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


#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <vector>
using namespace std;
int a;
int b;
int c;
int d;
int e;
int f;
int time;
int main(){
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	if (a < 0){
		time += (0 - a)*c;
		a = 0;
	}
	if (a == 0){
		time += d;
		f = 1;
	}
	
	
	if (a >= 0){
		time += (b - a)*e;
	
	}
	
	cout << time << endl;

	return 0;
}

Compiler output:
a.cc:16:5: error: 'int time' redeclared as different kind of entity
   16 | int time;
      |     ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:24:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |                 time += (0 - a)*c;
      |                 ~~~~~^~~~~~~~~~~~
a.cc:24:22: error: assignment of read-only location 'time'
a.cc:28:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |                 time += d;
      |                 ~~~~~^~~~
a.cc:28:22: error: assignment of read-only location 'time'
a.cc:34:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                 time += (b - a)*e;
      |                 ~~~~~^~~~~~~~~~~~
a.cc:34:22: error: assignment of read-only location 'time'
Language: C++

#include <iostream>

using namespace std;
int a;
int b;
int c;
int d;
int e;
int f;
int time;
int main(){
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	if (a < 0){
		time += (0 - a)*c;
		a = 0;
	}
	if (a == 0){
		time += d;
		f = 1;
	}
	
	
	if (a >= 0){
		time += (b - a)*e;
	
	}
	
	cout << time << endl;

	return 0;
}

Compiler output:
a.cc:10:5: error: 'int time' redeclared as different kind of entity
   10 | int time;
      |     ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:18:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   18 |                 time += (0 - a)*c;
      |                 ~~~~~^~~~~~~~~~~~
a.cc:18:22: error: assignment of read-only location 'time'
a.cc:22:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   22 |                 time += d;
      |                 ~~~~~^~~~
a.cc:22:22: error: assignment of read-only location 'time'
a.cc:28:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |                 time += (b - a)*e;
      |                 ~~~~~^~~~~~~~~~~~
a.cc:28:22: error: assignment of read-only location 'time'
Language: C++

#include <iostream>

using namespace std;
int a;
int b;
int c;
int d;
int e;
int f;
int time;
int main(){
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	if (a < 0){
		time += (0 - a)*c;
		a = 0;
	}
	if (a == 0){
		time += d;
		f = 1;
	}


	if (a >= 0){
		time += (b - a)*e;

	}

	cout << time << endl;

	return 0;
}

Compiler output:
a.cc:10:5: error: 'int time' redeclared as different kind of entity
   10 | int time;
      |     ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:18:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   18 |                 time += (0 - a)*c;
      |                 ~~~~~^~~~~~~~~~~~
a.cc:18:22: error: assignment of read-only location 'time'
a.cc:22:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   22 |                 time += d;
      |                 ~~~~~^~~~
a.cc:22:22: error: assignment of read-only location 'time'
a.cc:28:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |                 time += (b - a)*e;
      |                 ~~~~~^~~~~~~~~~~~
a.cc:28:22: error: assignment of read-only location 'time'
Language: C++

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

int a[100000000};
int main(){
    memset(a,-1,sizeof(-1));
    }

Compiler output:
a.cc:4:16: error: expected ']' before '}' token
    4 | int a[100000000};
      |                ^
      |                ]
a.cc:4:16: error: expected declaration before '}' token
a.cc: In function 'int main()':
a.cc:6:12: error: 'a' was not declared in this scope
    6 |     memset(a,-1,sizeof(-1));
      |            ^
Language: C++

#include <iostream>
using namespace std;
int msin(void)
{
	int a,b,c,d,e,f,g,h,i;
	cin>>a>>b>>c>>d>>e;
	f=0;
	if (a<0)
	{
		for (;;)
		{
			a++;
			f=f+c;
			if (a==b)
			{
				cout<<f<<endl;
				return 0;
			}
			if (a<=0)
			{
				break;
			}
		}
	}
	if (a==0)
	{
		f=f+c;
	}
	if (a>0)
	{
		a++;
		f=f+d;
		if (a==b)
		{
			cout<<f<<endl;
		}
	}
	return 0;	
}

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: C++

#include <iostream>
using namespace std;
int msin(void)
{
	int a,b,c,d,e,f,g,h,i;
	cin>>a>>b>>c>>d>>e;
	f=0;
	if (a<0)
	{
		for (;;)
		{
			a++;
			f=f+c;
			if (a==0)
			{
				f=f+d;
			}
			if (a==b)
			{
				cout<<f<<endl;
				return 0;
			}
			if (a==0)
			{
				break;
			}	
		}
	}
	if (a>0)
	{
		a++;
		f=f+d;
		if (a==b)
		{
			cout<<f<<endl;
		}
	}
	return 0;	
}

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: C++

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

using namespace std;

int main (void)
{
	long n,a,b,x,y,z,p,q,r;
	cin >> n >> a >> x >> y >> z;
	
	if (n < 0)
	{
		p = 0;
		p = x * (0 - n);
	
	
		q = 0;
		q = y;
		
		r = 0;
		r = z * a;
		cout << p + q + r << endl;	
	}
	else if (n == 0)
	{
		p = 0;
		q = 0;
				q = y;
				
				r = 0;
				r = z * a;
				cout << p + q + r << endl;	
	}
	else if (n > 0)
	{p =0 ;
	q = 0;
		r = z * a;
						cout << p + q + r << endl;	
			}
	}

}

Compiler output:
a.cc:44:1: error: expected declaration before '}' token
   44 | }
      | ^
Language: C

#include<stdio.h>
int main(void)
{
	int i,j,temp,m,n,c,a[1001],h=0;
	scanf("%d %d",&n,&m);

	for(i=1;i<m+1;i++){
		scanf("%d %d",&a[i],&m);
	}
	for(i=0;i<m;i++){
		for(j=m-1;j>i;j--){
			if(a[i]>a[j]){
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
			}
		}
	}
	j=0;
	for(i=0;i<m;i++){
		if(m-1<=j){
			break;
		}
		if(a[j]>=m-1){
		j++;
		}
	}
		else if(a[i]<=m-1){
		h=(m-1)-a[i];
		c+=h;
	}
	printf("%d\n",c);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:28:17: error: 'else' without a previous 'if'
   28 |                 else if(a[i]<=m-1){
      |                 ^~~~
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:4:22: error: invalid operands to binary & (have 'char *' and 'int')
    4 |         scanf("%d %d"&n,&m);
      |               ~~~~~~~^
      |               |
      |               char *
main.c:6:30: error: invalid operands to binary & (have 'char *' and 'int')
    6 |                 scanf("%d %d"&a,&b);
      |                       ~~~~~~~^
      |                       |
      |                       char *
Language: C

#include<stdio.h>

int n, m;	//?????????
int a, b, c;	//????????????????????????????????????
int i;
int sum, max;

int main()
{
	
	scanf_s("%d %d", &n, &m);

	for (i = 0; i < M; i++) {
		scanf_s("%d %d", &a, &b);
		c = N - a;
		if (c>0) {
			sum += c;
		}
		else if(c>=max){
			max = c;
		}
	}
	printf("%d\n", sum - max);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   11 |         scanf_s("%d %d", &n, &m);
      |         ^~~~~~~
      |         scanf
main.c:13:25: error: 'M' undeclared (first use in this function)
   13 |         for (i = 0; i < M; i++) {
      |                         ^
main.c:13:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:21: error: 'N' undeclared (first use in this function)
   15 |                 c = N - a;
      |                     ^
Language: C

#include<stdio.h>

int n, m;	//?????????
int a, b, c;	//????????????????????????????????????
int i;
int sum, max;

int main()
{
	
	scanf("%d %d", &n, &m);

	for (i = 0; i < M; i++) {
		scanf("%d %d", &a, &b);
		c = N - a;
		if (c>0) {
			sum += c;
		}
		else if(c>=max){
			max = c;
		}
	}
	printf("%d\n", sum - max);

	return 0;
}

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

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cstdlib>
using namespace std;
int main() {
	int n, m, now = 0, g = 0, mo = 0, p[1005][2], s[1005] = {0};
	cin >> n >> m;
	for (int i = 0; i < m; i++ ) {
		int a, b;
		cin >> a >> b;
		p[i][0] = a;
		p[i][1] = b;
		if (a >= b) {
			g++;
		}
		else {
			int c = n - a;
			
			for (int j = now; j >= 0; j--) {
				if (s[j-1] > c ) {
					s[j] = s[j-1];
					
				}
				else {
					s[j] = c;
					now++;
					
					break;
				}
				
				
			}
		}
	}
	
	}
	for (int i = 0; i < m; i++) {
		if (g < m - 1) {
			mo += s[i];
			cout << mo << endl;
			g++;
		}

	}
	
	cout << mo << endl;
	return 0;
}

Compiler output:
a.cc:39:9: error: expected unqualified-id before 'for'
   39 |         for (int i = 0; i < m; i++) {
      |         ^~~
a.cc:39:25: error: 'i' does not name a type
   39 |         for (int i = 0; i < m; i++) {
      |                         ^
a.cc:39:32: error: 'i' does not name a type
   39 |         for (int i = 0; i < m; i++) {
      |                                ^
a.cc:48:9: error: 'cout' does not name a type
   48 |         cout << mo << endl;
      |         ^~~~
a.cc:49:9: error: expected unqualified-id before 'return'
   49 |         return 0;
      |         ^~~~~~
a.cc:50:1: error: expected declaration before '}' token
   50 | }
      | ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:4:22: error: invalid operands of types 'const char [6]' and 'int' to binary 'operator&'
    4 |         scanf("%d %d"&n,&m);
      |               ~~~~~~~^~
      |               |       |
      |               |       int
      |               const char [6]
a.cc:6:30: error: invalid operands of types 'const char [6]' and 'int' to binary 'operator&'
    6 |                 scanf("%d %d"&a,&b);
      |                       ~~~~~~~^~
      |                       |       |
      |                       |       int
      |                       const char [6]
Language: C++

#include <iostream>
using namespace std;
int  main(void)
{
	int N,M,a,b,c[1000]={0},d,e,f,g;
	cin>>N>>M;
	for (a=0;a<M;a++)
	{
		cin>>b>>d;
		c[a]=b;
	}
	sort(c,c+1000);
	for (a=999;a>=0;a--)
	{
		if (c[a]>=N/2)
		{
			e++;
			if (e>=M-1)
			{
				break;
			}
		}
	}
	cout<<e<<endl;
	return 0;
}

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

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

using namespace std;

int main (void)
{
	int n,m,a[100],b[100],cou,x;
	cin >> n >> m;
	cou = 0;
	x = 200;
	for (int i = 0; i < m; i++)
	{
		cin >> a[i] >> b[i];
		if (a[i] >= b[i])
		{
			cou++;
		}
		
	}
	
	if (cou >= m - 1)
	{
		cout << '0' << endl;
	}
	else
	{
		for (int i = 0; i < m; i++)
		{
			if (a[i] < b[i] && x > (b[i] - a[i]))
			{
				x = 0;
				x = b[i] - a[i];
			}
		}
	}???

Compiler output:
a.cc: In function 'int main()':
a.cc:38:10: error: expected primary-expression before '?' token
   38 |         }???
      |          ^
a.cc:38:11: error: expected primary-expression before '?' token
   38 |         }???
      |           ^
a.cc:38:12: error: expected primary-expression before '?' token
   38 |         }???
      |            ^
a.cc:38:13: error: expected primary-expression at end of input
   38 |         }???
      |             ^
a.cc:38:13: error: expected ':' at end of input
   38 |         }???
      |             ^
      |             :
a.cc:38:13: error: expected primary-expression at end of input
a.cc:38:13: error: expected ':' at end of input
   38 |         }???
      |             ^
      |             :
a.cc:38:13: error: expected primary-expression at end of input
a.cc:38:13: error: expected ':' at end of input
   38 |         }???
      |             ^
      |             :
a.cc:38:13: error: expected primary-expression at end of input
a.cc:38:13: error: expected '}' at end of input
a.cc:9:1: note: to match this '{'
    9 | {
      | ^
Language: C++

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

using namespace std;

int main (void)
{
	int n,m,a[100],b[100],cou,x;
	cin >> n >> m;
	cou = 0;
	x = 200;
	for (int i = 0; i < m; i++)
	{
		cin >> a[i] >> b[i];
		if (a[i] >= b[i])
		{
			cou++;
		}
		
	}
	
	if (cou >= m - 1)
	{
		cout << '0' << endl;
	}
	else
	{
		for (int i = 0; i < m; i++)
		{
			if (a[i] < b[i] && x > (b[i] - a[i]))
			{
				x = 0;
				x = b[i] - a[i];
			}
		
	}???

Compiler output:
a.cc: In function 'int main()':
a.cc:38:10: error: expected primary-expression before '?' token
   38 |         }???
      |          ^
a.cc:38:11: error: expected primary-expression before '?' token
   38 |         }???
      |           ^
a.cc:38:12: error: expected primary-expression before '?' token
   38 |         }???
      |            ^
a.cc:38:13: error: expected primary-expression at end of input
   38 |         }???
      |             ^
a.cc:38:13: error: expected ':' at end of input
   38 |         }???
      |             ^
      |             :
a.cc:38:13: error: expected primary-expression at end of input
a.cc:38:13: error: expected ':' at end of input
   38 |         }???
      |             ^
      |             :
a.cc:38:13: error: expected primary-expression at end of input
a.cc:38:13: error: expected ':' at end of input
   38 |         }???
      |             ^
      |             :
a.cc:38:13: error: expected primary-expression at end of input
a.cc:38:13: error: expected '}' at end of input
a.cc:29:9: note: to match this '{'
   29 |         {
      |         ^
a.cc:38:13: error: expected '}' at end of input
   38 |         }???
      |             ^
a.cc:9:1: note: to match this '{'
    9 | {
      | ^
Language: C++

#include <iostream>
using namespace std;
int main(){

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

		if( a < n ){
                        y = n-a;
			x = x+y
			z = max( z , y );
		}
	}

	cout << x-z << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:32: error: expected ';' before 'z'
   16 |                         x = x+y
      |                                ^
      |                                ;
   17 |                         z = max( z , y );
      |                         ~
Language: C++

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

int main(){
  int N,M;
  cin >> N >> M;

  int A[1000],B[1000];
  for(int i = 0; i < M; i++){
    cin >> A[i] >> B[i];
  }

  list<int> l;
  int count = 0;
  for(int i = 0; i < M; i++){
    if(A[i] >= B[i]) count++;
    if(A[i] < B[i]) l.push_back(B[i] - A[i]);
    }
  }
  l.sort();

  int ans = 0;
  while(count < M - 1){
    count++;
    ans += l.front() / 2;
    l.pop_front();
  }
  cout << ans << endl;

  return 0;
}



Compiler output:
a.cc:20:3: error: 'l' does not name a type
   20 |   l.sort();
      |   ^
a.cc:23:3: error: expected unqualified-id before 'while'
   23 |   while(count < M - 1){
      |   ^~~~~
a.cc:28:3: error: 'cout' does not name a type
   28 |   cout << ans << endl;
      |   ^~~~
a.cc:30:3: error: expected unqualified-id before 'return'
   30 |   return 0;
      |   ^~~~~~
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++

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

int main()
{
	//合計時間

	int N, M;
	cin >> N >> M;
	int a;
	int A[5000];
	int b = 0;
	int x = 0;
	for (int i = 0; i < 2 * M; i++) {
		cin >> a;
		if (a < N) {
			A[x]=a;
			x++;
			break;
		}
		b++;
		cin >> a;
	}
	int sum = 0;
	if (b < M - 1) {
		sort(A.begin(), A.end());
		reverse(A.begin(), A.end());
		for (int i = 0; i < M - 1 - b; i++) {
			sum += N - A[i];
		}
	}
	cout << sum << endl;

	/*
	int sum=0, n;
	for (int i = 0; i < 4; i++) {
	cin >> n;
	sum += n;
	}
	cout << sum / 60 << endl;
	cout << sum % 60 << endl;
	//平均点
	/*
	int P[5];
	int sum=0;
	for (int i = 0; i < 5; i++) {
	cin >> P[i];
	if (P[i] < 40) P[i] = 40;
	sum += P[i];
	}
	cout << sum / 5 << endl;
	*/
	//投票
	/*
	int N, M;
	cin >> N >> M;
	int A[1000], vote[1000];
	for (int i = 0; i < N; i++) {
	cin >> A[i];
	vote[i] = 0;
	}
	int b;
	for (int i = 0; i < M; i++) {
	cin >> b;
	for (int j = 0; j < N; j++) {
	if (A[j] <= b) {
	vote[j]++;
	break;
	}
	}
	}
	int temps = 0, ans;
	for (int i = 0; i < N; i++) {
	if (vote[i] > temps) {
	temps = vote[i];
	ans = i;
	}
	}
	cout << ans + 1 << endl;
	*/

	//2.すごろく	
	/*
	int n;
	cin >> n;
	int A, _A = 1;
	int k = 0;
	int A_count[100];
	A_count[0] = 1;
	for (int i = 0; i < n; i++)
	{
	cin >> A;
	if (A == 1)
	{
	if (A == _A)
	{
	A_count[k]++;
	}
	else
	{
	k++;
	A_count[k] = 2;
	}
	}
	_A = A;
	}
	sort(A_count, A_count + k + 1);
	cout << A_count[k] << endl;
	*/

	//タイムカード
	/*
	int t[2][3];
	int x[3][3];
	for (int n=0; n < 3; n++)
	{
	for (int i=0; i < 2; i++)
	for (int k=0; k < 3; k++)
	cin >> t[i][k];

	for (int m = 2; m >= 0; m--)
	{
	x[n][m] = t[1][m] - t[0][m];
	if (t[0][m] > t[1][m])
	{
	x[n][m] += 60;
	t[1][m - 1]--;
	}
	}
	}
	for (int n= 0; n < 3; n++)
	{
	cout << x[n][0] << ' ' << x[n][1] <<' '<< x[n][2] << endl;
	}
	*/



	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:24: error: request for member 'begin' in 'A', which is of non-class type 'int [5000]'
   29 |                 sort(A.begin(), A.end());
      |                        ^~~~~
a.cc:29:35: error: request for member 'end' in 'A', which is of non-class type 'int [5000]'
   29 |                 sort(A.begin(), A.end());
      |                                   ^~~
a.cc:30:27: error: request for member 'begin' in 'A', which is of non-class type 'int [5000]'
   30 |                 reverse(A.begin(), A.end());
      |                           ^~~~~
a.cc:30:38: error: request for member 'end' in 'A', which is of non-class type 'int [5000]'
   30 |                 reverse(A.begin(), A.end());
      |                                      ^~~
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
typedef pair<int, int> P;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> v(m);
  FOR(i,0,m){
      int a, b;
      cin >> a >> b;
      v[i] = P(a, b);
  }
  int ans = 0;
  sort(v.begin(), v.end());
  FOR(i,1,m){
      if(v[i].first < n){
          ans += n - v[i].first;
      }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:14: error: cannot convert 'P' {aka 'std::pair<int, int>'} to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} in assignment
   35 |       v[i] = P(a, b);
      |              ^~~~~~~
      |              |
      |              P {aka std::pair<int, int>}
a.cc:40:15: error: request for member 'first' in 'v.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   40 |       if(v[i].first < n){
      |               ^~~~~
a.cc:41:27: error: request for member 'first' in 'v.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   41 |           ans += n - v[i].first;
      |                           ^~~~~
Language: C++


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

int board[1234][1234];
//#=-1 .=0

int main(void)
{
	int n, m, d;
	scanf("%d %d %d", &n, &m, &d);
	memset(board, 0xff, sizeof(board));
	for (int i = 0; i < n; ++i)
	{
		char str[123];
		scanf("%s", str);
		for (int j = 0; j < m; ++j)
		{
			board[i][j] = (str[j] == '#') ? -1 : 0;
		}
	}
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			bool flag = true;
			for (int dd = 0; dd < d; ++dd)
			{
				if (board[i][j + dd] == -1)
				{
					flag = false;
					break;
				}
			}
			if (flag)
			{
				++ans;
			}
			flag = true;
			for (int dd = 0; dd < d; ++dd)
			{
				if (board[i + dd][j] == -1)
				{
					flag = false;
					break;
				}
			}
			if (flag)
			{
				++ans;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
void main()
{
	int i, j, m, n, d, c, cnt = 0;
	int b[100][100];
	char a[100][101] = { -1 };
	cin >> n >> m >> d;
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			cin >> a[i][j];
			if (a[i][j] == '#') {
				b[i][j] = 1;
			}
			else {
				b[i][j] = 0;
			}

		}
	}
	//????????????
	/*for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			printf("%d", b[i][j]);
		}
		printf("\n");
		}*/
	//?????????

	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			if (b[i][j] == 0) {
				for (c = 1; c <= d + 1; c++) {
					if (b[i][j + c] == 1) {
						break;
					}
					if (c == d) {
						cnt++;
						break;
					}
				}
			}
		}
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			if (b[i][j] == 0) {
				for (c = 1; c <= d + 1; c++) {
					if (b[i +c][j] == 1) {
						break;
					}
					if (c == d) {
						cnt++;
						break;
					}
				}
			}
		}
	}
		//??????
	cout << cnt << endl;
}



	

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

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
void main()
{
	int i, j, m, n, d, c, cnt = 0;
	int b[100][100];
	char a[100][101] = { -1 };
	cin >> n >> m >> d;
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			cin >> a[i][j];
			if (a[i][j] == '#') {
				b[i][j] = 1;
			}
			else {
				b[i][j] = 0;
			}

		}
	}
	//????????????
	/*for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			printf("%d", b[i][j]);
		}
		printf("\n");
		}*/
	//?????????

	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			if (i+d<=n) {
				for (c = 0; c < d+1 ; c++) {
					if (b[i][j + c] == 1) {
						break;
					}
					if (c == d) {
						cnt++;
						break;
					}
				}
			}
		}
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			if (b[i][j] == 0) {
				for (c =0; c < d+1; c++) {
					if (b[i +c][j] == 1) {
						break;
					}
					if (c == d) {
						cnt++;
						break;
					}
				}
			}
		}
	}
		//??????
	cout << cnt << endl;
}



	

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


int main() {
	int n, m, d;
	cin >> n >> m >> d;
	vector<string> map;
	string s;
	for (int i = 0; i < n; i++) {
		cin >> s;
		map.emplace_back(s);
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= m - d + 1; j++) {
			int count = 0;
			for (int o = 0; o < d; o++) {
				if (map[i][j + o] == '.')count++;
			}
			if (count == d)ans++;
		}
	}
	for (int j = 0; j < m; j++) {
		for (int i = 0; i < n - d + 1; i++) {
			int count = 0;
			for (int o = 0; o < d; o++) {
				if (map[i + o][j] == '.')count++;
			}
			if (count == d)ans++;
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >> n >> m >> d;
      |         ^~~
a.cc:5:9: error: 'vector' was not declared in this scope
    5 |         vector<string> map;
      |         ^~~~~~
a.cc:5:16: error: 'string' was not declared in this scope
    5 |         vector<string> map;
      |                ^~~~~~
a.cc:5:24: error: 'map' was not declared in this scope
    5 |         vector<string> map;
      |                        ^~~
a.cc:6:15: error: expected ';' before 's'
    6 |         string s;
      |               ^~
      |               ;
a.cc:8:24: error: 's' was not declared in this scope
    8 |                 cin >> s;
      |                        ^
a.cc:30:9: error: 'cout' was not declared in this scope
   30 |         cout << ans << endl;
      |         ^~~~
a.cc:30:24: error: 'endl' was not declared in this scope
   30 |         cout << ans << endl;
      |                        ^~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n,m,d;
  cin >> n >> m >> d;
  int kaijou[100][100];
  char c;
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin >> c;
      if(c=='.'){
        kaijou[i][j]=1;
      }else if(c=='#'){
        kaijou[i][j]=0;
      }
    }
  }

  int ans=0;
  int nagasa;
  for(int i=0;i<n;i++){
    nagasa=0;
    for(int j=0;j<m;j++){
      if(kaijou[i][j]){
        nagasa++;
      }else{
        ans+=(nagasa-d+1>0)?(nagasa-d+1>0):0
        nagasa=0;
      }
    }
    ans+=(nagasa-d+1>0)?(nagasa-d+1>0):0
  }
  for(int i=0;i<m;i++){
    nagasa=0;
    for(int j=0;j<n;j++){
      if(kaijou[j][i]){
        nagasa++;
      }else{
        ans+=(nagasa-d+1>0)?(nagasa-d+1>0):0
        nagasa=0;
      }
    }
    ans+=(nagasa-d+1>0)?(nagasa-d+1>0):0
  }

  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:45: error: expected ';' before 'nagasa'
   28 |         ans+=(nagasa-d+1>0)?(nagasa-d+1>0):0
      |                                             ^
      |                                             ;
   29 |         nagasa=0;
      |         ~~~~~~                               
a.cc:32:41: error: expected ';' before '}' token
   32 |     ans+=(nagasa-d+1>0)?(nagasa-d+1>0):0
      |                                         ^
      |                                         ;
   33 |   }
      |   ~                                      
a.cc:40:45: error: expected ';' before 'nagasa'
   40 |         ans+=(nagasa-d+1>0)?(nagasa-d+1>0):0
      |                                             ^
      |                                             ;
   41 |         nagasa=0;
      |         ~~~~~~                               
a.cc:44:41: error: expected ';' before '}' token
   44 |     ans+=(nagasa-d+1>0)?(nagasa-d+1>0):0
      |                                         ^
      |                                         ;
   45 |   }
      |   ~
Language: C++

//Plush Toys
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

using namespace std;

int A[100000], B[21] = {};
int N, M;

int getCost(vector<int> v) {
    int cnt = 0;
    int i = 0;

    for(auto j : v) {
        int k = B[j];
        while(k > 0) {
            if(A[i++] != j) cnt++;
            k--;
        }
    }
    return cnt;
}

int main() {
    cin >> N >> M;

    for(int i = 0; i < N; i++) {
        cin >> A[i];
        B[A[i]]++;
    }

    vector<int> v(M);
    iota(v.begin(), v.end(), 1);

    int cost = INT_MAX;
    do {
        cost = min(cost, getCost(v));
    } while( next_permutation(v.begin(), v.end()) );

    cout << cost << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:16: error: 'INT_MAX' was not declared in this scope
   37 |     int cost = INT_MAX;
      |                ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <numeric>
  +++ |+#include <climits>
    6 |
Language: C++

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

int ruisekiwa[100001][20];
int main() {
	memset(ruisekiwa, 0, sizeof(ruisekiwa));
	int a, b;
	cin >> a >> b;
	int c[20]{};
	for (int d = 0; d < a; d++) {
		int e;
		scanf("%d", &e);
		e--;
		c[e]++;
		for (int f = 0; f < b; f++) {
			ruisekiwa[d + 1][f] = c[f];
		}
	}
	unordered_map<int, int>MINCOST;//20 19.......2 1
	for (int i = 1; i <= b; i++) {
		for (int bit = 0; bit < (1 << b); bit++) {
			int sum = 0, r = 0;;
			for (int g = 0; g < 22; g++) {
				if (bit >> g & 1) {
					sum++;
					r += ruisekiwa[a][g];
				}
			}
			if (sum == i) {
				int MIN = 1 << 29;
				for (int g = 0; g < 22; g++) {
					if (bit >> g & 1) {
						int copy = 1 << g;
						bit -= copy;
						MIN = min(MIN, MINCOST[bit] + ruisekiwa[a][g] - (ruisekiwa[r][g] - ruisekiwa[r - ruisekiwa[a][g]][g]));
						bit += copy;
					}
					MINCOST[bit] = MIN;
				}
			}
		}
	}
	for (int i = 0; i < (1 << b); i++) {
		cout << i << " " << MINCOST[i] << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'memset' was not declared in this scope
   11 |         memset(ruisekiwa, 0, sizeof(ruisekiwa));
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<functional>
  +++ |+#include <cstring>
    6 | #include<unordered_map>
Language: C++


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

int n, m;

int dist[1 << 20];
int cost[20][123456];
int nui[123456];
int ncount[20];

int memo[1 << 20];
int dp(int bit)
{
	if (bit == 0)return 0;
	if (memo[bit] >= 0)return memo[bit];
	int ans = 123456789;
	for (int i = 0; i < 20; ++i)
	{
		if (bit & (1 << i))
		{
			int lastbit = bit - (1 << i);
			ans = min(ans, dp(lastbit) + cost[i][dist[lastbit]]);
		}
	}
	return memo[bit] = ans;
}

int main(void)
{
	scanf("%d %d", &n, &m);
	memset(memo, 0xff, sizeof(memo));
	fill(ncount, ncount + 20, 0);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d", nui + i);
		--nui[i];
		++ncount[nui[i]];
	}
	dist[0] = 0;
	for (int bit = 1; bit < (1 << m); ++bit)
	{
		int bigb = 0;
		for (int i = 0; i < 20; ++i)
		{
			if (bit & (1 << i))
			{
				bigb = i;
				break;
			}
		}
		dist[bit] = dist[bit - (1 << bigb)] + ncount[bigb];
	}
	for (int j = 0; j < m; ++j)
	{
		//cost
		int price = 0;
		for (int first = 0; first < ncount[j]; ++first)
		{
			if (nui[first] == j)
			{
				++price;
			}
		}
		for (int shack = 0; shack <= n - ncount[j]; ++shack)
		{
			cost[j][shack] = ncount[j] - price;
			if (nui[shack] == j)
			{
				--price;
			}
			if (shack != n - ncount[j] && nui[shack + ncount[j]] == j)
			{
				++price;
			}
		}
	}
	int ans = dp((1 << m) - 1);
	printf("%d\n", ans);
	return 0;
}

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

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> plli;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define int long long
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>=0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll mod = 1e9 + 7;
const ll INF = 1<<30;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

int n, m;
int p[100000 + 5];
int s[100000 + 5][25];
int cnt[25];
int dp[1<<21];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    rep(i, n) cin >> p[i];
    rep(i, n) cnt[p[i] - 1] += 1;
    rep(i, n) s[i + 1][p[i] - 1] += 1;
    rep(i, n)rep(j, m) s[i + 1][j] += s[i][j];
    fill(dp, dp + (1<<m) + 1, 1e9);
    dp[0] = 0;
    rep(i, 1<<m) {
        rep(j, m) {
            if (i>>j & 1) {
                int l = 0;
                int r = 0;
                rep(k, m) {
                    if (k == j) r = cnt[k];
                    else if (i>>k & 1) l += cnt[k];
                }
                r += l
                int change = (r - l) - (s[r][j] - s[l][j]);
                dp[i] = min(dp[i], dp[i ^ (1<<j)] + change);
            }
        }
    }
    cout << dp[(1<<m) - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:23: error: expected ';' before 'long'
   57 |                 r += l
      |                       ^
      |                       ;
a.cc:59:53: error: 'change' was not declared in this scope
   59 |                 dp[i] = min(dp[i], dp[i ^ (1<<j)] + change);
      |                                                     ^~~~~~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<functional>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#define p pair<int,int>
#define P pair<int,p>
using namespace std;

int hyoukou[1002][1002];
int x[4] = { -1,0,0,1 }, y[4] = { 0,-1,1,0 };
int main() {
		unordered_map<int, unordered_set<int>>U;
		memset(hyoukou, 1, sizeof(hyoukou));
		priority_queue<P, vector<P>, greater<P>>Q;
		int c, d;
		cin >> c >> d;
		for (int e = 0; e < c; e++) {
			for (int f = 0; f < d; f++) {
				int g;
				scanf("%d", &g);
				g--;
				hyoukou[e + 1][f + 1] = g;
				Q.push(P(g, p(e + 1, f + 1)));
			}
		}
		while (Q.size()) {
			P h = Q.top(); Q.pop();
			for (int i = 0; i < 4; i++) {
				if (h.first> hyoukou[h.second.first + x[i]][h.second.second + y[i]]) {
					for (auto k = U[hyoukou[h.second.first + x[i]][h.second.second + y[i]]].begin(); k != U[hyoukou[h.second.first + x[i]][h.second.second + y[i]]].end(); k++) {
						U[h.first].insert(*k);
					}
				}
			}
			if (U[h.first].size() == 0)U[h.first].insert(h.first);
		}
		int S = 0;
		for (int i = 1; i <= c; i++) {
			for (int h = 1; h <= d; h++) {
				if (U[hyoukou[i][h]].size() != 1)S++;
			}
		}   
		cout << S << endl;
}

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

#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<unordered_set>
#define P pair<int,int>
using namespace std;

int h[1000000];
int ANS = 0;
int a, b, c[1002][1002], x[4] = { -1,0,0,1 }, y[4] = { 0,-1,1,0 };
P d[1000000];
int main() {
	memset(h, -1, sizeof(h));
	for (int i = 0; i < 1002; i++) {
		for (int j = 0; j < 1002; j++) {
			c[i][j] = 1 << 29;
		}
	}
	cin >> a >> b;
	for (int e = 0; e < a; e++) {
		for (int f = 0; f < b; f++) {
			int g; scanf("%d", &g);
			g--;
			c[e + 1][f + 1] = g;
			d[g] = P(e + 1, f + 1);
		}
	}
	for (int i = 0; i < a*b; i++) {
		int dx = d[i].first, dy = d[i].second;
		bool k = false; int sum = 0;
		for (int j = 0; j < 4; j++) {
			if (c[dx + x[j]][dy + y[j]]<i) {
				sum++;
				if (h[c[dx + x[j]][dy + y[j]]] ==-1) {
					k = true;
				}
				else {	
					if (h[i] == -1) {
						h[i] = h[c[dx + x[j]][dy + y[j]]];
					}
					else if (h[i] != h[c[dx + x[j]][dy + y[j]]])k = true;
				}
			}
		}
		if (sum!=0) {
			if (k)h[i] = -1;
			else  {  ANS++; }
		}
		else {
			h[i] = i;
			ANS++;
		}
	}
	cout << a*b-ANS << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'memset' was not declared in this scope
   16 |         memset(h, -1, sizeof(h));
      |         ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include<unordered_set>
  +++ |+#include <cstring>
    8 | #define P pair<int,int>
Language: C++

#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
int m[1020][1020],ma[1001][1001],qw,a,b,e,f;
int v[4]={-1,0,1,0},t[4]={0,-1,0,1};
using namespace std;
int dfs(int x,int y){
  if(qw>=2)goto L;
  if(m1[y][x]>0)return 0;
  int s=0,c=0;
  rep(i,4){
    if(0>x+v[i]||b<=x+v[i]||0>y+t[i]||a<=y+t[i])continue;
    if(m[y][x+v[i]]<m[y][x]||m[y+t[i]][x]<m[y][x]){
      s+=dfs(x+v[i],y+t[i]);
      c++;
    }
  }
  if(0>m1[y][x]){
    if(s>1)return 1;
    return 0;
  }
  if(!c&&!m1[y][x]){
    m1[y][x]++;
    qw++;
    return 1;
  }
  m1[y][x]++;
  return s;
}
int main(){
  int sum=0;
  cin>>a>>b;
  rep(i,a)rep(j,b)cin>>m[i][j];
  rep(i,a)rep(j,b){
    qw=0;
    sum+=dfs(j,i);
    L:if(wq){
wq=0;
sum++;
    };
    rep(z,a)rep(h,b)m1[z][h]=0;
  }
  cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:8:6: error: 'm1' was not declared in this scope; did you mean 'ma'?
    8 |   if(m1[y][x]>0)return 0;
      |      ^~
      |      ma
a.cc:17:8: error: 'm1' was not declared in this scope; did you mean 'ma'?
   17 |   if(0>m1[y][x]){
      |        ^~
      |        ma
a.cc:21:11: error: 'm1' was not declared in this scope; did you mean 'ma'?
   21 |   if(!c&&!m1[y][x]){
      |           ^~
      |           ma
a.cc:26:3: error: 'm1' was not declared in this scope; did you mean 'ma'?
   26 |   m1[y][x]++;
      |   ^~
      |   ma
a.cc:7:17: error: label 'L' used but not defined
    7 |   if(qw>=2)goto L;
      |                 ^
a.cc: In function 'int main()':
a.cc:36:10: error: 'wq' was not declared in this scope; did you mean 'qw'?
   36 |     L:if(wq){
      |          ^~
      |          qw
a.cc:40:21: error: 'm1' was not declared in this scope; did you mean 'ma'?
   40 |     rep(z,a)rep(h,b)m1[z][h]=0;
      |                     ^~
      |                     ma
Language: C++

#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
int m[1020][1020],m1[1001][1001],qw,a,b,e,f;
int v[4]={-1,0,1,0},t[4]={0,-1,0,1};
using namespace std;
int dfs(int x,int y){
  if(qw>=2)goto L;
  if(m1[y][x]>0)return 0;
  int s=0,c=0;
  rep(i,4){
    if(0>x+v[i]||b<=x+v[i]||0>y+t[i]||a<=y+t[i])continue;
    if(m[y][x+v[i]]<m[y][x]||m[y+t[i]][x]<m[y][x]){
      s+=dfs(x+v[i],y+t[i]);
      c++;
    }
  }
  if(0>m1[y][x]){
    if(s>1)return 1;
    return 0;
  }
  if(!c&&!m1[y][x]){
    m1[y][x]++;
    qw++;
    return 1;
  }
  m1[y][x]++;
  return s;
}
int main(){
  int sum=0;
  cin>>a>>b;
  rep(i,a)rep(j,b)cin>>m[i][j];
  rep(i,a)rep(j,b){
    qw=0;
    sum+=dfs(j,i);
    L:if(wq){
wq=0;
sum++;
    };
    rep(z,a)rep(h,b)m1[z][h]=0;
  }
  cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:7:17: error: label 'L' used but not defined
    7 |   if(qw>=2)goto L;
      |                 ^
a.cc: In function 'int main()':
a.cc:36:10: error: 'wq' was not declared in this scope; did you mean 'qw'?
   36 |     L:if(wq){
      |          ^~
      |          qw
Language: C++

#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
int m[1020][1020],qw,a,b,e,f;
int v[4]={-1,0,1,0},t[4]={0,-1,0,1};
using namespace std;
int dfs(int x,int y){
  if(qw>=2)return 1;
  if(m1[y][x]>0)return 0;
  int s=0,c=0;
  rep(i,4){
    if(0>x+v[i]||b<=x+v[i]||0>y+t[i]||a<=y+t[i])continue;
    if(m[y][x+v[i]]<m[y][x]||m[y+t[i]][x]<m[y][x]){
      s+=dfs(x+v[i],y+t[i]);
      c++;
    }
    if(qw>=2)return 1;
  }
  if(e==y&&f==x){
    if(s>1)return 1;
    return 0;
  }
  if(!c){
    qw++;
    return 1;
  }
  return s;
}
int main(){
  int sum=0;
  cin>>a>>b;
  rep(i,a)rep(j,b)cin>>m[i][j];
  rep(i,a)rep(j,b){
    qw=0;e=i;f=j;
    sum+=dfs(j,i);qw=0;
  }
  cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int dfs(int, int)':
a.cc:8:6: error: 'm1' was not declared in this scope; did you mean 'm'?
    8 |   if(m1[y][x]>0)return 0;
      |      ^~
      |      m
Language: C++

#include <iostream>
#include <stack>

#define UNDEF -1
#define IS_RD -2
#define INF 1073741824

using namespace std;

int M[1001][1001],H,W;
int dp[1001][1001];
stack<int> callX;
stack<int> callY;

int getM(int x,int y)
{
	if(x >= 0 && y >= 0 && x < W && y < H)
	{
		return M[x][y];
	}
	else
	{
		return INF;
	}
}

void calc(int _x,int _y)
{
	int x,y;
	callX.push(_x);
	callY.push(_y);
	while(!callX.empty())
	{
		endfn:
		x = callX.top();
		y = callY.top();
		if(dp[x][y] == UNDEF)
		{
			int a[4] = {INF,INF,INF,INF};
			if(getM(x+1,y) < getM(x,y))
			{
				if(dp[x+1][y] == UNDEF)
				{
					callX.push(x+1);
					callY.push(y);
					goto endfn;
				}
				else
				{
					a[0] = dp[x+1][y];
				}
			}
			if(getM(x-1,y) < getM(x,y))
			{
				if(dp[x-1][y] == UNDEF)
				{
					callX.push(x-1);
					callY.push(y);
					goto endfn;
				}
				else
				{
					a[1] = dp[x-1][y];
				}
			}
			if(getM(x,y+1) < getM(x,y))
			{
				if(dp[x][y+1] == UNDEF)
				{
					callX.push(x);
					callY.push(y+1);
					goto endfn;
				}
				else
				{
					a[2] = dp[x][y+1];
				}
			}
			if(getM(x,y-1) < getM(x,y))
			{
				if(dp[x][y-1] == UNDEF)
				{
					callX.push(x);
					callY.push(y-1);
					goto endfn;
				}
				else
				{
					a[3] = dp[x][y-1];
				}
			}
			if(a[0] == INF && a[1] == INF && a[2] == INF && a[3] == INF)
			{
				dp[x][y] = (x*1000)+y;
				goto endok;
			}
			else
			{
				for(int i = 0;i < 3;i++)
				{
					for(int ii = i+1;ii < 4;ii++)
					{
						if(a[i] != INF && a[ii] != INF && a[i] != a[ii])
						{
							dp[x][y] = IS_RD;
							goto endok;
						}
					}
				}
				for(int i = 0;i < 4;i++)
				{
					if(a[i] != INF)
					{
						dp[x][y] = a[i];
						goto endok;
					}
				}
			}
		}
		endok:
		callX.pop();
		callY.pop();
	}
}

int main(void)
{
	cin >> H >> W;
	for(int i = 0;i < H;i++)
	{
		for(int ii = 0;ii < W;ii++)
		{
			cin >> M[ii][i];
		}
	}
	for(int x = 0;x < 1001;x++)
	{
		for(int y = 0;y < 1001;y++)
		{
			dp[x][y] = UNDEF;
		}
	}
	int res = 0;
	for(int x = 0;x < W;x++)
	{
		for(int y = 0;y < H;y++)
		{
			calc(x,y);
		}
	}
	for(int x = 0;x < W;x++)
	{
		for(int y = 0;y < H;y++)
		{
			if(dfs(x,y) == IS_RD)
				res++;
		}
	}
	
	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:155:28: error: 'dfs' was not declared in this scope
  155 |                         if(dfs(x,y) == IS_RD)
      |                            ^~~
Language: C++

#include<cstdio>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<list>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#define P pair<int,int>//cost to
using namespace std;

int d[10000];
vector<P>rinsetu[10000];
struct room {
	int now, cost, state, keika;
};
bool operator <(room a, room b) {
	return a.cost > b.cost;
}
int mincost[10000][3][201];//??¨?±?????????????????????????
int main() {
	int a, b, c; cin >> a >> b >> c;
	for (int e = 0; e < a; e++) {
		scanf("%d", &d[e]);
	}
	for (int e = 0; e < b; e++) {
		int f, g, h; scanf("%d%d%d", &f, &g, &h);
		f--; g--;
		rinsetu[f].push_back(P(h, g));
		rinsetu[g].push_back(P(h, f));
	}
	memset(mincost, 0x3f, sizeof(mincost));
	mincost[0][0][0] = 0;
	priority_queue<room>Q;
	Q.push({0,0,0,0});
	while (Q.size()) {
		room e = Q.top(); Q.pop();
		if (mincost[e.now][e.state][e.keika] < e.cost)continue;
		for (P f : rinsetu[e.now]) {
			int x = min(c, f.first + e.keika), y = d[f.second];
			if (abs(e.state - y) == 2 && x < c)continue;
			if (y == 1) {
				y = e.state;
			}
			else {
				x = 0;
			}
			if (mincost[f.second][y][x] > e.cost + f.first) {
				mincost[f.second][y][x] = e.cost + f.first;
				Q.push({f.second,mincost[f.second][y][x],y,x});
			}
		}
	}
	int MIN = 1 << 29;
	for (int i = 0; i < b; i++) {
		MIN = min({MIN,mincost[a-1][0][i],mincost[a-1][1][i],mincost[a-1][2][i]});
	}
	cout << MIN << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'memset' was not declared in this scope
   36 |         memset(mincost, 0x3f, sizeof(mincost));
      |         ^~~~~~
a.cc:13:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include<queue>
  +++ |+#include <cstring>
   13 | #define P pair<int,int>//cost to