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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;

/**
 * Icicles
 */
public class Main {

	static P0551 main = new P0551();

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = Integer.parseInt(line.substring(0, line.indexOf(' ')));
			int l = Integer.parseInt(line.substring(line.indexOf(' ') + 1));

			Icicle[] icicles = new Icicle[n + 2];
			Queue<Icicle> growths = new PriorityQueue<Icicle>(1,
					new Comparator<Icicle>() {
						@Override
						public int compare(Icicle o1, Icicle o2) {
							return o2.length - o1.length;
						}
					});

			// read
			icicles[0] = main.new Icicle(0);
			for (int i = 1; i < n + 1; i++) {
				icicles[i] = main.new Icicle(Integer.parseInt(br.readLine()));
			}
			icicles[n + 1] = main.new Icicle(0);

			// solve

			int total = 0;
			while (true) {

				for (int i = 1; i < n + 1; i++) {
					if (!icicles[i].queued
							&& icicles[i].length > icicles[i - 1].length
							&& icicles[i].length > icicles[i + 1].length) {
						icicles[i].queued = true;
						growths.offer(icicles[i]);
					}
				}

				if (growths.isEmpty()) {
					break;
				}

				//
				int elapse = l - growths.peek().length;
				total += elapse;

				while (!growths.isEmpty()) {
					if (growths.peek().length + elapse == l) {
						growths.peek().length = 0;
						growths.poll();
					} else {
						break;
					}
				}

				for (Icicle i : growths) {
					i.length += elapse;
				}

			}
			System.out.println(total);
		}
	}

	class Icicle {
		int length;
		boolean queued = false;

		Icicle(int length) {
			this.length = length;
		}
	}
}

Compiler output:
Main.java:13: error: cannot find symbol
	static P0551 main = new P0551();
	       ^
  symbol:   class P0551
  location: class Main
Main.java:13: error: cannot find symbol
	static P0551 main = new P0551();
	                        ^
  symbol:   class P0551
  location: class Main
2 errors
Language: C++

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

using namespace std;

typedef unsigned long ulong;
typedef pair<ulong,int> pli;

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define MP(f,s) make_pair(f,s)

priority_queue<pli> p;
ulong t[100000];
int n=0;
int l=0;
ulong g=ULONG_MAX;

bool check(int c){
	if(c==0)
		return t[c]>t[c+1];
	if(c==n-1)
		return t[c]>t[c-1];
	return t[c]>t[c+1]&&t[c]>t[c-1];
}

int main(){
	scanf("%d %d",&n,&l);
	REP(i,n)
		scanf("%lu",&t[i]);
	REP(i,n){
		if(check(i))
			p.push(MP(g-(l-t[i]),i));
	}
	pli m;
	ulong res=0;
	while(!p.empty()){
		do{
		m=p.top();
		p.pop();
		t[m.second]=0;
		if(m.second>0)
			if(check(m.second-1))
				p.push(MP(m.first-(l-t[m.second-1]),m.second-1));
		if(m.second<n-1)
			if(check(m.second+1))
				p.push(MP(m.first-(l-t[m.second+1]),m.second+1));
		if(p.empty())
			break;
		}while(m.first == p.top().first);
		res+=g-m.first;
		g=m.first;
	}
	printf("%lu\n",res);
}

Compiler output:
a.cc:19:9: error: 'ULONG_MAX' was not declared in this scope
   19 | ulong g=ULONG_MAX;
      |         ^~~~~~~~~
a.cc:5:1: note: 'ULONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <algorithm>
  +++ |+#include <climits>
    5 |
Language: C++

#include<cstdio>
#include<math.h>
#include<algorithm>
#include<string.h>
#include<vector>
#include<queue>



using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int INF=1001001001;
pair<int,int> map[100002];
int time[100002];



int main(){
		int N,L;
		scanf("%d %d",&N,&L);
		rep(i,N){
			int a;
			scanf("%d",&a);
			map[i]=make_pair(a,i);
		}
		sort(map,map+N,greater<pair<int,int>???>());
		int ans=0;
		rep(i,N){
			int sans=0;
			int yokomax=0;
			if(map[i].second!=0){yokomax=max(time[map[i].second+1],yokomax);}
			if(map[i].second!=N-1){yokomax=max(time[map[i].second-1],yokomax);}
			sans=yokomax+L-map[i].first;
			time[map[i].second]=sans;
			ans=max(ans,sans);
		}
		printf("%d",ans);
}

Compiler output:
a.cc:26:54: warning: trigraph ??> ignored, use -trigraphs to enable [-Wtrigraphs]
   26 |                 sort(map,map+N,greater<pair<int,int>???>());
a.cc: In function 'int main()':
a.cc:26:56: error: template argument 1 is invalid
   26 |                 sort(map,map+N,greater<pair<int,int>???>());
      |                                                        ^
Language: C++

//成長し続けることが目的
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define N_MAX 100000
#define L_MAX 50000
using namespace std;
typedef int TL;
typedef int num;
typedef pair<TL,num> I;

int N,L;
int Ice[N_MAX+2+1];
int ct = 0;
priority_queue<I> que;

void solve(){
	for(int i = 1;i <= N;i++){
		if(Ice[i] > Ice[i-1] && Ice[i] > Ice[i+1])
			que.push(make_pair(-1*(L-Ice[i]),i));
	}
	while(!que.empty()){
		I ic = que.top();que.pop();
		ct = -1 * ic.first;
		int n = ic.second;
		Ice[n] = 0;
		if(n + 1 <= N && Ice[n+1] > Ice[n+2])
			que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
		if(n - 1 >= 1 && Ice[n-1] > Ice[n-2])
			que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
	}
	printf("%d\n",ct);
	return;
}


int main() {
	scanf("%d %d",&N,&L);
	Ice[0] = 0;Ice[N+1] = 0;
	for(int n = 1;n <= N;n++)scanf("%d",&Ice[n]);
	solve();
    
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:32:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                         que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
      |                                                ~~~~~~~~~~^~~~~
a.cc:32:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
   32 |                         que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
      |                                            ~~^~~~~~~~~~~~~~~~~~
      |                                            |             |
      |                                            int           time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                         que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
      |                                                ~~~~~~~~~~^~~~~
a.cc:34:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
   34 |                         que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
      |                                            ~~^~~~~~~~~~~~~~~~~~
      |                                            |             |
      |                                            int           time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
Language: C++

//成長し続けることが目的
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define N_MAX 100000
#define L_MAX 50000
using namespace std;
typedef int TL;
typedef int num;
typedef pair<TL,num> I;

int N,L;
int Ice[N_MAX+2+1];
int ct = 0;
priority_queue<I> que;

void solve(){
	for(int i = 1;i <= N;i++){
		if(Ice[i] > Ice[i-1] && Ice[i] > Ice[i+1])
			que.push(make_pair(-1*(L-Ice[i]),i));
	}
	while(!que.empty()){
		I ic = que.top();que.pop();
		ct = -1 * ic.first;
		int n = ic.second;
		Ice[n] = 0;
		if(n + 1 <= N && Ice[n+1] > Ice[n+2])
			que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
		if(n - 1 >= 1 && Ice[n-1] > Ice[n-2])
			que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
	}
	
	return;
}


int main() {
	scanf("%d %d",&N,&L);
	Ice[0] = 0;Ice[N+1] = 0;
	for(int n = 1;n <= N;n++)scanf("%d",&Ice[n]);
	solve();
    
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:32:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   32 |                         que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
      |                                                ~~~~~~~~~~^~~~~
a.cc:32:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
   32 |                         que.push(make_pair(-1*(L-Ice[n+1]+time),n+1));
      |                                            ~~^~~~~~~~~~~~~~~~~~
      |                                            |             |
      |                                            int           time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:34:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |                         que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
      |                                                ~~~~~~~~~~^~~~~
a.cc:34:46: error: invalid operands of types 'int' and 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to binary 'operator*'
   34 |                         que.push(make_pair(-1*(L-Ice[n-1]+time),n-1));
      |                                            ~~^~~~~~~~~~~~~~~~~~
      |                                            |             |
      |                                            int           time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i <= (int)n; ++i)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define MP make_pair
#define PB push_back
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define int long long
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef vector<int> VLL;
typedef vector<int> VVLL;
typedef unsigned int uint;
typedef priority_queue<int> maxque;
typedef priority_queue< int, vector<int>, greater<int> > minque;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const int LL_INF = 1ll << 60;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };


int s[100010];
signed main(){
    int n,m;
    int time=0;
    cin>>n>>m;
    FOR(i,1,n){
        cin>>s[i];
    }
    int t=0;
    int q=0;
    FOR(i,1,n){
        if(s[i]>s[i-1]&&s[i]>s[i+1]){
            if(t<s[i]){
                if(t!=0)s[i]+=(m-t);
                if(m>=s[i]){
                    time+=(m-s[i]);
                    t=s[i];
                }
                else {
                    q=(s[i]-m);
                    cout<<q<<endl;
                    if(s[i-1]!=0)s[i-1]+=q;
                }
            }
            s[i]=0;
        }
    }
    int p=LL_INF;
    FOR(i,1,n){
        if(s[i])time+=m-s[i];
    }
    if(p!=LL_INF)time+=(m-p);
    cout<<time<<endl;
    return 0;
}

Compiler output:
a.cc:23:22: error: conflicting declaration 'typedef long long unsigned int uint'
   23 | typedef unsigned int uint;
      |                      ^~~~
In file included from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/sys/types.h:150:22: note: previous declaration as 'typedef unsigned int uint'
  150 | typedef unsigned int uint;
      |                      ^~~~
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int N, L, a[100000], X, time = 0, pluser = 1000000, longs[30000];

int main()
{
	cin >> N >> L;

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

	for (int fin = 0; fin != 1;)
	{
		fin = 1;
		pluser = 60000;
		X = 0;
		if (a[0] > a[1])
		{
			pluser = min(pluser, L - a[0]);
			longs[X] = 0;
			X++;
		}
		for (int i = 1; i < N - 1; i++)
		{
			if (a[i] > a[i - 1] && a[i] > a[i + 1])
			{
				pluser = min(pluser, L - a[i]);
				longs[X] = i;
				X++;
			}
		}
		if (a[N - 1] > a[N - 2])
		{
			pluser = min(pluser, L - a[N - 1]);
			longs[X] = N - 1;
			X++;
		}

		time += pluser;

		for (int i = 0; i < X; i++)
		{
			if (a[longs[i]] == L - pluser)
			{
				a[longs[i]] = 0;
			}
			else if (a[longs[i]] != 0)
			{
				a[longs[i]] += pluser;
			}
		}
		for (int i = 0; i < N; i++)
		{
			if (a[i] != 0)
			{
				fin = 0;
				break;
			}
		}
	}

	cout << time << endl;


	return 0;
}

Compiler output:
a.cc:6:25: error: 'int time' redeclared as different kind of entity
    6 | int N, L, a[100000], X, time = 0, pluser = 1000000, longs[30000];
      |                         ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:44:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |                 time += pluser;
      |                 ~~~~~^~~~~~~~~
a.cc:44:22: error: assignment of read-only location 'time'
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

int N, L, a[100000], X, time = 0, pluser = 1000000, longs[30000];

int main()
{
	cin >> N >> L;

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

	for (int fin = 0; fin != 1;)
	{
		fin = 1;
		pluser = 60000;
		X = 0;
		if (a[0] > a[1])
		{
			pluser = min(pluser, L - a[0]);
			longs[X] = 0;
			X++;
		}
		for (int i = 1; i < N - 1; i++)
		{
			if (a[i] > a[i - 1])
			{
				if(a[i] > a[i + 1])
				{				
					pluser = min(pluser, L - a[i]);
					longs[X] = i;
					X++;
				}
			}
		}
		if (a[N - 1] > a[N - 2])
		{
			pluser = min(pluser, L - a[N - 1]);
			longs[X] = N - 1;
			X++;
		}

		time += pluser;

		for (int i = 0; i < X; i++)
		{
			if (a[longs[i]] == L - pluser)
			{
				a[longs[i]] = 0;
			}
			else if (a[longs[i]] != 0)
			{
				a[longs[i]] += pluser;
			}
		}
		for (int i = 0; i < N; i++)
		{
			if (a[i] != 0)
			{
				fin = 0;
				break;
			}
		}
	}

	cout << time << endl;

	return 0;
}

Compiler output:
a.cc:6:25: error: 'int time' redeclared as different kind of entity
    6 | int N, L, a[100000], X, time = 0, pluser = 1000000, longs[30000];
      |                         ^~~~
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:47:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   47 |                 time += pluser;
      |                 ~~~~~^~~~~~~~~
a.cc:47:22: error: assignment of read-only location 'time'
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 mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 101010
using namespace std;

int a[MAX],dp[MAX];

void solve(){
 int n,l;
 cin>>n>>l;
 a[0]=a[n+1]=0;
 FOR(i,n) cin>>a[i+1];
 ZERO(dp);
 int ma=0;
 FOR(i,n) ma=max(ma,dfs(i+1));
 cout<<ma<<endl;
}

int dfs(int now){
 if(dp[now]) return dp[now];
 if(a[now]>a[now-1]&&a[now]>a[now+1]) return dp[now]=l-a[now];
 int ma=0;
 if(a[now]<=a[now-1]) ma=dfs(now-1);
 if(a[now]<=a[now+1]) ma=max(ma,dfs(now+1));
 return dp[now]=ma+l-dp[now];
}

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

Compiler output:
a.cc: In function 'void solve()':
a.cc:24:21: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   24 |  FOR(i,n) ma=max(ma,dfs(i+1));
      |                     ^~~
      |                     ffs
a.cc: In function 'int dfs(int)':
a.cc:30:54: error: 'l' was not declared in this scope
   30 |  if(a[now]>a[now-1]&&a[now]>a[now+1]) return dp[now]=l-a[now];
      |                                                      ^
a.cc:34:20: error: 'l' was not declared in this scope
   34 |  return dp[now]=ma+l-dp[now];
      |                    ^
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 mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 101010
using namespace std;

int n,l,a[MAX],dp[MAX];

void solve(){
 cin>>n>>l;
 a[0]=a[n+1]=0;
 FOR(i,n) cin>>a[i+1];
 ZERO(dp);
 int ma=0;
 FOR(i,n) ma=max(ma,dfs(i+1));
 cout<<ma<<endl;
}

int dfs(int now){
 if(dp[now]) return dp[now];
 if(a[now]>a[now-1]&&a[now]>a[now+1]) return dp[now]=l-a[now];
 int ma=0;
 if(a[now]<=a[now-1]) ma=dfs(now-1);
 if(a[now]<=a[now+1]) ma=max(ma,dfs(now+1));
 return dp[now]=ma+l-dp[now];
}

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

Compiler output:
a.cc: In function 'void solve()':
a.cc:23:21: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   23 |  FOR(i,n) ma=max(ma,dfs(i+1));
      |                     ^~~
      |                     ffs
Language: C++

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

int n, l, icicles[100001], time1, time2, loop, ans = 0;
int main(){
	cin >> n >> l;
	for(int i = 1; i <= n; i++){
		cin >> icicles[i];
	}

	for(int i = 1; i <= n; i++){
		if(icicles[i] > icicles[i - 1] && icicles[i] > icicles[i + 1]){
			time1 = l - icicles[i];
			time2 = l - icicles[i];

			roop = i;
			while(icicles[loop] > icicles[--loop] && roop > 0){
				time1 += l - icicles[loop];
			}
			ans = max(ans, time1);

			roop = i;
			while(icicles[loop] > icicles[++loop] && roop <= n){
				time2 += l - icicles[loop];
			}
			ans = max(ans, time2);
		}
	}

	cout << ans << endl;

	return 0;
}

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

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

int n, l, icicles[100001], time1, time2, loop, ans = 0;
int main(){
	cin >> n >> l;
	for(int i = 1; i <= n; i++){
		cin >> icicles[i];
	}

	for(int i = 1; i <= n; i++){
		if(icicles[i] > icicles[i - 1] && icicles[i] > icicles[i + 1]){
			time1 = l - icicles[i];
			time2 = l - icicles[i];

			loop = i;
			while(icicles[loop] > icicles[--loop] && roop > 0){
				time1 += l - icicles[loop];
			}
			ans = max(ans, time1);

			roop = i;
			while(icicles[loop] > icicles[++loop] && roop <= n){
				time2 += l - icicles[loop];
			}
			ans = max(ans, time2);
		}
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:66: error: 'roop' was not declared in this scope; did you mean 'loop'?
   18 |                         while(icicles[loop] > icicles[--loop] && roop > 0){
      |                                                                  ^~~~
      |                                                                  loop
a.cc:23:25: error: 'roop' was not declared in this scope; did you mean 'loop'?
   23 |                         roop = i;
      |                         ^~~~
      |                         loop
Language: C++

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

int n, l, icicles[100001], time1, time2, loop, ans = 0;
int main(){
	cin >> n >> l;
	for(int i = 1; i <= n; i++){
		cin >> icicles[i];
	}

	for(int i = 1; i <= n; i++){
		if(icicles[i] > icicles[i - 1] && icicles[i] > icicles[i + 1]){
			time1 = l - icicles[i];
			time2 = l - icicles[i];

			loop = i;
			while(icicles[loop] > icicles[--loop] && loop > 0){
				time1 += l - icicles[loop];
			}
			ans = max(ans, time1);

			roop = i;
			while(icicles[loop] > icicles[++loop] && loop <= n){
				time2 += l - icicles[loop];
			}
			ans = max(ans, time2);
		}
	}

	cout << ans << endl;

	return 0;
}

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


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

int n,l;
int a[123456];

typedef pair<int,int> P;//first:time second:index

signed main()
{
	priority_queue<P,vector<P>,greater<P> >que;
	cin >> n >> l;
	a[0] = a[n+1] = 0;
	for(int i = 0;i < n;++i)
	{
		cin >> a[i + 1];
	}
	for(int i = 1;i <= n;++i)
	{
		if(a[i] > a[i - 1] && a[i] > a[i + 1])
		{
			que.push(make_pair(l - a[i],i));
		}
	}
	int ans = 0;
	while(!que.empty())
	{
		P p = que.top();que.pop();
		int time = p.first;
		int index = p.second;
		ans = time;
		a[index] = 0;
		for(int i = index - 1;i <= index + 1;i += 2)
		{
			if(i == 0 || i == n)continue;
			if(a[i] > a[i - 1] && a[i] > a[i + 1])
			{
				que.push(make_pair(l - a[i] + time,i));
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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


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

int n,l;
int a[123456];

typedef pair<int,int> P;//first:time second:index

signed main()
{
	priority_queue<P,vector<P>,greater<P> >que;
	cin >> n >> l;
	a[0] = a[n+1] = 0;
	for(int i = 0;i < n;++i)
	{
		cin >> a[i + 1];
	}
	for(int i = 1;i <= n;++i)
	{
		if(a[i] > a[i - 1] && a[i] > a[i + 1])
		{
			que.push(make_pair(l - a[i],i));
		}
	}
	int ans = 0;
	while(!que.empty())
	{
		P p = que.top();que.pop();
		int time = p.first;
		int index = p.second;
		ans = time;
		a[index] = 0;
		for(int i = index - 1;i <= index + 1;i += 2)
		{
			if(i == 0 || i == n)continue;
			if(a[i] > a[i - 1] && a[i] > a[i + 1])
			{
				que.push(make_pair(l - a[i] + time,i));
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:5:9: error: multiple types in one declaration
    5 | typedef Int int;
      |         ^~~
a.cc:5:13: error: declaration does not declare anything [-fpermissive]
    5 | typedef Int int;
      |             ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int main(){
	int n.l;
	cin>>n>>l;
	int icic[114514];
	icic[0]=0;
	icic[1]=0;
	for(int i=0;i<n;i++)cin>>icic[i+2];
	icic[n+2]=0;
	icic[n+3]=0;
	int t=0;
	
	priority_queue<P>Q;
	for(int i=1;i<=n;i++){
		if(icic[i]>icic[i-1]&&icic[i]>icic[i+1]){
			Q.push(P(icic[i],i));
			}
		}
		
		while(Q.size()){
			P p=Q.front();
			Q.pop();
			
			if(p.first==0)continue;
			if(p.first+t<l){
				t+=(l-p.first-t);
				}
				
			if(icic[p.second-2]<icic[p.second-1])Q.push(P(icic[p.second-1],p.second-1));
			if(icic[p.second+2]<icic[p.second+1])Q.push(P(icic[p.second+1],p.second+1));	
			}
			cout<<t<<endl;
			return 0;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: expected initializer before '.' token
    6 |         int n.l;
      |              ^
a.cc:7:14: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |         cin>>n>>l;
      |              ^
      |              yn
a.cc:7:17: error: 'l' was not declared in this scope
    7 |         cin>>n>>l;
      |                 ^
a.cc:24:31: error: 'class std::priority_queue<std::pair<int, int> >' has no member named 'front'
   24 |                         P p=Q.front();
      |                               ^~~~~
Language: C++

# include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>
 
# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)
 
using namespace std;

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <stdio.h>
#include<iostream>
using namespace std;
#include <stack>
int main()
{
	int k,n,o,r,i[100002]={ 0 },t=0,s;
	stack<int> up;
	scanf("%d%d",&k,&o);
	r=k;
	for(n=1;n<=k;n++){
		scanf("%d",&i[n]);
	}
	for(t=1;;t++)
	{
		for(n=1;n<=k;n++)
		{
			if(i[n]>i[n-1]&&i[n]>i[n+1])
			{
				up.push(n);
			}
		}
		while(!up.empty())
		{
			s=up.top();
			up.pop();
			i[s]+=1;
			if(i[s]==o)
			{
				i[s]=0;
				r-=1;
			}
		}
		if(r==0)
		{
			break;
		}
	}
	printf("%d\n",t);
	return 0;

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


void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}
 
 
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
 
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
 
  LL N, L;
  cin >> N >> L;
 
  vector<PLL> xs(N);
  REP(i,N){
	cin >> xs[i].FF;
	xs[i].SS = i;
  }
  RSORT(xs);
 
  VL ts(N);
  REP(i,N){
	int ix = xs[i].SS;
	ts[ix] = max((ix>0?ts[ix-1]:0ll), (ix+1<N?ts[ix+1]:0ll)) + L - xs[i].FF;
  }
  cout << *max_element(ALL(ts)) << endl;
 
  return 0;
}

Compiler output:
a.cc:2:6: error: variable or field 'maxi' declared void
    2 | void maxi(T& x, T y){
      |      ^~~~
a.cc:2:11: error: 'T' was not declared in this scope
    2 | void maxi(T& x, T y){
      |           ^
a.cc:2:14: error: 'x' was not declared in this scope
    2 | void maxi(T& x, T y){
      |              ^
a.cc:2:17: error: 'T' was not declared in this scope
    2 | void maxi(T& x, T y){
      |                 ^
a.cc:12:20: error: 'acos' was not declared in this scope
   12 | const double PI  = acos(-1.0);
      |                    ^~~~
a.cc:13:7: error: 'LL' does not name a type
   13 | const LL MOD = 1e9+7;
      |       ^~
a.cc: In function 'int main()':
a.cc:16:3: error: 'cin' was not declared in this scope
   16 |   cin.tie(0);
      |   ^~~
a.cc:17:3: error: 'ios_base' has not been declared
   17 |   ios_base::sync_with_stdio(false);
      |   ^~~~~~~~
a.cc:19:3: error: 'LL' was not declared in this scope
   19 |   LL N, L;
      |   ^~
a.cc:20:10: error: 'N' was not declared in this scope
   20 |   cin >> N >> L;
      |          ^
a.cc:20:15: error: 'L' was not declared in this scope
   20 |   cin >> N >> L;
      |               ^
a.cc:22:3: error: 'vector' was not declared in this scope
   22 |   vector<PLL> xs(N);
      |   ^~~~~~
a.cc:22:10: error: 'PLL' was not declared in this scope
   22 |   vector<PLL> xs(N);
      |          ^~~
a.cc:22:15: error: 'xs' was not declared in this scope
   22 |   vector<PLL> xs(N);
      |               ^~
a.cc:23:7: error: 'i' was not declared in this scope
   23 |   REP(i,N){
      |       ^
a.cc:23:3: error: 'REP' was not declared in this scope
   23 |   REP(i,N){
      |   ^~~
a.cc:27:3: error: 'RSORT' was not declared in this scope
   27 |   RSORT(xs);
      |   ^~~~~
a.cc:29:3: error: 'VL' was not declared in this scope
   29 |   VL ts(N);
      |   ^~
a.cc:34:3: error: 'cout' was not declared in this scope
   34 |   cout << *max_element(ALL(ts)) << endl;
      |   ^~~~
a.cc:34:28: error: 'ts' was not declared in this scope
   34 |   cout << *max_element(ALL(ts)) << endl;
      |                            ^~
a.cc:34:24: error: 'ALL' was not declared in this scope
   34 |   cout << *max_element(ALL(ts)) << endl;
      |                        ^~~
a.cc:34:12: error: 'max_element' was not declared in this scope
   34 |   cout << *max_element(ALL(ts)) << endl;
      |            ^~~~~~~~~~~
a.cc:34:36: error: 'endl' was not declared in this scope
   34 |   cout << *max_element(ALL(ts)) << endl;
      |                                    ^~~~
Language: C++

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

int main(){
	int n,l,*ice,buf,h=0,sz;
	queue<int> q;
	
	cin >> n >> l;
	
	ice = new int[n+2];
	ice[0] = ice[n+1] = 0;
	for(int i = 1; i < n+1; i++){
		cin >> ice[i];
	}
	
	for(int i = 1; i < n+1; i++){
		if(ice[i]){
			if((ice[i] > ice[i-1]) && (ice[i] > ice[i+1])){
				q.push(i);
			}
		}
	}
	
	while(1){
		sz = q.size();
		for(int i = 0; i < sz; i++){
			buf = q.front();
			q.pop();
			
			ice[buf]++;
			if(ice[buf] == l){
				ice[buf] = 0;
				if(ice[buf-1] > ice[buf-2]){
					q.push(buf-1);
				}
				if(ice[buf+1] > ice[buf+2]){
					q.push(buf+1);
				}
			}else{
				q.push(buf);
			}
		}
		h++;
		
		if(q.empty()){
			break;
		}
	}
	
	cout << h << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'queue' was not declared in this scope
    7 |         queue<int> q;
      |         ^~~~~
a.cc:3:1: note: 'std::queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
    2 | #include <map>
  +++ |+#include <queue>
    3 | using namespace std;
a.cc:7:15: error: expected primary-expression before 'int'
    7 |         queue<int> q;
      |               ^~~
a.cc:20:33: error: 'q' was not declared in this scope
   20 |                                 q.push(i);
      |                                 ^
a.cc:26:22: error: 'q' was not declared in this scope
   26 |                 sz = q.size();
      |                      ^
Language: C++

#include <iostream>
#include <queue>
#include <utility>
using namespace std;

int main(){
	int n,l,,buf,pa,h=0,sz,ice[100002];
	queue<pair<int, int> > q;
	priority_queue<pair<int, int> > bufq;
	
	cin >> n >> l;
	
	//ice = new int[n+2];
	ice[0] = ice[n+1] = 0;
	for(int i = 1; i < n+1; i++){
		cin >> ice[i];
	}
	
	for(int i = 1; i < n+1; i++){
		if(ice[i]){
			if((ice[i] > ice[i-1]) && (ice[i] > ice[i+1])){
				bufq.push(make_pair(ice[i], i));
			}
		}
	}
	
	while(1){
		sz = bufq.size();
		for(int i = 0; i < sz; i++){
			q.push(bufq.top());
			bufq.pop();
		}
		
		pa = l - q.front().first;
		
		sz = q.size();
		for(int i = 0; i < sz; i++){
			buf = q.front().second;
			q.pop();
			
			ice[buf] += pa;
			if(ice[buf] >= l){
				ice[buf] = 0;
				if(ice[buf-1] > ice[buf-2]){
					bufq.push(make_pair(ice[buf-1], buf-1));
				}
				if(ice[buf+1] > ice[buf+2]){
					bufq.push(make_pair(ice[buf+1], buf+1));
				}
			}else{
				bufq.push(make_pair(ice[buf], buf));
			}
		}
		h += pa;
		
		if(bufq.empty()){
			break;
		}
	}
	
	cout << h << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: expected unqualified-id before ',' token
    7 |         int n,l,,buf,pa,h=0,sz,ice[100002];
      |                 ^
Language: C++

#include <cstdio>
#include <utility>
#include <queue>
using namespace std;
int i,n,L,t,tr[100002],s;
int main(){
	typedef pair<int,int>pii;
	priority_queue<pii> qu;
	pii p;
	
	for(scanf("%d%d",&n,&L);i++<n;)scanf("%d",tr+i);

	for(;--i;)
		tr[i]>tr[i-1]&tr[i]>tr[i+1]?
			qu.push(pii(tr[i]-L,i)),
			tr[i]=L:0;

	for(;!qu.empty();		n&&n!=L&u>tr[s+2])?
			qu.push(pii(t-L+n,s+1)),
			tr[s+1]=L
		:0)
		p=qu.top(),
		qu.pop(),
		
		t=p.first,
		tr[s=p.second]=0,
		
		n=tr[s-1],
		n&&n!=L&n>tr[s-2]?
			qu.push(pii(t-L+n,s-1)),
			tr[s-1]=L
		:0,
		n=tr[s+1];

	
	printf("%d\n",-t);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:49: error: 'u' was not declared in this scope
   18 |         for(;!qu.empty();               n&&n!=L&u>tr[s+2])?
      |                                                 ^
a.cc:18:59: error: expected primary-expression before '?' token
   18 |         for(;!qu.empty();               n&&n!=L&u>tr[s+2])?
      |                                                           ^
Language: C++

#include <cstdio>
#include <utility>
#include <queue>
using namespace std;
int i,n,L,t,s;
int main(){
	typedef pair<int,int>pii;
	priority_queue<pii> qu;
	pii p;
	int tr[100002];
	
	for(scanf("%d%d",&n,&L);i++<n;)scanf("%d",tr+i);
	*t=tr[n+1]=0;
	for(;--i;)
		tr[i]>tr[i-1]&tr[i]>tr[i+1]?
			qu.push(pii(tr[i]-L,i)),
			tr[i]=L:0;

	for(;!qu.empty();
			n&&n!=L&n>tr[s+2]?
			qu.push(pii(t-L+n,s+1)),
			tr[s+1]=L
		:0)
		p=qu.top(),
		qu.pop(),
		
		t=p.first,
		tr[s=p.second]=0,
		
		n=tr[s-1],
		n&&n!=L&n>tr[s-2]?
			qu.push(pii(t-L+n,s-1)),
			tr[s-1]=L
		:0,
		n=tr[s+1];

	
	printf("%d\n",-t);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: invalid type argument of unary '*' (have 'int')
   13 |         *t=tr[n+1]=0;
      |         ^~
Language: C++

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

int N,L,a[100002]={0};
int memo[100002];
int rec(int id)
{
  if(~memo[id])return memo[id];

  int wait=0;
  if(a[id-1]>a[id])wait=max(wait,rec(id-1));
  if(a[id]<a[id+1])wait=max(wait,rec(id+1));
  return memo[id] = wait + L-a[id];
}

int main()
{
  memset(memo,-1,sizeof(memo));
  cin>>N>>L;
  for(int i=1;i<=N;i++)cin>>a[i];
  int ans=0;
  for(int i=1;i<=N;i++)ans=max(ans,rec(i));
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:3: error: 'memset' was not declared in this scope
   19 |   memset(memo,-1,sizeof(memo));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

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

using namespace std;

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

int a[100000];
int b[100000];
int amn=INT_MAX;
int amx=INT_MIN;
int bmn=INT_MAX;
int bmx=INT_MIN;
int n;
int c,d;
int or = INT_MIN;
int ou = INT_MIN;

int main(){
	scanf("%d",&n);
	REP(i,n){
		scanf("%d %d",&c,&d);
		a[i] = c+d;
		b[i] = c-d;
		amn = min(amn,a[i]);
		amx = max(amx,a[i]);
		bmn = min(bmn,b[i]);
		bmx = max(bmx,b[i]);
	}
	REP(i,n){
		or = max(or,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
		ou = max(ou,min(max(a[i]-amn,bmx-b[i]),max(amx-a[i],b[i]-bmn)));
	}
	printf("%d",min(or,ou));
}

Compiler output:
a.cc:18:5: error: expected unqualified-id before 'or' token
   18 | int or = INT_MIN;
      |     ^~
a.cc: In function 'int main()':
a.cc:33:17: error: expected primary-expression before 'or' token
   33 |                 or = max(or,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
      |                 ^~
a.cc:33:20: error: expected primary-expression before '=' token
   33 |                 or = max(or,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
      |                    ^
a.cc:33:26: error: expected primary-expression before 'or' token
   33 |                 or = max(or,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
      |                          ^~
a.cc:33:28: error: expected primary-expression before ',' token
   33 |                 or = max(or,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
      |                            ^
a.cc:36:25: error: expected primary-expression before 'or' token
   36 |         printf("%d",min(or,ou));
      |                         ^~
a.cc:36:27: error: expected primary-expression before ',' token
   36 |         printf("%d",min(or,ou));
      |                           ^
Language: C++

#include <cstdio>
#include <stdc++.h>
using namespace std;
#define R for(i=0;i<n;++i)
int a[1<<17],b[1<<17],amn=1e7,amx=-1e7,bmn=1e7,bmx=-1e7,n,c,d,ow=-1e7,oh=1e7,i;
int main(){
	scanf("%d",&n);
	R{
		scanf("%d %d",&c,&d);
		a[i] = c+d;
		b[i] = c-d;
		amn = min(amn,a[i]);
		amx = max(amx,a[i]);
		bmn = min(bmn,b[i]);
		bmx = max(bmx,b[i]);
	}
	R{
		ow = max(ow,min(max(a[i]-amn,b[i]-bmn),max(amx-a[i],bmx-b[i])));
		oh = max(oh,min(max(a[i]-amn,bmx-b[i]),max(amx-a[i],b[i]-bmn)));
	}
	printf("%d\n",min(ow,oh));
}

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

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef pair<int,int> pi;

int n;
pi a[100005];

int solve(){
    int s = 0, e = 400000;
    while (s != e) {
        int m = (s+e)/2;
        int xl = 1e9, yl = 1e9, xh = -1e9, yh = -1e9;
        for (int j=0; j<n; j++) {
            if(a[j].first > m || a[j].second > m){
                xl = min(xl,a[j].first);
                xh = max(xh,a[j].first);
                yl = min(yl,a[j].second);
                yh = max(yh,a[j].second);
            }
        }
        if(yh - yl <= m && xh - xl <= m) e = m;
        else s = m+1;
    }
    return s;
}

int main(){
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        int x,y;
        scanf("%d %d",&x,&y);
        a[i] = pi(x+y,x-y);
    }
    int ret = solve();
    for (int i=0; i<n; i++) {
        a[i].first = maxv1 - a[i].first;
    }
    ret = min(ret,solve());
    printf("%d\n",ret);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:22: error: 'maxv1' was not declared in this scope
   38 |         a[i].first = maxv1 - a[i].first;
      |                      ^~~~~
Language: C++

//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
#define geta 100000
vector<int>za[200005];
vector<int>all;
int main()
{
	int n;
	scanf("%d",&n);
	P p[100005];
	int xmi=INF,xma=-INF,ymi=INF,yma=-INF;
	for(int i=0;i<n;i++)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		p[i]=mp(x+y,x-y);
		xmi=min(xmi,x+y);
		xma=max(xma,x+y);
		ymi=min(ymi,x-y);
		yma=max(yma,x-y);
	}
	if(xma-xmi<yma-ymi)
	{
		for(int i=0;i<n;i++)swap(p[i].first,p[i].second);
		swap(xma,yma);
		swap(xmi,ymi);
	}
	for(int i=0;i<n;i++)
	{
		za[p[i].second+geta].pb(p[i].first);
		all.pb(p[i].first);
	}
	sort(all.begin(),all.end());
	for(int  i=0;i<200005;i++) sort(za[i].begin(),za[i].end());
	int lb=0;
	int ub=xma-xmi;
	int ano=yma-ymi;
	while(ub-lb>1)
	{
		int mid=(lb+ub)>>1;
		if(mid>=ano)
		{
			int d=upper_bound(all.begin(),all.end(),all[0]+mid)-all.begin();
			if(d==all.size() || all[all.size()-1]-all[d]<=mid) ub=mid;
			else lb=mid;
		}
		else
		{
			for(int i=yma+geta;i>ymi+mid+geta;i--)
			{
				if(za[i].empty())  continue;
				if(za[i][za[i].size()-1]>xmi+mid) goto next;
			}
			for(int i=ymi+geta;i<yma-mid+geta;i++)
			{
				if(za[i].empty())  continue;
				if(za[i][0]<xma-mid) goto next;
			}
			for(int i=yma-mid+geta;i<=ymi+mid+geta;i++)
			{
				if(za[i].empty())  continue;
				int d=upper_bound(za[i].begin(),za[i].end(),xmi+mid)-za[i].begin();
				int e=lower_bound(za[i].begin(),za[i].end(),xma-mid)-za[i].begin();
				if(d<e) goto next;
			}
			ub=mid;
			continue;
			next:;
			for(int i=yma+geta;i>ymi+mid+geta;i--)
			{
				if(za[i].empty())  continue;
				if(za[i][0]<xma-mid) goto next2;
			}
			for(int i=ymi+geta;i<yma-mid+geta;i++)
			{
				if(za[i].empty())  continue;
				if(za[i][za[i].size()-1]>xmi+mid) goto next2;
			}
			for(int i=yma-mid+geta;i<=ymi+mid+geta;i++)
			{
				if(za[i].empty())  continue;
				int d=upper_bound(za[i].begin(),za[i].end(),xmi+mid)-za[i].begin();
				int e=lower_bound(za[i].begin(),za[i].end(),xma-mid)-za[i].begin();
				if(d<e) goto next2;
			}
			ub=mid;
			continue;
			next2;
			lb=mid;
		}
	}
	printf("%d\n",ub);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:113:25: error: 'next2' was not declared in this scope; did you mean 'nextup'?
  113 |                         next2;
      |                         ^~~~~
      |                         nextup
a.cc:97:59: error: label 'next2' used but not defined
   97 |                                 if(za[i][0]<xma-mid) goto next2;
      |                                                           ^~~~~
Language: C++

//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
#define geta 200000
vector<int>za[400005];
vector<int>all;
int main()
{
	int n;
	scanf("%d",&n);
	P p[100005];
	int xmi=INF,xma=-INF,ymi=INF,yma=-INF;
	for(int i=0;i<n;i++)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		p[i]=mp(x+y,x-y);
		xmi=min(xmi,x+y);
		xma=max(xma,x+y);
		ymi=min(ymi,x-y);
		yma=max(yma,x-y);
	}
	if(xma-xmi<yma-ymi)
	{
		for(int i=0;i<n;i++)swap(p[i].first,p[i].second);
		swap(xma,yma);
		swap(xmi,ymi);
	}
	for(int i=0;i<n;i++)
	{
		za[p[i].second+geta].pb(p[i].first);
		all.pb(p[i].first);
	}
	sort(all.begin(),all.end());
	for(int  i=0;i<400005;i++) sort(za[i].begin(),za[i].end());
	int lb=0;
	int ub=xma-xmi;
	int ano=yma-ymi;
	while(ub-lb>1)
	{
		int mid=(lb+ub)>>1;
		if(mid>=ano)
		{
			int d=upper_bound(all.begin(),all.end(),all[0]+mid)-all.begin();
			if(d==all.size() || all[all.size()-1]-all[d]<=mid) ub=mid;
			else lb=mid;
		}
		else
		{
			for(int i=yma+geta;i>ymi+mid+geta;i--)
			{
				if(za[i].empty())  continue;
				if(za[i][za[i].size()-1]>xmi+mid) goto next;
			}
			for(int i=ymi+geta;i<yma-mid+geta;i++)
			{
				if(za[i].empty())  continue;
				if(za[i][0]<xma-mid) goto next;
			}
			for(int i=yma-mid+geta;i<=ymi+mid+geta;i++)
			{
				if(za[i].empty())  continue;
				int d=upper_bound(za[i].begin(),za[i].end(),xmi+mid)-za[i].begin();
				int e=lower_bound(za[i].begin(),za[i].end(),xma-mid)-za[i].begin();
				if(d<e) goto next;
			}
			ub=mid;
			continue;
			next:;
			for(int i=yma+geta;i>ymi+mid+geta;i--)
			{
				if(za[i].empty())  continue;
				if(za[i][0]<xma-mid) goto next2;
			}
			for(int i=ymi+geta;i<yma-mid+geta;i++)
			{
				if(za[i].empty())  continue;
				if(za[i][za[i].size()-1]>xmi+mid) goto next2;
			}
			for(int i=yma-mid+geta;i<=ymi+mid+geta;i++)
			{
				if(za[i].empty())  continue;
				int d=upper_bound(za[i].begin(),za[i].end(),xmi+mid)-za[i].begin();
				int e=lower_bound(za[i].begin(),za[i].end(),xma-mid)-za[i].begin();
				if(d<e) goto next2;
			}
			ub=mid;
			continue;
			next2;
			lb=mid;
		}
	}
	printf("%d\n",ub);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:113:25: error: 'next2' was not declared in this scope; did you mean 'nextup'?
  113 |                         next2;
      |                         ^~~~~
      |                         nextup
a.cc:97:59: error: label 'next2' used but not defined
   97 |                                 if(za[i][0]<xma-mid) goto next2;
      |                                                           ^~~~~
Language: C

#include <cstdio>
#include <queue>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef struct {
    int plus, pos;
} Dungeon;

bool operator < (const Dungeon &a, const Dungeon &b)
{
    if (a.plus != b.plus){
        return (a.plus < b.plus);
    }
    else {
        return (a.pos < b.pos);
    }
}
int data[1 << 18], datb[1 << 18];

void add(int a, int b, int x, int k, int l, int r)
{
    if (a <= l && r <= b){ //comletely inclusive.
        data[k] += x; //add to all segmets corresponds to [l, r).
    }
    else if (l < b && a < r){ //some of the segments are inclusive.
        datb[k] += (min(b, r) - max(a, l)) * x;  //add the x to the segments that belongs to [max(a, l), min(r, b)).
        add(a, b, x, k * 2 + 1, l, (l + r) / 2); //go to the left vertex.
        add(a, b, x, k * 2 + 2, (l + r) / 2, r); //go to the right vertex.
    }
}

//*
int sum(int a, int b, int k, int l, int r)
{
    if (b <= l || r <= a){ //looking segment[l, r) cross with the segment [a, b).
        return (0);
    }
    else if (a <= l && r <= b){ //completely inclusive.
        return (data[k] * (r - l) + datb[k]);
    }
    else { //some of the segments are inclusive.
        ll res;
        res = (min(b, r) - max(a, l)) * data[k];
        res += sum(a, b, k * 2 + 1, l, (l + r) / 2);
        res += sum(a, b, k * 2 + 2, (l + r) / 2, r);
        return (res);
    }
}
//*/

int main(void)
{
    int N, H;
    int di[100000], hi[100000];
    int curLife;
    
    scanf("%d%d", &N, &H);
    
    for (int i = 0; i < N - 1; i++){
        scanf("%d%d", &di[i], &hi[i]);
    }
    
    curLife = H;
    
    ll ans = 0;
    priority_queue<Dungeon> que;
    for (int i = 0; i < N - 1; i++){
        add(i, i + 1, curLife, 0, 0, 1 << 17);
        Dungeon in;
        curLife -= di[i];
        
        in.plus = hi[i];
        in.pos = i;
        
        que.push(in);
        while (curLife <= 0){
            Dungeon heal = que.top();
            que.pop();
            
            /* O(logN)
            int segMax = getMax(heal.pos, i + 1, 0, 0, 1 << 17);
            //*/
            
            //* O(NlogN)
            int segMax = 0;
            for (int j = heal.pos; j <= i; j++){
                segMax = max(segMax, sum(j, j + 1, 0, 0, 1 << 17));
            }
            //*/
            
            if (heal.plus + segMax > H){
                heal.plus = H - segMax;
                que.push(heal);
                continue;
            }
            
            int howMany = min((-1 * curLife) / heal.plus + 1, (H - segMax) / heal.plus);
            ans += howMany;
            curLife += howMany * heal.plus;
            
            add(heal.pos, i + 1, howMany * heal.plus, 0, 0, 1 << 17);
            que.push(heal);
        }
    }
    
    printf("%lld\n", ans);
    
    return (0);
}

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