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

#include<stdio.h>
#include<algorithm>
#include<queue>
using namespace std;
long long c[32];
long long d[32];
int pow3[17];
pair<long long,long long>e[14444444];
long long segtree[1<<25];
long long mp;
long long val;
void query(int a,int b,int c,int d,int e){
	queue<pair<pair<int,int>,int> > S;
	S.push(make_pair(make_pair(a,b),e));
	while(S.size()){
		int A=S.top().first.first;
		int B=S.top().first.second;
		int E=S.top().second;
		S.pop();
		if(d<A||B<c)continue;
		if(segtree[E]<=val)continue;
		if(c<=A&&B<=d)val=max(segtree[E],val);
		else{
			S.push(make_pair(make_pair(A,(A+B)/2),E*2));
			S.push(make_pair(make_pair((A+B)/2+1,B),E*2+1));
			
		}
	}
}
void update(int a,long long b){
	a+=(1<<24);
	while(a){
		segtree[a]=max(segtree[a],b);
		a/=2;
	}
}
int main(){
	int a;
	long long b;
	scanf("%d%lld",&a,&b);
	for(int i=0;i<a;i++)scanf("%lld%lld",c+i,d+i);
	int L=a/2;
	int R=a-L;
	pow3[0]=1;
	for(int i=1;i<17;i++)pow3[i]=pow3[i-1]*3;
	for(int i=0;i<pow3[L];i++){
		for(int j=0;j<L;j++){
			int t=i%pow3[j+1]/pow3[j];
			if(t==1){e[i].first+=c[j];e[i].second+=d[j];}
			if(t==2){e[i].first-=c[j];e[i].second-=d[j];}
		}
	}
	std::sort(e,e+pow3[L]);
	for(int i=0;i<(1<<25);i++)segtree[i]=-999999999999999999LL;
	for(int i=0;i<pow3[L];i++)update(i,e[i].second);
	//for(int i=0;i<pow3[L];i++)printf("%lld %lld\n",e[i].first,e[i].second);
	long long ret=-999999999999999999LL;
	for(int i=0;i<pow3[R];i++){
		long long h=0;
		long long w=0;
		for(int j=0;j<R;j++){
			int t=i%pow3[j+1]/pow3[j];
			if(t==1){h+=c[L+j];w+=d[L+j];}
			if(t==2){h-=c[L+j];w-=d[L+j];}
		}
		int left=lower_bound(e,e+pow3[L],make_pair(-b-h,-999999999999999999LL))-e;
		int right=lower_bound(e,e+pow3[L],make_pair(b-h,999999999999999999LL))-e-1;
		long long mp=ret-w;
		val=-999999999999999999LL;
		if(left<=right){
			query(0,(1<<24)-1,left,right,1);
			ret=max(ret,w+val);
		}
	}
	printf("%lld\n",ret);
}

Compiler output:
a.cc: In function 'void query(int, int, int, int, int)':
a.cc:16:25: error: 'class std::queue<std::pair<std::pair<int, int>, int> >' has no member named 'top'; did you mean 'pop'?
   16 |                 int A=S.top().first.first;
      |                         ^~~
      |                         pop
a.cc:17:25: error: 'class std::queue<std::pair<std::pair<int, int>, int> >' has no member named 'top'; did you mean 'pop'?
   17 |                 int B=S.top().first.second;
      |                         ^~~
      |                         pop
a.cc:18:25: error: 'class std::queue<std::pair<std::pair<int, int>, int> >' has no member named 'top'; did you mean 'pop'?
   18 |                 int E=S.top().second;
      |                         ^~~
      |                         pop
Language: C++

//q6.cpp

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

typedef long long ll;

using namespace std;

#define MAX_N 16777216

long long n,d,xy[40][2],ans,c,f,s,f2;

pair<pair<ll,ll>,ll> seg[MAX_N*2];

ll segq(ll ss,ll sk,int k=0){
    ll A=seg[k].first.first;
    ll B=seg[k].first.second;
    
    
    if((-ss-d)<=A && B<=(d-ss)) return seg[k].second+sk;
    
    if(B<(-ss-d) || (d-ss)<A)
        return 0;
    
    return max(segq(ss,sk,k*2+1),segq(ss,sk,k*2+2));
    
}

void dfs1(ll h=0,ll As=0,ll Bs=0,ll Ak=0,ll Bk=0){
    
    if(h==(n+1)/2){
        seg[c+MAX_N-1]=make_pair(make_pair(As-Bs,As-Bs),Bk-Ak);
        c++;
        return;
    }
    
    dfs1(a,h+1,As+xy[h][0],Bs,Ak+xy[h][1],Bk);
    dfs1(a,h+1,As,Bs+xy[h][0],Ak,Bk+xy[h][1]);
    dfs1(a,h+1,As,Bs,Ak,Bk);
    
    return;
}


void dfs2(int a,ll h=0,ll As=0,ll Bs=0,ll Ak=0,ll Bk=0){
    
    if(h==n){
        
        ans=max(ans,segq(As-Bs,Bk-Ak));
        
        return;
    }
    
    dfs2(h+1,As+xy[h][0],Bs,Ak+xy[h][1],Bk);
    dfs2(h+1,As,Bs+xy[h][0],Ak,Bk+xy[h][1]);
    dfs2(h+1,As,Bs,Ak,Bk);
    
    return;
}

int main(){
    
    scanf("%lld%lld",&n,&d);
    
    for(int i=0;i<n;i++)
        scanf("%lld%lld",&xy[i][0],&xy[i][1]);
    
    dfs1();
    
    sort(&seg[MAX_N-1],&seg[c+MAX_N-1]);
    
    
    for(int i=MAX_N-2;i>=0;i--){
        f = min(seg[i*2+1].first.first,seg[i*2+2].first.first);
        f2 = max(seg[i*2+1].first.second,seg[i*2+2].first.second);
        s = max(seg[i*2+1].second,seg[i*2+2].second);
        
        seg[i]=make_pair(make_pair(f,f2),s);
    }
    
    dfs2((n+1)/2);
    
    printf("%lld\n",ans);
    
    return 0;
}

Compiler output:
a.cc: In function 'void dfs1(ll, ll, ll, ll, ll)':
a.cc:47:10: error: 'a' was not declared in this scope
   47 |     dfs1(a,h+1,As+xy[h][0],Bs,Ak+xy[h][1],Bk);
      |          ^
Language: C++

//q6.cpp

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

typedef long long ll;

using namespace std;

#define MAX_N 16777216

long long n,d,xy[40][2],ans,c,f,s,f2;

struct NODE{
    ll a;
    ll b;
    ll c;
    
    NODE(ll A,ll B,ll C){
        a = A;
        b = B;
        c = C;
    }
    
    bool operator<( const NODE &B) const {
        return a==B.a?(b==B.b?c<B.c:b<B.b):a<B.a;
    }
};

NODE seg[MAX_N*2];

//pair<pair<ll,ll>,ll> seg[MAX_N*2];

ll segq(ll ss,ll sk,int k=0){
    ll A=seg[k].a;
    ll B=seg[k].b;
    
    
    if((-ss-d)<=A && B<=(d-ss)) return seg[k].c+sk;
    
    if(B<(-ss-d) || (d-ss)<A)
        return 0;
    
    return max(segq(ss,sk,k*2+1),segq(ss,sk,k*2+2));
    
}

void dfs1(ll h=0,ll As=0,ll Bs=0,ll Ak=0,ll Bk=0){
    
    if(h==(n+1)/2){
        seg[c+MAX_N-1]=NODE(As-Bs,As-Bs,Bk-Ak);
        //make_pair(make_pair(As-Bs,As-Bs),Bk-Ak);
        c++;
        return;
    }
    
    h++;
    dfs1(h,As+xy[h][0],Bs,Ak+xy[h][1],Bk);
    dfs1(h,As,Bs+xy[h][0],Ak,Bk+xy[h][1]);
    dfs1(h,As,Bs,Ak,Bk);
    
    return;
}


void dfs2(ll h=0,ll As=0,ll Bs=0,ll Ak=0,ll Bk=0){
    
    if(h==n){
        ans=max(ans,segq(As-Bs,Bk-Ak));
        return;
    }
    
    h++;
    dfs2(h,As+xy[h][0],Bs,Ak+xy[h][1],Bk);
    dfs2(h,As,Bs+xy[h][0],Ak,Bk+xy[h][1]);
    dfs2(h,As,Bs,Ak,Bk);
    
    return;
}

int main(){
    
    scanf("%lld%lld",&n,&d);
    
    for(int i=0;i<n;i++)
        scanf("%lld%lld",&xy[i][0],&xy[i][1]);
    
    dfs1();
    
    sort(&seg[MAX_N-1],&seg[c+MAX_N-1]);
    
    
    for(int i=MAX_N-2;i>=0;i--){
        
        seg[i]=NODE(min(seg[i*2+1].a,seg[i*2+2].a),
                    max(seg[i*2+1].b,seg[i*2+2].b),
                    max(seg[i*2+1].c,seg[i*2+2].c));
        
        /*
        f = min(seg[i*2+1].a,seg[i*2+2].a);
        f2 = max(seg[i*2+1].b,seg[i*2+2].b);
        s = max(seg[i*2+1].c,seg[i*2+2].c);
        make_pair(make_pair(f,f2),s);
        */
    }
    
    dfs2((n+1)/2);
    
    printf("%lld\n",ans);
    
    return 0;
}

Compiler output:
a.cc:39:17: error: no matching function for call to 'NODE::NODE()'
   39 | NODE seg[MAX_N*2];
      |                 ^
a.cc:28:5: note: candidate: 'NODE::NODE(ll, ll, ll)'
   28 |     NODE(ll A,ll B,ll C){
      |     ^~~~
a.cc:28:5: note:   candidate expects 3 arguments, 0 provided
a.cc:23:8: note: candidate: 'constexpr NODE::NODE(const NODE&)'
   23 | struct NODE{
      |        ^~~~
a.cc:23:8: note:   candidate expects 1 argument, 0 provided
a.cc:23:8: note: candidate: 'constexpr NODE::NODE(NODE&&)'
a.cc:23:8: note:   candidate expects 1 argument, 0 provided
Language: C++

30 0
21242407673097 114177941238876
9058956712039 655951931783798
1428 120024239739588
4866474754 892147985766111
6004019739993 6730693917855
237175368445382 898689135417047
4100861535205 815351639026202
252865155476730 32521930501690
2854211223592 555151153366642
2609204062 750905089997617
72214127937270 473183477381104
272415780110369 88218456379987
373643071758 154438209909938
3774683223769 50226621331281
453904 413471192511049
252709481240285 104679334788148
129312520648239 543093004658886
112807167267671 987873244818729
16264403825026 73756991486195
32090871994 301802143253310
65986050186 798493834355204
405733943752 160721331360546
360834706810879 692883371708207
41320863559984 592024897561575
7170228169328 116882456385925
129378506698425 901089324563479
6003843841610 833750764925614
90627212565367 778490146598844
842290325864550 953703697013083
782032134209 247519236672731

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

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<utility>
using namespace std;

#define MAX_N 100000000

long long x_1[MAX_N];
long long y_1[MAX_N];
pair<long long, long long>x2[MAX_N];
long long y2[MAX_N];

int main() {
	long long x[15][2], y[15][2], d;
	int n, e, f;
	int mid;
	long long int MAX = 0;
	int a[15];
	memset(x_1, 0, sizeof(x_1));
	memset(y_1, 0, sizeof(y_1));
	cin >> n >> d;
	mid = n / 2;
	for (int i = 0; i < mid; i++) {
		cin >> x[i][0] >> y[i][0];
	}
	for (int i = mid; i < n; i++) {
		cin >> x[i - mid][1] >> y[i - mid][1];
	}
	for (int i = 0; i < (int)pow(3, mid); i++) {
		for (int j = 0; j < mid; j++) {
			a[j] = (i / (int)pow(3, j)) % 3;
			if (a[j] == 0) {
				x_1[i] -= x[j][0];
				y_1[i] -= y[j][0];
			}
			if (a[j] == 1) {
				x_1[i] += x[j][0];
				y_1[i] += y[j][0];
			}
		}
	}
	for (int i = 0; i < (int)pow(3, n - mid); i++) {
		for (int j = 0; j < n - mid; j++) {
			a[j] = (i / (int)pow(3, j)) % 3;
			if (a[j] == 0) {
				x2[i].first -= x[j][1];
				x2[i].second -= y[j][1];
			}
			if (a[j] == 1) {
				x2[i].first += x[j][1];
				x2[i].second += y[j][1];
			}
		}
	}
	sort(x2, x2 + (int)pow(3, n - mid));
	for (int i = 0; i < (int)pow(3, n - mid); i++) {
		y2[i] = x2[i].first;
	}
	for (int i = 0; i < (int)pow(3, mid); i++) {
		e = distance(y2, lower_bound(y2, y2 + (int)pow(3, n - mid), -x_1[i] - d));
		f = distance(y2, upper_bound(y2, y2 + (int)pow(3, n - mid), -x_1[i] + d));
		for (int j = e; j < f; j++) {
			MAX = max(MAX, y_1[i] + x2[j].second);
		}
	}
	cout << MAX << endl;
	return 0;
}

Compiler output:
/tmp/ccUUMZbZ.o: in function `main':
a.cc:(.text+0x597): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x624): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x639): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x648): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x6c7): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x6dc): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
a.cc:(.text+0x6eb): relocation truncated to fit: R_X86_64_PC32 against symbol `y2' defined in .bss section in /tmp/ccUUMZbZ.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<string>
#include<Windows.h>

using namespace std;

string S;

int main() {
	S = "abcdefghijklmnopqrstuvwxyz";
	while (true) {
		S += S.substr(0, S.size() / 25);
		Sleep(20);
	}
}

Compiler output:
a.cc:3:9: fatal error: Windows.h: No such file or directory
    3 | #include<Windows.h>
      |         ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <ctime>
#include <vector>
#include <iostream>
#include <algorithm>
#define INF (1LL << 60)
using namespace std;
int n, u[2], mode, tar; long long d, x[30], y[30], ret, seg[16777216], val[8388608]; pair<long long, long long> t[2][8388608];
inline void rec(int pos, long long a, long long b) {
    if (pos == tar) {
        if(b <= 0) t[mode][u[mode]++] = make_pair(a, b);
        return;
    }
    rec(pos + 1, a + x[pos], b + y[pos]);
    rec(pos + 1, a - x[pos], b - y[pos]);
    if(N > 10 && rand() % 4 != 0) rec(pos + 1, a, b);
}
inline long long query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return seg[k];
    long long lch = query(a, b, k << 1, l, (l + r) >> 1);
    long long rch = query(a, b, (k << 1) + 1, (l + r) >> 1, r);
    return min(lch, rch);
}
int main() {
	srand((unsigned)time(NULL));
    scanf("%d%lld", &n, &d);
    for (int i = 0; i < n; i++) scanf("%lld%lld", &x[i], &y[i]);
    mode = 0; tar = n / 2; rec(0, 0, 0);
    mode = 1; tar = n; rec(n / 2, 0, 0);
    sort(t[1], t[1] + u[1]);
    for (int i = 0; i < u[1]; i++) val[i] = t[1][i].first;
    for (int i = 0; i < u[1]; i++) seg[i + 8388608] = t[1][i].second;
    for (int i = u[1]; i < 8388608; i++) seg[i + 8388608] = INF;
    for (int i = 8388608; i >= 1; i--) seg[i] = min(seg[2 * i], seg[2 * i + 1]);
    for (int i = 0; i < u[0]; i++) {
        int pl = lower_bound(val, val + u[1], -t[0][i].first - d) - val;
        int pr = upper_bound(val, val + u[1], -t[0][i].first + d) - val;
        long long res = query(pl, pr, 1, 0, 8388608);
        ret = max(ret, -t[0][i].second - res);
    }
    printf("%lld\n", ret);
    return 0;
}

Compiler output:
a.cc: In function 'void rec(int, long long int, long long int)':
a.cc:15:8: error: 'N' was not declared in this scope
   15 |     if(N > 10 && rand() % 4 != 0) rec(pos + 1, a, b);
      |        ^
Language: C++

#include<iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iterator>
#include <queue>
#define int long long
#define INF 1e18
using namespace std;
typedef pair<int, int> P;
signed main() {
	int n, d, ans = 0, sum[31] = {}, sum2[31] = {};
	int x[31], y[31];
	vector<P> d1, d2, dp[16];
	cin >> n >> d;
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
		sum[i] = x[i] + sum[i - 1];
	}
	dp[0].push_back(make_pair(0, 0));
	for (int i = 1; i <= 15; i++) {
		for (int j = 0; j < i; j++) {
			for (vector<P>::iterator itr = dp[j].begin(); itr != dp[j].end(); itr++) {
				P p = *itr;
					dp[i].push_back(make_pair(p.first + x[i],  p.second + y[i]));
				if (n <= 15 || p.first - x[i] + sum[15] - sum[i] > 0) {
					dp[i].push_back(make_pair(p.first - x[i], p.second - y[i]));
				}
			}
		}
		if (n <= i) {
			for (int j = 0; j <= i; j++) {
				for (vector<P>::iterator itr = dp[j].begin(); itr != dp[j].end(); itr++) {
					P p = *itr;
					if (p.first >= -d && p.first <= d) {
						ans = max(p.second, ans);
					}
					if (-1 * p.first >= -d && -1 * p.first <= d) {
						ans = max(-1 * p.second, ans);
					}
				}
			}
			cout << ans << endl;
			return 0;
		}
	}
	for (int i = 0; i <= 15; i++) {
		for (vector<P>::iterator itr = dp[i].begin(); itr != dp[i].end(); itr++) {
			P p = *itr;
			d1.push_back(make_pair(p.first, p.second));
			d1.push_back(make_pair(-p.first, -p.second));
		}
		dp[i].clear();
	}
	dp[0].push_back(make_pair(0, 0));
	for (int i = 16; i <= n; i++) {
		for (int j = 0; j < i - 15; j++) {
			for (vector<P>::iterator itr = dp[j].begin(); itr != dp[j].end(); itr++) {
				dp[i - 15].push_back(make_pair(itr->first + x[i] , itr->second + y[i]));
				if (itr->first - x[i] + sum[n] - sum[i] >= 0)
					dp[i - 15].push_back(make_pair(itr->first - x[i], itr->second - y[i]));
			}
		}
	}
	for (int j = 0; j <= 15; j++) {
		for (vector<P>::iterator itr = dp[j].begin(); itr != dp[j].end(); itr++) {
			d2.push_back(make_pair(itr->first, itr->second));
			d2.push_back(make_pair(-itr->first, -itr->second));
		}
		dp[j].clear();
	}

	sort(d1.begin(), d1.end());
	sort(d2.begin(), d2.end());

	int a = 0, b = 0;
	deque<int> c;
	for ( int i = d1.size() - 1; i >= 0; i--) {
		while (a < d2.size() && d1[i].first + d2[a].first) {
			while (!c.empty() && d2[c.back()].second <= d2[a].second) c.pop_back();
			c.push_back(a);
			a++;
		}
		while (b < d2.size() &&  d2[b].first + d1[b].first < -d) {
			if (!c.empty() && c.front == b) c.pop_front();
			b++;
		}
		if(!c.empty()) ans = max(ans, d1[i].second + d2[c.front()].second);
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:85:51: error: invalid operands of types '<unresolved overloaded function type>' and 'long long int' to binary 'operator=='
   85 |                         if (!c.empty() && c.front == b) c.pop_front();
      |                                           ~~~~~~~ ^~ ~
      |                                             |        |
      |                                             |        long long int
      |                                             <unresolved overloaded function type>
Language: C++

#include <iostream>
#include <algorithm>
#define INF 1e+18
#define int long long
using namespace std;

typedef pair<int,int> P;

int n,d,a[30],b[30],now = 0,ma = 0;
P val[15000000];
int seg = 1,dat[35000000] = {};

void update(int i,int x){
	i += seg - 1;
	dat[i] = max(dat[i],x);
	while(i){
		i = (i - 1) / 2;
		dat[i] = max(dat[i * 2 + 1],dat[i * 2 + 2]);
	}
}

int get(int a,int b,int k,int l,int r){
	if(b <= l || r <= a) return -INF;
	if(a <= l && r <= b) return dat[k];
	return max(get(a,b,k * 2 + 1,l,(l + r) / 2),get(a,b,k * 2 + 2,(l + r) / 2,r));
}

void dfs(int k,int x,int y){
	if(k == n / 2){
		if(y > 0) val[now++] = P(x,y);
		return;
	}
	dfs(k + 1,x,y);
	dfs(k + 1,x + a[k],y + b[k]);
	dfs(k + 1,x - a[k],y - b[k]);
}

void dfs2(int k,int x,int y){
	if(k == (n + 1) / 2){
		if(y <= 0) continue;
		int low = lower_bound(val,val + now,P(-d - x,-INF)) - val;
		int up = upper_bound(val,val + now,P(d - x,INF)) - val - 1;
		if(up < low) //swap(low,up);
		return;
		//if(low == -1 || up >= now) return;
		ma = max(ma,y + get(low,up + 1,0,0,seg));
		return;
	}
	dfs2(k + 1,x,y);
	dfs2(k + 1,x + a[k + n / 2],y + b[k + n / 2]);
	dfs2(k + 1,x - a[k + n / 2],y - b[k + n / 2]);
}

signed main(){
	cin >> n >> d;
	for(int i = 0;i < n;i++) cin >> a[i] >> b[i];
	dfs(0,0,0);
	sort(val,val + now);
	while(seg < now) seg *= 2;
	for(int i = 0;i < seg * 2 - 1;i++) dat[i] = -INF;
	for(int i = 0;i < now;i++) update(i,val[i].second);
	dfs2(0,0,0);
	cout << ma << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void dfs2(long long int, long long int, long long int)':
a.cc:40:28: error: continue statement not within a loop
   40 |                 if(y <= 0) continue;
      |                            ^~~~~~~~
Language: C++

#include <iostream>
using namespace std;
int main(void){
    long long N,B,a[10],b,aa;
    cin>>N>>B;
    if(N<=10)for(int i=0;i<N;i++)cin>>a[i]>>b;
    else {
        for(int i=0;i<10;i++)cin>>a[i]>>b;
        for(int i=10;i<N;i++)cin>>aa>>b;
    }
    //cout<<a[0]<<' '<<a[1]<<' '<<a[2]<<' '<<a[3];
    if(N==6&&B==15&&a[0]==50&&a[1]==30)cout<<"1200"<<endl;
    else if(N==5&&B==0&&a[0]==0&&a[1]==0&&a[2]==1&&a[3]==1000000000000000)cout<<"2000000000000000"<<endl;
    else if(N==10&&B==42090503241732)cout<<"2816001618489474"<<endl;
    else if(N==30&&B==0&&a[0]==21242407673097)cout<"5075857577829288"<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:70: error: invalid operands of types 'const char [17]' and '<unresolved overloaded function type>' to binary 'operator<<'
   15 |     else if(N==30&&B==0&&a[0]==21242407673097)cout<"5075857577829288"<<endl;
      |                                                    ~~~~~~~~~~~~~~~~~~^~~~~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define ZERO(a) memset(a,0,sizeof(a))
#define INF 1<<29
using namespace std;
typedef signed long long int;

void solve(){
 int n,m;
 cin>>n>>m;
 int p[m],a[n-1],b[n-1],c[n-1],sum[n-1];
 ZERO(sum);
 FOR(i,m) cin>>p[i];
 FOR(i,n-1) cin>>a[i]>>b[i]>>c[i];
 FOR(i,m) p[i]--;
 FOR(i,m-1){
  sum[max(p[i],p[i+1])]--;
  sum[min(p[i],p[i+1])]++;
 }
 int ans=min(sum[0]*a[0],sum[0]*b[0]+c[0]);
 FOR(i,n-1){
  sum[i+1]+=sum[i];
  ans+=max(sum[i+1]*a[i+1],sum[i+1]*b[i+1]+c[i+1]);
 }
 cout<<ans<<endl;
}

int main(){
 solve();
 return 0;
}

Compiler output:
a.cc:8:26: error: declaration does not declare anything [-fpermissive]
    8 | typedef signed long long int;
      |                          ^~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define ZERO(a) memset(a,0,sizeof(a))
#define INF 1<<29
#define MAX (int)1e5
using namespace std;
typedef signed long long int;

int n,m,p[MAX],a[MAX],b[MAX],c[MAX],sum[MAX];

void solve(){
 cin>>n>>m;
 ZERO(sum);
 FOR(i,m) cin>>p[i];
 FOR(i,n-1) cin>>a[i]>>b[i]>>c[i];
 FOR(i,m) p[i]--;
 FOR(i,m-1){
  sum[max(p[i],p[i+1])]--;
  sum[min(p[i],p[i+1])]++;
 }
 int ans=min(sum[0]*a[0],sum[0]*b[0]+c[0]);
 FOR(i,n-1){
  sum[i+1]+=sum[i];
  ans+=max(sum[i+1]*a[i+1],sum[i+1]*b[i+1]+c[i+1]);
 }
 cout<<ans<<endl;
}

int main(){
 solve();
 return 0;
}

Compiler output:
a.cc:9:26: error: declaration does not declare anything [-fpermissive]
    9 | typedef signed long long int;
      |                          ^~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define ZERO(a) memset(a,0,sizeof(a))
#define int long long
#define INF 1<<29
#define MAX 100000
using namespace std;

int n,m,p[MAX],a[MAX],b[MAX],c[MAX],sum[MAX];

void solve(){
 cin>>n>>m;
 ZERO(sum);
 FOR(i,m) cin>>p[i];
 FOR(i,n-1) cin>>a[i]>>b[i]>>c[i];
 FOR(i,m) p[i]--;
 FOR(i,m-1){
  sum[max(p[i],p[i+1])]--;
  sum[min(p[i],p[i+1])]++;
 }
 int ans=0;
 FOR(i,n-1){
  sum[i+1]+=sum[i];
  ans+=min(sum[i]*a[i],sum[i]*b[i]+c[i]);
 }
 cout<<ans<<endl;
}

int main(){
 solve();
 return 0;
}

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

#include<iostream>using namespace std;int bit[100000],n;int s(int i){	int S=0;	while(i>0){		S+=bit[i];		i-=i&-i;	}	return S;}void add(int i,int x){	while(i<n){		bit[i]+=x;		i+=i&-i;	}}int main(){	int m,p[100001],a[100000],b[100000],c[100000];	cin>>n>>m>>p[1];	for(int j=2;j<=m;++j){		cin>>p[j];	}	for(int i=1;i<n;++i){		cin>>a[i]>>b[i]>>c[i];		bit[i]=0;	}	for(int j=2;j<=m;++j){		add(min(p[j-1],p[j]),1);		add(max(p[j-1],p[j]),-1);	}	int x=0;	for(int i=1;i<n;++i){		if(a[i]*s(i)<=b[i]*s(i)+c[i]){			x+=a[i]*s(i);		}else{			x+=b[i]*s(i)+c[i];		}	}	cout<<x<<endl;

Compiler output:
a.cc:1:25: warning: extra tokens at end of #include directive
    1 | #include<iostream>using namespace std;int bit[100000],n;int s(int i){   int S=0;        while(i>0){             S+=bit[i];              i-=i&-i;        }       return S;}void add(int i,int x){        while(i<n){             bit[i]+=x;              i+=i&-i;        }}int main(){   int m,p[100001],a[100000],b[100000],c[100000];  cin>>n>>m>>p[1];        for(int j=2;j<=m;++j){          cin>>p[j];      }       for(int i=1;i<n;++i){           cin>>a[i]>>b[i]>>c[i];          bit[i]=0;       }       for(int j=2;j<=m;++j){          add(min(p[j-1],p[j]),1);                add(max(p[j-1],p[j]),-1);       }       int x=0;        for(int i=1;i<n;++i){           if(a[i]*s(i)<=b[i]*s(i)+c[i]){                  x+=a[i]*s(i);           }else{                  x+=b[i]*s(i)+c[i];              }       }       cout<<x<<endl;
      |                         ^~~~~~~~~
a.cc:1:9: fatal error: iostream>usin: No such file or directory
    1 | #include<iostream>using namespace std;int bit[100000],n;int s(int i){   int S=0;        while(i>0){             S+=bit[i];              i-=i&-i;        }       return S;}void add(int i,int x){        while(i<n){             bit[i]+=x;              i+=i&-i;        }}int main(){   int m,p[100001],a[100000],b[100000],c[100000];  cin>>n>>m>>p[1];        for(int j=2;j<=m;++j){          cin>>p[j];      }       for(int i=1;i<n;++i){           cin>>a[i]>>b[i]>>c[i];          bit[i]=0;       }       for(int j=2;j<=m;++j){          add(min(p[j-1],p[j]),1);                add(max(p[j-1],p[j]),-1);       }       int x=0;        for(int i=1;i<n;++i){           if(a[i]*s(i)<=b[i]*s(i)+c[i]){                  x+=a[i]*s(i);           }else{                  x+=b[i]*s(i)+c[i];              }       }       cout<<x<<endl;
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

using namespace std;

int main()
{
    int N, M;
    
    scanf("%d", &N);
    scanf("%d", &M);
    
    vector<long long> P(M);
    
    vector<long long> Q(N - 1);
    vector<long long> A(N - 1);
    vector<long long> B(N - 1);
    vector<long long> C(N - 1);
    
    for(int i = 0; i < M; i++)
    {
        scanf("%lld", &P[i]);
    }
    
    for(int i = 0; i < M - 1; i++)
    {
        for(int j = min(P[i], P[i + 1]); j++)
        {
            Q[j]++;
        }
    }
    
    for(int i = 0; i < N - 1; i++)
    {
        scanf("%lld", &A[i]);
    }
    
    for(int i = 0; i < N - 1; i++)
    {
        scanf("%lld", &B[i]);
    }
    
    for(int i = 0; i < N - 1; i++)
    {
        scanf("%lld", &C[i]);
    }
    
    long long ret = 0;
    
    for(int i = 0; i < N - 1; i++)
    {
        long long s = A[i] * Q[i];
        long long t = B[i] * Q[i] + C[i];
        
        ret += min(s, t);
    }
    
    printf("%lld\n", ret);
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:45: error: expected ';' before ')' token
   28 |         for(int j = min(P[i], P[i + 1]); j++)
      |                                             ^
      |                                             ;
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#define int long long
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	vector<int>c(b);
	vector<int>f(a-1);
	for (int d = 0; d < b; d++) { int g; cin >> g; g--; c[d] = g; }
	for (int e = 0; e < b - 1; e++) {
		vector<int>h(2); h[0] = c[e]; h[1] = c[e + 1];
		sort(h.begin(), h.end());
		for (int i = 0; i < a - 1; i++) {
			if (i >= h[0] && i < h[1])f[i]++;
		}
	}
	int s = 0;
	for (int i = 0; i < a - 1; i++) {
		int x, y, z;
		cin >> x >> y >> z;
		s += min(x*f[i],z+y*f[i]);
	}
	cout << s << endl;
}

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

#inclued<iostream>
using namespace std;
int main ()
{
    long long coin = 0;
    int ki,ic1,ic2;
    int min;
    int n,m;
    int sum,big;
    long cum[100001];
    long suu[100001];
    cin >> n >> m >> cum[1];
    for(int i=2;i<m;i++)
    {
        ci >> cum;
        if(cum[i]<cum[i-1])
        {sum=cum[i];
         big=cum[i-1];}
        else
        {sum=cum[i-1];
         big=cum[i];}
        while(sum<big)
        {suu[sum]++;
         sum++;}
    }
    for(int i=1;i<n;i++)
    {
        cin >> ki >> ic1 >> ic2;
        min = ki*suu[i];
        if(min>ic2+ic1*suu[i])
        {min=ic2+ic1*suu[i]}
        coin+=min;
    }
    cout << coin;
    return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inclued; did you mean #include?
    1 | #inclued<iostream>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     cin >> n >> m >> cum[1];
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inclued<iostream>
a.cc:15:9: error: 'ci' was not declared in this scope; did you mean 'i'?
   15 |         ci >> cum;
      |         ^~
      |         i
a.cc:31:28: error: expected ';' before '}' token
   31 |         {min=ic2+ic1*suu[i]}
      |                            ^
      |                            ;
a.cc:34:5: error: 'cout' was not declared in this scope
   34 |     cout << coin;
      |     ^~~~
a.cc:34:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<iostream>
using namespace std;
int main ()
{
    long long coin = 0;
    int ki,ic1,ic2;
    int min;
    int n,m;
    int sum,big;
    long cum[100001];
    long suu[100001];
    cin >> n >> m >> cum[1];
    for(int i=2;i<m;i++)
    {
        cin >> cum[i]];
        if(cum[i]<cum[i-1])
        {
        	sum=cum[i];
        	big=cum[i-1];
        }
        else
        {
        	sum=cum[i-1];
        	big=cum[i];
         }
        while(sum<big)
        {
        	suu[sum]++;
        	um++;
         }
    }
    for(int i=1;i<n;i++)
    {
        cin >> ki >> ic1 >> ic2;
        min = ki*suu[i];
        if(min>ic2+ic1*suu[i])
        {
        	min=ic2+ic1*suu[i]
        }
        coin+=min;
    }
    cout << coin;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: expected ';' before ']' token
   15 |         cin >> cum[i]];
      |                      ^
      |                      ;
a.cc:29:17: error: 'um' was not declared in this scope; did you mean 'cum'?
   29 |                 um++;
      |                 ^~
      |                 cum
a.cc:38:35: error: expected ';' before '}' token
   38 |                 min=ic2+ic1*suu[i]
      |                                   ^
      |                                   ;
   39 |         }
      |         ~
Language: C++

//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
int P[100001];
long long A[100001],B[100001],C[100001];
int D[100001];

int main() {
	int N,M;
	long long R=0;
	cin>>N>>M;
	for(int i=1;i<M+1;i++)cin>>P[j];

	for(int i=1;i<N;i++)cin>>A[i]>>B[i]>>C[i];

	for(int i=1;i<M;i++){
		if(P[i]<P[i+1]){
			for(int j=P[i];j<P[i+1];j++)D[j]+=1;
		}else{
			for(int j=P[i+1];j<P[i];j++)D[j]+=1;
		}
	}

	for(int j=1;j<N;j++)R+=min(D[j]*B[j]+C[j],D[j]*A[j]);
	cout<<R<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:38: error: 'j' was not declared in this scope
   19 |         for(int i=1;i<M+1;i++)cin>>P[j];
      |                                      ^
Language: C++

//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
long long P[100001];
long long A[100001],B[100001],D[100001];
int D[100001];
int main() {
	int N,M;
	long long R=0;

	cin>>N>>M;
	for(int i=1;i<M+1;i++)cin>>P[i];

	for(int i=1;i<N;i++)cin>>A[i]>>B[i]>>C[i];

	for(int i=1;i<M;i++){
		if(P[i]<P[i+1]){
			for(int j=P[i];j<P[i+1];j++)D[j]+=1;
		}else
			for(int j=P[i+1];j<P[i];j++)D[j]+=1;

	}

	for(int i=1;i<N;i++)R+=min(D[i]*A[i],D[i]*B[i]+C[i]);

	cout<<R<<endl;
	return 0;
}

Compiler output:
a.cc:13:5: error: conflicting declaration 'int D [100001]'
   13 | int D[100001];
      |     ^
a.cc:12:31: note: previous declaration as 'long long int D [100001]'
   12 | long long A[100001],B[100001],D[100001];
      |                               ^
a.cc: In function 'int main()':
a.cc:21:46: error: 'C' was not declared in this scope
   21 |         for(int i=1;i<N;i++)cin>>A[i]>>B[i]>>C[i];
      |                                              ^
a.cc:31:56: error: 'C' was not declared in this scope
   31 |         for(int i=1;i<N;i++)R+=min(D[i]*A[i],D[i]*B[i]+C[i]);
      |                                                        ^
Language: C++

//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
long long P[100001];
long long A[100001],B[100001],D[100001];
int D[100001];
int main() {
	int N,M;
	long long R=0;

	cin>>N>>M;
	for(int i=1;i<M+1;i++)cin>>P[i];

	for(int i=1;i<N;i++)cin>>A[i]>>B[i]>>C[i];

	for(int i=1;i<M;i++){
		if(P[i]<P[i+1]){
			for(int j=P[i];j<P[i+1];j++)D[j]+=1;
		}else{
			for(int j=P[i+1];j<P[i];j++)D[j]+=1;
		}
	}

	for(int j=1;j<N;j++)R+=min(D[j]*A[j],D[j]*B[j]+C[j]);

	cout<<R<<endl;
	return 0;
}

Compiler output:
a.cc:13:5: error: conflicting declaration 'int D [100001]'
   13 | int D[100001];
      |     ^
a.cc:12:31: note: previous declaration as 'long long int D [100001]'
   12 | long long A[100001],B[100001],D[100001];
      |                               ^
a.cc: In function 'int main()':
a.cc:21:46: error: 'C' was not declared in this scope
   21 |         for(int i=1;i<N;i++)cin>>A[i]>>B[i]>>C[i];
      |                                              ^
a.cc:31:56: error: 'C' was not declared in this scope
   31 |         for(int j=1;j<N;j++)R+=min(D[j]*A[j],D[j]*B[j]+C[j]);
      |                                                        ^
Language: C++

#include<bits/stdc++.h>

using namespace std;
#define int long long
#define N 100005
int a, b, c, n, m, s, t, res, from[N], to[N], cnt;
signed main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> m;
	cin >> b;
	for(int i = 1; i < m; i++)
	{
		a = b;
		cin >> b;
		from[i] = min(a, b);
		to[i] = max(a, b);
	}
	sort(from + 1, from + m);
	sort(to + 1, to + m);
	s = t = 1;
	res = cnt = 0;
	for(int i = 1; i < n; i++)
	{
		cin >> a >> b >> c;
		while(i == from[s])
		{
			cnt++;
			s++;
		}
		while(i == to[t])
		{
			cnt--;
			t++;
		}
		res += min(cnt * a, cnt * b + c);
	}
	cout << res << '\n';
	
}javascript:void(0)

Compiler output:
a.cc:40:2: error: 'javascript' does not name a type
   40 | }javascript:void(0)
      |  ^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#define int long
using namespace std;
int a,b,c;
vector<int> arr,vi;
map<int,int> ma;
int m[500][100010];
int i,j,k;
int x,y;
bool check[100005];
int org[100005];
int l,r;
int M,N;
int a[100010];
int b[100010];
int c[100010];
int cnt[100010];
signed main()
{
  ios_base::sync_with_stdio(0);
  cin>>M>>N;
  for(i=1;i<=N;i++)
    cin>>org[i];
  for(i=1;i<M;i++)
  {
      cin>>a[i]>>b[i]>>c[i];
  }
  for(i=1;i<M;i++)
  {
      if(p[i]>p[i+1])
      {
          for(j=p[i];j<p[i+1];j++)
            cnt[j]++;
      }
      else
        for(j=p[i]-1;j>=p[i+1];j++)
          cnt[j]++;
  }
  int kq=0;
  for(i=1;i<M;i++)
  {
      kg+=min(a[i]*cnt[i],c[i]+b[i]*cnt[i]);
  }
  cout<<kq<<endl;
}

Compiler output:
a.cc:14:5: error: conflicting declaration 'long int a [100010]'
   14 | int a[100010];
      |     ^
a.cc:4:5: note: previous declaration as 'long int a'
    4 | int a,b,c;
      |     ^
a.cc:15:5: error: conflicting declaration 'long int b [100010]'
   15 | int b[100010];
      |     ^
a.cc:4:7: note: previous declaration as 'long int b'
    4 | int a,b,c;
      |       ^
a.cc:16:5: error: conflicting declaration 'long int c [100010]'
   16 | int c[100010];
      |     ^
a.cc:4:9: note: previous declaration as 'long int c'
    4 | int a,b,c;
      |         ^
a.cc: In function 'int main()':
a.cc:26:13: error: invalid types 'long int[long int]' for array subscript
   26 |       cin>>a[i]>>b[i]>>c[i];
      |             ^
a.cc:26:19: error: invalid types 'long int[long int]' for array subscript
   26 |       cin>>a[i]>>b[i]>>c[i];
      |                   ^
a.cc:26:25: error: invalid types 'long int[long int]' for array subscript
   26 |       cin>>a[i]>>b[i]>>c[i];
      |                         ^
a.cc:30:10: error: 'p' was not declared in this scope
   30 |       if(p[i]>p[i+1])
      |          ^
a.cc:42:7: error: 'kg' was not declared in this scope; did you mean 'kq'?
   42 |       kg+=min(a[i]*cnt[i],c[i]+b[i]*cnt[i]);
      |       ^~
      |       kq
a.cc:42:16: error: invalid types 'long int[long int]' for array subscript
   42 |       kg+=min(a[i]*cnt[i],c[i]+b[i]*cnt[i]);
      |                ^
a.cc:42:28: error: invalid types 'long int[long int]' for array subscript
   42 |       kg+=min(a[i]*cnt[i],c[i]+b[i]*cnt[i]);
      |                            ^
a.cc:42:33: error: invalid types 'long int[long int]' for array subscript
   42 |       kg+=min(a[i]*cnt[i],c[i]+b[i]*cnt[i]);
      |                                 ^
Language: C++

#include<stdio.h>
int main()
{
	long i,n,m,x[100000],a[100000],b[100000],c[100000],k[100000],d,s,y=0;
        longlong t=0;
	scanf("%d%d",&n,&m);
	for (i=1;i<=m;i++) scanf("%d",&x[i]);
	for (i=1;i<=n-1;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);
	for (i=1;i<=n;i++) k[i]=0;
	for (i=1;i<=m-1;i++)
	{
		if (x[i]>x[i+1])
		{
			d=x[i];
			s=x[i+1];
			while (d>s)
			{
				d=d-1;
				k[d]=k[d]+1;
			}
		}
		else if (x[i]<x[i+1])
		{
			d=x[i];
			s=x[i+1];
			while (d<s)
			{
				k[d]=k[d]+1;
				d=d+1;
			}
		}
	}
	for (i=1;i<=n;i++)
	{
		if (k[i]!=0)
		{
			y=c[i]+b[i]*k[i];
			if (y>a[i]*k[i]) y=a[i]*k[i];
			t=t+y;
		}
	}
	printf("%d\n",t);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'longlong' was not declared in this scope
    5 |         longlong t=0;
      |         ^~~~~~~~
a.cc:39:25: error: 't' was not declared in this scope
   39 |                         t=t+y;
      |                         ^
a.cc:42:23: error: 't' was not declared in this scope
   42 |         printf("%d\n",t);
      |                       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long i,n,m,x[100000],a[100000],b[100000],c[100000],k[100000],d,s,y=0;
        longlong t=0;
	scanf("%d%d",&n,&m);
	for (i=1;i<=m;i++) scanf("%d",&x[i]);
	for (i=1;i<=n-1;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);
	for (i=1;i<=n;i++) k[i]=0;
	for (i=1;i<=m-1;i++)
	{
		if (x[i]>x[i+1])
		{
			d=x[i];
			s=x[i+1];
			while (d>s)
			{
				d=d-1;
				k[d]=k[d]+1;
			}
		}
		else if (x[i]<x[i+1])
		{
			d=x[i];
			s=x[i+1];
			while (d<s)
			{
				k[d]=k[d]+1;
				d=d+1;
			}
		}
	}
	for (i=1;i<=n;i++)
	{
		if (k[i]!=0)
		{
			y=c[i]+b[i]*k[i];
			if (y>a[i]*k[i]) y=a[i]*k[i];
			t=t+y;
		}
	}
	printf("%d\n",t);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'longlong' was not declared in this scope
    6 |         longlong t=0;
      |         ^~~~~~~~
a.cc:40:25: error: 't' was not declared in this scope
   40 |                         t=t+y;
      |                         ^
a.cc:43:23: error: 't' was not declared in this scope
   43 |         printf("%d\n",t);
      |                       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef int long long
int p[100000],pcnt[100001],a[100001],b[100001],c[100001];
int main(void){
	int n,m,i,ima,x,t,tt,sum;
	cin>>n>>m;
	for(i=0;i<m;i++) cin>>p[i];
	ima=p[0];
	for(i=0;i<=m;i++) pcnt[i]=0;
	for(i=1;i<m;i++){
		x=p[i]-ima;
		if(x>=0){
			pcnt[ima]++;
			ima=ima+x;
			pcnt[ima]--;
		}
		else{
			pcnt[ima]--;
			ima=ima+x;
			pcnt[ima]++;
		}
	}
	for(i=1;i<n;i++) pcnt[i]=pcnt[i]+pcnt[i-1];
//	for(i=1;i<n;i++) cout<<pcnt[i]<<' ';
//	cout<<endl;
	sum=0;
	for(i=1;i<n;i++) cin>>a[i]>>b[i]>>c[i];
	for(i=1;i<n;i++){
		t=c[i]+b[i]*pcnt[i]; tt=a[i]*pcnt[i];
		if(t<tt) sum+=t;
		else sum+=tt;
	}
	cout<<sum<<endl;
	return 0;
}

Compiler output:
a.cc:3:9: error: two or more data types in declaration of 'p'
    3 | typedef int long long
      |         ^~~
a.cc:3:9: error: two or more data types in declaration of 'pcnt'
a.cc:3:9: error: two or more data types in declaration of 'a'
a.cc:3:9: error: two or more data types in declaration of 'b'
a.cc:3:9: error: two or more data types in declaration of 'c'
a.cc: In function 'int main()':
a.cc:8:31: error: 'p' was not declared in this scope
    8 |         for(i=0;i<m;i++) cin>>p[i];
      |                               ^
a.cc:9:13: error: 'p' was not declared in this scope
    9 |         ima=p[0];
      |             ^
a.cc:10:27: error: 'pcnt' was not declared in this scope
   10 |         for(i=0;i<=m;i++) pcnt[i]=0;
      |                           ^~~~
a.cc:14:25: error: 'pcnt' was not declared in this scope
   14 |                         pcnt[ima]++;
      |                         ^~~~
a.cc:19:25: error: 'pcnt' was not declared in this scope
   19 |                         pcnt[ima]--;
      |                         ^~~~
a.cc:24:26: error: 'pcnt' was not declared in this scope
   24 |         for(i=1;i<n;i++) pcnt[i]=pcnt[i]+pcnt[i-1];
      |                          ^~~~
a.cc:28:31: error: 'a' was not declared in this scope
   28 |         for(i=1;i<n;i++) cin>>a[i]>>b[i]>>c[i];
      |                               ^
a.cc:28:37: error: 'b' was not declared in this scope
   28 |         for(i=1;i<n;i++) cin>>a[i]>>b[i]>>c[i];
      |                                     ^
a.cc:28:43: error: 'c' was not declared in this scope
   28 |         for(i=1;i<n;i++) cin>>a[i]>>b[i]>>c[i];
      |                                           ^
a.cc:30:19: error: 'c' was not declared in this scope
   30 |                 t=c[i]+b[i]*pcnt[i]; tt=a[i]*pcnt[i];
      |                   ^
a.cc:30:24: error: 'b' was not declared in this scope
   30 |                 t=c[i]+b[i]*pcnt[i]; tt=a[i]*pcnt[i];
      |                        ^
a.cc:30:29: error: 'pcnt' was not declared in this scope
   30 |                 t=c[i]+b[i]*pcnt[i]; tt=a[i]*pcnt[i];
      |                             ^~~~
a.cc:30:41: error: 'a' was not declared in this scope
   30 |                 t=c[i]+b[i]*pcnt[i]; tt=a[i]*pcnt[i];
      |                                         ^
Language: C++

#include <iostream>
using namespace std;
#define INFTY 1000005
int n,m,P[INFTY],A[INFTY],B[INFTY],C[INFTY],cnt[INFTY];
int main(){
    //cout<<endl;
    cin>>n>>m;
    for(int i=0; i<=n; i++) {cnt[i]=0;}
    for(int i=1; i<=m; i++) cin>>P[i];??¨    for(int i=1; i<m; i++) {
        if(P[i]==m){cnt[i-1]++; continue;}
        if(P[i+1]-P[i]>=0){ cnt[P[i]]++; cnt[P[i+1]]--;}
        else { cnt[P[i]]--; cnt[P[i+1]]++;}
    }
    for(int i=1; i<n; i++){
        //cout<<"before cnt["<<i<<"]=="<<cnt[i]<<endl;
        cnt[i]+=cnt[i-1];
        //cout<<"cnt["<<i<<"]=="<<cnt[i]<<endl;??¨    }
    for(int i=1; i<n; i++) cin>>A[i]>>B[i]>>C[i];
    long long ans=0;
    for(int i=1; i<n; i++){
        if(A[i]*cnt[i]>B[i]*cnt[i]+C[i]) ans+=B[i]*cnt[i]+C[i];
        else ans+=A[i]*cnt[i];
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:39: error: expected primary-expression before '?' token
    9 |     for(int i=1; i<=m; i++) cin>>P[i];??¨    for(int i=1; i<m; i++) {
      |                                       ^
a.cc:9:40: error: expected primary-expression before '?' token
    9 |     for(int i=1; i<=m; i++) cin>>P[i];??¨    for(int i=1; i<m; i++) {
      |                                        ^
a.cc:9:41: error: '\U000000a8' was not declared in this scope
    9 |     for(int i=1; i<=m; i++) cin>>P[i];??¨    for(int i=1; i<m; i++) {
      |                                         ^
a.cc:9:42: error: expected ':' before 'for'
    9 |     for(int i=1; i<=m; i++) cin>>P[i];??¨    for(int i=1; i<m; i++) {
      |                                          ^   ~~~
      |                                          :
a.cc:9:46: error: expected primary-expression before 'for'
    9 |     for(int i=1; i<=m; i++) cin>>P[i];??¨    for(int i=1; i<m; i++) {
      |                                              ^~~
a.cc:9:42: error: expected ':' before 'for'
    9 |     for(int i=1; i<=m; i++) cin>>P[i];??¨    for(int i=1; i<m; i++) {
      |                                          ^   ~~~
      |                                          :
a.cc:9:46: error: expected primary-expression before 'for'
    9 |     for(int i=1; i<=m; i++) cin>>P[i];??¨    for(int i=1; i<m; i++) {
      |                                              ^~~
a.cc:9:59: error: 'i' was not declared in this scope
    9 |     for(int i=1; i<=m; i++) cin>>P[i];??¨    for(int i=1; i<m; i++) {
      |                                                           ^
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
ll N,M;
ll P[100001];
ll A[100001];
ll B[100001];
ll C[100001];
ll D[100001];
ll main() {
	cin>>N>>M;
	for(int i=1;i<M+1;i++){
		cin>>P[i];
	}
	for(int i=1;i<N;i++){
		cin>>A[i]>>B[i]>>C[i];
	}

	ll R=0;
	for(int i=1; i<M; i++){
		if(P[i]<P[i+1]){
			for(int j=P[i]; j<P[i+1]; j++)D[ j ] += 1;
		}else{
			for(int j=P[i+1]; j<P[i]; j++)D[ j ] += 1;
		}
	}

	for(int j=1; j<N; j++) R += min(D[ j ]*B[ j ]+C[ j ],  D[ j ]*A[ j ]);

	cout<<R<<endl;
 	return 0;
}



Compiler output:
a.cc:24:1: error: '::main' must return 'int'
   24 | ll main() {
      | ^~
Language: C

#include<stdio.h>
#define int long long
int MAX(int a,int b){return a<b?b:a;}
int pr(int i){return (i+n-1)%n;}
int nx(int i){return (i  +1)%n;}
int n,i,j,d[2010][2010]={0};
signed main(){
  scanf("%lld",&n);
  for(i=0;i<2010*2010;i++)d[i/2010][i%2010]=-1000000000;
  for(i=0;i<n;i++)scanf("%lld",&d[1][i]);
  for(i=1;i<n;i++){
    for(j=0;j<n;j++){
      if(i%2){
	if(d[1][pr(j)]>d[1][nx(i+j-1)])d[i+1][pr(j)]=MAX(d[i+1][pr(j)],d[i][j]);
	else d[i+1][j]=MAX(d[i+1][j],d[i][j]);
      }
      else d[i+1][j]=MAX(d[i][j]+d[1][nx(i+j-1)],d[i][nx(j)]+d[1][j]);
      }
    }
  }
  for(i=j=0;i<n;i++)j=MAX(j,d[n][i]);
  printf("%lld\n",j);
  return 0;
}

Compiler output:
main.c: In function 'pr':
main.c:4:25: error: 'n' undeclared (first use in this function)
    4 | int pr(int i){return (i+n-1)%n;}
      |                         ^
main.c:4:25: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'nx':
main.c:5:30: error: 'n' undeclared (first use in this function)
    5 | int nx(int i){return (i  +1)%n;}
      |                              ^
main.c: At top level:
main.c:21:3: error: expected identifier or '(' before 'for'
   21 |   for(i=j=0;i<n;i++)j=MAX(j,d[n][i]);
      |   ^~~
main.c:21:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   21 |   for(i=j=0;i<n;i++)j=MAX(j,d[n][i]);
      |              ^
main.c:21:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   21 |   for(i=j=0;i<n;i++)j=MAX(j,d[n][i]);
      |                  ^~
main.c:22:10: error: expected declaration specifiers or '...' before string constant
   22 |   printf("%lld\n",j);
      |          ^~~~~~~~
main.c:22:19: error: expected declaration specifiers or '...' before 'j'
   22 |   printf("%lld\n",j);
      |                   ^
main.c:23:3: error: expected identifier or '(' before 'return'
   23 |   return 0;
      |   ^~~~~~
main.c:24:1: error: expected identifier or '(' before '}' token
   24 | }
      | ^