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

<?php
$server = "php://stdin";
$local="input.txt";
$handle = fopen($server, "r");
$t = trim(fgets($handle));
$a=explode(" ",$t);
$map=[];
$map=array_fill(1,$a[0],0);
$p=0;$ans=0;$y=0;
for($i=0;$i<$a[1];$i++)
{
    $x=trim(fgets($handle));
    $h=explode(" ",$x);
    if($map[$h[0]]==0 && $h[1]=="WA"){$p++;}
    if($map[$h[0]]==0 && $h[1]=="AC"){$ans++;$y=$p;$p=0;$map[$h[0]]=1;}
}

echo $ans." ".$y;
?>


Compiler output:
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <?php
      | ^
a.cc:3:1: error: '$local' does not name a type
    3 | $local="input.txt";
      | ^~~~~~
a.cc:4:1: error: '$handle' does not name a type
    4 | $handle = fopen($server, "r");
      | ^~~~~~~
a.cc:5:1: error: '$t' does not name a type
    5 | $t = trim(fgets($handle));
      | ^~
a.cc:6:1: error: '$a' does not name a type
    6 | $a=explode(" ",$t);
      | ^~
a.cc:7:1: error: '$map' does not name a type
    7 | $map=[];
      | ^~~~
a.cc:8:1: error: '$map' does not name a type
    8 | $map=array_fill(1,$a[0],0);
      | ^~~~
a.cc:9:1: error: '$p' does not name a type
    9 | $p=0;$ans=0;$y=0;
      | ^~
a.cc:9:6: error: '$ans' does not name a type
    9 | $p=0;$ans=0;$y=0;
      |      ^~~~
a.cc:9:13: error: '$y' does not name a type
    9 | $p=0;$ans=0;$y=0;
      |             ^~
a.cc:10:1: error: expected unqualified-id before 'for'
   10 | for($i=0;$i<$a[1];$i++)
      | ^~~
a.cc:10:10: error: '$i' does not name a type
   10 | for($i=0;$i<$a[1];$i++)
      |          ^~
a.cc:10:19: error: '$i' does not name a type
   10 | for($i=0;$i<$a[1];$i++)
      |                   ^~
a.cc:18:1: error: 'echo' does not name a type
   18 | echo $ans." ".$y;
      | ^~~~
a.cc:19:1: error: expected unqualified-id before '?' token
   19 | ?>
      | ^
Language: C++

#include<cstdio>
#include<algorithm>
#include<queue>
#define N 2000010
//#define int long long
#define INF 1e9
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
using namespace std;
inline int read()
{
	register char cc = getchar();register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - '0'; cc = getchar();}
	return cn * flus; 
}
bool flag[N];
int wa[N], ac[N];
queue<int> q;
signed main()
{
	int n, m;
	int ac1(0), wa1(0);
	n = read();
	m = read();
	while(m -- )
	{
		string st;
		int num;
		num = read();
		cin >> st;
		if(st == "AC") 
		{
			if(!flag[num]) 
			{
				flag[num] = 1;
				q.push(num);
				ac1 ++;
			}
		}
		if(st == "WA")
		{
			if(!flag[num]) 
			{
				wa[num] += 1;
			}
		}
	}
	while(!q.empty())
	{
		int u = q.front();
		q.pop();
		wa1 += wa[u];
	}
	printf("%d %d\n",ac1,wa1);
	return 0;
}

Compiler output:
a.cc: In function 'int read()':
a.cc:11:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   11 |         register char cc = getchar();register int cn(0), flus(1);
      |                       ^~
a.cc:11:51: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   11 |         register char cc = getchar();register int cn(0), flus(1);
      |                                                   ^~
a.cc:11:58: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   11 |         register char cc = getchar();register int cn(0), flus(1);
      |                                                          ^~~~
a.cc: In function 'int main()':
a.cc:27:17: error: 'string' was not declared in this scope
   27 |                 string st;
      |                 ^~~~~~
a.cc:4:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    3 | #include<queue>
  +++ |+#include <string>
    4 | #define N 2000010
a.cc:30:17: error: 'cin' was not declared in this scope
   30 |                 cin >> st;
      |                 ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<queue>
  +++ |+#include <iostream>
    4 | #define N 2000010
a.cc:30:24: error: 'st' was not declared in this scope; did you mean 'std'?
   30 |                 cin >> st;
      |                        ^~
      |                        std
Language: C++

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <stdlib.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
using namespace std;

typedef struct coun {

	int ac;
	int wa;
}tsCount;
int main()
{
	int N,M;
	cin >> N>>M;
	
	static int num[100000];
	static char c[100000][3];
	
	for (int i=0;i<M;i++){

		cin >> num[i] >> c[i];
	}

	vector<tsCount> array(N);

	char str[3] = "AC";
	int ACcount = 0;
	int WACount = 0;
	for (int i = 0; i < M; i++) {

		//初めてのACであればAC増やす
		if (strcmp(c[i],str)==0) {
			if (array[num[i]-1].ac==0) {
				array[num[i]-1].ac = 1;
				ACcount++;
			}
		}
		//WAの時。すでにACをしていなければWA数をカウントする
		else {
			if (array[num[i]-1].ac != 1) {
				WACount++;
			}
		}		
	}

	cout << ACcount << " " << WACount;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:21: error: 'strcmp' was not declared in this scope
   37 |                 if (strcmp(c[i],str)==0) {
      |                     ^~~~~~
a.cc:9:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <algorithm>
  +++ |+#include <cstring>
    9 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int n,m;
    cin>>n>>m;
    vector<int> a[100001];
    int solved=0,penalties=0;
    for(int i=0;i<m;i++){
    	int num,cat;
        string s;
      	cin>>num>>s;
        if(s=="WA")
          cat=1;
        else
          cat=2;
        a[num].push_back(cat);
    }
    int s=0,p=0;
    for(int i=1;i<=100000;i++){
    	if(a[i].size()>0){
        	for(int j=0;j<a[i].size();j++){
            	if(a[i][j]==1){
                  p++;
                }
                else{
                	s++;
                    break;
                }
            }
        }
    }
    cout<<s<<" "p;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:14: error: unable to find string literal operator 'operator""p' with 'const char [2]', 'long unsigned int' arguments
   33 |     cout<<s<<" "p;
      |              ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
#define elif else if
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define vtr vector<string>
#define vvtr vector<vector<string>>
#define vhar vector<char>
#define vvhar vector<vector<char>>
#define mod 100000007
#define elif else if
#define str string
int sum(int a){
  int b=0;
  while(true){
    if(a>=1){
      a%=10;
      b+=a%=10;
    }
    else break;
  }
  return b;
}
signed main(){
  int N,M,O,P=0,c=0,c2=0,crash=0,nowtab=1;
  double D,D2;
  char C;
  str S,T,U;
  cin>>N>>M;
  vint p(M);
  vtr s(M);
  vint B(N);rep(0,N)B[i]=0;
  rep(0,M){
    cin>>p[i]>>s[i];
  }
  rep(0,M){
    if(B[p[i]-1]==0&&s[i]=="WA"){
      c2++;
    }
    else if(B[p[i]-1]==0)&&s[i]=="AC"{
      B[p[i]-1]=1;
      c++;
    }
  }
  cout<<c<<" "<<c2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:29: error: expected ';' before '[' token
   47 |     else if(B[p[i]-1]==0)&&s[i]=="AC"{
      |                             ^
      |                             ;
a.cc:47:28: error: label 's' used but not defined
   47 |     else if(B[p[i]-1]==0)&&s[i]=="AC"{
      |                            ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class T>
inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>
inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N,M; cin >> N >> M;
    int cnt[N];
    rep(i,N) cntw[i]=0;
    map<int,bool>can;
    rep(i,M){
        int a; string s;
        cin >> a >> s;
        a--;
        if(s=="WA" && !can[a]){
            cnt[a]++;
        }
        if(s=="AC"){
            can[a]=true;
        }
    }
    int cntw=0;
    int cnta=0;
    rep(i,N){
        if(can[i]){
            cnta++;
            cntw+=cnt[i];
        }
    }

    cout << cnta << " " << cntw << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:14: error: 'cntw' was not declared in this scope; did you mean 'cnt'?
   49 |     rep(i,N) cntw[i]=0;
      |              ^~~~
      |              cnt
Language: C++

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

using namespace std;

using ll long long;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> alreadyAC(n, 0);
	ll ac = 0;
	ll wa = 0;

	for (int i = 0; i < m; i++) {
		int p;
		string s;
		cin >> p >> s;

		p --;

		if (s == "AC") {
			if (alreadyAC[p] == 1) {
				continue;
			}
			alreadyAC[p] = 1;
			ac++;
			continue;

		} else if (s == "WA") {
			if (alreadyAC[p] == 1) {
				continue;
			}
			wa++;
		}

	}
	cout << ac << " " << wa << endl;


	return 0;
}

Compiler output:
a.cc:7:7: error: expected nested-name-specifier before 'll'
    7 | using ll long long;
      |       ^~
a.cc: In function 'int main()':
a.cc:13:9: error: 'll' was not declared in this scope
   13 |         ll ac = 0;
      |         ^~
a.cc:14:11: error: expected ';' before 'wa'
   14 |         ll wa = 0;
      |           ^~~
      |           ;
a.cc:28:25: error: 'ac' was not declared in this scope
   28 |                         ac++;
      |                         ^~
a.cc:35:25: error: 'wa' was not declared in this scope
   35 |                         wa++;
      |                         ^~
a.cc:39:17: error: 'ac' was not declared in this scope
   39 |         cout << ac << " " << wa << endl;
      |                 ^~
a.cc:39:30: error: 'wa' was not declared in this scope
   39 |         cout << ac << " " << wa << endl;
      |                              ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
signed main (){
  int a,b,d,e=0,r=0;
  int q[1000000]={}
  stirng c;
  cin>>a>>b;
  for(int i=0;i<b;i++){
    cin>>d>>c;
    if(q[d]==0){
      if(c=="WA") e++;
      else r++,q[d]=1;
    }
  }
  cout<<e<<" "<<r<<"\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected ',' or ';' before 'stirng'
    6 |   stirng c;
      |   ^~~~~~
a.cc:9:13: error: 'c' was not declared in this scope
    9 |     cin>>d>>c;
      |             ^
Language: C++

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

int main(){
  int arr[10000]=(0);
  int n,m;
  string s;
  cin>>n>>m;
  int c=0,tp=0,p=0;
  for(int i=0;i<m;i++){
    int in;
    cin>>in>>s;
    if(arr[in]==0){
      if(s=="AC"){
        c++;
        arr[in]++;
        tp+=p;
        p=0;
      }else{
        p++;
      }
    }
  }
  cout<<c<<" "<<tp;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:19: error: array must be initialized with a brace-enclosed initializer
    6 |   int arr[10000]=(0);
      |                  ~^~
Language: C++

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

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

    map<int, bool> table;
    int ac = 0, wa = 0;

    while (m--) {
        int a; char b[3];
        cin >> a >> b;
        if (table[a])continue;
        if (strcmp(b, "AC") == 0) {
            table[a] = true;
            ++ac;
        }
        else {
            ++wa;
        }
    }

    cout << ac << " " << wa << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: 'strcmp' was not declared in this scope
   16 |         if (strcmp(b, "AC") == 0) {
      |             ^~~~~~
a.cc:3:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <map>
  +++ |+#include <cstring>
    3 | #include <string>
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main(){
  int N,M;
  int sum_AC=0,sum_WA = 0;
  int temW = 0;
  int p;
  string str;
  cin >> N >> M;
  for(int i=0;i<M;i++){
    cin >> p >> str;
    if(str.compare(AC) == 0){
      sum_AC += 1;
      sum_WA += temW;
      temW = 0;
    }else{
      temW += 1;
    }
  }
  printf("%d %d",sum_AC,sum_WA);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: 'AC' was not declared in this scope
   13 |     if(str.compare(AC) == 0){
      |                    ^~
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int N, M, P[100001];
string S[100001];

int ac_sum = 0, wc_sum = 0;
bool ac[100001];

int main() {
    cin >> N >> M;
    for (int i = 0; i < N; i++) {
        ac[i] = wc[i] = false;
        }
    for (int i = 0; i < M; i++) {
        cin >> P[i] >> S[i];
        if (ac[P[i]]) {
            continue;
        }
        if (S[i] == "AC") {
            ac_sum++;
            ac[P[i]] = true;
        }
        else {
            wc_sum++;
        }
    }
    cout << ac_sum << ' ' << wc_sum << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'wc' was not declared in this scope; did you mean 'ac'?
   16 |         ac[i] = wc[i] = false;
      |                 ^~
      |                 ac
Language: C++

#include <cstdio>
#include <iostream>

using namespace std;

int nilai[100005];

int main(){
   int n,m,nomor,i,benar,salah;
   char hurufpertama, hurufkedua;
   scanf("%d %d", &n,&m);
   getchar();
   benar=0;
   salah=0;
   for(i=1;i<n+1;i++){
      nilai=0;
   }
   for(i=0;i<m;i++){
      scanf("%d %c%c", &nomor, &hurufpertama, &hurufkedua);
      getchar();
      if(nilai[nomor]==0){
         if(hurufpertama=='A'){
            benar++;
            nilai[nomor]=1;
         }
         else{
            salah++;
         }
      }
   }
   cout<<benar<<" "<<salah<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: incompatible types in assignment of 'int' to 'int [100005]'
   16 |       nilai=0;
      |       ~~~~~^~
Language: C++

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;
#define pb push_back
#define ALL(a) (a).begin() , a.end()

int mod = 1e9 + 7;

int add(int a, int b){
	if(a + b >= mod)return a+ b - mod;
	return a + b;
}
int mul(int a, int b){
	return 1LL * a * b  % mod;
}
int power(int a, int b){
	if(b < 0)return 0;
	int re = 1;
	while(b){
		if(b&1){
			re = mul(re, a);
		}
		a = mul(a, a);
		b >>= 1;
	}
	return re;
}
int const N = 100000 + 5;
int fact[N], inverse[N];
void FAC(){
 	fact[0] = 1;
	for(int x = 1; x< N; x++){
		fact[x] = mul(fact[x-1], x);
	}
	inverse[N-1] = power(fact[N-1], mod -2);
	for(int x = N-2; x>= 0; x--){
		inverse[x] = mul(x + 1, inverse[x+1]);
	}

 }

int ncr(int a, int b){
	if(a < b)return 0;
	return mul(fact[a], mul(inverse[a-b], inverse[b]));
}


/******************************************************/

void solve(){
	int n, m;
	cin >> n >> m;
	int pe = 0;
	vector<int> vec(n+1, 0), v(n+1,0);
	for(int x =0; x<m; x++){
		int j;
		string s;
		cin >> j >> s;
		if(s == "AC"){
			vec[j] =1;
		}
		else{
			if(vec[j] == 0)v[j]++;
		}

	}
	int u = 0;
	for(auto a : vec)u += a;
	for(int x = ; x<n+1; x++){
		if(vec[x])pe += v[x];
	}
	cout << u << " " << pe;
}


/******************************************************/
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	int t;
	t = 1;
	// cin >> t;
	while(t--){
		solve();
	}

}

Compiler output:
a.cc: In function 'void solve()':
a.cc:71:21: error: expected primary-expression before ';' token
   71 |         for(int x = ; x<n+1; x++){
      |                     ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i=0; i< n; i++)
using namespace std;


int main() {
	int n,m;
	cin >> n >> m;
  vector<bool> v(n);
  vector<int> w(n);
  rep(i,n){
    v[i]=false;
    w[i]=0;
  }
    
  rep(i,m){
    int q;
    string s;
    cin >> q >> s;
    if (s=="AC") v[q-1]=true;
    if (s=="WA" && v[q-1]= false) w[q-1]+=1;
  }
  int ac=0;
  int wa=0;
  rep(i,n){
    if (v[i]) ac++;
    if (w[i]) wa+=w[i];
  }
  cout << ac << " " << wa << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: lvalue required as left operand of assignment
   24 |     if (s=="WA" && v[q-1]= false) w[q-1]+=1;
      |         ~~~~~~~~^~~~~~~~~
Language: C++

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

int main(){
	int n,m;
    cin>>n>>m;
    map<int,int> mp;
    int solved=0,penalities=0;
    for(int i=0;i<m;i++){
    	int num,cat;
        string s;
        cin>>num>>s;
        if(s=="WA")
          cat=1;
        else
          cat=2;
        if(mp.find(num)==mp.end()){
        	if(cat==1){
            	penalties++;
            }
            else{
            	solved++;
                mp[num]=1;
            }
        }
    }
    cout<<solved<<" "<<penalties;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: 'penalties' was not declared in this scope; did you mean 'penalities'?
   19 |                 penalties++;
      |                 ^~~~~~~~~
      |                 penalities
a.cc:27:24: error: 'penalties' was not declared in this scope; did you mean 'penalities'?
   27 |     cout<<solved<<" "<<penalties;
      |                        ^~~~~~~~~
      |                        penalities
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
 int N;
 int M;
 cin >> N >> M;
 int p[M];
 int a[N]={0};
 int b[N]={0};
 for(i=0;i<M;++i){
     string ans;
   cin >> p[i] >> ans;
   if(ans=="AC")a[p[i]-1]++;
   else{b[p[i]-1]++;}
   }
int count = 0;
int coun = 0;
 for(i=0;i<N;++i){
  if(a[i]>0)count++;
  if(b[i]>0)coun++;
 }
cout << count << " " << coun << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:6: error: 'i' was not declared in this scope
   11 |  for(i=0;i<M;++i){
      |      ^
a.cc:19:6: error: 'i' was not declared in this scope
   19 |  for(i=0;i<N;++i){
      |      ^
Language: C++

#include"bits/stdc++.h"
using namespace std;
int main(void){
  int n,m,p;
  string s;
  bool ac[100000];
  int AC=0,WA=0;
  cin>>n>>m;
  for(int i=0;i<n;++i){
    ac[i]=false;
  }
  for(int i=0;i<m;++i){
    cin>>p>>s;
    if(!ac[p-1]&&s=="WA"){
      ++WA;
    }
    if(s=="AC"){
      ac[p-1]=true;
      ++AC;
    }
    cout<<AC<<" "<<WA;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:22:4: error: expected '}' at end of input
   22 |   }
      |    ^
a.cc:3:15: note: to match this '{'
    3 | int main(void){
      |               ^
Language: C++

#include <iostream>
#include <math.h>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define memset(v, h) memset((v), h, sizeof(v))
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    ll n, m;
    cin >> n >> m;
    ll a[n];
    ll v = 0;
    ll o = 0;
    bool ac[n];
    memset(ac, false);

    rep(i,m){
        ll x;
        string q;
        cin >> x >> q;
        if(ac[x])
        {
            continue;
        }

        if(q == "AC")
        {
            ac[x] = true;
            v++;
        }
        else
        {
            o++;
        } 
    }
    
    cout << v << " " << o << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: 'memset' was not declared in this scope
    7 | #define memset(v, h) memset((v), h, sizeof(v))
      |                      ^~~~~~
a.cc:21:5: note: in expansion of macro 'memset'
   21 |     memset(ac, false);
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <math.h>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  int N,M;in(N,M);
  map<int,int>c,f;
  rep(i,M){
    int p;string s;in(p,s);
    if(f[p]==0&&s=="WA")c[p]++;
    if(f[p]==0&&s=="AC")f[p]++;
  }
  cpp_int cnt=0;
  for(auto e:c)cnt;=e.sd;
  cout<<f.size()<<" "<<cnt<<endl;
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Compiler output:
a.cc:12:9: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   12 | #include<boost/multiprecision/cpp_int.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define lli long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// int const mod = 7340033;
int const mod = 1e9+7;
int power(int a,int b,int m){
    a %= mod;
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}
 
int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 2e5+5;
int const inf = 1e15;
int a[N];
int is[N];


void solve(){
    int i,j,l;
    int n,k,m;
    cin>>n>>m;
    for(i=0;i<=n;i++) is[i] = 0 , a[i] = 0;
    for(i=0;i<m;i++){
        int p;
        string s;
        cin>>p>>s;
        if(s == "AC"){
            is[p] = 1;
        }
        else{
            if(is[p] == 0){
                a[p]++;
            }
        }
    }

    int co = 0;
    int pen = 0;
    for(i=1;i<=n;i++) {
        co += is[p];
        if(is[p] == 1) pen += a[i];
    }
    cout<<co<<" "<<pen<<endl;
}

int32_t main(){
    IOS;
    int t;
    t = 1;  
    // pre();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}

/*

*/

Compiler output:
a.cc: In function 'void solve()':
a.cc:71:18: error: 'p' was not declared in this scope
   71 |         co += is[p];
      |                  ^
Language: C++

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

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

  int n,m;
  cin >> n>>m;
  int p[m];
  string s[m];
  bool ac[n];
  memset(ac, 0, sizeof(ac));
  int numac = 0;
  int numwa = 0;
  for(int i=0; i<m; i++){
    cin >> p[i] >> s[i];
    if(!ac[p[i]]){
      if(s[i] == "AC"){
        numac++;
        ac[p[i]] = true;
      }
      else{
        numwa++;
      }
    }
  }
  cout << numac << " " << numwa << endl;


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:3: error: 'memset' was not declared in this scope
   14 |   memset(ac, 0, sizeof(ac));
      |   ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <string>
Language: C++

#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char str[5];

int main(int argc, char* argv[])
{
    int n,m;
    scanf("%d%d", &n, &m);
    vector<int> flag(n), cnt(n);
    int i;
    int cnt=0;
    for(i=0; i<m; i++) {
        int tmp;
        scanf("%d%s", &tmp, str); tmp--;
        if(strcmp(str,"AC")==0) {
            flag[tmp]=1;
        }
        else {
            if(flag[tmp]==0) {
                cnt[tmp]++;
            }
        }
    }

    int cnt0=0, cnt1=0;
    for(i=0; i<n; i++) {
        if(flag[i]) {
            cnt0++;
            cnt1+=cnt[i];
        }
    }
    printf("%d %d\n", cnt0, cnt1);

    return 0;
}




Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:35:9: error: conflicting declaration 'int cnt'
   35 |     int cnt=0;
      |         ^~~
a.cc:33:26: note: previous declaration as 'std::vector<int> cnt'
   33 |     vector<int> flag(n), cnt(n);
      |                          ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,m;
	cin>>n>>m;
	map<ll,vector<ll> > map;
	for(ll i=1;i<=m;i++){
		ll a;
		string b;
		cin>>a>>b;
		map[a].push_back(b);
	}
	std::map<ll, vector<ll> > :::iterator it;
	ll ans1=0,ans2=0;
	for(it=map.begin();it!=map.end();it++){
		vector<ll> &v=it->second;
		for(ll i=0;i<v.size();i++){
			if(v[i]=="AC"){
				ans2+=i;
				ans1+=1;
				break;
			}
		}
	}
	cout<<ans1<<" "<<ans2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:33: error: no matching function for call to 'std::vector<long long int>::push_back(std::string&)'
   13 |                 map[a].push_back(b);
      |                 ~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const std::vector<long long int>::value_type&' {aka 'const long long int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::vector<long long int>::value_type&&' {aka 'long long int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:15:37: error: expected unqualified-id before ':' token
   15 |         std::map<ll, vector<ll> > :::iterator it;
      |                                     ^
a.cc:17:13: error: 'it' was not declared in this scope; did you mean 'int'?
   17 |         for(it=map.begin();it!=map.end();it++){
      |             ^~
      |             int
a.cc:20:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |                         if(v[i]=="AC"){
Language: C++

//#pragma GCC optimize("O3")
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#define int long long
#define x first
#define y second
#define pb push_back

#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.x<<','<< P.y<<')';}

signed main()
{
    
    #endif 
	speed
	int n,m;cin>>n>>m;
	int ac=0,penalty=0;
	vector<bool> solved(n+1,0);
	vector<int> tmp(n+1,0);
	for (int i = 0; i < m; ++i)
	{
		int problem;
		string verdict;cin>>problem>>verdict;
		if(solved[problem]){continue;}
		else
		{
			if(verdict=="AC"){++ac;solved[problem]=1;penalty+=tmp[problem];}
			else{++tmp[problem];}
		}
	}
	cout<<ac<<" "<<penalty<<"\n";
}

Compiler output:
a.cc:33:6: error: #endif without #if
   33 |     #endif
      |      ^~~~~
Language: C++

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define lli long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// int const mod = 7340033;
int const mod = 1e9+7;
int power(int a,int b,int m){
    a %= mod;
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}
 
int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 2e5+5;
int const inf = 1e15;
int a[N];
int is[N];


void solve(){
    int i,j,l;
    int n,k,m;
    cin>>n>>m;
    for(i=0;i<m;i++){
        int p;
        string s;
        cin>>p>>s;
        if(s == "WA"){
            if(is[p] == 0){
                a[p]++;
            }
        }
        else{
            is[p] = 1;
        }
    }

    int co = 0;
    int pen = 0;
    for(i=1;i<=n;i++) co += is[i] , pe += a[i];
    cout<<co<<" "<<pe<<endl;
}

int32_t main(){
    IOS;
    int t;
    t = 1;
    // pre();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}

/*

*/

Compiler output:
a.cc: In function 'void solve()':
a.cc:69:37: error: 'pe' was not declared in this scope; did you mean 'pen'?
   69 |     for(i=1;i<=n;i++) co += is[i] , pe += a[i];
      |                                     ^~
      |                                     pen
a.cc:70:20: error: 'pe' was not declared in this scope; did you mean 'pen'?
   70 |     cout<<co<<" "<<pe<<endl;
      |                    ^~
      |                    pen
Language: C++

/* winners never quit and quitters never win.
      #swap                                 */
      
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(v) v.begin(),v.end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)

 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ll n,m;
    cin>>n>>m;
    bool done[n]={false};
    ll ww[n]={0}
    ll wrong=0,right=0;
    rep(a,0,m)
    {
		ll p;
		cin>>p;
		string s;
		cin>>s;
		p--;
		if(s=="AC")
		{
			if(!done[p]){
				done[p]=true;
				right++;
				wrong+=ww[p];
			}
		}
		else
		{
			if(!done[p])
				ww[p]++;
		}
	}
	cout<<right<<" "<<wrong<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:66:5: error: expected ',' or ';' before 'll'
   66 |     ll wrong=0,right=0;
      |     ^~
a.cc:78:33: warning: ISO C++ forbids incrementing a pointer of type 'std::ios_base& (*)(std::ios_base&)' [-Wpointer-arith]
   78 |                                 right++;
      |                                 ^~~~~
a.cc:78:38: error: lvalue required as increment operand
   78 |                                 right++;
      |                                      ^~
a.cc:79:33: error: 'wrong' was not declared in this scope
   79 |                                 wrong+=ww[p];
      |                                 ^~~~~
a.cc:88:27: error: 'wrong' was not declared in this scope
   88 |         cout<<right<<" "<<wrong<<endl;
      |                           ^~~~~
Language: C++

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,m,x,v[nmax],tot,tot1,nr[nmax];
string y;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>m;
	while(m--)
	{
		cin>>x>>y;
		if(!v[x] && y=="WA")nr[x]++;
		else if(!v[x] && y=="AC")v[x]=1,tot++;
	}    
	for(i=1;i<=n;i++)if(v[i])tot1+=nr[i];
	cout<<tot<<" "<<tot1<<endl;                                                         
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:13: error: 'i' was not declared in this scope
   36 |         for(i=1;i<=n;i++)if(v[i])tot1+=nr[i];
      |             ^
Language: C

#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define INF 10000000001
#define DIM 200001
#define mod 1000000007
#define PI 3.1415926535897932384626433
#define se second
#define fi first
#define pb push_back
#define T true
#define F false
#define endl "\n"
typedef char ch;
typedef bool boll;
typedef string st;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef set < string > sst;
typedef set < long long > sl;
typedef queue < long long > que;
typedef vector < long long > vec;
typedef map < long long, long long > mll;
typedef pair < long long, long long > pll;
typedef vector < pair < long long, long long > > vpl;
typedef pair < long long, unsigned long long > pul;
ll t,n,m,x,z,c,s,a[100001],b[100001];
int main()
{
    fast;
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        st ss;
        cin>>s>>ss;
        if(ss=="WA" && b[s]==0){
            a[s]++;
        }
        else b[s]=1;
    }
    for(int i=1;i<=n;i++){
        if(b[i]==1){
            x++;
            z+=a[i];
        }
    }
    cout<<x<<" "<<z<<endl;
}


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

##include<bits/stdc++.h>
using namespace std;
int main(void){
  int h,w; cin>>h>>w;
  vector<string> s(h);
  for(auto& i:s) cin>>i;
  queue<pair<int,pair<int,int>>> q;
  int res=0;
  for(int i=0; i<h; ++i) for(int j=0; j<w; ++j){
    vector<vector<bool>> z(h,vector<bool>(w,false));
    if(s[i][j]=='.') q.push({i,{j,0}});
    while(!q.empty()){
      int x=q.front().first;
      int y=q.front().second.first;
      int cnt=q.front().second.second;
      q.pop();
      if(z[x][y]==true) continue; else z[x][y]=true;
      if(x>0) if(s[x-1][y]=='.') q.push({x-1,{y,cnt+1}});
      if(y>0) if(s[x][y-1]=='.') q.push({x,{y-1,cnt+1}});
      if(x<h-1) if(s[x+1][y]=='.') q.push({x+1,{y,cnt+1}});
      if(y<w-1) if(s[x][y+1]=='.') q.push({x,{y+1,cnt+1}});
      res=max(res,cnt);
    }
  }
  cout<<res;
  return 0;
}

Compiler output:
a.cc:1:1: error: stray '##' in program
    1 | ##include<bits/stdc++.h>
      | ^~
a.cc:1:3: error: 'include' does not name a type
    1 | ##include<bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:4:12: error: 'cin' was not declared in this scope
    4 |   int h,w; cin>>h>>w;
      |            ^~~
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector<string> s(h);
      |   ^~~~~~
a.cc:5:10: error: 'string' was not declared in this scope
    5 |   vector<string> s(h);
      |          ^~~~~~
a.cc:5:18: error: 's' was not declared in this scope
    5 |   vector<string> s(h);
      |                  ^
a.cc:7:3: error: 'queue' was not declared in this scope
    7 |   queue<pair<int,pair<int,int>>> q;
      |   ^~~~~
a.cc:7:9: error: 'pair' was not declared in this scope
    7 |   queue<pair<int,pair<int,int>>> q;
      |         ^~~~
a.cc:7:14: error: expected primary-expression before 'int'
    7 |   queue<pair<int,pair<int,int>>> q;
      |              ^~~
a.cc:10:19: error: expected primary-expression before 'bool'
   10 |     vector<vector<bool>> z(h,vector<bool>(w,false));
      |                   ^~~~
a.cc:11:22: error: 'q' was not declared in this scope
   11 |     if(s[i][j]=='.') q.push({i,{j,0}});
      |                      ^
a.cc:12:12: error: 'q' was not declared in this scope
   12 |     while(!q.empty()){
      |            ^
a.cc:17:10: error: 'z' was not declared in this scope
   17 |       if(z[x][y]==true) continue; else z[x][y]=true;
      |          ^
a.cc:22:11: error: 'max' was not declared in this scope
   22 |       res=max(res,cnt);
      |           ^~~
a.cc:25:3: error: 'cout' was not declared in this scope
   25 |   cout<<res;
      |   ^~~~
Language: C++

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

vector<vector<char>> S;
int H,W;

int bfs(int Sx, int Sy){
  vector<int> cost(H*W,-1);
  queue<int> que;
  cost[Sy*W+Sx] = 0;
  que.push(Sy*W+Sx);
  int dx[4] = {-1,0,1,0};
  int dy[4] = {0,-1,0,1};
  while(!que.empty()){
    int v = que.front();
    que.pop();
    int x = v%W;
    int y = floor(v/W);
    for(int i = 0; i < 4; i++){
      if(x+dx[i] >= 0 && x+dx[i] < W && y+dy[i] >= 0 && y+dy[i] < H){
        cout << x << " " << y << " " << x+dx[i] << " " << y+dy[i] << endl;
        if(cost[nv] == -1 && S[y+dy[i]][x+dx[i]] == '.'){
          que.push(nv);
          cost[nv] = cost[v]+1;
        }
      }
    }
  }
  int m = 0;
  for(auto c : cost){
    m = max(c,m);
  }
  return m;
}

int main(){
  cin >> H >> W;
  S.assign(H,vector<char>(W));
  for(int y = 0; y < H; y++){
    for(int x = 0; x < W; x++){
      cin >> S[y][x];
    }
  }
  int m = 0;
  for(int Sy = 0; Sy < H; Sy++){
    for(int Sx = 0; Sx < W; Sx++){
      if(S[Sy][Sx] == '#') break;
      m = max(m,bfs(Sx,Sy));
    }
  }
  cout << m << endl;
}


Compiler output:
a.cc: In function 'int bfs(int, int)':
a.cc:22:17: error: 'nv' was not declared in this scope; did you mean 'v'?
   22 |         if(cost[nv] == -1 && S[y+dy[i]][x+dx[i]] == '.'){
      |                 ^~
      |                 v
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef pair<int,int> P;
typedef long long ll;
const int INF = 1001001001;
const ll INFL = 1e17;
const int MOD = 1e9+7;


int main(){
    int h,w;
    cin >> h >> w;
    vector<string> s;
    rep(i,h){
        string t;
        cin >> t;
        s.push_back(t);
    }

    vector<int> dx{1,-1,0,0};
    vector<int> dy{0,0,1,-1};
    int ans = 0;
    rep(i,h)rep(j,w){
        if(s[i][j]=='#') continue;
        vector<vector<int>> dist(h,vector<int>(w,INF));
        queue<P> que;
        que.push({i,j});
        dist[i][j] = 0;
        while(!que.empty()){
            int x = que.front().first;
            int y = que.front().end;
            rep(dir,4){
                int ix = x+dx[i], iy = y+dy[i];
                if(ix<0 || ix>=w || iy<0 || iy>=h) continue;
                if(s[iy][ix]=='#') continue;
                if(dist[iy][ix]!=INF) continue;
                dist[iy][ix] = dist[y][x]+1;
                que.push({ix,iy});
            }
        }
        rep(ii,h)rep(jj,w){
            if(dist[ii][jj]!=INF){
                ans = max(ans,dist[ii][jj]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:33: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'end'
   32 |             int y = que.front().end;
      |                                 ^~~
Language: C

#include<bits/stdc++.h>
using namespace std;
int n,m,maxx=0,s,minn,a,b,c,d;
char a1[21][21];
int fx[4]= {0,0,1,-1};
int fy[4]= {1,-1,0,0};
int di[21][21];
int dfs(int x,int y,int l,int r) {
	di[x][y]=min(di[x][y],s);
	for (int i=0; i<=3; i++) {
		if (a1[x+fx[i]][y+fy[i]]=='.') {
			a1[x][y]='#';
			s++;
			dfs(x+fx[i],y+fy[i],l,r);
			a1[x][y]='.';
			s--;
		}
	}
}
int main() {
	cin>>n>>m;
	for (int i=1; i<=n; i++) {
		for (int j=1; j<=m; j++) {
			cin>>a1[i][j];
		}
	}
	for (int i=1; i<=n; i++) {
		for (int j=1; j<=m; j++) {
			if (a1[i][j]=='.') {
				for (int i=1; i<=n; i++) {
					for (int j=1; j<=m; j++) {
						di[i][j]=210000000;
					}
				}
				dfs(i,j,i,j);
				for (int i=1; i<=n; i++) {
					for (int j=1; j<=m; j++) {
						if (di[i][j]!=210000000) {
							maxx=max(maxx,di[i][j]);
						}
					}
				}
			}
		}
	}
	cout<<maxx;
}

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

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

/*
BFSを書いて最小の経路コストを保持
最大になるように計算するということは、全探索？
任意の.からBFSを伸ばして、その合計では？
一応、始点と終点を得てからその2点で計算すること
いや、ちょっと待って、H,W<=20だから全点間でBFSできるじゃん
*/

int H, W;
const int INF = 1e9 + 1;

int ht[4] = {0, 1, 0, -1};
int wt[4] = {1, 0, -1, 0};

int bfs(vector<string> s, pair<int,int> start, pair<int,int> goal) {
    int cost[H][W];
    for(int hi=0;hi<H;++hi) for(int wi=0;wi<W;++wi) cost[hi][wi] = INF;
    cost[start.first][start.second] = 0;
    
    queue<pair<int,int>> q;
    q.push(start);
    while(!q.empty()) {
        pair<int,int> now = q.front(); q.pop();
        
        if (now.first == goal.first && now.second == goal.second) continue;
        
        for(int i=0;i<4;++i) {
            int nh = now.first + ht[i];
            int nw = now.second + wt[i];
            if (!(0 <= nh && nh < H)) continue;
            if (!(0 <= nw && nw < W)) continue;
            if (s[nh][nw] == '#') continue;
          
            if (cost[nh][nw] > cost[now.first][now.second] + 1) {
                cost[nh][nw] = cost[now.first][now.second] + 1;
              
                q.push(make_pair(nh, nw));
            }
        }
    }
    
    return cost[goal.first][goal.second];
}

int solve(vector<string> s) {
    int cost = 0;
    for(int hi=0;hi<H;++hi){
        for(int wi=0;wi<W;++wi){
            if (s[hi][wi] == '#') continue;
            for(int hj=0;hj<H;++hj){
                for(int wj=0;wj<W;wj++){
                    if (s[hj][wj] == '#') continue;
                    if(hi==hj && wi==wj) continue;
                    pair<int,int> start = make_pair(hi,wi);
                    pair<int,int> goal = make_pair(hj,wj);

                    cost = max(cost, bfs(s, start, goal));
                }
            }
        }
    }
    return cost;
}

int main() {
    cin >> H >> W;
    vector< string > s(H, "");
    for(int hi=0;hi<H;++hi) {
        cin >> s[hi];
    }
    
    cout << solve(s) << endl;
    
    return 0;
}


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