akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
#define MOD (ll)(1e9+7)
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

struct unionfind {
    vector<int> par;
    vector<int> sizes;

    unionfind(int n) : par(n),sizes(n,1){
        rep(i,0,n) par[i] = i;
    }

    int root(int x){
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x,int y){
        x = root(x);
        y = root(y);

        if(x == y) return;

        if(sizes[x] < sizes[y] ) swap(x,y);

        par[y] = x;
        sizes[x] += sizes[y];
        sizes[y] = 0;

        return;
    }

    bool same(int x,int y){
        return root(x) == root(y);
    }

    int size(int x){
        return sizes[root(x)];
    }
};

struct edge{
    ll from,to,cost;
    edge(ll from,ll to,ll cost):from(from),to(to),cost(cost){};
};

bool comp(const edge& e1, const edge& e2){
    return e1.cost < e2.cost;
}

signed main(){
    ll n;
    cin >> n;
    Pll pos[n];
    vector<edge> es;

    rep(i,0,n){
        cin >> pos[i].fs.fs >> pos[i].fs.sc;
        pos[i].sc = i;
    }

    sort(pos,pos+n);

    rep(i,0,n-1){
        ll d = min(abs(pos[i].fs.fs - pos[i+1].fs.fs),abs(pos[i].fs.sc - pos[i+1].fs.sc));
        es.push_back(edge(pos[i].sc,pos[i+1].sc,d));
        es.push_back(edge(pos[i+1].sc,pos[i].sc,d));
    }   

    rep(i,0,n){
        swap(pos[i].fs.fs,pos[i].fs.sc);
    }

    sort(pos,pos+n);

    rep(i,0,n-1){
        ll d = min(abs(pos[i].fs.fs - pos[i+1].fs.fs),abs(pos[i].fs.sc - pos[i+1].fs.sc));
        es.push_back(edge(pos[i].sc,pos[i+1].sc,d));
        es.push_back(edge(pos[i+1].sc,pos[i].sc,d));
    }    

    sort(es.begin(),es.end(),comp);
    unionfind uf(n);    
    ll ans = 0;
    rep(i,0,es.size()){
        edge e = es[i];
        if(!uf.same(e.from,e.to)){
            uf.unite(e.from,e.to);
            ans += e.cost;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 17004
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<vector<int>>adj;
bool che=0;
int col[205];
int vis[205];

void dfs(int v ,int c){
	vis[v]=1;
	col[v]=c;
	for(auto u:adj[v]){
		if(vis[u]==1 && col[u]==col[v]){
			che=1;
		}
		if(vis[u]==0){
			dfs(u, 1-c);
		}
	}
}

int main() {
	int n;
	cin>>n;
	adj.resize(n+1);
	for(int i=1; i<=n; i++){
		string s;
		cin>>s;
		for(int j=0; j<s.size(); j++){
			if(s[j]=='1'){
				adj[i].pb(j+1);
			}
		}
	}
	dfs(1, 1);
	if(che){
		cout<<-1;
		return 0;
	}
	int maxi=0;
	for(int i=1; i<=n; i++){
		int dis[n+1];
		for(int j=1; j<=n; j++){
			dis[j]=1000000000;
		}
		dis[i]=0;
		queue<int>q;
		q.push(i);
		while(!q.empty()){
			int x=q.front();
			q.pop();
			for(auto u:adj[x]){
				if(dis[u]>1+dis[x]){
					dis[u]=1+dis[x];
					q.push(u);
				}
			}
		}
		for(int j=1; j<=n; j++){
			maxi=max(maxi, dis[j]);
		}
	}
	cout<<1+maxi;
	return 0;
}

Measured memory_bytes: 3800
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926

typedef long long int ll;

//ll chk[55];
//ll num[55];
//ll num2[55];
//ll num[ten5];
//ll num2[ten5];
//char cmap[10][10];
//priority_queue<long long int> pq;   //big at front
//stack<int> stk;
//vector<pair<ll,ll>> vint;
//vector<ll> vtime;
//deque<ll> deq[55];
//list<int> li;
//set<int> sint;
//set<ll> sll;
map<ll,ll> mp;


int main()
{
    //double ans=0.0,half;
    //float f,g,h;
    long long int sum,sum2,n1,n2,n3;
    long long int m,n,o,i,j,k=1;
    long long int a,a1,a2,a3,a4,a5,a6;
    sum=sum2=n1=n2=n3=0;
    a=a1=a2=a3=a4=a5=a6=0;
    //string s,s1;
    //char now,pre,c;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a;
        mp[a]=i;
    }
    for(i=1;i<=n;i++) cout<<mp[i]<<" ";
    return 0;
}



Measured memory_bytes: 7040
/*
For Bantako San
By shyyhs.

Using hash to insert and search for a perticular number.
Every insert and search is O(1) ideally.
*/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
using namespace std;
#define ll long long
#define Hsize 100009
#define MAXN 210001 
ll sumZ=0; //sum from the beginning
int Ai; //This is Ai in the problem, we use it only once so array is not necessary.
int N; //N in the problem

struct T
{
    ll number,times;
    int next;
}hashBucket[MAXN];
int top=0;
int hashIndex[Hsize];


//x->hash(x)
inline int hashFunc(ll x)
{
    if (x<0) x=-x;
    return (x%100007);
}

//add the current sumZ to the hash table
void addToHash(ll sumZ)
{
    int index, HsumZ, beginP;
    HsumZ = hashFunc(sumZ);
    for (beginP=index=hashIndex[HsumZ]; index>0; index=hashBucket[index].next)
        if (hashBucket[index].number == sumZ) // there is already that number in the hashbucket
        {
            hashBucket[index].times+=1;
            return;
        } 
    hashIndex[HsumZ]=(++top);
    hashBucket[top].number = sumZ;
    hashBucket[top].times = 1;
    hashBucket[top].next = beginP;
}

void init()
{
    memset(hashBucket,-1,sizeof(hashBucket));
    scanf("%d",&N);
    addToHash(0);
    for (int i=0; i<N; ++i)
    {
        scanf("%d",&Ai);
        sumZ=sumZ+Ai;
        addToHash(sumZ);
    }
}

void work()
{
    ll answer=0;
    for (int i=1; i<=top; ++i)
        answer=answer+(((hashBucket[i].times)*(hashBucket[i].times-1))>>1) ;
    cout<<answer<<endl;
}
    
int main()
{
    init();
    work();
    return 0;
}


Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <string>
#define int long long
#define P pair<int,int>
#define V vector<int>
#define rep(i,n) for(int i=0;i<n;++i)
#define vsort(vec) sort(vec.begin(),vec.end())
#define end system("PAUSE");return 0
using namespace std;
signed main() {
	int n, memo = 0;
	cin >> n;
	rep(i, n) {
		int in;
		cin >> in;
		memo += in;
	}
	if (memo % 2 == 0)cout << "YES" << endl;
	else cout << "NO" << endl;
	end;
}


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

using namespace std;

int main() {
  	int n;
  	cin >> n;
  	map<string, int> mp;
  	int mx = 0;
  	for (string s; n--;) {
      	cin >> s;
      	mp[s]++;
      	mx = max(mx, mp[s]);
    }
  	for (auto x : mp) {
      	if (x.second == mx) {
          	cout << x.first << "\n";
        }
    }
  	return 0;
}

Measured memory_bytes: 25216
c = 3.times.map{ gets.split.map(&:to_i) }

hoge = c[0][0] + c[1][1] + c[2][2]
fuga = c[0][1] + c[1][2] + c[2][0]
piyo = c[0][2] + c[1][0] + c[2][1]

puts hoge == fuga && piyo == fuga ? "Yes" : "No"

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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n;
	cin>>n;
	if (n%2==0){
		cout<<n;
	}
	else {
		cout<<2*n;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

al=s.count("R")*s.count("G")*s.count("B")

for i in range(n-2):
    for k in range(i+1,n-1):
        l=k+(k-i)
        if l>=n:
            continue
        if s[i]!=s[k] and s[i]!=s[l] and s[k]!=s[l]:
            al-=1

print(al)


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

int main(){
  string S;
  ll K;
  cin>>S>>K;
  ll N=S.size();
  ll cnt(0);
  for (int i(0);i<N-1;i++){
    if (S[i]==S[i+1]) {
      cnt++;
      i++;
    }
  }
  ll hidari(1);
  ll migi(1);
  for (int i(0);i<N-1;i++){
    if (S[i]==S[i+1]) hidari++;
    else break;
  }
  for (int i(N-1);i>0;i--){
    if (S[i]==S[i-1]) migi++;
    else break;
  }
  if (hidari==N){
    cout << N*K/2 << endl;
    return 0;
  }
  if (hidari%2==1 && migi%2==1 && S[0]==S[N-1]){
    cout << cnt*K+(K-1) << endl;
  }else{
    cout << cnt * K << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }
struct Dinic {
	using Flow = int;
	const Flow kInfFlow = INF;
	struct Edge {
		int to, rev;
		Flow cap;
		Edge() {}
		Edge(int to, int rev, Flow cap) :to(to), rev(rev), cap(cap) {}
	};
	int n;
	vector<vector<Edge>> g;
	vector<bool> used;
	vector<int> level;
	vector<int> iter;
	Dinic(int n) :n(n), g(n), used(n), level(n), iter(n) {};
	void addArc(int from, int to, Flow cap) {
		dump(from, to, cap);
		g[from].emplace_back(to, (int)g[to].size(), cap);
		g[to].emplace_back(from, (int)g[from].size() - 1, Flow());
	}
	void addEdge(int a, int b, Flow cap) {
		g[a].emplace_back(b, (int)g[b].size(), cap);
		g[b].emplace_back(a, (int)g[a].size() - 1, cap);
	}
	Flow maximumFlow(int s, int t) {
		Flow total = Flow();
		while (true) {
			levelize(s);
			if (level[t] < 0)return total;
			fill(iter.begin(), iter.end(), 0);
			Flow f;
			while (true) {
				f = augment(s, t, kInfFlow);
				if (f == Flow())break;
				total += f;
			}
		}
	}
	Flow augment(int v, int t, Flow f) {
		if (v == t)return f;
		for (int &i = iter[v]; i < g[v].size(); i++) {
			Edge &e = g[v][i];
			if (e.cap > Flow() && level[v] < level[e.to]) {
				Flow d = augment(e.to, t, min(f, e.cap));
				if (d > Flow()) {
					e.cap -= d;
					g[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return Flow();
	}
	void levelize(int s) {
		fill(level.begin(), level.end(), -1);
		queue<int> q;
		level[s] = 0;
		q.push(s);
		while (q.size()) {
			int v = q.front(); q.pop();
			for (int i = 0; i < g[v].size(); i++) {
				Edge &e = g[v][i];
				if (e.cap > Flow() && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					q.push(e.to);
				}
			}
		}
	}
};

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

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

	vector<int> S(M), T(M), B(M); rep(i, 0, M) {
		cin >> S[i] >> T[i] >> B[i];
		S[i]--, T[i]--;
		if (S[i] > T[i])swap(S[i], T[i]);
	}

	int size = N + 2;
	Dinic dinic(size);
	int s = size - 2;
	int t = size - 1;

	rep(i, 0, N) {
		if (U[i] == 'R') {
			dinic.addArc(s, i, A[i]);
		}
		else {
			dinic.addArc(i, t, A[i]);
		}
	}

	rep(i, 0, M) {
		dinic.addArc(S[i], T[i], B[i]);
	}

	cout << dinic.maximumFlow(s, t) << endl;
	return 0;
}


Measured memory_bytes: 3356
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var s string
	fmt.Scan(&s)
	ct := 0
	for _, v := range s {
		if v == '1' {
			ct++
		}
	}
	fmt.Println(ct)
}


Measured memory_bytes: 640
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import qualified Data.Map.Strict             as Map
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  n <- getInt
  ss <- VB.replicateM n BS.getLine

  let getPos y x = let y' = y `mod` n
                       x' = x `mod` n
                   in (ss VB.! y') `BS.index` x'

      isGood offy offx = loop 0
        where loop y | y == (n-1) = True
                     | otherwise  = loop' y (y+1) && loop (y+1)

              loop' j i
                | i == n = True
                | otherwise = let s  = getPos (j+offy) (i+offx)
                                  s' = getPos (i+offy) (j+offx)
                              in s == s' && loop' j (i+1)

      solve i res | i == n     = res * n
                  | isGood 0 i = solve (i+1) (res+1)
                  | otherwise  = solve (i+1) res

  print $ solve 0 0

Measured memory_bytes: 636
arr = gets.chomp.split('').map(&:to_i)
if arr[-1] == 2||arr[-1]==4||arr[-1]==5||arr[-1]==7||arr[-1]==9
  puts "hon"
elsif arr[-1] == 0||arr[-1]==1||arr[-1]==6||arr[-1]==8
  puts "pon"
elsif arr[-1] == 3
  puts "bon"
end

Measured memory_bytes: 14348
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	int n,k;
	string s;
	cin >> n>>k>>s;

	vector<int> V;

	int cnt = 1;

	rep(i,n-1) {
		if (s[i+1]==s[i]) {
			cnt++;
		} else {
			V.push_back(cnt);
			cnt = 1;
		}
	}
	V.push_back(cnt);
	// rep(i, (int)V.size()) {
	// 	cout << V[i] << " ";
	// }


	int ma = 0;
	if (s[0]=='1') {
		for (int beg=0; beg<(int)V.size(); beg+=2) {
			int end = min((int)V.size()-1, beg+2*k);
			int tem = 0;
			for (int i = beg; i<=end; i++) {
				tem+=V[i];
			} 
			ma = max(tem, ma);
		}
	} else {
		int en = min((int)V.size()-1, 2*k-1);
		for (int i = 0; i<=en;i++) {
			ma+=V[i];
		}

		for (int beg=1; beg<(int)V.size(); beg+=2) {
			int end = min((int)V.size()-1, beg+2*k);
			int tem = 0;
			for (int i = beg; i<=end; i++) {
				tem+=V[i];
			} 
			ma = max(tem, ma);
		}
	}

	cout << ma << endl;
}



Measured memory_bytes: 1020
#include<stdio.h>
#include<math.h>

void CheckBlack(int, int, int, int);
void CheckWhite(int, int, int, int);

int area[50][50];

int main()
{
	int wCount, bCount;
	int i, j, h, w;
	
	while(1)
	{
		wCount = bCount = 0;
		
		scanf("%d %d", &w, &h);
		
		char input[51];
		
		if(h == 0 && w == 0) break;
		
		for(i = 0; i < h; i++)
		{
			scanf(" %s", input);
			for(j = 0; j < w; j++)
			{
				if(input[j] == 'W') {
					area[i][j] = 1;
				} else if(input[j] == 'B') {
					area[i][j] = 2;
				} else {
					area[i][j] = 0;
				}
			}
		}
		
		for(i = 0; i < h; i++)
		{
			for(j = 0; j < w; j++)
			{
				if((area[i][j] & 3) == 1) {
					area[i][j] |= 8;
					CheckWhite(i, j, h, w);
				} else if((area[i][j] & 3) == 2) {
					area[i][j] |= 4;
					CheckBlack(i, j, h, w);
				}
			}
		}
		
		for(i = 0; i < h; i++)
		{
			for(j = 0; j < w; j++)
			{
				if((area[i][j] & 12) == 4) {
					wCount++;
				} else if((area[i][j] & 12) == 8) {
					bCount++;
				}
			}
		}
		
		printf("%d %d\n", bCount, wCount);
	}
	
	return 0;
}

void CheckBlack(int h, int w, int maxH, int maxW)
{
	int i, hh, ww;
	
	if((area[h][w] & 8) != 8)
	{
		area[h][w] |= 8;
		
		for(i = 0; i < 4; i++)
		{
			ww = cos(90 * i * M_PI / 180);
			hh = sin(90 * i * M_PI / 180);
			
			if(h + hh > -1 && h + hh < maxH && w + ww > -1 && w + ww < maxW && (area[h + hh][w + ww] & 3) == 0)
			{
				CheckBlack(h + hh, w + ww, maxH, maxW);
			}
		}
	}
}

void CheckWhite(int h, int w, int maxH, int maxW)
{
	int i, hh, ww;
	
	if((area[h][w] & 4) != 4)
	{
		area[h][w] |= 4;
		
		for(i = 0; i < 4; i++)
		{
			ww = cos(90 * i * M_PI / 180);
			hh = sin(90 * i * M_PI / 180);
			
			if(h + hh > -1 && h + hh < maxH && w + ww > -1 && w + ww < maxW && (area[h + hh][w + ww] & 3) == 0)
			{
				CheckWhite(h + hh, w + ww, maxH, maxW);
			}
		}
	}
}

Measured memory_bytes: 688
/*
    Washief Hossain Mugdho
    21 September 2020
    Educational DP Subtree
*/

#ifndef DEBUG
#pragma GCC optimize("O3")
#endif

#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define fastio ios_base::sync_with_stdio(0)
#define untie cin.tie(0)
#define ms(a, b) memset(a, b, sizeof a)
using namespace std;
int n, mod, x, y;
const int mx = 1e5 + 5;
ll down[mx], up[mx];
list<int> adj[mx];

void downPaths(int a, int parent)
{
    for (auto i : adj[a])
        if (i != parent)
        {
            downPaths(i, a);
            down[a] = (down[a] * (down[i] + 1)) % mod;
        }
}

void upPaths(int a, int parent)
{
    vector<int> children;
    for (int i : adj[a])
        if (i != parent)
            children.pb(i);

    ll suffix[children.size() + 2], prefix[children.size() + 2];
    prefix[0] = suffix[children.size() + 1] = 1;

    for (int i = 0; i < children.size(); i++)
    {
        prefix[i + 1] = (prefix[i] * (down[children[i]] + 1)) % mod;
        suffix[children.size() - i] = (suffix[children.size() - i + 1] * (down[children[children.size() - i - 1]] + 1)) % mod;
    }

    for (int i = 0; i < children.size(); i++)
    {
        ll res = (prefix[i] * suffix[i + 2]) % mod;
        res = (res * up[a] + 1) % mod;
        up[children[i]] = res;
        upPaths(children[i], a);
    }
}

int main()
{
#ifdef LOCAL_OUTPUT
    freopen(LOCAL_OUTPUT, "w", stdout);
#endif
#ifdef LOCAL_INPUT
    freopen(LOCAL_INPUT, "r", stdin);
#endif
    cin >> n >> mod;
    for (int i = 0; i < n - 1; i++)
    {
        cin >> x >> y;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    for (int i = 1; i <= n; i++)
        down[i] = up[i] = 1;
    downPaths(1, 0);
    upPaths(1, 0);
    for (int i = 1; i <= n; i++)
        cout << (down[i] * up[i]) % mod << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

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

  ll N,K;
  cin>>N>>K;
  vector<ll> A(N),ss(N);
  rep(i,N)cin>>A[i];

  ll sum=0;
  rep(i,N){
    if(i<K-1){
      sum+=A[i];
    }else{
      sum+=A[i];
      ss[i]=sum;
      sum-=A[i-(K-1)];
    }
  }
  rep(i,N){
    if(i>=K){
      if(ss[i]>ss[i-1]){
        cout<<"Yes\n";
      }else{
        cout<<"No\n";
      }
    }
  }

  return 0;
}


Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
#define deb(x) cout << #x << " => " << x << endl

int getLen(int *hash, vector<vector<int>> &rev, int vertex) {
    if (rev[vertex].size() == 0) {
        return 0;
    }
    if (hash[vertex]) {
        return hash[vertex];
    }
    int maxLen = 0;
    for (auto r : rev[vertex]) {
        maxLen = max(maxLen, getLen(hash, rev, r) + 1);
    }
    hash[vertex] = maxLen;
    return maxLen;
}

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

    int n, m;
    cin >> n >> m;
    int *hash = new int[n];
    memset(hash, false, sizeof false);

    vector<vector<int>> rev(n);

    int a, b;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        a--; b--;
        rev[b].push_back(a);
    }

    int maxLen = 0;
    for (int i = 0; i < n; i++) {
        maxLen = max(maxLen, getLen(hash, rev, i));
    }
    cout << maxLen << endl;

    return 0;
}

Measured memory_bytes: 12160
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int K = sc.nextInt();
    	int cost = 0;
    	for (int i = 1; i <= N; i++) {
    		int A = sc.nextInt();
    		int B = Math.abs(K - A);
    		cost += 2 * Math.min(A, B);
    	}
    	System.out.println(cost);
    }
}

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;



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

	int n , q;
	cin >> n >> q;
	
	vector<tuple<int,int,int>> w(n);
	auto getS = [](auto& e)->int& { return get<0>(e); }; 
	auto getT = [](auto& e)->int& { return get<1>(e); }; 
	auto getX = [](auto& e)->int& { return get<2>(e); };
	for(auto& el : w) cin >> getS(el) >> getT(el) >> getX(el);
	
	
	map<int, vi> blockers;
	map<int, vi> unblockers;
	
	rep(i , n)
	{
		int s = getS(w[i]);
		int t = getT(w[i]);
		int x = getX(w[i]);
		
		blockers[max(s - x , 0)].pb(x);
		//cout << "Added blocker " << x << " " << max(s - x , 0) << endl;
		unblockers[max(t - x ,0)].pb(x);
		//cout << "Added unblocker " << x << " " << max(t - x , 0) << endl;
	}
	
	vi d(q);
	for(auto& el : d) cin >> el;
	
	set<int> times;
	for(auto& el : blockers) times.insert(el.fi);
	for(auto& el : unblockers) times.insert(el.fi);
	for(auto& el : d) times.insert(el);
	times.insert(0);
	
	//cout << "Times: "; for(auto t : times) cout << t << " ";cout << nl;
	
	multiset<int> cur;
	map<int,int> blocked;
	for(auto t : times)
	{
		for(auto el : blockers[t])
			cur.insert(el);
		for(auto el : unblockers[t])
			cur.erase(cur.find(el));
		if(cur.empty())
			blocked[t] = -1;
		else
			blocked[t] = *cur.begin();
	}
	
	rep(i , q) cout << blocked[d[i]] << endl;
	
	
	return 0;
}


Measured memory_bytes: 166784
use std::fs;
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: expr) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    let (n, nc): (usize, usize) = parse!(it, 2);
    let d: Vec<Vec<usize>> = (0..nc).map(|x| parse!(it, nc)).collect();
    let c: Vec<Vec<usize>> = (0..n).map(|x| parse!(it, n)).collect();
    let mut g = vec![vec![]; 3];
    for i in 0..n {
        for j in 0..n {
            g[(i + j) % 3].push((i, j));
        }
    }
    let mut memo = std::collections::HashMap::new();
    let mut gd = |gi: usize, ci: usize| {
        if let Some(x) = memo.get(&(gi, ci)) {
            return *x;
        }
        let mut ret = 0;
        for &(x, y) in &g[gi] {
            ret += d[c[x][y] - 1][ci];
        }
        memo.insert((gi, ci), ret);
        ret
    };
    let mut ret = std::usize::MAX;
    for c0 in 1..(nc + 1) {
        for c1 in 1..(nc + 1) {
            if c0 == c1 {
                continue;
            }
            for c2 in 1..(nc + 1) {
                if c0 == c2 || c1 == c2 {
                    continue;
                }
                let mut pret = 0;
                let ci = vec![c0, c1, c2];
                for i in 0..3 {
                    pret += gd(i, ci[i] - 1)
                }
                ret = std::cmp::min(ret, pret);
            }
        }
    }
    println!("{:?}", ret); // DEBUG
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 17388
#include<bits/stdc++.h>
using namespace std;
map<long long int,int> Hash;
void factorize(long long int n) 
{ 
    int count = 0; 
    while (!(n % 2)) 
    { 
        n >>= 1;
        count++; 
    } 
    if (count) 
        Hash[2]=count;
    for (long long i = 3; i <= sqrt(n); i += 2) 
    { 
        count = 0; 
        while (n % i == 0)
        { 
            count++; 
            n = n / i; 
        } 
        if (count) 
            Hash[i]=count; 
    } 
    if(n>2)
        Hash[n]=1;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    long long int N;
    cin>>N;
    long long int ans=0;
    factorize(N);
    for(auto it:Hash)
    {
        long long int z=it.second;
        long long int i;
        for(i=1;i<=50;i++)
        {
            if( (i*(i+1))/2==z)
            {
                break;
            }
            else if((i*(i+1))/2>z)
            {
                i=i-1;
                break;
            }

        }
        ans+=i;        
    }
    cout<<ans;

}


Measured memory_bytes: 3656
#include <iostream>
#include <map>
#include <vector>

#define MAX 8000

using namespace std;

void parse_string(string s, vector<int>& left_and_right, vector<int>& up_and_down) {
  int len = s.size();
  bool left_right = true;
  for(int i = 0; i < len;) {
    char c = s[i++];
    int count = 1;
    while(i < len && s[i] == c) {
      i++;
      count++;
    }
    if(c == 'F') {
      if(left_right)
        left_and_right.push_back(count);
      else
        up_and_down.push_back(count);
    } else { // c == 'T'
      left_right = (count % 2 != 0) ? !left_right : left_right;
    }
  }
}

// Updates a memo vector recursively.
void construct_helper(map<int, int>& memo, vector<int>& arr, int current_index) {
  if(current_index < 0 || arr.size() <= current_index)
    return;

  int val = arr[current_index];
  int before = current_index - 1;
  map<int, int> memo2 = memo;
  for(auto p : memo2) {
    if(p.second == before) {
      int x1 = p.first + val;
      int x2 = p.first - val;
      memo[x1] = current_index;
      memo[x2] = current_index;
    }
  }
  construct_helper(memo, arr, current_index + 1);
}

// Returns true if 'x' can be consructed
// by [+-]a1[+-]a2[+-] ...[+-]an, where
// { a1, a2, ... , an } is an given array.
bool construct(int x, vector<int>& arr, int start = 0) {
  if(arr.size() == 0)
    return x == 0;

  map<int, int> memo;
  memo[0] = start - 1;
  construct_helper(memo, arr, start);
  int n = memo.find(x) != memo.end() ? memo[x] : -1;
  cerr << n << endl;
  int max_index = arr.size() - 1;
  return n == max_index;
}

int main() {
  string s;
  int dist_x, dist_y;
  cin >> s;
  cin >> dist_x;
  cin >> dist_y;
  vector<int> left_and_right;
  vector<int> up_and_down;
  parse_string(s, left_and_right, up_and_down);
  bool r1 = false;
  if(s[0] == 'F') {
    int a0 = left_and_right[0];
    r1 = construct(dist_x - a0, left_and_right, 1);
  } else {
    r1 = construct(dist_x, left_and_right);
  }
  bool r2 = construct(dist_y, up_and_down);
  if(r1 && r2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 334336
(let* ((n (read))
    (a (make-array (* n 3)))
    (ans 0))
    (loop for i below (* n 3) do
        (setf (aref a i) (read))
    )
    (setf a (sort a #'>))

    (loop for i below (* n 2) do
        (if (not (zerop (rem i 2)))
            (incf ans (aref a i))
        )
    )
    (princ ans)
)

Measured memory_bytes: 78280
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		ArrayList<Integer> oddArray = new ArrayList<Integer>();

		for (int i = 0; i < N; i++) {
			int t = sc.nextInt();
			if (t % 2 != 0) {
				oddArray.add(t);
			}
		}
		if (oddArray.size() % 2 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}
}


Measured memory_bytes: 58876
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
int a[200005];
int b[200005];
bool vis[200005]={0};
vector<int> v[200005];
int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    long long n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        b[i]=v[a[i]].size();
        v[a[i]].push_back(i);

    }
    //cout<<":::";
    int now=0,loop=1;
    while(1)
    {
        //cout<<now<<'\n';

        if(now==v[a[now]].back())
        {
            now=v[a[now]][0]+1;
            loop++;
        }
        else now=v[a[now]][b[now]+1]+1;

        if(now==n) break;
    }
    //cout<<"LOOP"<<loop<<'\n';
    k=k%loop;
    vector<int> st;
    //cout<<st.size()<<'\n';
    now=0;
    loop=0;
    while(loop<k-1)
    {
        if(v[a[now]].size()==1)
        {
            loop++;
            now++;
            continue;
        }
        if(now==v[a[now]].back())
        {
            now=v[a[now]][0]+1;
            loop++;
        }
        else now=v[a[now]][b[now]+1]+1;
    }
    for(int j=now;j<n;j++)
    {
        if(!vis[a[j]])
        {
            st.push_back(a[j]);
                //cout<<a[j]<<'\n';
        }
        if(vis[a[j]])
        {

            while(st.back()!=a[j])
                {

                    vis[st.back()]=false;
                    st.pop_back();
                }
                st.pop_back();
        }
        vis[a[j]]=!vis[a[j]];

            //cout<<st.size()<<'\n';
    }

        for(int o=0;o<st.size();o++)
            cout<<st[o]<<' ';
        cout<<'\n';

}



Measured memory_bytes: 15096
# -*- coding: utf-8 -*-

N,A,B = map(int, input().split())
hN = [int(input()) for i in range(N)]

# 特定の爆破数で全滅させられるかを判定する関数
def enough(T):
    cnt = 0
    # 各魔物について確認していく
    for i in range(N):
        hp = hN[i]
        # 全体への共通ダメージ分
        hp -= B*T
        # 倒せていなければ追加ダメージを与える
        if hp > 0:
            cnt += (hp-1) // (A-B) +1
    # 追加ダメージに使用した合計爆破数がT回以内かどうか判定
    if cnt <= T:
        return True
    else:
        return False

# 2分探索で最初にTrueになる場所を見つける
hi = 10 ** 9
low = 0
while low+1 < hi:
    mid = (hi+low) // 2
    if enough(mid):
        hi = mid
    else:
        low = mid
print(hi)

# hi = 10 ** 9 + 1
# low = 0
# mid = 10 ** 9 // 2
# while low+1 < hi:
#     if enough(mid):
#         hi = mid
#     else:
#         low = mid
#     mid = (hi+low+1) // 2
# print(mid)

Measured memory_bytes: 7072
#include <bits/stdc++.h>
using namespace std;
int l[1005];
long long sum;
int main(){
	int a;
	cin >> a;
	int max=0;
	for(int i=0;i<a;i++){
		cin >> l[i];
		if(l[i]>max) max=l[i];
		sum+=l[i];
	}
	if(sum-max>max)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n; i++)
    {
        if (i % 3 == 0)
            continue;
        if (i % 5 == 0)
            continue;
        ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc135/tasks/abc135_b

n = int(input())
p = [int(x) for x in input().split()]
q = sorted(p)
r = [p1 != q1 for p1, q1 in zip(p, q)]
print("YES" if r.count(True) == 2 or r.count(True) == 0 else "NO")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
char su(int i){
  if(i==0) return 'z';
  return (char)(i+96);
}
int main(){
  ll n; cin >> n;
  string ans;
  while(n>0){
    ll ama = n%26;
    ans = su(ama) + ans;
    n /=26;
    if(ama==0)n--;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll>PLL;
#define rep(i,n) for (int i = 0; i < (n); ++i)
ll MOD = 1e4+7;
int main() {
    string n;
    cin >> n;
    int top = 0;
    bool all9 = true;
    rep(i, n.length()) {
        if ( i == 0 ) top = n[i] - '0';
        else if ( n[i] != '9' ) all9 = false;
    }
    if ( all9 ) cout << top + ( n.length() - 1 ) * 9 << endl;
    else        cout << top + ( n.length() - 1 ) * 9 - 1 << endl;
    return 0;
}



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

typedef long long int llint;

int main()
{
	llint n = 0, k = 0;
	llint val = 0, ret = 0;
	if (scanf("%lld %lld", &n, &k));
	if ((n == k) || (n == 0)) goto func;
	val = n % k;
	ret = k - val;
	val = (val < ret) ? val : ret;		

func:
	printf("%lld", val);

	return 0;

}

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

#define ll long long
#define ar array

const int mxM=1e6;
int n, c[mxM+1][26], d[mxM+1][26], ts=1;
ll ans;
string s[200000];

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

	cin >> n;
	for(int i=0; i<n; ++i)
		cin >> s[i];
	sort(s, s+n, [](const string &a, const string &b) {
		return a.size()<b.size();
	});
	for(int i=0; i<n; ++i) {
		int e[26]={};
		for(char c : s[i])
			++e[c-'a'];
		for(int j=s[i].size(), u=0; ~j; --j) {
			for(int k=0; k<26; ++k)
				if(e[k])
					ans+=d[u][k];
			if(j) {
				--e[s[i][j-1]-'a'];
				if(j<2)
					++d[u][s[i][0]-'a'];
				if(!c[u][s[i][j-1]-'a'])
					c[u][s[i][j-1]-'a']=ts++;
				u=c[u][s[i][j-1]-'a'];
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 162612
#include <cstdio>

#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
    vector<int> vec;
    int n_data, in;
    for (;;) {
	scanf("%d", &n_data);
	if (n_data == 0)
	    return 0;

	for (int i = 0; i < n_data; ++i) {
	    scanf ("%d", &in);
	    vec.push_back(in);
	}
	sort(vec.begin(), vec.end());

	int ave = 0;
	for (auto it = vec.begin() + 1; it < vec.end() - 1; ++it)
	    ave += *it;
	printf("%d\n", ave / (n_data - 2));
	vec.clear();
    }
}

Measured memory_bytes: 1036
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def prime_factorization(n):
    res = []
    for i in range(2, int(pow(n, 0.5))+1):
        if n % i: continue
        ex = 0
        while n % i == 0:
            n = n // i
            ex += 1
        res.append((i, ex))
    if n != 1:
        res.append((n, 1))
    return res

def solve():
    N = II()
    fact = prime_factorization(N)
    # print(fact)
    ans = 0
    for num, ex in fact:
        th = 1
        while ex >= th:
            ans += 1
            ex -= th
            th += 1
    print(ans)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9464
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int c0 =0, c1=0 , c2=0 ,c3 = 0;
		
		for (int i = 0; i < N; i++) {
            String d = sc.next();
			if (d.equals("AC")){c0++;}
			if (d.equals("WA")){c1++;}
			if (d.equals("TLE")){c2++;}
			if (d.equals("RE")){c3++;}
		}
		
		

      System.out.println("AC "+"x "+ c0 );
	  System.out.println("WA "+"x "+ c1 );
	  System.out.println("TLE "+"x "+ c2 );
	  System.out.println("RE "+"x "+ c3 );
      
    }
}

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

using namespace std;

template <class T>
using lim = numeric_limits<T>;

typedef long long ll;
typedef long double ld;

const int maxN = 10e5;
vector<ll> primes;
bool primeList[maxN+1];

// list of 2017-like numbers
bool numList[maxN+1];

void sieve(int n){
	for (int i = 2; i <= n; i++){
		bool isPrime = true;
		for (ll p : primes){
			if (p*p > i) break;
			
			if (i%p == 0){
				isPrime = false;
				break;
				}
			}
		
		if (!isPrime) continue;
		
		primes.push_back(i);
		primeList[i] = true;
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	memset(primeList, false, sizeof(primeList));
	memset(numList, false, sizeof(numList));
	sieve(maxN);
	
	for (int i = 3; i < maxN; i++){
		int partner = (i+1)/2;
		if (primeList[i] && primeList[partner]) numList[i] = true;
	}
	
	// prefix sum of 2017-like numbers
	int prefix[maxN+1];
	prefix[0] = (int) numList[0];
	for (int i = 1; i <= maxN; i++){
		prefix[i] += prefix[i-1] + (int)numList[i];
	}
	
	//queries
	int q; cin >> q;
	while(q--){
		int l, r; cin >> l >> r;
		cout << prefix[r] - prefix[l-1] << endl;
	}
	
}


Measured memory_bytes: 7284
import numpy as np
N = int(input())
l = np.array(list(map(int,input().split())))
ans = 'Yes'
M = l[0]

for i in range(1,N):
    if l[i] > l[i-1]:
        M = l[i]

    if l[i]< M-1:
        ans ='No'
        break
print(ans)

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  vector<int> q(n);
  for (int i = 0; i < n; ++i) cin >> p[i];
  for (int j = 0; j < n; ++j) cin >> q[j];

  vector<int> indices(n);
  iota(indices.begin(), indices.end(), 1);

  int ip = -1, iq = -1;
  int cur = 0;
  do {
    cur++;
    bool okp = true;
    bool okq = true;
    for (int i = 0; i < n; ++i) {
      if (indices[i] != p[i]) okp = false;
      if (indices[i] != q[i]) okq = false;
    }
    if (okp) ip = cur;
    if (okq) iq = cur;
  } while (next_permutation(indices.begin(), indices.end()));
  assert(ip >= 1);
  assert(ip >= 1);
  int ans = abs(ip - iq);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <math.h>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <numeric>
#include <list>
#include <deque>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int, int>PII;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), rend()
#define PB pushback
#define SORT(c) sort((c).begin(),(c).end())

const LL INF = 1LL << 60;

//priority_queue<int> p;

LL i, j, k, tmp, ans, cnt, N;
string s;

//scanf("%d",&N);

//printf("%d", ans);

//cout <<  << endl;

LL roundUP(LL div1, LL div2) {
	return (div1 + div2 - 1) / div2;
}

int main(void) {
	vector<LL> trans;
	scanf("%lld", &N);

	for(int i = 0; i < 5; i++){
		scanf("%lld", &tmp);
		trans.push_back(tmp);
	}
	LL neck = roundUP(N, trans.at(0));
    ans += roundUP(N, trans.at(0));
	
	for(int i = 1; i < 5; i++){
		if (neck < roundUP(N, trans.at(i))) {
			ans += roundUP(N,trans.at(i)) - (neck - 1);
			neck = roundUP(N, trans.at(i));

		}
		else {
			ans += 1;

		}
	}

	printf("%lld", ans);
	return 0;
}

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

int main(){
	int x[10000],i=0;
	do{
		cin>>x[i];
		i++;
	}while(x[i-1]);
	for(int j=0;j+1<i;j++) cout<<"Case "<<j+1<<": "<<x[j]<<endl;
	return 0;
}

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

int main(){
  int a,b,c,d=0,e,array[100001]={},i,j,k;
  string s;
  cin>>a;
  for(i=0;i<a;i++){
    cin>>array[i];
  }
  for(i=0;i<a;i++){
    c=0;
    while(array[i]==array[i+1]){
      c++;
      i++;
    }
    if(c==1){
      d++;
    }else{
      d+=c/2+c%2;
    }
  }
  cout<<d<<endl;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5))
	cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;
static const int M = 22370000;
bool Hash[M];

inline int convertChartoNum(const char c)
{
	if (c == 'A')
	{
		return(1);
	}
	else if (c == 'C')
	{
		return(2);
	}
	else if (c == 'G')
	{
		return(3);
	}
	else if (c == 'T')
	{
		return(4);
	}
}

inline int getKey(const string& s)
{
	int sum = 0;
	int p = 1;
	int size = s.size();
	for (int i = 0; i < size; ++i)
	{
		sum += p * convertChartoNum(s[i]);
		p *= 4;
	}
	return(sum);
}

void solve()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		string command, str;
		cin >> command >> str;
		int key = getKey(str);
		if (command[0] == 'i')
		{
			if (!Hash[key])
			{
				Hash[key] = true;
			}
		}
		else
		{
			if (Hash[key])
			{
				printf("yes\n");
			}
			else
			{
				printf("no\n");
			}
		}
	}
}

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

Measured memory_bytes: 2572
import math
 
stri = input()
ary = stri.split()
n = int(ary[0])
k = int(ary[1])
 
ans1 = 1 * (n-k +1 )
ansi = 0
ansi = int(ans1)
print(ansi)
for i in range(2,k+1):
    ansi = ansi * (k- i + 1) // int( i - 1 ) *  (n-k - i + 2) // int(i) 
    type(ansi)
    print(int(ansi % int(1000000007)))

Measured memory_bytes: 3316
#include<stdio.h>

int main() {
  int x1,x2,y1,y2;
  scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
  
  int x3,y3,x4,y4;
  x3=x2-y2+y1;
  y3=y2+x2-x1;
  x4=x3-y3+y2;
  y4=y3+x3-x2;
  
  printf("%d %d %d %d",x3,y3,x4,y4);
}


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

int n, a, mn=1e9, ans;
int main() {
	cin >> n;
	while(n--) {
		scanf("%d", &a);
		if(a < mn) ans++;
		mn = min(mn, a);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<string>
    
using namespace std;
long int a, b, k;
int main() {
    cin >> a >> b >> k;
    if (a > k) {
        a = a -k ;
    } else if ( k-a < b) {
        b = b - k + a;
        a = 0;
    } else {
        a = 0;
        b = 0;
    }
    cout << a << " " << b <<endl;
}

Measured memory_bytes: 256
import sys
from collections import Counter

n = int(sys.stdin.readline().rstrip())
s = sys.stdin.readline().rstrip()

def main():
    c = Counter(s)
    l = set()
    r = set(s)
    res = 0
    cnt = 0
    for letter in s:
        c[letter] -= 1
        if not c[letter]:
            r -= set([letter])
            if letter in l:
                cnt -= 1
        elif not letter in l:
            l.add(letter)
            cnt += 1
            res = max(res, cnt)
    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3316
l,r = gets.split.map(&:to_i)
ans = Float::INFINITY
r = [r,l+2019].min #　modの性質より
(l..r).each do |i|
  (l..r).each do |j|
    next if i >= j
    mod = i*j % 2019
    ans = mod if mod < ans
  end
end
p ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i = 0; i < ll(n); ++i)
#define FOR(i,a,b) for(ll i = (a); i <= ll(b); ++i)
#define ROF(i,a,b) for(ll i = (a)-1; i >= ll(b); --i) 
#define all(a) (a).begin(),(a).end()
#define fst first
#define snd second
typedef long long ll;
typedef vector<ll> vi;
const ll inf = 1ll<<10;

struct info{
  char c;
  ll minx,miny,maxx,maxy,count;

  info():minx(inf),miny(inf),maxx(0),maxy(0),count(0){}

  ll size(){
    return (maxx - minx + 1) * (maxy - miny + 1);
  }

  bool isin(ll x,ll y){
    bool res = false;
    if(minx <= x and x <= maxx and miny <= y and y <= maxy) res = true;
    return res;
  }
};

main(){
  ll n; cin >> n;
  ll h,w;
  rep(l,n){
    cin >> h >> w;
    vector<info> alpha(26);
    rep(i,26) alpha[i].c = 'A' + i;
    vector<string> xray(h); rep(i,h) cin >> xray[i];
    rep(i,h) rep(j,w){
      if(isalpha(xray[i][j])){
	alpha[ xray[i][j] - 'A' ].minx = min(i, alpha[ xray[i][j] - 'A' ].minx);
	alpha[ xray[i][j] - 'A' ].miny = min(j, alpha[ xray[i][j] - 'A' ].miny);
	alpha[ xray[i][j] - 'A' ].maxx = max(i, alpha[ xray[i][j] - 'A' ].maxx);
	alpha[ xray[i][j] - 'A' ].maxy = max(j, alpha[ xray[i][j] - 'A' ].maxy);
	alpha[ xray[i][j] - 'A' ].count++;
      }
    }
    //rep(i,26) cout << alpha[i].size() << endl;
    ROF(i,26,0){
      if(alpha[i].count == 0) alpha.erase(alpha.begin() + i);
    }
    ll prevsz;
    do{
      prevsz = alpha.size();
      rep(k,alpha.size()){
	if(alpha[k].size() == alpha[k].count){ // 長方形

	  // 領域内の各文字について
	  FOR(i,alpha[k].minx,alpha[k].maxx){
	    FOR(j,alpha[k].miny,alpha[k].maxy){
	      if(xray[i][j] == alpha[k].c){ // 消したい文字なら
		rep(m,alpha.size()){ // 所属する文字のcount++
		  if(alpha[m].isin(i,j)) alpha[m].count++;
		}
	      }
	    }
	  }
	  alpha.erase(alpha.begin() + k);
	  break;
	}
      }	  
    }while(prevsz != alpha.size());

    if(alpha.size())
      cout << "SUSPICIOUS\n";
    else
      cout << "SAFE\n";
  }
}


Measured memory_bytes: 3172
n,k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0]*n

for i in range(1,n):
    temp = 10**10
    for j in range(1, min(k+1, i+1) ):
        temp = min(temp, abs(h[i] - h[i-j]) + dp[i-j])
    dp[i] = temp

print(dp[n-1])

Measured memory_bytes: 52448
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func getInt() (n int) {
	sc.Scan()
	n, _ = strconv.Atoi(sc.Text())
	return n
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	K := 0
	N := getInt()
	d := make([]int, N)
	for i := 0; i < N; i++ {
		d[i] = getInt()
	}

	sort.Ints(d)
	K = d[len(d)/2] - d[len(d)/2-1]

	fmt.Println(K)
}


Measured memory_bytes: 2048
#include <iostream>
#include <vector>

using namespace std;

int getMaximumHapinessPoints(vector<vector<int>> activitiesVector, int days)
{
    for(int i = 1 ; i < days ; i++)
    {
        for(int j = 0 ; j < 3 ; j++)
        {
            activitiesVector[i][j] += max(activitiesVector[i-1][(j+1)%3], activitiesVector[i-1][(j+2)%3]);
        }
    }
    int maxHappinessPoints = max(activitiesVector[days-1][0], activitiesVector[days-1][1]);
    return max(activitiesVector[days-1][2], maxHappinessPoints);
}

int main(int argc, const char * argv[])
{
    int                 days;
    vector<vector<int>> activitiesVector;
    cin>>days;
    for(int i = 0 ; i < days ; i++)
    {
        vector<int> innerVector;
        for(int j = 0 ; j < 3 ; j++)
        {
            int element;
            cin>>element;
            innerVector.push_back(element);
        }
        activitiesVector.push_back(innerVector);
    }
    cout<<getMaximumHapinessPoints(activitiesVector, days)<<endl;
    return 0;
}


Measured memory_bytes: 11824