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

#include<stdio.h>

struct data{
	int t,n,m,s;
}d[1001];
struct QUESTION{
	int s,e,m;//* start,end,m
}q[51];

int t[1261][10000];

int main(){
	int i,j,k,l,n,m,r,q;
	int ans;
	while(scanf("%d%d",&n,&m),n+m){
		scanf("%d",&r);
		for(i = 0;i < r;i++)
			scanf("%d%d%d%d",&d[i].t,&d[i].n,&d[i].m,&d[i].s);
		scanf("%d",&q);
		for(i = 0;i < q;i++)
			scanf("%d%d%d",&q[i].s,&q[i].e,&q[i].m);

		for(i = 0;i < 1261;i++)for(j = 0;i < m;j++)t[i][j] = 0;

		for(i = 0;i < r;i++){
			t[d[i].t][d[i].m] = d[i].s - (d[i].s == 0);
		}

		for(j = 0;i < m;j++){
			for(i = 1;i < 1261;i++){
				d[i][j] += d[i-1][j];
			}
		}

		for(i = 0;i < q;i++){
			ans = 0;
			for(j = q[i].s;j < q[i].e;j++){
				ans++;
			}
			printf("%d\n",ans);
		}
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:21:42: error: subscripted value is neither array nor pointer nor vector
   21 |                         scanf("%d%d%d",&q[i].s,&q[i].e,&q[i].m);
      |                                          ^
main.c:21:50: error: subscripted value is neither array nor pointer nor vector
   21 |                         scanf("%d%d%d",&q[i].s,&q[i].e,&q[i].m);
      |                                                  ^
main.c:21:58: error: subscripted value is neither array nor pointer nor vector
   21 |                         scanf("%d%d%d",&q[i].s,&q[i].e,&q[i].m);
      |                                                          ^
main.c:31:37: error: subscripted value is neither array nor pointer nor vector
   31 |                                 d[i][j] += d[i-1][j];
      |                                     ^
main.c:31:50: error: subscripted value is neither array nor pointer nor vector
   31 |                                 d[i][j] += d[i-1][j];
      |                                                  ^
main.c:37:34: error: subscripted value is neither array nor pointer nor vector
   37 |                         for(j = q[i].s;j < q[i].e;j++){
      |                                  ^
main.c:37:45: error: subscripted value is neither array nor pointer nor vector
   37 |                         for(j = q[i].s;j < q[i].e;j++){
      |                                             ^
Language: C

#include<stdio.h>

struct data{
	int t,n,m,s;
}d[1001];
struct QUESTION{
	int s,e,m;//* start,end,m
}q[51];

int t[1261][10000];

int main(){
	int i,j,k,l,n,m,r,q;
	int ans;
	while(scanf("%d%d",&n,&m),n+m){
		scanf("%d",&r);
		for(i = 0;i < r;i++)
			scanf("%d%d%d%d",&(d[i]).t,&(d[i]).n,&(d[i]).m,&(d[i]).s);
		scanf("%d",&q);
		for(i = 0;i < q;i++)
			scanf("%d%d%d",&(q[i]).s,&(q[i]).e,&(q[i]).m);

		for(i = 0;i < 1261;i++)for(j = 0;i < m;j++)t[i][j] = 0;

		for(i = 0;i < r;i++){
			t[d[i].t][d[i].m] = d[i].s - (d[i].s == 0);
		}

		for(j = 0;i < m;j++){
			for(i = 1;i < 1261;i++){
				d[i][j] += d[i-1][j];
			}
		}

		for(i = 0;i < q;i++){
			ans = 0;
			for(j = q[i].s;j < q[i].e;j++){
				ans++;
			}
			printf("%d\n",ans);
		}
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:21:43: error: subscripted value is neither array nor pointer nor vector
   21 |                         scanf("%d%d%d",&(q[i]).s,&(q[i]).e,&(q[i]).m);
      |                                           ^
main.c:21:53: error: subscripted value is neither array nor pointer nor vector
   21 |                         scanf("%d%d%d",&(q[i]).s,&(q[i]).e,&(q[i]).m);
      |                                                     ^
main.c:21:63: error: subscripted value is neither array nor pointer nor vector
   21 |                         scanf("%d%d%d",&(q[i]).s,&(q[i]).e,&(q[i]).m);
      |                                                               ^
main.c:31:37: error: subscripted value is neither array nor pointer nor vector
   31 |                                 d[i][j] += d[i-1][j];
      |                                     ^
main.c:31:50: error: subscripted value is neither array nor pointer nor vector
   31 |                                 d[i][j] += d[i-1][j];
      |                                                  ^
main.c:37:34: error: subscripted value is neither array nor pointer nor vector
   37 |                         for(j = q[i].s;j < q[i].e;j++){
      |                                  ^
main.c:37:45: error: subscripted value is neither array nor pointer nor vector
   37 |                         for(j = q[i].s;j < q[i].e;j++){
      |                                             ^
Language: C

#include<stdio.h>

struct data{
	int t,n,m,s;
}d[1001];
struct QUESTION{
	int s,e,m;//* start,end,m
}q[51];

int t[1261][10000];

int main(){
	int i,j,k,l,n,m,r,qq;
	int ans;
	while(scanf("%d%d",&n,&m),n+m){
		scanf("%d",&r);
		for(i = 0;i < r;i++)
			scanf("%d%d%d%d",&d[i].t,&d[i].n,&d[i].m,&d[i].s);
		scanf("%d",&qq);
		for(i = 0;i < qq;i++)
			scanf("%d%d%d",&q[i].s,&q[i].e,&q[i].m);

		for(i = 0;i < 1261;i++)for(j = 0;i < m;j++)t[i][j] = 0;

		for(i = 0;i < r;i++){
			t[d[i].t][d[i].m] = d[i].s - (d[i].s == 0);
		}

		for(j = 0;i < m;j++){
			for(i = 1;i < 1261;i++){
				d[i][j] += d[i-1][j];
			}
		}

		for(i = 0;i < qq;i++){
			ans = 0;
			for(j = q[i].s;j < q[i].e;j++){
				ans++;
			}
			printf("%d\n",ans);
		}
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:31:37: error: subscripted value is neither array nor pointer nor vector
   31 |                                 d[i][j] += d[i-1][j];
      |                                     ^
main.c:31:50: error: subscripted value is neither array nor pointer nor vector
   31 |                                 d[i][j] += d[i-1][j];
      |                                                  ^
Language: C

#include<stdio.h>

struct data{
	int t,n,m,s;
}d[1001];
struct QUESTION{
	int s,e,m;//* start,end,m
}q[51];

int t[1261][10000];

int main(){
	int i,j,k,l,n,m,r,qq;
	int ans;
	while(scanf("%d%d",&n,&m),n+m){
		scanf("%d",&r);
		for(i = 0;i < r;i++)
			scanf("%d%d%d%d",&d[i].t,&d[i].n,&d[i].m,&d[i].s);
		scanf("%d",&qq);
		for(i = 0;i < qq;i++)
			scanf("%d%d%d",&q[i].s,&q[i].e,&q[i].m);

		for(i = 0;i < 1261;i++)for(j = 0;i < m;j++)t[i][j] = 0;

		for(i = 0;i < r;i++){
			t[d[i].t][d[i].m] = d[i].s - (d[i].s == 0);
		}

		for(j = 0;j < m;j++){
			for(i = 1;i < 1261;i++){
				d[i][j] += d[i-1][j];
			}
		}

		for(i = 0;i < qq;i++){
			ans = 0;
			for(j = q[i].s;j < q[i].e;j++){
				ans++;
			}
			printf("%d\n",ans);
		}
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:31:37: error: subscripted value is neither array nor pointer nor vector
   31 |                                 d[i][j] += d[i-1][j];
      |                                     ^
main.c:31:50: error: subscripted value is neither array nor pointer nor vector
   31 |                                 d[i][j] += d[i-1][j];
      |                                                  ^
Language: C

#include <stdio.h>

#define M_MAX         10000
#define N_MAX         1000
#define r_MAX         1000
#define q_MAX         50
#define DATASET_MAX   10
#define TS_MIN        540
#define TE_MAX        1260
#define USETIME_MAX   TE_MAX-TS_MIN

struct LogInfo{
    int PCNum;
    int LogInTime;
    int LogOutTime;
};

int LogInCnt[M_MAX];
struct LogInfo LogInfoData[M_MAX][r_MAX];
int UsePCTime[DATASET_MAX];

void VarInit( void ){
    int i;
    int j;
    
    for( i=0; i<M_MAX; i++ ){
        LogInCnt[i] = 0;
        for( j=0; j<r_MAX; j++ ){
            LogInfoData[i][j].PCNum = 0;
            LogInfoData[i][j].LogInTime = 0;
            LogInfoData[i][j].LogOutTime = 0;
        }
    }
}


void RecLogInInfo( int t, int n, int m ){
    LogInfoData[m][LogInCnt[m]].PCNum = n;
    LogInfoData[m][LogInCnt[m]].LogInTime = t;
    LogInCnt[m]++;
}

void RecLogOutInfo( int t, int n, int m ){
    int i;
  
    for( i=0; i<LogInCnt[m]; i++ ){
        if( (LogInfoData[m][i].PCNum == n) && (LogInfoData[m][i].LogOutTime == 0)){
            LogInfoData[m][i].LogOutTime = t;
        }
    }
}

int CalcUsePCTime( int ts, int te, int m ){
    int i,j,t1,t2,Time;
    int Work[USETIME_MAX+1];
    Time = 0;
    
    for( i=0; i<USETIME_MAX+1; i++){
        Work[i] = 0;
    }
    
    for( i=; i<LogInCnt[m]; i++ ){
        t1 = LogInfoData[m][i].LogInTime-TS_MIN;
        t2 = LogInfoData[m][i].LogOutTime-TS_MIN;
        for( i=t1; i<=t2; i++){
            Work[i] = 1;
        }
    }
    
    for( i=ts; i<=te; i++){
        if(Work[i-TS_MIN] == 1){
        Time++;
        }
    }
    
    return Time;
}


int main( void ){
    int i,N,M,r,q,t,n,m,s,ts,te;
    int qNum;
    int UseTime;
  
    qNum = 0;
    for( i=0; i<DATASET_MAX; i++ ){
        UsePCTime[i] = 0;
    }
    while( 1 ){
        scanf( " %d %d", &N, &M );
        if( N == 0 ){
            break;
        }
        VarInit();
        scanf( " %d", &r );
        for( i=0; i<r; i++ ){
            scanf( " %d %d %d %d", &t, &n, &m, &s );
            if( s == 1 ){
                RecLogInInfo( t, n, m );
            }else{
                RecLogOutInfo( t, n, m );
            }
        }
        
        scanf( " %d", &q );
        for( i=0; i<q; i++ ){
            scanf( " %d %d %d", &ts, &te, &m );
            UseTime = CalcUsePCTime( ts, te, m );
            printf("%d\n",UseTime);
        }
    }
}




Compiler output:
main.c: In function 'CalcUsePCTime':
main.c:62:12: error: expected expression before ';' token
   62 |     for( i=; i<LogInCnt[m]; i++ ){
      |            ^
Language: C++

4 2
10
775 1 1 1
780 4 2 1
790 2 1 1
800 2 1 0
810 3 1 1
820 1 1 0
825 3 1 0
860 1 1 1
870 4 2 0
880 1 1 0
1
780 870 1
13 15
12
540 12 13 1
600 12 13 0
650 13 15 1
660 12 15 1
665 11 13 1
670 13 15 0
675 11 13 0
680 12 15 0
1000 11 14 1
1060 12 14 1
1060 11 14 0
1080 12 14 0
3
540 700 13
600 1000 15
1000 1200 11
1 1
2
600 1 1 1
700 1 1 0
5
540 600 1
550 650 1
610 620 1
650 750 1
700 800 1
0 0


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

#include <cstdio>
#include <cassert>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <array>

using namespace std;

#define all(c) begin(c), end(c)
#define dump(c) cerr << "> " << #c << " = " << (c) << endl
#define REP(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1001001001;
const double EPS = 1e-10;


template<typename T1,typename T2>
ostream& operator<<(ostream& os, const pair<T1,T2>& p){
  return os << '(' << p.first <<',' << p.second << ')';
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& a){
  os << '[';
  rep(i,a.size()) os << (i ? " " : "") << a[i];
  return os << ']';
}

int cnt[10010], st[10010], acc[10010][1300];

int main() {
  for(int N, M; cin >> N >> M, (N | M) != 0; ) {
    memset(cnt, 0, sizeof(cnt));
    memset(st, 0, sizeof(st));
    memset(acc, 0, sizeof(acc));
    int r; cin >> r;
    rep(i, r) {
      int t, n, m, s; cin >> t >> n >> m >> s;
      if (s) {
        if(cnt[m] == 0) st[m] = t;
        cnt[m]++;
      }
      else {
        cnt[m]--;
        if(cnt[m] == 0) {
          REP(j, st[m], t) acc[m][j] = 1;
        }
      }
    }

    int q; cin >> q;
    rep(i, q) {
      int s, e, m; cin >> s >> e >> m;
      int cnt = 0;
      REP(i, s, e) cnt += acc[m][i];
      cout << cnt << endl;
    }
  }
  
  
  return 0;
}

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

#include <cstdio>
#include <cassert>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <array>
#include <cmemory>

using namespace std;

#define all(c) begin(c), end(c)
#define dump(c) cerr << "> " << #c << " = " << (c) << endl
#define REP(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1001001001;
const double EPS = 1e-10;


template<typename T1,typename T2>
ostream& operator<<(ostream& os, const pair<T1,T2>& p){
  return os << '(' << p.first <<',' << p.second << ')';
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& a){
  os << '[';
  rep(i,a.size()) os << (i ? " " : "") << a[i];
  return os << ']';
}

int cnt[10010], st[10010], acc[10010][1300];

int main() {
  for(int N, M; cin >> N >> M, (N | M) != 0; ) {
    memset(cnt, 0, sizeof(cnt));
    memset(st, 0, sizeof(st));
    memset(acc, 0, sizeof(acc));
    int r; cin >> r;
    rep(i, r) {
      int t, n, m, s; cin >> t >> n >> m >> s;
      if (s) {
        if(cnt[m] == 0) st[m] = t;
        cnt[m]++;
      }
      else {
        cnt[m]--;
        if(cnt[m] == 0) {
          REP(j, st[m], t) acc[m][j] = 1;
        }
      }
    }

    int q; cin >> q;
    rep(i, q) {
      int s, e, m; cin >> s >> e >> m;
      int cnt = 0;
      REP(i, s, e) cnt += acc[m][i];
      cout << cnt << endl;
    }
  }
  
  
  return 0;
}

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

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

int main(){
  int N,M;
  while(cin>>N>>M){
    if(N==0)break;
    int r,q;
    int student[M][721];
    memset(student,0,sizeof(student));  
    cin>>r;
    for(int i=0;i<r;i++){
      int t,n,m,s;
      cin>>t>>n>>m>>s;
      t-=540;m--;
      if(s==1){
	student[m][t]=n;
      }else{
	while(t>0 && student[m][--t]!=n){
	  if(student[m][t]==0) student[m][t]=n;
	}
      }
    }
    cin>>q;
    for(int i=0;i<q;i++){
      int ts,te,m;
      cin>>ts>>te>>m;
      ts-=540;te-=540;m--;
      int ans=0;
      for(int i=ts;i<te;i++){
	if(student[m][i]>0)ans++;
      }
      cout << ans << endl;
    }
  }
  return 0;
}

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

#include<iostream>
#include<vector>
using namespace std;
typedef pair<int, int> P;

const int INF = 1000000;

int main() {
  int N, M;
  while (cin >> N >> M and N) {
    int use = 0, r;
    int start, end;
    vector<P> period;
    REP(i, r) {
      int t, n, m, s;
      cin >> t >> n >> m >> s;

      if (use == 0 and s == 1) start = t;
      if (use == 1 and s == 0) {
        end = t;
        period.push_back(P(start, end));
      }

      if (s == 1) use++;
      else use--;
    }
    
    int q;
    REP(i, q) {
      cin >> start >> end;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'i' was not declared in this scope
   14 |     REP(i, r) {
      |         ^
a.cc:14:5: error: 'REP' was not declared in this scope
   14 |     REP(i, r) {
      |     ^~~
a.cc:31:6: error: expected '}' at end of input
   31 |     }
      |      ^
a.cc:10:31: note: to match this '{'
   10 |   while (cin >> N >> M and N) {
      |                               ^
a.cc:31:6: error: expected '}' at end of input
   31 |     }
      |      ^
a.cc:8:12: note: to match this '{'
    8 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
struct log{
  int t,n,m,s;
  bool operator<(const log&a)const{
    return n==a.n ? (m == a.m? t < a.t : m < a.m) : n<a.n;
  }
};
int main(){
  int nu,me,i,j,k,o,f;
  cin >> nu >> me;
  while(nu!=0||me!=0){
    int r,q;
    cin >> r;
    int t,n,m,s,ts,te;
    vector <log> logs;
    log l;
    for(i=0;i<r;i++){
      cin >> l.t >> l.n >> l.m >> l.s ;
      logs.push_back(l);
    }
    cin >> q;
    sort(logs.begin(),logs.end());
    i=0;

    int a;
    for(a=0;a<q;a++){
      cin >> ts >> te >> m ;
      
      j=0;
      o=0;
      f=0;
      for(i=ts;i<te;i++){
	f=0;
	k=0;
	for(j=0;j<logs.size();j+=2){
	  if(logs[j].m==m&&logs[j].t<=i&&i<logs[j+1].t){
	    f=1;
	  }
	}
	
	o+=f;
      }
      cout << o << endl;
    }
    
    cin >> nu >> me;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   24 |     sort(logs.begin(),logs.end());
      |     ^~~~
      |     short
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;
const int MAX_STUDENT = 10001;
const int MAX_TIME = 1261;
int main(){
  int N,M;
  while(true){
    cin >> N >> M;
    if(!N)break;
    int r;
    cin >> r;
    vector<vector<int>> timeline(MAX_STUDENT,vector<int>(MAX_TIMW,0));
    REP(i,r){
      int t,n,m,s;
      cin >> t >> n >> m >> s;
      if(s==0){
	timeline[m][t] -= 1;
      }else{
	timeline[m][t] += 1;
      }
    }
    REP(i,MAX_STUDENT)
      for(int j = 540;j<MAX_TIME;j++){
      timeline[i][j+1] += timeline[i][j];
    }
    int q;
    cin >> q;

    REP(i,q){
      int ct = 0;
      int t1,t2,m;
      cin >> t1 >> t2 >> m;
      for(int j = t1;j<t2;j++){
	if(timeline[m][j]>0)ct++;
      }
      cout << ct << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:58: error: 'MAX_TIMW' was not declared in this scope; did you mean 'MAX_TIME'?
   22 |     vector<vector<int>> timeline(MAX_STUDENT,vector<int>(MAX_TIMW,0));
      |                                                          ^~~~~~~~
      |                                                          MAX_TIME
Language: C++

#include <bit/stdc++.h> 
#define REP(i,n) for(int i=0; i< (n); ++i)
#define FOR(i,s,n) for(int i=s; i< (n); ++i)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
 
    cout << fixed << setprecision(30);
 
    while (true){
        int N, M; cin >> N >> M;
        if (N == 0) break;
        int r; cin >> r;
 
        vvi students(M, vi(1262, 0));
 
        REP(i, r){
            int t, n, m, s;
            cin >> t >> n >> m >> s; m--;
            if (s == 1){
                students[m][t]++;
            } else {
                students[m][t]--;
            }
        }
 
        REP(i, M) FOR(j, 1, 1262) students[i][j] += students[i][j - 1];
 
        int q; cin >> q;
        REP(i, q){
            int ts, te, m;
            cin >> ts >> te >> m; m--;
            int cnt = 0;
            FOR(j, ts, te) if (students[m][j] >= 1) cnt++;
            cout << cnt << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc:1:10: fatal error: bit/stdc++.h: No such file or directory
    1 | #include <bit/stdc++.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio> 
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rangeRep(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
struct Student {
	int t, n, m, s;
};

constexpr int timeOffset = 540;
//[PC][??????] = ????????????
int dp[1000][1260 - timeOffset] = { 0 };


class Solve {
public:
	Solve() {};
	~Solve() {};

	void solver() {
		std::vector<std::vector<int>> results;
		while (1) {
			int n, m, r, q;
			std::vector<Student> students;
			std::cin >> n >> m;
			if (!n) break;

			memset(dp, 0, sizeof(dp));
			
			results.push_back(std::vector<int>());
			//?????°???????????±
			std::cin >> r;
			Student s;
			rep(i, r) {
				//??????, PC??????, ????????????, isLogin
				std::cin >> s.t >> s.n >> s.m >> s.s;
				//?????°??????
				if (s.s) {
					//?????°??????????§???????????????????
					dp[s.n - 1][s.t - timeOffset] = s.m;
				}//?????°??¢??????
				else {
					//?????°????????¨????????§?????£?????????
					int time = s.t - timeOffset - 1;
					do{
						dp[s.n - 1][time--] = s.m;
					} while (dp[s.n - 1][time] == 0);
				}
			}

			//?????? [ts, te]??????????????????m????????¨??????
			std::cin >> q;
			rep(i, q) {
				int num = 0;
				int ts, te, m;
				std::cin >> ts >> te >> m;
				ts -= timeOffset; te -= timeOffset;
				//???????????????PC??§?????°?????????????????????????????????
				rangeRep(j, ts, te) {
					rep(k, 1000) {
						if (dp[k][j] == m) {
							num++;
							break;
						}
					}
				}
				results.back().push_back(num);
			}
		}

		for (auto& x : results) {
			for (auto& y : x) {
				std::cout << y << std::endl;
			}
		}
	}
private:

};

int main() {
	Solve solve;
	solve.solver();
	return 0;
}

Compiler output:
a.cc: In member function 'void Solve::solver()':
a.cc:43:25: error: 'memset' was not declared in this scope
   43 |                         memset(dp, 0, sizeof(dp));
      |                         ^~~~~~
a.cc:19:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   18 | #include <cstdio>
  +++ |+#include <cstring>
   19 | #define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
Language: C++

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio> 
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rangeRep(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
struct Student {
	int t, n, m, s;
};

constexpr int timeOffset = 540;
//[PC][??????] = ????????????
int dp[1000][1260 - timeOffset] = { 0 };


class Solve {
public:
	Solve() {};
	~Solve() {};

	void solver() {
		std::vector<std::vector<int>> results;
		while (1) {
			int n, m, r, q;
			std::vector<Student> students;
			std::cin >> n >> m;
			if (!n) break;

			std::memset(dp, 0, sizeof(dp));
			
			results.push_back(std::vector<int>());
			//?????°???????????±
			std::cin >> r;
			Student s;
			rep(i, r) {
				//??????, PC??????, ????????????, isLogin
				std::cin >> s.t >> s.n >> s.m >> s.s;
				//?????°??????
				if (s.s) {
					//?????°??????????§???????????????????
					dp[s.n - 1][s.t - timeOffset] = s.m;
				}//?????°??¢??????
				else {
					//?????°????????¨????????§?????£?????????
					int time = s.t - timeOffset - 1;
					do{
						dp[s.n - 1][time--] = s.m;
					} while (dp[s.n - 1][time] == 0);
				}
			}

			//?????? [ts, te]??????????????????m????????¨??????
			std::cin >> q;
			rep(i, q) {
				int num = 0;
				int ts, te, m;
				std::cin >> ts >> te >> m;
				ts -= timeOffset; te -= timeOffset;
				//???????????????PC??§?????°?????????????????????????????????
				rangeRep(j, ts, te) {
					rep(k, 1000) {
						if (dp[k][j] == m) {
							num++;
							break;
						}
					}
				}
				results.back().push_back(num);
			}
		}

		for (auto& x : results) {
			for (auto& y : x) {
				std::cout << y << std::endl;
			}
		}
	}
private:

};

int main() {
	Solve solve;
	solve.solver();
	getchar(); getchar();
	return 0;
}

Compiler output:
a.cc: In member function 'void Solve::solver()':
a.cc:43:30: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
   43 |                         std::memset(dp, 0, sizeof(dp));
      |                              ^~~~~~
      |                              wmemset
Language: C++

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

int s[10000][750];
signed main() {
	int a, b, c; 
	while (cin >> a >> b, a | b) {
		memset(s, 0, sizeof(s));
		cin >> c;
		for (int d = 0; d < c; d++) {
			int e, f, g, h; scanf("%d%d%d%d", &e, &f, &g, &h); g--;
			e -= 540;
			if (h) {
				s[g][e]++;
			}
			else {
				s[g][e]--;
			}
		}
		for (int d = 0; d < b; d++) {
			int k = 0;
			for (int e = 0; e < 750; e++) {
				k += s[d][e];
				s[d][e] = k;
			}
		}
		int d; cin >> d;
		for (int e = 0; e < d; e++) {
			int f, g, h; scanf("%d%d%d", &f, &g, &h); f -= 540; g -= 540; h--;
			int sum = 0;
			for (; f < g; f++) {
				if (s[h][f])sum++;
			}
			cout << sum << endl;
		}
	}
}

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

#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;++i)
using namespace std;
int main(){
int u,r,q,a,b,c;
while(cin>>r,r){cin>>r>>r;
vector<int>t(r),m(r),s(r);
r(i,r)cin>>t[i]>>m[i]>>m[i]>>s[i];cin>>q;
r(i,q){cin>>a>>b>>c;
int an=0,cn=0,p=a;
r(i,t.size()){u=min(t[i],b);
if(cnt)an+=max(u-p,0);
if(m[i]==c){if(s[i])cn++;else cn--;}
p=max(p,u);}
cout<<an<<endl;}}}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:4: error: 'cnt' was not declared in this scope; did you mean 'cn'?
   12 | if(cnt)an+=max(u-p,0);
      |    ^~~
      |    cn
Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int N,M;
    while(cin>>N>>M, N+M){
        int r; cin>>r;
        vector<vector<pii>>v(M+1,vector<pii>());
        vvi pclog(N+1,vi(M+1,0));
        rep(i,r){
            int t,n,m,s; cin>>t>>n>>m>>s;
            if(s){
                pclog[n][m]=t;
            }else{
                v[m].push_back(pii(pclog[n][m],t));
                pclog[n][m]=0;
            }
        }
        int q; cin>>q;
        rep(j,q){
            int ts,te,m; cin>>ts>>te>>m;
            ll ans=0;
            pii gotiusa;
            int imos[100000]={0};
            memset(imos, 0,sizeof(imos));
            rep(hoge,v[m].size()){
                imos[v[m][hoge].first]++;
                imos[v[m][hoge].second]--;
            }
            for(int i=0; i<10000;i++)
                if(i)imos[i]+=imos[i-1];
            for(int i=ts; i<te;i++)
                if(imos[i]>0)ans++;
            cout<<ans<<endl;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:13: error: 'memset' was not declared in this scope
   65 |             memset(imos, 0,sizeof(imos));
      |             ^~~~~~
a.cc:23:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   22 | #include <stack>
  +++ |+#include <cstring>
   23 | #define vi vector<int>
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265


void f(int n,int m){
  int v[1300][1100]={};
  bool e[1300]={};
  int r;
  cin>>r;
  rep(i,r){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    e[c]=true;
    if(d==1){
      v[c][a]++;
    }
    if(d==0){
      v[c][a]--;
    }
  }

  rep(i,1300){
    if(!c[i]) continue;
    FOR(j,540,1100){
      v[i][j]+=v[i][j-1];
    }
    FOR(j,540,1100){
      v[i][j]=(v[i][j]>0);
    }
    FOR(j,540,1100){
      v[i][j]+=v[i][j-1];
    }
  }


  int q;
  cin>>q;
  rep(i,q){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<v[c][b-1]-v[c][a-1]<<endl;
  }

}


int main(){
  while(1){
    int n,m;
    cin>>n>>m;
    if(n==0) break;
    f(n,m);
  }

  return 0;
}


Compiler output:
a.cc: In function 'void f(int, int)':
a.cc:37:9: error: 'c' was not declared in this scope
   37 |     if(!c[i]) continue;
      |         ^
Language: C++

l = (1260-540+1)
while True:
	N,M = map(int,input().split(" "))
	if N == 0 and M == 0:
		break
	T = [[0]*l for _ in range(M)]
	r = int(input())
	for i in range(r):
		t,n,m,s = map(int,input().split(" "))
		if s == 1:
			T[m-1][t-540] += 1
		else:
			T[m-1][t-540] -= 1

	q = int(input())
	for i in range(q):
		t1,t2,m = map(int,input().split(" "))
		T_range = []
		flg = True if T[m-1][0] >= 1 else False
		lb = 0
		for j in range(l-1):
			T[m-1][j+1] += T[m-1][j]
			if flg and T[m-1][j+1] == 0:
				T_range.append((lb+ 540,j+1+540))
				flg = False
			elif (not flg) and T[m-1][j+1] >= 1:
				flg = True
				lb = (j+1)
		if flg:
			T_range.append((lb+540,l+540))
		ans = 0
		for a,b in T_range:
			if not (b < t1 or t2 < a):
				ans += (min(t2,b) - max(t1,a))

		print(ans)



Compiler output:
a.cc:1:1: error: 'l' does not name a type
    1 | l = (1260-540+1)
      | ^
Language: C++

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

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

int N, M, r, q;
int used[10000][740];

void solve() {
  memset(used, -1, sizeof used);
  vector<Time> tl[M];
  cin>>r;

  rep(i,r) {
    int t, n, m, s;
    cin>>t>>n>>m>>s; t -= 540; m--;
    if (s == 1) {
      used[m][t] = n;
    } else {
      rep(j,740) {
        if (used[m][j] == n) {
          REP(k,j,t)
            if (used[m][k] == -1) used[m][k] = 0;
          used[m][j] = 0;
        }
      }
    }
  }
  
  cin>>q;
  rep(i,q) {
    int ts, te, m, res = 0;
    cin>>ts>>te>>m; ts -= 540; te -= 540; m--;
    REP(i,ts,te) if (used[m][i] == 0)
      res++;
    cout<<res<<endl;
  }
}

int main (int argc, char const* argv[]) {
  while (cin>>N>>M, N||M) {
    solve();
  }
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:14:10: error: 'Time' was not declared in this scope; did you mean 'time'?
   14 |   vector<Time> tl[M];
      |          ^~~~
      |          time
a.cc:14:14: error: template argument 1 is invalid
   14 |   vector<Time> tl[M];
      |              ^
a.cc:14:14: error: template argument 2 is invalid
Language: C++

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int N,M,r,q;
typedef struct{
	int t,n,m,s;
} LOG;

bool time_table[10000+1][1260 - 540 + 1];

void solve()
{
	memset(time_table,0,sizeof(time_table));

	cin>>r;
	vector<LOG> logs(r);
	for(int i = 0;i < r; i++){
		cin >> logs[i].t >> logs[i].n >> logs[i].m >> logs[i].s;
	}

	int count[10001]={0},t[10001] = {0};
	for(int j = 0; j < r; j++){
		int m = logs[j].m;
		if(count[m] == 1 && logs[j].s == 0)
			for(int k = t[m]; k < logs[j].t - 540; k++)
				time_table[m][k] = true;

		if(count[m] == 0 && logs[j].s == 1)
			t[m] = logs[j].t - 540;
		count[m] += (logs[j].s == 1) ? 1 : -1; //ツカツウツδ督トツづーツ堕敖個クツつウツつケツづゥ
	}

	cin >> q;
	for(int i = 0;i < q; i++){
		int ts,te,m;
		cin >> ts >> te >> m;
		int ans = 0;
		for(int i = ts - 540; i < te - 540; i++){
			ans += time_table[m][i];
		}
		cout << ans << endl;
	}


}

int main()
{
	while(cin >>N >>M,(N||M)){
		solve();
	}
	return 0;
}

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

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <stdlib.h>

using namespace std;

int N,M,r,q;
typedef struct{
	int t,n,m,s;
} LOG;

bool time_table[10000+1][1260 - 540 + 1];

void solve()
{
	memset(time_table,0,sizeof(time_table));

	cin>>r;
	vector<LOG> logs(r);
	for(int i = 0;i < r; i++){
		cin >> logs[i].t >> logs[i].n >> logs[i].m >> logs[i].s;
	}

	int count[10001]={0},t[10001] = {0};
	for(int j = 0; j < r; j++){
		int m = logs[j].m;
		if(count[m] == 1 && logs[j].s == 0)
			for(int k = t[m]; k < logs[j].t - 540; k++)
				time_table[m][k] = true;

		if(count[m] == 0 && logs[j].s == 1)
			t[m] = logs[j].t - 540;
		count[m] += (logs[j].s == 1) ? 1 : -1; //ツカツウツδ督トツづーツ堕敖個クツつウツつケツづゥ
	}

	cin >> q;
	for(int i = 0;i < q; i++){
		int ts,te,m;
		cin >> ts >> te >> m;
		int ans = 0;
		for(int i = ts - 540; i < te - 540; i++){
			ans += time_table[m][i];
		}
		cout << ans << endl;
	}


}

int main()
{
	while(cin >>N >>M,(N||M)){
		solve();
	}
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:19:9: error: 'memset' was not declared in this scope
   19 |         memset(time_table,0,sizeof(time_table));
      |         ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <stdlib.h>
  +++ |+#include <cstring>
    7 |
Language: C++

#include <iostream>
#include <stdio.h>
#include <ctype.h>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;


int main (){
  
  int pc,stu;
  
  while(1){

    cin >>pc>>stu;
    if (pc==0&&stu==0)break;
    
    int i,j,k,srec,sque,t,n,m,s,ts,te,sum;
    int record[pc][721]={};

    //record入力
    cin >>srec;
    for(i=0;i<srec;i++){
      cin >>t>>n>>m>>s;
      
      if (s==1){
	//ログイン
	for(j=t;j<721;j++){
	  record[n][j] = m;
	}
      }else{
	//ログアウト
	for(j=t+1;j<721;j++){
	  record[n][j] = 0;
	}
      }
    }
    
    //記録チェック
    sum = 0;
    cin >> sque;
    for(i=0;i<sque;i++){
      cin >> ts >>te >>m;
      for(j=ts;j<te+1;j++){
	for(k=0;k<pc;k++){
	  if (record[k][j]==m){
	    sum += 1;
	    break;
	  }
	}
      }
    }
    
    cout << sum <<endl;
    
  return 0;
}

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

#include <iostream>

using namespace std;
#define max 1260-540

bool time[10000][max+1];

int main(void){
	int N,M,r,q;
	while(cin >> N  >> M, N|M){
		for(int i=0;i<M;i++)
			for(int j=0;j<=max;j++)
				time[i][j]=false;

		cin >> r;
		int start[1001];
		for(int i=0;i<r;i++){
			int t,n,m,s;
			cin >> t >> n >> m >> s;
			if(s)
				start[n]=t-520;
			else{
				for(int k=start[n];k<t-520;k++)
					time[m][k]=true;
			}
		}
		cin >> q;
		for(int i=0;i<q;i++){
			int ts,te,m;
			cin >> ts >> te >> m;
			int num=0;
			for(int i=ts-520;i<te-520;i++){
				if(time[m][i])
					num++;
			}
			cout << num << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc:6:23: error: 'bool time [10000][721]' redeclared as different kind of entity
    6 | bool time[10000][max+1];
      |                       ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:13:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   13 |                                 time[i][j]=false;
      |                                       ^
a.cc:13:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   13 |                                 time[i][j]=false;
      |                                          ^
a.cc:13:43: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)j)))'
   13 |                                 time[i][j]=false;
      |                                 ~~~~~~~~~~^~~~~~
a.cc:24:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |                                         time[m][k]=true;
      |                                               ^
a.cc:24:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |                                         time[m][k]=true;
      |                                                  ^
a.cc:24:51: error: assignment of read-only location '*(time + (((sizetype)m) + ((sizetype)k)))'
   24 |                                         time[m][k]=true;
      |                                         ~~~~~~~~~~^~~~~
a.cc:33:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |                                 if(time[m][i])
      |                                          ^
a.cc:33:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   33 |                                 if(time[m][i])
      |                                             ^
Language: C++


#include<iostream>
using namespace std;

int main()
{
loop:
  int min = 1 << 30, max = 0, sum = 0, n;
  cin >> n;
  if(!s)
    return 0;
  for(int i = 0; i < n; i++)
  {
    int tmp;
    cin >> tmp;
    max = max < tmp ? tmp : max;
    min = min > tmp ? tmp : min;
    sum += tmp;
  }
  cout << (sum - max - min) / (n - 2) << endl;
  goto loop;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: 's' was not declared in this scope
   10 |   if(!s)
      |       ^
Language: C++

// 2007B.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <algorithm>
#define R 1001
using namespace std;

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

		//rの入力
		int r, t[R], n[R], m[R], s[R], q, ts, te, qm;
		fill(t, t + R, 0);
		fill(n, n + R, 0);
		fill(m, m + R, 0);
		fill(s, s + R, 0);

		cin >> r;
		for (int i = 0; i < r; i++){
			cin >> t[i] >> n[i] >> m[i] >> s[i];
		}
		cin >> q;

		//qの入力と計算
		for (int c = 0; c < q; c++){
			cin >> ts >> te >> qm;

			//記録
			int tm[1300];
			int pc[1300];
			fill(tm, tm + 1300, 0);
			fill(pc, pc + 1300, 0);
			for (int i = 0; i < r; i++){
				if (m[i] == qm){
					if (s[i] == 1){
						pc[n[i]] = t[i];
					}
					if (s[i] == 0){
						for (int j = pc[n[i]]; j < t[i]; j++){
							tm[j] = 1;
						}
					}
				}
			}

			//カウント
			//bool login = false;
			int counter = 0;
			//int temp;
			for (int i = ts; i < te; i++){
				counter += tm[i];
				
				/*
				if (tm[i] == 1 && login == false){
					temp = i;
					login = true;
				} 
				if (tm[i] == 0 && login == true){
					counter += i - 1 - temp;
					login = false;
				}
				*/
			//	cout << "i:" << i << " tm[i]:" << tm[i] << " login:" << login << " temp:" << temp << endl;
			}
			/*
			if (login == true){
				counter += te - temp;
			}
			*/
			cout << counter << endl;
		}
	}
	return 0;
}

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

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	Scanner sc = new Scanner(System.in);

	int INF = 1 << 28;
	double EPS = 1e-9;

	int n, w, h;
	int[] ps,ss;
	
	void run() {
		for(;;){
			n=sc.nextInt();
			w=sc.nextInt();
			h=sc.nextInt();
			if((n|w|h)==0){
				break;
			}
			ps=new int[n];
			ss=new int[n];
			for(int i=0;i<n;i++){
				ps[i]=sc.nextInt()-1;
				ss[i]=sc.nextInt();
			}
			solve();
		}
	}

	void solve() {
		LinkedList<R> list=new LinkedList<R>();
		list.add(new R(0,0,w,h));
		for(int i=0;i<n;i++){
if(list.get(ps[i])==null){
for(;;);
}
			R r=list.remove(ps[i]);
			debug(i,r.x,r.y,r.w,r.h);
			int s=ss[i]%(r.w*r.h);
			int x=r.x,y=r.y;
			for(int k=0;k<s;k++){
				if(y==r.y&&x<r.x+r.w){
					x++;
				}else if(x==r.x+r.w&&y<r.y+r.h){
					y++;
				}else if(y==r.y+r.h&&x>r.x){
					x--;
				}else if(x==r.x&&y>r.y){
					y--;
				}else{
for(;;);
					debug("Error!");
				}
				// debug(x,y);
			}
			debug(x,y);
			R r1=null,r2=null;
			if(x==r.x||x==r.x+w){
				r1=new R(r.x,r.y,r.w,y-r.y);
				r2=new R(r.x,r.y+r1.h,r.w,r.h-r1.h);
			}else{
				r1=new R(r.x,r.y,x-r.x,r.h);
				r2=new R(r.x+r1.w,r.y,r.w-r1.w,r.h);
			}
			debug("r1",r1.x,r1.y,r1.w,r1.h);
			debug("r2",r2.x,r2.y,r2.w,r2.h);
			if(r1.w*r1.h<r2.w*r2.h){
				list.add(r1);
				list.add(r2);
			}else{
				list.add(r2);
				list.add(r1);
			}
		}
	}
	
	class R implements Comparable<R>{
		int x,y,w,h;
		R(int x,int y,int w,int h){
			this.x=x;
			this.y=y;
			this.w=w;
			this.h=h;
		}
		@Override
		public int compareTo(R r) {
			return w*h-r.w*r.h;
		}
	}

	void debug(Object... os) {
		// System.err.println(Arrays.deepToString(os));
	}

	void print(String s) {
		System.out.print(s);
	}

	void println(String s) {
		System.out.println(s);
	}

	public static void main(String[] args) {
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Compiler output:
Main.java:59: error: unreachable statement
					debug("Error!");
					^
1 error
Language: C++

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

using namespace std;

int main()
{
    struct square{
        int w, h;
    };
    int n, w, d, p, s;
    while (true) {
        cin >> n >> w >> d;
        if (n == 0 && w == 0 && d == 0) {
            break;
        }
        square data[1000];
        data[1].w = w; data[1].h = d;
        for (int i = 1; i <= n; i++) {
            cin >> p >> s;

            s %= (data[p].w + data[p].h) * 2;
            square a, b;
            if (0 < s && s < data[p].w){
                a.w = s; a.h = data[p].h;
                b.w = data[p].w - s; b.h = data[p].h;
            }
            else if (data[p].w < s && s< data[p].w + data[p].h){
                a.w = data[p].w; a.h = data[p].w + data[p].h - s;
                b.w = data[p].w; b.h = s - data[p].w;
            }
            else if (data[p].w + data[p].h < s && s< data[p].w * 2 + data[p].h){
                a.w = data[p].w * 2 + data[p].h - s; a.h =data[p].h;
                b.w = s - data[p].w - data[p].h; b.h = data[p].h;
            }
            else{
                a.w = data[p].w; a.h = (data[p].w + data[p].h) * 2 - s;
                b.w = data[p].w; b.h = data[p].h - ((data[p].w + data[p].h) * 2 - s);
            }
            if (a.w * a.h > b.w * b.h) {
                swap(a.w, b.w);
                swap(a.h, b.h);
            }
            data[p] = a;
            data[i+1] = b;
        }

    
    return 0;
}

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

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

class piece{
public:
  int w, h, s;
  piece(int w_,int h_){
    w = w_;h = h_;s = w * h;
  }

  void init(int w_, int h_){
    w = w_;h = h_;s = w * h;
  }

  piece(){}
  bool operator<(const piece &a)const{
    return s < a.s;
  }
};

vector<piece> p;

void cutCake(int num, int cut, piece P){
  int w, h;
  w = P.w;
  h = P.h;
  piece np;
  while(cut > w + h)cut -= w + h;
  if(cut < w){
    np.init(cut, h);
    P.init(w - cut, h);
  }else{
    np.init(w, cut - w);
    P.init(w, h - (cut - w));
  }
  // cout << w << " " << h << endl;
  // cout << "np.w:" << np.w << " ";
  // cout << "np.h:" << np.h << " ";
  // cout << "np.s:" << np.s << endl;
  // cout << "p.w:" << P.w << " ";
  // cout << "p.h:" << P.h << " ";
  // cout << "p.s:" << P.s << endl;
  // cout << endl;
  if(np.s > P.s){
  p.push_back(P);
  p.push_back(np);
  }else{
  p.push_back(np);
  p.push_back(P);
  }
}

int main(){
  int n, w, h;
  while(cin >> n >> w >> h,w){
    p.clear();
    piece tmp(w, h);
    p.push_back(tmp);
    for (int i = 0; i < n; i++){
      int num,cut;
      cin >> num >> cut;
      cutCake(--num, cut, p[num]);
      p.erase(p.begin() + num);
    }
    sort(p.begin(), p.end());
    for(piece ite:p){
      cout << ite.s << " ";
    }
    cout << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   66 |     sort(p.begin(), p.end());
      |     ^~~~
      |     short
Language: C++

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

typedef struct{
  int width;
  int height;
}CAKE;

bool operator<( const CAKE& left, const CAKE& right ) {
  return left.width * left.height< right.width * right.height;
}

int main() {
  int n,w,d;

  while( cin >> n >> w >> d, n || w || d ) {

    vector< CAKE > cake;
    CAKE tmp = {w,d};
    cake.push_back(tmp);
    int p,s;
    while( n-- ){
      cin >> p >> s;
      p--;

      int cnt = 0;
      while( true ){
	asssert( s!=cake[p].width);
        if ( s-cake[p].width <= 0) break;
        s -= cake[p].width;
        cnt++;

	asssert( s!=cake[p].height);
        if ( s-cake[p].height <= 0) break;
        s -= cake[p].height;
        cnt++;
      }


      cnt %= 4;
      pair < CAKE,CAKE > P;
      if ( cnt % 2 == 0 ) {

        CAKE tmp = {s,cake[p].height};
        P.first = tmp;
        tmp.width = cake[p].width - s;
        P.second = tmp;

      } else {
        CAKE tmp = {cake[p].width,s};
        P.first = tmp;
        tmp.height = cake[p].height - s;
        P.second = tmp;
      }

      if (  P.first.width * P.first.height < P.second.width * P.second.height ) {
        cake.push_back(P.second);
        cake[p] = P.first;
      }else{
        cake.push_back(P.first);
        cake[p] = P.second;
      }

    }

    sort( cake.begin(),cake.end() );

    for ( int i = 0; i < cake.size()-1; i++ ) {
      cout << cake[i].width * cake[i].height << " ";
    }
    cout << cake[cake.size()-1].width * cake[cake.size()-1].height << endl;


  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'asssert' was not declared in this scope; did you mean 'assert'?
   29 |         asssert( s!=cake[p].width);
      |         ^~~~~~~
      |         assert