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 time = 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();
		time = -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",time);
	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:18:5: error: 'int time' redeclared as different kind of entity
   18 | int time = 0;
      |     ^~~~
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:5:
/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 'void solve()':
a.cc:28:22: error: assignment of function 'time_t time(time_t*)'
   28 |                 time = -1 * ic.first;
      |                 ~~~~~^~~~~~~~~~~~~~~
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}