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

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

#define fin cin

using namespace std;

int n = 0, m = 0;
vector<int> h;
vector<int> w;

template<typename Vec>
push_sum(Vec &v, int size)
{
    for(unsigned i = 0; i < size; i++){
        int num = v[i];

        unsigned sub = i + 1;
        while(sub < size)
        {
            num += v[sub];
            v.push_back(num);
            sub++;
        }
    }
}

int main()
{
//    ifstream fin("in.txt");

    while(fin >> n >> m, n | m)
    {
        h.clear();
        w.clear();

        int tmp = 0;
        for(int i = 0; i < n; i++)
        {
            fin >> tmp;
            h.push_back(tmp);
        }
        for(int i = 0; i < m; i++)
        {
            fin >> tmp;
            w.push_back(tmp);
        }

        push_sum(h, n);
        push_sum(w, m);

        sort(h.begin(), h.end());
        sort(w.begin(), w.end());

        int ans = 0;

        for(int i = 0; i < h.size(); i++)
        {
            for(int j = 0; j < w.size(); j++)
            {
                if(h[i] == w[j])ans++;
                if(h[i] < w[j])break;
            }
        }

        cout << ans << endl;


    }


    return 0;
}

Compiler output:
a.cc:15:1: error: ISO C++ forbids declaration of 'push_sum' with no type [-fpermissive]
   15 | push_sum(Vec &v, int size)
      | ^~~~~~~~
a.cc: In instantiation of 'int push_sum(Vec&, int) [with Vec = std::vector<int>]':
a.cc:51:17:   required from here
   51 |         push_sum(h, n);
      |         ~~~~~~~~^~~~~~
a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin >> n && n)
    {
        int m;
        cin >> m;
        int h[n], w[m];
        int p[n+1], q[m+1]; //h[0]+...+h[i]??????????????????????¨????????????????
        p[0] = 0;
        q[0] = 0;
        for(int i = 0; i < n; i++)
        {
            cin >> h[i];
            p[i+1] = p[i] + h[i];
            
        }
        for(int j = 0; j < m; j++)
        {
            cin >> w[j];
            q[j+1] = q[j] + w[j];
        }
        int t = 0;
        for(int a = 0; a < n; a++)
        {
            for(int b = a+1; b < n+1; b++)
            {
                for(int c = 0; c < m; c++)
                {
                    for(int d = d+1; d < m+1; d++)
                    {
                        if(p[a] - p[b]= q[c] - q[d])
                        {
                            t = t + 1;
                        }
                    }
                }
            }
        }
        cout << t << endl;
        
    
    
    
    }



}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:33: error: lvalue required as left operand of assignment
   34 |                         if(p[a] - p[b]= q[c] - q[d])
      |                            ~~~~~^~~~~~
Language: C++

def ans(N, M, h, w):
    count = 0
    for hr1 in range(N+1):
        for hr2 in range(N+1):
            if hr2 <= hr1:
                continue
            height = sum(h[e] for e in range(hr1, hr2))
             
            for wr1 in range(M+1):
                for wr2 in range(M+1):
                    if wr2 <= wr1:
                        continue
                    width = sum([w[e] for e in range(wr1, wr2)])
                     
                    if height == width:
                        count += 1
    return count
     
while True:
    N, M = [int(e) for e in input().strip().split()]
    if N == 0 and M == 0:
        break
    h = [int(input()) for e in range(N)]
    w = [int(input()) for e in range(M)]
    answer = ans(N,M,h,w)
    print(answer)


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def ans(N, M, h, w):
      | ^~~
Language: C++

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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

#define int ll

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

    vi h(n+1), w(m+1);
    h[0] = w[0] = 0;
    rep(i,n) cin >> h[i+1];
    rep(i,m) cin >> w[i+1];

    rep(i,n) h[i+1] += h[i];
    rep(i,m) w[i+1] += w[i];

    map<int,int> mph, mpw;
    rep(i,n) rep(j,n-i)
      mph[h[j + i + 1] - h[j]]++;
    rep(i,m) rep(j,m-i)
      mpw[w[j + i + 1] - w[j]]++;

    int ans = 0;
    for(x : mph){
      auto y = mpw.find(x.fst);
      if(y != mpw.end()) ans += x.snd * y->snd;
    }

    cout << ans << endl;
  }
}


Compiler output:
a.cc:34:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   34 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:55:11: error: found ':' in nested-name-specifier, expected '::'
   55 |     for(x : mph){
      |           ^
      |           ::
a.cc:55:9: error: 'x' has not been declared
   55 |     for(x : mph){
      |         ^
a.cc:61:3: error: expected primary-expression before '}' token
   61 |   }
      |   ^
a.cc:60:25: error: expected ')' before '}' token
   60 |     cout << ans << endl;
      |                         ^
      |                         )
   61 |   }
      |   ~                      
a.cc:55:8: note: to match this '('
   55 |     for(x : mph){
      |        ^
a.cc:61:3: error: expected primary-expression before '}' token
   61 |   }
      |   ^
Language: C++

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

int main(){
    int N, M, h[1501], w[1501];
    while(cin >> N >> M){
    if(N == 0 && M == 0)    break;
    for(int i=0;i<N;i++) cin >> h[i];
    for(int i=0;i<M;i++) cin >> w[i];
 
    int mxh=accumulate(h,h+N,0); //縦総和
    int mxw=accumulate(w,w+M,0); //横総和
 
    vector<int>th(mxh+1,0),tw(mxw+1,0); //0で初期化。
    
    for(int i=0; i<N; i++){
        int sum =0;
        for(int j=i; j<N; j++){
            sum += h[j]; //長さを足していく。
            th[sum]++;//縦がその長さになる個数をいれる。
        }
    }
    for(int i=0; i<M; i++){
        int sum =0;
        for(int j=i; j<M; j++){
            sum += w[j]; //長さを足していく。
            tw[sum]++;//横がその長さになる個数をいれる。
        }
    }
    long long count = 0;
    for(int i=0; i<=min(mxh,mxw); i++){
        count += (long long)th[i]*tw[i];
    }
    cout << count << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'accumulate' was not declared in this scope
   13 |     int mxh=accumulate(h,h+N,0); //縦総和
      |             ^~~~~~~~~~
Language: C++

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

int main(){
    int N, M, h[1501], w[1501];
    while(cin >> N >> M){
    if(N == 0 && M == 0)    break;
    for(int i=0;i<N;i++) cin >> h[i];
    for(int i=0;i<M;i++) cin >> w[i];
 
    int mxh=accumulate(h,h+N,0); 
    int mxw=accumulate(w,w+M,0); 
    
    vector<int>th(mxh+1,0),tw(mxw+1,0); 
    
    for(int i=0; i<N; i++){
        int sum =0;
        for(int j=i; j<N; j++){
            sum += h[j]; 
            th[sum]++;
        }
    }
    for(int i=0; i<M; i++){
        int sum =0;
        for(int j=i; j<M; j++){
            sum += w[j]; 
            tw[sum]++;
        }
    }
    long long count = 0;
    for(int i=0; i<=min(mxh,mxw); i++){
        count += (long long)th[i]*tw[i];
    }
    cout << count << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'accumulate' was not declared in this scope
   13 |     int mxh=accumulate(h,h+N,0);
      |             ^~~~~~~~~~
Language: C++

#include <cstdio>
#include <map>
using namespace std;int main(o,cn,cm,i,j,x){
for(;scanf("%d %d", &cn, &cm),cn;printf("%d\n",o)){
  map<int, int> point;
  map<int, int>::iterator p;
  int n[1501], m[1501];

  n[0]=m[0]=o=0;

  for(i=0;i<cn;i++){
    scanf("%d", &x);
    n[i+1]=n[i]+x;
  }
  for(i=0;i<cm;i++){
    scanf("%d", &x);
    m[i+1]=m[i]+x;
  }
  
  for(i=0;i<=cn;i++){
    for(j=0;j<=cm;j++){
	  point[n[i]+m[j]]++;
	}
  }
  
  for(p=point.begin(); p!=point.end(); p++){
	o+=(p->second)*((p->second)-1)/2;
  }
}
}

Compiler output:
a.cc:3:25: error: cannot declare '::main' to be a global variable
    3 | using namespace std;int main(o,cn,cm,i,j,x){
      |                         ^~~~
a.cc:3:30: error: 'o' was not declared in this scope
    3 | using namespace std;int main(o,cn,cm,i,j,x){
      |                              ^
a.cc:3:32: error: 'cn' was not declared in this scope
    3 | using namespace std;int main(o,cn,cm,i,j,x){
      |                                ^~
a.cc:3:35: error: 'cm' was not declared in this scope
    3 | using namespace std;int main(o,cn,cm,i,j,x){
      |                                   ^~
a.cc:3:38: error: 'i' was not declared in this scope
    3 | using namespace std;int main(o,cn,cm,i,j,x){
      |                                      ^
a.cc:3:40: error: 'j' was not declared in this scope
    3 | using namespace std;int main(o,cn,cm,i,j,x){
      |                                        ^
a.cc:3:42: error: 'x' was not declared in this scope
    3 | using namespace std;int main(o,cn,cm,i,j,x){
      |                                          ^
a.cc:3:43: error: expression list treated as compound expression in initializer [-fpermissive]
    3 | using namespace std;int main(o,cn,cm,i,j,x){
      |                                           ^
Language: C++

#include <cstdio>
#include <map>
using namespace std;int main(){
for(;scanf("%d %d", &cn, &cm),cn;printf("%d\n",o)){
  map<int,int> point;
  map<int,int>::iterator p;
  int n[1501], m[1501],o,cn,cm,i,j,x;

  n[0]=m[0]=o=0;

  for(i=0;i<cn;i++){
    scanf("%d", &x);
    n[i+1]=n[i]+x;
  }
  for(i=0;i<cm;i++){
    scanf("%d", &x);
    m[i+1]=m[i]+x;
  }
  
  for(i=0;i<=cn;i++){
    for(j=0;j<=cm;j++){
	  point[n[i]+m[j]]++;
	}
  }
  
  for(p=point.begin(); p!=point.end(); p++){
	o+=(p->second)*((p->second)-1)/2;
  }
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:22: error: 'cn' was not declared in this scope
    4 | for(;scanf("%d %d", &cn, &cm),cn;printf("%d\n",o)){
      |                      ^~
a.cc:4:27: error: 'cm' was not declared in this scope
    4 | for(;scanf("%d %d", &cn, &cm),cn;printf("%d\n",o)){
      |                           ^~
a.cc:4:48: error: 'o' was not declared in this scope
    4 | for(;scanf("%d %d", &cn, &cm),cn;printf("%d\n",o)){
      |                                                ^
Language: C++

#include <cstdio>
#include <map>
using namespace std;int main(){
  
for(int n[1501], m[1501],o,a,b,i,j,x;scanf("%d%d",&a,&b),cn;printf("%d\n",o)){
  map<int,int> point;
  map<int,int>::iterator p;

  n[0]=m[0]=o=0;

  for(i=0;i<cn;i++){
    scanf("%d", &x);
    n[i+1]=n[i]+x;
  }
  for(i=0;i<cm;i++){
    scanf("%d", &x);
    m[i+1]=m[i]+x;
  }
  
  for(i=0;i<=cn;i++){
    for(j=0;j<=cm;j++){
	  point[n[i]+m[j]]++;
	}
  }
  
  for(p=point.begin(); p!=point.end(); p++){
	o+=(p->second)*((p->second)-1)/2;
  }
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:58: error: 'cn' was not declared in this scope; did you mean 'n'?
    5 | for(int n[1501], m[1501],o,a,b,i,j,x;scanf("%d%d",&a,&b),cn;printf("%d\n",o)){
      |                                                          ^~
      |                                                          n
a.cc:15:13: error: 'cm' was not declared in this scope; did you mean 'm'?
   15 |   for(i=0;i<cm;i++){
      |             ^~
      |             m
a.cc:21:16: error: 'cm' was not declared in this scope; did you mean 'm'?
   21 |     for(j=0;j<=cm;j++){
      |                ^~
      |                m
Language: C++

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

Compiler output:
a.cc:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | #import<cstdio>
      |  ^~~~~~
a.cc:2:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    2 | #import<map>
      |  ^~~~~~
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){for(int n[1501],m[1501],o,a,b,i,j,x;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;j++)z[n[i]+m[j]]++;for(std::map<int,int>::iteartor p=z.begin();p!=z.end();p++)o+=p->second*((p->second)-1)/2;}}
      | ^~~~
a.cc: In function 'int main()':
a.cc:4:197: error: 'iteartor' is not a member of 'std::map<int, int>'
    4 | main(){for(int n[1501],m[1501],o,a,b,i,j,x;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;j++)z[n[i]+m[j]]++;for(std::map<int,int>::iteartor p=z.begin();p!=z.end();p++)o+=p->second*((p->second)-1)/2;}}
      |                                                                                                                                                                                                     ^~~~~~~~
a.cc:4:218: error: 'p' was not declared in this scope
    4 | main(){for(int n[1501],m[1501],o,a,b,i,j,x;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;j++)z[n[i]+m[j]]++;for(std::map<int,int>::iteartor p=z.begin();p!=z.end();p++)o+=p->second*((p->second)-1)/2;}}
      |                                                                                                                                                                                                                          ^
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>

using namespace std;

int h[1024*1500];
int w[1024*1500];

int getInt(){
  int c = getchar();
  int ret = 0;
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int main(){
  int n,m;
  while(n=getInt(), (m=getInt(), n+m){
    int hh[n];
    int ww[m];
    int mm = 0;

    for(int i=0; i<n; i++)
      hh[i] = getInt();
    for(int i=0; i<m; i++)
      ww[i] = getInt();

    for(int i=0; i<n; i++){
      int sum = 0;
      for(int j=i; j<n; j++){
	sum += hh[j];
	h[sum]++;
      }
      mm = max(mm, sum);
    }
    for(int i=0; i<m; i++){
      int sum = 0;
      for(int j=i; j<m; j++){
	sum += ww[j];
	if(sum > mm) break;
	w[sum]++;
      }
    }
    long long ans = 0;
    for(int i=0; i<=mm; i++){
      if(w[i] | h[i]){
	ans += (long long)w[i] * h[i];
	w[i] = h[i] = 0;
      }
    }

    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:38: error: expected ')' before '{' token
   25 |   while(n=getInt(), (m=getInt(), n+m){
      |        ~                             ^
      |                                      )
Language: C++

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

int w[1501]={0}, h[1501]={0};
int W[2250000]={0}, H[2250000]={0};

int sum(int* a , int i,int n,int size){
	int s = 0;
	for(int j=n ; j-- ; ){
		if( i >= size ){
			return 0;
		}
		s += a[i++];
	}
	return s;
}

int main(){
	int n,m,w_,h_;
	while( cin >> n >> m , n||m ){
		//int cnt_h[1001] = {0}
		int cnt_w[10000] = {0};
		
		for(int i=0 ; i<n ; i++ ){
			cin >> h[i];
		}
		int i_=0;
		for(int j=1 ; j <= n ; j++ ){
			for(int i=0 ; i+j <= n ; i++ ){
				H[i_++] = sum( h , i , j , n );
			}
		}
		/*for(int i=0 ; i<i_ ; i++ ){
			cnt_h[ H[i] ]++;
		}*/
		
		for(int i=0 ; i<m ; i++ ){
			cin >> w[i];
		}
		int j_=0;
		for(int j=1 ; j <= m ; j++ ){
			for(int i=0 ; i+j <= m ; i++ ){
				W[j_++] = sum( w , i , j , m );
			}
		}
		for(int i=0 ; i<j_ ; i++ ){
			cnt_w[ W[i] ] += 1;
		}
		/*for(int i=0 ; i<j_ ; i++ ){
			cout << "W[" << i << "] : " << W[i] << endl;
		}*/
		
		int ans = 0;
		for(int i=0 ; i < i_ ; i++ ){
			if( H[i] < 10000 && H[i] >= 0 )
				//ans += cnt_w[ H[i] ];
			//for(int j=0 ; j < j_ ; j++ ){
			//	if( W[j] == H[i] ) ans++;
			//}
		}
		//cout << "ans : " << ans << endl;
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:17: error: expected primary-expression before '}' token
   62 |                 }
      |                 ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdlib>

#define MAX 1500001

using namespace std;

int tate[MAX], yoko[MAX];

int main( void )
{
	int n, m;
	int h[1500], w[1500];
	while(cin >> n >> m, n | m) {
		int sum_all_h, sum_all_w;
		sum_all_h = sum_all_w = 0;
		for(int i=0; i < n; ++i) { cin >> h[i]; sum_all_h += h[i]; }
		for(int i=0; i < m; ++i) { cin >> w[i]; sum_all_w += w[i]; }
		memset(tate, 0, sizeof(tate));
		memset(yoko, 0, sizeof(yoko));
		int size = max(sum_all_h+1, sum_all_w+1);
		for(int i=0; i < n; ++i) {
			if(i) sum_all_h -= h[i-1];
			int sum_h = sum_all_h;
			++tate[sum_h];
			for(int j=n-1; j > i; --j) {
				sum_h -= h[j];
				++tate[sum_h];
			}
		}
		for(int i=0; i < m; ++i) {
			if(i) sum_all_w -= w[i-1];
			int sum_w = sum_all_w;
			++yoko[sum_w];
			for(int j=m-1; j > i; --j) {
				sum_w -= w[j];
				++yoko[sum_w];
			}
		}
		int answer = 0;
		for(int i=1; i < size; ++i) {
			answer += tate[i] * yoko[i];
		}
		cout << answer << endl;
	}

	return 0;
}

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

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int w[1501]={0}, h[1501]={0};
int W[2250000]={0}, H[2250000]={0};
 
int sum(int* a , int i,int n,int size){
    int s = 0;
    for(int j=n ; j-- ; ){
        if( i >= size ){
            return 0;
        }
        s += a[i++];
    }
    return s;
}
 
int main(){
    int n,m,w_,h_;
    while( cin >> n >> m , n||m ){
        int cnt_w[1000000] = {0};
         
        for(int i=0 ; i<n ; i++ ){
            cin >> h[i];
        }
        int pos=0;
        for(int j=1 ; j <= n ; j++ ){
            for(int i=0 ; i+j <= n ; i++ ){
                H[pos++] = sum( h , i , j , n );
            }
        }
         
        for(int i=0 ; i<m ; i++ ){
            cin >> w[i];
        }
        int j_=0;
        for(int j=1 ; j <= m ; j++ ){
            for(int i=0 ; i+j <= m ; i++ ){
                W[j_++] = sum( w , i , j , m );
            }
        }
        for(int i=0 ; i<j_ ; i++ ){
            cnt_w[ W[i] ] += 1;
        }
         
        int ans = 0;
        for(int i=0 ; i < i_ ; i++ ){
        	ans += cnt_w[ H[i] ];
        }
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:27: error: 'i_' was not declared in this scope; did you mean 'i'?
   49 |         for(int i=0 ; i < i_ ; i++ ){
      |                           ^~
      |                           i
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <hamkoutil.hpp>

using namespace std;
#define NUMMAX 1500
#define CMAX (NUMMAX * (NUMMAX + 1) / 2)

void makecvec(vector<int>& in, vector<int>& out) 
{
    for (int ni = 0; ni < (int)in.size(); ni++) {
        for (int pi = 0; pi < (int)in.size() - ni; pi++) {
            int sum = 0;
            for (int si = 0; si < ni + 1; si++)
                sum += in[pi + si];
            out.push_back(sum);
        }
    }
}

int main(void)
{
    int n, m;
    while (cin >> n >> m) {
        if (!n && !m) break;
        vector<int> h(n), w(m);
        for (int i = 0; i < n; i++) cin >> h[i];
        for (int i = 0; i < m; i++) cin >> w[i];

        vector<int> hs, ws;
        hs.reserve(CMAX), ws.reserve(CMAX);
        makecvec(h, hs), makecvec(w, ws);
        sort(hs.begin(), hs.end()), sort(ws.begin(), ws.end());

        int result = 0;
        int hi = 0, wi = 0;
        while (hi != (int)hs.size() && wi != (int)ws.size()) {
            if (hs[hi] == ws[wi]) {
                int hn = 0, wn = 0;
                while (hi != (int)hs.size() && hs[hi] == hs[hi-hn]) 
                    hi++, hn++;
                while (wi != (int)ws.size() && ws[wi] == ws[wi-wn]) 
                    wi++, wn++;
                result += wn * hn;
            } else if (hs[hi] < ws[wi]) 
                hi++;
            else 
                wi++;
        }
        cout << result << endl;
    }

    return 0;
}

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

import java.util.*;

public class Main {
	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];
			Map height = new HashMap<Integer, Integer>();
			int[] w = new int[m];
			Map width = new HashMap<Integer, Integer>();
			for (int i = 0; i < n; i++) {
				h[i] = sc.nextInt();
				int hh = h[i];
				if (height.containsKey(hh))
					height.put(hh, (int) height.get(hh) + 1);
				else
					height.put(hh, 1);
				for (int j = i - 1; j >= 0; j--) {
					hh += h[j];
					if (height.containsKey(hh))
						height.put(hh, (int) height.get(hh) + 1);
					else
						height.put(hh, 1);
				}
			}
			for (int i = 0; i < m; i++) {
				w[i] = sc.nextInt();
				int ww = w[i];
				if (width.containsKey(ww))
					width.put(ww, (int) width.get(ww) + 1);
				else
					width.put(ww, 1);
				for (int j = i - 1; j >= 0; j--) {
					ww += w[j];
					if (width.containsKey(ww))
						width.put(ww, (int) width.get(ww) + 1);
					else
						width.put(ww, 1);
				}
			}
			int result = 0;
			for (int i = 0; i < 1500001; i++)
				if (height.containsKey(i) && width.containsKey(i))
					result += (int) height.get(i) * (int) width.get(i);
			System.out.println(result);
		}
		sc.close();
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include <string>
#include <iostream>

#pragma warning(disable : 4996)

using namespace std;

int H, W;

string M[16];

bool visited[16][64][4];

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

void rec(int x, int y, int dir)
{
	if (!visited[y][x][dir])
	{
		visited[y][x][dir] = true;

		while (M[y + dy[dir]][x + dx[dir]] != '#')
		{
			x += dx[dir];
			y += dy[dir];

			visited[y][x][dir] = true;
		}

		rec(x, y, (dir + 3) % 4);
		rec(x, y, (dir + 1) % 4);
	}
}

int main()
{
	while (true)
	{
		scanf("%d", &W);
		scanf("%d", &H);
		
		if (H == 0 && W == 0) break;

		for (int i = 0; i < H; i++) cin >> M[i];

		int sx, sy, mx, my;

		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				if (M[i][j] == 'K')
				{
					sx = j;
					sy = i;
				}

				if (M[i][j] == 'M')
				{
					mx = j;
					my = i;
				}
			}
		}

		bool ok;

		// 1st.

		memset(visited, false, sizeof(visited));

		rec(sx, sy, 0);

		ok = false; for (int dir = 0; dir < 4; dir++) ok = ok || visited[my][mx][dir];

		if (!ok)
		{
			printf("He cannot bring tea to his master.\n");
		}
		else
		{
			// 2nd.

			memset(visited, false, sizeof(visited)); rec(sx, sy, 0);

			ok = false; for (int dir = 0; dir < 4; dir++) ok = ok || visited[my][mx][dir];

			if (!ok)
			{
				printf("He cannot return to the kitchen.\n");
			}
			else
			{
				printf("He can accomplish his mission.");
			}
		}
	}

	return 0;
}

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

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

typedef pair<int, int> pi;
pi mp;
string in[16];
const int dy[] = { -1,0,1,0 }, dx[] = { 0,-1,0,1 };
#define rep(i,n) for(int i=0;i<(int)n;i++)

bool solve(int sy,int sx,int w,int gy,int gx ) {
	static bool v[16][64][4];
	memset(v, 0, sizeof(v));
	int sd = 0;
	queue<pi> q;
	mp.first = sy * w + sx; mp.second = sd;
	q.push(mp);
	v[sy][sx][sd] = 1;
	while (!q.empty()) {
		int y = q.front().first / w, x = q.front().first%w;
		int dir = q.front().second; q.pop();
		while (in[y + dy[dir]][x + dx[dir]] != '#') y += dy[dir], x + dx[dir];
		if (y == gy&& x == gx)return 1;
		dir = (dir + 1) % 4 ;
		rep(d, 2) {
			if ((!v[y][x][dir])) {
				v[y][x][dir] = 1;
				mp.first = y*w + x;
				mp.second = dir;
			}
			dir = (dir + 2) % 4;
		}
	}
	return 0;
}

int main() {
	int h, w,sx,sy,gx,gy;
	while (cin >> w >> h, h&&w) {
		rep(i, h) getline(cin, in[i]);
		rep(j, w)rep(i, h) {
			if (in[i][j] == 'K')sy = i, sx = j;
			if (in[i][j] == 'M')gy = i, gx = j;
		}
		bool iki, kaeri;
		iki = solve(sy, sx, w, gy, gx);
		kaeri = solve(gy, gx, w, sy, sx);
		if (iki&&kaeri)cout << "He can accomplish his mission." << endl;
		else if (iki)cout << "He cannot return to the kitchen." << endl;
		else if (!iki)cout << "He cannot bring tea to his master." << endl;
	}
}

Compiler output:
a.cc: In function 'bool solve(int, int, int, int, int)':
a.cc:15:9: error: 'memset' was not declared in this scope
   15 |         memset(v, 0, sizeof(v));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<queue>
  +++ |+#include <cstring>
    4 | #include<string>
Language: C++

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

typedef pair<int, int> pi;
pi mp;
string in[16];
const int W = 100;
const int dy[] = { -1,0,1,0 }, dx[] = { 0,-1,0,1 };
#define rep(i,n) for(int i=0;i<(int)n;i++)

bool solve(int sy,int sx,int sd,int gy,int gx ) {
	static bool v[16][64][4];
	memset(v, 0, sizeof(v));
	queue<pi> q;
	mp.first = sy * W + sx; mp.second = sd;
	q.push(mp);
	v[sy][sx][sd] = 1;
	while (!q.empty()) {
		int y = q.front().first / W, x = q.front().first%W;
		int dir = q.front().second; q.pop();
		while (in[y + dy[dir]][x + dx[dir]] != '#') y += dy[dir], x += dx[dir];
		if (y == gy&& x == gx)return 1;
		dir = (dir + 1) % 4 ;
		rep(d, 2) {
			if ((!v[y][x][dir])) {
				v[y][x][dir] = true;
				mp.first = y*W + x;
				mp.second = dir;
				q.push(mp);
			}
			dir = (dir + 2) % 4;
		}
	}
	return 0;
}

int dir(int x, int y) {
	rep(i, 4) {
		if (in[y + dy[i]][x + dx[i]] == ',')return i;
	}
}

int main() {
	int w,h,sx,sy,gx,gy;
	while (cin >> w >> h, h!=0&&w!=0) {
		rep(i, h) cin >> in[i];
		rep(j, w)rep(i, h) {
			if (in[i][j] == 'K')sy = i, sx = j;
			if (in[i][j] == 'M')gy = i, gx = j;
		}
		bool iki, kaeri;
		iki = solve(sy, sx,dir(sy,sx),  gy, gx);
		kaeri = solve(gy, gx,dir(gy,gx), sy, sx);
		if (iki&&kaeri)cout << "He can accomplish his mission." << endl;
		else if (iki)cout << "He cannot return to the kitchen." << endl;
		else if (!iki)cout << "He cannot bring tea to his master." << endl;
	}
}}

Compiler output:
a.cc:62:2: error: expected declaration before '}' token
   62 | }}
      |  ^
a.cc: In function 'int dir(int, int)':
a.cc:45:1: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      | ^
Language: C++

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

typedef pair<int, int> pi;
pi mp;
string in[16];
const int W = 100;
const int dy[] = { -1,0,1,0 }, dx[] = { 0,-1,0,1 };
#define rep(i,n) for(int i=0;i<(int)n;i++)

bool solve(int sy,int sx,int sd,int gy,int gx ) {
	static bool v[16][64][4];	
	memset(v, 0, sizeof(v));
	queue<pi> q;
	mp.first = sy * W + sx; mp.second = sd;
	q.push(mp);
	v[sy][sx][sd] = 1;
	while (!q.empty()) {
		int y = q.front().first / W, x = q.front().first%W;
		int dir = q.front().second; q.pop();
		cout << x << " " << y << endl;
		while (in[y + dy[dir]][x + dx[dir]] != '#') { y += dy[dir]; x += dx[dir];
		}
		if (y == gy&& x == gx)return 1;
		dir = (dir + 1) % 4 ;
		rep(d, 2) {
			if ((!v[y][x][dir])) {
				v[y][x][dir] = true;
				mp.first = y*W + x;
				mp.second = dir;
				q.push(mp);
			}
			dir = (dir + 2) % 4;
		}
	}
	return 0;
}

int dir(int y, int x) {
	rep(i, 4) {
		cout << "i:" << i << endl;
		if (in[y + dy[i]][x + dx[i]] != '#')return i;
	}
}

int main() {
	int w,h,sx,sy,gx,gy;
	while (1) {
		scanf_s("%d %d", &w, &h);
		if (w == 0 && h == 0)break;
		rep(i, h) cin >> in[i];
		
		rep(j, w)rep(i, h) {
			if (in[i][j] == 'K')sy = i, sx = j;
			if (in[i][j] == 'M')gy = i, gx = j;
		}
		cout << sy << " " << sx << endl;
		cout << gy << " " << gx << endl;
		bool iki, kaeri;
		dir(gy, gx);
		
		iki = solve(sy, sx,dir(sy,sx),  gy, gx);
		kaeri = solve(gy, gx,dir(gy,gx), sy, sx);
		if (iki&&kaeri)cout << "He can accomplish his mission." << endl;
		else if (iki)cout << "He cannot return to the kitchen." << endl;
		else if (!iki)cout << "He cannot bring tea to his master." << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   53 |                 scanf_s("%d %d", &w, &h);
      |                 ^~~~~~~
      |                 scanf
a.cc: In function 'int dir(int, int)':
a.cc:48:1: warning: control reaches end of non-void function [-Wreturn-type]
   48 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<string.h>
#include<cstdio>
using namespace std;

typedef pair<int, int> pi;
pi mp;
string in[16];
const int W = 100;
const int dy[] = { -1,0,1,0 }, dx[] = { 0,-1,0,1 };
#define rep(i,n) for(int i=0;i<(int)n;i++)

bool solve(int sy,int sx,int sd,int gy,int gx ) {
	static bool v[16][64][4];	
	memset(v, 0, sizeof(v));
	queue<pi> q;
	mp.first = sy * W + sx; mp.second = sd;
	q.push(mp);
	v[sy][sx][sd] = 1;
	while (!q.empty()) {
		int y = q.front().first / W, x = q.front().first%W;
		int dir = q.front().second; q.pop();
		cout << x << " " << y << endl;
		while (in[y + dy[dir]][x + dx[dir]] != '#') { y += dy[dir]; x += dx[dir];
		}
		if (y == gy&& x == gx)return 1;
		dir = (dir + 1) % 4 ;
		rep(d, 2) {
			if ((!v[y][x][dir])) {
				v[y][x][dir] = true;
				mp.first = y*W + x;
				mp.second = dir;
				q.push(mp);
			}
			dir = (dir + 2) % 4;
		}
	}
	return 0;
}

int dir(int y, int x) {
	rep(i, 4) {
		cout << "i:" << i << endl;
		if (in[y + dy[i]][x + dx[i]] != '#')return i;
	}
}

int main() {
	int w,h,sx,sy,gx,gy;
	while (1) {
		scanf_s("%d %d", &w, &h);
		if (w == 0 && h == 0)break;
		rep(i, h) cin >> in[i];
		
		rep(j, w)rep(i, h) {
			if (in[i][j] == 'K')sy = i, sx = j;
			if (in[i][j] == 'M')gy = i, gx = j;
		}
		cout << sy << " " << sx << endl;
		cout << gy << " " << gx << endl;
		bool iki, kaeri;
		dir(gy, gx);
		
		iki = solve(sy, sx,dir(sy,sx),  gy, gx);
		kaeri = solve(gy, gx,dir(gy,gx), sy, sx);
		if (iki&&kaeri)cout << "He can accomplish his mission." << endl;
		else if (iki)cout << "He cannot return to the kitchen." << endl;
		else if (!iki)cout << "He cannot bring tea to his master." << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   54 |                 scanf_s("%d %d", &w, &h);
      |                 ^~~~~~~
      |                 scanf
a.cc: In function 'int dir(int, int)':
a.cc:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<string.h>
#include<cstdio>
using namespace std;

typedef pair<int, int> pi;
pi mp;
string in[16];
const int W = 100;
const int dy[] = { -1,0,1,0 }, dx[] = { 0,-1,0,1 };
#define rep(i,n) for(int i=0;i<(int)n;i++)

bool solve(int sy,int sx,int sd,int gy,int gx ) {
	static bool v[16][64][4];	
	memset(v, 0, sizeof(v));
	queue<pi> q;
	mp.first = sy * W + sx; mp.second = sd;
	q.push(mp);
	v[sy][sx][sd] = 1;
	while (!q.empty()) {
		int y = q.front().first / W, x = q.front().first%W;
		int dir = q.front().second; q.pop();
		while (in[y + dy[dir]][x + dx[dir]] != '#') { y += dy[dir]; x += dx[dir];
		}
		if (y == gy&& x == gx)return 1;
		dir = (dir + 1) % 4 ;
		rep(d, 2) {
			if ((!v[y][x][dir])) {
				v[y][x][dir] = true;
				mp.first = y*W + x;
				mp.second = dir;
				q.push(mp);
			}
			dir = (dir + 2) % 4;
		}
	}
	return 0;
}

int dir(int y, int x) {
	rep(i, 4) {
		if (in[y + dy[i]][x + dx[i]] != '#')return i;
	}
}

int main() {
	int w,h,sx,sy,gx,gy;
	while (1) {
		scanf_s("%d %d", &w, &h);
		if (w == 0 && h == 0)break;
		rep(i, h) cin >> in[i];
		
		rep(j, w)rep(i, h) {
			if (in[i][j] == 'K')sy = i, sx = j;
			if (in[i][j] == 'M')gy = i, gx = j;
		}
		bool iki, kaeri;
		dir(gy, gx);
		
		iki = solve(sy, sx,dir(sy,sx),  gy, gx);
		kaeri = solve(gy, gx,dir(gy,gx), sy, sx);
		if (iki&&kaeri)cout << "He can accomplish his mission." << endl;
		else if (iki)cout << "He cannot return to the kitchen." << endl;
		else if (!iki)cout << "He cannot bring tea to his master." << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   52 |                 scanf_s("%d %d", &w, &h);
      |                 ^~~~~~~
      |                 scanf
a.cc: In function 'int dir(int, int)':
a.cc:47:1: warning: control reaches end of non-void function [-Wreturn-type]
   47 | }
      | ^
Language: Java

import java.util.Scanner;

public class Princess_Gamble {
    static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
        int N, M ,P;
        while((N=scan.nextInt())!=0 && (M=scan.nextInt())!=0 && (P=scan.nextInt())!=0){
            int sum = 0;
            int[] ticket = new int[100];
            for(int i=0; i<N; i++){
                int k = scan.nextInt();
                ticket[i] = k;
                sum += k;
            }
            int pool = sum*100 * (100-P)/100;

            if(ticket[M-1] == 0){
                System.out.println(0);
                continue;
            }

            System.out.println(pool/ticket[M-1]);
        }
    }
}

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

import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			while(sc.hasNext()) {
				int N = sc.nextInt();
				int M = sc.nextInt();
				int P = sc.nextInt();
				if(N + M + P == 0) break;
				
				int w = 0;
				int sum = 0;
				boolean win = true;
				for(int i=1; i<N; i++) {
					int X = sc.nextInt();
					if(i == M) {
						if(x == 0) win = false;
						else  w = X;
					}
					sum += X * 100;
				}
				if(!win) System.out.println(0);
				else {
					sum = sum * (100 - P) / 100;
					System.out.println(sum / w);
				}
			}
		}
	}
}


Compiler output:
Main.java:18: error: cannot find symbol
						if(x == 0) win = false;
						   ^
  symbol:   variable x
  location: class Main
1 error
Language: C

#include<iostream>
using namespace std;

int main(){
  int n,m,p;
  double sum;
  double sumg;
  int gold;
  int x[101];

  while(1){
    sum=0;
    sumg=0;
    gold=0;
    cin >> n >> m >> p;
    if(n==0 && m==0 && p==0)break;
    for(int i=0;i<n;i++){
      cin >> x[i];
      sum+=100*x[i];
    }
    sumg=sum-sum*(p*0.01);
    gold=sumg/x[m-1];
    if(x[m-1]!=0){
      cout << gold <<endl;
    }else{
      cout << 0 << endl; 
    }
  }
}

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

#include <stdio.h>
int main(void)
{
  int i,n,m,p,ans;
  while(scanf("%d %d %d",&n,&m,&p)!=0&&n+m+p){
    int sum=0
    int x[n];
    for(i=0;i<n;i++){
      scanf("%d",x[i]);
      sum+=x[i];
    }
    sum*=100;
    sum*=1-(p/100);
    ans=sum/x[m];
    printf("%d\n",ans);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:5: error: expected ',' or ';' before 'int'
    7 |     int x[n];
      |     ^~~
main.c:9:18: error: 'x' undeclared (first use in this function)
    9 |       scanf("%d",x[i]);
      |                  ^
main.c:9:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main() {
  while (true) {
    int N, M, P;
    scanf("%d %d %d", &N, &M, &P);
    if (N == 0 && M == 0 && P == 0) break;
    int X[100];
    int sum = 0;
    for (int i = 0; i < N; i++) {
      scanf("%d", &X[i]);
      sum += X[i] * 100;
    }
    sum = sum * (100 - P) / 100;
    printf("%d\n", X[M - 1] == 0 ? 0 : sum / X[M - 1]);
  }
}



Compiler output:
main.c: In function 'main':
main.c:4:10: error: 'true' undeclared (first use in this function)
    4 |   while (true) {
      |          ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:4:10: note: each undeclared identifier is reported only once for each function it appears in
    4 |   while (true) {
      |          ^~~~
Language: C

#include<iostream>
using namespace std;
int main() {
	int n;
	int m;
	int p;
	int answer=0;
	int x[1000];
	while (1) {
		cin >> n;
		cin >> m;
		cin >> p;
		
		if (n == 0 && m == p && p == 0) {
			break;
		}

		for (int i = 0; i < n; i++) {
			cin >> x[i];
			answer += x[i];
		}
		if (x[m - 1 ]!= 0) {
			answer = (answer*(100- p)) / x[m - 1]; 
		}
		else {
			answer = 0;
		}
		cout << answer;

	}
}


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

int main()
{
  int n,m,p,i,x,sum,win;
  for(;scanf("%d%d%d",&n,&m,&p),n;)
    {
      sum=0;
h=0;
      for(i=1;i<=n;i++)
	{
	  scanf("%d",&x);
	  sum+=(x*100);
	  if(i==m)
	    win=x;
	}
      if(win==0)
	puts("0");
      else
	printf("%.f\n",(sum*((100-p)/(double)100))/win);
    }
  exit(0);
}

Compiler output:
main.c: In function 'main':
main.c:4:8: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |   for(;scanf("%d%d%d",&n,&m,&p),n;)
      |        ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main()
main.c:4:8: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |   for(;scanf("%d%d%d",&n,&m,&p),n;)
      |        ^~~~~
main.c:4:8: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:1: error: 'h' undeclared (first use in this function)
    7 | h=0;
      | ^
main.c:7:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:9: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   16 |         puts("0");
      |         ^~~~
main.c:16:9: note: include '<stdio.h>' or provide a declaration of 'puts'
main.c:18:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 |         printf("%.f\n",(sum*((100-p)/(double)100))/win);
      |         ^~~~~~
main.c:18:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:18:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:3: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
   20 |   exit(0);
      |   ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
  +++ |+#include <stdlib.h>
    1 | int main()
main.c:20:3: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
   20 |   exit(0);
      |   ^~~~
main.c:20:3: note: include '<stdlib.h>' or provide a declaration of 'exit'
Language: C++

#include<iostream>
using namespace std;

int main(){
  int n,m,p;
  while(cin>>n>>m>>p){
    if(n==0)break;
    double G=0;
    int num[n];
    for(int i=0;i<n;i++){
      cin>>num[i];
      G+=100*num[i];
    }
    G*=(100-p.0)/100.0;
    cout << G << endl;
    if(num[m-1]!=0){
      cout << (int)G/num[m-1] << endl;
    }else{
      cout << 0 << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: expected ')' before numeric constant
   14 |     G*=(100-p.0)/100.0;
      |        ~     ^~
      |              )
Language: C++

#include<iostream>
#include<vector>
#include<map>
#define P pair<int,int>
using namespace std;
int main(){
int n,m ,p;
while(cin>>n>>m>>p,n||m||p){
	int maisu=0,tmp,atari;
	int  ans=0;
	for(int i=0;i<n;i++){
		cin>>tmp;
		maisu+=tmp*100;
		if(i+1==m)atari=tmp;
	}
	if(atari==0)ans=0;
	ans=maisu/atari;
	else ans-=maisu/atari*(p/100);
	cout<<ans<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'else' without a previous 'if'
   18 |         else ans-=maisu/atari*(p/100);
      |         ^~~~
Language: C++

#include<stdio.h>

int main(){

int N,M,P;
while(1){

scanf("%d %d %d",&N,&M,&P);
if(N==0&&M==0&&P==0)break;

int x,s=0,y=0;
for(int i=0;i<N;i++){
scanf("%d",&x)s+=x;
if(M==i-1)y=x;

}

printf("%d\n",(y/s*(100-P)/100));
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: expected ';' before 's'
   13 | scanf("%d",&x)s+=x;
      |               ^
      |               ;
Language: C++

#include<iostream>
using namespace std;
int main(){
	int a,b,c,i,d,sum;
	while(1){
		sum=0;
	cin>>a>>b>>c;
	if(a==0&&a==b&&c==0)break;
for(i=0;i<a;i++){
cin>>d;
sum+=d;
if(i==b-1)b=d;
}
if(b==0)cout<<b<<endl;
if(c==100)cout<<0<<endlel;
else if(c==0)cout<<sum*100/b<<endl;
else cout<<(sum*100-sum*c)/b<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: 'endlel' was not declared in this scope
   15 | if(c==100)cout<<0<<endlel;
      |                    ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,m,p;
	while(cin>>n>>m>>p,n,m,p){
		int sum=0,num[101];
		for(int i=1;i<=n;i++){
			cin>>num[i];
			sum+=num[i];
		}
		sum*=100-p;
		sum/=num;
		if(num[m])cout<<max(sum,100)<<endl;
		else cout<<0<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: invalid operands of types 'int' and 'int*' to binary 'operator/'
   12 |                 sum/=num;
      |                 ~~~^~~~~
a.cc:12:20: note:   in evaluation of 'operator/=(int, int*)'
Language: C++

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

int main(){

    while(1){
        int N, M, P;
        cin>> N>> M>> P;
        if(!(N||M||P)) break;
        int X[N];
        for(int i=0; i<N; i++) cin>> X[i];

        int s=100*accumulate(X, X+N, 0);
        int haito=s/100*(100-P);

        cout<< (X[M-1]==0? 0: haito/X[M-1])<< endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: 'accumulate' was not declared in this scope
   14 |         int s=100*accumulate(X, X+N, 0);
      |                   ^~~~~~~~~~
Language: C++

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

int main()
{
  int N, M, P;
  while( cin >> N >> M >> P, N && M && P ) {
    int X[100];
    int sum = 0;
    for(int i=0; i<N; i++) cin >> X[i], sum += X[i];
    if( X[M-1] == 0 || P == 100 ) cout << 0 << endl;
    else cout << sum*100 * (100-P) / X[M-1] / 100 << endl;
  }
}

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

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

int main(){
  int N,M,P;
  while(cin>>N>>M>>P,N&&M&&P){
    int X[1000],sum=0;
    rep(i,N){
     cin>>X[i];
     sum+=100*X[i];
    }
    sum=sum-sum*P/100;
    rep(i,N+1){
      if(M==i){
        if(X[i-1]!=0){
         cout<<sum/X[i-1]<<endl;
         return 0;
	 else {
          cout<<'0'<<endl;
          return 0;
	 }
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: expected '}' before 'else'
   20 |          else {
      |          ^~~~
a.cc:17:22: note: to match this '{'
   17 |         if(X[i-1]!=0){
      |                      ^
Language: C++

#include<iostream>
using namespace std;

int main(){

  int n, m, p, x[101];
  
  while(cin >> n >> m >> p && n && m && p){
    int sum=0;
    for(int i=1; i<=n; i++){
      cin >> x[i];
      sum+=x[i];
    }
    if(x[m]==0){
      cout << 0 << endl;
    } else {
      cout << sum * (100-p) / x[m] << endl;
    }
  }

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

#include<iostream>
using namespace std;

int main(){
  int n, m, p, x[101], ans;

  while(cin >> n >> m >> p && n){
    for(int i=1; i<=n; i++){
      int sum=0;
      cin >> x[i];
      sum+=x[i];
    }
    if(x[m]!=0){
      ans = sum * (100-p) / x[m];
      cout << ans << endl;
    } else {
      cout << 0 << endl;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'sum' was not declared in this scope
   14 |       ans = sum * (100-p) / x[m];
      |             ^~~
Language: C++

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

int Sum(const int* X, int size) {
  int sum = 0;
  for(int i = 0; i < size; i++) {
    sum += X[i];
  }
  return sum;
}

int Devide(int d, const int *X, int M) {
  if(X[M] != 0) 
    return (int)(d / X[M]);
  else
    return 0;
}

int main() {
  int N; //競技者の数
  int M; //優勝者の番号
  int P; //控除率(百分率)
  vector<int> X;
  int deduction;

  while(1) {
    cin >> N >> M >> P;
    if(N == 0 && M == 0 && P == 0)
        break;
      
    for(int i = 0; i < N; i++) {
      int x;
      cin >> x;
      X.push_back(x);
    }
    
    deduction = Sum(&X.front(), X.size()) * (100-P);
    cout << Devide(deduction, &X.front(), M-1) << endl;
    X.clear();
  }

}



Compiler output:
a.cc:30:15: error: stray '\23' in program
   30 |         break;<U+0013><U+0003>
      |               ^~~~~~~~
a.cc:30:16: error: stray '\3' in program
   30 |         break;<U+0013><U+0003>
      |                       ^~~~~~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){

  int n,m,p;

  while(cin>>n>>m>>p,n||m||p){

	vector<int> x(n+1);
	int total=0;
	
	for(int i=1;i<=n;++i){
	  cin>>x[i];
	  total+=x[i];
	}
	
	total=total*(100-p)
	
	if(x[m]==0)
	  cout<<0<<endl;
	else{
	  double tmp = total/x[m];
	  cout<<(int)total<<endl;
	}
  }

}



Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: expected ';' before 'if'
   19 |         total=total*(100-p)
      |                            ^
      |                            ;
   20 | 
   21 |         if(x[m]==0)
      |         ~~                  
a.cc:23:9: error: 'else' without a previous 'if'
   23 |         else{
      |         ^~~~