akhauriyash/Code-Regression huggingface dataset:
package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  var line, buffer []byte
  var isPrefix bool = true
  var err error
  for isPrefix {
    line, isPrefix, err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
  }
  return string(buffer)
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

func main() {
  NM := NextIntVec()
  N := NM[0]
  M := NM[1]
  A := make([]string, N)
  B := make([]string, M)
  for i := range A {
    A[i] = NextLine()
  }
  for i := range B {
    B[i] = NextLine()
  }
  match := false
  for x := 0; x < N + 1 - M; x++ {
    if match { break }
    for y := 0; y < N + 1 - M; y++ {
      if match { break }
      test := true
      for i := 0; i < M; i++ {
        if !test { break }
        for j := 0; j < M; j++ {
          if A[x + i][y + j] != B[i][j] {
            test = false
          }
        }
      }
      match = test || match
    }
  }
  if match {
    Write("Yes")
  } else {
    Write("No")
  }
  Output()
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007



int main() {
	int X, Y, Z; cin >> X >> Y >> Z;

	int score = 0;

	X -= Z;

	while (X >= Y+Z) {
		X -= Y;
		score++;
		X -= Z;

	}
	print(score);



	



	return 0;
}

Measured memory_bytes: 256
/**
 *    author:  math2do
 *    created: 07.04.2020 14:04:21
**/

#include <bits/stdc++.h>

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "1" : "0");
}
string to_string(const char &ch) {
  return string(1, ch);
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  reverse(res.begin(), res.end());
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// returns all factors
template <typename T>
vector <T> factorize(T val) {
  vector <T> fac;
  for (T n = 1; n * n <= val; n++) {
    if (val % n == 0) {
      if (val / n == n) {
        fac.emplace_back(n);
      } else {
        fac.emplace_back(n);
        fac.emplace_back(val / n);
      }
    } 
  }
  return fac;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  if (n == 2) {
    cout << 1 << endl;
    return 0;
  } 
  vector <long long> a = factorize(n - 1);
  int ans = (int) a.size() - 1;
  vector <long long> b = factorize(n);
  sort(a.begin(), a.end());
  for (long long v : b) {
    if (v == 1) continue;
    if (!binary_search(a.begin(), a.end(), v)) {
      long long num = n;
      while (num % v == 0) {
        num = num / v;
      }
      ans += (num % v == 1); 
    } 
  } 

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


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

#pragma region Macros
using ll = long long;
#define int ll
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
#define IOS\
    ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SORT(name) sort(name.begin(), name.end())
#define RSORT(name)\
    SORT(name);\
    reverse(all(name));
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
template <class T> inline void print(T x){ cout << x << '\n';}
template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#pragma endregion

const int MAX_N = 110;

signed main() {
    IOS;

    int X, N;
    V<> P;
    V<bool> isExist(MAX_N, false);
    cin >> X >> N;
    P.resize(N);
    REP(i, N) {
        cin >> P[i];
        isExist[P[i]] = true;
    }

    if(!isExist[X]) {
        print(X);
        return 0;
    }

    pii ans = mp(LLINF, LLINF);
    for(int i = -3; i <= 103; ++i) {
        if(i <= 0 || !isExist[i]) {
            int dist = abs(X - i);
            if(dist < ans.second) {
                ans = mp(i, dist);
            }
        }
    }
    print(ans.first);

    return 0;
}


Measured memory_bytes: 3644
using System;
    using System.Linq;
    using System.Collections.Generic;

    public class Program
    {
        public static void Main(string[] args)
        {
            List<int> input = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

            Console.WriteLine(input[0] % input[1] == 0 ? "0":" 1");
        }
    }

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef int ut;
typedef complex<int> cli;
typedef vector<ut> VI;
typedef pair<double,int> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr> PQ;
const int SIZE=5+1e5;
const LL INF=1LL<<60;

LL N,K;
LL A[SIZE];
int main(){
	cin >> N >> K;
	LL ans=0;
	REP(i,N){
		cin >> A[i];
		ans+=max(0LL,A[i]);
	}
	LL minium=INF;
	LL sum=0;
	REP(i,N){
		if(A[i]>=0) sum+=A[i];
		if(i>=K)
			if(A[i-K]>=0) sum-=A[i-K];
		if(i+1>=K){
			minium=min(minium,sum);
		}
	}
	sum=0;
	REP(i,N){
		if(A[i]<=0) sum-=A[i];
		if(i>=K)
			if(A[i-K]<=0) sum+=A[i-K];
		if(i+1>=K){
			minium=min(minium,sum);
		}
	}
	cout << ans-minium << endl;
	return 0;
}

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

int main(){
    queue<pair<string,int> >v;
    int N,Q,T;
    string s;
    for(cin >> N >> Q; N--;) cin >> s >> T, v.push(make_pair(s,T));
    for(T = 0; !v.empty();){
        pair<string,int> p = v.front(); v.pop();
        if(p.second > Q) T += Q, p.second -= Q, v.push(p);
        else T += p.second, cout << p.first << ' ' << T << endl;
    }
}

Measured memory_bytes: 6188
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  double seek=0;
  
  cin >> n >> k;
  
  for(int i=1;i<=n;i++){
    int a=i;
    double asknum=1.0/n;
    while(a<k){
      a*=2;
      asknum /=2;
    }
    seek += asknum;
  }
  printf("%.12f\n",seek);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define ll long long 
#define mod 1000000007
void fast(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
}

int main() {
   fast();
   
   int n;
   cin>>n;
   int cnt[n+1]={0};
   long long ans=1;
   for(int i=2;i<=n;i++){
    int k=i;
     for(int j=2;j<=sqrt(i);j++){
      while(k%j==0){
        cnt[j]++;
        k=k/j;
      }
     }
     if(k>1){
      cnt[k]++;
     }
   }
   //cout<<ans<<"\n";
   for(int i=2;i<=n;i++){
       
      ans*=(cnt[i]+1);
      ans%=mod;
   }
   cout<<ans<<"\n";




}

Measured memory_bytes: 3660
import sys
from collections import defaultdict


def main():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    
    A = defaultdict(int)
    for i in map(int, input().split()):
        A[i] += 1
        
    for i in range(M):
        B, C = map(int, input().split())
        A[C] += B
        
    ret = 0
    count = 0
    for value, num_value in sorted(A.items(), key=lambda x:x[0])[::-1]:
        num_value = min(num_value, N - count)
        ret += value * num_value
        count += num_value
        if num_value == N:
            break
    
    print(ret)


if __name__ == "__main__":
    main()

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

#define INF (1 << 20)
#define MAX_SIZE 200010

int main() {
  int N, K;
  cin >> N >> K;

  int A[MAX_SIZE];
  for (int i = 0; i < MAX_SIZE; ++i) {
    A[i] = INF;
  }

  int size = 0;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    if (A[a] == INF) {
      A[a] = 0;
      ++size;
    }
    ++A[a];
  }

  sort(A, A+MAX_SIZE);

  int ans = 0;
  for (int i = 0; i < size - K; ++i) {
    ans += A[i];
  }

  cout << ans << endl;

  return 0;
}


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

#define INF (0x7FFFFFFF)
#define PI (3.1415926535898)
int ypos_cnt[2000001];


int get_change_cnt(int y, int max_cnt)
{
	int min_pos = 0;
	int max_pos = max_cnt+1;
	int mid_pos = (min_pos+max_pos+1)/2;
	
	for(;;) {
		if (y < ypos_cnt[mid_pos]) {
			max_pos = mid_pos;
		} else if (ypos_cnt[mid_pos] < y) {
			min_pos = mid_pos;
		}
		mid_pos = (min_pos+max_pos+1)/2;
		if (min_pos == mid_pos) {
			return min_pos+1;
		}
		if (max_pos == mid_pos) {
			return max_pos;
		}
	}
}


int main(void)
{
	int sx, sy, ex, ey, N;
	cin >> sx >> sy >> ex >> ey >> N;
	if (sx > ex) {
		swap(sx, ex);
		swap(sy, ey);
	}
	int rev = 1;
	if (sy > ey) rev = -1;

	vector <pair <int ,int> > circle;
	int minx = std::min(sx, ex);
	int miny = std::min(sy, ey);
	int maxx = std::max(sx, ex);
	int maxy = std::max(sy, ey);
	for (int i = 0; i < N; i++) {
		int x, y;
		cin >> x >> y;
		if (minx <= x && x <= maxx && miny <= y && y <= maxy) {
			circle.push_back(make_pair(x, rev*y));
		}
	}
	for (int i = 1; i <= 2000000; i++) {
		ypos_cnt[i] = INF;
	}
	ypos_cnt[0] = -INF;

	int cnt = 0;

	std::sort(circle.begin(), circle.end());
	for (unsigned int i = 0; i < circle.size(); i++) {
		// xは関係ない
		int y = circle.at(i).second;
		int change_cnt = get_change_cnt(y, cnt);
		ypos_cnt[change_cnt] = y;
		if (change_cnt > cnt) cnt++;
	}

	double ans = (abs(sx-ex) + abs(sy-ey)) * 100.;
	ans += cnt * (-20+20*PI/4);
	if (cnt == min(abs(sx-ex), abs(sy-ey))+1) {
		ans += 20*PI/4;
	}
	cout << setprecision(12);
	cout << setiosflags(ios::fixed);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 9712
C = [list(map(int, input().split())) for _ in range(3)]

ans = "Yes"

for i in range(1, -1, -1):
    C0j = C[0][2] - C[0][i]
    C1j = C[1][2] - C[1][i]
    C2j = C[2][2] - C[2][i]
    
    if C0j != C1j or C0j != C2j:
        ans = "No"
        
print(ans)

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

void solve(long long N, std::vector<std::string> s, long long M, std::vector<std::string> t){
    map<string,ll> count;
    for (ll i = 0;i<N;i++){
        if (count.count(s[i])==1){
            count[s[i]]+=1;
        }else{
            count[s[i]]=1;
        }
    }
    for (ll i=0;i<M;i++){
        if (count.count(t[i])==1){
            count[t[i]]-=1;
        }else{
            count[t[i]]=-1;
        }
    }
    ll maximum_count = 0;
    for (auto iter= count.begin();iter !=count.end();++iter){
        if (maximum_count <=iter->second){
            maximum_count = iter->second;
        }
    }
    printf("%lld\n",maximum_count);

    

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> s(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> s[i];
    }
    long long M;
    scanf("%lld",&M);
    std::vector<std::string> t(M);
    for(int i = 0 ; i < M ; i++){
        std::cin >> t[i];
    }
    solve(N, std::move(s), M, std::move(t));
    return 0;
}


Measured memory_bytes: 256
module Main where

import Data.List
import Control.Monad
import Debug.Trace

change :: Char -> Char
change 'A' = 'a'
change 'B' = 'b'
change 'C' = 'c'

solve :: Int -> String -> String
solve k s = map (\(w,i) -> if i == k then change w else w) $ zip s [1..]

main = do
    nk <- getLine
    let [n, k] = read <$> words nk :: [Int]
    s <- getLine
    putStrLn $ solve k s


Measured memory_bytes: 508
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define fi first
#define se second

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

const int N = 500000;

int n, a[N], c[2][N];

signed main()
{
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i += 2) c[0][a[i]]++;
    for (int i = 1; i < n; i += 2) c[1][a[i]]++;
    vector<pair<int, int> > A, B;
    for (int i = 0; i < N; i++)
    {
        A.push_back({c[0][i], i});
        B.push_back({c[1][i], i});
    }
    sort(rall(A));
    sort(rall(B));
    int ans = 0;
    ans = max(ans, A[1].first + B[1].first);
    if (A[0].se != B[0].se) ans = A[0].first + B[0].first;
    if (A[1].se != B[0].se) ans = max(ans, A[1].first + B[0].first);
    if (A[0].se != B[1].se) ans = max(ans, A[0].first + B[1].first);
    cout << n - ans;
}


Measured memory_bytes: 13280
<?php

$s = explode(' ', trim(fgets(STDIN)));
$xx = $s[2];
$yy = $s[3];

$x = explode(' ', trim(fgets(STDIN)));
$x = max($x);

$y = explode(' ', trim(fgets(STDIN)));
$y = min($y);

$ans = "War";
if ($x < $y){
  for($i=$x+1; $i<=$y; $i++){
    if ($xx < $i && $i <= $yy){
      $ans = "No War";
      break;
    }
  }
}

echo $ans;
  
?>

Measured memory_bytes: 4604
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif


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

    int N, M; cin >> N >> M;
    vl A(N); REP(i, N) cin >> A[i];

    vl S(N + 1);
    S[1] = A[0] % M;
    FOR(i,1,N) {
        S[i + 1] = (S[i] + A[i]) % M;
    }

    ll ans = 0;
    map<int, int> mp;
    REP(i,N+1) {
        ans += mp[S[i]];
        mp[S[i]]++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4736
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
#define print(x) cout << (x) << endl;
#define print2(x, y) cout << (x) << " " << (y) << endl;
ll dp[100010] = {};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,W;
    cin >> N >> W;
    ll w[110], v[110];
    rep(i,0,N) cin >> w[i] >> v[i];
    dp[0] = 0;
    rep(i,0,N){
        rrep(j,W,0){
            if(j+w[i] > W) continue;
            dp[j+w[i]] = max(dp[j+w[i]], dp[j] + v[i]);
        }
    }
    ll ans = 0;
    rep(i,0,W+1){
        ans = max(ans, dp[i]);
    }
    print(ans);

    
}

Measured memory_bytes: 1024
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (mut n, k) = (v[0], v[1]);
    let mut ans = 0;
    while n > 0 {
        n /= k;
        ans += 1;
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main(void){
  int n;
  int ma = 0;
  int mi;
  int ans;
  cin >> n;
  for(int i = 0; i < n; i++){
    int a, b;
    cin >> a >> b;
    if(a > ma) {
      ma = a;
      mi = b;
    }
  }
  cout << ma+mi << endl;
  return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

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

inline bool LT(double a,double b) { return !equals(a,b) && a < b; }
inline bool LTE(double a,double b) { return equals(a,b) || a < b; }

void compute() {

}

int bf(ll N) {
  int maxi = 0;
  rep(i,N+1) {
    maxi = max(maxi,__builtin_popcount(i));
  }
  return maxi;
}

int main() {
  ll n;
  cin >> n;
  //for(n=1;n<=1000;++n) {
    for(int i=60;i>=0;--i) {
      if( (n>>i) & 1 ) {
	int ans = max(i,__builtin_popcount(n));
	cout << ans << endl;
	//cout << bf(n) << endl;
	//assert( ans == bf(n));
	break;
      }
    }
    //}
  compute();
  return 0;
}


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

using namespace std;
typedef long long ll;

int main()
{
 string S;
 cin>>S;
 bool flag1 = true;
 bool flag2 = true;
 bool flag3 = true;
 int s = S.length();
 int s_1 = (s-1)/2;
 int s_2 = (s+3)/2;

 for(int i=0;S[i] != '\0';i++){
     if(S[i]!=S[s-1-i])flag1=false;
 }

 for(int i=0;i < s_1;i++){
     if(S[i]!=S[s_1-1-i])flag2=false;
 }

  for(int i= (s+1)/2;i < s_2;i++){
     if(S[i]!=S[s_2-1-i])flag3=false;
 }

 if(flag1 && flag2 && flag3)cout<<"Yes"<<endl;
 else cout<<"No"<<endl;

/*
cout<<s<<" "<<s_1<<" "<<s_2<<endl;
cout<<flag1<<flag2<<flag3<<endl;
*/

 return 0;  
}

Measured memory_bytes: 256
n=int(input())
x=list(map(int,list(input())))
def popcount(x):
  ret=0
  while x:
    if x%2==1:ret+=1
    x//=2
  return ret
def f(x):
  ret=0
  while x:
    x%=popcount(x)
    ret+=1
  return ret
from collections import Counter
xpop=Counter(x)[1]
xint_mi,xint_pl=0,0

for i,y in enumerate(x):
  if xpop>1:
    xint_mi+=(pow(2,n-i-1,xpop-1)*y)%(xpop-1)
    xint_mi%=(xpop-1)
  xint_pl+=(pow(2,n-i-1,xpop+1)*y)%(xpop+1)
  xint_pl%=(xpop+1)

for i,y in enumerate(x):
  if y and xpop>1:
    yint=xint_mi-pow(2,n-i-1,xpop-1)
    ypop=xpop-1
  else:
    yint=xint_pl+pow(2,n-i-1,xpop+1)
    ypop=xpop+1
  if y==1 and xpop==1:
    print(0)
    continue
  yint%=ypop
  #print(yint,ypop)
  print(f(yint)+1)


Measured memory_bytes: 12180
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
	int A,B,C,X,Y;
	cin >> A >> B >> C >> X >> Y;
	int ret=1<<30;
	for(int i=0;i<=2*100*1000;i++){
		int p=i*C;
		p+=max((X-i/2)*A,0);
		p+=max((Y-i/2)*B,0);
		ret=min(ret,p);
	}
	cout << ret << endl;

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int x,t,n,a[100];
	for(x=0;x<4;x++){
		scanf("%d %d",&t,&n);
		if(t==1){
			a[x]=n*6000;
		}
		else if(t==2){
			a[x]=n*4000;
		}
		else if(t==3){
   			a[x]=n*3000;
		}
		else if(t==4){
			a[x]=n*2000;
		}
}
for(x=0;x<4;x++){
	printf("%d\n",a[x]);
	}
return 0;

}

Measured memory_bytes: 600
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << 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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    map<string, int> m;
    rep(i, n)
    {
        string temp;
        cin >> temp;
        m[temp]++;
    }
    cout << "AC x " << m["AC"] << "\n";
    cout << "WA x " << m["WA"] << "\n";
    cout << "TLE x " << m["TLE"] << "\n";
    cout << "RE x " << m["RE"] << "\n";
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;

namespace ALDS1_6_D {
    public static class Problem {
        public static int GetMinCost(this int[] source) {
            int n = source.Length;
            int minCost = 0;

            int[] sorted = (int[])source.Clone();
            Array.Sort(sorted);
            int minValue = sorted[0];

            Dictionary<int, int> valueToIndex = new Dictionary<int, int>();
            for (int i = 0; i < n; i++)
                valueToIndex[source[i]] = i;

            bool[] used = new bool[n];
            
            for(int i = 0; i < n; i++) {
                if (used[i])
                    continue;

                int minValueInGroup = sorted[i];
                int curPosition = valueToIndex[minValueInGroup];
                int sumOriginal = 0;
                int sumReplace = (minValue + minValueInGroup) * 2;

                while (curPosition != i) {
                    used[curPosition] = true;
                    int nextValue = sorted[curPosition];
                    int nextPosition = valueToIndex[nextValue];
                    sumOriginal += nextValue + minValueInGroup;
                    sumReplace += nextValue + minValue;
                    curPosition = nextPosition;
                }
                minCost += Math.Min(sumOriginal, sumReplace);
            }
            return minCost;
        }
    }

    class Program {
        static void Main(string[] args) {
            Console.ReadLine();
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(input.GetMinCost());
        }
    }
}

Measured memory_bytes: 10264
# D
H, W = map(int, input().split())
N = int(input())
a_list = list(map(int, input().split()))

res = [[str(0) for j in range(W)] for i in range(H)]

i = 0
j = 0
ind = 1

for k in range(H*W):
    if i % 2 == 0:
        a_list[ind-1] -= 1
        res[i][j] = str(ind)
        j += 1
        if a_list[ind-1] == 0:
            ind += 1
        if j == W:
            j = W - 1
            i += 1
    else:
        a_list[ind-1] -= 1
        res[i][j] = str(ind)
        j -= 1
        if a_list[ind-1] == 0:
            ind += 1
        if j == -1:
            j = 0
            i += 1
        
for i in range(H):
    print(" ".join(res[i]))

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}

template<unsigned int mod_>
struct ModInt{
	using uint = unsigned int;
	using ll = long long;
	using ull = unsigned long long;

	constexpr static uint mod = mod_;

	uint v;
	ModInt():v(0){}
	ModInt(ll v):v(normS(v%mod+mod)){}
	explicit operator bool() const {return v!=0;}
	static uint normS(const uint &x){return (x<mod)?x:x-mod;}		// [0 , 2*mod-1] -> [0 , mod-1]
	static ModInt make(const uint &x){ModInt m; m.v=x; return m;}
	ModInt operator+(const ModInt& b) const { return make(normS(v+b.v));}
	ModInt operator-(const ModInt& b) const { return make(normS(v+mod-b.v));}
	ModInt operator-() const { return make(normS(mod-v)); }
	ModInt operator*(const ModInt& b) const { return make((ull)v*b.v%mod);}
	ModInt operator/(const ModInt& b) const { return *this*b.inv();}
	ModInt& operator+=(const ModInt& b){ return *this=*this+b;}
	ModInt& operator-=(const ModInt& b){ return *this=*this-b;}
	ModInt& operator*=(const ModInt& b){ return *this=*this*b;}
	ModInt& operator/=(const ModInt& b){ return *this=*this/b;}
	ll extgcd(ll a,ll b,ll &x,ll &y) const{
		ll u[]={a,1,0},v[]={b,0,1};
		while(*v){
			ll t=*u/ *v;
			rep(i,3) swap(u[i]-=t*v[i],v[i]);
		}
		if(u[0]<0) rep(i,3) u[i]=-u[i];
		x=u[1],y=u[2];
		return u[0];
	}
	ModInt inv() const{
		ll x,y;
		extgcd(v,mod,x,y);
		return make(normS(x+mod));
	}
	bool operator==(const ModInt& b) const { return v==b.v;}
	bool operator!=(const ModInt& b) const { return v!=b.v;}
	friend istream& operator>>(istream &o,ModInt& x){
		ll tmp;
		o>>tmp;
		x=ModInt(tmp);
		return o;
	}
	friend ostream& operator<<(ostream &o,const ModInt& x){ return o<<x.v;}
};
using mint = ModInt<1000000007>;

int N;
int L;
int a[99];
void input(){
	cin>>N;
	L=2*N-1;
	rep(i,L) cin>>a[i];
	sort(a,a+L);
}

mint dp[50][110][110];

int main(){
	input();
	dp[0][0][0]=1;
	int mid=N-1;
	rep(t,N-1){
		int loff=(a[mid-t]!=a[mid-t-1]);
		int roff=(a[mid+t]!=a[mid+t+1]);
		rep(l_,110) rep(r_,110) if(dp[t][l_][r_]){
			mint& val=dp[t][l_][r_];
			int l=l_+loff, r=r_+roff;
			//stay
			dp[t+1][l][r]+=val;
			//left
			rep(x,l) dp[t+1][l-1-x][r+1]+=val;
			//right
			rep(x,r) dp[t+1][l+1][r-1-x]+=val;
		}
	}
	mint ans=0;
	rep(i,110) rep(j,110) ans+=dp[N-1][i][j];
	cout<<ans<<endl;
}


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

int main(void) {
  long long x;
  long long a;
  int b;

  std::cin >> x;

  a = (x / 11 + 1)*2;
  b = x % 11;

  if (b != 0 && b < 7) {
    a--;
  }
  if (b == 0) {
    a = a - 2;
  }

  std::cout << a << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	int N,M;
	cin>>N>>M;
	int t = 1<<M;
	cout << t*(1900*M+100*(N-M)) << endl;
}


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

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      int N;
      cin >> N;
      vector<int> vec (N);
      for(int i = 0;i < N;i++){
          cin >> vec[i];
      }

      bool used = false;
      int ok = -1;
      for(int i = 1;i <= N;i++){
          if(vec[i-1] != i && i != ok){
              if(vec[vec[i-1]-1] != i || used){
                  cout << "NO" << endl;
                  return 0;
              }
              ok = vec[i-1];
              used = true;
          }
      }
      cout << "YES" << endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(200000)


def do_dfs(root, add_duplicated=True):
    global edges, visited, duplicated

    def main(i):
        visited[i] = True
        for edge in edges[i]:
            if visited[edge]:
                if edge == root:
                    return True
                if add_duplicated:
                    duplicated.add(edge)
                continue
            if main(edge):
                return True
        return False

    return main(root)


n, m = map(int, input().split())

edges = [set() for _ in range(n)]

for _ in range(m):
    s, t = map(int, input().split())
    edges[s].add(t)

visited = [False] * n
duplicated = set()

for i in range(n):
    if not visited[i]:
        if do_dfs(i):
            print(1)
            break
else:
    for i in duplicated:
        visited = [False] * n
        if do_dfs(i, False):
            print(1)
            break
    else:
        print(0)

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

int main()
{
	int N, T, E, x[100];
	cin >> N >> T >> E;
	for (int i = 0; i < N; ++i) cin >> x[i];
	for (int i = T-E; i <= T+E; ++i)
	{
		for (int j = 0; j < N; ++j)
		{
			if (i % x[j] == 0)
			{
				cout << j+1 << endl;
				return 0;
			}
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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; }
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  double ans = (double)(n/2+n%2)/(double)n;
  printf("%.10f\n",ans);
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner sc=new Scanner(System.in);
		boolean a[] =new boolean[10001];
		Arrays.fill(a, true);
		for(int i=2; i*i<=10000; i++)
		{
			if(!a[i])
				continue;
			for(int j=i*2; j<=10000; j+=i)
				a[j]=false;
		}
		while(sc.hasNext())
		{
			int n=sc.nextInt();
			if(n==0)
				return;
			int sum=0;
			int ans=0;
			for(int i=2; i<=n; i++)
			{
				sum =0;
				if(a[i])
					for(int j=i; j<=n; j++)
					{
						if(a[j])
						{
							sum+=j;
							if(n==sum)
								ans++;
						}
						if(sum>=n)
							break;
					}
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 12000
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0;i<(n);i++)
int N, M;
int x[1505];
int y[1505];
int co[3000005];
int main()
{
	while (true)
	{
		cin >> N >> M;
		if (N == 0 && M == 0) break;
		x[0] = 0;
		y[0] = 0;
		rep(i, N)
		{
			int a;
			cin >> a;
			x[i + 1] = x[i] + a;
		}
		rep(j, M)
		{
			int a;
			cin >> a;
			y[j + 1] = y[j] + a;
		}

		rep(i, N + 1)
		{
			rep(j, M + 1)
			{
				int p = y[j] - x[i];
				co[1500000 + p]++;//1500000
			}
		}
		int ans = 0;
		rep(i, 3000005)	ans += co[i] * (co[i] - 1) / 2; //3000005
		cout << ans << endl;
		memset(x, 0, sizeof x);
		memset(y, 0, sizeof y);
		memset(co, 0, sizeof co);
	}
	return 0;
}


Measured memory_bytes: 14712
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

ll f(ll n,vector<ll>& pow){
  ll i=0,j,digit=countdigits(n+1),tr=pow[digit-3]-1,ans=0;
  double p,min=(double)n/(double)sumdigits(n)*100.0;
  rep(i,1000){
    tr+=pow[digit-3];
    if(tr<=n)continue;
    p=(double)tr/(double)sumdigits(tr);
    if(min>p){
      min=p;
      ans=tr;
    }
  }
  return ans;
}

int main(){
  ll i,n=1099,K;
  vector<ll> pow(30,1);
  rep1(i,30)pow[i]=pow[i-1]*10;
  cin>>K;
  printf("1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n");
  if(K==10)return 0;
  printf("29\n39\n49\n59\n69\n79\n89\n99\n199\n299\n399\n499\n599\n699\n799\n899\n999\n1099\n");
  K-=28;
  for(i=0;i<K;i++){
    n=f(n,pow);
    printf("%lld\n",n);
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(a,b,c) for(int a=b; a<(int)c; a++)
#define REPE(a,b,c) for(int a=b; a<=(int)c; a++)
#define REPD(a,b,c) for(int a=b; a>(int)c; a--)
#define rep(a,b) REP(a,0,b)
#define repd(a,b) REPD(a,b,0)
class _datas{
public:
  int m;
  int t;
  int p;
  int j;
};
class _score{
public:
  int p;
  int t;
  _score(int p, int t){
    this->p = p;
    this->t = t;
  }
};
typedef long long int ll;
using namespace std;

  

int main(){
  while(true){
    int M,T,P,R;
    cin >> M >> T >> P >> R;
    if(M == 0) break;
    vector<_datas> datas(R);
    rep(i,R) cin >> datas[i].m >> datas[i].t >> datas[i].p >> datas[i].j;
    //rep(i,R) cout << datas[i].m << " "<< datas[i].t << " "<< datas[i].p << " "<< datas[i].j << " " << endl;
    vector<_score> scores(T+1,_score(0,0));
    REPE(i,1,T){
      vector<int> miss_cnt(P+1,0);
      rep(j,R){
        _datas data = datas[j];
        if(data.t == i){
          if(data.j == 0){
            scores[i].p++;
            scores[i].t += data.m + miss_cnt[data.p]*20;
          }else{
            miss_cnt[data.p]++;
          }
        }
      }
    }
    /*cout << "score" << endl;
    REPE(i,1,T){
      cout<<i<<":" << scores[i].p << " " << scores[i].t << endl;
      }*/
    _score b_score = _score(0,0);
    REPE(i,1,T){
      int max_idx = 1;
      REPE(j,2,T){
        if(scores[j].p > scores[max_idx].p || (scores[j].p==scores[max_idx].p && scores[j].t <= scores[max_idx].t)){
          max_idx = j;
        }
      }
      if(i != 1){
        if(b_score.p == scores[max_idx].p && b_score.t==scores[max_idx].t) cout << "=";
        else cout << ",";
      }
      cout << max_idx;
      b_score = scores[max_idx];
      scores[max_idx] = _score(-1,0);
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1228
#include <stdio.h>
#include <string.h>
int main(void){
    
    int i,h,w;
    char a[100][101];
    
    scanf("%d%d",&h,&w);
    for(i=0;i<h;i++){
        scanf("%s",a[i]);
    }
    
    for(i=0;i<strlen(a[0])+2;i++) printf("#");
    printf("\n");
    for(i=0;i<h;i++){
        printf("#%s#\n",a[i]);
    }
    for(i=0;i<strlen(a[0])+2;i++) printf("#");
    printf("\n");
}


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  
  int counter = 1;
  for(int i=1;i<N;i++){//今主役のホテル。ホテル１(i=0)は確かめない。
    bool good_view = true;
    for(int j=0;j<i;j++){//比較対象のホテル。
      if(A.at(j)>A.at(i)){
        good_view = false;
        break;
      }
    }
    if(good_view){
      counter++;
    }
  }
  cout << counter << endl;
}

Measured memory_bytes: 256
import numpy as np
H,W = [int(x) for x in input().split()]
N = int(input())
a = [int(x) for x in input().split()]
ans = np.array([1]*a[0])
for i in range(1,N):
  #print([i+1]*a[i])
  ans=np.r_[ans,[i+1]*a[i]]
ans = np.reshape(ans,(H,W))
for i in range(0,H,2):
  ans[i,:]=ans[i,::-1]
for i in range(H):
  print(*ans[i,:])
#print(ans)
                 

Measured memory_bytes: 15204
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	std::string s;
	std::cin >> s;
	std::string t = "hi";
	std::string r = t;
	rep(i,10) {
		if(s==t) {
			print("Yes");
			return 0;
		}
		t+=r;
	}
	print("No");
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

typedef string::const_iterator State;
class ParseError {};
int tree(State&);
int number(State&);

PII t[2][100010], ans[100010];
int idx;
int heap1[100010], heap2[100010], heap[100010];
int val[2][100010], val2[100010];
int cnt;

int tree(State &begin) {
  if(*begin != '(') return -1;
  begin++;
  int left = tree(begin);
  begin++;
  begin++;
  int res = number(begin);
  begin++;
  begin++;
  int right = tree(begin);
  begin++;
  val[idx][cnt] = res;
  t[idx][cnt++] = {left, right};
  // cout << left << " " << cnt-1 << " " << res << " " << right << endl;
  return cnt-1;
}

int number(State &begin) {
  int res = 0;
  while(isdigit(*begin)) {
    res *= 10;
    res += *begin - '0';
    ++begin;
  }
  return res;
}

string dfs(int num) {
  if(num == -1) return "";
  string ret = "(";
  ret += (dfs(ans[num].first));
  ret += (")[");
  ret += (to_string(val2[num]));
  ret += ("](");
  ret += (dfs(ans[num].second));
  ret += (")");
  return ret;
}

int func(int a, int b) {
  if(a == -1 || b == -1) return -1;
  int left = func(t[0][a].first, t[1][b].first);
  int right = func(t[0][a].second, t[1][b].second);
  val2[cnt] = val[0][a] + val[1][b];
  // cout << left << " val2[" << cnt << "] = " << val2[cnt] << " " << right << endl;
  ans[cnt++] = {left, right};
  return cnt-1;
}

signed main(void)
{
  string s, tt;
  cin >> s >> tt;
  memset(val, -1, sizeof(val));
  memset(heap1, -1, sizeof(heap1));
  memset(heap2, -1, sizeof(heap2));
  memset(heap, -1, sizeof(heap));
  idx = 0, cnt = 0;
  State begin = s.begin();
  int root1 = tree(begin);
  idx = 1, cnt = 0;
  begin = tt.begin();
  int root2 = tree(begin);

  memset(val2, -1, sizeof(val2));
  cnt = 0;
  int tmp = func(root1, root2);

  cout << dfs(tmp) << endl;

  return 0;
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int a, p; cin >> a >> p;
    p += a * 3;
    int ans = p / 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    map<int, int> M;
    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        ++M[a[i]];
    }
    sort(a.begin(), a.end());
    vector<int> b;
    b.push_back(a[0]);
    for (int i = 1; i < n; ++i)
        if (a[i] != a[i - 1])
            b.push_back(a[i]);
    if (b.size() >= 4)
    {
        cout << "No";
        return 0;
    }
    for (int i = 0; i < b.size(); ++i)
    {
        for (int j = 0; j < b.size(); ++j)
        {
            map<int, int> temp = M;
            vector<int> c(n);
            c[0] = b[i];
            c[1] = b[j];
            for (int k = 2; k < n; ++k)
                c[k] = (c[k - 1] ^ c[k - 2]);
            if ((c[n - 2] ^ c[n - 1]) != c[0])
                continue;
            bool ok = true;
            for (int k = 0; k < n; ++k)
            {
                if (temp[c[k]] == 0)
                    ok = false;
                else
                    --temp[c[k]];
            }
            if (ok)
            {
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 4864
#include <iostream>
#include <cstdlib>

using namespace std;

int main(){
  int n;
  cin >> n;
  while(n != 0){
    if(n%10 == 9){
      cout << "Yes" << endl;
      return 0;
    } else {
      n = n / 10;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    ll N, K;
    cin >> N >> K;
    if(K == 0) {
        cout << N * N << "\n";
        return 0;
    }
    ll ans = 0;
    for(int i = K + 1; i <= N; i++) {
        ans += (N / i) * (i - K);
        ans += max(0LL, N % i - K + 1);
    }
    cout << ans << "\n";
    return 0;
}


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

typedef pair<int,int> pii ;

int a = 0 ;
int b = 0 ;
int n = 0 ;
int dp[16][16] = {1} ;
vector<pii> construct ;
int inf = pow(10,9) ;

int solve()
{
  for ( int i = 0 ; i < 16 ; i++ )
  {
    for ( int j = 0 ; j < 16 ; j++ )
    {
      dp[i][j] = 0 ;
    }
  }
  for ( int i = 0 ; i < construct.size() ; i++ )
  {
    dp[ construct[i].first - 1 ][ construct[i].second - 1 ] = inf ;
  }
  construct.clear() ;
  dp[0][0] = 1 ;
  for ( int i = 0 ; i < a ; i++ )
  {
    for ( int j = 0 ; j < b ; j++ )
    {
      /*<debug>
      printf("<debug>\n\n") ;
      for ( int x = 0 ; x < a ; x++ )
      {
        for ( int y = 0 ; y < b ; y++ )
        {
          printf("%9d,", dp[x][y]) ;
        }
        printf("\n") ;
      }
      printf("\n</debug>\n") ;
      </debug>*/
      if ( dp[i][j] == inf ) continue ;
      if ( i < a - 1 )
      {
        if ( dp[ i + 1 ][j] != inf )
        {
          dp[ i + 1 ][j] += dp[i][j] ;
        }
      }
      if ( j < b - 1 )
      {
        if ( dp[i][ j + 1 ] != inf )
        {
          dp[i][ j + 1 ] += dp[i][j] ;
        }
      }
    }
  }
  return dp[ a - 1 ][ b - 1 ] ;
}

int main()
{
  while (1)
  {
    cin >> a >> b ;
    if ( !a && !b ) break ;
    cin >> n ;
    for ( int i = 0 ; i < n ; i++ )
    {
      int x, y ;
      cin >> x >> y ;
      construct.push_back( pii(x,y) ) ;
    }
    printf("%d\n", solve()) ;
  }
  return 0 ;
}

Measured memory_bytes: 3120
#include<stdio.h>
int main(void){
  int n,i,a[10000],b[10000],sum_a,sum_b;
  while(1){
    sum_a = 0;
    sum_b = 0;
    scanf("%d",&n);
    if(n==0)return(0);
    for(i=0;i<n;i++){
      scanf("%d %d",&a[i],&b[i]);
      if(a[i]>b[i]){
	sum_a += a[i] + b[i];
      }
      else if(b[i]>a[i]){
	sum_b += a[i] + b[i];
      }
      else{
	sum_a += a[i];
	sum_b += b[i];
      }
    }
    printf("%d %d\n",sum_a,sum_b);
  }
  return(0);
}

Measured memory_bytes: 1800