akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define MAX 200009
#define PI 3.141592653589793238
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in2.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << tp << ": ";
		int a, b, n;
		cin >> a >> b >> n;
		int maxi = 0;
		/*for(int x = 1; x <= n; x++){
			cout << x << " " << (a*x/b) << " "  << a*(x/b) << " " << (a*x/b) - a*(x/b) << '\n';
			maxi = max(maxi, (a*x/b) - a*(x/b));
		}*/
		int x = min(b-1, n);
		maxi = (a*x/b) - a*(x/b);
		cout << maxi;
		cout << '\n';
	}
	return 0;
}


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

#define FOR(k,m,n) for(int(k)=(m);(k)<(n);(k)++)
#define REP(k,n) FOR((k),0,(n))

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

using ll = long long;

const long long MAX = 1LL << 60;
// n 番目 (0-based)に到達するのに必要な最小のコスト
long long dp[100010];

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> hs(N);
    REP(i, N) {
        cin >> hs[i];
    }

    REP(i, N) {
        dp[i] = MAX;
    }
    dp[0] = 0;

    REP(i, N) {
        for (int j = 1; j <= K; ++j) {
            if (i - j >= 0) {
                chmin(dp[i], dp[i - j] + abs(hs[i - j] - hs[i]));
            }
        }
    }

    printf("%lld\n", dp[N - 1]);

    return 0;
}


/*
 * Local Variables:
 * compile-command: "CXXFLAGS='-std=c++14' make main"
 * End:
 */

Measured memory_bytes: 1408
N, M = map(int, input().split())
listA = list(map(int, input().split()))
i = len(listA)
tokuhyousuu = sum(listA)
a = -(-tokuhyousuu // (4 * M))
ninnkiList = [i for i in listA if not i < a]
ninnkisyouhinn = len(ninnkiList)
if ninnkisyouhinn < M:
    print('No')
else:
    print('Yes')

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-12;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=50000;
    rep(y,1,P){
        ll x=mod(y*k);
        
        if(abs(x)<=P||x+P>=i_7){
            if(x+P>=i_7){
                x-=i_7;
            }
            cout<<x<<"/"<<y<<endl;
            //cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
typedef vector<ll> vl;
//////////////////////////



int main(){fastio
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll ans=0;
    ll s[n];s[0]=a[0];rep(i,1,n-1)s[i]=mod(s[i-1]+a[i]);
    rep(i,1,n-1){
        Add(ans,s[i-1]*a[i]);
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 6788
#define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 50//00
#define MIN -100001
#define _MAX 100
int main(void)
{
	int a[_MAX] = { 0 }, x, max = 0;
	while (scanf_s("%d", &x) != EOF) {
		++a[x - 1];
		if (a[x - 1] > max) max = a[x - 1];
	}
	for (int i = 0; i < _MAX; ++i) {
		if (a[i] == max) {
			printf("%d\n", i + 1);
		}
	}
}	

Measured memory_bytes: 1188
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string
#include <vector> // vector
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <cstdint> // int64_t, int_fast64_t

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"

typedef std::int_fast64_t ll; // at least int64 > 9*10^18
typedef std::uint_fast64_t ull; // at least uint64

#define int ll

struct Interval
{
  int l,r;
  Interval() {}
  Interval(int l, int r) : l(l),r(r) {}
  int compute_sum() {
    int n = r-l;
    return n;
  }
};

signed main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n);
  rep(i,n) std::cin >> a[i];
  std::vector<Interval> intervals;
  int aor = 0;
  int sum = 0;
  int r=0;
  rep(l,n) {
    for(;r<=n;r++) {
      aor ^= a[r];
      sum += a[r];
      if(aor!=sum || r==n) {
        intervals.emplace_back(l,r);
        aor ^= a[r];
        sum -= a[r];
        aor^=a[l];
        sum-=a[l];
        break;
      }
    }
  }
  int ans = 0;
  for(auto i:intervals) {
    ans+=i.compute_sum();
  }
  std::cout << ans << ENDL;
  return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loop2(num) for (lli j = 0 ; j < num ; j ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }
#define looppu(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . push_back (x) ;}
#define loopin(num , ar) for (lli i = 0 ; i < num ;  i++) {lli x ; cin >> x ; ar . insert (x) ;}

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back ()
#define pof pop_front ()

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main ()
{
    fastio
    ll a , b , c ;
    cin >> a >> b >> c ;
    if (a == b && a == c)
        No ;
    else if (a == b)
        Yes ;
    else if (a == c)
        Yes ;
    else if (c == b)
        Yes ;
    else
        No ;

    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
using System;

class Program {
  static void Main(string[] args) {
    string[] str = Console.ReadLine().Split(' ');
    int H = int.Parse(str[0]);
    int W = int.Parse(str[1]);
    string[] picture = new string[H];

    for(int i = 0; i < H; ++i) {
      picture[i] = Console.ReadLine().Trim();
    }

    for(int i = 0; i < H; ++i) {
      Console.WriteLine(picture[i]);
      Console.WriteLine(picture[i]);
    }
  }
}


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

int main(){
    string S;
    string patternB = "", patternW = "";
    cin >> S;
    int N = S.length();
    const char unitB[2] = {'0', '1'};
    const char unitW[2] = {'1', '0'};

    int countB = 0, countW = 0;
    for(int i = 0; i < N; i++){
        if(unitB[i%2] != S[i]) countB++;
        if(unitW[i%2] != S[i]) countW++;
    }

    int out = min(countB, countW);
    cout << out << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>


long long chmax(long long &a, long long b) {
	return a = std::max(a, b);
}

int main() {
	int n; std::cin >> n;
	std::vector<std::pair<long long, int>> a(n);
	for (int i = 0; i < n; i++) std::cin >> a[i].first, a[i].second = i + 1;
	std::sort(a.rbegin(), a.rend());
	std::vector<std::vector<long long>> dp(n + 1, std::vector<long long>(n + 1, -1));
	dp[0][0] = 0;
	for (int id = 0; id < n; id++) {
		long long num = a[id].first;
		int t = a[id].second;
		for (int i = 0; i <= id; i++) {
			int left = i;
			int right = id - i;
			chmax(dp[left + 1][right], dp[left][right] + num*abs(left + 1 - t));
			chmax(dp[left][right + 1], dp[left][right] + num*abs(n - right - t));
		}
	}
	long long ans = 0;
	for (int i = 0; i <= n; i++) {
		int left = i;
		int right = n - i;
		chmax(ans, dp[left][right]);
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 34624
#include <stdio.h>
int main(void){
int hi,koku,suu,kokud,suud;
int n=0,m=0;
scanf("%d",&hi);
scanf("%d",&koku);
scanf("%d",&suu);
scanf("%d",&kokud);
scanf("%d",&suud);
while(!(koku<=0)){
koku-=kokud;
n++;
}
while(!(suu<=0)){
suu-=suud;
m++;
}
if(n>=m){
hi-=n;
}
else{
hi-=m;
}
printf("%d\n",hi);
return 0;
}

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

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

template <typename T>
inline void read(T &x)
{
    T data = 0, f = 1;
    char ch = getchar();
    while (!isdigit(ch))
    {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (isdigit(ch))
    {
        data = (data << 3) + (data << 1) + ch - '0';
        ch = getchar();
    }
    x = f * data;
}

const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int maxn = 1e5 + 9;
int m[109];
signed main()
{
    //freopen("in.txt","r",stdin);
    //freopen("data.txt","w",stdout);
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    //std::cout.tie(0);
    int n;
    read(n);
    int ans = 0;
    for (int i = 1; i <= n; ++i)
        read(m[i]);
    sort(m + 1, m + n + 1);
    for (int i = 1; i <= n; ++i)
    {
        for (int j = i + 1; j <= n; ++j)
        {
            if (m[i] == m[j])
                continue;
            for (int k = j + 1; k <= n; ++k)
            {
                if (m[k] == m[j])
                    continue;
                if (m[i] + m[j] > m[k])
                    ans++;
            }
        }
    }
    cout << ans << '\n';
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

Measured memory_bytes: 3636
from collections import deque
N = int(input())
s = input().split()
a = [int(i) for i in s]

b = deque()

for i in range(N) : 
    if i % 2 == 0 : b.append(a[i])
    if i % 2 == 1 : b.appendleft(a[i])

if i % 2 == 0 : b.reverse()        

print(" ".join(map(str, b)))

Measured memory_bytes: 45120
/*  ex9_1
    potter0723sw  */

#include <stdio.h>
#include <stdlib.h>
//スタックに格納するデータの最大数
#define SIZE 10

//スタックの定義
typedef struct stack{
    int size;
    int count;
    char data[SIZE];
    char *top;
} stack;

//スタックの初期化
void initialize_stack(stack *stk){
    stk->count = 0;
    stk->size = SIZE;
    stk->top = &(stk->data[SIZE]);
}

//データの追加
void push(stack *stk, char elem){
    if(stk->count >= stk->size){
        fprintf(stderr, "Error: stack overflow. (x=%c)\n", elem);
        exit(1);
    }
    else{
        stk->top--;
        *(stk->top) = elem;
        stk->count++;
    }
}

//データの取り出し
char pop(stack *stk){
    char latest;
    if(stk->count <= 0){
        fprintf(stdout, "Error: stack underflow.\n");
        exit(1);
    }
    else{
        latest = *(stk->top);
        stk->top++;
        stk->count--;
        return latest;
    }
}

int main(void){
    int i;
    stack stk;
    char input[11],ans[11];
    //スタックを初期化
    initialize_stack(&stk);
    //配列を初期化（入力で使われていない文字に変更）
    for(i=0; i<11; i++){
        input[i] = 'a';
        ans[i] = 'a';
    }
    scanf("%s", input);
    //iを初期化
    i=0;
    //入力を始めの方から処理
    while(input[i] != '\0'){
        if(input[i] == 'B'){
            if(stk.count != 0){//スタックに何もない場合はpopしない
                pop(&stk);
            }
        }else{
            push(&stk, input[i]);
        }
        i++;
    }
    //スタック内に残った文字を後ろからansに格納
    for(i = stk.count - 1; i >= 0; i--){
        ans[i] = pop(&stk);
    }
    //文字数分だけ出力
    i = 0;
    while(ans[i] != 'a'){
        printf("%c", ans[i]);
        i++;
    }
    //改行出力
    printf("\n");
    return 0;
}


Measured memory_bytes: 1624
#include <queue>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

const int N=5e3+2;

template <typename _Tp> inline void IN(_Tp&x) {
    char ch;bool flag=0;x=0;
    while(ch=getchar(),!isdigit(ch)) if(ch=='-') flag=1;
    while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
    if(flag) x=-x;
}

int head[N],dis[N],vis[N],QAQ[N],cnt,n,m,p;
struct Edge {int nxt,w,to;} G[N<<1]; 
inline void add(int u,int v,int w) {
	G[++cnt].nxt=head[u],G[cnt].to=v,G[cnt].w=w,head[u]=cnt;
}
inline void Spfa() {
	memset(dis,127,sizeof(dis));
    int inf=-(1e9+7);
	deque<int> q;q.push_back(1),dis[1]=0,vis[1]=true;
	while(!q.empty()) {
		int u=q.front();q.pop_front();++QAQ[u],vis[u]=false;
        if(QAQ[u]>=n) dis[u]=inf;
		for(int i=head[u];i;i=G[i].nxt) {
			int v=G[i].to;
			if(dis[u]+G[i].w<dis[v]&&QAQ[v]<n) {
				dis[v]=dis[u]+G[i].w;     
			    if(vis[v]==false)
				    v<q.front()?q.push_front(v):q.push_back(v),vis[v]=true; 
		    }
		}
	}
}

int main() {
    IN(n),IN(m),IN(p);
    for(int i=1,a,b,c;i<=m;++i)
        IN(a),IN(b),IN(c),add(a,b,-(c-p));
    Spfa();
    if(dis[n]<-5e8) puts("-1");
    else printf("%d\n",(dis[n]<0)?-dis[n]:0);
    return 0;
}

Measured memory_bytes: 384
// B.

#include <sstream>
#include <iostream>
#include <vector>
#include <set>

using namespace std;

typedef long long LL;

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }

int main(int argc, char *argv[])
{
	int n;
	cin >> n;
	vector<int> ans;
	set<int> s;
	LL sum = 0;
	for (int i = 2; i <= 30000; ++i) {
		if ((i % 2) == 0 || (i % 3) == 0) {
			ans.push_back(i);
			sum += i;
			if (ans.size() >= n) {
				break;
			}
			s.insert(i);
		}
	}
	for (int i = 2; i <= 30000; ++i) {
		if (s.find(i) == s.end()) {
			sum -= ans[n - 1];
			ans[n - 1] = i;
			sum += i;
			bool ok = true;
			for (int j = 0; j < n; ++j) {
				LL g = gcd(ans[j], sum - ans[j]);
				if (g <= 1) {
					ok = false;
					break;
				}
			}
			if (ok) {
				break;
			}
		}
	}
	for (int i = 0; i < n; ++i) {
		cout << (i ? " " : "") << ans[i];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<bitset>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

int main(){
    string a;
    int n;
    while(cin >> a >> n){
        int cnt = 0;
        for(int i=0; i < n; i++){
            int h;
            cin >> h;
            cnt += h;
        }
        cnt %= a.size();
        for(int i=0; i < cnt; i++){
            a += a[0];
            a.erase(a.begin());
        }
        cout << a << endl;
    }
}




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

int N;
string s,t;
int main(){
  cin>>N>>s>>t;

  for(int i=0;i<N;i++){
    if(s.substr(i) == t.substr(0,N-i)){
      cout<<(s+t.substr(N-i)).size()<<endl;
      return 0;
    }
  }

  cout<<N+N<<endl;
  return 0;
}



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

using namespace std;

int main(){

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<pair<int, int>> XL(N);
    for(int i=0; i<N; i++){
        cin >> XL.at(i).first >> XL.at(i).second;
        XL.at(i).first += XL.at(i).second;
    }
    sort(XL.begin(), XL.end());
    int count=1;
    int last=0;
    for(int i=0; i<N; i++){
        if (XL.at(last).first <= XL.at(i).first - 2 * XL.at(i).second){
            last = i;
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 1024
n=int(input())
monsters=[int(x) for x in input().split(' ')]
powers=[int(x) for x in input().split(' ')]
ans=0
for i in range(n):
	t=min(monsters[i],powers[i])
	ans+=t
	t2=min(monsters[i+1],powers[i]-t)
	ans+=t2
	monsters[i+1]-=t2
print(ans)

Measured memory_bytes: 18624
import static java.lang.Integer.parseInt;

public class Main {
    public static void main (String[] args) {
        String line = new java.util.Scanner ( System.in ).nextLine();
        String[] number = line.split(" ", 0);
        String ans = Range(parseInt(number[0]),parseInt(number[1]),parseInt(number[2]));
        System.out.println(ans);
    }
    public static String Range(int x ,int y , int z){
        if (x < y && y < z) {
            return "Yes";
        }
        else {
            return "No";
        }
    }
}

Measured memory_bytes: 26088
def main():
    n,m = map(int, input().split())
    A = list(map(int, input().split()))

    A.sort()
    A.reverse()
    for i in range(m):
        if A[i] < sum(A)*1/(4*m):
            print('No')
            return
    print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define VI vector<int>
#define PII pair<int, int>
#define FI first
#define SE second
#define ALL(x) (x).begin(), (x).end()
const int INF=1<<30;
const ll LINF=1LL<<60 ;
const ll MOD=1e9+7 ;
///////////////////
const int MXN = 2*100000 + 7;

class UnionFind {
private:
	unsigned size_; std::vector<unsigned> par, rank;
public:
	UnionFind() : size_(0), par(std::vector<unsigned>()), rank(std::vector<unsigned>()) {};
	UnionFind(unsigned size__) : size_(size__) {
		par.resize(size_); rank.resize(size_);
		for (unsigned i = 0; i < size_; i++) par[i] = i, rank[i] = 0;
	}
	unsigned size() { return size_; }
	unsigned root(unsigned x) { return par[x] == x ? x : par[x] = root(par[x]); }
	bool same(unsigned x, unsigned y) { return root(x) == root(y); }
	void unite(unsigned x, unsigned y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++;
		else par[y] = x;
	}
	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};

int num[MXN];

int main(){
	int n,k,l; scanf("%d %d %d", &n, &k, &l);
	UnionFind ufc(n+1);
	UnionFind uft(n+1);
	FOR(i,1,k){
		int p,q; scanf("%d %d", &p, &q);
		ufc.unite(p,q);
	}
	FOR(i,1,l){
		int r,s; scanf("%d %d", &r, &s) ;
		uft.unite(r,s);
	}

	map<pair<int, int>, int> cnt;

	FOR(i,1,n){
		cnt[MP(ufc.root(i), uft.root(i))]++;
	}

	FOR(i,1,n){
		cout << cnt[MP(ufc.root(i), uft.root(i))] << ' ';
	}
    return 0;
}

Measured memory_bytes: 15104
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define pd(x) printf("%lf\n", x)
#define ps(x) printf("%s\n", x)
 
#define INF 1000000000000000000
#define MOD 1000000007
 
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))

typedef struct data {
	long id;
	long num;
} DATA;

DATA yama[100010];

long N, M;
long a[300001];
long ans[100010] = {0};

int compare_long(const void *a, const void *b) {
	return *(long*)a - *(long*)b;
}

int comp_yama(const void *c1, const void *c2) {
	DATA d1 = *(DATA *)c1;
	DATA d2 = *(DATA *)c2;
	int t1 = d1.num;
	int t2 = d2.num;
	
	return t2 - t1;
}

int main() {
	long i, j;
	long min_id;
	long pre = 0;
	long sum = 0;
	
	sl(N);
	
	for(i=0;i<N;i++) {
		sl(yama[i].num);
		yama[i].id = i + 1;
	}
	
	qsort((void *)yama, N, sizeof(DATA), comp_yama);
	
	min_id = yama[0].id;
	for(i=1;i<N;i++) {
		sum += i * (yama[i-1].num - yama[i].num);
		ans[min_id] += i * (yama[i-1].num - yama[i].num);
		if(min_id > yama[i].id) {
			min_id = yama[i].id;
		}
	}
	ans[min_id] += i * yama[i-1].num;
	
	for(i=1;i<=N;i++) {
		pl(ans[i]);
	}
	
	return 0;
}

Measured memory_bytes: 5088
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;
template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T> inline void chmax(T &a, const T &b) { if ((a) < (b)) (a) = (b); }
template <class T> inline void chmin(T &a, const T &b) { if ((a) > (b)) (a) = (b); }
template <typename X, typename T> auto make_table(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto make_table(X x, Y y, Z z, Zs... zs) { auto cont = make_table(y, z, zs...); return vector<decltype(cont)>(x, cont); }

#define cdiv(a, b) (((a) + (b)-1) / (b))
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x) sort(all(x)); x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef long double ld;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
void check_input() { assert(cin.eof() == 0); int tmp; cin >> tmp; assert(cin.eof() == 1); }

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
template<class T=ll> using vec = vector<T>;
struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;


int solve() {
    ll x,k,d;cin>>x>>k>>d;

    x = abs(x);

    ll c = x/d;
    if (c >= k) {
        cout << x - k * d << endl;
    }
    else{ // c < k
        k -= c;
        if (k%2 == 0){
            cout << x - c*d << endl;
        }
        else{
            cout << abs(x - (c+1)*d) << endl;
        }
    }

    return 0; 
}


int main(){/*{{{*/
    solve();
    check_input();
    return 0;
}/*}}}*/


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
long long int mod =  1e9 + 7;
int main() {
  long long int n,m;
  cin>>n>>m;
  long long int arr[n];
 long long int brr[m];
  for(int i = 0;i<n;i++)
  {
      cin>>arr[i];
  }
    for(int i = 0;i<m;i++)
  {
      cin>>brr[i];
  }
 long long int dp[n+1][m+1];
for(int i = 0 ;i <=n; i++ )
{
    for(int j = 0;j<=m;j++)
    {
        if(i==0 || j==0)
        {
            dp[i][j] = 1;
        }else
        {
               if(arr[i-1]==brr[j-1])
               {
                   dp[i][j] = (dp[i][j-1] + dp[i-1][j] + mod)%mod;
               } else{
                   dp[i][j] = (dp[i][j-1] + dp[i-1][j] - dp[i-1][j-1] +mod)%mod;
               }

        }

    }

}
cout<<dp[n][m];


}


Measured memory_bytes: 31616
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}

func Ancestor(A []int, v, n int) int {
  u := v
  for i := 0; i < n; i++ {
    if u == 0 { return u }
    u = A[u] - 1
  }
  return u
}

func Solve() {
  var N, K int
  NextInt(&N, &K)
  var A []int
  NextIntVec(&A)
  T := make([][]int, N)
  for i := range T {
    T[i] = make([]int, 0)
  }
  for i, a := range A {
    T[a - 1] = append(T[a - 1], i)
  }
  D := make([]int, N)
  for i := range D[1:] {
    D[i + 1] = -1
  }
  Q := make([]int, N)
  pos := 1
  for _, q := range Q {
    for _, adj := range T[q] {
      if 0 <= D[adj] { continue }
      D[adj] = D[q] + 1
      Q[pos] = adj
      pos++
    }
  }
  cnt := 0
  if A[0] != 1 { cnt++ }
  V := make([]int, N)
  _Q := make([]int, 0)
  for i := N - 1; 0 <= i; i-- {
    v := Q[i]
    if D[v] <= K { break }
    if 0 < V[v] { continue }
    u := Ancestor(A, v, K - 1)
    _Q = append(_Q, u)
    V[u] = 1
    for 0 < len(_Q) {
      q := _Q[0]
      _Q = _Q[1:]
      for _, adj := range T[q] {
        if D[adj] < D[q] { continue }
        V[adj] = V[q] + 1
        if V[adj] < K { _Q = append(_Q, adj) }
      }
    }
    cnt++
  }
  Write(cnt)
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 10240
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cnt = Counter(a)
s = sum(a)
q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    if b not in cnt.keys():
        print(s)
        continue
    t = cnt.pop(b)
    s -= b * t
    cnt[c] += t
    s += c * t
    print(s)


Measured memory_bytes: 21604
from operator import itemgetter
N, M = map(int, input().split())
drink = []
for i in range(N):
    Ai, Bi = map(int, input().split())
    drink.append([Ai,Bi])

drink.sort(key=itemgetter(0))
yen = 0
m = 0
for n in range(N):
    if drink[n][1]+m < M:
        m += drink[n][1]
        yen += drink[n][0]*drink[n][1]
    else:
        yen += (M-m)*drink[n][0]
        break
print(yen)


Measured memory_bytes: 21272
def bubbleSort(R, N):
	flag = True
	cnt = 0
	while flag == True:
		flag = False
		for j in range(N - 1, 0, -1):
			if R[j] < R[j - 1]:
				tmp = R[j]
				R[j] = R[j - 1]
				R[j - 1] = tmp
				cnt = cnt + 1
				flag = 1
	print(" ".join(map(str, R)))
	return cnt

if __name__ == '__main__':
	n = int(input())
	A = list(map(int, input().split()))
	ans = bubbleSort(A, n)
	print(ans)

Measured memory_bytes: 7772
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int n;
int main() {
	cin >> n;
	cout << ((n / 10) % 111 == 0 || (n % 1000) % 111 == 0 ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;


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

	int a, b;
	cin >> a >> b;

	int money;
	if (a <= 5)
		money = 0;
	else if (a <= 12)
		money = b / 2;
	else
		money = b;

	cout << money << '\n';
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { //Simulate flip processes
	//UPD: Don't always need to take max rows

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		int K = input.nextInt();
		System.out.println(Valid(N,M,K)?"Yes":"No");
	}	
	public static boolean Valid(int N,int M,int K) {
		for (int r = 0; r <= N; r++) {
			int numB = r*M;
			for (int c = 0; c <= M; c++) {
				int leftrows = N-r;
				int net = leftrows-r;
				int total = numB+c*net;
				if (total==K) {
					return true;
				}
			}
		}
		return false;
	}
}

Measured memory_bytes: 24276
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int sum=0;
    int a[1001];
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]%2!=0 && i%2!=0)
            sum++;
    }
    printf("%d",sum);
    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int M = int.Parse(input[1]);
            int[] observatory = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int[] good = Array.ConvertAll(observatory, x => x - x);

            for(int i= 0; i < M; i++)
            {
                int[] load = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
                int to = load[0];
                int from = load[1];
                if (observatory[to - 1] > observatory[from - 1])
                {
                    good[from - 1] += 1;
                }
                else if(observatory[to - 1] < observatory[from - 1])
                {
                    good[to - 1] += 1;
                }
                else
                {
                    good[from - 1] += 1;
                    good[to - 1] += 1;
                }
            }

            Console.WriteLine(Array.FindAll(good,x=> x==0).Length);
        }
    }
}


Measured memory_bytes: 48700
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  ll X,Y,Z;cin>>X>>Y>>Z;
  cout<<(X-Z)/(Y+Z)<<endl;
  return 0;
}

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

#define int long long 

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}
 
void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

const int maxn = 1e5+10;
const int inf = 1e9;
const lf eps = 1e-8;

int p[maxn],n,c,l,t;

signed main() {
    read(n),read(l),read(t);
    for(int i=1,x;i<=n;i++) {
        read(p[i]),read(x);x=x==2?-1:x;p[i]+=x*t;
        if(p[i]>0) c+=p[i]/l;
        else if(p[i]<0) c+=(p[i]+1)/l-1;p[i]=(p[i]%l+l)%l;
    }sort(p+1,p+n+1);c=(c%n+n)%n;
    for(int i=c+1;i<=n;i++) write(p[i]);
    for(int i=1;i<=c;i++) write(p[i]);
    return 0;
}


Measured memory_bytes: 1920
a,b,x = gets.split.map(&:to_i)

if x > (a**2 * b) * 0.5
  X = 2 * (a**2 * b - x)
  Y = a**3
else
  X = b
  Y = (2.0 * x) / (a * b)
end

p Math.atan2(X, Y) * 180.0 / Math::PI


Measured memory_bytes: 1916
//K-OS WITH THE OCDE

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <iostream>
#include <numeric>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <deque>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <climits>

using namespace std;

typedef long long int ll;
typedef long double db;


#define TEST ll t; cin>>t; while(t--)
#define vell vector<ll>
#define pl pair<ll,ll>
#define all(v) v.begin(),v.end()
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define dbg(x)  cerr << #x << ": "<< x <<endl
#define dbg2(x,y) cerr<< #x <<": "<< x <<" || "<< #y << ": " << y << endl

#define endl "\n"
#define MAX 1e18
#define MIN INT_MIN
#define mod 998244353

ll add(ll a, ll b)  { return ((a % mod + b % mod) % mod); }
ll sub(ll a, ll b)  { return ((a % mod - b % mod) % mod); }
ll mult(ll a, ll b) { return (((a % mod) * (b % mod)) % mod); }

void solve()
{
	ll n, k;
	cin >> n >> k;
	ll f[n + 2] = {0};
	ll l[k] , r[k];

	for (ll i = 0 ; i < k ; ++i) {
		cin >> l[i] >> r[i];
		f[l[i]]++;
		f[r[i] + 1]--;
	}

	map <ll, ll> mp;

	for (ll i = 1 ; i <= n ; ++i) {
		f[i] += f[i - 1];
	}

	for (ll i = 1 ; i <= n ; ++i) {
		if (f[i])
			mp[i]++;
	}

	ll dp[n + 1] = {0} , pref[n + 3] = {0};

	dp[n] = 1;
	pref[n] = 1;
	ll g = 0;

	for (ll i = n - 1 ; i >= 1 ; --i) {

		for (ll j = 0 ; j < k ; ++j) {

			ll x = l[j] + i;
			ll y = r[j] + i;
            // dbg2(l[j] , r[j]);
			if (x > n)
				continue;


			y = min(y , n);

			// dbg2(x, y);

			g = add(g , pref[x] - pref[y + 1]);
		}

		pref[i] += g;
	}

	cout << (g + mod) % mod ;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0); cin.tie(0);
	//TEST
	solve();
}



Measured memory_bytes: 20724
n,m,q = map(int,input().split())
a = [[int(i) for i in input().split()] for _ in range(q)]
b = []
for i in range(m):
    b.append(i+1)
import itertools
l = list(itertools.combinations_with_replacement(b,n))
max=0
#print(l)                                                                      
for ll in l:
    m=0
    for aa in a:
        if ll[aa[1]-1]-ll[aa[0]-1]==aa[2]:
            m+=aa[3]
    if max < m:
        max=m
print(max)


Measured memory_bytes: 21484
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
int main()
{
  string s;
  cin >> s;
  // cout << s.size() << endl;
  if(s[s.size()-1] != 's') s += "s";
  else s += "es";
  cout << s << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less

#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define FASTIO ios::sync_with_stdio(0); cin.tie(0);
#define show(x) cerr << #x << " = " << x << "\n"
#define mem( a , b ) memset( a , b , sizeof a )
#define popcnt(x) __builtin_popcount(x)
#define all(x) x.begin() , x.end()
#define mod(x,m) ((x%m + m )%m)
#define SZ(a) (int)a.size()
#define ll  long long
#define ld  long double
#define vii vector  <ll>
#define dqi deque   <ll>
#define sii set     <ll>
#define vpi vector  <pii>
#define mii map     <ll,ll>
#define pii pair    <ll,ll>
#define pi  pair    <int,int>
#define pb  push_back
#define F   first
#define S   second
#define L   length()
#define OO  (ll)1e18
#define EPS 1e-9
using namespace std;
using namespace __gnu_pbds;
void ONLINE__JUDGE();

typedef tree<ll, null_type, less<ll>, rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
pii swapii( pii pr ){ return { pr.S , pr.F }; }
ll binEXP( ll x , ll pw , ll MOD = LLONG_MAX );
int dx[] = {  0 ,  0 , -1 , +1 , -1 , +1 , -1 , +1 };
int dy[] = { -1 , +1 ,  0 ,  0 , -1 , +1 , +1 , -1 };

const ll MOD = 1e9 + 7;
const ll MAX = 1e5 + 7;

ll dp[MAX]; vii adj[MAX];
ll x, y;

ll go( ll u ){

    if ( SZ(adj[u]) == 0 ) return 0;
    if ( ~dp[u] ) return dp[u];

    ll mx = 0;
    for ( ll i : adj[u] ){
        mx = max( mx , go(i) + 1 );
    }
    return dp[u] = mx;
}
int main()
{
    FASTIO //ONLINE__JUDGE();

    cin >> x >> y;
    for ( int i = 0; i < y; ++i ){
        ll u , v; cin >> u >> v;
        adj[u].pb(v);
    }

    mem( dp , -1 ); ll mx = 0;
    for ( int i = 1; i <= x; ++i ){
        mx = max( mx , go(i) );
    }
    cout << mx;
    return 0;
}

void ONLINE__JUDGE()
{
    #ifndef ONLINE_JUDGE
    freopen( "inp.c"         , "r" , stdin  );
    //freopen( "OutPut.txt"   , "w" , stdout );
    #endif // ONLINE_JUDGE
}

ll binEXP( ll x , ll pw , ll MOD )
{ ll res=1; while(pw>0){ pw%2 ? res *= x : 0; x *= x; x%=MOD; pw /= 2; res%= MOD; } return res%=MOD; }


Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define vl          vector<ll>
#define vi          vector<int>
#define pi          pair<int,int>
#define pl          pair<ll,ll>
#define all(a)      a.begin(),a.end()
#define mem(a,x)    memset(a,x,sizeof(a))
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define endl 		"\n"
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define fast_io     std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define trace(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1) {std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " : " << arg1;
	ZZ(comma, args...);
}

void solve() {
	ll n;
	cin >> n;
	if (n <= 26) {
		char c = (char)('a' + n - 1);
		cout << c;
		return;
	}
	vector<char> cc;
	while (n) {
		ll k = n;
		// trace(k)
		ll kk = k % 26;
		if (!kk)kk = 26;
		cc.pb((char)('a' + kk - 1));
		// trace(kk, (char)('a' + kk - 1));
		if (k % 26 == 0)k--;
		k /= 26;
		n = k;
		// if (kk == 26 && n == 1)break;
	}
	reverse(all(cc));
	rep(i, 0, cc.size())cout << cc[i];
}
int main() {
	fast_io;
	int t = 1;
	// cin>>t;
	while (t--) {
		solve();
	}
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 3624
// F.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>

using namespace std;

int n, u, v, ans, ami;
vector<vector<int>> e;
vector<int> ad;
vector<int> bd;
vector<int> cd;

void dfs1(int n, int d) {
	if (bd[n] >= 0) return;
	bd[n] = d;
	for (int nx : e[n]) {
		dfs1(nx, d + 1);
	}
}

void dfs2(int n, int d) {
	if (ad[n] >= 0 || d > bd[n]) return;
	ad[n] = d;
	ans = max(ans, d);
	if (d >= bd[n]) return;
	if (ami < 0 || bd[n] < bd[ami]) {
		ami = n;
	}
	for (int nx : e[n]) {
		dfs2(nx, d + 1);
	}
}

void dfs3(int n, int d) {
	if (d <= cd[n] || d > bd[n]) return;
	cd[n] = d;
	ans = max(ans, d);
	if (d >= bd[n]) return;
	for (int nx : e[n]) {
		dfs3(nx, d + 1);
	}
}

int main(int argc, char* argv[]) {
	cout.precision(20);
#ifdef _MSC_VER
	while (true)
#endif
	{
		ans = 0, n = -1, ami = -1;
		cin >> n >> u >> v;
		if (n <= 0) return 0;
		e.clear();
		e.resize(n);
		for (int i = 1; i < n; ++i) {
			int a, b;
			cin >> a >> b;
			e[a - 1].push_back(b - 1);
			e[b - 1].push_back(a - 1);
		}
		ad = vector<int>(n, -1);
		bd = vector<int>(n, -1);
		cd = vector<int>(n, -1);
		dfs1(v - 1, 0);
		dfs2(u - 1, 0);
		if (ami >= 0) {
			dfs3(ami, ad[ami]);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 9472
s=input()
n=len(s)
k=int(input())
lst=list(s)
lst.sort()
ans=[]
for i in range(min(k,n)):
    a=lst[i]
    count=0
    for j in range(n):
        if s[j]==a:
            count+=1
            for l in range(min(5,n-j)):
                ans.append(s[j:j+l+1])
    if count>=5:
        break
ans.sort()
t=1
while t<len(ans):
    if ans[t]==ans[t-1]:
        ans.pop(t)
    else:
        t+=1
print(ans[k-1])

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  stack<int> stk1;
  stack<pair<int,int> > stk2;
  int h = 0, maxH = 0;
  stk2.push(make_pair(h, 0));
  int sum = 0;
  for(int i = 0; i < n; ++i) {
    int v = 0;
    if(s[i] == '/' && stk1.size()) {
      int prev = stk1.top();
      stk1.pop();
      v = i - prev;
      sum += v;
    } else if(s[i] == '\\') {
      stk1.push(i);
    }
    
    if(s[i] == '/') ++h;
    else if(s[i] == '\\') --h;
    while(h <= maxH && stk2.size() && stk2.top().first < h) {
      v += stk2.top().second;
      stk2.pop();
    }
    maxH = max(maxH, h);
    stk2.push(make_pair(h, v));
  }
  vector<int> ans;
  while(stk2.size()) {
    if(stk2.top().second) ans.push_back(stk2.top().second);
    stk2.pop();
  }
  reverse(ans.begin(), ans.end());
  cout << sum << endl;
  cout << ans.size();
  for(int i = 0; i < ans.size(); ++i) {
    cout << " " << ans[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1476
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<char,int>;
const int inf = numeric_limits< int >::max()/3;

int bit[200010];
int dp[100000000];

int main(void){
  string s;
  cin >> s;
  int n = (int)s.size();
  fill(bit,bit+200010,0);
  fill(dp,dp+100000000,inf);
  bit[0] = 0;
  for(int i = 0;i < n;++i){
    bit[i+1] = bit[i] ^ (1 << s[i]-'a');
  }
  dp[0] = 0;
  for(int i = 1;i <= n;++i){
    int calc = dp[bit[i]] + 1;
    for(int j = 0;j < 26;++j){
      int mask = 1 << j;
      calc = min(calc,dp[bit[i]^mask]+1);
    }
    dp[bit[i]] = min(dp[bit[i]],calc);
    if(i == n)cout << calc << endl;
  }
  return 0;
}


Measured memory_bytes: 392068
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll i;
    ll a=0,b=0,t;
    for(i=0;i<N;i++){
        cin >> t;
        if(t%4==0)a++;
        else if(t%2==0)b++;
    }
    if(2*a+max((ll)1,b)>=N)cout<<"Yes"<<endl;else cout << "No" <<endl;
    return 0;
}


Measured memory_bytes: 256