Language: C++

a#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
#define Fordown(i,a,b) for(register sign i=(sign)(a);i>=(sign)(b);--i)
const int N=2e5+5;
template<typename T>bool cmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool cmin(T &a,T b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
	T ans=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
	return ans*f;
}
template<typename T>void write(T x,char y)
{
	if(x==0)
	{
		putchar('0'),putchar(y);
		return;
	}
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	static char wr[20];
	int top=0;
	for(;x;x/=10)wr[++top]=x%10+'0';
	while(top)putchar(wr[top--]);
	putchar(y);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("C.in","r",stdin);
	freopen("C.out","w",stdout);
#endif
}
int n,a[N];
void input()
{
	n=read<int>();
	For(i,1,n)a[i]=read<int>();
}
int num[65],stk[N],top;
bool check(int d)
{
	memset(num,0,sizeof num);
	For(i,1,n)if(a[i]<=60&&a[i]<=a[i-1])
	{
		num[a[i]]++;
		For(j,a[i]+1,60)num[j]=0;
		for(int pos=a[i];pos&&num[pos]==d;pos--)
		{
			num[pos]=0;num[pos-1]++;
			if(!pos)return 0;
		}
	}
	return 1;
}
void work()
{
	int flag=0;
	For(i,2,n)if(a[i]<=a[i-1])flag=1;
	if(!flag){puts("1");return;}
	int l=2,r=n,mid,ans=-1;
	while(l<=r)
	{
		mid=(l+r)>>1;
		if(check(mid))ans=mid,r=mid-1;
		else l=mid+1;
	}
	write(ans,'\n');
}
int main()
{

	input();
	work();
	return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | a#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'a' does not name a type
    1 | a#include<bits/stdc++.h>
      | ^
a.cc: In function 'T read()':
a.cc:13:17: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
   13 |         char ch=getchar();
      |                 ^~~~~~~
a.cc:13:17: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:14:16: error: there are no arguments to 'isdigit' that depend on a template parameter, so a declaration of 'isdigit' must be available [-fpermissive]
   14 |         while(!isdigit(ch)&&ch!='-')ch=getchar();
      |                ^~~~~~~
a.cc:14:40: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
   14 |         while(!isdigit(ch)&&ch!='-')ch=getchar();
      |                                        ^~~~~~~
a.cc:15:28: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
   15 |         if(ch=='-')f=-1,ch=getchar();
      |                            ^~~~~~~
a.cc:16:15: error: there are no arguments to 'isdigit' that depend on a template parameter, so a declaration of 'isdigit' must be available [-fpermissive]
   16 |         while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
      |               ^~~~~~~
a.cc:16:61: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
   16 |         while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
      |                                                             ^~~~~~~
a.cc: In function 'void write(T, char)':
a.cc:23:17: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   23 |                 putchar('0'),putchar(y);
      |                 ^~~~~~~
a.cc:23:30: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   23 |                 putchar('0'),putchar(y);
      |                              ^~~~~~~
a.cc:28:17: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   28 |                 putchar('-');
      |                 ^~~~~~~
a.cc:34:19: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   34 |         while(top)putchar(wr[top--]);
      |                   ^~~~~~~
a.cc:35:9: error: there are no arguments to 'putchar' that depend on a template parameter, so a declaration of 'putchar' must be available [-fpermissive]
   35 |         putchar(y);
      |         ^~~~~~~
a.cc: In function 'void file()':
a.cc:40:28: error: 'stdin' was not declared in this scope
   40 |         freopen("C.in","r",stdin);
      |                            ^~~~~
a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | a#include<bits/stdc++.h>
a.cc:40:9: error: 'freopen' was not declared in this scope
   40 |         freopen("C.in","r",stdin);
      |         ^~~~~~~
a.cc:41:29: error: 'stdout' was not declared in this scope
   41 |         freopen("C.out","w",stdout);
      |                             ^~~~~~
a.cc:41:29: note: 'stdout' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc: In function 'void input()':
a.cc:48:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   48 |         For(i,1,n)a[i]=read<int>();
      |             ^
a.cc:5:38: note: in definition of macro 'For'
    5 | #define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
      |                                      ^
a.cc: In function 'bool check(int)':
a.cc:53:9: error: 'memset' was not declared in this scope
   53 |         memset(num,0,sizeof num);
      |         ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | a#include<bits/stdc++.h>
a.cc:54:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   54 |         For(i,1,n)if(a[i]<=60&&a[i]<=a[i-1])
      |             ^
a.cc:5:38: note: in definition of macro 'For'
    5 | #define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
      |                                      ^
a.cc:57:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   57 |                 For(j,a[i]+1,60)num[j]=0;
      |                     ^
a.cc:5:38: note: in definition of macro 'For'
    5 | #define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
      |                                      ^
a.cc: In function 'void work()':
a.cc:69:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   69 |         For(i,2,n)if(a[i]<=a[i-1])flag=1;
      |             ^
a.cc:5:38: note: in definition of macro 'For'
    5 | #define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
      |                                      ^
a.cc:70:19: error: 'puts' was not declared in this scope
   70 |         if(!flag){puts("1");return;}
      |                   ^~~~
a.cc: In instantiation of 'T read() [with T = int]':
a.cc:47:13:   required from here
   47 |         n=read<int>();
      |           ~~~~~~~~~^~
a.cc:13:24: error: 'getchar' was not declared in this scope
   13 |         char ch=getchar();
      |                 ~~~~~~~^~
a.cc:13:24: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:14:23: error: 'isdigit' was not declared in this scope
   14 |         while(!isdigit(ch)&&ch!='-')ch=getchar();
      |                ~~~~~~~^~~~
a.cc:16:22: error: 'isdigit' was not declared in this scope
   16 |         while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
      |               ~~~~~~~^~~~
a.cc: In instantiation of 'void write(T, char) [with T = int]':
a.cc:78:7:   required from here
   78 |         write(ans,'\n');
      |         ~~~~~^~~~~~~~~~
a.cc:23:24: error: 'putchar' was not declared in this scope; did you mean 'char'?
   23 |                 putchar('0'),putchar(y);
      |                 ~~~~~~~^~~~~
      |                 char
a.cc:23:37: error: 'putchar' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation
   23 |                 putchar('0'),putchar(y);
      |                              ~~~~~~~^~~
a.cc:23:24: note: 'putchar' declared here, later in the translation unit
   23 |                 putchar('0'),putchar(y);
      |                 ~~~~~~~^~~~~
a.cc:28:24: error: 'putchar' was not declared in this scope; did you mean 'char'?
   28 |                 putchar('-');
      |                 ~~~~~~~^~~~~
      |                 char
a.cc:34:26: error: 'putchar' was not declared in this scope; did you mean 'char'?
   34 |         while(top)putchar(wr[top--]);
      |                   ~~~~~~~^~~~~~~~~~~
      |                   char
a.cc:35:16: error: 'putchar' was not declared in this scope; did you mean 'char'?
   35 |         putchar(y);
      |         ~~~~~~~^~~
      |         char