akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);


int main(){
    IOS;
    ll n;cin>>n;
    ll sum=0;
    f(i,1,n+1){
        f(j,1,n+1){
            ll gc=__gcd(i,j);
           // cout<<"gc"<<gc<<endl;
            f(k,1,n+1){
                ll x=__gcd(gc,k);
                //cout<<i<<" "<<j<<" "<<k<<" "<<x<<"\n";
                sum+=x;
            }
        }
    }
    cout<<sum;
    return 0;  
} 





Measured memory_bytes: 3648
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


if sum(A) < sum(B):
    print(-1)
    exit()


surpluses = sorted([a - b for a, b in zip(A, B) if a - b > 0])
need = [b - a for a, b in zip(A, B) if b - a > 0]
need_sum = sum(need)

ans = len(need)
tmp = 0
while tmp < need_sum:
    ans += 1
    tmp += surpluses.pop()


print(ans)


Measured memory_bytes: 19068
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
"""
n,m = LI()
a = LI()
b = LI()
li = list(set(a)|set(b))
li2 = list(set(a)&set(b))
li.sort()
li2.sort()
print(len(li2),len(li))
for i in li2:
    print(i)
for i in li:
    print(i)
"""

#B
"""
n = I()
p = LI()
p.append(float("inf"))
ans = ""
i = 0
l = 0
k = [i+1 for i in range(n)]
while i < n:
    if p[i] < p[i+1]:
        a = p[l:i+1][::-1]
        if a != k[l:i+1]:
            print(":(")
            quit()
        l = i+1
        for d in range(len(a)):
            ans += "("
        for d in range(len(a)):
            ans += ")"
    i += 1
print(ans)
"""
#C
def fact(n):
    i = 2
    a = n
    if n < 4:
        return [1,n],[n]
    li = [1,n]
    while i**2 <= a:
        if n%i == 0:
            li.append(i)
            if i != n//i:
                li.append(n//i)
        i += 1
    li.sort()
    i = 2
    if len(li) == 2:
        return li,[a]
    k = []
    b = a
    while i**2 <= b:
        if a%i == 0:
            k.append(i)
            while a%i == 0:
                a//= i
        i += 1
    if a!=1:
        k.append(a)
    return li,k
n = I()
l,k = fact(n)
if len(l) == 2:
    print(1,1)
else:
    print(len(k),len(l)-1)
#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T



Measured memory_bytes: 8176
// https://atcoder.jp/contests/abc165/tasks/abc165_c
// n重ループ　全探索 O(10^10)に見えるが実は昇順制約で19C9=92378通り
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define is_in(i, s) (s.find(i) != s.end())
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef pair<int,int> P;

#define MAX_N 11
int N,M,Q;
struct EDGE{int a,c,d;};
vector<EDGE> e[MAX_N];
int A[10];

int calc(int i){
	if(i==N)return 0;
	int smax = 0;
	for(int j=A[i-1];j<=M;j++){
		int score=0;
		rep(k,e[i].size()){
			if(j-A[e[i][k].a]==e[i][k].c){
				score += e[i][k].d;
			}
		}
		A[i] = j;
		smax=max(smax,calc(i+1)+score);
	}
	return smax;
}

int main() {
	cin >> N >> M >> Q;
	rep(i,Q){
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		a--;b--;
		e[b].push_back(EDGE{a,c,d});
	}
	A[0]=1;
	cout << calc(1) << endl;

    return 0;
}



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

int main(void) {
	int y, m, d;
	char c, cc;
	cin >> y >> c >> m >> cc >> d;
	if(y < 2019)
		cout << "Heisei" << endl;
	else if(y == 2019){
		if(m <= 4)
			cout << "Heisei" << endl;
		else
			cout << "TBD" << endl;
	}
	else
		cout << "TBD" << endl;
	return 0;
}

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

using namespace std;

const int N = 55;

int n, a, x;
long long f[N][N * N][N];

int main() {
    cin >> n >> a;
    f[0][0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        cin >> x;
        for (int sum = 0; sum <= (i - 1) * 50; ++sum) {
            for (int cnt = 0; cnt <= (i - 1); ++cnt) {
                f[i][sum][cnt] += f[i - 1][sum][cnt];
                f[i][sum + x][cnt + 1] += f[i - 1][sum][cnt];
            }
        }
    }
    long long result = 0;
    for (int sum = 0; sum <= n * 50; ++sum) {
        for (int cnt = 1; cnt <= n; ++cnt) {
            if (sum == cnt * a)
                result += f[n][sum][cnt];
        }
    }
    cout << result << endl;
    return 0;
}


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

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

  long long n,q;
  cin >> n >> q;
  int a[n-1],b[n-1];
  long long p[q],x[q],value[n]={};
  vector<int> graph[n];
  for(int i=0;i<n-1;i++){
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    graph[a[i]].push_back(b[i]);
    graph[b[i]].push_back(a[i]);
  }
  for(int i=0;i<q;i++){
    cin >> p[i] >> x[i];
    p[i]--;
    value[p[i]]+=x[i];
  }
  bool visited[n];
  for(int i=0;i<n;i++){
    visited[i]=false;
  }
  queue<int> que;
  que.push(0);
  while(!que.empty()){
    int now=que.front();
    visited[now]=true;
    que.pop();
    for(size_t i=0;i<graph[now].size();i++){
      int next=graph[now][i];
      if(!visited[next]){
        que.push(next);
        value[next]+=value[now];
      }
    }
  }
  for(int i=0;i<n;i++){
    cout << value[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 21236
s = gets.chomp.split("")

def renzoku(ary)
  check = false
  (1..ary.length).map{|i|
    if ary[i] == ary[i-1] then
      check = true
    end
  }
  check
end

if renzoku(s) then
  puts "Bad"
else
  puts "Good"
end


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

int main() {
  char b;
  cin >> b;
  if(b == 'A')
    cout << 'T' << endl;
  
  if(b == 'T')
    cout << 'A' << endl;
  
  if(b == 'G')
    cout << 'C' << endl;
  
  if(b == 'C')
    cout << 'G' << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main()
{
    int n,W;
    cin>>n>>W;
    long int v[n+1];
    int w[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
    }
   long long int dp[n+1][W+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=W;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
            else if(w[i]<=j)
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]] + v[i]);
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[n][W];
    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int dp[41][401][401];
int inf = 1e5;

int main()
{
    int n, ma, mb;
    cin >> n >> ma >> mb;
    int a[n], b[n], c[n];

    rep(i, n) cin >> a[i] >> b[i] >> c[i];

    rep(i, 41) rep(s, 401) rep(t, 401)
        dp[i][s][t] = inf;

    dp[0][0][0] = 0;

    rep(i, n)
    {
        rep(s, 401)
        {
            rep(t, 401)
            {
                dp[i + 1][s][t] = min(dp[i + 1][s][t], dp[i][s][t]);
                if (s + a[i] > 400 || t + b[i] > 400)
                    continue;
                dp[i + 1][s + a[i]][t + b[i]] = min(dp[i + 1][s + a[i]][t + b[i]], dp[i][s][t] + c[i]);
            }
        }
    }

    int ans = inf;

    for (int s = 1; s <= 400; s++)
    {
        for (int t = 1; t <= 400; t++)
        {
            if (ma * t == mb * s)
                ans = min(ans, dp[n][s][t]);
        }
    }

    cout << (ans == inf ? -1 : ans) << endl;

    return 0;
}

Measured memory_bytes: 25984
N=int(input())
x=[int(i) for i in input().split()]
ans=1
index=0
advance=0
devide=10**9+7

while True:
	if 2*(index-advance)+1 <= x[index]:
		index+=1
		if index==N:
			break
	else:
		ans*=(index-advance+1)#need concern
		ans%=devide
		index+=1
		advance+=1
		if index==N:
			break
for i in range(index-advance,0,-1):
	ans*=i
	ans%=devide
print(ans)

Measured memory_bytes: 14492
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <ctime>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

map<ll,ll> prime_factor(ll n){
	map<ll,ll> mp;
	for(ll i=2; i*i<=n; i++){
		while(n % i == 0){
			mp[i]++;
			n /= i;
		}
	}
	if(n != 1) mp[n] = 1;
	return mp;
}

int main(){
	ll n; cin >> n;
	auto pri = prime_factor(n);
	ll ans = 0;
	for(auto i : pri){
		ll ok = 0, ng = 100;
		while(ng - ok > 1){
			ll mid = (ok+ng)/2;
			if(mid*(mid+1)/2 <= i.second) ok = mid;
			else ng = mid;
		}
		ans += ok;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3632
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N, A, B;
  cin >> N >> A >> B;
  // const int64_t L = static_cast<int64_t>(T.length());
  vector<int64_t> X(N);
  vector<int64_t> dist(N, 0);
  int64_t result = 0;
  for (int64_t i = 0; i < N; ++i) {
    cin >> X[i];
    if (i > 0) {
      result += min(B, (X[i] - X[i - 1]) * A);
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 4744
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int dp[100009];
int L=24000;
bool ch (int x, vector< int> a)
{
    memset(dp,0,sizeof(dp));
    dp [L] = 1;
    for (int i = 0 ; i < a.size(); i++)
    {
        int K = a[i];
        for (int i = 2*L; i >= max (K, 0) ; i--)
            dp[i] = max (dp[i] , dp[i-K]);
    }
    return dp[x];
}
main()
{
    string s;
    int x, y;
    cin>> s >> x >> y;
    x += L;
    y += L;
    vector < int > X,Y;
    int i=0;
    while (i<s.size() && s[i]=='F')
        x--,i++;
        i++;
        int c=0,d=0;
    for (i; i < s.size(); i++)
    {

        if (s[i] == 'T')
        {
            if (c%2 == 0)
                Y.push_back(2*d);
            else
                X.push_back(2*d);
            c++;
            d = 0;
        }
        else
        {
            d++;
        }

    }
    if (c%2 == 0)
                Y.push_back(2*d);
            else
                X.push_back(2*d);
    int xx=X.size(),yy=Y.size();
    for (int i = 0; i < xx; i++)
        x+=X[i]/2;
    for (int i = 0; i < yy; i++)
        y+=Y[i]/2;
    if(ch(x,X) && ch(y,Y)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 768
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;

bool check(int a, int b) {
	return a > b;
}

int main() {
	int a, b;
	cin >> a >> b;
	if (b%a == 0) {
		cout << a + b << endl;
	}
	else {
		cout << b - a << endl;
	}
	return 0;
}


Measured memory_bytes: 256
# python 3.8.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
from math import gcd
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def lcm(a,b):return (a*b) // gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def lprint(l): print(*l, sep='\n')
def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N,M = imn()
A = iln()

if N-sum(A) >= 0:
    print(N-sum(A))
else:
    print(-1)


Measured memory_bytes: 11460
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
typedef long long ll;
using namespace std;
 
int main(){
    int N; cin >> N;
    vector <int> A(N+1);
    A[N]=1e9;
    rep(i,N) cin >> A[i];
    sort(A.begin(),A.end());
    int ans=0;
    
    for (int i=0; i<N-2; i++){
        for (int j=i+1; j<N-1; j++){
            int k=j+1;
            while((A[i]+A[j])>A[k]){
                ans++;
                k++;
            }
        }
    }
    cout << ans;
    
    
}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1e9 + 7;
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; }
const ll inf = 1ll << 60;

const int n_max = 110;
const int v_max = 100100;

int n;
ll W;
vector<ll> w(n_max);
vector<ll> v(n_max);
vector<vector<ll>> dp(n_max, vector<ll>(v_max, inf));

int main() {
    scanf("%d%lld", &n, &W);
    rp(i, 0, n) scanf("%lld%lld", &w.at(i), &v.at(i));

    //初期条件
    dp.at(0).at(0) = 0;
    //これだけでいいらしい
    //たしかに、それ以降は0を引き継ぐのか

    //遷移
    rp(i, 0, n) {
        //i(0~n-1)番目の商品について考える
        //対応するdpはdp.at(i+1)
        //これはdp.at(0)を初期条件としたため
        //ただ、iを1からとすると、wやvを考えるときにw.at(i-1)としなくちゃいけない
        rp(sum_v, 0, v_max) {
            chmin(dp.at(i+1).at(sum_v), dp.at(i).at(sum_v));
            if(sum_v - v.at(i) >= 0) chmin(dp.at(i+1).at(sum_v), dp.at(i).at(sum_v-v.at(i)) + w.at(i));
        }
    }
    int res = 0;
    rp(j, 0, v_max) if(dp.at(n).at(j) <= W) res = j;
    printf("%d", res);
    return 0;
} 

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

int main() {
  string s;
  cin >> s;
  int x, y;
  cin >> x >> y;
  vector<int> X, Y;
  int n=0;
  for (int i=0; i<s.size(); i++) {
    if (s[i]=='T') {
      (X.size()==Y.size()?X:Y).push_back(n);
      n=0;
    } else {
      n++;
    }
  }
  (X.size()==Y.size()?X:Y).push_back(n);
  int b=X[0], c=0;
  sort(X.begin()+1,X.end());
  sort(Y.begin(),Y.end());
  
  for (int i=X.size()-1; i>=1; i--) {
    b+=X[i]*(b>x?-1:1);
  }
  for (int i=Y.size()-1; i>=0; i--) {
    c+=Y[i]*(c>y?-1:1);
  }
  printf("%s\n",((b==x && c==y)?"Yes":"No"));
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict
from heapq import heapify, heappush
n,m=map(int,input().split())
s=[tuple(map(int,input().split())) for _ in range(m)]
def hl():
  ret=[]
  heapify(ret)
  return ret
d=defaultdict(hl)
for x in s:
  heappush(d[x[0]],-x[1])
  heappush(d[x[1]],-x[0])
for e in d[1]:
  if d[-e][0]==-n:
    print('POSSIBLE')
    sys.exit()
print('IMPOSSIBLE')

Measured memory_bytes: 75968
import heapq
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort(key=lambda x:x[0])

res = 0
q = []
pos = 0
heapq.heapify(q)
for i in range(1,M+1):
    x = 0
    #queueへの追加
    while pos <= N-1:
        if AB[pos][0] <= i:
            heapq.heappush(q,AB[pos][1]*-1)
            pos += 1
        else:
            break
    #queueからの取り出し
    if len(q) != 0:
        x = heapq.heappop(q)
    res += x*-1
print(res)

Measured memory_bytes: 82776
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
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; }

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    ll n;
    cin >> n;
    vll a(n), b(n);
    REP(i, n) {
        cin >> a[i] >> b[i];
    }
    VSORT(a);
    VSORT(b);
    ll lb, ub, res;
    if (n % 2) lb = a[n / 2], ub = b[n / 2];
    else lb = (a[n / 2 - 1] + a[n / 2]), ub = (b[n / 2 - 1] + b[n / 2]);
    res = ub - lb + 1;
    cout << res << endl;
    return 0;
}

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

int main(){
  string S;
  cin >> S;
  stack<char> A;
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='S'){
      A.push('S');
    }
    else if(S.at(i)=='T' && A.size()!=0 && A.top()=='S'){
      A.pop();
    }
    else{
      A.push('T');
    }
  }
  cout << A.size() << endl;
}

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

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

int x, a;

int main() {
	read(x), read(a);
	write(x < a ? 0 : 10);
	putchar('\n');
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int ans = n/2;
    if(n%2==1) ans = n/2+1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var x int
	fmt.Scan(&x)
	if x <= 3 {
		fmt.Println(1)
		return
	}
	ans := 1
	for i := 2; i <= x; i++ {
		v := i * i
		for v <= x {
			if ans < v {
				ans = v
			}
			v *= i
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int INF=0x3f3f3f3f;
const int maxn=5e3+7;
const int mod=1e9+7;
const int MAXN=705;

int d[MAXN][MAXN];
int col[MAXN];
int n,m;
int cnt[2];

void dfs(int u,int c)
{
    col[u]=c;
    cnt[c==1]++;
    for(int i=1;i<=n;++i)
    {
        if(i==u || d[u][i]) continue;
        if(!col[i]) dfs(i,-c);
        else if(col[i]==col[u])
        {
            dbg(i,u);
            puts("-1");
            exit(0);
        }
    }
}

int t[MAXN<<1],s[MAXN];
int main()
{
    cin>>n>>m;
    for(int i=1;i<=m;++i)
    {
        int x,y; cin>>x>>y;
        d[x][y]=d[y][x]=1;
    }       
    s[0]=1;
    for(int i=1;i<=n;++i)
    {
        if(col[i]) continue;
        cnt[0]=cnt[1]=0;
        dfs(i,1);
        memset(t,0,sizeof t);
        for(int j=0;j<=n;++j)
        {
            t[j+cnt[0]]|=s[j];
            t[j+cnt[1]]|=s[j];
        }
        for(int j=0;j<=n;++j)
            s[j]=t[j];
    }
    int ans=INF;
    for(int i=0;i<=n;++i)
    {
        if(s[i]) ans=min(ans,i*(i-1)/2+(n-i)*(n-i-1)/2);
    }
    print(ans);
}



Measured memory_bytes: 5552
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
 */
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);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        int f(int x) {
            int c = 0;
            while (x % 2 == 0) {
                x /= 2;
                ++c;
            }
            return c;
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int max = 0, res = 1;
            for (int i = 1; i <= n; ++i) {
                if (f(i) > max) {
                    res = i;
                    max = Math.max(max, f(i));
                }
            }
            out.println(res);
        }

    }

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

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

    }
}



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

int main(){
    int X,Y,Z,a=0;
    cin >> X>>Y;
    for (int i = 0; i < X+1; i++)
    {
      Z=i*2+(X-i)*4;
        if(Z==Y) a=1;
    }
    
    if (a==1)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    


}



Measured memory_bytes: 3588
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
#include <numeric>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back

#define INT 1.01

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

    int64_t X, v = 100; //intにすると大幅に遅くなる（2ms -> 2005ms）

    cin >> X;

    rep(ret, INF){ //whileにしても実行時間に大きな差はない
        if(X<=v){
            cout << ret << endl;
            break;
        }
        v *= INT;
    }

    /*
    int ret=0;
    while(true){
        ret++;
        v *= INF;
        if(X<=v) break;
    }
    cout << ret << endl;
    */

    return 0;
}


/* 以下悪いコード

#define INT 1.01

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

    ll X;
    cin >> X;

    int ret = 0, v = 100;
    while(true){
        ret ++;
        v *= INT;
        if(X<=v) break;
    }

    cout << ret << endl;

    return 0;
}
*/

Measured memory_bytes: 3612
class UnionFind:

    def __init__(self,n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x,y = y,x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

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

friends = [list(map(int,input().split())) for _ in range(m)]

uf = UnionFind(n)

for a,b in friends:
    uf.union(a-1,b-1)

ans = 0

for i in range(n):
    ans = max(ans, uf.size(i))
print(ans)


Measured memory_bytes: 112012
#pragma GCC optimize("Ofast")

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pop_b pop_back
#define pf push_front
#define pop_f pop_front
#define mt make_tuple
#define eb emplace_back
#define sf(x) sizeof(x)
#define len(x) x.length()
#define sz(x) x.size()
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define LB(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define UB(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef long long ll;
typedef pair<ll,ll> ii;
typedef long double ld; 
typedef vector<int> vi;
typedef vector<set<ll>> vset;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef deque<ll> dql;
typedef deque<int> dqi;
typedef unsigned long long ull;
typedef tuple<int,int,int> State;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << ", ";
	err(++it, args...);
	cout<<"\n";
}

#define vmax(type)   std::numeric_limits<type>::max()
#define vmin(type)   std::numeric_limits<type>::min()
#define each(a,x) for( auto &a:(x))
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rep2(i, l, r) for (ll i = (l); i < (r); i++)
#define rep2r(i, l, r) for (ll i = (r) - 1; i >= (l); i--)
#define range(a) a.begin(), a.end()
#define deb(x) cout<<#x<<" "<<x<<endl;
#define cinai(a, n) vi a(n); rep(i, n) { cin>>a[i]; }
#define cinal(a, n) vl a(n); rep(i, n) { cin>>a[i]; }
#define coutai(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define coutal(a, n) rep(i, n) { cout<<a[i]<<" "; } ent;
#define ent cout<<endl;
#define resize_vec(a) a.resize(unique(a.begin(), a.end()) - a.begin());
#define ms(dp, x) memset(dp, x, sf(dp))
#define endl '\n'

ll powm(ll a, ll b, ll mod) {
	ll res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

const ll mod = 1e9 + 7;
const ll N = 1000005;
const ll inf = 1e9;

void solve()
{
	int n;
	cin>>n;
	cinal(a, n);
	sort(range(a));
	int cnt = 0;
	rep(i, n){
		rep2(j, i+1, n){
			rep2(k, j+1, n){
				if(a[i] != a[j] and a[j] != a[k] and a[k] != a[i] and (a[i]+a[j] > a[k])){
					// cout<<i<<" "<<j<<" "<<k<<endl;
					cnt++;
				}
			}
		}
	}	
	cout<<cnt<<endl;
}

// #define _DEBUG 
// #define testCases
signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cout << fixed << setprecision(15);
	
	int tc = 1;
#ifdef testCases
	cin>>tc;
#endif
	while(tc--)
	{
#ifdef _DEBUG
	int tt = clock();
#endif
		solve();
		
#ifdef _DEBUG
		cerr << "TIME = " << clock() - tt << endl;
		tt = clock();
#endif
	}
	return 0;
}



Measured memory_bytes: 3652
N,K=map(int,input().split())
S=[0]*(N+1);cnt=0
for i in range(K):
  d=int(input())
  A=list(map(int,input().split()))
  for i in range(d):
    S[A[i]] +=1
#print(S)
for i in range(1,N+1):
  if S[i]==0:
    cnt=cnt+1
print(cnt)

Measured memory_bytes: 9200
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int n,d,x;
    int a[105];
    while(cin>>n>>d>>x&&n)
    {
        int sum=0;
      for(int i=0;i<n;i++)
        {cin>>a[i];
        sum=sum+(d-1)/a[i];
        }
        sum=sum+x+n;
        cout<<sum<<endl;
    }
}


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

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

  for(auto c:v){cout << c << endl;}
}

Measured memory_bytes: 4052
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int[][] a = new int[100][2];

        int i;

        for (i = 0;; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();

            if (a[i][0] == 0 && a[i][0] == 0) {
                break;
            }
        }

        for (int l = 0; l < i; l++) {
            for (int j = 0; j < a[l][1]; j++) {
                System.out.print("#");
            }
            System.out.print("\n");
            for (int k = 0; k < a[l][0] - 2; k++) {
                System.out.print("#");
                for (int j = 0; j < a[l][1] - 2; j++) {
                    System.out.print(".");
                }
                System.out.print("#");
                System.out.print("\n");
            }
            for (int j = 0; j < a[l][1]; j++) {
                System.out.print("#");
            }
            System.out.print("\n");
            System.out.print("\n");
        }

        sc.close();
    }
}


Measured memory_bytes: 37224
#include <vector>
#include <iostream>
#include <sstream>

using namespace std;
using graph = vector< vector< pair<int, int> > >;
using i64 = int64_t;
using pii = pair<int, int>;
using piii = pair< pair<int, int>, int>;

pii dfs(graph &g, vector<bool> &vis, int cur){
    vis[cur] = true;
    if(g[cur].size() == 1)return pii(-1, -1);
    pii ret, tmp;
    for(auto&& t:g[cur]){
        if(vis[t.first])continue;
        tmp = dfs(g, vis, t.first);
        if(tmp.second == -1)tmp = pii(0, cur);
        else tmp.first += t.second;
        ret = max(ret, tmp);
    }
    return ret;
}

int main(){
    int nv; 
    while(cin >> nv, nv){
        cin.ignore();
        graph g(nv);
        string con, cost;
        getline(cin, con);
        getline(cin, cost);
        stringstream scon, scost;
        scon << con; scost << cost;
        vector<piii> d;
        for(int i=1;i<nv;i++){
            int t, c;
            scon >> t; scost >> c;
            g[--t].emplace_back(i, c);
            g[i].emplace_back(t, c);
            d.emplace_back(pii(i, t), c);
        }
        int res = 0;
        for(auto&& x:d){
            int c = g[x.first.first].size() > 1 && g[x.first.second].size() > 1 ? 3 : 1;
            res += c * x.second;
        }
        int p = 0;
        while(g[p].size() < 2)p++;
        vector<bool> vis(nv, false);
        pii par = dfs(g, vis, p);
        vis.assign(nv, false);
        pii rem = dfs(g, vis, par.second);
        cout << res - rem.first << endl;
    }
}


Measured memory_bytes: 3404
#include<iostream>
#include<iomanip>
#include<cmath> 
using namespace std;
 
int main(){
  double r;
  
  cin >> r;
  
  cout << fixed;
  cout << setprecision(6) << M_PI * r * r << " " << setprecision(6) << 2 * M_PI * r << endl;
  
  return 0;
}

Measured memory_bytes: 3244
/*input
2 1 0
1 2 1 1
1 1000000000
1 1
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=50+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
ll dp[maxn][5005];
vector<int> v[maxn];
int c[maxn],d[maxn];
struct edge{
    int u,v,a,b;
};
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n,m,s;
    cin>>n>>m>>s;
    MNTO(s,5004);
    vector<edge> v;
    REP(i,maxn) REP(j,5005) dp[i][j]=INF64;
    dp[0][s]=0;
    REP(i,m){  
        edge e;
        cin>>e.u>>e.v>>e.a>>e.b;
        --e.u;
        --e.v;
        v.pb(e);
    }
    REP(i,n){
        cin>>c[i]>>d[i];
    }
    REP(i,50){
        REP(i,m){
            REP(j,5005){
                if(j>=c[v[i].u]) MNTO(dp[v[i].u][j],dp[v[i].u][j-c[v[i].u]]+d[v[i].u]);
                if(j>=c[v[i].v]) MNTO(dp[v[i].v][j],dp[v[i].v][j-c[v[i].v]]+d[v[i].v]);
               if(j>=v[i].a) MNTO(dp[v[i].v][j-v[i].a],dp[v[i].u][j]+v[i].b);
               if(j>=v[i].a) MNTO(dp[v[i].u][j-v[i].a],dp[v[i].v][j]+v[i].b);
            }
        }
    }
    REP1(i,n-1){
        ll ans=INF64;
        REP(j,5005){
            MNTO(ans,dp[i][j]);
        }
        cout<<ans<<'\n';
    }
}


Measured memory_bytes: 5824
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define endl '\n'
#define int long long


array<int, 3> T[1000009];
void update(int N, int S, int E, int I, int V) {
        if (S == E) {
                if (V == 'R') T[N][0]++;
                else if (V == 'G') T[N][1]++;
                else T[N][2]++;
        } else {
                if (I <= (S + E) / 2) update(2 * N, S, (S + E) / 2, I, V);
                else update(2 * N + 1, (S + E) / 2 + 1, E, I, V);
                T[N][0] = T[2 * N][0] + T[2 * N + 1][0];
                T[N][1] = T[2 * N][1] + T[2 * N + 1][1];
                T[N][2] = T[2 * N][2] + T[2 * N + 1][2];
        }
}


array<int, 3> q(int N, int S, int E, int l, int r) {
        if (l > E || r < S) return {INT_MAX, INT_MAX, INT_MAX};
        if (S >= l && E <= r) return T[N];
        array<int, 3> a = q(2 * N, S, (S + E) / 2, l, r),
                b = q(2 * N + 1,(S + E) / 2 + 1, E, l, r), res{0,0,0};
        if (get<0>(a) != INT_MAX) {
                res = a;
        }
        if (get<0>(b) != INT_MAX) {
                res[0] += b[0];
                res[1] += b[1];
                res[2] += b[2];
        }
        return res;
}


int getDiff(char a, char b) {
        for (const auto w: {'R', 'G', 'B'})
                if (w != a && w != b)
                        return w;
}


signed main() { //[J][O][L][S][K][E][Y]
        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int n; cin >> n;
        char str[n + 1];
        for (int i = 1; i <= n; i++) {
                cin >> str[i];
                update(1, 1, n, i, str[i]);
        }


        int ans = 0;
        for (int i = 1; i <= n; i++) {
                for (int k = i + 2;  k <= n; k++) {
                        if (str[i] == str[k]) continue;
                        auto t = q(1, 1, n, i + 1, k - 1);
                        char c = getDiff(str[i], str[k]);
                        int cnt = 0;
                        if (c == 'R') cnt = t[0];
                        else if (c == 'G') cnt = t[1];
                        else cnt = t[2];
                        if ((k - i) % 2 == 0 && str[(i + k) >> 1] == c) cnt--;
                        ans += cnt;
                }
        }



        cout << ans;
        return 0;
}

/*

*/

Measured memory_bytes: 3844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc146/abc146_a.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  vector<string> w = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  string s;
  cin >> s;

  int wk;
  rep(i, 7) {
    if (w[i] == s) wk = i;
  }

  cout << 7 - wk << endl;
}

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

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

  if ((s[6] > '4') ||(s[5] == '1')){

    cout << "TBD" << endl;
  }
  else {
    cout << "Heisei" << endl;
  }
}

  




Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int i,n;
	ll a,x=0ll,y=0ll;
	std::cin >> n;
	for(i=0; i<n; ++i){
		std::cin >> a;
		add_mod(x,a);
		add_mod(y,a*a%MOD);
	}
	mul_mod(x,x);
	add_mod(x,MOD-y);
	mul_mod(x,(MOD+1)/2);
	std::cout << x << std::endl;
	return 0;
}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll a,b,c;
    cin >> a >> b >> c;
    for(int i=1;i<10001;i++){
        if((a*i) % b == c){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N, K;
	cin >> N >> K;
	vector<double> B(N);
	double ans = 0;
	double max = 0;
	double x;
	for (int i = 0;i < N;i++) {
		cin >> x;
		for (int j = 1; j <= x;j++) {
			B[i] += j * (1 / x);
		}
	}
	double l=0;
	for (int i = 0;i < K;i++) l += B[i];
	ans = l;
	for (int i = 0;i < N - K ;i++) {
		l -= B[i];
		l += B[i + K];
		if (l > ans) ans = l;
	}
	cout << fixed << setprecision(13) << ans << endl;
}


Measured memory_bytes: 1920
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
 
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		for(int i = 0;i < n;i++){
			a.add(sc.nextInt());
		}
		int min;int max;
		Collections.sort(a);
		min = a.get(0);
		max = a.get(n-1);
		System.out.println(Math.abs(max-min));
	}
}


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

const int INF = 100000000;

int binpow(int n, int k) {
    if (k == 0) return 1;
    if (k == 1) return n;
    if (k % 2 == 0) {
        int nn = binpow(n, k / 2);
        return nn*nn;
    }
    if (k % 2 == 1) {
        return n * binpow(n, k - 1);
    }
}

vector<int> d;
vector<int> res;

void solve() {
    int n, x, y;
    cin >> n >> x >> y;
    vector<vector<int>> g(n);
    d.resize(n);
    res.assign(n, 0);
    for (int i = 0; i < n - 1; i++) {
        g[i].push_back(i + 1);
        g[i + 1].push_back(i);
    }
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
    vector<bool> used(n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            d[j] = INF;
            used[j] = false;
        }
        d[i] = 0;
        used[i] = true;
        queue<int> q;
        q.push(i);
        while (!q.empty()) {
            int v = q.front();
            q.pop();
            for (int u : g[v]) {
                if (used[u]) continue;
                d[u] = d[v] + 1;
                q.push(u);
                used[u] = true;
            }
        }
        for (int i = 0; i < n; i++) {
            res[d[i]]++;
        }
    }
    for (int i = 1; i < n; i++) {
        cout << res[i] / 2 << endl;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <vector>
#include <stack>
#define INF 0x3f3f3f3f
#define MAXV  10001
using namespace std;
char map[1017][1017];
int m,n,x,d[1017][1017],drc[4][2]={-1,0,1,0,0,1,0,-1};
typedef pair<int,int> Point;
int bfs(int sx,int sy,int ex,int ey)
{
    queue<Point> que;
    for(int i=0;i<m;i++)
        for(int j=0;j<n;j++)
            d[i][j]=INF;
    d[sx][sy]=0;
    que.push(Point(sx,sy));
    while(!que.empty())
    {
        //cout<<"in"<<endl;
        Point cur = que.front(); que.pop();
        if(cur.first==ex&&cur.second==ey)
        {
            map[cur.first][cur.second]='.';
            break;
        }
        for(int i=0;i<4;i++)
        {
            //cout<<"here"<<endl;
            int nx = cur.first+drc[i][0];
            int ny = cur.second+drc[i][1];

            if((d[nx][ny]==INF)&&map[nx][ny]!='X')
            {
                d[nx][ny]=d[cur.first][cur.second]+1;
                //if(!(nx<0||nx>m-1||ny<0||ny<n-1))
                que.push(Point(nx,ny));
            }
        }
    }
    return d[ex][ey];
}
int main()
{
    memset(d,0,sizeof(d));
    scanf("%d%d%d",&m,&n,&x);
    bool start = false,ed = false;
    int ex[11]={0},ey[11]={0},ans=0,q=1,p=49;
    for(int i =0;i<m;i++)
            scanf("%s",map[i]);
    for(q=1;q<=x;q++,p++)
    for(int i=0;i<m;i++)
        for(int j=0;j<n;j++)
            {
                if(map[i][j]=='S')
                {
                    ex[0]=i;
                    ey[0]=j;
                }
                if(map[i][j]==p)
                {
                    ex[q]=i;
                    ey[q]=j;
                }
            }
    for(int i=0;i<x;i++)
        {
            ans+=bfs(ex[i],ey[i],ex[i+1],ey[i+1]);
            //cout<<i<<ex[i]<<"  "<<ey[i]<<endl;
            //cout<<ans<<endl;
            //cout<<i<<endl;
        }
    cout<<ans<<endl;
    return 0;
}

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

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

	int total = 0;
	for (int i = 0; i < N.length(); i++) {
		int num = N[i] - '0';
		total += num;
	}

	if (stoi(N) % total == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}
	


Measured memory_bytes: 256