akhauriyash/Code-Regression huggingface dataset:
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, K;
    cin >> N >> K;
    vector<int> V(N);
    int S = 0;
    for (int i = 0; i < N; i++) {
        cin >> V[i];
        S += V[i];
    }

    int ret = INF;

    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N; j++) {
            if (i + j > N) continue;
            if (i + j > K) continue;
            int remain = K - (i + j);

            int tmp = 0;
            for (int l = i; l < N - j; l++) tmp += V[l];

            vector<int> removed;
            for (int l = 0; l < i; l++) removed.push_back(V[l]);
            for (int l = N - j; l < N; l++) removed.push_back(V[l]);
            sort(removed.begin(), removed.end());

            for (int l = 0; l < remain; l++) {
                if (l >= removed.size()) break;
                if (removed[l] > 0) break;
                tmp += removed[l];
            }

            ret = min(ret, tmp);
        }
    }

    cout << S - ret << endl;
    return 0;
}

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

int gcd(int a, int b)
{
    int c;

    if (a < b) {
        a+=b; b=a-b; a-=b;
    }

    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

int main(void){
    string s;
    cin >> s;
    int a, b, c;
    a = stoi(s.substr(0, 4));
    b = stoi(s.substr(5, 2));
    c = stoi(s.substr(8, 2));
    if (a > 2019) cout << "TBD" << endl;
    else if (a == 2019 && b > 4) cout << "TBD" << endl;
    else cout << "Heisei" << endl;


}

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

using namespace std;

using LL = long long;

template<typename T>
ostream& operator << (ostream& out, const vector<T>& v) {
    out << "[";
    for(auto& x : v) {
        out << x << ", ";
    }
    return out << "]";
}

template<typename S, typename T>
ostream& operator << (ostream& out, const pair<S, T>& p) {
    return out << "{" << p.first << ", " << p.second << "}";
}

void solve() {
    LL N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    unordered_map<LL, LL> dist;
    auto cmp = [](const pair<LL, LL>& x, const pair<LL, LL>& y) {
        return x.second > y.second;
    };
    priority_queue<pair<LL, LL>, vector<pair<LL, LL>>, decltype(cmp)> Q(cmp);
    auto insertQ = [&](LL n, LL d) {
        if(not dist.count(n) or dist[n] > d) {
            dist[n] = d;
            Q.emplace(n, d);
        }
    };
    insertQ(N, 0);
    while(Q.size()) {
        auto t = Q.top();
        Q.pop();
        LL n = t.first;
        LL d = t.second;
        if(n == 0) {
            cout << d << "\n";
            return;
        } else if(n == 1) {
            cout << (d + D) << "\n";
            return;
        }
        if(double(n) * double(D) <= 1e18) {
            insertQ(0, d + n * D);
        }
        if(n % 2 == 0) {
            insertQ(n / 2, d + A);
        } else {
            insertQ(n / 2, d + A + D);
            insertQ(n / 2 + 1, d + A + D);
        }
        if(n % 3 <= 1) {
            insertQ(n / 3, d + B + (n % 3) * D);
        } else {
            insertQ(n / 3 + 1, d + B + D);
        }
        if(n % 5 <= 2) {
            insertQ(n / 5, d + C + (n % 5) * D);
        } else {
            insertQ(n / 5 + 1, d + C + (5 - (n % 5)) * D);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int T;
    cin >> T;
    while(T--) {
        solve();
    }
    
    
    return 0;
} 


Measured memory_bytes: 3944
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> a(h); 
    rep(i, h) cin >> a[i];
    rep(i, w+2) cout << '#';
    cout << endl;
    rep(i, h) cout << '#' << a[i] << '#' << endl;
    rep(i, w+2) cout << '#';
    cout << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <stdlib.h>
#define inf 100000000

using namespace std;

int n, m;
int g[105][105];

bool used[105];
vector<int> vec;
int table[20][20];

int calc()
{
	int mi, ret = 0;
	for(int i = 0; i < vec.size(); i++){
		mi = inf;
		for(int j = 0; j < vec.size(); j++){
			if(i == j) continue;
			mi = min(mi, g[vec[i]][vec[j]]);
		}
		if(mi == inf) mi = 0;
		ret += mi;
	}
	return ret;
}

int dfs()
{
	int ret = calc();
	int mi = inf;
	
	if(vec.size() >= 14) return ret;
	for(int i = vec.back()+1; i <= n; i++){
		for(int j = 0; j < vec.size(); j++){
			if(g[vec[j]][i] == 0) goto NG;
		}
		vec.push_back(i);
		ret = max(ret, dfs());
		vec.pop_back();
		NG:;
	}
	return ret;
}

int main(void)
{
	cin >> n >> m;
	int u, v, f;
	for(int i = 0; i < m; i++){
		cin >> u >> v >> f;
		g[u][v] = g[v][u] = f;
	}
	
	for(int i = 0; i <= 19; i++){
		for(int j = 0; j <= 19; j++){
			table[i][j] = inf;
		}
	}
	
	int ans = 0;
	for(int i = 1; i <= n; i++){
		vec.push_back(i);
		ans = max(ans, dfs());
		vec.pop_back();
	}
	
	cout << ans << endl;
	return 0;
}

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

int main(){
  int n;
  while(cin>>n,n){
    int data[86401]={0};
    for(int i=0;i<n;i++){
      int hh1,mm1,ss1;
      int hh2,mm2,ss2;
      int time1,time2;
      scanf("%d:%d:%d %d:%d:%d",&hh1,&mm1,&ss1,&hh2,&mm2,&ss2);
      time1=hh1*3600+mm1*60+ss1;
      time2=hh2*3600+mm2*60+ss2;
      for(int i=time1;i<time2;i++){
	data[i]++;
      }
    }
    int max=0;
    for(int i=0;i<86401;i++){
      max =((max < data[i])?(data[i]):(max));
    }
    cout<<max<<endl;
  }
  return 0;
}

Measured memory_bytes: 1584
#include <bits/stdc++.h>
using namespace std;
typedef bool bolean;

#define ll long long

void exgcd(int a, int b, int& x, int& y) {
	if (!b) {
		x = 1, y = 0;
	} else {
		exgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
}

int inv(int a, int n) {
	int x, y;
	exgcd(a, n, x, y);
	return (x < 0) ? (x + n) : (x);
}

const int Mod = 1e9 + 7;

template <const int Mod = :: Mod>
class Z {
	public:
		int v;

		Z() : v(0) {	}
		Z(int x) : v(x){	}
		Z(ll x) : v(x % Mod) {	}

		Z operator + (Z b) {
			int x;
			return Z(((x = v + b.v) >= Mod) ? (x - Mod) : (x));
		}
		Z operator - (Z b) {
			int x;
			return Z(((x = v - b.v) < 0) ? (x + Mod) : (x));
		}
		Z operator * (Z b) {
			return Z(v * 1ll * b.v);
		}
		Z operator ~() {
			return inv(v, Mod);
		}
		Z operator - () {
			return Z(0) - *this;
		}
		Z& operator += (Z b) {
			return *this = *this + b;
		}
		Z& operator -= (Z b) {
			return *this = *this - b;
		}
		Z& operator *= (Z b) {
			return *this = *this * b;
		}
};

Z<> qpow(Z<> a, int p) {
	Z<> rt = Z<>(1), pa = a;
	for ( ; p; p >>= 1, pa = pa * pa) {
		if (p & 1) {
			rt = rt * pa;
		}
	}
	return rt;
}

typedef Z<> Zi;

const int N = 1e6 + 6;

int n;
Zi Inv[N];

int main() {
	scanf("%d", &n);
	Inv[0] = 0, Inv[1] = 1;
	for (int i = 2; i <= n; i++) {
		Inv[i] = -Inv[Mod % i] * (Mod / i);
	}
	Zi E = 0, pw3 = ~Zi(3), pw = pw3, ans = 0;
	for (int i = 1; i <= n; i++) {
		E = E + Inv[n - i + 1];
		ans = ans + (pw *= pw3) * E * (2 + (i == n));
	}
	ans = ans * Inv[n];
	printf("%d\n", ans.v);
	return 0;
}


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

using namespace std;

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

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

#endif


void Main() {
    ll N; string S; cin >> N >> S;
    if (N % 2 == 0){
        if (S.substr(0, N / 2) == S.substr(N / 2, N / 2)){
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        cout << "No" << endl;
    }
}

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


Measured memory_bytes: 256
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    string str;
    cin>>str;
    if(str[2]==str[3] && str[4]==str[5])
        cout<<"Yes";
    else
        cout<<"No";
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    vector<int> nums(3);
    rep(i, 3) cin >> nums[i];

    outYES(count(all(nums), 5) == 2 && count(all(nums), 7) == 1);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;

#define ll long long
#define int ll

int ans;

int N;
int a[300000];
int b[300000];
int c[300000];
int d[300000];
int nn;

int search(int value) {
	int left = 0;
	int right;
	right = N-1;
	int mid = 0;

	while (left <= right) {
		mid = (left + right) / 2;
		if (a[mid] == value) {
			if (d[c[mid]] >= 1) {
				d[c[mid]]--;
				return mid;
			}
			else {
				return -1;
			}
		}
		else if (a[mid] < value) {
			left = mid + 1;
		}
		else {
			right = mid - 1;
		}
	}
	return -1;
}

signed main()
{
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}

	sort(a, a + N);
	int A,C;
	A = a[0];
	C = 0;
	for (int i = 0; i < N; i++) {
		if (a[i] == A) {
			c[i] = C;
			d[C]++;
		}
		else {
			A = a[i];
			c[i] = i;
			C = i;
			d[C]++;
		}
	}
	nn = 1;

	while (nn <= a[N - 1]) {
		nn *= 2;
	}

	for (int i = N - 1; i >= 0; i--) {
		if (d[c[i]] != 0) {
			d[c[i]] --;
			while (nn > a[i] * 2) {
				nn /= 2;
			}
			if (search(nn - a[i]) != -1) {
				ans++;
			}

		}
	}

	cout << ans << endl;

//	system("pause");
	return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  double ans = 0;
  for (int64_t i = 1; i <= N; i++) {
    int64_t memo = i;
    double memo2 = 1.0 / N;
    while (memo < K) {
      memo *= 2;
      memo2 *= 0.5;
    }
    ans += memo2;
  }
  cout << fixed << setprecision(16);
  
  cout << ans << endl;
}

Measured memory_bytes: 3748
using System;

class ABC072D
{
	static public void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		string[] vals = Console.ReadLine().Split(' ');
		int[] p = new int[N];

		for(int i=0; i < N; i++)
			p[i] = int.Parse(vals[i]);


		int count = 0;
		int t;
		for(int i = 0; i < N; i++)
		{
			if(p[i] == i+1)
			{
				if(i < N - 1)
				{
					t = p[i+1];
					p[i+1] = p[i];
					p[i] = t;
					count++;
				}
				else
				{
					t = p[i-1];
					p[i-1] = p[i];
					p[i] = t;
					count++;
				}
			}
		}
		Console.WriteLine(count);
	}
}


Measured memory_bytes: 16864
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vi vec(n);
	int xo=0;
	// unordered_map<ll, ll> mp;
	for(int i=0;i<n;i++){
		cin>>vec[i];
		xo^=vec[i];
	}
	for(int i=0;i<n;i++){
		int t = xo^vec[i];
		cout<<t<<" ";
	}
	cout<<endl;



	return 0;
}


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()

using ll = std::int64_t;
using vint = std::vector<int>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    char c;
    cin >> c;
    if (c == 'A')puts("T");
    if (c == 'T')puts("A");
    if (c == 'C')puts("G");
    if (c == 'G')puts("C");
}

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(cin.hasNext()){
			double a = cin.nextDouble();
			double b = cin.nextDouble();
			if(a<35.50&&b<71.0){
				System.out.println("AAA");
			}
			else if(a<37.50&&b<77.0){
				System.out.println("AA");
			}
			else if(a<40.0&&b<83.0){
				System.out.println("A");
			}
			else if(a<43.0&&b<89.0){
				System.out.println("B");
			}
			else if(a<50.0&&b<105.0){
				System.out.println("C");
			}
			else if(a<55.0&&b<116.0){
				System.out.println("D");
			}
			else if(a<70.0&&b<148.0){
				System.out.println("E");
			}
			else{
				System.out.println("NA");
			}
		}

	}

}

Measured memory_bytes: 12000
import sys
from decimal import *

rline = sys.stdin.readline


def solve():
    a, b, c = input().split()
    getcontext().prec = 500
    if Decimal.sqrt(Decimal(a)) + Decimal.sqrt(Decimal(b)) < Decimal.sqrt(Decimal(c)):
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 5076
#include<iostream>
#include<cmath>
using namespace std;
int main (){
  int A,B;
  cin >> A >> B;
  for(int i=1;i<10000;i++){
    if(i*2/25==A && i/10==B) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>                   // below comment for pbds
#include<ext/pb_ds/assoc_container.hpp>   // to use it make ordered_set
#include<ext/pb_ds/tree_policy.hpp>       // all set fnct + = 1. order_of_key(x); //number 
#define ll long long                      //of element strictly smaller than it;
#define ld long double                    // 2. find_by_order(x),pointer el at x pos after 
using namespace std;                      // sort use as s.f();
using namespace __gnu_pbds;



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);		
	cout.flush();
	ll t=1;
	//cin>>t;
	while(t--)
	{
		ll n,k,ans;
		cin>>n>>k;
		ll r1=n%k;
		ll r2=k-r1;
		ans=min(r1,r2);
		
	   cout<<ans<<endl;
	}
	
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define pb(a) push_back(a)
using namespace std;
typedef long long ll;

int res(int a, int b)
{
    if (a < b)
    {
        int tmp = b;
        b = a;
        a = tmp;
    }

    while (a % b != 0)
    {
        a = a % b;

        int tmp = b;
        b = a;
        a = tmp;
    }

    return min(a, b);
}

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);

    REP(i, N)
    {
        cin >> A.at(i);
    }

    int c = A.at(0);
    FOR(i, 1, N)
    {
        c = res(A.at(i), c);
    }

    cout << c;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define MM 1e9

int R,G,B,N;
int Rm,Gm,Bm;
long long res=0;

void input() {
    cin >> R >> G >> B >> N;
}

void solve(){
    Rm=N/R;
    repr(i,Rm,0) {
        Gm=(N-i*R)/G;
        repr(j,Gm,0) {
            Bm=(N-i*R-j*G)/B;
            repr(k,Bm,0) {
                if (i*R+j*G+k*B==N) res++;
                if (i*R+j*G+k*B<N) break;
            }
        }
    }
    cout << res << endl;
}

int main() {
    input();
    solve();
}

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

int main() {
  int n, m, c, a, ans = 0;
  cin >> n >> m >> c;
  int b[m];
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    int sum = 0;
    for (int j = 0; j < m; j++) {
      cin >> a;
      sum += a * b[j];
    }
    if (sum + c > 0) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class FastReader 
{ 
    BufferedReader br; 
    StringTokenizer st; 
    
    public FastReader() 
    { 
        br = new BufferedReader(new InputStreamReader(System.in)); 
    } 
    
    String next() 
    { 
        while (st == null || !st.hasMoreElements()) 
        { 
            try
            { 
                st = new StringTokenizer(br.readLine()); 
            } 
            catch (IOException  e) 
            { 
                e.printStackTrace(); 
            } 
        } 
        return st.nextToken(); 
    } 
    
    int nextInt() 
    { 
        return Integer.parseInt(next()); 
    } 
    
    long nextLong() 
    { 
        return Long.parseLong(next()); 
    } 
    
    double nextDouble() 
    { 
        return Double.parseDouble(next()); 
    } 
    
    String nextLine() 
    { 
          String str = ""; 
        try
        { 
            str = br.readLine(); 
        } 
        catch (IOException e) 
        { 
            e.printStackTrace(); 
        } 
        return str; 
    } 
} 

class Solution
{
    void solve()
    {
        FastReader sc = new FastReader();

        int A = sc.nextInt();
        int P = sc.nextInt();

        int p = 3*A + P;

        System.out.println(p/2);
    }
}
  
public class Main 
{ 
    public static void main(String[] args) 
    { 
        Solution ob = new Solution();

        ob.solve();
    } 
} 

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

int main(void){
    string s;
    cin >> s;
    int count = 0;
    int rock = -1;
    int rock2 = -1;
    int ans_a = 0;
    int ans_b = 0;
    for (int i = 0; i < s.size(); i++){
        if (s[i]=='A' && rock==-1){
            ans_a = i;
            rock = 1;
        }
        if (s[i]=='Z'){
            ans_b = i;
        }
    }
    cout << (ans_b - ans_a)+1 << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());

    string t;
    cin >> t;
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());

    if (s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
"""
AtCoder Beginner Contest 051
B - Sum of Three Integers
"""

if __name__ == "__main__":
    K, S = map(int, input().split())

    ans = 0
    for x in range(K+1):
        for y in range(K+1):
            if x + y > S or S - (x + y) > K:
                continue
            ans += 1

    print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long n,ans;
inline long long quick_power(int n)
{
	long long num=1,Bit=2;
	while(n>0)
	{
		if(n&1) num=num*Bit;
		Bit=Bit*Bit;
		n>>=1;
	}
	return num;
}
int main()
{
	scanf("%lld",&n);
	while(1)
	{
		n>>=1;
		ans++;
		if(n==0) break;
	}
	printf("%lld ",quick_power(ans)-1);
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define vi vector<int>
#define LLMAX 4000000000000000000LL
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
struct edge
{
	int t, f, w;
	bool operator < (const edge& e) const
	{
		return w > e.w;
	}
	edge(int from, int to, int weight)
	{
		t = to;
		f = from;
		w = weight;
	}
};
#define pll pair<ll,ll>
#define ii pair<int,int>
#define MOD 1000000007
const double EPS = (1e-5);
long long binpow(long long a, long long b){long long res = 1;while (b > 0){if (b & 1)res = res * a;a = a * a;b >>= 1;}return res;}
int findXOR(int n){switch (n % 4){case 0:return n;case 1:return 1;case 2:return n + 1;case 3:return 0;}}
int rangeXOR(int l, int r){return (findXOR(l - 1) ^ findXOR(r));}
int getbit(int mask, int bit){return (mask & (1 << bit));}void setbit(int& mask, int bit, int val){if (val)mask |= (1 << bit);else mask &= ~(1 << bit);}
//ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
//ll lcm(ll a, ll b){return a * (b / gcd(a, b));}
const int N = 2e5+2;
const int M = 26;
const ll INF = N;
void solve()
{
	ll x;
	cin >> x;
	ll st = 100;
	int years = 0;
	while (st < x)
	{
		st = st + st * 0.01;
		years++;
	}
	cout << years << '\n';
}
int main(void)
{
	//freopen("commandos.in", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int tc = 1;
	//cin >> tc;
	//scanf("%d", &tc);
	while (tc--)
	{
		solve();
	}
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<deque>

using namespace std;

int main(){
    int H,W,N;
    cin>>H>>W>>N;
    vector<vector<int>> color(H,vector<int>(W));

    deque<int> kind(N);

    for(auto &x:kind){
        cin>>x;
    }

    int now_color=0;
    for(int i=0;i<H;++i){
        if(i%2==0){
            for(int k=0;k<W;++k){
                color[i][k]=now_color+1;
                kind[now_color]--;
                if(kind[now_color]==0){
                    now_color++;
                }
            }
        }else{
            for(int k=W-1;k>=0;--k){
                color[i][k]=now_color+1;
                kind[now_color]--;
                if(kind[now_color]==0){
                    now_color++;
                }
            }
        }
    }


    for(int i=0;i<H;++i){
        for(int k=0;k<W;++k){
            cout<<color[i][k]<<" ";
        }
        cout<<endl;
    }

}

Measured memory_bytes: 384
n,t=map(int, input().split())
x=[]
y=[]
m=[]
for i in range(n):
    a,b=map(int, input().split())
    x.append(a)
    y.append(b)
    m.append([a,b])
x.sort()
y.sort()
ans=float('inf')
for i in range(n-1):
    for j in range(i+1,n):
        for k in range(n-1):
            for l in range(k+1,n):
                count=0
                for a,b in m:
                    if x[i]<=a<=x[j] and y[k]<=b<=y[l]:
                        count+=1
                if count>=t:
                    ans=min(ans,(x[j]-x[i])*(y[l]-y[k]))
print(ans)
    

Measured memory_bytes: 74584
import itertools
N,M,Q = list(map(int,input().split()))
list1 = [list(map(int,input().split())) for i in range(Q)] 
  
ans = [0]
def dfs(x,n2,m1):
  if len(x) == n2:
    score = sum(x1[3] for x1 in list1 if x[x1[1]-1]-x[x1[0]-1] == x1[2])
    if score > ans[0]:
      ans[0] = score
  else:
    for i in range(1,m1+1,1):
      if i >= x[-1]:
        x.append(i)
        dfs(x,n2,m1)
        x.pop()

dfs([1],N,M)
print(ans[0])

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, int> pint;
typedef vector<int> vii;
typedef vector<int> vint;

#define X first
#define Y second
#define rep(i,n) for(int i=0; i<(n); i++)
#define repp(i,a,b) for(int i=a; i<=(b); i++)
#define repp2(i,b,a) for(int i=b; i>=(a); i--)
#define fiint(a,val) memset(a, (val), sizeof(a))
#define mp make_pair
#define pb push_back
#define aint(c) (c).begin(), (c).end()
#define uni(c) c.resize(distance(c.begin(), unique(aint(c))))
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sc(num) scanf("%intd",&num)
//#define ONLINE
#ifdef ONLINE
FILE *fin = freopen("great.in","r",stdin);
FILE *fout = freopen("great.out","w",stdout);
#endif

int mod= 1e9 + 7, mod1=1e9+9;
const int N=100005;

ll solve(ll a, ll b){
    if(a>b)swap(a,b);
    if(a==0)return -b;
    
    return b/a*2*a+solve(b%a,a);
    
}

int main(){
    io;
    
    ll n,x;
    cin>>n>>x;
    cout<<n+solve(x,n-x);
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
            #define ll long long
            #define f   first
            #define s   second
            #define pb          push_back
            #define mod        1000000007
            #define mod1       1000000009
            #define hell        998244353
            #define inf         1000000000000000000LL
            #define pi          3.14159265358979323
            //#define N           100005 
            const int N=1000005;
            using namespace std;
            ll n,k,sum,q,res,m,val,ans;
            ll x,y;
            double p;
            ll xx[]={1,0,-1,0};
            ll yy[]={0,1,0,-1};
            ll bfs(ll x,vector<ll> adj[],bool vis[])
            {   queue<ll> q;
                q.push(x);
                vis[x]=1;
                ll res=0;
                while(!q.empty())
                {
                    ll y=q.front();
                    q.pop();
                    res++;
                    for(auto z:adj[y])
                    {
                        if(!vis[z])
                        {
                            vis[z]=1;
                            q.push(z);
                        }
                    }
                }
                return res;
            }
            void solve()    
            {   ll a,b,c;
                map<pair<ll,ll>,bool> hm;
                cin>>n>>m;
                vector<ll> adj[n+1];
                for(int i=0;i<m;i++)
                {   
                    cin>>x>>y;
                    ll x1=min(x,y);
                    ll y1=max(x,y);
                    if(!hm.count({x1,y1})) {adj[x].pb(y);adj[y].pb(x);}
                    hm[{x1,y1}]=1;
                }
                ll ans=1;
                bool vis[n+1];
                memset(vis,0,sizeof(vis));
                for(int i=1;i<=n;i++)
                {
                    if(!vis[i]) {ans=max(ans,bfs(i,adj,vis));}
                }
                cout<<ans;



                
                
            }
            int main()  
            {   ios_base::sync_with_stdio(false);
                cin.tie(0);cout.tie(0);
                ll t=1;
                
                //cin>>t;
                 for(ll i=1;i<=t;i++)
                    solve();
                
            }            


Measured memory_bytes: 30164
xy = list(map(int,input().split()))
prise = 0

for i in xy:
  if i == 1:
    prise += 300000
  elif i == 2:
    prise += 200000
  elif i == 3:
    prise += 100000

if sum(xy) == 2:
  prise += 400000

print(prise)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  ll a,b;
  char op;

  cin >> a >> op >> b;
  if(op=='+'){
    cout << a+b << endl;
  }else{
    cout << a-b << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
std::vector<int> A['   '];
int n, m, S['   '], a, l, r, i, d, x;
void U(int z, int u) {
  while (z <= n)
    S[z] += u, z += z & -z;
}
int main() {
  scanf("%d%d", &m, &n);
  for (i = 1; i <= m; i++)
    scanf("%d%d", &l, &r), A[r - l + 1].push_back(l);
  for (d = 1; d <= n; d++) {
    a = m;
    for (i = d; i <= n; i += d) {
      r = 0, x = i;
      while (x)
        r += S[x], x -= x & -x;
      a += r;
    }
    for (int u : A[d])
      U(u, 1), U(u + d, -1), m--;
    printf("%d\n", a);
  }
  return 0;
}

Measured memory_bytes: 53760
#include <iostream>
#define INF 1e+9
using namespace std;

int main(){
	int n,m,a[100000],cnt[20] = {},imos[100001][20] = {};
	int dp[1 << 20] = {};
	cin >> n >> m;
	for(int i = 0;i < n;i++){
		cin >> a[i];
		a[i]--;
		cnt[a[i]]++;
		for(int j = 0;j < m;j++) imos[i + 1][j] = imos[i][j];
		imos[i + 1][a[i]]++;
	}
	for(int i = 0;i < (1 << 20);i++){
		dp[i] = INF;
	}
	dp[0] = 0;
	for(int i = 1;i < (1 << m);i++){
		int sum = 0;
		for(int j = 0;j < m;j++){
			if((i >> j) & 1) sum += cnt[j];
		}
		for(int j = 0;j < m;j++){
			if((i >> j) & 1){
				dp[i] = min(dp[i],dp[i & ~(1 << j)] + cnt[j] - (imos[sum][j] - imos[sum - cnt[j]][j]));
			}
		}
	}
	cout << dp[(1 << m) - 1] << endl;
	return 0;
}

Measured memory_bytes: 15380
N, M, Q = map(int, input().split())
T = [[0 for j in range(N + 1)] for i in range(N + 1)]
for i in range(M):
  l, r = map(int, input().split())
  T[0][r - 1] += 1
  T[l][r - 1] -= 1
  T[0][N] -= 1
  T[l][N] += 1
for i in range(N):
  for j in range(N):
    T[i][j + 1] += T[i][j]
for j in range(N):
  for i in range(N):
    T[i + 1][j] += T[i][j]
for i in range(Q):
  p, q = map(int, input().split())
  print(T[p - 1][q - 1])

Measured memory_bytes: 9716
n=int(input())
a=list(map(int,input().split()))
a+=a
for i in range(2*n):
  if i%2:a[i]=-a[i]
for i in range(2*n-1):
  a[i+1]+=a[i]
a=[0]+a
for i in range(n):
  print(abs(a[n+i]-a[i]))

Measured memory_bytes: 88320
#include<bits/stdc++.h>
using namespace std;
#define ioso ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define kholo freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define endl '\n'
#define laglo cerr << "Time Laglo: " << 1.0*clock() / CLOCKS_PER_SEC << endl;
int main() {
	ioso;
	//kholo;
	int n;
	string s,t;
	cin >> n >> s >> t;
	for(int i=0;i<n;i++) {
		cout << s[i] << t[i];
	}
	//laglo;
	}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    if(a + b + 1 >= c)
    {
        cout << b + c << "\n";
    }
    else
    {
        cout << (a + b + 1) + b << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
arr.sort(key=lambda l:-l[2])

for cx in range(101):
  for cy in range(101):
    ch = None
    for x, y, h in arr:
      t = h + abs(cx-x) + abs(cy-y)
      if h > 0:
        if ch is not None and t != ch:
          break
        ch = t
      else:
        if t < ch:
          break
    else:
      print(cx, cy, ch)
      exit()

Measured memory_bytes: 3064
//nikkei2019qual_d_topo.cpp
//Thu Jun  4 23:20:50 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

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

	vector<int> g[n];
	int in[n];
	fill(in,in+n,0);
	int a[n-1+m],b[n-1+m];
	for (int i=0;i<n-1+m;i++){
		cin >> a[i] >> b[i];
		a[i]--;b[i]--;
		g[a[i]].push_back(b[i]);
		in[b[i]]++;
	}

	int root = -1;
	for (int i=0;i<n;i++){
		if (in[i]==0){
			root = i;
			break;
		}
	}

	queue<int> q;
	q.push(root);
	int dist[n];
	fill(dist,dist+n,0);
	while (!q.empty()){
		int tmp = q.front();q.pop();
		for (int i=0;i<g[tmp].size();i++){
			int next = g[tmp][i];
			in[next]--;
			dist[next] = max(dist[next],dist[tmp]+1);
			if (in[next]==0){
				q.push(next);
			}
		}
	}

	int par[n];
	fill(par,par+n,-1);
	for (int i=0;i<n-1+m;i++){
		if (dist[b[i]]-dist[a[i]]==1){
			par[b[i]] = a[i];
		}
	}

	for (int i=0;i<n;i++){
		cout << par[i]+1 << endl;
	}
}

Measured memory_bytes: 8192
#include <stdio.h>
int count1=0;
int num;
void xiandan(long long n,unsigned char flag)
{
    if(n<=num)
    {
        if(flag==07)

        count1++;

            xiandan(n*10+3,flag|01);
            xiandan(n*10+5,flag|02);
            xiandan(n*10+7,flag|04);




    }

}
int main()
{
    scanf("%d",&num);
    xiandan(0,0);
    printf("%d",count1);
    return 0;
}


Measured memory_bytes: 256
import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func mainC() {
    var N = readInt()

    var results: [Int] = []

    while N > 0 {
        N -= 1
        results.insert(N % 26, at: 0)
        N /= 26
    }

    let name = results.map { offset in
        return Character(UnicodeScalar(Int(Character("a").unicodeScalars.first!.value) + offset)!)
    }

    print(String(name))
}

mainC()

Measured memory_bytes: 13088
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;

#define M 1000000007

 
int main() {
    string s, t;
    cin >> s >> t;
    ll n, m;
    n = s.length();
    m = t.length();

    vector<vector<ll>> dp(n+1, vector<ll>(m+1, 0));
    for (ll i = 0; i < n; ++i) {
        for (ll j = 0; j < m; ++j) {
            if (s[i]==t[j]) {
                dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1);
            }
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j]);
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1]);
        }
    }

    string ans = "";
    while(n > 0 && m > 0){
        if(dp[n][m] == dp[n-1][m]){
            n--;
        }else if(dp[n][m] == dp[n][m-1]){
            m--;
        }else{
            ans = s[n-1] + ans;
            n--;
            m--;
        }
      }
 
    cout << ans << endl;    
}


Measured memory_bytes: 72448
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int K = scan.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scan.nextInt();
        }
        scan.close();

        System.out.println(playStones(A, K));
    }
    private static String playStones(int[] A, int K) {
        boolean[] dp = new boolean[K + 1];
        Arrays.sort(A);
        for (int k = 1; k <= K; k++) {
            for (int a : A) {
                int leftover = k - a;
                if (leftover >= 0 && !dp[leftover]) {
                    dp[k] = true;
                    break;
                }
            }
        }

        return dp[K] ? "First" : "Second";
    }

}

Measured memory_bytes: 23380
#include <iostream>

using namespace std;

int main(){
    int n, m;

    cin >> n >> m;
    int a[n][m], b[m], c[n];

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


    for(int i=0; i<m; i++)
        cin >> b[i];

    for(int i=0; i<n; i++)
        c[i] = 0;

    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            c[i] += a[i][j] * b[j];
        }
    }

    for(int i=0; i<n; i++)
        cout << c[i] << endl;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

const ld day = 86400;

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n, l;
	while (cin >> n >> l, n)
	{
		vector<pair<pii, int>> v;
		vi use(day);
		REP(i, n)
		{
			int s, t, u; cin >> s >> t >> u;
			FOR(j, s, t) use[j] = u;
		}
		ld lb = 0, ub = 1000000;
		REP(bs, 150)
		{
			ld mid = (lb + ub) / 2.0;
			ld vol = l;
			ld tmp;
			REP(i, day)
			{
				vol -= use[i];
				vol += mid;
				if (vol > l) vol = l;
				if (vol < 0)
				{
					lb = mid;
					goto end;
				}
			}
			tmp = vol;
			REP(i, day)
			{
				vol -= use[i];
				vol += mid;
				if (vol > l) vol = l;
				if (vol < 0)
				{
					lb = mid;
					goto end;
				}
			}
			if (tmp > vol) lb = mid;
			else ub = mid;
		end:;
		}
		cout << lb << endl;
	}
	return 0;
}

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

const long long INF = 1e18;

int r, c;

vector<vector<pair<int, int>>> g;
vector<bool> used;

vector<long long> rowsMin;
vector<long long> colsMin;
vector<long long> value;
int cmpCount;

bool Dfs(int v, long long curValue) {
    value[v] = curValue;
    used[v] = true;

    if (v < r) {
        rowsMin[cmpCount] = min(rowsMin[cmpCount], curValue);
    } else {
        colsMin[cmpCount] = min(colsMin[cmpCount], curValue);
    }

    for (const pair<int, int>& p : g[v]) {
        if (!used[p.first]) {
            if (!Dfs(p.first, p.second - curValue)) {
                return false;
            }
        } else {
            if (p.second - curValue != value[p.first]) {
                return false;
            }
        }
    }

    return true;
}

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

    cin >> r >> c;

    int n;
    cin >> n;

    g.resize(r + c);
    for (int i = 0; i < n; ++i) {
        int cr, cc, cv;
        cin >> cr >> cc >> cv;

        --cr;
        --cc;

        g[cr].push_back(make_pair(r + cc, cv));
        g[r + cc].push_back(make_pair(cr, cv));
    }

    cmpCount = 0;
    used.assign(r + c, false);
    value.resize(r + c);
    for (int i = 0; i < r + c; ++i) {
        if (!used[i]) {
            rowsMin.push_back(INF);
            colsMin.push_back(INF);
            if (!Dfs(i, 0) || rowsMin[cmpCount] + colsMin[cmpCount] < 0) {
                cout << "No" << endl;
                return 0;
            }
            ++cmpCount;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	string s;
	cin >> s;

	int n = s.size();
	string key = "keyence";

	if(s.substr(0, 7) == key){
		cout << "YES" << endl;
		return 0;
	}

	if(s.substr(n-7, 7) == key){
		cout << "YES" << endl;
		return 0;
	}

	for(int i = 1; i <= 6; i++){
		if(s.substr(0, i) != key.substr(0, i)) continue;
		if(s.substr(n-(7-i), 7-i) != key.substr(i, 7-i)) continue;
		cout << "YES" << endl;
		return 0;
	}

	cout << "NO" << endl;
}


Measured memory_bytes: 256
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,0,n)

#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)

#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
			<< " , " << #y << " = " << (y) << "\n";

const int INF = 1e9;
const double EPS = 1e-10;

ll n,m,v[4];
int cp[4];

int main() {
	REP(i, 4) cin >> v[i];
	REP(i, 4){
		int p = 0;
		ll mn = 1e14;
		REP(j, i + 1){
			if(mn > v[j] * pow(2, i-j)){
				p = j;
				mn = v[j] * pow(2, i-j);
			}
		}
		cp[i] = mn;
	}
	cin >> n;
	n*=4;

	ll ans = 0;
	RREP(i, 4){
		int bul = pow(2, i);
		ll am = n / bul;
		ans += cp[i] * am;
		n %= bul;
	}

	cout << ans;
	cout << endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

  public static void main(String[] args) {
    FastScanner sc = new FastScanner();

    int N = sc.nextInt();
    int b = (int) Math.sqrt(N);

    int ans = 0;
    for (int i = 1; i <= b; i++) {
      for (int p = 1; p < 10; p++) {
        if (Math.pow(i, p) > N) {
          break;
        }
        ans = (int) Math.max(ans, Math.pow(i, p));
      }
    }
    System.out.println(ans);

  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte()) {
      return buffer[ptr++];
    } else {
      return -1;
    }
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  private void skipUnprintable() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
      ptr++;
    }
  }

  public boolean hasNext() {
    skipUnprintable();
    return hasNextByte();
  }

  public String next() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public int nextInt() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    int n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public long nextLong() {
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
        throw new NumberFormatException();
      }
      b = readByte();
    }
  }
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <string.h>
int main(void){
    char a[200001], b[200001];
    scanf("%s %s", a, b);
    int i, l, count = 0;
    for(i = 0; i < strlen(a); i++){
        if(a[i] != b[i]) count++;
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 2100