akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>

using namespace std;

int main(){
    short int N;
    cin >> N;

    vector< vector <short int> > game(N, vector<short int>( N-1 ));
    for(short int i=0; i<N; i++){
        for(short int j = 0; j< N-1; j++){
            cin >> game[i][j];
        }
    }

    int ok = 1;
    int n; 
    int sum = 0;
    int ans = 0;
    
    while(ok){
        vector < short int > et(0);
        n  =0;
        for(int i=0; i<N; i++){
            if(game[i].size() != 0){
                if(game[ game[i][0] -1 ][0] == i+1){
                    et.emplace_back(i);
                    n++;
                    sum ++;
                }
            }
        }
        for(auto itr = et.begin(); itr != et.end(); ++itr){
            game[*itr].erase(game[*itr].begin());
        }
        if(n != 0){
            ans ++ ;
        }
        
        if( sum == N * (N-1)){
            break;
        }
        else if(n==0) ok=0;
    }
    if(ok) cout << ans << endl;
    else cout << -1 <<endl;
    return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  int X, Y;
  cin >> X >> Y;
  if (X%Y)
    cout << X << endl;
  else
    cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
ll n, a, b;
vector<ll> ans;
vector<ll> fin;

void construct(void)
{
	ll rem=n-(a+b-1), i, j;
	for(i=b ; i>=1 ; i--) ans.push_back(i);
	for(i=2 ; i<=a ; i++)
	{
		for(j=1 ; j<=min(rem,b-1) ; j++) ans.push_back(i*b-j+1);
		rem-=min(rem,b-1);
		ans.push_back((i-1)*b+1);
	}
	fin=ans; sort(fin.begin(),fin.end());
	for(i=0 ; i<n ; i++) ans[i]=lower_bound(fin.begin(),fin.end(),ans[i])-fin.begin()+1;
	for(i=0 ; i<n ; i++) cout<<ans[i]<<" ";
}

int main(void)
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n>>a>>b;
	if(a+b-1<=n && n<=a*b) construct();
	else cout<<-1; return 0;
}

Measured memory_bytes: 8172
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    s = s_input()

    print(s[:3])

if __name__ == '__main__':
    main()


Measured memory_bytes: 72684
#include "bits/stdc++.h"
using namespace std;

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

	int ans = 0;
	for (int i = 1; i < n; i++) {
		for (int j = 1; i * j < n; j++) {
			ans++;
		}
	}
	cout << ans << endl;
}

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

using namespace std;

const int N = 1005;

int a[N][2], f[N * 10];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, n;
  cin >> h >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
  }
  f[0] = 0;
  for (int i = 1; i <= h; i++) {
    f[i] = 1e9;
    for (int j = 0; j < n; j++) {
      if (i - a[j][0] > 0) {
        f[i] = min(f[i], a[j][1] + f[i - a[j][0]]);
      } else {
        f[i] = min(f[i], a[j][1]);
      }
    }
  }
  cout << f[h] << '\n';
  return 0;
}

Measured memory_bytes: 256
x = gets.to_i
ans = 0
flag = 0

x.upto(500000) do |i|
	(3..(i/2)).each do |j|
		flag = 1 if i % j == 0
	end
  if flag == 0
    ans = i
    break
  else
  	flag = 0
  end
end
puts ans

Measured memory_bytes: 3836
import java.util.*;

class Graph {
	private int totalVertex;
	//adjMatrix[u][v] = 1 if there is an edge from u to v, otherwise 0
	private int[][] adjMatrix;
	//adjWeight[u][v] -- the weight of the edge from u to v if there is one
	private int[][] adjWeight;
	//if a node is settled (e.g., processed in the Dijkstra's algorithm)
	private Boolean[] ifSettled;
	public Graph() { totalVertex = 0; }
	public int getTotalVertex() { return totalVertex; }
	//load graph from standard input
	public void loadAdjMatrix() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjMatrix = new int[totalVertex][totalVertex];
		adjWeight = new int[totalVertex][totalVertex];
		ifSettled = new Boolean[totalVertex];
		int i, j;
		for(i = 0; i < totalVertex; i ++) {
			ifSettled[i] = false;
			for(j = 0; j < totalVertex; j ++) {
				adjMatrix[i][j] = adjWeight[i][j] = 0;
			}
		}
		int u, v;
		for(i = 0; i < totalVertex; i ++) {
			u = in.nextInt();
			int degree = in.nextInt();
			for(j = 0; j < degree; j ++) {
				v = in.nextInt(); 
				adjMatrix[u][v] = 1;
				adjWeight[u][v] = in.nextInt();
			}	
		}
		in.close();
	}
	//return weight of the edge from u to v if there is one
	public int getWeight(int u, int v) {
		return adjWeight[u][v];
	}
	//return neighbors of u as a LinkedList
	public LinkedList<Integer> getNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if(adjMatrix[u][v] == 1) tmp.add(v);
		}
		return tmp;
	}
	//return unsettled neighbors of u as a LinkedList
	public LinkedList<Integer> getUnsettledNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if((adjMatrix[u][v] == 1) && (ifSettled[v] == false)) tmp.add(v);
		}
		return tmp;
	}
	//return the unsettled node that has the smallest dist
	public int getUnsettledNearest(int[] dist) {
		int md = Integer.MAX_VALUE;
		int mv = -1;
		int v;
		for(v = 0; v < totalVertex; v ++) {
			if((ifSettled[v] == false) && (dist[v] < md)) {
				md = dist[v];
				mv = v;
			}
		}
		return mv;
	}
	//implement the following	
	public int[] Dijkstra(int s) {
		int[] dist = new int[totalVertex];
		
		for (int i = 0; i < dist.length; i++) { 
            dist[i] = Integer.MAX_VALUE; 
 
        }
		dist[s]=0;
		
		for(int i = 0; i < totalVertex-1; i++) {
			int closest = getUnsettledNearest(dist);
			ifSettled[closest] = true;
			// Update dist[v] only if is not settled, there is an edge from 
            // u to v, and total weight of path from src to  v through u is 
            // smaller than current value of dist[v] 
			for(int v = 0; v < totalVertex; v++) {
				if (!ifSettled[v] && adjMatrix[closest][v] != 0 && dist[closest] != Integer.MAX_VALUE && dist[closest] + adjWeight[closest][v] < dist[v]) 
                    dist[v] = dist[closest] + adjWeight[closest][v]; 
			}
		}
		return dist;
	}
	
	
}




public class Main {
	public static void main(String[] argv) {
		Graph g = new Graph();
		g.loadAdjMatrix();
		int[] dist = g.Dijkstra(0);
		for(int i = 0; i < g.getTotalVertex(); i ++) {
			System.out.println(i + " " + dist[i]);
		}
	}
}









Measured memory_bytes: 40252
unittest
{
	assert( [ "2019/04/30" ].parse.expand.solve == "Heisei" );
	assert( [ "2019/11/01" ].parse.expand.solve == "TBD" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front;
	return tuple( s );
}

auto solve( string s )
{
	return ( s <= "2019/04/30" ) ? "Heisei" : "TBD";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
#define pii pair<int, int>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int h, w;
    cin >> h >> w;

    vector<vector<int>> c(10, vector<int>(10));
    rep(i, 10) {
        rep(j, 10) {
            cin >> c[i][j];
        }
    }

    rep(k, 10) {
        rep(i, 10) {
            rep(j, 10) {
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }

    int ans = 0;
    rep(i, h) {
        rep(j, w) {
            int a;
            cin >> a;
            if(a >= 0) {
                ans += c[a][1];
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e18
#define PIE 3.14159265358979323

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

int main() {
    ll n;
    cin >> n;
    vector<ll> v(5);
    int r;
    ll m = INF;
    rep(i, 5) {
        cin >> v[i];
        if (chmin(m, v[i]))
            r = i;
    }
    ll ans = 4;
    if (n % v[r])
        ans += n / v[r] + 1;
    else
        ans += n / v[r];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

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

using namespace std;
typedef long long ll;

int main()
{
    // Input
    ll a;
    long double b;
    cin >> a >> b;

    ll bnew = round(b * 100);

    cout << fixed << (a * bnew / 100);

    return 0;
}


Measured memory_bytes: 3172
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int tA = scan.nextInt();
		int tB = scan.nextInt();
		int aC = scan.nextInt();
		int aD = scan.nextInt();
		String ans = "Yes";
		
		while(tA>0 && aC>0){
          //高橋君の攻撃
          aC = aC - tB;
          if(aC <= 0){
            ans="Yes";
            break;
          }

          //青木君の攻撃
          tA = tA - aD;
          if(tA <= 0){
            ans = "No";
            break;
          }
        }
      
        //回答表示
        System.out.println(ans);
    }
}

Measured memory_bytes: 35852
member = int(input())
param = input().split()
day = int(param[0])
rest = int(param[1])

choco = []
for m in range(member):
    span = int(input())
    eat = 0
    for d in range(0,day,span):
        eat += 1
#         print(eat, d)
    choco.append(eat)
#     print(choco)

print(sum(choco, rest))

Measured memory_bytes: 3060
#/*
    AUTHOR:shivam51
    IIESTS
*/
  #include<bits/stdc++.h>
  using namespace std;
  //
  // #define MAX 100001
  #define md 998244353
  #define add accumulate
  #define ll long long int
  #define ld long double
  #define ff first
  #define ss second
  #define pb push_back
  #define mp make_pair
  #define vll vector<ll>
  #define lb lower_bound
  #define ub upper_bound
  #define pll pair<ll,ll>
  #define vpll vector<pll>
  #define all(v) v.begin(), v.end()
  #define rep(i,k,n) for(int i=k;i<n;i++)
  #define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
  #define repa(a,n) for(int i=a;i<n;i++)
  const int MAX=1e5+5;
  const int mod=1e9+7;
  const int N=3e5+9;
  const long double eps=1e-9;
  const ld PI=acos(-1.0);
    ll dx[]={1,0,-1,0};
	ll dy[]={0,1,0,-1};
	int dp[MAX];
  //
  //
	int arr[MAX];
	ll oper(ll index){
		if(dp[index]!=-1)
			return dp[index];
		ll fst=abs(arr[index]-arr[index-1])+oper(index-1);
		ll snd=abs(arr[index]-arr[index-2])+oper(index-2);
		dp[index]= min(abs(arr[index]-arr[index-1])+oper(index-1),abs(arr[index]-arr[index-2])+oper(index-2));
		return dp[index];
	}
  int main(){
  	rep(i,0,MAX)
  		dp[i]=-1;
  	ll n;
  	cin>>n;
  	rep(i,0,n)	cin>>arr[i];
  	dp[0]=0;
  	dp[1]=abs(arr[1]-arr[0]);
  	dp[2]=abs(arr[2]-arr[0]);
  	// cout<<oper(n-1);
  	oper(n-1);
  	cout<<dp[n-1]<<" ";
  	// rep(i,0,n)
  		// cout<<dp[i]<<" ";
  	return 0;
  }

Measured memory_bytes: 5760
IDENTIFICATION DIVISION.
PROGRAM-ID. SORTNUM.

DATA DIVISION.
    WORKING-STORAGE SECTION.
      
      01 X PIC 9.

PROCEDURE DIVISION.
    MAIN SECTION.
      
      ACCEPT X.
      
      IF X = 0 THEN
      	DISPLAY 1
      ELSE
      	DISPLAY 0
      END-IF.


    STOP RUN.


Measured memory_bytes: 3756
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
template<typename G>
struct DLCA{
    const int Log;
    vector<int> dep;
    const G &g;
    vector<vector<int>> table;
    explicit DLCA(const G &g):g(g),dep(g.size()),Log(32-__builtin_clz(g.size())){
        table.assign(Log,vector<int>(g.size(),-1));
    }
    //各点に番号付
    void dfs(int idx,int par,int d){
        table[0][idx]=par;
        dep[idx]=d;
        for(auto &to:g[idx]){
            if(to!=par)dfs(to,idx,d+1);
        }
    }
    //構築
    void build(){
        dfs(0,-1,0);
        for(int k=0;k<Log-1;k++){
           for(int i=0;i<table[k].size();i++){
               if(table[k][i]==-1)table[k+1][i]=-1;
               else table[k+1][i]=table[k][table[k][i]];
           }
        }
    }
    //２点の最小共通祖先を探す
    int query(int u,int v){
       if(dep[u]>dep[v])swap(u,v);
       for(int i=Log-1;i>=0;i--){
           if(dep[v]-dep[u]&(1<<i))v=table[i][v];
       }
       if(u==v)return u;
       for(int i=Log-1;i>=0;i--){
           if(table[i][u]!=table[i][v]){
               u=table[i][u];
               v=table[i][v];
           }
       }
       return table[0][u];
    }
    //２点間距離
    int dist(int u,int v){
        int par=query(u,v);
        return abs(dep[u]-dep[par])+abs(dep[v]-dep[par]);
    }
};
int main(){
  int n,u,v;
  cin>>n>>u>>v;
  u--;v--;
  V<V<int>> g(n);
  for(int i=0;i<n-1;i++){
      int a,b;
      cin>>a>>b;
      a--;b--;
      g[a].push_back(b);
      g[b].push_back(a);
  }
  DLCA<V<V<int>>> t(g);
  t.build();
  int l,r,par=t.query(u,v),c;int ans=t.dist(v,par)-1;
  for(int i=0;i<n;i++){
      l=t.dist(u,i),r=t.dist(i,v),c=t.dist(par,i);
      if(l<r){
          chmax(ans,r-1);
      }
  }
  cout<<ans<<"\n";
}


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

public class Main {
	public static void main (String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] firstLine = br.readLine().split(" ", 2);
		int n = Integer.parseInt(firstLine[0]);
		int m = Integer.parseInt(firstLine[1]);
		UnionFindTree uft = new UnionFindTree(n, m);
		for (int i = 1; i <= n; i++) {
			String[] line = br.readLine().split(" ");
			int k = Integer.parseInt(line[0]);
			for (int j = 1; j <= k; j++) {
				uft.add(i, Integer.parseInt(line[j]));
			}
		}
		int target = uft.find(0);
		for (int i = 1; i <= n; i++) {
			if (target != uft.find(i - 1)) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
	
	static class UnionFindTree {
		int persons;
		int lang;
		int[] parent;
		public UnionFindTree(int persons, int lang) {
			this.persons = persons;
			this.lang = lang;
			parent = new int[persons + lang];
			for (int i = 0; i < persons + lang; i++) {
				parent[i] = i;
			}
		}
		
		public int find(int x) {
			if (parent[x] == x) {
				return x;
			}
			parent[x] = find(parent[x]);
			return parent[x];
		}
		
		public void add(int p, int l) {
			parent[find(p - 1)] = find(persons + l - 1);
		}
	}
}


Measured memory_bytes: 46464
S = input()
flag = 0
echo = ["Yes", "No"]
for i in range(len(S)):
    if i % 2 == 1:
        if S[i] not in ("L", "U", "D"):
            flag = 1
            break
    else:
        if S[i] not in ("R", "U", "D"):
            flag = 1
            break
print(echo[flag])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
#define int ll

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  if (SZ(s) & 1) {
    cout << "No\n";
  }
  else {
    bool ok = true;
    for (int i = 0; i < SZ(s); i++) {
      if (i % 2 == 0) {
        ok &= s[i] == 'h';
      }
      else {
        ok &= s[i] == 'i';
      }
    }
    cout << (ok ? "Yes\n" : "No\n");
  }
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<endl;
#define printii(x)  for(auto it=x.begin();it!=x.end();it++) cout<<*it.F<<' '<<*it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)
vector<vector<pair<ll, ll>>> adj;
vector<bool> visited;
vvi adjcpy;
vi d;
ll spfa(ll s) {
    ll n = adj.size();
    d.assign(n, LLMAX);
    vector<ll> cnt(n, 0);
    vector<bool> inqueue(n, false);
    queue<ll> q;

    d[s] = 0;
    q.push(s);
    inqueue[s] = true;
    while (!q.empty()) {
        ll v = q.front();
        q.pop();
        inqueue[v] = false;

        for (auto edge : adj[v]) {
            ll to = edge.first;
            ll len = edge.second;

            if (d[v] + len < d[to]) {
                d[to] = d[v] + len;
                if (!inqueue[to]) {
                    q.push(to);
                    inqueue[to] = true;
                    cnt[to]++;
                    if (cnt[to] > n)
                        return 1;  // negative cycle
                }
            }
        }
    }
    return min(0ll,d[n-1]);
}

void dfs(int v){
	visited[v] = true;
	for(int i=0;i<adjcpy[v].size();i++){
	    if(!visited[adjcpy[v][i]]){
	    	dfs(adjcpy[v][i]);
	    }
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,x,t,m,p,z,y;
	cin>>n>>m>>p;
	adj.resize(n);
	adjcpy.resize(n);
	visited.resize(n);
	for(int i=0;i<m;i++){
	    cin>>x>>y>>z;
	    x--;y--;
	    adj[x].pb(mp(y,p-z));
	    adjcpy[y].pb(x);
	}
	dfs(n-1);
	for(int i=0;i<n;i++){
	    if(!visited[i]){
	    	adj[i].clear();
	    }
	}
	
	cout<<-1*spfa(0);
	


	return 0;
}







Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>

using namespace std;

int N , A , B;
int t;
int ans;

int main(){
	scanf("%d%d%d" , &N , &A , &B);
	for(int i = 0 ; i < N ; ++i){
		scanf("%d" , &t);
		if(t < A || B <= t) ++ans;
	}
	printf("%d\n" , ans);
	return 0;
}


Measured memory_bytes: 128
import itertools


def resolve():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    P = [(1 + p) / 2 for p in P]
    accumulate_P = [0] + list(itertools.accumulate(P))

    ans = 0
    for ii in range(N - K + 1):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

resolve()

Measured memory_bytes: 25148
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

ll gcd(ll a,ll b){
	return (b==0?a:gcd(b,a%b));
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

    int n,m;
    cin>>n>>m;
    vi a(n),b(n);
    cin>>a>>b;
    sort(all(a));
    sort(all(b));
    int l=-1,r=inf;
    while(r-l>1){
        int h=(l+r)/2;
        int c=0;
        rep(i,n)c+=max(0ll,a[i]-h/b[n-1-i]);
        // cout<<h<<" "<<c<<endl;
        if(c<=m)r=h;
        else l=h;
    }
    cout<<r<<endl;

}


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

int main(){
  int N;
  cin >> N;
  
  vector<int> d(N);
  
  int sum = 1;
  
  for(int i=0;i<N;i++){
    cin >> d[i];
  }
  
  sort(d.begin(),d.end());
  
  for(int j=1;j<N;j++){
    if(d[j - 1]!=d[j]){
      sum++;
    }
  }

  cout << sum << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int i,j=0;
    string S;
    cin>>S;
    if(S=="Sunny")
    {
        cout<<"Cloudy"<<endl;
    }
    else if(S=="Cloudy")
    {
        cout<<"Rainy"<<endl;
    }
    if(S=="Rainy")
    {
        cout<<"Sunny"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n = inp()
if n%1000:
    print(1000-(n%1000))
else:
    print(0)
    


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

int main() {
  int L;
  cin >> L;
  if(L % 3 == 0){
    cout << L * L * L / 27 << endl;
  }
  else{
    cout << fixed << setprecision(12);
    cout << 1.0 * L * L * L / 27 << endl;
  }
}


Measured memory_bytes: 256
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int V[3],i;
inline void solve(){
  INS(i,3,V);
  sort(V,V+3);
  if(V[0]==5&&V[1]==5&&V[2]==7)OUT("YES");
  else OUT("NO");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;


int main() {

	double value;
	string kind;
	double ans = 0.0;

	long N;
	cin >> N;

	for (long i = 0; i < N; i++) {
		cin >> value;
		cin >> kind;
		if (kind == "JPY") {
			ans += value;
		}
		else {
			ans += 380000.0 * value;
		}
	}

	cout << fixed;
	cout << setprecision(6) << ans << endl;

	return 0;
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, a, b, c, d;
  string s;
  cin >> n >> a >> b >> c >> d >> s;
  a--;
  b--;
  c--;
  d--;
  
  bool can = false;  
  vector<int>block(n);
  rep(i,n-1){
    if(s[i] == '#' && s[i+1] == '#'){
      block[i]++;
    }
  }
  //bd→acが最適
  if(c<d){
    bool flag_bd = true;
    rep(i,max(d-b-1,0)){
      if(block[b+i]) flag_bd = false;
    }
    if(flag_bd){
      bool flag_ac = true;
      rep(i,max(c-a-1,0)){
        if(block[a+i]) flag_ac = false;
      }
      if(flag_ac) can = true;        
    }
  }
  else{
    bool flag_bd = true;
    rep(i,max(d-b-1,0)){
      if(block[b+i]) flag_bd = false;
    }
    rep(i,n)if(s[i]=='#')block[i]++;
    if(flag_bd){
      bool change = false;
      for(int i=b-1;i<=d-1;i++){
        if(!block[i] && !block[i+1] && !block[i+2]){
          bool flag_ac = true;
          rep(j,max(c-a-1,0)){
            if(block[a+j] && block[a+j+1]) flag_ac = false;
          }
          if(flag_ac){
            can = true;
            change = true;
            break;
          }
        }
      }
    }
  }
  if(can) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
  
}


Measured memory_bytes: 1360
#include <bits/stdc++.h>
using namespace std;
const int maxn=10;
char s[maxn];
int main(){
    while(~scanf("%s", s)){
        int ans=0;
        for(int i=0;i<6;i++){
            if(s[i]=='1')ans++;
        }
        printf("%d\n", ans);
    }
}


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

#define x first
#define y second
#define rs resize
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define rep(i,a,b) for(auto i=(a);i!=(b); ++i)
#define REP(i,n) rep(i,0,n)
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
template<class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;

template<class T1, class T2>
ostream& operator<<(ostream &out, const pair<T1,T2> &a) { return out << '(' << a.x << ", " << a.y << ')'; }
template<class T1, class T2>
istream& operator>>(istream &in, pair<T1,T2> &a) { return in >> a.x >> a.y; }

const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

// lambda-expression: [] (args) -> retType { body }

const int MAXSUM = 15'000;

ll gcd(ll a, ll b) { while (b) a %= b, swap(a,b); return a; }

void run() {
	ll n, x, d;
	cin >> n >> x >> d;

	if (d == 0) {
		ll ans = n+1;
		if (x == 0) ans = 1; // only zero...

		cout << ans << endl;
		return;
	}

	ll g = gcd(abs(x), abs(d));
	if (d < 0) g = -g;

	x /= g;
	d /= g;

	assert(d > 0);

	map<int, vii> intervals;
	ll smallest = 0, largest = 0;
	for (ll i = 0, ix = 0; i <= n; i++, ix += x) {
		ll quot = ix/d, rem = ix - quot*d;
		intervals[rem].eb(quot + smallest, quot + largest);

		smallest += i;
		largest += n-1-i;
	}

	// for each interval, count the number of elements in it.
	ll answer = 0;
	for (const auto &entry : intervals) {
		// printf("Remainder %d: \n", entry.x);

		vii ivals = entry.y;
		// sort by starting value.
		sort(all(ivals));

		ll curptr = LLONG_MIN;
		for (ii pr : ivals) {
			// printf("[%lld, %lld]\n", pr.x, pr.y);

			ll start_val = max(curptr + 1, pr.x);
			ll end_val = pr.y;
			if (start_val <= end_val) {
				answer += end_val - start_val + 1;
				curptr = end_val;
			}
		}
	}

	cout << answer << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr << boolalpha;
	(cout << fixed).precision(10);

	run();

	return 0;
}


Measured memory_bytes: 22144
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define x0 gtmshb
#define y0 gtmsub
#define x1 gtmjtjl
#define y1 gtmsf
int a[100010],b[100010],par[100010],minm[100010],pos[100010],n,m,tot,num;
bool vis[100010];
long long ans;
int find(int x){return x==par[x]?x:par[x]=find(par[x]);}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)par[i]=i;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);x++;y++;
		par[find(x)]=find(y);
	}
	for(int i=1;i<=n;i++)minm[i]=1000000001;
	for(int i=1;i<=n;i++)
	{
		int u=find(i);
		if(!vis[u])num++;vis[u]=1;
		if(minm[u]>a[i]){pos[u]=i;minm[u]=a[i];}
	}
	for(int i=1;i<=n;i++)
	{
		int u=find(i);
		if(pos[u]==i)ans+=a[i];
		else b[++tot]=a[i];
	}
	if(num==1)
	{
		puts("0");
		return 0;
	}
	else if(tot<num-2)
	{
		puts("Impossible");
		return 0;
	}
	sort(b+1,b+tot+1);
	for(int i=1;i<=num-2;i++)ans+=b[i];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2304
#include<stdio.h>

int main(void) {
    int x, y, z;
    int tmp;
    scanf("%d %d %d", &x, &y, &z);

    if(x > y) {
        tmp = x;
        x = y;
        y = tmp;
    }
    if( y > z ){
        tmp = y;
        y = z;
        z = tmp;
    }
    if( x > y ){
        tmp = y;
        y = x;
        x = tmp;
    }
    printf("%d %d %d\n", x ,y ,z);
    
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll p=pow(10,9)+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
    x = x % p;  
   while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 

ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k,i,j;
    cin>>n>>k;
    ll arr[n];
    for(i=0;i<n;i++)
    cin>>arr[i];
    ll dp[n];
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(i=2;i<n;i++)
    {
        dp[i]=pow(10,18);
        for(j=1;j<=k;j++)
        {
        if(i-j>=0)    
        dp[i]=std::min(dp[i],dp[i-j]+abs(arr[i]-arr[i-j]));
        }
    }
   
    cout<<dp[n-1]<<endl;
    
    

 
    return 0;
    
}
    



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

#define ll long long
#define ar array
#define fo(i,n) for(i=0;i<n;i++)
#define fok(i,k,n) for(i=k;i<n;i++)

//const double PI=acos(-1); 
#define vint vector<int>
#define vfloat vector<float>

#define pb push_back

const long long mod=1e9;

#define PI 3.14159 
#define vint vector<int>
#define vfloat vector<float>

void solve(){
	
		int a,b;
  cin>>a>>b;
  cout<<a*b;
}

int main(int argc, char const *argv[])
{
	//cout<<"changed\n";
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll t=1;
	//cin>>t;

	while(t--)
	{	
		solve();

	}	
	return 0;	
}

Measured memory_bytes: 3648
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//ABC119B
int main(void) {
  int n,i;
  double y=0, x;
  char u[4],jp[]="JPY";
  scanf(" %d", &n);
  for(i=0; i<n; i++){
    scanf(" %lf %s", &x, u);
    if(strcmp(u, jp)==0) y+=x;
    else y+=x*380000;
  }
  printf("%lf", y);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define lmod 15000000000031
typedef long long int ll;
typedef unsigned long long int ull;
#define vi vector<int>
#define vll vector<ll>
#define sll set<ll>
#define pb(a) push_back(a) 
#define loop(i,a,b) for(ll i = (ll)a ; i < (ll)b ; i++)
#define rtloop(i,a,b) for(ll i = (ll)a ; i >= (ll)b ;i--)

/*long long moduloMultiplication(long long a, 
                            long long b, 
                            long long modu) 
{ 
    long long res = 0; // Initialize result 
  
    // Update a if it is more than 
    // or equal to mod 
    a %= modu; 
  
    while (b) 
    { 
        // If b is odd, add a with result 
        if (b & 1) 
            res = (res + a) % modu; 
  
        // Here we assume that doing 2*a 
        // doesn't cause overflow 
        a = (2 * a) % modu; 
  
        b >>= 1; // b = b / 2 
    } 
  
    return res; 
} */

int main(){    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    ll t,n;
    cin >> t >> n;
    if(t >= 1 && n >= 1 && t<=9 && n <= 9)cout << t*n <<"\n";
    else cout << -1 << "\n";
    
    return 0;
    
}

    
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[52],b[52];
int main(){
    cin>>a;
    cin>>b;
    int la=strlen(a),lb=strlen(b);
    int l=min(la,lb),ll=max(la,lb);
    for(int i=0;i<=l-1;i++)
        cout<<a[i]<<b[i];
    if(la>lb)
        for(int i=l;i<=ll-1;i++)
            cout<<a[i];
    else for(int i=l;i<=ll-1;i++)
            cout<<b[i];
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		//		new Main().solveB();
		new Main().solveB2();
		//		new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();

			if (numA > 16 / 2 || numB > 16 / 2) {
				System.out.println(":(");
				return;
			}

			System.out.println("Yay!");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numD = 0;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numD = scanner.nextInt();
			numN = scanner.nextInt();
			if (numN == 100) {
				numN++;
			}
			switch (numD) {
			case 0:
				System.out.println(numN);
				break;
			case 1:
				System.out.println(numN * 100);
				break;
			case 2:
				System.out.println(numN * 10000);
				break;
			default:
				break;
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private int getFunc(int x) {
		int res = 0;
		while (x % 100 == 0) {
			x = x / 100;
			res++;
		}
		return res;
	}

	private int getFuncSaiki(int x) {
		if (x % 100 != 0) {
			return 0;
		}
		return getFuncSaiki(x / 100) + 1;
	}

	private void solveB2() {
		Scanner scanner = null;
		int numD = 0;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numD = scanner.nextInt();
			numN = scanner.nextInt();

			int count = 0;
			int val = 0;

			while (count != numN) {
				val++;
				if (getFunc(val) == numD) {
					count++;
				}
			}
			System.out.println(val);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private long dpSolveC(long[] wk) {
		int cnt = 0;
		for (int i = 0; i < wk.length; i++) {
			long wkNum = wk[i];
			while (wkNum % 2 == 0) {
				wkNum /= 2;
				cnt++;
			}
		}
		return cnt;

	}

	/**
	 * a[i]の操作終了条件は「2で割れなくなったとき」
	 * a[i]を3倍しても「2で割る事の出来る回数は増えない」
	 * そのため、a[i]を2で割れる回数の総計が操作可能回数。
	 */
	private void solveC() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			long[] wk = new long[numN];

			for (int i = 0; i < wk.length; i++) {
				wk[i] = scanner.nextLong();
			}

			System.out.println(dpSolveC(wk));

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 23252
s = input()
t = input()

ary_s = []
ary_t = []

for i in s:
    ary_s.append(i)
for i in t:
    ary_t.append(i)

copy = list(ary_s)

if ary_s == ary_t:
    print("Yes")
else:
    while(True):
        tmp = ary_s[-1]
        ary_s.insert(0,tmp)
        ary_s.pop(-1)
        if ary_s == ary_t:
            print("Yes")
            break
        if ary_s == copy:
            print("No")
            break
        

Measured memory_bytes: 3060
import math
n = int(input())

order = int(math.log10(n))
first = int(n/(10**order))


hund = [0]*99

def calc(a,b):
    global n,order,first
    num = 0

    if(a>n):
        return 0
    if(a==b and a<=n):
        num += 1
    if(order==0):
        return num
    if(a!=first):
        if(first>a):
            num += (10**(order)-1)/9
        else:
            num += (10**(order-1)-1)/9
    else:
        num += (10**(order-1)-1)/9
        if(n%10>=b):
            num += int((n - first * (10**order))/10)+1
        else:
            num += int((n - first * (10**order))/10)
    return num

def eq(a,b):
    if(a!=b):
        return 2
    return 1

for i in range(1,10):
    for j in range(1,10):
        hund[(i-1)*10+(j-1)] = calc(i,j)

count = 0

for i in range(1,10):
    for j in range(1,i+1):
        count += hund[(i-1)*10+(j-1)]*hund[(j-1)*10+(i-1)]*eq(i,j)


print(int(count))

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main(void){
    int A,B,C,D,E,x,y,cou=0,v[3];
    char S[3],s[3],X,Y;
    scanf("%d %d",&A,&B);
    if((A==2)&&(B==2)){
        printf("Yes");
    }else if(((A==4)||(A==6)||(A==9)||(A==11))&&((B==4)||(B==6)||(B==9)||(B==11))){
        printf("Yes");
    }else if(((A==1)||(A==3)||(A==5)||(A==7)||(A==8)||(A==10)||(A==12))&&((B==1)||(B==3)||(B==5)||(B==7)||(B==8)||(B==10)||(B==12))){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

class UnionFindTree {
public:
    this(size_t n) {
        parent = iota(n).array();
        rank = new size_t[](n);
    }
    size_t find(size_t n) {
        if(n == parent[n]) {
            return n;
        } else {
            parent[n] = find(parent[n]);
            return parent[n];
        }
    }
    void unite(size_t n, size_t m) {
        auto p1 = find(n);
        auto p2 = find(m);
        if(n == m) {
            return;
        }
        if(rank[p1] < rank[p2]) {
            swap(p1, p2);
        }
        if(rank[p1] == rank[p2]) {
            ++rank[p1];
        }
        parent[p2] = p1;
    }
private:
    size_t[] parent;
    size_t[] rank;
}
unittest {
    auto uft = new UnionFindTree(10);
    foreach(i; iota(10)) {
        assert(uft.find(i) == i);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0).drop(1)) {
        uft.unite(i, i-3);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0)) {
        assert(uft.find(0) == uft.find(i));
    }
    foreach(i; iota(10).filter!(a => a%3 != 0)) {
        assert(uft.find(0) != uft.find(i));
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

void main(){
    auto n = readLong();
    auto a = readLongs();
    long[long] c;
    foreach(ai; a) {
        if(ai in c) {
            c[ai]++;
        } else {
            c[ai] = 1;
        }
    }
    long ans;
    foreach(k, v; c) {
        if(k <= v) {
            ans += v-k;
        } else {
            ans += v;
        }
    }
    writeln(ans);
}



Measured memory_bytes: 9944
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int N = 8;
int n,m, ans = 0, vis[N];
vector<int> g[N];

void dfs(int u, int p){
    vis[u] = 1;
    int allvis = 1;
    for (int i = 0; i < n; i++){
        if(vis[i] == 0) allvis = 0;
    }
    if(allvis) {
        ans++;
        vis[u] = 0;
        return;
    }
    for (auto  v: g[u]) {
        if(!vis[v]&&v!=p) dfs(v, u);
    }
    vis[u] = 0;
}



int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    
    cin>>n>>m;
    int u,v;
    for (int i = 0; i < m; i++){
        cin>>u>>v;
        u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    
    dfs(0, -1);
    cout<<ans<<endl;
    
    return 0;
}


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

int cnt = 0;
size_t gaps[100] = { 1 };
static const size_t len_gaps = sizeof(gaps) / sizeof(*gaps);

void insertion_sort(int* array, size_t size, size_t gap)
{
  for(size_t i = gap; i < size; i++) {
    int max = array[i];
    int k = i - gap;
    while(0 <= k && max < array[k]) {
      array[k + gap] = array[k];
      k = k - gap;
      cnt++;
    }
    array[k + gap] = max;
  }
}

size_t power(int x, int n)
{
  int res = 1;
  for(int i = 0; i < n; i++) {
    res = res * x;
  }
  return res;
}

void shell_sort(int* array, size_t size)
{
  size_t gap_index;
  for(gap_index = 1; gap_index < len_gaps; gap_index++) {
    gaps[gap_index] = (power(3, gap_index+1) - 1) / 2;
    if(size / 2 < gaps[gap_index]) {
      break;
    }
  }
  gap_index--;
  printf("%lu\n", gap_index+1);
  for(int i = (int)gap_index; 0 <= i; i--) {
    printf("%lu", gaps[i]);
    if(i == 0) {
      putchar('\n');
    } else {
      putchar(' ');
    }
    insertion_sort(array, size, gaps[i]);
  }
}

int main()
{
  int size;
  scanf("%d", &size);
  int* array = malloc(sizeof(int) * size);
  if(!array) {
    perror("malloc");
    exit(EXIT_FAILURE);
  }
  for(int i = 0; i < size; i++) {
    scanf("%d", &array[i]);
  }
  shell_sort(array, size);
  printf("%d\n", cnt);
  for(int i = 0; i < size; i++) {
    printf("%d\n", array[i]);
  }

  free(array);
  return 0;
}



Measured memory_bytes: 5496