akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int N = Integer.parseInt(br.readLine());
		int[][][] all = new int[4][3][10];

		for(int l = 0; l<N; l++){
			String[] set = br.readLine().split(" ");
			int b = Integer.parseInt(set[0]);
			int f = Integer.parseInt(set[1]);
			int r = Integer.parseInt(set[2]);
			int v = Integer.parseInt(set[3]);

			all[b-1][f-1][r-1] += v;
		}

		for(int i = 0; i < all.length; i++){
			for(int j = 0; j < all[i].length; j++) {
				for(int k = 0; k < all[i][j].length; k++) {
					sb.append(" ").append(all[i][j][k]);
				}
				sb.append("\n");
			}
			if (i != all[i].length) {
				sb.append("####################\n");
			}
		}
		System.out.print(sb);
	}

}

Measured memory_bytes: 24392
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back
const int mod = 1e9+7;

ll dp[405][405], sum[405][405];
int a[405], b[405];
ll pow2(ll a, ll b){
    ll ans = 1;
    while(b){
        if(b%2 == 1) ans = ans*a%mod;
        a = a*a%mod;
        b/=2;
    }
    return ans;
}
int main(){
    for(int i=1;i<=400;i++){
        for(int j=0;j<=400;j++){
            sum[i][j] = (sum[i-1][j] + pow2(i, j))%mod;
        }
    }
    int n, c;
    scanf("%d%d", &n, &c);
    for(int i=0;i<n;i++) scanf("%d", &a[i]);
    for(int i=0;i<n;i++) scanf("%d", &b[i]);
    dp[0][0] = 1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=c;j++){
            if(dp[i][j] == 0) continue;
            for(int k=0;k<=c-j;k++){
                dp[i+1][j+k] = (dp[i+1][j+k] + dp[i][j]*1ll*(sum[b[i]][k]-sum[a[i]-1][k]+mod))%mod;
            }
        }
    }   
    printf("%lld\n", dp[n][c]);
}

Measured memory_bytes: 6304
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  string left="mnlkjhyuiop";
  string s;
  while(cin>>s,s.size()!=1||s[0]!='#'){
    bool h=true;//r
    int co=-1;
    rep(i,11){if(left[i]!=s[0])continue;co++;break;}
    rep(i,s.size()){
      bool han=true;
      if(h){han=false;rep(j,11)if(left[j]==s[i])han=true;}
      else {rep(j,11)if(left[j]==s[i])han=false;}
      if(!han){co++;h^=1;}
      //cout<<h<<endl;
    }
    cout<<co<<endl;
  }

}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main()
{
    string s, t;
    std::cin >> s >> t;
    for (unsigned int i = 0; i < s.length(); ++i)
    {
        if (s[i] != t[i])
        {
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    std::cout << "Yes" << std::endl;
    return 0;
}

Measured memory_bytes: 3628
# import bisect
# from collections import Counter, defaultdict, deque
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    a, b = list(map(int,ipti().split()))
    print((a-1)*(b-1))

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define INF 0x3f3f3f3f
typedef long long ll;
ll n;

int main()
{
    // ios_base::sync_with_stdio(0),cin.tie(0);
    ll m,d;
    while(cin>>m>>d)
    {
        ll sum=0;
        rep1(i,m)
        {
            for(int j=10;j<=d;j++)
            {
                if(j<100)
                {
                    if(j/10>=2&&j%10>=2)
                    if(j/10*(j%10)==i) sum++;
                }
            }
        }
        cout<<sum<<'\n';
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main (){
	int n; cin >> n;
	vector<int> v(n);
	cinv(n,v);
	vector<int> vv;
	rep(i,n){
		int a = 0, b = 0;
		if (i+1 >= n) break;
		rep(j,i+1){
			a += v[j];
		}
		for(int j = i+1; j < n; j++){
			b += v[j];
		}
		vv.push_back(abs(a-b));
	}
	cout << *min_element(all(vv)) << endl;
}

Measured memory_bytes: 256
L,R=map(int,input().split())
MOD=2019

ans=2019

for l in range(L,R):
    for r in range(l+1,R+1):
        if r-l>=2019:
            print(0)
            exit()
        else:
            ans=min(ans,l*r%MOD)
            
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(a) (a).begin(), (a).end()
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define sz() size()
#define fr first
#define sc second
#define int long long
#define mp make_pair
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
using namespace std;

int n,x,t;

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    srand(chrono::steady_clock::now().time_since_epoch().count());
    cin >> n >> x >> t;
    if(n % x == 0){
        cout << t * (n/x);
    }
    else{
        cout << t*(n/x + 1);
    }
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N;
    Scd(N);
    
    char s[232323];

    Scs(s);

    bool bl = false;
    int tmp = 0;
    Rep(i,N){
        if( s[i] == '.' )
        tmp++;
    }
    int ans = tmp;
    Rep(i,N){
        if( s[i] == '#' )
            tmp++;
        else if( s[i] == '.' )
            tmp--;
        ans = min(ans,tmp);
    }


    printf("%d\n", ans);


    return 0;
}



Measured memory_bytes: 512
#include<cstring>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;

char s[100005];
map<char,long long>S;
int main(){
	int n;
	long long sum=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%s",s);
		if(s[0]=='M'||s[0]=='A'||s[0]=='R'||s[0]=='C'||s[0]=='H') S[s[0]]++;
	}
	sum+=(S['M']*S['A']*S['R']);
	sum+=(S['M']*S['A']*S['C']);
	sum+=(S['M']*S['A']*S['H']);
	sum+=(S['M']*S['R']*S['C']);
	sum+=(S['M']*S['R']*S['H']);
	sum+=(S['M']*S['C']*S['H']);
	sum+=(S['A']*S['R']*S['C']);
	sum+=(S['A']*S['R']*S['H']);
	sum+=(S['A']*S['C']*S['H']);
	sum+=(S['R']*S['C']*S['H']);
	printf("%lld\n",sum);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
using namespace std;
int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	char c;
	cin>>c;
	if(c>='A' && c<='Z')cout<<"A"<<endl;
	else cout<<"a"<<endl; 
	return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
typedef pair<int,int> P;
const int INF=1e9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
int main(){
    int h,w,sx,sy,gx,gy;
    cin>>h>>w>>sx>>sy>>gx>>gy;
    sx--;sy--;gx--;gy--;
    vector<vector<char>> map(h,vector<char>(w));
    vector<vector<int>> dist(h,vector<int>(w,INF));
    rep(i,h) rep(j,w) cin>>map[i][j];
    deque<P> que;
    que.emplace_front(P(sx,sy));
    dist[sx][sy]=0;
    while(que.size()){
        P p=que.front();que.pop_front();
        if(p.first==gx&&p.second==gy) break;
        rep(i,4){
            int nx=p.first+dx[i],ny=p.second+dy[i];
            if(nx<0||h<=nx||ny<0||w<=ny||dist[nx][ny]<=dist[p.first][p.second]) continue;
            if(map[nx][ny]=='.'){
                que.emplace_front(P(nx,ny));
                dist[nx][ny]=dist[p.first][p.second];
            }
        }
        for(int i=-2;i<3;i++){
            for(int j=-2;j<3;j++){
                int nx=p.first+i,ny=p.second+j;
                if(nx<0||h<=nx||ny<0||w<=ny||dist[nx][ny]<=dist[p.first][p.second]+1) continue;
                if(map[nx][ny]=='.'){
                    que.emplace_back(P(nx,ny));
                    dist[nx][ny]=dist[p.first][p.second]+1;
                }
            }
        }
    }
    if(dist[gx][gy]==INF) cout<<"-1";
    else cout<<dist[gx][gy];
}

Measured memory_bytes: 8564
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    private const int MOD_N = 1000000000 + 7;

    public static void Main()
    {
        var list = Console.ReadLine().Split(' ');
        var l = int.Parse(list[0]);
        var r = int.Parse(list[1]);

        if (r - l >= 2018)
        {
            Console.WriteLine(0);
            return;
        }

        var l_rem = l % 2019;
        var r_rem = r % 2019;

        if (l_rem > r_rem)
        {
            Console.WriteLine(0);
            return;
        }

        int min = 2019;

        for (int i = l_rem; i < r_rem; ++i)
        {
            for (int j = i + 1; j <= r_rem; ++j)
            {
                var t = i * j % 2019;
                if (t < min)
                    min = t;
            }
        }

        Console.WriteLine(min);
    }

    private static int GCD(int a, int b) => a > b ? GCD_impl(a, b) : GCD_impl(b, a);
    private static int GCD_impl(int a, int b) => b == 0 ? a : GCD_impl(b, a % b);
    private static long LCM(int a, int b) => (long)a * b / GCD(a, b);

    private static int Comb(int m, int n)
    {
        var t = m - n;
        if (n > t)
            n = t;

        long numerator = 1;
        for (int i = 0; i < n; ++i)
        {
            numerator *= m - i;
            numerator %= MOD_N;
        }
        long denominator = 1;
        for (; n != 0; --n)
        {
            denominator *= n;
            denominator %= MOD_N;
        }

        var inv_denominator = ModInv((int)denominator, MOD_N);
        var ret = (int)(numerator * inv_denominator % MOD_N);

        return ret >= 0 ? ret : ret + MOD_N;
    }

    private static int ModInv(int a, int m)
    {
        int b = m, x = 1, y = 0;
        while (b != 0)
        {
            var t = a / b;
            a -= t * b;
            Swap(ref a, ref b);
            x -= t * y;
            Swap(ref x, ref y);
        }
        x %= m;
        return x >= 0 ? x : x + m;
    }

    private static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>
#include <queue>

using namespace std;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
 
int main(){

    int H, W;
    cin >> H >> W;
    int ch, cw, dh, dw;
    cin >> ch >> cw;
    cin >> dh >> dw;
    vector<string> S(H);
    for(int i = 0; i < H; i++){
        cin >> S[i];
    }

    vector<vector<bool>> isChecked(H, vector<bool>(W, false));
    isChecked[ch - 1][cw - 1] = true;
    queue<pair<int, int>> q;
    q.push(make_pair(ch - 1, cw - 1));
    int ans = 0;
    while(true){
        if(q.empty()){
            cout << -1 << endl;
            return 0;
        }
        else{
            queue<pair<int, int>> tempQ = q;
            while(!q.empty()){
                auto temp = q.front();
                q.pop();
                int x = temp.first;
                int y = temp.second;

                if(x == dh - 1 && y == dw - 1){
                    cout << ans << endl;
                    return 0;
                }

                for(int i = 0; i < 4; i++){
                    int nx = x + dx[i];
                    int ny = y + dy[i];

                    if(0 <= nx && nx < H && 0 <= ny && ny < W){
                        if(S[nx][ny] == '.' && !isChecked[nx][ny]){
                            isChecked[nx][ny] = true;
                            q.push(make_pair(nx, ny));
                            tempQ.push(make_pair(nx, ny));
                        }
                    }
                }
            }

            while(!tempQ.empty()){
                auto temp = tempQ.front();
                tempQ.pop();
                int x = temp.first;
                int y = temp.second;

                for(int i = -2; i <= 2; i++){
                    for(int j = -2; j <= 2; j++){
                        int nx = x + i;
                        int ny = y + j;
                        if(0 <= nx && nx < H && 0 <= ny && ny < W){
                            if(S[nx][ny] == '.' && !isChecked[nx][ny]){
                                isChecked[nx][ny] = true;
                                q.push(make_pair(nx, ny));
                            }
                        }
                    }
                }
            }
        }
        ans++;
    }

    return 0;
}

Measured memory_bytes: 5720
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
const LL MOD = 1e9 + 7;

int main(){
    
    // 1. 入力情報.
    int N, K;
    scanf("%d %d", &N, &K);
    
    // 2. 0 ～ N から, K個以上選択した場合の最小値, 最大値 を 見ていく.
    LL ans = 0;
    repx(k, K, N + 2){
        LL minS = (LL)(k - 1) * (LL)k / 2 % MOD;
        LL maxS = (LL)(2 * N - k + 1) * (LL)k / 2 % MOD;
        LL dx = (MOD + maxS - minS + 1) % MOD;
        ans += dx;
        ans %= MOD;
        // printf("minS=%lld maxS=%lld\n", minS, maxS);
    }
    
    // 3. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 3824
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = IL()

cnt = [0]*N
ans = 1
for i in range(N):
    if a[i] == 0:
        ans = ans * (3 - cnt[a[i]]) %mod
    else:
        ans = ans * (cnt[a[i] - 1] - cnt[a[i]]) %mod
    cnt[a[i]] += 1
print(ans)

Measured memory_bytes: 53300
from math import sqrt
N=int(input())
for i in range(N):
    A,B=map(int,input().split())
    if A==B:
        print(2*(A-1))
    else:
        if A>B:
            A,B=B,A
        s=int(sqrt(A*B-1))+5
        for j in range(s,s-10,-1):
            if j**2<A*B:
                s=j
                break
        a=s*2-1
        if s*(s+1)>=A*B:
            a-=1
        print(a)


Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

int main(){
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll K,X;
    cin >> K >> X;

    cout << (K*500 >= X?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
vector<int>distan(90001, 0);
int main(void)
{
	int H, W, D, Q;
	cin >> H >> W >> D;//W=yoko H=tate
	vector<pair<int, int>> arr(H*W + 1, { 0,0 });
	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			int a; cin >> a;
			arr[a] = { i,j };
		}
	}
	for (int i = D+1; i <= H * W ; i++)
	{
		distan[i] = distan[i - D] + abs(arr[i].first - arr[i - D].first) + abs(arr[i].second - arr[i - D].second);
	}
	cin >> Q;
	for (int i = 0; i < Q; i++)
	{
		int aa, bb; cin >> aa >> bb;
		cout << distan[bb] - distan[aa] << "\n";
	}
}

Measured memory_bytes: 2176
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

signed main(void)
{
  int a, b;
  cin >> a >> b;
  cout << ceil((double)(a+b)/2) << endl;

  return 0;
}


Measured memory_bytes: 384
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int n; cin>>n; 
    list <int> v;
    for (int i=0;i<n;i++) {
      int a; cin>>a;
      v.pb(a);
    }
    v.unique();
    vector <int> a(v.begin(),v.end());
    int money=1000;
    n=sz(a);
    for (int i=1;i<n;i++){
        if (a[i]>a[i-1]){
            int c=money/a[i-1];
            money -= a[i-1]*c;
            money += a[i]*c;
        }
    }
    cout << money << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3548
N = int(input())
A = list(map(int, input().split()))

# print(N, A)
B = [0]*N

for i in range(N//2 + 1, N + 1):
#     print(i, A[i - 1])
    B[i - 1] = A[i - 1]

for i in range(N // 2):
    index = N // 2 - i - 1
    num = 0
#     print(index)
    for j in range(1, N // (index + 1) + 1):
        v = j * (index + 1) - 1
        num += B[v]
        # print(v, B[v])
#     print(index, num)
    if num % 2 != A[index]:
        B[index] = 1
# print(B)

M = 0
for b in B:
    if b == 1:
        M += 1
print(M)
ANS = []
for i in range(N):
    if B[i] == 1:
        ANS.append(str(i + 1))
if M > 0:
    ans = ' '.join(ANS)
    print(ans)


Measured memory_bytes: 71400
n, m, q = [int(i) for i in input().split()]

a = [[0] * (n + 1) for _ in range(n + 1)]

for _ in range(m):
    l, r = [int(i) for i in input().split()]
    a[l][r] += 1

for i in range(n + 1):
    for j in range(n):
        a[i][j + 1] += a[i][j]
for i in range(n + 1):
    for j in range(n):
        a[j + 1][i] += a[j][i]

for _ in range(q):
    p, q = [int(i) for i in input().split()]
    print(-a[p - 1][q] + a[-1][q])


Measured memory_bytes: 14832
import math
def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def func(n, m, a):
    # print("n:{} m:{} a:{}".format(n, m, a))
    for i in range(n):
        if i > 0:
            a[i] += a[i-1]
        a[i] %= m
    a.sort()
    a.append(-1)
    # print(a)
    count = 0
    same = 1
    for i in range(len(a)):
        if a[i] == 0:
            count += 1
        if a[i] == a[i-1]:
            same += 1
        else:
            if same >= 2:
                count += cmb(same, 2)
            same = 1
    return count

n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
print(func(n, m, a))
"""
print(func(3, 2, [4, 1, 5]))
print(func(13, 17, [29, 7, 5, 7, 9, 51, 7, 13, 8, 55, 42, 9, 81]))
print(func(10, 400000000, [1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000, 1000000000]))
"""
# print("func({}, {}, {})".format(n, m, a))


Measured memory_bytes: 14700
/*|In The Name Of Allah|*/
//This Month Will Be Expert ISA
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

const int mod = 1e9+7;

int n;

int main(){
    cin >> n;
    int flag = 1;
    for(int i = 1; i <= n; i++){
        int x;
        cin >> x;
        if(x % 2 == 0){
            if(!(x % 5 == 0 || x % 3 == 0))
                flag = 0;
        }
    }
    if(flag){
        cout << "APPROVED" << endl;
    } else {
        cout << "DENIED" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

ll judge(ll x){
  switch(x){
    case -1: return 1;
    case 0: return 1;
    case 1: return 1;
    case 2: return 2;
    case 3: return 3;
    case 4: return 5;
    case 5: return 8;
    case 6: return 13;
    case 7: return 21;
  }
}

int main(){
  ll i, j;
  ll h, w, k;
  cin >> h >> w >> k;
  ll dp[h + 1][w + 2];
  for(j = 0; j <= w + 1; j++)
    dp[0][j] = 0;
  
  dp[0][1] = 1;
  for(i = 1; i <= h; i++){
    for(j = 1; j <= w; j++){
      dp[i][j] = dp[i - 1][j - 1] * (judge(j - 2) * judge(w - j)) +
        dp[i - 1][j + 1] * (judge(j - 1) * judge(w - j - 1))
        + dp[i - 1][j] * (judge(j - 1) * judge(w - j));
      dp[i][j] %= MOD;
      //cout << i spa j spa dp[i][j] << endl;
    }
    dp[i][0] = 0;
    dp[i][w + 1] = 0;
  }
  cout << dp[h][k] << endl;
  
  return 0;
}

Measured memory_bytes: 256
faces = input().split()

move = input()

for i in range(len(move)):
    m = move[i]
    
    if m == "N":
        # N
        # 1 -> 5
        # 2 -> 1
        # 6 -> 2
        # 5 _> 6
        tmp = faces[4]
        faces[4] = faces[0]
        faces[0] = faces[1]
        faces[1] = faces[5]
        faces[5] = tmp
        
        
    elif m == "S":
        # S
        # 1 -> 2
        # 5 _> 1
        # 6 -> 5
        # 2 -> 6
        tmp = faces[1]
        faces[1] = faces[0]
        faces[0] = faces[4]
        faces[4] = faces[5]
        faces[5] = tmp
        
    elif m == "E":
        # E
        # 1 -> 3
        # 4 -> 1
        # 6 -> 4
        # 3 -> 6
        tmp = faces[2]
        faces[2] = faces[0]
        faces[0] = faces[3]
        faces[3] = faces[5]
        faces[5] = tmp
        
    elif m == "W":
        # W
        # 1 -> 4
        # 3 -> 1
        # 6 -> 3
        # 4 -> 6
        tmp = faces[3]
        faces[3] = faces[0]
        faces[0] = faces[2]
        faces[2] = faces[5]
        faces[5] = tmp

print(faces[0])


Measured memory_bytes: 5568
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    ll N,K,i,j;
    cin >> N >> K;
    ll A[N];
    for(i=0;i<N;i++){
        cin >> A[i];
    }
    ll part=0;
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
            if(A[i]>A[j])part++;
        }
    }
    ll ans=part*K%1000000007;
    sort(A,A+N);
    ll same=1;
    ll num=(K*(K-1)/2)%1000000007;
    for(i=N-1;i>0;i--){;
        if(A[i]==A[i-1])same++;else {
            ans=(ans+same*i*num)%1000000007; 
            same=1;
        }       
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,b;
    cin >> n;
    list<int> a;
    string s;
    while(n--){
        cin >> s;
        if(s=="insert"){
            cin >> b;
            a.push_front(b);
        }
        else if(s=="delete"){
            cin >> b;
            list<int>::iterator it=a.begin();
            while(it!=a.end()){
                if(*it==b){
                    a.erase(it); 
                    break;
                }
                it++;
            }
        }
        else if(s=="deleteFirst"){
            a.pop_front();
        }
        else if(s=="deleteLast"){
            a.pop_back();
        }
       // cout << "n= " << n << endl;
    }
        list<int>::iterator it=a.begin();
        for(int i=0; it!=a.end(); it++,i++){
            if(i) cout << " ";
            cout << *it;
        }
        cout << endl;
    return 0;
}


Measured memory_bytes: 34364
#include<bits/stdc++.h>
using namespace std;
int n;
int a[101][101];
int d[101];

void bfs(int s){
	queue<int>q;
	q.push(s);
	memset(d,-1,sizeof(d));
	d[s]=0;
	int u;
	while(!q.empty()){
		u=q.front();
		q.pop();
		for(int v=0;v<n;v++){
			if(a[u][v]==0)continue;
			if(d[v]!=-1)continue;
			d[v]=d[u]+1;
			q.push(v);
		}
	} 
	for(int i=0;i<n;i++){
		cout<<i+1<<" "<<d[i]<<endl;
	}
}

int main(){
	cin>>n;
	memset(a,0,sizeof(a));
	int u,k,v;
	for(int i=0;i<n;i++){
		cin>>u>>k;
		u--;
		for(int j=0;j<k;j++){
			cin>>v;
			v--;
			a[u][v]=1;
		}
	}
	bfs(0);
}


Measured memory_bytes: 3104
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.OptionalInt;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScan in = new MyScan(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, MyScan in, PrintWriter out) {
            int n = in.nextInt();
            int[] data = in.na(n);


            int[] size = new int[n + 1];

            for (int x : data) {
                size[x] = size[x - 1] + 1;
            }
            out.println(n - Arrays.stream(size).max().getAsInt());

        }

    }

    static class MyScan {
        private final InputStream in;
        private byte[] inbuf = new byte[1024];
        public int lenbuf = 0;
        public int ptrbuf = 0;

        public MyScan(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (lenbuf == -1) throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = in.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0) return -1;
            }
            return inbuf[ptrbuf++];
        }

        public int[] na(int n) {
            int[] k = new int[n];
            for (int i = 0; i < n; i++) {
                k[i] = nextInt();
            }
            return k;
        }

        public int nextInt() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = num * 10 + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

    }
}



Measured memory_bytes: 27596
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <regex>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const long long INF =  999999999;

int main(){
  int n,k,p[200020];
  ll s[200020];
  cin>>n>>k;
  REP(i,n){
    cin>>p[i];
  }
  s[0]=0;
  REP(i,k)s[0]+=p[i];
  ll ansl=s[0]+k;
  for(int i=k;i<n;i++){
    s[i-k+1]=s[i-k]+p[i]-p[i-k];
    ansl=max(ansl,s[i-k+1]+k);
  }
  double ans=ansl;
  ans/=2;
  printf("%.8f\n",ans);
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int n;
int a[10];
int c[2];

int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		++c[a[i]&1];
	}

	ll ret = 1;
	rep(i, n) ret *= 3;

	ll dec = 1;
	rep(i, c[0]) dec *= 2;
	cout << ret - dec << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0,1,0,-1 };
const ll dy[4] = { -1, 0, 1,0 };
const ll INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////

ll d[301][301];
ll ans[301][301];
int main() {
	ll N, M, L; cin >> N >> M >> L;
	REP(i, 301) {
		REP(j, 301) {
			if (j == i)d[i][j] = 0;
			else d[i][j] = 1e18;
		}
	}
	REP(i, M) {
		ll a, b, c; cin >> a >> b >> c;
		if (c > L)continue;
		a--, b--;
		d[a][b] = c;
		d[b][a] = c;
	}
	REP(k, N) {
		REP(i, N) {
			REP(j, N) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
	REP(i, N) {
		REP(j, N) {
			if (d[i][j] <= L)ans[i][j] = 1;
			else ans[i][j] = 1e18;
		}
	}
	REP(k, N) {
		REP(i, N) {
			REP(j, N) {
				ans[i][j] = min(ans[i][j], ans[i][k] + ans[k][j]);
			}
		}
	}
	int Q; cin >> Q;
	REP(i, Q) {
		int s, t; cin >> s >> t;
		s--, t--;
		if (ans[s][t] > 1e17) {
			cout << -1 << endl;
		}
		else {
			cout << ans[s][t]-1 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll MOD=1000000007;
int main() {
   ll n,k;
  cin>>n>>k;
  vector<int> h(n);
  rep(i,n) cin>>h[i];
  vector<ll> dp(n+k);
rep(i,n) dp[i]=INF;
    dp[0] = 0;
  rep(i,n) {
       rep2(j,1,k+1) {
            chmin(dp[i+j],dp[i]+abs(h[i]-h[i+j]));
        }
    }
    cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1536
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    // https://atcoder.jp/contests/abc172/tasks/abc172_a
    public class A_Calc_172
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            long a = long.Parse(Console.ReadLine());

            long result = a + (long)Math.Pow(a, 2) + (long)Math.Pow(a, 3);

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 27852
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int x;

int main() {
    cin >> x;
    int mans = 0;
    for(int i = 1; i < sqrt(x)+1; ++i) {
        if(i == 1) {
            chmax(mans, 1);
        }else {
            for(int j = 0; ; ++j) {
                int check = pow(i, j);
                if(check <= x) {
                    chmax(mans, check);
                }else break;
            }
        }
    }
    cout << mans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long int
using namespace std;

int32_t main(){

	int n;
	cin >> n;

	map <int, int> mp;

	int sum = 0;

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


	int q;
	cin >> q;

	for(int i = 0; i < q; ++i){
		int b, c;
		cin >> b >> c;
		sum += c*mp[b] - b*mp[b];
		mp[c] += mp[b];
		mp[b] = 0;
		cout << sum << "\n";
	}


}

Measured memory_bytes: 9360
#include <iostream>
#include <algorithm>
using namespace std;

int main(void){
    // Your code here!
   int a, b;
   cin >> a >> b;
   if(a == b){
       cout << "Draw" << endl;
       return 0;
   }
   if(a == 1){
       a+= 13;
   } else if (b == 1){
       b+= 13;
   }
   cout << (a > b ? "Alice" : "Bob") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200005
char s[N];int n,k,l,r,rev;
int main(){scanf("%d%d%s",&n,&k,s);for(int i=0;i<n;i++) s[i]-=65;if(k>n*2+1) k=k%2?(n*2+1):(n*2+2);r=n-1;
for(int i=1;i<=k;i++)if(!(s[l]^rev)) s[l]^=1;else l=(l+1)%n,r=(r+1)%n,rev^=1;
for(;;l=(l+1)%n){printf("%c",65+(s[l]^rev));if(l==r) break;}}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}




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

  ll n, a, b;
  cin >> n >> a >> b;
  if(a > b || (n < 2 && abs(a-b))) {
    cout << 0 << endl;
    return 0;
  }
  if(n == 1) {
    cout << 1 << endl;
    return 0;
  }
  ll mn = a+b + (n-2)*a;
  ll mx = a+b + (n-2)*b;
  ll ans = mx - mn + 1;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n) ; ++i)
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define emb emplace_back

using namespace std;
using ll = long long;
using P = pair<int,int>;

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

int main() {
  int n;
  cin >> n;
  vector<int> p(n,0);
  rep(i,n) {
    cin >> p.at(i);
  }
  int ans = 1;int mn=p.at(0);
  rep(i,n-1) {
    if(mn >= p.at(i+1)) ans++;
    mn = min(mn,p.at(i+1));
  }
  cout << ans << endl;



  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>

int main(void){
    int A, B, C, D, E, a, b, c, ans;
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &C);
    scanf("%d", &D);
    scanf("%d", &E);
    if(A < 0){
       a = -1 * A * C;
       b = D;
       c = E * B;
       ans = a + b + c;
    }
    if(A > 0){
        c = B - A;
        ans = c * E;
    }
    printf("%d\n", ans);
    return 0;
    
}


Measured memory_bytes: 2080
#include <bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0; i<n ; ++i)
#define lpx(i,x,n) for(int i=x; i<n ; ++i)
#define all(v) v.begin() , v.end()
#define sz(v) (int(v.size()))
typedef unsigned long long ul;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<char, int> pci;
typedef vector<pii> vp;
typedef vector<pci> vpc;
typedef pair<int,pii> piii;

int OO = 2e9;
const double eps = 1e-9 ;
const int N = 500000;
int mx = -1e9 , mn = 1e9 ;
ll arr[N],arr2[N] ;

int dcmp(double x, double y)
{
    return fabs(x - y) <= eps ? 0 : x > y ? -1 : 1;
}



int main()
{

    int n,y=0; cin>> n;
    lp(i,n){
        int x;cin >> x;
        if(x>y)y = x;
        if(x-y<-1){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n" << endl;

    return 0;
}
























Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define loop(i, n) for(int i = 0 ; i < n ; i++)

using namespace std;

int main() {
	int n, x;
	cin >> n >> x;
	vector<int> v(n);
	loop(i, n) cin >> v[i];
	int cur = 0;
	int ans = 1;
	loop(i, n){
		if(cur + v[i] <= x) cur += v[i], ans++;
		else break;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define F first
#define S second
using namespace std;
int n;
ll a[200010];
ll ans=1e18;
void div(int l,int r,ll &x,ll &y)
{
	int mid;
	ll res=1e18;
	int li=l,ri=r;
	while (li<ri)
	{
		mid=(li+ri)/2;
		//cout <<l<<" "<<r<<" "<<mid<<" "<<x<<" "<<y<<" "<<res<<" "<<(a[mid]-a[l-1])<<" "<<(a[r]-a[mid])<<" #\n";
		if (res>abs((a[mid]-a[l-1])-(a[r]-a[mid])))
		{
			res=abs((a[mid]-a[l-1])-(a[r]-a[mid]));
			x=a[mid]-a[l-1];
			y=a[r]-a[mid];
		}
		if (a[mid]-a[l-1]<a[r]-a[mid]) li=mid+1;
		else ri=mid; 
	}
}
int main()
{
	cin >>n;
	for (int i=0;i<n;i++)
	{
		int x;
		cin >>x;
		a[i+1]=x+a[i];
		//cout <<a[i+1]<<" ##\n";
	}
	for (int i=2;i<n-1;i++)
	{
		//cout <<i<<" #################\n";
		ll w=0,x=0,y=0,z=0;
		div(1,i,w,x);
		//cout <<w<<" "<<x<<" #####\n";
		div(i+1,n,y,z);
		//cout <<y<<" "<<z<<" #####\n";
		ll mx=max(max(w,x),max(y,z));
		ll mn=min(min(w,x),min(y,z));
		ans=min(ans,mx-mn);
	}
	cout <<ans;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;

const int MAX_NUM = 2000;
// const int MAX_NUM = 6;

int horiz[MAX_NUM][MAX_NUM];
int vert[MAX_NUM][MAX_NUM];
char box[MAX_NUM][MAX_NUM];

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

    int H, W;
    cin >> H >> W;
    for (int h = 0; h < H; ++h) {
        for (int w = 0; w < W; ++w) {
            cin >> box[h][w];
        }
    }

    for (int h = 0; h < H; ++h) {
        int count = 0;
        for (int w = 0; w <= W; ++w) {
            if (w < W && box[h][w] == '.') {
                count++;
            } else {
                for (int i = w - count; i < w; ++i) {
                    horiz[h][i] = count;
                }
                count = 0;
            }
        }
    }

    for (int w = 0; w < W; ++w) {
        int count = 0;
        for (int h = 0; h <= H; ++h) {
            if (h < H && box[h][w] == '.') {
                count++;
            } else {
                for (int i = h - count; i < h; ++i) {
                    vert[i][w] = count;
                }
                count = 0;
            }
        }
    }

    int max_val = 0;
    for (int h = 0; h < H; ++h) {
        for (int w = 0; w <= W; ++w) {
            max_val = max(max_val, horiz[h][w] + vert[h][w] - 1);
        }
    }

    cout << max_val << '\n';

    return 0;
}


Measured memory_bytes: 35456
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		long ans = 0;
		long end = 0;
		for (int i = 0; i < n; i++) {
			long next = a[i] + t;
			ans += Math.min(next - end, t);
			end = next;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 64984
#include <iostream>
#include <iomanip>
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    
    cout << a/b << " ";
    cout << a%b << " ";
    cout << setprecision(6) << fixed << (double)a/b << endl;
    
    return 0;
}


Measured memory_bytes: 3268
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
	int N,M,K;
	cin >> N >> M >> K;
	bool ret = false;
	for(int i = 0;i <= N;i++) {
		for(int j = 0;j <= M;j++) {
			if(M * i + N * j - 2 * i * j == K) {
				ret = true;
			}
		}
	}
	if(ret == true) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl; 
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main(){
    string s, sample = "AKIHABARA";
    cin >> s;
    while (1) {
        if (s.size() > sample.size()) {
            puts("NO");
            return 0;
        }
        if (s.size() == sample.size()) break;
        for (int i = 0; i < sample.size(); ++i) {
            if (s[i] != sample[i] || i > s.size() - 1) {
                if (sample[i] == 'A') {
                    s = s.substr(0,i) + 'A' + s.substr(i, s.size() - i);
                    break;
                } else {
                    puts("NO");
                    return 0;
                }
            }
        }
    }

    if (s == sample) puts("YES");
    else puts("NO");

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace tes
{
    class Program
    {
        static void Main(string[] args)
        {
            int a=0,b=0,i=0,t=0,y=0;
            int[] x = new int[100000];
            
            while (a < 20)
            {
                var line = Console.ReadLine().Split();
                x[i] = int.Parse(line[0]);
                x[i + 1] = int.Parse(line[1]);
                if((x[i]==0)&&(x[i+1]==0))
                {
                    break;
                }
                i+=2;
            }

            while (a < 20)
            {
                t = x[b];
                y = x[b+1];
                for (int p = 0; p < t; p++)
                {
                    for (int q = 0; q < y; q++)
                    {
                        Console.Write("#");
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();

                b += 2;
                if ((x[b] == 0) && (x[b + 1] == 0))
                {
                    break;
                }

            }
            

        }
    }
}

Measured memory_bytes: 9284
#include <stdio.h>

int main(void)
{
	int i;
	int a[101];
	int c = 1;
	int max = 0;
	int n;
	
	for (i = 0; i <= 100; i++) {
		a[i] = 0;
	}
	
	while (scanf("%d", &n) != EOF) {
		a[n - 1]++;
		c++;
	}
	
	for (i = 0; i < c; i++) {
		if (max < a[i]) {
			max = a[i];
		}
	}
	
	for (i = 0; i < c; i++) {
		if (a[i] == max) {
			printf("%d\n", i + 1);
		}
	}
	
	return 0;
}

Measured memory_bytes: 596
#include <stdio.h>

int main(void)
{
	int r,c,i,j;
	int sheet[101][101] = {0};
	
	scanf("%d %d",&r,&c);
	for (i=0; i<r; i++) {
		for (j=0; j<c; j++) {
			scanf("%d",&sheet[i][j]);
		}
	}
	for (i=0; i<r; i++) {
		for (j=0; j<c; j++) {
			sheet[i][c] += sheet[i][j] ;
		}
	}
	for (j=0; j<c+1; j++) {
		for (i=0; i<r; i++) {
			sheet[r][j] += sheet[i][j] ;
		}
	}
	for (i=0; i<r+1; i++) {
		for (j=0; j<c; j++) {
			printf("%d ",sheet[i][j]);
		}
		printf("%d\n",sheet[i][c]);
	}
	return 0;
}

Measured memory_bytes: 648