akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int n,m,a,b,ans;
map<int,int> mp;
int main(void){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>a;
        for(int j=0;j<a;j++){
            cin>>b;
            mp[b]++;
        }
    }
    for(int i=1;i<=m;i++){
        if(mp[i]==n)ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mii map<int,int>
#define ff first
#define ss second
#define mll map<long long,long long>
#define ull unordered_map<long long,long long>
#define pb push_back
#define si set<int>
#define mp make_pair
#define sll set<long long>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define test(t) ll t;cin>>t;while(t--)
#define mod 1000000007
#define SIZE 1000001
#define rep(a,b) for(int a=0;a<b;a++)
#define reps(a,b,c) for(int a=b;a<c;a++)
#define I INT_MAX
#define Im INT_MIN
using namespace std;
ll dp[1001][1001];

ll func(string a[],ll dp[1001][1001],ll s,ll e,ll n,ll m)
{
    if(dp[s][e]!=-1)
        return dp[s][e];
    if(s>=n || e>=m)
        return 0;
    if(s==n-1 && e==m-1)
        return 1;
    if(a[s][e]=='#')
        return 0;
    if(dp[s][e]!=-1)
        return dp[s][e];
    ll sum=((func(a,dp,s,e+1,n,m)%mod) + (func(a,dp,s+1,e,n,m)%mod))%mod;
    return dp[s][e]=sum;
}

int main()
{
for(ll i=0;i<1001;i++)
    for(ll j=0;j<1001;j++)
        dp[i][j]=-1;
    ll n,m;
    cin>>n>>m;
    string a[n];
    rep(i,n)
        cin>>a[i];
    ll f=func(a,dp,0,0,n,m)%mod;
    cout<<f;
    return 0;
}

Measured memory_bytes: 13492
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int len=s.size();
	bool flag=false;
	for(int i=0;i<len;i++){
		if(s[i]=='C') flag=true;
		if(s[i]=='F'&&flag){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

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

int N, M, X;
int L, R;

int main() {
  cin >> N >> M >> X;
  for(int i = 0; i < M; ++i) {
    int a; cin >> a; ++(a < X ? L : R);
  }
  cout << min(L, R) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

#include <boost/range/adaptors.hpp>

int main() {
    long a;
    long b;
    long c;
    std::cin >> a >> b >> c;

    if (c - a - b <= 0) {
        std::cout << "No" << std::endl;
    } else {
        long left = 4 * a * b;
        long right = (c - a - b) * (c - a - b);
        if (left < right) {
            std::cout << "Yes" << std::endl;
        } else {
            std::cout << "No" << std::endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    for(int i=0;i<s.length()-1;i++)
    {
        if(s[i]==s[i+1]){
            s.erase(s.begin()+i);
                i--;
        }
    }
    cout<<(s.length()-1)<<endl;
    return 0;
}


Measured memory_bytes: 512
#include<cstdio>
using namespace std;

#define REP(i,a,b) for(int i=a; i<b; ++i)
#define rep(i,n) REP(i,0,n)

int sum[100010];

int main() {
  int n,k,t,zero;
  while(scanf("%d %d", &n, &k), n|k) {
    rep(i,n+1) sum[i] = 1; sum[0] = 0;
    zero = 0;
    rep(i,k) {
      scanf("%d", &t);
      if(t == 0) zero++;
      else sum[t] = 0;
    }

    rep(i,n) sum[i+1] += sum[i];

    int res = 0,start = 0,end = 0;
    while(end <= n) {
      if(sum[end]-sum[start] > zero) start++;
      if(end - start > res) res = end - start;
      end++;
    }
    printf("%d\n",res);
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const int MOD = 1e9+7;
/* テンプレートここまで */

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 main() {
  string s, t;
  cin >> s;
  cin >> t;
  int n = s.size();
  int m = t.size();

  vector<vector<int>> dp(n+1, vector<int>(m+1, 0));

  REP(i, n){
    REP(j, m){
      if(s[i] == t[j]) chmax(dp[i+1][j+1], dp[i][j] + 1);
      else{
        chmax(dp[i+1][j+1], dp[i][j+1]);
        chmax(dp[i+1][j+1], dp[i+1][j]);
      }
    }
  }

  int l = dp[n][m];
  string ans = "";
  int x = n-1;
  int y = m-1;  
  while(l != 0){
    // DUMP(x);
    // DUMP(y);
    // DUMP(l);
    if(s[x] == t[y]){
      ans = s[x] + ans;
      x--; y--; l--;
      continue;
    }

    if(dp[x][y+1] == l){
      x--;
    }else if(dp[x+1][y]){
      y--;
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 35584
#include <iostream>
#include <vector>
#include <algorithm>

static void input(std::vector<int>& hills)
{
    int val = 0;
    
    if (0x00 == &hills) {
        std::cerr << "hills is null" << std::endl;
        exit (1);
    }
 
    while (std::cin >> val) {
        hills.push_back(val);
    }
}

static int getMax(std::vector<int>& hills)
{
    if (0x00 == &hills) {
        std::cerr << "hills is null" << std::endl;
        exit (1);
    }

    std::sort(hills.begin(), hills.end());
    int ret = hills.back();
    hills.pop_back();

    return ret;
}

int main()
{
    std::vector<int> vec;

    input(vec);
    for (int i = 0; i < 3; i++) {
        std::cout << getMax(vec) << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3132
#import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys

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

def main():
    n = int(input())
    h = list(map(int,ipti().split()))

    hmax = 0
    for i in range(n-1):
        if h[i] - 1 >= hmax:
            h[i] -= 1
        hmax = h[i]

    for i in range(1, n):
        if h[i] - h[i-1] < 0:
            print('No')
            sys.exit()

    print('Yes')

if __name__ == '__main__':
    main()

Measured memory_bytes: 59632
#include <stdio.h>
#include <string.h>
int num[100005],rev[100005];
int main(){
	for(;;){
		int n,k,ret=0,cnt=0,id=1;scanf("%d%d",&n,&k);if(!n) return 0;
		memset(rev,0,sizeof(rev));
		for(int i=1;i<=k;i++) { scanf("%d",&num[i]); rev[num[i]]=i; }
		if(!rev[0]){
			while(id<=n){
				if(!rev[id]) { id++; continue;}
				while(id<=n&&rev[id]){id++;cnt++;}
				ret=ret<cnt?cnt:ret; cnt=0;
			}
		}
		else{
			int prev=0; int prex=-1;
			while(id<=n){
				if(!rev[id]) { id++; continue;}
				bool ok=(prex+2==id);
				while(id<=n&&rev[id]){id++;cnt++;}
				if(ok) ret=ret<cnt+prev+1?cnt+prev+1:ret;
				else ret=ret<cnt+1?cnt+1:ret;
				prev=cnt;prex=id-1;cnt=0;
			}
		}
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 1736
str = "#." * 150
ARGF.each_line do |line|
  chess = ""
  h, w = line.split.map(&:to_i)
  break if h == 0 && w == 0
  (0...h).each do |i|
    odd = i % 2
    chess += str[odd...(w + odd)] + "\n"
  end
  puts chess + "\n"
end

Measured memory_bytes: 9120
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans[20],a[ohara],b[ohara],c,d,tmp,tmpp,m,h,w,x,y,sum,pos;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
map<P,ll> mp;
map<P,ll> out;

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
        cin.tie(0);
        cout.tie(0);
    ios::sync_with_stdio(false);

    cin>>h>>w>>n;
    rep(i,n)cin>>a[i]>>b[i];
    rep(i,n){
        mp[{a[i],b[i]}]++;
    }
    rep(i,n){
        ll kosuu=0;
        int ok=1;
        rrep(sty,a[i]-2,a[i]+1){
            rrep(stx,b[i]-2,b[i]+1){
                ok=1;
                kosuu=0;
                rep(j,3){
                    rep(k,3){
                        ll nowy=sty+j,nowx=stx+k;
                        //if(sty==2&&stx==1)cout<<nowy<<" "<<nowx<<" "<<mp[{nowy,nowx}]<<"\n";
                        if(nowy<=0||nowy>h||nowx<=0||nowx>w){
                            ok=0;
                            break;
                        }
                        kosuu+=mp[{nowy,nowx}];
                    }
                    if(!ok)break;
                }
                if(!ok||out[{sty,stx}]==1)continue;
                out[{sty,stx}]=1;
                //if(sty==2&&stx==1)cout<<kosuu<<"\n";
                ans[kosuu]++;
                kosuu=0;
            }
        }
        if(!ok)continue;
    }
    ll zero=(h-2)*(w-2);
    rep(i,10)zero-=ans[i];
    ans[0]=zero;
    rep(i,10)Cout(ans[i]);
    return 0;
}


Measured memory_bytes: 217600
#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, Q;
string s[100010];
int cnt[100010][26][26];
int sub[100010];

struct Trie {
	bool f;
	int num[26];
	Trie *nxt[26];

	Trie() { 
		f = 0;
		rep(i, 26) num[i] = 0;
		fill(nxt, nxt + 26, (Trie*)0);
	}
};

Trie *insert(string &t, Trie *r)
{
	rep(i, t.size()) {
		int c = t[i] - 'a';
		if (!r->nxt[c]) r->nxt[c] = new Trie;
		++(r->num[c]);
		r = r->nxt[c];
	}

	r->f = true;

	return r;
}

void pre(int id, string &t, Trie *r)
{
	rep(i, t.size()) {
		sub[id] += r->f;

		int c = t[i] - 'a';

		rep(j, 26) cnt[id][j][c] += r->num[j];
		r = r->nxt[c];
	}
}

int main() {
	ios::sync_with_stdio(false);

	cin >> N;
	Trie *r = new Trie(); 

	rep(i, N) {
		cin >> s[i];
		Trie *v = r;
		insert(s[i], v);
	}

	rep(i, N) {
		Trie *v = r;
		pre(i, s[i], v);
	}

	cin >> Q;
	rep(i, Q) {
		int k;
		string pr;
		cin >> k >> pr;
		--k;
		int ret = sub[k];

		rep(p, 26) {
			for (int q = p+1; q < 26; ++q) {
				ret += cnt[k][pr[p]-'a'][pr[q]-'a'];
			}
		}

		cout << ret + 1 << "\n";
	}

	return 0;
}

Measured memory_bytes: 309632
n=int(input())
a=[input() for i in range(n)]
cnt=[0]*4
jud=['AC x','WA x','TLE x','RE x']
for i in a:
    if i=='AC':
        cnt[0]+=1
    if i=='WA':
        cnt[1]+=1
    if i=='TLE':
        cnt[2]+=1
    if i=='RE':
        cnt[3]+=1
for i in range(4):
    print(jud[i],cnt[i])

Measured memory_bytes: 82788
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    
    int main(){
      int a,b,c;
      cin>>a>>b>>c;
      int cnt = 0;
      REP(i,1,b){
        if((a*i)%b == c){
          cout << "YES" <<endl;
          return 0;
        }
        cnt++;
      }
      cout << "NO"<<endl;
    }

    

    
    

Measured memory_bytes: 256
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	X,Y,Z = getlist()
	print(Z, X, Y)
	


if __name__ == '__main__':
	main()

Measured memory_bytes: 38384
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll ans=0;
    ll a,b,n;cin>>a>>b>>n;
    if(n>=b-1){
        ans=(b-1)*a/b;
    }else{
        ans=n*a/b;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int gcd(int a,int b){
    if(a==0)return b;
    if(b==0)return a;

    int M=max(a,b);
    int m=min(a,b);
    return gcd(m,M%m);
}

ll lcm(int a,int b){
    return (ll)a/gcd(a,b)*b;
}

int main(){
    int A,B;cin>>A>>B;
    cout<<lcm(A,B)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>//accumulate(v.begin(), v.end(), 0);
#include <algorithm>//sort(v.begin(),v.end());
#include <string>//
#include <cmath>
#include <iomanip> //setprecision(2)
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
        ll n,m;
        cin >> n >> m;
        ll k[n];
        ll a[50][50]={};
        ll res2=0;
        ll ans[40]={};
        rep(i,n) {
                cin >> k[i];
                rep(j,k[i]){
                        cin >> res2;
                        ans[res2]++;
                }
        }
        int res=0;
        rep(i,32){
                if(ans[i]==n) res++;
        }
        cout << res <<endl;




}


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

int main() {
  int n;
  string s;

  cin >> n;
  cin >> s;

  int ans = n;
  for (int i=1; i<n; i++) {
    if (s.at(i-1) == s.at(i)) {ans--;}
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5000100;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; 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(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[101010];

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	cout << 0 << " " << 0 << " " << 1 << " " << 1000000000 << " ";
	for (ll x = 0;x <= 1000000000;++x) {
		if (1000000000 * x + n <= 1000000000) {
			cout << x << " " << 1000000000 * x + n << endl;
			return 0;
		}
		if (0 <= 1000000000 * x - n) {
			cout << x << " " << 1000000000 * x - n << endl;
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 #define rep(i,n) for(int i=0;i<n;i++)
 using namespace std;
  int main(){
 int A,B,C,D;
 cin >> A >> B >> C >> D;

 const int lower = max(A,C);
 const int upper = min(B,D);

 cout << max(0,upper-lower) << endl;

 return 0;
  
  }

Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;

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;
}

/*
 * ref. http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_D&lang=jp
 */
int main(void) {
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    // (value, count)
    deque<int> q;
    for (int i = 0; i < n; i++) {
        auto it = lower_bound(q.begin(), q.end(), a[i]);
        if (it == q.end()) {
            q.push_back(a[i]);
        } else {
            q[it - q.begin()] = a[i];
        }
    }

    cout << q.size() << endl;

    return 0;
}



Measured memory_bytes: 3720
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

void solve(){
 ll n,u,v;
  cin >> n >> u >> v;
  --u;
  --v;
 vvll G(n);
  rep(i,0,n-1){
   ll a,b;
    cin >> a >> b;
    --a;
    --b;
    G[a].eb(b);
    G[b].eb(a);
  }
  
  vll t(n,-1),a(n,-1);
  t[u]=0;
  a[v]=0;
  queue<ll> q;
  q.push(u);
  while(q.size()>0){
   ll p=q.front();
    q.pop();
    for(auto x:G[p]){
    if(t[x]!=-1) continue;
      t[x]=t[p]+1;
      q.push(x);
    }
  }
  
  q.push(v);
  while(q.size()>0){
   ll p=q.front();
    q.pop();
    for(auto x:G[p]){
    if(a[x]!=-1) continue;
      a[x]=a[p]+1;
      q.push(x);
    }
  }
    
  ll ans=0;
  rep(i,0,n) if(t[i]<a[i]) chmax(ans,a[i]-1);
 
  cout << ans << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  


Measured memory_bytes: 8064
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


s64 N, M;
vs64 A, S, sum;

s64 cost(s64 x)
{
    s64 ret = 0;
    rep (i, N)
    {
        s64 idx = x - A[i];
        if (idx < 0) ret += S[0];
        else if (idx > A[0]) ret += 0;
        else ret += S[idx];
    }
    return ret;
}

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

    cin >> N >> M;
    A.resize(N);
    S.resize(1e5 + 1, 0);
    sum.resize(N + 1);
    sum[0] = 0;
    rep (i, N)
    {
        cin >> A[i];
        ++S[A[i]];
    }

    sort(A.begin(), A.end(), greater<s64>());
    rep (i, N) sum[i + 1] = sum[i] + A[i];
    for (int i = A[0]; i > 0; --i)
    {
        S[i - 1] += S[i];
    }

    s64 l = 2 * A[N - 1];
    s64 r = 2 * A[0] + 1;
    s64 mid;
    while (l + 1 < r)
    {
        mid = (l + r) / 2;
        s64 c = cost(mid);
        if (c >= M)
        {
            l = mid;
        }
        else
        {
            r = mid;
        }
    }

    s64 ans = ((M - cost(r)) >= 0 ? M - cost(r) : 0) * l;
    M = (cost(r) > M ? M : cost(r));
    rep (i, N)
    {
        if (M <= 0) break;
        s64 j = r - A[i];
        s64 idx;
        if (j < 0) idx = S[0];
        else if (j > A[0]) idx = 0;
        else idx = S[j];
        if (idx > M) idx = M;
        ans += idx * A[i] + sum[idx];
        M -= idx;
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 2560
<?php
list($n, $m) = explode(" ", trim(fgets(STDIN)));
for($i = 0; $i < $n; $i++){
    $from[] = explode(" ", trim(fgets(STDIN)));
}
for($i = 0; $i < $m; $i++){
    $to[] = explode(" ", trim(fgets(STDIN)));
}
foreach($from as $f){
    $minDist = 10**18;
    $p = -1;
    foreach($to as $i => $t){
        $dist = abs($t[0] - $f[0]) + abs($t[1] - $f[1]);
        if($dist < $minDist){
            $minDist = $dist;
            $p = $i;
        }
    }
    echo ($p+1),"\n";
}


Measured memory_bytes: 4856
#include <stdio.h>
  
int main()
{
    int r, c;
    scanf("%d %d", &r, &c);
  
    int i, j;
    int a[100][100] = {0};
    int h[100] = {0};
    for(i=0; i<r; i++)
    {
        for(j=0; j<c; j++)
        {
            scanf("%d", &a[i][j]);
            h[j] += a[i][j];
        }
    }
  
      
    for(i=0; i<r+1; i++)
    {
        int w=0;
        for(j=0; j<c+1; j++)
        {
            if(j == c)
            {
                printf("%d\n", w);
            }
            else
            {
                int s = i==r?h[j]:a[i][j];
                printf("%d ", s);
                w += s;
            }
  
        }
          
    }
  
  
    return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
  IOS();
  int a,b;
  cin>>a>>b;
  if( a <= 8 && b <= 8 ) cout<<"Yay!"<<endl;
  else cout<<":("<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;

const int INF = 1001001001;

int main(){
    int N, M;
    cin >> N >> M;
    int A[N];
    int Sum = 0;
    rep(i, N){
        cin >> A[i];
        Sum += A[i];
    }
    int count = 0;
    rep(i, N){
        if(A[i] * 4 * M >= Sum){
            count++;
        }
    }

    if(count >= M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  cin>>s;
  vector<string> a;
  string white(w,'.');
  rep(i,h){
    if(s[i]!=white)a.emplace_back(s[i]);
  }
  int m = a.size();
  vector<int> iswhite(w,true);
  rep(i,m)rep(j,w){
    iswhite[j]&=(a[i][j]=='.');
  }

  rep(i,m){
    rep(j,w){
      if(iswhite[j])continue;
      cout<<a[i][j];
    }
    cout<<endl;
  }

}

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

class union_find {
public:
	vector<int> par, rnk;

	union_find(int N) :
		par(N), rnk(N)
	{
		init(N);
	};

	void init(int n)
	{
		for (int i = 0; i < n; i++) {
			par[i] = i;
			rnk[i] = 0;
		}
	}

	int find(int x)
	{
		if (par[x] == x)
			return x;
		else
			return par[x] = find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);
		if (x == y)
			return;
		if (rnk[x] < rnk[y])
			par[x] = y;
		else {
			par[y] = x;
			if (rnk[x] == rnk[y])
				rnk[x]++;
		}
	}

	bool same(int x, int y)
	{
		return find(x) == find(y);
	}

};
int main()
{
	ios::sync_with_stdio(false);
	int N, K, L;
	cin >> N >> K >> L;
	union_find tree1(N), tree2(N);
	int x, y;
	for (int i = 0; i < K; i++) {
		cin >> x >> y;
		tree1.unite(x - 1, y - 1);
	}
	for (int i = 0; i < L; i++) {
		cin >> x >> y;
		tree2.unite(x - 1, y - 1);
	}
	map<pair<int, int>, int> ans;
	for (int i = 0; i < N; i++) {
		ans[make_pair(tree1.find(i), tree2.find(i))]++;
	}
	for (int i = 0; i < N; i++) {
		cout << ans[make_pair(tree1.find(i), tree2.find(i))] << " \n"[i == N - 1];
	}
	return 0;
}


Measured memory_bytes: 15104
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main(){

  int X, A;
  cin >> X >> A;

  if (X < A)
    cout << 0 << endl;
  else
    cout << 10 << endl;

  return 0;
}


Measured memory_bytes: 256
N = int(input())
x = 0

for i in range(1,N+1):

    if i%3 == 0:
            print(" %d"%i,end = "");
    else:
        x = i
        while (x):
            if x%10 == 3:
                print(" %d"%i,end = "")
                break
            x //= 10
print()


Measured memory_bytes: 5868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 212345
int a[N];
int b[N]={};
set<int> s;

int c[N];
void check(int x, int k, int n){
#ifdef LOCAL_DEBUG
	REP(i, n) c[i]=a[i];
	sort(c+x, c+x+k);
	REP(i, n) DEBUG("%d ", c[i]);
#endif
}

int main(){
	int n, k; scanf("%d%d", &n, &k);
	REP(i, n) scanf("%d", a+i);
	FOR(i, 1, n) if(a[i-1]>a[i]) b[i]=1;
	FOR(i, 1, n) b[i] += b[i-1];
	// REP(i, n) DEBUG("%d ", b[i]);
	
	int ans = 1;
	REP(i, k) s.emplace(a[i]);
	check(0, k, n); DEBUG("\n");
	bool has_sorted = b[0] == b[k-1];
	REP(i, n-k){
		s.emplace(a[i + k]);
		check(i+1, k, n);
		bool is_sorted = b[i+1] == b[i+k];
		DEBUG("a[%d]=%d min=%d a[%d]=%d max=%d b[%d]=%d b[%d]=%d %d\n",
				i, a[i], *s.begin(), i+k, a[i+k], *s.rbegin(), i+1, b[i+1], i+k-1, b[i+k-1],
				is_sorted);
		if(a[i] == *s.begin()
				&& a[i+k] == *s.rbegin()
			 	// && b[i+1] == b[i+k-1]
			){
			DEBUG("same\n");
		}else if(has_sorted && is_sorted) {
			DEBUG("sorted appered\n");
		}else{
			ans += 1;
		}
		has_sorted |= is_sorted;
		s.erase(s.find(a[i]));
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 11136
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

s = S()
t = S()

ls = len(s)
lt = len(t)
n_try = ls - lt + 1

ans = lt

for i in range(n_try):
    st = s[i:lt+i]
    buf = 0
    for j in range(lt):
        if st[j] !=  t[j]:
            buf += 1
    ans = min(ans, buf)

print(ans)

Measured memory_bytes: 9164
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();

        while(n!=0){
            double[] a = new double[n];
            double sum =0, ave;
            for(int i=0;i<n;i++){
                a[i]=scn.nextDouble();
                sum +=a[i];
            }
            ave = sum/n;
            sum=0;
            for(int i=0;i<n;i++){
                sum +=Math.pow(a[i]-ave,2);
            }
            ave = sum/n;
            double sd = Math.sqrt(ave);
            System.out.printf("%.8f%n",sd);
            n=scn.nextInt();

        }

        scn.close();

    }

}


Measured memory_bytes: 40072
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#define INF -1000000000000000000
#define N 200000
#define ll long long
using namespace std;

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll max=INF;
    if(max<a*c) max=a*c;
    if(max<a*d) max=a*d;
    if(max<b*c) max=b*c;
    if(max<b*d) max=b*d;
    cout<<max<<endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f first
#define s second
#define pb push_back
#define pi acos(-1)
ll mod=998244353;
 
ll po(ll a,ll p)
{
    if(p==0)
        return 1ll;
    else if(p==1)
        return a%mod;
    else if(p%2)
    {
        ll temp=po(a,p/2);
        return ((((temp%mod)*(temp%mod))%mod*(a%mod)))%mod;
    }
    else
    {
        ll temp=po(a,p/2);
        return ((temp%mod)*(temp%mod))%mod;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll t, n, m, tc = 0;
    cin >> n >> m;
    ll val[n+5] = {0}, weight[n+5] = {0};
    ll arr[n+5][m+5] = {0};
    for(int i = 1; i <= n; i++)
    {
        cin >> weight[i] >> val[i];
    }
    for(int i = 0; i <= n; i++)
    {
        for(int j = 0; j <= m; j++)
        {
            if(!i || !j)
            {
                arr[i][j] = 0;
            }
            else if (weight[i] <= j)
            {
                arr[i][j] = max(val[i]+arr[i-1][j-weight[i]], arr[i-1][j]);
            }
            else
            {
                arr[i][j] = arr[i-1][j];
            }
        }
    }
    cout << arr[n][m] << endl;
    return 0;
}

Measured memory_bytes: 82304
#include<cstdio>
#include<algorithm>
using namespace std;
int dp[200][200],a[200],b[200],c[200],mx,t[200];
int main(void)
{
	int d,n,i,j,k,x;
	scanf("%d %d",&d,&n);
	for(i=0;i<d;i++){
		scanf("%d",&t[i]);
	}
	for(i=0;i<d;i++){
		for(j=0;j<n;j++){
			dp[i][j]=-1;
		}
	}
	for(i=0;i<n;i++){
		scanf("%d %d %d",&a[i],&b[i],&c[i]);
		if(a[i]<=t[0]&&t[0]<=b[i]){
			dp[0][i]=0;
		}
	}
	for(i=0;i<d-1;i++){
		for(j=0;j<n;j++){
			if(dp[i][j]!=-1){
				for(k=0;k<n;k++){
					if(a[k]<=t[i+1]&&t[i+1]<=b[k]){
						x=c[j]-c[k];
						if(x<0)	x=-x;
						dp[i+1][k]=max(dp[i+1][k],dp[i][j]+x);
					}
				}
			}
		}
	}
	mx=0;
	for(i=0;i<n;i++){
		mx=max(mx,dp[d-1][i]);
	}
	printf("%d\n",mx);
	return 0;
}


Measured memory_bytes: 2828
from fractions import gcd


def lcm(x, y):
    return (x * y) // gcd(x, y)


A, B, C, D = map(int, input().split())
SUM = B - A + 1
c = (B // C - (A - 1) // C)
d = (B // D - (A - 1) // D)
cd = (B // lcm(C, D) - (A - 1) // lcm(C, D))
print(SUM - (c + d - cd))


Measured memory_bytes: 5076
#include<bits/stdc++.h>
#define rep(i,n)  for(ll i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(b<a) { a=b; return 1; } return 0; }

int main(){
  int n; cin >> n;
  vi a(n+2); rep(i,n) cin >> a[i+1];
  int sum = 0;
  rep(i,a.size()-1) sum += abs(a[i+1]-a[i]);

  for(int i = 1; i < n+1; i++){
    int x = sum;
    x -= (abs(a[i+1]-a[i])+abs(a[i]-a[i-1]));
    x += abs(a[i+1]-a[i-1]);
    cout << x << "\n";
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3780
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, std::vector<long long> a){
    if(n == 0 && a[0] == 1){
        // TODO: check
        cout << 1 << endl;
        return;
    }
    if(n == 0 || a[0] != 0){
        // TODO: check
        cout << -1 << endl;
        return;
    }
    vector<i64> bound(n + 1, 1);
    for(int i = 1; i <= n; ++i){
        bound[i] = bound[i - 1] * 2 - a[i];
        if(bound[i] >= INF){
            bound[i] = INF;
        }
    }
    i64 ans = a[n];
    i64 leaf = a[n];
    for(int i = n - 1; i >= 0; --i){
        // [lb, ub]
        i64 ub = min(bound[i], leaf);
        i64 lb = (leaf + 1) / 2;
        if(ub < lb){
            cout << -1 << endl;
            return;
        }
        leaf = ub + a[i];
        ans += leaf;
    }
    cout << ans << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N-0+1);
    for(int i = 0 ; i < N-0+1 ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

ll n;

int main() {
    cin >> n;
    ll ans = 0;
    for (ll r = 1; r*r <= n; r++) {
        if (n%r != 0) continue;
        ll m = n / r;
        if (m-1 > r) ans += m-1;
        if (r-1 > m) ans += r-1;
    }
    cout << ans << endl;
}

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

int main(){
  int d,n,i;
  int x=1;
  cin >> d >> n;
  for(i=0;i<d;i++){
    x *= 100;
  }
  if (n < 100){
    cout << x*n << endl;
  }else if(n == 100){
    cout << x*(n+1) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t x;
  cin>>x;
  int64_t a=(x-(x%11))/11;
  int64_t b=x%11;
  if(b==0){
    cout<< 2*a;
  }
  else if(b<=6){
    cout<<2*a+1;
  }
  else{
    cout << 2*(a+1);
  }
}

Measured memory_bytes: 256
#include<cstdio>
const int N=2e5+6;
int n,A[N];
int a[N],b[N],top;
bool check(int c){
    top=0;
    for(int i=2;i<=n;++i)
    if(A[i]<=A[i-1]){
        int pos=A[i];
        while(top&&a[top]>pos)--top;
        if(!top||a[top]!=pos)a[++top]=pos,b[top]=1;else{
            while(top&&a[top]==pos&&b[top]==c-1)--top,--pos;
            if(!pos)return 0;
            if(top&&a[top]==pos)++b[top];else a[++top]=pos,b[top]=1;
        }
    }
    return 1;
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i)scanf("%d",A+i);
    bool ok=1;
    for(int i=1;i<=n;++i)if(A[i]<=A[i-1])ok=0;
    if(ok){puts("1");return 0;}
    int l=2,r=1e9,ans=1e9;
    while(l<=r){
        const int mid=l+r>>1;
        if(check(mid))r=(ans=mid)-1;else l=mid+1;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 896
#ABC130B-Bounding.py

import sys
from functools import lru_cache

def main():
    N, X = list(map(int,sys.stdin.readline().split()))
    L = list(map(int,sys.stdin.readline().split()))

    @lru_cache(maxsize=None)
    def D(i):
        if i == 1:
            return 0
        elif i <= N+1:
            return D(i-1) + L[i-2]

    for i in range(1,N+2):
        if D(i) > X:
            print(i-1)
            break
    else:
        print(N+1)



if __name__ == "__main__":
    main()


Measured memory_bytes: 3828
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		
		if (a * b == 1 || a * b == 3 || a * b == 9) {
			System.out.println("Yes");
			return;
		}
		else {
			System.out.println("No");
			return;
		}
	
	}
	
}

Measured memory_bytes: 22868
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_N (200000)

int main(int argc, char *argv[]) {
  // read inputs
  char s[MAX_N + 1];
  scanf("%s", s);
  const long N = strlen(s);

  // count number of occurence of each letter
  long cnts[26] = {};
  for (long i = 0; i < N; i++) {
    cnts[s[i] - 'a']++;
  }
  long ans = N * (N - 1) / 2 + 1;
  for (long i = 0; i < 26; i++) {
    const long cnt = cnts[i];
    ans -= cnt * (cnt - 1) / 2;
  }
  printf("%ld\n", ans);
  
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N; cin >> N;
    map<string, ll> cnt;
    rep(i, N){
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        if (cnt.find(s) != cnt.end()){
            cnt[s] += 1;
        } else {
            cnt[s] = 1;
        }
    }
    ll ans = 0;
    for (auto it : cnt) {
        if (it.second > 1){ans += (it.second * (it.second - 1) / 2);}
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 11264
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

const (
	BUFSIZE   = 10000000
	MOD       = 1000000007
	INF_INT   = math.MaxInt32
	INF_INT64 = math.MaxInt64
)

var rdr = bufio.NewReaderSize(os.Stdin, BUFSIZE)

func main() {
	solve()
}

func solve() {
	S := ReadLine()
	flag := true
	for i, c := range S {
		if i%2 == 1 {
			if string(c) == "R" {
				flag = false
			}
		} else {
			if string(c) == "L" {
				flag = false
			}
		}
	}
	if flag {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func ReadLine() string {
	buf := make([]byte, 0, BUFSIZE)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			fmt.Println(e.Error())
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func ReadWords() []string {
	str := strings.Split(ReadLine(), " ")
	return str
}

func ReadLineInt64() []int64 {
	str := ReadWords()
	l := len(str)

	ret := make([]int64, l)

	for i, s := range str {
		ret[i] = s2i64(s)
	}
	return ret
}

func ReadLineInt() []int {
	values := ReadLineInt64()
	ret := make([]int, len(values))
	for i, v := range values {
		ret[i] = int(v)
	}
	return ret
}

func ReadInt() int {
	v := ReadLineInt()
	return v[0]
}
func ReadInt2() (int, int) {
	v := ReadLineInt()
	return v[0], v[1]
}
func ReadInt3() (int, int, int) {
	v := ReadLineInt()
	return v[0], v[1], v[2]
}
func ReadInt4() (int, int, int, int) {
	v := ReadLineInt()
	return v[0], v[1], v[2], v[3]
}

func ReadInt64() int64 {
	v := ReadLineInt64()
	return v[0]
}
func ReadInt64_2() (int64, int64) {
	v := ReadLineInt64()
	return v[0], v[1]
}
func ReadInt64_3() (int64, int64, int64) {
	v := ReadLineInt64()
	return v[0], v[1], v[2]
}
func ReadInt64_4() (int64, int64, int64, int64) {
	v := ReadLineInt64()
	return v[0], v[1], v[2], v[3]
}

func s2i64(s string) int64 {
	v, ok := strconv.ParseInt(s, 10, 64)
	if ok != nil {
		panic("Faild : " + s + " can't convert to int64")
	}
	return v
}

// For int64
func Bool2Int64(b bool) int64 {
	if b {
		return 1
	} else {
		return 0
	}
}

func Abs64(v int64) int64 {
	if v < 0 {
		return -v
	}
	return v
}

func Min64(values ...int64) int64 {
	ret := int64(INF_INT64)
	for _, v := range values {
		if ret > v {
			ret = v
		}
	}
	return ret
}

func Max64(values ...int64) int64 {
	ret := -int64(INF_INT64)
	for _, v := range values {
		if ret < v {
			ret = v
		}
	}
	return ret
}

func Distance64(a, b int64) int64 {
	return Abs64(a - b)
}

// For int
func Bool2Int(b bool) int {
	if b {
		return 1
	} else {
		return 0
	}
}

func Abs(v int) int {
	if v < 0 {
		return -v
	}
	return v
}

func Min(values ...int) int {
	ret := INF_INT
	for _, v := range values {
		if ret > v {
			ret = v
		}
	}
	return ret
}

func Max(values ...int) int {
	ret := -INF_INT
	for _, v := range values {
		if ret < v {
			ret = v
		}
	}
	return ret
}

func Distance(a, b int) int {
	return Abs(a - b)
}


Measured memory_bytes: 2536
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N=sc.nextInt();
    	long a=sc.nextLong();
    	for(int i=1;i<N;i++){
    		long b=sc.nextLong();
    		long gcd=getGCD(a,b);
    		a=getLCM(a,b,gcd);
    	}
    	System.out.println(a);
    }
    private static long getGCD(long m, long n) {
    	long r;
    	if(m<n){
    		long buffer=m;
    		m=n;
    		n=buffer;
    	}
    	r=m%n;
    	while(r!=0){
    		m=n;
    		n=r;
    		r=m%n;
    	}
    	return n;
    }
    private static long getLCM(long m, long n, long gcd) {
    	return m/gcd*n;
    }
}

Measured memory_bytes: 21972
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n%2==0)ou(n);
  else ou(n*2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
#define PI 3.14159265358979323846264338327950L
typedef unsigned long long uint64;
using namespace std;
using ll = long long;
int main(){
  int a,b;
  cin >> a >> b;
  if(a>b){
    for(int i = 0;i<a;i++){
      cout << b;
    }
    cout << endl;
  }else{
    for(int i= 0;i<b;i++){
      cout << a ;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3508
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 100010, P = 1000000007;

int n;
char s[N * 2];

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif

  scanf("%d%s", &n, s + 1);
  s[0] = 'W';
  int cnt = 0, ans = 1;
  bool pre = false;
  for (int i = 1; i <= n * 2; ++i) {
    if ((s[i] == s[i - 1]) == pre) {
      ++cnt;
      pre = false;
    } else {
      ans = ans * (ll) cnt-- % P;
      pre = true;
    }
  }
  if (cnt) ans = 0;
  for (int i = 1; i <= n; ++i) ans = ans * (ll)i % P;
  printf("%d\n", ans);

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {        
    int n, d, x;
    cin >> n >> d >> x; 
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        x += d / a + (d % a > 0 ? 1 : 0);
    }
    cout << x << endl;
}


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

using namespace std;

int main(int argc, char *argv[]) {
    int N, K;
    cin >> N >> K;

    int ans = 0;
    for (int i = 1; i <= N; i++) {
        int one = i;
        int other = i + K - 1;
        if (other <= N) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll unsigned long long int
#define pb push_back
#define ull  long long int

#define IO ios::sync_with_stdio(false);
typedef vector<int> vi;
#define H return 0;
#define C continue;
#define B break;
#define sec second
#include <bits/stdc++.h>

    int main()
{   IO

ll n;
cin>>n;
ll a[n];ll an=0;
for(ll i=0;i<n;i++)
{
    cin>>a[i];
    an+=a[i];
}
cout<<an-n;
}



Measured memory_bytes: 256