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

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <cmath>
#include <cstdlib>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define MOD 1000000007
#define INF 1000000007
#define int long long
#define PI 3.14159265358979323846
using namespace std;
//
int N,A,B;
vector<long long> H;
bool check(int X){
  int cnt=0;
  FOR(i,0,N){
    int G=H[i]-B*X;
    if(G<=0){
      return true;
    }else{
      cnt+=(G+(A-B)-1)/(A-B);
    }
    if(cnt>X){
      return false;
    }
  }
  return true;
}
int main(){
  cin>>N>>A>>B;
  FOR(i,0,N){
    int h;
    cin>>h;
    H.PB(h);
  }
  sort(H.rbegin(),H.rend());
  int lo=0,up=1e9;
  while(up-lo>1){
    int md=(lo+up)/2;
    if(check(md)){
      up=md;
    }else{
      lo=md;
    }
  }
  cout<<up<<endl;
  return 0;
}


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

#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

ll n,a,b;
ll v[100010];

bool check(ll mid)
{
	ll num = 0;
	REP(i,n)
	{
		ll tmp = b*mid;
		
		if((v[i] - tmp + a - 1) / a > 0)
		{
			num += (v[i] - tmp + a - 1) / a;
		}
	}
	
	return mid >= num;
}

int main()
{
	cin >> n>> a>> b;
	a -= b;
	
	
	REP(i,n)
	{
		cin >> v[i];
	}
	
	ll ub,tb;
	ub = 0;tb = 10000000000;
	
	while(tb - ub > 1)
	{		
		cout << mid << endl;
		
		if(check(mid))tb = mid;
		else ub = mid;
	}
	
	cout << tb << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:73:25: error: 'mid' was not declared in this scope
   73 |                 cout << mid << endl;
      |                         ^~~
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
int n,a,b,h[100005];
bool check(long long k)
{
	long long ck=k;
	for(int i=0;i<n;i++)
	{
		if(k*b>=(long long) h[i]);
		else if(k*a>=(long long) h[i])
		{
			t-=(long long) ceil((double) ((double) (h[i]-k*b))/((double) (a-b)));
			if(t<0) return false;
		}
		else return false;
	}
	return true;
}
int solve()
{
	int lb=-1,rb=1e9;
	while (lb<rb-1)
	{
		int mid=(lb+rb)/(long long)2;
		if (!check(mid))
		{
			lb=mid;
		}
		else
		{
			rb=mid;
		}
	}
	return rb;
}
int main()
{
	cin >> n >> a >> b;
	for (int i=0;i<n;i++)
	{
		cin >> h[i];
	}
	cout << solve();
	return 0;
}

Compiler output:
a.cc: In function 'bool check(long long int)':
a.cc:13:25: error: 't' was not declared in this scope
   13 |                         t-=(long long) ceil((double) ((double) (h[i]-k*b))/((double) (a-b)));
      |                         ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>
using namespace std;
const long long int mod=1000000009;
const long long int INF=1000000000;
const long long int MAX=1000000000;
int main()
{
	long long int n,a,b;
	vector<long long int> h;
	cin>>n>>a>>b;
	a-=b;
	h.resize(n);
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
 
	long long int up=MAX,low=0;
	long long int mid=0;
 
	while(up-low>1)
	{
		mid=(up+low)/2;
		long long int t=0;
		for(int i=0;i<n;i++)
		{
			t+=max(0,(int)(ceil((float)(h[i]-k*b)/(float)a)));
		}
        if(t<=mid)
		{
			up=mid;
		}else
		{
			low=mid;
		}
	}
	cout<<up<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:58: error: 'k' was not declared in this scope
   35 |                         t+=max(0,(int)(ceil((float)(h[i]-k*b)/(float)a)));
      |                                                          ^
Language: C++

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

int main()
{
int n;
cin>>n;
int a,b;
cin>>a>>b;
float arr[n];
int mx = 0;
for(int  i = 0;i<n;i++)
{
cin>>arr[i];
mx += int(ceil(arr[i]/a));
}

int mn = 1;

while(mn!= mx)
{
int mid = (mn+mx)/2;
int rem = mid;
long long int b_cm = mid*b;
int i;
for( i = 0;i<n;i++)
{
if(arr[i]> b_cm)
{
int req = int(ceil((arr[i] - b_cm)/(a-b)));
if(req >rem )
break;
else rem -= req;
}
}
if(i==n)
mx = mid;
else 
mn = mid+1;
}
cout<<mn;



Compiler output:
a.cc: In function 'int main()':
a.cc:41:10: error: expected '}' at end of input
   41 | cout<<mn;
      |          ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;
 
LL N, A, B, h[112345];
LL low, high, mid;
 
bool check(LL T)
{
	LL res = 0;
	rep(i, N)
	{
		if (h[i] > B*T)
		{
			res += (h[i] - B*T) / (A - B);
			if ((h[i] - B*T) % (A - B) != 0) { ++res; }
		}
	}
	return (res <= T);
}
 
int main()
{
	in >> N >> A >> B;
	rep(i, N) { in >> h[i]; }
 
	low = 1; high = 1129999934567890;
	while (high - low > 1)
	{
		mid = (high + low) / 2;
		if (check(mid)) { high = mid; }
		else { low = mid; }
	}
 
	out << high << std::endl;
	return 0;
}

Compiler output:
a.cc:8:1: error: extended character   is not valid in an identifier
    8 |  
      | ^
a.cc:11:1: error: extended character   is not valid in an identifier
   11 |  
      | ^
a.cc:25:1: error: extended character   is not valid in an identifier
   25 |  
      | ^
a.cc:30:1: error: extended character   is not valid in an identifier
   30 |  
      | ^
a.cc:38:1: error: extended character   is not valid in an identifier
   38 |  
      | ^
a.cc:8:1: error: '\U000000a0' does not name a type
    8 |  
      | ^
a.cc:11:1: error: '\U000000a0' does not name a type
   11 |  
      | ^
a.cc:25:1: error: '\U000000a0' does not name a type
   25 |  
      | ^
Language: C++

#include <iostream>
typedef long long in;
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    in a,b,diff,h[123456],mid,l,r,temp,t=0,res;
    int n;
    cin>>n>>a>>b;
    diff=a-b;
    l=1; r=10e9+10;
    in res=r;
    for (int i=0;i<n;i++) cin>>h[i];
    while (r-l>1){
        mid = (l+r)>>1;
        t=0;
        for (int i=0;i<n;i++)
            {
                temp = h[i]-b*mid;
                if (temp>=0) {t+=temp/diff;
                        if (temp%diff!=0) t++;
                }
            }
        if (t>mid) l=mid+1;
        else r=mid-1,res=mid;
    }
    cout<<res;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: redeclaration of 'in res'
   13 |     in res=r;
      |        ^~~
a.cc:8:44: note: 'in res' previously declared here
    8 |     in a,b,diff,h[123456],mid,l,r,temp,t=0,res;
      |                                            ^~~
Language: C++

#include <iostream>
typedef long long in;
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    in a,b,diff,h[123456],mid,l,r,temp,t=0;
    int n;
    cin>>n>>a>>b;
    diff=a-b;
    l=1; r=10e9+10;
    for (int i=0;i<n;i++) cin>>h[i];
    while (r-l>1){
        mid = (l+r)/2;
        t=0;
        for (int i=0;i<n;i++)
            {
                temp = h[i]-b*mid;
                if (temp>0) {t+=temp/diff;
                        if (temp%diff!=0) t++;
                }
            }
        if (t>mid) l=mid-1;
        else r=mid-1; res=mid;
    }
    cout<<mid;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:23: error: 'res' was not declared in this scope
   25 |         else r=mid-1; res=mid;
      |                       ^~~
Language: C++

#include <iostream>
#include <algorithm>

typedef long long ll;

#define FOR(i,a,b) for(ll i = (a);i < (b);++i)
#define REP(i,n) FOR(i,0,n)

#define debug(x) cout << #x << "=" << x << endl;

using namespace std;

int N,A,B;
int enemyLP[100000];

bool check(ll mid){

    ll cnt = 0;
    int addDmg = A-B;
    int splashDmg = B;

    REP(i,N){
        
        if(enemyLP[i] > splashDmg * mid){
            cnt += ceil((enemyLP[i] - splashDmg * mid) / addDmg);
        }
        
    }
    if(cnt <= mid){
        return true;
    }else{
        return false;
    }
}

int main(void){

    cin >> N >> A >> B;

    REP(i,N){
        cin >> enemyLP[i];
    }

    int ok = (int)1e+9;
    int ng = -1;
    
    while(abs(ok - ng) > 1){

        ll mid = (ok + ng) / 2;

        if(check(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }

    cout << ok << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'bool check(ll)':
a.cc:25:20: error: 'ceil' was not declared in this scope
   25 |             cnt += ceil((enemyLP[i] - splashDmg * mid) / addDmg);
      |                    ^~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<stdio.h>
#include<string.h>
#include<string>
#include<string>
#include<set>
#include<stdlib.h>
#include<bitset>
#include<algorithm>
using namespace std;
#define ll long long
int n,a,b;
vector<int>v;
bool check(long long x) {
	long long sum = 0;
	for (int i = 0; i < n; ++i) {
		if (b*x >= v[i])
			continue;
		// x == y + z
		// v[i] <= a*y + b*z
		// v[i] <= a*y +(b*(x-y))
		// v[i] <= a*y + b*x -b*y
		// v[i] -b*x <= y*(a-b)
		// y = (v[i] - b*x)/(a-b)
		sum += max((ll)0, (ll)ceil((double)(v[i] - b*x) / (a - b)));
	}
	return sum <= x;
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif // !ONLINE_JUDGE
	int x;
	scanf("%d%d%d", &n, &a, &b);
	long long d = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%d", &x);
		v.push_back(x);
		d += x / a + (x%a?1:0);
	}
	long long low = 0, high = d, mid, ans = d;
	while (low <= high) {
		mid = (low + high) / 2;
		if (check(mid)) {
			ans = mid;
			high = mid - 1;
		}
		else
			low = mid + 1;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'bool check(long long int)':
a.cc:29:39: error: 'ceil' was not declared in this scope
   29 |                 sum += max((ll)0, (ll)ceil((double)(v[i] - b*x) / (a - b)));
      |                                       ^~~~
Language: C++

#include <bits/stdc++.h>

#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdbl vector<double>
#define vstr vector<string>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll N,A,B;
ll h[100001];

bool C(ll x){
	ll l = x;

	rep(i,N){
		ll a = h[i];
		if(a <= B*x){
			continue;
		}

		ll b = a - B*x;
		ll c = b % (A-B) == 0 ? b / (A-B) : b / (A-B) + 1;

		l -= c;
		if(l < 0) return false;
	}
	return true;
}

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

	cin >> N >> A >> B;

	sum = 0;
	rep(i,N){
		cin >> h[i];
	}

	ll lb = 0;
    ll ub = 1e10;
    while(ub - lb > 1){
        ll mid = (lb + ub) / 2;
        // cout << lb << "," << mid << "," << ub << "," << C(mid) << endl;
        if(C(mid)) ub = mid;
        else lb = mid;
    }
	
	cout << ub << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:9: error: 'sum' was not declared in this scope
   46 |         sum = 0;
      |         ^~~
Language: C++

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

#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

#define int long long
#define INF (int)(1e9 + 7)

int n, a, b;
vector<int> h;

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> n >> a >> b;

	h.resize(n);

	for (int i = 0; i < n; ++i)	{
		cin >> h[i];
	}

	sort(h.begin(), h.end(), greater<int>());

	int l = 0, r = INF, dif = a - b, t = 0, m, tmp;

	for (;;) {
	

		t = m = 0;

		for (int i = 0; i < n; ++i) {
			m = h[i] - b * l;
			if (m > 0) {
				t += (m % dif == 0) ? m / dif : m / dif + 1;
			}
			else if (m <= 0) break;
		}

		if (t <= l) {
			l += (r - l) / 2;
			if (r - l < 10) break;
			continue;
		}

		t = m = 0;

		for (int i = 0; i < n; ++i) {
			m = h[i] - b * r;
			if (m > 0) {
				t += (m % dif == 0) ? m / dif : m / dif + 1;
			}
			else if (m <= 0) break;
		}

		if (t <= r) {
			r -= (r - l) / 2;
			if (r - l < 10) break;
			continue;
		}

		tmp = r;
		r += (r - l);
		l = tmp + 1;
	}

	int ans = INF;

	l = (l - 10 > 0) ? l - 10 : 0;
	r = (r + 10 < INF) ? r + 10 : r;

	for (int i = l; i <= r; ++i) {
		t = m = 0;

		for (int j = 0; j < n; ++j) {
			m = h[j] - b * i;
			if (m > 0) {
				t += (m % dif == 0) ? m / dif : m / dif + 1;
			}
			else if (m <= 0) break;
		}

		if (t <= i) {
			ans = (ans > i) ? i : ans;
		}
	}

	cout << ans << endl;

    return 0;
}



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

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

int n;
ll a, b, h[100000];

int can(ll k){
	ll s = 0;
	for(int i = 0; i < n; i++){
		s += max(0, ((h[i] - a * k) + b - 1) / b);
		if(s > k) return 0;
	}
	return 1;
}

int main(){
	scanf("%d%lld%lld", &n, &a, &b);
	for(int i = 0; i < n; i++) scanf("%lld", h + i);
	ll s = 1, e = int(1e14) + 5;
	while(s <= e){
		ll m = (s + e) / 2;
		if(can(m)) e = m - 1;
		else s = m + 1;
	}
	printf("%lld\n", s);
}

Compiler output:
a.cc: In function 'int can(ll)':
a.cc:11:25: error: no matching function for call to 'max(int, ll)'
   11 |                 s += max(0, ((h[i] - a * k) + b - 1) / b);
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:11:25: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   11 |                 s += max(0, ((h[i] - a * k) + b - 1) / b);
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:11:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   11 |                 s += max(0, ((h[i] - a * k) + b - 1) / b);
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

using namespace std;

int n;
long long a, b, c, ans = 0;
vector<long long> h;

bool f(long long aa) {
	long long an= 0;
	for (int i = 0; i < n; i++) {
		long long d = h[i] - aa*b;
		if (d > 0) {
			an += (d+c-1) / c);
		}
	}
	return an <= aa;
}

int main() {
	cin >> n >> a >> b;
	c = a - b;
	h.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	long long mm = 1, ma = 17179869185;
	long long now = (mm + ma)/2;
	while (ma - mm > 1) {
	//	cout << mm << " " << now <<  " " <<  ma <<endl;
		if (f(now)) {
			ma = now;
		}
		else {
			mm = now;
		}
		now = (mm + ma) / 2;
	}
	cout << ma << endl;
//	cin >> n;
	return 0;
}


Compiler output:
a.cc: In function 'bool f(long long int)':
a.cc:23:42: error: expected ';' before ')' token
   23 |                         an += (d+c-1) / c);
      |                                          ^
      |                                          ;
Language: C++

#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
 
using namespace std;
 
int n;
long long a, b, c, ans = 0;
vector<long long> h;
 
bool f(long long aa) {
	long long an= 0;
	for (int i = 0; i < n; i++) {
		long long d = h[i] - aa*b;
		if (d > 0) {
			an += ceil(double(d) / c);
		}
	}
	return an <= aa;
}
 
int main() {
	cin >> n >> a >> b;
	c = a - b;
	h.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	long long mm = 1, ma = 17179869185;
	long long now = (mm + ma)/2;
	while (ma - mm > 2) {
	//	cout << mm << " " << now <<  " " <<  ma <<endl;
		if (f(now)) {
			ma = now + 1;
		}
		else {
			mm = now;
		}
		now = (mm + ma) / 2;
	}
if(f(m)) cout << mm << endl;
else cout << mm + 1 << endl;
//	cin >> n;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:6: error: 'm' was not declared in this scope; did you mean 'ma'?
   48 | if(f(m)) cout << mm << endl;
      |      ^
      |      ma
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int n,a,b;
	cin>>n>>a>>b;
    long long int h[n];
	for(int i=0;i<n;++i){
		cin>>h[i];
	}
    long long int l = -1, r = (long long int)1e9;
    while(r-l>1){
    	long long int m=(l+r)/2;
    	long long int req=0;
    	for(int i=0;i<n;++i){
    		if(h[i]>(long long)m*(long long)b){
    			if(h[i]-m*b < a-b)res++;
    			else if(h[i]-m*b % (a-b) ==0)res+=(h[i]-m*b)/(a-b);
    			else
    			req+=(h[i]-(long long)m*(long long int)b)/(a-b) + 1;
    		}
    	}
    	if(req<=m){
    		r=m;
    	} else {
    		l=m;
    	}
    }
    cout<<r<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:43: error: 'res' was not declared in this scope; did you mean 'req'?
   16 |                         if(h[i]-m*b < a-b)res++;
      |                                           ^~~
      |                                           req
a.cc:17:54: error: 'res' was not declared in this scope; did you mean 'req'?
   17 |                         else if(h[i]-m*b % (a-b) ==0)res+=(h[i]-m*b)/(a-b);
      |                                                      ^~~
      |                                                      req
Language: C++

#include <iostream>
#include <vector>

using namespace std;

void display();

vector<long long> v;

int main(int argc, const char * argv[]) {
    long long n, a, b;
    long long x;
    
    long long cnt, num;
    
    //初期化
    cnt = 0;
    
    cin >> n >> a >> b;
    
    for (long long i = 0; i < n; i++) {
        cin >> x;
        v.push_back(x);
    }
    
    while (v.empty() != true) {
        sort(v.begin(), v.end());
        num = -1;
        
        v[v.size()-1] -= a;
        if (v[v.size()-1] <= 0) {
            v.erase(v.end()-1);
        }
        
        for (long long i = v.size()-1; i >= 0; i--) {
            if (v[i] - b > 0) {
                v[i] -= b;
            }else{
                num = i;
                break;
            }
        }
        
        //要素削除
        if (num != -1) {
            v.erase(v.begin(), v.begin()+num);
        }
        cnt++;
    }
    cout << cnt << endl;

    return 0;
}

void display() {
    for (long long i = 0; i < v.size(); i++) {
        cout << v[i] << ' ';
    }
    cout << endl;
}

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

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


int main(){
  int n,a,b;
  cin >> n >> a >> b;
  int h[n];
  for(int i=0;i<n;i++){
    cin >> h[i];
  }
  sort(h,h+n);

  int ans=1;
  int x=0;
  bool flag=false;
  while(){
    while(h[x]<=ans*b){
      x++;
      if(x>=n-1){
        flag=true;
        break;
      }
    }
    if(flag=true){
      break;
    }

    h[n-1]-=(a-b);
    sort(h,h+n);
    ans++;
  }

  cout << ans <<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: expected primary-expression before ')' token
   18 |   while(){
      |         ^
Language: C++

#include <iostream>

using namespace std;

int main(void){
  int n,a,b;
  int h[100000];
  int m=0;
  bool f;
  cin >> n >> a >> b;
  for (int i=0; i<n; i++) cin >> h[i];
  while(1){
    f=1;
    sort(h,h+n);
    h[n-1] -= a;
    if(h[n-1]>0) f=0;
    for (int i=0; i<n-1; i++){
      h[i] -= b;
      if(h[i]>0) f=0;
    }
    m += 1;
    if(f==1){
      cout << m << endl;
      return 0;
    }
  }
}


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

#include <stdio.h>
#include <algorithm>

using ll = long long;
int main() {
	ll N, A, B, Diff, h[100001];
	scanf("%lld %lld %lld", &N, &A, &B);
	Diff = A - B;
	for (int i = 0; i < N; i++)
		scanf("%lld", h + i);

	std::sort(h, h + N);
	h[N] = LLONG_MAX;
	ll up = 1000000000, down = 0, center = (up + down) / 2;
	while (1 < (up - down)) {
		ll aup = N + 1, adown = 0, acenter = (aup + adown) / 2;
		while (1 < (aup - adown)) {
			if (h[adown] < (B * center))
				adown = acenter;
			else
				aup = acenter;
			acenter = (aup + adown) / 2;
		}

		ll sum = 0;
		for (int i = adown + 1; i < N; i++)
			sum += (h[i] - B * center + Diff - 1) / Diff;

		if (sum <= center)
			up = center;
		else
			down = center;
		center = (up + down) / 2;
	}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: 'LLONG_MAX' was not declared in this scope
   13 |         h[N] = LLONG_MAX;
      |                ^~~~~~~~~
a.cc:3:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <algorithm>
  +++ |+#include <climits>
    3 |
Language: C++

#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cfloat>
#include <cmath>
#include <functional>
#include <forward_list>
#include <list>


#define DEBUG(x) cout << #x << "\t:" << x << endl;
#define EPS (1e-9)
#define INF (INT_MAX/2)
#define MOD 1000000007
#define PI 3.14159265358979
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REPV(it,v) for(auto it = (v).begin(); it != (v).end(); ++it)

#define NUM 5000

#define ll long long
#define ull unsigned long long

using namespace std;

typedef pair<int, int> iiPair;


class Main {
public:
	bool winnable(vector<int>& hs, ll n, int a, int b) {
		ll sum = 0;
		REP(i, hs.size()) {
			int rest = hs[i] - n * b;
			int more = a - b;
			sum += (rest + more - 1) / more;
		}
		bool res = (sum <= n);
		return res;
	}

	int getAns(vector<int>& hs, int a, int b) {
		int left = 0;
		int right = INT_MAX/2;

		while (right - left > 1) {
			int mid = ((ll)left + right) / 2;
			if (winnable(hs, mid, a, b)) {
				right = mid;
			}
			else {
				left = mid;
			}
		}
		return right;
	}
};

int main(void) {
	Main main;
	int n,a,b;
	vector<int> hs;
	cin >> n >> a >> b;
	REP(i, n) {
		int inp;
		cin >> inp;
		hs.push_back(inp);
	}

	cout << main.getAns(hs, a, b) << endl;

	return 0;
}

Compiler output:
a.cc: In member function 'int Main::getAns(std::vector<int>&, int, int)':
a.cc:49:29: error: 'INT_MAX' was not declared in this scope
   49 |                 int right = INT_MAX/2;
      |                             ^~~~~~~
a.cc:14:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   13 | #include <list>
  +++ |+#include <climits>
   14 |
Language: C++

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

const int N=1e5+1e3+7;

const long long M=1e10+1e3+7;

long long n,a,b,h[N],ans,dam,k,hh[N];

bool can(long long m)
{
	ans=0;
	memset(hh,0,sizeof(hh));
	for(int i=1;i<=n;i++)
		hh[i]=h[i]-b*m;
	for(int i=1;i<=n;i++)
	{
		if(hh[i]<=0)
			continue;
		else
		{
			if(hh[i]%a)
				ans+=hh[i]/(a-b)+1;
			else
				ans+=hh[i]/(a-b);
		}
	}
	return ans<=m;
}

int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
		cin>>h[i];
	long long l=0,r=M+1;
	while(r-l>1)
	{
		long long mid=(l+r)>>1;
		if(can(mid))
			r=mid;
		else
			l=mid;
	}
	cout<<r;
}

Compiler output:
a.cc: In function 'bool can(long long int)':
a.cc:16:9: error: 'memset' was not declared in this scope
   16 |         memset(hh,0,sizeof(hh));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<iostream>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

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

const int N=1e5+1e3+7;

const long long M=1e10+1e3+7;

long long n,a,b,h[N],ans,dam,k,hh[N];

bool can(int m)
{
	ans=0;
	memset(hh,0,sizeof(hh));
	for(int i=1;i<=n;i++)
		hh[i]=h[i]-b*m;
	for(int i=1;i<=n;i++)
	{
		if(hh[i]<=0)
			continue;
		else
		{
			if(hh[i]%a)
				ans+=hh[i]/(a-b)+1;
			else
				ans+=hh[i]/(a-b);
		}
	}
	return ans<=m;
}

int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
		cin>>h[i];
	long long l=0,r=M+1;
	while(r-l>1)
	{
		long long mid=(l+r)>>1;
		if(can(mid))
			r=mid;
		else
			l=mid;
	}
	cout<<r;
}

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

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

const int N=1e5+1e3+7;

const long long M=1e10+1e3+7;

long long n,a,b,h[N],ans,dam,k,hh[N];

bool can(int m)
{
	ans=0;
	memset(hh,0,sizeof(hh));
	for(int i=1;i<=n;i++)
		hh[i]=h[i]-b*m;
	for(int i=1;i<=n;i++)
	{
		if(hh[i]<=0)
			continue;
		else
		{
			if(hh[i]%a)
				ans+=hh[i]/(a-b)+1;
			else
				ans+=hh[i]/(a-b);
		}
	}
	return ans<=m;
}

int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
		cin>>h[i];
	long long l=0,r=M+1;
	while(r-l>1)
	{
		int mid=(l+r)>>1;
		if(can(mid))
			r=mid;
		else
			l=mid;
	}
	cout<<r;
}

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

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

using int64 = int64_t;

int64 N, A, B;
int64 h[100000];

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> A >> B;
    for (int j = 0; j < N; ++j) {
        cin >> h[j];
    }

    int64 l = 0, r = 1000000001;
    while (l < r) {
        int64 m = (l + r) / 2;
        int64 D = A-B, b = 0;
        for (int j = 0; j < N; ++j) {
            int64 tt = max(0LL, h[j] - B * m);
            b += (tt + D - 1) / D;
        }
        if (b <= m) {
            r = m;
        } else {
            l = m+1;
        }
    }
    cout << r << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:27: error: no matching function for call to 'max(long long int, int64)'
   41 |             int64 tt = max(0LL, h[j] - B * m);
      |                        ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:41:27: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64' {aka 'long int'})
   41 |             int64 tt = max(0LL, h[j] - B * m);
      |                        ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:41:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   41 |             int64 tt = max(0LL, h[j] - B * m);
      |                        ~~~^~~~~~~~~~~~~~~~~~~
Language: C

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}


signed main() {
	ll n,a,b;
	scanf("%lld %lld %lld", &n, &a, &b);
	vector<ll> p(n);
	REP(i, n) {
		scnaf("%lld", &p[i]);
	}

	sort(ALL(p));

	ll sa = a - b;

	ll l = 0, r = p[n-1]/b+1;

	while (1) {
		ll mid = (l + r) / 2;

		ll cou = 0;
		REP(i, n) {
			ll cur = p[i] - b * mid;
			cou += (cur + sa-1)/sa;
		}

		if (cou > mid) {
			l = mid;
		}
		else r = mid;

		if (r - l <= 1) {
			printf("%lld\n", r);
			break;
		}
	}
	
	return 0;
}

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

#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<queue>
#include<stack>
#include<string.h>
#include<functional>
#include<limits.h>
#define int long long
using namespace std;

int a[100000];
signed main() {
	int b, c, d; cin >> b >> c >> d;
	for (int e = 0; e < b; e++) {
		scanf("%lld", &a[e]);
	}
	int S = 0, G = pow(10, 15);//[S,G)
	while (G - S > 1) {
		int K = (S + G) / 2;
		int sum = 0;
		for (int i = 0; i < 100000; i++) {
			int T = max(a[i] - K*d, 0ll);
			sum += T / (c - d);
			if (T % (c - d))sum++;
		}
		if (sum <= K) {
			G = K;
		}
		else {
			S = K;
		}
	}
	cout << G << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:24: error: 'pow' was not declared in this scope
   25 |         int S = 0, G = pow(10, 15);//[S,G)
      |                        ^~~
Language: Java

// copied
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
using namespace std;
typedef long long LL;
const int maxn = 2e5 + 100;
int n, k;
LL a[maxn], c[maxn*4];
map<LL, int> M;
vector<LL> V;
void Modify(int x, int s){
    for(; x <= n; x += x&(-x)) c[x] += s;
}
LL Query(int y){
    if(y <= 0) return 0;
    LL ans = 0;
    for(int x = y; x; x -= x&(-x)) ans += c[x];
    return ans;
}

int main()
{
    int x;
    scanf("%d %d", &n, &k);
    for(int i = 1; i <= n; i++) scanf("%d", &x), a[i] = x;
    LL sum = 0;
    for(int i = 1; i <= n; i++) {
        sum += a[i];
        sum -= k;
        V.push_back(sum);
    }
    sort(V.begin(), V.end());
    for(int i = 0; i < V.size(); i++) M[V[i]] = i+1;
    sum = 0;
    LL ans = 0;
    for(int i = 1; i <= n; i++){
        sum += a[i];
        sum -= k;
        ans += Query(M[sum]);
        if(sum >= 0) ans++;
        Modify(M[sum], 1);
    }
    cout<<ans<<endl;
}


Compiler output:
Main.java:2: error: illegal character: '#'
#include <algorithm>
^
Main.java:3: error: illegal character: '#'
#include <iostream>
^
Main.java:4: error: illegal character: '#'
#include <vector>
^
Main.java:5: error: illegal character: '#'
#include <cstdio>
^
Main.java:6: error: illegal character: '#'
#include <map>
^
Main.java:8: error: class, interface, enum, or record expected
typedef long long LL;
^
Main.java:9: error: class, interface, enum, or record expected
const int maxn = 2e5 + 100;
^
Main.java:10: error: class, interface, enum, or record expected
int n, k;
^
Main.java:11: error: class, interface, enum, or record expected
LL a[maxn], c[maxn*4];
^
Main.java:12: error: unnamed classes are a preview feature and are disabled by default.
map<LL, int> M;
^
  (use --enable-preview to enable unnamed classes)
Main.java:46: error: not a statement
    cout<<ans<<endl;
             ^
Main.java:27: error: illegal start of expression
    scanf("%d %d", &n, &k);
                   ^
Main.java:27: error: illegal start of expression
    scanf("%d %d", &n, &k);
                       ^
Main.java:28: error: illegal start of expression
    for(int i = 1; i <= n; i++) scanf("%d", &x), a[i] = x;
                                            ^
Main.java:28: error: ';' expected
    for(int i = 1; i <= n; i++) scanf("%d", &x), a[i] = x;
                                               ^
15 errors
Language: C++

//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
 
//#include <x86intrin.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>
#include <deque>     
#include <queue>
#include <iomanip>
#include <stack>
#include <map>
#include <set>
//#include <ordered_set>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;
 
const double pi = acos (-1.0);
const double eps = 1e-9;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, a[N];
ll pref[N], k, ans;
ordered_set < pair <ll, int> > s;

inline void boost () {
   ios_base :: sync_with_stdio (0);
   cin.tie (0), cout.tie (0);
}
 
inline void Solve () {
   cin >> n >> k;
   for (int i = 1; i <= n; i ++) {
      cin >> a[i];
      pref[i] = pref[i - 1] + a[i];
   }
   for (int i = 1; i <= n; i ++) {
      s.in ({pref[i - 1] - k * (i - 1), i - 1});
      ans += s.order_of_key ({pref[i] - 1ll * k * i, mod});
   }
   cout << ans;
   //(pref[r] - pref[l - 1]) / (r - l + 1) >= k
   //pref[r] - pref[l - 1] >= k * (r - (l - 1))
   //pref[r] - pref[l - 1] >= k * r - k * (l - 1)
   //pref[r] - k * r >= pref[l - 1] - k * (l - 1)
}               
 
signed main () {                                       
  // #ifdef QWERTY
  //    freopen("input", "r", stdin);
  // #endif
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}                   

Compiler output:
a.cc:60:1: error: 'ordered_set' does not name a type
   60 | ordered_set < pair <ll, int> > s;
      | ^~~~~~~~~~~
a.cc: In function 'void Solve()':
a.cc:74:7: error: 's' was not declared in this scope
   74 |       s.in ({pref[i - 1] - k * (i - 1), i - 1});
      |       ^
Language: C++

/// IN THE NAME OF METAL
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define sz(x)                       (ll) x.size()
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second

ll Pow(ll a, ll b, ll md, ll ans = 1) {
    for (; b; b >>= 1, a = a * a % md)
        if (b & 1)
            ans = ans * a % md;
    return ans % md;
}

const ll MAXN = 1e6 + 10;
const ll INF = 818;
const ll MOD = 1e9 + 7;
ll ind[MAXN], fen[MAXN], A[MAXN], ps[MAXN], ans = 0, n, P;
vector<ll> compress;

void update(ll ind, ll val) {
    for (; ind < MAXN; ind += ind & -ind) fen[ind] += val;
}

ll get(ll ind, ll res = 0) {
    for (; ind; ind -= ind & -ind) res += fen[ind];
    return res;
}

int main() {
    scanf("%lld%lld", &n, &p);
    for (ll i = 1; i <= n; i++) {
        scanf("%lld", &A[i]);
    }
    for (ll i = 1; i <= n; i++) {
        A[i] -= P;
    }
    partial_sum(A, A + MAXN, ps);
    for (ll i = 0; i <= n; i++) {
        compress.push_back(ps[i]);
    }
    sort(all(compress));
    compress.resize(unique(all(compress)) - compress.begin());
    for (ll i = 0; i <= n; i++) {
        ind[i] = lower_bound(all(compress), ps[i]) - compress.begin() + 1;
        ans += get(ind[i]);
        update(ind[i], 1);
    }
    printf("%lld", ans);
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:28: error: 'p' was not declared in this scope
   37 |     scanf("%lld%lld", &n, &p);
      |                            ^
Language: C++

#include <iterator>
#include <numeric>
#include <vector>

using namespace std;

int main(int argc, const char *argv[]) {
  using ll = long long;
  int n;
  ll k;
  cin >> n >> k;
  vector<ll> va(n);
  for (auto &a : va) {
    cin >> a;
  }

  ll ans = 0;
  vector<ll> csum{0};
  partial_sum(va.begin(), va.end(), back_inserter(csum));
  for (int i = 0; i < va.size(); i++) {
    bool l_found = false;
    for (int j = 1; j <= va.size() - i; j++) {
      // iからj個とる
      ll lower = k * j + csum[i];
      if (lower <= csum[i + j]) {
        l_found = true;
        ans++;
      } else if (l_found) {
        break;
      }
    }
  }

  cout << ans << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:11:3: error: 'cin' was not declared in this scope
   11 |   cin >> n >> k;
      |   ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <vector>
  +++ |+#include <iostream>
    4 | 
a.cc:34:3: error: 'cout' was not declared in this scope
   34 |   cout << ans << '\n';
      |   ^~~~
a.cc:34:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#define ASIZE 200005
#include <bits/stdc++.h>
using namespace std;
long long ft[ASIZE],n=ASIZE+1;
typedef pair<long long,long long> pii;

void increment(long long p){
  for(;p<=n;p+=(p & -p))ft[p]++;
}

long long query(long long p){
  long long sum=0;
  for(;p>0;p-=(p & -p))sum+=ft[p];
  return sum;
}

long long main() {
  long long n,k,a[ASIZE]={0},ps[ASIZE],x,sum=0;
  priority_queue<pii,vector<pii>,greater<pii> >pq;
  cin>>n>>k;
  for(long long i=1;i<=n;i++){
    cin>>a[i];
    a[i]-=k;
    ps[i]=ps[i-1]+a[i];
    pq.emplace(ps[i],i);
  }
  while(!pq.empty()){
    x=pq.top().second;
 //   cout<<"x= "<<x<<"\n";
    sum+=query(x);
    increment(x);
    if(pq.top().first>=0)sum++;
    pq.pop();
  }
  cout<<sum;
  return 0;
}

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

#include "bits/stdc++.h"
#define ll long long
#define fr first
#define sc second
using namespace std;

const int mnx = 1e7 + 9;
const int mod = 1e9 + 7;
const double PI = acos(-1);

ll n, k, a[mnx], t[mnx], h;
pair <int, int> z[mnx];

get(int x){
    ll res = 0;

    for(; x > 0; x -= (x & -x)){
        res += t[x];
    }

    return res;
}

upd(int x){
    for(; x <= n; x += (x & -x)){
        t[x]++;
    }
}

void solve(){
    cin >> n >> k;

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

    ll sum = 0;

    for(int i = 1; i <= n; i++){
        sum += a[i];
        z[i] = {sum, i};
    }

    sort (z + 1, z + n + 1);

    ll ans = 0;

    for(int i = 1; i <= n; i++){
        upd(z[i].sc);
        ans += get(z[i].sc);
        if(z[i].fr < 0) ans--;
    }

    cout << ans << '\n';
}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    ll tt = 1;

//    scanf("%d", &tt);

    while(tt--){
        solve();
    }

    return 0;
}


Compiler output:
a.cc:14:1: error: ISO C++ forbids declaration of 'get' with no type [-fpermissive]
   14 | get(int x){
      | ^~~
a.cc:24:1: error: ISO C++ forbids declaration of 'upd' with no type [-fpermissive]
   24 | upd(int x){
      | ^~~
a.cc: In function 'int upd(int)':
a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
Language: C++

#include "bits/stdc++.h"
#define ll long long
#define fr first
#define sc second
using namespace std;

const int mnx = 1e7 + 9;
const int mod = 1e9 + 7;
const double PI = acos(-1);

ll n, k, a[mnx], t[mnx], h;
pair <int, int> z[mnx];

get(int x){
    ll res = 0;

    for(; x > 0; x -= (x & -x)){
        res += t[x];
    }

    return res;
}

upd(int x){
    for(; x <= n; x += (x & -x)){
        t[x]++;
    }
}

void solve(){
    cin >> n >> k;

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

    ll sum = 0;

    for(int i = 1; i <= n; i++){
        sum += a[i];
        z[i] = {sum, i};
    }

    sort (z + 1, z + n + 1);

    ll ans = 0;

    for(int i = 1; i <= n; i++){
        upd(z[i].sc);
        ans += get(z[i].sc);
        if(z[i].fr < 0) ans--;
    }

    cout << ans << '\n';
}


int main(){
//    ios_base::sync_with_stdio(0);
//    cin.tie(0), cout.tie(0);
    ll tt = 1;

//    scanf("%d", &tt);

    while(tt--){
        solve();
    }

    return 0;
}


Compiler output:
a.cc:14:1: error: ISO C++ forbids declaration of 'get' with no type [-fpermissive]
   14 | get(int x){
      | ^~~
a.cc:24:1: error: ISO C++ forbids declaration of 'upd' with no type [-fpermissive]
   24 | upd(int x){
      | ^~~
a.cc: In function 'int upd(int)':
a.cc:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#include <tuple>
#define INF 1000000009
#define LINF 1000000000000000009
#define double long double
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
//ll mod = 1000000007;
//ll mod = 998244353;

vector<ll> cnt(700010);

void add(ll i, ll x) {
	i += 262143;
	cnt[i] += x;
	while (i > 0) {
		i = (i - 1) / 2;
		cnt[i] = cnt[i * 2 + 1] + cnt[i * 2 + 2];
	}
}

ll query(ll a, ll b, ll k, ll l, ll r) {
	if (r <= a || b <= l) return 0;
	if (a <= l && r <= b) return cnt[k];
	else {
		ll c1 = query(a, b, 2 * k + 1, l, (l + r) / 2);
		ll c2 = query(a, b, 2 * k + 2, (l + r) / 2, r);
		return c1 + c2;
	}
}

int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	vector<ll> s(n + 1);
	s[0] = 0;
	for (int i = 0; i < n; i++) s[i + 1] = s[i] + a[i] - k;
	map<ll, ll> mp;
	for (int i = 0; i <= n; i++) {
		s[i] += k * n;
		mp[s[i]]++;
	}
	vector<ll> t(n + 1);
	for (int i = 0; i <= n; i++) t[i] = s[i];
	sort(all(t));
	for (int i = 1; i <= n; i++) {
		if (t[i] != t[i - 1]) mp[t[i]] += mp[t[i - 1]];
	}
	ll ans = 0;
	for (int i = 0; i <= n; i++) {
		s[i] = mp[s[i]];
		ll res = query(262143, 262144 + s[i], 262143,524287);
		ans += res;
		add(s[i], 1);
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:31: error: too few arguments to function 'll query(ll, ll, ll, ll, ll)'
   64 |                 ll res = query(262143, 262144 + s[i], 262143,524287);
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:32:4: note: declared here
   32 | ll query(ll a, ll b, ll k, ll l, ll r) {
      |    ^~~~~