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

#include <stdio.h>
#include <queue>

using namespace std;

int main(void){
	int black[50][50], white[50][50], h, w, i, j, k, x, y, bc, wc;
	char field[50][51];
	const int dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};
	queue<int> qx,qy;
	scanf("%d%d%*c",&w,&h);
	while(w != 0 || h != 0){
		memset(black,0,sizeof(black));
		memset(white,0,sizeof(white));
		for(i = 0;i < h;i++){
			for(j = 0;j < w;j++)
				field[i][j] = getchar();
			getchar();
		}
		for(i = 0;i < h;i++){
			for(j = 0;j < w;j++){
				if(field[i][j] == 'B'){
					qx.push(j);
					qy.push(i);
					while(qx.size()){
						x = qx.front();
						y = qy.front();
						qx.pop();
						qy.pop();
						if(field[y][x] == '.')
							black[y][x] = 1;
						for(k = 0;k < 4;k++){
							if(x + dx[k] >= 0 && x + dx[k] < w && y + dy[k] >= 0 && y + dy[k] < h && field[y + dy[k]][x + dx[k]] == '.' && !black[y + dy[k]][x + dx[k]]){
								qx.push(x + dx[k]);
								qy.push(y + dy[k]);
							}
						}
					}
				}
				else if(field[i][j] == 'W'){
					qx.push(j);
					qy.push(i);
					while(qx.size()){
						x = qx.front();
						y = qy.front();
						qx.pop();
						qy.pop();
						if(field[y][x] == '.')
							white[y][x] = 1;
						for(k = 0;k < 4;k++){
							if(x + dx[k] >= 0 && x + dx[k] < w && y + dy[k] >= 0 && y + dy[k] < h && field[y + dy[k]][x + dx[k]] == '.' && !white[y + dy[k]][x + dx[k]]){
								qx.push(x + dx[k]);
								qy.push(y + dy[k]);
							}
						}
					}
				}
			}
		}
		bc = wc = 0;
		for(i = 0;i < h;i++)
			for(j = 0;j < w;j++) if(white[i][j] && !black[i][j]) wc++;
		for(i = 0;i < h;i++)
			for(j = 0;j < w;j++) if(black[i][j] && !white[i][j]) bc++;
		printf("%d %d\n",wc,bc);
		scanf("%d%d",&w,&h);
	}
	return 0;
}

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

#include "iostream"
#include "vector"
#include "string"
#include "queue"
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool black[50][50],white[50][50];
int main(void)
{
	int w,h;
	while (cin>>w>>h,w) {
		memset(black,0,sizeof(black));
		memset(white,0,sizeof(white));
		vector<string> in;
		for (int i = 0; i < h; i++) {
			string t; cin>>t;
			in.push_back(t);
		}

		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				int f=0;
				if(in[i][j]=='W') f=1;
				else if(in[i][j]=='B') f=2;

				if(in[i][j]!='.')
				{
					bool used[50][50];
					memset(used,0,sizeof(used));
					queue<int> xs,ys;
					xs.push(j); ys.push(i);
					while (!xs.empty()) {
						int x=xs.front(),y=ys.front();
						xs.pop(); ys.pop();
						used[y][x]=true;
						if(f==1) white[y][x]=true;
						else black[y][x]=true;
						for (int k = 0; k < 4; k++) {
							int nx=x+dx[k],ny=y+dy[k];
							if(0<=nx&&nx<w&&0<=ny&&ny<h&&!used[ny][nx]&&in[ny][nx]=='.')
							{
								xs.push(nx); ys.push(ny);
							}
						}
					}
				}
			}
		}

		int Black=0,White=0;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if(in[i][j]!='B'&&black[i][j]&&!white[i][j]) Black++;
				else if(in[i][j]!='W'&&!black[i][j]&&white[i][j]) White++;
			}
		}
		cout<<Black<<" "<<White<<endl;
	}
	return 0;
}

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

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

int w,h;
string grid[55],col[55];
bool vis[55][55];
int dy[] = {-1,0,1,0}, dx[] = {0,1,0,-1};

int count(char color){
  int res = 0;
  rep(i,h)rep(j,w)if(col[i][j]==color)res++;
  return res;
}

void rec(int y,int x,int color){
  if(vis[y][x])return;
  vis[y][x] = true;

  if(grid[y][x]=='.'){
    if(col[y][x] == '.' || col[y][x] == color)col[y][x] = color;
    else col[y][x] = 'G';
  }
    
  rep(d,4){
    int ny = y+dy[d], nx = x+dx[d];
    if(ny<0 || nx<0 || ny>=h || nx>=w)continue;
    if(grid[ny][nx]!='.')continue;
    rec(ny,nx,color);
  }
}

int main(){
  while(cin >> w >> h, w){
    rep(i,h){
      cin >> grid[i];
      col[i] = "";
      rep(j,w)col[i] += '.';
    }
    
    rep(i,h){
      rep(j,w){
	if(grid[i][j]!='.'){
	  memset(vis,0,sizeof(vis));
	  rec(i,j,grid[i][j]);
	}
      }
    }
   
    cout << count('B') << " " << count('W') << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:11: error: 'memset' was not declared in this scope
   44 |           memset(vis,0,sizeof(vis));
      |           ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #define rep(i,n) for(int i=0;i<n;i++)
Language: C++

#include<cstdio>
#include<iostream>

#define W_MAX 50
#define H_MAX 50


using namespace std;

int map[H_MAX][W_MAX];
int zyo[H_MAX][W_MAX];
int w,h;
int flag;

void solve(int H,int W){
	int dx[4]={-1,1,0, 0};
	int dy[4]={ 0,0,1,-1};
	/*cout<<H<<","<<W<<","<<map[H][W]<<","<<zyo[H][W]<<","<<flag<<endl;*/
	for(int a=0;a<4;a++){
			if(H+dx[a]<0||H+dx[a]>=h) continue;
			if(W+dy[a]<0||W+dy[a]>=w) continue;
			if(zyo[H+dx[a]][W+dy[a]]==-1&&map[H+dx[a]][W+dy[a]]==0){
				zyo[H+dx[a]][W+dy[a]]=3;
				solve(H+dx[a],W+dy[a]);
			}
			else if(map[H+dx[a]][W+dy[a]]==1){
				if(flag==-1) flag=1;
				if(flag==2) flag=0;
			}
			else if(map[H+dx[a]][W+dy[a]]==2){
				if(flag==-1) flag=2;
				if(flag==1) flag=0;
		}
	}
	return;
}

int main(void){

	char tmp;
	int bc,wc;

	while(1){
			memset(map,-1,sizeof(map));
			memset(zyo,-1,sizeof(zyo));
			bc=0,wc=0;

			cin>>w>>h;
			if(w==0&&h==0) break;
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){
					cin>>tmp;
					switch(tmp){
					case '.':
						map[i][j]=0;
						zyo[i][j]=-1;
						break;
					case 'B':
						map[i][j]=1;
						zyo[i][j]=0;
						break;
					case 'W':
						map[i][j]=2;
						zyo[i][j]=0;
						break;
					}
				}
			}

		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(zyo[i][j]==-1){
					zyo[i][j]=3;
					flag=-1;
					solve(i,j);
					for(int k=0;k<h;k++){
						for(int l=0;l<w;l++){
							if(zyo[k][l]==3) zyo[k][l]=flag;
						}
					}
				}
			}
		}

		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				//cout<<zyo[i][j];
				if(zyo[i][j]==1) bc++;
				else if(zyo[i][j]==2) wc++;
			}
			//cout<<endl;
		}
		cout<<bc<<" "<<wc<<endl;
	}
	return 0;
}

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

import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class AOJ2015 {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static int[] cnth = new int[1500001];
	static int[] cntw = new int[1500001];

	static boolean solve() {
		int n = in.nextInt();
		int m = in.nextInt();
		if (n + m == 0) return false;

		int[] h = new int[n+1];
		for (int i=1; i<=n; i++) {
			h[i] = in.nextInt();
			h[i] += h[i-1];
		}

		int[] w = new int[m+1];
		for (int i=1; i<=m; i++) {
			w[i] = in.nextInt();
			w[i] += w[i-1];
		}

		Arrays.fill(cnth,0);

		for (int i=1; i<=n; i++) {
			for (int j=1; j<=n; j++) {
				if (i-j < 0) continue;
				cnth[h[i] - h[i-j]]++;
			}
		}

		Arrays.fill(cntw,0);

		for (int i=1; i<=m; i++) {
			for (int j=1; j<=m; j++) {
				if (i-j < 0) continue;
				cntw[w[i] - w[i-j]]++;
			}
		}

		int ans = 0;
		for (int i=0; i<1500001; i++) {
			ans += cnth[i] * cntw[i];
		}

		out.println(ans);

		return true;
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		while(solve());
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

Compiler output:
Main.java:6: error: class AOJ2015 is public, should be declared in a file named AOJ2015.java
public class AOJ2015 {
       ^
1 error
Language: Java

import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n, m;
		while ((n = in.nextInt()) != 0 & (m = in.nextInt()) != 0) {
			HashMap<Integer, Integer> hmap = new HashMap<Integer, Integer>();
			a(in, n, hmap);
			HashMap<Integer, Integer> wmap = new HashMap<Integer, Integer>();
			a(in, m, wmap);
			int counter = 0;
			Set<Integer> sqws = new HashSet<Integer>();
			sqws.addAll(hmap.keySet());
			sqws.retainAll(wmap.keySet());
			for (Integer size : sqws) {
				counter += hmap.get(size) * wmap.get(size);
			}
			System.out.println(counter);
		}

	}

	private static void a(Scanner in, int n, HashMap<Integer, Integer> map) {
		int size = 0;
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			int val = in.nextInt();
			size += i + 1;
			int j = 0;
			int v = val;
			do {
				final int value = (map.containsKey(v)) ? map.get(v) : 0;
				map.put(v, value + 1);
				v = val + array[j];
				array[j] = v;
			} while (j++ < i);
		}
	}

Compiler output:
Main.java:42: error: reached end of file while parsing
	}
	 ^
1 error
Language: Java

import java.util.*;

public class Square_Route {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if (n == 0 && m == 0)
				break;
			int[] h = new int[n];
			int[] w = new int[m];
//			int[] y = new int[1500001];
			List<Integer> x = new ArrayList<Integer>();
			for (int i = 0; i < n; i++) {
				h[i] = sc.nextInt();
				int nh = 0;
				for (int j = i; j >= 0; j--) {
					nh += h[j];
//					y[nh]++;
					x.add(nh);
				}
			}
			int result = 0;
			Collections.sort(x);
			for (int i = 0; i < m; i++) {
				w[i] = sc.nextInt();
				int nw = 0;
				for (int j = i; j >= 0; j--) {
					nw += w[j];
//					result += y[nw];
					for(int k=0;k<x.size();k++){
						if(nw==x.get(k))
							result++;
						else if(nw < x.get(k))
							break;
					}
				}
			}
			System.out.println(result);
		}
		sc.close();
	}
}

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

#include <stdio.h>

int main(){
    int N,M,i,j,k,l,a,h[i],w[i],s,t,x;
    x=0;
    scanf("%d %d",&N,&M);
    while (N!==0 && M!==0) {
    for (i=0;i<N;i++) {
        scanf("%d",&h[i]);
    }
    for (i=0;i<M;i++){
        scanf("%d",&w[i]);
    }
    for (i=0;i<N;i++) {
        for (j=i;j<N;j++) {
            for(k=0;k<M;k++) {
                for (l=k;l<M;l++) {
                    s=0; t=0;
                    for (a=i;a<=j;a++) {s=s+h[a];}
                    for (a=k;a<=l;a++) {t=t+w[a];}
                    if (s==t) {x++;}
                }
            }
        }
    }
    printf("%d\n",x);
    scanf("%d %d",&N,&M);}
    return 0;
    
}

Compiler output:
main.c: In function 'main':
main.c:7:15: error: expected expression before '=' token
    7 |     while (N!==0 && M!==0) {
      |               ^
Language: C

#import<cstdio>
#import<map>
#define I(M,A)for(i=1;i<=M;i++)scanf("%d",A+i),A[i]+=A[i-1];
main(){for(int n[1501],m[1501],o,a,b,i,j;scanf("%d%d",&a,&b),a;printf("%d\n",o)){std::map<int,int>z;*n=*m=o=0;I(a,n)I(b,m)for(i=0;i<=a;i++)for(j=0;j<=b;)z[n[i]+m[j++]]++;for(typeof(z.begin())p=z.begin();p!=z.end();)o+=p->second*(p++->second-1)/2;}}

Compiler output:
main.c:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | #import<cstdio>
      |  ^~~~~~
main.c:1:8: fatal error: cstdio: No such file or directory
    1 | #import<cstdio>
      |        ^~~~~~~~
compilation terminated.
Language: C

#include <cstdio>
#include <algorithm>

#define N 1500

static
int my[ N + 1 ][ N + 1 ];

using namespace std;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int i;

  for ( ; ; )
  {
    int px[ N + 1 ], py[ N + 1 ];
    /** Allocated in Heap Memory Area:
     * int my[ N + 1 ][ N + 1 ]; */
    int x1, x2, y1, y2;
    int res = 0;
    int n, m;

    scanf ( "%d%d", &n, &m );
    if ( !( n | m ) ) break ;

    px[ 0 ] = 0; py[ 0 ] = 0;
    for ( i = 1; i <= n; ++i )
    {
      scanf ( "%d", px + i );
      px[ i ] += px[ i - 1 ];
    }
    for ( i = 1; i <= m; ++i )
    {
      scanf ( "%d", py + i );
      py[ i ] += py[ i - 1 ];
    }

    for ( y1 = 0;       y1 <= m; ++y1 )
    for ( y2 = y1 + 1;  y2 <= m; ++y2 )
    {
      my[ y1 ][ y2 ] = py[ y2 ] - py[ y1 ];
    }
    for ( x1 = 0;       x1 <= n; ++x1 )
    for ( x2 = x1 + 1;  x2 <= n; ++x2 )
    {
      const int dx = px[ x2 ] - px[ x1 ];

      for ( y1 = 0; y1 <= m; ++y1 )
      {
        res += !!( binary_search ( &my[ y1 ][ y1 + 1 ],
                                   &my[ y1 ][ m + 1 ], dx ) );
      }
    }

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

  return ( 0 );
}

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

#include <iostream>
#include <vector>
#include <map>

using namespace std;

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

        vector<int> h,w;
        map<int,int> mh, mw;
        int sum=0,tmp;
        h.push_back(0);
        for(int i=0;i<n;i++){
            cin >> tmp;
            sum += tmp;
            h.push_back(sum);
        }
        sum = 0;
        w.push_back(0);
        for(int i=0;i<m;i++){
            cin >> tmp;
            sum += tmp;
            w.push_back(sum);
        }

        for(int i=0;i<h.size();i++){
            for(int j=i+1;j<h.size();j++){
                mh[h[j] - h[i]]++;
            }
        }

        for(int i=0;i<w.size();i++){
            for(int j=i+1;j<w.size();j++){
                mw[w[j] - w[i]]++;
            }
        }
        
        map<int,int>::iterator hit = mh.begin(), wit = mw.begin();
        
        int ret = 0;
        while(hit != mh.end() && wit != mw.end()){
            if((*hit).first == (*wit).first){
                ret += (*hit).second * (*wit).second;
                ++hit;
                ++wit;
            }else if((*hit).first < (*wit).first){
                ++hit;
            }else{
                ++wit;
            }
        }
        cout << ret << endl;
    }
}

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

include<stdio.h>
 
int main(){
    int N,M,h[2000],w[2000],i,j,k,l,th=0,tw=0,cnt;
    while(1){
        scanf("%d %d",&N,&M);
        if(M==0&&N==0) break;
        for(i=0;i<N;i++) scanf("%d",&h[i]);
        for(i=0;i<M;i++) scanf("%d",&w[i]);
        for(cnt=0,k=0;k<N;k++){
            for(l=0;l<M;l++){
                for(th=0,tw=0,i=k;i<N;i++){
                    th+=h[i];
                    for(j=l,tw=0;j<M;j++){
                        tw+=w[j];
                        if(th<tw) break;
                        if(th==tw){
                            cnt++;
                        }
                    }
                }
            }
        }
        printf("%d\n",cnt);
    }
    return 0;
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C

#include <stdio.h>

int main() {
  register int h[1501], w[1501];
  register int n, m, i, j, k, l;
  
  while(scanf("%d%d", &n, &m) && (n|m)) {
    n++, m++;
    h[0] = w[0] = 0;
    for(i=1; i<n; i++) scanf("%d", &h[i]);
    for(i=1; i<m; i++) scanf("%d", &w[i]);
    
    for(i=1; i<n-1; i++) h[i+1] += h[i];
    for(i=1; i<m-1; i++) w[i+1] += w[i];
    
    int cnt = 0;
    for(i=0; i<n-1; i++)
      for(j=0; j<m-1; j++)
	for(k=i+1; k<n; k++)
	  for(l=j+1; l<m; l++)
	    cnt += h[k]-h[i] == w[l]-w[j];
    
    printf("%d\n", cnt);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:3: error: address of register variable 'n' requested
    7 |   while(scanf("%d%d", &n, &m) && (n|m)) {
      |   ^~~~~
main.c:7:3: error: address of register variable 'm' requested
main.c:10:5: error: address of register variable 'h' requested
   10 |     for(i=1; i<n; i++) scanf("%d", &h[i]);
      |     ^~~
main.c:11:5: error: address of register variable 'w' requested
   11 |     for(i=1; i<m; i++) scanf("%d", &w[i]);
      |     ^~~
main.c:13:5: error: address of register variable 'h' requested
   13 |     for(i=1; i<n-1; i++) h[i+1] += h[i];
      |     ^~~
main.c:13:5: error: address of register variable 'h' requested
main.c:14:5: error: address of register variable 'w' requested
   14 |     for(i=1; i<m-1; i++) w[i+1] += w[i];
      |     ^~~
main.c:14:5: error: address of register variable 'w' requested
main.c:21:13: error: address of register variable 'h' requested
   21 |             cnt += h[k]-h[i] == w[l]-w[j];
      |             ^~~
main.c:21:13: error: address of register variable 'h' requested
main.c:21:13: error: address of register variable 'w' requested
main.c:21:13: error: address of register variable 'w' requested
Language: C++

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

const int MAX_LEN=100000;
int N,M;
int h[MAX_LEN],w[MAX_LEN];
int x,y;
int x,y;
int solve()
{
    int sum=0;
    int k=N;
    for(int i=0;i<N;i++)
    {
        h[k]=h[i];
        for(int j=i+1;j<N;j++)
        {
            h[k]+=h[j];
            h[k+1]=h[k];
            k++;
        }
    }
    int l=M;
    for(int i=0;i<M;i++)
    {
        w[l]=w[i];
        for(int j=i+1;j<M;j++)
        {
            w[l]+=w[j];
            w[l+1]=w[l];
            l++;
        }
    }
    sort(h,h+k);
    sort(w,w+l);
    for(int i=0;i<k;i++)
        for(int j=0;j<l&&j<=i;j++)
            if(w[j]==h[i])sum++;
    return sum;
}

int max(int a,int b)
{
    return a>b?a:b;
}
int main()
{
    while(cin>>N>>M&&N!=0)
    {
        for(int i=0;i<N;i++)
    {
        cin>>h[i];
    }
        for(int i=0;i<M;i++)
    {
        cin>>w[i];
    }
    cout<<solve()<<endl;
    }
        return 0;
}


Compiler output:
a.cc:12:5: error: redefinition of 'int x'
   12 | int x,y;
      |     ^
a.cc:11:5: note: 'int x' previously declared here
   11 | int x,y;
      |     ^
a.cc:12:7: error: redefinition of 'int y'
   12 | int x,y;
      |       ^
a.cc:11:7: note: 'int y' previously declared here
   11 | int x,y;
      |       ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000 + 0;
//{{{ templates
#define TT_ template<typename T>inline
#define TTF_ template<typename T,typename F>inline
TT_ T sq(T x){return x*x;}
TT_ T In(){T x;cin>>x;return x;}
TT_ void Out(T&x){cout<<x;}
TT_ void sort(T&v){sort(begin(v),end(v));}
TT_ void revs(T&v){reverse(begin(v),end(v));}
TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT_ int ubnd(T&v,typename T::value_type x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT_ int lbnd(T&v,typename T::value_type x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
TT_ typename T::iterator minel(T&v){return min_element(begin(v),end(v));}
TT_ typename T::iterator maxel(T&v){return max_element(begin(v),end(v));}

inline void fast_io(){ios_base::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}
//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple

int H[2048], W[2048];
int main()
{
  int N, M;
  while (N = in(), M = in()){
    unorderd_set<int> hs;
    hs.reserve(N);
    for (int i = 1; i <= N; i++){
      H[i] = H[i - 1] + in();
      hs.insert(H[i]);
    }
    for (int i = 1; i <= M; i++){
      W[i] = W[i - 1] + in();
    }
    int ans = 0;
    for (int y = 0; y < N; y++){
      for (int x = 0; x <= M; x++){
        for (int z = x + 1; z <= M; z++){
          int d = W[z] - W[x];
          ans += hs.count(H[y] + d);
        }
      }
    }
    printf("%d\n", ans);
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:5: error: 'unorderd_set' was not declared in this scope
   38 |     unorderd_set<int> hs;
      |     ^~~~~~~~~~~~
a.cc:38:18: error: expected primary-expression before 'int'
   38 |     unorderd_set<int> hs;
      |                  ^~~
a.cc:39:5: error: 'hs' was not declared in this scope
   39 |     hs.reserve(N);
      |     ^~
Language: C++

#include <stdio.h>
#include <vector>
#include <map>

auto solve(int N, int M) -> int
{
	using namespace std;
	vector<int> h(N);
	vector<int> w(M);

	for(int i = 0; i < N; i++)
	{
		int x;
		scanf("%d", &x);
		h[i] = x;
	}
	for(int i = 0; i < M; i++)
	{
		int x;
		scanf("%d", &x);
		w[i] = x;
	}

	map<int, int>& eh = *(new map<int, int>());
	map<int, int>& ew = *(new map<int, int>());
	for(int i = 0; i < N; i++)
	{
		int sum = 0;
		for(int j = i; j < N; j++)
		{
			sum += h[j];
			if(eh.find(sum) != ew.end())
				eh[sum]++;
			else
				eh[sum] = 1;
		}
	}
	for(int i = 0; i < M; i++)
	{
		int sum = 0;
		for(int j = i; j < M; j++)
		{
			sum += w[j];
			if(ew.find(sum) != ew.end())
				ew[sum]++;
			else
				ew[sum] = 1;
		}
	}

	int ans = 0;
	for(auto p : eh)
	{
		if(ew.find(p.first) != ew.end())
			ans += p.second * ew[p.first];
	}
	
	delete h;
	delete w;
	delete eh;
	delete ew;

	return ans;
}

auto main() -> int
{
	int n, m;
	while(1)
	{
		scanf("%d%d", &n, &m);
		if(!(n | m))
			break;
		printf("%d\n", solve(n, m));
	}
}

Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:58:16: error: type 'class std::vector<int>' argument given to 'delete', expected pointer
   58 |         delete h;
      |                ^
a.cc:59:16: error: type 'class std::vector<int>' argument given to 'delete', expected pointer
   59 |         delete w;
      |                ^
a.cc:60:16: error: type 'class std::map<int, int>' argument given to 'delete', expected pointer
   60 |         delete eh;
      |                ^~
a.cc:61:16: error: type 'class std::map<int, int>' argument given to 'delete', expected pointer
   61 |         delete ew;
      |                ^~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cstdio>
#include<cstring>
#include<string>

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

int di[4] = {1, 0, -1, 0};
int dj[4] = {0, 1, 0, -1};
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
    int n,m;
    while(cin >> n >> m){
        if(n+m==0) break;
        int h[n], w[m];
        int cnt = 0;
        REP(i,n) cin >> h[i];
        REP(i,m) cin >> w[i];

        int wh[1500001];
        int ww[1500001];
        REP(i,n){
            int sum = 0;
            for(int j=i, j<n; j++){
                sum += h[i];
                wh[sum]++;
            }
        }
        REP(i,m){
            int sum = 0;
            for(int j=i, j<n; j++){
                sum += w[i];
                ww[sum]++;
            }
        }

        int cnt = 0;
        REP(i,1500001) c += wh[i] * ww[i];
        cout << cnt << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:27: error: expected ';' before '<' token
   32 |             for(int j=i, j<n; j++){
      |                           ^
      |                           ;
a.cc:32:27: error: expected primary-expression before '<' token
a.cc:39:27: error: expected ';' before '<' token
   39 |             for(int j=i, j<n; j++){
      |                           ^
      |                           ;
a.cc:39:27: error: expected primary-expression before '<' token
a.cc:45:13: error: redeclaration of 'int cnt'
   45 |         int cnt = 0;
      |             ^~~
a.cc:24:13: note: 'int cnt' previously declared here
   24 |         int cnt = 0;
      |             ^~~
a.cc:46:24: error: 'c' was not declared in this scope
   46 |         REP(i,1500001) c += wh[i] * ww[i];
      |                        ^
Language: C++


#include <iostream>
#include <algorithm>

using namespace std;
int N,M;


int main() {
    for (; ;) {
        cin >>N>>M;
        if (N==0&&M==0) {
            break;
        }
        int h[N],w[M];
        h[0]=0;
        w[0]=0;
        for (int i=1; i<=N; i++) {
            int k;
            cin >>k;
            h[i]=(h[i-1]+k);
        }
        for (int i=1; i<=M; i++) {
            int l;
            cin >>l;
            w[i]=(w[i-1]+l);
        }
        int H[N*N],W[M*M];
        memset(H, 100000007, sizeof(H));
        memset(W, 100000007, sizeof(W));
        int p=0;
        for (int i=0; i<=N; i++) {
            for (int j=0; j<=N; j++) {
                if (h[i]<h[j]) {
                    H[p++]=h[j]-h[i];
                }
            }
        }
        sort(H, H+p);
        int q=0;
        for (int i=0; i<=M; i++) {
            for (int j=0; j<=M; j++) {
                if (w[i]<w[j]) {
                    W[q++]=w[j]-w[i];
                }
            }
        }
        sort(W, W+q);
        int ans=0;
        for (int i=0; i<p; i++) {
            for (int j=0; j<q; j++) {
                if (W[j]==H[i]) {
                    ans++;
                }
                if (W[j]>H[i]) {
                    break;
                }
            }
        }
    cout << ans <<endl;
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:9: error: 'memset' was not declared in this scope
   29 |         memset(H, 100000007, sizeof(H));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 |
Language: C++

int main() {
    for (; ;) {
        int N,M;
        cin >>N>>M;
        if (N==0&&M==0) {
            break;
        }
        int h[N],w[M];
        h[0]=0;
        w[0]=0;
        for (int i=1; i<=N; i++) {
            int k;
            cin >>k;
            h[i]=(h[i-1]+k);
        }
        for (int i=1; i<=M; i++) {
            int l;
            cin >>l;
            w[i]=(w[i-1]+l);
        }
        long long H[N*N],W[M*M];
        memset(H, 1000000007, sizeof(H));
        memset(W, 1000000007, sizeof(W));
        int p=0;
        for (int i=0; i<=N; i++) {
            for (int j=0; j<=N; j++) {
                if (h[i]<h[j]) {
                    H[p++]=h[j]-h[i];
                }
            }
        }
        sort(H, H+p);
        int q=0;
        for (int i=0; i<=M; i++) {
            for (int j=0; j<=M; j++) {
                if (w[i]<w[j]) {
                    W[q++]=w[j]-w[i];
                }
            }
        }
        sort(W, W+q);
        int ans=0;
        int flag=0;
        for (int i=0; i<p; i++) {
            for (int j=flag; W[j]<=H[i]&&j<q; j++) {
                if (W[j]==H[i]) {
                    ans++;
                }else{
                    flag++;
                }
            }
        }
        cout << ans <<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >>N>>M;
      |         ^~~
a.cc:22:9: error: 'memset' was not declared in this scope
   22 |         memset(H, 1000000007, sizeof(H));
      |         ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | int main() {
a.cc:32:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   32 |         sort(H, H+p);
      |         ^~~~
      |         short
a.cc:53:9: error: 'cout' was not declared in this scope
   53 |         cout << ans <<endl;
      |         ^~~~
a.cc:53:23: error: 'endl' was not declared in this scope
   53 |         cout << ans <<endl;
      |                       ^~~~
Language: C++

int main() {
    for (; ;) {
        int N,M;
        cin >>N>>M;
        if (N==0&&M==0) {
            break;
        }
        int h[N],w[M];
        h[0]=0;
        w[0]=0;
        for (int i=1; i<=N; i++) {
            int k;
            cin >>k;
            h[i]=(h[i-1]+k);
        }
        for (int i=1; i<=M; i++) {
            int l;
            cin >>l;
            w[i]=(w[i-1]+l);
        }
        long long H[N*N],W[M*M];
        memset(H, 150000007, sizeof(H));
        memset(W, 150000007, sizeof(W));
        int p=0;
        for (int i=0; i<=N; i++) {
            for (int j=0; j<=N; j++) {
                if (h[i]<h[j]) {
                    H[p++]=h[j]-h[i];
                }
            }
        }
        sort(H, H+p);
        int q=0;
        for (int i=0; i<=M; i++) {
            for (int j=0; j<=M; j++) {
                if (w[i]<w[j]) {
                    W[q++]=w[j]-w[i];
                }
            }
        }
        sort(W, W+q);
        int ans=0;
        int flag=0;
        for (int i=0; i<p; i++) {
            for (int j=flag; W[j]<=H[i]&&j<q; j++) {
                if (W[j]==H[i]) {
                    ans++;
                }else{
                    flag++;
                }
            }
        }
        cout << ans <<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >>N>>M;
      |         ^~~
a.cc:22:9: error: 'memset' was not declared in this scope
   22 |         memset(H, 150000007, sizeof(H));
      |         ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | int main() {
a.cc:32:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   32 |         sort(H, H+p);
      |         ^~~~
      |         short
a.cc:53:9: error: 'cout' was not declared in this scope
   53 |         cout << ans <<endl;
      |         ^~~~
a.cc:53:23: error: 'endl' was not declared in this scope
   53 |         cout << ans <<endl;
      |                       ^~~~
Language: C++

#include<iostream>
using namespace std;
int t[2000],u[2000];
int a[2000000],b[2000000];
int N,M;
int main(){
  while(1){
    cin>>N>>M;
    if(N==0&&M==0)break;
    for(int i=0;i<2000000;i++)a[i]=b[i]=0;
    for(int i=1;i<=N;i++)cin>>t[i],t[i]+=t[i-1];
    for(int i=1;i<=M;i++)cin>>u[i],u[i]+=u[i-1];
    for(int i=1;i<=N;i++)
      for(int j=i;j<=N;j++)
    a[t[j]-t[i-1]]++;
    for(int i=1;i<=M;i++)
      for(int j=i;j<=M;j++)
    b[u[j]-u[i-1]]++;
    int ans=0;
    for(int i=0;i<2000000;i++)ans+=a[i]*b[i];
    cout<<ans<<endl;
  }
  return 0;

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

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

int main(){
  int N,M;
  while(cin >> N >> M){
    if(N==0&&M==0){
      break;
    }
    vector<int> X(N,0);
    vector<int> Y(M,0);
    for(int i=0;i<N;i++){
      cin >> X[i];
    }
    for(int i=0;i<M;i++){
      cin >> Y[i];
    }


    int hit=0;
    int width=0;
    int height=0;
    int min=max(N,M);
    for(int i=0;i<M;i++){
      width = Y[i];
      for(int j=0;j<N;j++){
	height = X[j];
	if(width==height){
	  hit++;
	}
	for(int k=1;min(i,j)+k<min;k++){
	  if(width<height){
	    width+=Y[i+k];
	  } else if(width>height){
	    height+=X[j+k];
	  } else if(k!=1){
	    hit++;
	    width+=Y[i+k];
	    height+=X[j+k];
	  }
	}
      }
    }
    cout << hit << endl;
  }
}
  

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

[i];
    }
         
    cout << cnt << endl;
    
  }
  
  return 0;
}
h

Compiler output:
a.cc:1:1: error: expected unqualified-id before '[' token
    1 | [i];
      | ^
a.cc:2:5: error: expected declaration before '}' token
    2 |     }
      |     ^
a.cc:4:5: error: 'cout' does not name a type
    4 |     cout << cnt << endl;
      |     ^~~~
a.cc:6:3: error: expected declaration before '}' token
    6 |   }
      |   ^
a.cc:8:3: error: expected unqualified-id before 'return'
    8 |   return 0;
      |   ^~~~~~
a.cc:9:1: error: expected declaration before '}' token
    9 | }
      | ^
a.cc:10:1: error: 'h' does not name a type
   10 | h
      | ^
Language: C++

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

#include "stdafx.h"
#include<iostream>
#include<string.h>
using namespace std;
static int table[1500 * 1000];
int main()
{
	int n, m;
	while (cin >> n >> m && n != 0 || m != 0)
	{
		int x[1502];
		int y[1502];
		memset(table, 0, sizeof table);
		y[0] = 0;
		for (int i = 0; i < n; i++)
		{
			int h;
			cin >> h;
			y[i + 1] = y[i] + h;
		}
		x[0] = 0;
		for (int i = 0; i < m; i++)
		{
			int w;
			cin >> w;
			x[i + 1] = x[i] + w;
		}
		for (int i = 0; i < m; i++)
		{
			for (int j = i + 1; j <= m; j++)
			{
				table[x[j] - x[i]]++;
			}
		}
		int count = 0;
		for (int i = 0; i < n; i++)
		{
			for (int j = i + 1; j <= n; j++)
			{
				if (table[y[j] - y[i]] > 0)
				{
					count += table[y[j] - y[i]];
				}
			}
		}
		cout << count << 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: C++

#include <iostream>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i=(a);i<=(b);i++)

int n, m, c;
int h[1001], w[1001];

int main() {
  
  while(cin>>n>>m,n|m) {
    c = 0;
    h = {};
    w = {};
    map<int, int> mh, mw;
    rep(i, 1, n) {
      cin>>h[i];
      h[i] += h[i-1];
    }
    rep(i, 1, m) {
      cin>>w[i];
      w[i] += w[i-1];
    }
    
    rep(i, 1, n) {
      rep(j, i+1, n) {
        mh[h[j]-h[i]] += 1;
      }
    }
    
    rep(i, 1, m) {
      rep(j, i+1, m) {
        mw[w[j]-w[i]] += 1;
      }
    }
    int s = h[n]<w[m]?h[n]:w[m];
    rep(i, 1, s) {
      c += mh[i]*mw[i];
    }
    cout << c << endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: assigning to an array from an initializer list
   13 |     h = {};
      |     ~~^~~~
a.cc:14:7: error: assigning to an array from an initializer list
   14 |     w = {};
      |     ~~^~~~
Language: C++

#include <iostream>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i=(a);i<=(b);i++)

int n, m, c;
int h[1001], w[1001];

int main() {
  
  while(cin>>n>>m,n|m) {
    c = 0;
    h[] = {};
    w[] = {};
    map<int, int> mh, mw;
    rep(i, 1, n) {
      cin>>h[i];
      h[i] += h[i-1];
    }
    rep(i, 1, m) {
      cin>>w[i];
      w[i] += w[i-1];
    }
    
    rep(i, 1, n) {
      rep(j, i+1, n) {
        mh[h[j]-h[i]] += 1;
      }
    }
    
    rep(i, 1, m) {
      rep(j, i+1, m) {
        mw[w[j]-w[i]] += 1;
      }
    }
    int s = h[n]<w[m]?h[n]:w[m];
    rep(i, 1, s) {
      c += mh[i]*mw[i];
    }
    cout << c << endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: expected primary-expression before ']' token
   13 |     h[] = {};
      |       ^
a.cc:14:7: error: expected primary-expression before ']' token
   14 |     w[] = {};
      |       ^
Language: C++

#include <string>
#include <vector>
#include <map>
#include <iostream>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <climits>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <algorithm>
#include <functional>
using namespace std;
int N,M;
int h[1100]={};
int w[1100]={};
int dfs(int x){
	int p=0;
	for(int u=0;u<N;u++){
			int f=0;
			for(int w=0;w<N-u;w++){
				f+=h[u+w];
				if(f>x)break;
				if(f==x){
					p++;
					break;
				}

			}
	}
	return p;
}
int main(){
	while(1){
	cin>>N>>M;
	if(N==0 && M==0)break;
	long long int ans=0;
	for(int i=0;i<N;i++){
		cin>>h[i];
	}
	for(int i=0;i<M;i++){
		cin>>w[i];
	}
	for(int i=0;i<M;i++){
		for(int j=i;j<M;j++){
			cnt=0;
			for(int k=i;k<=j;k++){
				cnt+=w[k];
			}
			ans+=dfs(cnt);
		}
	}
	cout<<ans<<endl;
	}
	return 0;
}

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

//?????????????????§??????????????????????????£????????????
#include <stdio.h>
#include <iostream>
#include <queue>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#define PB push_back
#define in scanf
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#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 IREP(i,n) for (int i=0;i<=(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
using	namespace std;
int N,M;
int h[1501],w[1501],tw[1502]={},th[1502]={};
//int hhh[15000001]={};
//int www[15000001]={};
void solve(){
	while(cin >> N >>M,N!=0){
		REP(i,N)cin >> h[i];
		REP(i,M)cin >> w[i];
		tw[0]=th[0]=0;
		REP(i,N){
			th[i+1]=th[i]+h[i];

		}REP(i,M)tw[i+1]=tw[i]+w[i];
		int hhh[th[N]+1];
		int www[tw[N]+1];
			memset(www,0,sizeof(www));
			memset(hhh,0,sizeof(hhh));//vector <int>hh,ww;
			int temp;
			for(int s=0;s<=N;s++){
					for(int g=s+1;g<=N;g++){
							 temp = th[g]-th[s];
							//hh.PB(temp);
							hhh[temp]++;
												}
			}for(int s=0;s<=M;s++){
					for(int g=s+1;g<=M;g++){

							 temp = tw[g]-tw[s];
							www[temp]++;
							//cout << temp <<endl;
							//ww.PB(temp);

					}
			}
			int m = min(th[N],tw[N]);

			int res =0;
			REP(i,m+1) res+= www[i]*hhh[i];
			cout << res <<endl;





	}

}

int main(){
solve();


}

Compiler output:
a.cc: In function 'void solve()':
a.cc:33:25: error: 'memset' was not declared in this scope
   33 |                         memset(www,0,sizeof(www));
      |                         ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <math.h>
  +++ |+#include <cstring>
   10 | #define PB push_back
Language: C++

int main() {
    ios_base::sync_with_stdio(0);
    int n, m, i, j, sumV, sumH, cnt;
    
    while(1){
        cin >> n >> m;
        if(n==0 && m==0)
            break;
        for(i=0; i<n; i++)
            cin >> roadV[i];
        for(i=0; i<m; i++)
            cin >> roadH[i];
        
        for(i=1; i<=n*1000; i++){
            widthV[i]=0;
        }
        for(i=1; i<=m*1000; i++){
            widthH[i]=0;
        }
    
        for(i=0; i<n; i++){
            sumV=0;
            sumH=0;
            for(j=i;j<n;j++){
                sumV+=roadV[i];
                sumH+=roadH[i];
            
                widthV[sumV]++;
                widthH[sumH]++;
            }
        }
    
        cnt=0;
        for(i=1; i<=n*1000; i++){
            cnt+=widthV[i]*widthH[i];
        }
    
        cout << cnt << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'ios_base' has not been declared
    2 |     ios_base::sync_with_stdio(0);
      |     ^~~~~~~~
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin >> n >> m;
      |         ^~~
a.cc:10:20: error: 'roadV' was not declared in this scope
   10 |             cin >> roadV[i];
      |                    ^~~~~
a.cc:12:20: error: 'roadH' was not declared in this scope
   12 |             cin >> roadH[i];
      |                    ^~~~~
a.cc:15:13: error: 'widthV' was not declared in this scope
   15 |             widthV[i]=0;
      |             ^~~~~~
a.cc:18:13: error: 'widthH' was not declared in this scope
   18 |             widthH[i]=0;
      |             ^~~~~~
a.cc:25:23: error: 'roadV' was not declared in this scope
   25 |                 sumV+=roadV[i];
      |                       ^~~~~
a.cc:26:23: error: 'roadH' was not declared in this scope
   26 |                 sumH+=roadH[i];
      |                       ^~~~~
a.cc:28:17: error: 'widthV' was not declared in this scope
   28 |                 widthV[sumV]++;
      |                 ^~~~~~
a.cc:29:17: error: 'widthH' was not declared in this scope
   29 |                 widthH[sumH]++;
      |                 ^~~~~~
a.cc:35:18: error: 'widthV' was not declared in this scope
   35 |             cnt+=widthV[i]*widthH[i];
      |                  ^~~~~~
a.cc:35:28: error: 'widthH' was not declared in this scope
   35 |             cnt+=widthV[i]*widthH[i];
      |                            ^~~~~~
a.cc:38:9: error: 'cout' was not declared in this scope
   38 |         cout << cnt << endl;
      |         ^~~~
a.cc:38:24: error: 'endl' was not declared in this scope
   38 |         cout << cnt << endl;
      |                        ^~~~
Language: C++

using namespace std;

int main(){
  int n,m,sum=0,a,sums=0,sumh;
  vector<int> x,y,sa;
  while(1){
    cin>>n>>m;
    if(n==0)break;
    x.clear();  y.clear();  sa.clear();

    cin>>a;
    x.push_back(a);
    for(int i=1;i<n;i++){
      cin>>a;
      x.push_back(a+x[i-1]);
    }

    cin>>a;
    y.push_back(a);
    for(int j=1;j<m;j++){
      cin>>a;
      y.push_back(a+y[j-1]);
    }
    x.push_back(0);    y.push_back(0);
    for(int i=0;i<x.size();i++){
      for(int j=0;j<y.size();j++){
	sa.push_back(x[i]-y[j]);
      }
    }
    sort(sa.begin(),sa.end());
    //for(int i=0;i<sa.size();i++)cout<<sa[i]<<endl;///////////
    sum=0;
    sums=0;
    for(int i=1;i<sa.size();i++){
      if(sa[i]==sa[i-1])sum++;
      else if(sa[i]!=sa[i-1]&&sum!=0){
	if(sum==1)sums+=sum;
	else {
	  sum++;
	  sums+=sum*(sum-1)/2;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector<int> x,y,sa;
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:5:10: error: expected primary-expression before 'int'
    5 |   vector<int> x,y,sa;
      |          ^~~
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin>>n>>m;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:9:5: error: 'x' was not declared in this scope
    9 |     x.clear();  y.clear();  sa.clear();
      |     ^
a.cc:9:17: error: 'y' was not declared in this scope
    9 |     x.clear();  y.clear();  sa.clear();
      |                 ^
a.cc:9:29: error: 'sa' was not declared in this scope; did you mean 'a'?
    9 |     x.clear();  y.clear();  sa.clear();
      |                             ^~
      |                             a
a.cc:30:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   30 |     sort(sa.begin(),sa.end());
      |     ^~~~
      |     short
a.cc:41:10: error: expected '}' at end of input
   41 |         }
      |          ^
a.cc:36:38: note: to match this '{'
   36 |       else if(sa[i]!=sa[i-1]&&sum!=0){
      |                                      ^
a.cc:41:10: error: expected '}' at end of input
   41 |         }
      |          ^
a.cc:34:33: note: to match this '{'
   34 |     for(int i=1;i<sa.size();i++){
      |                                 ^
a.cc:41:10: error: expected '}' at end of input
   41 |         }
      |          ^
a.cc:6:11: note: to match this '{'
    6 |   while(1){
      |           ^
a.cc:41:10: error: expected '}' at end of input
   41 |         }
      |          ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

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

int c[1500];
int d[1500];
int main() {
	int a, b;
	while (scanf("%d%d", &a, &b),a | b) {
		map<int, int>e;
		map<int, int>f;
		memset(c, 0, a * 4);
		memset(d, 0, b * 4);
		for (int g = 0; g < a; g++) {
			int h;
			scanf("%d", &h);
			for (int i = 0; i <= g; i++) {
				c[i] += h;
				e[c[i]]++;
			}
		}
		for (int g = 0; g < b; g++) {
			int h;
			scanf("%d", &h);
			for (int i = 0; i <= g; i++) {
				d[i] += h;
				f[d[i]]++;
			}
		}
		int s = 0;
		for (auto k = e.begin(); k != e.end(); k++) {
			s += f[k->first] * k->second;
		}
		printf("%d\n", s);
	}
}

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

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <array>
#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))

int intervalX[1500];
int intervalY[1500];
int intervalsX[1500 * 1500];
int intervalsY[1500 * 1500];

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

	void solver() {
		int n, m;
		while (std::cin >> n >> m, n, m) {
			std::memset(intervalX, 0, sizeof(intervalX));
			std::memset(intervalY, 0, sizeof(intervalY));
			std::memset(intervalsX, 0, sizeof(intervalsX));
			std::memset(intervalsY, 0, sizeof(intervalsY));
			//input
			rep(i, n) {
				std::cin >> intervalX[i];
			}
			rep(i, m) {
				std::cin >> intervalY[i];
			}
			//All patterns enumeration
			int numOfIntervalsX = 0;
			int numOfIntervalsY = 0;
			int squares = 0;
			int edgeXNo = 0;
			int cnt = 0;
			rep(i, n) {
				rep(j, n - i) {
					rangeRep(k, j, j + i + 1) {
						intervalsX[cnt] += intervalX[k];
					}
					++cnt;
					++numOfIntervalsX;
				}
			}
			cnt = 0;
			rep(i, m) {
				edgeXNo = 0;
				rep(j, m - i) {
					rangeRep(k, j, j + i + 1) {
						intervalsY[cnt] += intervalY[k];
					}
					rep(k, numOfIntervalsX) {
						if (intervalsX[k] == intervalsY[cnt]) squares++;
					}
					++cnt;
				}
			}
			std::cout << squares << "\n";
		}
		std::cout << std::endl;
	}
private:

};

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

Compiler output:
a.cc: In member function 'void Solve::solver()':
a.cc:37:30: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
   37 |                         std::memset(intervalX, 0, sizeof(intervalX));
      |                              ^~~~~~
      |                              wmemset
a.cc:38:30: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
   38 |                         std::memset(intervalY, 0, sizeof(intervalY));
      |                              ^~~~~~
      |                              wmemset
a.cc:39:30: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
   39 |                         std::memset(intervalsX, 0, sizeof(intervalsX));
      |                              ^~~~~~
      |                              wmemset
a.cc:40:30: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
   40 |                         std::memset(intervalsY, 0, sizeof(intervalsY));
      |                              ^~~~~~
      |                              wmemset