akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

int main(void) {
    int n, m;
    cin >> n >> m;
    ll cakes[n][3];
    rep(i, n) rep(j, 3) cin >> cakes[i][j];

    ll ans = 0;
    rep(i, 8) {
        vector<ll> vc;
        rep(j, n) {
            ll temp = 0;
            rep(k, 3) {
                if (i & (1 << k)) {
                    temp += cakes[j][k];
                } else {
                    temp -= cakes[j][k];
                }
            }
            vc.push_back(temp);
        }
        sort(vc.begin(), vc.end());
        reverse(vc.begin(), vc.end());
        ll sum = 0;
        rep(j, m) sum += vc[j];
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 896
n=int(input())
lists=list(map(int,input().split()))
maxi=0
gives=0
index=0

for i in range(n):
    if abs(lists[i])>maxi:
        maxi=abs(lists[i])
        gives=lists[i]
        index=i
if gives<0:
    print(2*n-2)
    for i in range(n):
        if i!=index:
            print(index+1,i+1)
    for i in range(n-1):
        print(n-i,n-1-i)
elif gives>=0:
    print(2*n-2)
    for i in range(n):
        if i!=index:
            print(index+1,i+1)
    for i in range(n-1):
        print(i+1,i+2)

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

int main(){
    int N;
    cin >> N;
    if(N == 1){
        cout << "Hello World" << endl;
    }else{
        int A,B;
        cin >> A >> B;
        cout << A+B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pr(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define Toggle(n,i) (n^(1<<i))
#define Check(n,i) (n&(1<<i))
#define Set(n,i) (n|(1<<i))
#define Reset(n,i) (n&(~(1<<i)))
#define fo(i,x,y) for(int i=(x);i<=(y);++i)
#define me(arr,val) memset(arr,val,sizeof arr)
#define inf 10e8
#define infl LLONG_MAX
#define mod 1000000007
#define f first
#define s second
#define  g(t,a)  (get<a>(t))
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
//int dx[]={+1,-1,0,0};//vertical horizontal
//int dy[]={0,0,+1,-1};//vertical horizontal
//int dx[]={+1,+1,-1,-1,+2,-2,+2,-2};//knights move
//int dy[]={+2,-2,+2,-2,+1,+1,-1,-1};//knights move
//int dx[]={+1,-1,0,0,+1,+1,-1,-1};//vertical horizontal diagonal
//int dy[]={0,0,+1,-1,-1,+1,+1,-1};//vertical horizontal diagonal
using namespace std;
using namespace __gnu_pbds;
/*typedef tree<int, null_type,less<int>, rb_tree_tag,
             tree_order_statistics_node_update>indexed_set;
for set use above*/
typedef tree<pair<int,int>, null_type,less_equal<pair<int, int>>, rb_tree_tag,
tree_order_statistics_node_update> indexed_multiset;


int main()
{
    int n,cnt=0;
    scanf("%d",&n);
    char s[n+5];
    scanf("%s",s);
    for(int i=0;i<n-2;++i)
    {
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
        {
            ++cnt;
        }
    }
    printf("%d",cnt);
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int x[n+5],y[n+5];
    int l=0;
    for(int i=0;i<n;i++)
    {
        cin>>x[i];
        y[l++]=x[i];
    }
    sort(x,x+n);
    int k=0;
    for(int  i=0;i<n;i++)
    {
        if(x[i]!=y[i])
        {
            k++;
        }
    }
    if(k<=2)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
return 0;
}


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

string s, t;
int n;

int main(){
	cin >> n;
	cin >> s >> t;
	int l = 0, r = 0;
	while(l < s.size() || r < t.size()){
		if(l < s.size()){
			cout << s[l++];
		}
		if(r < t.size()){
			cout << t[r++];
		}
	}
	printf("\n");
}

Measured memory_bytes: 256
package main

import (
	"sort"
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	a := scanInts(n)
	b := scanInts(n)
	c := scanInts(n)

	sort.Ints(a)
	sort.Ints(c)

	ans := scanInt()

	for i := 0; i < n; i++ {
		d := sort.SearchInts(a, b[i])
		e := sort.SearchInts(c, b[i]+1)
		ans += d*(n-e)
	}

	fmt.Fprintln(wr, ans)
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define PI acos(-1.0)
typedef long long ll;
typedef unsigned long long ull;
#define gcd __gcd
const int INF=0x3f3f3f3f;
const ll LINF=1000000000000000000;
//#define N 200005
// d[4][2]={1,0,-1,0,0,1,0,-1};
//priority_queue<int, vector<int>, greater<int> >p;
ll n,k,sum=LINF;
ll a[100005];
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n-k+1;i++)
    {
        if(a[i]<=0&&a[i+k-1]<=0)sum=min(sum,-a[i]);
        if(a[i]<=0&&a[i+k-1]>0)sum=min(sum,a[i+k-1]-a[i]+min(a[i+k-1],-a[i]));
        if(a[i]>=0&&a[i+k-1]>0){sum=min(sum,a[i+k-1]);break;}
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#define rep( i, a, n ) for( int i = a; i < n; i++ )
#define per( i, a, n ) for( int i = n - 1; i >= a; i-- )
#define mem( f, x ) memset( f, x, sizeof( f ) )
#define ll long long
#define pii pair<int, int>
#define fi first
#define se second
#define INF 0x3f3f3f3f

using namespace std;
const int N = 1050;
const int M = 35;
const int MAX = 5;
const double g = 9.80;
const double PI = acos( -1.0 );
int m, n, ans, k, t;
int w[N], v[N], dp[N][M], a[M], b[M];

int main( ){
    scanf( "%d", &n );
    if( n < 105 )
        ans = 0;
    else if( n < 135 )
        ans = 1;
    else if( n < 165 )
        ans = 2;
    else if( n < 189 )
        ans = 3;
    else if( n < 195 )
        ans = 4;
    else
        ans = 5;
    printf( "%d\n", ans );
    return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return int(a)
    r = a % b
    return gcd(b, r)

def lcm(a,b):
  return int(a*b/gcd(a,b))
 
N,M = map(int,input().split())
S = input()
T = input()
L = lcm(N,M)
flag = True
min_len = min(N,M)
s_index = int(int(L/M)/gcd(int(L/M),int(L/N)))
t_index = int(int(L/N)/gcd(int(L/M),int(L/N)))

if N == M:
  for i in range(N):
    if S[i] == T[i]:
      continue
    else:
      flag = False
      break
else:
  for i in range(min_len):
    if i * s_index < N-1 and i*t_index < M - 1:
      if S[i*s_index] == T[i*t_index]:
        continue
      else:
        flag = False
        break
    else:
      break
    
if flag:  
  print(L)
else:
  print(-1)

Measured memory_bytes: 3444
//#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl '\n'
#define all(c) c.begin(),c.end()
const int MOD=1e9+7;
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
	string a,b;
	cin>>a>>b;
	if(a==b){cout<<"No"<<endl;return;}
	sort(all(a));
	sort(all(b));
	reverse(all(b));
	if(a>b)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
}
int32_t main(){
  IOS;
  solve();
  //debug();
 #ifdef LOCAL_DEFINE
 cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
 #endif	
}


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

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int main()
{
    string S;
    int cnt = 0;
    int ans = 0;

    cin >> S;

    for(int i = 0; i < S.length(); i++) {
        if(S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C') {
            cnt++;
        } else {
            cnt = 0;
        }
        ans = max(cnt, ans);
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
    int N,L;
    cin>>N>>L;
    vector<vector<string>>S(N,vector<string>(1));
    for(int i=0;i<N;i++)cin>>S.at(i).at(0);
    sort(S.begin(),S.end());
    //for(int i=0;i<N;i++)cout<<S.at(i).at(0)<<endl;
    for(int i=0;i<N;i++)cout<<S.at(i).at(0);
    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.next().toInt()
    val m = sc.next().toInt()
    val a = mutableListOf<Int>()
    val b = mutableListOf<Int>()
    repeat((0 until m).count()) {
        a.add(sc.next().toInt())
        b.add(sc.next().toInt())
    }
    println(problem54c(n, m, a, b))
}

fun problem54c(n: Int, m: Int, a: List<Int>, b: List<Int>): Int {
    var count = 0
    fun dfs(v: Int, past: HashSet<Int>) {
//        debugLog("v", v, "past", past)
//        debugLog("if", past.sorted(), (a + b).toHashSet().sorted())
        if (past.sorted() == (a + b).toHashSet().sorted()) {
//            debugLog("success")
            count++
            return
        }
        val nextList = mutableListOf<Int>()
        (0 until m).forEach { i ->
            val ai = a[i]
            if (!past.contains(ai) && v == b[i]) {
                nextList.add(ai)
            }
            val bi = b[i]
            if (!past.contains(bi) && v == a[i]) {
                nextList.add(bi)
            }
        }
//        debugLog("nextList", nextList)
        for(next in nextList) {
            if (past.contains(next)) continue
            past.add(next)
            dfs(next, past.toHashSet())
            past.remove(next)
        }
    }
    dfs(1, hashSetOf(1))
    return count
}

Measured memory_bytes: 52088
N, M, P = map(int, input().split())
edges = []
edges1 = [[] for _ in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    edges1[b-1].append(a-1)
    edges.append((a-1, b-1, -c+P))
from collections import deque
que = deque([N-1])
flag = [True]*N
flag[-1] = False
while que:
    v = que.pop()
    for e in edges1[v]:
        if flag[e]:
            que.append(e)
            flag[e] = False
def f(n,w,es):
    #負の経路の検出
    #n:頂点数, w:辺の数, es[i]: [辺の始点,辺の終点,辺のコスト]
    d = [float("inf")] * n
    d[0] = 0 
    #この始点はどこでもよい
    for i in range(n):
        for j in range(w):
            e = es[j]
            if flag[e[1]]:
                continue
            if d[e[1]] > d[e[0]] + e[2]:
                d[e[1]] = d[e[0]] + e[2]
                if i == n-1:
                    return False
    return d
d = f(N, M, edges)
if d:
    print(max(-d[-1], 0))
else:
    print(-1)   
        

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

string S;

int main() {
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		for (int j = i - 1; j < S.size(); j++) {
			string V = S.substr(0, i) + S.substr(j + 1, S.size() - (j + 1));
			if (V == "keyence") {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
A = rl()

num_min = len([a for a in A if a < 0])
B = [abs(a) for a in A]
if num_min % 2 == 0:
	print(sum(B))
else:
	print(sum(B) - 2*min(B))


Measured memory_bytes: 91936
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr = ds.begin(); itr != ds.end(); ++itr)
#define mp make_pair
#define INF 2000000000
#define INFL 2000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;


//#define DEBUG

#ifdef DEBUG
#define dprintf printf
#define dbg 
#define drepl(i,a,b) repl(i,a,b)
#define drep(i,n) rep(i,n)
#else
#define dprintf (true)?0:printf
#define dbg if(false)
#define drepl(i,a,b) int i; if(false)
#define drep(i,n) int i; if(false)
#endif // DEBUG



int main() {
	int N;
	cin >> N;
	vvi num(N);
	rep(i, N) {
		num[i] = vi(26, 0);
		string s;
		cin >> s;
		rep(j, s.length()) {
			num[i][s[j] - 'a']++;
		}
	}
	rep(i, 26) {
		int m = INF;
		rep(j, N) {
			m = min(m, num[j][i]);
		}
		rep(j, m) {
			cout << (char)('a' + i);
		}
	}
	cout << endl;

	return 0;
}

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

int main(){
    int n; cin >> n;
    ll ans = 0;
    rep(i, n+1){
        if((i % 3 != 0) && (i % 5 != 0)){
            if(i % 3 != 0){
                if(i % 5 != 0){
                    ans += i;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3592
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

int main() {
    int N;
    cin >> N;
    int a[401];
    rep(i, 0, N) cin >> a[i];

    ll cumsum[402];
    cumsum[0] = 0;
    rep(i, 0, N) cumsum[i+1] = cumsum[i] + a[i];

    ll dp[401][401];
    rep(i, 0, N+1){
        rep(j, 0, N+1){
            dp[i][j] = INF;
        }
    }
    rep(i, 0, N+1) dp[i][i] = 0;
    rep(i, 0, N) dp[i][i+1] = 0;
    rep(k, 2, N+1){
        for(int i=0; i<N+1; i++){
            int j = i + k;
            if(j > N) continue;
            for(int l=i+1; l<j; l++){
                dp[i][j] = min(dp[i][j], dp[i][l] + dp[l][j] + cumsum[j] - cumsum[i]);
            }
        }
    }
    cout << dp[0][N] << endl;

    return 0;
}




Measured memory_bytes: 1536
main :: IO ()
main = do ls <- getContents
          putStr (compose ls)

compose :: String -> String
compose = unlines . mathOp . fmap ((\[x,y,z] -> (read x::Int,y,read z::Int)) . take 3 . words) . lines

mathOp  :: [(Int, String, Int)] -> [String]
mathOp  [] = []
mathOp  ((m, op ,n):xs) | op == "?" = []
                        | otherwise = show (opr op m n) : mathOp xs

opr :: String -> Int -> Int -> Int
opr op | op == "+" = (+)
       | op == "-" = (-)
       | op == "*" = (*)
       | op == "/" = div
       | otherwise = error "Input is illegal."

Measured memory_bytes: 4012
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int N;
vector<vector<int>> G;
vector<int> C, D;

int bfs() {
    int ret = 0, idx = 0;
    D[0] = C[idx++];

    queue<int> Q;
    Q.push(0);
    while (!Q.empty()) {
        auto q = Q.front(); Q.pop();
        for (auto g : G[q]) {
            if (D[g]) continue;
            D[g] = C[idx++];
            ret += D[g];
            Q.push(g);
        }
    }

    return ret;
}

int main() {
    cin >> N;
    G.resize(N); C.resize(N); D.resize(N);

    REP(i, 0, N - 1) {
        int a, b; cin >> a >> b; a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    REP(i, 0, N) cin >> C[i];
    sort(ALL(C), greater<int>());

    cout << bfs() << endl;
    for (auto d : D) cout << d << " ";
    cout << endl;

    return 0;
}

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

int main(){
	int n;
  	cin >> n;
  	vector<int> v(n);
  	for(int i = 0; i < n; i++){
		cin >> v[i];
    }
  	
  	sort(v.begin(), v.end());
  	
  	cout << v[v.size()-1] - v[0] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,x,y) for(ll i=x; i<=y; i++)
#define BIT(t) ((long long 1) << t)
#define PER(i,y,x) for(ll i=y; i>=x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
using namespace std;
typedef long long ll;

map<int, int> mp;
int tbl[20][(1<<18) + 5];


int main(){
    int n;
    cin >> n;
    REP(i,1,(1 << n)){
        int x;
        cin >> x;
        mp[x]++;
    }
    auto itr = mp.end();
    itr--;
    int cur = 1;
    tbl[n][0] = 1;
    while(1){
        int tmp = itr->second;
        int cnt = 0;
        //cout << tmp << endl;
        PER(i,n,0){
            if(tbl[i][cur-1] >= tmp){
                tbl[i][cur-1] -= tmp;
                if(i>0){
                    tbl[i-1][cur] += tmp;
                }
                tmp = 0;
                //cout << itr->first << " " << i << " " << cur-1 << endl;
            }else {
                tmp -= tbl[i][cur-1];
                if(i>0){
                    tbl[i-1][cur] += tbl[i][cur-1];
                }
                tbl[i][cur-1] = 0;
            }
            if(tmp == 0){
                break;
            }
        }
        if(tmp > 0){
            //cout << itr->first << " " << tmp << endl;
            cout << "No" << endl;
            return 0;
        }
        PER(i,n-1,0){
            tbl[i][cur] += tbl[i+1][cur];
        }
        PER(i,n,0){
            tbl[i][cur] += tbl[i][cur-1];
        }
        //cout << "!" << endl;
        cur++;
        if(itr == mp.begin()){
            break;
        }
        itr--;
    }
    cout << "Yes" << endl;

}


Measured memory_bytes: 33024
#include<iostream>
#include<vector>
#include<queue>
#include<utility>
#include<algorithm>
#include<string>
using namespace std;
#define mkp make_pair
#define veb vector<bool>
#define vel vector<long long>
#define vvel vector<vel>
#define vvvel vector<vvel>
#define pin pair<long long,long long>
int main() {
	int n, m;
	cin >> n >> m;
	vel a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	vel ko{ 0,2,5,5,4,5,6,3,7,6 };
	vel dp(n + 10,-n);
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			int k1 = ko[a[j]];
			dp[i + k1] = max(dp[i + k1], dp[i] + 1);
		}
	}
	int mn = n;
	while (mn > 0) {
		int x = 0;
		int nen = mn;
		for (int i = 0; i < m; i++) {
			int mi = ko[a[i]];
			if (mn >= mi) {
				if (dp[mn - mi] == dp[mn] - 1) { x = a[i]; nen = mn - mi; }
			}
		}
		mn = nen;
		cout << x;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>

using namespace std;

int main(){

	int t,sum,s,e,n;

	while(true){
		scanf("%d",&t);
		if(t == 0)break;

		scanf("%d",&n);

		sum = 0;

		for(int i = 0; i < n; i++){
			scanf("%d %d",&s,&e);
			sum += e-s;
		}

		if(sum >= t){
			printf("OK\n");
		}else{
			printf("%d\n",t-sum);
		}

	}


    return 0;
}

Measured memory_bytes: 2696
#include <cstdio>
#include <cctype>
using namespace std;

int main () {
    char c;

    while (true) {
        scanf("%c", &c);
        if (c == '\n') {
            printf("\n");
            break;
        } else if (isupper(c)) {
            printf("%c", tolower(c));
        } else if (islower(c)) {
            printf("%c", toupper(c));
        } else {
            printf("%c", c);
        }
    }

    return 0;
}

Measured memory_bytes: 944
#include<bits/stdc++.h>
using namespace std;
int main()
{
     int a,b;
      cin>>a>>b;

        int g;
        int c=0;

       for(int i=1;i<=5000;i++)
       {
          int h=0.08*i;
          int k=0.1*i;

            if(h==a && k==b)
              {
                  g=i;
                  c=1;
                  break;
              }
       }
         if(c==0)
          cout<<"-1";

          else
          cout<<g;

}


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

int main() {
    string s;
    cin >> s;
    int N = s.length();
    for(int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            if (s[i] == 'L') {
                cout << "No" << "\n";
                return 0;
            }
        } else {
            if (s[i] == 'R') {
                cout << "No" << "\n";
                return 0;
            }
        }
    }
    cout << "Yes" << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
long long MOD = 1e9 + 7;
constexpr long long MAX = 1000000;

//long long MOD = 998244353;
constexpr ll INF = 1e17;
constexpr double PI = 3.141592653589793;


long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    ll x, y;
    cin >> x >> y;

    if ((x + y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }

    COMinit();

    ll n = (x + y) / 3LL;
    ll k = (2 * y - x) / 3LL;

    cout << COM(n, k) << endl;

    return 0;
}

Measured memory_bytes: 23680
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def main():
    n = INT()
    lis = make_divisors(n)
    #print(lis)

    if len(lis) % 2 == 0:
        p = len(lis)//2
        print(lis[p-1] + lis[p] - 2)
    else:
        q = len(lis)//2
        print(lis[q] * 2 - 2)

if  __name__=='__main__':
    main()


Measured memory_bytes: 5400
#![allow(unused_imports)]
#![allow(dead_code)]

use std::collections::*;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n = sc.read();
    let ma: usize = sc.read();
    let mb: usize = sc.read();
    let abc: Vec<(usize, usize, i32)> = (0..n).map(|_| (sc.read(), sc.read(), sc.read())).collect();
    let mut dp: Vec<Vec<Vec<i32>>> = vec![vec![vec![std::i32::MAX; 401]; 401]; n + 1];
    dp[0][0][0] = 0;
    for i in 0..n {
        for j in 0..401 {
            for k in 0..401 {
                if dp[i][j][k] == std::i32::MAX {
                    continue;
                }
                dp[i + 1][j][k] = std::cmp::min(dp[i + 1][j][k], dp[i][j][k]);
                if j + abc[i].0 as usize <= 400 && k + abc[i].1 as usize <= 400 {
                    dp[i + 1][j + abc[i].0][k + abc[i].1] = std::cmp::min(
                        dp[i + 1][j + abc[i].0][k + abc[i].1],
                        dp[i][j][k] + abc[i].2,
                    );
                }
            }
        }
    }
    let mut mul = 1;
    let mut ans = std::i32::MAX;
    while mul * ma <= 400 && mul * mb <= 400 {
        if dp[n][mul * ma][mul * mb] < ans {
            ans = dp[n][mul * ma][mul * mb];
        }
        mul += 1;
    }
    if ans == std::i32::MAX {
        ans = -1;
    }
    println!("{}", ans);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

Measured memory_bytes: 33020
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define ppi pair<int,pair<int,int> >
#define fr first
#define sc second
#define PI acos(-1)
#define mp make_pair

using namespace std;


#define sim template < class c

#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main()
{

    ios::sync_with_stdio(0);
    cin .tie(0);
    cout.tie(0);
    string s; cin >> s;
    string t; cin >> t;
    int cnt=  0;
    for(int i = 0;i<3;i++)
        cnt+=(s[i]==t[i]);

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	int stack[100], value, i, top = -1;
	char in[10];
	
	while (scanf("%s ", in) != EOF) {
		if ('0' <= in[0] && in[0] <= '9') {
			for (value = i = 0; in[i] != '\0'; i++) {
				value *= 10;
				value += in[i] - '0';
			}
			stack[++top] = value;
		} else if (in[0] == '+') {
			stack[top-1] += stack[top];
			top--;
		} else if (in[0] == '-') {
			stack[top-1] -= stack[top];
			top--;
		} else if (in[0] == '*') {
			stack[top-1] *= stack[top];
			top--;
		}
	}
	printf("%d\n", stack[top]);
	return 0;
}

Measured memory_bytes: 544
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func rev(s []byte) string {
	N := len(s)
	for i := 0; i < N/2; i++ {
		s[i], s[N-1-i] = s[N-1-i], s[i]
	}
	return string(s)
}

func check(a, b string) bool {
	for _, e := range a {
		if byte(e) == b[0] {
			return true
		}
	}
	return false
}

type pair struct {
	pre  string
	post byte
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N := getInt()
	s := make([]string, N)
	for i := 0; i < N; i++ {
		s[i] = rev([]byte(getString()))
	}
	sort.Slice(s, func(i, j int) bool {
		return len(s[i]) < len(s[j])
	})
	ans := 0
	mp := make(map[int]int)
	off := 100007
	for _, x := range s {
		hash := make([]int, len(x))
		hash[0] = int(x[0])
		for i := 1; i < len(x); i++ {
			hash[i] = hash[i-1]*off + int(x[i])
		}
		cnt := make([]int, 26)
		for i := 0; i < len(x); i++ {
			cnt[int(x[i]-'a')]++
		}
		for c := 0; c < 26; c++ {
			if cnt[c] == 0 {
				continue
			}
			h := c + 'a'
			_, ok := mp[h]
			if ok {
				ans += mp[h]
			}
		}
		for i := 0; i < len(x)-1; i++ {
			h := hash[i] * off
			cnt[x[i]-'a']--
			for c := 0; c < 26; c++ {
				if cnt[c] == 0 {
					continue
				}
				h += c + 'a'
				_, ok := mp[h]
				if ok {
					ans += mp[h]
				}
				h -= c + 'a'
			}
		}
		_, ok := mp[hash[len(x)-1]]
		if !ok {
			mp[hash[len(x)-1]] = 1
		} else {
			mp[hash[len(x)-1]]++
		}
	}
	out(ans)
}


Measured memory_bytes: 19812
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int compare(const void *a, const void *b)
{
    return strcmp((char *)a, (char *)b);
}

int main(void)
{
    intmax_t N;
    char S[(int)2e5][11];

    scanf("%jd", &N);
    for (size_t i = 0; i < N; i++) {
        scanf("%s", &S[i][0]);
    }

    qsort(S, N, sizeof(S[0]), compare);

    struct vote {
        size_t idx;
        uintmax_t cnt;
    } vote[(int)2e5];
    uintmax_t maxcnt = 1;
    vote[0].idx = 0;
    vote[0].cnt = 1;
    for (size_t i = 1, j = 0; i < N; i++) {
        if (strcmp(S[i - 1], S[i]) == 0) {
            vote[j].cnt++;
            if (vote[j].cnt > maxcnt) {
                maxcnt = vote[j].cnt;
            }
        } else {
            vote[++j].cnt++;
            vote[j].idx = i;
        }
    }

    for (size_t i = 0; i < N; i++) {
        if (vote[i].cnt == 0)
            break;
        if (vote[i].cnt == maxcnt) {
            printf("%s\n", &S[vote[i].idx][0]);
        }
    }

    return 0;
}


Measured memory_bytes: 7240
import itertools
N = int(input())
l = []
for _ in range(N):
    a = int(input())
    xy = [list(map(int, input().split())) for _ in range(a)]
    l.append(xy)
#print(l) #[[[2, 0]], [[1, 1]]]

test_list = list(itertools.product([1,0],repeat=N))
test_list = sorted(test_list, key=lambda x:x.count(0))
#print(test_list) #[(1,1),(1,0),(0,1),(0,0)]

for test in test_list:
    for i in range(N):
        if test[i]:
            for l_ in l[i]:
                if l_[1] != test[l_[0]-1]:
                    break
            else:
                continue
            break
    else:
        print(test.count(1))
        break
    continue

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

int main()
{
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int L = A + B;
  int R = C + D;
  
  string ans;
  if (L == R) ans = "Balanced";
  else if (L > R) ans = "Left";
  else ans = "Right";
  
  cout << ans << endl;
}

Measured memory_bytes: 256
li=["KIHBR","AKIHBR","KIHABR","KIHBAR","KIHBRA","AKIHABR","AKIHBAR","AKIHBRA","KIHABAR","KIHABRA","KIHBARA","AKIHABAR","AKIHABRA","AKIHBARA","KIHABARA","AKIHABARA"]

if input() in li:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 9080
#include <iostream>

using namespace std;

int A, B, C, D, E, F;

int main(void) {

	cin >> A >> B >> C >> D >> E >> F;

	double max_val = -1.0;
	int v1=0, v2=0;

	for (int a = 0; a <= 30; a++) {
		for (int b = 0; b <= 30; b++) {
			if (100 * A*a + 100 * B*b > F) { continue; }
			int P = (a*A + b*B)*E;
			for (int c = 0;; c++) {
				if (c*C > P) { break; }
				for (int d = 0;; d++) {
					if (c*C + d*D > P || 100*a*A+100*b*B+c*C+d*D>F) { break; }
					if (max_val < 100.0*(c*C + d*D) / (1.0*(100 * a*A + 100 * b*B + c*C + d*D))) {
						max_val = 100.0*(c*C + d*D) / (1.0*(100 * a*A + 100 * b*B + c*C + d*D)); v1 = 100 * a*A + 100 * b*B + c*C + d*D; v2 = c*C + d*D;
					}

				}
			}

		}
	}

	cout << v1 << " " << v2 << endl;

	//system("pause");
	return 0;
}

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    FOREACH(x, v) { cout << x << " "; }                                        \
    cout << "\n";

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N, lx, ly, lt;

int main() {
    cin >> N;
    REP(i,N){
        LCIN(t,x,y);
        if(abs(x-lx)+abs(y-ly)>t-lt){
            cout <<"No"<<"\n";
            return 0;
        }
        if((abs(x-lx)+abs(y-ly))%2!=(t-lt)%2){
            cout <<"No"<<"\n";
            return 0;
        }
        lx=x; ly=y; lt=t;
    }
    cout <<"Yes"<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath> 
#include <string>
typedef long long ll;
using namespace std;

ll abc140d(ll n, ll k, char faces[]) {
  ll a = 0;
  for(ll i =0;i<n;i++) {

    if(i != n-1) {
      if(faces[i] != faces[i+1]) {
	a++;
      }
    } else {
    }

  }
  return n-1 - max(a - 2*k, 0LL);
}
int main() {
  ll n, k;
  cin >> n >> k;
  string s;  
  cin >> s;
  char faces[n];
  for(ll i=0;i<n;i++) {
    faces[i] = s[i];
  }
  cout << abc140d(n, k, faces);
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;

// ****************************************CODE***************************************//

ll h, w;
vector<string> a;

ll dp[1100][1100];

void add(ll &a, ll b){
    a += b;
    if(a >= mod) a -= mod;
}

int main() {
    cin >> h >> w;
    a.resize(h);
    for(int i = 0; i < h; i++) cin >> a[i];

    dp[0][0] = 1;

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(i+1 < h && a[i+1][j] == '.') add(dp[i+1][j], dp[i][j]);
            if(j+1 < w && a[i][j+1] == '.') add(dp[i][j+1], dp[i][j]);
        }
    }

    cout << dp[h-1][w-1] << endl;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() { 
  int n;
  cin >> n;
  vl a(n);
  rep(i,n) cin >> a[i];
  ll ans = 0,sum=0;
  int r = 0;
  rep(l,n){
    while(r<n && ((sum+a[r]) == (sum^a[r]))){
      sum+=a[r];
      r++;
    }
    ans+=r-l;
    if(r-l)sum-=a[l];
    else r++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

int main() {
    int d;
    cin >> d;
    string ans;
    if (d == 25) ans = "Christmas";
    else if (d == 24) ans = "Christmas Eve";
    else if (d == 23) ans = "Christmas Eve Eve";
    else ans = "Christmas Eve Eve Eve";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

struct UnionFind {
  vector<int> d;
  UnionFind(int n): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    rep(i,m) {
        int x, y, z;
        cin >> x >> y >> z;
        x--; y--;
        uf.unite(x,y);
    }
    set<int> s;
    rep(i,n) {
        s.insert(uf.find(i));
    }
    int ans = s.size();
    cout << ans << endl;
    return 0;
}

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

typedef pair<int,int>   pii;
typedef vector< pii >  vii;
typedef long long int 	ll;

#define pb push_back
#define fe first
#define se second
#define all(a) (a).begin(),(a).end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define scn(n) scanf("%d",&n)
#define prn(n) printf("%d\n",n)
#define scnl(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mset(A, val) memset(A, val, sizeof(A))

const ll mod = 1e9 + 7ll;
const int N = (int)1e5 + 7;

int main(){
	
	fast_io;
	int a,b;
	cin>>a>>b;
	cout<<max(0,a-2*b)<<endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
using static System.Console;
using static System.Math;


namespace abc90_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            long M=0;
            long A=0;
            long R=0;
            long C=0;
            long H=0;

            for(int i=0; i<n; i++)
            {
                var s = ReadLine().Substring(0,1);

                switch(s)
                {
                    case ("M"):
                        M++;
                        break;
                    case ("A"):
                        A++;
                        break;
                    case ("R"):
                        R++;
                        break;
                    case ("C"):
                        C++;
                        break;
                    case ("H"):
                        H++;
                        break;
                    default:
                        break;
                }
            }
            long sum = (M*A*R)+(M*A*C)+(M*A*H)+(M*R*C)+(M*R*H)+(M*C*H)+(A*R*C)+(A*R*H)+(A*C*H)+(R*C*H);
            WriteLine(sum);
        }
    }
}

Measured memory_bytes: 15184
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
	int R,G,B,N;
	int count = 0;
	cin >> R >> G >> B >> N;
	for(int i = 0; i <= (N/R); i++){
		for(int j = 0; ((N-(i*R))/G) >= j ;j++){
			
			if((N-(i*R)-(j*G))%B == 0){
				count++;
			}
		}
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,n,t,m,ans,npr1,npr2,ncr1,ncr2;
    //int minirow=INT_MAX,minicol=INT_MAX,maxrow=INT_MIN,maxcol=INT_MIN;
    //int i,j;
    //string s[100],p;
    //char ch;
    cin>>n>>m;
    npr1=n*(n-1);
    ncr1=npr1/2;
    npr2=m*(m-1);
    ncr2=npr2/2;
    //cout<<npr1<<endl;
    //cout<<ncr1<<" "<<ncr2<<endl;
    ans=ncr1+ncr2;
    cout<<ans<<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    int m=min(a,b);
    int n=min(c,d);
    printf("%d\n",m+n);
    return 0;
}


Measured memory_bytes: 256
N=int(input())
i=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(i[N-1])

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		try {
			while(scan.hasNext()){
				BigInteger bigInteger1=new BigInteger(scan.next());
				BigInteger bigInteger2=new BigInteger(scan.next());
				BigInteger bigInteger3=bigInteger1.gcd(bigInteger2);
				BigInteger bigInteger4=bigInteger1.multiply(bigInteger2).divide(bigInteger3);
				System.out.println(bigInteger3+" "+bigInteger4);
				
				
			}
		} catch (Exception e) {
			// TODO: handle exception
		}
		
	}

}

Measured memory_bytes: 15420
#include<cstdio>
#include<algorithm>
using namespace std;
int n, w[201000], res;
int main() {
	int i, a;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		scanf("%d", &a);
		w[a] = i;
	}
	int c = 0;
	for (i = 1; i <= n; i++) {
		if (w[i] < w[i + 1])c++;
		else c = 0;
		res = max(res, c + 1);
	}
	printf("%d\n", n - res);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n; cin >> n;
    map<int,int> m;
    REP(i,n) {
        int x;
        cin >> x;
        m[x]++;
    }

    priority_queue<int> pq;
    for(auto p:m) {
        // cerr << p.second << endl;
        pq.push(p.second);
    }
    // cerr << endl;
    while(pq.top() != 1) {
        int t = pq.top(); pq.pop();
        // cerr << t << endl;
        if (t > 2) {
            while(t > 2) t -= 2;
            pq.push(t);
        } else { 
            int s = pq.top(); pq.pop();
            if (s == 2) { // 2 2 -> 1 1
                REP(i,2) pq.push(1);
            } else pq.push(1); // 2 1 -> 0 1
        }
    }

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

    return 0;
}

Measured memory_bytes: 5632
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
aa = a % 10
bb = b % 10
cc = c % 10
dd = d % 10
ee = e % 10
Ra =0
Rb =0
Rc =0
Rd =0
Re =0

if aa == 0:
    Ra = a//10
    aa = 10
else: Ra = (a //10) + 1

if bb == 0:
    Rb = b//10
    bb = 10
else: Rb = (b //10) + 1

if cc == 0:
    Rc = c//10
    cc = 10
else: Rc = (c //10) + 1

if dd  == 0:
    Rd = d//10
    dd = 10
else: Rd = (d //10) + 1

if ee == 0:
    Re = e//10
    ee = 10
else: Re = (e //10) + 1

xx = min(aa,bb,cc,dd,ee)

print(xx + (Ra +Rb + Rc +Rd + Re -1)*10)

Measured memory_bytes: 3064