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

#include <iostream>
using namespace std;
int n, a[375][22]; bool vis[375][3][3][7][7][7][7], dp[375][3][3][7][7][7][7];
int solve(int pos, int x, int y, int d1, int d2, int d3, int d4) {
	if (pos == n) return true;
	int b = x * 4 + y;
	if (a[pos][b] || a[pos][b + 1] || a[pos][b + 4] || a[pos][b + 5]) return false;
	if (vis[pos][x][y][d1][d2][d3][d4]) return dp[pos][x][y][d1][d2][d3][d4];
	bool ret = false;
	for (int i = 0; i <= 2 && !ret; i++) {
		for (int j = 0; j <= 2 && !ret; j++) {
			if (i != x && j != y) continue;
			int nd1 = d1 + 1, nd2 = d2 + 1, nd3 = d3 + 1, nd4 = d4 + 1;
			if (i == 0 && j == 0) nd1 = 0;
			if (i == 0 && j == 2) nd2 = 0;
			if (i == 2 && j == 0) nd3 = 0;
			if (i == 2 && j == 2) nd4 = 0;
			if (nd1 < 7 && nd2 < 7 && nd3 < 7 && nd4 < 7 && solve(pos + 1, i, j, nd1, nd2, nd3, nd4)) ret = true;
		}
	}
	vis[pos][x][y][d1][d2][d3][d4] = true;
	dp[pos][x][y][d1][d2][d3][d4] = ret;
	return ret;
}
int main() {
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 16; j++) {
				cin >> a[i][j];
			}
		}
		memset(vis, 0, sizeof(vis));
		memset(dp, 0, sizeof(dp));
		bool ret = solve(0, 1, 1, 1, 1, 1, 1);
		cout << (ret ? 1 : 0) << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:17: error: 'memset' was not declared in this scope
   32 |                 memset(vis, 0, sizeof(vis));
      |                 ^~~~~~
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 | using namespace std;
Language: C++

#include<iostream>
#include<sstream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

int n;
bool market[365][16];
bool V[366][2401][9];

bool check(int day,int y,int x)
{
	rep(i,2)rep(j,2)if(market[day][(y+i)*4+x+j])return 0;
	return 1;
}
bool visit(int day,int y,int x,int r0,int r1,int r2,int r3)
{
	bool &v=V[day][343*r0+49*r1+7*r2+r3][y*3+x];
	if(v)return 1;
	
	v=1;
	return 0;
}
bool dfs(int day,int cy,int cx,int r0,int r1,int r2,int r3)
{
	if(day>=n)return 1;
	
	for(int ny=cy-2;ny<=cy+2;ny++)for(int nx=cx-2;nx<=cx+2;nx++)
	if(ny==cy||nx==cx)
	if(0<=ny&&ny<3&&0<=nx&&nx<3)
	{
		if(!check(day,ny,nx))continue;
		int nr0=r0,nr1=r1,nr2=r2,nr3=r3;
		if(ny==0&&nx==0)nr0=0; else nr0++;
		if(ny==0&&nx==2)nr1=0; else nr1++;
		if(ny==2&&nx==0)nr2=0; else nr2++;
		if(ny==2&&nx==2)nr3=0; else nr3++;
		
		if(nr0>=7||nr1>=7||nr2>=7||nr3>=7)continue;
		if(visit(day+1,ny,nx,nr0,nr1,nr2,nr3))continue;
		if(dfs(day+1,ny,nx,nr0,nr1,nr2,nr3))return 1;
	}
	return 0;
}
int main()
{
	while(scanf("%d",&n),n)
	{
		rep(i,n)rep(j,16)scanf("%d",market[i]+j);
		rep(i,n+1)rep(j,2401)fill_n(V[i][j],9,0);
		
		if(!check(0,1,1))
		{
			cout<<0<<endl; continue;
		}
		cout<<dfs(1,1,1,1,1,1,1)<<endl;
	}
	return 0;
}
}

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

#include<set>
#include<cstdio>
#include<vector>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int to[9][5]; // to[i] : 雲が位置 i から移動できる位置

int n;
int sun[366][16]; // sun[t][j]==1 <=> t 日目にマス j は晴れていないといけない
int rain[9][16]; // rain[i][j]==1 <=> 雲が位置 i にいるとき, マス j は雨

set< vector<int> > vis[366][9];
bool dfs(int t,int i,vector<int> last){
	if(vis[t][i].count(last)==1) return false;
	vis[t][i].insert(last);

	rep(j,16){
		if(rain[i][j]==1){
			last[j]=0;
			if(sun[t][j]==1) return false;
		}
		else{
			last[j]++;
			if(last[j]>=7) return false;
		}
	}

	if(t==n) return true;

	rep(j,5) if(dfs(t+1,to[i][j],last)) return true;
	return false;
}

int main(){
	to[0][0]=0;
	to[0][1]=1;
	to[0][2]=2;
	to[0][3]=3;
	to[0][4]=6;
	to[1][0]=1;
	to[1][1]=0;
	to[1][2]=2;
	to[1][3]=4;
	to[1][4]=7;
	to[2][0]=2;
	to[2][1]=0;
	to[2][2]=1;
	to[2][3]=5;
	to[2][4]=8;
	to[3][0]=3;
	to[3][1]=0;
	to[3][2]=4;
	to[3][3]=5;
	to[3][4]=6;
	to[4][0]=4;
	to[4][1]=1;
	to[4][2]=3;
	to[4][3]=5;
	to[4][4]=7;
	to[5][0]=5;
	to[5][1]=2;
	to[5][2]=3;
	to[5][3]=4;
	to[5][4]=8;
	to[6][0]=6;
	to[6][1]=0;
	to[6][2]=3;
	to[6][3]=7;
	to[6][4]=8;
	to[7][0]=7;
	to[7][1]=1;
	to[7][2]=4;
	to[7][3]=6;
	to[7][4]=8;
	to[8][0]=8;
	to[8][1]=2;
	to[8][2]=5;
	to[8][3]=6;
	to[8][4]=7;
	rain[0][ 0]=rain[0][ 1]=rain[0][ 4]=rain[0][ 5]=1;
	rain[1][ 1]=rain[1][ 2]=rain[1][ 5]=rain[1][ 6]=1;
	rain[2][ 2]=rain[2][ 3]=rain[2][ 6]=rain[2][ 7]=1;
	rain[3][ 4]=rain[3][ 5]=rain[3][ 8]=rain[3][ 9]=1;
	rain[4][ 5]=rain[4][ 6]=rain[4][ 9]=rain[4][10]=1;
	rain[5][ 6]=rain[5][ 7]=rain[5][10]=rain[5][11]=1;
	rain[6][ 8]=rain[6][ 9]=rain[6][12]=rain[6][13]=1;
	rain[7][ 9]=rain[7][10]=rain[7][13]=rain[7][14]=1;
	rain[8][10]=rain[8][11]=rain[8][14]=rain[8][15]=1;

	while(scanf("%d",&n),n){
		rep(t,n) rep(j,16) scanf("%d",sun[t]+j);
		rep(t,n+1) rep(i,9) vis[t][j].clear();

		vector<int> last(16); // 最後に雨が降ったのは何日前か
		puts(dfs(0,4,last)?"1":"0");
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:95:44: error: 'j' was not declared in this scope
   95 |                 rep(t,n+1) rep(i,9) vis[t][j].clear();
      |                                            ^
Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

vector<vector<int>> atom(26, vector<int>(27, -1));


int shiki(string& s, int& i);
int genshiA(string& s, int& i);
int genshiP(string& s, int& i);
int genshi(string& s, int& i);
int number(string& s, int& i);


bool flag = true;
int start(string& s, int& i) {
	flag = true;
	int a = shiki(s, i);
	if (flag) {
		return a;
	}
	else {
		return -1;
	}
}

int shiki(string& s, int& i) {
	int sum = 0;
	while (s[i] != '?'&&s[i] != ')') {
		int a = genshiA(s, i);
		sum += a;
	}
	
	return sum;
}

int genshiA(string& s, int& i) {
	int a = genshiP(s, i);
	
	if (isdigit(s[i])) {
		int b = number(s, i);
		a = a*b;
	}
	return a;
}

int genshiP(string& s, int& i) {
	if (s[i] == '(') {
		i++;
		int a = shiki(s, i);
		i++;
		return a;
	}
	else {
		int a = genshi(s, i);
		return a;
	}
}

int genshi(string& s, int& i) {
	char atomA = s[i];
	i++;
	char atomB = 'a' - 1;
	if ('a' <= s[i] && s[i] <= 'z') {
		atomB = s[i];
		i++;
	}
	int a = atom[atomA - 'A'][atomB - 'a' + 1];
	if (a == -1) {
		flag = false;
		return 0;
	}
	else {
		return a;
	}
}

int number(string& s, int& i) {
	int a = s[i] - '0';
	i++;
	if (isdigit(s[i])) {
		a = a * 10 + (s[i] - '0');
		i++;
	}
	return a;
}

int main()
{

	while (true) {
		string ss;
		cin >> ss;
		if (ss.size() ==17) {
			break;
		}
		int num;
		cin >> num;
		if (ss.size() == 1) {
			atom[ss[0] - 'A'][0] =num;
		}
		else {
			atom[ss[0] - 'A'][ss[1] - 'a' + 1] = num;
		}
	}
	while (true) {
		string ss;

		cin >> ss;
		if (ss[0] == '0') { break; }
		int k = 0;
		int a = start(ss+"??????",k);
		if (a == -1) {
			cout << "UNKNOWN" << endl;
		}
		else {
			cout << a << endl;
		}

	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:140:33: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
  140 |                 int a = start(ss+"??????",k);
      |                               ~~^~~~~~~~~
a.cc:44:19: note:   initializing argument 1 of 'int start(std::string&, int&)'
   44 | int start(string& s, int& i) {
      |           ~~~~~~~~^
Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

vector<vector<int>> atom(26, vector<int>(27, -1));


int shiki(string& s, int& i);
int genshiA(string& s, int& i);
int genshiP(string& s, int& i);
int genshi(string& s, int& i);
int number(string& s, int& i);


bool flag = true;
int start(string& s, int& i) {
	flag = true;
	int a = shiki(s, i);
	if (flag) {
		return a;
	}
	else {
		return -1;
	}
}

int shiki(string& s, int& i) {
	int sum = 0;
	while (s[i] != '?'&&s[i] != ')') {
		int a = genshiA(s, i);
		sum += a;
	}
	
	return sum;
}

int genshiA(string& s, int& i) {
	int a = genshiP(s, i);
	
	if (isdigit(s[i])) {
		int b = number(s, i);
		a = a*b;
	}
	return a;
}

int genshiP(string& s, int& i) {
	if (s[i] == '(') {
		i++;
		int a = shiki(s, i);
		i++;
		return a;
	}
	else {
		int a = genshi(s, i);
		return a;
	}
}

int genshi(string& s, int& i) {
	char atomA = s[i];
	i++;
	char atomB = 'a' - 1;
	if ('a' <= s[i] && s[i] <= 'z') {
		atomB = s[i];
		i++;
	}
	int a = atom[atomA - 'A'][atomB - 'a' + 1];
	if (a == -1) {
		flag = false;
		return 0;
	}
	else {
		return a;
	}
}

int number(string& s, int& i) {
	int a = s[i] - '0';
	i++;
	if (isdigit(s[i])) {
		a = a * 10 + (s[i] - '0');
		i++;
	}
	return a;
}

int main()
{

	while (true) {
		string ss;
		cin >> ss;
		if (ss.size() ==17) {
			break;
		}
		int num;
		cin >> num;
		if (ss.size() == 1) {
			atom[ss[0] - 'A'][0] =num;
		}
		else {
			atom[ss[0] - 'A'][ss[1] - 'a' + 1] = num;
		}
	}
	while (true) {
		string ss;

		cin >> ss;
		if (ss[0] == '0') { break; }
		int k = 0;
		int nyaan = start(ss+"??????",k);
		if (nyaan == -1) {
			cout << "UNKNOWN" << endl;
		}
		else {
			cout << nyaan << endl;
		}

	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:140:37: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
  140 |                 int nyaan = start(ss+"??????",k);
      |                                   ~~^~~~~~~~~
a.cc:44:19: note:   initializing argument 1 of 'int start(std::string&, int&)'
   44 | int start(string& s, int& i) {
      |           ~~~~~~~~^
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cctype>
#include<string>
#include<map>
#include<vector>
using namespace std;
struct I{int x;I():x(-1){}operator int(){return x;}void operator=(int r){x=r;}};
int main()
{
	char a[128],*p,*q;
	int w,x,i;
	map<string,I>m;vector<int>v,s;while(scanf("%s",a),strcmp(a,"END_OF_FIRST_PART"))scanf("%d",&w),m[a]=v.size(),v.push_back(w);
	while(scanf("%s",a),a[0]-'0')
	{
		s.clear();
		s.push_back(0);
		for(p=a;*p;)
		{
			if(isupper(*p))
			{
				if(islower(p[1]))i=m[string(p,2)],p+=2;
				else i=m[string(p,1)],++p;
				if(i<0){puts("UNKNOWN");goto E;}
				if(isdigit(*p))x=strtol(p,&q,10),p=q;
				else x=1;
				s.back()+=x*v[i];
			}
			else if(*p=='(')s.push_back(0),++p;
			else if(*p==')')
			{
				++p;
				w=s.back(),s.pop_back();
				x=strtol(p,&q,10);
				if(p==q)x=1;
				p=q;
				s.back()+=w*x;
			}
		}
		printf("%d\n",s[0]);
E:;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:59: error: 'strcmp' was not declared in this scope
   13 |         map<string,I>m;vector<int>v,s;while(scanf("%s",a),strcmp(a,"END_OF_FIRST_PART"))scanf("%d",&w),m[a]=v.size(),v.push_back(w);
      |                                                           ^~~~~~
a.cc:7:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include<vector>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

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


string s;
int p;
map<string,int> weight;

long long calc(){
	if(p==s.size())return 0;
	char c=s[p++];
	if(c==')')return 0;
	if(c=='('){
		long long w,n=0;
		w = calc();
		if(w==-1)return -1;	
		while(p<s.size() && isdigit(s[p])){
			n=n*10+s[p++]-'0';
		}
		return w*n+calc();
	}
	else {
		string atom;
		atom+=c;
		if(p<s.size() && islower(s[p])){
			atom+=s[p++];
		}
		if(weight.find(atom)==weight.end())return -1;	
		long long n=1;
		if(p<s.size() && isdigit(s[p])){
			n=p[s++]-'0';
			if(p<s.size() && isdigit(s[p])){
				n=n*10+s[p++]-'0';
			}
		}
		long long a=calc();
		if(a==-1)return -1;
		return weight[atom]*n+a;
	}
}

int main(){
	while(cin>>s,s!="END_OF_FIRST_PART"){
		int n;
		cin>>n;
		weight[s]=n;
	}
	while(cin>>s,s!="0"){
		long long w;
		p=0;
		w=calc();
		if(w==-1)cout<<"UNKNOWN"<<endl;
		else cout<<w<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'long long int calc()':
a.cc:33:30: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   33 |                         n=p[s++]-'0';
      |                             ~^~
Language: C++

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

struct edge{
  int to;
  double cost;
};

typedef vector<edge> Node;
typedef vector<Node> Graph;

bool dfs(int pos,double sum,Graph &G, vector<int> &visited , vector< double > &mem){
  if(visited[pos]){
    return !eq( sum-mem[pos] , 0 );
  }
  
  visited[pos]=true;
  mem[pos]=sum;
  
  for(int i=0;i<(int)G[pos].size();i++){
    edge e=G[pos][i];
    if( dfs(e.to, sum+e.cost, G, visited, mem) )return true;
  }
  return false;
}

bool solve(Graph &G){
  int N=G.size();
  vector<int> visited(N,false);
  vector<double> mem(N);
  
  for(int i=0;i<N;i++){
    if(visited[i])continue;
    if(dfs(i,0,G,visited,mem))return true;
  }
  
  return false;
}

Graph segments2graph( vector<S> segments ){
  Graph G;
  vector< P > points;
  int n=segments.size();
  for(int i=0;i<n;i++){
    S si=segments[i];
    points.push_back( si.first );
    points.push_back( si.second );
    for(int j=0;j<i;j++){
      S sj=segments[j];
      if( isCrossSS( si , sj ) && !isParallel( si, sj ) ){
        points.push_back( getCrossLL(si,sj) );
      }
    }
  }

  G.resize(points.size());

  typedef pair< double , int > Pair;
    
  for(int i=0;i<n;i++){
    S si=segments[i];
    P sf=si.first, se=si.second;
    vector< Pair > targets;
    for(int j=0;j<(int)points.size();j++){
      P pj=points[j];
      // if( ccw( si.first, si.second, pj ) == 0 ){
      if( onSP( si, pj ) ){
        targets.push_back( Pair(getTime(se-sf ,pj-sf ), j ) );
      }
    }

    for(int j=0;j<(int)targets.size();j++){
      for(int k=0;k<j;k++){
        Pair a=targets[j];
        Pair b=targets[k];
        P ap=points[ a.second ];
        P bp=points[ b.second ];
        G[a.second].push_back( (edge){ b.second , getArg(ap,bp) } );
        G[b.second].push_back( (edge){ a.second , getArg(bp,ap) } );
      }
    }
    /*
    sort( targets.begin(), targets.end() );
    for(int j=0;j+1<(int)targets.size();j++){
      Pair a=targets[j];
      Pair b=targets[j+1];
      P ap=points[ a.second ];
      P bp=points[ b.second ];
      G[a.second].push_back( (edge){ b.second , getArg(ap,bp) } );
      G[b.second].push_back( (edge){ a.second , getArg(bp,ap) } );
    }
    */
  }

  for(int i=0;i<(int)G.size();i++){
    for(int j=0;j<(int)G[i].size();j++){
      edge e=G[i][j];
      //      cout<<i<<' '<<e.to<<endl;
      //      cout<<points[i]<<' '<<points[e.to]<<' '<<e.cost<<endl;
    }
  }
  return G;
}

int main(){
  while(1){
    int n;
    cin>>n;
    if(n==0)break;
    vector< S > segments;
    for(int i=0;i<n;i++){
      P a=input();
      P b=input();
      segments.push_back( S(a,b) );
    }
    Graph G=segments2graph(segments);


    if( solve(G) )cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}

Compiler output:
a.cc:2:10: fatal error: test.cpp: No such file or directory
    2 | #include "test.cpp"
      |          ^~~~~~~~~~
compilation terminated.
Language: C

main(z,a,b,c,X,Y,A,f,i,j){for(;scanf("%d%d%d",&a,&b,&c),a;printf("%d %d\n",X,Y))
for(A=99999999,f=i=0;!f;i++)
	for(j=0;j<=i;j++)
		if(z=a*j-b*(i-j),(Z=a*j+b*(i-j))==c||z==c||z==-c)
			if(f=1,A>Z)A=Z,X=j,Y=i-j;
exit(0);}

Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | main(z,a,b,c,X,Y,A,f,i,j){for(;scanf("%d%d%d",&a,&b,&c),a;printf("%d %d\n",X,Y))
      | ^~~~
main.c: In function 'main':
main.c:1:1: error: type of 'z' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'a' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'b' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'X' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'Y' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'A' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'f' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:1: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:1:32: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | main(z,a,b,c,X,Y,A,f,i,j){for(;scanf("%d%d%d",&a,&b,&c),a;printf("%d %d\n",X,Y))
      |                                ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | main(z,a,b,c,X,Y,A,f,i,j){for(;scanf("%d%d%d",&a,&b,&c),a;printf("%d %d\n",X,Y))
main.c:1:32: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | main(z,a,b,c,X,Y,A,f,i,j){for(;scanf("%d%d%d",&a,&b,&c),a;printf("%d %d\n",X,Y))
      |                                ^~~~~
main.c:1:32: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:59: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | main(z,a,b,c,X,Y,A,f,i,j){for(;scanf("%d%d%d",&a,&b,&c),a;printf("%d %d\n",X,Y))
      |                                                           ^~~~~~
main.c:1:59: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:59: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:59: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:4:35: error: 'Z' undeclared (first use in this function)
    4 |                 if(z=a*j-b*(i-j),(Z=a*j+b*(i-j))==c||z==c||z==-c)
      |                                   ^
main.c:4:35: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:1: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
    6 | exit(0);}
      | ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
  +++ |+#include <stdlib.h>
    1 | main(z,a,b,c,X,Y,A,f,i,j){for(;scanf("%d%d%d",&a,&b,&c),a;printf("%d %d\n",X,Y))
main.c:6:1: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
    6 | exit(0);}
      | ^~~~
main.c:6:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
Language: C++

#include <utility>
#include <iostream>
#include <stdexcept>

int a, b, d;

bool cmp(int ax, int ay, int bx, int by){
  if(ax+ay != bx+by) return ax+ay < bx+by;
  return a*ax+b*ay < a*bx+b*by;
}

int main(){
  while(scanf("%d%d%d", &a, &b, &d) && a+b+d){
    int resx = (INF)/2, resy = (INF)/2, r, l, y;
    rep(x, 50000){
      r = a*x + d;
      if(!(r%b)){
    y = r/b;
    if(cmp(x,y,resx,resy)) resx = x, resy = y;
      }
      l = a*x - d;
      if(l >= 0 && !(l%b)){
    y = l/b;
    if(cmp(x,y,resx,resy)) resx = x, resy = y;
      }
      l = d - a*x;
      if(l >= 0 && !(l%b)){
    y = l/b;
    if(cmp(x,y,resx,resy)) resx = x, resy = y;
      }
    }

    printf("%d %d\n", resx, resy);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 'INF' was not declared in this scope
   14 |     int resx = (INF)/2, resy = (INF)/2, r, l, y;
      |                 ^~~
a.cc:15:9: error: 'x' was not declared in this scope
   15 |     rep(x, 50000){
      |         ^
a.cc:15:5: error: 'rep' was not declared in this scope
   15 |     rep(x, 50000){
      |     ^~~
a.cc:33:29: error: 'resy' was not declared in this scope; did you mean 'resx'?
   33 |     printf("%d %d\n", resx, resy);
      |                             ^~~~
      |                             resx
Language: C++

#include <iostream>
#include <fstream>

// DIV(a,b) gives q where a == b * q + r and 0 <= r < b (NOTE: b > 0).
#define DIV(a,b) ((a) < 0 ? -((-(a))/(b)+1) : ((a)/(b)))

using namespace std;

int exgcd(int a, int b, int &x, int &y)
{
	if(b == 0) {
		x = 1, y = 0;
		return a;
	}
	else {
		int g = exgcd(b, a % b, y, x);
		y -= (a / b) * x;
		return g;
	}
}

bool compute(int &x, int &y, int dx, int dy)
{
	int q;

	q = DIV(y, dy);
	x += q * dx;
	y -= q * dy;

	if(x < 0) {
		if(dx > 0) return false;
		q = DIV(x, -dx);
		x += q * dx;
		y -= q * dy;
	}

	return true;
}

void update(int a, int b, int x, int y, int dx, int dy, int &xm, int &ym)
{
	if(dx < dy) {
		if(!compute(x, y, dx, dy)) return;
	}
	else {
		if(!compute(y, x, dy, dx)) return;
	}

	if(x + y != xm + ym) {
		if(x + y < xm + ym) xm = x, ym = y;
	}
	else {
		if(a * x + b * y < a * xm + b * ym) xm = x, ym = y;
	}
}

int main(void)
{
	ifstream cin("A.txt");

	int a, b, d;
	while(cin >> a >> b >> d) {
		if(a == 0 && b == 0 && d == 0) break;
		int x, y, g;
		g = exgcd(a, b, x, y);
		x *= d / g;
		y *= d / g;
		int xm = INT_MAX, ym = 0;
		update(a, b, +x, +y, +(b/g), +(a/g), xm, ym);
		update(a, b, +x, -y, +(b/g), -(a/g), xm, ym);
		update(a, b, -x, +y, -(b/g), +(a/g), xm, ym);
		cout << xm << " " << ym << endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:26: error: 'INT_MAX' was not declared in this scope
   68 |                 int xm = INT_MAX, ym = 0;
      |                          ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <fstream>
  +++ |+#include <climits>
    3 | 
a.cc:69:58: error: 'ym' was not declared in this scope; did you mean 'xm'?
   69 |                 update(a, b, +x, +y, +(b/g), +(a/g), xm, ym);
      |                                                          ^~
      |                                                          xm
Language: C++

#include <utility>
#include <iostream>
#include <algorithm>

using namespace std;

int gcd(int a, int b)
{
	if (a == 0) { return b; }
	if (b == 0) { return a; }

	if (a > b) { return gcd(b, a % b); }

	return gcd(a, b % a);
}

int extgcd(int a, int b, int &x, int &y)
{
	int d = a;

	if (b != 0)
	{
		d = extgcd(b, a % b, y, x);

		y -= (a / b) * x;
	}
	else
	{
		x = 1; y = 0;
	}

	return d;
}

pair<long long, long long> solve(int a, int b, int c) // ax + by = c
{
	int x, y, d; d = extgcd(a, b, x, y);

	x *= (c / d);
	y *= (c / d);

	pair<long long, long long> ret; long long e = (1LL << 60), f = -1//(1LL << 60);

	for (long long i = -2500000; i <= 2500000; i++)
	{
		long long x2 = x + i * b / d;
		long long y2 = y - i * a / d;

		if (abs(x2) + abs(y2) < e)
		{
			e = abs(x2) + abs(y2); f = (1LL << 60);

			ret = make_pair(x2, y2);
		}
		else if ((abs(x2) + abs(y2) == e) && (a * abs(x2) + b * abs(y2) > f))
		{
			f = a * abs(x2) + b * abs(y2);

			ret = make_pair(x2, y2);
		}
	}

	return ret;
}

int main()
{
	long long a, b, c;

	while (true)
	{
		cin >> a >> b >> c;

		if (a == 0 && b == 0 && c == 0) { break; }

		pair<long long, long long> ret = solve(a, b, c);

		cout << abs(ret.first) << ' ' << abs(ret.second) << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'std::pair<long long int, long long int> solve(int, int, int)':
a.cc:44:9: error: expected ',' or ';' before 'for'
   44 |         for (long long i = -2500000; i <= 2500000; i++)
      |         ^~~
a.cc:44:38: error: 'i' was not declared in this scope
   44 |         for (long long i = -2500000; i <= 2500000; i++)
      |                                      ^
Language: C++

#include <utility>
#include <iostream>
#include <algorithm>

using namespace std;

int gcd(int a, int b)
{
	if (a == 0) { return b; }
	if (b == 0) { return a; }

	if (a > b) { return gcd(b, a % b); }

	return gcd(a, b % a);
}

int extgcd(int a, int b, int &x, int &y)
{
	int d = a;

	if (b != 0)
	{
		d = extgcd(b, a % b, y, x);

		y -= (a / b) * x;
	}
	else
	{
		x = 1; y = 0;
	}

	return d;
}

pair<long long, long long> solve(int a, int b, int c) // ax + by = c
{
	int x, y, d; d = extgcd(a, b, x, y);

	x *= (c / d);
	y *= (c / d);

	pair<long long, long long> ret; long long e = (1LL << 60), f = -1;//(1LL << 60);

	for (long long i = -2500000; i <= 2500000; i++)
	{
		long long x2 = x + i * b / d;
		long long y2 = y - i * a / d;

		if (abs(x2) + abs(y2) < e)
		{
			e = abs(x2) + abs(y2); f = -1//(1LL << 60);

			ret = make_pair(x2, y2);
		}
		else if ((abs(x2) + abs(y2) == e) && (a * abs(x2) + b * abs(y2) < f))
		{
			f = a * abs(x2) + b * abs(y2);

			ret = make_pair(x2, y2);
		}
	}

	return ret;
}

int main()
{
	long long a, b, c;

	while (true)
	{
		cin >> a >> b >> c;

		if (a == 0 && b == 0 && c == 0) { break; }

		pair<long long, long long> ret = solve(a, b, c);

		cout << abs(ret.first) << ' ' << abs(ret.second) << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'std::pair<long long int, long long int> solve(int, int, int)':
a.cc:51:54: error: expected ';' before 'ret'
   51 |                         e = abs(x2) + abs(y2); f = -1//(1LL << 60);
      |                                                      ^
      |                                                      ;
   52 | 
   53 |                         ret = make_pair(x2, y2);
      |                         ~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;
typedef pair< int, int > Pi;

bool cmp(const pair< Pi, Pi >& p, const pair< Pi, Pi >& q)
{
  if(p.first.first + p.second.first, q.first.first + q.second.first)
    return(p.first.first + p.second.first < q.first.first + q.second.first);
  return(p.first.first * p.first.second + p.second.first * p.second.second <
         q.first.first * p.first.second + q.second.first * q.second.second);
}

// ax + by = d
pair< Pi, Pi > ask(int a, int b, int d)
{
  pair< Pi, Pi > ret({INF, INF}, {INF, INF});
  for(int x = 0; x < 100000; x++) {
    int f = abs(d - a * x);
    if(f % b == 0) ret = min(ret, {{x, a}, {f / b, b}}, cmp);
  }
  return(ret);
}

int main()
{
  int a, b, d;
  while(cin >> a >> b >> d, a) {
    auto alpha = ask(a, b, d), beta = ask(b, a, d);
    auto ret = min(alpha, beta, cmp);
    if(ret == beta) swap(ret.first, ret.second);
    cout << ret.first.first << " " << ret.second.first << endl;
    
}

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

#include<cmath>
#define LIMIT 50000
using namespace std;
int a, b , d, mx, my;

void update( int x, int y ){
    if ( y < 0 ) return;
    if ( x + y == mx + my && a*x + b*y < a*mx + b*my ){
	mx = x; my = y;
    } else if ( x + y < mx + my ){
	mx = x; my = y;
    }
}

main(){
    while( cin >> a >> b >> d, (a || b || d) ){
	mx = my = LIMIT;
	for ( int y, x = 0; x <= b + d; x++ ){
	    if ( (a*x - d)%b == 0 ){y = (a*x - d)/b; update( x, y );}
	    if ( (a*x + d)%b == 0 ){y = (a*x + d)/b; update( x, y );}
	    if ( (d - a*x)%b == 0 ){y = (d - a*x)/b; update( x, y );}
	}
	cout << mx << " " << my << endl;
    }
}

Compiler output:
a.cc:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:16:12: error: 'cin' was not declared in this scope
   16 |     while( cin >> a >> b >> d, (a || b || d) ){
      |            ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cmath>
  +++ |+#include <iostream>
    2 | #define LIMIT 50000
a.cc:23:9: error: 'cout' was not declared in this scope
   23 |         cout << mx << " " << my << endl;
      |         ^~~~
a.cc:23:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:36: error: 'endl' was not declared in this scope
   23 |         cout << mx << " " << my << endl;
      |                                    ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<cmath>
  +++ |+#include <ostream>
    2 | #define LIMIT 50000
Language: C++

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

#define X first
#define Y second

int a, b;

pair<int, int> calc(int d) {
	int x = 0, y = 0, diff = 0;

	while(diff != d) {
		const int ad = abs(diff + a - d), bd = abs(diff - b - d);
		if(ad > bd) {
			diff -= b;
			++y;
		}
		else {
			diff += a;
			++x;
		}
	}

	return make_pair(x, y);
}

void chans(pair<int, int>& p, const pair<int, int>& q) {
	const int p_sum = p.X + p.Y, q_sum = q.X + q.Y;
	if(p_sum > q_sum || (p_sum == q_sum && p.X * a + p.Y * b > q.X * a + q.Y * b))
		p = q;
}

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

	for(int d; cin >> a >> b >> d, a | b | d;) {
		int g = __gcd(a, b);
		a /= g;
		b /= g;
		d /= g;

		pair<int, int> ans = calc(d);
		chans(ans, calc(-d));

		if(d % a == 0)
			chans(ans, make_pair(d / a, 0));

		if(d % b == 0)
			chans(ans, make_pair(0, d / b));

		for(int x = 1; a * x < d; ++x) {
			const int rest = d - a * x;
			if(rest % b == 0)
				chans(ans, make_pair(x, rest / b));
		}

		cout << ans.X << " " << ans.Y << endl;
	}

	return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:25: error: '__gcd' was not declared in this scope
   40 |                 int g = __gcd(a, b);
      |                         ^~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cassert>
#include <tuple>
using namespace std;
using ll = long long int;

ll A, B, D;
const ll INF = 1LL << 50;
const ll MAX = 1LL << 21;
pair<ll, ll> NIL(INF, INF);

pair<ll, ll> compare_pair(pair<ll, ll> L, pair<ll, ll> R) {
  ll XL, XR, YL, YR;
  tie(XL, YL) = L; tie(XR, YR) = R;
  if(XL + YL != XR + YR) {
    if(XL + YL < XR + YR) return L;
    else                  return R;
  }
  else {
    ll massL = XL * A + YL * B;
    ll massR = XR * A + YR * B;
    if(massL < massR) return L;
    else              return R;
  }
}

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  else return gcd(b, a%b);
}

pair<ll, ll> solve(ll a, ll b, ll d, bool rev) {
  ll g = gcd(a, gcd(b, d));
  ll na = a/g, nb=b/g, nd=d/g;

  if(gcd(na, nb) != 1) return NIL;
  ll x; for(x=0; x<nb; x++) if(na*x % nb == nd % nb) break;

  if(x == nb) return NIL;
  fprintf(stderr, "na = %lld, nb = %lld, nd = %lld, x = %lld\n", na, nb, nd, x);
  // x *= g;

  pair<ll, ll> ans = NIL;
  for(; x<MAX; x += nb) {
    // fprintf(stderr, "a = %lld, x = %lld, b = %lld, d = %lld\n", a, x, b, d);
    assert(a*x % b == d % b);
    ll val = a*x - d;
    if(val < 0 or val % b != 0) continue;
    ll y = val / b;
    // if(x < 10 and y < 10) fprintf(stderr, "x = %lld, y = %lld\n", x, y);
    if(rev) {
      ans = compare_pair(ans, make_pair(y, x));
    }
    else {
      ans = compare_pair(ans, make_pair(x, y));
    }
  }

  return ans;
}

int main() {
  while(cin >> A >> B >> D, A) {
    pair<ll, ll> ans = NIL;
    ans = compare_pair(ans, solve(A, B, D, false));
    ans = compare_pair(ans, solve(B, A, D, true));
    printf("%lld %lld\n", ans.first, ans.second);
  }
  return 0;
}

a


Compiler output:
a.cc:75:1: error: 'a' does not name a type
   75 | a
      | ^
Language: C++

#include <iostream>

using namespace std;

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b) 

int g[12][12][12];
int h[12][12];
int n, m, p;

bool valid(int x, int y, int z){
    return 0 <= x && x < n && 0 <= y && y < n && 0 <= z && z < n;
}

bool check(int turn){
    int dx[] = { 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 };
    int dy[] = { 0, 1, 0, 1, -1, 0, 0, 1, 1, 1, 1, -1, -1 };
    int dz[] = { 0, 0, 1, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1 };
    rep(i, n)rep(j, n)rep(k, n){
        rep(l, 13){
            int ix = j, iy = i, iz = k, c = 0;
            while (valid(ix, iy, iz) && g[iy][ix][iz] == turn){
                ix += dx[l];
                iy += dy[l];
                iz += dz[l];
                c++;
            }
            if (m <= c) return true;
        }
    }
    return false;
}

int main(){
    while (cin >> n >> m >> p && n){
        memset(g, -1, sizeof(g));
        memset(h, 0, sizeof(0));
        int ans = -1;
        rep(i, p){
            int x, y;
            cin >> x >> y;
            x--; y--;
            g[y][x][h[y][x]] = i & 1;
            h[y][x]++;
            if (ans == -1 && check(i & 1)) {
                ans = i + 1;
            }
        }
        if (ans == -1) cout << "Draw";
        else if (ans & 1 == 1) cout << "Black" << " " << ans;
        else cout << "White" << " " << ans;
        cout << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: 'memset' was not declared in this scope
   37 |         memset(g, -1, sizeof(g));
      |         ^~~~~~
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 |
Language: C++

// Aoj_1249.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdafx.h"
#include<iostream>
#include<vector>
using namespace std;
int dx[] = {0,1,-1};
int dy[]= {0,1,-1};
int dz[] = {0,1,-1};

int main()
{
	int n, m, p;
	while (cin >> n >> m >> p && n != 0 || m != 0 || p != 0)
	{
		int board[8][8][8];
		int height[8][8];
		for (int i = 0; i < 8; i++)
		{
			for (int j = 0; j < 8; j++)
			{
				for (int k = 0; k < 8; k++)
				{
					board[i][j][k] = 0;
				}
			}
		}

		for (int i = 0; i < 8; i++)
		{
			for (int j = 0; j < 8; j++)
			{
				height[i][j] = 0;
			}
		}
		int ansColor = 0;
		int ansNumber = 0;
		bool flag = false;
		for (int i = 0; i < p; i++)
		{
			int x, y;
			cin >> x >> y;
			int z = height[y][x];
			if (i % 2 == 0)
			{
				board[y][x][z] = 1;
			}
			else
			{
				board[y][x][z] = 2;
			}

			for (int a = 0; a < 3; a++)
			{
				for (int b = 0; b < 3; b++)
				{
					for (int c = 0; c < 3; c++)
					{
						if (a == 0 && b == 0 && c == 0)continue;
						int vx = x + dx[a];
						int vy = y + dy[b];
						int vz = z + dz[c];
						int cnt = 0;
						int pre = 2;//white
						if (i % 2 == 0)
						{
							pre = 1;//black
						}
						while (vx >= 0 && vy >= 0 && vz >= 0 && vx <= n && vy <= n && vz <= n && pre == board[vy][vx][vz])
						{
							cnt++;
							vx += dx[a];
							vy += dy[b];
							vz += dz[c];
						}

						if (cnt >= m - 1)
						{
							ansColor = board[y][x][z];
							ansNumber = i + 1;
							flag = true;
							break;
						}
					}
					if (flag)break;
				}
				if (flag)break;
			}
			if (flag)break;
			height[y][x]++;
		}
		if (ansColor == 0)
		{
			cout << "Draw" << endl;
		}
		else if (ansColor == 1)
		{
			cout << "Black " << ansNumber << endl;
		}
		else
		{
			cout << "White " << ansNumber << endl;
		}

	}
}

Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

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

int main()
{
	//black 1
	//white 2
	int board[7][7][7];
	int height[7][7];
	int N, M, P;
	while (cin >> N >> M >> P && N != 0 || M != 0 || P != 0)
	{
		memset(board, -1, sizeof(board));
		memset(height, 0, sizeof(height));
		int ansColor = -1;
		int ansP = -1;
		int a = 0;
		bool flag = false;
		for ( a = 0; a < P; a++)
		{
			int X, Y;
			cin >> X >> Y;
			X--; Y--;
			if (a % 2 == 0)
			{
				board[Y][X][height[Y][X]] = 1;
			}
			else
			{
				board[Y][X][height[Y][X]] = 2;
			}

			int color = board[Y][X][height[Y][X]];
			for (int dx = -1; dx <= 1; dx++)
			{
				for (int dy = -1; dy <= 1; dy++)
				{
					for (int dz = -1; dz <= 1; dz++)
					{
						if (dx == 0 && dy == 0 && dz == 0)continue;
						int nx = X + dx;
						int ny = Y + dy;
						int nz = height[Y][X] + dz;
						int cnt = 1;

						while (nx >= 0 && nx < N && ny >= 0 && ny < N && nz >= 0 && nz < N)
						{
							if (board[ny][nx][nz] != color)break;
							cnt++;
							nx += dx;
							ny += dy;
							nz += dz;
						}

						nx = X - dx;
						ny = Y - dy;
						nz = height[Y][X] - dz;
						while (nx >= 0 && nx < N && ny >= 0 && ny < N && nz >= 0 && nz < N)
						{
							if (board[ny][nx][nz] != color)break;
							cnt++;
							nx -= dx;
							ny -= dy;
							nz -= dz;
						}

						if (cnt >= M && !flag)
						{
							ansP = a + 1;
							ansColor = color;
							flag = true;
							break;
						}
					}
					if (flag)break;
				}
				if (flag)break;
			}
			if (flag)break;
			height[Y][X]++;
		}
		int X, Y;
		for (int b = a + 1; b < P; b++)cin >> X >> Y;
		if (ansColor == 1)
		{
			cout << "Black " << ansP << endl;
		}
		else if (ansColor == 2)
		{
			cout << "White " << ansP <<endl;
		}
		else
		{
			cout << "Draw" << endl;
		}

	}
}

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

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

int main()
{
	//black 1
	//white 2
	int board[7][7][7];
	int height[7][7];
	int N, M, P;
	while (cin >> N >> M >> P && N != 0 || M != 0 || P != 0)
	{
		memset(board, -1, sizeof(board));
		memset(height, 0, sizeof(height));
		int ansColor = -1;
		int ansP = -1;
		int a = 0;
		bool flag = false;
		for ( a = 0; a < P; a++)
		{
			int X, Y;
			cin >> X >> Y;
			X--; Y--;
			if (a % 2 == 0)
			{
				board[Y][X][height[Y][X]] = 1;
			}
			else
			{
				board[Y][X][height[Y][X]] = 2;
			}

			int color = board[Y][X][height[Y][X]];
			for (int dx = -1; dx <= 1; dx++)
			{
				for (int dy = -1; dy <= 1; dy++)
				{
					for (int dz = -1; dz <= 1; dz++)
					{
						if (dx == 0 && dy == 0 && dz == 0)continue;
						int nx = X + dx;
						int ny = Y + dy;
						int nz = height[Y][X] + dz;
						int cnt = 1;

						while (nx >= 0 && nx < N && ny >= 0 && ny < N && nz >= 0 && nz < N)
						{
							if (board[ny][nx][nz] != color)break;
							cnt++;
							nx += dx;
							ny += dy;
							nz += dz;
						}

						nx = X - dx;
						ny = Y - dy;
						nz = height[Y][X] - dz;
						while (nx >= 0 && nx < N && ny >= 0 && ny < N && nz >= 0 && nz < N)
						{
							if (board[ny][nx][nz] != color)break;
							cnt++;
							nx -= dx;
							ny -= dy;
							nz -= dz;
						}

						if (cnt >= M && !flag)
						{
							ansP = a + 1;
							ansColor = color;
							flag = true;
							break;
						}
					}
					if (flag)break;
				}
				if (flag)break;
			}
			if (flag)break;
			height[Y][X]++;
		}
		int X, Y;
		for (int b = a + 1; b < P; b++)cin >> X >> Y;
		if (ansColor == 1)
		{
			cout << "Black " << ansP << endl;
		}
		else if (ansColor == 2)
		{
			cout << "White " << ansP <<endl;
		}
		else
		{
			cout << "Draw" << endl;
		}

	}
}

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

#include <iostream>
using namespace std;

int f[7][7][7],N,M;
int dx[] ={0,0,-1,1,0,-1,1,-1,1};
int dy[] ={0,-1,0,0,1,-1,-1,1,1};

int dfs(int x, int y, int z, int c,int m,int mz, bool d)
{
	int s=1;
	int tx=x, ty=y,tz=z;
	if(d) tx+=dx[m], ty+=dy[m], tz+=mz;
	else  tx-=dx[m], ty-=dy[m], tz-=mz;
	if(tx<0||ty<0||tz<0||tx>=N||ty>=N||tz>=N) return s;
	if(f[tx][ty][tz]!=c) return s;
	s+=dfs(tx,ty,tz,c,m,mz,d);
	
	return s;
}

int main()
{
	int P;
	while(cin >> N >> M >> P, (N||M||P))
	{
		memset(f,0,sizeof(f));
		int c=0, e=0;
		for(int j=1; j<=P; j++)
		{
			c=(c==1?2:1);
			int x,y,z=0;
			cin >> x >> y;
			x--,y--;
			while(1)
			{
				if(f[x][y][z]==0)
				{
					f[x][y][z]=c;
					break;
				}
				z++;
			}
			
			if(e!=0) continue;
			
			for(int mz=-1; mz<=1; mz++)
			for(int i=0; i<9; i++)
			{
				int t=1;
				if(i==0&&mz==0) continue;
				for(int d=0; d<2; d++)
				{
					int tx=x, ty=y,tz=z;
					
					if(d) tx+=dx[i], ty+=dy[i], tz+=mz;
					else  tx-=dx[i], ty-=dy[i], tz-=mz;
					
					if(tx<0||ty<0||tz<0||tx>=N||ty>=N||tz>=N) continue;
					if(f[tx][ty][tz]!=c) continue;
					
					t+=dfs(tx,ty,tz,c,i,mz,d);
					
				}
				if(t>=M) e=j;
			}
		}
		
		if(e==0) cout << "Draw" << endl;
		else
		{
			cout << (e%2==0?"White ":"Black ") << e << endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: 'memset' was not declared in this scope
   26 |                 memset(f,0,sizeof(f));
      |                 ^~~~~~
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 | using namespace std;
Language: C++

#include<cstdio>
using namespace std;

int main(int argc, char *argv[]){
  int s;
  cin >> s;
  unsigned int data[9];
  for (int i = 0; i < s; i++) {
    unsigned int ans = 0;
    for (int j = 0; j < 9; j++) {
      scanf("%x", &data[j]);
    }
    for (int j = 0; j < 32; j++) {
      unsigned int sum = 0;
      for (int k = 0; k < 8; k++) {
        sum += data[k]^ans;
      }
      if((sum&(1<<j)) != (data[8]&(1<<j)))
        ans |= 1<<j;
    }
    printf("%x\n", ans);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> s;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cstdio>
  +++ |+#include <iostream>
    2 | using namespace std;
Language: C++

#include<stdio.h>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <functional>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <assert.h>
#include <stdio.h>
#include <queue>
#include<iomanip>
#include<bitset>
#include<stack>
#include <array>

using namespace std;

string tohx(unsigned long long int a){
	if (a == 0){
		return "0";
	}
	string st;
	while (a){
		int b = a % 16;
		if (b < 10){
			st.push_back('0'+b);
		}
		else{
			st.push_back('a' + b - 10);
		}
		a /= 16;
	}
	reverse(st.begin(), st.end());
	return st;
}
unsigned long long int  toli(string a){
	unsigned long long int li = 0;
	unsigned long long int os = 1;
	while (a.size()){
		char c = a.back();
		if (isdigit(c)){
			li += os*((c-'0'));
		}
		else{
			li += (os)*( 10 + (c - 'a'));
		}
		a.pop_back();
		os *= 16;
	}
	return li;
}

int main() {
	unsigned long long int N;
	cin >> N;
	for (int j = 0; j < N; ++j){
		string sts[9];
		for (int i = 0; i < 9; ++i){
			cin >> sts[i];
		}
		vector<unsigned long long int> nums;
		for (int i = 0; i < 9; ++i){
			nums.push_back(toli(sts[i]));
		}
		unsigned long long int ans = 0;
		unsigned long long int kuriagari = 0;
		for (int i = 0; i < 32; ++i){

			vector<unsigned long long int >havebit(9);
			for (int k = 0; k < 9; ++k){
				havebit[k] = ((nums[k] & (1 << i)) >> i);
			}
			int lbitnum = accumulate(havebit.begin(), havebit.begin() + 8, unsigned long long int(0));
			if ((lbitnum + kuriagari + havebit[8]) % 2){
				ans += long long int(1) << i;
				lbitnum = 8 - lbitnum;
			}
			kuriagari = (kuriagari + lbitnum) / 2;
		}
		string ansst = tohx(ans);
		cout << ansst << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:88: error: expected primary-expression before 'unsigned'
   76 |                         int lbitnum = accumulate(havebit.begin(), havebit.begin() + 8, unsigned long long int(0));
      |                                                                                        ^~~~~~~~
a.cc:78:40: error: expected primary-expression before 'long'
   78 |                                 ans += long long int(1) << i;
      |                                        ^~~~
Language: C++

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

vector<string> spl(string s) {
  vector<string> res;
  int old = 1;
  while(1) {
    int p = s.find("/", old);
    if (p == string::npos) break;
    res.push_back(s.substr(old, p-old));
    old = p + 1;
  }
  res.push_back(s.substr(old));
  return res;
}

pair<bool, vector<string>> ff(vector<vector<string>>& lst, vector<string>& file) {
  vector<string> path;
  bool isdir = true;
  int n = lst.size();
  bool added = false;
  for (string name:file) {
    if (name == ".") continue;
    if (name == "..") {
      if (path.empty() || !isdir) return make_pair(false, path);
      else {
        path.pop_back();
        continue;
      }
    }
    bool fnd = false;
    REP(i,n){
      bool ok = lst[i].size() > path.size();
      REP(j,path.size()) {
        if (lst[i].size() <= j || path[j] != lst[i][j]) {
          ok = false;
          break;
        }
      }
      if (ok) {
        if (name == lst[i][path.size()]) {
          path.push_back(name);
          isdir = (path.size() != lst[i].size());
          fnd = true;
          break;
        } else if (name == "" && lst[i].size() == path.size() + 1 && lst[i][path.size()] == "index.html") {
          path.push_back("index.html");
          fnd = true;
          added = true;
          break;
        }
      }
    }
    if (!fnd) return make_pair(false, path);
  }
  if (!added) {
    REP(i,n) {
      if (path == lst[i]) return (true, path);
      if (path.size() + 1 != lst[i].size()) continue;
      bool ok = true;
      REP(j,path.size()) {
        if (path[j] != lst[i][j]) {
          ok = false;
          break;
        }
      }
      if (ok && lst[i].back() == "index.html") {
        return make_pair(true, lst[i]);
      }
    }
  }
  return make_pair(false, path);
}

int main() {
  while(1){
    int n,m;
    cin>>n>>m;
    if(!n)break;
    vector<vector<string>> f(n);
    REP(i,n) {
      string fp;
      cin>>fp;
      f[i] = spl(fp);
    }
    REP(i,m) {
      string a,b;
      cin>>a>>b;
      auto fa = spl(a);
      auto fb = spl(b);
      auto pa = ff(f, fa);
      auto pb = ff(f, fb);
      if (pa.first && pb.first) {
        if (pa.second == pb.second) {
          cout << "yes" << endl;
        } else {
          cout << "no" << endl;
        }
      } else {
        cout << "not found" << endl;
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'std::pair<bool, std::vector<std::__cxx11::basic_string<char> > > ff(std::vector<std::vector<std::__cxx11::basic_string<char> > >&, std::vector<std::__cxx11::basic_string<char> >&)':
a.cc:65:39: error: could not convert '((void)0, path)' from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::pair<bool, std::vector<std::__cxx11::basic_string<char> > >'
   65 |       if (path == lst[i]) return (true, path);
      |                                  ~~~~~^~~~~~~
      |                                       |
      |                                       std::vector<std::__cxx11::basic_string<char> >