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

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
        int n = sc.nextInt();
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		// 文字列の入力
		String s = sc.next();
        String sa[];
        sa = new String[s.length()];
        int countA = 0;
        int countB = 0;
        int countY = 0;
        for(int i=0; i<s.length(); i++){
            if(i < c.length() -1){
            sa[i] = s.substring(i, i+1);
            }
            else{
            sa[i] = s.substring(i);
            }
            switch (sa[i]){
                case "a":
                    countA = countA + 1;
                    if(countY < a + b){
                        countY = countY + 1;
                        		System.out.println("Yes" + "\n");
                    }
                    else{
                                System.out.println("No" + "\n");
                    }
                    break;
                case "b":
                    countB = countB + 1;
                    
                    if(countY < a + b && countB =< b){
                        countY = countY + 1;
                                System.out.println("Yes" + "\n");
                    }
                    else{
                                System.out.println("No" + "\n");
                    }
                    break;
                case "c":
                                System.out.println("No" + "\n");
                    break;
            }
        }
		// 出力
	}
}

Compiler output:
Main.java:38: error: > or ',' expected
                    if(countY < a + b && countB =< b){
                                                    ^
1 error
Language: C++

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


int main() {
	int n, a, b;
	cin >> n >> a >> b;
	int c = a+b;
	string s;
	cin >> s;
	int r1 = 0, total = 0, r2 = 0;
	for(int i=0; i<n; i++)　{
		if(s[i] == 'c') {
			cout << "No" << endl;
		} else if(s[i] == 'a') {
			if(total < c) {
				total++;
				cout << "Yes" << endl;
			}else 
				cout << "No" << endl;
		} else {
			if(total < c) {
				
				r2++;
				if(r2 <=b) {
					total++;
					cout << "Yes" << endl;
				} else
					cout << "No" << endl;
			} else {
				cout << "No" << endl;
			}
		}
	}
}


Compiler output:
a.cc:13:31: error: extended character 　 is not valid in an identifier
   13 |         for(int i=0; i<n; i++)　{
      |                               ^
a.cc: In function 'int main()':
a.cc:13:31: error: '\U00003000' was not declared in this scope
   13 |         for(int i=0; i<n; i++)　{
      |                               ^~
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main()
{
    int n,a,b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    std::string nihon("a");
    std::string kaigai("b");
    for (int i = 0; i < n; ++i)
    {
    	if(a+b>0){
    		if(s[i]=="a"){
                cout << "Yes" << endl;
                a--;
            }else if (s[i]=="b" && b>0){
                cout << "Yes" << endl;
                b--;
            }else{
                cout << "No" << endl;   
            }
    	}else{
            cout << "No" << endl;
        }
    }
    // 出力
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |                 if(s[i]=="a"){
a.cc:18:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |             }else if (s[i]=="b" && b>0){
Language: Java

import java.util.Scanner;

public class Maiin {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int ta = 0, tb = 0;
		String string = scanner.next();
		for (int i = 0; i < n; i++) {
			switch (string.charAt(i)) {
			case 'a':
				if (ta + tb < a + b) {
					ta++;
					System.out.println("Yes");
					break;
				}
				System.out.println("No");
				break;

			case 'b':
				if (ta + tb < a + b && tb < b) {
					tb++;
					System.out.println("Yes");
					break;
				}
				System.out.println("No");
				break;

			case 'c':
				System.out.println("No");
				break;
			}
		}
	}
}

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

#include <iostream>
#include <string>

using namespace std;
int main() {
	int N, A, B;
	cin >> N >> A >> B;
	string S;
	cin >> S;
	int exceed = 0;
	int orderB = 0;
	for (int i = 0; i < N; i++) {
		char c = S.at[i];
		switch(c){
		case 'a':
			if (exceed < A + B) {
				cout << "Yes" << endl;
				exceed++;
			}
			else {
				cout << "No" << endl;
			}
			break;
		case 'b':
			orderB++;
			if (exceed < A + B && orderB <= B) {
				cout << "Yes" << endl;
				exceed++;
			}
			else{
				cout << "No" << endl;
			}
			break;
		case 'c':
			cout << "No" << endl;
			break;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   13 |                 char c = S.at[i];
      |                              ^
Language: Java

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


	public static void Main (String[] args) throws java.lang.Exception
	{
		Scanner reader = new Scanner(System.in);
        int N = reader.nextInt();
        int A = reader.nextInt();
        int B = reader.nextInt();
        reader.nextLine();
        String input = reader.nextLine();

        int foreigners = 0;
		int disqualified = 0;

        int counter = 0;
        for(int i = 0; i < input.length(); i++){
          boolean printed = false;

          if(input.charAt(i) == 'b'){
            foreigners++;
          }

          if(input.charAt(i) == 'c'){
            disqualified++;
            System.out.println("No");
            printed = true;
          }
          else if(i <= (A+B+disqualified)){
            if(input.charAt(i) == 'a'){
              System.out.println("Yes");
              printed = true;
            }
            else if(input.charAt(i) == 'b'){
              if(foreigners <= B){
                System.out.println("Yes");
                printed = true;
              }
            }
          }
          
          if(printed == false){
            System.out.println("No");
          }
        }
	}


Compiler output:
Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
	public static void Main (String[] args) throws java.lang.Exception
	              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C++

#include <iostream>
#include <string>

using namespace std;
int main() {
	int N, A, B;
	cin >> N >> A >> B;
	string S;
	cin >> S;
	int exceed = 0;
	int orderB = 0;
	for (int i = 0; i < N; i++) {
		switch (S.at[i]) {
		case 'a':
			if (exceed < A + B) {
				cout << "Yes" << endl;
				exceed++;
			}
			else {
				cout << "No" << endl;
			}
			break;
		case 'b':
			orderB++;
			if (exceed < A + B && orderB <= B) {
				cout << "Yes" << endl;
				exceed++;
			}
			else{
				cout << "No" << endl;
			}
			break;
		case 'c':
			cout << "No" << endl;
			break;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:29: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   13 |                 switch (S.at[i]) {
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a) ;i < (b) ;i++)
#define repr(i, a, b) for (int i = (b) - 1 ;i >= a ;i--) 
int main(){
	int N, A, B ;
	string S ;
	cin>>N >>A>>B ;
	cin>>S ;
	int a = 0, b = 0 ;
	for (int i = 0 ;i < N ;i++){
		if (s[i] == 'c')cout<<"No"<<endl ;
		if (s[i] == 'a'){
			if (a + b < A + B){
				a++ ;
				cout<<"Yes"<<endl ;
			}
			else cout<<"No"<<endl ;
		}
		if (s[i] == 'b'){
			if (a + b < A + B && b < B){
				b++ ;
				cout<<"Yes"<<endl ;
			}
			else cout<<"No"<<endl ;
		}
	}
	return 0 ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: 's' was not declared in this scope
   12 |                 if (s[i] == 'c')cout<<"No"<<endl ;
      |                     ^
a.cc:13:21: error: 's' was not declared in this scope
   13 |                 if (s[i] == 'a'){
      |                     ^
a.cc:20:21: error: 's' was not declared in this scope
   20 |                 if (s[i] == 'b'){
      |                     ^
Language: C++

#include <iostream>

using namespace std;

int main(){
    int n,a,b,cnt,c;
    cnt=0;
    c=0;
    string s;
    cin>>n>>a>>b>>s;
    for(int i=0;i<s.length(),++i){
        switch(s[i]){
            case 'a':
                if(cnt<a+b) {
                    cout<<'Yes'<<endl;
                    cnt++;
                }
                else{
                    cout<<"No"<<endl;
                }
                break;
            case  'b':
                if(cnt<a+b&&c<b){
                    cout<<"Yes"<<endl;
                    cnt++;
                    c++;
                }else{
                    cout<<"No"<<endl;
                }
                break;
            case 'c':
                cout<<"No"<<endl;
                break;
        }
    }
    
    return 0;
}

Compiler output:
a.cc:15:27: warning: multi-character character constant [-Wmultichar]
   15 |                     cout<<'Yes'<<endl;
      |                           ^~~~~
a.cc: In function 'int main()':
a.cc:11:33: error: expected ';' before ')' token
   11 |     for(int i=0;i<s.length(),++i){
      |                                 ^
      |                                 ;
Language: C++

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

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

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))
#define INF (1<<28)
#define pb(i) push_back(i)
#define fs first
#define sc second

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

int main(){
	int n,a,b;
	string s;
	cin >> n >> a >> b >> s;
	rep(i,n){
		if(s[i]=='a'){
			if(a>0){
				cout << "Yes" << endl;
				a--;
			}else if(b>0){
				cout << "Yes" << endl;
				b--;
			}else cout << "No"< << endl;
		}else if(s[i]=='b'){
			if(b>0){
				cout << "Yes" << endl;
				b--;
			}else cout << "No"<< endl;
		}else cout << "No" << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:45: error: expected primary-expression before '<<' token
   30 |                         }else cout << "No"< << endl;
      |                                             ^~
Language: C++

#include<bits/stdc++.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int w,h;cin>>w>>h;
  vector<pll>pq(w+h);
  rep(i, w+h){
    cin>>pq[i].first;
    pq[i].second = i;
  }
  sort(pq.begin(), pq.end());

  UnionFind uf(w+h);

  ll cw=w+1, ch=h+1;
  ll result = 0;
  for(auto p: pq){
    if(p.second >= w){
      result += p.first*cw;
      ch--;
    }else{
      result += p.first*ch;
      cw--;
    }
  }

  cout<<result<<endl;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'UnionFind' was not declared in this scope
   26 |   UnionFind uf(w+h);
      |   ^~~~~~~~~
Language: C++

import sys
from operator import itemgetter

read = sys.stdin.read
readline = sys.stdin.readline

W, H, *pq = map(int, read().split())
pq = list(zip(pq[:W], ['p'] * W)) + list(zip(pq[W:], ['q'] * H))
pq.sort(key=itemgetter(0))
answer = 0
x = W + 1
y = H + 1
for cost, i in pq:
    if i == 'p':
        answer += cost * y
        x -= 1
    else:
        answer += cost * x
        y -= 1

print(answer)


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
using Graph = vector<vector<int> >;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

void solve() {
	int w, h; cin >> w >> h;
    vector<pair<ll, int>> es(w + h);
    rep(i, h + w) {
        cin >> es[i].fr;

        if(i < w) es[i].sc = 0;
        else es[i].sc = 1;
    }
    sort(all(e));
    ll ans = 0;
    int a = h + 1, b = w + 1;
    for(auto e: es) {
        if(e.sc == 0) {
            ans += e .fr * a;
            --b;
        } else {
            ans += e.fr * b;
            --a;
        }
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:62:14: error: 'e' was not declared in this scope; did you mean 'es'?
   62 |     sort(all(e));
      |              ^
a.cc:45:16: note: in definition of macro 'all'
   45 | #define all(c) c.begin(),c.end()
      |                ^
Language: C++

include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
typedef long long ll;
typedef pair<ll,ll> P;

int main(){
    ll w, h;
    cin >> w >> h;
    ll p, q;
    priority_queue<P,vector<P>,greater<P>> que;
    rep(i,w) {
        cin >> p;
        que.push(P(p,0));
    }
    rep(i,h) {
        cin >> q;
        que.push(P(q,1));
    }
    ll ans = 0;
    ll n = 0;
    p = w + 1; q = h + 1;
    while(!que.empty()){
        P a = que.top();
        que.pop();
        if(a.second == 0) {
            if(q > 0)  ans += a.first*q;
            else  ans += a.first;
            p--;
        } else {
            if(p > 0) ans += a.first*p;
            else ans += a.first;
            q--;
        }
    }
    cout << ans << endl;
    return 0;
} 

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc:5:9: error: 'pair' does not name a type
    5 | typedef pair<ll,ll> P;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> w >> h;
      |     ^~~
a.cc:11:5: error: 'priority_queue' was not declared in this scope
   11 |     priority_queue<P,vector<P>,greater<P>> que;
      |     ^~~~~~~~~~~~~~
a.cc:11:20: error: 'P' was not declared in this scope
   11 |     priority_queue<P,vector<P>,greater<P>> que;
      |                    ^
a.cc:11:22: error: 'vector' was not declared in this scope
   11 |     priority_queue<P,vector<P>,greater<P>> que;
      |                      ^~~~~~
a.cc:11:31: error: expected primary-expression before ',' token
   11 |     priority_queue<P,vector<P>,greater<P>> que;
      |                               ^
a.cc:11:32: error: 'greater' was not declared in this scope
   11 |     priority_queue<P,vector<P>,greater<P>> que;
      |                                ^~~~~~~
a.cc:11:44: error: 'que' was not declared in this scope
   11 |     priority_queue<P,vector<P>,greater<P>> que;
      |                                            ^~~
a.cc:24:10: error: expected ';' before 'a'
   24 |         P a = que.top();
      |          ^~
      |          ;
a.cc:26:12: error: 'a' was not declared in this scope
   26 |         if(a.second == 0) {
      |            ^
a.cc:36:5: error: 'cout' was not declared in this scope
   36 |     cout << ans << endl;
      |     ^~~~
a.cc:36:20: error: 'endl' was not declared in this scope
   36 |     cout << ans << endl;
      |                    ^~~~
Language: C++

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

struct path{
		int cst,char wh;
		path(){};
		path(int cst_,char wh_){
			cst=cst_;wh=wh_;
		};
	bool operator<(const path& o)const{return cst>o.cst;}
};

signed main(){
	int w,h;cin>>w>>h;
	vector<int>p(w),q(h);
	for(auto&& u:p)cin>>u;
	for(auto&& u:q)cin>>u;
	priority_queue<path> pq;
	int nw=0,nh=0,cst=0,num=0;
	for(auto&& u:p)pq.push(path(u,'w'));
	for(auto&& u:q)pq.push(path(u,'h'));
	
	while(!pq.empty()){
		auto&& x=pq.top();pq.pop();
		if(x.wh=='w'){
			cst+=x.cst*(h-1-nh);
			num+=h-1-nh;
			nw++;
		}else if(x.wh=='h'){
			cst+=x.cst*(w-1-nw);
			num+=w-1-nw;
			nh++;
		}
		if(num>=(h-1)*(w-1)-1)break;
	}
	cout<<cst<<endl;
}

Compiler output:
a.cc:7:25: error: expected unqualified-id before 'char'
    7 |                 int cst,char wh;
      |                         ^~~~
a.cc: In constructor 'path::path(long long int, char)':
a.cc:10:34: error: 'wh' was not declared in this scope; did you mean 'wh_'?
   10 |                         cst=cst_;wh=wh_;
      |                                  ^~
      |                                  wh_
a.cc: In function 'int main()':
a.cc:27:22: error: 'const struct path' has no member named 'wh'
   27 |                 if(x.wh=='w'){
      |                      ^~
a.cc:31:28: error: 'const struct path' has no member named 'wh'
   31 |                 }else if(x.wh=='h'){
      |                            ^~
Language: C++

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

struct path{
		int cst,char wh;
		path(){};
		path(int cst_,char wh_){
			cst=cst_,wh=wh_;
		};
	bool operator<(const path& o)const{return cst>o.cst;}
};

signed main(){
	int w,h;cin>>w>>h;
	vector<int>p(w),q(h);
	for(auto&& u:p)cin>>u;
	for(auto&& u:q)cin>>u;
	priority_queue<path> pq;
	int nw=0,nh=0,cst=0,num=0;
	for(auto&& u:p)pq.push(path(u,'w'));
	for(auto&& u:q)pq.push(path(u,'h'));
	
	while(!pq.empty()){
		auto&& x=pq.top();pq.pop();
		if(x.wh=='w'){
			cst+=x.cst*(h-1-nh);
			num+=h-1-nh;
			nw++;
		}else if(x.wh=='h'){
			cst+=x.cst*(w-1-nw);
			num+=w-1-nw;
			nh++;
		}
		if(num>=(h-1)*(w-1)-1)break;
	}
	cout<<cst<<endl;
}

Compiler output:
a.cc:7:25: error: expected unqualified-id before 'char'
    7 |                 int cst,char wh;
      |                         ^~~~
a.cc: In constructor 'path::path(long long int, char)':
a.cc:10:34: error: 'wh' was not declared in this scope; did you mean 'wh_'?
   10 |                         cst=cst_,wh=wh_;
      |                                  ^~
      |                                  wh_
a.cc: In function 'int main()':
a.cc:27:22: error: 'const struct path' has no member named 'wh'
   27 |                 if(x.wh=='w'){
      |                      ^~
a.cc:31:28: error: 'const struct path' has no member named 'wh'
   31 |                 }else if(x.wh=='h'){
      |                            ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll w,h;cin>>w>>h;
  vector<ll> p(w),q(h);
  ll ans=0;
  for(ll i=0;i<w;i++){
    cin>>p[i];
    ans+=p[i];
  }
  sort(p.begin(),p.end());
  ll sum[w+1];
  sum[0]=0;
  for(ll i=0;i<w;i++){
    sum[i+1]=sum[i]+p[i];
  }
  for(ll j=0;j<h;j++){
    cin>>q[i];
    ans+=q[i];
    ll c=lower_bound(p,p+n,q[i])-p.begin();
    ans+=sum[c]+q[i]*(w-c);
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: 'i' was not declared in this scope
   19 |     cin>>q[i];
      |            ^
a.cc:21:26: error: 'n' was not declared in this scope
   21 |     ll c=lower_bound(p,p+n,q[i])-p.begin();
      |                          ^
Language: C++

    while (i < H || j < W) {
        if (i == H) {
            ans += p[j];
            j++;
        } else if (j == W) {
            ans += q[i];
            i++;
        } else {
            if (q[i] < p[j]) {
                ans += (W - j + 1) * q[i];
                i++;
            } else {
                ans += (H - i + 1) * p[j];
                j++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc:1:5: error: expected unqualified-id before 'while'
    1 |     while (i < H || j < W) {
      |     ^~~~~
a.cc:18:5: error: 'cout' does not name a type
   18 |     cout << ans << endl;
      |     ^~~~
a.cc:20:5: error: expected unqualified-id before 'return'
   20 |     return 0;
      |     ^~~~~~
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
Language: C++

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

public class Main {
	
	public static void main(String[] args) {
		new Main().solve();
	}
	int W,H,N;
	long[]p;
	long[]q;
	long INF=Long.MAX_VALUE/2;
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		W=sc.nextInt();
		H=sc.nextInt();
		N=(W+1)*(H+1);
		p=new long[W];
		q=new long[H];
		for(int i=0;i<W;i++) {
			p[i]=sc.nextLong();
		}
		for(int i=0;i<H;i++) {
			q[i]=sc.nextLong();
		}
		Arrays.sort(p);
		Arrays.sort(q);
		
		int a=W, b=H;
		int i=0,j=0;
		long ans=0;
		while(a>0 || b>0) {
			if(i==W) {
				ans+=q[j]*(a+1);
				j++;
				b--;
			}else if(j==H) {
				ans+=p[i]*(b+1);
				i++;
				a--;
			}else if(p[i]<q[j]) {
				ans+=p[i]*(b+1);
				i++;
				a--;
			}else {
				ans+=q[j]*(a+1);
				j++;
				b--;
			}
		}
		System.out.println(ans);
	}
}


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

#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <map>
#define ll long long
using namespace std;

#define MOD 1000000007

class Solve
{
private:
	ll w, h;
	vector<ll> p;
	vector<ll> q;

public:
	Solve(){
		cin >> w >> h;
		for (ll i = 0; i < w; ++i)
		{
			ll tmp;
			cin >> tmp;
			p.push_back(tmp);
		}
		for (ll i = 0; i < h; ++i)
		{
			ll tmp;
			cin >> tmp;
			q.push_back(tmp);
		}
		sort(p.begin(), p.end());
		sort(q.begin(), q.end());

	}

	void exec(){
		ll i1 = 0;
		ll i2 = 0;
		ll ans = 0;
		for (ll i = 0; i < w + h; ++i)
		{
			if(i1 == w) {
				ans += q[i2] * (w - i1 + 1);
				i2++;
				continue;
			}

			if(i2 == h) {
				ans += p[i1] * (h - i2 + 1);
				i1++;
				continue;
			}

			if(p[i1] < q[i2]) {
				ans += p[i1] * (h - i2 + 1);
				i1++;
			} else {
				ans += q[i2] * (w - i1 + 1);
				i2++;
			}
		}

		cout << ans << endl;
	}
};

ll main(){
	Solve solver = Solve();
	solver.exec();
}


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

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<cstdlib>
#define range(i,a,b) for(int i = (a); i <= (b); i++)
#define rrange(i,a,b) for(int i = (a); i >= (b); i--)
#define rep(i,b) for(int i = 1; i <= (b); i++)
#define rrep(i,b) for(int i = (b); i >= 1; i--)
#define all(a) (a).begin(), (a).end()
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long ll;
const int N=1e5+11;
const int INF = 1001001001;
const ll LLINF = 1001001001001001001LL;
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int h,w,n;
ll ans,t;
struct node{
	ll c;int id;
	operator <(node &b){
		return c<b.c;
	}
}cost[N<<1];
int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
ll ll_read(){
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
int main(){
//	freopen("ex.in","r",stdin);
	w=read();h=read();
	n=h+w;
	rep(i,n){
		cost[i].c=ll_read();
		if(i<=w) cost[i].id=0;
		else cost[i].id=1;
	}
	sort(cost+1,cost+1+n);
	rep(i,n){
		if(cost[i].id==0){
			t=h+1;
			w--;
		}
		else{
			t=w+1;
			h--;
		}
		ans+=t*cost[i].c;
	}
	printf("%lld",ans);
	return 0;
}

Compiler output:
a.cc:26:9: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
   26 |         operator <(node &b){
      |         ^~~~~~~~
Language: C++

#include<iostream>
#include<unordered_map>
#include<cstdio>
#include<algorithm>
#define count Count
#define P pair<int,int>
#define ll long long
using namespace std;

P c[200000];
int count[2];
int n[2];
signed main() {
	int a, b; scanf("%d%d", &a, &b);
	n[0] = a; n[1] = b;
	for (int d = 0; d < a; d++) {
		int e; scanf("%d", &e);
		c[d] = { e,0 };
	}
	for (int d = 0; d < b; d++) {
		int e; scanf("%d", &e);
		c[a+d] = { e,1 };
	}
	sort(c, c + a + b);
	ll ans = 0;
	for (int i = 0; i < a+b; i++) {
		ans += ll(c[i].first)*(n[(c[i].second + 1) & 1]- count[(c[i].second + 1) & 1]+1);
		count[c[i].second]++;
	}
	printf("%lld\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: expected primary-expression before 'long'
    7 | #define ll long long
      |            ^~~~
a.cc:27:24: note: in expansion of macro 'll'
   27 |                 ans += ll(c[i].first)*(n[(c[i].second + 1) & 1]- count[(c[i].second + 1) & 1]+1);
      |                        ^~
Language: C++

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

using namespace std;

int main(){
  int W, H;
  cin >> W >> H;
  vector<int> p(W);
  vector<int> q(H);

  for(int i = 0; i < W; i++) cin >> p[i];
  for(int i = 0; i < H; i++) cin >> q[i];

   sort(p.begin(), p.end());
   sort(q.begin(), q.end());

   int w = W + 1, h = H + 1;
   long long res = 0;
   int i = 0; j = 0;
  while(i < W || j < H){
    if(j < H && (i == W || p[i] > q[j])){
      res += q[j]*w;
      --h;
      ++j;
    }
    else{
      res += p[i] * h;
      --w;
      ++i;
    }
  }
  cout << res << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: 'j' was not declared in this scope
   21 |    int i = 0; j = 0;
      |               ^
Language: C++

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

using namespace std;

int main(){
  int W, H;
  cin >> W >> H;
  vector<int> p(W);
  vector<int> q(H);

  for(int i = 0; i < W; i++) cin >> p[i];
  for(int i = 0; i < H; i++) cin >> q[i];

   sort(p.begin(), p.end());
   sort(q.begin(), q.end());

   int w = W + 1, h = H + 1;
   long long res = 0;
   int i = 0; j = 0;
  while(i < W || j < H){
    if(j < H && (i == W || P[i] > Q[j])){
      res += Q[j]*w;
      --h;
      ++j;
    }
    else{
      res += P[i] * h;
      --w;
      ++i;
    }
  }
  cout << res << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:15: error: 'j' was not declared in this scope
   21 |    int i = 0; j = 0;
      |               ^
a.cc:23:28: error: 'P' was not declared in this scope
   23 |     if(j < H && (i == W || P[i] > Q[j])){
      |                            ^
a.cc:23:35: error: 'Q' was not declared in this scope
   23 |     if(j < H && (i == W || P[i] > Q[j])){
      |                                   ^
Language: C++

#include <bits/stdc++.h>
#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define numa(x,a) for(auto x: a)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define pf push_front
#define sec second
#define sz(x) ((int)(x).size())
#define ALL( c ) (c).begin(), (c).end()
#define gcd(a,b) __gcd(a,b)
#define mem(x,n) memset(x,n,sizeof(x))
#define endl "\n"
using namespace std;
template <int POS, class TUPLE> void deploy(std::ostream &os, const TUPLE &tuple){}
template <int POS, class TUPLE, class H, class ...Ts> void deploy(std::ostream &os, const TUPLE &t){ os << (POS == 0 ? "" : ", ") << get<POS>(t); deploy<POS + 1, TUPLE, Ts...>(os, t); }
template <class T,class U> std::ostream& operator<<(std::ostream &os, std::pair<T,U> &p){ os << "(" << p.first <<", " << p.second <<")";return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::vector<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::set<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T, class K> std::ostream& operator<<(std::ostream &os, std::map<T, K> &mp){ int remain = mp.size(); os << "{"; for(auto e: mp) os << "(" << e.first << " -> " << e.second << ")" << (--remain == 0 ? "}" : ", "); return os; }
#define DEBUG1(var0) { std::cerr << (#var0) << "=" << (var0) << endl; }
#define DEBUG2(var0, var1) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG1(var1); }
#define DEBUG3(var0, var1, var2) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG2(var1,var2); }
#define DEBUG4(var0, var1, var2, var3) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG3(var1,var2,var3); }
using ll = long long;

int main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int H,W;
  cin >> W >> H;
  vector <ll> p(W);
  vector <ll> q(H);
  rep(i,W){
    cin >> p[i];
  }
  rep(i,H){
    cin >> q[i];
  }
  sort(ALL(p)); sort(QLL(q));
  p.push_back(INF); q.push_back(INF);
  reverse(ALL(p)); reverse(ALL(q));
  int w = W, h = H;
  ll ans = 0;
  while (true) {
    if (w == 0 || h == 0) {
      break;
    }
    if (p.back() < q.back()) {
      ans += q.back() * (w + 1);
      q.pop_back();
      h -= 1;
    }else{
      ans += p.back() * (h + 1);
      p.pop_back();
      w -= 1;
    }
  }
  cout << ans << endl;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:47:22: error: 'QLL' was not declared in this scope; did you mean 'ALL'?
   47 |   sort(ALL(p)); sort(QLL(q));
      |                      ^~~
      |                      ALL
Language: C++

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

struct TEdge {
    int From;
    int To;
    int Type;
    int Cost;
};

bool operator < (const TEdge& lhs, const TEdge& rhs) {
    return lhs.Cost > rhs.Cost;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n[2];
    cin >> n[0] >> n[1];

    vector<int> p[2];
    for (int i = 0; i < 2; ++i) {
        p[i].resize(n[i]);
        for (int j = 0; j < n[i]; ++j) {
            cin >> p[i][j];
        }
    }

    TDsu dsu[2];
    int cn[2];
    for (int i = 0; i < 2; ++i) {
        dsu[i].Init(n[i] + 1);
        cn[i] = n[i] + 1;
    }

    priority_queue<TEdge> q;
    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < n[i]; ++j) {
            q.push(TEdge{j, j + 1, i, p[i][j]});
        }
    }

    long long cost = 0;
    while (!q.empty()) {
        TEdge e = q.top();
        q.pop();

        cost += 1LL * e.Cost * cn[1 - e.Type];

        cn[e.Type] -= 1;
    }

    cout << cost << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:5: error: 'TDsu' was not declared in this scope
   35 |     TDsu dsu[2];
      |     ^~~~
a.cc:38:9: error: 'dsu' was not declared in this scope
   38 |         dsu[i].Init(n[i] + 1);
      |         ^~~
Language: C++

#include <string>
#include <vector>
#include <map>
#include <set>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <list>

using namespace std;

void read(int &w){
    cin >> w;
}

int main(int argc, char * argv [] )
{
/**
4 3
2
4
8
1
2
9
3
https://code-festival-2016-qualb.contest.atcoder.jp/submit?task_id=2081
*/
    int w, h;
    cin >> w >> h;
    vector<long long> p(w);
    vector<long long> q(h);

    for_each(p.begin(), p.end(), read);
    for_each(q.begin(), q.end(), read);

    sort(p.begin(), p.end());
    sort(q.begin(), q.end());

    long long sum = 0;

    for (int i = 0, j = 0; i != w || j != h;) {
        if (i < w && j < h) {
            if (p.at(i) < q.at(j)) {
                sum += p.at(i++) * (h - j + 1);
            } else {
                sum += q.at(j++) * (w - i + 1);
            }
        } else if (i < w) {
            sum += p.at(i++) * (h - j + 1);
        } else {
            sum += q.at(j++) * (w - i + 1);
        }
    }
    cout << sum << endl;
    return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_Funct std::for_each(_IIter, _IIter, _Funct) [with _IIter = __gnu_cxx::__normal_iterator<long long int*, vector<long long int> >; _Funct = void (*)(int&)]':
a.cc:35:13:   required from here
   35 |     for_each(p.begin(), p.end(), read);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:3786:12: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
 3786 |         __f(*__first);
      |         ~~~^~~~~~~~~~
Language: C++

/* ***************************************
Author        :Scau.ion
Created Time  :2016/10/10 19:56:54 UTC+8
File Name     :ion.cpp
*************************************** */

#include <bits/stdc++.h>

#define LL long long
#define ULL unsigned long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<PII>
#define X first
#define Y second
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define IN freopen("in", "r", stdin);
#define OUT freopen("out", "w", stdout);

using namespace std;

const int maxn=200010;

struct edge
{
    int val;
    bool ty;
    operator <(const edge &b)const
    {
        return val<b.val;
    }
}ed[maxn];

int main()
{
    int n[2];
    scanf("%d%d",&n[0],&n[1]);
    int nn=n[0]+n[1];
    for (int j=1;j<=n[0];++j)
    {
        scanf("%d",&ed[j].val);
        ed[j].ty=0;
    }
    for (int j=1;j<=n[1];++j)
    {
        scanf("%d",&ed[n[0]+j].val);
        ed[n[0]+j].ty=1;
    }
    sort(ed+1,ed+nn+1);
    LL ans=0;
    for (int j=1;j<=nn;++j)
    {
        ans+=1LL*ed[j].val*(n[!(ed[j].ty)]+1);
        --n[(ed[j].ty)];
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc:30:5: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
   30 |     operator <(const edge &b)const
      |     ^~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <queue>

using namespace std;

struct node {
	int x;
	int y;
	int dis;
	node* p;
	node(int _x, int _y, int d) :x(_x), y(_y), dis(d), p(NULL){};
};

struct com {
	bool operator()(node x, node y)
	{
		return x.dis > y.dis;
	}
};
int main()
{
	int w, h;
	cin >> w >> h;
	vector<int>p;
	vector<int>q;
	for (int i = 0; i < w; ++i)
	{
		int temp;
		cin >> temp;
		p.push_back(temp);
	}
	for (int i = 0; i < h; ++i)
	{
		int temp;
		cin >> temp;
		q.push_back(temp);
	}
	int res = 0;
	priority_queue < node, vector<node>, com> heap;
	vector<vector<node> >arr(w+1, vector<node>(h+1,node(0, 0, INT_MAX)));
	for (int i = 0; i <= w; ++i)
	{
		for (int j = 0; j <= h; ++j)
		{
			node temp(i, j, INT_MAX);
			arr[i][j] = temp;
		}
	}
	arr[0][0].dis = 0;
	node cur = arr[0][0];
	
	heap.push(cur);
	vector<vector<bool> >flag(w+1, vector<bool>(h+1, false));
	//flag[0][0] = true;
	int count = 0;
	while (count < (h+1) * (w+1))
	{
		cur = heap.top();
		heap.pop();
		if (flag[cur.x][cur.y])
			continue;
		count++;
		//cout << cur.x << cur.y << endl;
		flag[cur.x][cur.y] = true;
		if(!(cur.x == 0&& cur.y == 0))
			res += cur.dis;
		if (cur.x > 0)
		{
			if (arr[cur.x - 1][cur.y].dis > p[cur.x - 1])
			{
				arr[cur.x - 1][cur.y].dis =  p[cur.x - 1];
				arr[cur.x - 1][cur.y].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x - 1][cur.y]);
		}
		if(cur.x < w)
		{
			if (arr[cur.x + 1][cur.y].dis > p[cur.x])
			{
				arr[cur.x + 1][cur.y].dis = p[cur.x];
				arr[cur.x + 1][cur.y].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x + 1][cur.y]);
		}
		if (cur.y < h)
		{
			if(arr[cur.x][cur.y + 1].dis > q[cur.y]);
			{
				arr[cur.x][cur.y + 1].dis = q[cur.y];
				arr[cur.x][cur.y + 1].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x][cur.y+1]);
		}
		if (cur.y > 0)
		{
			if (arr[cur.x][cur.y - 1].dis > q[cur.y - 1])
			{
				arr[cur.x][cur.y - 1].dis = q[cur.y - 1];
				arr[cur.x][cur.y - 1].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x][cur.y - 1]);
		}

	}
	cout << res;
	cin.get();
	return 0;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:67: error: 'INT_MAX' was not declared in this scope
   42 |         vector<vector<node> >arr(w+1, vector<node>(h+1,node(0, 0, INT_MAX)));
      |                                                                   ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <queue>
  +++ |+#include <climits>
    5 |
Language: C++

#include<vector>
#include<random>
#include<stack>
#include<sstream>
#include<list>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cstdio>
#include<limits>
#include<cmath>
#include<deque>
#include<iostream>
#include<unordered_map>
#include<unordered_set>
#include<queue>
using namespace std;
template<typename T>
void pprintv(T arr)
{
	for(int i=0;i<arr.size();++i)
	{
		cout<<arr[i]<<" ";
	}
	cout<<endl;
}

typedef pair<int,int> point;
struct edge
{
	point end;
	int weight;
	edge(point e,int w):end(e),weight(w){}

};

bool operator<(const edge& a,const edge& b)
{
	return a.weight>b.weight;
}

void solve()
{

	int w,h;
	cin>>w>>h;
	vector<int>pw;
	vector<int>qh;
	vector<vector<bool>>used(w+1,vector<bool>(h+1,false));
	std::priority_queue<edge> pq;
	pq.push(edge(point(0,0),point(0,0),0));
	long long  result=0;


	for(int i=0;i<w;++i)
	{
		int t;
		cin>>t;
		pw.push_back(t);
	}
	for(int i=0;i<h;++i)
	{
		int t;
		cin>>t;
		qh.push_back(t);
	}
	int counter=0;
	for(;counter<(w+1)*(h+1);)
	{
		if(used[pq.top().end.first][pq.top().end.second])
		{
			pq.pop();
			continue;
		}
		result+=pq.top().weight;
		used[pq.top().end.first][pq.top().end.second]=true;
		int ii=pq.top().end.first;
		int jj=pq.top().end.second;
		pq.pop();
		if(ii>0&&!used[ii-1][jj])pq.push(edge(point(ii-1,jj),pw[ii-1]));
		if(jj>0&&!used[ii][jj-1])pq.push(edge(point(ii,jj-1),qh[jj-1]));
		if(ii<w&&!used[ii+1][jj])pq.push(edge(point(ii+1,jj),pw[ii]));
		if(jj<h&&!used[ii][jj+1])pq.push(edge(point(ii,jj+1),qh[jj]));
		++counter;
	}
	cout<<result;

}
int main()
{
	//freopen("input","r",stdin);

	solve();
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:55:45: error: no matching function for call to 'edge::edge(point, point, int)'
   55 |         pq.push(edge(point(0,0),point(0,0),0));
      |                                             ^
a.cc:37:9: note: candidate: 'edge::edge(point, int)'
   37 |         edge(point e,int w):end(e),weight(w){}
      |         ^~~~
a.cc:37:9: note:   candidate expects 2 arguments, 3 provided
a.cc:33:8: note: candidate: 'constexpr edge::edge(const edge&)'
   33 | struct edge
      |        ^~~~
a.cc:33:8: note:   candidate expects 1 argument, 3 provided
a.cc:33:8: note: candidate: 'constexpr edge::edge(edge&&)'
a.cc:33:8: note:   candidate expects 1 argument, 3 provided
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <queue>

using namespace std;

struct node {
	int x;
	int y;
	int dis;
	node* p;
	node(int _x, int _y, int d) :x(_x), y(_y), dis(d), p(NULL){};
};

struct com {
	bool operator()(node x, node y)
	{
		return x.dis > y.dis;
	}
};
int main()
{
	int w, h;
	cin >> w >> h;
	vector<int>p;
	vector<int>q;
	for (int i = 0; i < w; ++i)
	{
		int temp;
		cin >> temp;
		p.push_back(temp);
	}
	for (int i = 0; i < h; ++i)
	{
		int temp;
		cin >> temp;
		q.push_back(temp);
	}
	int res = 0;
	priority_queue < node, vector<node>, com> heap;
	vector<vector<node> >arr(w+1, vector<node>(h+1,node(0, 0, INT_MAX)));
	for (int i = 0; i <= w; ++i)
	{
		for (int j = 0; j <= h; ++j)
		{
			node temp(i, j, INT_MAX);
			arr[i][j] = temp;
		}
	}
	node cur = arr[0][0];
	cur.dis = 0;
	heap.push(cur);
	vector<vector<bool> >flag(w+1, vector<bool>(h+1, false));
	//flag[0][0] = true;
	int count = 0;
	int pre = 0;
	while (count < (h+1) * (w+1))
	{
		cur = heap.top();
		heap.pop();
		if (flag[cur.x][cur.y])
			continue;
		count++;
		flag[cur.x][cur.y] = true;
		if(cur.x != 0&& cur.y != 0)
			res += cur.dis - cur.p->dis;
		if (cur.x > 0)
		{
			if (arr[cur.x - 1][cur.y].dis > cur.dis + p[cur.x - 1])
			{
				arr[cur.x - 1][cur.y].dis = cur.dis + p[cur.x - 1];
				arr[cur.x - 1][cur.y].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x - 1][cur.y]);
		}
		if(cur.x < w)
		{
			if (arr[cur.x + 1][cur.y].dis > cur.dis + p[cur.x])
			{
				arr[cur.x + 1][cur.y].dis = cur.dis + p[cur.x];
				arr[cur.x + 1][cur.y].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x + 1][cur.y]);
		}
		if (cur.y < h)
		{
			if(arr[cur.x][cur.y + 1].dis > cur.dis + q[cur.y]);
			{
				arr[cur.x][cur.y + 1].dis = cur.dis + q[cur.y];
				arr[cur.x][cur.y + 1].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x][cur.y+1]);
		}
		if (cur.y > 0)
		{
			if (arr[cur.x][cur.y - 1].dis, cur.dis + q[cur.y - 1])
			{
				arr[cur.x][cur.y - 1].dis = cur.dis + q[cur.y - 1];
				arr[cur.x][cur.y - 1].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x][cur.y - 1]);
		}

	}
	cout << res;
	cin.get();
	return 0;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:67: error: 'INT_MAX' was not declared in this scope
   42 |         vector<vector<node> >arr(w+1, vector<node>(h+1,node(0, 0, INT_MAX)));
      |                                                                   ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <queue>
  +++ |+#include <climits>
    5 |
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <queue>

using namespace std;

struct node {
	int x;
	int y;
	int dis;
	node* p;
	node(int _x, int _y, int d) :x(_x), y(_y), dis(d), p(NULL){};
};

struct com {
	bool operator()(node x, node y)
	{
		return x.dis > y.dis;
	}
};
int main()
{
	int w, h;
	cin >> w >> h;
	vector<int>p;
	vector<int>q;
	for (int i = 0; i < w; ++i)
	{
		int temp;
		cin >> temp;
		p.push_back(temp);
	}
	for (int i = 0; i < h; ++i)
	{
		int temp;
		cin >> temp;
		q.push_back(temp);
	}
	int res = 0;
	priority_queue < node, vector<node>, com> heap;
	vector<vector<node> >arr(w+1, vector<node>(h+1,node(0, 0, INT_MAX)));
	for (int i = 0; i <= w; ++i)
	{
		for (int j = 0; j <= h; ++j)
		{
			node temp(i, j, INT_MAX);
			arr[i][j] = temp;
		}
	}
	node cur = arr[0][0];
	cur.dis = 0;
	heap.push(cur);
	vector<vector<bool> >flag(w+1, vector<bool>(h+1, false));
	//flag[0][0] = true;
	int count = 0;
	int pre = 0;
	while (count < (h+1) * (w+1))
	{
		cur = heap.top();
		heap.pop();
		if (flag[cur.x][cur.y])
			continue;
		count++;
		flag[cur.x][cur.y] = true;
		res += cur.dis - cur.p->dis;
		if (cur.x > 0)
		{
			if (arr[cur.x - 1][cur.y].dis > cur.dis + p[cur.x - 1])
			{
				arr[cur.x - 1][cur.y].dis = cur.dis + p[cur.x - 1];
				arr[cur.x - 1][cur.y].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x - 1][cur.y]);
		}
		if(cur.x < w)
		{
			if (arr[cur.x + 1][cur.y].dis > cur.dis + p[cur.x])
			{
				arr[cur.x + 1][cur.y].dis = cur.dis + p[cur.x];
				arr[cur.x + 1][cur.y].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x + 1][cur.y]);
		}
		if (cur.y < h)
		{
			if(arr[cur.x][cur.y + 1].dis > cur.dis + q[cur.y]);
			{
				arr[cur.x][cur.y + 1].dis = cur.dis + q[cur.y];
				arr[cur.x][cur.y + 1].p = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x][cur.y+1]);
		}
		if (cur.y > 0)
		{
			if (arr[cur.x][cur.y - 1].dis, cur.dis + q[cur.y - 1])
			{
				arr[cur.x][cur.y - 1].dis = cur.dis + q[cur.y - 1];
				arr[cur.x][cur.y - 1].dis = &arr[cur.x][cur.y];
			}
			heap.push(arr[cur.x][cur.y - 1]);
		}

	}
	cout << res;
	cin.get();
	return 0;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:67: error: 'INT_MAX' was not declared in this scope
   42 |         vector<vector<node> >arr(w+1, vector<node>(h+1,node(0, 0, INT_MAX)));
      |                                                                   ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <queue>
  +++ |+#include <climits>
    5 | 
a.cc:99:61: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type*' {aka 'node*'} to 'int' [-fpermissive]
   99 |                                 arr[cur.x][cur.y - 1].dis = &arr[cur.x][cur.y];
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a) ;i < (b) ;i++)
#define repr(i, a, b) for (int i = (b) - 1 ;i >= a ;i--) 
int main(){
	int w, h, p[100000], q[100000] ;
	cin >> w >> h ;
	rep(i, 0, w)cin>>p[i] ;
	rep(j, 0, h)cin>>q[j] ;

	long ans = 0, added = 0 ;
  	sort(q,q+h,greater<int>());
  	sort(p,p+w,greater<int>());

  	int i = 0 ,j = 0 ;
  	
  	while(!(i >= w) && !(j >= h){
  		if (i < w && p[i] <= q[j]){
  			ans += (h + 1 - j) * long (p[i]) ;
  			i++ ;
  		}else{
  			ans += (w + 1 - i) * long (q[j]) ;
  			j++ ;
  		}

  	}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:17:37: error: expected ')' before '{' token
   17 |         while(!(i >= w) && !(j >= h){
      |              ~                      ^
      |                                     )
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<climits> //INT_MIN/MAX


using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(int (i)=(s);(i)>(e);(i)--)
#define MOD 1000000007
#define llong long long
#define debug(x) cout<<#x<<": "<<x<<endl


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

    int W,H;
    int p[100005], q[100005];
   llong int ans = 0;

    cin >> W>>H;
    for (int i = 0; i < W; i++) {
       int num;
        cin >> num;
        p[i] = num;
    }
    llong int Hnum = 0;
    for (int i = 0; i < H; i++) {
      int num;
        cin >> num;
        q[i] = num;
        Hnum += num;
    }
    sort(p, p+W);
    llong int  sum[100005];
    sum[0] = 0;
  int t = 0;
    for (int i = 0; i < W; i++) {
        sum[i] = t + p[i];//
        t = sum[i];
    }
    ans = Hnum*W+sum[W - 1]*(H+1);

    for (int i = 0; i < H; i++) {
        int it = *lower_bound(p.begin(), p.end(), q[i]);
        ans = ans-q[i]*it+sum[it];

    }



    cout << ans << endl;


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:33: error: request for member 'begin' in 'p', which is of non-class type 'int [100005]'
   57 |         int it = *lower_bound(p.begin(), p.end(), q[i]);
      |                                 ^~~~~
a.cc:57:44: error: request for member 'end' in 'p', which is of non-class type 'int [100005]'
   57 |         int it = *lower_bound(p.begin(), p.end(), q[i]);
      |                                            ^~~