akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int X;
    cin >> X;
    if (X == 7 || X == 5 || X == 3) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 1000005;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int x, y; cin >> x >> y;
		//3の倍数ではない場所には移動できない
		if ((x + y) % 3 != 0) {
			cout << 0 << endl;
			return;
		}
		//何回移動すれば良いか
		int n = (x + y) / 3;
		x -= n; y -= n;
		//移動回数が0以下となる場合は移動不可能
		if (x < 0 || y < 0) {
			cout << 0 << endl;
			return;
		}
		COMinit();
		//xとyの総数からxの選び方だけ決まれば良い
		cout << COM(x + y, x) % MOD << endl;
    return;
}

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



Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
int main(){
    int64_t a,b,c,k;
    cin>>a>>b>>c>>k;
    int64_t ans=0;
    if(a>=k){
        ans = k;
    }
    else if(a+b>=k){
        ans = a;
    }
    else{//a+b+c>=k
        ans = a;
        k -= a+b;
        ans -= k;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <stdio.h>

int F[44];

int fibonacci(int n)
{
  if(n==0 || n==1)
    return F[n] = 1;
  if(F[n]>0)
    return F[n];
  return F[n] = fibonacci(n-2) + fibonacci(n-1);
}

int main()
{
  int n, i, a;
  scanf("%d",&n);
  for( i=0 ; i<n ; i++ )
    F[i] = -1;
  printf("%d\n",fibonacci(n));

  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vi a,b,c;

int main(){
	cin>>n;
	a=b=vi(n);
	c=vi(n-1);
	for(auto &i:a) cin>>i;
	for(auto &i:b) cin>>i;
	for(auto &i:c) cin>>i;
	int t=0;
	for(int i=0;i<n;i++){
		t+=b[a[i]-1];
		if(i&&a[i]==a[i-1]+1) t+=c[a[i]-2];
	}
	cout<<t<<endl;
}

Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif
using namespace std;

V<string> vs = { "SUN","MON","TUE","WED","THU","FRI","SAT" };

int main() {
    string S;
    cin >> S;
    ll idx = distance(vs.begin(), find(ALL(vs), S));
    ll ans = 0;
    if(S == vs[0]) {
        idx++;
        ans++;
    }
    while(true) {
        idx++;
        ans++;
        idx %= vs.size();
        if(idx == 0) break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PI acos(-1.0)
#define sq(n) (n)*(n)

using namespace std;
typedef long long ll;

int main() {
    FAST;

    int n, a;
    cin >> n;

    vector<int> v(n);

    while (--n) {
        cin >> a;
        ++v[a-1];
    }

    for (int x : v) cout << x << "\n";

    return 0;
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

int main() {
    int N, ans = 1;
    cin >> N;
    while (ans <= N) ans *= 2;
    cout << ans / 2 << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

bool G[8][8];

int dfs(int v, int N, bool visited[8]){
    bool all = true;
    rep(i, N) if(visited[i] == false) all = false;
    if (all) return 1;

    int ret = 0;
    rep(i, N) {
        if(G[v][i] == false) continue;
        if(visited[i] == true) continue;

        visited[i] = true;
        ret += dfs(i, N, visited);
        visited[i] = false;
    }

    return ret;
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    int a[M], b[M];
    rep(i, M) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        G[a[i]][b[i]] = true;
        G[b[i]][a[i]] = true;
    }

    bool visited[8];
    rep(i, 8) visited[i] = false;

    visited[0] = true;
    cout << dfs(0, N, visited) << endl;

    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

int main(){
    int a,b,x,diff1,diff2;
    
    scanf("%d %d %d",&x,&a,&b);
    
    diff1=abs(x-a);
    diff2=abs(x-b);
    
    if(diff1<=diff2){
        printf("A\n");
    }
    else{
        printf("B\n");
    }
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int MOD=1000000007;
int d,a,b,i2,pos;
long long dp[102],res,tmp[102];
char k[10002];
int main()
{
    scanf("%s",&k);
    for(; k[pos]!=0; ++pos) a+=k[pos]-'0';
    scanf("%d",&d);
    dp[0]=1;
    a%=d;
    if(a==0) ++res;
    while(--pos>=0)
    {
        if(k[pos]!='0')
        {
            b=k[pos]-'0';
            a-=b;
            while(a<0) a+=d;
            if(a) i2=d-a; else i2=0;
            for(int i=0; i<b; ++i)
            {
                res+=dp[i2--];
                if(i2<0) i2+=d;
            }
            res%=MOD;
        }
        tmp[0]=0;
        i2=d-1;
        for(int i=0; i<9; ++i)
        {
            tmp[0]+=dp[i2--];
            if(i2<0) i2+=d;
        }
        for(int i=1; i<d; ++i) tmp[i]=tmp[i-1]+dp[i-1]-dp[++i2%d];
        for(int i=0; i<d; ++i) dp[i]=(dp[i]+tmp[i])%MOD;
    }
    if(--res<0) res+=MOD;
    printf("%lld",res);
    return 0;
}

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

int main() {
    int n;cin>>n;
    int cnt=0;

    vector<int>a(n);
    rep(i,n){
        cin>>a[i];
    }

    rep(i,n){
        if(a[a[i]-1]==i+1){
            cnt++;
        }
    }
    cout<<cnt/2<<endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define vi vector<int>
typedef long long llong;
using namespace std;

int main(){
	int n,wl;
	cin>>n>>wl;
	
	vi w(n),v(n);
	REP(i,n) cin>>w[i]>>v[i];
	
	vector<llong> dp(wl+1,0);//dp[i]は重さでの持てる最大価値量.
	REP(i,n){
		for(int j=wl;j>=w[i];--j){
			dp[j]=max(dp[j],dp[j-w[i]]+v[i]);//逆から.
		}
	}
	
	cout<<dp[wl]<<endl;
}//復習.

Measured memory_bytes: 1024
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	vector<int> A(N);
	rep(i, 0, N)cin >> A[i];
	sort(all(A));

	pii p = mp(INF, -1);
	rep(i, 0, N - 1)
	{
		if (chmin(p.first, abs(A[i]*2 - A[N - 1])))
		{
			p.second = i;
		}
	}

	cout << A[N - 1] << " " << A[p.second] << endl;

	return 0;
}

Measured memory_bytes: 4000
n = int(input())
h = list(map(int, input().split()))
t = 0
result = 0
for i in range(n - 1):
  if h[i + 1] <= h[i]:
    t += 1
  else:
    result = max(t, result)
    t = 0
result = max(t, result)
print(result)

Measured memory_bytes: 14252
a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())
d = {1:0, 2:0, 3:0, 4:0}
d[a1] += 1
d[a2] += 1
d[a3] += 1
d[b1] += 1
d[b2] += 1
d[b3] += 1
if 3 in d.values():
  print("NO")
else:
  print("YES")

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
  int x,s=400,t=599,m=8,r=0;
  cin>>x;
  for(int i=0;i<9;i++)
  {
    if(x>=s && x<=t)
    {
      r=m;
      break;
    }
    else
    {
      s=t+1;t=t+200;
      m--;
    }
  }
  cout<<r;
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(c)  c.begin(), c.end()
#define llv vector< ll >
#define mp make_pair
#define endl "\n"
const int N = (int)1e5+10 ;
const int M = (int)1000000007; 


int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    ll n , i , j ;
    cin >> n ;
    double p[n+1] ;
    for(i=1 ; i<=n ; i++){
        cin >> p[i] ;
    }
    double dp[n+1][n+1] = { } ;

    dp[0][0] = 1.0 ;
    for(i=1 ; i<=n ; i++){
        dp[i][0] = dp[i-1][0]*(1.0 - p[i]) ;
        for(j=1 ; j<=i ; j++){
             dp[i][j] = p[i]*dp[i-1][j-1] + (1.0 - p[i])*dp[i-1][j] ;
        }
    }

    double ans = 0.0 ;
    for(i=(n+1)/2 ; i<=n ; i++){
        ans+=dp[n][i]  ;
    }
    cout << setprecision(10) << fixed << ans ;
    return 0 ;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main() {
    int n, m; cin >> n >> m;
    ll ans = 1;
    int a = n; int b = m;
    while (n > 0) {
        ans *= (ll)n;
        ans %= MOD;
        n--;
    }
    while (m > 0) {
        ans *= (ll)m;
        ans %= MOD;
        m--;
    }

    if (a == b) ans = (ans * 2) % MOD;
    if (abs(a - b) > 1) ans = 0;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<utility>
#include<stack>
#include<algorithm>
#include<string>
#include<string.h>
#include<assert.h>
#include<iomanip>
#include<unordered_map>
#define F first
#define S second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;

const int N = 55;

int n, m, q;
int ar[N];
int a[N], b[N], c[N], d[N];

int calc(){
  int res = 0;
  for(int i = 0; i < q; ++i){
    if(ar[b[i]] - ar[a[i]] == c[i])res += d[i];
  }
  return res;
}

int bf(int idx, int last){
  if(idx == n){
    return calc();
  }

  int res = 0;
  for(int i = last; i <= m; ++i){
    ar[idx] = i;
    res = max(res, bf(idx + 1, i));
  }

  return res;
}

int main(){
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cin >> n >> m >> q;
  for(int i = 0; i < q; ++i){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--, b[i]--;
  }

  cout << bf(0, 1) << endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int c[226];
int main(){
    ios::sync_with_stdio(false);
    string s;cin >> s;
    for(auto cc:s) c[cc]++;
    ll n=s.size();ll ans=n*(n+1)/2+1;
    for(int i='a'; i<='z' ;i++) ans-=1LL*c[i]*(c[i]+1)/2;
    cout << ans << endl;
}

Measured memory_bytes: 768
#include<cstdio>
#include<cstring>
using namespace std;
const int Mod=1e9+7;
int n,m,ans,fac[2100000],inv[2100000];
char s[2100000];
void init(int n){
    fac[0]=1; for (int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%Mod;
    inv[1]=1; for (int i=2;i<=n;i++) inv[i]=1ll*(Mod-Mod/i)*inv[Mod%i]%Mod;
    inv[0]=1; for (int i=1;i<=n;i++) inv[i]=1ll*inv[i-1]*inv[i]%Mod;
}
int qpow(int x,int a){
    int res=1;
    while (a){
        if (a&1) res=1ll*res*x%Mod;
        x=1ll*x*x%Mod; a>>=1;
    }
    return res;
}
int C(int n,int m){
    return 1ll*fac[n]*inv[m]%Mod*inv[n-m]%Mod;
}
int main() {
	scanf("%d",&n);
	scanf("%s",s); m=strlen(s);
	n+=m; init(n);
    for (int i=m;i<=n;i++)
		ans=(ans+1ll*qpow(25,i-m)*qpow(26,n-i)%Mod*C(i-1,m-1))%Mod;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 18248
//#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); }

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

signed main(void)
{
  int h, w, d;
  cin >> h >> w >> d;
  REP(i, h) {
    REP(j, w) {
      int x = i+j+5000, y = i-j+5000;
      // cout << x << " " << y << " ";
      x /= d, y /= d;
      // cout << x << " " << y << endl;
      if(x%2 && y%2) {
        cout << "R";
      } else if(x%2) {
        cout << "G";
      } else if(y%2) {
        cout << "B";
      } else {
        cout << "Y";
      }
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
  #include<string.h>
  #include<stdlib.h>
  int top,N[1000];
  void push(int p){
    N[++top]=p;
  }
  int pop(){
    top--;
    return N[top+1];
  }
  int main(){
    int x,y;
    top=0;
    char n[100];

    while(1){
      if(scanf("%s",n)==EOF) break;
      if(n[0]=='+'){
        x=pop();
        y=pop();
        push(x+y);
      }else if(n[0]=='-'){
        x=pop();
        y=pop();
        push(y-x);
      }else if(n[0]=='*'){
        x=pop();
        y=pop();
        push(x*y);
      }else {
        push(atoi(n));
      }
    }
    printf("%d\n",pop());
    return 0;
  }



Measured memory_bytes: 2108
// Author : Mohamed Sameh
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
typedef long long ll ;
using namespace std ;
int main ()
{   
    int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; 
    int k;
    cin >> k;
    cout << a[--k];

}



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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    while (1) {
      c -= b;
      if (c <= 0) {
        cout << "Yes" << endl;
        return 0;
      }
      a -= d;
      if (a <= 0) {
        cout << "No" << endl;
        return 0;
      }
    }
}

Measured memory_bytes: 3604
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    int sum = 0;
    rep(i,10) {
        int n;
        cin >> n;
        sum += n;
    }
    P(sum);
    return 0;
}

Measured memory_bytes: 3092
#include<cstdio>
#include<cmath>
int main(){
	int q;float x;
	for(;scanf("%d",&q),~q;printf("%f\n",x))
		for(x=q/2.;fabs(x*x*x-q)>1e-5*q;x-=(x*x*x-q)/(3*x*x));
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <array>
using namespace std;
constexpr int MOD = 2019;
template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
int main() {
    string S;
    cin >> S;
    array<int, MOD> modcnt = {1};
    int ans = 0;
    for (int i = S.size() - 1, t = 0; i >= 0; i--) {
        t = (t + mod_pow(10, (int)S.size() - i - 1, MOD) * (S[i] - '0')) % MOD;
        modcnt[t]++;
    }
    for (int i = 0; i < MOD; i++) {
        ans += modcnt[i] * (modcnt[i] - 1) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3736
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0514

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    while True:
        a, b, c = map(int, input().split())
        if a == 0 and b == 0 and c == 0:
            break
        N = int(input())

        ok_items = set()
        ng_items = set()
        pendings = []
        for _ in range(N):
            x, y, z, r = map(int, input().split())
            if r == 1:
                ok_items.add(x)
                ok_items.add(y)
                ok_items.add(z)
            else:
                pendings.append([x, y, z])

        for x, y, z in pendings:
            p = set([x, y, z])
            und = p - ok_items
            if len(und) == 1:
                for i in und:
                    ng_items.add(i)

        for i in range(1, (a+b+c+1)):
            if i in ok_items:
                print(1)
            elif i in ng_items:
                print(0)
            else:
                print(2)


if __name__ == '__main__':
    main(sys.argv[1:])
    

Measured memory_bytes: 8016
#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[]){
    string s;
    cin >> s;
    int cnt = 0;
    for (int i=0;i<4;i++){
        for(int j=i+1;j<4;j++){
            if(s[i]==s[j]){
                cnt++;
            }
        }
    }
    if(cnt==2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("hard1.txt","r",stdin)
#define OUT freopen("hard1.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 1000005

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;

#define INF 1000000000000000000LL
#define alpha 26
#define mod 998244353LL
#define maxn 500005
#define LOG 18

bool comp( pair<i64,i64> a, pair<i64,i64> b )
{
    return ( a.xx-a.yy > b.xx-b.yy ) ;
}

i64 X[maxn] , Y[maxn] ;

i64 f( int x , int y , vector < pair<i64,i64> > vp )
{
    sort( vp.begin() , vp.end() , comp ) ;
    multiset<i64> ms ;

    i64 ret = 0 ;

    int n = (int)vp.size() ;

    for(int i=0 ; i<n ; i++)
    {
        ms.insert( vp[i].xx ) ;
        ret += vp[i].xx ;
        if( ms.size() > x )
        {
            auto it = ms.begin() ;
            ret -= (*it) ;
            ms.erase(it) ;
        }
        X[i] = ret ;
    }
    ms.clear() ;
    ret = 0 ;
    for(int i=n-1 ; i>=0 ; i--)
    {
        ms.insert( vp[i].yy ) ;
        ret += vp[i].yy ;
        if( ms.size() > y )
        {
            auto it = ms.begin() ;
            ret -= (*it) ;
            ms.erase(it) ;
        }
        Y[i] = ret ;
    }
    i64 ans = -INF ;
    for(int i=0 ; i<n ; i++)
    {
        if( i+1 >= x && (n-1-i) >= y ) ans = max( ans , X[i] + Y[i+1] ) ;
    }
    return ans ;
}

int main()
{
    int x , y , z  ;

    scanf("%d %d %d",&x,&y,&z) ;

    i64 ans = 0 ;
    vector < pair<i64,i64> > vp ;

    for(int i=1 ; i<=x+y+z ; i++)
    {
        i64 a , b , c ;
        scanf("%lld %lld %lld",&a,&b,&c) ;
        ans += a ;
        b-=a ; c-=a ;
        vp.pb(mp(b,c)) ;
    }

    ans += f(y,z,vp) ;

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

    return 0 ;
}


Measured memory_bytes: 12656
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int D, G, ans = 100000000;
    cin >> D >> G;
    vector<Pint> A(D);
    for (int i = 0; i < D; i++){
        cin >> A.at(i).first >> A.at(i).second;
    }
    for (int i = 0; i < (int)pow(2, D); i++){
        int sum = 0, a = i, num = 0;
        vector<bool> T(D);
        for (int j = 0; j < D; j++){
            if (a & 1){
                sum += 100 * A.at(j).first * (j + 1) + A.at(j).second;
                num += A.at(j).first;
                T.at(j) = true;
            }
            a >>= 1;
        }
        if (G <= sum){
            ans = min(ans, num);
        }
        else {
            for (int j = 0; j < D; j++){
                if (!T.at(D - j - 1)){
                    for (int k = 0; k < A.at(D - j - 1).first - 1; k++){
                        num++;
                        sum += 100 * (D - j);
                        if (G <= sum){
                            ans = min(ans, num);
                            break;
                        }
                    }
                    break;
                }
            }
        }

    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
#define ll long long
#define M 1000000007

#define pb push_back
#define fs first
#define se second
using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //  #ifndef ONLINE_JUDGE
    //     freopen("mengawasi_sample_1.in", "r", stdin);
    //     freopen("mengawasi_sample_1.out", "w", stdout);
    // #endif
    ll n,m;
    cin>>n>>m;
    vector<ll>arr[m+1];
    for(ll i=0;i<n;i++)
    {
        ll a,b;
        cin>>a>>b;
        if(a<=m)
            arr[a].pb(b);
    }
    ll sum=0;
    priority_queue<ll>pq;
    for(ll i=1;i<=m;i++)
    {
        if(arr[i].size()>0)
        {
            for(ll j=0;j<arr[i].size();j++)
            {
                pq.push(arr[i][j]);
            }
        }
        if(!pq.empty())
        {
            sum+=pq.top();
            pq.pop();
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
int main(){
	int m,d,i,j,d1,d10,count=0;
	cin>>m>>d;
	for(i=1;i<=m;i++){
		for(j=1;j<=d;j++){
			d1=j%10;
			d10=(j/10)%10;
			if(d1>=2 && d10>=2 && d1*d10==i)count++;
		}
	}
	cout<<count;
	return 0;
}

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

int mark[maxn];
int lb[maxn][21], rb[maxn][21];
int L[maxn], R[maxn], fa[maxn], p[maxn];
int x[maxn];
int v[21];
int fl[maxn], fr[maxn];
int tp;
int n, m;

int find(int a) {
	return (fa[a] == a ? a : (fa[a] = find(fa[a])));
}

bool cmp(int a, int b) {
	return (x[a + 1] - x[a] < x[b + 1] - x[b]);
}

int main() {
	scanf("%d %d",&n,&m);
	for (int i = 1; i <= n; i++) scanf("%d",&x[i]);
	tp = 0;
	for (; m; m >>= 1) v[tp++] = m;
	v[tp++] = 0;
	for (int i = 1; i <= n; i++) L[i] = R[i] = fa[i] = i;
	for (int i = 1; i < n; i++) p[i] = i;
	int q = 1;
	sort(p + 1, p + n, cmp);	
	for (int t = tp - 1; t >= 0; t--) {
		while (q < n && x[p[q] + 1] - x[p[q]] <= v[t]) {
			int a = p[q], b = p[q] + 1;
			a = find(a); b = find(b);
			R[fa[a]] = R[fa[b]];
			fa[fa[b]] = fa[a];
			q++;
		}
		for (int i = 1; i <= n; i++) {
			lb[i][t] = L[find(i)];
			rb[i][t] = R[find(i)];
		}
	}

	for (int u = 0; u < tp; u++) {
		lb[n + 1][u] = n;
		rb[0][u] = 1;
	}

	for (int st = 0; st < (1 << tp); st++) {
		fr[st] = n + 1;
		for (int u = 0; u < tp; u++) {
			if (!(st >> u & 1)) continue;
			fl[st] = max(fl[st], rb[fl[st ^ (1 << u)] + 1][u]);
			fr[st] = min(fr[st], lb[fr[st ^ (1 << u)] - 1][u]);
		}
	}

	for (int st = 0; st < (1 << tp); st++) {
		if (st & 1) continue;
		int l = fl[st];
		int r = fr[((1 << tp) - 1) ^ 1 ^ st];
		if (l >= r - 1) { mark[1]++; continue; }
		if (rb[l + 1][0] >= r - 1) {
			mark[lb[l + 1][0]]++;
			mark[rb[l + 1][0] + 1]--;
		}
	}

	for (int i = 1; i <= n; i++) {
		mark[i] += mark[i - 1];
		if (mark[i] > 0) printf("Possible\n");
		else printf("Impossible\n");
	}
	return 0;
}

Measured memory_bytes: 61824
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.Map.Entry;

public class Main {

	public static void main(String[] args) {
		Task task = new Task();
		task.solve();
	}

	public static class Task {
		static final long MOD = (long) 1e9 + 7;

		public void solve() {
			Scan sc = new Scan();
			int n = (int) sc.scanLong();
			long[] arr = new long[n];
			long[] cum = new long[n];
			Map<Long, Integer> freq = new HashMap<Long, Integer>();
			for (int i = 0; i < n; ++i) {
				arr[i] = sc.scanLong();
				cum[i] = arr[i] + (i > 0 ? cum[i - 1] : 0);
				freq.put(cum[i], 1 + freq.getOrDefault(cum[i], 0));
			}
			long res = 0;
			for (Entry<Long, Integer> item : freq.entrySet()) {
				Long value = item.getKey();
				Integer count = item.getValue();
				if (count > 1) {
					res += ((long) count * (count - 1)) / 2;
				}
				if (value == 0) {
					res += count;
				}
			}
			System.out.println(res);
		}
	}

	public static class Scan {
		private byte[] buf = new byte[1024];
		private int index;
		private InputStream in;
		private int total;

		public Scan() {
			in = System.in;
		}

		public int scan() {
			if (total < 0)
				throw new InputMismatchException();
			if (index >= total) {
				index = 0;
				try {
					total = in.read(buf);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				if (total <= 0)
					return -1;
			}
			return buf[index++];
		}

		public long scanLong() {
			long integer = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n)) {
				if (n >= '0' && n <= '9') {
					integer *= 10;
					integer += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			return neg * integer;
		}

		public double scanDouble() throws IOException {
			double doub = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n) && n != '.') {
				if (n >= '0' && n <= '9') {
					doub *= 10;
					doub += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			if (n == '.') {
				n = scan();
				double temp = 1;
				while (!isWhiteSpace(n)) {
					if (n >= '0' && n <= '9') {
						temp /= 10;
						doub += (n - '0') * temp;
						n = scan();
					} else
						throw new InputMismatchException();
				}
			}
			return doub * neg;
		}

		public String scanString() {
			StringBuilder sb = new StringBuilder();
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			while (!isWhiteSpace(n)) {
				sb.append((char) n);
				n = scan();
			}
			return sb.toString();
		}

		public char scanChar() {
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			return (char) n;
		}

		private boolean isWhiteSpace(int n) {
			if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
				return true;
			return false;
		}
	}
}


Measured memory_bytes: 64052
#include <iostream>

using namespace std;
 
int main() {
  int n, r, result;
  cin >> n >> r;
  
  if (n >= 10) {
    result = r;
  } else {
    result = r + 100 * (10 - n);
  }
  cout << result;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#define mm(a,x) memset(a,x,sizeof(a))
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define ll long long
#define int long long
using namespace std;
const int MAXN=2e5+10;
int a[MAXN];
int cnt[MAXN];
signed main(void)
{
    sync;
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;++i)
    {
        cin>>a[i];
        ++cnt[a[i]];
    }
    for(int i=1;i<=n;++i)
        ans+=cnt[i]*(cnt[i]-1ll)/2;
    for(int i=1;i<=n;++i)
        if(cnt[a[i]])
            cout<<ans-cnt[a[i]]+1<<endl;
        else
            cout<<ans<<endl;
    return 0;
}

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


bool IsCoprime(int a, int b)
{
	while (a > 0 && b > 0)
	{
		if (a < b) swap(a, b);
		a %= b;
	}
	if (a == 1 || b == 1) return true;
	return false;
}


char get(int a, int b, char c)
{
	for (int i = 0; i < 26; i++)
	{
		if ((a * i + b) % 26 == c - 'a') return char(i + 'a');
	}
}


int main()
{
	int n;
	string cip;
	string dec;

	cin >> n;
	cin.get();

	while (n--)
	{
		getline(cin, cip);
		dec = cip;

		for (int a = 0; a < 26; a++)
		{
			if (!IsCoprime(a, 26)) continue;
			for (int b = 0; b < 26; b++)
			{
				for (int i = 0; i < cip.size(); i++)
				{
					if (cip[i] == ' ') continue;
					dec[i] = get(a, b, cip[i]);
				}
				if (dec.find("that") != -1 || dec.find("this") != -1)
				{
					cout << dec << endl;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1212
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Linq.Enumerable;
using static System.Math;

class Program
{
    static void Main()
    {
        var (N, M, X) = ReadLine().Split(' ').Select(int.Parse).ToArray();
        var A = ReadLine().Split(' ').Select(int.Parse).ToArray();

        var ans = Min(A.Count(a => a < X), A.Count(a => a > X));

        WriteLine(ans);
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 28260
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;
vec d2(201, 0);
mat dist(201, vec(201,INF));

bool dfs(ll v, ll c){
    if(d2[v] == -c) return false;
    if(d2[v] == c) return true;
    //cout<<v<<' '<<c<<endl;
    d2[v] = c;
    rep(i,N){
        if(dist[v][i] == 1){
            if(!dfs(i,-c)) return false;
        }
    }
    return true;
}

int main() {
    cin>>N;
    rep(i,N){
        cin>>S;
        rep(j,N) if(S[j] == '1') dist[i][j] = dist[j][i] = 1;
    }
    ll num = 0;
    rep(i,N){
        if(d2[i] == 0) {
            ++num;
            if (!dfs(i, num)) {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    //rep(i,N) cout<<d2[i]<<endl;
    rep(k,N){
        rep(i,N){
            rep(j,N){
                if(dist[i][j] > dist[i][k] + dist[k][j]){
                    dist[i][j] = dist[i][k] + dist[k][j];
                }
            }
        }
    }
    mat group(num,vec(0));
    rep(i,N) group[abs(d2[i]) - 1].push_back(i);
    ll ans = 0;
    for(vec &g : group){
        ll temp = 0;
        for(ll i : g){
            for(ll j : g){
                if(i != j) temp = max(temp,dist[i][j]);
            }
        }
        ans += temp + 1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <cstdint>

int main() {
	int n;
	std::cin>>n;
	std::vector<long long> a(n+1,0);
	for (int i = 1; i <= n; ++i) {
		std::cin>>a[i];
	}
	long long dp[n+1][n+1];
	memset(dp, 0 ,sizeof(dp));
	for (int i = 1; i <= n; ++i) {
		dp[i][i] = a[i];
	}

	for (int i = 2; i <= n; ++i) {
		for (int j = 1; i + j - 1 <= n; ++j) {
			dp[j][i+j-1] = std::max(a[j] - dp[j+1][i+j-1], a[i+j-1] - dp[j][i+j-2]);
		}
	}
	printf("%lld\n", dp[1][n]);
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

inline void add(vector<pair<int, pair<int, int> > > &v, int l, int r, int ch){
	if(v.empty() || v.back().first != ch)v.push_back({ch, {l, r}});
	else v.back().second.second = r;
}

inline void reduce(vector<pair<int, pair<int, int> > > &v, int r){
	while(v.back().second.second > r){
		if(v.back().second.first > r){
			v.pop_back();
		}else{
			v.back().second.second = r;
		}
	}
}

inline void process(vector<pair<int, pair<int, int> > > &v, int len, int sz){
	while(v.back().first == sz){
		v.pop_back();
	}
	int ch = v.back().first;
	int l = v.back().second.first;
	int r = v.back().second.second;
	v.pop_back();
	if(l == r){
		add(v, l, r, ch + 1);
	}else{
		add(v, l, r - 1, ch);
		add(v, r, r, ch + 1);
	}
	if(r != len){
		add(v, r + 1, len, 1);
	}
}

inline bool isPossible(vector<int> &a, int sz){
	vector<pair<int, pair<int, int> > > vec;
	int prev = 0;
	for(int i = 0; i < a.size(); i++){
		if(a[i] > prev){
			add(vec, prev + 1, a[i], 1);
		}else{
			reduce(vec, a[i]);
			if(vec.size() == 1 && vec[0].first == sz)return false;
			process(vec, a[i], sz);
		}
		prev = a[i];
	}
	return true;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout<<setprecision(32);

	int n;
	cin>>n;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin>>a[i];
	}
	int l = 1, r = n;
	while(l < r){
		int m = l + (r - l)/2;
		if(isPossible(a, m))r = m;
		else l = m + 1;
	}
	cout<<l<<endl;

	return 0;
}

Measured memory_bytes: 3976
using System;
using System.Collections;
using System.Collections.Generic;

class Program {

    static void Main (string[] args) {
        long X = long.Parse (Console.ReadLine ());
        bool found = false;
        long a = 1;
        long b = -1;
        while (!found) {
            if (a == b) {
                a++;
                b = -a;
            }
            if (a * a * a * a * a - b * b * b * b * b == X) {
                found = true;
                break;
            }
            b++;
        }
        Console.WriteLine (a + " " + b);
    }
}

Measured memory_bytes: 27532
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

const long long mod = 1000000007;
long long inv[200200] = { 0, 1 };

int n; vector<int> g[200200];

long long d[200200]; int s[200200];

void go1(int x, int l)
{
	d[x] = 1;
	s[x] = 1;
	for (auto y : g[x]) if (y != l){
		go1(y, x);
		d[x] = d[x] * d[y] % mod * inv[s[y]] % mod;
		s[x] += s[y];
	}
}

long long finv(long long x)
{
	long long r = 1;
	long long p = mod - 2;
	while (p){
		if (p & 1) r = r * x % mod;
		x = x * x % mod;
		p /= 2;
	}
	return r;
}

long long u[200200];

void go2(int x, int l)
{
	for (auto y : g[x]) if (y != l){
		if (x == 1) u[y] = d[x] % mod * finv(d[y]) % mod * s[y] % mod;
		else u[y] = u[x] * d[x] % mod * finv(d[y]) % mod * s[y] % mod * inv[n - s[x]] % mod;
		go2(y, x);
		d[y] = d[y] * u[y] % mod * inv[n - s[y]] % mod;
	}
}

int main()
{
	for (int i = 2; i < 200200; i++) inv[i] = (mod - mod / i) * inv[mod % i] % mod;

	scanf ("%d", &n);
	for (int i = 1; i < n; i++){
		int x, y; scanf ("%d %d", &x, &y);
		g[x].push_back(y);
		g[y].push_back(x);
	}

	go1(1, 0);
	go2(1, 0);

	long long f = 1;
	for (int i = 1; i < n; i++) f = f * i % mod;
	for (int i = 1; i <= n; i++) printf ("%lld\n", d[i] * f % mod);

	return 0;
}

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


#define ll long long
#define int long long
#define pb push_back

#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, a, b) for(int i = (a); i > (b); --i)

typedef pair <int,int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <ll> vl;

const int mod = 998244353;
const ll inf = 2e18+5;




signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   
    
    int n; string s;
    cin>>s;
    n=s.length();
    int f=0;
    loop(i,0,n/2+1){
        if(s[i]!=s[n-1-i])
            {f=1;break;}
    }
    if(f==1){
        cout<<"No"<<endl;return 0;
    }
    string fi="",sec="";
    loop(i,0,(n-1)/2)
        fi+=s[i];
    loop(i,(n-1)/2+1,n)
        sec+=s[i];
    n=fi.length();
    f=0;
    loop(i,0,n/2+1){
        if(fi[i]!=fi[n-1-i])
            {f=1;break;}
    }
    if(f==1){
        cout<<"No"<<endl;return 0;
    }
    n=sec.length();
    f=0;
    loop(i,0,n/2+1){
        if(sec[i]!=sec[n-1-i])
            {f=1;break;}
    }
    if(f==1){
        cout<<"No"<<endl;return 0;
    }
    cout<<"Yes"<<endl;    
    return 0;
}   

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  char s[1003];
  scanf("%s",&s);
  int i = 0;
  while (s[i])
  {
    i++;
  }
  if (s[i - 1] == 's')
  {
    s[i] = 'e';
    s[i+1] = 's';
    s[i+2] = '\0';
  }
  else
  {
    s[i] = 's';
    s[i+1] = '\0';
  }
  printf("%s",s);
}

Measured memory_bytes: 1736
void main() {
	auto ip = readAs!(int[]), R = ip[0], G = ip[1], B = ip[2], N = ip[3];
	ulong r = 0, g = 0;
	ulong cnt;
	while(r * R <= N) {
		while(r * R + g * G <= N) {
			auto tmp = N - (r * R + g * G);
			if(tmp % B == 0) cnt++;
			//writefln("%d %d %d", r, g, tmp);
			g++;
		}
		r++;
		g = 0;
	}
	cnt.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

// find_by_order(k) returns the iterator to the kth largest element (start from 0)
// order_of_key(k) returns the number of elements in the set which are strictly less than the value k

using namespace std;
using namespace __gnu_pbds;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define rightmostbit(x) __builtin_ffsll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         cout << fixed; cout << setprecision(x); cout << y;
#define pi              3.141592653589793238
#define mk(a,n)         int n;cin>>n;vi a(n);for(int i=0;i<n;i++) cin>>a[i]
#define w(x)            int x; cin>>x; while(x--)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

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

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void g_b()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
}
const int N  = 1e6 + 5;
int32_t main()
{
	g_b();
	mk(a, n);
	int c = 0;
	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			for (int k = j + 1; k < n; k++)
			{
				if ((a[i] + a[j] > a[k]) && (a[i] + a[k] > a[j]) && (a[j] + a[k] > a[i])) {
					if (a[i] != a[j] && a[j] != a[k] && a[k] != a[i])c++;
				}
			}
	cout << c;
	return 0;


}

Measured memory_bytes: 3608
#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long
ll digitpower(ll a,ll b){//aのb乗を計算
  if(b==1){
    return a;
  }else if(b==0){
    return 1;
  }
  if(b%2==1){
    ll tmp = digitpower(a,(b-1)/2);
    tmp*=tmp;
    tmp*=a;
    return (tmp);
  }else{
    ll tmp = digitpower(a,(b)/2);
    tmp*=tmp;
    return (tmp);
  }
}
int main(void){
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b+c>=22){
  cout<<"bust"<<endl;
  }else{
  cout<<"win"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256