akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a.begin(),a.end());
  vector<int> b(n);
  int ans=abs(a[0]-a[n-1]);
  ans+=abs(a[0]-a[n-2]);

  int l=1;
  int r=n-1;

  for(int i=0;i<n/2-1;i++){
    ans+=abs(a[l]-a[r]);
    ans+=abs(a[l+1]-a[r-1]);
    if(i%2==0)r-=2;
    else l+=2;
  }

  sort(a.begin(),a.end(),greater<int>());

  int ans2=abs(a[0]-a[n-1]);
  ans2+=abs(a[0]-a[n-2]);

  l=1;
  r=n-1;

  for(int i=0;i<n/2-1;i++){
    ans2+=abs(a[l]-a[r]);
    ans2+=abs(a[l+1]-a[r-1]);
    if(i%2==0)r-=2;
    else l+=2;
  }

  cout<<max(ans,ans2)<<endl;
}


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

int main()
{
    int N;
    int64_t D;
    cin >> N >> D;
    vector<int64_t> X_vec(N), Y_vec(N);
    for (int i = 0; i < N; ++i)
        cin >> X_vec.at(i) >> Y_vec.at(i);
    int cnt = 0;
    for (int i = 0; i < N; ++i) {
        int64_t X = X_vec.at(i);
        int64_t Y = Y_vec.at(i);
        if (X * X + Y * Y <= D * D)
            ++cnt;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 6420
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {

  int n; cin >> n;
  string s; cin >> s;
  int cnt = 0;
  int cntb = 0;
  for(auto e: s) {
    if (e == 'R') {
      cnt++;
    } else {
      cntb++;
    }
  }
  if (cnt > cntb) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

}


Measured memory_bytes: 256
a = [0,0,0,0,0]
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())
k = int(input())

re = 'Yay!'
for i in range(5):
    for j in range(5):
        if i != j:
            if abs(a[i] - a[j]) > k:
                re = ':('
                break
                
print(re)

Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(4000)

n = int(input())
p = [float(x) for x in input().split()]

dp = [[0]*(n+1) for i in range(n)]

dp[0][0] = 1-p[0]
dp[0][1] = p[0]

for i in range(n-1):
  for j in range(i+2):
    dp[i+1][j] += dp[i][j]*(1-p[i+1])
    dp[i+1][j+1] += dp[i][j]*p[i+1]

ans = 0
for i in range(n//2+1, n+1):
  ans += dp[n-1][i]
print(ans)

Measured memory_bytes: 253960
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int mod = 1e9 + 7;
int n;
int A[100001];
int cnt[100000];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> A[i];
        ++cnt[A[i]];
    }
    int ans = 1;
    for (int i = n - 1; i > 0; i -= 2) {
        if (cnt[i] != 2) {
            printf("0\n");
            return 0;
        }
        ans = (ans << 1) % mod;
    }
    if (cnt[0] != (n & 1)) {
        printf("0\n");
        return 0;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1024
program main
integer,allocatable :: a(:),b(:),c(:)
integer :: n,ans=0,i
read *,n
allocate(a(n),b(n),c(n-1))
read *,a,b,c

do i = 1,n
ans = ans + b(a(i))
if (a(i) == a(i-1) + 1) then
ans = ans + c(a(i-1))
end if
end do

print *,ans 
end program main

Measured memory_bytes: 256
#include <iostream> 
#include <vector>
#include <queue>
#include <cmath>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define ll long long
#define pb push_back
ll cnt[200005];
ll a[200005];
int main(int argc, char** argv) {
	int n;
	cin>>n;
	ll sum=0;
	rep(i,1,n)scanf("%lld",&a[i]),cnt[a[i]]++;
	rep(i,1,n)
	{
		sum+=cnt[i]*(cnt[i]-1)/2;
	}
	rep(i,1,n)
	{
		sum-=cnt[a[i]]*(cnt[a[i]]-1)/2;
		cnt[a[i]]--;
		sum+=cnt[a[i]]*(cnt[a[i]]-1)/2;
		printf("%lld\n ",sum);
		sum-=cnt[a[i]]*(cnt[a[i]]-1)/2;
		cnt[a[i]]++;
		sum+=cnt[a[i]]*(cnt[a[i]]-1)/2;
	}
	return 0;
}

Measured memory_bytes: 5368
#include <stdio.h>
#include <string.h>

int main(){
  int l, i, r;
  char n[1024];
  while(scanf("%s", n) && n[0] != '0'){
    l = strlen(n);
    for(r = i = 0; i < l; i++) r += n[i];
    printf("%d\n", r - l * '0');
  }
  return 0;
}


Measured memory_bytes: 2104
N = int(input())
X = list(map(int, input().split()))
Y = [[X[k],k] for k in range(N)]
Y.sort()
A = [0 for k in range(N)]

for k in range(N):
    if k >= N//2:
        A[Y[k][1]] = Y[N//2-1][0]
    else:
        A[Y[k][1]] = Y[N//2][0]

for x in A:
    print(x)

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

#define ed cout << "\n";
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long
#define ffor(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(i, n) ffor(i, 0, n)
#define All(obj) (obj).begin(), (obj).end()
#define INF ((ll)1e9 + 7)
#define c(a) cout << a << "\n";
using namespace std;
const int N = 100005;

int main()
{
    speed;
    cout << fixed << setprecision(6);
    /*start*/
    int a, b;
    cin >> a >> b;
    int ans = 6 - a - b;
    c(ans);
    ed;
    return 0;
}

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

int n;
char s[55][55];

int main() {	
	scanf("%d",&n);
	for(int i = 0; i < n; ++i)
		scanf("%s",s[i]);
	for(char c = 'a'; c <= 'z'; ++c) {
		int mn = 1<<20;
		for(int i = 0; i < n; ++i) {
			int f = 0;
			for(int j = strlen(s[i])-1; j >= 0; --j)
				f += s[i][j] == c;
			mn = min(f,mn);
		}
		while(mn--)
			printf("%c",c);
	}
	printf("\n");
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000

vector<int>e[N];
bool used[N];
int nd;
int di;
int z;

void dfs(int k,int x) {
	used[k] = true;
	if (nd < x) {
		nd = x;
		z = k;
	}
	if (di < x)di = x;
	f(i, e[k].size()) {
		if (!used[e[k][i]])dfs(e[k][i], x + 1);
	}
	return;
}


int main() {
	int n, k;
	int x, y;
	int s, ans;
	bool v = true;
	ans = 0;
	scanf("%d", &n);
	f(i, n-1) {
		scanf("%d %d", &x, &y);
		x--;
		y--;
		e[x].push_back(y);
		e[y].push_back(x);
	}
	nd = 0;
	z = 0;
	f(i, N)used[i] = false;
	dfs(0,0);
	nd = MOD;
	di = 0;
	f(i, N)used[i] = false;
	dfs(z,0);
	if(di%3==1)printf("Second\n");
	else printf("First\n");


	return 0;
}

Measured memory_bytes: 20736
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		while(sc.hasNext())
		{
			double value = sc.nextDouble();
			double min_t = value/9.8;
			double just = 4.9*min_t*min_t;
			int number = (int)((just+10)/5.0);
			System.out.println(number);
		}
	}
}

Measured memory_bytes: 18620
from collections import Counter
url = "https://atcoder.jp//contests/abc058/tasks/arc071_a"

def main():
    s = [input() for _ in range(int(input()))]
    isall = Counter(s[0])
    for k in isall:
        for row in s:
            c_count = row.count(k)
            if c_count < isall[k]:
                isall[k] = c_count
    isall = sorted(isall.items())
    for k, v in isall:
        print(k*v, end="")


if __name__ == '__main__':
    main()

Measured memory_bytes: 9432
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) < (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pii Dir[8] = { //移動
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define int ll
signed main(void) {
	int n, q;
	cin >> n >> q;
	ll sumsum = 0;
	vector<ll> a(n), x(q), rui(n + 1), oddrui(n + 1), everui(n + 1);
	vector<ll> ans(q);

	REP(i, n) {
		scanf("%lld", &a[i]);
		sumsum += a[i];
		rui[i + 1] = a[i] + rui[i];
		oddrui[i + 1] = oddrui[i] + (i % 2 ? a[i] : 0);
		everui[i + 1] = everui[i] + (i % 2 ? 0 : a[i]);
	}
	REP(i, q) {
		scanf("%lld", &x[i]);
	}

	REP(qnum, q) {
		ll target = x[qnum];

		int nearest = lower_bound(ALL(a), target) - a.begin();

		if (nearest == a.size()) nearest = a.size() - 1;
		else if(nearest > 0){
			if (abs(a[nearest] - target) > abs(a[nearest - 1] - target))
				nearest--;
		}

		auto calcturn = [&](int right) {

			int dist = a[right] - target;

			int leftbound = target - dist; //kore ijou ha hukumareru

			int lbound = lower_bound(ALL(a), leftbound) - a.begin();

			return right - lbound + 1;
		};

		int ri = a.size(), le = 0;
		
		while (ri-1 > le) {
			int mid = (ri + le) / 2;


			int turn = calcturn(mid);

			if (mid >= a.size() - turn) {//kabuttetara out
				ri = mid;
			}
			else le = mid;

		}
		int turn = calcturn(le);
		int amari = a.size() - turn - le - 1;

		int rightbound = le;
		int leftbound = le + 1 - turn - amari;
		leftbound = max(0LL, leftbound);
		int sum = Getsum(rui, max(0LL,leftbound), rightbound + 1);
		
		if (n % 2) {
			sum += oddrui[max(0LL,leftbound-1)];
		}
		else {
			sum += everui[max(0LL, leftbound - 1)];
		}
		printf("%lld\n", sumsum - sum);
	}

	return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int main() {
  string c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  string s;
  int n;
  cin >> n;
  cin >> s;
  for(ll i= 0; i< s.size(); i++){
    int pos = c.find(s.at(i));
    if(pos+n < 26){
      cout << c.at(pos+n); 
    } else {
      cout << c.at(pos+n - 26);
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

int main() {
  i64 M;
  cin >> M;
  vector<i64> D(M), C(M);
  rep(i,0,M) cin >> D[i] >> C[i];
  i64 ans = 0;
  i64 sum = 0;
  rep(i,0,M) {
    ans += C[i];
    sum += C[i] * D[i];
  }
  ans -= 1;
  while(sum >= 10) {
    ans += sum / 10;
    sum = sum % 10 + sum / 10;
  }
  cout << ans << endl;
}


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

int main(void) {
    int H,W;

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

    for(int i=0;i<W+2;i++) {
        cout << '#';
    }
    cout << endl;

    for(int i=0;i<H;i++) {
        cout << '#' << a[i] << "#\n";
    }

    for(int i=0;i<W+2;i++) {
        cout << '#';
    }
    cout << endl;

    return 0;
}


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

using namespace std;

int main(){
    long long N, M, ans, c;
    cin >> N >> M;
    if (2 * N <= M) {
        ans = N;
        M -= 2 * N;
        ans += M / 4;
        cout << ans << endl;
        return 0;
    }
    else {
        ans = M / 2;
        cout << ans << endl;
        return 0;
    }



    return 0;
}


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

using namespace std;
#define For(i,l,r) for (int i = l; i <= r; ++i)
#define Cor(i,l,r) for (int i = l; i >= r; --i)

int n, m, q, A[1111111], bound[1111111], vis[1111111];
vector<int> vec[1111111];
int main() {
	cin >> m >> n >> q;
	For(i,1,q) {
		scanf("%d", &A[i]);
		vec[A[i]].push_back(i);
	}
	For(i,1,m) bound[i] = q + 1;
	int id = 1;
	bool force = false ;
	Cor(i,q,1) {
		if (vis[A[i]]) continue ;
		int idx = vec[A[i]].size() - 1;
		bound[1] = vec[A[i]][idx];
		bool no = false ;		
		For(j,2,m) {
			if (--idx < 0) {
				no = true;
				break ;
			}
			while (bound[j] < vec[A[i]][idx]) {
				if (idx == 0) {
					no = true;
					break ;
				}
				--idx;
			}
			bound[j] = vec[A[i]][idx];
		}
		if (no) {
			force = true;
		}
		vis[A[i]] = true;
		if (force) {
			if (id == A[i]) {
				while (vis[id]) ++id;
				continue ;
			} else {
				puts("No");
				return 0;
			}
		}
		while (vis[id]) ++id;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 30592
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	string s;
	cin >> s;
	int count = 0;
	for (int i = 0; i < s.size(); i++) {
		if ((i + 1) % 2 == 0) {
			if (s[i] == 'L') {
				count++;
			}
			else if (s[i] == 'U') {
				count++;
			}
			else if (s[i] == 'D') {
				count++;
			}
			else {
				cout << "No" << endl; 
				exit(0);

			}
		}
		else if((i+1)%2==1){

			if (s[i] == 'R') {
				count++;
			}
			else if (s[i] == 'U') {
				count++;
			}
			else if (s[i] == 'D') {
				count++;
			}
			else {
				cout << "No" << endl;
				exit(0);
			}

		}
	}
	if (count = s.size()) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

N, M = map(int, readline().split())
L = [[] for i in range(N+1)]
R = [[] for i in range(N+1)]
for i in range(M):
    l, r, a = map(int, readline().split())
    L[l-1].append((r, a))

INF = 2**31-1

LV = (N).bit_length()
N0 = 2**LV
data = [0]*(2*N0)
lazy = [0]*(2*N0)

I = []; J = []
for x in range(N0+1):
    y = N0 + x
    z = (y // (y & -y)) >> 1
    J.append(2*z-1 if z else 0)
    r = []
    while z:
        r.append(z)
        z >>= 1
    r.reverse()
    I.append(r)
I.append([])

def propagates(ids):
    for i in ids:
        v = lazy[i-1]
        if not v:
            continue
        lazy[2*i-1] += v; lazy[2*i] += v
        data[2*i-1] += v; data[2*i] += v
        lazy[i-1] = 0

# update [0, r)
def update(r, x):
    #propagates(I[r])

    i = r
    while i:
        v = J[i]
        lazy[v] += x; data[v] += x
        i -= (i & -i)

    k = (J[r] + 1) >> 1
    while k:
        data[k-1] = max(data[2*k-1], data[2*k]) + lazy[k-1]
        k >>= 1

# update[k, k+1)
def update1(k, x):
    #propagates(I[k])
    k += N0
    data[k-1] += x
    while k:
        k >>= 1
        data[k-1] = max(data[2*k-1], data[2*k]) + lazy[k-1]


# query [0, r)
def query(r):
    return max(map(data.__getitem__, qquery(r)))

def qquery(r):
    propagates(I[r])

    while r:
        yield J[r]
        r -= (r & -r)

# query [k, k+1)
def query1(k, x):
    propagates(I[k])
    return data[k + N0 - 1]


for i in range(N):
    for r, a in L[i]:
        update(i+1, a)
        R[r].append((i, a))
    for l, a in R[i]:
        update(l+1, -a)
    v = query(i+1)
    update1(i+1, v)
for l, a in R[N]:
    update(l+1, -a)
sys.stdout.write("%d\n" % query(N+1))

Measured memory_bytes: 164216
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        ab: [(i64, i64)]
    }
    let mut ba = ab.into_iter().map(|(a, b)| (b, a)).collect::<Vec<_>>();
    ba.sort();
    let mut time = 0;
    for (b, a) in ba {
        time += a;
        if time > b {
            println!("No");
            return;
        }
    }
    println!("Yes");
}


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

int main() {
int b;
cin>>b;
    int a=(b%10);

if(a==2 || a==4 || a==5 || a==7 || a==9) {cout<<"hon"<<endl;}
if(a==0 || a==1 || a==6 || a==8){cout<<"pon"<<endl;}
if(a==3) {cout<<"bon"<<endl;}

}

Measured memory_bytes: 3636
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BStringPalindrome solver = new BStringPalindrome();
        solver.solve(1, in, out);
        out.close();
    }

    static class BStringPalindrome {
        public boolean isPalindrome(String x) {
            for (int i = 0; i < x.length() / 2; i++) {
                if (x.charAt(i) != x.charAt(x.length() - i - 1)) return false;
            }
            return true;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String x = in.next();
            if (isPalindrome(x.substring(0, x.length() / 2)) && isPalindrome(x) && isPalindrome(x.substring(x.length() / 2 + 1))) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



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


int main(){
	int h, w;
	cin >> h >> w;
	vector<string> raw(h);
	rep(i,h) cin >> raw[i];

	vector<string> picture(h+2);
	string tmp = "";
	rep(i,w+2){
	    tmp += "#";
	}
	picture[0] = tmp;
	picture[h+1] = tmp;

	rep(i,h){
	    picture[i+1] = "#" + raw[i] + "#";
	}
	for(auto str : picture){
        cout << str << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
 int main(){
 int n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n){
   cin >> a[i];
  }
  sort(a.begin(),a.end(),greater<>());
   int ans=0;
   rep(i,k){
       ans+=a[i];
   }
   cout << ans << endl;
   return 0;
 }

Measured memory_bytes: 3568
#include <iostream>

using namespace std;

int main() {
	int h, w, i, j;
	while (1) {
		cin >> h >> w;
		if (h == 0 && w == 0) {
			break;
		}
		for (i = 0; i < h; i++) {
			for (j = 0; j < w; j++) {
				if (i == 0 || i == h - 1 || j == 0 || j == w - 1) {
					cout << "#";
				}
				else {
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
	
	return 0;
}


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

class C
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var d = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();

		Console.WriteLine(d[n / 2] - d[n / 2 - 1]);
	}
}


Measured memory_bytes: 22112
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int a = 1;
  if (S.size() % 2 == 0) {
    for (int i = 0; i < S.size(); i += 2) {
      if (S.at(i) != 'h' || S.at(i+1) != 'i') {
        a = 0;
      }
    }
    if (a == 1) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
a, b, c, x, y = map(int, input().split())
cost1 = a * x + b * y
cost2 = c * max(x, y) * 2
if x < y:
    cost3 = c * x * 2 + b * (y - x)
elif y < x:
    cost3 = c * y * 2 + a * (x - y)
else:
    cost3 = cost1
print(min(cost1, cost2, cost3))


Measured memory_bytes: 2940
import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()


def solve():
    N, Q = map(int, input().split())
    edge = [[] for _ in range(N)]
    counter = [0 for _ in range(N)]

    for i in range(N - 1):
        a, b = map(int, input().split())
        a, b = a - 1, b - 1
        edge[a].append(b)
        edge[b].append(a)

    for i in range(Q):
        p, x = map(int, input().split())
        p = p - 1
        counter[p] += x

    q = deque()
    q.append(0)
    d = [-1 for _ in range(N)]
    d[0] = 1

    while q:
        v = q.popleft()
        for n_v in edge[v]:
            if d[n_v] == -1:
                counter[n_v] += counter[v]
                d[n_v] = 1
                q.append(n_v)

    for i in range(N):
        print(str(counter[i]) + ' ', end='')
    print()


if __name__ == '__main__':
    solve()


Measured memory_bytes: 94028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 1000010
#define rep(i, n) for(int i = 0; i < (n); ++i)
const ll mod = 1e9 + 7;

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

bool pairCompare(const P &firstElof, const P &secondElof) {
    return firstElof.second < secondElof.second;
}
ll a[MAXN];

int main() {
    ll n;
    cin >> n;
    rep(i, n) { cin >> a[i]; }
    ll sum_a = 0;
    ll ans = 0;
    rep(i, n - 1) {
        sum_a += a[i];
        sum_a %= mod;
        ans += sum_a * a[i + 1];
        ans %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5176
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
	int N = sc.nextInt();
    int[] H = new int[N];
    H[0] = sc.nextInt();
      int max = 0;
      int next = 0;
    for(int i=1;i<N;i++){
      H[i]=sc.nextInt();
      if(H[i]<=H[i-1]){
        next++;
      }else{
       if(max<next){
         max=next;
       }
        next=0;
      }
      if(i+1==N&&max<next){
        max=next;
      }
    }

      System.out.println(max);

    }
  
  private static long lcm(long m, long n) {
    return m * n / gcd(m, n);
}
  
  private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
    if(n == 0) return m;
    return gcd(n, m % n);
}
}

Measured memory_bytes: 50516
from itertools import accumulate

N = int(input())
S = input()

R = [0] + list(accumulate(int(s == "R") for s in S))
G = [0] + list(accumulate(int(s == "G") for s in S))
B = [0] + list(accumulate(int(s == "B") for s in S))

memo = {"R": R, "G": G, "B": B}

ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        if S[i] == S[j]:
            continue

        color = "RGB".replace(S[i], "").replace(S[j], "")
        C = memo[color]

        d = j - i
        x = N - j
        if d < x and S[j + d] == color:
            ans += C[N] - C[j] - 1
        else:
            ans += C[N] - C[j]

print(ans)

Measured memory_bytes: 69192
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
"""
n = 12
m = 3
a = [4, 56, 78, 901, 2, 345, 67, 890, 123, 45, 6, 789]
"""
for i in range(m):
    if sorted(a)[(i+1)*-1] * 4 * m < sum(a):
        print('No')
        exit()

print('Yes')


Measured memory_bytes: 3064
function Main(input){
  input = input.split("\n");
  inputStr = input[0].split(" ");
  var N = Number.parseInt(inputStr[0]);

  //引数に応じた結果を出力
  if( N===1 ){
    console.log(1);
  } else {
    if( N%2 === 0 ){
      console.log((N/2)/N);
    } else {
      console.log(((N+1)/2)/N);
    }
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H & b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H & b) const { return x == b.x && y == b.y; }
	bool operator!=(const H & b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T & a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T & a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n;
int a[400000];
bool solve(int t) {
	vector<H>v;
	v.push_back(H{ 1,0 });
	for (int i = 0; i < n; i++) {
		if (v[v.size() - 1].x < a[i]) {
			v.push_back(H{ a[i],1 });
		}
		else {
			while (!v.empty() && v[v.size() - 1].x > a[i]) v.pop_back();
			if (v[v.size() - 1].x == a[i]) v[v.size() - 1].y++;
			else v.push_back(H{ a[i],2 });
		}
		while (v.size() >= 2 && v[v.size() - 1].y == t + 1) {
			int k = v.size();
			if (v[k - 2].x == v[k - 1].x - 1) {
				v[k - 2].y++;
				v.pop_back();
			}
			else {
				k = v[k - 1].x - 1;
				v.pop_back();
				v.push_back(H{ k,1 });
			}
		}
		if (i == 0) v[0].y = 1;
	}
	if (v[0].y > t) return 0;
	return 1;

}
signed main() {
	cin >> n;
	bool b = 1;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (i > 0 && a[i - 1] >= a[i]) b = 0;
	}
	if (b) {
		cout << 1 << endl;
		return 0;
	}
	int l = 1, r = (1 << 30), t;
	while (r - l > 1) {
		t = (r + l) / 2;
		if (solve(t)) r = t;
		else l = t;
	}
	cout << r << endl;
}


Measured memory_bytes: 3816
N = int(input())
nums = list(map(int, input().split()))
sorted_nums = sorted(nums)

diff_count = 0
for i in range(N):
    if nums[i] != sorted_nums[i]:
        diff_count += 1

if diff_count == 0 or diff_count == 2:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n;
P p[100005];
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>p[i].first>>p[i].second;
    }
    sort(p,p+n);
    cout<<p[n-1].first+p[n-1].second<<endl;
    
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int min =n+1;
  int count =0;
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    if(min>a.at(i)){
      count++;
      min = a.at(i);
    }
  }
  cout << count << endl;
    
}




Measured memory_bytes: 1024
H, N = map(int, input().split())
A_list = []
for i in range(1, N+1):
    A_list.append("A_" + str(i))

A_list = map(int, input().split())
A_total = sum(A_list)

if A_total >= H:
    print("Yes")
else:
    print("No") 

Measured memory_bytes: 24240
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: u32,
        k: u32,
    }
    let p = k * (k - 1).pow(n - 1);
    println!("{}", p);
}


Measured memory_bytes: 4352
/**-------------------------
|--------From A.R.A--------|
-------------------------**/

#include <bits/stdc++.h>

#define ll            long long int
#define pb            push_back
#define ull           unsigned long long int
#define endl          "\n"
#define sz(c)         (c).size()
#define sall(c)       sort((c).begin(),(c).end())
#define rsall(c)      sort((c).rbegin(),(c).rend())
#define rev(c)        reverse((c).begin(),(c).end())
#define FOR(i,n)      for(ll i=0;i<n;i++)
#define max3(a,b,c)   max(max(a,b),c)
#define min3(a,b,c)   min(min(a,b),c)
#define input(a,i,n)  for(ll i=0;i<n;i++){      cin>>a[i];}
#define output(a,i,n) for(ll i=0;i<n;i++){cout<<a[i]<<" ";}

using namespace std;
int64_t R=1;
void solution(){
    int n;
    long double sum=0,x=0;
    cin>>n;
    for(int i=0,a;i<n;i++){
        cin>>a;
        x=x+(1.000/a);
    }
    cout<<setprecision(15)<<1.000/x<<endl;
}
int main()
{
    FOR(i,R){solution();}
    return 0;
}


Measured memory_bytes: 256
h, _ = gets.split.map(&:to_i)
arr = [].tap do |o|
  h.times { o << gets.chomp.chars }
end
arr.map.with_index do |row, i|
  r = row.map.with_index do |col, j|
    if col == '#'
      '#'
    else
      c = 0
      [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]].each do |a, b|
        c += 1 if arr.dig(a + i, b + j) == '#' && a + i >= 0 && b + j >= 0
      end
      c
    end
  end
  puts r.join
end

Measured memory_bytes: 2172
#include <iostream>
#include <string.h>
using namespace std;

char bits[11];
int main()
{
    long long ans = 0;
    int N;
    char S[11];
    cin >> S;
    N = strlen(S);
    for (int i = (1 << (N - 1)); i < (1 << N); ++i) {
        for (int j = 0; (1 << j) < (1 << N); ++j) {
            if (((1 << j) & i) != 0) {
                bits[j] = '1';
            } else {
                bits[j] = '0';
            }
        }
        long long nr = S[0] - '0';
        for (int j = 0; (1 << j) < (1 << N - 1); ++j) {
            if (bits[j] == '0') {
                nr = nr * 10 + (S[j + 1] - '0');
            } else {
                ans += nr;
                nr = (S[j + 1] - '0');
            }
        }
        if (nr != 0) {
            ans += nr;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define test(s) \
  if (!(s))     \
    cout << "Line " << __LINE__ << ": [" << #s << "] is false" << endl;
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion


signed main() {
  int N;
  cin >> N;
  string s;
  cin >> s;

  map<char, char> inv = {{'S', 'W'}, {'W', 'S'}};

  string ans;
  vector<string> heads = {"SS", "SW", "WS", "WW"};
  for (auto head : heads) {
    ans = head;
    repp(i, 1, N - 2) {
      char p = ans[len(ans) - 2];
      char c = ans[len(ans) - 1];
      if (c == 'S' ^ s[i] == 'x') {
        ans.pb(p);
      } else {
        ans.pb(inv[p]);
      }
    }

    bool ok = true;
    if (ans[0] == 'S' ^ s[0] == 'x') {
      if (ans[1] != ans[N - 1])
        ok = false;
    } else {
      if (ans[1] == ans[N - 1])
        ok = false;
    }

    if (ans[N - 1] == 'S' ^ s[N - 1] == 'x') {
      if (ans[0] != ans[N - 2])
        ok = false;
    } else {
      if (ans[0] == ans[N - 2])
        ok = false;
    }

    if (ok) {
      cout << ans << endl;
      return 0;
    }
  }
  cout << -1 << '\n';
}

Measured memory_bytes: 3652
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

vector<vector<char>> board;

int main(void) {
    int H, W;
    cin >> H >> W;

    board.resize(H + 2, vector<char>(W + 2, '.'));
    for (int h = 1; h <= H; h++) {
        for (int w = 1; w <= W; w++) {
            char c;
            cin >> c;
            if (c == '#') {
                board[h][w] = c;
            }
        }
    }

    bool ok = true;
    for (int h = 1; h <= H; h++) {
        for (int w = 1; w <= W; w++) {
            if (board[h][w] == '#') {
                if (board[h - 1][w] == '.' && board[h + 1][w] == '.'
                        && board[h][w - 1] == '.' && board[h][w + 1] == '.') {
                    ok = false;
                }
            }
        }
    }

    if (ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3628
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);


int main() {
	int n;
	while (cin >> n&&n) {
		bool flag[5001][5001] = {};
		int xpos[5001] = {}, ypos[5001] = {};
		for (int i = 0; i < n; i++) {
			cin >> xpos[i] >> ypos[i];
			flag[xpos[i]][ypos[i]] = true;
		}
		int ans = 0;
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j <= n; j++) {
				if (i == j)continue;
				int xl = xpos[i] - xpos[j];
				int yl = ypos[i] - ypos[j];
				if ((0 <= xpos[i] + yl && xpos[i] + yl <= 5000) && (0 <= ypos[i] - xl && ypos[i] - xl <= 5000) && (0 <= xpos[j] + yl && xpos[j] + yl <= 5000) && (0 <= ypos[j] - xl && ypos[j] - xl <= 5000)) {
					if (flag[xpos[i] + yl][ypos[i] - xl] && flag[xpos[j] + yl][ypos[j] - xl]) {
						ans = max(ans, xl*xl + yl*yl);
					}
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 27552
#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;

int main()
{
    int n, sheet;
    cin >> n;
    if(n % 2 == 0)
    {
        sheet = n / 2;
    }
    else if(n % 2 != 0)
    {
        sheet = n / 2;
        sheet++;
    }
    cout << sheet << endl;
    return 0;
}



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

int main(void){
 int y,m,d;
 char s;

 cin>>y>>s>>m>>s>>d;
 
 if(y<2019)cout<<"Heisei"<<endl;
 else if(m>4)cout<<"TBD"<<endl;
 else cout<<"Heisei"<<endl;
 
 return 0;
}

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

int main(){
	long long N, h, n;
	scanf("%lld", &N);
	for(h = 1; h <= 3500; h++){
		for(n = 1; n <= 3500; n++){
			if(4 * h * n > N * (h + n)){
				if((N * h * n) % (4 * h * n - N * (h + n)) == 0){
					printf("%lld %lld %lld\n", h, n, (N * h * n) / (4 * h * n - N * (h + n)));
					return 0;
				}
			}
		}
	}
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

/*
    (1,0) => (1,1)
    (0,1) => (-1,1)
    (x,y) => (x-y,x+y)
*/

pair<int,int> rotate45(int y,int x){
    return make_pair(y+x,-y+x);
}

void solve(){
    int H,W,d;
    cin >> H >> W >> d;

    vector<int> ys,xs;
    rep(i,0,H) rep(j,0,W){
        int i_=rotate45(i,j).first,j_=rotate45(i,j).second;
        ys.push_back(i_);
        xs.push_back(j_);
    }

    sort(ys.begin(),ys.end());
    sort(xs.begin(),xs.end());

    ys.erase(unique(ys.begin(),ys.end()),ys.end());
    xs.erase(unique(xs.begin(),xs.end()),xs.end());

    map<int,int> y_to_order,x_to_order;
    rep(i,0,ys.size()) y_to_order[ys[i]]=i;
    rep(i,0,xs.size()) x_to_order[xs[i]]=i;

    vector<int> color(H*W);
    rep(i,0,H){
        rep(j,0,W){
            int i_=rotate45(i,j).first,j_=rotate45(i,j).second;
            color[i*W+j]=(y_to_order[i_]/d*2+x_to_order[j_]/d+2000)%4;
        }
    }

    rep(i,0,H){
        rep(j,0,W){
            if(color[i*W+j]==0) cout << "R";
            else if(color[i*W+j]==1) cout << "Y";
            else if(color[i*W+j]==2) cout << "G";
            else cout << "B";
        }
        cout << endl;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
#define ts cout<<"ok"<<endl
#define int long long
#define hh puts("")
#define ls(x) ((x)<<1)
#define rs(x) ((x)<<1|1)
using namespace std;
int n,m,rt,cnt,w[1000005],c[1000005],head[1000005],num,mo;
int f[1000005],d[1000005],top[1000005],son[1000005],sz[1000005],id[1000005],rk[1000005];
int sum[4000005],tag[4000005];
struct Edge{
	int v,nx;
}e[1000005];
inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') ff=-ff;ch=getchar();}
    while(isdigit(ch)){ret=(ret<<3)+(ret<<1)+(ch^48);ch=getchar();}
    return ret*ff;
}
inline void add(int x,int y){
	e[++cnt].v=y;
	e[cnt].nx=head[x];
	head[x]=cnt;
}
void dfs1(int now,int fa){
	sz[now]=1;
	d[now]=d[fa]+1;
	for(int i=head[now];i;i=e[i].nx){
		int v=e[i].v;
		if(v==fa) continue;
		f[v]=now;
		dfs1(v,now);
		sz[now]+=sz[v];
		if(!son[now]||sz[son[now]]<sz[v]) son[now]=v;
	}
}
void dfs2(int now,int fa){
	id[now]=++num;
	rk[num]=now;
	top[now]=fa;
	if(son[now]) dfs2(son[now],fa);
	for(int i=head[now];i;i=e[i].nx){
		int v=e[i].v;
		if(f[now]==v||v==son[now]) continue;
		dfs2(v,v);
	}
}
inline void push_down(int l,int r,int k){
	int mid=(l+r)>>1;
	tag[ls(k)]=tag[ls(k)]+tag[k];
	tag[rs(k)]=tag[rs(k)]+tag[k];
	sum[ls(k)]=sum[ls(k)]+(mid-l+1)*tag[k];
	sum[rs(k)]=sum[rs(k)]+(r-mid)*tag[k];
	tag[k]=0;
}
void update(int l,int r,int x,int y,int v,int k){
	if(x<=l&&r<=y){
		tag[k]=tag[k]+v;
		sum[k]=sum[k]+(r-l+1)*v;
		return;
	}
	push_down(l,r,k);
	int mid=(l+r)>>1;
	if(x<=mid) update(l,mid,x,y,v,ls(k));
	if(mid+1<=y) update(mid+1,r,x,y,v,rs(k));
	sum[k]=sum[ls(k)]+sum[rs(k)];
}
int query(int l,int r,int x,int y,int k){
	if(x<=l&&r<=y) return sum[k];
	push_down(l,r,k);
	int mid=(l+r)>>1,res=0;
	if(x<=mid) res=res+query(l,mid,x,y,ls(k));
	if(mid+1<=y) res=res+query(mid+1,r,x,y,rs(k));
	return res;
}
inline void modify(int x,int y,int z){
	while(top[x]!=top[y]){
		if(d[top[x]]<d[top[y]]) swap(x,y);
		update(1,n,id[top[x]],id[x],z,1);
		x=f[top[x]];
	}
	if(id[x]>id[y]) swap(x,y);
	update(1,n,id[x],id[y],z,1);
}
inline int query_sum(int x,int y){
	int res=0;
	while(top[x]!=top[y]){
		if(d[top[x]]<d[top[y]]) swap(x,y);
		res=res+query(1,n,id[top[x]],id[x],1);
		x=f[top[x]];
	}
	if(id[x]>id[y]) swap(x,y);
	res=res+query(1,n,id[x],id[y],1);
	return res;
}
signed main(){
	n=read(),m=read(),rt=1;
	for(int i=1;i<n;i++){
		int x=read(),y=read();
		add(x,y);
		add(y,x);
	}
	dfs1(rt,0);
	dfs2(rt,0);
	for(int i=1;i<=m;i++){
		int x=read(),y=read();
		update(1,n,id[x],id[x]+sz[x]-1,y,1);
	}
	for(int i=1;i<=n;i++) printf("%lld ",query_sum(i,i));
    return 0;
}


Measured memory_bytes: 58880
#include<stdio.h>
int main(){
    int n, m, i, j;
    int a[105][105], b[105], res[105];
    scanf("%d %d",&n, &m);
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d", &a[i][j]);
        }
    }
    for(i=0;i<m;i++){
        scanf("%d", &b[i]);
    }
    for(i=0;i<n;i++){
        res[i] = 0;
        for(j=0;j<m;j++){
            res[i] += a[i][j] * b[j];
        }
    }
    for(i=0;i<n;i++){
        printf("%d\n", res[i]);
    }
return 0;
}



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

int main() {
  int n, a, min = -1;
  cin >> n;

  for(int i = 0; i < n; i++){
    cin >> a;
    int j = 0;
    while(a % 2 == 0){
      j++;
      a /= 2;
    }
    if(j < min || min < 0) min = j;
  }

  cout << min << endl;

}


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

int main(){
    int x;
    cin >> x;
    int a[x];
    for(int i=0; i<x; i++){
        cin >> a[i];
    }
    //プリント
        for(int k=0; k<x-1; k++){
            cout << a[k] << " ";
        }
        cout << a[x-1] << endl;
    //ソート
    for(int i=1; i<x; i++){
        int v = a[i];
        int j = i-1;
        while(j>=0 && a[j]>v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        //プリント
        for(int k=0; k<x-1; k++){
            cout << a[k] << " ";
        }
        cout << a[x-1] << endl;
    }

    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define rep(i, a) for (ll i = 0; i < (a); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
typedef long long ll;
typedef long double la;
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  int botton = 1;
  int count = 0;

  while(botton != 2){
    botton = a[botton-1];
    count++;
    if(count == 100000){
      cout << "-1" << endl;
      return 0;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

pub fn read<t: FromStr>() -> t {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: i64 = read();
    let b: i64 = read();
    let c: i64 = read();
    let d: i64 = read();

    if (a - c).abs() > d && ((a - b).abs() > d || (b - c).abs() > d) {
        println!("No");
    } else {
        println!("Yes")
    }
}


Measured memory_bytes: 4352