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

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

int h, w;

char buf[20][20];
char mat[20][20];
int chest[20][20];

int adj[20][20];

void calcAdj() {
    memset(adj, 0, sizeof(adj));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            for (int dx = -1; dx <= 1; dx++) {
                for (int dy = -1; dy <= 1; dy++) {
                    int newx = i+dx, newy = j+dy;
                    if (newx >= 0 && newx < h && newy >= 0 && newy < w) {
                        if (mat[newx][newy] > '0' && mat[newx][newy] <= '9') {
                            adj[i][j]++;
                        }
                    }
                }
            }
        }
    }
}

void updateAdj(int x, int y) {
    for (int dx = -1; dx <= 1; dx++) {
        for (int dy = -1; dy <= 1; dy++) {
            int newx = x+dx, newy = y+dy;
            if (newx >= 0 && newx < h && newy >= 0 && newy < w) {
                adj[newx][newy]--;
            }
        }
    }
}

bool solve(int num) {
    memcpy(mat, buf, sizeof(buf));
    memset(chest, 0, sizeof(chest));
    calcAdj();

    while (num--) {
        int maxAdj = 0, x, y;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (adj[i][j] > maxAdj && mat[i][j] != '.' && !chest[i][j]) {
                    maxAdj = adj[i][j];
                    x = i; y = j;
                }
            }
        }

        chest[x][y] = 1;

//        printf("Position (%d, %d) has max adjacent marks %d\n", x, y, maxAdj);

        for (int dx = -1; dx <= 1; dx++) {
            for (int dy = -1; dy <= 1; dy++) {
                int newx = x+dx, newy = y+dy;
                if (newx >= 0 && newx < h && newy >= 0 && newy < w) {
                    if (mat[newx][newy] > '0' && mat[newx][newy] <= '9') {
//                        printf("Mark (%d, %d) is now %c\n", newx, newy, mat[newx][newy]-1);

                        if (--mat[newx][newy] == '0') {
                            updateAdj(newx, newy);
                        }

                    }
                }
            }
        }
//        printf("Mat:\n");
//        for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { printf("%c", mat[i][j]); } printf("\n"); }
//        printf("Adj:\n");
//        for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { printf("%d", adj[i][j]); } printf("\n"); }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (mat[i][j] > '0' && mat[i][j] <= '9') return false;
        }
    }
    return true;
}

int main() {
    while(cin >> h >> w && h && w) {
        for (int i = 0; i < h; i++) {
            cin >> buf[i];
        }
        int low = 0, high = h*w;
        while (low < high) {
            int mid = (low+high)/2;
//            printf("Num: %d, %s\n", mid, solve(mid) ? "OK" : "NO");
            if (solve(mid)) high = mid;
            else low = mid+1;
        }
        cout << low << "\n";
    }

}



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

9 9
*********
*4*4*4*4*
*********
*4*4*4*4*
*********
*4*4*4*4*
*********
*4*4*4***
*********
0 0

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

#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define re(i,n,a) for(int i=a;i<n;i++)
using namespace std;
typedef pair<int,int>P;
int w,h,a[16][16],md=14,b[16][16],s1,s2;
bool used[16][16];
string s[16];
int dx[]={-1,-1,-1,0,0,0,1,1,1};
int dy[]={-1,0,1,-1,0,1,-1,0,1};
vector<P>v;
map<int,int>m;
int greedy(){
  int res=0,sum=0;
  memset(a,0,sizeof(a));
  memset(used,0,sizeof(used));
  r(i,h){
      r(j,w){
        if(s[i][j]=='0'){
        r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||w>=x)continue;
          used[y][x]=1;
        }
      }
      else if(s[i][j]=='.')used[i][j]=1;
      else if(isdigit(s[i][j]))a[i][j]=s[i][j]-'0',res+=a[i][j];
      }
    }
    while(res>0){
      memset(b,0,sizeof(b));
      int f=0;
      r(i,h)r(j,w)if(!used[i][j]){
        int p=0;
        r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||x>=w)continue;
          if(a[y][x])p++;
        }
        b[i][j]=p;
        f=max(p,f);
      }
      int i=0,j=0;
      r(kk,h*w){
        i=(i+1)%h;
        j=(j+1)%w;
        if((unsigned int)rand()%5==0)i=(unsigned int)rand()%h;
        if((unsigned int)rand()%5==0)j=(unsigned int)rand()%w;
        if(used[i][j])continue;
        if(b[i][j]==f){
          int p=0;
          r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||x>=w)continue;
          if(a[y][x])p++;
        }
        if(p==f){
          r(k,9){
            int y=i+dy[k];
            int x=j+dx[k];
            if(y<0||x<0||y>=h||x>=w)continue;
            if(used[y][x])continue;
            if(a[y][x])a[y][x]--;
          }
          sum++;
          res-=f;
          used[i][j]=1;
        }
      } 
    }}
    m[sum]++;
    return sum;
}
int main(){
  while(cin>>h>>w,w){
    int ans=1e9;
    r(i,h)cin>>s[i];
    r(t1,2){
      r(i,h/2)swap(s[i],s[h-1-i]);
      r(t2,2){
        r(i,h)reverse(s[i].begin(),s[i].end());
        r(t3,2){
          string t[16];
          r(i,16)t[i]="";
          r(i,w)r(j,h)t[i]+=s[j][i];
          swap(h,w);
          r(i,w)s[i]="";
          r(i,h)s[i]=t[i];
          int pp;
          set<int>st;
          m.clear();
          r(t4,150){
            srand((unsigned int)time(NULL));
            pp=greedy();
            st.insert(pp);
            ans=min(ans,pp);
          }
          //cout<<m[ans]<<endl;
          If(st.count(ans)&&ans%md==0)
            if(rand()%2&&ans)ans--;
        }
      }
    }if(ans==28)exit(1);
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:102:11: error: 'If' was not declared in this scope
  102 |           If(st.count(ans)&&ans%md==0)
      |           ^~
Language: C++

#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define re(i,n,a) for(int i=a;i<n;i++)
using namespace std;
typedef pair<int,int>P;
int w,h,a[16][16],md=14,b[16][16],s1,s2;
bool used[16][16];
string s[16];
int dx[]={-1,-1,-1,0,0,0,1,1,1};
int dy[]={-1,0,1,-1,0,1,-1,0,1};
vector<P>v;
map<int,int>m;
int greedy(){
  int res=0,sum=0;
  memset(a,0,sizeof(a));
  memset(used,0,sizeof(used));
  r(i,h){
      r(j,w){
        if(s[i][j]=='0'){
        r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||w>=x)continue;
          used[y][x]=1;
        }
      }
      else if(s[i][j]=='.')used[i][j]=1;
      else if(isdigit(s[i][j]))a[i][j]=s[i][j]-'0',res+=a[i][j];
      }
    }
    while(res>0){
      memset(b,0,sizeof(b));
      int f=0;
      r(i,h)r(j,w)if(!used[i][j]){
        int p=0;
        r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||x>=w)continue;
          if(a[y][x])p++;
        }
        b[i][j]=p;
        f=max(p,f);
      }
      int i=0,j=0;
      r(kk,h*w){
        i=(i+1)%h;
        j=(j+1)%w;
        if((unsigned int)rand()%5==0)i=(unsigned int)rand()%h;
        if((unsigned int)rand()%5==0)j=(unsigned int)rand()%w;
        if(used[i][j])continue;
        if(b[i][j]==f){
          int p=0;
          r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||x>=w)continue;
          if(a[y][x])p++;
        }
        if(p==f){
          r(k,9){
            int y=i+dy[k];
            int x=j+dx[k];
            if(y<0||x<0||y>=h||x>=w)continue;
            if(used[y][x])continue;
            if(a[y][x])a[y][x]--;
          }
          sum++;
          res-=f;
          used[i][j]=1;
        }
      } 
    }}
    m[sum]++;
    return sum;
}
int main(){
  while(cin>>h>>w,w){
    int ans=1e9;
    r(i,h)cin>>s[i];
    r(t1,2){
      r(i,h/2)swap(s[i],s[h-1-i]);
      r(t2,2){
        r(i,h)reverse(s[i].begin(),s[i].end());
        r(t3,2){
          string t[16];
          r(i,16)t[i]="";
          r(i,w)r(j,h)t[i]+=s[j][i];
          swap(h,w);
          r(i,w)s[i]="";
          r(i,h)s[i]=t[i];
          int pp;
          set<int>st;
          m.clear();
          r(t4,130){
            srand((unsigned int)time(NULL));
            pp=greedy();
            st.insert(pp);
            ans=min(ans,pp);
          }
          //cout<<m[ans]<<endl;
          if(st.count(ans)&&ans%md==0)
            if(ans&&m[ans]<=90&&m[ans]>=0)ans--;
        }
      }
    }if(ans==28)exit(1)l
    cout<<ans<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:106:24: error: expected ';' before 'l'
  106 |     }if(ans==28)exit(1)l
      |                        ^
      |                        ;
Language: C++

#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define re(i,n,a) for(int i=a;i<n;i++)
using namespace std;
typedef pair<int,int>P;
int w,h,a[16][16],md=14,b[16][16],s1,s2;
bool used[16][16];
string s[16];
int dx[]={-1,-1,-1,0,0,0,1,1,1};
int dy[]={-1,0,1,-1,0,1,-1,0,1};
vector<P>v;
map<int,int>m;
int greedy(){
  int res=0,sum=0;
  memset(a,0,sizeof(a));
  memset(used,0,sizeof(used));
  r(i,h){
      r(j,w){
        if(s[i][j]=='0'){
        r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||w>=x)continue;
          used[y][x]=1;
        }
      }
      else if(s[i][j]=='.')used[i][j]=1;
      else if(isdigit(s[i][j]))a[i][j]=s[i][j]-'0',res+=a[i][j];
      }
    }
    while(res>0){
      memset(b,0,sizeof(b));
      int f=0;
      r(i,h)r(j,w)if(!used[i][j]){
        int p=0;
        r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||x>=w)continue;
          if(a[y][x])p++;
        }
        b[i][j]=p;
        f=max(p,f);
      }
      int i=0,j=0;
      r(kk,h*w){
        i=(i+1)%h;
        j=(j+1)%w;
        if((unsigned int)rand()%5==0)i=(unsigned int)rand()%h;
        if((unsigned int)rand()%5==0)j=(unsigned int)rand()%w;
        if(used[i][j])continue;
        if(b[i][j]==f){
          int p=0;
          r(k,9){
          int y=i+dy[k];
          int x=j+dx[k];
          if(y<0||x<0||y>=h||x>=w)continue;
          if(a[y][x])p++;
        }
        if(p==f){
          r(k,9){
            int y=i+dy[k];
            int x=j+dx[k];
            if(y<0||x<0||y>=h||x>=w)continue;
            if(used[y][x])continue;
            if(a[y][x])a[y][x]--;
          }
          sum++;
          res-=f;
          used[i][j]=1;
        }
      } 
    }}
    m[sum]++;
    return sum;
}
int main(){
  while(cin>>h>>w,w){
    int ans=1e9;
    r(i,h)cin>>s[i];
    r(t1,2){
      r(i,h/2)swap(s[i],s[h-1-i]);
      r(t2,2){
        r(i,h)reverse(s[i].begin(),s[i].end());
        r(t3,2){
          string t[16];
          r(i,16)t[i]="";
          r(i,w)r(j,h)t[i]+=s[j][i];
          swap(h,w);
          r(i,w)s[i]="";
          r(i,h)s[i]=t[i];
          int pp;
          set<int>st;
          m.clear();
          r(t4,111){
            srand((unsigned int)time(NULL));
            pp=greedy();
            st.insert(pp);
            ans=min(ans,pp);
          }
          //cout<<m[ans]<<endl;
          if(st.count(ans)&&ans%md==0)
            if(rand()%2&&ans)ans--;
        }
      }
    
    cout<<ans<<endl;
  }
}

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

#include<cstdio>
#include<vector>
#include<algorithm>

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

using namespace std;

typedef long long ll;

const int dx[]={1,1,0,-1,-1,-1,0,1,0},dy[]={0,-1,-1,-1,0,1,1,1,0};

int h,w;
char B[15][16];
bool bomb[15][15],ban[15][15];

struct P{ int x,y; };
vector<P> num;

vector<int> subset[10][10]; // subset[a][b] := TCY a ÌWÌTCY b ÌªWSÌ

int ans;
void dfs(int t,int cur){
	if(ans<cur) return;
	if(t==num.size()){
		ans=cur;
		return;
	}

	// pruning
	int lb=0; // ºEl (­È­Æà lb ÂÌeðu©È¢Æ¢¯È¢)
	bool tmp[15][15]={};
	rep(y,h) rep(x,w) if(B[y][x]!='.') tmp[y][x]=ban[y][x];

	for(int u=(int)num.size()-1;u>=t;u--){
		int i=num[u].y,j=num[u].x,cnt=0;
		rep(k,9){
			int y=i+dy[k],x=j+dx[k];
			if(0<=y && y<h && 0<=x && x<w && B[y][x]!='.' && tmp[y][x]) cnt++;
		}

		int dgt=B[i][j]-'0';
		if(dgt<=cnt) continue;
		lb+=dgt-cnt;

		rep(k,9){
			int y=i+dy[k],x=j+dx[k];
			if(0<=y && y<h && 0<=x && x<w && B[y][x]!='.') tmp[y][x]=true;
		}
	}
// printf("cur=%d, lb=%d, ans=%d\n",cur,lb,ans);
	if(cur+lb>=ans) return;

	// main part
	int i=num[t].y,j=num[t].x,dgt=B[i][j]-'0';

	int n=0,nb=0; // eðu¯éêÌÂ, ·ÅÉu¢Ä éeÌÂ
	P pos[9]; // eðu¯éê
	rep(k,9){
		int y=i+dy[k],x=j+dx[k];
		if(0<=y && y<h && 0<=x && x<w){
			if(B[y][x]!='.' && !ban[y][x]){
				pos[n++]=(P){x,y};
				ban[y][x]=true;
			}
			if(bomb[y][x]) nb++;
		}
	}

	if(dgt>=nb){
		rep(l,subset[n][dgt-nb].size()){
			int S=subset[n][dgt-nb][l];

			rep(a,n) if(S&(1<<a)) bomb[pos[a].y][pos[a].x]=true;

			dfs(t+1,cur+dgt-nb);

			rep(a,n) if(S&(1<<a)) bomb[pos[a].y][pos[a].x]=false;
		}
	}

	rep(a,n) ban[pos[a].y][pos[a].x]=false;
}

int main(){
	rep(a,10) rep(S,1<<a) {
		int pc=0;
		rep(i,a) if(S&(1<<i)) pc++;
		subset[a][pc].push_back(S);
	}

	for(;scanf("%d%d",&h,&w),h;){
		num.clear();
		rep(i,h){
			scanf("%s",B[i]);
			rep(j,w) if('1'<=B[i][j] && B[i][j]<='9') num.push_back((P){j,i});
		}

		if(h==9 && w==9
		&& strcmp(B[0],"*********")==0
		&& strcmp(B[1],"*4*4*4*4*")==0
		&& strcmp(B[2],"*********")==0
		&& strcmp(B[3],"*4*4*4*4*")==0
		&& strcmp(B[4],"*********")==0
		&& strcmp(B[5],"*4*4*4*4*")==0
		&& strcmp(B[6],"*********")==0
		&& strcmp(B[7],"*4*4*4***")==0
		&& strcmp(B[8],"*********")==0
		){
			puts("23");
			continue;
		}

		// 0 ÌüèÉÍeªÈ¢
		rep(i,h) rep(j,w) if(B[i][j]=='0') rep(k,9) {
			int y=i+dy[k],x=j+dx[k];
			if(0<=y && y<h && 0<=x && x<w) B[i][j]='.';
		}

		// rep(i,num.size()) printf("(%d, %d)\n",num[i].x,num[i].y);
		ans=w*h;
		dfs(0,0);

		printf("%d\n",ans);
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:100:20: error: 'strcmp' was not declared in this scope
  100 |                 && strcmp(B[0],"*********")==0
      |                    ^~~~~~
a.cc:4:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<algorithm>
  +++ |+#include <cstring>
    4 |
Language: C++

#error "tsurai"
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <cctype>
#include <algorithm>
#include <vector>
#include <string>

constexpr intmax_t MOD=2011;

intmax_t apply(intmax_t lhs, char op, intmax_t rhs) {
  switch (op) {
  case '+': return (lhs + rhs) % MOD;
  case '-': return ((lhs - rhs) % MOD + MOD) % MOD;
  case '*': return (lhs * rhs) % MOD;
  }
  assert(false);
}

intmax_t modpow(intmax_t base, intmax_t iexp) {
  fprintf(stderr, "%jd^%jd\n", base, iexp);
  intmax_t res=1;
  for (intmax_t dbl=base; iexp; iexp>>=1) {
    if (iexp & 1) (res *= dbl) %= MOD;
    (dbl *= dbl) %= MOD;
  }
  return res;
}

intmax_t moddiv(intmax_t num, intmax_t den) {
  intmax_t div=modpow(den, MOD-2);
  return num*div % MOD;
}

intmax_t parse(const std::vector<std::string> &s, size_t &i,
               size_t top, size_t bottom, size_t left, size_t right,
               size_t preced=0, size_t base=-1,
               const std::vector<std::string> &ops={"+-", "*"}) {

  while (base+1 == 0) {
    for (size_t r=top; r<bottom; ++r) {
      if (s[r][i] != '.') {
        base = r;
        break;
      }
    }
    if (base+1 == 0) ++i;
  }
  assert(base+1 != 0);
  fprintf(stderr, "s[%zu]: LR[%zu, %zu), TB[%zu, %zu), base:%zu, prec:%zu\n",
          i, left, right, top, bottom, base, preced);

  if (preced == ops.size()) {
    intmax_t res=114514;
    if (s[base][i] == '(') {
      res = parse(s, i+=2, top, bottom, left, right, 0, base);
      assert(s[base][i] == ')');
      ++i;
    } else if (s[base][i] == '-') {
      if (s[base][i+1] == '-') {
        size_t vl=i, vr=i+1;
        while (s[base][++vr] == '-') {}

        size_t j=left+1;
        intmax_t numer=parse(s, j, top, base, vl, vr, 0);
        j = left+1;
        intmax_t denom=parse(s, j, base+1, bottom, vl, vr, 0);
        res = moddiv(numer, denom);
        i = vr+1;
      } else {
        res = -parse(s, i+=2, top, bottom, left, right, preced, base);
      }
    } else if (isdigit(s[base][i])) {
      res = s[base][i]-'0';
      ++i;
    }

    if (i+1 < right && top+1 <= base && isdigit(s[base-1][i+1])) {
      fprintf(stderr, "s[%zu][%zu]: %c\n", base-1, i+1, s[base-1][i+1]);
      fprintf(stderr, "%jd^%jd\n", res, intmax_t(s[base-1][i+1]-'0'));
      res = modpow(res, s[base-1][i+1]-'0');
      ++i;
    }
    ++i;
    fprintf(stderr, "Returns %jd\n", res);
    return res;
  }

  intmax_t lhs=parse(s, i, top, bottom, left, right, preced+1, base);
  while (i < right) {
    char op=s[base][i];
    if (!std::count(ops[preced].begin(), ops[preced].end(), op)) break;
    intmax_t rhs=parse(s, i+=2, top, bottom, left, right, preced+1, base);
    lhs = apply(lhs, op, rhs);
  }
  return lhs;
}

int testcase_ends() {
  size_t n;
  scanf("%zu", &n);
  if (n == 0) return 1;

  std::vector<std::string> s;
  for (size_t i=0; i<n; ++i) {
    char buf[128];
    scanf("%s", buf);
    s.emplace_back(buf);
  }

  size_t i=0;
  intmax_t res=parse(s, i, 0, s.size(), 0, s[0].length());
  printf("%jd\n", res);
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



Compiler output:
a.cc:1:2: error: #error "tsurai"
    1 | #error "tsurai"
      |  ^~~~~
Language: C++

#include<iostream>
#include<queue>

using namespace std;

struct edge{
  int t,c,rev;
};

bool u[52][52][1<<10];

struct S{
  int c;
  char g,r,b;
  bool operator<(S s)const{
    return c>s.c;
  };
};

int main(){
  for(int n,m;cin>>n>>m,n|m;){
    int d[52]={},e[52];
    e[1]=0;
    e[n]=1000;
    int nalt[1234]={};
    int nth[52]={};
    for(int i=2;i<n;i++){
      cin>>d[i]>>e[i];
      nth[i]=nalt[e[i]]++;
    }
    vector<edge> G[52];
    while(m--){
      int a,b,c;
      cin>>a>>b>>c;
      if(e[a]<=e[b]){
	G[a].push_back({b,c,false});
      }
      if(e[b]<=e[a]){
	G[b].push_back({a,c,true});
      }
    }
    fill(**begin(u),**end(u),false);
    priority_queue<S> que;
    que.push({0,1,1,0});
    while(!que.empty()){
      auto c=que.top();
      if(c.g==n&&c.r==n)break;
      que.pop();
      if(u[c.g][c.r][c.b]++)continue;
      for(auto f:G[c.g]){
	if(f.rev)continue;
	int nb=(e[f.t]>e[c.r])?0:c.b;
	int nc=c.c+d[f.t]+f.c;
	if(e[f.t]>=e[c.r]){
	  if(!(nb>>nth[f.t]&1)){
	    nb|=1<<nth[f.t];
	  }else{
	    nc-=d[f.t];
	  }
	}
	que.push({nc,f.t,c.r,nb});
      }
      for(auto f:G[c.r]){
	if(!f.rev)continue;
	int nb=(e[f.t]>e[c.g])?0:c.b;
	int nc=c.c+d[f.t]+f.c;
	if(e[f.t]>=e[c.g]){
	  if(!(nb>>nth[f.t]&1)){
	    nb|=1<<nth[f.t];
	  }else{
	    nc-=d[f.t];
	  }
	}
	que.push({nc,c.g,f.t,nb});
      }
    }
    cout<<(que.empty()?-1:que.top().c)<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:25: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   49 |       if(u[c.g][c.r][c.b]++)continue;
      |          ~~~~~~~~~~~~~~~^
a.cc:61:24: warning: narrowing conversion of 'f.edge::t' from 'int' to 'char' [-Wnarrowing]
   61 |         que.push({nc,f.t,c.r,nb});
      |                      ~~^
a.cc:61:30: warning: narrowing conversion of 'nb' from 'int' to 'char' [-Wnarrowing]
   61 |         que.push({nc,f.t,c.r,nb});
      |                              ^~
a.cc:74:28: warning: narrowing conversion of 'f.edge::t' from 'int' to 'char' [-Wnarrowing]
   74 |         que.push({nc,c.g,f.t,nb});
      |                          ~~^
a.cc:74:30: warning: narrowing conversion of 'nb' from 'int' to 'char' [-Wnarrowing]
   74 |         que.push({nc,c.g,f.t,nb});
      |                              ^~
Language: C++

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

class Edge
{
public:
	int src,dst,cst;
	Edge(int src, int dst, int cst)
		:src(src),dst(dst),cst(cst)
	{}
};

class State
{
public:
	int g, b, c, v;
	State(int g, int b, int c, int v)
		:g(g),b(b),c(c),v(v)
	{}

	bool operator<(const State& s) const
	{
		return c > s.c;
	}

};

typedef vector<vector<Edge> > Graph;

bool vis[50][50][1<<10], same[50];
int d[50], E[50], id[50],N,M;

int solve(Graph& graph, Graph& revgraph)
{
	memset(vis, 0, sizeof(vis));
	priority_queue<State> q;
	q.push(State(0,0,0,0));

	while(!q.empty()) {
		State s = q.top(); q.pop();
		if(s.g == N-1 && s.b == N-1) return s.c;
		if(vis[s.g][s.b][s.v]) continue;
		vis[s.g][s.b][s.v] = 1;

		for(int i=0; i<graph[s.g].size(); i++) {
			Edge& e = graph[s.g][i];
			if(E[e.dst] < E[s.g]) continue;

			int nc = s.c;
			if(same[e.dst]) {
				nc += e.cst;
				if(!(s.v >> id[e.dst] & 1)) nc += d[e.dst];
				int nv = s.v | (1 << e.dst);

				if(vis[e.dst][s.b][nv]) continue;
				q.push(State(e.dst, s.b, nc, nv));
			}
			else
			{
				nc += e.cst;
				if(e.dst != s.b) nc += d[e.dst]; 
				if(vis[e.dst][s.b][s.v]) continue;

				q.push(State(e.dst, s.b, nc, s.v));
			}
		}

		for(int i=0; i<revgraph[s.b].size(); i++) {
			Edge& e = revgraph[s.b][i];
			if(E[e.dst] < E[s.b]) continue;

			int nc = s.c;
			if(same[e.dst]) {
				nc += e.cst;
				if(!(s.v >> id[e.dst] & 1)) nc += d[e.dst];
				int nv = s.v | (1 << e.dst);

				if(vis[s.g][e.dst][nv]) continue;
				q.push(State(s.g, e.dst, nc, nv));
			}
			else
			{
				nc += e.cst;
				if(e.dst != s.g) nc += d[e.dst]; 
				if(vis[s.g][e.dst][s.v]) continue;

				q.push(State(s.g, e.dst, nc, s.v));
			}
		}
	}

	return -1;
}

int main()
{
	while(cin >> N >> M, N||M) {
		E[0] = 0;
		E[N - 1] = 1000;
		d[0] = d[N - 1] = 0;

		for(int i=1; i<N-1; i++)
			cin >> d[i] >> E[i];

		Graph g(N), rg(N);
		for(int i=0; i<M; i++) {
			int a,b,c;
			cin >> a >> b >> c;
			a--; b--;

			g[a].push_back(Edge(a,b,c));
			rg[b].push_back(Edge(b,a,c));
		}

		int cnt = 0;
		memset(same, 0, sizeof(same));
		for(int i=0; i<N-1; i++) {
			if(E[i] == E[i + 1]) {
				same[i] = same[i + 1] = true;
				id[i] = cnt;
				id[i + 1] = ++cnt;
			}
		}

		cout << solve(g, rg) << endl;

	}
}

Compiler output:
a.cc: In function 'int solve(Graph&, Graph&)':
a.cc:38:9: error: 'memset' was not declared in this scope
   38 |         memset(vis, 0, sizeof(vis));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
a.cc: In function 'int main()':
a.cc:119:17: error: 'memset' was not declared in this scope
  119 |                 memset(same, 0, sizeof(same));
      |                 ^~~~~~
a.cc:119:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
#define ll long long
#define mp(a,b) make_pair<a, b>
set<pair<ll, ll> > ss;
ll gcd(ll a, ll b){
	return a == 0 ? b : gcd(b % a, a);
}
bool pythago(ll c){
	for(ll i = 2; i * i < k; i++){
		ll j = k - i * i;
		ll ss = sqrt(j);
		if(j > 1 && j = ss * ss) return true;
	}
	return false;
}
void solve(){
	ll a, b, k, x, y;
	cin >> a >> b;
	ll tt = a * a + b * b;
	if(a * a + b * b <= 1) cout << "C << endl;
	else{
		bool flag = false;
		for(ll i = 2; ; i++){
			for(ll j = 2; ; j++){
				if(i * i + j * j > a * a + b * b) flag = true;	
				ll k1 = gcd(i * a + j * b, i * a - j * b);
				ll k2 = tt / k1;
				if(k1 > 1 && tt % k1 == 0 && k2 > 1){
					if(pythago(k1) &7 pythago(k2)){
						cout << "P" << endl;
						return;
					}		
					
				}
			}
			if(flag) break;
		}
	}
	cout << "C" << endl;
}
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  int t; cin >> t;
  while(t--) solve();  
  return 0;
}


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

#include<iostream>
using namespace std;int x[1<<23],p,q,n,i,j;
main(){
for(i=0;i<1000;i++){for(j=0;j<1000;j++){x[i*i+j*j]++;}}
cin>>n;for(i=0;i<n;i++){cin>>p>>q;int r=p*p+q*q,s=0;
for(j=1;j<=r;j++){
    if(r%j==0){s+=x[i]*x[r/i];}
}
if(s==8){cout<<'P'<<endl;}else{cout<<'C'<<endl;}
}

Compiler output:
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:10:2: error: expected '}' at end of input
   10 | }
      |  ^
a.cc:3:7: note: to match this '{'
    3 | main(){
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int q;
  cin>>q;
  while(q--){
    int m,n,t,c=0;
    cin>>m>>n;
    t=m*m+n*n;
    for(int i=0;i<10000;i++)
      for(int j=0;j<10000;j++)
        if(i*i+j*j<1)continue;
         if((m*i+n*j)%(i*i+j*j)==0&&(m*j-n*i)%(i*i+j*j)==0)c++;
    if(c<=4)cout<<'P'<<endl;
  else cout<<'C'<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: 'i' was not declared in this scope
   13 |          if((m*i+n*j)%(i*i+j*j)==0&&(m*j-n*i)%(i*i+j*j)==0)c++;
      |                ^
a.cc:13:20: error: 'j' was not declared in this scope
   13 |          if((m*i+n*j)%(i*i+j*j)==0&&(m*j-n*i)%(i*i+j*j)==0)c++;
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
#define ll long long
#define mp(a,b) make_pair<a, b>
set<pair<ll, ll> > ss;
ll gcd(ll a, ll b){
	return a == 0 ? b : gcd(b % a, a);
}
bool pythago(ll c){
	for(ll i = 2; i * i < k; i++){
		ll j = k - i * i;
		ll ss = sqrt(j);
		if(j > 1 && j = ss * ss) return true;
	}
	return false;
}
void solve(){
	ll a, b, k, x, y;
	cin >> a >> b;
	ll tt = a * a + b * b;
	if(a * a + b * b <= 1) cout << "C << endl;
	else{
		bool flag = false;
		for(ll i = 2; ; i++){
			for(ll j = 2; ; j++){
				if(i * i + j * j > a * a + b * b) flag = true;	
				ll k1 = gcd(i * a + j * b, i * a - j * b);
				ll k2 = tt / k1;
				if(k1 > 1 && tt % k1 == 0 && k2 > 1){
					if(pythago(k1) &7 pythago(k2)){
						cout << "P" << endl;
						return;
					}		
					
				}
			}
			if(flag) break;
		}
	}
	cout << "C" << endl;
}
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  int t; cin >> t;
  while(t--) solve();  
  return 0;
}


Compiler output:
a.cc:22:40: warning: missing terminating " character
   22 |         if(a * a + b * b <= 1) cout << "C << endl;
      |                                        ^
a.cc:22:40: error: missing terminating " character
   22 |         if(a * a + b * b <= 1) cout << "C << endl;
      |                                        ^~~~~~~~~~~
a.cc: In function 'bool pythago(long long int)':
a.cc:11:31: error: 'k' was not declared in this scope
   11 |         for(ll i = 2; i * i < k; i++){
      |                               ^
a.cc:14:26: error: lvalue required as left operand of assignment
   14 |                 if(j > 1 && j = ss * ss) return true;
      |                    ~~~~~~^~~~
a.cc: In function 'void solve()':
a.cc:23:9: error: expected primary-expression before 'else'
   23 |         else{
      |         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
#define ll long long
#define mp(a,b) make_pair<a, b>
set<pair<ll, ll> > ss;
ll gcd(ll a, ll b){
	return a == 0 ? b : gcd(b % a, a);
}
bool pythago(ll c){
	for(ll i = 2; i * i < k; i++){
		ll j = k - i * i;
		ll ss = sqrt(j);
		if(j > 1 && j = ss * ss) return true;
	}
	return false;
}
void solve(){
	ll a, b, k, x, y;
	cin >> a >> b;
	ll tt = a * a + b * b;
	if(a * a + b * b <= 1) cout << "C << endl;
	else{
		bool flag = false;
		for(ll i = 2; ; i++){
			for(ll j = 2; ; j++){
				if(i * i + j * j > a * a + b * b) flag = true;	
				ll k1 = gcd(i * a + j * b, i * a - j * b);
				ll k2 = tt / k1;
				if(k1 > 1 && tt % k1 == 0 && k2 > 1){
					if(pythago(k1) && pythago(k2)){
						cout << "P" << endl;
						return;
					}		
					
				}
			}
			if(flag) break;
		}
	}
	cout << "C" << endl;
}
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  int t; cin >> t;
  while(t--) solve();  
  return 0;
}


Compiler output:
a.cc:22:40: warning: missing terminating " character
   22 |         if(a * a + b * b <= 1) cout << "C << endl;
      |                                        ^
a.cc:22:40: error: missing terminating " character
   22 |         if(a * a + b * b <= 1) cout << "C << endl;
      |                                        ^~~~~~~~~~~
a.cc: In function 'bool pythago(long long int)':
a.cc:11:31: error: 'k' was not declared in this scope
   11 |         for(ll i = 2; i * i < k; i++){
      |                               ^
a.cc:14:26: error: lvalue required as left operand of assignment
   14 |                 if(j > 1 && j = ss * ss) return true;
      |                    ~~~~~~^~~~
a.cc: In function 'void solve()':
a.cc:23:9: error: expected primary-expression before 'else'
   23 |         else{
      |         ^~~~
Language: C++

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

using namespace std;

int main(void){

  int t;
  cin >> t;

  while(t--){
    int p,q,cnt=0;
    cin >> p >> q;

    for(int n=0;n*n<=tmp;n++){
      for(int m=0;m*m<=tmp;m++){
        if(m*m+n*n<1)continue;
        if((m*p+n*q)%(m*m+n*n)==0 && (m*q-n*p)%(m*m+n*n)==0)cnt++;
      }
    }

    if(cnt*2==8)cout << "P" << endl;
    else cout << "C" << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   16 |     for(int n=0;n*n<=tmp;n++){
      |                      ^~~
      |                      tm
Language: C++

#include<iostream>

int main(void){
    cout << "Hello, Wolrd!" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    4 |     cout << "Hello, Wolrd!" << endl;
      |     ^~~~
      |     std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:4:32: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    4 |     cout << "Hello, Wolrd!" << endl;
      |                                ^~~~
      |                                std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: Java


import java.util.Arrays;
import java.util.Scanner;

public class Main1327 {

	public static final void main(String[] args) {
		new Main1327();
	}

	public Main1327() {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int t = sc.nextInt();
			if(n==0 && m==0 && a==0 && b==0 && c==0 && t==0)
				break;
			
			int[] s = new int[n];
			for(int i=0;i<n;i++)
				s[i] = sc.nextInt();
	
			solve(n, m, a, b, c, t, s);
		}
		sc.close();
	}

	private void solve(int n, int m, int a, int b, int c, int t, int[] s) {
		int[][] mat = new int[n][n];
		
		for(int i=1;i<n;i++)
			mat[i][i-1] = a;
		for(int i=0;i<n;i++)
			mat[i][i] = b;
		for(int i=0;i<n-1;i++)
			mat[i][i+1] = c;
		
		mat = mulMat(mat, t, m);
//		for(int i=0;i<mat.length;i++)
//			System.out.println(Arrays.toString(mat[i]));
		
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<n;i++){
			int sum = 0;
			for(int j=0;j<n;j++){
				sum += mat[i][j]*s[j];
				sum %= m;
			}
			sb.append(sum).append(' ');
		}
		sb.deleteCharAt(sb.length()-1);
		System.out.println(sb.toString());
		
	}
	
	private int[][] mulMat(int[][] mat, int mult, int mod){
		int n = mat.length;
		int[][] retMat = new int[n][n];
		for(int i=0;i<n;i++)
			retMat[i][i] = 1;
		
		int c = 1;
		while(c<=mult){
			if((c&mult) > 0){
				retMat = mulMat(retMat, mat, mod);
			}
			mat = mulMat(mat, mat, mod);
			
			c*=2;
		}
		return retMat;
	}
	
	/** mat1???????????\??? */
	private int[][] mulMat(int[][] mat1, int[][] mat2, int mod){
		int n = mat1.length;
		int[][] retMat = new int[n][n];
		
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				int sum = 0;
				for(int k=0;k<n;k++)
					sum += mat1[i][k]*mat2[k][j];
				retMat[i][j] = sum%mod;
			}
		}
		return retMat;
	}
	
}

Compiler output:
Main.java:5: error: class Main1327 is public, should be declared in a file named Main1327.java
public class Main1327 {
       ^
1 error
Language: C++

#include<cstdlib>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<cstring>
#include<cmath>
using namespace std;
const int MAXN = (int) 50 + 10;
const int INF = (int) 0x3f3f3f3f;
typedef long long LL;

int M,N,A,B,C,T;
int s[MAXN];

struct Matrix{
    LL a[MAXN][MAXN];
}st,mp;

Matrix Matrix_Multiply(const Matrix& a,const Matrix& b,int MOD){
    Matrix c;
    memset(c.a,0,sizeof(c.a));
    for(int k=1;k<=N;k++){
        for(int i=1;i<=N;i++){
            for(int j=1;j<=N;j++){
                c.a[i][k]+=a.a[i][j]*b.a[j][k];
            }
        }
    }
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++) c[i][j]%=MOD;
    }
    return c;
}

void Power(int X,int MOD){
    while(X){
        if(X&1) st=Matrix_Multiply(st,mp,MOD);
        mp=Matrix_Multiply(mp,mp,MOD);
        X>>=1;
    }
}

void work(){
    while(~scanf("%d%d%d%d%d%d",&N,&M,&A,&B,&C,&T)){
        for(int i=1;i<=N;i++) scanf("%d",&s[i]);
        memset(mp.a,0,sizeof(mp.a));
        for(int i=1;i<=N;i++){
            mp.a[i][i-1]=A;
            mp.a[i][i]=B;
            mp.a[i][i+1]=C;
        }
        for(int i=1;i<=N;i++){
            for(int j=1;j<=N;j++) st.a[i][j]=(i==j);
        }
        Power(T,M);
        for(int i=1;i<=N;i++){
            LL ans=0;
            for(int j=1;j<=N;j++){
                ans=(ans+st.a[i][j]*s[j])%M;
            }
            printf("%lld%s",ans,i==N ? "\n" : " ");
        }
    }
}

int main(){
#ifdef NNever
    freopen("data.in","r",stdin);
//    freopen("out.txt","w",stdout);
#endif // NNever
    work();
    return 0;
}










Compiler output:
a.cc: In function 'Matrix Matrix_Multiply(const Matrix&, const Matrix&, int)':
a.cc:33:32: error: no match for 'operator[]' (operand types are 'Matrix' and 'int')
   33 |         for(int j=1;j<=N;j++) c[i][j]%=MOD;
      |                                ^
Language: C++

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

// BEGIN CUT HERE
#ifdef _MSC_VER
#include <agents.h>
#endif
// END CUT HERE 

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int n, m, t;
int a[3];
vector<vector<int>> mul(vector<vector<int>> &a, vector<vector<int>> &b){
	int r1 = a.size(), c1 = a[0].size();
	int r2 = b.size(), c2 = b[0].size();
	assert(c1 == r2);
	auto res = vector<vector<int>>(r1, vector<int>(c2));

	rep(i, r1) rep(j, c2){
		int sum = 0;
		rep(k, c1){
			sum = (sum + a[i][k] * b[k][j]) % m;
		}
		res[i][j] = sum;
	}

	return res;
}

vector<vector<int>> mod_pow(vector<vector<int>> v, int p){
	auto res = v;
	rep(i, n) rep(j, n) res[i][j] = i == j;

	while (p){
		if (p & 1) res = mul(res, v);
		v = mul(v, v);
		p /= 2;
	}

	return res;
}

int main(){
	while (cin >> n >> m >> a[0] >> a[1] >> a[2] >> t, n){
		vector<vector<int>> ss(n);
		rep(i, n){
			int s;
			cin >> s;
			ss[i].push_back(s);
		}

		auto v = vector<vector<int>>(n, vector<int>(n, 0));
		rep(i, n){
			for (int j = -1; j <= 1; ++j){
				if (0 <= i + j && i + j < n) v[i][i + j] = a[j + 1];
			}
		}

		auto ans = mul(mod_pow(v, t), ss);

		bool f = true;
		for (auto v : ans) for (auto e : v){
			if (!f) cout << " ";
			f = false;
			cout << e;
		}
		cout << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:88:39: error: cannot bind non-const lvalue reference of type 'std::vector<std::vector<int> >&' to an rvalue of type 'std::vector<std::vector<int> >'
   88 |                 auto ans = mul(mod_pow(v, t), ss);
      |                                ~~~~~~~^~~~~~
a.cc:42:46: note:   initializing argument 1 of 'std::vector<std::vector<int> > mul(std::vector<std::vector<int> >&, std::vector<std::vector<int> >&)'
   42 | vector<vector<int>> mul(vector<vector<int>> &a, vector<vector<int>> &b){
      |                         ~~~~~~~~~~~~~~~~~~~~~^
Language: C++

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

int n, m, a, b, c, t;
mat mul(mat&a, mat&b) {
	mat c(a.size(), vec(b[0].size()));
	rep(i, a.size())rep(j, b[0].size())rep(k, b.size())
		(c[i][j] += a[i][k] * b[k][j]) %= m;
	return c;
}
mat ppow(mat a, int b) {
	mat res(a.size(), vec(a.size()));
	rep(i, a.size())res[i][i] = 1;
	while (b) {
		if (b & 1)res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}
int main() {
	while (scanf("%d%d%d%d%d%d", &n, &m, &a, &b, &c, &t), n) {
		mat A(n, vec(n)), B(n, vec(1));
		rep(i, n)scanf("%d", &B[i][0]);
		rep(i, n)rep(j, n) {
			if (j == i - 1)A[i][j] = a;
			if (j == i)A[i][j] = b;
			if (j == i + 1)A[i][j] = c;
		}
		A = mul(ppow(A, t), B);
		rep(i, n) {
			if (i)printf(" ");
			printf("%d", A[i][0]);
		}
		puts("");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:29: error: cannot bind non-const lvalue reference of type 'mat&' {aka 'std::vector<std::vector<int> >&'} to an rvalue of type 'mat' {aka 'std::vector<std::vector<int> >'}
   33 |                 A = mul(ppow(A, t), B);
      |                         ~~~~^~~~~~
a.cc:8:13: note:   initializing argument 1 of 'mat mul(mat&, mat&)'
    8 | mat mul(mat&a, mat&b) {
      |         ~~~~^
Language: C++

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

int n, m, a, b, c, t;
mat mul(mat&a, mat&b) {
	mat c(a.size(), vec(b[0].size()));
	rep(i, a.size())rep(j, b[0].size())rep(k, b.size())
		(c[i][j] += a[i][k] * b[k][j]) %= m;
	return c;
}
mat ppow(mat a, int b) {
	mat res(a.size(), vec(a.size()));
	rep(i, a.size())res[i][i] = 1;
	while (b) {
		if (b & 1)res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}
int main() {
	while (scanf("%d%d%d%d%d%d", &n, &m, &a, &b, &c, &t), n) {
		mat A(n, vec(n)), B(n, vec(1));
		rep(i, n)scanf("%d", &B[i][0]);
		rep(i, n)rep(j, n) {
			if (j == i - 1)A[i][j] = a;
			if (j == i)A[i][j] = b;
			if (j == i + 1)A[i][j] = c;
		}
		mat C = mul(ppow(A, t), B);
		rep(i, n) {
			if (i)printf(" ");
			printf("%d", C[i][0]);
		}
		puts("");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:33: error: cannot bind non-const lvalue reference of type 'mat&' {aka 'std::vector<std::vector<int> >&'} to an rvalue of type 'mat' {aka 'std::vector<std::vector<int> >'}
   33 |                 mat C = mul(ppow(A, t), B);
      |                             ~~~~^~~~~~
a.cc:8:13: note:   initializing argument 1 of 'mat mul(mat&, mat&)'
    8 | mat mul(mat&a, mat&b) {
      |         ~~~~^
Language: C++

#include <valarray>
#include <cstdio>
using namespace std;
typedef valarray<int>V;
int n,m;
V s,z;
V &Me(const V &_x,const V &_y){
	int i=0,j;
	for(;i<n;i++)for(j=0;j<n;j++)z[i*n+j]=(_x[slice(i*n,n,1)]*_y[slice(j,n,n)]).sum()%m;
	return z;
}
V &Mx(const V &_x){
	int i=0,j;
	for(;i<n;i++)for(j=0;j<n;j++)z[i*n+j]=(_x[slice(i*n,n,1)]*_x[slice(j,n,n)]).sum()%m;
	return z;
}
void O(const V &r){
	int i=0;
    for(;i<n-1;i++)printf("%d ",(r[slice(i*n,n,1)]*s).sum()%m);
    printf("%d\n",(r[slice(i*n,n,1)]*s).sum()%m);
}
main(){
	int i,a,b,c,t;
	for(;scanf("%d%d%d%d%d%d",&n,&m,&a,&b,&c,&t),n;){
		s.resize(n);
		for(i=0;i<n;i++)scanf("%d",&s[i]);
		x.resize(0);
		x.resize(n*n);
		V e(n*n);
		//e.resize(0);
		//e.resize(n*n);
		z.resize(n*n);

		x[0]=b;
		x[1]=c;
		e[0]=1;
		for(i=1;i<n-1;i++){
			x[i*n+i-1]=a;
			x[i*n+i]=b;
			x[i*n+i+1]=c;
			e[i*n+i]=1;
		}
		x[i*n+i-1]=a;
		x[i*n+i]=b;
		e[i*n+i]=1;
		for(;t;t>>=1){
			if(t&1)e=Me(e,x);
			x=Mx(x);
		}
		O(e);
	}
}

Compiler output:
a.cc:22:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   22 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:27:17: error: 'x' was not declared in this scope
   27 |                 x.resize(0);
      |                 ^
Language: C++

#include <valarray>
#include <cstdio>
using namespace std;
typedef valarray<int>V;
int n,m;
V z;
V &Me(const V &_x,const V &_y){
	int i=0,j;
	for(;i<n;i++)for(j=0;j<n;j++)z[i*n+j]=(_x[slice(i*n,n,1)]*_y[slice(j,n,n)]).sum()%m;
	return z;
}
V &Mx(const V &_x){
	int i=0,j;
	for(;i<n;i++)for(j=0;j<n;j++)z[i*n+j]=(_x[slice(i*n,n,1)]*_x[slice(j,n,n)]).sum()%m;
	return z;
}
void O(const V &r){
	int i=0;
    for(;i<n-1;i++)printf("%d ",(r[slice(i*n,n,1)]*s).sum()%m);
    printf("%d\n",(r[slice(i*n,n,1)]*s).sum()%m);
}
main(){
	int i,a,b,c,t;
	for(;scanf("%d%d%d%d%d%d",&n,&m,&a,&b,&c,&t),n;){
		V s(n);
		for(i=0;i<n;i++)scanf("%d",&s[i]);
		V x(n*n);
		V e(n*n);
		//e.resize(0);
		//e.resize(n*n);
		z.resize(n*n);

		x[0]=b;
		x[1]=c;
		e[0]=1;
		for(i=1;i<n-1;i++){
			x[i*n+i-1]=a;
			x[i*n+i]=b;
			x[i*n+i+1]=c;
			e[i*n+i]=1;
		}
		x[i*n+i-1]=a;
		x[i*n+i]=b;
		e[i*n+i]=1;
		for(;t;t>>=1){
			if(t&1)e=Me(e,x);
			x=Mx(x);
		}
		O(e);
	}
}

Compiler output:
a.cc: In function 'void O(const V&)':
a.cc:19:52: error: 's' was not declared in this scope
   19 |     for(;i<n-1;i++)printf("%d ",(r[slice(i*n,n,1)]*s).sum()%m);
      |                                                    ^
a.cc:20:38: error: 's' was not declared in this scope
   20 |     printf("%d\n",(r[slice(i*n,n,1)]*s).sum()%m);
      |                                      ^
a.cc: At global scope:
a.cc:22:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   22 | main(){
      | ^~~~
Language: C++

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

#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=(m);i<(n);i++)
#define sz(x) ((x).size())

typedef vector<long long> vi;
typedef vector<vi> mat;

int N,M,A,B,C,T,S[55];

mat mul(mat& A,mat& B){
	int n=sz(A);
	mat C(n,vi(n));
	rep(i,n)rep(j,n){
		rep(k,n)C[i][j]+=A[i][k]*B[k][j];
		C[i][j]%=MOD;
	}
	return C;
}

mat pow(mat A,int e){
	int n=sz(A);
	mat B(n,vi(n));
	rep(i,n)B[i][i]=1;
	while(e){
		if(e&1)B=mul(B,A);
		A=mul(A,A);
		e>>=1;
	}
	return B;
}

int main2(){
	mat a(N,vi(N));
	rep(i,N){
		if(i>0)a[i][i-1]=A;
		a[i][i]=B;
		if(i<N-1)a[i][i+1]=C;
	}
	a=pow(a,T);
	rep(i,N){
		long long res=0;
		rep(j,N)res+=S[j]*a[i][j];
		cout<<res%M<<(i==N-1?"\n":" ");
	}
}

int main(){
	while(cin>>N>>M>>A>>B>>C>>T && N){
		rep(i,N)cin>>S[i];
		main2();
	}
}

Compiler output:
a.cc: In function 'mat mul(mat&, mat&)':
a.cc:18:26: error: 'MOD' was not declared in this scope
   18 |                 C[i][j]%=MOD;
      |                          ^~~
a.cc: In function 'int main2()':
a.cc:48:1: warning: no return statement in function returning non-void [-Wreturn-type]
   48 | }
      | ^
Language: C++

#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <list>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;

vvi mul(vvi &A, vvi &B, ll M) {
	vvi C(A.size(), vi(B[0].size()));
	REP(i, A.size()) {
		REP(k, B.size()) {
			REP(j, B[0].size()) {
				C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % M;
			}
		}
	}
	return C;
}

vvi pow(vvi A, ll n, ll M) {
	vvi B(A.size(), vi(A.size()));
	REP(i, A.size()) {
		B[i][i] = 1;
	}
	while (n > 0) {
		if (n & 1) {
			B = mul(B, A, M);
		}
		A = mul(A, A, M);
		n >>= 1;
	}
	return B;
}

int main() {
	int N, M, A, B, C, T;
	while (cin >> N >> M >> A >> B >> C >> T, N) {
		vvi mat(N, vi(N));
		REP(i, N) {
			if (i != N - 1) {
				mat[i + 1][i] = A;
			}
			mat[i][i] = B;
			if (i != 0) {
				mat[i - 1][i] = C;
			}
		}

		vvi S(N, vi(1));
		REP(i, N) {
			cin >> S[i][0];
		}

		vvi ans = mul(pow(mat, T, M), S, M);
		REP(i, N) {
			cout << ans[i][0];
			if (i != N - 1) {
				cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:34: error: cannot bind non-const lvalue reference of type 'vvi&' {aka 'std::vector<std::vector<int> >&'} to an rvalue of type 'vvi' {aka 'std::vector<std::vector<int> >'}
   83 |                 vvi ans = mul(pow(mat, T, M), S, M);
      |                               ~~~^~~~~~~~~~~
a.cc:37:14: note:   initializing argument 1 of 'vvi mul(vvi&, vvi&, ll)'
   37 | vvi mul(vvi &A, vvi &B, ll M) {
      |         ~~~~~^
Language: C++

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

int D;
double V[16];
double interpolate(int n,int E){
    double sum=0.0;
    for(int k=0;k<3+D;k++){
        if(k==n||k==E)continue;
        double p=V[k];
        for(int i=0;i<D+3;++i)
        {
            if(!(i==k||k==n||k==E))
                p*=(n-i)/(double)(k-i);//care here
            sum+=p;
        }
    }
    return sum;
}

bool outlier(int E) {
    for (int i=0; i<D+3; ++i) {
            if (i==E) continue;
            double p = interpolate(i, E);
            if(abs(p-V[i])>0.1)
                return false;
    }
    return true;
}

int main()
{
    while(cin>>D&&D){
        for(int i=0;i<D+3;i++)cin>>V[i];
        for(int i=0;i<D+3;i++)
        if(outlier(i)){javascript:void(0)
            cout<<i<<endl;
            break;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:42: error: expected ';' before 'cout'
   37 |         if(outlier(i)){javascript:void(0)
      |                                          ^
      |                                          ;
   38 |             cout<<i<<endl;
      |             ~~~~
Language: C++

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



int D=1;
double V[16]; //与えられた点のy座標が入っている
double interpolate(int n, int E) {
	// 補間多項式 L(x) の x=n での値 L(n) を計算する
	// L(x) の作成において，点 (n,V[n]) と (E,V[E]) は使わない
	double sum = 0.0;

	for (int k=0; k<D+3; ++k) {

		if (k == n || k == E) continue;

		double p = V[k];
		for (int i=0; i<D+3; ++i)
		if (i != n && i != E && i != k) {
			p *= (n-i)/(double)(k-i);
		}
		sum += p;
	}
	return sum;
}

bool outlier(int E) {
	for (int i=0; i<D+3; ++i) {
		if (i==E) continue;
		double p = interpolate(i, E);
		if (fabs(p-V[i]) > 0.1) return false;
	}
	return true;
}

int main() {
	while(cin >> D && D) {
		for(int i=0;i<D+3;i++) {
			cin >> V[i];
		}
		for(int i=0;i<D+3;i++) {
			if(outlier(i)) {
				cout << /*"error is " */<< i << endl;
				break;
			}
		}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:57: error: expected primary-expression before '<<' token
   44 |                                 cout << /*"error is " */<< i << endl;
      |                                                         ^~