akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#define MARK_MAX 4
#define NUM_MAX 13
#define TF 1
#define GET_MAX 52
using namespace std;

struct mn
{
	char mark;
	int num;
	int tf;
};

int main()
{
	struct mn set[MARK_MAX][NUM_MAX];
	struct mn get[GET_MAX];
	int m, n, i;

	for (m = 0; m < MARK_MAX;m++)
	{
		for (n = 0; n < NUM_MAX; n++){
			if (m == 0)
			{
				set[m][n].mark = 'S';
			}
			else if (m==1)
			{
				set[m][n].mark = 'H';
			}
			else if (m==2)
			{
				set[m][n].mark = 'C';
			}
			else if (m == 3)
			{
				set[m][n].mark = 'D';
			}
			set[m][n].num = n+1;
			set[m][n].tf = 1;
		}
	}

	int count;
	cin >> count;
	for (int i = 0; i <count; i++)
	{
		cin >> get[i].mark >> get[i].num;
	}
	for (m = 0; m < MARK_MAX; m++)
	{
		for  (n = 0; n < NUM_MAX; n++)
		{
			for (i = 0; i < count; i++)
			{
				if (set[m][n].mark == get[i].mark && set[m][n].num == get[i].num)
				{
					set[m][n].tf = 0;
				}
			}
			if (set[m][n].tf == 1)
			{
				cout << set[m][n].mark << ' ' << set[m][n].num << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>

using namespace std;

int main(){

    int S,h,m,s;
    cin >> S;
    h = S/3600;
    m = (S-h*3600)/60;
    s = S-m*60-h*3600;

    cout << h << ":" << m << ":" << s << endl;


    return 0;
}



Measured memory_bytes: 3136
def examA():
    N = I()
    ans = 0
    print(ans)
    return

# maspyさん
def examB():
    H, W, N = LI()
    sr, sc = LI()
    S = SI()
    T = SI()

    sr = H + 1 - sr

    # ここに居たら後手の価値
    L, R = 1, W
    D, U = 1, H
    for s, t in zip(S[::-1], T[::-1]):
        if t == 'L':
            R += 1
        elif t == 'D':
            U += 1
        elif t == 'R':
            L -= 1
        elif t == 'U':
            D -= 1

        if L == 0: L = 1
        if D == 0: D = 1
        if R > W: R = W
        if U > H: U = H

        if s == 'L':
            L += 1
        elif s == 'R':
            R -= 1
        elif s == 'D':
            D += 1
        elif s == 'U':
            U -= 1

        if L > R or D > U:
            # 後手の勝てる場所が存在せず
            break

    bl = (L <= sc <= R) and (D <= sr <= U)
    answer = 'YES' if bl else 'NO'
    print(answer)
    return

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

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

import sys,copy,bisect,itertools,heapq,math
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
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""

Measured memory_bytes: 4424
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import qualified Data.List as L

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = fst . fromJust . BS.readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
  s <- getIntList
  putStrLn $ solve s

solve :: [Int] -> String
solve s = do
  let n = length $ L.nub $ s
      in if n == 1 || n==3 then "No" else "Yes"



Measured memory_bytes: 380
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;

class Program
{
	static void Main(string[] args)
	{
		string s = "abcdefghijklmnopqrstuvwxyz";
		string C = Console.ReadLine();

		Console.WriteLine(s.Substring(s.IndexOf(C) + 1,1));
	}
}

//string s = Console.ReadLine();
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];
//int N = int.Parse(Console.ReadLine());

//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.ReadKey();


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

using ll=long long;
const ll MOD=1000000007;

int main() {
  int a,b,x;
  cin >> a >> b >> x;
  if(a<=x&&x<=a+b)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    for(int i = 0; i < 10000; i++){
        int num;
        cin >> num;
        if(num != 0){
            cout << "Case " << i + 1 << ": " << num << endl;
        }
        else{
            break;
        }
    }
}


Measured memory_bytes: 2988
#include<bits/stdc++.h>
using namespace std;
const int maxn=100000+10;
int a[maxn],b[maxn][2],c;
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++) scanf("%d",a+i);
    sort(a,a+n);
    if(a[0]>=0)
    {
        for(int i=0;i<n-2;i++)
        {
            b[i][0]=a[i];b[i][1]=a[i+1];
            a[i+1]=a[i]-a[i+1];
        }
        b[n-2][0]=a[n-1];b[n-2][1]=a[n-2];
        a[n-1]=a[n-1]-a[n-2];
    }
    else if(a[n-1]<=0)
    {
        for(int i=0;i<n-1;i++)
        {
            b[i][0]=a[n-1];b[i][1]=a[i];
            a[n-1]-=a[i];
        }
    }
    else
    {
        for(int i=0;i<n-2;i++)
        {
            if(a[i]<0&&a[i+1]<0)
            {
                b[i][0]=a[n-1];b[i][1]=a[i];
                a[n-1]-=a[i];
            }
            else
            {
                b[i][0]=a[i];b[i][1]=a[i+1];
                a[i+1]=a[i]-a[i+1];
            }
        }
        b[n-2][0]=a[n-1];b[n-2][1]=a[n-2];
        a[n-1]=a[n-1]-a[n-2];
    }
    cout<<a[n-1]<<endl;
    for(int i=0;i<n-1;i++) printf("%d %d\n",b[i][0],b[i][1]);
    return 0;
}

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

using namespace std;

int t[1000006];

int main() {
  int n, k, q;
  cin >> n >> k >> q;
  for (int i = 0; i < q; ++i) {
    int a;
    cin >> a;
    t[a]++;
  }

  for (int i = 1; i <= n; ++i) {
    if (q - t[i] >= k) {
      cout << "No";
    } else {
      cout << "Yes";
    }
    cout << endl;
  }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
#define INF (ll)1e19
#define N 2000006

using namespace std;

int a, b, c;

int main() {
    //freopen("txt.in", "r", stdin);
    //freopen("txt.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> a >> b >> c;
    if (a != b && a != c) cout << a << endl;
    else if (b != a && b != c) cout << b << endl;
    else cout << c << endl;

	return 0;
}


Measured memory_bytes: 256
/*
* Problem link
* 
*/

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> V;
typedef vector<V> VV;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
template<typename T>
inline bool chmax(T &a, T b) {
	bool res = a < b;
	if (res)a = b;
	return res;
}
typedef pair<int, int> P;
typedef vector<P> VP;
#define fi first
#define se second
#define ALL(v) (v).begin(),(v).end()
string f[4][10] = {
	{"","i","2i","3i","4i","5i" ,"6i","7i" ,"8i","9i" },
	{ "","x","2x","3x","4x","5x" ,"6x","7x" ,"8x","9x" },
	{ "","c","2c","3c","4c","5c" ,"6c","7c" ,"8c","9c" },
	{ "","m","2m","3m","4m","5m" ,"6m","7m" ,"8m","9m" },
};
void calc(string s, char c, int d, int &a) {
	int id = s.find(c);
	if (id == string::npos);
	else {
		if (id == 0 || !isdigit(s[id - 1]))a += d;
		else a += (s[id - 1] - '0') * d;
	}
}
int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	int T;
	cin >> T;
	while (T--) {
		string s, t;
		cin >> s >> t;
		int a = 0, b = 0;
		calc(s, 'm', 1000, a);
		calc(s, 'c', 100, a);		
		calc(s, 'x', 10, a);		
		calc(s, 'i', 1, a);
		calc(t, 'm', 1000, b);
		calc(t, 'c', 100, b);
		calc(t, 'x', 10, b);
		calc(t, 'i', 1, b);
		int c = a + b;
		string res;
		REP(i,4) {
			res = f[i][c % 10] + res;
			c /= 10;
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 3068
//Totka hai dosto
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
const int N=1e5+3;
vector<vector<int>> adj;
vector<bool> vis;
vector<int> ans;
int n,m;
int32_t main()
{
	cin>>n>>m;
	adj=vector<vector<int>>(n+1);
	vis=vector<bool>(n+1);
	ans=vector<int>(n+1,-1);
	int u,v;
	for(int i=0;i<m;i++)
	{
		cin>>u>>v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	queue<int> q;
	q.push(1);vis[1]=1;
	while(!q.empty())
	{
		u=q.front();
		q.pop();
		for(auto v:adj[u])
		{
			if(!vis[v])
			{
				ans[v]=u;
				vis[v]=1;
				q.push(v);
			}
		}
	}
	bool ok=1;
	for(int i=2;i<=n;i++)
	{
		if(ans[i]==-1)ok=0;
	}
	if(!ok){puts("No");return 0;}
	puts("Yes");
	for(int i=2;i<=n;i++)
	cout<<ans[i]<<"\n";
	
}

Measured memory_bytes: 13024
A,B,C,D = gets.chomp.split.map(&:to_i)  # スペースで区切られた複数の整数

A.freeze
B.freeze
C.freeze
D.freeze

wk1 = A	#高橋君
wk2 = C #青木君

loop do
  wk2 = wk2 - B
  if wk1 <= 0 || wk2 <= 0 then
    break
  end
  wk1 = wk1 - D
  if wk1 <= 0 || wk2 <= 0 then
    break
  end
end
    
if wk1 > 0 then
  puts("Yes")
else
  puts("No")
end

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

int main(){
  int A , B , C , D;
  cin >> A >> B >> C >> D;
  
  if (A + B > C + D)
    cout << "Left" << endl;
  else if (A + B == C + D)
    cout << "Balanced" << endl;
  else {
    cout << "Right" << endl;
  }
}

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

typedef long long ll;

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

	ll N, K;
	cin >> N >> K;

	ll min = N;

	if(N > K) {
		min = N % K;
		if(K - min < min) min = K - min;
	} else {
		if(K - N < min) min = K - N;
	}

	cout << min << endl;
}

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

ll gcd(ll a, ll b) {
    // cout << "---gcd start---" << endl;
    // cout << a << endl;
    // cout << b << endl;
    // cout << "---gcd end---" << endl;
    return b ? gcd(b, a % b) : a;
}

int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int K;
    cin >> K;
    ll ans = 0;
    for (int i = 1; i <= K; i++){
        for (int j = 1; j <= K; j++){
            for (int m = 1; m <= K; m++){
                ans += gcd(i,gcd(j, m));
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int ans = 1;
  cin >> n >> k;
  while (n--) {
    if (ans * 2 <= ans + k) ans *= 2;
    else {
      ans += k;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

const ll MOD = 1e9+7;
const int sz = 1e5+5;
const int R = 0;

vector<int> adj[sz];
vector<ll> cnt1(sz, 0), cnt2(sz, -1), col(sz, -1);
ll k = 0;

void dfs(int v, int p){
    col[v] = k-p;
    if( v == R )
        cnt1[v] = 1;
    else
        cnt1[v] = 2;
    for(int u : adj[v])
        if( col[u] == -1 )
            dfs(u, cnt1[v]), cnt1[v]++;
}

int main(){

    ll n;
    cin >> n >> k;
    int a, b;
    for(int i = 0; i < n-1; i++){
        cin >> a >> b;
        a--, b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    dfs(0, 0);
    ll res = 1;
    for(int i = 0; i < n; i++){
        res = (res*col[i])%MOD;
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
int cnt(int h[],int n){
    vector<int>dp(n+1,0);
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++){
        dp[i]+=min(dp[i-1]+(abs(h[i]-h[i-1])),dp[i-2]+abs(h[i]-h[i-2]));
    }
    return dp[n-1];
    }
int main(){
    int n;
    cin>>n;
    int h[n];
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    cout<<cnt(h,n)<<endl;
    return 0;
}


Measured memory_bytes: 1024
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
roundnum=0
alice=0
bob=0
def game():
    global roundnum
    global alice
    global bob
    if roundnum%2==0:
        alice+=a.pop()
    else:
        bob+=a.pop()
    roundnum+=1
        
while a:
    game()
    
print(alice-bob)

Measured memory_bytes: 3060
#include<stdio.h> 
#include<string.h>  
int main()  
{  
    char a[27];
    scanf("%s",a);
    int i,j;
    int k=1;
    for(i=0;i<strlen(a);i++)
     for(j=i+1;j<strlen(a);j++)
     {
     	if(a[i]==a[j])
     	 {
     		k=0;
		 }
	 }
	 if(k==1) printf("yes\n");
	 else printf("no\n");
    
}  

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, x;
  cin >> n >> x;

  int minv = INF;
  int sum = 0;
  rep(i, n) {
    int m;
    cin >> m;
    chmin(minv, m);
    sum += m;
  }

  cout << n + (x - sum) / minv << "\n";

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define riterator reverse_iterator
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int N = 100;
char a[N+3][N+3];
int f[N+3][N+3];
int n,m;

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1; i<=n; i++) scanf("%s",a[i]+1);
	for(int i=1; i<=n; i++)
	{
		for(int j=1; j<=m; j++)
		{
			if(i==1&&j==1) {f[i][j] = (a[i][j]=='#'); continue;}
			f[i][j] = 1000000;
			if(i>1) {f[i][j] = min(f[i][j],f[i-1][j]+(a[i-1][j]!='#'&&a[i][j]=='#'));}
			if(j>1) {f[i][j] = min(f[i][j],f[i][j-1]+(a[i][j-1]!='#'&&a[i][j]=='#'));}
		}
	}
	printf("%d\n",f[n][m]);
	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli a, b, t,ans=0;
    cin>>a>>b>>t;
    for(lli i=1;i<=t;i++){ 
        if(i%a==0){ 
            ans+=b;
        }
    }
    out(ans);
}

Measured memory_bytes: 3616
#include<stdio.h>
#define S 100000
#define T 100000
int main(){
  int i,j,n,q,count=0;
  int s[S];
  int t[T];
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&s[i]);
  }
  scanf("%d",&q);
  for(i = 0; i < q; i++){
    scanf("%d",&t[i]);
  }
  for(j = 0; j < q; j++){
    for(i = 0; i < n; i++){
      if(t[j] == s[i]){
	count++;  
	break; 
      }
    }
  }
  if(count == 0){
    printf("0\n");
  }
  else printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 648
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	char s[101][101];
	int n,h[101],i,j,k,flg,flg2;
	cin>>n;
	for(i=0;i<n;i++) {
		cin>>s[i];
		h[i]=strlen(s[i]);
	}
	flg=0;
	for(i=1;i<n;i++){
		if(s[i][0]!=s[i-1][h[i-1]-1]) flg=1;
		for(j=0;j<n;j++){
			if(h[i]==h[j]&&i!=j){
				flg2=1;
				for(k=0;k<h[j];k++){
					if(s[i][k]!=s[j][k]) flg2=0;
				}
				if(flg2==1) flg=1;
			}
		}
		//printf("%c %c\n",s[i][0],s[i-1][h[i-1]-1]);
		//cout<<i<<endl;
		if(flg==1) break;
	}
	if(flg==0) cout<<"Yes"<<endl;
	if(flg==1) cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    vector<ll> l(n,0), r(n,0);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i==j){continue;}
            if(a[i]<a[j]){
                if(i<j){r[i]++;}
                else{l[i]++;}
            }
        }
    }

    ll ans = 0;
    for(int i = 0; i < n; i++){
        ll tmp = k*(k+1)/2;
        tmp %= MOD;
        tmp *= (l[i]+r[i]);
        tmp %= MOD;
        tmp += 10000*MOD;
        tmp -= (r[i])*k;
        ans += tmp;
        ans %= MOD;
    }
    cout << ans%MOD << endl;
    return 0;
}


Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

vi A(3);

signed main(){

    in(A);
    sort(rall(A));
    Yn(A[0]==A[1]+A[2]);

    return 0;
}


Measured memory_bytes: 256
A, B, C, X, Y = gets.chomp.split.map(&:to_i)

if X >= Y
	if A/2 >= C
		puts C*X*2
	elsif (A+B)/2 >= C
		puts C*Y*2+(X-Y)*A
	else
		puts A*X+B*Y
	end
else #X<Y
	if B/2 >= C
		puts C*Y*2
	elsif (A+B)/2 >= C
		puts C*X*2+(Y-X)*B
	else
		puts A*X+B*Y
	end
end

Measured memory_bytes: 1788
from collections import deque
 
process_num, qms = map(int ,input().split())
que = deque({})
 
for i in range(process_num):
    name, time = input().split()
    time = int(time)
    que.append({"name":name, "time":time})
 
if __name__ == '__main__':
    total_time = 0
    while len(que)>0:
        atop = que.popleft()
        spend = min(atop["time"], qms)
        atop["time"] -= spend
        total_time += spend
        if(atop["time"] == 0):
            print("{} {}".format(atop["name"], total_time))
        else:
            que.append(atop)



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

#define ff              first
#define fo(i,n)         for(i=0;i<n;i++)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


const int N = 3e5, M = N;
//=======================


void solve() {
  int i, j, n, m;
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int ans1=b*d;
  int ans2=a*c;
  int ans3=b*c;
  int ans4=a*d;
  cout<<max({ans1,ans2,ans3,ans4});
}

int32_t main()
{
  FIO;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  
  solve();
  return 0;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;
typedef tuple<long long, long long, long long> tllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
bool compTuple(const tllint& arg1, const tllint& arg2) { return get<2>(arg1) > get<2>(arg2); }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void) {
    int d, t, s;
    cin >> d >> t >> s;

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


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
v(ll) d;

v(ll)* bellmanford(vector<pair<ll,P>> &ES,int V,int E,int s) {
  // ES[i] = P(c,P(f,t)) means that from `f` to `t` 's cost is `c`
    d = v(ll)(V,LINF);
    d[s] = 0;
    int cnt = 0;
    while(cnt < V+1) {
        bool update = false;
        rep(i,E) {
            pair<ll,P> e = ES[i];
            if(d[e.second.first] != LINF && d[e.second.second] > d[e.second.first] + e.first) {
                d[e.second.second] = d[e.second.first] + e.first;
                update = true;
                if(cnt >= V && e.second.second == V-1) {
                    return NULL;
                }
            }
        }
        if(!update) break;
        cnt++;
    }
    return &d;
}

int main() {
  int N,M;
  cin >> N >> M;
  vector<pair<ll,P>> ES(M);
  rep(i,M) {
    int a,b;
    ll c;
    cin >> a >> b >> c;
    a--;
    b--;
    ES[i] = pair<ll,P>(-c,P(a,b));
  }
  v(ll)* dis = bellmanford(ES,N,M,0);
  if(dis == NULL) {
    cout << "inf" << endl;
  } else {
    cout << -1ll * (*dis)[N-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a,b;string s;cin >> a >> b;
	cin >> s;bool correct = s[a] == '-';
	for (int i=0; i<a; i++) {
		if (s[i] < '0' || s[i] > '9')
			correct = false;
	}
	for (int i=0; i<b; i++) {
		if (s[i+a+1] < '0' || s[i+a+1] > '9')
			correct = false;
	}
	if (correct) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

int main() {
	int w, h, n;
	cin >> w >> h >> n;
	int wmax = w, hmax = h;
	int wmin = 0, hmin = 0;
	int x,y,a;
	for (int i = 0; i < n; i++) {
		cin >> x >> y >> a;
		if (a == 1) {
			wmin = max(x, wmin);
		}
		else if (a == 2) {
			wmax = min(x, wmax);
		}
		else if (a == 3) {
			hmin = max(hmin, y);
		}
		else if (a == 4) {
			hmax = min(hmax, y);
		}
	}
	if (wmax - wmin < 0 || hmax - hmin < 0) {
		cout << 0 << endl;
	}
	else {
		cout << (wmax - wmin)*(hmax - hmin) << endl;
	}
	return 0;
}

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

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

using namespace std;

int n, m;
char x[100000 + 1];
int a[10];
int k;
int p[7];
int dp[8][10];

int convert(int f, int i){
	if((n - i) % 2 == 1){
		return f;
	}
	int g = f * 2;
	return (g / 10) + (g % 10);
}

int main(){
	scanf("%d%s%d", &n, x, &m);
	rep(i, m){
		scanf("%d", a + i);
	}
	int t = 0;
	rep(i, n){
		if(x[i] == '*'){
			p[k++] = i;
		}
		else{
			t += convert(x[i] - '0', i);
		}
	}
	dp[0][t % 10] = 1;
	for(int i = 1; i <= k; ++i){
		rep(j, m){
			int q = convert(a[j], p[i - 1]);
			rep(l ,10){
				dp[i][(l + q) % 10] += dp[i - 1][l];
			}
		}
	}
	/*for(int i = 0; i <= k; ++i){
		printf("i = %d\n", i);
		rep(j, 10){
			printf("%d ", dp[i][j]);
		}
		printf("\n");
	}*/
	printf("%d\n", dp[k][0]);
	return 0;
}

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

#define x first
#define y second

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

ostream& operator<<(ostream &out, const pii &a) { return out << '(' << a.x << ", " << a.y << ')'; }
istream& operator>>(istream &in, pii &a) { return in >> a.x >> a.y; }

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

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

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

	ll A, B;
	cin >> A >> B;
	cout << max(0LL, A - B) << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main{
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}

	static int[][]f;
	static final int[]dx={-1,0,1,0},dy={0,-1,0,1};
	public static void main(String[]$){
		int h=getInt(),w=getInt();
		f=new int[h][w];
		int i=h*w-1,n=getInt();
		for(int k=1;k<=n;++k) {
			for(int c=getInt();c>0;--c,--i) {
				f[i/w][i/w%2==0?i%w:w-1-i%w]=k;
			}
		}
		Arrays.stream(f).map(o->Arrays.stream(o).mapToObj(String::valueOf).collect(Collectors.joining(" ")))
				.forEach(System.out::println);
	}
}

Measured memory_bytes: 32348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;


int main(){
    ll X; cin >> X;
    cout << (X+1)%2 << endl;
  
}



Measured memory_bytes: 3600
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    DP = [[-10 ** 20, -10 ** 20] for _ in range(N)] #[-1が偶数, -1が奇数]
    DP[0] = [A[0], -1 * A[0]]
    for i in range(1, N):
        DP[i][0] = max(DP[i-1][0] + A[i], DP[i-1][1] - A[i])
        DP[i][1] = max(DP[i-1][0] - A[i], DP[i-1][1] + A[i])
    print(DP[N-1][0])
    #print(DP)


    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 31012
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
int n;
map<string,int>M;
map<string,vector<string> >A;
map<string,bool>u;
int f(string s)
{
    if(u[s])return M[s];
    int now=M[s];
    if(A[s].size()>0)
    {
        int a=0;
        for(int i=0;i<A[s].size();i++)a+=f(A[s][i]);
        now=min(now,a);
    }
    u[s]=1;
    return M[s]=now;
}
main()
{
	while(cin>>n,n)
	{
		M.clear();
		A.clear();
		u.clear();
		for(int i=0;i<n;i++)
		{
			string s;int a;cin>>s>>a;M[s]=a;
		}
		int m;cin>>m;
		for(int i=0;i<m;i++)
		{
			string s;cin>>s;
			int k;cin>>k;
			for(;k--;)
			{
				string t;cin>>t;
				A[s].push_back(t);
			}
		}
		string s;cin>>s;
		cout<<f(s)<<endl;
	}
}



Measured memory_bytes: 3036
# -*- coding: utf-8 -*-


def main():
    n, m = map(int, input().split())
    votes = list(map(int, input().split()))

    sum_vote = sum(votes)
    filter_list = list(filter(lambda x : x >= sum_vote / (4 * m), votes))

    if len(filter_list) >= m:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
// Problem : A - Lucky 7
// Contest : AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n; i >= a; i--)
#define pb              push_back
#define lb              lower_bound		// first element >= val(itr) 
#define ub              upper_bound		// first element >  val(itr)
#define vll							vector<ll>
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))	//x can be 0 or -1

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

#ifdef LOCAL_TEST
#include"/home/shrey/debug.h"
#endif

const ll inf = 1e18;
const int nax = 1e5 + 5;

void SolveTestCase()
{
	string s;
	cin>>s;
	
	if(s[0] == '7' || s[1] == '7' || s[2] == '7')
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
}

int main()
{
	speedup_IO;

	int t = 1;
	//cin >> t;
	forn(i, 0, t)
	{
		SolveTestCase();
	}

	return 0;
}


Measured memory_bytes: 3644
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    def is_prime(x):
        for i in range(2,int(x**0.5)+1):
            if x%i==0:
                return False
        return True
    N=int(input())
    ans=[]
    tmp=1
    while len(ans)<N:
        tmp+=10
        if is_prime(tmp):
            ans.append(tmp)
    print(*ans)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;


#define REP(i, n) for(ll i = 0; i < n; i++)
























int main(){
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    REP(i, n){
        cin >> a[i];
    }
    REP(i, m){
        cin >> b[i];
    }
    ll ans = 0, sum = 0;
    REP(i, n){
        sum += a[i];
        if(sum > k){
            sum -= a[i];
            break;
        }
        ans = i + 1;
    }
    ll idx = ans - 1;
    REP(i, m){
        sum += b[i];
        while(idx >= 0 && sum > k){
            sum -= a[idx];
            idx--;
        }
        if(sum <= k) ans = max(ans, idx + 1 + i + 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 6424
while True:
    l = map(int,raw_input().split())
    if l == [0,0]:
        break
    else:
        n = l[0]
        card = range(n)
        for i in range(l[1]):
            l = map(int,raw_input().split())
            p = l[0]
            c = l[1]
            card = card[p-1: p+c-1] + card[:p-1] + card[p+c-1:]
        print n - card[0]

Measured memory_bytes: 6268
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define long long long // for codeforces

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

  int ans = 32;
  rep(i,n){
    int d;
    cin>>d;
    int t = 0;
    while(d%2==0){d/=2; t++;}
    ans = min(ans, t);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt(), k = scanner.nextInt();
		int count = 0;
		for(int i=0;i<n;i++){
			int a = scanner.nextInt();
			count += Math.min(a - 0 , k - a) * 2;
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 21204
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <functional>
#include <numeric>


using namespace std;
typedef long long LL;

// import here

int main(){
    LL n;
    cin >> n;
    vector<LL> a(n), b(n);
    for(LL i = 0; i < n; ++i){
        cin >> a[i];
    }
    for(LL i = 0; i < n; ++i){
        cin >> b[i];
    }
    LL total_a = accumulate(a.begin(), a.end(), 0LL);
    LL total_b = accumulate(b.begin(), b.end(), 0LL);
    LL need = 0;
    for(LL i = 0; i < n; ++i){
        if(a[i] > b[i]){
            need += a[i] - b[i];
        }else if((b[i] - a[i]) % 2 == 1){
            need++;
        }
    }
    if(total_b >= total_a + need){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
inVal = int(input())
outLen = ""
for i in range(1, inVal + 1):
    if i % 3 == 0:
        outLen = outLen + " " + str(i)
    else:
        x = i
        while (x):
            if x % 10 == 3:
                outLen = outLen + " " + str(i)
                break
            x = x // 10
print(outLen)


Measured memory_bytes: 5628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int i,j,n,p,q,temp;
    int a,b,t;
    int time=0;
    int flag=0;
    string s;
cin>>n;
int v[n];
int c[n];
for(i=0; i<n; i++){
    cin>>v[i];
}
for(i=0; i<n; i++){
    cin>>c[i];
}
for(i=0; i<n; i++){
    if(v[i]>c[i]){flag=flag+v[i];time=time+c[i];}
}
cout<<flag-time;

    return 0;
}

Measured memory_bytes: 256
s = input()
x = 0
y = 0
cnt = 0
for c in s:
    if c == '0':
        if y > 0:
            y -= 1
            cnt += 2
        else:
            x += 1
    else:
        if x >0:
            x -= 1
            cnt += 2
        else:
            y += 1
print(cnt)
    
    


Measured memory_bytes: 39792
#include<bits/stdc++.h>
#define maxn 205050

using namespace std;
typedef long long ll;
const ll M=1000000007;
ll a[maxn],c[maxn],b[maxn],dp[maxn];
int n,m;

int main(){
    cin >> n;
    for (int i=1;i<=n;i++){
        cin >> a[i];
        if (a[i]!=a[i-1]) b[++m]=a[i];
    }
    dp[0]=1; c[b[1]]=1;
    for (int i=1;i<=m;i++){
        dp[i]=c[b[i]];
        (c[b[i+1]]+=dp[i])%=M;
    }
    cout << dp[m] << endl;
    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);(i)++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;(i)>=(int)(m);(i)--)
#define REP(i,n) rep(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = 998244353;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


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;
}

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


ll dfs(Graph& g, ll v,Array& c) {
	bool flag = true;
	for (auto e : g[v]) {
		if (c[e.to] == -1) {
			c[e.to] = !c[v];
			if (!dfs(g, e.to, c)) flag = false;
		}
		else {
			if (c[e.to] == c[v]) flag = false;
		}
	}
	return flag;
}

void solve() {
	string s;
	cin >> s;
	ll n = s.size();
	bool flag = true;
	if (n % 2 == 1) flag = false;
	for (int i = 0; i < n; i += 2) {
		if (s.substr(0, 2) != "hi")flag = false;
	}
	cout << (flag ? "Yes" : "No") << en;
}

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

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict, deque

def bfs(s):
    queue = deque([s])
    cv = [0] * n
    cv[s] = 1
    while queue:
        u = queue.popleft()
        for nxt, w in adj[u]:
            if not cv[nxt]:
                if w % 2 == 1:
                    color[nxt] = color[u] ^ 1
                else:
                    color[nxt] = color[u]
                queue.append(nxt)
                cv[nxt] = 1

n = int(input())
adj = defaultdict(list)
for _ in range(n - 1):
    u, v, w = [int(item) for item in input().split()]
    u -= 1
    v -= 1
    adj[u] += [(v, w)]
    adj[v] += [(u, w)]

color = [0] * n
bfs(0)

for x in color:
    print(x)


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

int N, A, B, C;
vector<int> L;
int ans = 1e9;

void dfs(vector<int> V) {
  if (V.size() == N) {
    int a = 0, b = 0, c = 0, d = 0;
    for (int i = 0; i < N; i++) {
      if (V.at(i) == 0) a += L.at(i);
      if (V.at(i) == 1) b += L.at(i);
      if (V.at(i) == 2) c += L.at(i);
      if (V.at(i) == 3) d++;
    }
    if (!a || !b || !c) return;
    int mp = ((N - d - 3) * 10 + abs(A - a) + abs(B - b) + abs(C - c));
    ans = min(ans, mp);
    return;
  }
  for (int i = 0; i <= 3; i++) {
    V.push_back(i);
    dfs(V);
    V.pop_back();
  }
}

int main() {
  cin >> N >> A >> B >> C;
  L.resize(N);
  for (int i = 0; i < N; i++) cin >> L.at(i);
  vector<int> start;
  dfs(start);
  cout << ans << "\n";
}

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

int main(){
  string A,B,C;
  cin >>A>>B>>C;
  int a=A.length();
  int b=B.length();
  int c=C.length();

  if(A[a-1]==B[0] &&B[b-1]==C[0]) cout <<"YES";
  else cout <<"NO";
}


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

a,b=mp()
if a>=13:
    print(b)
elif a>=6:
    print(b//2)
else:
    print(0)

Measured memory_bytes: 5068
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a-b>=2)
	{
		printf("%d",a*2-1);
		return 0;
	}
	if(b-a>=2)
	{
		printf("%d",b*2-1);
		return 0;
	}
	else 
	{
		printf("%d",a+b);
	return 0;
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////

const ll inf = 1LL<<60;
const ll mod = 1000000007;

ll gcd(ll a, ll b){return b==0 ? a : gcd(b, a%b);}
ll lcm(ll a, ll b){return a / gcd(a,b) * b;}

int main()
{
  ll a,b; cin>>a>>b;

  cout << lcm(a, b) << endl;

  return 0;
}


Measured memory_bytes: 3584
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<vs> vvs;

typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpl;
typedef vector<tuple<int, int, int>> vti;


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    
    int j = 0;
    if (w % 2 == 0 && h % 2 == 0){
        if (x == w / 2 && y ==  h / 2){
            j = 1;
        }
    }
    cout << ((double)w / 2 * h ) << " " << j << endl;
}


Measured memory_bytes: 256
x = list(map(int, input().split()))

#for i in range(len(x)): #rangeを使わないとiが番号として機能しない
for i, v in enumerate(x): # xの添字と値を順番に入れていく vが配列の値 iが添字
    if v == 0:
        print(i+1)

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

struct doll{
    int h, r;
    doll(int height, int radius) : h(height), r(radius) {}
    bool  operator<(const doll other) const{
        if(h != other.h)    return h < other.h;
        else                return r < other.r;
    }
};

int main(){
    while(1){
        int n, m, h, r;
        cin >> n;

        if(n == 0)  break;

        vector<doll> dolls;

        for(int i = 0; i < n; i++){
            cin >> h >> r;
            dolls.push_back(doll(h,r));
        }

        cin >> m;

        for(int i = 0; i < m; i++){
            cin >> h >> r;
            dolls.push_back(doll(h,r));
        }
    
        sort(dolls.begin(), dolls.end());

        n += m;
        
        int len[n];
        for(int i = 0; i < n; i++)  len[i] = 1;

        for(int i = 0; i < n; i++){
            for(int j = 0; j < i; j++){
                if(dolls[j].h < dolls[i].h && dolls[j].r < dolls[i].r && len[j] + 1 > len[i]){
                    len[i] = len[j] + 1;
                }
            }
        }

        int ans = 0;
        for(int i = 0; i < n; i++)  ans = max(ans, len[i]);
        cout << ans << endl;
    }

    return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

void func(long long N){

    lli small = 0,large = 1e9;

    while(small+1<large){
        lli middle = (small+large)/2;
        lli left = N - middle;

        lli usable = middle-1;
        lli sum = (usable+1)*usable/2;
        if(sum >= left){
            large = middle;
        }
        else{
            small = middle;
        }
    }
    
    vector<lli> v;
    v.push_back(large);
    lli left = N-large;
    for(lli i=large-1;i>0;i--){
        if(left >= i){
            v.push_back(i);
            left -= i;
        }
    }
    SORT(v);
    REP(i,0,v.size())cout<<v[i]<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    func(N);
    return 0;
}


Measured memory_bytes: 3716
using System;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            // 団体の数
            int N = int.Parse(Console.ReadLine());
            // 団体の数分、団体がどの席からどの席に座っているか続く
            // その合計人数を数える
            int result = 0;     // 合計人数
            for (int i = 0; i < N; ++i)
            {
                string[] s = Console.ReadLine().Split(' ');
                int start = int.Parse(s[0]);
                int end = int.Parse(s[1]);
                result += (end - start + 1);
            }
            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 11092