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

int main() {
    string S;
    cin >> S;
    int n=S.size();
    if(n%2==1){
        cout << "No" << endl;
    }
    else{
        int flag=1;
        for(int i=0;i<n;i++){
            if(i%2==0){
                if(S.at(i)!='h') flag=0;
            }
            else{
                if(S.at(i)!='i') flag=0;
            }
        }
        if(flag){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int a,b,c,n;
  scanf("%d%d%d", &a, &b, &c);
  n = a;
  a = b;
  b = n;
  
  n = a;
  a = c;
  c = n;
  printf("%d %d %d\n",a,b,c);
  
  return 0;
}

Measured memory_bytes: 1732
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int n;
string a,b;
int main(){
	cin>>n>>a>>b;
	for(int i=0;i<n;i++)
		cout<<a[i]<<b[i];
	return 0;
}


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

#define fast                     ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int                      long long 
#define pb                       push_back
#define pii                      pair<int,int>
#define vi                       vector<int>
#define vii                      vector<pii>
#define mi                       map<int,int>
#define mii                      map<pii,int>
#define all(a)                   (a).begin(),(a).end()
#define l                        first
#define r                        second
#define sz(x)                    (int)x.size()
#define endl                     '\n'
#define MOD                      1000000007
#define loop(i,a,b)              for(int (i)=(a);(i)<(b);(i)++)
#define rloop(i,a,b)             for(int (i)=(a);(i)>=(b);(i)--)
#define Unique(A)                (A).resize(distance((A).begin(),unique(all((A)))))
#define MXe(A)                   *max_element(all(A))
#define MNe(A)                   *min_element(all(A))
#define SP(val,precision)        fixed << setprecision((precision)) << (val)
#define setBits(x)               __builtin_popcountll(x)
#define zroBits(x)               __builtin_ctzll(x)
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define mem(name,val)            memset(name,val,sizeof(name))
#define traceA(A,x)              cerr<<#A<<": ";loop(i,0,x)cerr<<A[i]<<' ';cerr<<endl
#define traceV(A)                cerr<<#A<<": ";for(auto i:A)cerr<<i<<' ';cerr<<endl
#define maxheap                  priority_queue<int>
#define minheap                  priority_queue<int,vector<int>,greater<int>>

using namespace std;

const int N = 2e5+77;
int A[N];

int32_t main(){
    int n ; cin >> n;
    if(n>=30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

using u64 = unsigned long long;
constexpr u64 M = 2305843009213693951; // 2^61 - 1
constexpr u64 MASK31 = 2147483647; // 2^31 - 1
constexpr u64 MASK30 = 1073741823; // 2^30 - 1
constexpr u64 POSITIVIZER = 4*M;

u64 CalcMod(u64 x) {
    u64 res = (x >> 61) + (x&M);
    if (res >= M) res -= M;
    return res;
}
u64 mul(u64 x,u64 y) {
    u64 au = (x >> 31),ad = (x&MASK31),bu = (y >> 31),bd = (y&MASK31);
    u64 m = au * bd + ad * bu;
    u64 mu = (m >> 31),md = (m&MASK31);
    u64 ans = ((au*bu + mu) << 1) + (md << 31) + ad*bd;
    return CalcMod(ans);
}

struct RollingHash {
    static u64 B;
    int N;
    vector<u64> hash,power;
    RollingHash(const string &s) {
        N = (int)s.size();
        hash.resize(N + 1,0); power.resize(N + 1,0);
        hash[0] = 0; power[0] = 1;
        for (int i = 0; i < (int)s.size(); ++i) {
            hash[i + 1] = CalcMod(mul(hash[i],B) + s[i]);
            power[i + 1] = mul(power[i],B);
        }
    }
    u64 get() {return hash[N];}
    u64 get(int k) {return hash[k];}
    u64 get(int l,int r) {return CalcMod(hash[r] + POSITIVIZER - mul(hash[l],power[r - l]));}
};

mt19937_64 mt;
uniform_int_distribution<unsigned long long> rng(2,M - 2);
unsigned long long RollingHash::B = rng(mt);

int main() {
    int N; cin >> N;
    vector<string> S(N);
    rep(i,N) cin >> S[i];

    sort(S.begin(),S.end(),[](const string &a,const string &b){return a.size() < b.size();});
    set<u64> before;
    ll ans = 0;
    rep(i,N) {
        string s = S[i];
        reverse(s.begin(),s.end());
        u64 hash = 0;
        vector<int> alpha(26,0);
        rep(j,s.size()) alpha[s[j] - 'a'] ++;
        rep(k,26) {
            if (alpha[k]) {
                u64 now = CalcMod(k + 97);
                if (before.count(now)) ++ans;
            }
        }
        rep(j,s.size()) {
            hash = CalcMod(mul(hash,RollingHash::B) + s[j]);
            alpha[s[j] - 'a'] --;
            u64 x = mul(hash,RollingHash::B);
            rep(k,26) {
                if (alpha[k]) {
                    u64 now = CalcMod(x + k + 97);
                    if (before.count(now)) ++ans;
                }
            }
        }
        before.insert(hash);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 18620
n, q = map(int, input().split())

c = [0] * (n+1)
parent = [0] * (n+1)
for _ in range(n-1):
    a, b = map(int, input().split())
    parent[b] = a
    

for _ in range(q):
    p, x = map(int, input().split())
    c[p] += x

for i in range(2, n+1):
    c[i] += c[parent[i]]
    
print(' '.join(map(str, c[1:])))

Measured memory_bytes: 36896
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        a: u64,
        b: u64,
        k: u64
    }
    let x1 = std::cmp::min(a,k);
    let x2 = std::cmp::min(b, k-x1);
    println!("{} {}", a-x1, b-x2);
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int pt[1000000], last[1000000];
int main(){
    int num;
    cin >> num;
    pt[0]=1;
    for(int i=1,x;i<=num;i++){
        cin>>x;
        pt[i]=pt[i-1];
        if(last[x]&&last[x]!=i-1)
            pt[i]+=pt[last[x]];
        last[x]=i;
        pt[i]%=1000000007;
    }
    cout<<pt[num];
    return 0;
}


Measured memory_bytes: 5120
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int a, b;
    io.read(a, b);
    int ans = a + b;
    if(ans % 2 == 0){
        ans /= 2;
    }
    else{
        ans = ans / 2 + 1;
    }
    cout << ans;
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    for(int i = 1;i <= 9;i++){
        if(n % i == 0 && n / i <= 9){
            cout << "Yes" << endl;
            break;
        }
        if(i == 9) cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void merge(int [],int,int,int);
void mergeSort(int [],int,int);
#define MAX 500000
#define SENTINEL 2000000000
   
int L[MAX/2+2], R[MAX/2+2];
int count=0;

int main(){
  int n,i;
  int S[MAX];

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

  
  mergeSort(S,0,n);

  for(i=0;i<n;i++){
    if(i==n-1) printf("%d\n",S[i]);
    else printf("%d ",S[i]);
  }
  printf("%d\n",count);

  return 0;
}

void merge(int *A,int left,int mid,int right){
  int i,j,k;
  int n1,n2;  
  n1 = mid - left;
  n2 = right - mid;
  int L[n1+2],R[n2+2];
  
  for(i = 0; i < n1; i++){
    L[i] = A[left + i];
  }
  for(i = 0; i < n2; i++){
    R[i] = A[mid + i];
  }
  
  L[n1] = SENTINEL;
  R[n2] = SENTINEL;
  
  i = 0;
  j = 0;
    
  for(k = left; k < right; k++){
    count++;
    if(L[i] <= R[j]){
      A[k] = L[i++];
    }
    else{ 
      A[k] = R[j++];
    }
  }
}

void mergeSort(int *A,int left,int right){
  int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

Measured memory_bytes: 4504
N=int(input())
SP=[[list(input().split()), i+1] for i in range(N)]
for i in range(N):
  SP[i][0][1]=(-1)*int(SP[i][0][1])
SP.sort(key=lambda x:(x[0][0], x[0][1]))
for i in range(N):
  print(SP[i][1])

Measured memory_bytes: 3060
import math
x = int(input())
if x == 1:
  print(0)
  exit()
  
d = math.ceil((x+1)**0.5)
def divisorize(fct):
    b, e = fct.pop()
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]
 
 
def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct
 
 
def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a

ans = 0
fct = factorize(x)
for div in divisorize(fct):
    c = num(div)
    if d+1 <= c:
      ans += c-1
      
print(ans)


Measured memory_bytes: 4468
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    vector<ll>L(N),C(N),R(N);
    ll ans=0;
    priority_queue<ll, vector<ll>, greater<ll>> QL;
    priority_queue<ll, vector<ll>, less<ll>> QR;
    rep(i,N){
        cin>>L[i];
        QL.push(L[i]);
        ans+=L[i];
    }

    rep(i,N)cin>>C[i];

    rep(i,N){
        cin>>R[i];
        QR.push(R[i]);
        ans-=R[i];
    }

    sort(all(L));
    sort(all(R));
    reverse(all(R));
    vector<ll>SL(N+1),SC_L(N+1),SR(N+1);
    
    rep(i,N){
        QL.push(C[i]);
        ll tmp=QL.top();
        QL.pop();
        SL[i+1]=SL[i]+C[i]-tmp;

    }

    rep(i,N){
        QR.push(C[N-i-1]);
        ll tmp=QR.top();
        QR.pop();
        SR[i+1]=SR[i]+C[N-i-1]-tmp;

    }

    ll d=0;

    rep(i,N+1){
        chmax(d,SL[i]-SR[N-i]);
    }


    cout << ans+d << endl;


    return 0;
    

}

Measured memory_bytes: 9528
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
using namespace std;
int main(){
    //Seiranchan!
    int N,cnt=0,ans=0,a,M=0;
    cin >> N;

    if(N==1){
        cout << 1 << endl;
        return 0;
    }
    for(int i=0;i<=N;i++){
       if(i%2==0){
           a = i;
           while(a>0){
               cnt ++;
               a/=2;
            
           }
           if(M<cnt){
               M = cnt;
               ans = i;
           }
       }
       cnt = 0;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

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

    int n = sc.nextInt();

    List<Pair> l = new ArrayList<>();
    for (int i = 0; i < n; i++) {
        l.add(new Pair(i+1, sc.nextInt()));
    }

    Collections.sort(l, (Pair p, Pair q) -> p.b - q.b);

    StringBuffer sb = new StringBuffer();
    for (Pair x : l) sb.append(x.a + " ");

    System.out.println(sb.toString().trim());
  }
}

class Pair {
  public int a;
  public int b;

  public Pair(int a, int b) {
    this.a = a;
    this.b = b;
  }
}

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

namespace AizuOnlineJudge {
    class Program {
        static void Main() {
            var nml = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var ab = Enumerable.Range(0, 2).Select(i => Enumerable.Range(1, nml[i]).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray()).ToArray();

            for (var i = 0; i < nml[0]; ++i) {
                var c = new long[nml[2]];
                for (var j = 0; j < nml[1]; ++j) {
                    for (var k = 0; k < nml[2]; ++k) {
                        c[k] += ab[0][i][j] * ab[1][j][k];
                    }
                }

                Console.WriteLine(string.Join(" ", c));
            }
        }
    }
}


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

using namespace std;

int main(){

	int n, m, lp, les;
	cin>> n >> m;

  	lp=(m+n-1)/n;
  	//cout<< lp <<endl;//
  
  	for(int i=lp;i>0;i--){
      les=m-n*i;
      //cout<< i << " " << les <<endl;//
      if(les%i==0){
        cout<< i <<endl;
        return 0;
      }
    }
 
	return 0;
}

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

string s,t;

bool cmp(int a,int b)
{
	return a>b;
}

int main()
{
	cin >> s >> t;
	sort(s.begin(),s.end());
	sort(t.begin(),t.end(),cmp);
	if(s<t) cout << "Yes";
	else cout << "No";
	return 0;
}


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	bool flag=false;
	lli n, contador=0, contadoraux=0;
	string aux;
	cin>>n;
	vector< vector<lli> > avr(n);
	for (lli i=0; i<n; i++)
	{
		cin>>aux;
		for (int j=0; j<10; j++)
		{
			avr[i].push_back(aux[j]-97);	
		}
	}
	
	for (lli i=0; i<n; i++)
	{
		sort(avr[i].begin(), avr[i].end());
	}
	
	sort(avr.begin(), avr.end());
	
	for (lli i=1; i<n; i++)
	{
		for (int j=0; j<10; j++)
		{
			if (avr[i-1][j]==avr[i][j])
			{
				flag=true;
				continue;
			}
			else
			{
				flag=false;
				break;
			}
		}
		if ((flag)and(i==n-1))
		{
			contador++;
			contadoraux+=(contador)*(contador+1)/2;
		}
		if (flag)
		{
			contador++;
			flag=false;
		}
		else if (flag==false)
		{
			contadoraux+=(contador)*(contador+1)/2;	
			contador=0;
		}
	}
	
	cout<<contadoraux<<endl;
	
	return 0;
}

Measured memory_bytes: 16640
/*
* @Author: kabbo
* @Date:   2020-05-10 12:18:17
* @Last Modified by:   kabbo
* @Last Modified time: 2020-05-10 12:40:29
*/
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define endl '\n'
#define ull unsigned long long
#define ll long long
const int mod = 1e9 + 7;
using u64 = uint64_t;
using u128 = __uint128_t;
void solve() {
	int n, k;
	cin >> n >> k;
	vector<int>h(n + 1);
	for (int i(1); i <= n; ++i)
		cin >> h[i];
	int dp[n + 1] = {0};
	auto res = INT_MAX;
	for (int i(2); i <= n; ++i) {
		res = INT_MAX;
		for (int l(1); l <= k; ++l) {
			if ( i - l >= 1) {
				res = min(res, abs(h[i] - h[i - l]) + dp[i - l]);
			}
		}
		dp[i] = res;

	}
	cout << dp[n] << endl;
}
int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	/*int t;
	cin >> t;
	for (int i(1); i <= t; ++i) {
		printf("Case %d: ", i);*/
	solve();
	//}
#ifndef LOCAL_DEFINE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
	return 0;
}

Measured memory_bytes: 1024
#define MAXLENGTH (1200)
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;


int main()
{
	string str;
	getline(cin, str);

	for (int i=0; i<str.size();i++){
		if (str[i] >= 'a'&&str[i] <= 'z') {
			cout << (char)(str[i] - 'a' + 'A');
		}
		else if (str[i] >= 'A'&&str[i] <= 'Z') {
			cout << (char)(str[i] - 'A' + 'a');
		}
		else cout << (char)str[i];
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 3172
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    A=[]
    check=[0]*n
    temp=0
    ct=1
    for i in range(n):
        A.append((INT()-1))
    check[0]=1
    for i in range(n):
        if A[temp]==1:
            print(ct)
            break
        elif check[A[temp]]==1:
            print(-1)
            break
        else:
            temp=A[temp]
            check[temp]=1
            ct+=1
            
if __name__ == '__main__':
    do()

Measured memory_bytes: 7852
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cmath>
 
using namespace std;
typedef long long LL;
 
struct node{
	LL x , y;
}a[100];
 
int main()
{
	int n , m;
	scanf("%d %d",&n , &m);
	for(int i = 1 ; i <= n ; i++) scanf("%lld %lld",&a[i].x , &a[i].y);
	LL ans = 1LL << 62;
	for(int i = 1 ; i <= n ; i++){
		for(int j = i + 1 ; j <= n ; j++){
			for(int k = 1 ; k <= n ; k++){
				for(int l = k + 1 ; l <= n ; l++){
					int sum = 0;
					LL lx = min(a[i].x , a[j].x) , hy = max(a[i].y , a[j].y);
					LL ly = min(a[k].y , a[l].y) , hx = max(a[k].x , a[l].x);
					for(int h = 1 ; h <= n ; h++){
						if(a[h].x >= lx && a[h].x <= hx && a[h].y >= ly && a[h].y <= hy)
							sum++;
					}
					if(sum >= m) ans = min(ans , (hx - lx) * (hy - ly));
				}
			}
		}
	}
	printf("%lld\n",ans);
}

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

using namespace std;

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<int64_t> A(n), B(m);
    copy_n(istream_iterator<int64_t>(cin), n, A.begin());
    copy_n(istream_iterator<int64_t>(cin), m, B.begin());
    int ans = 0;

    vector<int64_t> SA(n + 1), SB(m + 1);
    for (int i = 0; i < n; i++)
        SA[i + 1] = SA[i] + A[i];
    for (int i = 0; i < m; i++)
        SB[i + 1] = SB[i] + B[i];

    int j = 0;
    for (int i = n; i >= 0; i--){
        while (j < m and SA[i] + SB[j + 1] <= k){
            j++;
        }
        if (SA[i] + SB[j] <= k)
            ans = max(ans, i + j);
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 9592
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 998244353
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

bool prime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}
bool comp(pair<ll,ll>a,pair<ll,ll>b)
{
    return a.fi>b.fi;
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll n; cin>>n;
vi arr(n);
rep(i,0,n)cin>>arr[i];
map<ll,ll>mpa,mpb;
mpa[1+arr[0]]++;
ll cnt = 0;

rep(i,1,n)
{
    if(mpa.find(i+1-arr[i])!=mpa.end())cnt+=(mpa[i+1-arr[i]]);
    mpa[i+1+arr[i]]++;
}

mpb[n-arr[n-1]]++;
for(ll i=n-2;i>=0;i--)
{
    if(mpb.find(i+1+arr[i])!=mpb.end())cnt+=(mpb[i+1+arr[i]]);
    mpb[i+1-arr[i]]++;
}
cout<<cnt/2<<endl;
return 0;

}


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

using namespace std;

struct point {
    int left, right, block, id;
};

bool cmp(const point &lhs, const point &rhs) {
    if (lhs.block < rhs.block)
        return true;
    else if (lhs.block > rhs.block)
        return false;
    else
        return lhs.right < rhs.right;
}

int main(){
    int n, q;
    scanf("%d %d", &n,&q);
    vector<int> A(n);
    for (int i = 0; i < n; i++)
        scanf("%d", &A[i]);

    int block_size = sqrt(n);
    vector<point> query(q);
    for (int i = 0; i < q; i++) {
        scanf("%d %d", &query[i].left, &query[i].right);
        query[i].left--, query[i].right--;
        query[i].block = query[i].left / block_size;
        query[i].id = i;
    }

    sort(query.begin(), query.end(), cmp);

    vector<int> solution(q);
    vector<int> hash(1000100);

    int left = 0, right = 0, answer = 1;
    hash[A[0]] = 1;

    for (const point &task : query) {
        while (left < task.left) {
            hash[A[left]]--;
            answer -= (hash[A[left]] == 0);
            left++;
        }
        while (left > task.left) {
            left--;
            hash[A[left]]++;
            answer += (hash[A[left]] == 1);
        }
        while (right < task.right) {
            right++;
            hash[A[right]]++;
            answer += (hash[A[right]] == 1);
        }
        while (right > task.right) {
            hash[A[right]]--;
            answer -= (hash[A[right]] == 0);
            right--;
        }
        solution[task.id] = answer;
    }

    for (int answer : solution)
        printf("%d\n", answer);
    return 0;
}


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

int main()
{
  int n; cin >> n;
  string s; cin >> s;
  int l = s.length();
  rep(i, l) {
    s[i] = (s[i]-'A'+n)%26 + 'A';
  }
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int>a(N);
    rep(i, N) cin >> a[i];
    int p = 0;
    for(int i=0; i<N; ++i){
        if(a[i]==p+1){
            p++;
        }
    }
    if(p!=0){
        cout << N-p << endl;
    }
    else cout << "-1" << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>

#define fmax(a,b) ((a)>(b)?(a):(b))

long long ans,n,k;

int main(){
	scanf("%lld%lld",&n,&k);
	if (k==0){
		printf("%lld\n",n*n);
		return 0;
	}
	for(register long long j=k+1;j<=n;j++){
		//printf("%lld %lld %lld\n",j,(j-k)*(n/j),n-(n/j)*j-k+1);
		ans+=(j-k)*(n/j)+fmax(n-(n/j)*j-k+1,0);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
n = gets.chomp.to_i
w = gets.chomp.split(" ").map(&:to_i)
mini = Float::INFINITY
(0..n-2).each do |i|
    zenhan = w[0..i].inject(:+)
    kouhan = w[i+1..n-1].inject(:+)
    mini = [(zenhan-kouhan).abs,mini].min
end
puts mini


Measured memory_bytes: 14336
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 1000000007;

constexpr int operator""_s(const char *s) {
    int r = 0;
    for (int i = 0; s[i]; i++) {
        r *= 4;
        r += s[i] - '0';
    }
    return r;
}

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

    int dp[101][1000_s] = {};
    dp[0][333_s] = 1;

    for (int k = 0; k < n; k++) {
        for (int i = 0; i < 1000_s; i++) {
            if (i == 012_s) continue;
            if (i == 102_s) continue;
            if (i == 021_s) continue;
            ll t = 0;
            for (int h = 0; h < 10_s; h++) {
                int v = h * 1000_s + i;
                if ((v | 0300_s) == 0312_s) continue;
                if ((v | 0030_s) == 0132_s) continue;
                t += dp[k][v / 10_s];
            }
            dp[k + 1][i] = t % P;
        }
    }

    ll r = 0;
    for (int i = 0; i < 1000_s; i++) {
        r += dp[n][i];
    }
    cout << r % P << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()
#入力
n, q = map(int, input().split())
G = [[] for _ in range(n+1)]
for i in range(n-1):
    x, y = map(int, input().split())
    G[x].append(y)
    G[y].append(x)

counter = [0 for _ in range(n+1)]
for _ in range(q):
    x, y = map(int, input().split())
    counter[x] += y

"""
#再帰
ans_dfs = [0 for _ in range(n)]
def dfs(now, parent, S):
    ans_dfs[now] = S + counter[now]
    for to in G[now]:
        if to == parent: continue
        dfs(to, now, ans_dfs[now])

"""
#非再帰
class p:
    num = -1
    parent = -1

    def __init__(self, x, y):
        self.num = x
        self.parent = y
#dfsでの探索順
node_list = []
ans = [0 for _ in range(n+1)]

def main():

    #dfs(1, -1, 0)
    #dfsでの探索順の作成
    stack = []
    stack.append(p(1, -1))
    while len(stack) != 0:
        now = stack.pop()
        node_list.append(now)
        for to in G[now.num]:
            if to == now.parent: continue
            stack.append(p(to, now.num))

    for now in node_list:
        ans[now.num] = counter[now.num] + ans[now.parent]

    for i in range(1, n+1): print(ans[i], end=' ')
    print()



if __name__ == '__main__':
    main()


Measured memory_bytes: 113260
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;

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

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

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

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

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

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

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

    public int nextInt() {
        return (int) nextLong();
    }

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner();
	    int n = sc.nextInt();
	    int m = sc.nextInt();
	    int[] as = new int[n];
	    for (int i = 0; i < n; ++i) {
	    	as[i] = sc.nextInt();
	    }
	    long ans = solve(n, m, as);
	    System.out.println(ans);
	}

	public static long solve(int n, int m, int[] as) {
		Queue<Long> queue = new PriorityQueue<>();
		for (int i = 0; i < n; ++i) {
			queue.add(-(long)as[i]);
		}
		for (int i = 0; i < m; ++i) {
			long max = queue.poll();
			queue.add(max / 2);
		}

		return -queue.stream().reduce((long)0, (x, y) -> x + (long)y);
	}

}


Measured memory_bytes: 36292
#include <iostream>
#include <vector>
#include <set>
using namespace std;

vector<int> pl;
int primes[1000005] = {};
typedef long long ll;


void init() {
    primes[0] = primes[1] = 1;
    for(int i=4; i<1000005; i+=2) primes[i] = 1;
    for(int i=3; i*i<1000005; i+=2)
        if(primes[i] == 0)
            for(int j=2; i*j<1000005; ++j)
                primes[i*j] = 1;

    pl.push_back(2);
    for(int i=3; i<1000005; i+=2)
        if(primes[i] == 0)
            pl.push_back(i);
    return;
}

void factorize(vector<ll> &p,vector<ll> &cnt,ll x) {
    p.clear(); cnt.clear();

    ll pp = pl[0],pi = 0;
    while(true) {
        pp = pl[pi];
        if(x <= 1) break;
        if(x % pp == 0) {
            p.push_back(pp);
            cnt.push_back(0);
            while(x%pp == 0) {
                cnt[cnt.size()-1]++;
                x /= pp;
            }
        }
        pi++;
        if(pi == pl.size()) break;
    }
    if(x > 1) {
        p.push_back(x);
        cnt.push_back(1);
    }
    return;
}

int main() {
    pl.clear();
    init();
    ll l;
    while(cin>>l, l) {
        vector<ll> fact,cnt;
        factorize(fact,cnt,l);

        ll ans = 1;

        for(int i=0; i<cnt.size(); ++i) {
            ans  *= (cnt[i]+1)*2-1;
        }
        cout<<(ans+1)/2<<endl;
    }
}

Measured memory_bytes: 5248
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;

int main() {
	ll a, b, c, x;
	ll ans = 0;

	cin >> a >> b >> c >> x;

	REP(i, a + 1) {
		REP(j, b + 1) {
			REP(k, c + 1) {
				ll now = 500 * i + 100 * j + 50 * k;

				if (now == x) {
					ans++;
				}
			}
		}
	}

	cout << ans << endl;
}

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

int main() {
	int n;
	cin >> n;
	if (n % 2 == 0) {
		cout << 0.5 << endl;
	}
	else {
		double tmp = n;
		cout << setprecision(10) << fixed << double(((tmp + 1) / 2) / tmp) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define lld long double
#define MOD 1000000007
#define inf 1000000000000000000ll
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x,ll y, ll md=inf){ll res = 1;x%=md;while(y){if(y&1)res = (res*x)%md;x *= x; if(x>=md) x %= md; y >>= 1;}return res;}
 
using namespace std;


#define endl '\n'
#define int ll

signed main() {
	fast;

	int h,w;
	cin>>h>>w;

	pii v[200002];
	for(int i=0;i<h;i++) cin>>v[i].f>>v[i].s;

	map<int,int> mp;
	for(int i=1;i<=w;i++) mp[i] = 0;

	map<int,int> mini = {{0,w}};

	for(int i=0;i<h;i++) {
		int l = v[i].f;
		int r = v[i].s;

		auto it = mp.lower_bound(l);
		int mn = inf;

		while(it!=mp.end() && it->f <= r) {
			mn = min(mn, r+1-(it->f)+(it->s));
			auto it1 = it++;
			mini[it1->s]--;
			if(mini[it1->s]==0) mini.erase(it1->s);
			mp.erase(it1);
		}

		if(r+1<=w && mn<inf) {
			if(it!=mp.end() && it->f == r + 1) {
				if(it->s > mn) {
					mini[it->s]--;
					if(mini[it->s]==0) mini.erase(it->s);
					mini[mn]++;
					mp[r+1] = mn;
				}
			}
			else {
				mp[r+1] = mn;
				mini[mn]++;
			}
		}

		if(mini.size()) cout<<mini.begin()->f+i+1<<endl;
		else cout<<-1<<endl;

	}
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int k;

ll dist[MAX_N];

ll ans;

ll solve() {
  fill_n(dist, k + 1, INF);

  deque<pair<int, ll>> deq;
  set<int> visited;

  deq.push_front(make_pair(1, 0LL));

  ll ret = 0;

  while (!deq.empty()) {
    auto cur = deq.front();
    deq.pop_front();

    int node = cur.first;
    ll cost = cur.second;

    visited.insert(node);

    dist[node] = cost;

    if (node == 0) {
      ret = cost;
      break;
    }

    int next_p1 = (node + 1) % k;
    if (visited.find(next_p1) == visited.end()) {
      if (dist[next_p1] > cost + 1LL) {
        deq.push_back(make_pair(next_p1, cost + 1LL));
      }
    }

    int next_t10 = (node * 10) % k;
    if (visited.find(next_t10) == visited.end()) {
      if (dist[next_t10] > cost) {
        deq.push_front(make_pair(next_t10, cost));
      }
    }
  }

  return ret + 1LL;
}

int main(void) {
  // Here your code !
  scanf("%d", &k);

  ans = solve();

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

  return 0;
}


Measured memory_bytes: 6528
N=int(input())
A=list(map(int, input().split()))
if N==0:
  if A[0]==1:
    print(1)
  else:
    print(-1)
  exit()
if A[0]>0:
  print(-1)
  exit()

B=[0]*(N+1)
B[N]=A[N]
for i in range(N-1, -1, -1):
  B[i]=B[i+1]+A[i]

ans=1
x=1
for i in range(1, N+1):
  if x*2<A[i]:
    print(-1)
    exit()
  elif x*2==A[i] and i!=N:
    print(-1)
    exit()
    
  if x*2<=B[i]:
    x*=2
    ans+=x
  elif x>B[i]:
    print(-1)
    exit()
  else:
    x=B[i]
    ans+=x
  x-=A[i]
print(ans)

Measured memory_bytes: 20008
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
 
int main() {
  int n;
  cin >> n;
  
  int a[n];
  rep(i,n)cin >> a[i];
  
  unordered_map<int,int> list;
  
  rep(i,n){
    if(list.count(a[i])){
      cout << "NO" << endl;
      return 0;
    }
    else{
      list[a[i]]=1;
    }
  }
  
  cout << "YES" << endl;
}





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

long long arr[100005];

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

    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    long long ans=0;

    if(arr[0]>x)
    {
        ans+=arr[0]-x;
        arr[0]=x;
    }

    for(int i=1;i<n;i++)
    {
        if(arr[i]+arr[i-1]>x)
        {
            ans+=arr[i]-(x-arr[i-1]);
            arr[i]=x-arr[i-1];
        }
    }
    cout<<ans;
    return 0;

}


Measured memory_bytes: 1024
[N, M] = map(int, input().rstrip().split(' '))
ps = []
ss = []

result = {}
ac = 0
wa = 0

was = [0 for i in range(N+1)]

for i in range(M):
    [p, s] = input().rstrip().split(' ')
    # 初めての結果
    if result.get(p) == None:
        result[p] = s
        if s == "WA":
            was[int(p)] += 1
        elif s == "AC":
            ac += 1
    # すでにAC済み
    elif result[p] == "AC":
        continue
    #  すでにWA済み
    else:
        # 今回正解
        if s == "AC":
            result[p] = s
            wa += was[int(p)]
            ac += 1
        # 今回不正解
        else:
            was[int(p)] += 1

print(" ".join(map(str, [ac, wa])))


Measured memory_bytes: 22816
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
/*
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll max3(ll a, ll b, ll c){return max(a, max(b, c));};
ll min3(ll a, ll b, ll c){return min(a, min(b, c));};
ll max4(ll a, ll b, ll c, ll d){return max(max(a, b), min(c, d));};
ll min4(ll a, ll b, ll c, ll d){return min(min(a, b), min(c, d));};
ll max5(ll a, ll b, ll c, ll d, ll e){return max(max(a, b), max3(c, d, e));};
ll min5(ll a, ll b, ll c, ll d, ll e){return min(min(a, b), min3(c, d, e));};
*/
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

//デバッグ
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){return x / gcd(x, y) * y;};


ll kai_mod(ll x){
  if(x == 0) return 1;
  return x * kai_mod(x-1) % MOD;
}


ll homb(ll n, ll k){
  ll res = 1;
  vector<ll> x = {2, 3, 4, 5, 6, 7};
  rep(i, 7){
    res *= (n + i);
    rep(j, 6){
      if(res % x[j] == 0){
        res /= x[j];
        x[j] = 1;
      }
    }
  }
  return res;
}

void solve(ll K){
  string ans;
  for(ll now = 600; now >= 1; now--){
    ll x = K / homb(now, 7);
    rep(i, x){
      ans += 'L';
    }
    K %= homb(now, 7);
    ans += '#';
  }
  string ANS;
  rep(i, ans.size()){
    if(ans[i] == 'L') ANS += 'L';
    else{
      ANS += "AVITSEF";
    }
  }
  reverse(ANS.begin(), ANS.end());
  cout << ANS << endl;
}


int main(){
  ll K;
  cin >> K;
  solve(K);
}


Measured memory_bytes: 256
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException ‚There is no more input";}else{var returnInput = this.list[this.index++];return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = new Array(N);
  for(var i = 0; i < N; i++){
    var tmp = nextIntArray();
    list[i] = {
      A : tmp[0],
      B : tmp[1]
    };
  }
  list.sort(function(a,b){
    return a.B - b.B;
  });
  var sum = 0;
  for(var i = 0; i < N; i++){
    if(sum + list[i].A <= list[i].B){
      sum += list[i].A;
    }else{
      myout("No");
      return;
    }
  }
  myout("Yes");
}


Measured memory_bytes: 92936
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<string>
#include<vector>
#include<math.h>
#include<time.h>
#include<utility>
#include<cstdlib>
#include<sstream>
#include<cstring>
#include<stdio.h>
#include<iomanip>
//#include<conio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
long long a[100000];
map<long long,int> vis;
vector<long long> ve;
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	    vis[a[i]]++;
	}
	for(int i=0;i<n;i++){
		if(vis[a[i]]>=2) ve.push_back(a[i]);
	}
	sort(ve.begin(),ve.end());
	ve.erase(unique(ve.begin(),ve.end()),ve.end());
	if(ve.size()==0){
		cout<<0<<endl;
		return 0;
	}
	if(vis[ve[ve.size()-1]]>=4){
		cout<<ve[ve.size()-1]*ve[ve.size()-1]<<endl;
		return 0;
	}
	if(ve.size()<2){
		cout<<0<<endl;
		return 0;
	}
	cout<<(ve[ve.size()-1]*ve[ve.size()-2])<<endl;
	return 0;
}


Measured memory_bytes: 7296
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String data = scanner.nextLine();
    String[] array = data.split(" ");
    String output = new String();
    for(int i=0; i<array.length; i++) {
       output += array[i].substring(0,1);
    }
    System.out.println(output.toUpperCase());
  }
}


Measured memory_bytes: 23124
import collections
N=int(input())
S = [str(input()) for _ in range(N)]
c = collections.Counter(S)
most = []
most_num=c.most_common()[0][1]
for i in c.most_common():
    if i[1]==most_num:
        most.append(i[0])
most.sort()
for i in most:
    print(i)

Measured memory_bytes: 45040
import sys


def check(line):
    for i in xrange(len(line) / 2):
        if line[i] != line[i + len(line) / 2]:
            return False
    return True

line = sys.stdin.readline().rstrip()
for i in xrange(2, len(line), 2):
    substr = line[:len(line) - i]
    if check(substr):
        print len(substr)
        break


Measured memory_bytes: 2568
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  char c;
  cin>>c;
  if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
/*input
y
1
2 1 x
*/
#include <bits/stdc++.h>
using namespace std; 
#define int long long int
#define max(x, y) ((x) > (y) ? (x) :(y))
#define pii pair< int , int> 
#define vi vector<int>
#define REP( i , st , en ) for ( int i =st; i < (int)en; i++)
#define REPD( i , en , st ) for ( int i =en; i >= (int)st; i--)
#define SZ(a) (int)a.size()
#define all(v) v.begin() , v.end()
#define pb push_back
#define F first
#define S second
#define bitch_i_m_on_fiyaah_yeahhhh ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// const int mod = 998244353;
const int mod = 1e9+7;
ostream& operator << ( ostream&  o, vector<int> s){for ( int i = 0;  i < (int)s.size() ; i++)o << s[i] << " ";o << "\n";return o;}
void  add( int &a, int b){a = a + b;if ( a< 0 ) a += mod; if ( a> mod ) a-= mod;}
void sub( int &a, int b){a = a - b;if ( a < 0) a += mod;}
int mul( int a , int b){return ((a %mod) * (b %mod) ) %mod;}
int exp( int a , int pow){ return (pow == 0 ? 1 : ( pow & 1  ? mul ( a ,exp( mul(a, a) , pow /2) ) : exp(mul(a ,a) , pow/2)));}
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
// const int inf = 1e18;
const int maxn = 6e3 +5;
void solve(int test ) 
{		
	string s;
	cin >> s;
	int q; cin >> q;
	int state = 0 ;
	vector<char> b[2];
	while( q--){
		int t;
		cin >> t;
		if ( t == 1) state ^=1;
		else {
			int d ; char c;
			cin >> d >> c;
			d--;
			b[d^state].push_back(c);
		}
	}
	if (state ==1 ){
		for ( int i =SZ(b[1])-1 ; i>= 0; i--) cout << b[1][i];
		string tt =s;
		reverse( all(tt));
		cout << tt;
		for ( char c : b[0]) cout << c;
	}
	else{
		for ( int i =SZ(b[0])-1 ; i>= 0; i--) cout << b[0][i];
		cout <<s;
		for ( char c : b[1]) cout << c;
	}
}
signed main(){
	bitch_i_m_on_fiyaah_yeahhhh
	int t =1; 
	// cin >> t;
	auto start = chrono::steady_clock::now();
	for ( int i = 0 ; i < t; i++)
	solve(i+1 );
	auto end = chrono::steady_clock::now();
	auto diff = end - start;
	// cout <<  (chrono::duration <double, milli> (diff).count()  / 1000 .0 )<< " s" << endl;
}

Measured memory_bytes: 976
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vector<pair<ll,ll>>pll(n);
  for(int i=0;i<n;i++){
    ll a,b;cin>>a>>b;
    pll[i]=mp(b,a);
  }
  ll now=llINF;
  bool ans=true;
  sort(ALL(pll),greater<pair<ll,ll>>());
  for(int i=0;i<n;i++){
    ll shime=pll[i].F;
    ll tim=pll[i].S;
    if(now>shime){
      now=shime;
    }
    now-=tim;
  }
  if(now<0)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 3456