akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ll long long

ll n,i,maxr;
map<string,ll> f;
vector <string> res;
string s[200009];

bool comp(string x,string y){
    return x<y;
}

int main(){
    cin>>n;
    for (i=1;i<=n;i++) {
        cin>>s[i];
    }
    maxr=0;
    sort(s+1,s+n+1,comp);
    for (i=1;i<=n;i++) {
        f[s[i]]++;
        //cout<<s[i]<<' '<<f[s[i]]<<'\n';
        if (f[s[i]]>maxr) {
            res.clear();
            res.push_back(s[i]);
            maxr=f[s[i]];
        }
        else if (f[s[i]]==maxr) {
            res.push_back(s[i]);
        }
    }
    for (i=0;i<res.size();i++) {
        cout<<res[i]<<'\n';
    }
}


Measured memory_bytes: 28272
from heapq import *

V, E, r = map(int, input().split())
graph = [[] for _ in range(V)]
for _ in range(E):
    s, t, d = map(int, input().split())
    graph[s].append([d, t])

dist = [10**18]*V
dist[r] = 0
pq = []
# heapの要素 => (重み、頂点)
heappush(pq, (dist[r], r))

while pq:
    d, v = heappop(pq)

    if dist[v] < d:
        continue

    for w, nv in graph[v]:
        if dist[nv] > dist[v] + w:
            dist[nv] = dist[v] + w
            heappush(pq, (dist[nv], nv))


for di in dist:
    if di == 10**18:
        print('INF')
    else:
        print(di)



Measured memory_bytes: 96956
#include <bits/stdc++.h>
#define ull unsigned long long
#define int long long
#define ll long long
#define fr(i, n) for (int i = 0; i < n; i++)
#define frf(i, j, n) for (int i = j; i <= n; i++)
#define frd(i, n) for (int i = n; i >= 0; i--)
#define mp(i, j) make_pair(i, j)
#define pb(x) push_back(x)
using namespace std;
// typedef vector<vector<ll>> matrix;
// const ll S = 3e5 + 20;
// const ll N = 1e6 + 1;
// const ll PRIME = 1e9 + 7;
// const ll MAX = 1e6;

void solve()
{
   int a;
   cin>>a;
   cout<<a+a*a+a*a*a;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t;
    // cin >> t;
    t = 1;
    while (t--)
    {
        solve();
    }
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
long long a[200005],ai[200005],b[200005],bi[200005],n,m,k;
int main()
{
    cin>>n>>m>>k;
    for(long long i=1;i<=n;++i)
    {
        cin>>a[i];
        ai[i]=ai[i-1]+a[i];
    }
    for(long long i=1;i<=m;++i)
    {
        cin>>b[i];
        bi[i]=bi[i-1]+b[i];
    }
    long long ans=0,j=m;
    for(long long i=0;i<=n;++i)
    {
        if(ai[i]>k)break;
        while(bi[j]>k-ai[i])j--;
        ans=max(ans,i+j);
    }
    cout<<ans;
}


Measured memory_bytes: 9880
__DEUBG__ = 0

import decimal
import math
import sys
from collections import *
from itertools import *

N = int(input())

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

if __DEUBG__:
	print(prime_factors(N))

z = set()
p = None

while N > 1:
	if __DEUBG__:
		print('while')
		print(N)
	for n in prime_factors(N):
		if p:
			if (p % n) == 0:
				p *= n
			else:
				p = n
			if p in z:
				pass
			else:
				N //= p
				z.add(p)
				p = None
				break
		else:
			p = n
			if p in z:
				pass
			else:
				N //= p
				z.add(p)
				p = None
				break
	else:
		break

print(len(z))


Measured memory_bytes: 9932
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int mod = 1e9 + 7;
  cin >> N;
  long dp[N+1][4][4][4] = {0};
  dp[0][3][3][3] = 1;
  int a, c1, c2, c3;
  for(int i=0; i<N; i++){
    for(a=0; a<4; a++){
      for(c1=0; c1<4; c1++){
        for(c2=0; c2<4; c2++){
          for(c3=0; c3<4; c3++){
            if(c2 == 0 && c3 == 1 && a == 2) continue;
            if(c2 == 1 && c3 == 0 && a == 2) continue;
            if(c2 == 0 && c3 == 2 && a == 1) continue;
            if(c1 == 0 && c3 == 1 && a == 2) continue;
            if(c1 == 0 && c2 == 1 && a == 2) continue;
            dp[i+1][c2][c3][a] += dp[i][c1][c2][c3];
            dp[i+1][c2][c3][a] %= mod;
          }
        }
      }
    }
  }
  
  int ans = 0;
  for(int i=0; i<4; i++){
    for(int j=0; j<4; j++){
      for(int k=0; k<4; k++){
        ans += dp[N][i][j][k];
        ans %= mod;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define mod 1000000007ll
using namespace std;
int n,x,y;
ll now;
ll _inv[200005];
void pre(){  
    _inv[0]=_inv[1]=1;  
    for(int i=2;i<=200000;i++)
        _inv[i]=((mod-mod/i)*_inv[mod%i])%mod;  
    for(int i=2;i<=200000;i++)
        _inv[i]=_inv[i]*_inv[i-1]%mod;
}
int pow_mod(int a,int b){
    ll ans = 1;
    ll base = a%mod;
    while(b>0){
        if(b&1!=0)
            ans = (ans*base)%mod;
        base = (base*base)%mod;
        b >>= 1;
    }
    return ans;
}
int main(){
    pre();
    cin>>n>>x>>y;
    ll ans=pow_mod(2,n);
    ans=(ans==0?mod-1:ans-1);
    ll now1=1;
    for(int i=n;i>=n-x+1;i--) now1=now1*i%mod;
    ll now2=1;
    for(int i=n;i>=n-y+1;i--) now2=now2*i%mod;
    ans=((ans+mod-now1*_inv[x]%mod)+mod-now2*_inv[y]%mod)%mod;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(){
    int a, b, c, ans;

    scanf("%d %d %d", &a, &b, &c);

    if(a > b){
        if(a > c)
            ans = a*10 + b + c;
        else
            ans = c*10 + b + a;
    }
    else{
        if(b > c)
            ans = b*10 + c + a;
        else
            ans = c*10 + a + b;
    }

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

    return 0;
}

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

#define int long long
#define debug(x) cout<<#x<<" "<<x<<endl;

const int N=1e6+5;
const double eps=1e-9;
const int INF=1e18;
const int P=1e9+7;

int a[N];

signed main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n;cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    int res=0,sum=0;
    for(int i=1;i<=n;i++){
        sum+=a[i];
        res+=(sum-a[i])%P*a[i],res%=P;
    }
    cout<<res<<endl;
    return 0;
}

//Created Time  :2020/8/29 20:00:20


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

typedef long long ll;
int N;
vector<int> arr;

int main() {
    scanf("%d", &N);
    arr.resize(N);
    ll tot = 0;
    for(int i = 0; i < N; i++) {
        scanf("%d", &arr[i]);
        tot += arr[i];
    }

    ll sum = 0;
    ll ans = 1e18;
    for(int i = 0; i < N - 1; i++) {
        sum += arr[i];
        ans = min(ans, abs(tot - 2*sum));
    }

    printf("%lld", ans);
}


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

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


struct waterdrop{
    int y, x, dir;
};

void add_wd(vector<waterdrop> &vp, int y, int x){
    rep(k,4){
        int ddy = y+dy[k];
        int ddx = x+dx[k];
        if(ddx<0 || ddy<0 || ddx>=4 || ddy>=4)continue;
        vp.pb( waterdrop{ddy, ddx, (int)k} );
    }
}

MAP eval(MAP v, int y, int x){
    vector<waterdrop> vp;
    v[y][x]++;
    if(v[y][x]>4){
        add_wd(vp, y, x);
    }

    while(vp.size()){
        vector<waterdrop> nvp;
        for(const auto &wd: vp){
            if(v[wd.y][wd.x]!=0){
                v[wd.y][wd.x]++;
            }
        }

        for(const auto &wd: vp){
            if(v[wd.y][wd.x]>4){
                add_wd(nvp, wd.y, wd.x);
                v[wd.y][wd.x] = -1;
            }else if(v[wd.y][wd.x]==0){
                int ddy = wd.y+dy[wd.dir];
                int ddx = wd.x+dx[wd.dir];
                if(ddx<0 || ddy<0 || ddx>=4 || ddy>=4)continue;
                nvp.pb( waterdrop{ddy, ddx, wd.dir} );
            }
        }
        rep(i,4){
            rep(j,4){
                if(v[i][j]>4 || v[i][j]<0)v[i][j] = 0;
            }
        }
        
        vp = nvp;
    }
    return v;
}

int dfs(MAP v, int t){
    if(t>5)return INF;
    bool all_zero = true;
    rep(i,4){
        rep(j,4){
            if(v[i][j]!=0){
                all_zero = false;
                j=100, i=100;
            }
        }
    }
    if(all_zero)return 0;
    
    int ret = INF;
    rep(i,4){
        rep(j,4){
            if(v[i][j]==0)continue;
            ret = min(ret, dfs(eval(v, i, j), t+1)+1);
        }
    }
    if(ret>5)return INF;
    else return ret;
}

int main(){
    MAP inp;
    rep(i,4)rep(j,4)cin>>inp[i][j];
    
    int ret = dfs(inp, 0);
    if(ret>=INF)cout<<-1<<endl;
    else cout<<ret<<endl;
}



Measured memory_bytes: 3176
#include<iostream>
#include<map>
#include<utility>
#include<algorithm>
using namespace std;

typedef multimap<string, int>::iterator mmit;

int main(){
  
  int q, com, x;
  string key, l, r;
  multimap<string, int> M;
  
  cin >> q;
  for(int i = 0;i < q;i++){
    cin >> com;
    
    if(com == 0){
      cin >> key >> x;
      M.insert(make_pair(key, x));
    }else if(com == 1){
      cin >> key;
      pair<mmit, mmit> mit = M.equal_range(key);
      for(mmit it = mit.first;it != mit.second;it++) cout << it->second << endl;
    }else if(com == 2){
      cin >> key;
      M.erase(key);
    }else if(com == 3){
      map<string, int>::iterator itl, itr;
      
      cin >> l >> r;
      itl = M.lower_bound(l);
      itr = M.upper_bound(r);
      
      for(mmit it = itl;it != itr;it++) cout << it->first << " " << it->second << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 24888
#include<bits/stdc++.h>
#define N 100002
using namespace std;
inline int read(){
	int x=0; bool f=1; char c=getchar();
	for(;!isdigit(c); c=getchar()) if(c=='-') f=0;
	for(; isdigit(c); c=getchar()) x=(x<<3)+(x<<1)+(c^'0');
	if(f) return x; return 0-x;
}
int n,L,T,cnt;
struct ants{int x,w;}a[N];
inline bool cmp(ants a, ants b){
	return a.x<b.x;
}
int main(){
	n=read(), L=read(), T=read();
	for(int i=0; i<n; ++i){
		a[i].x=read(), a[i].w=read();
		a[i].x+=(a[i].w==1)?T:-T;
		cnt+=a[i].x/L;
		if(a[i].x%L<0) --cnt;
		cnt=(cnt%n+n)%n;
		a[i].x=(a[i].x%L+L)%L;
	}
	sort(a,a+n,cmp);
	for(int i=cnt; i<n; ++i) printf("%d\n",a[i].x);
	for(int i=0; i<cnt; ++i) printf("%d\n",a[i].x);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 1920
/*
 * FileName:     queue_fix_2
 * CreatedDate:  2020-04-16 00:49:20 +0900
 * LastModified: 2020-04-16 01:48:27 +0900
 */

#include <stdio.h>
#include <stdlib.h>
typedef struct _node{
    char name[10];
    int time;
    struct _node *prev;
    struct _node *next;
    
}node;

int main(void){
    int n,q;
    scanf("%d %d",&n,&q);
    node *queue=(node*)calloc(n,sizeof(node));
    scanf("%s %d",queue->name,&queue->time);
    queue->prev=queue+n-1;
    for(int i=1;i<n;i++){
        scanf("%s %d",queue[i].name,&queue[i].time);
        queue[i].prev=queue+i-1;
        queue[i-1].next=queue+i;
    }
//    printf("%s,%d\n",queue[0].name,queue[0].time);
    queue[n-1].next=queue;
    node *head=queue,*tail=&queue[n-1];
//    printf("%s,%d\n",head->name,head->time);
    int tmp=0;
    while(head!=tail){
        if(head->time<=q){
            printf("%s %d\n",head->name,head->time+tmp);
            tmp+=head->time;
            head->prev->next=head->next;
            head->next->prev=head->prev;
            
            head=head->next;

        }
        else{
            tmp+=q;
            head->time-=q;
            head=head->next;
            tail=tail->next;
        }
    }
    printf("%s %d\n",head->name,head->time+tmp);
    free(queue);
    return 0;
}



Measured memory_bytes: 3116
#include<stdio.h>
int main(void){
    int N, d[101], X, MX, i, j, temp;
    scanf("%d", &N);
    for(i = 1; i <= N; i++){
        scanf("%d", &d[i]);
    }
    for(i = 1; i <= N; i++){
        for(j = N; j > i; j--){
            if(d[j-1] > d[j]){
                temp = d[j-1];
                d[j-1] = d[j];
                d[j] = temp;
            }
        }
    }
    MX = 1;
    for(i = 1; i < N; i++){
        if(d[i] != d[i+1]) MX++;
    }
    printf("%d\n", MX);
    return 0;
}



Measured memory_bytes: 128
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int N;
  ci(N);
  ve<int> a(N);
  rep(i, N){
    ci(a.at(i));
  }
  int t = 1, c = 0;
  rep(i, N){
    t = a.at(t - 1);
    c++;
    if(t == 2){
      co(c);
      rt;
    }
  }
  co(-1);
}

Measured memory_bytes: 640
//#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

using namespace std;
using ll=long long;

void solve(){
  int num;
  cin >> num;
  vector<string> str(num);
  for(int i=0;i<num;i++)
    cin >> str[i];
  for(int i=0;i<num;i++)
    for(int j=i+1;j<num;j++)
      if(str[i]==str[j]){cout << "No" << endl;return;}
  for(int i=1;i<num;i++)
      if(str[i][0]!=str[i-1][str[i-1].length()-1])
        {cout << "No" << endl;return;}
  cout << "Yes" << endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
import sys 
sys.setrecursionlimit(10000000)


n,k = iim()
A = iil()
d = {0:True}
l = [0]
def move(num):
    l.append(A[num]-1)
    if d.get(A[num]-1,False):
        return True if A[num]-1 == 0 else False
    else:
        d[A[num]-1] = True
        return move(A[num]-1)

if move(0):
    rep = len(l)-1
    ini = 0
else:
    ini = l.index(l[-1])
    rep = len(l)-ini-1

if k <= ini:
    print(l[k]+1)
else:
    mod = (k-ini)%rep
    if mod == 0:
        mod = rep
#    print(l,mod,rep,ini)
    print(l[ini+mod]+1)

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

// This file is a "Hello, world!" in Java language by OpenJDK for wandbox.

class Main
{
	public static void main(String[] args)
	{
		new Main().run();
	}

	void run(){
		Scanner sc=new Scanner(System.in);
		int H=sc.nextInt();
		int W=sc.nextInt();
		char[][] m=new char[H][W];
		for(int i=0;i<H;++i){
			m[i]=sc.next().toCharArray();
		}
		int[][][][] d=new int[H][W][H][W];
		for(int i=0;i<H;++i)
			for(int j=0;j<W;++j)
				for(int k=0;k<H;++k)
					for(int l=0;l<W;++l){
						if(i==k&&j==l)continue;
						d[i][j][k][l]=Integer.MAX_VALUE/3;
					}
		for(int i=0;i<H;++i)
			for(int j=0;j<W;++j){
				int[] di={1,-1,0,0};
				int[] dj={0,0,1,-1};
				for(int k=0;k<4;++k){
					int ni=i+di[k];
					int nj=j+dj[k];
					if(ni<0||nj<0||ni>=H||nj>=W)continue;
					if(m[i][j]=='#'||m[ni][nj]=='#')continue;
					d[i][j][ni][nj]=1;
					d[ni][nj][i][j]=1;
				}
			}
			for(int o=0;o<H;++o)
				for(int p=0;p<W;++p)
					for(int i=0;i<H;++i)
						for(int j=0;j<W;++j)
							for(int k=0;k<H;++k)
								for(int l=0;l<W;++l)
									d[i][j][k][l]=Math.min(d[i][j][k][l],d[i][j][o][p]+d[o][p][k][l]);
		int ans=0;
		for(int i=0;i<H;++i)
			for(int j=0;j<W;++j){
				if(m[i][j]=='#')continue;
					for(int k=0;k<H;++k)
						for(int l=0;l<W;++l){
							if(m[k][l]=='#')continue;
							ans=Math.max(ans,d[i][j][k][l]);
						}
				}
		System.out.println(ans);

	}
	
	void tr(Object...o){System.out.println(Arrays.deepToString(o));}
}
// OpenJDK reference:
//   http://openjdk.java.net/

// Java language references:
//   http://docs.oracle.com/javase
	

Measured memory_bytes: 25320
#include <cstdio>
#include <stack>
#include <vector>
using namespace std;

using i64 = long long;

#define REP(i, stop) for (register int i = 1; i <= stop; ++i)

const int is = 1 << 17;
char ib[is], *ip = ib + is, it;
inline char getc() {
	if (ip == ib + is) { fread_unlocked(ib, 1, is, stdin); ip = ib; }
	return *ip++;
}
inline int read() {
	int r = 0;
	if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
	else while ((it = *ip++) & 16) r = r * 10 + it - '0';
	return r;
}

const int os = 1 << 17;
char ob[os], *op = ob, ot;
inline void putc(const char c) {
	*op++ = c;
	if (op == ob + os) { fwrite_unlocked(ob, 1, os, stdout); op = ob; }
}
// x shoud be greater than or equal to zero
inline void write(i64 x) {
	char d[20];
	int i = 0;
	while (true) {
		d[i] = x % 10 + 48;
		x /= 10;
		++i;
		if (x <= 0) break;
	}
	while (i--) {
		putc(d[i]);
	}
	putc(' ');
}

i64 cnt[200001];
bool used[200001];
i64 st[200001], *tp;
signed main() {
  i64 N = read(), Q = read();
  vector<vector<i64>> G(N + 1);
  REP(_, N - 1) {
    i64 a = read(), b = read();
    G[a].push_back(b);
    G[b].push_back(a);
  }
  REP(_, Q) {
    i64 p = read(), x = read();
    cnt[p] += x;
  }
  tp = st;
  ++tp;
  *tp = 1;
  while (*tp) {
    i64 a = *tp;
    --tp;
    used[a] = true;
    for (i64 b : G[a]) {
      if (!used[b]) {
        cnt[b] += cnt[a];
        ++tp;
        *tp = b;
      }
    }
  }
  REP(i, N) {
    write(cnt[i]);
  }
  fwrite_unlocked(ob, 1, op - ob, stdout);
}


Measured memory_bytes: 18288
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

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


#define X real()
#define Y imag()
typedef complex<double> P;

int main(){
	const int N = 10;
	int masu[N][N]={0};
	int a,b,c;
	while(scanf("%d,%d,%d",&a,&b,&c)!=EOF){
		string hit[4][5]={
			{"","","","",""},
			{
				"00000",
				"00100",
				"01110",
				"00100",
				"00000",
			},
			{
				"00000",
				"01110",
				"01110",
				"01110",
				"00000",
			},
			{
				"00100",
				"01110",
				"11111",
				"01110",
				"00100",
			},
		};
		
		a-=2;
		b-=2;
		
		rep(i,5){
			rep(j,5){
				int x = a+i;
				int y = b+j;
				if(x<0 || y<0 || x>=N || y>=N)continue;
				masu[y][x] += hit[c][i][j]-'0';
			}
		}
		
	}
	int z = 0;
	int p = 0;
	
	rep(i,N)rep(j,N){
		if(masu[i][j]==0)z++;
		p=max(p,masu[i][j]);
	}
	
	printf("%d\n%d\n",z,p);
	
}

Measured memory_bytes: 1208
n=int(input())
pre=[1]*(n//2+200)
pp=[1]*(n+1)
mod=998244353
for i in range(1,n//2+100):
    pre[i]=((pre[i-1]*2)%mod)
    
p=[1]*(n+1)
for i in range(n):
    p[i+1]=((p[i]*(i+1))%mod)
pp[-1] = pow(p[-1], mod - 2, mod)
 
for i in range(2, n + 1):
	pp[-i] = int((pp[-i + 1] * (n + 2 - i)) % mod)
tot=1
for i in range(n):
    tot*=3
    tot%=mod
#print(1)
#print(tot)
cc=0
for i in range(n//2+1,n+1):
    c=(((((p[n]*pp[i])%mod)*pp[n-i])%mod)*pre[n-i])%mod
    c%=mod
    cc+=c
tot-=cc
tot-=cc
tot%=mod
print(tot)


Measured memory_bytes: 229256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

int main(){
    int n, m;
    std::cin >> n >> m;
    std::vector<int> a(n);
    int sum = 0;
    for(int i = 0; i < n; i++){
        std::cin >> a[i];
        sum += a[i];
    }

    long double c = sum / (4.0 * m);

    std::sort(a.begin(), a.end(), std::greater<int>());

    for(int i = 0; i < m; i++){
        if(a[i] < c){
            std::cout << "No" << std::endl;
            return 0;
        }
    }

    std::cout << "Yes" << std::endl;

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
inline int read() {
	register int x; register char c, op = 0;
	while(c = getchar(), c < '0' || c > '9') if(c == '-') op = !op;
	x = c ^ 48;
	while(c = getchar(), c >= '0' && c <= '9') x = (x << 3) + (x << 1) + (c ^ 48);
	return op ? -x : x;
}
#define mod 1000000007
long long dp[301][301][301] = {0};
vector<pair<int, int> > v[301];
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n = read(), m = read();
	for(int i = 1; i <= m; i ++) {
		int x = read(), y = read(), z = read();
		v[y].push_back(make_pair(x, z));
	}
	dp[1][0][0] = 1;
	for(int i = 1; i <= n; i ++) {
		for(int j = 0; j < i; j ++)
			for(int k = 0; k < max(1, j); k ++)
				for(int l = 0; l < v[i].size(); l++) {
					pair<int,int> p = v[i][l];
					if(p.second == 1 && p.first <= j) dp[i][j][k] = 0;
					if(p.second == 2 && (p.first <= k || p.first > j)) dp[i][j][k] = 0;
					if(p.second == 3 && p.first > k) dp[i][j][k] = 0;
				}
		if(i == n) break;
		for(int j = 0; j < i; j ++)
			for(int k = 0; k < max(1, j); k ++) {
				(dp[i + 1][j][k] += dp[i][j][k]) %= mod;
				(dp[i + 1][i][k] += dp[i][j][k]) %= mod;
				(dp[i + 1][i][j] += dp[i][j][k]) %= mod;
			}
	}
	long long ans = 0;
	for(int i = 0; i < n; i ++)
		for(int j = 0; j < max(1, i); j ++) (ans += dp[n][i][j]) %= mod;
	ans *= 3, ans %= mod; 
	printf("%lld\n", ans);
	return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(4) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

bool check(string s){
    for(int i=0;i<SZ(s);i++){
        if(s[i]!=s[SZ(s)-i-1])
            return false;
    }
    return true;
}

void smain(){


    string s;
    cin>>s;
    int n=SZ(s);
    if(check(s)&&check(s.substr(0,SZ(s)/2))&&check(s.substr(SZ(s)/2+1,SZ(s)/2)))
        cout<<"Yes";
    else
        cout<<"No";

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main() {
	int a[3];
	for(int i=0;i<3;i++) cin >> a[i];
	sort(a, a+3);
	for(int i=0;i<3;i++)
		if(a[i]%2==0) {
			puts("0");
			return 0;
		}
	printf("%lld\n",1ll*a[0]*a[1]);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	int s;
	cin >> s;
	vector<int> times(3);
	int i = 2;
	while (s && i >= 0) {
		times[i] = s % 60;
		s /= 60;
		i--;
	}
	rep(i, 3) {
		printf("%d%c", times[i] ? times[i] : 0 ,i == 2 ? '\n' : ':');
	}
}




Measured memory_bytes: 3236
X,N=map(int, input().split())
lis = list(map(int, input().split()))
p=list(range(102))
# print(p)
for i in lis:
    p.remove(i)
# print(p)
d=10000
m=10000
for i in p:
    if d > abs(X-i):
        d = abs(X-i)
        m = i
print(m)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int x,a,b;
    cin >> x >> a >> b;
    if(b <= a) cout << "delicious" << endl;
    else if(b <= a + x) cout << "safe" << endl;
    else cout << "dangerous" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

struct Point {
    double x;
    double y;
};

void koch(int n, struct Point a, struct Point b) {
    if ( n == 0 ) return;
    struct Point s, t, u;
    double th = M_PI * 60.0 / 180.0;

    s.x = (2.0 * a.x + 1.0 *b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 *b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 *b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 *b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(n-1,a,s);
    cout << s.x << " " << s.y << endl;
    koch(n-1,s,u);
    cout << u.x << " " << u.y << endl;
    koch(n-1,u,t);
    cout << t.x << " " << t.y << endl;
    koch(n-1,t,b);

}

int main() {
    struct Point a,b;
    int n;

    cin >> n;

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    cout << fixed;
    cout << setprecision(8);
    cout << a.x << " " << a.y << endl;
    koch(n,a,b);
    cout << b.x << " " << b.y << endl;

    return 0;
}


Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB(x) push_back(x)
#define MP make_pair
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<'Y'<<'e'<<'s'<<endl
#define coutn cout<<'N'<<'o'<<endl
#define coutY cout<<'Y'<<'E'<<'S'<<endl
#define coutN cout<<'N'<<'O'<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

int divide(int n){
    int ret=0;
    for(int i=1; i<=n; i++){
        if(n%i==0) ret++;
    }
    return ret;
}
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    int res=0;
    for(int i=1; i<=n; i+=2){
        if(divide(i)==8) res++;
    }
    cout<<res<<endl;
}

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

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

    int a[n];

    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    int min = a[0];
    int max = a[0];
    long long sum = a[0];

    for(int i = 1; i < n; i++) {
        if(min > a[i]) {
            min = a[i];
        }
        if(a[i] > max) {
            max = a[i];
        }
        sum += a[i];
    }

    cout << min << " " << max << " " << sum << endl;

    return 0;
}


Measured memory_bytes: 3144
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int a,b;
int main(){
	ios::sync_with_stdio(0);
	cin>>a>>b;
	forn(i,b*10,(b+1)*10){
		long double u=(long double)(i)*(0.0800);
		int v=(int)(u);
		if(v==a){
			cout<<i;
			re 0;
		}
	}
	cout<<-1;
	re 0;
}

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

const int MOD = 1e9+7;

ll cmb(int n, int k) {
    vector<ll> f(n+1),inv(n+1),invf(n+1);
    f[0]=f[1]=1;
    invf[0]=invf[1]=1;
    inv[1]=1;
    for (int i=2;i<n+1;i++) {
        f[i]=(i*f[i-1])%MOD;
        inv[i]=MOD-((MOD/i)*inv[MOD%i])%MOD;
        invf[i]=(inv[i]*invf[i-1])%MOD;
    }
    ll cmb=f[n]*(invf[k]*invf[n-k]%MOD)%MOD;
    if (n>=k) return cmb;
    else return 0;
}



int main() {
    int x,y;
    cin >> x >> y;
    int ans;
    
    if ((2*y-x)%3!=0 || (2*x-y)%3!=0) ans=0;
    else if (2*y-x<0 || 2*x-y<0) ans=0;
    else {
        int a=(2*y-x)/3;
        int b=(2*x-y)/3;
        ans=cmb(a+b,b);
    }
    cout << ans << endl;
}

Measured memory_bytes: 15872
n, l = map(int, input().split())

a = [l+int(x)-1 for x in range(1, n+1)]
b = [abs(a[i]) for i in range(n)]

if a[-1] >= 0:
  print(sum(a) - min(b))
else:
  print(sum(a) + min(b))

Measured memory_bytes: 3060
n = int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
    tmp = input()
    if tmp == 'AC':
        ac+=1
    elif  tmp == 'WA':
        wa+=1
    elif  tmp == 'TLE':
        tle+=1
    elif  tmp == 'RE':
        re+=1
    else:
        continue
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))

Measured memory_bytes: 9196
n, l = map(int,input().split())

sum_taste = 0
min_abs = 999
idx = -1
for i in range(n):
    taste = l+i
    if min_abs > abs(taste):
        min_abs = abs(taste)
        idx = i
    sum_taste += taste

print(sum_taste - (l+idx))

Measured memory_bytes: 3060
N, K = map(int, input().split())
V = list(map(int, input().split()))

ans = 0
for left in range(min(N, K) + 1):
    for right in range(min(N - left, K - left) + 1):
        tmp = V[:left] + V[N - right:]
        tmp.sort()
        score = 0
        count = K - left - right
        for i in tmp:
            if count <= 0:
                score += i
            else:
                if i < 0:
                    count -= 1
                else:
                    score += i
        # print (left, right, score, tmp)
        ans = max(ans, score)

print (ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string>
#include <algorithm>
#include <map>
#include <iostream>
#include<math.h>
using namespace std;

int main() {
	long long N, a[100001], b[100002] = { 0 }, y, ymax = 0;
	cin >> N;

	for (long long i = 0; i < N; i++)cin >> a[i];
	for (long long i = 0; i < N; i++)b[a[i]]++;
	for (int i = 0; i < 100000; i++) {
		y = b[i - 1] + b[i] + b[i + 1];
		if (ymax < y) ymax = y;
	}
	cout << ymax << endl;
}


Measured memory_bytes: 1792
s;n,k,i,y;d['   '];c(int*z){i=*1[&z]-*z;}main(x){for(scanf("%*d");~scanf("%d%d%d",&n,&k,&y);printf("%u\n",s)){for(i=--n;i;y=x)scanf("%d",&x),d[--i]=x-y;qsort(d,n,4,c);for(s=0;n>=k;s+=d[--n]);}}

Measured memory_bytes: 1180
#include<stdio.h>
int main(void)
{
		int a,b,x[7],i,j;
		for(i=0;i<7;i++){
			scanf("%d %d",&a,&b);
				x[i]=a-b;	
			}
		for(j=0;j<7;j++){		
		printf("%d\n",x[j]);
		}
		return 0;
}	

Measured memory_bytes: 600
/* You can't hack me! */
#pragma warning(disable : 4996)
#include"bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vch;
typedef set<ll> sll;
#define fo(i,n) for(ll i=0; i<(n); i++)
#define FO(i,a,b) for(auto i=a; i!=(b); i+=(b)>(a)?1:-1)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(c) c.begin(), c.end()
#define F first
#define S second
#define sc scanf
#define pr printf
#define in(x) sc("%lld", &(x))
#define id(x) sc("%Lf", &(x))
#define os(x) cout<<x<<' '
#define on(x) cout<<x<<"\n"
#define nl cout<<"\n"
#define maxe(x) max_element(all(x))-(x).begin()
#define mine(x) min_element(all(x))-(x).begin()
const ll P=998244353;
const ll MaxN=2000010;
const long double pi=3.14159265358979323846264338327950288419716939937510;

ll gcd(ll a, ll b)
{
    ll m=min(a, b), M=max(a, b);
    if(m==0) return M;
    return gcd(m, M%m);
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ll t=1;
    //cin>>(t);
    //in(t);
    fo(q, t)
    {
        ll n;
        cin>>n;
        string s;
        cin>>s;
        if(s.size()<=n) on(s);
        else
        {
            s.erase(s.begin()+n, s.end());
            s+="...";
            on(s);
        }
    }
    cerr << "Time : " << ((double)clock()) / (double)CLOCKS_PER_SEC << "s\n";
    return 0;
}

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



struct Point{double x,y,mine,high;};
bool comp(Point a,Point b) {return (a.x==b.x ? a.y<b.y : a.x<b.x);}

bool Intersection(Point p1,Point p2,Point p3,Point p4,Point *res){
    double d = (p2.x - p1.x)*(p4.y - p3.y) - (p2.y - p1.y)*(p4.x - p3.x);
    if (d == 0) return false;
    double u = ((p3.x - p1.x)*(p4.y - p3.y) - (p3.y - p1.y)*(p4.x - p3.x))/d;
    double v = ((p3.x - p1.x)*(p2.y - p1.y) - (p3.y - p1.y)*(p2.x - p1.x))/d;
    if (u < 0.0 || u > 1.0)return false;
    if (v < 0.0 || v > 1.0)return false;
    res->x = p1.x + u * (p2.x - p1.x);
    res->y = p1.y + u * (p2.y - p1.y);
    res->high = (p3.mine == p3.high);
    return true;
}

int main(void){
    int N,xa,ya,xb,yb,n,xs,ys,xt,yt,o,l;
    cin>>N;
    while(N--){
        vector<Point> cross;
        cin>>xa>>ya>>xb>>yb>>n;
        Point a = {xa,ya,true,true};
        Point b = {xb,yb,true,true};
        rep(i,n){
            cin>>xs>>ys>>xt>>yt>>o>>l;
            Point s = {xs,ys,o,l};
            Point t = {xt,yt,o,l};
            Point res;
            if(Intersection(a,b,s,t,&res)){
                cross.push_back(res);
            }
        }

        sort(cross.begin(),cross.end(),comp);
        int cnt=0;
        for(int i=0;i+1<cross.size();i++){
            cnt+=(cross[i].high!=cross[i+1].high);
        }
        cout<<cnt<<endl;
    }

    return 0;
}

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

int main() {
 int N;
  cin >> N;
for (int i=0; i<N; i++) {
  string S;
  cin >> S;
  if ( S == "Y" ) {
  cout << "Four" << endl;
    return 0;
  }  
 }
  cout << "Three" << endl;
    return 0;
}  

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

#define LL long long

#define FOR(INDEX, START, END) for (int INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (int INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	string str;
	cin >> str;

	string key = "keyence";

	if (str.size() < key.size()) {
		cout << "NO" << endl;
		return 0;
	}

	if (str.substr(0, key.size()) == key) {
		cout << "YES" << endl;
		return 0;
	}
	if (str.size() >= key.size() && str.substr(str.size() - key.size(), key.size()) == key) {
		cout << "YES" << endl;
		return 0;
	}

	int s = 0;
	while (s < key.size()) {
		if (str[s] != key[s]) {
			break;
		}
		++s;
	}

	int e = 0;
	while (e < key.size()) {
		if (str[str.size() - 1 - e] != key[key.size() - 1 - e]) {
			break;
		}
		++e;
	}

	if (s + e >= key.size()) {
		cout << "YES" << endl;
		return 0;
	}

	cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
'use strict'
function Main(input){
  input=input.split(/\n/);
  var N=input.shift()-0;
  var S=input.join('').trim().replace(/\s+/,'').split('');
  var W=0;
  for(let i=0;i<N;i++) if(S[i]==='.') W++;
  var a=[W];
  for(let i=0;i<N;i++){
    let d=(S[i]==='.'?-1:1);
    a.push(a[i]+d);
  }
  var ans=a.reduce((A,c)=>Math.min(A,c));
  console.log(ans);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 23884
#include <bits/stdc++.h>
using namespace std;
inline int read() {
    int x=0;
    char ch=getchar();
    while (!isdigit(ch)) ch=getchar();
    while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
    return x;
}
int a[510][510];
int main() {
    int k=read(),n=(k/4+(k%4>0))*2;
    if (k==1) {
        printf("1\n1");
        return 0;
    }
    if (k==n) {
        for (int i=1;i<=n;i++)
            for (int j=1;j<=n;j++) a[i][j]=(i+j-2)%n+1;
    } else {
        for (int i=1;i<=n;i++)
            for (int j=1;j<=n;j++) {
                a[i][j]=(i+j-2)%n+1+(i&1)*n;
                if (a[i][j]>k) a[i][j]-=n;
            }
    }
    cout<<n<<endl;
    for (int i=1;i<=n;i++,putchar('\n'))
        for (int j=1;j<=n;j++) printf("%d ",a[i][j]);
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
using ll = long long ;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
template< int id > struct CompTupleBy
{
  template<class T> 
  bool operator()( const T& a, const T& b ) const {
    return std::get<id>(a) < std::get<id>(b);
  }
};

using namespace std;

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

    ll x,y;
    cin >> x >> y;
    ll cnt=0;
    while(x <= y){
        x *= 2;
        cnt += 1;
    }
    cout << cnt << endl;
    
}

Measured memory_bytes: 256
from collections import deque 
N,Q=map(int, input().split())
G=[[] for _ in range(N)]
for i in range(N-1):
    a,b=map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
X=[0]*N
for i in range(Q):
    p,x=map(int, input().split())
    X[p-1]+=x
que=deque([(0,-1)])
#print(que)
while que:
    now, pre=que.popleft()
    for nex in G[now]:
        if nex==pre:
            continue
        else:
            X[nex]+=X[now]
            que.append((nex,now))

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


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &i : a) {
    cin >> i;
  }
  sort(a.begin(), a.end());
  cout << a[n-1] - a[0] << endl;
  return 0;
}

Measured memory_bytes: 256
a,b = map(int,input().split())

if a*b <= 0:
    print("Zero")
    exit()
if a > 0:
    print("Positive")
    exit()

s = abs(a) - abs(b) + 1
if s % 2 == 0:
    print("Positive")
else:
    print("Negative")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2000002;
int n, m;
vector<vector<int>> v;
int dis = 10;
int vis[N];
int main() {
	//freopen("input.txt", "r", stdin);
	scanf("%d%d", &n, &m);
	v.resize(n + 1);
	for (int i = 0; i < m; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		v[a].push_back(b);
		v[b].push_back(a);
	}
	queue<int> q;
	q.push(1);
	while (q.size()) {
		int x = q.front();
		q.pop();
		for (int i = 0; i < v[x].size(); i++) {
			int y = v[x][i];
			if (!vis[y]) {
				vis[y] = vis[x] + 1;
				q.push(y);
			}
		}
	}
	if (vis[n] == 2)
		puts("POSSIBLE");
	else
		puts("IMPOSSIBLE");

	return 0;
}


Measured memory_bytes: 13168
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int ans = 1;
    for (;ans*2 <= n; ans *= 2);
    cout << ans << endl;
}

Measured memory_bytes: 256
/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
LL now;
struct Union_Find{
    int d[SIZE],num[SIZE];
    void init(int n){
        REP(i,n)d[i]=i,num[i]=1;
    }
    int find(int x){return (x!=d[x])?(d[x]=find(d[x])):x;}
    bool is_root(int x){return d[x]==x;}
    bool uu(int x,int y){
        x=find(x);
        y=find(y);
        if(x==y)return 0;
        if(num[x]>num[y])swap(x,y);
        now-=num[x]*(LL)num[y];
        num[y]+=num[x];
        d[x]=y;
        return 1;
    }
}U;
int N,M,a[SIZE],b[SIZE];
LL an[SIZE];
int main(){
    R(N,M);
    now=N*(N-1LL)/2;
    REP(i,M)R(a[i],b[i]);
    U.init(N+1);
    for(int i=M-1;i>=0;i--){
        an[i]=now;
        U.uu(a[i],b[i]);
    }
    REP(i,M)W(an[i]);
    return 0;
}


Measured memory_bytes: 12288
#include <stdio.h>
#include <string.h>

int yorimoi(const char* kimari) {
	size_t asumisu = strlen(kimari);
	size_t i;
	if (asumisu <= 1) return 1;
	for (i = 0; i < asumisu - 1 - i; i++) {
		if (kimari[i] != kimari[asumisu - 1 - i]) return 0;
	}
	return 1;
}

int main(void) {
	int A, B;
	int fukuennmisato, mizukinana = 0;
	if (scanf("%d%d", &A, &B) != 2) return 1;
	for (fukuennmisato = A; fukuennmisato <= B; fukuennmisato++) {
		char minaseinori[8];
		snprintf(minaseinori, sizeof(minaseinori), "%d", fukuennmisato);
		if (yorimoi(minaseinori)) mizukinana++;
	}
	printf("%d\n", mizukinana);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int par[100001];
int root(int x){
	if (par[x] == x){
		return x;
	}
	else{
		return par[x] = root(par[x]);
	}
}
bool same(int x, int y){
	return root(x) == root(y);
}
void unite(int x, int y){
	x = root(x);
	y = root(y);
	if (x == y)return;
	par[x] = y;
}
int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i <= n; i++){
		par[i] = i;
	}
	int f, x, y;
	for (int i = 0; i < m; i++){
		cin >> f >> x >> y;
		if (!f){
			unite(x, y);
		}
		else{
			if (same(x, y)){
				cout << "1" << endl;
			}
			else{
				cout << "0" << endl;
			}
		}
	}
}

Measured memory_bytes: 1312