akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, a, n) for(ll i = a; i < (ll)(n); ++i)
#define repr(i, a, n) for(ll i = n - 1; (ll)a <= i; --i)
#define ENDL '\n'
typedef pair<int, int> Pi;
typedef pair<ll, ll> PL;
constexpr ll mod = 1000000007;  // 998244353;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 + 99);
const ld PI = acos((ld)-1);
const vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
template <typename T, typename U> inline bool chmin(T& t, const U& u) {
  if(t > u) {
    t = u;
    return 1;
  }
  return 0;
}
template <typename T, typename U> inline bool chmax(T& t, const U& u) {
  if(t < u) {
    t = u;
    return 1;
  }
  return 0;
}
template <typename T> inline T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

template <typename T, typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(; n; n >>= 1) {
    if(n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template <typename T> V<T> prefix_sum(const V<T>& v) {
  int n = v.size();
  V<T> ret(n + 1);
  rep(i, 0, n) ret[i + 1] = ret[i] + v[i];
  return ret;
}

template <typename T, typename Y>
ostream& operator<<(ostream& os, const pair<T, Y>& p) {
  return os << "{" << p.fs << "," << p.sc << "}";
}
template <typename T> ostream& operator<<(ostream& os, const V<T>& v) {
  os << "{";
  for(auto e : v) os << e << ",";
  return os << "}";
}
template <typename... Args> void debug(Args&... args) {
  for(auto const& x : {args...}) { cerr << x << ' '; }
  cerr << ENDL;
}

signed main() {
  cin.tie(0);
  cerr.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  V<ll> a(n), b(n);
  V<ll> al(n + 1, INF), ar(n + 1, -1);
  V<ll> bl(n + 1, INF), br(n + 1, -1);

  rep(i, 0, n) {
    cin >> a[i];
    chmin(al[a[i]], i);
    chmax(ar[a[i]], i);
  }
  rep(i, 0, n) { cin >> b[i]; }
  sort(all(b));

  rep(i, 0, n) {
    chmin(bl[b[i]], i);
    chmax(br[b[i]], i);
  }

  ll dmn = 0, dmx = n-1;
  rep(i,1,n+1){
    if(al[i]==INF || bl[i]==INF)continue;
    chmax(dmn,ar[i]-bl[i]+1);
    chmin(dmx,al[i]+n-br[i]-1);
    //debug(dmn,dmx);
  }


  if(dmn>dmx)cout<<"No"<<ENDL;
  else{
    cout<<"Yes"<<ENDL;
    rep(i,n-dmn,2*n-dmn){
      cout<<b[(i)%n]<<" ";
    }
    cout<<ENDL;
  }
  debug(dmn,dmx);
}
//! ( . _ . ) !
// CHECK overflow,vector_size,what to output?

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
string to_str(ll x){string res; while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return res;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end



int main(){
    ll n; scanf("%lld",&n);
    if(n&1){printf("0\n"); return 0;}
    ll ans=n/10; n/=10;
    while(n){
        n/=5; ans+=n;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
def examA():
    N, M = LI()
    ans = N*(N-1)//2 + M*(M-1)//2
    print(ans)
    return

def examB():
    def judge(A):
        #print(A)
        n = len(A)
        for i in range(n//2):
            if A[i]!=A[n-i-1]:
                return False
        return True
    S = SI()
    N = len(S)
    if not judge(S):
        print("No")
        return
    if judge(S[:(N-1)//2]) and judge(S[(N+1)//2:]):
        print("Yes")
    else:
        print("No")
    return

def examC():
    L = I()
    ans = (L/3)**3
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examC()

"""

"""

Measured memory_bytes: 4464
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    n= int(sys.stdin.readline())
    l= list(map(int, sys.stdin.readline().split()))
    c=0
    for i in range(n):
        minj=i
        for j in range(i,n):
            if l[j] < l[minj]:
                minj=j
        if i!=minj:
            c+=1
            temp=l[minj]
            l[minj]=l[i]
            l[i]=temp
    print(*l)
    print(c)



Measured memory_bytes: 7328
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("inf")
for bit in range(1 << d):
    count = 0
    sum = 0
    nokori = set(range(1, d + 1))
    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
            nokori.discard(i + 1)
    if sum < g:
        use = max(nokori)
        count += min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
        sum += min(pc[use - 1][0], -(-(g - sum) // (use * 100))) * use * 100
    if sum >= g:
        ans = min(ans, count)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cmath> 
#include <cctype>

using namespace std;

struct Card {
    char suit, number;
};

void bubble(struct Card A[], int N) {
    for (int i = 0; i < N; i++) {
        for (int j = N - 1; j >= i + 1; j--) {
            if (A[j - 1].number > A[j].number) {
                Card temp = A[j];
                A[j]      = A[j - 1];
                A[j - 1]      = temp;
            }
        }
    }
}

void selection(struct Card A[], int N) {
    int minv;
    for (int i = 0; i < N; i++) {
        minv = i;
        for (int j = i; j < N; j++) {
            if (A[j].number < A[minv].number) {
                minv = j;
            }
        }
        Card temp = A[i];
        A[i]      = A[minv];
        A[minv]   = temp;
    }
}

bool isStable(struct Card C1[], struct Card C2[], int N) {
    for (int i = 0; i < N; i++) {
        if (C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

void print(struct Card A[], int N) {
    for (int i = 0; i < N; i++) {
        if (i > 0) cout << " ";
        cout << A[i].suit << A[i].number;
    }
    cout << endl;
}

int main() {
    int N; 
    cin >> N;
    Card C1[N], C2[N];

    for (int i = 0; i < N; i++) {
        cin >> C1[i].suit >> C1[i].number;
    }

    for (int i = 0; i < N; i++) C2[i] = C1[i];

    bubble(C1, N);
    selection(C2, N);

    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);

    if (isStable(C1, C2, N)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }

    return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define db long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
 
#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define EB emplace_back
#define fi first
#define se second
 
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
 
#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
 
#define INF ((1ll<<60)-233)
#define sqr(x) ((x)*(x))
#define debug puts("wzpkking")
using namespace std;
 
const int N=505;
const int LIM=8000;
int fl[LIM],pri[LIM],n;
void initprime(){
	For(i,2,LIM-1) For(j,2,(LIM-1)/i) fl[i*j]=1;
	For(i,1,LIM-1) if (!fl[i]) pri[++*pri]=i;
}
map<int,int> mp1,mp2;
map<ll,int> mp3;
ll ans[N][N];
ll gcd(ll x,ll y){
	return y?gcd(y,x%y):x;
}
void work(){
	int l=4;
	For(i,1,n) For(j,1,n) if ((i+j)&1){
		if (!mp1[i+j]) mp1[i+j]=pri[l++];
		ans[i][j]=mp1[i+j];
	}
	Rep(i,n,1) For(j,1,n) if ((i+j)&1){
		if (!mp2[i-j]) mp2[i-j]=pri[l++];
		ans[i][j]*=mp2[i-j];
	}

	ll mx=0;
	For(i,1,n) For(j,1,n) if (!ans[i][j]){
		ll lcm=1;
		if (i!=1) lcm*=ans[i-1][j]/gcd(ans[i-1][j],lcm);
		if (i!=n) lcm*=ans[i+1][j]/gcd(ans[i+1][j],lcm);
		if (j!=1) lcm*=ans[i][j-1]/gcd(ans[i][j-1],lcm);
		if (j!=n) lcm*=ans[i][j+1]/gcd(ans[i][j+1],lcm);
		ans[i][j]=lcm+1;
	}
	For(i,1,n){
		For(j,1,n) 
		  {//if(mp3[ans[i][j]]) {cout<<"fuck"<<endl;exit(0);}  else mp3[ans[i][j]]=1; 
		   printf("%lld ",ans[i][j]);
	      } 
		puts("");
	}
}
 
int main(){
	scanf("%d",&n);
	initprime();
	if(n==2)
	  {cout<<4<<' '<<7<<endl;
	   cout<<23<<' '<<10<<endl;
	    return 0;
	  }
	work();
}

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

using namespace std;

constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    int n;
    cin >> n;
    auto f = [n](int y, int x) { return y * n + x; };
    vector<int> p(n*n), cost(n*n, 0);
    vector<bool> sit(n*n, true);
    for(int i=0;i<n*n;++i) {
        cin >> p[i];
        --p[i];
    }
    for(int i=0;i<n*n;++i) {
        int y = i / n, x = i % n;
        cost[i] = min({y, n-1-y, x, n-1-x});
    }

    int ans = 0LL;
    for(int i=0;i<n*n;++i) {
        ans += cost[p[i]];
        
        queue<int> que;
        que.push(p[i]);
        sit[p[i]] = false;
        while(!que.empty()) {
            int j = que.front(); que.pop();
            int y = j / n, x = j % n;
            for(int k=0;k<4;++k) {
                int yy = y + dyx[k][0], xx = x + dyx[k][1];
                if(0 <= yy && yy < n && 0 <= xx && xx < n && cost[f(yy,xx)] > cost[f(y,x)] + int(sit[f(y,x)])) {
                    cost[f(yy,xx)] = cost[f(y,x)] + int(sit[f(y,x)]);
                    que.push(f(yy,xx));
                }
            }
        }
    }

    cout << ans << endl;
}

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

const int maxN = 2e5+5;

void solve(){
    int n; cin >> n;
    int A[maxN];
    int count_red = 0, count_red2 = 0;
    for(int i = 0; i < n; i++){
        char c; cin >> c;
        if(c == 'W') A[i] = 0;
        else{
            A[i] = 1;
            count_red++;
        }
    }
    for(int i = count_red; i < n; i++){
        if(A[i] == 1) count_red2++;
    }
    int ans = 0;
    int white = count_red-(count_red-count_red2);
    ans = white;
    if(white < count_red2){
        count_red2 -= white;
        white = 0;
    }
    else{
        white -= count_red2;
        count_red2 = 0;
    }

    cout << ans+count_red2 << "\n";


}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    bool multitest = false;
    //multitest = true;
    if(multitest){
        int t; cin >> t;
        while(t--)
            solve();
    }
    else
        solve();
}






Measured memory_bytes: 4436
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];


int main () {
    int K, N;
    cin >> K >> N;

    vector<int>A(N);
    rep(i,N){
        cin >> A[i];
    }

    int m = K-A[N-1]+A[0];
    rep(i,N-1){
        m =max(m,A[i+1]-A[i]);
    }

    cout << K-m << endl;
}

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

void solve() {
	int N; cin >> N; // 花の個数
	vector<int> h(N); // 花の高さ
	rep(i, N) scanf("%d", &h[i]);

	int res = 0; // hを構成する区間ベクトルの個数
	while (true) {
		// 全ての区間内の最大高さが0なら終了
		if (*max_element(h.begin(), h.end()) == 0) break;

		int i = 0;
		while (i < N) {
			// 区間の始まり
			if (h[i] == 0) i++;
			else {
				res++;
				while (i < N && h[i] > 0) {
					h[i]--;
					i++;
				}
			}
		}
	}

	cout << res << endl;
}

int main(void) {
	solve();

	return 0;
}

Measured memory_bytes: 256
// High above the clouds there is a rainbow...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxn=1e5+10,mod=1e9+7;
const ll inf=1e18;

pair<int,pii>p[maxn];
ll sm[maxn];

ll f(pair<int,pii> p,int x){
    if(x<=p.F) return 1ll*x*p.S.F;
    return 1ll*p.F*p.S.F + 1ll*(x-p.F)*p.S.S;
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int n,x;cin>>n>>x;
    ll SM=0;
    for(int i=0;i<n;i++){
	cin>>p[i].F>>p[i].S.F>>p[i].S.S;
	SM+=1ll*p[i].S.F*p[i].F;
    }
    
    sort(p,p+n,[&](pair<int,pii>a,pair<int,pii>b){ return f(a,x)>f(b,x); } );
    
    for(int i=1;i<=n;i++){
	sm[i]=sm[i-1]+f(p[i-1],x);
    }
    
    ll l=-1,r=1ll*n*x;
    while(r-l>1){
	ll mid=(l+r)>>1;
	ll num=0;
	int cnt=mid/x,rem=mid%x;
	for(int i=0;i<cnt;i++){
	    num=max(num,sm[cnt+1]-f(p[i],x)+f(p[i],rem));
	}
	for(int i=cnt;i<n;i++){
	    num=max(num,sm[cnt]+f(p[i],rem));
	}
	if(num>=SM) r=mid;
	else l=mid;
    }
    return cout<<r<<endl,0;
}
// Deathly mistakes:
//  * Read the problem curfully.
//  * Check maxn.
//  * Overflows.


Measured memory_bytes: 2176
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <queue>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
#include <list>
using namespace std;
#define INF 1000000000
typedef long long int lli;
typedef pair<int,int> P;

double dp[51][5001];

int main(){
	int x,y,z;
	while(cin>>x>>y>>z){
		if(x==0&&y==0&&z==0) break;
		vector<P> event(y+1);
		vector<int> v;
		for(int i=0; i<x; ++i){
			int tmp;
			cin >> tmp;
			v.push_back(tmp);
		}
		for(int i=0; i<z; ++i){
			int n,e,a;
			cin >> n >> e >> a;
			event[n].first=e;
			event[n].second=a;
		}
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(int i=0; i<y; ++i){
			for(int j=0; j<=5000; ++j){
				for(int k=0; k<x; ++k){
					if(i+v[k]>=y){
						dp[y][j]+=dp[i][j]/x;
					} else if(event[i+v[k]].first==1){
						dp[min(y,i+v[k]+event[i+v[k]].second)][j]+=dp[i][j]/x;
					} else if(event[i+v[k]].first==2&&j+event[i+v[k]].second<=5000){
						dp[i+v[k]][j+event[i+v[k]].second]+=dp[i][j]/x;
					} else if(event[i+v[k]].first==3){
						dp[i+v[k]][max(0,j-event[i+v[k]].second)]+=dp[i][j]/x;
					} else{
						dp[i+v[k]][j]+=dp[i][j]/x;
					}
				}
			}
		}
		double ans=0;
		for(int i=0; i<=5000; ++i){
			ans+=dp[y][i]*i;
		}
		cout << (int)ans << "\n";
	}
	return 0;
}

Measured memory_bytes: 3220
#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

int main(){
	
	int task[3];
	vector<int> T = {0, 1, 2};
	int ans = 1000000;
	int tmp;
	
	for(int i=0; i<3; i++) scanf("%d", &task[i]);
	
	for(int i=0; i<3; i++){
		T.erase(T.begin()+i);
		for(int j=0; j<2; j++){
			tmp = abs(task[i]-task[T[j]]) + abs(task[T[(j+1)%2]] -task[T[j]]);
			if(tmp < ans) ans = tmp;
		}
		T = {0, 1, 2};
	}
	
	printf("%d\n", ans);
	
	return 0;
	
}

Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std; 
int n,a[12],ans=0; 

void  fun(int idx,int s){
    if (idx>n and (s&1)^1) ans++;
    if (idx>n) return;
    for (int i=a[idx]-1;i<=a[idx]+1;i++){
        fun(idx+1,s*i);
    }
}

inline void solve(){
    cin>>n; 
    for (int i=1;i<=n;i++) cin >> a[i] ; 
    fun(1,1);
    cout << ans << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()

using namespace std;

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

  if (b - a > x)
    puts("dangerous");
  else if (b > a)
    puts("safe");
  else
    puts("delicious");

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<set>
#include<tuple>
#include<utility>
using namespace std;

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

typedef long long ll;


int abc107_b(){
    //入力
    int n,k;
    cin >> n >> k;
    vector<ll> vm,vp(1,0);
    REP(i,n){
        ll a;
        cin >> a;
        if(a>=0){
            vp.push_back(a);
        }else{
            vm.push_back(abs(a));
        }
    }
    vm.push_back(0);
    reverse(vm.begin(), vm.end());
    
    //処理
    ll ans = 1000000000;
    if(k<vm.size()){
        ans = min(ans , vm[k]);
    }
    if(k<vp.size()){
        ans = min(ans , vp[k]);
    }
    for(int i=1;i<k-1;++i){
        ll tmp;
        if(i<vm.size() && k-i<vp.size()){
            tmp = vm[i] + vp[k-i] + min(vm[i] , vp[k-i]);
            ans = min(ans , tmp);
            }
    }
    
    //出力
    cout << ans << enter;
    return 0;
}

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


Measured memory_bytes: 1656
x=input()
y=input()

n=len(x)

def trn(s):
	c=[0]*n
	cnt=1
	for i in range(n):
		if c[i]==0:
			c[i]=cnt
			if i<n-1:
				for j in range(i+1,n):
					if s[j]==s[i]:
						c[j]=cnt
			cnt+=1
	return c

x_c=trn(x)
y_c=trn(y)

res='Yes'

for i in range(n):
	if x_c[i]!=y_c[i]:
		res='No'
		break

print(res)

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

int main(){
    string S;
    for (int i = 0; i < 4; i++) {
        string s;
        cin >> s;
        S += s;
    }
    sort(S.begin(), S.end());
    cout << ((S == "1479") ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
typedef long long ll;
const ll BIGMOD = 1e9 + 7;
using namespace std;

int main() {
  int m, n;
  cin >> n >> m;
  vector<int> vec(n);
  for (int i = 0; i < n; ++i) cin >> vec[i];
  sort(vec.begin(), vec.end(), greater<int>());
  ll sum = accumulate(vec.begin(), vec.end(), 0);

  // cout << vec[m - 1] << " " << sum / 4.0 / m << endl;
  if (vec[m - 1] >= sum / 4.0 / m)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100001

int maximum(int a,int b){
 if(a>b)return a;
return b;
}

/*xは容量 kは台数*/
int check(int x,int W[],int n,int k){
int i,j,temp;
int cnt=0;
i=0;

while(cnt<k){
temp=0;

if(cnt>k)return 0;

 while(i<n){
  temp+=W[i];
  if(i==n-1&&temp<=x){cnt++;i++;break;}

  if(temp<x)i++;
  else if(temp==x){cnt++;i++;break;}
  else if(temp>x){cnt++;break;}

 }/*while end*/

 if(cnt<=k&&i==n)return 1;

}

return 0;
}



int main(){
int n,i,k;
int W[MAX];
int sum=0;
int large=-1;

scanf("%d %d",&n,&k);

for(i=0;i<n;i++){
 scanf("%d",&W[i]);
 sum+=W[i];
 large=maximum(large,W[i]);
}

large=maximum(large,sum/k);


for(i=large;i<=sum;i++){

if(check(i,W,n,k)==1)break;

}/*for end*/

printf("%d\n",i);

return 0;
}


Measured memory_bytes: 2236
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
vector<int> X;
vector<int> Y;
vector<int> Z;
void m(vector<int> &a) {
	for (int i = 0; i < a.size(); i++) {
		a[i] = -a[i];
	}
}
int N, M;
int solve() {
	vector<vector<int> >dp(N + 1, vector<int>(M+ 1 , -((int)1 << 60)));
	dp[0][0] = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			if(j > 0)dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + X[i - 1] + Y[i - 1] + Z[i - 1]);
			dp[i][j] = max(dp[i][j], dp[i - 1][j]);
		}
	}
	return dp[N][M];
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> N >> M;
	X.resize(N);
	Y.resize(N);
	Z.resize(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> X[i] >> Y[i] >> Z[i];
	}
	res = solve();
	m(X);
	res = max(res, solve());
	m(X);
	m(Y);
	res = max(res, solve());
	m(Y);
	m(Z);
	res = max(res, solve());
	m(Z);
	m(X); m(Y);
	res = max(res, solve());
	m(X); m(Y);
	m(X); m(Z);
	res = max(res, solve());
	m(X); m(Z);
	m(Z); m(Y);
	res = max(res, solve());
	m(X);
	res = max(res, solve());
	cout << res << endl;
}

Measured memory_bytes: 8216
#include<bits/stdc++.h>
#define ll          long long int
#define ld          double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         1000000000000000000
#define MAXN        200005
#define LOG         20
#define mod         1000000007
using namespace std;
 
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,i,j,x,mx=0,k;
    char ch;
    cin>>n>>m;
    ll a[n][m];
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            cin>>ch;
            if(ch=='#'){
                a[i][j]=1;
            }
            else{
                a[i][j]=0;
            }
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            x=a[i][j];
            if(x==0){
                ll vis[n][m];
                ll dis[n][m];
                memset(vis,0,sizeof(vis));
                memset(dis,0,sizeof(dis));
                queue<pair<ll,ll> > qe;
                qe.push({i,j});
                vis[i][j]=1;
                dis[i][j]=0;
                while(!qe.empty()){
                    ll x1=qe.front().ff;
                    ll y1=qe.front().se;
                    qe.pop();
                    mx=max(mx,dis[x1][y1]);
                    ll dx[4]={0,0,-1,+1};
                    ll dy[4]={-1,+1,0,0};
                    for(k=0;k<4;k++){
                        ll nx=dx[k]+x1;
                        ll ny=dy[k]+y1;
                        if(nx<0 || ny<0 || nx>n-1 || ny>m-1){
                            continue;
                        }
                        if(!vis[nx][ny] && a[nx][ny]==0){
                            qe.push({nx,ny});
                            vis[nx][ny]=1;
                            dis[nx][ny]=dis[x1][y1]+1;    
                        }
                    }
                }
            }
        }
    }
    cout<<mx;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;

const ld pi = 3.141592653589793;

#ifdef EBUG
#define debug(x) cout << "\033[31m" << #x << ": " << x << "\033[0m\n";
#else
#define debug(x)
#endif

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

int main() {
  ll x[5];
  rep(i, 5) {
    cin >> x[i];
    if (x[i] == 0) {
      cout << i + 1 << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3608
def main():
    people_num = int(input())
    directions = input()
    east_direction = [0]
    for i in range(people_num):
        if directions[i] == "E":
            east_direction.append(east_direction[i] + 1)
        else:
            east_direction.append(east_direction[i])
    answer = float("inf")
    for i in range(1, people_num + 1):
        change_to_east = i - 1 - east_direction[i - 1]
        change_to_west = east_direction[-1] - east_direction[i]
        answer = min(answer, change_to_east + change_to_west)
    print(answer)


if __name__ == '__main__':
    main()

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

#define rep(i, n) for(int i=0; i<n; ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
#define ll long long int

int n, m;
int g[10];

int inc(int i){
    if(i<0) return -1;
    if(g[i]==m){
        g[i]=inc(i-1);
    }
    else g[i]++;
    return g[i];
}

int main(){
    int q;
    int a[50], b[50], c[50], d[50];
    cin>>n>>m>>q;
    rep(i, q){
        cin>>a[i]>>b[i]>>c[i]>>d[i];
        a[i]--; b[i]--;
    }

    rep(i, n) g[i]=1;
    int mx=0;  
    while(1){
        int s=0;
        rep(i, q) if(g[b[i]]-g[a[i]]==c[i]) s+=d[i];
        mx=max(mx, s);
        if(inc(n-1)==-1) break;
    }
    cout << mx << endl;
    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D, w) for(auto vec : vec2D) { for (auto v : vec) cerr << setw(w) << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

const char en = '\n';

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

typedef vector<vector<int>> Graph;
void add_edge(Graph& g, int from, int to, bool isDirected) {
	g[from].push_back(to);
	if (!isDirected) g[to].push_back(from);
}

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


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

	string s;
	cin >> s;

	int a = 0;
	for(auto c : s) {
	  int k = c - '0';
		a += k;
		a %= 9;
	}
	
	if (a == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}



Measured memory_bytes: 3768
#include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
using vi = vector <int>;
using vvi = vector <vi>;

class Dijkstra{
	private:
		struct edge{int to, cost;};
		vector <vector <edge>> G;
		vector <int> d;
		priority_queue <pair <int, int>, vector <pair <int, int>>, greater <pair <int, int>>> que;

	public:
		Dijkstra(int v){
			G = vector <vector <edge>> (v);
			d = vector <int> (v);
		}

		void addEdge(int start, int end, int cost){
			G[start].push_back({end, cost});
		}

		int dist(int n){
			return d[n];
		}

		void execute(int start){
			for (int i = 0; i < G.size(); i++)
				d[i] = i == start ? 0 : INF;
			que.push({0 , start});
			while(!que.empty()){
				pair <int, int> p = que.top(); que.pop();
				int from = p.second;
				if(d[from] < p.first)continue;
				for(int i = 0; i < G[from].size(); i++){
					edge e = G[from][i];
					if(d[e.to] > d[from] + e.cost){
						d[e.to] = d[from] + e.cost;
						que.push({d[e.to], e.to});
					}
				}
			}
		}
};

signed main(){
	int v, e, r;
	cin >> v >> e >> r;

	Dijkstra dijkstra(v);

	rep(i, e){
		int s, t, d;
		cin >> s >> t >> d;
		dijkstra.addEdge(s, t, d);
	}

	dijkstra.execute(r);

	rep(i, v)
		cout << (dijkstra.dist(i) == INF ? "INF" : to_string(dijkstra.dist(i))) << endl;
}

Measured memory_bytes: 19376
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    String str, ing, ing2, p, order, ans;
    int a, b, q, i;
    str = sc.next();
    ing = "";
    ing2 = "";
    ans = "";
    q = sc.nextInt();
    
    for(i=0;i<q;i++){
        order = sc.next();
        a = sc.nextInt();
        b = sc.nextInt();
        
        if(order.equals("print")){//order=print：aからbまでを出力させる
            ans = str.substring(a,b+1);
            System.out.println(ans);
        }
        else if(order.equals("reverse")){//order=reverse：aからbまでの範囲を反転させたものを埋め込み，strに返す
            /*StringBuffer sb = new StringBuffer(str.substring(a, b+1));
            str = str.substring(0, a) + sb.reverse() + str.substring(str.length()-(b-a));
            System.out.println(str);*/
            ing = str.substring(a,b+1);
            ing2 = "";
            for(int j = ing.length()-1; j>=0; j--){
                ing2 += String.valueOf(ing.charAt(j));
            }
            str = str.substring(0,a) + ing2 + str.substring(b+1,str.length());
        }
        else if(order.equals("replace")) {//order=replace：aからbの範囲に受け取った文字pを埋め込み，strに返す
            p = sc.next();
            /*str = str.replaceFirst(str.substring(a,b+1), p);
            System.out.println(str)*/
            str = str.substring(0,a) + p + str.substring(b+1,str.length());
        }
    }
    }
    }


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

using namespace std;

int main(void) {
  string s;
  cin >> s;

  int ans = 0;
  for(int i = 0, j = s.size() - 1;i < s.size() / 2;i++,j--) {
    if(s[i] != s[j]) ans++; 
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector<int> A(5);
    for(int i=0;i<5;i++){
        cin>>A.at(i);
    }
    int K;
    cin>>K;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            if(K<abs(A.at(i)-A.at(j))){
             cout<<":("<<endl;
             return 0;
            }
        }
    }
    cout<<"Yay!"<<endl;
}

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

int main(){

  int x;
  cin >> x;
  int n;

  for (ll i = 1; i < 100000; i++) {
    if (x <= i * (i+1) / 2) {
      n = i;
      break;
    }
  }






  cout  << n << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <climits>
#include <cassert>
#include <iterator>

using namespace std;
using ll = long long;

bool ok(int a, int b, int c){
    return a+b>c && b+c>a && a+c>b;
}

int main(){
    int tests;
    // cin >> tests;
    tests = 1;
    while(tests--){
        int n;
        cin >> n;
        vector<int> arr(n);
        for(auto& ele : arr)
            cin >> ele;
        
        ll ans = 0;
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                for(int k = j + 1; k < n; k++){
                    if(arr[i] != arr[j] && arr[j] != arr[k] && arr[i] != arr[k])
                        ans += ok(arr[i], arr[j], arr[k]);
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3196
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <queue>
#include <vector>
#include <sstream>
#include <functional>
#include <list>
#include <iterator>
using namespace std;

int main()
{
	int n;
	cin>>n;
	while(n--){	
		string s;
		char c[690];
		fill(c,c+690,'-');
		int fro=345,now=345;
		cin>>s;
		c[now]=s[0];
		for(int i=3;i<(int)s.length();i+=3){
			char tmp=s[i];
			if(s[i-1]=='>'){
				c[++now]=tmp;
			}else if(s[i-1]=='-'){
				now--;
				if(c[now]=='-'){
					fro=now;
					c[now]=tmp;
				}
			}
		}
		for(int i=fro;c[i]!='-';i++){
			cout<<c[i];
		}
		cout<<endl;
	}
    return 0;
}

Measured memory_bytes: 1196
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <list>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define LL long long
#define eps 1e-6
using namespace std;
const double pi = 3.1415926535;
/*
https://codeforces.com/contest/1106/problems
https://codeforces.com/contest/1106/submit
*/
char c[200500];
int main() {
    ss(c)
    int lena = len(c);
    int x = -1,y = -1;
    for(int i = 0; i < lena; i ++){
        if(c[i] == 'A' && x == -1){
            x = i;
        }
    }
    for(int i = lena-1; i >= 0; i --){
        if(c[i] == 'Z' && y == -1){
            y = i;
        }
    }
    p(y-x+1)


    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

template<typename T>
T euclid(T a, T b){
  if(b == 0) return a;
  else return euclid(b, a % b);
}

/////////////////////////////////////////////////////////

void Main() {
  const int num = 26;
  int N; cin >> N;
  string S; cin >> S;
  vector<int> cnt(num, 0);
  rep(i, 0, N) cnt[S[i] - 'a']++;
  ll res = 1;
  rep(i, 0, num){
    res *= cnt[i] + 1;
    res %= MOD;
  }
  cout << res - 1 << endl;
}

/////////////////////////////////////////////////////////

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

  Main();
}


Measured memory_bytes: 512
def main():
    nvertices, nedges = map(int, input().split())
    Adj = [[] for i in range(nvertices)]
    for i in range(nedges):
        s, t = map(int, input().split())
        Adj[s].append(t)

    visited = [0 for i in range(nvertices)]
    stack = [0 for i in range(nvertices)]
    ans = 0
    for u in range(nvertices):
        if not visited[u]:
            if dfs(u, visited, stack, Adj):
                ans = 1
                break
    print(ans)


def dfs(u, visited, stack, Adj):
    stack[u] = visited[u] = 1
    for v in Adj[u]:
        if stack[v]:
            return True
        if visited[v]:
            continue
        if dfs(v, visited, stack, Adj):
            return True
    stack[u] = 0
    return False


main()

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

int main() { 
  int n;
  cin >> n;
  for(int i = 1; i <= 9; ++i) {
    for(int j = 1; j <= 9; ++j) {
      if(i*j == n) {
        cout << "Yes" << '\n';
        return 0;
      }
    }
  }
  cout << "No" << '\n';
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
using namespace std;
#define PB push_back
struct b{
    int h;
    int w;
    bool operator ==(const b &a){return (h==a.h&&w==a.w)||(h==a.w&&w==a.h);}
    void in(){
        scanf("%d%d",&h,&w);
        return ;
    }
    void reset(){
        h=w=0;
        return ;
    }
    bool check(){return h!=0&&w!=0;}
    void operator =(const b &a){
        h=a.h;
        w=a.w;
        return ;
    }
};
void swap(b &a,b &r){
    b temp=a;
    a=r;
    r=temp;
    return ;
}
int main(){
    vector<b> v;
    b a[6];
    bool f;
    for(int i=0;i<6;i++)a[i].in();
    for(int i=0;i<6;i++)if(a[i].check()){
        f=false;
        for(int j=i+1;j<6;j++)if(a[j]==a[i]){
            f=true;
            v.PB(a[i]);
            a[i].reset();
            a[j].reset();
            break;
        }
        if(!f){
            printf("no\n");
            return 0;
        }
    }
    for(int i=0;i<2;i++){
    if(v[0].h==v[1].h&&v[1].w==v[2].h&&v[2].w==v[0].w){
        printf("yes\n");
        return 0;
    }
    else if(v[0].h==v[1].h&&v[1].w==v[2].w&&v[2].h==v[0].w){
        printf("yes\n");
        return 0;
    }
    else if(v[0].h==v[1].w&&v[1].h==v[2].h&&v[2].w==v[0].w){
        printf("yes\n");
        return 0;
    }
    else if(v[0].h==v[1].w&&v[1].h==v[2].w&&v[2].h==v[0].w){
        printf("yes\n");
        return 0;
    }
        swap(v[1],v[2]);
    }
    printf("no\n");
}


Measured memory_bytes: 2684
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ！！

N = int(input())
list_1 = list(map(int,input().split()))
list_2 = list(map(int,input().split()))

#↓にいくタイミングをtとする
#各ルートでひろう飴の合計値をsum_listに追加していき、後でmax値を引っ張り出す
#0~tのlist_1の値の合計、t~Nのlist_2の値の合計を取ってきてくっつける
sum_list = []
for t in range(N):
    sum_number = 0
    for i in range(t+1):
        sum_number += list_1[i]
        if i == t:
            for k in range (t,N):
                sum_number += list_2[k]
                if k == N-1:
                    sum_list.append(sum_number)
print(max(sum_list))


Measured memory_bytes: 3060
from datetime import datetime

while True:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if y1 < 0 or m1 < 0 or d1 < 0 or y2 < 0 or m2 < 0 or d2 < 0: break
    date1 = datetime(y1, m1, d1)
    date2 = datetime(y2, m2, d2)
    result = date2 - date1
    print(result.days)


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

signed main() {
	string a; cin >> a;
	for (int i = 0; i < a.length(); i++) {
		for (int j = i; j < a.length(); j++) {
			if (a.substr(0, i) + a.substr(j, a.length()) == "keyence") {
				puts("YES");
				return 0;
			}
		}
	}
	puts("NO");
}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var input1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var X = input1[0];
        if (input1[1] == 0)
        {
            Console.ReadLine();
            Console.WriteLine(X);
            return;
        }

        var input2 = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var a = new bool[102];
        for (int i = 0; i < input2.Length; i++)
        {
            a[input2[i]] = true;
        }

        var ridx = X;
        while (a[ridx])
        {
            ridx++;
        }
        var lidx = X;
        while (a[lidx])
        {
            lidx--;
        }

        Console.WriteLine((X - lidx) > (ridx - X) ? ridx : lidx);
    }
}


Measured memory_bytes: 28316
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数
using namespace std;

signed main() {
  double A, B;
  cin >> A >> B;
  cout << A / B << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

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

  ll ma = 0;
  ll mi = n;

  for (ll x = 0; x <= n; x++) {
    ll y = a - x;
    ll z = b - y;
    ll w = n - x - y - z;
    if (y >= 0 && z >= 0 && w >= 0) {
      ma = max(ma, y);
      mi = min(mi, y);
    }
  }

  cout << ma << ' ' << mi << endl;
}

Measured memory_bytes: 256
using System;

namespace _166_c
{
    internal class Ac
    {
        private static void Main(string[] args)
        {
            var s = Console.ReadLine();
            if (s == "ABC")
            {
                Console.WriteLine("ARC");
            }

            if (s == "ARC")
            {
                Console.WriteLine("ABC");
            }
        }
    }
}

Measured memory_bytes: 25632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		String N = sc.next();
		
		if (N.substring(0, 1).equals(N.substring(1, 2)) && N.substring(1, 2).equals(N.substring(2, 3))) {
			System.out.println("Yes");
		} else if (N.substring(1, 2).equals(N.substring(2, 3)) && N.substring(2, 3).equals(N.substring(3, 4))) {
			System.out.println("Yes");
		} else {
			System.out.println("No");	
		}
		
		sc.close();
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    int A, B, M;
    cin >> A >> B >> M;
    vector<int> a(A);
    vector<int> b(B);
    int minA = 1000000;
    int minB = 1000000;
    rep(i, A) {
        cin >> a[i];
        minA = min(minA, a[i]);
    }
    rep(i, B) {
        cin >> b[i];
        minB = min(minB, b[i]);
    }
    int minT = minA + minB;
    rep(i, M) {
        int x, y, c;
        cin >> x >> y >> c;
        --x;
        --y;
        int p = a[x] + b[y] - c;
        minT = min(minT, p);
    }

    cout << minT << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
 
int main(){
  int n, x;
  cin >> n >> x;
  int ans = 1;
  int total = 0;
  rep(i,n){
    int tmp;
    cin >> tmp;
    total += tmp;
    if (total <= x) ans++;
    else break;
  }
  
  cout << ans << endl;
}

  

Measured memory_bytes: 256
from itertools import product


def makelist(BIT):
    LIST, tmp = [], s[0]
    for si, bi in zip(s[1:], BIT):
        if bi == 1:
            LIST.append(tmp)
            tmp = si
        elif bi == 0:
            tmp = [t + sij for t, sij in zip(tmp, si)]
    else:
        LIST.append(tmp)
    return LIST


def solve(LIST):
    COST, cnt = 0, [li[0] for li in LIST]
    if any(num > k for num in cnt):
        return h * w
    for j in range(1, w):
        tmp = [t + li[j] for t, li in zip(cnt, LIST)]
        if any(num > k for num in tmp):
            COST += 1
            cnt = [li[j] for li in LIST]
        else:
            cnt = tmp[:]
    return COST


h, w, k = map(int, input().split())
s = [[int(sij) for sij in input()] for _ in range(h)]

ans = h * w
for bit in product([0, 1], repeat=(h - 1)):
    numlist = makelist(bit)
    ans = min(ans, solve(numlist) + sum(bit))
print(ans)


Measured memory_bytes: 9496
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
using ll = int64_t;
template<typename T>
using vec = vector<T>;
using P = pair<ll, ll>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[5001][5002];

ll pows(ll a, ll b) {
	if (b == 0)return 1;
	else if (b % 2 == 0) {
		ll d = pows(a, b / 2);
		return (d * d);
	}
	else return (a * pows(a, b - 1));
}

signed main(){
	IOS;
	ll n, p;
	cin >> n >> p;
	map<ll, ll> mp;
	ll ans = 1;
	ll x = 0;
	if(n == 1 || p == 1){
		dump(p);
		return 0;
	}
	for(int i = 2;pows(i, n) <= p;i++){
		while(p % i == 0){
			x++;
			p /= i;
		}
		ll jo = x / n;
		if(jo >= 1)ans *= pows(i, jo);
		x = 0;
	}
	if(n == 1)ans *= p;
	dump(ans);
}


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

#define MAX 200

int isEmpty();
int ifFull();
void push(int);
int pop();

int g_top = 0;
int g_s[100];

int main(){
  int x,a,b;
  char s[100];

  while(scanf("%s",s) != EOF){
    switch(s[0]){
    case '+':
      a = pop();
      b = pop();
      push(b+a);
      break;
    case '-':
      a = pop();
      b = pop();
      push(b-a);
      break;
    case '*':
      a = pop();
      b = pop();
      push(b*a);
      break;
    default:
      x = atoi(s);
      push(x);
      break;
    }
  }

  printf("%d\n",g_s[g_top]);
  
  return 0;
}

int isEmpty(){
  if (g_top == 0) return 1;
  else return 0;
}

int isFull(){
  if(g_top >= MAX - 1) return 1;
  else return 0;
}

void push(int x){
  if(isFull() == 1) fprintf(stderr,"error,push\n");
  g_top++;
  g_s[g_top] = x;
}

int pop(){
  if(isEmpty() == 1)  fprintf(stderr,"error,pop\n");
  g_top--;
  return g_s[g_top+1];
}



Measured memory_bytes: 2040
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define inf (int)(1e18)
#define p (int)(1e9 + 7)

signed compare(const void *a, const void *b){
	int sub = *(int *)a - *(int *)b;
	if(sub < 0){
		return -1;
	}
	else if(sub == 0){
		return 0;
	}
	else{
		return 1;
	}
}

signed main(){
	int N, i, j, k, ans = 1;
	scanf("%lld", &N);
	int *a = (int *)malloc(sizeof(int) * (N + 1));
	int *b = (int *)malloc(sizeof(int) * (N + 1));
	for(i = 0; i < N; i++){
		scanf("%lld", &a[i]);
	}
	for(i = 0; i < N; i++){
		scanf("%lld", &b[i]);
	}
	a[N] = inf;
	b[N] = inf;
	qsort(a, N, sizeof(int), compare);
	qsort(b, N, sizeof(int), compare);
	for(i = 0, j = 0, k = 0; i < N || j < N; k++){
		if(a[i] < b[j]){
			a[i] = k;
			i++;
		}
		else{
			b[j] = k;
			j++;
		}
	}
	int *c = (int *)malloc(sizeof(int) * (2 * N));
	for(i = 0; i < 2 * N; i++){
		c[i] = 0;
	}
	for(i = 0; i < N; i++){
		if(a[i] < b[i]){
			c[a[i]]++;
			c[b[i]]--;
		}
		else{
			c[a[i]]--;
			c[b[i]]++;
		}
	}
	for(i = 1; i < 2 * N; i++){
		c[i] += c[i - 1];
	}
	for(i = 0; i < 2 * N - 1; i++){
		if(c[i] > c[i + 1]){
			ans = (ans * c[i]) % p;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4076