akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;


int main() {
	int n, m;
	cin >> n >> m;
	vector<string> s(n),ans(n+2);
	rep(i, n) {
		cin >> s[i];
		ans[i] = s[i] + "##";
	}
	ans[n] = s[n - 1] + "##";
	ans[n + 1] = s[n - 1] + "##";
	rep(i, n + 2) {
		rep(j, m + 2) {
			if (i == 0 || j == 0 || i == n + 1 || j == m + 1) {
				ans[i][j] = '#';
			}
			else {
				ans[i][j] = s[i - 1][j - 1];
			}
		}
	}
	rep(i, n + 2) {
		cout << ans[i] << endl;
	}
	return 0;
}

//Ctrl+Aを使わない

Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>

typedef long long ll;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
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;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}


//深さ優先探索
void dfs(vector<string> &m,vector<vector<bool>> &seen, ll x, ll y, ll h, ll w){

	seen[y][x]=true;

	
	for(ll i=0;i<4;i++){
		ll nx=x,ny=y;
		if(i==0){ //up
			ny=y-1;
		}
		else if(i==1){ //down
			ny=y+1;
		}
		else if(i==2){ //right
			nx=x+1;
		}
		else{ //left
			nx=x-1;
		}

		if(nx<0 || nx>=w || ny<0 || ny>=h){
			continue;
		}
		if(seen[ny][nx]){
			continue;
		}
		
		if(m[ny][nx]=='#'){
			continue;
		}

		dfs(m,seen,nx,ny,h,w);
	}
}

const ll MOD=1000000007;

void solve(){
	
	ll x;
	cin>>x;

	ll c=100;
	ll ans=0;
	while(c<x){
		c=(double)c*1.01;
		ans++;
	}

	cout<<ans<<endl;
	


}


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


Measured memory_bytes: 3600
//*******Abhijit Burman***********//
//Jalpaiguri Government Engineering College//

#include<bits/stdc++.h>
using namespace std;
#define ll long long int

#define pb push_back
#define mk make_pair
#define MAXX (1000000000000000000+7)
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
ll n,m;
double dp[3002][3002];

double Heads(ll p, ll i,double a[])
{
    //cout<<i<<endl;
    if(p == n)
    {
        return 1.0;
    }
    else
    {
        if(dp[p][i]!=-1.0)
        {
            return dp[p][i];
        }
        else
        {
            if(i<m)
            {
                return dp[p][i] = (a[p]*(Heads(p+1,i,a))+(1.0-a[p])*(Heads(p+1,i+1,a)));
            }
            else
                return dp[p][i] = (a[p]*Heads(p+1,i,a));
            }
        }
}

int main()
{
      cin>>n;
      double a[n];
      for(int i=0;i<=n;i++)
      {
          for(int j=0;j<=n;j++)
          {
              dp[i][j] = -1.0;
          }
      }
      for(int i=0;i<n;i++)
      {
          cin>>a[i];
      }
      if(n%2==0)
      {
          m = (n/2)-1;
      }
      else
      {
          m = n/2;
      }
      double ans = Heads(0,0,a);
      cout<<setprecision(11)<<ans<<endl;

}



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

class Program {
    static void Main(string[] args) {
        int N = Cin.Ni();
        int T = Cin.Ni();
        long TotalTime = 0;
        long lastPush = -T;
        for (int i = 0; i < N; i++) {
            int tmp = Cin.Ni();
            TotalTime += T;
            long sub = lastPush - tmp + T;
            lastPush = tmp;
            if (sub > 0) {
                TotalTime -= sub;
            }
        }
        Console.WriteLine(TotalTime);

    }
}


public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

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

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

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}


Measured memory_bytes: 28832
#include <stdio.h>
#include <cstdlib>
#include <math.h>

int wx[100],wy[100],r[100],n,m,tx,ty,sx,sy,i,j,check,cos1,cos2;
double distance;

int main()
{
	for(;scanf("%d",&n),n;)
	{
		for(i=0;i<n;i++)
		scanf("%d %d %d",&wx[i],&wy[i],&r[i]);
		
		scanf("%d",&m);
		
		for(j=0;j<m;j++)
		{
			scanf("%d %d %d %d",&tx,&ty,&sx,&sy);
			
			check=0;
			for(i=0;i<n;i++)
			{
				cos1 = (wx[i]-tx)*(sx-tx)+(wy[i]-ty)*(sy-ty);
				cos2 = (wx[i]-sx)*(tx-sx)+(wy[i]-sy)*(ty-sy);
				
				distance = cos1<0 ? hypot(wx[i]-tx,wy[i]-ty) : cos2<0 ? hypot(wx[i]-sx,wy[i]-sy) : abs((sx-tx)*(wy[i]-ty)-(wx[i]-tx)*(sy-ty)) / hypot(sx-tx,sy-ty);
				
				if( (r[i]>hypot(tx-wx[i],ty-wy[i])) - (r[i]>hypot(sx-wx[i],sy-wy[i])) )
				check++;
				
				if(distance<=r[i]&& ( r[i]<hypot(tx-wx[i],ty-wy[i]) || r[i]<hypot(sx-wx[i],sy-wy[i]) ))
				check++;
			}
			puts(check ? "Safe" : "Danger");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n,i,b,mc = 0;long long minus = 0;cin >> n;
  int a[n];
  for(i=0;i<n;i++) cin >> a[i];
  vector<int> plus;
  for(i=0;i<n;i++){
    cin >> b;
    if(a[i]-b>0) plus.push_back(a[i]-b);
    else if(a[i]-b<0){
      minus += a[i]-b;mc++;
    }
  }
  sort(plus.begin(),plus.end(),greater<int>());
  if(mc==0) cout << 0 << endl;
  else{
    for(i=0;i<plus.size();i++){
      minus += plus[i];
      if(minus>=0){
        cout << i+mc+1 << endl;break;
      }
    }
  }
  if(minus<0) cout << -1 << endl;
}
  

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static int searchNext(long[] x, long[] y, boolean[] tabu, long p, long q, int id) {
		for (int i = 0; i < x.length; i++) {
			if (x[i] == x[id] + p && y[i] == y[id] + q && tabu[i] == true) {
				tabu[i] = false;
				return searchNext(x, y, tabu, p, q, i) + 1;
			}
		}
		return 0;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] x = new long[N];
		long[] y = new long[N];
		for (int i = 0; i < N; i++) {
			x[i] = sc.nextLong();
			y[i] = sc.nextLong();
		}
		sc.close();

		if (N == 1 || N == 2) {
			System.out.println(1);
			return;
		}

		boolean[] tabu = new boolean[N];

		int minCnt = Integer.MAX_VALUE;

		for (int pqi = 0; pqi < N - 1; pqi++) {
			for (int pqj = pqi + 1; pqj < N; pqj++) {
				for (int i = 0; i < N; i++) {
					tabu[i] = true;
				}
				int cnt = N;

				long p = x[pqi] - x[pqj];
				long q = y[pqi] - y[pqj];

				for (int j = 0; j < N; j++) {
					if (tabu[j] == true) {
						tabu[j] = false;
						for (int i = 0; i < N; i++) {
							if (x[i] == x[j] - p && y[i] == y[j] - q && tabu[i] == true) {
								tabu[i] = false;
								cnt -= searchNext(x, y, tabu, -p, -q, i) + 1;
							}
							if (x[i] == x[j] + p && y[i] == y[j] + q && tabu[i] == true) {
								tabu[i] = false;
								cnt -= searchNext(x, y, tabu, p, q, i) + 1;
							}
						}
					}
				}

				if (minCnt > cnt)
					minCnt = cnt;
			}
		}
		System.out.println(minCnt);
	}
}

Measured memory_bytes: 24536
//https://atcoder.jp/contests/agc024/tasks/agc024_b
//B - Backfront
//LIS? longest_inceasing_subsequence
//->連続する部分列以外は移動させないといけないので、連続する部分列の数を調べる
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif

int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-1.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N; cin>>N;
    vector<pair<ll,ll>> pn(N+1); //P,場所i
    FOR(i,1,N+1){
        auto&& p=pn.at(i);
        cin>>p.first;
        p.second=i;
    }
    sort(pn.begin(),pn.end());
    dump(pn);
    ll cnt=1;
    ll ans=1;
    FOR(i,2,N+1){
        const auto& prev=pn.at(i-1);
        const auto& cur=pn.at(i);
        if(cur.second>prev.second){
            ++cnt;
            ans=max(ans,cnt);
        }else {
            cnt=1;
        }
    }
    cout<<N-ans<<endl;

    return 0;
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<int, int> i_i;

const int MOD = 1e9 + 7;
const ll INF = LLONG_MAX / 2;

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		if (-v[x] < -v[y]) swap(x, y);
		v[x] += v[y]; v[y] = x;
	}
	bool root(int x) { return v[x] < 0; }
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};

int main() {
	int N, M; cin >> N >> M;
	vector<int> a(M), b(M), c(M);
	rep(i, M) cin >> a[i] >> b[i] >> c[i], a[i]--, b[i]--;
	vector<vector<int> > adj(N, vector<int>(N));
	rep(i, M) adj[a[i]][b[i]] = adj[b[i]][a[i]] = c[i];
	vector<int> C(1<<N);
	rep(S, 1<<N) rep(i, M) if ((S>>a[i] & 1) && (S>>b[i] & 1)) C[S] += c[i];
	vector<vector<int> > dp(1<<N, vector<int>(N, -1));
	dp[1][0] = 0;
	rep(S, 1<<N) rep(u, N) if (dp[S][u] != -1) {
		int _S = (1<<N) - 1 - S;
		rep(v, N) if ((_S>>v & 1) && adj[u][v])
			dp[S | 1 << v][v] = max(dp[S | 1 << v][v], dp[S][u] + adj[u][v]);
		for (int T = _S; T; T = (T - 1) & _S)
			dp[S | T][u] = max(dp[S | T][u], dp[S][u] + C[T | 1<<u]);
	}
	int ans = -dp.back()[N - 1];
	rep(i, M) ans += c[i];
	cout << ans << endl;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    int K;
    int X;
    int Y;
    cin >> N >> K >> X >> Y;
    int res = 0;
    for(int i = 0; i < N; i++) {
        if(i < K) {
            res += X;
        } else {
            res += Y;
        }
    }
    cout << res << endl;
}

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

int main() {
    string s,t;
    cin >> s >> t;
    int ans = 0;
    rep(i,3) {
        if(s[i] == t[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
S=input()
cnt=0
ans=0
A=len(S)
for i in range(A):
  ans=max(cnt,ans)
  if S[i]=='A':
    cnt+=1
  elif S[i]=='C':
    cnt+=1
  elif S[i]=='G':
    cnt+=1
  elif S[i]=='T':
    cnt+=1
  else:
    cnt=0
print(max(ans,cnt))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

const int MOD = 1000000007;


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

    set<ll> B;
    rep(i,N){
        auto it = B.find(A[i]);
        if (it != B.end()){
            B.erase(A[i]);
        }
        else{
            B.insert(A[i]);
        }
    }

    cout << B.size() << endl;
    
}

Measured memory_bytes: 8548
#!/usr/bin/env python

def main(n, p):
    ans = 0
    for i in range(1, n-1):
        if p[i-1] < p[i] and p[i] < p[i+1]:
            ans += 1
        elif p[i-1] > p[i] and p[i] > p[i+1]:
            ans += 1
    return ans

if __name__ == '__main__':
    n = int(input())
    p = list(map(int, input().split()))
    print(main(n, p))

Measured memory_bytes: 38256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
  int n,k,i,sum=0;
  cin>>n>>k;int arr[n];
  for(i=0;i<n;i++)
  {
    cin>>arr[i];
  }
  sort(arr,arr+n);
  for(i=0;i<k;i++)
    sum+=arr[i];
  cout<<sum<<endl;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  while (true) {
    int n, q; cin >> n >> q;
    if (n == 0) return;
    map<int, int> ma;
    rep(i, n) {
      int m; cin >> m;
      rep(i, m) {
        int d; cin >> d;
        ma[d]++;
      }
    }
    int mx = 0, md = -1;
    each(m, ma) {
      if (mx < m.second) {
        mx = m.second, md = m.first;
      }
    }
    if (mx < q) cout << 0 << '\n';
    else cout << md << '\n';
  }
}



Measured memory_bytes: 3152
#include<iostream>
#include<algorithm>
using namespace std;
int lis(int A[],int n)
{
	int*L=new int[n+1];
	L[0]=A[0];
	int length=1;
	
	for(int i=1;i<n;i++)
	{
		if(L[length-1]<A[i])L[length++]=A[i];
		else *lower_bound(L,L+length,A[i])=A[i];
	}
	
	return length;
}

int main()
{
	int n;cin>>n;
	int *A=new int[n];
	for(int i=0;i<n;i++)cin>>A[i];
	cout<<lis(A,n)<<endl;
	return 0;
}

Measured memory_bytes: 3816
#include <iostream>
#include <string>

using namespace std;

int main(){

	int n , c = 0 , ans = 0;
	int count = 0 , cou = 0;
	string name , prob , newname;
	cin >> n;
	cin >> name;

	for(int i = 0; i < n; i++){
		cin >> prob;
		int flag = 0;
		for(int e = 0; e < prob.size(); e++){
			c = 0;
			
			for(int j = 0; j < prob.size(); j++){
				if(flag == 1) break;
					c++;
					newname = "";
					count = e;
				for(int k = 0; k < prob.size(); k++){
					newname += prob[count];
					count += c;
					if(newname.size() == name.size() || prob.size() < count){
						if(newname == name){
							ans++;
							flag = 1;
						}
						break;
					}
				}
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3160
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a>b){
        swap(a,b);
    }
    if(a>c){
        swap(a,c);
    }
    if(b>c){
        swap(b,c);
    }
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}


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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;	
	string s; cin>>s;
	for (const char ch:s)
		cout<<char((ch-'A'+n)%26+'A');
	cout<<"\n"<<endl;
	return 0;
}

Measured memory_bytes: 256
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 main(){

    input!{
        a: usize,
    }

    println!("{}",a+a*a+a*a*a);

}

Measured memory_bytes: 2124
#include <iostream>
 
using namespace std;
int main(void){
    // Your code here!
   string N;
   cin >> N;
   if (N[0] == N[1] && N[1] == N[2])
   cout << "Yes" << endl;
   else if (N[1] == N[2] && N[2] == N[3])
   cout << "Yes" << endl;
   else
   cout << "No" << endl;
}

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

int N;
const int MAX_N = 2.0e5 + 100;
pair<int, char> ab[MAX_N];
const int MOD = 1.0e9 + 7;

int main() {
    cin >> N;
    for (int i = 0; i < 2*N; i++) {
        int ab_in;
        cin >> ab_in;
        if (i < N) ab[i] = make_pair(ab_in, 'a');
        else ab[i] = make_pair(ab_in, 'b');
    }

    sort(ab, ab+2*N);

  
    ll ans = 1;
    ll a = 0, b = 0;
    for (int i = 0; i < 2*N; i++) {
        if (ab[i].second == 'a') a++;
        else b++;

        if (a > 0 && b > 0) {
            ans = ((ans*a) % MOD * b) % MOD;
            a--;
            b--;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
  int x;
  cin>>x;
  vector<int>y(x,0);
  for(int i=0;i<x-1;i++){
  int z;
  cin>>z;
  y.at(z-1)++;
  }
  for(int j=0;j<x;j++){
  cout<<y.at(j)<<endl;
  }
}

Measured memory_bytes: 4000
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
  long n;
  int d[100000];

  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> d[i];
  }
  sort(d,d+n);

  if (d[n/2] == d[n/2-1])
  {
    cout << 0 << endl;
  }else{
    cout << d[n/2] - d[n/2-1] << endl;
  }

  return 0;
}

Measured memory_bytes: 640
L=int(input())
keta=0
while(2**keta -1<L):
    keta+=1


edge=[]
tmp=1
for i in range(0,keta-1):
    edge.append("{} {} 0".format(keta-1-i,keta-i))
    edge.append("{} {} {}".format(keta-1-i,keta-i,tmp))
    tmp*=2
    if(L & 1<<(keta-2-i)):
        edge.append("{} {} {}".format(keta-1-i,keta,tmp))
        tmp+=1

if(L==1):
    edge=["1 2 0"]

print("{} {}".format(keta,len(edge)))
for e in edge:
    print(e)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int a[100009],b[100009];
int main() {
    int t,n,sum;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        b[i]=0;
    }
    b[1]=0;b[2]=abs(a[1]-a[2]);
    for(int i=3;i<=n;i++)
        b[i]=min(b[i-1]+abs(a[i]-a[i-1]), b[i-2]+abs(a[i]-a[i-2]));
    cout<<b[n]<<endl;
}


Measured memory_bytes: 1024
n = int(input())
lst = []
for i in range(n):
  lst.append(int(input()))
slst = sorted(lst)
m1 = slst[-1]
m2 = slst[-2]
for i in range(n):
  if(lst[i] == m1):
    print(m2)
  else:
    print(m1)

Measured memory_bytes: 14112
'use strict';
(function(stdin) {
  var lines  = stdin.toString();
  var result = (function(data) {

    var hashmap = data.filter(function(v) {
        return /[A-Za-z]/.test(v);
    })
    .map(function(v) {
      return v.toLowerCase();
    })
    .reduce(function(map,key) {
      map[key]++;
      return map;
    },{a:0,b:0,c:0,d:0,e:0,f:0,g:0,h:0,i:0,j:0
      ,k:0,l:0,m:0,n:0,o:0,p:0,q:0,r:0,s:0,t:0
      ,u:0,v:0,w:0,x:0,y:0,z:0}
    );

    return Object.keys(hashmap).map(function(key) {
      return key + ' : ' + hashmap[key];
    }).join('\n');

  }(lines.split('')
  ));
  console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 8664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  string s, t; cin >> s >> t;
  int szs = s.size(), szt = t.size();
  vector<vector<pair<int, P>>> dp(szs+1, vector<pair<int, P>>(szt+1, {0, {-1, -1}}));
  for(int i=1;i<=szs;++i) {
    for(int j=1;j<=szt;++j) {
      if(s[i-1] == t[j-1]) {
        dp[i][j] = {dp[i-1][j-1].first+1, {i-1, j-1}};
      } else if(dp[i-1][j].first > dp[i][j-1].first) {
        dp[i][j] = {dp[i-1][j].first, {i-1, j}};
      } else {
        dp[i][j] = {dp[i][j-1].first, {i, j-1}};
      }
    }
  }
  string ans = "";
  int x = szs, y = szt;
  while(dp[x][y].first > 0) {
    if(s[x-1] == t[y-1]) ans.push_back(s[x-1]);
    int tmpx = dp[x][y].second.first, tmpy = dp[x][y].second.second;
    x = tmpx; y = tmpy;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;;
}


Measured memory_bytes: 105984
N, M = map(int, input().split())
L = 0
R = N+1
for _ in range(M):
    l, r = map(int, input().split())
    L = max(L, l)
    R = min(R, r)
print(R - L + 1 if R - L + 1 >= 0 else 0)


Measured memory_bytes: 9004
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  int N;
  cin >> N;
  
  cout << "ABC" << N << endl;
}

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

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;

ll a[300000];
ll sum[300000];

int main(){
	int n,K;cin>>n>>K;
	if(K==1){
		puts("0");return 0;
	}
	rep(i,n){
		scanf("%lld",&a[i]);
		a[i]=(a[i]+K-1)%K;
	}
	map<int,int>mp;
	mp[0]++;
	ll ans=0;
	rep(i,n){
		sum[i+1]=(sum[i]+a[i])%K;
		ans+=mp[sum[i+1]];
		if(i-K+2>=0)mp[sum[i-K+2]]--;
		mp[sum[i+1]]++;
	}
	cout<<ans<<endl;
}

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

const long long MOD = 2019;

void solve(long long L, long long R){
    if(R-L>2019){
        cout<<0<<endl;
        return;
    }
    long long res = 2019;
    for(long long i = L;i<R;++i){
        for(long long j=L+1;j<=R;++j){
            res = min(res, (i*j)%MOD);
        }
    }
    cout<<res<<endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long L;
    scanf("%lld",&L);
    long long R;
    scanf("%lld",&R);
    solve(L, R);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl;
#define pno cout << "no" << endl;
#define pYe cout << "Yes" << endl;
#define pNo cout << "No" << endl;
#define pYE cout << "YES" << endl;
#define pNO cout << "NO" << endl;
#define end return 0;
#define prin(num) cout << num << endl;
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 100000000000
#define MOD 1000000007LL
#define MAX 200005
#define NIL -1
#define WHITE 0
#define BLACK 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main(void) {
    ll x, y;
    cin >> x >> y;
    
    if((x==0 || y==0) && x<=y) {
        prin(y-x)
        end
    }else if((x==0 || y==0) && x>y) {
        prin(x-y+1)
        end
    }
    
    
    if(x*y>0 && x<=y) {
        prin(y-x)
    }else if(x*y>0 && x>y){
        prin(x-y+2)
    }else {
        prin(abs(abs(x)-abs(y))+1)
    }
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        using (var reader = new StreamReader("../TextFile1.txt")) {
            var count = 1; string str;
            while((str=Debugger.ReadBlock(reader))!= null) {
                System.Diagnostics.Debug.WriteLine("----------" + count++ + "----------");
                System.Diagnostics.Debug.WriteLine(process(new StringReader(str)));
            }
        }
        System.Diagnostics.Debug.WriteLine("-----END DEBUG-----");
#endif

#if !DEBUG
        String ret = process(new System.IO.StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static string process(TextReader input) {
        var ss = input.ReadLine();
        var spl = ss.Split(' ');
        long s = long.Parse(spl[0]);
        long c = long.Parse(spl[1]);

        long r = 0;

        if (c <= s * 2) {
            r = c / 2;
        } else {
            r += s;
            c -= s * 2;
            r += c / 4;
        }
        return r + "";
    }
}

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

const int64_t inf = 1LL << 40;

int64_t a[5000], dp1[5000][5001], dp2[5000][5001], size[5000], merged1[5001], merged2[5001];
vector<int> graph[5000];

template <typename T>
void ChangeMin(T& var, T t) { var = min(var, t); }

void DFS(int root, int parent) {
  for (int num = 0; num <= 5000; num++) dp1[root][num] = dp2[root][num] = inf;

  size[root] = 1;

  dp1[root][1] = a[root] > 0 ? a[root] : inf;
  dp2[root][1] = a[root];

  for (int to : graph[root]) {
    if (to == parent) continue;

    DFS(to, root);

    for (int num = 1; num <= size[root] + size[to]; num++) merged1[num] = merged2[num] = inf;

    for (int num1 = 1; num1 <= size[root]; num1++) {
      for (int num2 = 1; num2 <= size[to]; num2++) {
        // 繋げない
        if (dp1[to][num2] < inf) {
          ChangeMin(merged1[num1 + num2], dp1[root][num1]);
          ChangeMin(merged2[num1 + num2], dp2[root][num1]);
        }
        if (dp2[to][num2] < 0) {
          ChangeMin(merged1[num1 + num2], dp1[root][num1]);
          ChangeMin(merged2[num1 + num2], dp2[root][num1]);
        }

        // 繋げる
        ChangeMin(merged1[num1 + num2 - 1], dp1[root][num1] + dp1[to][num2]);
        ChangeMin(merged2[num1 + num2 - 1], dp2[root][num1] + dp2[to][num2]);
      }
    }
    size[root] += size[to];
    for (int num = 1; num <= size[root]; num++) {
      dp1[root][num] = merged1[num];
      dp2[root][num] = merged2[num];
    }
  }
}

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

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

  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }

  DFS(0, -1);

  for (int num = 1; num <= n; num++) {
    if (dp1[0][num] < inf or dp2[0][num] < 0) {
      cout << num - 1 << endl;
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 391936
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue> 
using namespace std;
char s[105];
long long k;
int main()
{
    scanf("%s",s);
    scanf("%lld",&k);
    for (int i=0; i<strlen(s); i++)
    {
        if (s[i]!='1') {printf("%c\n",s[i]); return 0;}
        if (i+1==k) {printf("1\n"); return 0;}
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <queue>
using namespace std;
typedef long long ll;


bool kaibun(string S) {
  int s = S.size();
  for (auto i = 0;i < s/2;i ++) {
    if (S[i] != S[s - i - 1]) {
      return false;
    }
  }
  return true;
}

int main() {
  string S;
  cin >> S;
  string S2(""), S3("");
  for (auto i = 0;i < (S.size() - 1)/2; i++) {
    S2 += S[i];
  }
  for (auto i = (S.size() + 3)/2;i <= S.size(); i++) {
    S3 += S[i-1];
  }
  if (kaibun(S) && kaibun(S2) && kaibun(S3)) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
const ll inf = 1000000007;
int main() {
  vector<vector<ll>> a(3,vector<ll>(3));
  map<ll,ll> mp;
  rep(i,3){
    rep(j,3){
      cin >>a[i][j];
      mp[a[i][j]]=0;
         }
       }
       
 
  ll n; cin >>n;
  vector<ll>  b(n);
  rep(i,n){
    cin >>b[i];
    rep(j,3)rep(k,3)if(a[j][k]==b[i])mp[a[j][k]]=1;
  }
  rep(i,3){
    if(mp[a[i][0]]==mp[a[i][1]]&&mp[a[i][0]]==mp[a[i][2]]&&mp[a[i][0]]==1){
      cout <<"Yes"<<endl;
      return 0;
    }
    if(mp[a[0][i]]==mp[a[1][i]]&&mp[a[0][i]]==mp[a[2][i]]&&mp[a[1][i]]==1){
      cout <<"Yes"<<endl;
      return 0;
    }
  }
  if(mp[a[0][0]]==mp[a[1][1]]&&mp[a[0][0]]==mp[a[2][2]]&&mp[a[0][0]]==1){
    cout <<"Yes"<<endl;
    return 0;
  }
   if(mp[a[0][2]]==mp[a[1][1]]&&mp[a[0][2]]==mp[a[2][0]]&&mp[a[0][2]]==1){
    cout <<"Yes"<<endl;
     return 0;
  }
  cout <<"No"<<endl;
}

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;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 (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin>>n;
vector<ll>a(n),b(n),diff(n);
rep(i,n)cin>>a[i];
rep(i,n){
    cin>>b[i];
    diff[i]=a[i]-b[i];
}
int ans;
if(accumulate(diff.begin(),diff.end(),0LL)<0){
    ans=-1;
}
else{
    sort(diff.begin(),diff.end());
    int i=0,j=0;
    int v=0;
    while(diff[i]<0){
        if(v>=abs(diff[i])){
            v+=diff[i];
            i++;
        }
        else{
            v+=diff[(n-1)-j];
            j++;
        }
    }
    ans=i+j;
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 5584
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;

int main(){
	double x1, y1, x2, y2;
	scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
	double d = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
	printf("%lf\n", d);
	return 0;
}

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

int main() {
  int N, A, B;
  int x;
  scanf("%d %d %d",&N,&A,&B);
  long long int ans=0;
  int sum;
  int k;
  for (int i=1; i<=N; i++) {
    sum=0;
    x=i;
    while (x>0) {
      k=x%10;
      sum+=k;
      x/=10;
    }
    if (sum>=A && sum<=B) {
      ans+=i;
    }
  }
  printf("%lld\n",ans);
  return 0;
}


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int a , b;

int main()
{
    _FastIO;
    cin >> a;

    cout << int((a + 1) / 2) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int N = sc.nextInt();
		int L = sc.nextInt();
		
		int[] d = new int[N];
        int min = 0;
        boolean first = true;
        boolean plus = true;
		for (int i = 1; i <= N; i++) {
			d[i-1] = L+i-1;
            int num = 0;
            boolean plus2 = true;
            if(d[i-1] < 0){
             num = 0 - d[i-1];
             plus2 = false;
            } else {
             num = d[i-1] - 0;
            }
          
            if(min > num || first){
              min = num;
              plus = plus2;
            }
            if(first){
              first = false;
            }
		}
        int ans = 0;
  		for (int i = 0; i < N; i++) {
           ans += d[i];
        }
        ans = plus ? ans - min : ans + min;
		System.out.println(ans);
	}		
}


Measured memory_bytes: 21844
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  int n,m;
  string s;cin>>s;
  n = s.size();
  if(n%2 == 1){
    cout<<"No"<<endl;
    return 0;
  }
  rep(i,s.size()/2){
    if(s[i*2] == 'h' && s[i*2+1] == 'i'){

    }else{
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;

}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pl= pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

int main(){
   int n;cin >>n;
   V a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    ll ans=0;
    sort(all(a));
    if(n%2==1){
        ll now=0;
        for (int i = 0; i < n / 2 - 1; ++i) {
            now-=a[i]*2;
        }
        for (int i =n/2-1; i <=n/2; ++i) {
            now-=a[i];
        }
        for (int i =n/2+1; i <n; ++i) {
            now+=a[i]*2;
        }
        ans=max(ans,now);
        now=0;
        reverse(all(a));
        for (int i = 0; i < n / 2 - 1; ++i) {
            now+=a[i]*2;
        }
        for (int i =n/2-1; i <=n/2; ++i) {
            now+=a[i];
        }
        for (int i =n/2+1; i <n; ++i) {
            now-=a[i]*2;
        }
        ans=max(ans,now);
        reverse(all(a));
    }
    else {
        ll now=0;
        for (int i = 0; i < n / 2 - 1; ++i) {
            now-=a[i]*2;
        }
        now-=a[n/2-1];
        now+=a[n/2];
        for (int i =n/2+1; i <n; ++i) {
            now+=a[i]*2;
        }
        ans=max(ans,now);
    }
    cout <<ans <<endl;
}


Measured memory_bytes: 3760
n = int(input())
a = list(map(int, input().split()))

answer = 0
up_or_down = 0
previous = None

for i in a:
    if previous is None or previous == i:
        pass
    elif previous < i:
        if up_or_down == -1:
            answer += 1
            up_or_down = 0
        else:
            up_or_down = 1
    elif previous > i:
        if up_or_down == 1:
            answer += 1
            up_or_down = 0
        else:
            up_or_down = -1
    previous = i

print(answer + 1)


Measured memory_bytes: 14224
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
public class Hello
{
    private const int INF = 1000000007;
    public static void Main()
    {
        string S = NextString();
        ///3種類しかない
        int[] count = new int[3];
        for (int i = 0; i < S.Length; i++)
            count[S[i] - 'a']++;
        int X = count.Min();
        count[0] -= X;
        count[1] -= X;
        count[2] -= X;

        if (count.All(v => v < 2)) Console.WriteLine("YES");
        else Console.WriteLine("NO");
        
    }
}

public class Input
{
    private static Queue<string> queue = new Queue<string>();
    private static void Confirm() { if (queue.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) queue.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(queue.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(queue.Dequeue()); }
    public static string NextString() { Confirm(); return queue.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(queue.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


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

int main(){
  string S;
  cin>>S;
  int ans;

  for(int i=S.size()-2;i>0;i-=2){
    int c = 0;
    for(int j=0;j<i/2;j++){

      if(S.at(j)!=S.at(j+i/2)){
        c=1;
        break;
      }
    }
    if(c==0){
      ans = i;
      break;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
X = int(input())

C = 0
P = 0
D = 0
L = 0
total = 0

if X >= 0 and X <= 10 ** 9:
    while True:
        if X >= 500:
            C = X // 500
            P = 500 * C
            X = X - P
        elif X >= 5:
            D = X // 5
            L = 5 * D
            X = X - L
        else:
            break
man = 1000 * C
t   = 5 * D

total = man + t

print(total)

Measured memory_bytes: 2568
#include<iostream>
#define ll long long
using namespace std;
int main()
{
	ll n,i,sum=0,a[100005],b[100005];
	cin>>n;
	for(i=1;i<=n+1;i++)
		cin>>a[i];
	for(i=1;i<=n;i++)
		cin>>b[i];
	for(i=1;i<=n;i++)
	{
		if(a[i]>=b[i])
		{
			sum+=b[i];
		}
		else
		{
			b[i]-=a[i];
			sum+=a[i];
			if(a[i+1]>=b[i])
			{
				sum+=b[i];
				a[i+1]-=b[i];
			}
			else
			{
				sum+=a[i+1];
				a[i+1]=0;
			}
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1792
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
A = list(map(int, input().split()))

if 0 in A:
    print(0)
    exit(0)

ans = 1
for a in A:
    ans *= a
    if ans > pow(10, 18):
        print(-1)
        exit(0)

print(ans)


Measured memory_bytes: 21636
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<pii>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}

const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}


void solve(){
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    if(k <= a)cout << k;
    else if(k <= a+b)cout << a;
    else {k -= a+b;cout << a-k;}
}

signed main()   
{
    showoff;
    int T = 1;
    //cin >> T;
    FOR(t,1,T+1){
       solve();
       cout << "\n";
    }
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...


Measured memory_bytes: 3656
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
p=lmp()
p.append(n+1)
ans=0
for i in range(n):
    if p[i]==i+1:
        p[i],p[i+1]=p[i+1],p[i]
        ans+=1
print(ans)

Measured memory_bytes: 21628
#include <stdio.h>

int main() {
    double xA, yA, xB, yB, xC, yC, xD, yD;
    while (scanf("%lf%lf%lf%lf%lf%lf%lf%lf",
                &xA, &yA, &xB, &yB, &xC, &yC, &xD, &yD) != EOF) {
        bool f = true;
        if (xD < xA || xB < xC) f = false;
        if (yD < yA || yB < yC) f = false;
        puts(f ? "YES" : "NO");
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <math.h>

using namespace std;

int main() {
    double a, b, c, d;
    cin >> a >> b >> c >> d;

    if (ceil(c/b) > ceil(a/d)) {
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }

    return 0;
}


Measured memory_bytes: 3720
# import itertools
# import math
# import sys
# import numpy as np

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
# Q = list(map(int, input().split()))
# S = input()

d = {}
for i in range(N):
    S = input()
    d.setdefault(S, 0)
    d[S] += 1

cnt_max = max(d.values())
d = sorted(d.items(), key=lambda x:x[0]) # keyでsort

for k, v in d:
    if cnt_max == v:
        print(k)

Measured memory_bytes: 49044
a = True
n = int(input())
p = input()
s = {p}
for i in range(n-1):
    c = input()
    if p[-1] != c[0] or c in s:
        a = False
    else:
        p = c
        s.add(p)
if a:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9180
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

x, y = map(int, input().split())
for g in [a, b, c]:
    if x in g and y in g:
        print('Yes')
        break
else:
    print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>

typedef long long ll;

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    set<char> arare;
    for(int i=0; i<n; i++)
    {
        char a;
        cin >> a;
        arare.insert(a);
    }
    if(arare.size() == 3) cout << "Three";
    else cout << "Four";
    return 0;

}


Measured memory_bytes: 384