akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <bitset>
using namespace std;

int main(){
	vector <string> Code;
	int i, j, k, n, max;
	while (1){
		cin >> n;
		if (n == 0) break;
		Code.clear();
		for (k = 0; k < n; k++){
			string temp, code;
			cin >> temp;
			code += temp[0];
			for (i = 0; i < temp.size() - 1; i++){
				if (temp[i] == 'a' || temp[i] == 'i' || temp[i] == 'u' || temp[i] == 'e' || temp[i] == 'o'){
					code += temp[i + 1];
				}
			}
			if (code[code.size() - 1] != '\0') code += '\0';
			Code.push_back(code);
			if (k == 0) max = code.size();
			else if (code.size() > max) max = code.size();
		}
		for (i = 0; i < n - 1; i++){
			for (j = i + 1; j < n; j++){
				int lmin;
				if (Code[i].size() < Code[j].size()) lmin = Code[i].size() - 1; else lmin = Code[j].size() - 1;
				for (k = 0; k < lmin; k++){
					if (Code[i][k] != Code[j][k]) break;
				}
				if (k == lmin){
					if (Code[i].size() == Code[j].size()) goto AllBreak;
				}
				if (i == 0 && j == 1) max = k;
				else if (k > max) max = k;
			}
		}
	AllBreak:
		if (i != n - 1 || j != n) cout << -1 << endl;
		else cout << max + 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 3164
import sys

def step_count(val, lim):
    count = 0
    while True:
        if val >= lim:
            return count
        else:
            val *= 2
            count += 1

def main():
    sinputl = sys.stdin.readline

    dice, limit = [int(x) for x in sinputl().split()]

    chance = 0.0

    for first in range(1, dice+1):
        chance += (1/dice) * (1/ 2 ** step_count(first, limit))

    print(chance)



if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;
    

    void calc()
    {
        cin = new Scanner();
        long X = cin.nextLong();
        long Y = cin.nextLong();
        if (X % Y == 0) Console.WriteLine(-1);
        else Console.WriteLine(X);
        
    }
    
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
// template<class A>void pr(A a){cout << (a) << endl;}
// template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
// template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
// template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef unsigned long long ll;
// typedef pair<ll, ll> l_l;
// typedef pair<int, int> i_i;
// int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {

int main(void) {
  int n;cin>>n;
  map<ll,ll> M;
  int a[n+10];
  REP(i,n) {
    cin>>a[i];
    M[a[i]]+=1;
  }

  ll res=0;
  for(pair<ll,ll> m:M) {
    // pr(m.first,m.second);
    res+=(m.second)*(m.second-1)/2;
  }

  // pr(res);

  // pr("===");

  int t=0;
  REP(i,n) {
    // pr(M[a[i]]);
    t=M[a[i]];
    cout << res-t*(t-1)/2+(t-1)*(t-2)/2 << endl;
  }
  // REP(i,n) {
  //   // (M[a[i]].second-1)*(M[a[i]].second-2);
  // }
  return 0;
}


Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define rep(i,n) REP(i, 0, n)
typedef complex<double> Point;
double cross(const Point& a, const Point& b){
    return (conj(a) * b).imag();
}
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    Point a[4];
    int N; cin >> N;
    rep(casenum, N){
        rep(i, 4) cin >> a[i].real() >> a[i].imag();
        double sum = cross(a[0] - a[1], a[2] - a[3]) / 2;
        if(abs(sum) < 1.0e-11) cout << "YES" << endl; else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <stdio.h>

using namespace std;

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

int main(void) {
    int a, b;

    while(~scanf("%d %d", &a, &b)) {
        cout << gcd(a, b) << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
using namespace std;
main()
{
    int a,b,c;
    map<int,int>p;
    cin>>a>>b>>c;
    p[a]++;p[b]++;p[c]++;
    if(p[5]==2&&p[7]==1)
        cout<<"YES";
    else
        cout<<"NO";
}


Measured memory_bytes: 3608
use std::cmp::{max, min};

fn main() {
    let t: Vec<i64> = reads();
    let (n, c) = (t[0] as usize, t[1]);

    let xv: Vec<_> = (0..n)
        .map(|_| {
            let t: Vec<i64> = reads();
            (t[0], t[1])
        })
        .collect();

    let mut ls = vec![0; n + 1];
    let mut rs = vec![0; n + 1];

    {
        let mut acc = 0;
        for i in 0..n {
            acc += xv[i].1;
            let cur = acc - xv[i].0;
            ls[i + 1] = max(ls[i], cur);
        }
    }

    {
        let mut acc = 0;
        for i in 0..n {
            acc += xv[n - 1 - i].1;
            let cur = acc - (c - xv[n - 1 - i].0);
            rs[i + 1] = max(rs[i], cur);
        }
    }

    let mut ans = 0;
    {
        for i in 0..n {
            let cur1 = ls[i + 1];
            let cur2 = ls[i + 1] - xv[i].0 + rs[1 + n - 1 - 1 - i];
            ans = max(ans, max(cur1, cur2));
        }
    }
    {
        for i in 0..n {
            let cur1 = rs[i + 1];
            let cur2 = rs[i + 1] - (c - xv[n - 1 - i].0) + ls[1 + n - 1 - 1 - i];
            ans = max(ans, max(cur1, cur2));
        }
    }

    println!("{}", ans);
}

//------

#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_owned()
}

#[allow(dead_code)]
fn reads<T>() -> Vec<T>
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    read_line()
        .split_whitespace()
        .map(|w| w.parse().unwrap())
        .collect()
}


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

using i8   = int8_t;
using u8   = uint8_t;
using i16  = int16_t;
using u16  = uint16_t;
using i32  = int32_t;
using u32  = uint32_t;
using i64  = int64_t;
using u64  = uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;

using f32  = float;
using f64  = double;
using f80  = __float80;
using f128 = __float128;
// }}}

constexpr i64 INF = 1'010'000'000'000'000'000LL;

constexpr i64 MOD = 1'000'000'007LL;

constexpr f64 EPS = 1e-12;

constexpr f64 PI = 3.14159265358979323846;

// {{{ util
#define FOR(i, start, end) for(i64 i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cc) { return (f)(begin(cc), end(cc), ## __VA_ARGS__); })(c))

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

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

template<typename T>
void RD(T& x) {
    cin >> x;
#ifdef PROCON_LOCAL
    assert(cin);
#endif
}

template<typename T>
void RD(vector<T>& v, int n) {
    v.reserve(n);
    REP(_, n) {
        T e; RD(e);
        v.emplace_back(e);
    }
}

template<typename T>
void PRINT(const T& x) {
    cout << x;
}

template<typename T>
void PRINT(const vector<T>& v) {
    for(auto first = begin(v), it = first; it != end(v); ++it) {
        if(it != first)
            cout << ' ';
        cout << *it;
    }
}

template<typename T>
void PRINTLN(const T& x) {
    PRINT(x);
    cout << '\n';
}

template<typename T>
void DBG_IMPL(i64 line, const char* expr, const T& value) {
#ifdef PROCON_LOCAL
    cerr << "[LINE " << line << "]: ";
    cerr << expr << " = " << value << "\n";
#endif
}

#define DBG(expr) DBG_IMPL(__LINE__, #expr, (expr))
// }}}

//--------------------------------------------------------------------

i64 N;
i64 M;
i64 C;
vector<vector<i64>> A;
vector<i64> B;

void solve() {
    i64 ans = 0;
    for(const auto& e : A) {
        i64 x = ALL(inner_product, e, begin(B), 0LL) + C;
        if(x > 0)
            ++ans;
    }

    PRINTLN(ans);
}

signed main() {
    RD(N);
    RD(M);
    RD(C);
    RD(B, M);

    A.reserve(N);
    REP(_, N) {
        vector<i64> e; RD(e, M);
        A.emplace_back(e);
    }

    solve();

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int x;
	int count = 1;
	scanf("%d", &x);

	while (x != 0)
	{
		printf("Case %d: %d\n", count, x);
		count = count + 1;
		scanf("%d", &x);


	}

	return 0;

}


Measured memory_bytes: 1980
while 1:
    try:
        a, b = map(int, raw_input().split())
        if a > b: x, y = a, b
        else: x, y = b, a

        r = x % y
        while (r != 0):
            x = y
            y = r
            r = x % y
        gcd = y

        lcm = (a / gcd) * b

        print str(gcd) + " " + str(lcm)

    except:
        break

Measured memory_bytes: 4208
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[100009];
ll n,x,result,ans;
vector<ll>v;
ll frog(ll pos,ll k)
{
   if (pos >= 0 && pos <n-1)
    {
        if (dp[pos]!= -1)
            return dp[pos];
      ll  int ret = INT_MAX;
        for(int i=1; i<=k ; i++)
        {
            if(pos+i==n)
                break;
            ans = frog(i + pos,k ) + abs(v[pos]-v[pos+i]);
           // cout<<ans<<endl;
                ret = min(ret,ans );
        }
        return dp[pos] = ret;
    }
    else if(pos==n-1)
        return 0;
    else
        return INT_MAX;
}

int main()
{
    ll k;
    cin>>n>>k;
    memset(dp,-1,sizeof(dp));
    for(ll i=0; i<n; i++)
    {
        cin>>x;
        v.push_back(x);
    }
    cout<<frog(0,k)<<endl;
}

Measured memory_bytes: 11120
n, k = map(int, input().split())
r,s,p = map(int, input().split())
t = input()
point = {"s":r, "p":s, "r":p}
x = {"s":"r", "p":"s", "r":"p"}
ans = []
P = 0
for i in t:
    if len(ans) < k or ans[-k] != x[i]:
        ans.append(x[i])
        P += point[i]
    else: ans.append("")
print(P)  

Measured memory_bytes: 10100
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for (int i = 0; i < n; ++i)
#define REP(i,k,n) for (int i = k; i <= n; ++i)
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define debug1(a) cout<<" a : "<<a<<"\n"
#define debug2(a,b) cout<<" a : "<<a<<" b : "<<b<<"\n"
#define debug3(a,b,c) cout<<" a : "<<a<<" b : "<<b<<" c : "<<c<<"\n"
#define debug4(a,b,c,d) cout<<" a : "<<a<<" b : "<<b<<" c : "<<c<<" d : "<<d<<"\n"
// #define M 421412341324321
#define MOD 998244353 

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n;
	cin>>n;
	int a[n];
	long double ans = 0;
	rep(i,n)
	{
		cin>>a[i];
		ans+= ((long double)1.0)/a[i];
 	}
 	ans = ((long double)1.0)/ans;
 	cout<<fixed<<setprecision(10)<<ans;
	
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N;
  cin>>N;
  pii ans;
  vi A(N);
  rep(i,0,N) cin>>A[i];
  sort(ALL(A));
  ans.first=A[N-1];
  if(N==2)
    ans.second=A[0];
  else{
    int K=A[N-1]/2;
    int X=dislow(A,K);
    if(A[N-1]-A[X]<A[X-1])
      ans.second=A[X-1];
    else
      ans.second=A[X];
    }
  cout<<ans.first<<" "<<ans.second<<endl;
  }


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
vi seg;
ll N;
void init(ll n){
    N=1;
    while(N<n)N*=2;
    seg=vi(N*2-1);
}
void update(ll i,ll x){
    i=N+i-1;
    seg[i]=x;
    while(i>0){
        i=(i-1)/2;
        seg[i]=seg[i*2+1]+seg[i*2+2];
    }
}
ll getsum(ll a,ll b,ll k,ll l,ll r){
    if(r<=a||b<=l)return 0;
    if(a<=l&&r<=b)return seg[k];
    ll c1=getsum(a,b,k*2+1,l,(l+r)/2);
    ll c2=getsum(a,b,k*2+2,(l+r)/2,r);
    return c1+c2;
}
int main(){
    ll n,ans=0;cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    vp s(n);
    rep(i,n)s[i]=P(i+v[i],i);
    sort(all(s));
    vi id(n);
    rep(i,n)id[s[i].se]=i;
    init(n);
    rep(i,n){
        ans+=getsum(lb(s,P(i-v[i],0)),lb(s,P(i-v[i],inf)),0,0,N);
        update(id[i],1);
    }
    out(ans);
}

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

int main(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
// #ifndef ONLINE_JUDGE 
//     freopen("input.txt", "r", stdin); 
//     freopen("output.txt", "w", stdout); 
// #endif
    int n,k;
    cin>> n>>k;
    int a[n];
    for(int i=0;i<n;i++){
    	cin>>a[i];
    }
    int dp1[n] ;
    for (int i = 0; i < n; ++i){
        dp1[i] = INT_MAX;
    }
    dp1[0]=0;
    for(int i=0;i<n;i++){
        for (int j=1;j<=k;j++){
            if ((i-j)>=0 && (i-j)<n)
                { 
               //cout<<i<<" "<<j<<"\n";     
            dp1[i]=min(dp1[i],dp1[i-j]+abs(a[i]-a[i-j]));
        }    
    }
    }
    // for(auto x : dp1){
    //     cout<<x<<"\n";
    // }
    cout<< dp1[n-1]<<"\n";
	return 0;

}

Measured memory_bytes: 1024
#include<iostream>
#include<numeric>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++)  cin >> a[i];
    for(int i = 0; i < n; i++)  cin >> b[i];
    ll asum = accumulate(a.begin(),a.end(),0ll);
    ll bsum = accumulate(b.begin(),b.end(),0ll);
    if(asum < bsum){
        cout << -1 << endl;
        return 0;
    }
    priority_queue<int> give;
    ll want = 0;
    int ret = n;
    for(int i = 0; i < n; i++){
        if(a[i] > b[i]){
            give.push(a[i]-b[i]);
        }else if(b[i] > a[i]){
            want += b[i]-a[i];
            ret--;
        }
    }
    while(want > 0){
        want -= give.top(); give.pop();
        ret--;
    }
    cout << n-ret << endl;
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll n,k,s;cin>>n>>k>>s;
    ll t=1000000000;
    vi ans(n);
    if(s==t)rep(i,n)ans[i]=t-1;
    else rep(i,n)ans[i]=t;
    rep(i,k)ans[i]=s;
    outv(ans);
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 200000
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
	int n,x,y;
    cin>>n>>x>>y;
    x--;
    y--;
    vector<int> m(n);
    REP(i,n-1){
        for(int j=i+1;j<n;j++){
            int t=min(j-i,abs(x-i)+1+abs(y-j));
            m[t]++;
        }
    }
    for(int i=1;i<n;i++){
        OUT(m[i]);
    }
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main ()
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if(a < b && b <c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
} 


Measured memory_bytes: 2040
#include<iostream>
#include<sstream>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<numeric>
#include<set>
using namespace std;

void add_to_child(queue<int> &arr, vector<set<int>> &ab, vector<int> &px){  
  for(auto &ind_c : ab[arr.front()]){
    px[ind_c] += px[arr.front()];
    ab[ind_c].erase(arr.front());
    arr.push(ind_c);
  }
  arr.pop();
}

int main(){
  int n, q;
  cin >> n >> q;

  int a, b;
  vector<set<int>> ab(n+1);
  for(int i = 0; i < n-1; i++){
    cin >> a >> b;
    ab[a].insert(b);
    ab[b].insert(a);
  }

  int p, x;
  vector<int> px(n+1, 0);
  for(int i = 0; i < q; i++){
    cin >> p >> x;
    px[p] += x;
  }
  
  queue<int> arr;
  arr.push(1);
  while(!arr.empty())
    add_to_child(arr, ab, px);

  for(int i = 1; i <= n; i++)
    cout << px[i] << " ";

  cout << endl;
  
  return 0;
}

Measured memory_bytes: 32000
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5, mod = 1e9 + 7;
int n, m, a[maxn + 10], lim;
char s[maxn + 10];
bool fd, fir = 1;
int f[maxn + 10], sum[maxn + 10], ans;
int main() {
	scanf("%d%d%s", &n, &m, s + 1);
	for (int i = 1; i <= m; ++i) a[i] = s[i] == 'R';
	if (a[1]) {
		for (int i = 1; i <= m; ++i) a[i] ^= 1;
	}
	for (int i = 1; i <= m; ++i)
		if (a[i]) fd = 1;
	lim = n;
	if (fd) {
		for (int i = 1, cnt = 0; i <= m; ++i)
			if (!a[i]) ++cnt;
			else {
				if (fir) {
					lim = min(lim, cnt % 2 ? cnt : cnt + 1);
					fir = 0;
				} else if (cnt % 2) 
					lim = min(lim, cnt);
				cnt = 0;
			}
		if (n % 2) {
			printf("0"); return 0;
		}
		n /= 2; lim = (lim + 1) / 2;
		f[0] = sum[0] = 1;
		for (int i = 1; i <= n; ++i) {
			if (i <= lim) f[i] = sum[i - 1];
			else f[i] = (sum[i - 1] - sum[i - lim - 1] + mod) % mod;
			sum[i] = (sum[i - 1] + f[i]) % mod;
		}
		for (int i = 1; i <= lim; ++i)
			(ans += 2ll * i * f[n - i] % mod) %= mod;
	} else {
		f[0] = sum[0] = 1;
		for (int i = 1; i <= n; ++i) {
			if (i > 1) f[i] = sum[i - 2];
			sum[i] = (sum[i - 1] + f[i]) % mod;
		}
		ans = 1;
		for (int i = 2; i <= lim; ++i)
			(ans += 1ll * i * f[n - i] % mod) %= mod;
	}
	printf("%d", ans);
}


Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define FORR(i,a,b) for (int i = b - 1; i >= a; --i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)
#define fi first
#define se second
#define mp make_pair
//#define DEBUG

void showCost(vector<vector<int>>& cost) {
	cout << "=== cost ===" << endl;
	REP(h, cost.size()) {
		REP(w, cost[0].size()) {
			cout << cost[h][w] << "\t";
		}
		cout << endl;
	}
}

int main() {
	int H, W, Ch, Dh, Cw, Dw;
	cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
	--Ch, --Cw, --Dh, --Dw;

	vector<vector<bool>> stage(H, vector<bool>(W, true));
	{
		char c;
		REP(h, H) REP(w, W) {
			cin >> c;
			if (c == '#') stage[h][w] = false;
		}
	}

	vector<vector<int>> cost(H, vector<int>(W, 1000000));

	deque<pii> q;
	q.emplace_back(Ch, Cw);
	cost[Ch][Cw] = 0;

	int zh[4] = {0, -1, 0, 1};
	int zw[4] = {-1, 0, 1, 0};
	int oh[20] = {-2, -2, -2, -2, -2, -1, -1, -1, -1,  0,  0,  1,  1,  1,  1,  2,  2,  2,  2,  2};
	int ow[20] = {-2, -1,  0,  1,  2, -2, -1,  1,  2, -2,  2, -2, -1,  1,  2, -2, -1,  0,  1,  2};

	while (!q.empty()) {
		pii p = q.front();
		q.pop_front();

		int cp = cost[p.fi][p.se];

		// cost 0
		REP(i, 4) {
			int h = p.fi + zh[i], w = p.se + zw[i];
			if (h < 0 || H <= h || w < 0 || W <= w) continue;
			if (!stage[h][w]) continue;
			if (cost[h][w] <= cp) continue;
			cost[h][w] = cp;
			q.emplace_front(h, w);
		}

		// cost 1
		REP(i, 20) {
			int h = p.fi + oh[i], w = p.se + ow[i];
			if (h < 0 || H <= h || w < 0 || W <= w) continue;
			if (!stage[h][w]) continue;
			if (cost[h][w] <= cp + 1) continue;
			cost[h][w] = cp + 1;
			q.emplace_back(h, w);
		}
	}

#ifdef DEBUG
	showCost(cost);
#endif

	if (cost[Dh][Dw] == 1000000) cout << "-1" << endl;
	else cout << cost[Dh][Dw] << endl;

	return 0;
}

Measured memory_bytes: 7780
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            var a = ReadLine();
            var b = ReadLine();
            var ac = string.Concat(a.OrderBy(x => x));
            var bc = string.Concat(b.OrderByDescending(x => x));

            if (string.Compare(ac, bc) < 0)
            {
                WriteLine("Yes");
            }
            else WriteLine("No");
        }
    }
}

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

using namespace std;

#define ll long long
#define F first
#define S second
#define ii pair < int , int >

const int N=500000;
ll a[N];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",a+i);
    }
    ll lst=0LL;
    ll sum=0LL;
    for(int i=1;i<=n;i++){
        if(a[i]<lst){
            sum+=(lst-a[i]);
        }
        else{
            lst=a[i];
        }
    }
    printf("%lld",sum);

}


Measured memory_bytes: 5244
def main():
        N = int(input())

        N_list = list(str(N))

        tail = int(N_list[-1])

        hon = [2,4,5,7,9]
        pon = [0,1,6,8]
        bon = [3]

        ans = ""

        if tail in hon:
                ans = "hon"
        elif tail in pon:
                ans = "pon"
        else:
                ans = "bon"

        print("{}".format(ans))

if __name__=="__main__":
        main()

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

using namespace std;

int main()
{
	string s;
	int k;
	cin >> s >> k;
	
	vector <pair <char, int> > c;
	set <string> q;
	vector <string> z;
	
	for (int i = 0; i < s.size(); i++)
		c.push_back(make_pair(s[i], i));
		
	sort(c.begin(), c.end());

	for (int i = 0; i < s.size() && (s.size() < 10 || c[i].first <= c[9].first); i++)
	{
		for (int j = 0; j < min(10, (int)s.size()-c[i].second); j++)
		{
			if (q.find(s.substr(c[i].second, j+1)) == q.end())
			{
				z.push_back(s.substr(c[i].second, j+1));
				q.insert(s.substr(c[i].second, j+1));
			}
		}
	}

	sort(z.begin(), z.end());
	cout << z[k-1];
}

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

#define N 100
#define MAX 100000

int A[N + 1][N + 1] = {};
int n, u, k, v;
int t1[N + 1]; //発見時刻

//sは始点,tは時間
void bfs(int s, int t) {
    t1[s] = t;
    for(int i = 1; i <= n; ++i) {
        if(A[s][i] == 1 && t < t1[i]) {
            bfs(i, t + 1);
        }
    }
}

int main(void) {
    cin >> n;
    
    for(int i = 0; i < n; ++i) {
        cin >> u >> k;
        for(int j = 0; j < k; ++j) {
            cin >> v;
            A[u][v] = 1;
        }
    }
    
    for(int i = 0; i <= n; ++i) t1[i] = MAX;
    
    bfs(1, 0);
    
    for(int i = 1; i <= n; ++i) {
        cout << i << ' ';
        if(t1[i] == MAX) cout << -1 << endl;
        else cout << t1[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int i,j,k,n,a[10000];

    cin>>n;

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

    cout<<a[n-1]-a[0]<<endl;

    return 0;

}


Measured memory_bytes: 256
import sys
from io import StringIO
import unittest

def resolve():
    n, m = map(int, input().split())

    red = [0 for _ in range(n)]
    red[0] = 1
    balls = [1 for _ in range(n)]

    for _ in range(m):
        x, y = map(int, input().split())

        if red[x - 1] == 1:
            red[y - 1] = 1

        balls[x - 1] -= 1
        balls[y - 1] += 1

        if balls[x - 1] == 0:
            red[x - 1] = 0

    print(sum(red))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例1(self):
        input = """3 2
1 2
2 3"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例2(self):
        input = """3 3
1 2
2 3
2 3"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例3(self):
        input = """4 4
1 2
2 3
4 1
3 4"""
        output = """3"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Measured memory_bytes: 59420
import java.io.*;

public class Main {
	public static void main(String[] argv) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] lineArray;
		while ((line = br.readLine()) != null) {
			lineArray = line.split(" ");
			double[] f = new double[lineArray.length];
			for (int i = 0; i < lineArray.length; i++) {
				f[i] = (double)Integer.parseInt(lineArray[i]);
			}
			double x = (f[4] * f[2] - f[1] * f[5]) / (f[0] * f[4] - f[1] * f[3]);
			double y = (-f[2] * f[3] + f[0] * f[5]) / (f[0] * f[4] - f[1] * f[3]);
			if(x==0.0)
            {
                x=0.0;
            }
            if(y==0.0)
            {
                y=0.0;
            }
			System.out.print(String.format("%.3f %.3f", x, y) + "\n");
		}
	}
}

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

using namespace std;

const int Maxn = 1e2+7;

int n, a[Maxn], sum;
double res, dd;

int main()
{
    cin >> n;
    for(int i = 0; i < n; ++i)
    {
        cin >> a[i];
        sum += a[i];
    }
    double ave = (double)sum/n;
    dd = abs(ave-a[0]);
    for(int i = 1; i < n; ++i)
    {
        if(abs(ave-a[i]) < dd)
        {
            dd = abs(ave-a[i]);
            res = i;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np


def main(L, R, d):
    num = L
    ans = 0
    while True:
        if num % d == 0:
            ans += 1
        if num >= R:
            break
        num += 1
    return ans


L, R, d = map(int, input().split())
print(main(L, R, d))


Measured memory_bytes: 27144
#include <stdio.h>
int main(void){
         int a, b, x, cnt;
    scanf("%d %d", &a, &b);
    while(a!=0 && b!=0){
        cnt = 0;
        if(b >= a){
            x = a;
            a = b;
            b = x;
        }
        while(b != 0){
            cnt++;
            a = a % b;
            x = a;
            a = b;
            b = x;
        }
        printf("%d %d\n",a,cnt);
        scanf("%d %d",&a,&b);
    }
    return 0;
}



Measured memory_bytes: 1924
#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <bitset>

using namespace std;

typedef long double ld;
typedef long long li;
typedef vector<li> vec;
typedef vector<vector<li>> mt;
typedef pair<li, li> pll;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)

const double EPS = 1e-9;
const int INF = 1e9 + 7;
const li LINF = 1e18 + 7;

double f(li x) {
	li a = x;
	int res = 0;
	while (x) {
		res += x % 10;
		x /= 10;
	}

	return a * 1.0 / res;
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	int k; 
	cin >> k;

	li x = 1, step = 1;
	while (k) {
		cout << x << endl;
		k--;
		
		while (f(x + step) > f(x + 2 * step)) {
			step *= 10;
		}

		x += step;
	}
}

	

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
struct UnionFind{
    vector<int> par;
    vector<int> rank;
    void init(int n){
        par.resize(n);
        rank.resize(n);
        for(int i = 0; i < n; i++){
            par[i] = i;
            rank[i] = 1;
        }
    }
    int root(int x){
        if(par[x] == x) return x;
        return root(par[x]);
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    int size(int x){
        return rank[(root(x))];
    }
    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(size(y) > size(x)) swap(x, y);
        rank[x] += rank[y];
        par[y] = par[x]; 
    }
};

int main(){
    int n, q;
    cin >> n >> q;
    UnionFind U;
    U.init(n);
    for(int i = 0; i < q; i++){
        int c, x, y;
        cin >> c >> x >> y;
        if(!c) U.unite(x, y);
        else if(c){
            if(U.same(x, y)) cout << 1 << endl;
            else cout << 0 << endl;
        }
    }
}


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

    char a[102][102] = {"\0"};
    rep(i, h) {
        rep(j, w) {
            cin >> a[i][j];
        }
    }

    printf("\n");
    
    rep(i, w+2) {
        cout << "#";
    }
    printf("\n");
    rep(i, h) {
        cout << "#";
        rep(j, w) {
            cout << a[i][j];
        }
        printf("#\n");
    }
    rep(i, w+2) {
        cout << "#";
    }
    
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>

using namespace std;
using ll = long long;
using ld = long double;

namespace NyaGadget
{
	struct NyaStruct {
		ll times = 0;
		ll v = 0;
	};

	auto NyaSort = [](const NyaStruct& l, const NyaStruct& r)
	{	// 昇順は演算子>, 昇順は演算子<, if順の優先でソートされる
		return l.v > r.v;
	};
}

#define all(collection) (collection).begin(), (collection).end()              // begin to end
#define divc(a, b) ceil((ld) a / (ld) b);                                     // div ceiling
#define rep(i, begin, end) for (ll i = begin; i < end; i++)                   // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)                  // repeat reverse
#define size(collection) ((ll) (collection).size())                           // collection size
/********** for each macro **********/
#define fori(i, ...) if(ll i = -1) for(__VA_ARGS__) if(i++, true)
#define each(i, e, v) fori(i, auto& e: v)
#define forir(i, ...) if(ll i = size(v)) for(__VA_ARGS__) if(i--, true)
#define eachr(i, e, v) forir(i, auto& e: boost::adaptors::reverse(v))

using namespace NyaGadget;

int main(void)
{
	ll r; cin >> r;

	cout << r * r;
	return 0;
}

Measured memory_bytes: 256
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() { 
    string s;cin >> s;
    int ans = 0;
    rep(bit,(1<<(s.size()))) {
        if((bit>>s.size()-1)&1) break;
        string t = "";
        rep(i, s.size()) {
            if((bit>>i)&1) {
                t+=s[i];
                ans+=stoi(t);
                t="";
            }
            else {
                t+=s[i];
            }
            // cout << ans << endl;
            // cout << t << endl;
        }
        if(t!=""){
            ans+=stol(t);
            // cout << "OK\n";
        }
        // if(t!="")cout << t << endl;
        // cout << bitset<3>(bit) << endl;
        // cout << ans << endl;
    }
    cout << ans/*+stoi(s)*/ << endl;
    return 0;
}

Measured memory_bytes: 3624
n = gets.to_i
result = { AC: 0, WA: 0, TLE: 0, RE: 0}
n.times do
  s = gets.chomp.to_s
  result[s.to_sym] += 1
end

puts "AC x #{result[:AC]}" 
puts "WA x #{result[:WA]}" 
puts "TLE x #{result[:TLE]}" 
puts "RE x #{result[:RE]}" 


Measured memory_bytes: 14404
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            long a = Long.parseLong(in.next());
            long b = Long.parseLong(in.next());
            long c = Long.parseLong(in.next());
            long ans = 0;

            if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
                ans = 0;
            } else {
                ans = Math.min(b * c, c * a);
                ans = Math.min(ans, a * b);
            }
            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    ll x,y;
    cin>>x>>y;
    if(x%y==0)cout<<-1<<endl;
    else cout<<x<<endl;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

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

int main() {
  int n;
  cin >> n;
  double a = n - n / 2;
  cout << fixed << setprecision(10) << a / n << endl;
}


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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int, int>
#define all(x) x.begin(), x.end()
#define Matrix vector<vector<int>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = ((int64_t)2e18);
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

set<int> s;
void gen(int cur, int d, int k, bool f) {
  cur = cur * 10 + d;
  if (k == 11) {
    // debug(cur);
    // debug(s.size());
    s.emplace(cur);
    return;
  }

  if (f) {
    for (int i = 0; i <= 9; ++i)
      gen(cur, i, k + 1, (i == 0));
  }

  if (d > 0)
    gen(cur, d - 1, k + 1, false);
  gen(cur, d, k + 1, false);
  if (d < 9)
    gen(cur, d + 1, k + 1, false);
}

signed main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int t;

  // cin >> t;
  t = 1;
  // for (int i = 0; i <= 9; ++i)
  gen(0, 0, 0, true);

  while (t--) {
    int n;
    cin >> n;

    s.erase(0);

    auto it = s.begin();
    while (--n) {
      // debug(*it);
      ++it;
    }

    cout << *it << endl;
  }
}

Measured memory_bytes: 27520
//order_of_key(k): Number of items strictly smaller than k .
//find_by_order(k): K-th element in a set (counting from zero).
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define full(x,n) x,x+n+1
#define full(x) x.begin(),x.end()
#define finish return 0

#define putb push_back
#define f first
#define s second

//logx(a^n)=loga(a^n)/logx(a)
//logx(a*b)=logx(a)+logx(b)
//logx(y)=log(y)/log(x)

#define ordered_set tree<ll,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define putf push_front
#define gainb pop_back

#define gainf pop_front
#define len(x) (ll)x.size()

// 1/b%mod=b^(m-2)%mod
// (a>>x)&1==0

typedef double db;
typedef long long ll;

const ll ary=1e2+5;
const ll mod=1e9+7;
const ll inf=1e18;

using namespace std;
using namespace __gnu_pbds;
ll n,k;
vector< pair<ll,ll> > q;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>k;
	ll x=0,p=0;
	for(int i=2;i<=n;i++){
		q.putb({1,i});
		x+=p;
		p++;
	}
	if(x<k){
		cout<<-1;
		return 0;
	}
	for(int i=2;i<=n;i++){
		if(x==k){
			break;
		}
		for(int j=i+1;j<=n;j++){
			if(x==k){
				break;
			}
			x--;
			q.putb({i,j});
		}
	}
	if(x==k){
		cout<<len(q)<<"\n";
		for(int i=0;i<len(q);i++){
			cout<<q[i].f<<" "<<q[i].s<<"\n";
		}
		return 0;
	}
	cout<<-1;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>
#include<chrono>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

ll mod = 1e9 + 7;

namespace {
    ll mul(ll a, ll b) {
        ll val = a * b - (ll)((ld)a * b / mod) * mod;
        if (val < 0) val += mod;
        if (val >= mod) val -= mod;
        return val;
    }
    ll poww(ll a, ll b) {
        ll val = 1;
        a %= mod;
        while (b > 0) {
            if (b % 2) val = mul(a, val);
            a = mul(a, a);
            b >>= 1;
        }
        return val % mod;
    }
    ll inv(ll a) {
        return poww(a, mod - 2);
    }
}

ll const maxn = 5e5 + 5;

ll fact[maxn];

ll C(ll n, ll k) {
    return mul(fact[n], inv(mul(fact[n - k], fact[k])));
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("output.txt", "w", stdout);
    fact[0] = 1;
    for (ll i = 1; i < maxn; i++) fact[i] = mul(fact[i - 1], i);

    ll a; cin >> a;
    cout << a + a * a + a * a * a << endl;

    return 0;
}

/*

*/

Measured memory_bytes: 7516
#include <bits/stdc++.h>
#define N 350001
using namespace std;

int n, a[N], b[N], c[N * 15];

inline int read() {
	int x = 0, flag = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') flag = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - 48;
		ch = getchar();
	}
	return x * flag;
}

void add(int x, int v) {
	for (int i = x; i <= n; i += i & -i) c[i]++;
}

int query(int x) {
	int res = 0;
	for (int i = x; i; i -= i & -i) res += c[i];
	return res;
}

signed main() {
	n = read();
	for (int i = 1; i <= n; ++i) a[i] = read();
	int tot = 0;
	for (int i = n; i >= 1; --i) {
		tot += query(a[i]);
		add(a[i], 1);
	}
	for (int i = 1; i <= n; ++i) {
		if ((i & 1 && !(a[i] & 1)) || (!(i & 1)) && a[i] & 1) {
			puts("No");
			return 0;
		}
	}
	memset(c, 0, sizeof(c));
	int cnt = 0, tot1 = 0;
	for (int i = 1; i <= n; ++i) {
		if (i & 1)
		b[++cnt] = a[i];
	}
	for (int i = cnt; i >= 1; --i) {
		tot1 += query(b[i]);
		add(b[i], 1);
	}
	memset(c, 0, sizeof(c));
	cnt = 0;
	int tot2 = 0;
	for (int i = 1; i <= n; ++i) {
		if (!(i & 1))
		b[++cnt] = a[i];
	}
	for (int i = cnt; i >= 1; --i) {
		tot2 += query(b[i]);
		add(b[i], 1);
	}
//	printf("%lld %lld %lld\n", tot1, tot2, tot);
	if (3 * (tot1 + tot2) != tot) {
		puts("No");
		return 0;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 25892
s = input()

acgt = ['A','C','G','T']

acgt_num = 0
answer = 0
for i in range(len(s)):
    for j in range(4):
        if s[i] == acgt[j]:
            acgt_num += 1
            if i == len(s) - 1 and acgt_num > answer:
                answer = acgt_num
            break
        elif j == 3:
            if acgt_num > answer:
                answer = acgt_num
            acgt_num = 0

print(answer)


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

int main(){
  int n;
  long long k;
  cin>>n>>k;
  vector<pair<int,int>>atai(n);
  rep(i,n){
    cin>>atai[i].first>>atai[i].second;
  }
  sort(atai.begin(),atai.end());
  long long sum=0;
  rep(i,n){
    sum+=atai[i].second;
    if(sum>=k){
      cout<<atai[i].first<<endl;
      break;
    }
  }
  return 0;
}

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

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

    if ( (a+b) % 2 == 0 ){
        cout << (a+b)/2 << endl;
    }
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto a = readln.chomp.split.to!(int[]);
  int cnt;
  foreach (e; a) {
    while (e % 2 == 0) {
      e /= 2;
      cnt++;
    }
  }

  writeln(cnt);
}


Measured memory_bytes: 2684
//----------------------------------------------------------------------
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <string>
//----------------------------------------------------------------------
using namespace std;
int main(void) {
    int n; cin >> n;
    vector<long long> h(n);
    for(auto& v : h) {
        cin >> v;
    }

    int k = 1;
    int min = h[0];
    for(int i = 1; i < n; ++i) {
        if(min>=h[i]) {
            k++;
            min = h[i];
        }
    }

    cout << k << endl;
    return 0;
}



Measured memory_bytes: 1792