akhauriyash/Code-Regression huggingface dataset:
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve(test_def_name=""):
    # 数値取得サンプル
    #   1行1項目 n = int(input())
    #   1行2項目 x, y = map(int, input().split())
    #   1行N項目 x = list(map(int, input().split()))
    #   N行1項目 x = [int(input()) for i in range(n)]
    #   N行N項目 x = [list(map(int, input().split())) for i in range(n)]

    # 文字取得サンプル
    n, z, w = map(int, input().split())
    a_s = list(map(int, input().split()))

    if len(a_s) >= 2:
        print(max(abs(a_s[-1] - w), abs(a_s[-2] - a_s[-1])))
    else:
        print(abs(a_s[-1] - w))

# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """3 100 100
10 1000 100"""
        output = """900"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """3 100 1000
10 100 100"""
        output = """900"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """5 1 1
1 1 1 1 1"""
        output = """0"""
        self.assertIO(test_input, output)

    def test_input_4(self):
        test_input = """1 1 1
1000000000"""
        output = """999999999"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()


Measured memory_bytes: 77620
#include<iostream>
#include<stdio.h>
#include<string>
#include<stdlib.h>
using namespace std;

struct Node{
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node* )malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;
    
    while(x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        }else {
            x = x->right;
        }
    }
    
    z->parent = y;
    if(y == NIL) {
        root = z;
    } else {
        if (z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inParse(Node *a) {
    if (a == NIL) return;
    inParse(a->left);
    cout << " " << a->key;
    inParse(a->right);
}
void preParse(Node *a) {
    if (a == NIL) return;
    cout << " " << a->key;
    preParse(a->left);
    preParse(a->right);
}

int main() {
    int n, i, x;
    string com;
    
    scanf("%d", &n);
    
    for(int i = 0; i < n; i++) {
        cin >> com;
        if (com == "insert" ) {
            scanf("%d", &x);
            insert(x);
        } else if (com == "print") {
            inParse(root);
            cout << endl;
            preParse(root);
            cout << endl;
        }
    }
    
    return 0;
}


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

const long inf = 1e18;
int n, r;
long a[301];
long dp[302][301];

int main() {
  cin >> n >> r;
  ++n;
  a[0] = 0;
  for (int i = 1; i < n; ++i) cin >> a[i];
  for (int k = 0; k <= n - r; ++k) {
    for (int i = 0; i < n; ++i) {
      dp[k][i] = inf;
    }
  }
  dp[1][0] = 0;
  
  for (int k = 2; k <= n - r; ++k) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < i; ++j) {
        dp[k][i] = min(dp[k][i], dp[k - 1][j] + max(0l, a[i] - a[j]));
      }
    }
  }
  
  long mn = inf;
  for (int i = 0; i < n; ++i) {
    mn = min(mn, dp[n - r][i]);
  }
  cout << mn << endl;
}

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

using namespace std;

int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n, i;
	
	cin >> n;
	
	int a[n], dp[n];
	
	for(i=0; i<n; i++)
	{
		cin >> a[i];
		
		dp[n] = INT_MAX;
	}
	
	dp[0] = 0;
	dp[1] = abs(a[0]-a[1]);
	
	for(i=2; i<n; i++)
	{
		dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
	}
	
	cout << dp[n-1];

	return 0;
}


Measured memory_bytes: 1024
<?php
  $tmp = explode(" ", trim(fgets(STDIN)));
  $a = $tmp[0];
  $b = $tmp[1];

  $num1 = $a+$b;
  $num2 = $a-$b;
  $num3 = $a*$b;

  if($num1>=$num2 && $num1>=$num3){
    echo $num1;
  }else if($num2>=$num1 && $num2>=$num3){
    echo $num2;
  }else if($num3>=$num1 && $num3>=$num2){
    echo $num3;
  }
  echo "\n";



Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef vector<int> vint;
typedef vector<float> vfloat;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vstr> vvstr;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    int w;
    vint W(n);
    rep(i, n) {
        cin >> w;
        if (i == 0) W[i] = w;
        else W[i] = W[i-1] + w;
    }
    int sum = W.back();
    int ans = INF;
    rep(i, n) ans = min(ans, abs(sum - 2 * W[i]));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define forin(x,y) for(ll i=x;i<y;i++)
#define vii vector<ll>
#define pii  pair<ll,ll>
#define pb push_back
#define mp make_pair
using namespace __gnu_pbds;
using namespace std;

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

vector<vii> v;
vii dp;
ll evaluate(ll cur)
{
    ll ans =0;
    if(dp[cur] != -1)   return dp[cur];
    if(v[cur].empty())
    {
        dp[cur] = 0;   
    }
    else
    {
        for(auto i:v[cur])
        {
            ans = max(ans,evaluate(i));
        }
        ++ans;
        dp[cur] = ans;
    }
    return dp[cur];
}
int main()
{
    ios::sync_with_stdio(false);    cin.tie(0);     cout.tie(0);
    ll ver,edge,temp=0,from,to; cin>>ver>>edge;        v.resize(ver+1);
    forin(0,edge)
    { 
        cin>>from>>to;
        v[from].pb(to);
    }
    dp.assign(ver+1,-1);
    for(ll i=1;i<=ver;i++)
    {
        evaluate(i);
    }
    ll ans=0;

    for(ll i=1;i<=ver;i++)
    {
        ans = max(ans,dp[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 8576
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

vector<bool> eratosthenes(int n) {
	vector<bool> prime(n + 1);
	for (int i = 2; i <= n; i++) {
		prime[i] = true; // 初期化
	}
	prime[0] = prime[1] = false;
	for (int i = 2; i*i <= n;i++) {
		if (prime[i]) {
			for (int j = i * 2; j <= n; j += i) {
				prime[j] = false;
			}
		}
	}
	return prime;
}
int n, m,p[10], ans = 0,a[29], b[29];
const int nmax = 8;
bool graph[nmax][nmax];
/**
 * pos個は決定済み
 * mask 残に置く数の集合を表すビット配列
 */
void dfs(int pos, int mask) {
//	cout << "pos=" << pos << ",mask=" << mask << endl;
	if (pos == n) { // posが最後までいった
//		cout << p[0] << p[1] << p[2] << endl;
		return;
	}
	REP(i, n) {
		if (mask  & (1 << i)) { // 残の中にiが残っている場合
//			cout << "mask=" << mask << ",1<<" << i << "="  << (1 << i) << "=true" << endl;
			p[pos] = i; // 配列のPOS位置を0～nまでループ
			if (p[0] != 0)continue;
			if (pos > 0 && graph[p[pos - 1]][p[pos]] == false) {
				//				cout << "pos=" << pos << "," << p[0] << p[1] << p[2] << ",graph[" << p[pos - 1] << "][" << p[pos] << "]=false" << endl;
				continue;
			}
			dfs(pos + 1, (mask ^ (1 << i))); // 配列のPOS位置を進める,排他的論理和でフラグを下ろす
		}
		else {
//			cout << "mask=" << mask << ",1<<" << i << "=" << (1 << i) << "=false" << endl;
		}
	}
}
/*int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	scanf("%d %d", &n ,&m);

	REP(i, m) {
		scanf("%d %d",&a[i], &b[i]);
		p[i] = i;
		graph[a[i] - 1][b[i] - 1] = graph[b[i] - 1][a[i] - 1] = true;
	}

	dfs(0, (1 << n) - 1);
	cout << ans << endl;
	return 0;
}*/
/**
 * v 現在の頂点
 */
int dfs(int v, int n, bool visited[]) {
	bool all_visited = true; // 全頂点を訪問済
	REP(i, n) {
		if(!visited[i])all_visited = false;
	}
	if (all_visited)return 1; //答を1増やす
	int ret = 0;
	REP(i, n) { //頂点i:頂点vに隣接、且つ、未訪問
		if (!graph[v][i])continue;
		if(visited[i])continue;

		visited[i] = true;
		ret += dfs(i, n, visited);
		visited[i] = false;
	}
	return ret;
}
int main() {
	int N, M;
	cin >> N >> M;
	
	for (int i = 0; i < M; ++i) {
		int A, B;
		cin >> A >> B;
		graph[A - 1][B - 1] = graph[B - 1][A - 1] = true;
	}
	
	bool visited[nmax];
	for (int i = 0; i < N; ++i) {
		visited[i] = false;
	}
	
	visited[0] = true;
	cout << dfs(0, N, visited) << endl;
	return 0;

}


Measured memory_bytes: 256
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
//void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 55;
const ll mm = 1e+18;
bool p=false;
void f(int wh,int a,int b,int c,int k){
    if(wh==k){
        if(b>a&&c>b){
            p=true;
        }
        return;
    }
    f(wh+1,2*a,b,c,k);
    f(wh+1,a,2*b,c,k);
    f(wh+1,a,b,2*c,k);
}
void solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    int k;
    cin>>k;
    f(0,a,b,c,k);
    if(p) cout<<"Yes";
    else cout<<"No";
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    // freopen("sp.txt","r",stdin);
    // freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}

Measured memory_bytes: 3652
def degitsum(n):
    ans = 0
    while n/10 != 0:
        ans += n%10
        n = int(n/10)
    return ans

n, a, b = map(int, input().split())

ans = 0
for i in range(1, n+1):
    if a <= degitsum(i) <= b:
        ans += i
    else:
        continue
        
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int N, M;
	cin >> N >> M;
	int a[51], b[51], c[51], d[51];
	for (int i = 0; i < N;++i) {
		cin >> a[i] >> b[i];
	}
	for (int j = 0; j < M; ++j) {
		cin >> c[j] >> d[j];
	}
	for (int i = 0; i < N; ++i) {
		int min_dist = abs(a[i] - c[0]) + abs(b[i] - d[0]);
		int checkpoint = 1;
		for (int j = 1; j < M; ++j) {
			const int cur_dist = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			if (cur_dist < min_dist) {
				min_dist = cur_dist;
				checkpoint = j + 1;
			}
		}
		cout << checkpoint << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
struct edge
{
  ll to;
  ll cost;
  edge() {}
  edge(ll to, ll cost) : to(to), cost(cost){};
};
int main()
{
ll n;
cin >> n ;
vector<vector<edge>> g(n);
rep(i, n-1)
{
  ll a, b;
  cin >> a >> b ;
  g[a - 1].emplace_back(b - 1, i);
  g[b - 1].emplace_back(a - 1, i); //無向辺
}
ll c=0;
vector<ll> ans(n-1);
vector<ll> see(n);
queue<ll> q;
see[0]=1;
ll tt=1;
for(auto r:g[0]){
  ans[r.cost]=tt;
  see[r.to]=tt;
  tt++;
  q.push(r.to);
}
while(!q.empty()){
  auto p=q.front();
  q.pop();
  ll t=1;
  for(auto r:g[p]){
    if(see[r.to]!=0)continue;
    if(t==see[p])t++;
    ans[r.cost]=t;
    see[r.to]=t;
    t++;
    q.push(r.to);
  }
}
c=*max_element(ans.begin(),ans.end());
cout << c << endl;
rep(i,n-1)cout << ans[i] << endl;

return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>

typedef long long ll;

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    int ans;
    ans = n*(n-1)/2 + m*(m-1)/2;
    cout << ans;
}



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

int main() {
    int N; cin >> N;
    vector<long long> A(N*3);
    for (int i = 0; i < N*3; ++i) cin >> A[i];
    sort(A.begin(), A.end(), greater<long long>());
    long long res = 0;
    for (int i = 1; i < N*2; i += 2) res += A[i];
    cout << res << endl;
}


Measured memory_bytes: 2560
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        998244353
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  200005
ll f[N];
ll expo(ll base, ll exponent, ll mod) {								//return base^exponent modulo modulus
    ll ans = 1;
    while(exponent !=0 ) {
        if((exponent&1) == 1) {
            ans = ans*base ;
            ans = ans%mod;
        }
        base = base*base;
        base %= mod;
        exponent>>= 1;
    }
    return ans%mod;
}
ll inv(ll x){
	return expo(x,hell-2,hell);
}
ll nCr(ll n,ll r){
	return ((f[n]*inv(f[r]))%hell*inv(f[n-r]))%hell;
}
int main()
{
	ios
	ll n,m,i,j,k;
	cin>>n>>m>>k;
	f[0]=1;
	for(i=1;i<N;i++)
		f[i]=(f[i-1]*i)%hell;
	ll ans=0;
	for(i=0;i<=k;i++){
		ll sum=((nCr(n-1,i)*m)%hell*(expo(m-1,n-1-i,hell)))%hell;
		ans+=sum;
		ans%=hell;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5232
#include<iostream>
#include<vector>
#include<cassert>
#include<algorithm>
#include<list>
using namespace std;

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

struct Packet {
    int id, pos, len;
};

bool solve() {
    int N; cin >> N;
    if(N == 0) return false;
    list<Packet> memory;
    rep(i, N) {
        char c; cin >> c;
        if(c == 'W') {
            int len, id; cin >> id >> len;
            int pos = 0;
            for(auto itr = memory.begin(); itr != memory.end(); itr++) {
                if(itr->pos > pos) {
                    int blank = itr->pos - pos;
                    Packet p = {id, pos, min(blank, len)};
                    memory.insert(itr, p);
                    len -= p.len;
                    if(len == 0) break;
                }
                pos = itr->pos + itr->len;
            }
            if(len > 0) {
                Packet p = {id, pos, len};
                memory.push_back(p);
            }
        } else if(c == 'D') {
            int id; cin >> id;
            for(auto itr = memory.begin(); itr != memory.end();) {
                if(itr->id == id) itr = memory.erase(itr);
                else itr++;
            }
        } else if(c == 'R') {
            int num; cin >> num;
            for(auto itr = memory.begin(); itr != memory.end(); itr++) {
                if(itr->pos <= num and num < itr->pos + itr->len){
                    cout << itr->id << endl;
                    goto END_R;
                }
            }
            cout << -1 << endl;
      END_R:;
        }
    }
    cout << endl;
    return true;
}

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

Measured memory_bytes: 3236
from collections import deque
n = int(input())
ki = [[] for i in range(n)]
lis = []
for i in range(n-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    ki[a].append(b)
    ki[b].append(a)
    lis.append([a,b,i])
mx = 0
for i in range(n):
    ki[i].sort()
    mx = max(mx,len(ki[i]))
lis = sorted(lis, key=lambda x:x[0])
lis = sorted(lis, key=lambda x:x[1])
lis2 = [[] for i in range(n)]
cnt = 0
for i in range(n-1):
    lis2[lis[i][0]].append(lis[i])
#print(lis2)

#print(ki)
def bfs(ki,lis2):
    d = [True] * n
    que = deque([(0,-1)])
    d[0] = False
    while len(que) != 0:
        val = que.popleft()
        cnt = 1
        cnt2 = 0
        for i in range(len(ki[val[0]])):
            if d[ki[val[0]][i]] == True:
                d[ki[val[0]][i]] = False

                #print(cnt,cnt2,val,i)
                if val[1] == cnt:
                    cnt += 1
                lis2[val[0]][cnt2].append(cnt)
                que.append([ki[val[0]][i],cnt])
                cnt += 1
                cnt2 += 1

    return lis2
lis2 = bfs(ki,lis2)
#print(lis2)
val = 0
for i in range(n):
    val = max(len(ki[i]),val)
print(val)
lis = []
for i in range(n):
    for j in range(len(lis2[i])):
        lis.append(lis2[i][j])
lis = sorted(lis,key=lambda x:x[2])
for i in range(n-1):
    print(lis[i][3])


Measured memory_bytes: 117536
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 100005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
const int mod = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int>v(n);
    ll lcm = 1;
    for(auto &i:v){
        cin >> i;
        i >>= 1;
        lcm =  i * lcm /__gcd(lcm,(ll)i);   
        if(lcm > k){
            cout << 0 << '\n';
            exit(0);
        }
    }
    for(auto i:v){
        if((lcm/i)%2==0){
            cout << 0 << endl;
            exit(0);
        }
    }
    k /= lcm;
    ll ans = (k + 1) / 2;
    cout << ans << '\n';
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int n, k;
    cin >> n >> k;
    double ans = 0;
    for(int i = 1; i <= n; i++){
        int num = i;
        double win = 1.0/n;
        while(num < k){
            num *= 2;
            win /= 2.0;
        }
        ans += win;
    }
    printf("%.12f\n", ans);
    return 0;
}

Measured memory_bytes: 3756
import sys
sys.setrecursionlimit(10**6)

def input():
	return sys.stdin.readline()[:-1]

n, m = map(int, input().split())
a = list(map(int, input().split()))
adj = [[] for _ in range(n)]
for _ in range(m):
	x, y = map(int, input().split())
	adj[x].append(y)
	adj[y].append(x)

root = [-1 for _ in range(n)]
is_minimum = [False for _ in range(n)]

def dfs(x, r):
	global mi, mi_ind
	if a[x] < mi:
		mi = a[x]
		mi_ind = x
	for v in adj[x]:
		if root[v] < 0:
			root[v] = r
			dfs(v, r)
	return mi_ind

for i in range(n):
	if root[i] < 0:
		mi, mi_ind = 10**10, -1
		root[i] = i
		is_minimum[dfs(i, i)] = True

con_num = len(set(root))
#print(con_num)
if (con_num-1) * 2 > n:
	print("Impossible")
	sys.exit()
elif con_num == 1:
	print(0)
	sys.exit()
ans = sum([a[i] for i in range(n) if is_minimum[i]])
ans += sum(sorted([a[i] for i in range(n) if not is_minimum[i]])[:con_num-2])
print(ans)

Measured memory_bytes: 29100
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;
const int INF = 1001001001;
int main(){
  int n;cin >>n;
  vector<int> vec(n);
  vector<int> l(n+1);
  vector<int> r(n+1);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  l.at(0)=0;
  r.at(0)=0;
  for(int i=0;i<n;i++){
    l.at(i+1)=__gcd(l.at(i),vec.at(i));
  }
  for(int i=0;i<n;i++){
    r.at(i+1)=__gcd(r.at(i),vec.at(n-1-i));
  }
  int ans=1;
  for(int i=0;i<n;i++){
    ans=max(ans,__gcd(l.at(i),r.at(n-i-1)));
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
#pragma GCC optimize("O3")
            #pragma comment(linker, "/stack:200000000")
            #pragma GCC optimize("unroll-loops")
             
            #include <algorithm>
            #include <bitset>
            #include <cassert>
            #include <chrono>
            #include <cmath>
            #include <complex>
            #include <cstdio>
            #include <cstdlib>
            #include <cstring>
            #include <ctime>
            #include <deque>
            #include <functional>
            #include <iomanip>
            #include <iostream>
            #include <iterator>
            #include <limits>
            #include <climits>
            #include <list>
            #include <map>
            #include <numeric>
            #include <queue>
            #include <random>
            #include <ratio>
            #include <set>
            #include <sstream>
            #include <stack>
            #include <string>
            #include <unordered_map>
            #include <unordered_set>
            #include <utility>
            #include <vector>
            using namespace std;
             
            typedef long long ll;
            typedef long double ld;
            #define int ll
            #define double ld
            #define pb push_back
            #define mp make_pair
            #define REP(i,n) for (int i = 0; i < n; i++)
            #define loop(i,n) for (int i = 0; i < n; i++)
            #define FOR(i,a,b) for (int i = a; i < b; i++)
            #define REPD(i,n) for (int i = n-1; i >= 0; i--)
            #define FORD(i,a,b) for (int i = a; i >= b; i--)
            #define remax(a,b) a = max(a,b)
            #define remin(a,b) a = min(a,b)
            #define mem(a, b) memset(a, b, sizeof a)
            #define append push_back
            #define all(v) v.begin(),v.end()
            #define F first
            #define S second
            #define print(x) cout << (x) << endl
            #define PRECISION(x) cout << fixed << setprecision(x)
            #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
            #define N 300005
            const double PI=acos(-1);
            const int MOD = 1000000007;
            const int FMOD = 998244353;
            const double eps = 1e-9;
             
            mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
            
            signed main()
            {
            	int a,b,c,k;
            	cin>>a>>b>>c>>k;
            	int ans=0;
            	if(k<=a)
            	{
            		ans+=k;
            		cout<<ans;
            		return 0;
				}
				k-=a;
				ans+=a;
				if(k<=b)
				{
					cout<<ans;
					return 0;
				}
				k-=b;
			
				if(k<=c)
				{
					ans-=k;
				}
				else
				ans-=c;
				
				cout<<ans;
				
			}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


// グローバルに使いたいので
vector<int> l;
int n;

// 渡された順番の優先順に作る場合の最小コストを返す関数
int solve(int first, int second, int third) {

    int f_min = INT_MAX; int f_mask = 0;
    int s_min = INT_MAX; int s_mask = 0;
    int t_min = INT_MAX; int t_mask = 0;

    // 使った竹の本数
    int f_count = 0;
    int s_count = 0;

    // 1つ目を求める
    for (int bit = 1; bit < (1<<n); ++bit) {
        int tmp = 0;
        int cost = 0;
        int tmp_count = 0;
        rep(i, n) if (bit & (1<<i)) {
            if(tmp > 0) cost += 10;
            tmp += l[i];
            tmp_count++;
        }
        if(n-tmp_count < 2) continue;

        cost += abs(max(first,tmp)-min(first,tmp));
        if(f_min > cost) {
            f_min = cost;
            f_mask = bit;
            f_count = tmp_count;
        }
    }



    for (int bit = 1; bit < (1<<n); ++bit) {
        if(bit & f_mask) continue;
        int tmp = 0;
        int cost = 0;
        int tmp_count = 0;
        rep(i, n) if (bit & (1<<i)) {
            if(tmp > 0) cost += 10;
            tmp += l[i];
            tmp_count++;
        }
        if(n-f_count-tmp_count < 1) continue;
        cost +=  abs(max(second,tmp)-min(second,tmp));
        if(s_min > cost) {
            s_min = cost;
            s_mask = bit;
            s_count = tmp_count;
        }
    }

    for (int bit = 1; bit < (1<<n); ++bit) {
        if(bit & f_mask || bit & s_mask) continue;
        int tmp = 0;
        int cost = 0;
        int tmp_count = 0;
        rep(i, n) if (bit & (1<<i)) {
            if(tmp > 0) cost += 10;
            tmp += l[i];
            tmp_count++;
        }
        if(n-f_count-s_count-tmp_count < 0) continue;
        cost += abs(max(third,tmp)-min(third,tmp));
        if(t_min > cost) {
            t_min = cost;
            t_mask = bit;
        }
    }

    return f_min + s_min + t_min;
}


int main() {
    int a,b,c; cin >> n >> a >> b >>c;
    rep(i, n) {
        int tmp; cin >> tmp;
        l.push_back(tmp);
    }

    int ans = INT_MAX;
    chmin(ans, solve(a,b,c));
    chmin(ans, solve(a,c,b));
    chmin(ans, solve(b,a,c));
    chmin(ans, solve(b,c,a));
    chmin(ans, solve(c,a,b));
    chmin(ans, solve(c,b,a));

    cout << ans << endl;

    return 0;
}


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

int main() {
    int A, B;
    cin >> A >> B;

    vector<int> num(5);
    int res = 0;
    for (int i = A; i <= B; i++) {
        int t = i;
        for (int j = 0; j < 5; j++) {
            num.at(j) = t % 10;
            t /= 10;
        }
        if (num.at(0) == num.at(4) && num.at(1) == num.at(3)) {
            res++;
        }
    }
    cout << res << endl;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

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

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

llong GCD(llong a, llong b){
	a = abs(a), b = abs(b);
	while(b){
		a %= b;
		swap(a,b);
	}

	return a;
}

int main() {
	llong N;
	vector<llong> A, B;
	queue<int> que;

	cin >> N;
	A.resize(N);
	B.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> A[i];
	for (int i = 0; i < N; ++i) {
		cin >> B[i];
		que.push(i);
	}

	bool is_change = true;
	llong ans = 0;
	vector<int> exist(N, 0);
	while (que.size()) {
		int id = que.front();
		que.pop();
		exist[id] = 0;
		if (A[id] == B[id]) continue;

		int left = (id-1+N)%N, right = (id+1)%N;
		llong bitween = B[left] + B[right];
		if (B[id] - bitween >= A[id]) {
			llong div = (B[id] - A[id])/bitween;
			ans += div;
			B[id] -= div*bitween;

			if (B[id] != A[id]) {
				exist[id] = 1;
				que.push(id);
			}
			if (exist[left] == 0) {
				exist[left] = 1;
				que.push(left);
			}
			if (exist[right] == 0) {
				exist[right] = 1;
				que.push(right);
			}
		}
	}

	llong is_same = true;
	for (int i = 0; i < N; ++i) {
		if (A[i] != B[i]) is_same = false;
	}

	if (is_same) {
		cout << ans << endl;
	} else {
		cout << -1 << endl;
	}

	return 0;
}

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

int main(){
  int n, m;
  cin >> n >> m;
  int sum = 0;
  for(int i = 0; i < m; i++){
    int a;
    cin >> a;
    sum += a;
  }
  if(sum <= n)
    cout << n - sum;
 else
   cout << -1;
 cout << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;
typedef long long ll;
// Welcome to my source code!

class Cube {
public:
    int face[6];
    void roll(int i, int j, int k, int l) {
        int t = face[i]; face[i] = face[j]; face[j] = face[k]; face[k] = face[l]; face[l] = t;
    }
    void roll_turn() { roll(1,2,4,3); } // Rotate to the side.
    void roll_S() { roll(1,0,4,5); } // to S
    void roll_E() { roll(2,0,3,5); } // to E
};

bool eq(Cube c1, Cube c2) {
    rep(i,6) {
        if (c1.face[i] != c2.face[i]) return false;
    }
    return true;
}

bool equal(Cube c1, Cube c2) {
    rep(i,6) {
        rep(j,4) {
            if (eq(c1, c2)) return true;
            c1.roll_turn();
        }
        if (i % 2 == 0) c1.roll_E();
        else c1.roll_S();
    }
    return false;
}

int main() {
    Cube c1, c2;
    rep(i,6) cin >> c1.face[i];
    rep(i,6) cin >> c2.face[i];

    if (equal(c1, c2)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD				1000000007
#define MOD1			998244353
#define EPS				1e-9
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	//freopen("asd1.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int n;
	cin>>n;
	int ar[n];
	int gcds[n];
	gcds[0] = 0;
	int g = 0;
	int ac = 0;
	fore(i, 0, n)
	{
		cin>>ar[i];
		if(i < n-1)
		{
			gcds[i+1] = __gcd(ac, ar[i]);
		ac = gcds[i+1];
		}
	}
	ac = 0;
	int res = 0;
	for(int i = n-1; i > -1; i--)
	{
		res = max(res, __gcd(ac, gcds[i]));
		ac = __gcd(ac, ar[i]);
	}
	cout<<res<<'\n';
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

Measured memory_bytes: 1024
N, A, B = map(int, input().split())
S = list(input())
ans = ""
cnt = 0
f = 0

for i in range(len(S)):
    if S[i] == "c":
        ans = "No"
    elif S[i] == "a":
        if cnt < A + B:
            ans = "Yes"
            cnt += 1
        else:
            ans = "No"
    elif S[i] == "b":
        if cnt < A + B and f < B:
            ans = "Yes"
            cnt += 1
            f += 1
        else:
            ans = "No"
    print(ans)


Measured memory_bytes: 9824
import sys
input = sys.stdin.readline
import math
a,b,x = (int(i) for i in input().rstrip('\n').split())
if b*(a**2)<2*x:
  S=2*(b*(a**2)-x)
  res = math.atan2(S,a**3)
  res2 = math.degrees(res)
  print(res2)
else:
  res = math.atan2(2*x,a*(b**2))
  res2 = math.degrees(res)
  print(90-res2)

Measured memory_bytes: 9416
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			
			int X = scan.nextInt();
			int Y = scan.nextInt();
			
			
			for(int i = 0;i<=X;i++) {
				int turu = i;
				int kame = X-i;
				if(2*turu+4*kame==Y) {
					System.out.print("Yes");
					System.exit(0);
				}
				
			}
			
			
			System.out.print("No");
			
			
		}
		
		
	}
		

}


Measured memory_bytes: 35948
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
#include<queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 100005
#define PI 	3.14159265358979323846

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,h,w;
    cin >> n >> h >> w;
    ll ans = 0;
    REP(i,n){
        ll a,b;
        cin >> a >> b;
        if(h<=a && w<=b)ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
double sum = 0.0;
  cin>>n;
  double a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    }
  for(int i=0;i<n;i++){
    sum = sum + (1/a[i]);
    }
  cout<<1/sum<<endl;
  }
 
 

Measured memory_bytes: 3732
#include <stdio.h>

int mapsize;
char map[256][256];

int main(void) {
	int i,j,k;
	int now,max;
	while(1) {
		scanf("%d",&mapsize);
		if(mapsize==0)break;
		for(i=0;i<mapsize;i++)scanf("%s",map[i]);
		max=0;
		//tate
		for(i=0;i<mapsize;i++) {
			now=0;
			for(j=0;j<mapsize;j++) {
				if(map[j][i]=='1')now++; else {
					if(now>max)max=now;
					now=0;
				}
			}
			if(now>max)max=now;
		}
		//yoko
		for(i=0;i<mapsize;i++) {
			now=0;
			for(j=0;j<mapsize;j++) {
				if(map[i][j]=='1')now++; else {
					if(now>max)max=now;
					now=0;
				}
			}
			if(now>max)max=now;
		}
		//naname 1
		for(i=0;i<mapsize;i++) {
			for(j=0;j<mapsize;j++) {
				if(map[i][j]=='1') {
					now=1;
					for(k=1;i+k<mapsize && j+k<mapsize;k++) {
						if(map[i+k][j+k]!='1')break;
						now++;
					}
					if(now>max)max=now;
				}
			}
		}
		//naname 2
		for(i=0;i<mapsize;i++) {
			for(j=0;j<mapsize;j++) {
				if(map[i][j]=='1') {
					now=1;
					for(k=1;i+k<mapsize && j-k>=0;k++) {
						if(map[i+k][j-k]!='1')break;
						now++;
					}
					if(now>max)max=now;
				}
			}
		}
		printf("%d\n",max);
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int main() {
  int A, B, C, X;
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> X;
  int total;
  int count = 0;

  for(int i = 0; i <= A; i++) {
    for(int j = 0; j <= B; j++) {
      for(int k =0; k <= C; k++) {
        total = 500 * i + 100 * j + 50 * k;
        if(total == X) count++;
      }
    }
  }

  cout << count << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
 
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define pii pair<int,int>
 
using namespace std;
typedef long long ll;
const ll maxn = 1e5 + 101;
int a[maxn],b[maxn],c[maxn];
int dp[maxn][3];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        scanf("%d%d%d",a+i,b+i,c+i);
    }
    dp[1][0]=a[1];
    dp[1][1]=b[1];
    dp[1][2]=c[1];
    for(int i=2;i<=n;++i){
        dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=b[i]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=c[i]+max(dp[i-1][1],dp[i-1][0]);        
    }
    printf("%d\n",max({dp[n][0],dp[n][1],dp[n][2]}));
    return 0;
}

Measured memory_bytes: 6152
#include<cstdio>
#include<vector>


using namespace std;


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		vector<char> s(n+1);
		scanf("%s", &s[0]);

		int c=0, oc=0;
		for(int i=0;s[i];i++)
		{
			if(s[i]==')')
			{
				c--;
				if(c<0)
				{
					oc++;
					c++;
				}
			}
			if(s[i]=='(')
			{
				c++;
			}
		}

		for(;oc;oc--) printf("(");
		printf("%s", &s[0]);
		for(;c;c--) printf(")");
		printf("\n");
	}
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define flash ios_base::sync_with_stdio(false);     cin.tie(NULL);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) v.begin(),v.end()
#define f first
#define s second



using namespace std;

int main()
{
  flash
  ll n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int x;
    cin>>x;
    n-=x;
  }
  if(n>=0)
  cout<<n<<"\n";
  else
  cout<<"-1\n";

}


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

int N, a, counter, ans;

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

    ans = counter = 0;
    for (int i = 1; i <= N; i++) {
        scanf("%d", &a);
        if (a != i) {
            ans += (counter + 1)/2;
            counter = 0;
        } else
            counter++;
    }

    ans += (counter + 1)/2;

    printf("%d\n", ans);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();

		System.out.println((100 * r + 10 * g + b) % 4 == 0 ? "YES" : "NO");

		sc.close();

	}

}

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

int main(){
  int D;
  cin >> D;
  if(D==22){
    cout << "Christmas Eve Eve Eve" << endl;
  }else if(D==23){
    cout << "Christmas Eve Eve" << endl;
  }else if(D==24){
    cout << "Christmas Eve" << endl;
  }else if(D==25){
    cout << "Christmas" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(obj) (obj).begin(),(obj).end()
typedef priority_queue<int> pqmaxi;  //push(xx) top->maxi,pop();
const int mod=1e9+7;
typedef pair<ll,ll> P;
typedef tuple<int,int,int> TP;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;cin>>n;
  vector<P> a(n);
  ll tot=0;
  rep(i,n){
    cin>>a[i].first;
    a[i].second=i;
  }
  sort(a.begin(),a.end(),greater<P>());
  vector<vector<ll>> dp(n+1,vector<ll>(n+1,0));
  rep(i,n){
      for(int j=0;i+j<n;j++){
        chmax(dp[i+1][j],dp[i][j]+a[i+j].first*(a[i+j].second-i));
        chmax(dp[i][j+1],dp[i][j]+a[i+j].first*(n-1-j-a[i+j].second));
      }
  }

  ll res=0;
  rep(i,n+1)chmax(res,dp[i][n-i]);
  cout<<res<<endl;
  return 0;
  }


Measured memory_bytes: 34612
import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7 # 998244353
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n, m = map(int, input().split())
    E = [[] for _ in range(n)]
    indeg = [0] * n
    for _ in range(m):
        u, v = map(int, input().split())
        u -= 1; v -= 1
        E[u].append(v)
        indeg[v] += 1

    # topological sort
    stack = [v for v in range(n) if indeg[v] == 0]
    order = []
    while stack:
        v = stack.pop()
        order.append(v)
        for nv in E[v]:
            indeg[nv] -= 1
            if indeg[nv] == 0:
                stack.append(nv)

    dp = [0] * n
    for v in order[::-1]:
        for nv in E[v]:
            dp[v] = max(dp[v], 1 + dp[nv])

    print(max(dp))
resolve()

Measured memory_bytes: 61744
#include <bits/stdc++.h>
using namespace std;
int mid(int a, int b, int c){
    return (a + b + c - max({a, b, c}) - min({a, b, c}));
}

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int A = max({a, b, c}), B = mid(a, b, c), C = min({a, b, c});
    
    int ans = abs(A - B);
    C += ans;
    B += ans;
    
    int D = abs(A - C);
    if(D % 2 == 0){
        ans += (D / 2);
    }else{
        ans += ((D + 1) / 2) + 1;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
 * by:       okay__
 * 2020-05-17 17:59
 */

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

#define endl '\n'

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int n; cin >> n;
    int t = n%10;
    if (t==2 or t==4 or t==5 or t==7 or t==9) cout << "hon" << endl;
    if (t==0 or t==1 or t==6 or t==8) cout << "pon\n";
    if (t==3) cout << "bon\n";

    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  /////入力部/////
  int N; //総数
  int POINT=1; //POINT
  int sum_norm; //金額の合計
  
  cin >> N >> sum_norm; //総数と金額を代入
  
  for(int i=0;i<N+1;i++){ //一万円のところ
    //if(sum_norm<10000*i)break;
    int sum_ans=0;
    for(int j=0;j<N+1;j++){ //五千円のところ
      ///// 計算部 /////
      sum_ans = 10000*i + 5000*j + 1000*(N-i-j);
      
      //cout<< sum_ans <<endl;
      ///// 判定部と出力部 /////
      if(sum_ans == sum_norm and N>=i+j){
        cout << i<<" " << j<<" " << (N-i-j) << endl;//正解のみ
        POINT =0;
        break;
      }
      //if(i+j>N)break;//間違っているときのみ
    }
  
  if(POINT!=1){
    break;
  }
    
  }
  if(POINT) cout << -1<<" " << -1<<" " << -1 << endl;
}
      
      
    
  


Measured memory_bytes: 3520
n,k = map(int,input().split())
d = 0
A = []
s = [0] * n
for i in range(k) :
    d = int(input())
    for j in range(d) :
        A = list(map(int,input().split()))
        for k in range(len(A)) :
            l = A[k]-1
            s[l] += 1
        break

    
print(s.count(0))

Measured memory_bytes: 9204
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <cstdlib>
typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
 
using namespace std;
 
int main(){
 
    int h,w;
    cin >> h >> w;

    char a[h+2][w+2];
    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            if(i == 0 || i == h+1 || j == 0 || j == w+1) a[i][j] = '.';
            else cin >> a[i][j];
        }
    }

    int px = 1,py =1;
    while(1){
        if(!(a[px-1][py+1] == '.' && a[px-1][py] == '.' && a[px-1][py-1] == '.' && a[px][py-1] == '.' && a[px+1][py-1] == '.')){
            cout << "Impossible";
            return 0;
        }
        if(px == h && py == w){
            cout << "Possible";
            return 0;
        }
        if(a[px][py+1] == '#' && a[px+1][py] == '#'){
            cout << "Impossible";
            return 0;
        }else if(a[px][py+1] == '#'){
            a[px][py] = '.';
          	py++;
            
        }else if(a[px+1][py] == '#'){
            a[px][py] = '.';
          	px++;
            
        }
    }
    return 0;
}

Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>

int main()
{
    std::uint32_t L0,R0,L,R;
    std::uint32_t M=2019;
    std::cin>>L0>>R0;
    
    L=L0%M;
    R=L+std::min(R0-L0,M);
    
    std::uint32_t tmp=M;
    for(std::uint32_t i=L;i<=R;++i){
        for(std::uint32_t k=i+1;k<=R;++k){
            tmp = std::min(tmp,i*k%M);
        }
    }
    std::cout<<tmp;
}

Measured memory_bytes: 632
# Coding is about expressing your feeling, and
# there is always a better way to express your feeling_feelme
import sys
import math
# sys.stdin=open('input.txt','r')
# sys.stdout=open('output2.txt','w')
from sys import stdin,stdout
from collections import deque,defaultdict
from math import ceil,floor,inf,sqrt,factorial,gcd,log2
from copy import deepcopy
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
mod=int(1e9 + 7)

n,h=iia()
arr=iia()
count=0
for i in range(n):
    if arr[i]>=h:
        count+=1
print(count)


Measured memory_bytes: 19344
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
signed main() {
    int H1,M1,H2,M2,K;
    cin>>H1>>M1>>H2>>M2>>K;
    int en=H2*60+M2;
    int fi=H1*60+M1;
    cout<<en-fi-K<<endl;
}


Measured memory_bytes: 3600