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

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <vector>

using namespace std;
#define REP2(i,m,n) for(int i=(int)(m);i<(int)n;i++)
#define REP(i,n) REP2(i,0,n)
int main() {
	int W, H, N;
	while (cin >> W >> H >> N && W) {
		vector<int> X(2 * N), Y(2 * N);
		REP(i, 2 * N)cin >> X[i] >> Y[i];
		X.push_back(W);
		Y.push_back(0);
		X.push_back(W);
		Y.push_back(H);

		vector<double> Ys1, Ys2;
		REP(i, X.size())REP(j, i)if (X[i] != X[j]) {
			double y = Y[i] - (double)(Y[j] - Y[i]) / (X[j] - X[i])*X[i];
			if (y<0 || y>H) {
				continue;
			}
			Ys1.push_back(y);
		}
		Ys1.push_back(0);
		Ys1.push_back(H);
		sort(Ys1.begin(), Ys1.end());
		Ys1.erase(unique(Ys1.begin(), Ys1.end()), Ys1.end());

		double res = 0;
		REP(i, Ys1.size() - 1) {
			Ys2.clear();

			double y = (Ys1[i + 1] + Ys1[i]) / 2;
			REP(j, 2 * N) {
				Ys2.push_back(y + (Y[j] - y) / X[j] * W);
			}
			sort(Ys2.begin(), Ys2.end());
			double h = (min((double)H, Ys2[H]) - (max(0.0, Ys2[N - 1])));
			res += (Ys1[i + 1] - Ys1[i])*max(0, 0, h);
		}
		prinf("%.10lf\n", res / H / W);
	}
	return;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:17: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   61 |                 prinf("%.10lf\n", res / H / W);
      |                 ^~~~~
      |                 printf
a.cc:63:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   63 |         return;
      |         ^~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = double]':
a.cc:59:36:   required from here
   59 |                         res += (Ys1[i + 1] - Ys1[i])*max(0, 0, h);
      |                                                      ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#define pb       push_back
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
 
const double EPS=1e-11;
 
int main(){
    for(int W,H,n;scanf("%d%d%d",&W,&H,&n),W;){
        n*=2;
        int x[200],y[200];
        rep(i,n) scanf("%d%d",x+i,y+i);
 
        vector<double> y1;
        y1.pb(0);
        y1.pb(H);
        rep(i,n){
            double y_tmp;
 
            if(x[i]<W){
                y_tmp=(double)(y[i]-0)/(x[i]-W)*(0-W)+0;
                if(0<=y_tmp && y_tmp<=H) y1.pb(y_tmp);
 
                y_tmp=(double)(y[i]-H)/(x[i]-W)*(0-W)+H;
                if(0<=y_tmp && y_tmp<=H) y1.pb(y_tmp);
            }
 
            rep(j,i) if(x[i]!=x[j]) {
                y_tmp=(double)(y[i]-y[j])/(x[i]-x[j])*(0-x[j])+y[j];
                if(0<=y_tmp && y_tmp<=H) y1.pb(y_tmp);
            }
        }
 
        sort(y1.begin(),y1.end());
 
        double ans=0,y2[202];
        rep(i,y1.size()-1) if(y1[i+1]-y1[i]>EPS) {
            double y_mid=(y1[i]+y1[i+1])/2;
            rep(j,n){
                y2[j]=(y_mid-y[j])/(0-(x[j]+EPS))*(W-x[j])+y[j];
                if(y2[j]<0) y2[j]=0;
                if(y2[j]>H) y2[j]=H;
            }
            y2[n]=0;
            y2[n+1]=H;
            sort(y2,y2+n+2);
            ans+=(y1[i+1]-y1[i])*(y2[(n+2)/2]-y2[(n+2)/2-1]);
        }
        ans/=H*H;
        printf("%.10f\n",ans);
    }
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:19: error: 'scanf' was not declared in this scope
    9 |     for(int W,H,n;scanf("%d%d%d",&W,&H,&n),W;){
      |                   ^~~~~
a.cc:14:9: error: 'vector' was not declared in this scope
   14 |         vector<double> y1;
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | #define pb       push_back
a.cc:14:16: error: expected primary-expression before 'double'
   14 |         vector<double> y1;
      |                ^~~~~~
a.cc:15:9: error: 'y1' was not declared in this scope; did you mean 'y'?
   15 |         y1.pb(0);
      |         ^~
      |         y
a.cc:34:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   34 |         sort(y1.begin(),y1.end());
      |         ^~~~
      |         short
a.cc:50:9: error: 'printf' was not declared in this scope
   50 |         printf("%.10f\n",ans);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #define pb       push_back
Language: Java

import java.util.*;
public class main {
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    int m = kbd.nextInt();
	    int n = kbd.nextInt();
	    if(m!=0 && n!=0){
		int c;
		int max=0;
		for(int i=0; i<m; i++){
			c=0;
			for(int j=0; j<n; j++){
			    int x =kbd.nextInt();
			    if(x==1) c++;
			}
			if(c>max) max = c;
		}
		System.out.println(max);
	    }
	}
    }
}

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

#include <stdio.h>
int main(void) {
int i, j, m, n, a, max=0;
int m[21]={0};
scanf("%d%d",&m,&n);
for(i=0;i<m;i++) {
for(j=0;j<n;j++){
scanf("%d",&a);
m[i]+=a;
}
if(max<m[i]) max=m[i];
}
printf("%d\n",max);
return(0);
}

Compiler output:
main.c: In function 'main':
main.c:4:5: error: conflicting types for 'm'; have 'int[21]'
    4 | int m[21]={0};
      |     ^
main.c:3:11: note: previous declaration of 'm' with type 'int'
    3 | int i, j, m, n, a, max=0;
      |           ^
Language: C

	int tmp=0;
	
	scanf("%d %d",&m,&n);
	for(j=0;j<m;j++){
		for(i=0;i<n;i++){
			scanf("%d ",&str[i][j]);
		}
	}
	for(j=0;j<m;j++){
		for(i=0;i<n;i++){
			tmp += str[i][j];
		}
		if(tmp>max) max = tmp;
		tmp = 0;
	}
	printf("%d\n",max);
	
	return 0;
}

Compiler output:
main.c:3:15: error: expected declaration specifiers or '...' before string constant
    3 |         scanf("%d %d",&m,&n);
      |               ^~~~~~~
main.c:3:23: error: expected declaration specifiers or '...' before '&' token
    3 |         scanf("%d %d",&m,&n);
      |                       ^
main.c:3:26: error: expected declaration specifiers or '...' before '&' token
    3 |         scanf("%d %d",&m,&n);
      |                          ^
main.c:4:9: error: expected identifier or '(' before 'for'
    4 |         for(j=0;j<m;j++){
      |         ^~~
main.c:4:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    4 |         for(j=0;j<m;j++){
      |                  ^
main.c:4:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    4 |         for(j=0;j<m;j++){
      |                      ^~
main.c:9:9: error: expected identifier or '(' before 'for'
    9 |         for(j=0;j<m;j++){
      |         ^~~
main.c:9:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    9 |         for(j=0;j<m;j++){
      |                  ^
main.c:9:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    9 |         for(j=0;j<m;j++){
      |                      ^~
main.c:16:16: error: expected declaration specifiers or '...' before string constant
   16 |         printf("%d\n",max);
      |                ^~~~~~
main.c:16:23: error: unknown type name 'max'
   16 |         printf("%d\n",max);
      |                       ^~~
main.c:18:9: error: expected identifier or '(' before 'return'
   18 |         return 0;
      |         ^~~~~~
main.c:19:1: error: expected identifier or '(' before '}' token
   19 | }
      | ^
Language: C

#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int M,N,a[20]={0},s;
  cin >> M >> N;
  for(int i=0;i<M;i++){
    for(int j=0;j<N;j++){
      cin >> s;
      if(s==1){
	a[i]++;
      }
    }
  }
  int max=0;
  for(int i=0;i<M;i++){
    if(a[i]>max)max=a[i];
  }
  cout << max << endl;
}

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

#include <bits/stdc++.h>
#define r(i,a,n) for(int i=a;i<n;i++)
using namespace std;
main(){
  int n,m,s=0,c;
  cin>>n>>m;
  r(i,n){int k=0; 
    r(j,m)if(cin>>c&&c)k++;
    s=max(s,k);
  }cout<<s<<endl;
}

Compiler output:
a.cc:7:8: error: macro "r" requires 3 arguments, but only 2 given
    7 |   r(i,n){int k=0;
      |        ^
a.cc:2:9: note: macro "r" defined here
    2 | #define r(i,a,n) for(int i=a;i<n;i++)
      |         ^
a.cc:8:10: error: macro "r" requires 3 arguments, but only 2 given
    8 |     r(j,m)if(cin>>c&&c)k++;
      |          ^
a.cc:2:9: note: macro "r" defined here
    2 | #define r(i,a,n) for(int i=a;i<n;i++)
      |         ^
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'r' was not declared in this scope
    7 |   r(i,n){int k=0;
      |   ^
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int main(void){

int n,m,ans;

while(cin >> n >> m){
ans=0;
for(int i=0;i<n;i++){
int sum=0;
for(int j=0;j<m;j++){
int in;
cin >> in;
sum+=m;
}
ans=max(ans.sum);
}
cout << ans << endl;
}

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: request for member 'sum' in 'ans', which is of non-class type 'int'
   19 | ans=max(ans.sum);
      |             ^~~
Language: Java

import java.util.*;
public class Main {
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    String n = kbd.next();
	    if(n.length()!=0){
		String[] c = new String[n.length()];
		int i;
		int count = 0;
		for(i=0; i<n.length(); i++){
		    c[i] = n.substring(i, i+1);
		    //System.out.println(c[i]);
		}
		//System.out.println();

		if(c[c.length/2].equals("(") || c[c.length/2].equals(")")) {
		    count++;	
		    // System.out.println("a");
		}

		for(i=0; i<c.length/2; i++){
		    if(!check(c[i], c[c.length-i-1])) {
			count++;
			//System.out.println("b"+i);
		    }
		}

		System.out.println(count);
	    }
	}
    }

    static boolean check(String a, String b){
	if(a.equals("(")){
	    if(!b.equals(")")) return false;   
	}
	else if(a.equals(")"){ 
		if(!b.equals("(")) return false;   
	}
	else{
	    if(!a.equals(b)) return false;
	}
	return true;
    }
}

Compiler output:
Main.java:38: error: ')' expected
	else if(a.equals(")"){ 
	                     ^
1 error
Language: C++

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

using namespace std;

int main(){
	string iwi;
	int d = 0;

	cin >> iwi;
	for (int i = 0; i <= iwi.length << 1; i++){
		switch (iwi.at(i)){
		case 'i':
			if (iwi.at(iwi.length - i - 1) == 'i'){
				d++;
			}
			break;
		case 'w':
			if (iwi.at(iwi.length - i - 1) == 'w'){
				d++;
			}
			break;
		case '(':
			if (iwi.at(iwi.length - i - 1) == ')'){
				d++;
			}
			break;
		case ')':
			if (iwi.at(iwi.length - i - 1) == '('){
				d++;
			}
			break;
		}
	}
	printf("%d", d);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:34: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   12 |         for (int i = 0; i <= iwi.length << 1; i++){
      |                              ~~~~^~~~~~
      |                                        ()
a.cc:15:40: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   15 |                         if (iwi.at(iwi.length - i - 1) == 'i'){
      |                                    ~~~~^~~~~~
      |                                              ()
a.cc:20:40: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   20 |                         if (iwi.at(iwi.length - i - 1) == 'w'){
      |                                    ~~~~^~~~~~
      |                                              ()
a.cc:25:40: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   25 |                         if (iwi.at(iwi.length - i - 1) == ')'){
      |                                    ~~~~^~~~~~
      |                                              ()
a.cc:30:40: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   30 |                         if (iwi.at(iwi.length - i - 1) == '('){
      |                                    ~~~~^~~~~~
      |                                              ()
Language: C++

#include <iostream>

using namespace std;

bool CheckSymmetry(char a, char b){
	switch (a){
	case 'i':
	case 'w':
		if (b == a)return true;
		break;
	case '(':
		if (b == ')')return true;
		break;
	case ')':
		if (b == '(')return true;
		break;
	default:
		return false;
	}
	return false;
}

int main(){
	char Loader[11];
	cin >> Loader;

	int length = strlen(Loader);
	int cnt = 0;
	for (int i = 0; i <length/2; ++i){
		if (!CheckSymmetry(Loader[i],Loader[length-i-1]))++cnt;
	}
	if (length % 2 == 1 && (Loader[(length + 1) / 2] != '('
		|| Loader[(length + 1) / 2] != ')'))
		++cnt;

	cout << cnt << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:22: error: 'strlen' was not declared in this scope
   27 |         int length = strlen(Loader);
      |                      ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++


#include<string.h>
using namespace std;
int main(){
  int i;
  string moji;
  cin >> moji;
  int count=0;
  int len = moji.size();
 
  for(i = 0; i < len/2; i++){
    char A,B;
    A=moji[i];
    B=moji[len-i-1];
    
    if(A=='i'&& B=='i')continue;
    if(A=='w' && B=='w')continue;
    if(A=='(' && B==')')continue; 
    if(A==')' && B=='(')continue;
  count++;
  }
  if(len%2==1){
    if(moji[len/2]!='i'&&moji[len/2]!='w')count++;
  }
  cout << count << endl; 
  return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope
    6 |   string moji;
      |   ^~~~~~
a.cc:3:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    2 | #include<string.h>
  +++ |+#include <string>
    3 | using namespace std;
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> moji;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<string.h>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:7:10: error: 'moji' was not declared in this scope
    7 |   cin >> moji;
      |          ^~~~
a.cc:25:3: error: 'cout' was not declared in this scope
   25 |   cout << count << endl;
      |   ^~~~
a.cc:25:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:20: error: 'endl' was not declared in this scope
   25 |   cout << count << endl;
      |                    ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<string.h>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include <iostream>
using namespace std;

const int MAX_SIZE = 10;

int calc(char s[]) {
  int c = 0, l = strlen(s);
  if (l % 2) {
    if (s[l / 2 + 1] <= ')') c++;
  }
  for (int i = 0; i < l / 2; ++i) {
    if (s[i] <= ')') {
      if (abs(s[i] - s[l - i - 1]) != 1) c++;
    } else {
      if (s[i] != s[l - i - 1]) c++;
    }
  }
  return c;
}

int main() {
  char s[MAX_SIZE + 1];
  cin >> s;
  cout << calc(s) << endl;
}

Compiler output:
a.cc: In function 'int calc(char*)':
a.cc:7:18: error: 'strlen' was not declared in this scope
    7 |   int c = 0, l = strlen(s);
      |                  ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <iostream>
using namespace std;
   
map<char, char> sym;
   
void init() {
  sym['i'] = 'i';
  sym['w'] = 'w';
  sym['('] = ')';
  sym[')'] = '(';
}
   
int main() {
  init();
     
  string str;
  getline(cin, str);
     
  int n = str.size();
  int cnt = 0;
  for(int i=0; i<n/2+1; i++) {
    if(sym[str[i]] != str[n-i-1]) cnt ++;
    str[n-i-1] = sym[str[i]];
  }
  cout << cnt << endl;
     
  return 0;
}

Compiler output:
a.cc:4:1: error: 'map' does not name a type
    4 | map<char, char> sym;
      | ^~~
a.cc: In function 'void init()':
a.cc:7:3: error: 'sym' was not declared in this scope
    7 |   sym['i'] = 'i';
      |   ^~~
a.cc: In function 'int main()':
a.cc:22:8: error: 'sym' was not declared in this scope
   22 |     if(sym[str[i]] != str[n-i-1]) cnt ++;
      |        ^~~
a.cc:23:18: error: 'sym' was not declared in this scope
   23 |     str[n-i-1] = sym[str[i]];
      |                  ^~~
Language: C++

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

char str[17];

/*
i" x "i"
"w" x "w"
"(" x ")"
")" x "("
"{" x "}"
"}" x "{"
"[" x "]"
"]" x "["
*/
int taisyo( char p, char q ){
	if( p == 'i' && q == 'i' )
		return 1;
	if( p == 'w' && q == 'w' )
		return 1;
	if( p == '(' && q == ')' )
		return 1;
	if( p == ')' && q == '(' )
		return 1;
	if( p == '{' && q == '}' )
		return 1;
	if( p == '}' && q == '{' )
		return 1;
	if( p == '[' && q == ']' )
		return 1;
	if( p == ']' && q == '[' )
		return 1;
	return 0;
}

int main(){
	int i,j;
	scanf("%s",str);
	
	int len = strlen(str);
	int ans = 0;
	
	for( i = 0; i < (1<<len); i++ ){
		int use[17];
		char substr[17];
		int cnt = 0;
		for( j = 0; j < len; j++ ){
			use[j] = ( (i)>>(j) )%2; 
		}
		
		for( j = 0; j < len; j++ ){
			if( use[j] ){
				substr[cnt++] = str[j];
			}
		}
		substr[cnt] = '\0';
		
		//printf("%s\n",substr);
		
		for( j = 0; j < cnt; j++ ){
			if( !taisyo( substr[j], substr[cnt-j-1] ) )
				break;
		}
		if( j < cnt ){
			break;
		}
		
		//iwiを含まないとだめ
		if( strstr(substr,iwi) == NULL )
			break;
			
		if( ans < cnt ){
			ans = cnt;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:35: error: 'iwi' was not declared in this scope
   69 |                 if( strstr(substr,iwi) == NULL )
      |                                   ^~~
Language: C++

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

int maxv;
string str;

bool match(char l, char r){
  if ( l == '[' ) return r == ']';
  if ( l == ']' ) return r == '[';
  if ( l == '(' ) return r == ')';
  if ( l == ')' ) return r == '(';
  if ( l == '{' ) return r == '}';
  if ( l == '}' ) return r == '{';
  assert(false);
}

bool isParin(string s){
  if ( s.size()%2==0 || s.size() < 3) return false;
  int c = s.size()/2;
  if ( !(s[c-1] == 'i' && s[c] == 'w' && s[c+1] == 'i') ) return false;

  for ( int i = 0; i < s.size()/2-1; i++ ){
    char left = s[i];
    char right = s[s.size()-i-1];
    if ( !match(left, right) ) return false;
  }
  return true;
}

void rec(int pos, string cur){
  if ( pos == str.size() ){
    if ( isParin(cur) ){
      maxv = max(maxv, (int)cur.size());
    }
    return;
  }

  rec(pos+1, cur + str[pos]);
  rec(pos+1, cur);

}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: Java


	//@2262  Stopping Problem
	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

		String s = reader.readLine();
		String[] sp = s.split(" ");
		int ymax = Integer.parseInt(sp[0]);
		int xmax = Integer.parseInt(sp[1]);
		
		String[] map = new String[ymax];
		
		for(int y = 0; y < ymax; y++) {
			map[y] = reader.readLine();
		}
//		map[0] = "6>--v.";
//		map[1] = ".^--_@";
		
		reader.close();
		
		int x = 0;
		int y = 0;
		int xx = 1;
		int yy = 0;
		int v = 0;
		
		for(int step = 0;; step++) {
			if (step > 1000*1000*40) { // 1000*1000*1000=19.98
				System.out.printf("NO\n"); // â~µÈ¢
				break;
			}
			char c = map[y].charAt(x);
//			System.out.printf("%d %c\n", v, c);
			
			if (c == '@') {
				System.out.printf("YES\n"); // â~
				break;
			}
			else if ("0123456789".indexOf(c) >= 0) {
				v = "0123456789".indexOf(c);
			}
			else {
				if (c == '?') {
					// _
					int r = (int)Math.floor(Math.random() * 4);
					c = "<>^v".charAt(r);
				}
				switch(c) {
				case '<':
					xx = -1;
					yy = 0;
					break;
				case '>':
					xx = 1;
					yy = 0;
					break;
				case '^':
					xx = 0;
					yy = -1;
					break;
				case 'v':
					xx = 0;
					yy = 1;
					break;
				case '_':
					if (v == 0) {
						xx = 1;
						yy = 0;
					}
					else {
						xx = -1;
						yy = 0;
					}
					break;
				case '|':
					if (v == 0) {
						xx = 0;
						yy = 1;
					}
					else {
						xx = 0;
						yy = -1;
					}
					break;
				case '+':
					v = (v + 1) % 16;
					break;
				case '-':
					v = (v + 15) % 16;
					break;
				case '.':
					break;
				default:
					assert false;
				}
			}
			x = (x + xx + xmax) % xmax;
			y = (y + yy + ymax) % ymax;
		}			
	}
}

Compiler output:
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
	public static void main(String[] args) throws IOException {
	              ^
  (use --enable-preview to enable unnamed classes)
Main.java:102: error: class, interface, enum, or record expected
}
^
2 errors
Language: C

#include<iostream>
#include<utility>
#include<stack>
using namespace std;

typedef pair<int,int> P;
typedef pair<P,P> P2;

int main(){
  int r,c;
  string grid[30];
  bool v[30][30][4][20];
  int dx[] = {1,0,-1,0} , dy[] = {0,1,0,-1};
  bool f = false;

  cin >> r >> c;
  for(int i=0;i<r;i++){
    cin >> grid[i];
    for(int j=0;j<c;j++)
      for(int k=0;k<4;k++)
	for(int l=0;l<16;l++)v[i][j][k][l] = false;
  }

  v[0][0][0][0] = true;
  stack<P2> q;
  q.push(P2(P(0,0),P(0,0)));

  while(q.size()){
    P2 p = q.top(); q.pop();
    int y = p.first.first, x = p.first.second;
    int d = p.second.first, m = p.second.second;

    for(;;){
      if(grid[y][x] == '?'){
	for(int i=0;i<4;i++){
	  int ty = (y+dy[i])%r, tx = (x+dx[i])%c;
	  if(v[ty][tx][i][m])continue;
	  v[ty][tx][i][m] = true;
	  q.push(P2(P(ty,tx),P(i,m)));
	}
	break;
      }else if(grid[y][x] == '@'){
	f = true;
	break;
      }else{
	if(grid[y][x] == '>')d = 0;
	else if(grid[y][x] == 'v')d = 1;
	else if(grid[y][x] == '<')d = 2;
	else if(grid[y][x] == '^')d = 3;
	else if(grid[y][x] == '_'){
	  if(m)d = 2;
	  else d = 0;
	}
	else if(grid[y][x] == '|'){
	  if(m)d = 3;
	  else d = 1;
	}
	else if(grid[y][x] == '+')m = (m+1)%16;
	else if(grid[y][x] == '-')m = (m+15)%16;
	else if(grid[y][x] != '.')m = grid[y][x] - '0';
	
	y = (y+dy[d])%r; x = (x+dx[d])%c;
	if(v[y][x][d][m])break;
	v[y][x][d][m] = true;
      }
    }
    if(f)break;
  }

  if(f)cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

#include<iostream>
#include<utility>
#include<stack>
using namespace std;

typedef pair<int,int> P;
typedef pair<P,P> P2;

int main(){
  int r,c;
  string grid[30];
  bool v[30][30][4][20];
  int dx[] = {1,0,-1,0} , dy[] = {0,1,0,-1};
  bool f = false;

  cin >> r >> c;
  for(int i=0;i<r;i++){
    cin >> grid[i];
    for(int j=0;j<c;j++)
      for(int k=0;k<4;k++)
	for(int l=0;l<16;l++)v[i][j][k][l] = false;
  }

  v[0][0][0][0] = true;
  stack<P2> q;
  q.push(P2(P(0,0),P(0,0)));

  while(q.size()){
    P2 p = q.front(); q.pop();
    int y = p.first.first, x = p.first.second;
    int d = p.second.first, m = p.second.second;
    int ty,tx;

    if(grid[y][x] == '.'){
      ty = (y+dy[d])%r; tx = (x+dx[d])%c;
      if(v[ty][tx][d][m])continue;
      v[ty][tx][d][m] = true;
      q.push(P2(P(ty,tx),P(d,m)));
    }
    else if(grid[y][x] == '>'){
      d = 0;
      ty = (y+dy[d])%r; tx = (x+dx[d])%c;
      if(v[ty][tx][d][m])continue;
      v[ty][tx][d][m] = true;
      q.push(P2(P(ty,tx),P(d,m)));
    }
    else if(grid[y][x] == 'v'){
      d = 1;
      ty = (y+dy[d])%r; tx = (x+dx[d])%c;
      if(v[ty][tx][d][m])continue;
      v[ty][tx][d][m] = true;
      q.push(P2(P(ty,tx),P(d,m)));
    }
    else if(grid[y][x] == '<'){
      d = 2;
      ty = (y+dy[d])%r; tx = (x+dx[d])%c;
      if(v[ty][tx][d][m])continue;
      v[ty][tx][d][m] = true;
      q.push(P2(P(ty,tx),P(d,m)));
    }
    else if(grid[y][x] == '^'){
      d = 3;
      ty = (y+dy[d])%r; tx = (x+dx[d])%c;
      if(v[ty][tx][d][m])continue;
      v[ty][tx][d][m] = true;
      q.push(P2(P(ty,tx),P(d,m)));
    }
    else if(grid[y][x] == '?'){
      for(int i=0;i<4;i++){
	ty = (y+dy[i])%r; tx = (x+dx[i])%c;
	if(v[ty][tx][i][m])continue;
	v[ty][tx][i][m] = true;
	q.push(P2(P(ty,tx),P(i,m)));
      }
    }
    else if(grid[y][x] == '_'){
      if(m)d = 2;
      else d = 0;
      ty = (y+dy[d])%r; tx = (x+dx[d])%c;
      if(v[ty][tx][d][m])continue;
      v[ty][tx][d][m] = true;
      q.push(P2(P(ty,tx),P(d,m)));
    }
    else if(grid[y][x] == '|'){
      if(m)d = 3;
      else d = 1;
      ty = (y+dy[d])%r; tx = (x+dx[d])%c;
      if(v[ty][tx][d][m])continue;
      v[ty][tx][d][m] = true;
      q.push(P2(P(ty,tx),P(d,m)));
    }
    else if(grid[y][x] == '+'){
      m = (m+1)%16;
      ty = (y+dy[d])%r; tx = (x+dx[d])%c;
      if(v[ty][tx][d][m])continue;
      v[ty][tx][d][m] = true;
      q.push(P2(P(ty,tx),P(d,m)));
    }
    else if(grid[y][x] == '-'){
      m = (m+15)%16;
      ty = (y+dy[d])%r; tx = (x+dx[d])%c;
      if(v[ty][tx][d][m])continue;
      v[ty][tx][d][m] = true;
      q.push(P2(P(ty,tx),P(d,m)));
    }else if(grid[y][x] == '@'){
      f = true;
      break;
    }
    else{
      m = grid[y][x] - '0';
      ty = (y+dy[d])%r; tx = (x+dx[d])%c;
      if(v[ty][tx][d][m])continue;
      v[ty][tx][d][m] = true;
      q.push(P2(P(ty,tx),P(d,m)));
    }
  }

  if(f)cout << "YES" << endl;
  else cout << "NO" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: 'class std::stack<std::pair<std::pair<int, int>, std::pair<int, int> > >' has no member named 'front'
   29 |     P2 p = q.front(); q.pop();
      |              ^~~~~
Language: C++

#include <iostream>

using namespcae std;
int main()
{
string s;
while (cin >> s)
ceer << s << endl;
}

Compiler output:
a.cc:3:7: error: expected nested-name-specifier before 'namespcae'
    3 | using namespcae std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:1: error: 'string' was not declared in this scope
    6 | string s;
      | ^~~~~~
a.cc:6:1: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included 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:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:7:8: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 | while (cin >> s)
      |        ^~~
      |        std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:7:15: error: 's' was not declared in this scope
    7 | while (cin >> s)
      |               ^
a.cc:8:1: error: 'ceer' was not declared in this scope
    8 | ceer << s << endl;
      | ^~~~
a.cc:8:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    8 | ceer << s << endl;
      |              ^~~~
      |              std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
#include <queue>
#include <cctype>
#include <cassert>
#include <algorithm>
using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define DbgPass(a) cout<<"-- pass: "<< a << endl
#define DbgMap(m,r,c) rep(dbgI,r){rep(dbgJ,c){cout<<m[dbgI][dbgJ];}cout<<endl;}
#define makeMapFromInput(m,r,c) rep(sysI,r){rep(sysJ,c){cin>>m[sysI][sysJ];}cin.ignore();}

#define LEFT  0
#define UP    1
#define RIGHT 2
#define DOWN  3
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

char code[21][21];
int R, C;
bool visited[21][21][4][15];

struct State {
  int x,y,d,m;
  State();
  State(int xx, int yy, int dd, int mm)
    : x(xx),y(yy),d(dd),m(mm) {}
};

int getX(int xx) { return (xx+C)%C; }
int getY(int yy) { return (yy+R)%R; }

bool run() {
  queue<State> Q;
  State s = State(0,0,LEFT,0);
  Q.push(s);
  fill(visited[0][0][0], visited[21][0][0], false);
  
  State st, ne;
  
  while(!Q.empty()) {
    st = Q.front(); Q.pop();
    //DbgPass(code[st.y][st.x]);
    visited[st.x][st.y][st.d][st.m] = true;

    ne = st;
    switch(code[st.y][st.x]) {
    case '<': ne.d = LEFT;  break;
    case '^': ne.d = UP;    break;
    case '>': ne.d = RIGHT; break;
    case 'v': ne.d = DOWN;  break;
    case '.': ne.d = st.d;  break;
    case '@': return true;
    case '+': ne.m = (st.m+1)%16;  break;
    case '-': ne.m = (st.m+15)%16; break;
    case '_':
      if(st.m==0) ne.d = RIGHT;
      else ne.d = LEFT;
      break;
    case '|':
      if(st.m==0) ne.d = DOWN;
      else ne.d = UP;
      break;
    default:
      if(isdigit(code[st.y][st.x])) ne.m = code[st.y][st.x]-'0';
      else assert(1);
    }
    
    if(code[st.y][st.x]=='?') {
      for(int i=0; i<4; i++) {
	ne.x = getX(st.x+dx[i]), ne.y = getY(st.y+dy[i]), ne.d = i;
	if(!visited[ne.x][ne.y][ne.d][ne.m]) Q.push(ne);
      }
    }
    else {
      //DbgPass("move");
      ne.x = getX(st.x+dx[ne.d]), ne.y = getY(st.y+dy[ne.d]+R);
      if(!visited[ne.x][ne.y][ne.d][ne.m]) Q.push(ne);
    }
  }
  
  return false;
}

int main() {
  cin>>R>>C; cin.ignore();
  makeMapFromInput(code,R,C);
  //DbgMap(code,R,C);

  cout << ( run() ? "YES" : "NO" ) << endl;
  return 0;
}

Compiler output:
/usr/bin/ld: /tmp/ccQ7ZhZl.o: in function `run()':
a.cc:(.text+0xbd): undefined reference to `State::State()'
/usr/bin/ld: a.cc:(.text+0xcc): undefined reference to `State::State()'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <queue>
#include <cctype>
#include <cassert>
#include <algorithm>
using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define DbgPrint(a) cout<<"Debug: "<<a<<endl
#define DbgPass(a) cout<<"-- pass: "<< a << endl
#define DbgMap(m,r,c) rep(dbgI,r){rep(dbgJ,c){cout<<m[dbgI][dbgJ];}cout<<endl;}
#define makeMapFromInput(m,r,c) rep(sysI,r){rep(sysJ,c){cin>>m[sysI][sysJ];}cin.ignore();}

#define LEFT  0
#define UP    1
#define RIGHT 2
#define DOWN  3
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

char code[21][21];
int R, C;
bool visited[21][21][4][15];

struct State {
  int x,y,d,m;
  State();
  State(int xx, int yy, int dd, int mm)
    : x(xx),y(yy),d(dd),m(mm) {}
};

int getX(int xx) { return (xx+C)%C; }
int getY(int yy) { return (yy+R)%R; }

bool run() {
  queue<State> Q;
  State s = State(0,0,LEFT,0);
  Q.push(s);
  fill(visited[0][0][0], visited[21][0][0], false);

  int cnt=0;
  while(!Q.empty()) {
    if(cnt=>21*21*4*15) break;
    cnt++;

    State st = Q.front(); Q.pop();
    //DbgPass(code[st.y][st.x]);
    visited[st.x][st.y][st.d][st.m] = true;

    State ne = st;
    switch(code[st.y][st.x]) {
    case '<': ne.d = LEFT;  break;
    case '^': ne.d = UP;    break;
    case '>': ne.d = RIGHT; break;
    case 'v': ne.d = DOWN;  break;
    case '.': ne.d = st.d;  break;
    case '@': return true;
    case '+': ne.m = (st.m+1)%16;  break;
    case '-': ne.m = (st.m+15)%16; break;
    case '_':
      if(st.m==0) ne.d = RIGHT;
      else ne.d = LEFT;
      break;
    case '|':
      if(st.m==0) ne.d = DOWN;
      else ne.d = UP;
      break;
    default:
      if(isdigit(code[st.y][st.x])) ne.m = code[st.y][st.x]-'0';
      else assert(1);
    }
    
    if(code[st.y][st.x]=='?') {
      for(int i=0; i<4; i++) {
	ne.x = getX(st.x+dx[i]), ne.y = getY(st.y+dy[i]), ne.d = i;
	if(!visited[ne.x][ne.y][ne.d][ne.m]) Q.push(ne);
      }
    }
    else {
      //DbgPass("move");
      ne.x = getX(st.x+dx[ne.d]), ne.y = getY(st.y+dy[ne.d]);
      if(!visited[ne.x][ne.y][ne.d][ne.m]) Q.push(ne);
    }
  }
  
  return false;
}

int main() {
  cin>>R>>C; cin.ignore();
  makeMapFromInput(code,R,C);
  //DbgMap(code,R,C);
  //DbgPrint(21*21*4*16);
  cout << ( run() ? "YES" : "NO" ) << endl;
  return 0;
}

Compiler output:
a.cc: In function 'bool run()':
a.cc:44:12: error: expected primary-expression before '>' token
   44 |     if(cnt=>21*21*4*15) break;
      |            ^
Language: C++

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

const int MAX_H = 20;
const int MAX_W = 20;
const int MAX_M = 16;

int H, W;
string M[20];
bool vis[MAX_M][4][MAX_H][MAX_W];

bool run( int x, int y, int dir, int mem ) {
  
  if(vis[mem][dir][y][x]) return 0;
  vis[mem][dir][y][x] = 1;
  
  bool flag = 0;
  
  switch(M[y][x]) {
  case '<': dir = 0; break;
  case '>': dir = 2; break;
  case '^': dir = 1; break;
  case 'v': dir = 3; break;
  case '_': dir = ( mem ? 0 : 2 ); break;
  case '|': dir = ( mem ? 1 : 3 ); break;
  case '?': flag = 1; break;
  case '.': break;
  case '@': return 1;
  case '+': mem = ( mem + 1 ) % 16; break;
  case '-': mem = ( mem + 15 ) % 16; break;
  default:
    if(isdigit(M[y][x])) {
      mem = M[y][x]-'0';
    }
  }

  if(flag) {
    for(int i=0; i<4; i++) {
      if(run((x+dx[i])%W, (y+dy[i])%H, i, mem)) return 1;
    }
    return 0;
  }
  
  return run((x+dx[dir])%W, (y+dy[dir])%H, dir, mem);
}

int main() {
  
  cin >> H >> W;
  cin.ignore();
  
  for(int i=0; i<H; i++) getline(cin, M[i]);
  
  if(run(0, 0, 2, 0)) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}

Compiler output:
a.cc:9:1: error: 'string' does not name a type
    9 | string M[20];
      | ^~~~~~
a.cc: In function 'bool run(int, int, int, int)':
a.cc:19:10: error: 'M' was not declared in this scope
   19 |   switch(M[y][x]) {
      |          ^
a.cc:32:8: error: 'isdigit' was not declared in this scope
   32 |     if(isdigit(M[y][x])) {
      |        ^~~~~~~
a.cc: In function 'int main()':
a.cc:49:3: error: 'cin' was not declared in this scope
   49 |   cin >> H >> W;
      |   ^~~
a.cc:52:39: error: 'M' was not declared in this scope
   52 |   for(int i=0; i<H; i++) getline(cin, M[i]);
      |                                       ^
a.cc:52:26: error: 'getline' was not declared in this scope
   52 |   for(int i=0; i<H; i++) getline(cin, M[i]);
      |                          ^~~~~~~
a.cc:54:23: error: 'cout' was not declared in this scope
   54 |   if(run(0, 0, 2, 0)) cout << "YES" << endl;
      |                       ^~~~
a.cc:54:40: error: 'endl' was not declared in this scope
   54 |   if(run(0, 0, 2, 0)) cout << "YES" << endl;
      |                                        ^~~~
a.cc:55:8: error: 'cout' was not declared in this scope
   55 |   else cout << "NO" << endl;
      |        ^~~~
a.cc:55:24: error: 'endl' was not declared in this scope
   55 |   else cout << "NO" << endl;
      |                        ^~~~
Language: Java

import java.util.*;

public class Main2{

    void solve(){
        Scanner sc = new Scanner(System.in);

        int INF = 1000000000;

        int n = sc.nextInt();
        int[][] ab = new int[n][2];
        for(int i=0; i<n; i++){
            ab[i][0] = sc.nextInt();
            ab[i][1] = sc.nextInt();
        }

        Arrays.sort(ab, new Comparator<int[]>(){
                public int compare(int[] a, int[] b){
                    return a[1] - b[1];
                }
            });

        int[][] dp = new int[n+1][n+1];
        for(int i=0; i<=n; i++) Arrays.fill(dp[i],INF);
        for(int i=0; i<=n; i++) dp[i][0] = 0;
        for(int i=0; i<n; i++){
            for(int j=0; j<=i; j++){
                if(dp[i][j]+ab[i][0]<=ab[i][1]){
                    dp[i+1][j+1] = Math.min(dp[i][j]+ab[i][0],
                                            dp[i][j+1]);
                }
            }
        }

        int ans = 0;
        for(int i=0; i<=n; i++){
            if(dp[n][i]!=INF) ans = Math.max(ans,i);
        }

        System.out.println(ans);
    }

    public static void main(String[] args){
        new Main2().solve();
    }
}

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

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

int n;
class Data{
public:
    int a,b;
    bool operator<(const Data &d)const{
        return this->a<d.a;
    }
};
Data datas[1000001];

int main(){
    cin>>n;
    int ct=0;
    for(int i = 0; i < n; i++){
        cin>>datas[i].a>>datas[i].b;
        ct=max(ct,datas[i].b);
    }
    priority_queue<Data> pq;
    int idx=n-1;
    int cnt=0;
    while(1){
        if(ct==0||idx==-1)
            break;
        for(int i = idx; i >= 0; i--){
            if(datas[i].b==ct)
                pq.push(datas[i]);
            else{
                idx=i;
                break;
            }
            if(i==0)
                idx=-1;
        }
        if(pq.size()==0){
            // »ÝÉàÁÆàß¢àÌðâ[
            ct=datas[idx].b;
            for(int i = idx; i >= 0; i--){
                if(datas[i].b==ct)
                    pq.push(datas[i]);
                else{
                    idx=i;
                    break;
                }
                if(i==0)
                    idx=-1;
            }
            if(pq.size()==0)
                break;
        }
        bool ok=false;
        Data dd;
        while(pq.size()){
            Data &d=pq.top();
            if(d.b<ct){
                pq.pop();
                continue;
            }
            else{
                dd=pq.top();
                pq.pop();
                ok=true;break;
            }
        }
        if(!ok)
            break;
        ct-=dd.a;
        if(ct<0)
            break;
        cnt++;
    }
    cout<<cnt<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:27: error: binding reference of type 'Data&' to 'const __gnu_cxx::__alloc_traits<std::allocator<Data>, Data>::value_type' {aka 'const Data'} discards qualifiers
   59 |             Data &d=pq.top();
      |                     ~~~~~~^~
Language: C++

#include <queue>
#include <algorithm>
#include <cstdio>
main(){
	int i=0,n,a,b,s=0;
	std::vector<pair<int,int> >v;
	for(scanf("%d",&n);i<n;i++)scanf("%d%d",&a,&b),v.push_back(make_pair(b,a));
	std::sort(v.begin(),v.end());
	std::priority_queue<int>q;
	for(i=0;i<n;i++){
		s+=v[i].second;
		q.push(v[i].second);
		s>v[i].first?s-=q.top(),q.pop():1;
	}
	printf("%d\n",q.size());
}

Compiler output:
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:6:21: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    6 |         std::vector<pair<int,int> >v;
      |                     ^~~~
      |                     std::pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/deque:62,
                 from /usr/include/c++/14/queue:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: 'std::pair' declared here
   89 |     struct pair;
      |            ^~~~
a.cc:6:33: error: template argument 1 is invalid
    6 |         std::vector<pair<int,int> >v;
      |                                 ^
a.cc:6:33: error: template argument 2 is invalid
a.cc:6:35: error: expected unqualified-id before '>' token
    6 |         std::vector<pair<int,int> >v;
      |                                   ^
a.cc:7:56: error: 'v' was not declared in this scope
    7 |         for(scanf("%d",&n);i<n;i++)scanf("%d%d",&a,&b),v.push_back(make_pair(b,a));
      |                                                        ^
a.cc:7:68: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
    7 |         for(scanf("%d",&n);i<n;i++)scanf("%d%d",&a,&b),v.push_back(make_pair(b,a));
      |                                                                    ^~~~~~~~~
      |                                                                    std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:8:19: error: 'v' was not declared in this scope
    8 |         std::sort(v.begin(),v.end());
      |                   ^
Language: C++

#include <queue>
#include <algorithm>
#include <cstdio>
using namespace std;
main(){
	int i=0,n,a,b,s=0;
	vector<pair<int,int> >v;
	for(scanf("%d",&n);i<n;i++)scanf("%d%d",&a,&b),v.push_back(make_pair(b,a));
	sort(v.begin(),v.end());
	priority_queue<int>q;
	for(i=0;i<n;i++){
		s+=v[i].second;
		q.push(v[i].second);
		s>v[i].first?s-=q.top(),q.pop():1;
	}
	printf("%d\n",q.size());
}

Compiler output:
a.cc:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:14:49: error: second operand to the conditional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'void'
   14 |                 s>v[i].first?s-=q.top(),q.pop():1;
      |                                                 ^
Language: C++

/*
ÂmÂ[ÂhÂÃ° n/2 ÂÃÂÃ2ÂÃÂÃÂOÂÂÂ[ÂvÂÃÂÂªÂÂ¯ÂÃ©

  ÂOÂÂÂ[Âv1   ÂOÂÂÂ[Âv2
  ---------   ---------
          1           0
          2           5
          3           4

ÂÂ±ÂÃ2ÂÃÂÃÂOÂÂÂ[ÂvÂÃ°ÂÃÂÂºÂÃÂÂÂÃÂÃÂMÂUÂMÂUÂÃÂÃÂÃÂÂ°ÂÃ©ÂÃ1ÂpÂ^Â[ÂÂÂÃÂÂ«ÂÂ ÂÂªÂÃ©.
  0 -> 1 -> 5 -> 2 -> 4 -> 3

ÂÂ³ÂÃ§ÂÃ, ÂÂ±ÂÃÂpÂ^Â[ÂÂÂÃ°ÂÂ½ÂÂÂvÂÃ±ÂÃ¨ÂÃÂÂÂÃÂÃÂÃ±Â]ÂÂ³ÂÂ¹ÂÃÂÂ¢ÂÂ­ÂÃ,
  0 -> 1 -> 5 -> 2 -> 4 -> 3
  1 -> 2 -> 0 -> 3 -> 5 -> 4
  2 -> 3 -> 1 -> 4 -> 0 -> 5
ÂÃÂÃ°ÂÂ¤ÂLÂÂµÂÃÂÂ¢(n / 2)ÂÃÂÃÂSÂÃ¦ÂÃÂÃ°ÂÂ¾ÂÃ©ÂÂ±ÂÃÂÂªÂÃÂÂ«ÂÃ©.

n=ÂÃ´ÂÂÂÃÂÂ ÂÃ©ÂÃÂÂ«, ÂÂ±ÂÃÂ@ÂÂ¥ÂÃÂÂµÂÂ½ÂÂªÂÃÂÃÂSÂÃ¦ÂÃÂÃ°ÂgÂÃÂÃÂÂ¢ÂÃÂÂ½ÂÃªÂÂ,
ÂSÂÃ¦ÂÃÂÃÂgÂÃ­ÂÃÂÂ¢ÂÃ¦ÂÂ¤ÂÃÂÂ³ÂÃÂÃÂGÂbÂWÂÂª1ÂÃÂÃ ÂÂ­ÂÂ¶ÂÂµÂÃÂÂ¢.

ÂÂ±ÂÃÂÂ±ÂÃÂÂ©ÂÃ§, ÂÂ±ÂÃÂÃ»Â@ÂÂªÂÃªÂÃÂÂ½ÂÂ­ÂÂ³ÂÃ±ÂSÂÃ¦ÂÃÂÃ°ÂÃ¬ÂÃ©ÂÂ±ÂÃÂÂªÂÃÂÂ«ÂÃ©.


ÂÂÂÂ½ÂÃÂÂ
  ÂoÂÃÂÂªÂÂ½ÂÂ·ÂÂ¬ÂÃ©ÂÃÂ\ÂzÂÃÂÂ«ÂÃ©ÂÃªÂÂÂÃ, printfÂÃ°ÂgÂÂ¤

 */

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

int main(){
  int n, k;

  while(cin >> n >> k){
    if(n / 2 < k){
      printf("-1\n");
      //cout << "-1\n";
      continue;
    }

    int p[n + 2];
    p[0] = 0;

    for(int i = 1; i < n; i += 2){
      p[i] = i / 2 + 1;
      p[i + 1] = n - p[i];
    }

    for(int i = 0; i < k; i++){
      if(i != 0) puts("");

      for(int j = 0; j < n - 1; j++){
        int a = (p[j] + i) % n + 1;
        int b = (p[j + 1] + i) % n + 1;

        printf("%d %d\n", a, b);
        //cout << a << " " << b << endl;
      }

      puts(output);
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:12: error: 'output' was not declared in this scope
   63 |       puts(output);
      |            ^~~~~~
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

/* global variables */

ll as[MAX_N];

/* subroutines */

/* main */

int main() {
  int n;
  cin >> n;

  for (int i = 0; i < n; i++) cin >> as[i];
  sort(as, as + n, greater<int>());

  ll maxsum = 0;

  for (int i = 0; i < n - 2; i++)
    if (as[i] < as[i + 1] + as[i + 2]) {
      int sum = as[i] + as[i + 1] + as[i + 2];
      for (int j = i + 3; j < n - 2; j++)
	if (as[j] < as[j + 1] + as[j + 2]) {
	  maxsum = sum + as[j] + as[j + 1] + as[j + 2];
	  break;
	}
      if (maxsum > 0) break;
    }

  cout << maxsum << endl;
  
  return 0;
}

Compiler output:
a.cc:29:1: error: 'll' does not name a type
   29 | ll as[MAX_N];
      | ^~
a.cc: In function 'int main()':
a.cc:39:38: error: 'as' was not declared in this scope; did you mean 'abs'?
   39 |   for (int i = 0; i < n; i++) cin >> as[i];
      |                                      ^~
      |                                      abs
a.cc:40:8: error: 'as' was not declared in this scope; did you mean 'abs'?
   40 |   sort(as, as + n, greater<int>());
      |        ^~
      |        abs
a.cc:42:3: error: 'll' was not declared in this scope
   42 |   ll maxsum = 0;
      |   ^~
a.cc:49:11: error: 'maxsum' was not declared in this scope
   49 |           maxsum = sum + as[j] + as[j + 1] + as[j + 2];
      |           ^~~~~~
a.cc:52:11: error: 'maxsum' was not declared in this scope
   52 |       if (maxsum > 0) break;
      |           ^~~~~~
a.cc:55:11: error: 'maxsum' was not declared in this scope; did you mean 'fmaximum'?
   55 |   cout << maxsum << endl;
      |           ^~~~~~
      |           fmaximum