akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm> 
using namespace std;
typedef long long ll;
const int N=51;
int n,a,b;
ll c[N][N],v[N],sum[N],ans;
ll son,par;
void init()
{
	for(int i=1;i<=50;++i)
	{
		c[i][0]=c[i][i]=1;
		for(int j=1;j<i;++j)
		c[i][j]=c[i-1][j-1]+c[i-1][j];
	}
}
int main()
{
	init();
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1;i<=n;++i)
	scanf("%lld",&v[i]);
	sort(v+1,v+n+1,greater<ll>());
	son=par=1;
	for(int i=1;i<=n;++i)
		sum[i]=sum[i-1]+v[i];
	for(int i=a;i<=b;++i)
	{
		if(sum[i]*par>son*i)
		{
			son=sum[i];
			par=i;
		}
	}
	for(int i=a;i<=b;++i)
	{
		if(sum[i]*par==son*i)
		{
			int my=1,all=0;
			for(int j=i-1;j>=1;--j)
			if(v[j]==v[j+1])my++;
			else break;
			all=my;
			for(int j=i+1;j<=n;++j)
			if(v[j]==v[j-1])all++;
			else break;
			ans+=c[all][min(all-my,my)];
		}
	}
	printf("%.6lf\n",1.0*son/par);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
# coding: utf-8
H,W=map(int,input().split())
MAP=[]
d=[]
INF=10**9

for i in range(H):
    line=list(input())
    MAP.append(line)
    d.append([INF for j in range(W)])

if MAP[0][0]==".":
    d[0][0]=0
else:
    d[0][0]=1

for i in range(H):
    for j in range(W):
        if i==0 and j==0:
            continue
        
        if i!=0 and j!=0:
            if MAP[i][j]==".":
                d[i][j]=min(d[i][j-1],d[i-1][j])
                
            else: 
                if MAP[i][j-1]==MAP[i-1][j]==".":
                    d[i][j]=min(d[i][j-1],d[i-1][j])+1
                    
                elif MAP[i][j-1]==MAP[i-1][j]=="#":
                    d[i][j]=min(d[i][j-1],d[i-1][j])
                    
                elif MAP[i][j-1]==".":
                    d[i][j]=min(d[i][j-1]+1,d[i-1][j])
                    
                elif MAP[i-1][j]==".":
                    d[i][j]=min(d[i][j-1],d[i-1][j]+1)
                    
        elif i==0:
            if MAP[i][j]==".":
                d[i][j]=d[i][j-1]
                
            else: 
                if MAP[i][j-1]==".":
                    d[i][j]=d[i][j-1]+1
                    
                elif MAP[i][j-1]=="#":
                    d[i][j]=d[i][j-1]
                    
                elif MAP[i][j-1]==".":
                    d[i][j]=d[i][j-1]+1
                    
        elif j==0:
            if MAP[i][j]==".":
                d[i][j]=d[i-1][j]
                
            else: 
                if MAP[i-1][j]==".":
                    d[i][j]=d[i-1][j]+1
                    
                elif MAP[i-1][j]=="#":
                    d[i][j]=d[i-1][j]
                    
                elif MAP[i-1][j]==".":
                    d[i][j]=d[i-1][j]+1

print(d[H-1][W-1])

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
using namespace std;

int power(int x,int n,int mod){
    //(x^n)%mod
    int result=1;
    while(n){
        if(n%2)
            result=(result*x)%mod;
        x=(x*x)%mod;
        n/=2;
    }
    return result;
}



int32_t main() {

    fast

    int a,b,c;
    cin>>a>>b>>c;

    int k;
    cin>>k;

    while(a>=b){
        b*=2;
        k--;
    }
    while(b>=c){
        c*=2;
        k--;
    }
    if(k>=0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }



    return 0;
}



Measured memory_bytes: 3532
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#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>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in1(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in1(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
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()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N, M;
    in2(N, M);

    vi P(M), Y(M);
    rep(i, M) in2(P[i], Y[i]);

    vvi X(N + 1);
    rep(i, M) X[P[i]].push_back(Y[i]);

    rep(i, N + 1) sort(all(X[i]));

    rep(i, M)
    {
        auto itr = lower_bound(all(X[P[i]]), Y[i]);

        auto num = distance(X[P[i]].begin(), itr) + 1;

        cout << setw(6) << setfill('0') << P[i];
        cout << setw(6) << num << endl;
    }
    return 0;
}


Measured memory_bytes: 9432
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int N = 1e5 + 10;
const int M = 1e5 + 10;
const int INF = 0x3f3f3f3f;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define endl '\n'
#define ls (i << 1)
#define rs (i << 1 | 1)
#define loop(i, a, b) for (int i = a; i < b; ++i)

inline int read() {
    char ch = getchar();
    int w = 1, c = 0;
    for (; !isdigit(ch); ch = getchar())
        if (ch == '-') w = -1;
    for (; isdigit(ch); ch = getchar()) c = (c << 3) + (c << 1) + (ch ^ 48);
    return w * c;
}

const int mod = 1e9 + 7;
ll a[2010];

int main() {
    int s = read();
    a[0] = 1;
    for (int i = 3; i <= s; ++i) {
        for (int j = 3; j <= i; ++j) {
            a[i] = (a[i] % mod + a[i - j] % mod) % mod;
        }
    }
    cout << a[s] << endl;
    return 0;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll n; cin>>n;
  ll arr[n];
  for(ll i=0;i<n;i++)
    cin>>arr[i];
  ll sum=0;
  for(ll i=1;i<n;i++)
  {
    if(arr[i]<arr[i-1])
    {
      sum+=(arr[i-1]-arr[i]);
      arr[i]=arr[i-1];
    }
  }
  cout<<sum;
  return 0;
}
  


Measured memory_bytes: 5052
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BOOST {ios_base::sync_with_stdio(false);cin.tie(NULL);}

typedef long long ll;

vector<int> dp(100000,-1);
int cost(vector<int> &h,int n)
{
    if(dp[n]!=-1)
        return dp[n];
    if(n<=0)
        return dp[0] = 0;
    dp[n] = min(
        cost(h,n-1)+abs(h[n]-h[n-1]),
        cost(h,n-2)+abs(h[n]-h[n-2])
    );
    return dp[n];
}
int main()
{
    BOOST
    int n;
    cin>>n;
    vector<int> h(n,0);
    for(int i=0;i<n;i++)cin>>h[i];
    //IMPORTANT
    dp[0] = 0;
    dp[1] = abs(h[0]-h[1]); 
    cout<<cost(h,n-1)<<'\n';
    return 0;
}

Measured memory_bytes: 6336
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x

int main() {

  int N, Q, i, j;
  long long K;
  int who, A[100100] = {0};
  long long border;
  
  cin >> N >> K >> Q;
  REP(i, Q){
    cin >> who;
    A[--who]++;
  }

  border = Q - K;
  REP(i, N){
    if( A[i] > border ){
      cout << "Yes" << endl;
    } else{
      cout << "No" << endl;
    }
  }

}

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

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

typedef long long ll;

struct dish{
    ll ca,cb,sum;
};

bool comp(dish x,dish y){
    if(x.sum>y.sum) return true;
    else return false;
}

int main(){
    int N; cin >> N;
    dish ans[N];
    for(int i=0;i<N;i++){
        ll a,b; cin >> a >> b;
        ans[i].ca=a;
        ans[i].cb=b;
        ans[i].sum=a+b;
    }
    sort(ans,ans+N,comp);
    ll sumt=0;
    ll suma=0;
    for(int i=0;i<N;i++){
        if(i%2==0) sumt+=ans[i].ca;
        else suma+=ans[i].cb;
    }
    cout << sumt-suma << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <utility>
#include <vector>

void print(std::vector<int> readVec){
    int sz = readVec.size();
    for(int i = 0; i < sz; ++i){
        std::cout << readVec.at(i);
        if(sz - 1 == i){
            std::cout << std::endl;
        }else{
            std::cout << " ";
        }
    }
}

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

    std::vector<int> p(n);
    long long cnt = 0, subCnt = 0;
    for(int i = 0; i < n; ++i){
        int val;
        std::cin >> val;
        if(i + 1 == val){
            ++subCnt;
        }else{
            cnt += (subCnt + 1) / 2;
            subCnt = 0;
        }

//        std::cout << i << " -> " << cnt << ", " << subCnt << std::endl;
    }

    cnt += (subCnt + 1) / 2;
//    std::cout << cnt << ", " << subCnt << std::endl;

    std::cout << cnt << std::endl;

    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;



ll solve(ll n){
    if(n % 2 == 1) return 0;
    ll res = 0;
    n /= 2;
    while(n){
        res += n / 5;
        n /= 5;
    }
    return res;
}

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll n;
    cin >> n;
    print(solve(n));


}


Measured memory_bytes: 256
fn main(){
    let mut v:Vec<i32> = getline().trim().split(' ').map(|e| e.parse().unwrap()).collect();
    let d = v.pop().unwrap();
    if (v[0] - v[2]).abs() <= d || (v[0] - v[1]).abs() <= d && (v[1] - v[2]).abs() <= d {
        println!("Yes");
    }
    else {
        println!("No");
    }
}

fn getline() -> String{
    let mut r = String::new();
    std::io::stdin().read_line(&mut r).ok();
    return r;
}


Measured memory_bytes: 4352
<?php
// 縦h x 横w の迷路を木構造に変換（壁=# 道=.）
define('BLACK', '#');
define('WHITE', '.');
fscanf(STDIN, '%d %d', $h, $w);
for ($i  = 0; $i < $h; $i++) {
    $s[] = trim(fgets(STDIN));
}
$g = array_fill(0, $h * $w, []);
$cnt_w = 0;
for ($i  = 0; $i < $h * $w; $i++) {
    $l = intdiv($i, $w);
    $m = $i % $w;

    if ($s[$l][$m] === BLACK) continue;

    $cnt_w++;
    if ($m < $w - 1 && $s[$l][$m + 1] === WHITE) {
        $g[$i][] = $i + 1;
        $g[$i + 1][] = $i;
    }

    if ($l < $h - 1 && $s[$l + 1][$m] === WHITE) {
        $g[$i][] = $i + $w;
        $g[$i + $w][] = $i;
    }
}

// BFS（幅優先探索）：最短経路アルゴリズムとして活用
$n = $h * $w;
$q = new SplQueue(); // キューを用意
$dist = array_fill(0, $n, -1); // 距離を格納する配列（-1の場合はその頂点が未発見）

$dist[0] = 0; // 頂点0からの距離格納配列
$q->enqueue(0); // キューに0を追加

while (!$q->isEmpty()) {
    $v = $q->dequeue();

    foreach ($g[$v] as $next_v) {
        if ($dist[$next_v] !== -1) continue; // 発見済み

        $dist[$next_v] = $dist[$v] + 1;
        $q->enqueue($next_v);
    }
}
if ($dist[$h * $w - 1] === -1) exit('-1');
echo $cnt_w - 2 - ($dist[$h * $w - 1] - 1);


Measured memory_bytes: 4728
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        cin.nextInt();
        string S = cin.next();
        int ans = 0;
        int tmp = 0;
        foreach (var item in S)
        {
            if(item == 'o')
            {
                ans++;
                tmp = 0;
            }
            else
            {
                tmp++;
                if (tmp == 2) break;
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 9804
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x);1
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair	
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
using namespace std;
typedef long long ll;
typedef long double ld;	
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const ll MAX = 10000000;
const ll inf = 5e18-1;

int main() {
	fastio;
	ll n,m,a,b,d=0;
	cin>>n>>m;
	vii t;
	f(i,0,n){
		cin>>a>>b;
		t.pb(mp(a,b));
	}
	sor(t);
	f(i,0,n){
		if(m<=0) break;
		d+=min(t[i].sc,m)*t[i].fs;
		m-=t[i].sc;
	}
	cout<<d<<endl;
    return 0;
	}

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

map<int,int> m;
vector<int> v;
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		if(m[x]==0) v.push_back(x);
		m[x]++;
	}
	int ans=0;
	for(int i=0;i<v.size();i++)
		if(v[i]>m[v[i]]) ans+=m[v[i]];
		else if(v[i]<m[v[i]]) ans+=m[v[i]]-v[i];
	cout<<ans;
}

Measured memory_bytes: 5112
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
void dfs(ll x,vector<vector<ll>>&adj,vector<ll>&vis)
{
    vis[x]=1;
    for(auto a:adj[x])
    {
        if(vis[a]==0)
            dfs(a,adj,vis);
    }
}
int main()
{
    ll n,m,i,j,k;
    cin>>n>>m;
    vector<vector<ll>>adj(n);
    vector<ll>vis(n,0);
    for(i=1;i<=m;i++)
    {
        cin>>j>>k;
        adj[j-1].push_back(k-1);
        adj[k-1].push_back(j-1);
    }
    ll ans=0;
    for(i=0;i<n;i++)
    {
        if(vis[i]==0)
        {
            ans++;
            dfs(i,adj,vis);
        }
    }
    cout<<ans-1;
}

Measured memory_bytes: 11180
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>

#define rep(i, j) for(int i = 0; i < j; i++)
#define rep2(i, j) for(int i = 0; i <= j; i++)
#define all(i) i.begin(), i.end()
#define pint(i) printf("%d\n", i)

using namespace std;

vector<bool> era(1000010, true);
void makePrimeTable(int n)
{
	era[0] = false; era[1] = false;
	for (int i = 2; i <= n; i++)
	{
		if (era[i]) { for (int j = i * 2; j <= n; j += i) { era[j] = 0; } }
	}
}
int main()
{
	makePrimeTable(200000);
	int N, P; while (cin >> N >> P && N != -1)
	{
		vector<int> dat(0);
		vector<int> prm(0);
		while (1)
		{
			N++;
			if (era[N]) { prm.push_back(N);}
			if (prm.size() == P) { break; }
		}
		for (int i = 0; i < P; i++) for (int j = i; j < P; j++) { dat.push_back(prm[i] + prm[j]); }
		sort(all(dat)); 
		printf("%d\n", dat[P - 1]);
	}
	return 0;
}

Measured memory_bytes: 3248
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#ifdef DEBUG
std::ostream& dout = cout;
#else
stringstream dout;
#endif
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
signed main(signed argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
    string s;
    cin>>s;
    rep(i,s.size()){
        if((i%2==1&&s[i]!='i')||(i%2==0&&s[i]!='h')){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(s.size()%2==1)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b){if(b==0)return a;return gcd(b,a%b);}
int main(){
  bool flag=true;
  long long n,m,l,a,b,c;
  char s[100005],t[100005];
  scanf("%lld%lld%s%s",&n,&m,&s,&t);
  l=n/gcd(n,m)*m;
  a=l/n;b=l/m;c=a/gcd(a,b)*b;a=c/a;b=c/b;
  for(int i=0,j=0;i<n;i+=a,j+=b)
    if(s[i]!=t[j]){flag=false;break;}
  if(flag)printf("%lld",l);else puts("-1");
}


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

//constant
const int inf=1<<28;

//variable
int n,r;
int p,c;


int main(){
    while(cin>>n>>r,r){
        deque<int> pile;
        for(int i=0; i<n; i++){
            pile.push_front(i+1);
        }
        for(int i=0; i<r; i++){
            cin>>p>>c;
            deque<int> temp;
            for(int i=0; i<c; i++){
                temp.push_front(*(pile.begin()+p-1));
                pile.erase(pile.begin()+p-1);
            }
            while(!temp.empty()){
                pile.push_front(temp.front());
                temp.pop_front();
            }
        }
        /*cout<<endl;
        for(auto it=pile.begin(); it!=pile.end(); it++){
            cout<<*it<<endl;
        }
        cout<<endl;*/
        cout<<pile.front()<<endl;
    }

    return 0;
}

Measured memory_bytes: 2996
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
typedef pair<int, pii> tii;
typedef pair<ll, tii> T;
int x[3], k;
V<ll> X[3];
map<tii, bool> z;
priority_queue<T, vector<T>> q;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  FOR(i, 0, 3) cin >> x[i];
  cin >> k;
  FOR(i, 0, 3){
    X[i].pb(-IINF);
    FOR(j, 0, x[i]){
      ll a;
      cin >> a;
      X[i].pb(a);
    }
    sort(all(X[i]));
    reverse(all(X[i]));
  }
  q.push(mp(X[0][0]+X[1][0]+X[2][0], mp(0, mp(0, 0))));
  lll ans = 0;
  while(k){
    T t = q.top(); q.pop();
    if(z[t.se]) continue;
    z[t.se] = true;
    k--;
    cout << t.fi << endl;
    int x0 = t.se.fi;
    int x1 = t.se.se.fi;
    int x2 = t.se.se.se;
    x0++; q.push(mp(X[0][x0]+X[1][x1]+X[2][x2], mp(x0, mp(x1, x2)))); x0--;
    x1++; q.push(mp(X[0][x0]+X[1][x1]+X[2][x2], mp(x0, mp(x1, x2)))); x1--;
    x2++; q.push(mp(X[0][x0]+X[1][x1]+X[2][x2], mp(x0, mp(x1, x2)))); x2--;
  }
}

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

using namespace std;
typedef long long ll;

typedef pair<int, int> P;
const int MN = 200010;
const int INF = 2e9;
int n;
P a[MN];
int ma, mi;

ll solve1() {
    int lmi = INF, rma = 0;
    for (int i = 0; i < n; i++) {
        lmi = min(lmi, a[i].second);
        rma = max(rma, a[i].first);
    }
    return ll(ma - lmi) * (rma - mi);
}

ll solve2() {
    int dmi = INF;
    set<P> st;
    for (int i = 0; i < n; i++) {
        st.insert(P(a[i].first, i));
    }
    int last = -1;
    while (!st.empty()) {
        P x = *(st.begin());
        st.erase(st.begin());
        int v = x.first, id = x.second;
        dmi = min(dmi, st.rbegin()->first - v);
        if (id == last) break;
        if (v <= a[id].second) {
            st.insert(P(a[id].second, id));
        }
        last = id;
    }
    return ll(ma - mi) * dmi;
}

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

    cin >> n;
    ma = 0; mi = INF;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        if (x > y) swap(x, y);
        a[i] = P(x, y);
        ma = max(ma, y);
        mi = min(mi, x);
    }

    ll ans = min(solve1(), solve2());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 11264
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>

#include <inttypes.h>
using namespace std;
typedef long long ll;

int main()
{
	int N, H;
	scanf("%d%d", &N, &H);

	int a_max = 0, b[100000];
	for (int i = 0; i < N; i++) {
		int a;
		scanf("%d%d", &a, &b[i]);
		a_max = max(a_max, a);
	}
	sort(b, b + N, greater<int>());

	ll sum[100001];
	sum[0] = 0;
	for (int i = 1; i <= N; i++)
		sum[i] = sum[i - 1] + b[i - 1];

	ll res = numeric_limits<ll>::max();
	for (int k = 0; k <= N; k++) {
		ll hit_point = H - sum[k];
		ll attacks = k;
		if (hit_point > 0) {
			attacks += hit_point / a_max;
			if (hit_point % a_max > 0)
				attacks++;
		}
		res = min(res, attacks);
	}

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

	return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)

int dfs(int n, vector<int> &sn){
  queue<pair<int,int>> q;
  q.push(pair<int,int>(0,0));
  int ans;
  while(!q.empty()){
    int b = q.front().first;
    int c = q.front().second;
    bool flg=false;
    q.pop();
    for(auto x: sn){
      if(b+x<=n) q.push(pair<int,int>(b+x,c+1));
      if(b+1==n){
        ans = c + 1;
        flg = true;
        break;
      }
    }
    if(flg) break;
  }
  return ans;
}

void f(vector<int> &dp,vector<int> &sn ,int n, int k){
  if(dp[k] < 8765432) return;
  else{
    int mini = 98765432;
    for(auto x: sn){
      if(k-x<0) continue;
      if(dp[k-x]>8765432)f(dp,sn,n,k-x);
      mini = min(mini,dp[k-x]);
    }
    dp[k] = mini+1;
  }
}

void solve(){
  int n;
  cin >> n;
  vector<int> six(10), nine(10); vector<int> sn;
  six[0] = 1; nine[0] = 1;
  FOR(i,0,9) six[i+1] = six[i]*6;
  FOR(i,0,9) nine[i+1] = nine[i]*9;
  sn.push_back(1);
  FOR(i,1,8) sn.push_back(six[i]);
  FOR(i,1,7) sn.push_back(nine[i]);
  sort(sn.begin(), sn.end());
  vector<int> dp(n+5,987654321);
  dp[0] = 0;
  f(dp,sn,n,n);
  int ans = dp[n];
  cout << ans << endl;
}

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

Measured memory_bytes: 11520
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)

struct Unionfind{
  vector<int> rank,p;
  Unionfind(){}
  Unionfind(int size){
		rank.resize(size,0);
		p.resize(size,0);
		for(int i=0;i<size;i++){
	    makeSet(i);
		}
	}
  void makeSet(int x){
		p[x]=x;
		rank[x]=0;
	}
  bool same(int x,int y){
		return (findSet(x)==findSet(y));
  }

  void unite(int x,int y){
		link(findSet(x),findSet(y));
  }

  void link(int x,int y){
		if(rank[x]>rank[y]){
	    p[y]=x;
		}
		else{
	    p[x]=y;
	    if(rank[x]==rank[y]){
				rank[y]++;
	    }
		}
  }

  int findSet(int x){
		if(x!=p[x]){
	    p[x]=findSet(p[x]);
		}
		return p[x];
  }
};

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  Unionfind uf(n+5);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    uf.unite(a,b);
  }
  vint count(n+5,0);
  rep(i,n+1){
    count[uf.findSet(i)]++;
  }
  int max=0;
  rep(i,n+1){
    chmax(max,count[i]);
  }
  cout<<max<<'\n';
  return(0);
}


Measured memory_bytes: 5528
/*
    Zeolim - An AC a day keeps the bug away
*/
  
//#pragma GCC optimize(2)
//#pragma GCC ("-W1,--stack=128000000")
#include <bits/stdc++.h>
using namespace std;
#define mp(x, y) make_pair(x, y)
#define fr(x, y, z) for(int x = y; x < z; ++x)
#define pb(x) push_back(x)
#define mem(x, y) memset(x, y, sizeof(x))
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef std::pair <int, int> pii;
typedef std::vector <int> vi;
void re(ll &x){x=0;char s=getchar();while(s<'0'||s>'9')s=getchar();while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}}
void wr(ll x){if(x>9) wr(x/10);putchar(x%10+'0');}
const ld PI = acos(-1.0);
const ld E = exp(1.0);
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 386910137;
const ull P = 13331;
const int MAXN = 1e6 + 100;

int main()
{  
    //ios::sync_with_stdio(0);
    //cin.tie(0); cout.tie(0);
    //freopen("d:\out.txt","w",stdout);
    //freopen("d:\in.txt","r",stdin);
    
    ll n, m;
    
    cin >> n;
    
    ll ans = INF;
    
    for(ll i = 1; i * i <= n; ++i)
    {
    	ll ry = n / i;
    	if(ry * i == n) { ans = min((i - 1 + ry - 1), ans); }
	}
    
    cout << ans << '\n';
    
    return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N, W;
    cin >> N >> W;
    vector<lint> v(N), w(N);
    rep(i, N) cin >> v[i] >> w[i];

    vector<lint> ma(W + 1, -1);
    ma[0] = 0;
    for (int i = 0; i < W; i++) {
        for (int j = 0; j < N; j++) {
            if (i + w[j] <= W) ma[i + w[j]] = max(ma[i + w[j]], ma[i] + v[j]);
        }
    }
    lint ans = -1;
    for (int j = 0; j <= W; j++) {
        ans = max(ans, ma[j]);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
using ll = long long;

int main()
{
	int N;
	cin >> N;
	
	int ans = 0;
	for (int i = 1; i <= N; i += 2)
	{
		int count = 0;
		for (int j = 1; j <= i; j++)
		{
			if (i % j == 0) count++;
			if (count >= 9) break;
		}
		if (count == 8) ans++;
	}
	cout << ans;
}

Measured memory_bytes: 256
# include <stdio.h>
int main(void){
    long long int sum=0,m=10000000,n=-10000000;
    int N,i;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        int b;
        scanf("%d",&b);
        sum=sum+b;
        if(m>b){
            m=b;
        }
        if(n<b){
            n=b;
        }
    }
    printf("%lld %lld %lld\n",m,n,sum);











    return 0;
}

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

bool tri(ll a, ll b, ll c){
    if(a+b>c&&b+c>a&&a+c>b){
        return true;
    }
    return false;
}

int main(){
    int N;
    cin >> N;
    vector<ll> L(N);
    rep(i,N) cin >> L[i];
    sort(L.begin(),L.end());
    ll ans = 0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                if(L[i]==L[j]||L[j]==L[k]) continue;
                if(tri(L[i],L[j],L[k]))ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;
using namespace std;


int main(int argc, char* argv[])
{
    char str[20]={0};
    scanf("%s", str);

    ll ans=0;
    int n=strlen(str);
    int i;
    ll save=0;
    for(i=0; i<n; i++) {
        int tmp=str[i]-'0';
        if(tmp>0) {
            ll curr=save+tmp-1;
            curr += (9*(n-i-1));
            ans = MAX(ans, curr);
        }
        save+=tmp;
        if(i==n-1) {
            ans = MAX(ans, save);
        }
    }
    printf("%lld\n", ans);

    return 0;
}


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

using namespace std;

#define ll long long
#define ini(arr, val) memset(arr, (val), sizeof(arr))
#define loop(i,n)  for(ll i=0; i<n; i++)

#define all(a)      (a).begin(),(a).end()
#define exist(s,e)  (s.find(e)!=s.end())
#define dbg(x)  cout << #x << " is " << x << endl;
#define pt(x) cout<<x<<"\n"
#define pts(x) cout<<x<<" "

#define mp make_pair
#define pb push_back
#define f first
#define s second


#define inf (int)1e9
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007


#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test   int t; cin>>t; while(t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef set<int> si;

typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef vector<vl> vvl;
typedef map<ll,ll> mll;
typedef set<ll> sl;


//////////////////////////////////////////////////////////////////////////////////////////
//                      main starts
//////////////////////////////////////////////////////////////////////////////////////////
int const lmt=2e5+5;
string a[lmt];


int main(){

 //    #ifndef ONLINE_JUDGE
 //    freopen("../input.txt", "r", stdin);
 //    freopen("../output.txt", "w", stdout);
	// #endif
 //    fast

	ll n;
	cin>>n;
	// map<int,string>m;
	string a[n];
	loop(i,n){
		cin>>a[i];
	}
	map<string,ll>m;
	ll c=0;
	loop(i,n){
		if(m[a[i]]>0) c++;
		m[a[i]]++;
	}
	pt(n-c);

}


/*

// 

*/

Measured memory_bytes: 31680
// Frog 2
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define times(t) int t; cin >> t; while(t--)
#define mod 1000000007
#define pb push_back
#define mp make_pair

void solve() {
	int n, k; cin >> n >> k;
	vector<int> arr(n);
	for(auto &x : arr) cin >> x;
	vector<int> dp(n+1, INT_MAX);
	dp[0] = 0;
	for(int i=0; i<=n; i++) {
		int j = 1;
		while(j<=k && j<=n) {
			dp[i+j] = min(dp[i+j], dp[i]+abs(arr[i+j]-arr[i]));
			++j;
		}
	}
	// for(auto i : dp) cout << i << ' ';
	// cout << endl;
	cout << dp[n-1] << endl;
	return;
}

int main() {
	IOS;
	// #ifndef ONLINE_JUDGE
	// freopen("C:/Gen code/CompProg/input.txt", "r", stdin);
	// freopen("C:/Gen code/CompProg/output.txt", "w", stdout);
	// #endif
	solve();
	return 0;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define len(arr) (int)(sizeof(arr)/sizeof((arr)[0]))
#define Sort(arr) sort(arr,arr+len(arr))
#define For(i,s,n) for(int i=s;i<n;i++)	
#define Rep(i,n) for(int i=0;i<n;i++)
#define Per(i,n) for(int i=n;i>=0;i--)
#define All(x) (x).begin(),(x).end()
#define in(arr,n) Rep(i,n) cin >> arr[i];
#define in2(arr1,arr2,n) Rep(i,n) cin >> arr1[i] >> arr2[i];
#define in3(arr1,arr2,arr3,n) Rep(i,n) cin >> arr1[i] >> arr2[i] >> arr3[i];
#define LL_MAX 9223372036854775807
#define LL_MIN -9223372036854775808
#define MOD 1000000007
#define MOD9 1000000009

//{ ライブラリ

// 標準出力の高速化
#define endl "\n"

// 出力
template<typename Type>
void print(Type a[],int n){
	Rep(i,n) cout << a[i] << endl;
}
template<typename Type1,typename Type2>
void print(Type1 a[],Type2 b[],int n){
	Rep(i,n) cout << a[i] << " " << b[i] << endl;
}
template<typename Type1,typename Type2,typename Type3>
void print(Type1 a[],Type2 b[],Type3 c[],int n){
	Rep(i,n) cout << a[i] << " " << b[i] << " " << c[i] << endl;
}

// 配列の最大値
template<typename Type>
Type max(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=max(ret,a[i]);
	return ret;
}

// 配列の最小値
template<typename Type>
Type min(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=min(ret,a[i]);
	return ret;
}

// 最大公約数
template<typename Type>
Type gcd(Type a,Type b){return(b==0)?a:gcd(b,a%b);}
template<typename Type>
Type gcd(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=gcd(ret,a[i]);
	return ret;
}

// 最小公倍数
template<typename Type>
Type lcm(Type a,Type b){return (a/gcd(a,b))*b;}
template<typename Type>
Type lcm(Type a[],int n){
	Type ret=a[0];
	For(i,1,n) ret=lcm(ret,a[i]);
	return ret;
}

// aを元にしてペアでソート
template<typename Type1,typename Type2>
void PairSort(Type1 a[],Type2 b[],int left,int right){
	int i=left,j=right;
	Type1 p=a[(left+right)/2];
	while(true){
		while(a[i]<p) i++;
		while(p<a[j]) j--;
		if(i>=j) break;
		swap(a[i],a[j]);
		swap(b[i],b[j]);
		i++;j--;
	}
	if(left<i-1) PairSort(a,b,left,i-1);
	if(j+1<right) PairSort(a,b,j+1,right);
}
template<typename Type1,typename Type2,typename Type3>
void PairSort(Type1 a[],Type2 b[],Type3 c[],int left,int right){
	int i=left,j=right;
	Type1 p=a[(left+right)/2];
	while(true){
		while(a[i]<p) i++;
		while(p<a[j]) j--;
		if(i>=j) break;
		swap(a[i],a[j]);
		swap(b[i],b[j]);
		swap(c[i],c[j]);
		i++;j--;
	}
	if(left<i-1) PairSort(a,b,c,left,i-1);
	if(j+1<right) PairSort(a,b,c,j+1,right);
}

// 配列を逆順にする
template<typename Type>
void Reverse(Type a[],int n){Rep(i,n/2) swap(a[i],a[n-i-1]);}

// 文字列を逆順にする
// reverse(All(str));

//}

int main(){
	int N,A,B;
	cin >> N >> A >> B;
	cout << min(N*A,B);
}
		
		

Measured memory_bytes: 256
N, K = map(int, input().split())
MOD = 10 ** 9 + 7

B = 1
Rm = 0
R = 1
RM = (N-K) - 1

for i in range(1, K+1):
    ans = 2 * R + Rm + RM
    ans *= B
    ans %= MOD
    print(ans)
    B = (B * (K-i)) // i
    Rm = R
    R = RM
    RM = (RM * (N-K-i-1)) // (i+1)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9+7;

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


int32_t  main()
{ 
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
 
  #ifndef ONLINE_JUDGE
  freopen("input.txt","rt",stdin);
  freopen("output.txt","wt",stdout);
  #endif
int k;
cin>>k;

bool check=0;
int val=0;
int ans=-2;
for(int i=0;i<2000000;i++)
{
   val=(val*10+7)%k;
   if(val==0){
     ans=i; break;
   }
}

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


}

Measured memory_bytes: 3648
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($format:expr) => (write!(out,$format).unwrap());
        ($format:expr, $($args:expr),+) => (write!(out,$format,$($args),*).unwrap())
    }
    const W: usize = 100100;
    input!{
        n: usize,
        a: [usize; n],
    }
    let mut dp = vec![vec![(0, 0); W]; 2];
    for i in 0 .. W {
        dp[0][i].1 = i;
        dp[1][i].1 = i;
    }
    for i in 0 .. n {
        dp[i % 2][a[i]].0 += 1;
    }
    dp[0].sort();
    dp[0].reverse();
    dp[1].sort();
    dp[1].reverse();
    let tot;
    if dp[0][0].1 != dp[1][0].1 {
        tot = dp[0][0].0 + dp[1][0].0;
    } else {
        tot = max(dp[0][0].0 + dp[1][1].0, dp[1][0].0 + dp[0][1].0);
    }
    puts!("{}\n", n - tot);
    
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 14588
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            var answer = 0;
            var last = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (last == S[i]) continue;
                answer++;
                last = S[i];
            }

            Console.WriteLine(answer);
        }
    }
}


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

int main(void){
  int K;
  string S;
  
  cin >> K;
  cin >> S;
  
  if(S.size() > K){
    for(int i = 0; i < K; i++){
      cout << S.at(i);
    }
    cout << "..." << endl;
  }
  else{
    cout << S << endl;
  }
}

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

#define int long long

using namespace std;

const int maxn = 410, inf = 1e18;
int a[maxn], ps[maxn], dp[maxn][maxn], n;

int get(int l, int r)
{
    return l ? ps[r] - ps[l - 1] : ps[r];
}

signed main()
{
    ios::sync_with_stdio(false);
    cin >> n;

    for (int i = 0; i < n; i++)
        cin >> a[i], ps[i] = ps[max(0ll, i - 1)] + a[i];

    for (int l = 2; l <= n; l++)
        for (int i = 0; i + l - 1 < n; i++)
        {
            int j = i + l - 1;
            dp[i][j] = inf;
            for (int k = i; k < j; k++)
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j] + get(i, k) + get(k + 1, j));
        }

    cout << dp[0][n - 1];

    return 0;
}


Measured memory_bytes: 1536
s = input()
l = int(s[:2])
r = int(s[2:])
if 1 <= l <= 12 and 1<= r <= 12:
  print('AMBIGUOUS')
elif 1 <= l <= 12:
  print('MMYY')
elif 1 <= r <= 12:
  print('YYMM')
else:
  print('NA')

Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
using namespace std;
#define Nmax 200010
#define GETMD(a) ((a)%998244353+998244353)%998244353
#define MD 998244353
int N;
int K;
int sg[13][2];
long long sm[Nmax];
long long F[Nmax];
int main()
{
	scanf("%d %d", &N, &K);
	for (int i = 0; i < K; i++)
	{
		scanf("%d %d", &sg[i][0], &sg[i][1]);
	}
	F[1] = 1;
	sm[1] = 1;
	for (int i = 2; i <= N; i++)
	{
		F[i] = 0;
		for (int j = 0; j < K; j++)
		{
			F[i] = GETMD(F[i] + sm[max(i-sg[j][0], 0)] - sm[max(0, i-sg[j][1]-1)]);
		}
		sm[i] = GETMD(sm[i-1] + F[i]);
	}
	printf("%lld\n", F[N]);
	
	return 0;
}

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

double dp[305][305][305];

int main(){
  int n, a;
  cin >> n;
  vector<int> sushi(3);
  for(int i=0; i<n; ++i){
    cin >> a;
    ++sushi[a-1];
  }
  int sum1 = sushi[2];
  int sum2 = sushi[1] + sushi[2];
  int sum3 = sushi[0] + sushi[1] + sushi[2];
  for(int k=0; k <= sum1; ++k) for(int j=0; j+k <= sum2; ++j) for(int i=0; i+j+k <=sum3; ++i){
    if(i>0) dp[i][j][k] += (dp[i-1][j][k] +(double)n/(i+j+k)) *i /(i+j+k);
    if(j>0) dp[i][j][k] += (dp[i+1][j-1][k] +(double)n/(i+j+k)) *j /(i+j+k);
    if(k>0) dp[i][j][k] += (dp[i][j+1][k-1] +(double)n/(i+j+k)) *k /(i+j+k);
  }
  printf("%.15f\n",dp[sushi[0]][sushi[1]][sushi[2]]);
}

Measured memory_bytes: 112400
#include <stdio.h>
int main()
{
 int A, B, C ,flag = 0;
 scanf("%d%d%d", &A, &B, &C);
 if (A == 5 && B == 5 && C == 7) flag = 1;
 if (A == 5 && B == 7 && C == 5) flag = 1;
 if (A == 7 && B == 5 && C == 5) flag = 1;
 if (flag == 1)
  printf("YES\n");
 else printf("NO\n");
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <deque>
#include <cstdlib>

using namespace std;
const long long INF = 1LL << 60;
typedef long long int lli;

int main()
{
    // Input numbers
    string a, b, c;
    cin >> a >> b >> c;

    int len[3] = {(int)a.length(), (int)b.length(), (int)c.length()};
    const char *ac[] = {a.c_str(), b.c_str(), c.c_str()};
    int i[3] = {0, 0, 0};

    int turn = 0;
    for (;;) {
        if (len[turn] > i[turn]) {
            char t = ac[turn][i[turn]];
            i[turn]++;
            turn = (t == 'a') ? 0 : (t == 'b') ? 1 : 2;
        } else {
            break;
        }
    }

    char res = (turn == 0) ? 'A' : (turn == 1) ? 'B' : 'C';

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3600