akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline void fastio () {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
}

#define whats(x) cerr << #x << " = " << (x) << "\n"; 

using LL = long long;
using LD = long double;

const LL INF = LLONG_MAX;
const LL MOD = 998244353;
const LL N = 2e5+1;

int main() {
	fastio();

	char c;
	cin >> c;

	char ans;
	if (c >= 'A' && c <= 'Z') {
		ans = 'A';
	}
	else {
		ans = 'a';
	}
	cout << ans << "\n";
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define REPA(x, v) for(auto&& x:v)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(v.rbegin(),v.rend())
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N;
    cin >> N;
    vector<string> S(N);
    REP(i,N) cin >> S[i];
    
    int ans = 0;
    REP(a, 1){
        REP(b, N){
            bool f = true;
            Rep(i, 0, N-1){
                Rep(j, i+1, N){
                    if(S[(i+a)%N][(j+b)%N]!=S[(j+a)%N][(i+b)%N]){
                        f = false;
                        break;
                    }
                }
                if(!f)break;
            }
            if(f) ans += N;
        }
    }

    pr(ans);
}


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

void solve(long long S, long long W){
    if(W>=S){
        cout << "unsafe" << endl;
    }else{
        cout <<"safe" << endl;
    }

}

int main(){
    long long S;
    scanf("%lld",&S);
    long long W;
    scanf("%lld",&W);
    solve(S, W);
    return 0;
}


Measured memory_bytes: 3672
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

ll modpow(ll m, ll p) {
    if (p == 0) return 1;
    ll tmp = modpow(m, p / 2);
    if (p & 1) return (tmp * tmp % MOD) * m % MOD;
    else return tmp * tmp % MOD;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll k; string s; cin >> k >> s;
    ll n = s.size();
    ll total = modpow(26, k + n);
    vll fac(2000005, 1), invfac(2000005, 1);
    for (ll i = 2; i < 2000005; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        invfac[i] = invfac[i - 1] * modpow(i, MOD - 2) % MOD;
    }

    ll sub = 0;
    for (ll i = 1; i <= n; i++) {
        ll pi = i - 1;
        ll ccc = (fac[n + k] * invfac[pi] % MOD) * invfac[n + k - pi] % MOD; 
        (sub += modpow(25, n + k - pi) * ccc % MOD) %= MOD;
    }

    cout << (total - sub + MOD) % MOD << '\n';
    return 0;
}


Measured memory_bytes: 35676
from collections import defaultdict
from heapq import heappush, heappop, heapify
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    INF = 10**9
    N, M = map(int, readline().split())
    if N == M == 0:
        return False
    H = [int(readline()) for i in range(N)]
    E = []
    G = [[] for i in range(N)]
    for i in range(M):
        a, b, c = map(int, readline().split())
        E.append((c, a-1, b-1))
        G[a-1].append((b-1, c))
        G[b-1].append((a-1, c))
    E.sort()

    mp = defaultdict(list)
    for i in range(N):
        mp[H[i]].append(i)

    def root(x):
        if x == prt[x]:
            return x
        prt[x] = y = root(prt[x])
        return y
    def unite(x, y):
        px = root(x); py = root(y)
        if px == py:
            return False
        if sz[px] > sz[py]:
            prt[py] = px
            sz[px] += sz[py]
        else:
            prt[px] = py
            sz[py] += sz[px]
        return True

    *prt, = range(N)
    sz = [1]*N

    *hs, = mp.keys()
    hs.sort(reverse=1)
    U = [0]*N
    c = 0
    h0 = -1
    k = -1
    for i, h in enumerate(hs):
        vs = mp[h]
        for v in vs:
            for w, _ in G[v]:
                if not U[w]:
                    continue
                unite(v, w)
            U[v] = 1
            c += 1
        v0 = root(vs[0])
        if sz[v0] != c:
            h0 = h
            k = i

    if k == len(hs)-1:
        write("0\n")
        return True

    ans = 0

    h = hs[k+1]
    *prt, = range(N); sz = [1]*N
    for c, a, b in E:
        if H[a] >= h and H[b] >= h:
            if unite(a, b):
                ans += c

    mc = [INF]*N
    U = [0]*N
    for v in range(N):
        if H[v] < h:
            continue
        U[v] = 1
        for w, d in G[v]:
            if H[w] < h:
                mc[w] = min(mc[w], d)

    que = []
    for v in range(N):
        if H[v] >= h:
            continue
        que.append((-H[v], mc[v], v))
    heapify(que)
    while que:
        _, cost, v = heappop(que)
        if U[v]:
            continue
        U[v] = 1
        h = H[v]
        ans += cost
        for w, d in G[v]:
            if not U[w] and H[w] <= h and d < mc[w]:
                mc[w] = d
                heappush(que, (-H[w], d, w))
    write("%d\n" % ans)
    return True
while solve():
    ...


Measured memory_bytes: 11356
s = gets.chomp

ans_a = ans_b = 0

s.length.times do |i|
  c = s[i].to_i
  ans_a += 1 if i.even? && c == 0 || i.odd? && c == 1
  ans_b += 1 if i.even? && c == 1 || i.odd? && c == 0
end

puts ans_a <= ans_b ? ans_a : ans_b


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll T, X; cin >> T >> X;
  double ans;
  ans = (double)T/(double)X;
  printf("%.10f\n", ans);

}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    int train;
    train = N * A;
    if(train < B) cout << train << endl;
    else cout << B << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var n = ReadInt();
            var p = ReadSplitInt();

            var ans = 0;
            for (int i = 1; i < n-1; i++)
            {
                var a = new List<int> { p[i - 1], p[i], p[i + 1] }.OrderBy(x => x).ToList()[1];
                if (a == p[i]) ans++;
            }
            Println(ans);
        }

        static List<int> ReadLines(int n)
        {
            var l = new List<int>();
            for (int i = 0; i < n; i++)
            {
                l.Add(ReadInt());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a * b / Gcd(a, b);

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


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


main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int a,b,c;
    set<int> s;
    cin>>a>>b>>c;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    if(s.size()==2) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {

	ll X , Y , Z , K;
	cin >> X >> Y >> Z >> K;
	vector<ll> A(X), B(Y), C(Z);
	rep(i, X) cin >> A[i];
	rep(i, Y) cin >> B[i];
	rep(i, Z) cin >> C[i];

	vector<ll> AB(X*Y);

	rep(i, X) rep(j, Y) {
		AB[i*Y + j] = A[i] + B[j];
	}

	SORTL2S(ll, AB);
	SORTL2S(ll, C);

	vector<ll> pos(Z,0);

	rep(i, K) {
		ll ans = 0;
		ll index = 0;

		rep(j, Z) {
			
			if (pos[j] == AB.size()) continue;

			ll tmp = C[j] + AB[pos[j]];

			if (tmp > ans) {
				ans = tmp;
				index = j;
			}

		}
		pos[index]++;

		cout << ans << endl;
	}

}

int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	cout << endl;
	return 0;
}

Measured memory_bytes: 8192
#include<cstdio>
#include<cctype>

int main(){
  char ch;
    
    while(1){
      scanf("%c", &ch);
        if ( isalpha(ch) ){
         if ( islower(ch) ) printf("%c", toupper(ch));
         else printf("%c", tolower(ch));
        } else printf("%c", ch);
        
        if ( ch == '\n' ) break;
    }    
    
    
    
    return 0;
}   

Measured memory_bytes: 944
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	//freopen("in.txt","r",stdin);
	ll n;
	cin>>n;
	ll q,w;
	cin>>q>>w;
	ll x = 0;
	for(ll i=2;i<n;i++){
		ll tmp;
		cin>>tmp;
		x ^= tmp;
	}
	ll d = (q+w-x)  / 2;
	if(d<0 or d>q or (d&x) or (q+w-x)%2==1){
		cout<<-1<<endl;
		exit(0);
	}
	for(ll i=45;i>=0;i--){
		if(x>>i&1LL){
			if(d+(1LL<<i) <= q){
				d += (1LL<<i);
			}
		}
	}
	if(d==0) cout<<-1<<endl;
	else cout<<q-d<<endl;
	return 0;
}

Measured memory_bytes: 3628
open Printf
open Scanf

let () =
  let s = scanf "%s\n" (fun x -> x) in
  let cs = "abcdefghijklmnopqrstuvwxyz" in
  let rec iter i =
    if i = 26 then "None"
    else
      if String.contains s cs.[i] then iter (i+1)
      else String.make 1 cs.[i]
  in
  printf "%s\n" (iter 0)


Measured memory_bytes: 2688
#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 << "Balanced" << endl;
   else  if (a+b <= c+d)
     cout << "Right" << endl;
   else
     cout << "Left" << endl;
 }

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[100001];
    int m = 0;
    for(int i = 0; i < N; i++) {
      a[sc.nextInt()]++;
    }
    for(int i = 0; i < 100001 - 2; i++) {
      m = Math.max(m, a[i] + a[i + 1] + a[i + 2]);
    }
    System.out.println(m);
  }
}


Measured memory_bytes: 52612
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
using namespace std;

#define REP(i,n) for(int i=0;i<n;++i)
#define enter "\n"

typedef long long ll;


int abc101_a(){
    //入力
    ll n;
    cin >> n;
    ll n2 = n;
    int sn = 0;
    
    //処理
    while(n2!=0){
        sn += n2%10;
        n2 /= 10;
    }
    
    //出力
    if(n%sn==0) cout << "Yes" << enter;
    else cout << "No" << enter;
    return 0;
}

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


Measured memory_bytes: 256
s = input()
a = [chr(i) for i in range(97, 97 + 26)]

if s == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
    exit()

if len(s) != 26:
    print(s + sorted(list(set(a) - set(s)))[0])
else:
    t = s
    s = list(s)
    n = len(s)
    for i in range(n - 1):
        if s[i] < s[i + 1]:
            j = i
    for i, v in enumerate(s[::-1]):
        if s[j] < v:
            s[j], s[n-i-1] = s[n-i-1], s[j]
            break
    s = s[:j + 1] + s[j + 1:][::-1]

    ans = ""
    for i, j in zip(s, t):
        ans += i
        if i != j:
            print(ans)
            exit()

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

#define ll long long

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	double dp[1001]; dp[0]=0;
	for(int i=1;i<1001;i++){
		dp[i] = dp[i-1] + (double)i;
	}

	int n,k;
	cin >> n >> k;
	int b[n]; double a[n];
	for(int i=0;i<n;i++){
		cin >> b[i];
		a[i] = (double)dp[b[i]] / (double)b[i];
	}

	double res = 0.0,ans=0.0;
	for(int i=0;i<k;i++){
		res += a[i];
	}
	ans = max(ans,res);
	int j = 0;

	for(int i=k;i<n;i++){
		res += a[i];
		res -= a[j];
		ans = max(res,ans);
		j++;
	}

	cout << fixed << setprecision(8) << ans;


}

Measured memory_bytes: 2560
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/


int main() {
int K,N;
cin>>N>>K;
ll h[N];
rep(i,N){
  cin>>h[i];
}
sort(h,h+N);
ll min_dif=INF2;
rep(i,N-K+1){
  min_dif=min(min_dif,h[i+K-1]-h[i]);
}
cout<<min_dif<<endl;
return 0;
}



Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
#define fi        first
#define se        second
#define pb        push_back
#define PI        acos(-1)
#define LC(a)     ((a<<1))
#define RC(a)     ((a<<1)+1)
#define MID(a,b)  ((a+b)>>1)
#define mem(a, b) memset(a, b, sizeof(a))
#define IOS()     std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<ll,ll>   PLL;
typedef pair<ll,int>  PLI;
const int INF = 0X3F3F3F3F;
const int MIN = -(1<<30);
const ll N = 1e5+7;
inline void solve()
{
	string s;
	cin>>s;
	int len = s.size();
	if(len&1)
	{
		cout<<"No"<<endl;
		return;
	}

	for(int i=0; i<s.size(); i++)
	{
		if(i%2==0 && s[i]=='h') continue;
		if(i%2==1 && s[i]=='i') continue;
		cout<<"No"<<endl;
		return;
	}
	cout<<"Yes"<<endl;

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




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



int main(){

  ll x,y,rn,gn,c;
  cin>>x>>y>>rn>>gn>>c;
  ll red[rn];
  ll green[gn];
  ll fake[c];

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

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

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

  vector<ll>v;

  sort(red,red+rn);
  sort(green,green+gn);
  sort(fake,fake+c);

  for(int i=0;i<c;i++){

      v.push_back(fake[i]);

  }

  for(int i = rn-1;i>=rn-x;i--){
      v.push_back(red[i]);
  }

  for(int i= gn-1;i>=gn-y;i--){
      v.push_back(green[i]);
  }

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

  ll size = v.size();

  ll fin = 0;

  for(int i=size-1;i>=size-(x+y);i--){
      fin+=v[i];
  }

  cout<<fin;

}

Measured memory_bytes: 8304
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long  ll;

int main(){
	int cas;
	scanf("%d", &cas);
	while(cas--){
		ll p, q;
		scanf("%lld%lld", &p, &q);
		int cnt = 0;
		for(ll m = -141; m <= 141; m++){
			for(ll n = -141; n <= 141; n++){
				ll a = m * p + n * q;
				ll b = m * q - n * p;
				ll mod = m * m + n * n;
				if(mod < 1) continue;
				if(a % mod || b % mod) continue;
				ll x = a / mod;
				ll y = b / mod;
				if(mod * (x * x + y * y) == p * p + q * q){
					cnt++;
				}
			}
		}
		if(cnt == 8) puts("P");
		else puts("C");
	}
	return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N), B(M);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < M; i++) cin >> B[i];

  long long totalB = 0;
  for (int i = 0; i < M; i++) totalB += B[i];
  long long ans = 0;
  for (int i = 0; i < N; i++) ans += A[i] * totalB;

  cout << ans << endl;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();
        int res = 0;
        for (char c1 = '0'; c1 <= '9'; c1++) {
            for (char c2 = '0'; c2 <= '9'; c2++) {
                for (char c3 = '0'; c3 <= '9'; c3++) {
                    String c = "";
                    c += c1;
                    c += c2;
                    c += c3;
                    
                    int state = 0;
                    for (int i = 0; i < n; i++) {
                        if (s.charAt(i) == c.charAt(state)) {
                            state++;
                            if(state==3) {
                                res++;
                                break;
                            }
                        }
                    }
                }
            }
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 25300
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
ld eps = 1.0e-18;

int main() {
  ll a,b,c;
  cin >> a >> b >> c;
  //cout << sqrtl((ld)a) << endl;
  if(c-a-b > 0 && 4*a*b < (c-a-b)*(c-a-b)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return(0);
}

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

using db = double;
using ll = long long;
using vi = vector <int>;
#define op operator
#define pb push_back

int main() {
	ios :: sync_with_stdio(0);

	db x; vector <db> v;
	while(cin >> x) v.pb(x);
	cout << fixed << setprecision(3);
	cout << *max_element(v.begin(), v.end()) - *min_element(v.begin(), v.end());

	return 0;
}

Measured memory_bytes: 3252
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>

using namespace std;
int main() {
	int L, R, d;
	int ans=0;
	scanf("%d%d%d", &L, &R, &d);
	for (int i = L; i <= R; i++) {
		if (i % d == 0) ans++;
	}
	printf("%d", ans);
}



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

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}


int main() {
    long long int a, b;
    std::cin >> a >> b;
    long long int c = a * b;
    long long int ans = c / gcd(a, b);
    cout << ans << endl;
}

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

const int maxn = 100010;

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

main()
{
    int n;
    n = read();
    std::cout << pow(n, 3);
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
const int N = 700;
int adj[N+1][N+1];
int n;
int color[N+1];
bool bipartite(int u, int c, int* count)
{
    if(color[u]!=-1)
        return color[u]==c;
    color[u] = c;
    count[c]++;
    for(int v = 1; v <= n; v++)
        if(adj[u][v] && !bipartite(v,c^1,count))
            return false;
    return true;
}
int memo[N+1][N+1];
int dp(int i, int diff, vector<int>& d)
{
    if(i==d.size())
        return diff;
    else if(memo[i][diff] != -1)
        return memo[i][diff];
    else
        return memo[i][diff] = min(dp(i+1,diff+d[i],d),dp(i+1,abs(diff-d[i]),d));
}
int solve()
{
    int m; cin >> n >> m;
    for(int u = 1; u <= n; u++)
        for(int v = 1; v <= n; v++)
            adj[u][v] = u!=v;

    for(int i = 0; i < m; i++)
    {
        int u, v; cin >> u >> v;
        adj[u][v] = adj[v][u] = 0;
    }

    vector<int> d;
    memset(color,-1,sizeof color);
    for(int u = 1; u <= n; u++)
        if(color[u]==-1)
        {
            int count[] = {0,0};
            if(!bipartite(u,0,count))
                return -1;
            d.push_back(abs(count[0]-count[1]));
        }

    memset(memo,-1,sizeof memo);
    int diff = dp(0,0,d);

    int x = (n-diff)/2;
    int y = n-x;
    return x*(x-1)/2 + y*(y-1)/2;
}
int main()
{
    cout<<solve()<<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
using Graph =vector<int>;
typedef pair<int,int> P;

const ll MAX_N=131072;

int bit[MAX_N*2-1];
ll n;
vector<int> G[1000010];
vector<vector<int>> used(1000010,vector<int>(3,0));
int main(){
  int N,M;cin>>N>>M;
  rep(i,M){
    int u,v;cin>>u>>v;
    --u;--v;
    G[u].push_back(v);
  }
  int S,T;cin>>S>>T;
  --S;--T;
  queue<P> q;
  q.push(P(S,0));
  used[S][0]+=0;
  while(!q.empty()){
    P p=q.front();q.pop();
    int u,num;u=p.first;num=p.second;
    for(auto v:G[u]){
      if (!used[v][(num+1)%3]){
        used[v][(num+1)%3]=used[u][num]+1;
        q.push(P(v,(num+1)%3));
        if (v==T&&(num+1)%3==0){
          cout<<used[v][(num+1)%3]/3<<endl;
          return 0;
        }
      }
    }
  }
  cout<<-1<<endl;
}


Measured memory_bytes: 81536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] nums = Console.ReadLine().Split(' ').Select(s=>long.Parse(s)).ToArray();

            long A = nums[0];
            long B = nums[1];
            long K = nums[2];

            if (A + B <= K)
            {
                Console.WriteLine("0 0");
                return;
            }

            if (A >= K)
            {
                Console.WriteLine($"{A - K} {B}");
                return;
            }

            Console.WriteLine($"0 {B + A - K}");
        }
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<vector>
#include<climits>
#include<algorithm>
#include<cstdio>

using namespace std;

int main(){
  int N;
  while(cin>>N, N){
    if(N==1){
      cout << "1 1" << endl;
      continue;
    }
    vector<int> n(N-1);
    vector<int> d(N-1);
    for(int i=0; i<N-1; i++){
      cin >> n[i] >> d[i];
    }
    int dx[]={-1,0,1,0};
    int dy[]={0,1,0,-1};
    vector<pair<int,int> > v(N);
    v[0].first=0; v[0].second=0;
    int xmax=0,xmin=0;
    int ymax=0,ymin=0;
    for(int i=1;i<N;i++){
      int nn=n[i-1];
      int dd=d[i-1];
      v[i].first = v[nn].first+dx[dd];
      v[i].second = v[nn].second+dy[dd];
      xmax=max(xmax,v[i].first);
      xmin=min(xmin,v[i].first);
      ymax=max(ymax,v[i].second);
      ymin=min(ymin,v[i].second);
    }
    cout << xmax-xmin+1 << " " << ymax-ymin+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T, class Compare = less<>>
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template <class T, class Compare = greater<>>
using MinHeap = priority_queue<T, vector<T>, Compare>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline istream& operator>>(istream &is, vector<T> &vec) {
    for (auto &e: vec) {
        is >> e;
    }
    return is;
}

inline void output() { cout << "\n"; }
template <class Head, class... Tail>
inline void output(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) {
        cout << " ";
    }
    output(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        os << e << delim[&e == &vec.back()];
    }
    return os;
}

template <class T>
inline vector<T> makeVector(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeVector(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeVector<T>(initValue, args...))>(sz, makeVector<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

template <class T>
inline bool chmax(T &a, const T &b) noexcept {
    return b > a && (a = b, true);
}

template <class T>
inline bool chmin(T &a, const T &b) noexcept {
    return b < a && (a = b, true);
}

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// End Header }}}

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

    var(intmax_t, x, y);

    intmax_t res = 1;
    while (x * 2 <= y) {
        x *= 2;
        res++;
    }

    output(res);

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		//long n = sc.nextLong();
		//long m = sc.nextLong();
		//long k = sc.nextLong();

		if(s.compareTo(t)<0) {
			System.out.println("<");
		}else if(s.compareTo(t)>0){
			System.out.println(">");
		}else {
			System.out.println("=");
		}
		//System.out.println(s.compareTo(t));
	}
}




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

int main(){
  int k;
  cin >> k;
  
  int ans = 0;
  for (int a=1;a<=k;++a){
    for (int b=1;b<=k;++b){
      for (int c=1;c<=k;++c){
        ans+=gcd(gcd(a,b),c);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3636
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
public class Main {
	final int INF = (int)1e9 + 7;
	int N,M;
	int[] a,b,d;
	ArrayList<Integer>[] graph;
	int[][] cost;
	private class P implements Comparable<P>{
		int first,second;
		public P(int first,int second){
			this.first = first;
			this.second = second;
		}
		public int compareTo(P p){
			if(this.first == p.first){
				return this.second - p.second;
			}
			return this.first - p.first;
		}
	}

	public int dijkstra(int s){
		boolean[] used = new boolean[N];
		int ret = 0;
		PriorityQueue<P> pq = new PriorityQueue<P>();
		pq.add(new P(0,s));
		while(pq.size() > 0){
			P p = pq.poll();
			if(used[p.second])continue;
			used[p.second] = true;
			ret+=p.first;
			for(int next : graph[p.second]){
				pq.add(new P(cost[p.second][next],next));
			}
		}
		return ret;
	}

	@SuppressWarnings("unchecked")
	public void solve() {
		while(true){
			N = nextInt();

			if(N == 0)break;

			M = nextInt();
			a = new int[M];
			b = new int[M];
			d = new int[M];
			graph = new ArrayList[N];
			cost = new int[N][N];
			for(int i = 0;i < N;i++){
				graph[i] = new ArrayList<Integer>();
			}
			for(int i = 0;i < M;i++){
				String[] line = next().split(",");
				a[i] = Integer.parseInt(line[0]);
				b[i] = Integer.parseInt(line[1]);
				d[i] = (Integer.parseInt(line[2]) / 100) - 1;
				cost[a[i]][b[i]] = d[i];
				cost[b[i]][a[i]] = d[i];
				graph[a[i]].add(b[i]);
				graph[b[i]].add(a[i]);
			}
			out.println(dijkstra(0));
		}
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 30584
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		int max_L = 0;
		int min_R = N;

		for(int i=0;i<M;i++) {
			int L = sc.nextInt();
			int R = sc.nextInt();

			if(max_L <= L) {
				max_L = L;
			}

			if(R <= min_R) {
				min_R = R;
			}
		}

		int ans = min_R - max_L + 1;
		if(ans > 0) {
			System.out.println(ans);
		}else {
			System.out.println(0);
		}
	}
}


Measured memory_bytes: 63368
N = int(input())
A = list(map(int,input().split()))
ans = 0

for n in range(A[-1]//2):
  for a in A:
    if a%2 == 1:
      print(ans)
      exit()
  for n in range(N):
    A[n] = A[n]/2
  ans+=1
  
print(ans)

Measured memory_bytes: 9180
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};
//vector<int> bucket[MAX_N/1000];

int dp[1000001][2][2];

int main(void){
    int N;
    cin >> N;
    dp[0][0][0]=1;
    rep(i,N) rep(j,2) rep(k,2){
        rep(d,10){
            int i2=i+1,j2=j,k2=k;
            if(d==0) j2|=1;
            if(d==9) k2|=1;
            dp[i2][j2][k2]=(dp[i2][j2][k2]+dp[i][j][k])%MOD;
        }
    }
    cout << dp[N][1][1] << endl;
}


Measured memory_bytes: 19204
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;
#define int long long


//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int n,k;
  cin >> n >> k;
  int r,s,p;
  cin >> r >> s >> p;
  string t;
  cin >> t;
  int ans = 0;
  vector<vector<int>> dp(n, vector<int>(3,0));
  for(int i = 0 ; i < k; i++){
  	int j = i;
  	for(j = i ; j < n ; j += k){
  		if(j > i){
  			dp[j][0] = max(dp[j-k][1],dp[j-k][2]);
  			dp[j][1] = max(dp[j-k][0],dp[j-k][2]);
  			dp[j][2] = max(dp[j-k][0],dp[j-k][1]);
  		}
  		if(t[j] == 'r'){
  			dp[j][0] += p;
  		}
  		else if(t[j] == 's'){
  			dp[j][1] += r;
  		}
  		else{
  			dp[j][2] += s;
  		}
  	}
  	ans += *max_element(dp[j-k].begin(),dp[j-k].end());
  }

  cout << ans << endl;
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Measured memory_bytes: 5840
#include<bits/stdc++.h>
using namespace std;
#define R 111
int n,ax[R],ay[R],bx[R],by[R];
bool g[R][R],B[R];int lk[R];
bool fd(int x){
	for(int i=1; i<=n; i++){
		if(g[x][i] && !B[i]){
			B[i] = true;
			if(lk[i]==-1 || fd(lk[i])){
				lk[i] = x;
				return true;
			}
		}
	}
	return false;
}
int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; i++)
		scanf("%d%d",&ax[i],&ay[i]);
	for(int i=1; i<=n; i++)
		scanf("%d%d",&bx[i],&by[i]);
	for(int i=1; i<=n; i++)
		for(int j=1; j<=n; j++)
			if(ax[i] < bx[j] && ay[i] < by[j])
				g[i][j] = true;
	int ret=0;
	memset(lk,-1,sizeof(lk));
	for(int i=1; i<=n; i++){
		memset(B,0,sizeof(B));
		if(fd(i))
			ret++;
	}
	printf("%d\n",ret);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
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;}

const ll mod = 1000000007;

ll mpow(ll a, ll x){
  if(x<0) return 0;
  ll res = 1;
  while(x > 0){
    if(x & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    x >>= 1;
  }
  return res;
}
int main(){
  int N; cin >> N;
  ll ans = 0;
  ans = mpow(10,N)-mpow(9,N)-mpow(9,N)+mpow(8,N);
  while(ans<0) ans += mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int a[505][505];
int H, W;

void debug() {
    cout << "-------" << endl;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
    cout << "-------" << endl;
}

int main() {

    vector<string> ans;

    cin >> H >> W;

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

    for (int i = 0; i < W; i++) {
        for (int j = 0; j < H-1; j++) {
            if (a[j][i] % 2 == 1) {
                a[j][i]--;
                a[j+1][i]++;
                ans.push_back( to_string(j+1) + " " + to_string(i+1) + " "
                        + to_string(j+2) + " " + to_string(i+1) );
            }
        }
    }

    for (int i = 0; i < W-1; i++) {
        if (a[H-1][i] % 2 == 1) {
            a[H-1][i]--;
            a[H-1][i+1]++;
            ans.push_back( to_string(H) + " " + to_string(i+1) + " "
                        + to_string(H) + " " + to_string(i+2) );
        }
    }

    cout << ans.size() << endl;

    for (auto& e: ans) {
        cout << e << endl;
    }

    return 0;
}


Measured memory_bytes: 11892
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, const char* argv[]) {
	long long z, t, n, m, a[200002],b[200002];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}
	long long max1=0, max2=0;
	for (int i = 0; i < n; i++) {
		if (a[i] > max1) {
			max1 = a[i];
		}
		else if (a[i] > max2) {
			max2 = a[i];
		}
	}
	for (int i = 0; i < n; i++) {
		if (a[i] != max1) {
			cout << max1 << endl;
		}
		else {
			cout << max2 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3200
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
        String ans = "Three";
        for(int i = 0; i < n; i++) {
          // 文字列の入力
		  if(sc.next().equals("Y")){
            ans = "Four";
            break;
          }
        }
    
		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int r,g,b,n; cin >>r>>g>>b>>n;
    int res=0;
    for(int i=0; i*r<=n; i++){
        for(int j=0; i*r+j*g<=n; j++){
            int rest=n-i*r-j*g;
            if(rest<0) continue;
            if(rest%b==0) res++;
        }
    }  
    cout<<res<<endl;
}

Measured memory_bytes: 3560
N = int(input())

W=[[int(_) for _ in input().split()] for __ in range(N)]  

W.sort(key=lambda x: x[1])

sum = 0
flg = False

for i in range(N):
    sum += W[i][0]
    if (sum > W[i][1]):
        flg = True
        break

if (flg):
    print('No')
else:
    print('Yes')

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

#define ll long long
#define F(i,a,b) for(int i=a;i<=b;++i)
#define R(i,a,b) for(int i=a;i<b;++i)
#define mem(a,b) memset(a,b,sizeof(a))

ll q,h,s,d;
ll n;
int main()
{
   cin>>q>>h>>s>>d;
   cin>>n;
   int qq=q*8,hh=h*4,ss=s*2;
   ll ans=0;
   //printf("%d %d %d %d\n",qq,hh,ss,d );
   if((d<=ss)&&(d<=hh)&&(d<=qq))
   {
      ans=ans+1LL*n/2*d;n%=2;
      if(qq<=hh&&qq<=ss) ans=ans+n*4*q;
      else if(hh<=qq&&hh<=ss) ans=ans+n*2*h;
      else ans=ans+n*s;
   }
   else
   {
      if(qq<=hh&&qq<=ss) ans=ans+n*4*q;
      else if(hh<=qq&&hh<=ss) ans=ans+n*2*h;
      else ans=ans+n*s;
   }
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256