Language: Java

#include<map>
#include<set>
#include<unordered_map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;


struct edge
{
	long long to; long long len;
	bool operator<(const edge& rhs) const {
		return len > rhs.len;
	}
};

ll const MAX = 200005;
ll a[MAX], b[MAX];
ll n;

bool ok(ll mid) {
	unordered_map<ll, ll> mp;
	stack<ll> st;
	st.push(0);
	REP(i, 1, n) {
		ll cur = b[i];
		if (cur == -1) continue;
		while (st.top() > cur) {
			ll t = st.top();
			st.pop();
			mp[t] = 0;
		}
		if (st.top() < cur) {
			st.push(cur);
		}
		mp[cur]++;
		ll uuu = cur;
		while (mp[uuu] >= mid) {
			mp[uuu] = 0;
			uuu--;
			mp[uuu]++;
			if (uuu <= 0) {
				return false;
			}
		}
	}
	return true;
}

int main() {
	cin >> n;
	REP(i, 1, n) {
		cin >> a[i];
	}
	bool flag = 1;
	REP(i, 1, n - 1) {
		if (a[i] >= a[i + 1]) {
			flag = 0;
		}
	}
	if (flag) {
		cout << 1 << endl;
		return 0;
	}

	ll cur = 0;
	REP(i, 1, n) {
		if (cur >= a[i]) {
			b[i] = a[i];
		}
		else {
			b[i] = -1;
		}
		cur = a[i];
	}
	ll lb = 1; ll ub = 200005;
	while (ub > lb + 1) {
		ll mid = (ub + lb) / 2;
		if (ok(mid)) {
			ub = mid;
		}
		else {
			lb = mid;
		}
	}
	cout << ub << endl;
}



Compiler output:
Main.java:1: error: illegal character: '#'
#include<map>
^
Main.java:2: error: illegal character: '#'
#include<set>
^
Main.java:3: error: illegal character: '#'
#include<unordered_map>
^
Main.java:4: error: illegal character: '#'
#include<bitset>
^
Main.java:5: error: illegal character: '#'
#include<cstdio>
^
Main.java:6: error: illegal character: '#'
#include<iostream>
^
Main.java:7: error: illegal character: '#'
#include<algorithm>
^
Main.java:8: error: illegal character: '#'
#include<vector>
^
Main.java:9: error: illegal character: '#'
#include<queue>
^
Main.java:10: error: illegal character: '#'
#include<string>
^
Main.java:11: error: illegal character: '#'
#include<chrono>
^
Main.java:12: error: illegal character: '#'
#include<stack>
^
Main.java:13: error: illegal character: '#'
#include<fstream>
^
Main.java:14: error: illegal character: '#'
#include<list>
^
Main.java:15: error: illegal character: '#'
#define REP(i,x,y) for(ll i=x;i<=y;i++)
^
Main.java:15: error: class, interface, enum, or record expected
#define REP(i,x,y) for(ll i=x;i<=y;i++)
                              ^
Main.java:15: error: class, interface, enum, or record expected
#define REP(i,x,y) for(ll i=x;i<=y;i++)
                                   ^
Main.java:16: error: illegal character: '#'
#define SIZE(a) ll(a.size())
^
Main.java:17: error: illegal character: '#'
#define vll vector<ll> 
^
Main.java:18: error: illegal character: '#'
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
^
Main.java:18: error: class, interface, enum, or record expected
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
                                   ^
Main.java:18: error: class, interface, enum, or record expected
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
                                        ^
Main.java:19: error: illegal character: '#'
#define BIT(n) (ll(1)<<n)
^
Main.java:20: error: illegal character: '#'
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
^
Main.java:21: error: illegal character: '#'
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
^
Main.java:22: error: illegal character: '#'
#define SORT(a,n) sort(a+1,a+n+1)
^
Main.java:23: error: illegal character: '#'
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
^
Main.java:24: error: illegal character: '#'
#define PER(i,y,x) for(ll i=y;i>=x;i--)
^
Main.java:24: error: class, interface, enum, or record expected
#define PER(i,y,x) for(ll i=y;i>=x;i--)
                              ^
Main.java:24: error: class, interface, enum, or record expected
#define PER(i,y,x) for(ll i=y;i>=x;i--)
                                   ^
Main.java:26: error: class, interface, enum, or record expected
using namespace std;
^
Main.java:29: error: class, interface, enum, or record expected
struct edge
^
Main.java:31: error: class, interface, enum, or record expected
	long long to; long long len;
	              ^
Main.java:32: error: class, interface, enum, or record expected
	bool operator<(const edge& rhs) const {
	^
Main.java:34: error: class, interface, enum, or record expected
	}
	^
Main.java:37: error: class, interface, enum, or record expected
ll const MAX = 200005;
^
Main.java:38: error: class, interface, enum, or record expected
ll a[MAX], b[MAX];
^
Main.java:39: error: unnamed classes are a preview feature and are disabled by default.
ll n;
^
  (use --enable-preview to enable unnamed classes)
Main.java:45: error: ';' expected
	REP(i, 1, n) {
	            ^
Main.java:71: error: not a statement
	cin >> n;
	    ^
Main.java:73: error: not a statement
		cin >> a[i];
		    ^
Main.java:82: error: not a statement
		cout << 1 << endl;
		          ^
Main.java:106: error: not a statement
	cout << ub << endl;
	           ^
Main.java:72: error: ';' expected
	REP(i, 1, n) {
	            ^
Main.java:76: error: ';' expected
	REP(i, 1, n - 1) {
	                ^
Main.java:87: error: ';' expected
	REP(i, 1, n) {
	            ^
46 errors