akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports)]
use proconio::input;
use proconio::marker::*;
use std::collections::{HashMap, HashSet};

fn main() {
  input! {
    n: usize,
    blues: [String;n],
    m: usize,
    reds: [String;m]
  }
  
  let mut map: HashMap<String, isize> = HashMap::new();
  
  for v in blues {
    let entry = map.entry(v).or_insert(0);
    *entry += 1;
  }
  
  for v in reds {
    let entry = map.entry(v).or_insert(0);
    *entry -= 1;
  }
  
  let mut max = 0;
  for (_, value) in map {
    max = std::cmp::max(value, max);
  }
  println!("{}", max);
}

Measured memory_bytes: 2124
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;
// << fixed << setprecision(0) <<

int main() {
ll n;
cin >> n;
int a[n];
int cnt=1;
bool flg=false;
REP(i,n) {
  cin >> a[i];
  if(a[i]==cnt) {
    cnt++;
    flg=true;
  }
}
if(flg) {
  cout << n-cnt+1 << endl;
} else {
  cout << "-1" << endl;
}
return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;

using ll = long long;
const int N = 1e5+5;

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

    int n,x,y;
    cin >> n >> x >> y;
    map<int,int> cnt;
    for(int i = 1; i <= n; ++i) {
        for(int j = i+1; j <= n; ++j) {
            int no_edge = j-i;
            int pp = abs(x-i) + abs(y-j) + 1;
            cnt[min(no_edge, pp)]++;
        }
    }
    for(int i = 1; i < n; ++i)
        cout << cnt[i] << "\n";
    return 0;
}


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

int candy_sum(int c){

  if (c==0) {
    return 0;
  }
  
  int cs = candy_sum(c-1);
  return cs + c;
}
 
int main() {
  int x, ans;
  cin >> x;
  ans = candy_sum(x);
  cout << ans << endl;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    t1,t2 = LI()
    a1,a2 = LI()
    b1,b2 = LI()

    if a1 > b1:
        a1,b1 = b1,a1
        a2,b2 = b2,a2

    sa = t1*a1 + t2*a2
    sb = t1*b1 + t2*b2

    if sa == sb:
        return "infinity"

    if sb > sa:
        return 0

    t = t1*b1 - t1*a1
    st = sa - sb
    if t % st == 0:
        r = t // st * 2
    else:
        r = t // st * 2 + 1

    return r


print(main())





Measured memory_bytes: 6936
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

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

int main(){
	int n;
	cin >> n;
	vector<pair<int, int> > r(n), b(n);
	for(int i=0; i<n; i++)
		cin >> r[i].first >> r[i].second;
	for(int i=0; i<n; i++)
		cin >> b[i].first >> b[i].second;
	sort(b.begin(), b.end());
	int ans=0;
	for(int i=0; i<n; i++){
		int tmp=-1;
		for(int j=0; j<n; j++){
			if(r[j].first<b[i].first && r[j].second<b[i].second){
				if(tmp==-1)
					tmp=j;
				else if(r[j].second>r[tmp].second)
					tmp=j;
			}
		}
		if(tmp!=-1){
			r[tmp].first=r[tmp].second=200;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque

n=int(input())
a_num = ord("a")
deque = deque()
deque.append(("a", a_num))
ans = []

if n > 1:
    while len(deque) > 0:
        s, s_num = deque.popleft()
        for i in range(a_num, s_num + 2):
            s_nxt = s + chr(i)
            s_num = max(s_num, i)
            if len(s_nxt) == n:
                ans.append(s_nxt)
            else:
                deque.appendleft((s_nxt, s_num))

    ans.sort()
    print(" ".join(ans))

else:
    print("a")

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;



int main() {

    double L;
    cin >> L;

    double ans = (L / 3.0) * (L / 3.0) * (L / 3.0);

    printf("%.10f", ans);



}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
import java.util.Scanner


object Main {

  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val s = sc.next()
    val sg = s.groupBy(identity)
    val result = sg.size == 2 && sg.values.forall(_.length == 2)
    println(if(result) "Yes" else "No")
  }
}

Measured memory_bytes: 25420
//naveen mall
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto i: a)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        fl(i,0,n){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";cout<<"\n";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define PB                pop_back
#define endl              "\n"
#define what(x) cerr <<	 #x << " is " << x << endl;
int sum() { return 0; }template<typename T,typename... Args>T sum(T a, Args... args) { return a + sum(args...); }
#define p   200005

vec<int> v;
void div(int n)
{
   for(int i=2;i*i<=n;i++)
   	   {
   	   	if(n%i==0)
   	   		 {
   	   		 	if(n/i==i)
   	   		 		v.pb(i);
   	   		 	else
   	   		 		{v.pb(i);v.pb(n/i);}
   	   		 }
   	   }
   	   if(n!=1)
   	   v.pb(n);


}
bool ddi(int i,int j)
  {
  	while(j%i==0)
  		 {
  		 	j=j/i;
  		 }
  		 if(j%i==1)
  		 	return true;
  		 else
  		 	 return false;

  } 
  
void solve()
{   
int n;
cin>>n;
int ans=0;
div(n-1);
ans+=sz(v);
//display(v)
v.resize(0);
div(n);
for(auto i:v)
{
	if(ddi(i,n))
		ans++;

}
cout<<ans;










}
signed main()
{fast
	int t;
	//cin>>t;
	t=1;
	while(t--)
	{
solve();}
  
}












Measured memory_bytes: 384
#include <cstdio>
#include <algorithm>
#include <string>

const int dx[3] = {0, 1, 0}, dy[3] = {1, 1, 2};
int N;
int cloth[10][10];
int x[12], y[12], type[12];

bool canFill(int cx, int cy, int t){
    int mx;
    
    if(t == 0){
        mx = 1;
    }else if(t == 1){
        mx = 2;
    }else if(t == 2){
        mx = 2;
    }

    for(int i=-mx;i<=mx;i++){
        for(int j=-mx;j<=mx;j++){
            if(std::abs(i) + std::abs(j) > mx){continue;}
            if(t == 1 && (i == 0 && std::abs(j) == 2 || std::abs(i) == 2 && j == 0)){continue;}
            int x = j + cx, y = i + cy;
            if(x < 0 || x >= 10 || y < 0 || y >= 10){return false;}
            if(!cloth[y][x]){return false;}
        }
    }

    return true;
}

void spuit(int cx, int cy, int t, int v){
    int mx;
    
    if(t == 0){
        mx = 1;
    }else if(t == 1){
        mx = 2;
    }else if(t == 2){
        mx = 2;
    }

    for(int i=-mx;i<=mx;i++){
        for(int j=-mx;j<=mx;j++){
            if(std::abs(i) + std::abs(j) > mx){continue;}
            if(t == 1 && (i == 0 && std::abs(j) == 2 || std::abs(i) == 2 && j == 0)){continue;}
            int x = j + cx, y = i + cy;
            if(x < 0 || x >= 10 || y < 0 || y >= 10){continue;}
            cloth[y][x] -= v;
        }
    }
}

bool dfs(int n){
    if(n == N){
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(cloth[i][j]){return false;}
            }
        }
        
        for(int i=0;i<N;i++){
            printf("%d %d %d\n", x[i], y[i], type[i]);
        }
        return true;
    }

    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            if(!cloth[i][j]){continue;}
            for(int k=0;k<3;k++){
                int cx = j + dx[k], cy = i + dy[k];
                if(!canFill(cx, cy, k)){continue;} 
                spuit(cx, cy, k, 1);
                
                x[n] = cx; y[n] = cy; type[n] = k + 1;
                if(dfs(n+1)){return true;}
                spuit(cx, cy, k, -1);       
            }
            return false;
        }
    }

    return false;
}

int main(){
    scanf("%d", &N);

    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            scanf("%d", &cloth[i][j]);
        }
    }
    
    dfs(0);
}

Measured memory_bytes: 1032
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <random>
#include <functional>

using namespace std;

#define F first
#define S second
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; 
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define dbv(a) cerr << #a << ": "; for (auto& xxxx: a) cerr << xxxx << " "; cerr << endl;
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)a.size()
#define pw(n) (1ll << (n))
#define equal equalll
#define less lesss

typedef double dbl;
typedef long long ll;
const int N = 2e6 + 100;
const int INF = 1.01e9;
typedef vector<int> vi;

bitset<N> dp;

int main() {
#ifdef HOME 
    assert(freopen("in", "r", stdin));
#endif
    int n;
    scanf("%d", &n);
    vector<int> a(n);   
    int s = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        s += a[i];
    }
    dp[0] = 1; 
    for (auto x: a) {
        dp |= dp << x;
    }

    int mx = 0;
    for (int i = 0; i * 2 <= s; i++) {
        if (dp[i]) {
            mx = i;
        }
    }
    cout << s - mx << endl;



    
#ifdef HOME 
    epr("time = %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
#endif
    return 0;
}


Measured memory_bytes: 1024
a, b, deg = gets.split.map(&:to_i)
rad = deg * Math::PI / 180

s = a * b * Math.sin(rad) / 2
l = Math.sqrt(a**2 + b**2 - 2 * a * b * Math.cos(rad)) + a + b
h = 2 * s / a

p s, l, h



Measured memory_bytes: 6948
import java.util.*;

public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveD();
    }
    
    private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
	int X = sc.nextInt();	
    	System.out.println(A > X ? "NO" : (A+B >= X ? "YES" : "NO"));
    }

    private void solveB() {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
    	int M = sc.nextInt();
	int X = sc.nextInt();

	int[] a = new int[M];

	for(int i=0; i < M; i++){
	    a[i] = sc.nextInt();	    
	}

	int ans1=0;
	for(int i=X; i > 0; i--){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans1++;	    
	    }
	}

	int ans2=0;
	for(int i=X; i < N; i++){
	    for(int j=0; j < M; j++){
		if (a[j] == i) ans2++;	    
	    }
	}
	System.out.println(Math.min(ans1,ans2));
    }
    private void solveC() {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int[] X = new int[N];
	int[] Y = new int[N];

	for(int i=0; i < N; i++){
	    X[i] = sc.nextInt();	    
	}

	for(int i=0; i < N; i++){
	    Y[i] = X[i];	    
	}

	Arrays.sort(X);

	int ans1 = X[N/2 -1];
	int ans2 = X[N/2];

	for(int i=0; i < N; i++){
	    if (Y[i]<=ans1) System.out.println(ans2);
	    else System.out.println(ans1);
	}
       
    }
    private void solveD() {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int[] a = new int[n];
	
	for(int i=0; i < n; i++){
	    a[i] = sc.nextInt();	    
	}

	int max = a[0];
	for (int i=0;i<n;i++){
	    if (a[i]>max) max=a[i];
	}

	int m;
	if (max%2 == 0) m = max/2;
	else m = (max+1)/2;
	
	int ans = 0;
	int d = m;
	for (int i=0;i<n;i++){
	    int delta = Math.abs(m-a[i]);
	    if (delta < d) {
		d=delta;
		ans = a[i];
	    }
	}
	System.out.println(max+" "+ans);
    }
	
}

Measured memory_bytes: 50760
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int N, c[100000], C;

int main(){
  while(scanf("%d", &N) && N){
    memset(c, 0, sizeof(c));
    scanf("%d", &C);
    int index = 0, left, prev ;
    c[index] =  1;
    left = prev =  C;
    REP(i, 2, N+1){
      scanf("%d", &C);
      if(C == prev){
	c[index]++;
      }else if(i%2 == 0){
	if(index == 0){
	  c[index]++;
	  left = C;
	}else{
	  c[index-1] += c[index] + 1;
	  index--;
	}
      }else{
	index++;
	c[index] = 1;
      }
      prev = C;
    }
    int res = 0;
    rep(i, index+1){
      if((i+left)%2 == 0) res += c[i];
      //      printf("%d\n", c[i]);
    }
    printf("%d\n", res);
  }
  return 0;
}

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

#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define endl '\n'
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

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

/*追加部分*/

int sum_digit(int _num){
    int a = _num / 10000;
    int b = _num%10000 / 1000;
    int c = _num%1000 / 100;
    int d = _num%100 / 10;
    int e = _num%10;

   return a + b + c + d + e;
}

/*main関数*/

int main() {
FASTIO;
    int n, a, b; cin >> n >> a >> b;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(a <= sum_digit(i) && sum_digit(i) <= b){
            ans += i;
        }
    }
    cout << ans << endl;

return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
 
int main() {
  string a,b;
  int s = 0;
  cin >> a;
  cin >> b;
  for(int i=0;i<a.size();i++){
  if(a.at(i)!=b.at(i)){
  break;

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


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

using namespace std;

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

    int k, x;
    cin >> k >> x;
    cout << (500 * k >= x ? "Yes" : "No");
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD (ll) (1e9+7)
int main()
{
	ll ar[5];
	for(int i=0;i<5;i++)
	{
		cin>>ar[i];
	}
	ll ans;
	for(int i=0;i<5;i++)
	{
		if(ar[i] == 0)
		{
			ans = i+1;
		}
	}
	cout<<ans<<"\n";
}


Measured memory_bytes: 3600
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  string s;
  cin >> s;
  if(s.size() % 2 == 1){
    cout << "No" << endl;
    return 0;
  }

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


Measured memory_bytes: 888
n = int(input())

for i in range(1,n+1):
    x = i
    if x % 3 == 0:
        print(" " + str(i), end="")
    else:
        while x > 0:
            if x % 10 == 3:
                print(" " + str(i), end="")
                break
            x = x // 10
print()


Measured memory_bytes: 5872
#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    #define FAST ios_base::sync_with_stdio(false);cin.tie(0);
    const double EPS = 1e-9;
    const double PI = acos(-1);
    const int knightDir[8][2] = {{-2,-1},{-2,1},{-1,2},{1,2},{2,-1},{2,1},{-1,-2},{1,-2}};
    //const int dx[]={0,0,0,1,1,1,-1,-1,-1};
    //const int dy[]={-1,0,1,-1,0,1,-1,0,1};
    const int dx[] = {0 , 1 , 0 , -1};
    const int dy[] = {1 , 0 , -1 , 0};
    //#define MOD         1000000007LL
    #define MAX         1000005
    const ll MOD = 1000000000 + 7;
    
    int main()
    {
        FAST
        int t;
        t = 1;

        while(t--)
        {
           int n ;
           cin >> n;
           
           vector<int> a(n);
           
           for(int i = 0 ; i < n ; i++)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++)
               {
                   for(int k = j + 1 ; k < n ; k++)
                   {
                       if(a[i] != a[j] && a[j] != a[k])
                       {
                           if(a[i] + a[j] > a[k])
                           {
                               ans++;
                           }
                       }
                   }
               }
           }
           
           cout << ans << endl;
        }
    }



Measured memory_bytes: 3568
#include<bits/stdc++.h>
#define LL long long
using namespace std;
inline int read(){int x;scanf("%d",&x);return x;}
struct type{
    int first,second;
};
type operator+(type a, type b){
    int t[4]={a.first,a.second,b.first,b.second};
    sort(t,t+4);
    a.first=t[3];
    a.second=t[2];
    return a;
}
inline void FWT_Or(type *a,int n){
    for(int i=1;i<n;i<<=1)
        for(int j=0;j<n;j+=(i<<1))
            for(int k=0;k<i;++k){
                type x=a[j+k],y=a[j+k+i];
                a[j+k+i]=x+y;
            }
}
int main(){
    int n=read();
    static type a[1<<18];
    for(int i=0;i<(1<<n);++i)
        a[i]=(type){read(),-1};
    FWT_Or(a,1<<n);
    int result=0;
    for(int i=1;i<(1<<n);++i){
        result=max(result,a[i].first+a[i].second);
        printf("%d\n",result);
    }
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> V;
typedef pair<ll,ll> P;
typedef map<ll,ll> M;

#define REP(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define FOR(i,j,n) for(ll (i) = (j); (i) < (n); ++(i))
#define REPR(i,n) for(ll (i) = (n); (i) >= 0; --i))


signed main(){
    ll n;
    cin >> n;
    V a(n);
    for(auto& xx : a)
        cin >> xx;
    ll ma = *max_element(a.begin(), a.end());
    ll nowma = ma;
    V yak;
    ll sq = sqrt(ma) + 1;
    FOR(i, 1, sq){
        if(ma % i == 0){
            yak.push_back(i);
            yak.push_back(ma / i);
        }
    }
    sort(yak.begin(), yak.end());
    ll ans = 0;
    for(auto xx : a){
        ans += (*lower_bound(yak.begin(), yak.end(), xx)) - xx;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3632
#[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 ( 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 , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ 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 , 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: usize,
        a: [i64;n]
    }
    let mut ret = 1i64<<60;
    for positive in 0..2 {
        let mut sum = 0;
        let mut cnt = 0;
        for i in 0..n {
            sum += a[i];
            if i % 2 == positive && sum <= 0 {
                cnt += 1 - sum;
                sum = 1;
            }
            if i % 2 != positive && sum >= 0 {
                cnt += sum + 1;
                sum = -1;
            }
        }
        ret = std::cmp::min(ret, cnt);
    }
    println!("{}", ret);
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	string s;
	map<char, int> ct;
	cin >> s;
	for (auto ch : s) ct[ch]++;

	bool valid = true;
	for (auto p : ct) {
		if (p.second % 2 == 1) valid = false;
	}

	if (valid) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s;
    cin>>s;
    int sz=s.size();
    int ans=sz;
    FOR(i,1,sz){
        if(s[i-1]!=s[i]) ans=min(ans,max(i,sz-i));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>

    #define INF 1e7
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;

    int main(){
      int n;
      cin>>n;
      auto a = vec(int,INF);
      auto p = vec(int,INF);
      REP(i,1,n){
        cin >> a[i];
        p[a[i]] = i;
      }
      REP(i,1,n)cout <<p[i]<<" ";
    }


Measured memory_bytes: 78976
#!/usr/bin/env python3
#D

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))


def root(x):
    if par[x] == x:
        return x
    par[x] = root(par[x])
    return par[x]

def union(x,y):
    x = root(x)
    y = root(y)
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1

n,m = LI()
ab = [LI() for _ in range(m)]
ans = 0
for i in range(m):
    par = [i for i in range(n)]
    rank = [0] * n
    for j in range(m):
        if i == j:
            continue
        a, b = ab[j]
        if root(a-1) != root(b-1):
            union(a-1, b-1)
    cnt = len(set([root(i) for i in range(n)]))
    if cnt > 1:
        ans += 1
print(ans)

Measured memory_bytes: 43760
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


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

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

int main(){

    string s;
    vector<char> s_vec;
    cin >> s;
    

    for(int i=0; i<s.size(); i++){
        if(s[i] == '0' || s[i] == '1') s_vec.pb(s[i]);
        else{
            if(s_vec.empty()) continue;
            else s_vec.pop_back();
        }
    }

    vector<char>::iterator ite;
    for(ite = s_vec.begin(); ite != s_vec.end(); ite++){
        cout << *ite;
    }

    cout << endl;

}

Measured memory_bytes: 256
/*
    B - Algae
    https://atcoder.jp/contests/abc127/tasks/abc127_b
*/
#include <bits/stdc++.h>
using namespace std;

void f(int r, int d, int x2000) {
    long int xi[11] = {};
    xi[0] = r * x2000 - d;
    for (int i = 1; i <= 10; i++) {
        xi[i] = r * xi[i - 1] - d;
        cout << xi[i - 1] << endl;
    }
}

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

    int r, d, x2000;
    cin >> r >> d >> x2000;
    f(r, d, x2000);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int pos;
string t;

int calc(){
	char c = t[pos++];
	if('0'<=c&&c<'3') return c - '0';
	if(c == '-')   return 2 - calc();
	int a = calc();
	char op = t[pos++];
	int b = calc();
	pos++;
	return op == '+' ? max(a,b) : min(a,b);
}

int main(){
	string s;
	while(cin >> s){
		if(s == ".") break;
		int ans = 0;
		for(int P=0;P<3;P++){
			for(int Q=0;Q<3;Q++){
				for(int R=0;R<3;R++){
					t = "";
					pos = 0;
					for(int i=0;i<s.size();i++){
						if(s[i]=='P') t += P + '0';
						else if(s[i]=='Q') t += Q + '0';
						else if(s[i]=='R') t += R + '0';
						else t += s[i];
					}
					ans += calc() == 2;
				}
			}
		}
		cout << ans << endl;
	}
}

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

#define MAX 10000
#define INFTY (1 << 29)

class DisjointSet
{
public:
  vector<int> rank, p;

  DisjointSet() {}
  DisjointSet(int size)
  {
    rank.resize(size, 0);
    p.resize(size, 0);
    for (int i = 0; i < size; i++)
      makeSet(i);
  }

  void makeSet(int x)
  {
    p[x] = x;
    rank[x] = 0;
  }

  bool same(int x, int y)
  {
    return findSet(x) == findSet(y);
  }

  void unite(int x, int y)
  {
    link(findSet(x), findSet(y));
  }

  void link(int x, int y)
  {
    if (rank[x] > rank[y])
    {
      p[y] = x;
      return;
    }
    p[x] = y;
    if (rank[x] == rank[y])
      rank[y]++;
  }

  int findSet(int x)
  {
    if (x != p[x])
      p[x] = findSet(p[x]);
    return p[x];
  }
};

int main()
{
  int n, a, b, q, t;
  cin >> n >> q;
  DisjointSet ds = DisjointSet(n);

  for (int i = 0; i < q; i++)
  {
    cin >> t >> a >> b;
    if (t == 0)
      ds.unite(a, b);
    else if (t == 1)
    {
      if (ds.same(a, b))
        cout << 1 << endl;
      else
        cout << 0 << endl;
    }
  }
}


Measured memory_bytes: 3188
#include <stdio.h>

int main(){
    int i, n;
    int arr[100];
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf(" %d", &arr[i]);
    }
    for(i=0;i<n;i++){
        if(i)printf(" ");
        printf("%d", arr[n-i-1]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 1804
#include <stdio.h>

int main(void){
  int a,b,c,d,e,f;
  int x1,y1;
  int i;
  double x,y;

  while(scanf("%d %d %d %d %d %d\n%",&a,&b,&c,&d,&e,&f) != EOF){

    y = (double)(c*d-f*a)/(double)(b*d-e*a);
  
    x = (c-b*y)/a;

    if(x>=0){
      x1 = x*1000+0.5;
      x = (double)x1/1000;
    }else{
      x1 = (-1)*x*1000+0.5;
      x = (double)x1/1000*(-1);
    }

    if(y>=0){
      y1 = y*1000+0.5;
      y = (double)y1/1000;
    }else{
      y1 = (-1)*y*1000+0.5;
      y = (double)y1/1000*(-1);
    }
  
    printf("%.3lf %.3lf\n",x,y);
    
    i++;
  }
  return 0;
}

Measured memory_bytes: 632
#include"bits/stdc++.h"
using namespace std;
int r,c,n;
bool on_boundary(int x,int y)
{
	return (x==0 or x==r or y==0 or y==c);
}
int enc(int x, int y)
{
	if(x==0)return y;
	if(y==c)return c+x;
	if(x==r)return 2*c+r-y;
	return 2*c+2*r-x;
}
int main()
{
	cin>>r>>c>>n;
	vector<pair<int,int>> p;
	for(int i=0;i<n;i++)
	{
		int x1,y1,x2,y2;
		cin>>x1>>y1>>x2>>y2;
		if(on_boundary(x1,y1) and on_boundary(x2,y2))
		{
			p.push_back({enc(x1,y1),i});
			p.push_back({enc(x2,y2),i});
		}
	}

		sort(p.begin(),p.end());
		stack<int> s;
		for(auto i:p)
		{
			if(s.empty() or s.top()!=i.second)s.push(i.second);
			else s.pop();
		}
		if(s.empty())puts("YES");
		else puts("NO");

}


Measured memory_bytes: 5368
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#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;
#define umap unordered_map
#define uset unordered_set
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(x) cout<<#x<<' '<<'='<<' '<<x<<'\n'
#define fo(i,a,b) for(int i=a;i<b;i++)
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}
// const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
const int MAXN=100000+11;
void solveforthiscase(const int & test)
{//deb(test);
cin>>n;
long double d=n;
cout<<fixed<<setprecision(20);
cout<<(d*d*d)/27;





return ;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
using namespace std;
int main(){
	int N; cin >> N; 
	map<int, int> M; 
	for(int i = 0; i < N; i++){
		int d; cin >> d; M[d] ++; 
	}
	int K; cin >> K; 
	for(int i = 0; i < K; i++){
		int t; cin >> t; M[t] --; 
		if(M[t] < 0){
			cout << "NO" << endl; return 0; 
		}
	}
	cout << "YES" << endl; 
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
            ll N,K,a;cin>>N>>K;
            a=0;
            vector<ll>v(N);
            rep(i,N){
                     cin>>v[i];
                     }
            rep(i,N){
                     if(v[i]>=K){
                                 a++;
                                 }
                      }
           cout<<a<<endl;       
                                 
                                 
    }



Measured memory_bytes: 1024
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

const int BIAS = 20;

signed main(){
    while(true){
        double r;
        int n;
        cin >> r >> n;

        if(r == 0 && n == 0){
            break;
        }

        vector<double> bill(20*2);
        rep(i, n){
            double xl, xr, h;
            cin >> xl >> xr >> h;
            for(int j = xl; j < xr; j++){
                bill[j+BIAS] = max(bill[j+BIAS], h);
            }
        }

        double min = 100.0;
        for(int i = -r; i < 0; i++){
            double d = i+1;
            double len = bill[i+BIAS] - sqrt(r*r - d*d) + r;

            if(min > len){
                min = len;
            }
        }

        for(int i = 0; i < r; i++){
            double d = i;
            double len = bill[i+BIAS] - sqrt(r*r - d*d) + r;

            if(min > len){
                min = len;
            }
        }
        cout << fixed << setprecision(4) << min << endl;
    }

    return 0;
}



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

signed main() {
  int t1,t2,r1,r2;cin>>t1>>t2>>r1>>r2;
  if (r1==r2) cout << "Draw" <<endl;
  else if (r1<0 || r2<0) {
    if (t1==t2) cout << "Draw" << endl;
    else if(t1<t2) cout << "Alice" <<endl;
    else cout << "Bob" << endl;
  } else {
    if (r1<r2) cout << "Bob" << endl;
    else cout << "Alice" << endl;
  }
  return 0;
}



Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  bool ans = c - a - b > 0 && 4 * a * b < (c - a - b) * (c - a - b);
  cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long int N;
  cin>>N;
  vector<long long int> march(5,0);
  for(int i=0;i<N;i++){
    string s;
    cin>>s;
    char c=s.at(0);
    if(c=='M'){march.at(0)++;}
    else if(c=='A'){march.at(1)++;}
    else if(c=='R'){march.at(2)++;}
    else if(c=='C'){march.at(3)++;}
    else if(c=='H'){march.at(4)++;}
  }
  long long int res=0;
  for(int f=0;f<3;f++){
    for(int s=f+1;s<4;s++){
      for(int t=s+1;t<5;t++){
        res+=march.at(f)*march.at(s)*march.at(t);
      }
    }
  }
  cout<<res<<endl;
}

Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');

while (line = lines.shift()) {
	const numberOfStudents = line.split(' ').map(Number);
    const nextLine = lines.shift();

    
    let scoreDiffFromStudent = [];

    if (nextLine !== undefined){
	    const scores = nextLine.split(' ').map(Number);
	    
	   for(let i = 0; i < numberOfStudents; i++) {
	   		let studentDiff = [];

		   	for (j = numberOfStudents-1; j >= 0; j--) {
		   		if (j != i){
		   			studentDiff.push(Math.abs(scores[i] - scores[j]));
		   		}
		    }

		    const smallestScore = Math.min.apply(null,studentDiff);
		    scoreDiffFromStudent.push(smallestScore);
	   }

	    console.log(Math.min(...scoreDiffFromStudent));
	}
}


Measured memory_bytes: 20896
#include <stdio.h>

int main(void){
    int i, j, n;
    int d[100] = {0};
    int sum = 0;

    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &d[i]);
    }

    for(i = 0; i < n; i++){
        for(j = i+1; j < n; j++){
            sum += d[i] * d[j];
        }
    }

    printf("%d\n", sum);

    return 0;

}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main()
{
    string s,t;
    int c=0;
       cin>>s>>t;

    for (int i=0; i<=s.length(); i++ )
    {
        if (s[i]!=t[i])
        {
            c++;
        }
    }
      cout<<c;

}


Measured memory_bytes: 3912
N,M = map(int,input().split())
A = [(list(map(int,input().split()))) for i in range(M)]
L = []
for i in range(M):
    L.append(A[i][0])
    L.append(A[i][1])
for i in range(1,N+1):
    print(L.count(i))

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

void solve() {
  string a, b, c;
  cin >> a >> b >> c;
  if (a.back() == b.front() && b.back() == c.front()) {
    cout << "YES" << '\n';
  }
  else cout << "NO" << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) solve();
}


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

int main() {
  string s;
  cin >> s;
  rep(i, (int)s.size()) if(s[i]=='/') s.erase(i, 1);
  
  int num = stoi(s);
  
  if(num <= 20190430) cout << "Heisei" << endl;
  else cout << "TBD" << endl;
  
  
  
  
  return 0;
}


Measured memory_bytes: 256
#最初のを試したところ、python のほうが早かった
#メモリが問題になるせいか？
#こちらでは？

from fractions import gcd
import random
n = int(input())
a = list(map(int, input().split( )))
random.shuffle(a)
#最小公倍数でよいか？
#全てのjについてAiBiはAjで割り切れる
#計算時間は？

mod =10**9+7


ag1 = 1
for i in range(n//2):
    ag1 = ag1*a[i]//gcd(ag1,a[i])
ag2 = 1
for i in range(n//2,n):
    ag2 = ag2*a[i]//gcd(ag2,a[i])

ag3 = ag1*ag2//gcd(ag1,ag2)

ans = 0

for i in range(n//2):
    ans += ag1//a[i]
ans*=ag3//ag1
ans %=mod
ans2 = 0
for i in range(n//2,n):
    ans2 += ag2//a[i]
ans2*= ag3//ag2
ans2%=mod 
ans += ans2
ans %=mod
print(ans)


Measured memory_bytes: 6500
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#include<numeric>
#include<queue>
using namespace std;


int main(void) {
  string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  int n;
  while(cin >> n){
    if( n == 0 ) break;

    vector<char> c(n);
    for(int i=0; i<n; i++) cin >> c[i];

    vector< pair<int, int> > alp(26);
    int one = 0;
    int two = 0;
    bool f = true;

    for(int i=0; i<26; i++){
      alp[i].first = 0;
      alp[i].second = i;
    }

    for(int i=0; i<n; i++){
      int tmp = c[i]-'A';
      alp[ tmp ].first++;

      vector< pair<int, int> > q = alp;
      sort(q.begin(), q.end());
      one = q[q.size()-1].first;
      two = q[q.size()-2].first;


      // cerr << one << " " << two << " " << n-i << endl;
      if( two + (n-i-1) < one ){
        cout << s[ q[q.size()-1].second ] << " " << i+1 << endl;
        f = false;
        break;
      }
    }
    if( f ) cout << "TIE" << endl;


  }


  return 0;
}








//

Measured memory_bytes: 3184
import sys

read = sys.stdin.read


def mod_pow(a, p, mod):
    if p == 0:
        return 1
    elif p % 2 == 1:
        return a * mod_pow(a, p - 1, mod)
    else:
        return (mod_pow(a, p // 2, mod) % mod) ** 2 % mod


N, *C = map(int, read().split())
mod = 10 ** 9 + 7

C.sort(reverse=True)
n = mod_pow(4, N - 1, mod)

answer = 0

for i, c in enumerate(C, 2):
    answer += i * c
    if answer > mod:
        answer %= mod

answer *= n
answer %= mod

print(answer)


Measured memory_bytes: 25124
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b)
{
    return b==0?a:gcd(b,a%b);
}
ll p[10005];
ll cmp(ll a,ll b)
{
    return a>b;
}
int main()
{

    ll a,b,k;
    scanf("%lld%lld%lld",&a,&b,&k);
    ll d = gcd(a,b);
    int id = 0;
    for(ll i=1; i*i<=d; i++)
    {
        if(d%i==0)
        {
            if(i*i==d) p[id++]=i;
            else
            {
                p[id++]=i;
                p[id++]=d/i;
            }
        }
    }

    sort(p,p+id,cmp);
    printf("%lld\n",p[k-1]);


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int k; cin >> k;
    ll a[k];
    rep(i,k) cin >> a[i];
    ll amin=2,amax=2;
    rrep(i,k){
        amin=(amin+a[i]-1)/a[i]*a[i];
        if(amin>amax){
            cout << -1 << endl;
            return 0;
        }
        amax=(amax/a[i]+1)*a[i]-1;
    }
    cout << amin << " " << amax << endl;

}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    int f[n][10];
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 5; j++) {
            cin >> f[i][j * 2];
            cin >> f[i][j * 2 + 1];
        }
    }
    int p[n][11];
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 11; j++) {
            cin >> p[i][j];
        }
    }

    int state[10];
    for(int i = 0; i < 10; i++) {
        state[i] = 0;
    }
    state[0] = 1;
    int sum = 0;
    bool fis = true;
    while(1) {
        
        int cou[n];
        for(int i = 0; i < n; i++) {
            cou[i] = 0;
        }
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < 10; j++) {
                if(state[j] == 1 && f[i][j] == 1) cou[i]++;
            }
        }
        int nowSum = 0;
        for(int i = 0; i < n; i++) {
            nowSum += p[i][cou[i]];
        }
        if(fis) {
            sum = nowSum;
            fis = false;
        } else {
            sum = max(sum,nowSum);
        }
       

        state[0]++;
        for(int i = 0; i < 9; i++) {
            if(state[i] == 2) {
                state[i+1]++;
                state[i] = 0;
            }
        }
        if(state[9] == 2) break;
    }
    cout << sum << endl;

}

Measured memory_bytes: 256
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

ll N;

bool is_ok(ll val)
{
    bool b[3] = {false, false, false};
    while(val > 0){
        int v = val % 10;
        if(v == 3) b[0] = true;
        else if(v == 5) b[1] = true;
        else if(v == 7) b[2] = true;
        val /= 10;
    }
    return b[0] && b[1] && b[2];
}

ll rec(ll val){
    if(val > N) return 0;
    ll ret = is_ok(val) ? 1 : 0;
    REP(i, 3){
        ll nval = val*10 + 2*(i+1)+1;
        ret += rec(nval);
    }
    return ret;
}

void solve()
{
    cout << rec(0) << endl;
}

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

// vim:set foldmethod=marker:


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

int main(){
	int n;
	while(1){
		int s[1000] = {};
		cin >> n;
		if(n==0){
			break;
		}
		else{
			int sum = 0;
			double var, ave;
			for(int i = 0; i < n; i++){
				cin >> s[i];
				sum += s[i];
			}
			ave = double(sum) / n;
			double temp = 0;
			for(int i = 0; i < n; i++){
				temp += (s[i] - ave)*(s[i] - ave);
			}
			var = temp / n;
			printf("%f\n", sqrt(var));
		}
	}

	return 0;
}

Measured memory_bytes: 1188
a,b,c=input().split()
a = int(a)
b = int(b)
c = int(c)
if a<=b<c:
	print(a,b,c)
elif a<=c<b:
	print(a,c,b)
elif b<a<c:
	print(b,a,c)
elif b<c<a:
	print(b,c,a)
elif c<a<b:
	print(c,a,b)
else:
	print(c,b,a)


Measured memory_bytes: 5596