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

#include<string.h>
int map[100][100];
int main(){
	int n,m,i,a,b,j,sum;
	scanf("%d%d",&n,&m);
	memset(map,0,sizeof(map));
	for(i=0;i<m;i++){
		scanf("%d%d",&a,&b);
		map[a][b]++;
		map[b][a]++;
	}
	for(i=1;i<=n;i++){
		sum=0;
		for(j=1;j<=n;j++){
			sum+=map[i][j];
		}
		printf("%d\n",sum);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'scanf' was not declared in this scope
    5 |         scanf("%d%d",&n,&m);
      |         ^~~~~
a.cc:17:17: error: 'printf' was not declared in this scope
   17 |                 printf("%d\n",sum);
      |                 ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include<string.h>
  +++ |+#include <cstdio>
    2 | int map[100][100];
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
	int m, n;int a[55];
	ios::sync_with_stdio;
	while (cin >> m >> n) {
		memset(a, 0, sizeof(a));
		for (int i = 0; i < n; i++) {
			int aa, bb;
			cin >> aa >> bb;
			if (aa != bb) {
				a[aa]++;
				a[bb]++;
			}
		}
		for (int i = 1; i <= m; i++)
			cout << a[i] << endl;
	}
	return 0;
}

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

#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
	int m, n;int a[55];
	ios::sync_with_stdio;
	while (cin >> m >> n) {
		memset(a, 0, sizeof(a));
		for (int i = 0; i < n; i++) {
			int aa, bb;
			cin >> aa >> bb;
			a[aa]++;
			a[bb]++;
		}
		for (int i = 1; i <= m; i++)
			cout << a[i] << endl;
	}
	return 0;
}

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

#include <iostream>
#include <vector>
#include <cstdint>

using namespace std;

int main()
{
	int_least32_t n, m;
	cin >> n >> m;

	vector<int_least32_t> v( n. 0 );
	int_least32_t a, b;
	for(auto& x : v) {
		cin >> a >> b;
		++v[a - 1];
		++v[b - 1];
	}

	for(auto$ x : v) {
		cout << x << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:37: error: expected unqualified-id before numeric constant
   12 |         vector<int_least32_t> v( n. 0 );
      |                                     ^
a.cc:20:13: error: 'auto$' was not declared in this scope; did you mean 'auto'?
   20 |         for(auto$ x : v) {
      |             ^~~~~
      |             auto
a.cc:23:1: error: expected primary-expression before '}' token
   23 | }
      | ^
a.cc:22:10: error: expected ';' before '}' token
   22 |         }
      |          ^
      |          ;
   23 | }
      | ~         
a.cc:23:1: error: expected primary-expression before '}' token
   23 | }
      | ^
a.cc:22:10: error: expected ')' before '}' token
   22 |         }
      |          ^
      |          )
   23 | }
      | ~         
a.cc:20:12: note: to match this '('
   20 |         for(auto$ x : v) {
      |            ^
a.cc:23:1: error: expected primary-expression before '}' token
   23 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
	int m, n;int a[55];
	ios::sync_with_stdio;
	cin >> m >> n;
	memset(a, 0, sizeof(a));
	for (int i = 0; i < n; i++) {
		int aa, bb;
		cin >> aa >> bb;
	    a[aa]++;
	    a[bb]++;
	}
	for (int i = 1; i <= m; i++)
		cout << a[i] << endl;
	return 0;
}

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

#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;
int a[1000];
int main()
{
	int m, n;
	cin >> m >> n;
	memset(a, 0, sizeof(a));
	for (int i = 0; i < n; i++) {
		int aa, bb;
		cin >> aa >> bb;
		if (aa != bb) {
			a[aa]++;
			a[bb]++;
		}
	}
	for (int i = 1; i <= m; i++)
		cout << a[i] << endl;
	//system("pause");
	return 0;
}

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

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

int main(void)
{
    int n, m, *ccnt, cnt;

    scanf("%d %d", &n, &m);
    ccnt = (int)malloc(sizeof(int) * n);

    memset(ccnt, 0, m);

    for(cnt = 0; cnt < m; cnt++)
    {
        scanf("%d %d", a, b);
        ccnt[a - 1] +=1;
        ccnt[b - 1] +=1;
    }

    for(cnt = 0; cnt < n;cnt++)
    {
        printf("%d\n", ccnt[cnt]);
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: cast from 'void*' to 'int' loses precision [-fpermissive]
    9 |     ccnt = (int)malloc(sizeof(int) * n);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:9:12: error: invalid conversion from 'int' to 'int*' [-fpermissive]
    9 |     ccnt = (int)malloc(sizeof(int) * n);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |            |
      |            int
a.cc:11:5: error: 'memset' was not declared in this scope
   11 |     memset(ccnt, 0, m);
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <stdlib.h>
  +++ |+#include <cstring>
    3 | 
a.cc:15:24: error: 'a' was not declared in this scope
   15 |         scanf("%d %d", a, b);
      |                        ^
a.cc:15:27: error: 'b' was not declared in this scope
   15 |         scanf("%d %d", a, b);
      |                           ^
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <cstdlib>
using namespace std;
int a[1000];
int main()
{
	int m, n;
	cin >> m >> n;
	memset(a, 0, sizeof(a));
	for (int i = 0; i < n; i++) {
		int aa, bb;
		cin >> aa >> bb;
		a[aa]++;
		a[bb]++;
	}
	for (int i = 1; i <= m; i++)
		cout << a[i] << endl;
	return 0;
}

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

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

using namespace std;
int main()
{
	int i, j = 0;
	int N, M = 0;
	int A[50] = {};
	int a, b = 0;

	cin >> N;
    cin >> M;

	for (i = 0; i <= M-1; i++) {
		cin >> a;
		cin >> b;
		A[a-1] += 1;
		A[b-1] += 1;
	}

	for (j = 0; j <= N-1; j++) {

		printf("%d\n", A[j]);
	}

	cin >> i;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin >> N;
      |         ^~~
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 |
Language: C

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

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C

include<stdio.h>                                                               
int main(void){

  int n,m,a[100],b[100],i,j,count;

  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++){;
    scanf("%d %d",&a[i],&b[i]);
  }

  count = 0;

  for(i=0;i<n;i++){
    count = 0;
    for(j=0;j<m;j++){
      if(a[j]==i+1){
	count = count + 1;
      }
      if(b[j]==i+1){
	count = count + 1;
      }
    }
      printf("%d\n",count);
  }
    return 0;
}




Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C

#include<stdio.h>
int main(void){
 int n, m;
 int i;
 int a, b;
 int city[1000] = {0};

 scanf("%d%d",&n,&m);
 for(i = 0;i < N; ++i){
  scanf("%d%d", &a, &b);
  city[a] += 1;
  city[b] += 1;
 }
 for(i = 1;i <= m; i++) printf("%d\n", city[i]);
 return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:16: error: 'N' undeclared (first use in this function)
    9 |  for(i = 0;i < N; ++i){
      |                ^
main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main() {
  int N, M;
  cin >> N >> M;
  int a[M], b[M];
  for (int i = 0; i < M; i++) {
    cin >> a[i] >> b[i];
  }

  int c[M];
  for (int i = 0; i < M; i++) c[i] = 0;
  
  for (int i = 0; i < M; i++) {
    if (a[i] == i+1) c[i]++;
    if (b[i] == i+1) c[i]++;
  }

  for (int i = 0; i < M; i++) {
    c[i] /= 2
  }

  for (int i = 0; i < M; i++) {
    cout << c[i] << endl;
  }
  
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: expected ';' before '}' token
   22 |     c[i] /= 2
      |              ^
      |              ;
   23 |   }
      |   ~
Language: C++

#include <cstdio>
#include <cstring>
#include <iostream>
#include <set>
#include <vector>

using namespace std;
#define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl;
#define sci(x) int x;scanf("%d",&x);
#define scii(x, y) int x,y;scanf("%d%d",&x,&y);
#define REP(i,y) for(int i=0;i<(int)(y);i++)
#define REPP(i,y) for(int i=1;i<=(int)(y);i++)
vector<int> vec;

int main() {
  scii(N,M)
  REP(_,M) {
    scii(a,b);
    vec.push_back(a);
    vec.push_back(b);
  }
  REPP(i,N) {
    cout << count(vec.begin(), vec.end(), i) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'count' was not declared in this scope
   23 |     cout << count(vec.begin(), vec.end(), i) << endl;
      |             ^~~~~
Language: C++

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

using namespace std;
int main(int argc, char* argv[]) {
	int n, m; cin >> n >> m;
	vector<int> a, b;
	for (int i = 0; i < m; i++) {
		int aa, bb; cin >> aa >> bb;
		a.pushback(aa);
		b.pushback(bb);
	}
	vector<int> ans;
	for (int i = 0; i < n; i++) {
		ans.pushback(0);
	}
	for (int i = 0; i < m; i++) {
		ans[a[i] - 1]++;
		ans[b[i] - 1]++;
	}
	for (auto x : ans) {
		cout << x << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:11:19: error: 'class std::vector<int>' has no member named 'pushback'; did you mean 'push_back'?
   11 |                 a.pushback(aa);
      |                   ^~~~~~~~
      |                   push_back
a.cc:12:19: error: 'class std::vector<int>' has no member named 'pushback'; did you mean 'push_back'?
   12 |                 b.pushback(bb);
      |                   ^~~~~~~~
      |                   push_back
a.cc:16:21: error: 'class std::vector<int>' has no member named 'pushback'; did you mean 'push_back'?
   16 |                 ans.pushback(0);
      |                     ^~~~~~~~
      |                     push_back
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include<iomanip>

using namespace std;


int main() {
	vector<int> load;

	int n, m;
	int s, e;

	cin >> n >> m;

	load.resize(n);
	for (int& v : load) {
		v = 0;
	}

	while (cin >> s >> e) {
		load[s - 1]++;
		load[e - 1]++;
	}

	for (int i = 0; i < n; i++) {
		cout << load[i] << endl;
	}

	

	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:36:18: error: expected '}' at end of input
   36 |         return 0;
      |                  ^
a.cc:12:12: note: to match this '{'
   12 | int main() {
      |            ^
Language: C

/*ABC*/
#include<stdio.h>
int main(){
  int n,m;
  scanf("%d %d",&n,&m);
  int a[m],b[m],ans[n];
  int i;
  for(i=0;i<n;i++){
    ans[i]=0;
  }
  for(i=0;i<m;i++){
    scanf("%d %d",a[i],b[i]);
    ans(a[i])++;
    ans(b[i])++;
  }
  for(i=0;i<n;i++){
    printf("%d\n",ans[i]);
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:13:5: error: called object 'ans' is not a function or function pointer
   13 |     ans(a[i])++;
      |     ^~~
main.c:6:17: note: declared here
    6 |   int a[m],b[m],ans[n];
      |                 ^~~
main.c:14:5: error: called object 'ans' is not a function or function pointer
   14 |     ans(b[i])++;
      |     ^~~
main.c:6:17: note: declared here
    6 |   int a[m],b[m],ans[n];
      |                 ^~~
Language: C++

#include <stdio.h>

void main(){
  int n,m;
  int road[100];
  for(int i =0; i < 100; i++){
    road[i] = 0;
  }
  scanf("%d%d", &n, &m);
  for(int i =0; i < m; i++){
    int a,b;
    scanf("%d%d", &a, &b);
    road[a-1]++;
    road[b-1]++;
  }
  for(int i =0; i < n; i++){
    printf("%d\n", road[i]);
  }
}


Compiler output:
a.cc:3:1: error: '::main' must return 'int'
    3 | void main(){
      | ^~~~
Language: C

/*ABC*/
#include<stdio.h>
int main(){
  int n,m;
  scanf("%d %d",&n,&m);
  int a[m],b[m],ans[n];
  for(int i=0;i<n;i++){
    ans[i]=0;
  }
  for(i=0;i<m;i++){
    scanf("%d %d",a[i],b[i]);
    ans(a[i])++;
    ans(b[i])++;
  }
  for(i=0;i<n;i++){
    printf("%d\n",ans[i]);
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:10:7: error: 'i' undeclared (first use in this function)
   10 |   for(i=0;i<m;i++){
      |       ^
main.c:10:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:5: error: called object 'ans' is not a function or function pointer
   12 |     ans(a[i])++;
      |     ^~~
main.c:6:17: note: declared here
    6 |   int a[m],b[m],ans[n];
      |                 ^~~
main.c:13:5: error: called object 'ans' is not a function or function pointer
   13 |     ans(b[i])++;
      |     ^~~
main.c:6:17: note: declared here
    6 |   int a[m],b[m],ans[n];
      |                 ^~~
Language: C++

#include<stdio.h>
int main()
{
int N,M;
int a[50],b[50],town[50];
int i;
scanf("%d %d",&N,&M);
for(i=0;i<M;i++)
scanf_n("%d %d",&a[i],&b[i]);
for(i=0;i<M;i++)
{
town[a[i]]++;
town[b[i]]++;
}
for(i=0;i<M;i++)
printf("%d\n",town[i]);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:1: error: 'scanf_n' was not declared in this scope; did you mean 'scanf'?
    9 | scanf_n("%d %d",&a[i],&b[i]);
      | ^~~~~~~
      | scanf
Language: C++

int main() {
	int N, M, a, b, R[50] = { 0 };
	scanf("%d %d", &N, &M);
	for (int i = 0; i < M; i++) {
		scanf("%d %d", &a, &b);
		R[a - 1]++;
		R[b - 1]++;
	}
	for (int i = 0; i < N; i++)
		printf("%d\n", R[i]);
	while (true);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'scanf' was not declared in this scope
    3 |         scanf("%d %d", &N, &M);
      |         ^~~~~
a.cc:10:17: error: 'printf' was not declared in this scope
   10 |                 printf("%d\n", R[i]);
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main() {
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define ist istream_iterator
#define ost ostream_iterator

ll const inf = 100 * 1000;
int const N = (1 << 17) + 16;


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

  int n, m;
  vector<int> cnt(n+1);
  for(int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    a[x]++;
    a[y]++;
  }

  copy_n(a.begin()+1, n, ostream_iterator<int>(cout, "\n"));
  cout << flush;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'a' was not declared in this scope
   22 |     a[x]++;
      |     ^
a.cc:26:10: error: 'a' was not declared in this scope
   26 |   copy_n(a.begin()+1, n, ostream_iterator<int>(cout, "\n"));
      |          ^
Language: C++

#include <iostream>
#include <map>
#include <numeric>

int main()
{
	int n, m;

	std::cin >> n >> m;

	std::vector<std::vector<int> > v(n, std::vector<int>(n, 0));

	for (int i = 0; i < m; i++) {
		int a, b;

		std::cin >> a >> b;
		a--;
		b--;
		v[a][b] = 1;
		v[b][a] = 1;
	}

	for (int i = 0; i < n; i++) {
		std::cout << std::accumulate(v[i].begin(), v[i].end(), 0) << std::endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: 'vector' is not a member of 'std'
   11 |         std::vector<std::vector<int> > v(n, std::vector<int>(n, 0));
      |              ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <numeric>
  +++ |+#include <vector>
    4 | 
a.cc:11:26: error: 'vector' is not a member of 'std'
   11 |         std::vector<std::vector<int> > v(n, std::vector<int>(n, 0));
      |                          ^~~~~~
a.cc:11:26: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:11:33: error: expected primary-expression before 'int'
   11 |         std::vector<std::vector<int> > v(n, std::vector<int>(n, 0));
      |                                 ^~~
a.cc:19:17: error: 'v' was not declared in this scope
   19 |                 v[a][b] = 1;
      |                 ^
a.cc:24:46: error: 'v' was not declared in this scope
   24 |                 std::cout << std::accumulate(v[i].begin(), v[i].end(), 0) << std::endl;
      |                                              ^
Language: C++

#include <string>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

using ll = long long int;

int arr[60];

int main() {

	int n, m;
	cin >> n >> m;

	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;

		arr[a]++;
		arr[b]++;
	}

	for (int i = 1; i <= n; i++) {
		cout << arr[i] << endl;
	}

}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'cin' was not declared in this scope
   15 |         cin >> n >> m;
      |         ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <map>
  +++ |+#include <iostream>
    5 | 
a.cc:26:17: error: 'cout' was not declared in this scope
   26 |                 cout << arr[i] << endl;
      |                 ^~~~
a.cc:26:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:26:35: error: 'endl' was not declared in this scope
   26 |                 cout << arr[i] << endl;
      |                                   ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <map>
  +++ |+#include <ostream>
    5 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define r(i,n) for(int i=0;i<n;i++)
int main(){
  int n,m;
  cin>>n>>m;
  int a[n]={};
  while(m--){
    int q,w;
    cin>>q>>w;
    a[q-1]++;
    q[w-1]++;
  }
  for(int i=0;i<n;i++)
    cout<<a[i]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:6: error: invalid types 'int[int]' for array subscript
   14 |     q[w-1]++;
      |      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 int H, W;
 int seen[10000][10000];
  char S[10000][10000];
vector<pair<ll, ll>> prime_factorize(ll n) { //素因数分解と各素数の個数
    vector<pair<ll, ll>> res;

    for (ll i = 2; i * i <= n; i++)
    {
        if (n % i != 0)
        {
            continue;
        }
        int num = 0;
        
        while (n % i == 0)
        {
            ++num;
            n /= i;
        }
        res.push_back(make_pair(i, num));
       
    }
     if (n != 1) 
        {
            res.push_back(make_pair(n, 1));
        }
        return res;
        
} 
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll lcm(ll x, ll y) {
    return x / GCD(x, y) * y;//先に割り算をして掛けられる数を小さくして掛け算を行う
}
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

void dfs(int st, int fi) {
  //  cout << st << " " << fi <<  endl;
    if (st < 0 || fi < 0 || st >= H || fi >= W)
    {
        return ;
    }
    if (S[st][fi] == '#')
    {
        return ;
    }

    if (seen[st][fi] == 1)
    {
        return ;
    }
    
    
    if (S[st][fi] == '.')
    {
        seen[st][fi] = 1;
    }
    

    dfs(st + 1, fi);
    dfs(st, fi + 1);
    dfs(st, fi - 1);
    dfs(st - 1, fi);
    
}
int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> a(N), b(N);
    vector<pair<ll, ll>> pa(N);
    for(ll i = 0; i < N; i++) {
        cin >> a[i] >> b[i];
        pa.push_back(make_pair(a[i], b[i]));
    }

    map<ll, ll> p;

    for(ll i = 0; i < N; i++) {
        p[a[i]] += b[i];
    }

    
    ll sum = 0;
    ll ans = 0;
    sort(pa.begin(), pa.end());
    for(ll i = 0; i < N; i++) {
        sum += pa.second;
        if(sum >= K) { ans = pa.first; cout << ans << endl; return 0; }
        
    }

    cout << ans << endl;
 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:114:19: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
  114 |         sum += pa.second;
      |                   ^~~~~~
a.cc:115:33: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
  115 |         if(sum >= K) { ans = pa.first; cout << ans << endl; return 0; }
      |                                 ^~~~~
Language: C++

/*Allah Vorosha*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define n_p next_permutation
#define p_p prev_permutation
#define in insert
#define rev reverse
#define pf push_front
#define pob pop_back
#define uniq(v)         v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define all(x) (x).begin(),(x).end()
#define pof pop_front
#define ios ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define scn scanf
#define prt printf
#define rep(i, a, n) for(int i = a; i < n; i++)
#define mod 1000000007
#define yes cout << "YES\n"
#define no cout << "NO\n";
#define take for(auto &it : a) cin >> it;
#define out cout << a << "\n";
#define l_b lower_bound
#define u_b upper_bound
#define Max 100005
template<typename T> T mymax(T x, T y) {
    return (x > y ? x : y);
}

using namespace std;

const int N = 1e5 + 5;

ll cnt[N];

void solve() {
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n), b(n);
    int mx = -1;
    for(int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        cnt[a[i]] += (ll)b[i];
        mx = max(mx, a[i]);
    }
    int mx = *max_element(all(a));
    for(int i = 1; i <= mx; i++) {
        k -= cnt[i];
        if(k <= 0) {
            cout << i << '\n'; return;
        }
    }
}

int main() {

    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:49:9: error: redeclaration of 'int mx'
   49 |     int mx = *max_element(all(a));
      |         ^~
a.cc:43:9: note: 'int mx' previously declared here
   43 |     int mx = -1;
      |         ^~
Language: C++

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

#define plong pair<long,long>;

int main(){
  int N;cin>>N;
  long K;cin>>K;
  vector<plong> A(N);
  for(int i=0;i<N;i++){
    long X,Y;cin>>X>>Y;
    A.at(i)=make_pair(X,Y);
  }
  sort(A.begin(),A.end());
  int X=0;
  long count=0;
  int ans=1;
  while(true){
    while(true){
      if(A.at(X).first!=ans) break;
      count+=A.at(X).second;
      if(count>=K) break;
      X++;
    }
    if(count>=K) break;
    ans++;
  }
  cout<<ans<<endl;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:4:15: error: template argument 1 is invalid
    4 | #define plong pair<long,long>;
      |               ^~~~~~~~~~~~~~~
a.cc:9:10: note: in expansion of macro 'plong'
    9 |   vector<plong> A(N);
      |          ^~~~~
a.cc:4:15: error: template argument 2 is invalid
    4 | #define plong pair<long,long>;
      |               ^~~~~~~~~~~~~~~
a.cc:9:10: note: in expansion of macro 'plong'
    9 |   vector<plong> A(N);
      |          ^~~~~
a.cc:9:15: error: expected primary-expression before '>' token
    9 |   vector<plong> A(N);
      |               ^
a.cc:9:17: error: 'A' was not declared in this scope
    9 |   vector<plong> A(N);
      |                 ^
Language: C++

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

#define pl pair<long,long>;

int main(){
  int N;cin>>N;
  long K;cin>>K;
  vector<pl> A(N);
  for(int i=0;i<N;i++){
    long X,Y;cin>>X>>Y;
    A.at(i)=make_pair(X,Y);
  }
  sort(A.begin(),A.end());
  int X=0;
  long count=0;
  int ans=1;
  while(true){
    while(true){
      if(A.at(X).first!=ans) break;
      count+=A.at(X).second;
      if(count>=K) break;
      X++;
    }
    if(count>=K) break;
    ans++;
  }
  cout<<ans<<endl;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:4:12: error: template argument 1 is invalid
    4 | #define pl pair<long,long>;
      |            ^~~~~~~~~~~~~~~
a.cc:9:10: note: in expansion of macro 'pl'
    9 |   vector<pl> A(N);
      |          ^~
a.cc:4:12: error: template argument 2 is invalid
    4 | #define pl pair<long,long>;
      |            ^~~~~~~~~~~~~~~
a.cc:9:10: note: in expansion of macro 'pl'
    9 |   vector<pl> A(N);
      |          ^~
a.cc:9:12: error: expected primary-expression before '>' token
    9 |   vector<pl> A(N);
      |            ^
a.cc:9:14: error: 'A' was not declared in this scope
    9 |   vector<pl> A(N);
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  long long N,K;cin>>N>>K;long long M=0;
  map<long long,long long>mp;
  for(int X=0;X<N;X++){
    int A,B;cin>>A>>B;
    map[A]+=B;
  }
  for(auto p:mp){
    long long A=p.first;long long B=p.second;M+=B;
    if(M>K){
      cout<<A<<emdl;break;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: conflicting declaration 'auto A'
    8 |     map[A]+=B;
      |         ^
a.cc:7:9: note: previous declaration as 'int A'
    7 |     int A,B;cin>>A>>B;
      |         ^
a.cc:8:11: error: expected initializer before '+=' token
    8 |     map[A]+=B;
      |           ^~
a.cc:13:16: error: 'emdl' was not declared in this scope
   13 |       cout<<A<<emdl;break;
      |                ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  long long N,K;cin>>N>>K;long long M=0;
  map<long long,long long>mp;
  for(int X=0;X<N;X++){
    int A,B;cin>>A>>B;
    map[A]+=B;
  }
  for(auto p:mp){
    long long A=p.first;long long B=p.second;M+=B;
    if(M>K)
      cout<<A<<emdl;break;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: conflicting declaration 'auto A'
    8 |     map[A]+=B;
      |         ^
a.cc:7:9: note: previous declaration as 'int A'
    7 |     int A,B;cin>>A>>B;
      |         ^
a.cc:8:11: error: expected initializer before '+=' token
    8 |     map[A]+=B;
      |           ^~
a.cc:13:16: error: 'emdl' was not declared in this scope
   13 |       cout<<A<<emdl;break;
      |                ^~~~
Language: C++

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

using pl pair<long,long>;

int main(){
  long N,K;cin>>N>>K;
  vector<pl> A(N);
  for(int i=0;i<N;i++){
    long X,Y;cin>>X>>Y;
    A.at(i)=make_pair(X,Y);
  }
  sort(A.begin(),A.end());
  int X=0;
  long count=0;
  int ans=1;
  while(true){
    while(true){
      if(S.at(X).first!=ans) break;
      count+=S.at(X).second;
      if(count>=K) break;
      X++;
    }
    if(count>=K) break;
    ans++;
  }
  cout<<ans<<endl;
}
  

Compiler output:
a.cc:4:7: error: expected nested-name-specifier before 'pl'
    4 | using pl pair<long,long>;
      |       ^~
a.cc: In function 'int main()':
a.cc:8:10: error: 'pl' was not declared in this scope
    8 |   vector<pl> A(N);
      |          ^~
a.cc:8:12: error: template argument 1 is invalid
    8 |   vector<pl> A(N);
      |            ^
a.cc:8:12: error: template argument 2 is invalid
a.cc:11:7: error: request for member 'at' in 'A', which is of non-class type 'int'
   11 |     A.at(i)=make_pair(X,Y);
      |       ^~
a.cc:13:10: error: request for member 'begin' in 'A', which is of non-class type 'int'
   13 |   sort(A.begin(),A.end());
      |          ^~~~~
a.cc:13:20: error: request for member 'end' in 'A', which is of non-class type 'int'
   13 |   sort(A.begin(),A.end());
      |                    ^~~
a.cc:19:10: error: 'S' was not declared in this scope
   19 |       if(S.at(X).first!=ans) break;
      |          ^
a.cc:20:14: error: 'S' was not declared in this scope
   20 |       count+=S.at(X).second;
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll INF = 1e12;
const ll MOD = 1000000000 + 7;
#define PB push_back
#define PF push_front
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<ll>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define mii map<int, int>
#define mci map<char, int>
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pr_d(x) cout << fixed << setprecision(15) << x << endl
#define ud(c, x) distance(c.begin(), upper_bound(all(c), x))
#define ld(c, x) distance(c.begin(), lower_bound(all(c), x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep3(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep4(i, a, b) for (int i = (a); i > (b); --i)
#define pb push_back
#define out(x) cout << x << "\n"
bool odd(int i) { return i % 2; }

#define all(v) v.begin(), v.end()
#define size(x) int(x.size())

int gcd(int a, int b) { return __gcd(a, b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
void Yes_No(bool f) {
  if (f)
    printf("Yes\n");
  else
    printf("No\n");
}
void YES_NO(bool f) {
  if (f)
    printf("YES\n");
  else
    printf("NO\n");
}

template <typename T>
void deb1(T x) {
  cout << "debug: " << x << "\n";
}

template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
//-------------------ここから回答する-----------------------

void solve(void) {
  ll n, k;
  cin >> n >> k;
  vll a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];
  mll mp;
  rep(i, n) mp[a[i]] += b[i];
  ll cta = 0;
  for (auto i : mp) {
    cta += i.se;
    if (cta >= k) {
      out(i.fi);
      return;
    }
  }
}
int main(void) { solve(); }


Compiler output:
a.cc: In function 'void solve()':
a.cc:81:3: error: 'mll' was not declared in this scope; did you mean 'll'?
   81 |   mll mp;
      |   ^~~
      |   ll
a.cc:82:13: error: 'mp' was not declared in this scope
   82 |   rep(i, n) mp[a[i]] += b[i];
      |             ^~
a.cc:84:17: error: 'mp' was not declared in this scope
   84 |   for (auto i : mp) {
      |                 ^~
Language: C++

10 500000
1 100000
1 100000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 10 500000
      | ^~
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;
typedef long long ll;

const int maxn = 200010;

lll n,m,k,cnt;
ll bas[maxn],a[maxn],b[maxn],arr[maxn],pre[maxn];

ll read(){ ll s=0,f=1; char ch=getchar(); while(ch<'0' || ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0' && ch<='9'){ s=s*10+ch-'0'; ch=getchar(); } return s*f; }

int main(){
	memset(bas,0,sizeof(bas));
	m = 0, cnt = 0;
	n = read(), k=read();
	for(int i=1;i<=n;i++)
	{
		a[i] = read(), b[i] = read(); 
		m = max(m,a[i]);
		bas[a[i]] += b[i];
	}
	
	for(int i=1;i<=m;i++){
		if(bas[i]!=0) arr[++cnt] = i;
	}
	
	for(int i=1;i<=cnt;i++){
		pre[i] = bas[arr[i]];
		pre[i] += pre[i-1];
	}
	
	sort(arr+1,arr+cnt+1);

	for(int i=1;i<=cnt;i++){
		if(pre[i]>=k){
			printf("%d\n",arr[i]);
			break;
		}
	}

//	for(int i=1;i<=cnt;i++){
//		printf("%d ",pre[i]);
//	}printf("\n");
//	for(int i=1;i<=cnt;i++){
//		printf("%d ",bas[arr[i]]);
//	}printf("\n");

	return 0;
}

Compiler output:
a.cc:13:1: error: 'lll' does not name a type; did you mean 'll'?
   13 | lll n,m,k,cnt;
      | ^~~
      | ll
a.cc: In function 'int main()':
a.cc:20:9: error: 'm' was not declared in this scope; did you mean 'tm'?
   20 |         m = 0, cnt = 0;
      |         ^
      |         tm
a.cc:20:16: error: 'cnt' was not declared in this scope; did you mean 'int'?
   20 |         m = 0, cnt = 0;
      |                ^~~
      |                int
a.cc:21:9: error: 'n' was not declared in this scope; did you mean 'yn'?
   21 |         n = read(), k=read();
      |         ^
      |         yn
a.cc:21:21: error: 'k' was not declared in this scope
   21 |         n = read(), k=read();
      |                     ^
Language: C++

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

int main() {
  ll n,k;
  cin >> n >> k;
  vector<pair<ll,ll>> vec;
  rep(i,n){
    ll x,y;
    cin >> x >> y;
    vec.push_back(make_pair(x,y));
  }
  sort(vec.begin(),vec.end());
  ll now=0;
  rep(i,n){
    now+=vec[i].second;
    if(k<=now) {
      cout << vec[i].first << endl;
      break;
    }
  }
    
}


Compiler output:
a.cc:6:4: error: expected ';' before 'main'
    6 | int main() {
      |    ^~~~~
      |    ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll n,k;
  cin >> n >> k;
  vector<pair<ll,ll>> vec;
  rep(i,n){
    ll x,y;
    cin >> x >> y;
    vec.push_back(make_pair(x,y));
  }
  sort(vec.begin(),vec.end());
  ll now=0;
  rep(i,n){
    now+=vec[i].second;
    if(k<=now) {
      cout << vec[i].first << endl;
      break;
    }
  }
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'll' was not declared in this scope
    6 |   ll n,k;
      |   ^~
a.cc:7:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin >> n >> k;
      |          ^
      |          yn
a.cc:7:15: error: 'k' was not declared in this scope
    7 |   cin >> n >> k;
      |               ^
a.cc:8:20: error: template argument 1 is invalid
    8 |   vector<pair<ll,ll>> vec;
      |                    ^~
a.cc:8:20: error: template argument 2 is invalid
a.cc:10:7: error: expected ';' before 'x'
   10 |     ll x,y;
      |       ^~
      |       ;
a.cc:11:12: error: 'x' was not declared in this scope
   11 |     cin >> x >> y;
      |            ^
a.cc:11:17: error: 'y' was not declared in this scope
   11 |     cin >> x >> y;
      |                 ^
a.cc:12:9: error: request for member 'push_back' in 'vec', which is of non-class type 'int'
   12 |     vec.push_back(make_pair(x,y));
      |         ^~~~~~~~~
a.cc:14:12: error: request for member 'begin' in 'vec', which is of non-class type 'int'
   14 |   sort(vec.begin(),vec.end());
      |            ^~~~~
a.cc:14:24: error: request for member 'end' in 'vec', which is of non-class type 'int'
   14 |   sort(vec.begin(),vec.end());
      |                        ^~~
a.cc:15:5: error: expected ';' before 'now'
   15 |   ll now=0;
      |     ^~~~
      |     ;
a.cc:17:5: error: 'now' was not declared in this scope; did you mean 'pow'?
   17 |     now+=vec[i].second;
      |     ^~~
      |     pow
a.cc:17:13: error: invalid types 'int[int]' for array subscript
   17 |     now+=vec[i].second;
      |             ^
a.cc:19:18: error: invalid types 'int[int]' for array subscript
   19 |       cout << vec[i].first << endl;
      |                  ^
Language: Java


import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long k = sc.nextInt();
    HashMap<Integer, Long> map = new HashMap<Integer, Long>();
    for(int i = 0; i < n; i++) {
      int a = sc.nextInt();
      long b = sc.nextLong();
      if(map.containsKey(a)) {
        map.put(a, map.get(a) + b);
      } else {
        map.put(a, b);
      }
    }
    ArrayList<Integer> list = map.keySet();
    Collections.sort(list);
    int ans = 0;
    for(int i = 0; i < list.size(); i++) {
      int key = list.get(i);
      k -= map.get(key);
      if(k <= 0) {
        ans = key;
        break;
      }
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:19: error: incompatible types: Set<Integer> cannot be converted to ArrayList<Integer>
    ArrayList<Integer> list = map.keySet();
                                        ^
1 error
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;

int main() {
    ll N, K;
    cin >> N >> K;

    ll A(N), B(N);
    rep(i, N) {
        cin >> A[i] >> B[i];
    }

    int i = 0;
    while (K > 0) {
        K -= B[i];
        i++;
    }
    cout << A[i - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: invalid types 'll {aka long long int}[int]' for array subscript
   14 |         cin >> A[i] >> B[i];
      |                 ^
a.cc:14:25: error: invalid types 'll {aka long long int}[int]' for array subscript
   14 |         cin >> A[i] >> B[i];
      |                         ^
a.cc:19:15: error: invalid types 'll {aka long long int}[int]' for array subscript
   19 |         K -= B[i];
      |               ^
a.cc:22:14: error: invalid types 'll {aka long long int}[int]' for array subscript
   22 |     cout << A[i - 1] << endl;
      |              ^
Language: Java

import java.util.*;

public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long k = sc.nextLong();
        Map<Integer, Long> map = new TreeMap<>();
        for (int i = 0; i < n; i++) {
            int key = sc.nextInt();
            long value = sc.nextLong();
            long count = map.getOrDefault(key, 0 );
            map.put(key, value + count);
        }

        for (Map.Entry<Integer, Long> e : map.entrySet()) {
            if (k > e.getValue()) {
                k -= e.getValue();
            } else {
                System.out.println(e.getKey());
                return;
            }
        }
    }
}

Compiler output:
Main.java:12: error: incompatible types: int cannot be converted to Long
            long count = map.getOrDefault(key, 0 );
                                               ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  const int nmax = 100100;
  int n,k;
  int m[nmax];
  cin >> n >> k;
  rep(i,n){
    int a,b;
    cin >> a >> b;
    m[a] += b;
  }

  int ans;

  for (int i = 1; i <= AMAX; ++i){
    if(k<=m[i]){
      cout << i << endl;
      return 0;
    }
    k -= m[i];
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: 'AMAX' was not declared in this scope
   20 |   for (int i = 1; i <= AMAX; ++i){
      |                        ^~~~
Language: C++

#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long int;
const int INF = 1000000000;
const int LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

const int M = 1e5 + 5;
int main(void)
{
    int N, K;
    cin >> N >> K;

    vector<int> list(M, 0);
    int value, cnt;
    for (int i = 0; i < N; i++)
    {
        cin >> value >> cnt;
        list[value] += cnt;
    }

    int ans = 0;
    for (int i = 0; i < M; i++)
    {
        if (list[i] > 0)
        {
            K -= list[i];
            if (K <= 0)
            {
                ans = i;
                break;
            }
        }
    }
    cout << ans << "\n";
    return (0);
}

Compiler output:
a.cc:4:19: error: declaration does not declare anything [-fpermissive]
    4 | typedef long long int;
      |                   ^~~
a.cc:6:18: warning: overflow in conversion from 'long int' to 'int' changes value from '1000000000000000000' to '-1486618624' [-Woverflow]
    6 | const int LINF = 1000000000000000000; //1e18
      |                  ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <stdio.h>
#include <iostream>
 
int main(void)
{
  long long n, k;
  long long a, b;
  const int AMAX = 100000;
  long long cnt1[AMAX + 1];
  long long cnt2[AMAX + 1];
  long long c = 0;
  long long t = 1;
  
  std::cin >> n >> k;
  
  for(long long i = 0; i < n; i++)
  {
    std::cin >> a >> b;
    cnt1[c] = a;
    cnt2[c++] = b; 
  }
  
  for(long long j = 0; j < (c-1); j++)
  {
    if(J == (c-2) && t <= k)
    {
      std::cout << cnt1[j] << std::endl;
      break;
    }
    else if(	t <= k && (t + cnt2[j+1]) > k)
    {
      std::cout << cnt1[j] << std::endl;
      break;
    }
    
    t += cnt2[j];
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:8: error: 'J' was not declared in this scope
   25 |     if(J == (c-2) && t <= k)
      |        ^
Language: C++

#include <stdio.h>
#include <iostream>
 
int main(void)
{
  long long n, k;
  long long a, b;
  const int AMAX = 100000;
  long long cnt[AMAX + 1];
  long long c = 0;
  long long t = 0;
  
  std::cin >> n >> k;
  
  for(long long i = 0; i < n; i++)
  {
    std::cin >> a >> b;
    cnt1[c] = a;
    cnt2[c++] = b; 
  }
  
  for(long long j = 0; j < c; j++)
  {
    if(	cnt2[j] <= k && cnt2[j+1] > k)
    {
      std::cout << cnt1[j] << std::endl;
      break;
    }
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'cnt1' was not declared in this scope; did you mean 'cnt'?
   18 |     cnt1[c] = a;
      |     ^~~~
      |     cnt
a.cc:19:5: error: 'cnt2' was not declared in this scope; did you mean 'cnt'?
   19 |     cnt2[c++] = b;
      |     ^~~~
      |     cnt
a.cc:24:9: error: 'cnt2' was not declared in this scope; did you mean 'cnt'?
   24 |     if( cnt2[j] <= k && cnt2[j+1] > k)
      |         ^~~~
      |         cnt
a.cc:26:20: error: 'cnt1' was not declared in this scope; did you mean 'cnt'?
   26 |       std::cout << cnt1[j] << std::endl;
      |                    ^~~~
      |                    cnt
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
#define SWAP(x,y,z) {if ( y > z ) swap(y,z); if ( x > y ) swap(x,y); if (y > z) swap(y,z);}
typedef long long ll;
typedef unsigned long long ull;
 
double const eps = 1e-6;
double const pi = 3.1415926535;
ll const mod = 1e9+7;
 
ll a[100005];
 
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
    int n;
    ll k;
    cin >> n >> k;
    for ( int i = 1; i <= n; i++ )
    {
        int x,y;
        cin >> x >> y;
        a[x] += y;
    }
 
    for ( int i = 1; i <= 100000; i++ )
    {
        if ( k-a[i] <= 0 )
        {
            cout << i << '\n';
            break;
        }
         k -= a[i];
    }
 

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

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

int main(){
    ll n;
    ll k;
    cin>>n>>k;
    vector<pair<int,int>>c(n);
    rep(i,n){
        cin>>c[i].first>>c[i].second;

    }
    sort(c.begin(),c.end());
    
    int ans;

    for(int i=1;i<n;i++){
        if(c[i].second>k){
            ans=c[i-1].first;
            break;
    }
    cout<<ans<<endl;

}

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

#include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define ll long long

ll l1[100005];

int main()
{
    ll n,m;
    cin>>n>>m;
    ll a,b,y=0,x=0;
    for(int i=1;i<=n;i++){
        cin>>a>>b;
        x+=b;
        //if(x>=m&&y==0)y=a;
        l1[a]+=b;
    }
    for(int i=1;i<=100000;i++){
        if(k<=l1[i]){
            cout<<i<<endl;return 0;
        }
        k-=l1[i];
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:12: error: 'k' was not declared in this scope
   20 |         if(k<=l1[i]){
      |            ^
a.cc:23:9: error: 'k' was not declared in this scope
   23 |         k-=l1[i];
      |         ^
Language: C++

#include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define ll long long

ll l1[55];

int main()
{
    ll n,m;
    cin>>n>>m;
    ll a,b,y=0,x=0;
    for(int i=1;i<=n;i++){
        cin>>a>>b;
        x+=b;
        if(x>=m&&y=0)y=a;
    }
    cout<<y<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: lvalue required as left operand of assignment
   16 |         if(x>=m&&y=0)y=a;
      |            ~~~~^~~
Language: C++

    #include <stdio.h>
    #include <iostream>
    #include <iomanip>
    #include <vector>
    #include <cstdlib>
    #include <cmath>
    #include <numeric>
    #include <algorithm>
    #include <sstream>
    #include <string>
    #include <map>
    #include <set>
    #include <stack>
    #include <deque>
    using namespace std;
     
    using ll=long long;
    const int AMAX=100000;
    ll cnt[AMAX+1];
     
    int main(void){
      int N;
      ll K;
      cin>>N>>K;
      for(int i=0;i<N;++i) {
        int A, B;
        cin>>A>>B;
        cnt[A]+=B;
      }
      for(int ans=1; ans<=AMAX;++ans){
        if(K<=cnt[ans]) {
          cout<<ans<<endl;
          break;
        }
        K-=cnt[ans];
      }
      
      return0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:38:7: error: 'return0' was not declared in this scope
   38 |       return0;
      |       ^~~~~~~