akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#define maxn 505
int n,m;
char s[3][maxn][maxn];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%s",s[2][i]+1);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			s[i&1][i][j]='#',s[(i&1)^1][i][j]='.';
	for(int i=1;i<=n;i++) s[0][i][1]=s[1][i][m]='#',s[0][i][m]=s[1][i][1]='.';
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(s[2][i][j]=='#') s[0][i][j]=s[1][i][j]='#';
	for(int i=1;i<=n;i++) printf("%s\n",s[0][i]+1);
	printf("\n");
	for(int i=1;i<=n;i++) printf("%s\n",s[1][i]+1);
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
#define mp(a,b) make_pair(a,b)
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n;
    cin>>n;
    vector<pair<int,int>> v(n);
    for(int i=0;i<n;i++){
        int a,b;
        cin>>a>>b;
        v[i]={a-b,a+b};
    }
    sort(v.begin(),v.end());
    int ans=1;
    int end=v[0].second;
    for(int i=1;i<n;i++){
        if(v[i].first >= end ){
            ans++;
            end=v[i].second;
        }
        else{
            end=min(end,v[i].second);
        }
    }
    cout<<ans;
}


Measured memory_bytes: 1024
N, Y = map(int, input().split())

def check(N, Y):
    for i in range(N+1):
        for j in range(N+1 - i):
            if i * 10000 + j * 5000 + (N-i-j) * 1000 == Y:
                return ' '.join(map(str, (i, j, N-i-j)))
    else:
        return '-1 -1 -1'

print(check(N, Y))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


int main() {
  ll n; cin >> n;
  ll m = 1ll<<n;
  V s(m);
  rep(i, m) cin >> s[i];
  sort(all(s));
  reverse(all(s));

  multiset<int> S;
  S.insert(s[0]);
  s[0] = -1;

  rep(i, n) {
    stack<int> sta;
    for (auto e : S) sta.push(e);
    int j = 0;
    while (!sta.empty()) {
      int x = sta.top(); sta.pop();
      while (j < m && (s[j] < 0 || x <= s[j])) j++;
      if (j == m) {
        cout << "No" << endl;
        return 0;
      }
      S.insert(s[j]);
      s[j] = -1;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 13568
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <bitset>
#include <set>

using ll = long long;
using namespace std;
constexpr ll MOD = ll(1e9) + 7;

int main(void) {
	int n, k;
	cin >> n >> k;
	
	vector<ll> h(n);
	for(int i = 0; i < n; ++i) {
		cin >> h[i];
	}
	
	if( n <= k ) { 
		cout << 0 << endl;
		return 0;
	}
	
	sort(h.begin(), h.end(), greater<int>());
	
	ll ans = 0;
	for(int i = k; i < n; ++i) {
		ans += h[i];
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.D_Challenge
{
    class ABC_056
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int[] nk = ReadInts();
            long[] array = ReadLongs();
            Array.Sort(array);
            int bottom = -1;
            int top = nk[0];
            while (bottom + 1 < top)
            {
                int x = (bottom + top) / 2;
                bool need = false;
                if (array[x] >= nk[1]) need = true;
                else
                {
                    var dp = new bool[nk[1]];
                    dp[0] = true;
                    for (int i = 0; i < nk[0]; i++)
                    {
                        if (x == i) continue;

                        var nextDp = new bool[nk[1]];
                        for (int j = 0; j < nk[1]; j++)
                        {
                            if (!dp[j]) continue;

                            nextDp[j] = true;

                            if (j + array[i] >= nk[1]) continue;

                            if (j + array[i] >= nk[1] - array[x])
                            {
                                need = true;
                            }
                            nextDp[j + array[i]] = true;
                        }
                        dp = nextDp;
                    }
                }
                /*
                for (int j = 0; j < nk[1]; j++)
                {
                    Console.Write(dp[j] + " ");
                }
                Console.WriteLine();
                */
                if (need)
                {
                    top = x;
                }
                else
                {
                    bottom = x;
                }

            }
            Console.WriteLine(bottom + 1);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

long long INF = 1e18;

int main()
{
	int N, M, L;
	cin >> N >> M >> L;
	vector<vector<long long>> adj(N, vector<long long>(N, 0));
	for (int i = 0; i < M; ++i)
	{
		int A, B, C;
		cin >> A >> B >> C; --A; --B;
		adj[A][B] = C;
		adj[B][A] = C;
	}

	vector<vector<long long>> dist(N, vector<long long>(N, 0));
	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < N; ++j)
		{
			if (i == j)
				dist[i][j] = 0;
			else if (adj[i][j])
				dist[i][j] = adj[i][j];
			else
				dist[i][j] = INF;
		}
	}
	
	for (int k = 0; k < N; ++k)
		for (int i = 0; i < N; ++i)
			for (int j = 0; j < N; ++j)
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	
	vector<vector<long long>> fuel(N, vector<long long>(N, INF));
	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < N; ++j)
		{
			if (i == j)
				fuel[i][j] = 0;
			else if (dist[i][j] <= L)
				fuel[i][j] = 1;
		}
	}
				
	for (int k = 0; k < N; ++k)
		for (int i = 0; i < N; ++i)
			for (int j = 0; j < N; ++j)
				fuel[i][j] = min(fuel[i][j], fuel[i][k] + fuel[k][j]);

	// process queries
	int Q;
	cin >> Q;
	vector<int> ans(Q);
	for (int i = 0; i < Q; ++i)
	{
		int s, t;
		cin >> s >> t; --s; --t;
		if (fuel[s][t] == INF)
			ans[i] = -1;
		else
			ans[i] = fuel[s][t] - 1;
	}
	for (int i = 0; i < Q; ++i)
		cout << ans[i] << '\n';
}


Measured memory_bytes: 3072
import static java.util.Comparator.comparing;

import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==========================================================
    double[][] dp;
    public void solve() {
    	int N = ni();
    	double[] P = new double[N];
    	for (int i = 0; i < N; i++) {
			P[i] = sc.nextDouble();
		}
    	dp = new double[N+1][N+1];
    	dp[0][0] = 1;
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j <= i; j++) {
				dp[i+1][j+1] += dp[i][j] * P[i];
				dp[i+1][j] += dp[i][j] * (1 - P[i]);
			}
		}
    	double ans = 0;
    	for (int i = (N+1)/2; i <= N; i++) {
			ans += dp[N][i];
		}
    	out.println(ans);
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return sc.nextInt();
    }
    public long nl() {
    	return sc.nextLong();
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] nddi(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


Measured memory_bytes: 123032
#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, s;
  cin >> k >> s;
  int answer = 0;
  for (int x = 0; x <= k; x++) {
    for (int y = 0; y <= k; y++) {
      int z = s - x - y;
      if (0 <= z && z <= k) answer++;
    }
  }
  cout << answer;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i,n) cin >> d[i];
    sort(d.begin(),d.end());
    auto f = [&](int x){return x < (d[n/2-1]+1);};
    auto count = count_if(d.begin(),d.end(),f);
    if (count > n/2) cout << 0 << endl;
    else cout << d[n/2]-d[n/2-1] << endl;

}

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

using ll = long long int;
using P = std::pair<int, int>;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rag(con) std::begin(con), std::end(con)

int main()
{
    int d, t, s;

    std::cin >> d >> t >> s;

    if ((d + s - 1) / s <= t)
        std::cout
            << "Yes" << std::endl;
    else
    {
        std::cout << "No" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {
 
	ll N, an=0,m=99999999999;
	cin >> N ;
	vector<ll> vec(N);
	vector<ll> veb(N);

	for (int i = 0; i < N; i++) {
		cin >> vec.at(i)>>veb.at(i);
		if (m > veb.at(i)) {
			m = veb.at(i);
			an = vec.at(i) + veb.at(i);
		}
	}
	cout << an << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)

#define endl "\n"
#define pb push_back
#define elif else if
#define cout_db cout << fixed

#define MOD 1000000007
 
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};

typedef long long ll;

template <typename T>
inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T>
inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T>
inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T>
inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T>
inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	string s;
	cin >> s;

	ll ans = 0;
	int wcnt = 0, combo = 0;
	for (int i = 0; i < s.size(); i++) {
		if(s[i] == 'W'){
			ans += (ll)i - wcnt;
			wcnt++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

int n;
int a[110];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  while (cin >> n, n) {
    REP(i,n) cin >> a[i];
    sort(a,a+n);
    int sum = 0;
    FOR(i,1,n-1) sum += a[i];
    cout << sum/(n-2) << endl;
  }

  return 0;
}


Measured memory_bytes: 3228
#include <stdio.h>
int main (){

    int x,y,r,tmp;


    scanf("%d %d",&x,&y);
    if(y>x) {
        tmp = y;
        y = x;
        x = tmp;
    }
    
    while (y > 0){
        r = x % y;
        x = y;
        y = r;
    }
    
    
    printf("%d\n",x);

return 0;
}


Measured memory_bytes: 2100
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <numeric>
#include <cstring>

using namespace std;

#define ll          long long

ll MOD = 1000000007;
#define SIZE 2005
ll C[SIZE][SIZE];
void start_comb() {
  for (int i = 0; i < SIZE; i++)
    C[i][0] = 1;
  for (int i = 1; i < SIZE; i++) {
    for (int j = 1; j < SIZE; j++) {
      C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MOD;
    }
  }
}

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

  start_comb();
  
  for (int i = 1; i <= K; i++) {
    ll a = C[K-1][i-1];
    ll b = C[N-K+2-1][i+1-1];
    printf("%lld\n", a * b % MOD);
  }

  return 0;
}


Measured memory_bytes: 31616
sx,sy,tx,ty=map(int,input().split())
ans1='U'*(ty-sy)+'R'*(tx-sx)
ans2=ans1.replace('U','D').replace('R','L')
ans3='L'+'U'*(ty-sy+1)+'R'*(tx-sx+1)+'D'
ans4='R'+'D'*(ty-sy+1)+'L'*(tx-sx+1)+'U'
print(ans1+ans2+ans3+ans4)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) > (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(a,b) <<" "<<max(0,a+b-n) <<endl;

    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<queue>
using namespace std;

string s;
int x[100000],y[100000],ans[100000];

int main(){  
    cin >> s;
    for(int i = 0;i < s.size() - 1;i++){
        if(x[i] == -1) continue;
        if(s.at(i) == 'R' && s.at(i + 1) == 'L'){
            x[i] = -1;
            x[i + 1] = -1;
        }
        else if(s.at(i) == 'R'){
            x[i] = 2;
        }
        else{
            x[i] = 1;
        }
    }

    int n = s.size();

    if(x[n - 1] != -1){
        x[n - 1] = 1;
    }

    int roop = 0;

    for(int i= 0;i < s.size();i++){
        switch(x[i]){
            case -1:
            y[i] = -1;
            roop = i;
            ans[i]++;
            break;
            case 1:
            y[i] = i - roop;
            if(y[i]%2 == 0){
                ans[roop]++;
            }
            else{
                ans[roop - 1]++;
            }
            break;
            case 2:
            break;
        }
    }

    for(int i= s.size() - 1;i >= 0;i--){
        switch(x[i]){
            case -1:
            y[i] = -1;
            roop = i;
            ans[i]++;
            break;
            case 1:
            break;
            case 2:
            y[i] = roop - i;
            if(y[i]%2 == 0){
                ans[roop]++;
            }
            else{
                ans[roop + 1]++;
            }
            break;
        }
    }



    for(int i = 0;i < s.size();i++){
        if(ans[i] > 0){
            ans[i]--;
        }
        cout << ans[i] << " " ;
    }

   cout << endl;
}

Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;
		double x=0,y=0;
		double angle=0;

		while(!(str=br.readLine()).equals("0,0")){
			double a = Double.parseDouble(str.substring(0, str.indexOf(",")));
			double b = Double.parseDouble(str.substring(str.indexOf(",")+1, str.length()));

			y += a * Math.cos(-Math.toRadians(angle));
			x += a * Math.sin(Math.toRadians(angle));
			angle += b;
		}
		System.out.println((int)x);
		System.out.println((int)y);
	}
}

Measured memory_bytes: 17064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int m;
vi tmp;
int w[8][3]={
	{0,1,2},
	{3,4,5},
	{6,7,8},
	{0,3,6},
	{1,4,7},
	{2,5,8},
	{0,4,8},
	{2,4,6}
};
vi in;
bool f(){
	vi su(8);
	rep(i,8){
		int sum=0;
		rep(j,3)sum+=tmp[w[i][j]];
		su[i]=sum%m;
	}
	bool h=true;
	rep(i,8)if(su[0]!=su[i])h=false;
	return h;
}
int main(){
	while(1){
		in=vi(10);
		rep(i,10)cin>>in[i];
		if(in[0]==-1)break;
		tmp=vi(11);
		rep(i,10)tmp[in[i]]++;
		vi per;
		rep(i,10)if(tmp[i+1]==0)per.pb(i+1);
		int out=0;
		do{
			tmp=in;
			int c=0;
			rep(i,10)if(tmp[i]==0)tmp[i]=per[c],c++;
			m=tmp[9];
			out+=f();
		}while(next_permutation(all(per)));
		cout<<out<<endl;
	}
}

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

using namespace std;

int n, k;
bool is[10];

int32_t main()
{
        ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        cin >> n >> k;
        memset(is,true,sizeof(is));
        for (int i=0; i<k; i++)
        {
                int x; cin >> x;
                is[x] = false;
        }
        for (int i=n; ; i++)
        {
                int x = i;
                bool ok = true;
                while (x)
                {
                        int t = x%10;
                        x/=10;
                        if (!is[t])
                        {
                                ok = false;
                                break;
                        }
                }
                if (ok)
                {
                        cout << i;
                        return 0;
                }
        }
        return 0;
}


Measured memory_bytes: 256
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

if (a < b):
    pa = a + v * t
    pb = b + w * t
    if pa < pb:
        print('NO')
    else:
        print('YES')
else:
    pa = a - v * t
    pb = b - w * t
    if pb < pa:
        print('NO')
    else:
        print('YES')


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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if(abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d) )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i = (a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = false;

int n, m;
int a[1000];

int main() {
	while (cin >> n >> m, n || m) {
		REP(i, n) scanf("%d", a + i);
		sort(a, a + n);
		int ans = -1;
		REP(i, n) {
			int idx = upper_bound(a, a + n, m - a[i]) - a - 1;
			if (i >= idx) continue;
			int sum = a[i] + a[idx];
			if (sum <= m) chmax(ans, sum);
		}
		if (debug) putchar('@');
		if (ans == -1) puts("NONE");
		else printf("%d\n", ans);
	}
	
	return 0;
}


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

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

  sort(S.begin(), S.end());

  rep(i, S.length() - 1) {
    if (S[i] == S[i + 1]) {
      puts("no");
      return 0;
    }
  }
  puts("yes");
}

Measured memory_bytes: 256
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    T=I()
    M=60
    


    
    def pipo(x):
        cnt=0
        for i in range(M):
            if x==0:
                return cnt
            else:
                x=x//2
                cnt+=1
    

        
    
    for _ in range(T):
        N=I()
        A=LI()
        S=list(input())
        #後ろから見ていき，S=0の数だけで作れない数が(S=1の時に)出てきたらNG
        Vec=[]
        flag=1
        for i in range(N-1,-1,-1):
            #print(i,S[i]) 
            if S[i]=="0":
                if Vec==[]:
                    Vec.append((A[i],pipo(A[i])))
                else:
                    now=A[i]
                    p=pipo(A[i])
                    for v in Vec:
                        if v[1]==p:
                            now=now^v[0]
                            p=pipo(now)
                    if now!=0:
                        Vec.append((now,pipo(now)))
                        Vec.sort(reverse=True)
                            
                
            else:
                #print(Vec)
                now=A[i]
                for v in Vec:
                    if v[1]==pipo(now):
                        now=now^v[0]
                if now!=0:
                    flag=0

                    
                
        if flag:
            print(0)
        else:
            print(1)
            
            
        
        
        
        

main()


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

int main()
{
	int a, b, c;
	while (std::cin >> a >> b >> c)
	{
		if (a == 0 && b == 0 && c == 0)
			break;

		int n;
		std::cin >> n;

		std::vector<int> va, vb, vc;
		// 0は故障 1は正常 2は不明
		std::vector<int> vac(a, 2), vbc(b, 2), vcc(c, 2);

		for (int i = 0; i != n; ++i)
		{
			int a1, b1, c1;
			std::cin >> a1 >> b1 >> c1;
			a1 -= 1;
			b1 -= a + 1;
			c1 -= a + b + 1;

			int a;
			std::cin >> a;
			if (a == 1)
			{
				vac[a1] = 1;
				vbc[b1] = 1;
				vcc[c1] = 1;
			}
			else
			{
				va.push_back(a1);
				vb.push_back(b1);
				vc.push_back(c1);
			}
		}

		for (int i = 0; i != va.size(); ++i)
		{
			if (vac[va[i]] == 1 && vbc[vb[i]] == 1)
				vcc[vc[i]] = 0;
			if (vbc[vb[i]] == 1 && vcc[vc[i]] == 1)
				vac[va[i]] = 0;
			if (vcc[vc[i]] == 1 && vac[va[i]] == 1)
				vbc[vb[i]] = 0;
		}

		for (int i = 0; i != a; ++i)
			std::cout << vac[i] << std::endl;
		for (int i = 0; i != b; ++i)
			std::cout << vbc[i] << std::endl;
		for (int i = 0; i != c; ++i)
			std::cout << vcc[i] << std::endl;
	}

	return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,b,a) for (ll i = b - 1; i >= a; i--)
#define all(v) v.begin(), v.end()
#define maxe(v) *max_element(v.begin(), v.end())
#define mine(v) *min_element(v.begin(), v.end())
#define pb push_back
#define pf push_front
#define rem 1000000007
#define cont continue
const ll INF=(1ll<<60)-1;
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b%a, a);
}
ll modulo(ll a, ll b)
{
    ll r = a % b;
    return r < 0 ? r + b : r;
}
//ncr
ull ncr(ull n, ull r)
{
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    ull ans = 1;
    ull i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
class abc
{
    public:
    ll val;
    ll ind;
};
bool fun1(abc x,abc y)
{
    return x.val>y.val;
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
ll modInverse(ll n, ll p)
{
    return power(n, p-2, p);
}
ll fact[100000+2];
ll ncrfast(ll n, ll r, ll p)
{
   if (r==0)
      return 1;
    return (fact[n]* modInverse(fact[r], p) % p *
            modInverse(fact[n-r], p) % p) % p;
}
///////////////////////////////////////////////////////

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*ll tc;
    cin>>tc;
    while(tc--)
    {}*/
    ll n;
    cin>>n;
    ll ans=0;
    rep(i,1,n+1)
    {
        rep(j,1,n+1)
        {
            rep(k,1,n+1)
            {
                ll x=gcd(i,j);
                ll y = gcd(x,k);
                ans+=y;
            }
        }
    }
    cout<<ans<<'\n';
}
// 1. "\"D:\\\\mingw\\\\mingw32\\\\lib\\\\gcc\\\\i686-w64-mingw32\\\\8.1.0\\\\include\\\\c++\""
// 2.  "D:\\mingw\\mingw32\\lib\\gcc\\i686-w64-mingw32\\8.1.0\\include\\c++"

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K;
  cin >> N >> K;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  auto f = [&](int64_t x) {
    int64_t res = 0;
    if (x == 0) return false;
    for (int i = 0; i < N; i++) {
      res += (A[i] - 1) / x;
    }
    return res <= K;
  };
  int64_t lo = 0, hi = *max_element(A.begin(), A.end()) + 1;
  while (lo < hi) {
    int64_t mi = (lo + hi) / 2;
    if (f(mi)) {
      hi = mi;
    } else {
      lo = mi + 1;
    }
  }
  cout << hi << '\n';
  return 0;
}


Measured memory_bytes: 4780
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

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

int w,h,cnt,l[50][50];

void f(int x,int y){
	l[y][x]=0;
	for(int i=0;i<8;i++){
		int nx=x+dx[i];
		int ny=y+dy[i];
		if(nx>=0&&nx<w&&ny>=0&&ny<h&&l[ny][nx]==1)f(nx,ny);
	}
}

int main(){
	while(cin>>w>>h,w||h){
		cnt=0;
		for(int i=0;i<w*h;i++)cin>>l[i/w][i%w];
		for(int i=0;i<w*h;i++)if(l[i/w][i%w]==1){cnt++;f(i%w,i/w);}
		cout<<cnt<<endl;
	}
}

Measured memory_bytes: 0
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
#define what(x) cerr << #x << " is " << x << endl;
const int INF = 1 << 28;

ll fastpowmod(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll modinv(ll a, ll mod) { return fastpowmod(a, mod - 2, mod); }

ll comb(ll a, ll b, ll mod) {
    ll ret = 1;
    for (ll i = a; i > (a - b); --i) {
        ret = ret * i % mod;
    }
    for (ll i = 1; i <= b; ++i) {
        ret = ret * modinv(i, mod) % mod;
    }
    return ret;
}

void factors(ll a, set<ll> &facs) {
    for (ll i = 1; i <= sqrt(a); ++i) {
        if (a % i == 0) {
            facs.insert(i);
            facs.insert(a / i);
        }
    }
}

void primeFactors(ll a, map<ll, ll> &facs) {
    set<ll> allFactors;
    factors(a, allFactors);
    allFactors.erase(1);
    for (auto it = allFactors.begin(); it != allFactors.end(); it = next(it)) {
        while (a % (*it) == 0) {
            facs[*it]++;
            a /= *it;
        }
    }
}

int main() {
    ll N, M;
    cin >> N >> M;
    ll mod = 1'000'000'007;
    map<ll, ll> facs;
    primeFactors(M, facs);
    ll ret = 1;
    for (auto it = facs.begin(); it != facs.end(); it = next(it)) {
        ret = ret * comb(it->second + N - 1LL, it->second, mod) % mod;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
INF = float('inf')
N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]
V = 1000*N
dp = [[INF]*(V+1) for _ in range(N+1)]
dp[0][0]=0
for i in range(N):
    for j in range(V+1):
        if j-wv[i][1] >= 0:
            dp[i+1][j] = min(dp[i][j-wv[i][1]]+wv[i][0],dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]

ans = 0
for i in range(N+1):
    for j in range(V+1):
        if dp[i][j] <= W:
            ans = max(ans,j)
print(ans)

Measured memory_bytes: 311064
#include <bits/stdc++.h>
#define lint long long
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
using namespace std;

int main(){
  int N,M;
  cin >> N >> M;
  
  vector<vector<int> > next(N, vector<int>(0));
  
  for(int i=0; i<M; i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    next[a].PB(b);
    next[b].PB(a);
  }
  
  vector<bool> done(N, false);
  done[0] = true;
  queue<int> will;
  will.push(0);
  
  vector<int> ans(N, -1);
  
  while(will.empty()==false){
    int v = will.front();
    will.pop();
    
      for(int i=0; i<next[v].size(); i++){
        if(done[next[v][i]]==true) continue;
        else{
          ans[next[v][i]] = v;
          done[next[v][i]] = true;
          will.push(next[v][i]);
        }
      }
  }
  
  cout << "Yes" << endl;
  
  for(int i=1; i<=N-1; i++){
    cout << ans[i]+1 << endl;
  }
}
    
  
          
  
   

Measured memory_bytes: 10052
import sys

n, m = map(int, input().split())
links = [set() for _ in range(n)]
counts = [0] * n
for line in sys.stdin:
    s, t = map(int, line.split())
    s -= 1
    t -= 1
    links[s].add(t)
    counts[s] += 1

not_omitted = [0.0] * n
exp_get = not_omitted.__getitem__
for j in range(n - 2, -1, -1):
    not_omitted[j] = sum(map(exp_get, links[j])) / counts[j] + 1

ans = 1e6

for i in range(n - 1):
    expected = [0.0] * n
    expected[i + 1:] = not_omitted[i + 1:]
    e_get = expected.__getitem__

    if counts[i] == 1:
        expected[i] = sum(map(e_get, links[i])) / counts[i] + 1
    else:
        exp = list(map(e_get, links[i]))
        expected[i] = (sum(exp) - max(exp)) / (counts[i] - 1) + 1

    for j in range(i - 1, -1, -1):
        expected[j] = sum(map(e_get, links[j])) / counts[j] + 1

    ans = min(ans, expected[0])

print(ans)


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

using namespace std;
using ll=int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi=vector<int>;
using vii=vector<vi>;
using vl=vector<ll>;
using vll=vector<vl>;
using vpi=vector<pii>;
using tpi=tuple<int, int, int>;

int main() {
    string s, t;
    cin >> s >> t;
    using vsi=vector<set<int>>;
    vsi v(26);
    for (int i = 0; i < s.size(); i++) {
        v[s[i] - 'a'].insert(i + 1);
    }

    int prev = 0;
    ll ans = 0;
    for (char c : t) {
        if (v[c - 'a'].empty()) {
            cout << -1 << endl;
            return 0;
        }
        bool hit = false;
        auto index_iter = v[c - 'a'].upper_bound(prev);
        if (index_iter == v[c - 'a'].end()) {
            ans += (s.size() - prev);
            ans += *v[c - 'a'].begin();
            prev = *v[c - 'a'].begin();
        } else {
            ans += (*index_iter - prev);
            prev = *index_iter;
        }
    }

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


Measured memory_bytes: 5120
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

int main(){
    int N,K; cin >> N >> K;
    vector<ll> v(N);
    ll sum[55];
    cin >> v[0];
    sum[0] = v[0];
    for (int i = 1; i < N; i++){
        cin >> v[i];
        sum[i] = sum[i-1]+v[i];
    }
    
    ll mx = 0;
    for (int i = 0; i < min(N,K)+1; i++){
        for (int j = 0; j < min(N,K)-i+1; j++){
            vector<ll> vec = v;
            vec.erase(vec.begin()+i,vec.end()-j);
            sort(vec.begin(),vec.end());
            if (K-i-j < 0) continue;
            ll sum = accumulate(vec.begin(),vec.end(),0);
            ll f = min(K-i-j, (int)vec.size());
            for (int k = 0; k < f; k++){
                if (vec[k] < 0) sum -= vec[k];
            }
            mx = max(mx,sum);
        }
    }
    cout << mx << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <tuple>
using namespace std;
long long K, A, B;
int main() {
	cin >> K >> A >> B;
	long long C = A;
	if (C >= K) { cout << "1" << endl; }
	else  if (A <= B) { cout << "-1" << endl; }
	else {
		cout << 1LL + 2LL * (((K - C) + (A - B - 1)) / (A - B)) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int n,m,shu1,shu2,point[1000005],dp[1000005];
int ans,num[1000005];
int moc(int x)
{
	if(x>=mod) 
        return x-mod;
	if(x<0) 
        return x+mod;
	return x;
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&shu1,&shu2);
		shu1--,shu2--;
		point[shu1]|=1<<shu2;
	}
	int maxa=(1<<n)-1;
	dp[0]=1;
	for(int i=0;i<=maxa;i++)
	{
		int now=0;
		for(int j=0;j<n;j++)
		    if(i>>j&1) 
                now++;
		num[i]=1<<now;
	}
	for(int s=1;s<=maxa;s++)
	if((s&1)==(s>>1&1))
	{
		for(int ss=s;ss;ss=(ss-1)&s)
        {
            if((ss&1)==(ss>>1&1))
		    {
			    int t=s^ss,now=1;
			    for(int i=0;i<n;i++)
			    if(ss>>i&1)
			        now=1ll*now*num[point[i]&t]%mod;
			    else if(t>>i&1)now=1ll*now*(num[point[i]&ss]-1)%mod;
			        dp[s]=moc(dp[s]+1ll*now*dp[t]%mod);
		    }
        }	    
	}
	ans=1;
	for(int i=1;i<=m;i++)
	    ans=moc(ans<<1);
	ans=moc(ans-dp[maxa]);
	printf("%d",ans);
	return 0;
}

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

using namespace std;

int main()
{
  int l, c;
  string str;

  while(cin>>str){
    l = str.size()/2;
    if(str.size()%2 == 0 || str[l] == 'i' || str[l] == 'w'){
      c = 0;
    } else {
      c = 1;
    }
    for(int i = 0; i < l; i++){
      char c1 = str[i], c2 = str[str.size()-1-i];

      if(c1 == c2 && (c1 == 'i' || c1 == 'w')){
        continue;
      } else if(c1 == ')' && c2 == '('){
        continue;
      } else if(c1 == '(' && c2 == ')'){
        continue;
      }
     
      c++; 
    }

    cout << c << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define db double
using namespace std;
const int N=5e5+10;
int n,l=1,r=0;
db maxl,v,sumv,t,ans;
struct node{
	db t,v;
}q[N];
int main(){
	scanf("%d%lf",&n,&maxl);
	while(n--){
		scanf("%lf%lf",&t,&v);
		while(v+sumv>maxl){
			db out=min(v+sumv-maxl,q[l].v);
			ans-=out*q[l].t,sumv-=out,q[l].v-=out;
			if(!q[l].v) l++;
		}
		q[++r]=(node){t,v};
		ans+=t*v,sumv+=v;
		while(l<r && q[r-1].t>q[r].t){
			q[r-1].t=(q[r-1].t*q[r-1].v+q[r].t*q[r].v)/(q[r-1].v+q[r].v);
			q[r-1].v+=q[r].v; r--;	
		}
		printf("%.7lf\n",ans/sumv);
	}
}

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


int main(void) {
  int  m, n;
  char str_n[6];
  char str_m[6];
  
  scanf("%s", str_n);
  scanf("%s", str_m);
  n = atoi(str_n);
  m = atoi(str_m);
  if(n == m) {
    printf("Yes");
  } else {
    printf("No");
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))

int main()
{
	string s, a, b;
	cin >> s;
	a = b = "";
	rep(i, 1, s.size())
	{
		if (i % 2 == 1)
		{
			a += "0";
			b += "1";
		}
		else
		{
			a += "1";
			b += "0";
		}
	}
	int pa, pb;
	pa = pb = 0;
	rep(i, 0, s.size() - 1)
	{
		if (s[i] != a[i])++pa;
		if (s[i] != b[i])++pb;
	}
	cout << min(pa, pb) << endl;
}

Measured memory_bytes: 768
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), ((a) + (n))
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define MODNUM (INT(1e9 + 7))
#define MOD(x) ((x) % MODNUM)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

const int INF = 2e9;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

template <typename T>
int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T>
void chmax(T& m, T x) {
	m = max(m, x);
}

template <typename T>
void chmin(T& m, T x) {
	m = min(m, x);
}

template <typename T>
T square(T x) {
	return x * x;
}

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int h, n;
	scanf("%d %d", &h, &n);
	VI a(n);
	REP(i, n) { scanf("%d", &a[i]); }
	int sum = 0;
	REP(i, n) { sum += a[i]; }
	puts(h - sum > 0 ? "No" : "Yes");
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int digitSum (int i){
	int sum = 0;
	while (i > 0){
		sum += i%10;
		i /= 10;
	}
	return sum;
}


int main(){
	
	int n, a, b;
	int sum = 0;
	scanf ("%d %d %d", &n, &a, &b);
		for (int i = 1; i <= n; i++){
			if (digitSum(i) >= a && digitSum(i) <= b){
				sum += i;
			}
		}
		printf ("%d", sum);
	
	return 0;
}

Measured memory_bytes: 2080
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=1000000000000000003;
const int32_t LOG=21;
const int MOD=MOD1;


int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      {  
           int k,n;
           cin>>k>>n;
           int a[n];
           set<int> s;
           rep(i,0,n){cin>>a[i];s.insert(a[i]);}
           vector<int> v;
           for(auto it:s)
           {
           	 v.push_back(it);
           }
           sort(v.begin(),v.end());
           
           int siz=v.size();
           if(siz==1)
           {
           	 cout<<0<<endl;
           	 continue;
           }
           int ans=INF;	
           rep(i,0,v.size())
           {
               int prev1=(i-1+siz)%siz;
               int nxt1=(i+1)%siz;
               int cur=v[i],prev=v[prev1],nxt=v[nxt1];
               if(prev>cur)
               {
               	  ans=min(ans,prev-cur);
               }
               else
               {
               	  ans=min(ans,k-(cur-prev));
               }

               if(nxt<cur)
               {
               	  ans=min(ans,cur-nxt);
               }
               else
               {
               	  ans=min(ans,k-(nxt-cur));
               }	
           }
           cout<<ans<<endl;           	
      }

      return 0;     
}

/*
 TIPS(FOR ME):
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/


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

#define long long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define F first
#define S second
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define INF 0x3f3f3f3f//infinity for integers
#define JJ ios_base::sync_with_stdio(0); cin.tie(0)//input fast

int main()
{
	JJ;
	int n; cin >> n;
	long sum = 0;
	FOR(i, 1, n + 1){
		if(i % 3 != 0 && i % 5 != 0)
		{
			sum += i;
		}
	}
	cout << sum << endl;



	return 0;
}


Measured memory_bytes: 3616
import java.io.*;

class Main{
    public static void main(String[] args) throws Exception{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        int time = Integer.parseInt(str);

        int h = time / 3600;
        int m = ((time % 3600) / 60);
        int s = time % 60;

        System.out.println(h + ":" + m + ":" + s);
    }
}

Measured memory_bytes: 24276
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<n;i++)
    {
        int p;
        cin>>p;
        a[p]++;
    }
    for(int i=1;i<=n;i++)
    {
        cout<<a[i]<<endl;
    }
}



Measured memory_bytes: 4360
H,W,D=map(int,input().split())

board_dic={}
for i in range(H):
  array=list(map(int,input().split()))
  for j in range(W):
    num=array[j]
    board_dic[num]=(i+1,j+1)
#print(board_dic)  
  
dslist=[]
for i in range(1,D+1):
  dl=[0]
  for j in range(i+D,H*W+1,D):
    x1,y1=board_dic[j-D]
    x2,y2=board_dic[j]
    dist=abs(x2-x1)+abs(y2-y1)
    dl.append(dl[-1]+dist)
  dslist.append(dl)
#print(dslist)    

Q=int(input())
for i in range(Q):
  l,r=map(int,input().split())
  index=(l-1)%D
  print(dslist[index][(r-1)//D]-dslist[index][(l-1)//D])

Measured memory_bytes: 28256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int A, B; cin >> A >> B;
    cout << max(max(A+B, A-B), A*B) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ios std::ios::sync_with_stdio(false)
#define maxn 100005
using namespace std;
signed main()
{
	ios;
	string s;
	cin >> s;
	int lianxu=0;
	int max_lianxu=0;
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == 'S')
		{
			lianxu = 0;
			continue;
		}
		lianxu++;
		if (lianxu > max_lianxu)
		{
			max_lianxu = lianxu;
		}
	}
	cout << max_lianxu;
}

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

int main() {
  
  int N,Y;
  cin >> N >> Y;
  
  int ansi=-1, ansj=-1, ansk=-1;
  
  for(int i=0; i<=N; i++){
    for(int j=0; j<=N-i; j++){
      int k = N-i-j;
      int total = i*10000 + j*5000 + k*1000;
      if(total == Y){
        ansi = i;
        ansj = j;
        ansk = k;
      }
    }
  }
  
  cout << ansi << " " << ansj << " " << ansk << endl;
}


Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n)cin >> v[i];
    int k = 0;
    rep(i, n){
        if(v[i] != i+1) k++;
    }
    if(k <= 2)  cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
def examA():
    S = SI()
    if len(S)%2==1:
        print("No")
        return
    for i in range(len(S)//2):
        if S[i*2:i*2+2]!="hi":
            print("No")
            return
    print("Yes")
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examA()

"""

"""

Measured memory_bytes: 6120