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

#include <bits/stdc++.h>
using namespace std;
int vis[100][26]={0};
int isfull[1000]={0};

int main() {
    int n,k;
    char tmp[15];
    cin>>n>>k;
    int tol=1;
    getchar();
    while(n--)
    {
        bool f=0;
        gets(tmp);
        for(int i=1;i<=tol;i++)
        {
            if(!vis[i][tmp[0]-'A']&&isfull[i]<k)
            {
                vis[i][tmp[0]-'A']=1;
                isfull[i]++;
                f=1;
                break;
            }
        }
        if(f==0)
        {
            tol++;
            vis[tol][tmp[0]-'A']=1;
            isfull[tol]++;
        }
    }
    int ans=0;
    for(int i=1;i<=tol;i++)
    {
        if(isfull[i]==k)ans++;
    }
   // for(int i=1;i<=tol;i++)cout<<isfull[i]<<" ";cout<<endl;
    cout<<ans<<endl;
    //cout<<tol<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   15 |         gets(tmp);
      |         ^~~~
      |         getw
Language: C++

#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cctype>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
using namespace std;
const int INF=1<<30;

typedef pair<int,int> P;

int main(){
	
	int n,k;
	int ch[28]={0};
	int ans=0;
	//set<string> p; 
	cin>>n>>k;
	
	string s;
	for(int i=0;i<n;i++){
		cin>>s;
		//if(p.find(s)==p.end()){
		//	p.insert(s);	
		 ch[s[0]-'A']++;
		}
	}
	int x=0;
	while(1){
		for(int i=0;i<26;i++){
			if(ch[i]>0){
				x++;
				ch[i]--;
			}
			if(x>=k)
				break;
		}
		if(x>=k){
			ans++;
			x=0;
		}
		else
			break;
	}
	cout<<ans<<endl;
	
}

Compiler output:
a.cc:43:9: error: expected unqualified-id before 'while'
   43 |         while(1){
      |         ^~~~~
a.cc:59:9: error: 'cout' does not name a type
   59 |         cout<<ans<<endl;
      |         ^~~~
a.cc:61:1: error: expected declaration before '}' token
   61 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,k;
	cin>>n>>k;
	vi in(26);
	rep(i,n){
		string s;
		cin>>s;
		in[s[0]-'A']++;
	}
	int out=0;
	while(1){
		sort(all(in),[](int a,int b){
			return a>b;
		});
		rep(i,26)cout<<" "<<in[i];cout<<endl;
//		int co=0;
		rep(i,26)if(in[i]){
			co++;
			in[i]--;
			if(co==k)break;
		}
		if(co!=k)break;
		out++;
	}
	cout<<out<<endl;
}








Compiler output:
a.cc: In function 'int main()':
a.cc:50:25: error: 'co' was not declared in this scope; did you mean 'cos'?
   50 |                         co++;
      |                         ^~
      |                         cos
a.cc:54:20: error: 'co' was not declared in this scope; did you mean 'cos'?
   54 |                 if(co!=k)break;
      |                    ^~
      |                    cos
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main () {
  int dp[128][1001];
  for (int n = 1; n < 1001; n ++) {
    for (int j = 0; j < 128; j ++) {
      if (n == 1) dp[j][n] = j;
      dp[j][n] = -1;
      else {
        for (int i = 0; i < 128; i ++) {
          int kj = j ^ i;
          int ku = max(dp[kj][n - 1] + i, dp[i][n - 1] + kj);
          if (dp[j][n] < ku) dp[j][n] = ku;
        }
      }
    }
  }
  int T;
  cin >> T;
  for (int i = 0; i < T; i ++) {
    int N, D;
    cin >> N >> D;
    cout << dp[D][N] << endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'else' without a previous 'if'
    9 |       else {
      |       ^~~~
a.cc:24:4: error: expected '}' at end of input
   24 |   }
      |    ^
a.cc:3:13: note: to match this '{'
    3 | int main () {
      |             ^
Language: C++

/*************************************************************************
     File Name: C.cpp
     ID: obsoles1
     BLOG: blog.csdn.net/obsolescence
     LANG: C++ 
     Mail: 384099319@qq.com 
     Created Time: 日 10/ 2 12:25:36 2016
 ************************************************************************/
#define MAX(x,y) ((x)>(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();++it)
#define ABS(x,y) ((x)>(y)?((x)-(y)):((y)-(x)))
#define MEM0(x) memset(x,0,sizeof(x))
#define MEM1(x) memset(x,-1,sizeof(x))
#define MEMX(x) memset(x,0x3f,sizeof(x))
#define pb push_back
#include<iostream>
using namespace std;

int main() {
  int t,n,x,i,j;
  cin>>t;
  for (int nc=1; nc<=t; ++nc) {
    cin>>n>>x;
    //cout<<"n="<<n<<" x="<<x<<endl;
    int sum=0;
    for (i=n-2; i>=0; --i) {
      int bit=7-i,xx=x,y=0,cnt=0,b[10];
      MEM0(b);
      for (; xx; xx>>=1) b[cnt++]=xx&1;
      int m=cnt;
      //cout<<"m="<<m<<" bit="<<bit<<endl;
      for (j=0; j<MIN(m,bit); ++j) y+=((!b[j])<<j);
      for (j=MIN(m,bit); j<bit; ++j) y+=((!b[j])<<j);
      //for (j=bit; j<m; ++j) y+=(b[j]<<j);
      //for (j=0; j<m; ++j) cout<<b[j]<<" \n"[j==m-1];
      //cout<<"y="<<y<<endl;
      //cout<<"cnt="<<cnt<<endl;
      sum+=(x^y);
      //cout<<"x^y="<<(x^y)<<endl;
      //cout<<"sum="<<sum<<endl;
      x=y;
    }
    sum+=x;
    cout<<sum<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'memset' was not declared in this scope
   13 | #define MEM0(x) memset(x,0,sizeof(x))
      |                 ^~~~~~
a.cc:29:7: note: in expansion of macro 'MEM0'
   29 |       MEM0(b);
      |       ^~~~
a.cc:18:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   17 | #include<iostream>
  +++ |+#include <cstring>
   18 | using namespace std;
Language: Java

import java.util.*;

class C {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final int T = sc.nextInt();
        for (int i = 0; i < T; i++) {
            final int N = sc.nextInt();
            final int D = sc.nextInt();
            if(N % 2 == 1)
                System.out.println(D + (N - 1) * 127);
            else
                System.out.println((D ^ 127) + (N - 1) * 127);
        }
    }
}
package kupc2016;

public class Main {
    public static void main(String... args) {
        C.main();
    }
}

Compiler output:
Main.java:17: error: class, interface, enum, or record expected
package kupc2016;
^
1 error
Language: C++

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

struct edge {
	int to, cost;
	edge(int t,int c):to(t),cost(c) {}
};
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

//-----------------------------------------------------------------------------

int n;
string s[2]={"..##",".#.#"};

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

	cin>>n;
	string t[2];
	REP(i,4) {
		char res;
		cout<<s[0][i]<<endl<<s[1][i]<<endl;
		cin>>res;
		if(res=='T') {
			t[0]=s[0][i],t[1]=s[1][i];
			break;
		}
	}
	while (true) {
		bool flg=false;
		REP(j,4) {
			REP(i,2) {
				cout<<t[i]<<s[i][j]<<endl;
			}
			char res;
			cin>>res;
			if(res=='T') {
				REP(k,2) t[k]+=s[k][j];
				flg=true;
				break;
			}
		}
		if(!flg||t.size()==n) break;
	}
	while (true) {
		bool flg=false;
		REP(j,4) {
			REP(i,2) {
				cout<<s[i][j]<<t[i]<<endl;
			}
			char res;
			cin>>res;
			if(res=='T') {
				REP(k,2) t[k]=s[k][j]+t[k];
				flg=true;
				break;
			}
		}
		if(!flg||t.size()==n) break;
	}
	REP(i,2) cout<<t[i]<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:28: error: request for member 'size' in 't', which is of non-class type 'std::string [2]' {aka 'std::__cxx11::basic_string<char> [2]'}
   61 |                 if(!flg||t.size()==n) break;
      |                            ^~~~
a.cc:77:28: error: request for member 'size' in 't', which is of non-class type 'std::string [2]' {aka 'std::__cxx11::basic_string<char> [2]'}
   77 |                 if(!flg||t.size()==n) break;
      |                            ^~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
     
int main(){
  int N;
  cin >> N;
  string table[2];
  bool flag = false;
  
  while(1){
    // query
    string n_table[2];
    int cnt = 0;

    for(int i = 0 ; i < 4 ; i++){
      for(int j = 0 ; j < 2 ; j++){
    	n_table[j] = table[j];
      }

      if(flag){
	n_table[0] += (i%2?'#':'.');
	n_table[1] += ((i >> 1)%2?'#':'.');
      }
      else {
	string s1 = (i%2?'#':'.');
	string s2 = ((i >> 1)%2?'#':'.');
	n_table[0] = s1 + n_table[0];
	n_table[1] = s2 + n_table[1];
      }
          
      printf("%s\n%s\n", n_table[0].c_str(), n_table[1].c_str()); fflush(stdout);
      // in
      string str;
      cin >> str;
      if(str == "T"){
    	for(int j = 0 ; j < 2 ; j++){
    	  table[j] = n_table[j];
    	}
    	break;
      }
      if(str == "F"){
	cnt++;
      }
      else if(str == "end"){
    	return 0;
      }
    }
    if(cnt == 4)flag = true;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:25: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   27 |         string s1 = (i%2?'#':'.');
      |                     ~~~~^~~~~~~~~
a.cc:28:32: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   28 |         string s2 = ((i >> 1)%2?'#':'.');
      |                     ~~~~~~~~~~~^~~~~~~~~
Language: C++

//1列(4通り)を質問 -> 当たったら1列（右側に）追加して(4通り)質問 -> …を繰り返すと400回以内で当たらなくなる（かendが返る）
//このとき、質問した列は黒板の右端にある。あとは、同様にして左側を特定すればよい。

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

string reverse(string str) {
	string ret;
	for (int i = (int)str.length() - 1; i >= 0; i--) ret += str[i];
	return ret;
}

int n;
string query[2];

void addCharRight(int type) {
	char c0 = ((type / 2) % 2 ? '#' : '.');
	char c1 = (type % 2 ? '#' : '.');
	query[0] += c0;
	query[1] += c1;
}

void addCharLeft(int type) {
	char c0 = ((type / 2) % 2 ? '#' : '.');
	char c1 = (type % 2 ? '#' : '.');
	reverse(query[0]);
	reverse(query[1]);
	query[0] += c0;
	query[1] += c1;
	reverse(query[0]);
	reverse(query[1]);
}

void delCharRight() {
	string s[2];
	for (int i = 0; i < (int)query[0].size() - 1; i++) s[0] += query[0][i];
	for (int i = 0; i < (int)query[1].size() - 1; i++) s[1] += query[1][i];
	query[0] = s[0];
	query[1] = s[1];
}

void delCharLeft() {
	string s[2];
	for (int i = 1; i < (int)query[0].size(); i++) s[0] += query[0][i];
	for (int i = 1; i < (int)query[1].size(); i++) s[1] += query[1][i];
	query[0] = s[0];
	query[1] = s[1];
}

//return : {T, F, end}
char getQuery() {
	cout << query[0] << endl;
	cout << query[1] << endl;
	cout.flush();
	string ret;
	cin >> ret;
	return ret[0];
}

//return : {T, F, e}
char addQueryRight(int type) {
	addCharRight(type);
	char res = getQuery();
	if (res == 'e' || res == 'T') return res;
	delCharRight(type);
	return res;
}

char addQueryLeft(int type) {
	addCharLeft(type);
	char res = getQuery();
	if (res == 'e' || res == 'T') return res;
	delCharLeft(type);
	return res;
}

signed main() {
	cin >> n;
	
	int j;
	
	while (true) {
		for (j = 0; j < 4; j++) {
			char res = addQueryRight(j);
			if (res == 'e') return 0;
			if (res == 'T') break;
		}
		if (j == 4) break;
	}
	
	while (true) {
		for (j = 0; j < 4; j++) {
			char res = addQueryLeft(j);
			if (res == 'e') return 0;
			if (res == 'T') break;
		}
		if (j == 4) break;
	}
	return 0;
}

Compiler output:
a.cc: In function 'char addQueryRight(int)':
a.cc:66:21: error: too many arguments to function 'void delCharRight()'
   66 |         delCharRight(type);
      |         ~~~~~~~~~~~~^~~~~~
a.cc:35:6: note: declared here
   35 | void delCharRight() {
      |      ^~~~~~~~~~~~
a.cc: In function 'char addQueryLeft(int)':
a.cc:74:20: error: too many arguments to function 'void delCharLeft()'
   74 |         delCharLeft(type);
      |         ~~~~~~~~~~~^~~~~~
a.cc:43:6: note: declared here
   43 | void delCharLeft() {
      |      ^~~~~~~~~~~
Language: C++

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

string query(pair<string,string> p1,pair<string,string> p2){
  string s1,s2;
  s1 = p1.first + p2.first;
  s2 = p1.second + p2.second;
  printf("%s\n%s\n", s1.c_str(), s2.c_str()); fflush(stdout);
  string str;
  cin >> str;
  return str;
}

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

  set<pair<string,string> >st;
  for(int i = 0 ; i < 2 ; i++){
    string str1;
    string str2;
    for(int j = 0 ; j < 4 ; j++){
      str1 += (j%2?".":"#");
      str2 += ((j >> 1)%2?".":"#");
    }
    st.insert(make_pair(str1,str2));
  }

  pair<string,string>rp;
  
  while(1){
    vector<pair<string,string> >vec(st.begin(),st.end());
    for(int i = 0 ; i < vec.size() ; i++){
      for(int k = 0 ; k < 2 ; k++){
	string r;
	pair<string,string>p;
	if(k % 2){
	  r = query(rp,vec[j]);
	  p = make_pair(rp.first + vec[j].first,rp.second + vec[j].second);
	}
	else {
	  r = query(vec[j],rp);
	  p = make_pair(vec[j].first + rp.first,vec[j].second + rp.second);
	}
	// in
	if(r == "T"){
	  if(rp.first.size() > p.first.size())rp = p;
	  st.insert(p);
	}
	else if(r == "end"){
	  return 0;
	}
      }
    }
  }
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:28: error: 'j' was not declared in this scope
   43 |           r = query(rp,vec[j]);
      |                            ^
a.cc:47:25: error: 'j' was not declared in this scope
   47 |           r = query(vec[j],rp);
      |                         ^
Language: C++

#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
char s[SIZE];
int main(){
    DRI(N);gets(s);
    string up,dn;
    bool right=1;
    while(SZ(up)<N){
        if(!right){
            up="."+up;
            dn="."+dn;
        }
        if(right){
            up+=".";
            dn+=".";
            cout<<up<<endl<<dn<<endl;
            fflush(stdout);
            gets(s);
            if(s[0]!='F')continue;

            up[SZ(up)-1]='#';
            cout<<up<<endl<<dn<<endl;
            fflush(stdout);
            gets(s);
            if(s[0]!='F')continue;
            
            dn[SZ(dn)-1]='#';
            cout<<up<<endl<<dn<<endl;
            fflush(stdout);
            gets(s);
            if(s[0]!='F')continue;
            
            up[SZ(up)-1]='.';
            cout<<up<<endl<<dn<<endl;
            fflush(stdout);
            gets(s);
            if(s[0]!='F')continue;
            right=0;
            up="."+up.substr(0,SZ(up)-1);
            dn="."+dn.substr(0,SZ(dn)-1);
        }
        cout<<up<<endl<<dn<<endl;
        fflush(stdout);
        gets(s);
        if(s[0]!='F')continue;
        
        up[0]='#';
        cout<<up<<endl<<dn<<endl;
        fflush(stdout);
        gets(s);
        if(s[0]!='F')continue;

        dn[0]='#';
        cout<<up<<endl<<dn<<endl;
        fflush(stdout);
        gets(s);
        if(s[0]!='F')continue;

        up[0]='.';
        cout<<up<<endl<<dn<<endl;
        fflush(stdout);
        gets(s);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:12: error: 'gets' was not declared in this scope; did you mean 'getw'?
   32 |     DRI(N);gets(s);
      |            ^~~~
      |            getw
Language: C++

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

string query(pair<string,string> p1,pair<string,string> p2){
  string s1,s2;
  s1 = p1.first + p2.first;
  s2 = p1.second + p2.second;
  printf("%s\n%s\n", s1.c_str(), s2.c_str()); fflush(stdout);
  string str;
  cin >> str;
  return str;
}

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

  set<pair<string,string> >st;
  for(int i = 0 ; i < 2 ; i++){
    string str1;
    string str2;
    for(int j = 0 ; j < 4 ; j++){
      str1 += (j%2?".":"#");
      str2 += ((j >> 1)%2?".":"#");
    }
    st.insert(make_pair(str1,str2));
  }
  
  while(1){
    vector<pair<string,string>vec(st.begin(),st.end());
    for(int i = 0 ; i < vec.size() ; i++){
      for(int j = i ; j < vec.size() ; j++){
	for(int k = 0 ; k < 2 ; k++){
	  string r;
	  pair<string,string>p;
	  if(k % 2){
	    r = query(vec[i],vec[j]);
	    p = make_pair(vec[i].first + vec[j].first,vec[i].second + vec[j].second);
	  }
	  else {
	    r = query(vec[j],vec[i]);
	    p = make_pair(vec[j].first + vec[i].first,vec[j].second + vec[i].second);
	  }
	  // in
	  if(r == "T"){
	    st.insert(p);
	  }
	  else if(r == "end"){
	    return 0;
	  }
	}
      }
    }
  }
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:54: error: template argument 1 is invalid
   35 |     vector<pair<string,string>vec(st.begin(),st.end());
      |                                                      ^
a.cc:35:54: error: template argument 2 is invalid
a.cc:36:25: error: 'vec' was not declared in this scope
   36 |     for(int i = 0 ; i < vec.size() ; i++){
      |                         ^~~
Language: C++

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

string query(pair<string,string> p1,pair<string,string> p2){
  string s1,s2;
  s1 = p1.first + p2.first;
  s2 = p1.second + p2.second;
  printf("%s\n%s\n", s1.c_str(), s2.c_str()); fflush(stdout);
  string str;
  cin >> str;
  return str;
}

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

  set<pair<string,string> >st;
  for(int i = 0 ; i < 2 ; i++){
    string str1;
    string str2;
    for(int j = 0 ; j < 4 ; j++){
      str1 += (j%2?".":"#");
      str2 += ((j >> 1)%2?".":"#");
    }
    st.insert(make_pair(str1,str2));
  }
  
  while(1){
    vector<pair<string,string>vec(st.begin(),st.end());
    for(int i = 0 ; i < vec.size() ; i++){
      for(int j = i ; j < vec.size() ; j++){
	for(int k = 0 ; k < 2 ; k++){
	  string r;
	  pair<string,string>p;
	  if(k % 2){
	    r = query(vec[i],vec[j]);
	    p = make_pair(vec[i].first + vec[j].first,vec[i].second + vec[j].second);
	  }
	  else {
	    r = query(vec[j],vec[i]);
	    p = make_pair(vec[j].first + vec[i].first,vec[j].second + vec[i].second);
	  }
	  // in
	  if(r == "T"){
	    st.insert(p);
	  }
	  else if(r == "end"){
	    return 0;
	  }
	}
      }
    }
  }
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: 'set' was not declared in this scope
   22 |   set<pair<string,string> >st;
      |   ^~~
a.cc:6:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    5 | #include<map>
  +++ |+#include <set>
    6 | using namespace std;
a.cc:22:27: error: expected primary-expression before '>' token
   22 |   set<pair<string,string> >st;
      |                           ^
a.cc:22:28: error: 'st' was not declared in this scope; did you mean 'std'?
   22 |   set<pair<string,string> >st;
      |                            ^~
      |                            std
a.cc:34:54: error: template argument 1 is invalid
   34 |     vector<pair<string,string>vec(st.begin(),st.end());
      |                                                      ^
a.cc:34:54: error: template argument 2 is invalid
a.cc:35:25: error: 'vec' was not declared in this scope
   35 |     for(int i = 0 ; i < vec.size() ; i++){
      |                         ^~~
Language: C++

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

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

  string table[2];
  for(int i = 0 ; i < 2 ; i++){
    for(int j = 0 ; j < N ; j++){
      table[i] += '.';
    }
  }
  
  while(1){
    // query
    string n_table[2];
    for(int i = 0 ; i < 4 ; i++){
      for(int j = 0 ; j < 2 ; j++){
	n_table[j] = table[j];
      }

      n_table[0] += (i%2?'#':'.');
      n_table[1] += ((i >> 1)%2?'#':'.');
      
      printf("%s\n%s\n", n_table[0].c_str(), n_table[1].c_str()); fflush(stdout);
      // in
      string str;
      cin >> str;
      if(str == "T"){
	for(int j = 0 ; j < 2 ; j++){
	  table[j] = n_table[j];
	}
	break;
      }
      else if(str == "end"){
	return 0;
      }
    }
  return 0;
}


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

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

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

  string table[2];
  for(int i = 0 ; i < 2 ; i++){
    for(int j = 0 ; j < N ; j++){
      table[i] += '.';
    }
  }
  
  while(1){
    // query
    string n_table[2];
    for(int i = 0 ; i < 4 ; i++){
      for(int j = 0 ; j < 2 ; j++){
	n_table[j] = table[j];
      }

      n_table[0] += (i%2?'#':'.');
      n_table[1] += ((i >> 1)%2?'#':'.');
      
      printf("%s\n%s\n", n_table[0], n_table[1]); fflush(stdout);
      // in
      string str;
      cin >> str;
      if(str == "T"){
	for(int j = 0 ; j < 2 ; j++){
	  table[j] = n_table[j];
	}
	break;
      }
      else if(str == "end"){
	return 0;
      }
    }
  return 0;
}


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

#include <bits/stdc++.h>

using namespace std;

const string du[] = {".", ".", "#", "#"};
const string dd[] = {".", "#", ".", "#"};

char s[77];

string ask(string u, string d) {
  printf("%s\n%s\n", u.c_str(), d.c_str());
  fflush(stdout);
  scanf("%s", s);
  return s;
}

int main() {
  int n;
  scanf("%d", &n);
  string u = "", d = "";
  int sw = 0;
  while (true) {
    int j;
    for (j = 0; j < 4; ++j) {
      ++cnt;
      string r = (sw == 0 ? ask(u + du[j], d + dd[j]) : ask(du[j] + u, dd[j] + d));
      if (r == "end") {
        return 0;
      }
      if (r == "T") {
        break;
      }
    }
    if (j == 4) {
      sw = 1 - sw;
      continue;
    }
    if (sw == 0) {
      u += du[j];
      d += dd[j];
    } else {
      u = du[j] + u;
      d = dd[j] + d;
    }
  }
}

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

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

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

    vector<string> s(2);
    bool isRight = true;
    for(int i=0; i<n; ++i){
        for(int j=0; ; ++j){
            vector<string> t(2);
            if(isRight){
                t[0] = s[0] + ((j & 1) ? '#' : '.');
                t[1] = s[1] + ((j & 2) ? '#' : '.');
            }
            else{
                t[0] = ((j & 1) ? '#' : '.') + s[0];
                t[1] = ((j & 2) ? '#' : '.') + s[1];
            }

            cout << s[0] << endl << s[1] << endl;
            string input;
            cin >> input;
            if(input == "T" || input == "end"){
                s = t;
                break;
            }
            if(j == 3)
                isRight = false;
        }
    }

    return 0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:13: error: expected ';' before '}' token
   56 |     return 0
      |             ^
      |             ;
   57 | }
      | ~
Language: C++

#pragma region head
#include <bits/stdc++.h>

#include <atcoder/maxflow>
using namespace std;
using namespace atcoder;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
using vv = vector<vector<T>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rrepi(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bit(n) (1LL << (n))
template <class T>
inline bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const int INF = 1002003004;
const ll LINF = 1002003004005006007ll;
struct preprocess {
    preprocess() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} ____;
#pragma endregion head

#pragma region library
#pragma endregion library
int h, w;
int coord(int x, int y, bool in) {
    if (in) {
        return x * w + y;
    } else {
        return h * w + (x * w + y);
    }
}
int main() {
    cin >> h >> w;
    vv<char> grid(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> grid[i][j];
    mf_graph<int> g(2 * h * w + 2);
    int s = 2 * h * w, t = 2 * h * w + 1;
    bool flag = false;
    rep(i, h) rep(j, w) {
        if (i < h - 1) {
            g.add_edge(coord(i, j, false), coord(i + 1, j, true), INF);
            g.add_edge(coord(i + 1, j, false), coord(i, j, true), INF);
        }
        if (j < w - 1) {
            g.add_edge(coord(i, j, false), coord(i, j + 1, true), INF);
            g.add_edge(coord(i, j + 1, false), coord(i, j, true), INF);
        }
        if (grid[i][j] == 'X') {
            g.add_edge(s, coord(i, j, true), INF);
            g.add_edge(coord(i, j, true), coord(i, j, false), INF);
        } else {
            g.add_edge(coord(i, j, true), coord(i, j, false), 1);
        }
        if (i == 0 || i == h - 1 || j == 0 || j == w - 1) {
            g.add_edge(coord(i, j, false), t, INF);
            if (grid[i][j] == 'X') flag = true;
        }
    }
    if (flag) {
        cout << -1 << '\n';
        return 0;
    }
    cout << g.flow(s, t) << '\n';
}

Compiler output:
a.cc:4:10: fatal error: atcoder/maxflow: No such file or directory
    4 | #include <atcoder/maxflow>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#pragma region head
#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
using vv = vector<vector<T>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rrepi(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bit(n) (1LL << (n))
template <class T>
inline bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const int INF = 1002003004;
const ll LINF = 1002003004005006007ll;
struct preprocess {
    preprocess() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} ____;
#pragma endregion head

#pragma region library
#pragma endregion library
int h, w;
int coord(int x, int y, bool in) {
    if (in) {
        return x * w + y;
    } else {
        return h * w + (x * w + y);
    }
}
int main() {
    cin >> h >> w;
    vv<char> grid(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> grid[i][j];
    mf_graph<int> g(2 * h * w + 2);
    int s = 2 * h * w, t = 2 * h * w + 1;
    bool flag = false;
    rep(i, h) rep(j, w) {
        if (i < h - 1) {
            g.add_edge(coord(i, j, false), coord(i + 1, j, true), INF);
            g.add_edge(coord(i + 1, j, false), coord(i, j, true), INF);
        }
        if (j < w - 1) {
            g.add_edge(coord(i, j, false), coord(i, j + 1, true), INF);
            g.add_edge(coord(i, j + 1, false), coord(i, j, true), INF);
        }
        if (grid[i][j] == 'X') {
            g.add_edge(s, coord(i, j, true), INF);
            g.add_edge(coord(i, j, true), coord(i, j, false), INF);
        } else {
            g.add_edge(coord(i, j, true), coord(i, j, false), 1);
        }
        if (i == 0 || i == h - 1 || j == 0 || j == w - 1) {
            g.add_edge(coord(i, j, false), t, INF);
            if (grid[i][j] == 'X') flag = true;
        }
    }
    if (flag) {
        cout << -1 << '\n';
        return 0;
    }
    cout << g.flow(s, t) << '\n';
}

Compiler output:
a.cc:4:10: fatal error: atcoder/all: No such file or directory
    4 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAX = 4e4;
const int OO = 0x3f3f3f3f3f3f3f3f;
int SOURCE, SINK;

struct edge
{
    int v, f, c;
    edge(){}
    edge(int _v, int _f, int _c)
    {
        v = _v, f = _f, c = _c;
    }
};

vector<edge> edges;
vector<int> G[MAX];
int dist[MAX], work[MAX];

void add_edge(int u, int v, int cp, int rc){
	edges.push_back(edge(v, 0, cp));
	G[u].push_back(edges.size()-1);
	edges.push_back(edge(u, 0, rc));
	G[v].push_back(edges.size()-1);
}

bool bfs(int s, int t)
{
    memset(dist, -1, sizeof(dist));
    dist[s] = 0;
    queue<int> q;
    q.push(s);
    while(!q.empty())
    {
        int u = q.front();
        q.pop();
        for(int e : G[u])
            if(dist[edges[e].v] == -1 and edges[e].c-edges[e].f > 0)
            {
                q.push(edges[e].v);
                dist[edges[e].v] = dist[u] + 1;
            }
    }
    return dist[t] != -1;
}

int dfs(int s, int t, int f)
{
    if(s == t) return f;
    for(int &i = work[s]; i < G[s].size(); i++)
    {
    	int e = G[s][i];
        if(dist[edges[e].v] == dist[s] + 1 and edges[e].c-edges[e].f > 0)
            if(int a = dfs(edges[e].v, t, min(f, edges[e].c-edges[e].f)))
            {
                edges[e].f += a;
                edges[e^1].f -= a;
                return a;
            }
    }
    return 0;
}

int MaxFlow(int s, int t)
{
    int mf = 0;
    while(bfs(s, t))
	{
    	memset(work, 0, sizeof(work));
        while(int a = dfs(s, t, OO))
            mf += a;
    }
    return mf;
}

int n, m, a, b;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};

bool check(int x, int y)
{
	return x >= 0 and x < n and y >= 0 and y < m;
}

int vertexIn(int i, int j)
{
	return i * m + j;
}

int vertexOut(int i, int j)
{
	return i * m + j + n * m + 1;
}

int main()
{
 	cin >> n >> m;
 	SOURCE = 2 * n * m + 2;
 	SINK = 2 * n * m + 3;
 	for(int i = 0; i < n; i++)
 		for(int j = 0; j < m; j++)
 		{
 			char c;
 			cin >> c;
 			int cost = 1;
 			if(c == 'X') cost = OO;
 			add_edge(vertexIn(i, j), vertexOut(i, j), cost, 0);
 			if(cost == OO) add_edge(vertexOut(i, j), SINK, OO, 0);
 			for(int k = 0; k < 4; k++)
 			{
				int x = i + dx[k], y = j + dy[k];
				if(check(x, y))
 					add_edge(vertexOut(i, j), vertexIn(x, y), OO, 0);
 			}
 			if(!i or !j or i == n - 1 or j == m - 1)
 				add_edge(SOURCE, vertexIn(i, j), OO, 0);
 		}	
	int ans = MaxFlow(SOURCE, SINK);
	if(ans >= 5 * n * m) ans = -1;
 	cout << ans << '\n';
    return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

const int N = 100;
string s[N + 5];
int mark[N + 5][N + 5];
int red[N + 5][N + 5];

int py[] = {1,0,-1,0};
int px[] = {0,1,0,-1};

void hora(int tc) {
	int r,c;
	cin>>r>>c;
	for(int i = 0;i < r;i++) cin>>s[i];
	for(int i = 0;i < r;i++){
		if(s[i][0] == 'X' || s[i][c - 1] == 'X') {
			cout<<"-1"<<endl;
			return ;
		}
	}
	for(int i = 0;i < c;i++){
		if(s[0][i] == 'X' || s[r - 1][c] == 'X') {
			cout<<"-1"<<endl;
			return ;
		}
	}
	for(int i = 1;i < r - 1;i++) {
		for(int j = 1;j < c - 1;j++) {
			if(s[i][j] == 'X') {
				for(int k = 0;k < 4;k++) {
					int ny = i + py[k];
					int nx = j + px[k];
					if(s[ny][nx] == 'X') continue;
					mark[ny][nx] = 1;
				}
			}
		}
	}
	int tot = 0;
	for(int i = 0;i < r;i++) {
		for(int j = 0;j < c;j++) {
			if(mark[i][j] == 1) {
				bool stay = false;
				if(i  == 0 || i == r - 1 || j == 0 || j == c - 1) stay = true;
				else {
					for(int k = 0;k < 4;k++) {
						int ny = i + py[k];
						int nx = j + px[k];
						else if(s[ny][nx] == '.' && mark[ny][nx] == 0) stay = true;
					}					
				}
				if(stay == true) tot++;
			}
		}
	}
	cout<<tot<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}




Compiler output:
a.cc: In function 'void hora(int)':
a.cc:103:49: error: 'else' without a previous 'if'
  103 |                                                 else if(s[ny][nx] == '.' && mark[ny][nx] == 0) stay = true;
      |                                                 ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <unordered_set>
using namespace std;
#define long long ll

int n, m;

bool inrange(int x, int y) {
	return x >= 0 && x < n && y >= 0 && y < m;
}

int main() {
	int ans = 0, mask[4][2] = { {1, 0},{-1, 0},{0, 1},{0, -1} };
	cin >> n >> m;
	vector<string>v(n);
	for (int i = 0; i < n; ++i)
		cin >> v[i];
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if (v[i][j] == 'X') {
				for (int k = 0; k < 4; ++k) {
					int nx = i + mask[k][0], ny = j + mask[k][1];
					if (!inrange(nx, ny))
						return cout << -1, 0;
					else {
						if (v[nx][ny] == '.')
							v[nx][ny] = '#', ++ans;
					}
				}
			}
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if (v[i][j] == '#') {
				bool ok = 1;
				for (int k = 0; k < 4 && ok; ++k) {
					int nx = i + mask[k][0], ny = j + mask[k][1];
					if (!inrange(nx, ny) || v[nx][ny] == '.')
						ok = 0;
				}
				if (ok)
					--ans;
			}
		}
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'vector' was not declared in this scope
   17 |         vector<string>v(n);
      |         ^~~~~~
a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    4 | #include <unordered_set>
  +++ |+#include <vector>
    5 | using namespace std;
a.cc:17:22: error: expected primary-expression before '>' token
   17 |         vector<string>v(n);
      |                      ^
a.cc:17:23: error: 'v' was not declared in this scope
   17 |         vector<string>v(n);
      |                       ^
Language: C++

#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

class Network{
	private:
	int V;
	struct edge{
		int to,cap,rev;
	};
	vector<vector<edge> > List;
	int DFS(int v,int t,int f,vb& used){
		if(v==t) return f;
		used[v]=1;
		for(int i=0;i<List[v].size();i++){
			edge &e=List[v][i];
			if(!used[e.to]&&e.cap>0){
				int d=DFSplus(e.to,t,min(f,e.cap),used);
				if(d>0){
					e.cap-=d;
					List[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	public:
	Network(int v){
		V=v;
		List=vector<vector<edge> >(v);
	}
	void add_edge(int s,int t,int c){
		List[s].push_back(edge{t,c,(int)List[t].size()});
		List[t].push_back(edge{s,0,(int)List[s].size()-1});
	}
	int MF(int s,int t){
		int ans=0;
		while(1){
			vb used(V);
			int f=DFS(s,t,inf,used);
			if(f==0) return ans;
			ans+=f;
		}
	}
};

int h,w;
vvc a;

inline int f(int x,int y){
	return x*w+y;
}

int main(){
	cin>>h>>w;
	a=vvc(h,vc(w));
	Network nt(2*h*w+2);
	bool flag=1;
	for(int i=0;i<h;i++) for(int j=0;j<w;j++){
		cin>>a[i][j];
		if(a[i][j]=='X') nt.add_edge(2*h*w,h*w+f(i,j),inf);
		else nt.add_edge(f(i,j),h*w+f(i,j),1);
		if(!i||i==h-1||!j||j==w-1){
			nt.add_edge(h*w+f(i,j),2*h*w+1,inf);
			if(a[i][j]=='X') flag=0;
		}
		for(int k=0;k<4;k++){
			int x=i+dx[k],y=j+dy[k];
			if(x>=0&&x<h&&y>=0&&y<w) nt.add_edge(h*w+f(i,j),f(x,y),inf);
		}
	}
	if(!flag){
		cout<<-1<<endl;
		return 0;
	}
	cout<<nt.MF(2*h*w,2*h*w+1)<<endl;
}

Compiler output:
a.cc: In member function 'int Network::DFS(int, int, int, vb&)':
a.cc:60:39: error: 'DFSplus' was not declared in this scope
   60 |                                 int d=DFSplus(e.to,t,min(f,e.cap),used);
      |                                       ^~~~~~~
Language: C++

#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

class Network{
	private:
	int V;
	struct edge{
		int to,cap,rev;
	};
	vector<vector<edge> > List;
	int DFS(int v,int t,int f,vb& used){
		if(v==t) return f;
		used[v]=1;
		for(int i=0;i<List[v].size();i++){
			edge &e=List[v][i];
			if(!used[e.to]&&e.cap>0){
				int d=DFSplus(e.to,t,min(f,e.cap),used);
				if(d>0){
					e.cap-=d;
					List[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	public:
	Network(int v){
		V=v;
		List=vector<vector<edge> >(v);
	}
	void add_edge(int s,int t,int c){
		List[s].push_back(edge{t,c,(int)List[t].size()});
		List[t].push_back(edge{s,0,(int)List[s].size()-1});
	}
	int MF(int s,int t){
		int ans=0;
		while(1){
			vb used(V);
			int f=DFS(s,t,inf,used);
			if(f==0) return ans;
			ans+=f;
		}
	}
};

int h,w;
vvc a;

inline int f(int x,int y){
	return x*w+y;
}

int main(){
	cin>>h>>w;
	a=vvc(h,vc(w));
	Network nt(2*h*w+2);
	bool flag=1;
	for(int i=0;i<h;i++) for(int j=0;j<w;j++){
		cin>>a[i][j];
		if(a[i][j]=='X') nt.add_edge(2*h*w,h*w+f(i,j),inf);
		else nt.add_edge(f(i,j),h*w+f(i,j),1);
		if(!i||i==h-1||!j||j==w-1){
			nt.add_edge(h*w+f(i,j),2*h*w+1,inf);
			if(a[i][j]=='X') flag=0;
		}
		for(int k=0;k<4;k++){
			int x=i+dx[k],y=j+dy[k];
			if(x>=0&&x<h&&y>=0&&y<w) nt.add_edge(h*w+f(i,j),f(x,y),inf);
		}
	}
	if(!flag){
		cout<<-1<<endl;
		return 0;
	}
	cout<<nt.MFplus(2*h*w,2*h*w+1)<<endl;
}

Compiler output:
a.cc: In member function 'int Network::DFS(int, int, int, vb&)':
a.cc:60:39: error: 'DFSplus' was not declared in this scope
   60 |                                 int d=DFSplus(e.to,t,min(f,e.cap),used);
      |                                       ^~~~~~~
a.cc: In function 'int main()':
a.cc:119:18: error: 'class Network' has no member named 'MFplus'
  119 |         cout<<nt.MFplus(2*h*w,2*h*w+1)<<endl;
      |                  ^~~~~~
Language: C

	      else     ny--;
	    }
	    nx--;
	  }
	}
      }	      
      //for(k=1;k<tr;k++)s+=MAX(abs(ty[k]-ty[k-1]),abs(tx[k]-tx[k-1]));
      //s+=4;//printf("\n");
    }
  }
  //for(i=0;i<h;i++)printf("%s\n",d[i+2]+2);
  qy[t=0]=qx[0]=c=0;
  d[0][0]=1;
  for(r=1;r-t;t++){
    for(k=0;k<4;k++){
      ny=qy[t]+Y[k];
      nx=qx[t]+X[k];
      if(ny<0||h+2<ny||nx<0||w+2<nx)continue;
      if(d[ny][nx]=='#'){
	c++;
	d[ny][nx]=1;
      }
      if(d[ny][nx]==1)continue;
      d[qy[r]=ny][qx[r]=nx]=1;
      r++;
    }
  }
  printf("%d\n",c);
  return 0;
}


Compiler output:
main.c:1:15: error: expected identifier or '(' before 'else'
    1 |               else     ny--;
      |               ^~~~
main.c:2:13: error: expected identifier or '(' before '}' token
    2 |             }
      |             ^
main.c:3:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '--' token
    3 |             nx--;
      |               ^~
main.c:4:11: error: expected identifier or '(' before '}' token
    4 |           }
      |           ^
main.c:5:9: error: expected identifier or '(' before '}' token
    5 |         }
      |         ^
main.c:6:7: error: expected identifier or '(' before '}' token
    6 |       }
      |       ^
main.c:9:5: error: expected identifier or '(' before '}' token
    9 |     }
      |     ^
main.c:10:3: error: expected identifier or '(' before '}' token
   10 |   }
      |   ^
main.c:12:6: error: 't' undeclared here (not in a function)
   12 |   qy[t=0]=qx[0]=c=0;
      |      ^
main.c:12:3: warning: data definition has no type or storage class
   12 |   qy[t=0]=qx[0]=c=0;
      |   ^~
main.c:12:3: error: type defaults to 'int' in declaration of 'qy' [-Wimplicit-int]
main.c:12:11: error: 'qx' undeclared here (not in a function); did you mean 'qy'?
   12 |   qy[t=0]=qx[0]=c=0;
      |           ^~
      |           qy
main.c:12:17: error: 'c' undeclared here (not in a function)
   12 |   qy[t=0]=qx[0]=c=0;
      |                 ^
main.c:13:3: warning: data definition has no type or storage class
   13 |   d[0][0]=1;
      |   ^
main.c:13:3: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
main.c:13:11: error: invalid initializer
   13 |   d[0][0]=1;
      |           ^
main.c:14:3: error: expected identifier or '(' before 'for'
   14 |   for(r=1;r-t;t++){
      |   ^~~
main.c:14:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '-' token
   14 |   for(r=1;r-t;t++){
      |            ^
main.c:14:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   14 |   for(r=1;r-t;t++){
      |                ^~
main.c:28:10: error: expected declaration specifiers or '...' before string constant
   28 |   printf("%d\n",c);
      |          ^~~~~~
main.c:28:17: error: expected declaration specifiers or '...' before 'c'
   28 |   printf("%d\n",c);
      |                 ^
main.c:29:3: error: expected identifier or '(' before 'return'
   29 |   return 0;
      |   ^~~~~~
main.c:30:1: error: expected identifier or '(' before '}' token
   30 | }
      | ^