akhauriyash/Code-Regression huggingface dataset:
#include<cmath>  
#include<queue>  
#include<vector>  
#include<cstdio>  
#include<cstring>  
#include<iostream>  
#include<algorithm>  
#define INF 1000005 
#define MAXN 500000
int read() 
{ 
    int f=1,x=0;char s=getchar(); 
    while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();} 
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();} 
    return x*f; 
} 
struct node{
	int key;
	node *ch[2],*fa;
};
node tree[MAXN+5];
node *Root,*NIL,*ncnt;
void Init()
{
	NIL=&tree[0];
	NIL->fa=NIL->ch[0]=NIL->ch[1]=NIL;
	ncnt=&tree[1];
	Root=NIL;
	return ;
}
inline node *NewNode(int val)
{//插入新的?点
	node *p=++ncnt;
	p->key=val;
	p->fa=p->ch[0]=p->ch[1]=NIL;
	return p;
}
void Insert(node *&rt,node *fa,int val)
{//插入(?造二叉排序?)
	if(rt==NIL)
	{
		rt=NewNode(val);
		rt->fa=fa;
		return ;
	}
	int d=(val>=rt->key);
	Insert(rt->ch[d],rt,val);
	return ;
}
void InOrder(node *rt)
{//?出
	if(rt==NIL) return ;
	InOrder(rt->ch[0]);
	printf(" %d",rt->key);
	InOrder(rt->ch[1]);
	return ;
}
void PreOrder(node *rt)
{//?出
	if(rt==NIL) return ;
	printf(" %d",rt->key);
	PreOrder(rt->ch[0]);
	PreOrder(rt->ch[1]);
	return ;
}
node *Find(node *rt,int val)
{//找一?在??中
	if(rt==NIL) return NIL;
	if(rt->key==val) return rt;
	int d=(val>=rt->key);
	return Find(rt->ch[d],val);
}
node *FindNext(node *rt)
{
	if(rt==NIL) return NIL;
	node *y=rt->ch[1];
	while(y->ch[0]!=NIL)
		y=y->ch[0];
	return y;
}
void Delete(node *rt,int val)
{
	node *x,*y,*z=Find(rt,val);
	if(z==NIL) return ;
	if(z->ch[0]==NIL||z->ch[1]==NIL)
		y=z;
	else
		y=FindNext(z);
	if(y->ch[0]!=NIL)
		x=y->ch[0];
	else
		x=y->ch[1];
	if(x!=NIL)
		x->fa=y->fa;
	if(y->fa==NIL)
		Root=x;
	else
	{
		int d=(y==y->fa->ch[1]);	
		y->fa->ch[d]=x;
	}
	if(y!=z)
		z->key=y->key;
	return ;
}
int main()
{
    int n=read(),x;
	char op[20];
	Init();
	for(int i=1;i<=n;i++)
	{
		scanf("%s",op);
		if(op[0]=='i')
		{
			x=read();
			Insert(Root,NIL,x);
		}
		else if(op[0]=='f')
		{
			x=read();
			if(Find(Root,x)==NIL)
				printf("no\n");	
			else
				printf("yes\n");
		}
		else if(op[0]=='d')
		{
			x=read();
			Delete(Root,x);
		}
		else
		{
			InOrder(Root);
			puts("");
			PreOrder(Root);
			puts("");
		}
	}
	return 0;  
}  

Measured memory_bytes: 15708
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

int N;

int main() {

	scanf("%d", &N);

	if (N >= 1000) printf("ABD\n");
	else
	printf("ABC\n");

	return 0;
}


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

int x,y,z,p = 0;

int main(){
    cin >> x >> y >> z;
    if(x < y + 2 * z){
        cout << p << endl;
        return 0;
     }
     p = 1;
     x = x - (y + z); 
     while(x >= y + 2 * z){
         p++;
         x = x - (y + z);
     }
     cout << p << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){

	int a, b;
	scanf("%d %d", &a, &b);

	if (a < b)
	{
		printf("a < b\n");
	}
	else if (a > b)
	{
		printf("a > b\n");
	}
	else
	{
		printf("a == b\n");
	}
	return 0;
}


Measured memory_bytes: 2112
n,a,b = map(int,input().split())
s = input()
total = a+b
cnt_t = 0
cnt_b = 0
for i in s:
  if i == 'a' and total > cnt_t:
    print('Yes')
    cnt_t += 1
  elif i == 'b' and total > cnt_t and b > cnt_b:
    print('Yes')
    cnt_t += 1
    cnt_b += 1
  else:
    print('No')

Measured memory_bytes: 4016
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

    private static int n;
    private static boolean[] color;
    private static List<List<Edge>> adj = new ArrayList<List<Edge>>();
    private static final int INF = 1 << 24;

    private static void input() {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            adj.add(new ArrayList<Edge>());
        }
        for (int i = 0; i < n; i++) {
            int v = scanner.nextInt();
            int k = scanner.nextInt();
            for (int j = 0; j < k; j++) {
                int f = scanner.nextInt();
                int s = scanner.nextInt();
                adj.get(v).add(new Edge(f, s));
            }
        }
    }

    private static void efficient_dijkstra() {
        color = new boolean[n];
        int[] d = new int[n];
        PriorityQueue<Edge> pq = new PriorityQueue<Edge>();
        pq.add(new Edge(0, 0));
        Arrays.fill(d, INF);
        d[0] = 0;
        while (!pq.isEmpty()) {
            Edge f = pq.poll();
            int u = f.second;
            color[u] = true;
            if (d[u] < f.first)
                continue;
            for (int i = 0; i < adj.get(u).size(); i++) {
                int v = adj.get(u).get(i).first;
                if (color[v])
                    continue;
                int a = adj.get(u).get(i).second;
                if (d[v] > d[u] + a) {
                    d[v] = d[u] + a;
                    pq.add(new Edge(d[v], v));
                }
            }
        }
        for (int i = 0; i < n; i++) {
            System.out.printf("%d %d\n", i, d[i]);
        }

    }

    static class Edge implements Comparable<Edge> {
        int first;
        int second;

        public Edge(int first, int second) {
            super();
            this.first = first;
            this.second = second;
        }

        @Override
        public int compareTo(Edge o) {
            return this.first - o.first;
        }

    }

    public static void main(String[] args) {
        input();
        efficient_dijkstra();
    }
}

Measured memory_bytes: 218884
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] x=new int[n];
		
		for(int i=0;i<n;i++)
			x[sc.nextInt()]++;
		int m = 0;
		boolean can = true;
		if(n%2==1){
			if(x[0]!=1)
				can = false;
			for(int i=2;i<n;i+=2){
				m++;
				if(x[i]!=2)
					can = false;
			}
		}
		else{
			for(int i=1;i<n;i+=2){
				m++;
				if(x[i]!=2)
					can = false;
			}
		}
		long sum = 1;
		int all = (int)1e9+7;
		if(can){
			for(int i=0;i<m;i++){
				sum*=2;
				sum%=all;
			}
		}else
			sum=0;
		System.out.print(sum);
	}
}


Measured memory_bytes: 48924
N, K = map(int, input().split())
A = list(map(int, input().split()))

B = [0 for i in range(40)]

for a in A:
    for i in range(40):
        B[i] += (a & (1 << i)) >> i

ans = 0
s = 0
for i in range(39, -1, -1):
    if K & (1 << i) > 0:
        tmp = s
        tmp += B[i] << i
        for j in range(i-1, -1, -1):
            tmp += max(B[j], N - B[j]) << j
        ans = max(ans, tmp)
    if K & (1 << i) > 0:
        s += (N - B[i]) << i
    else:
        s += B[i] << i

ans = max(ans, s)

print(ans)


# 9 1001

# 7 0111
# 4 0100
# 0 0000
# 3 0011

# 8 * 4 + 4 * 2 + 2 * 2 + 2 * 1
# 32 + 8 + 4 + 2


Measured memory_bytes: 14984
#

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    mod = 10**9 + 7

    N,K = map(int, input().split())
    a = tuple(map(int, input().split()))
    dp = [[0]*(K+1) for _ in range(N+1)]
    dp[0][0] = 1
    for i in range(N):
        temp = dp[i][0]
        k = a[i]
        for j in range(K+1):
            if j == 0:
                dp[i+1][j] = temp
                continue
            if j <= k:
                temp += dp[i][j]
                dp[i+1][j] = temp%mod
            else:
                temp += dp[i][j] - dp[i][j-k-1]
                dp[i+1][j] = temp%mod
    print(dp[N][K]%mod)


if __name__ == '__main__':
    main()

Measured memory_bytes: 117744
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
res = 0
sum_val = 0
for i in range(N):
    if res + B[i] >= A[i]:
        sum_val += A[i]
        res = min(res + B[i] - A[i], B[i])
    else:
        sum_val += res + B[i]
        res = 0

if res >= A[N]:
    sum_val += A[N]
else:
    sum_val += res

print(sum_val)

Measured memory_bytes: 18476
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
s=input()
if s.isupper():
    print("A")
else:
    print("a")
































Measured memory_bytes: 61996
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;




ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> h(N);
    rep(i, N)cin >> h[i];
    vector<bool> good(N, true);
    rep(i, M){
        int A, B;
        cin >> A >> B;
        if(h[A - 1] > h[B - 1]) good[B - 1] = false;
        else if(h[A - 1] < h[B - 1]) good[A - 1] = false;
        else if(h[A - 1] == h[B - 1]){
            good[A - 1] = false;
            good[B - 1] = false;
        }
    }

    int ans = 0;
    rep(i, N){
        if(good[i] == true) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3732
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

ll ans;
ll H;

ll solve(ll x) {

}

int main(void) {
    scanf("%lld", &H);

    ll x = 1;
    while (H > 0) {
        ans += x;
        x *= 2;
        H /= 2;
    }
  
    printf("%lld\n", ans);

	return 0;
}


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

#define FOR(i, j, k) for(int i=j ; i<k ; i++)
#define REP(i, j) FOR(i, 0, j)
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main() {
    int a, b; cin >> a >> b;

    int c = b - a;
    int ans = 0;
    REP(i, c) ans += i + 1;
    cout << ans - b << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <cmath>
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	double a,b,x;
	cin>>a>>b>>x;
	if(2*x>=a*a*b){
		printf("%.9f",180*atan2((a*a*b-x)*2/(a*a*a),1.0)/M_PI);
	}
	else{
		printf("%.9f",90.0-180*atan2(2*x/(a*b*b),1.0)/M_PI);
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 4112
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <map> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

//すべての積が負か正かzeroか
//負とzeroを数える

int main(){
    ll a,b;
    cin >> a >> b;
    string res;
    if(a > 0)
    {
        res = "Positive";
    }
    else if(a <= 0 && b >= 0)
    {
        res = "Zero";
    }
    else
    {
        //負の数
        //-5 -3 -> Negative

        if((b - a) % 2 == 0)
        {
            res = "Negative";
        }
        else
        {
            res = "Positive";
        }
    }
    
    cout << res << endl;

    return 0;    
}



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

fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(&mut i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run(i: &mut BufRead, o: &mut Write) {
    let hwd = read_vec::<usize>(i);
    let (h, w, d) = (hwd[0], hwd[1], hwd[2]);
    let wh = w * h;
    let mut a_to_xy = vec![(0, 0); wh + 1];
    for y in 0..h {
        let a = read_vec::<usize>(i);
        for x in 0..w {
            a_to_xy[a[x]] = (x, y);
        }
    }
    fn abs_sub(x0: usize, s1: usize) -> usize {
        (x0 as isize - s1 as isize).abs() as usize
    }

    let mut mps = vec![0; wh + 1];
    for i in 1..wh + 1 - d {
        let xy0 = a_to_xy[i];
        let xy1 = a_to_xy[i + d];
        mps[i + d] = mps[i] + abs_sub(xy0.0, xy1.0) + abs_sub(xy0.1, xy1.1);
    }
    std::mem::drop(a_to_xy);

    let q = read::<usize>(i);
    for _ in 0..q {
        let lr = read_vec::<usize>(i);
        let (l, r) = (lr[0], lr[1]);
        let mp = mps[r] - mps[l];
        writeln!(o, "{}", mp).unwrap();
    }
}

fn read_line(i: &mut BufRead) -> String {
    let mut line = String::new();
    i.read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn read<T: FromStr>(i: &mut BufRead) -> T {
    read_line(i).parse().ok().unwrap()
}
fn read_vec<T: FromStr>(i: &mut BufRead) -> Vec<T> {
    read_line(i)
        .split(' ')
        .map(|x| x.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 6396
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
using namespace std;
const int INF = 1000000000000;
const int mod = 1000000007;
int cnt[345678];
signed main() {
	int n, ans = 0; cin >> n;
	while (n >= 5) {
		if (n >= 500) { ans += 1000; n -= 500; }
		else { ans += 5; n -= 5; }
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define INVALID_S "x"

int main() {
  char costmap[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  for (int i = 0; i < M; i++)
    cin >> A[i];
  vector<string> dp(N+1);
  for (int i = 0; i <= N; i++) {
    if (i == 0) {
      dp[0] = "";
      continue;
    }
    int maxdigit = -1;
    string maxs;
    for (int j = 0; j < M; j++) {
      if (i >= costmap[A[j]]) {
        string prev = dp[i-costmap[A[j]]];
        if (prev == INVALID_S)
          continue;
        if (prev.length() >= maxs.length() || (prev.length() == maxs.length()-1 && A[j] > maxdigit)) {
          maxs = to_string(A[j]) + prev;
          maxdigit = A[j];
        }
      }
    }
    if (maxdigit < 0) {
      dp[i] = INVALID_S;
    } else {
      //cout << i << ":" << maxs << endl;
      dp[i] = maxs;
    }
  }
  cout << dp[N] << endl;
  return 0;
}


Measured memory_bytes: 32384
from bisect import bisect_right
from itertools import accumulate

N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

A.sort()
B.sort()
C.sort()

# a < b < c

# Bcnt[i]: B[i]が置ける下部パーツの数
Bcnt = [0] * N
for i,b in enumerate(B):
    r = bisect_right(C, b)
    Bcnt[i] = N - r
 
Bcnt = [0] + list(accumulate(Bcnt))
 
Acnt = [0] * N
for i,a in enumerate(A):
    r = bisect_right(B, a)
    Acnt[i] = Bcnt[N] - Bcnt[r]

print(sum(Acnt))

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

ll mod = 1e9+7; 

ll dp[3001][3001];

ll n;

char c[3001];

int main(){
    cin>>n;
    for(int i=1;i<n;i++)
        cin>>c[i];
    dp[1][1]=1;
    for(int i=2;i<=n;i++)
    for(int j=1;j<=i;j++){

        if(c[i-1]=='<') 
            dp[i][j] = (dp[i][j-1] + dp[i-1][j-1] + mod) %mod;
        else
            dp[i][j] = (dp[i][j-1] + (dp[i-1][i-1] - dp[i-1][j-1] + mod) %mod + mod ) %mod;
    }

    cout<<dp[n][n]<<endl;
}



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

int main()
{
	int x;
	cin >> x;

	if (x == 3 || x == 7 || x == 5) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
type pair = {
  order:int;
  id:int
}

let () = Scanf.scanf "%d" @@ fun n -> 
  let array = Array.init n @@ fun i -> Scanf.scanf " %d" @@ fun a -> {order = a; id = i+1} in
  let compare p1 p2 =
    match p1 with {order = order1; id = id1} ->
    match p2 with {order = order2; id = id2} ->
    if order1 = order2 && id1 = id2 then 0
    else if order1 > order2 then 1
    else if order1 = order2 && id1 > id2 then 1
    else -1 in
  Array.sort compare array;
  for i = 1 to n do
    match array.(i-1) with {order = _; id = ans} ->
    if i = 1 then Printf.printf "%d" ans
    else Printf.printf " %d" ans
  done;

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

const ll INF = 1001001001;

ll gcd(ll a,ll b){
  if(b==0) return a;
  else return gcd(b,a%b);
}

ll f(ll x){
  if(x==0) return 0;
  else if(x==1) return 1;
  return x*f(x-1);
}

int zetai(int y,int z ){
  if(y>=z) return y-z;
  else return z-y;
}

//再起関数でとく

int main(){
  int n,k;
  cin>>n>>k;
  vector<int>d(k);
  vector<int>vec(n,0);
  for(int i=0;i<k;i++){
    cin>>d[i];
    vector<int>a(d[i]);
    for(int j=0;j<d[i];j++){
      cin>>a[j];
      vec[a[j]-1]++;
    }
  }
  int ans=0;
  rep(i,n){
    if(vec[i]==0){
      ans++;
    }
  }
  cout<<ans<<endl;
  
  return 0;
}



Measured memory_bytes: 3636
//run: g++ -std=c++14 -o run_sol.exe solution.cpp -DLOCAL_JUDGE
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define INFLL 1e17
#define PI 2*acos(0.0)
#define show(x) cout<< #x <<" is "<< x <<"\n"
using namespace std;

#define FS first
#define SC second
#define PB(t) push_back(t)
#define LEN(t) ((int)t.size())
#define ALL(t) t.begin(),t.end()
#define MP(x, y) make_pair((x), (y))
#define Fill(a,c) memset(&a, c, sizeof(a))
#define POPCOUNT __builtin_popcount

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<PII> VPII;

const int mod = 1e9 + 7;

int main() {
    #ifdef LOCAL_JUDGE
        freopen("../input.txt", "rt", stdin);
        freopen("../output.txt", "wt", stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(NULL);

    for (int n, m; cin >> n >> m; ) {
        string mat;
        vector<VI> dp(n, VI(m, 0));
        dp[0][0] = 1;
        for (int i = 0; i < n; i++) {
            cin >> mat;
            
            for (int j = 0; j < mat.size(); j++) {
                if (mat[j] == '.') {
                    if (i - 1 >= 0)
                        dp[i][j] += dp[i - 1][j];
                    if (j - 1 >= 0)
                        dp[i][j] += dp[i][j - 1];
                    dp[i][j] %= mod;
                    // dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
                } else {
                    dp[i][j] = 0;
                }
            }
        }
        cout << dp[n - 1][m - 1] << "\n";
    }
    

return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i) 
typedef long long ll;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
/*
	　　　  　 ,ﾍ／L──- 、
	　　　   　Lﾆ)r_」=＝= ｲ
	　　 　,ﾍ、i ﾉノλﾉﾊﾉﾍ
	　　   ,'　｀(ﾊﾘ ﾟ ヮﾟﾉi)　',
	　　 .i　　 >〈(つ,i!と)　　i
	　　  vﾍγk´_/___i,ゝﾍノ
	　　　　　 ｀ﾞr_,ｨ_ｧﾞ´
*/
int n;
cin >> n;
string s = "Christmas";
if (n == 25) {
	cout << s << endl;
	return 0;
}
else {
	rep1(i, 25 - n) {
		s += " Eve";
	}
	cout << s << endl;
}

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;


int main() {

	ll N, M;
	cin >> N >> M;

	pair<ll, ll> dr[MAX];
	repn(i, N) cin >> dr[i].first >> dr[i].second;

	sort(dr + 1, dr + N + 1);

	ll ans = 0;

	ll store = 1;

	repn(i, M) {
		ans += dr[store].first;
		dr[store].second--;
		if (dr[store].second == 0) { store++; }
	}

	cout << ans;



	
	system("PAUSE");
}

Measured memory_bytes: 16120
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
#define moder 1000000007
#define inf 1000000000000000000
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

static int n, a[200005];
signed main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		if (i&&a[i] > a[i - 1] + 1) {
			cout << -1 << endl;
			endre;
		}
	}
	if (a[0] != 0) {
		cout << -1 << endl;
		endre;
	}
	int ans = a[n - 1];
	for (int i = n - 2; i >= 0; i--) {
		if (a[i] == a[i + 1] - 1)continue;
		ans += a[i];
	}
	cout << ans << endl;
	endre;
}

Measured memory_bytes: 1792
// Problem : C - String Transformation
// Contest : AtCoder - AtCoder Beginner Contest 110
// URL : https://atcoder.jp/contests/abc110/tasks/abc110_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	string S,T;
	cin>>S>>T;
	int N=sz(S);
	map<char,char> m1,m2;
	F0R(x,N)
	{
		if(m1.find(S[x])==m1.end())
		{
			m1[S[x]]=T[x];
			// continue;
		}
		else if(m1[S[x]]!=T[x])
		{
			cout<<"No"<<nl;
			return 0;
		}
		if(m2.find(T[x])==m2.end())
		{
			m2[T[x]]=S[x];
			// continue;
		}
		else if(m2[T[x]]!=S[x])
		{
			cout<<"No"<<nl;
			return 0;
		}
	}
	cout<<"Yes"<<nl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3808
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <array>
#include <string>
#include <tuple>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>

/* ----- Type Alias ----- */
using lint = long long int;
using Real = long double;
template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T>
T ndvec(T v) { return v; }

template <class T, class... Ts>
auto ndvec(size_t l, Ts... ts) {
    return std::vector<decltype(ndvec<T>(ts...))>(l, ndvec<T>(ts...));
}

template <class Cost = int>
struct Edge {
    int src, dst;
    Cost cost;
    Edge(int src = -1, int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = int>
using Edges = std::vector<Edge<Cost>>;
template <class Cost = int>
using Graph = std::vector<std::vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    int precision;
    explicit Fout(int precision) : precision(precision) {}
};

std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}

/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// const Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

int main() {
    int n;
    std::cin >> n;
    for (int i = 1; i <= 9; ++i) {
        if (n % i == 0 && n / i <= 9) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }

    std::cout << "No" << std::endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray();
		int[] alphabetNum = new int[26];
		for (int i = 0; i < alphabetNum.length; i++)
		{
			alphabetNum[i] = 0;
		}

		while (sc.hasNext())
		{
			char[] input = sc.next().toLowerCase().toCharArray();

			for (int i = 0; i < input.length; i++)
			{
				for (int j = 0; j < alphabet.length; j++)
				{
					if (input[i] == alphabet[j])
					{
						alphabetNum[j]++;
						break;
					}
				}
			}
		}

		for (int i = 0; i < alphabetNum.length; i++)
		{
			System.out.println(alphabet[i] + " : " + alphabetNum[i]);
		}
	}
}



Measured memory_bytes: 26224
#include<bits/stdc++.h>
using namespace std;
typedef		 long long int    ll;
typedef		vector<ll>      vll;
#define     fi              first
#define     print(v)        for(ll i:v) cout<<i<<ss
#define     se              second
#define		pb              push_back
#define		nn              "\n"
#define		all(p)          p.begin(),p.end()
#define		zz(v)           (ll)v.size()
#define 	S(a)            scanf("%lld",&a)
#define 	SS(a,b)         scanf("%lld %lld",&a,&b)
#define 	SSS(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define		ss              ' '
#define     pii             pair<ll,ll>
#define		gcd(a,b)        __gcd(a,b)
#define		lcm(a,b)        (a*b)/gcd(a,b)
const double eps = 1e-8;

const ll N=1e5+10;

vll v[N];
ll in[N];
ll dis[N];
ll vis[N];


void dfs(ll u)
{
    vis[u]=1;


    for(ll i:v[u])
    {
        dis[i]=max(dis[i],1+dis[u]);
        in[i]--;
        if(in[i]==0)
        {
            dfs(i);
        }
    }



}


int main()
{

    ll n,m;
    cin>>n>>m;
    while(m--)
    {
        ll a,b;
        cin>>a>>b;
        v[a].pb(b);
        in[b]++;
    }


    for(ll i=1; i<=n; i++)
    {

        if(!vis[i]&&in[i]==0)
        {
            dfs(i);
        }


    }



    ll ans=0;
    for(ll i=1; i<=n; i++)
    {
        ans=max(ans,dis[i]);
    }

    cout<<ans<<nn;




}


/* Final check before submit :

1. array size or integer overflow,like uninitialised 0 index.

2. Think twice,code once.check all possible counter test case.

3. Be careful about corner case! n=1?k=1? something about 0?

4. avoid stupid mistake!complexity(t/m)?precision error?submit same code twice?

5. if got WA than remember that you are missing something common.
   *** Be confident!!! who knows? may be your one step back to AC ***
4. minus mod ans=(ans-k+mod)%mod;

*/






Measured memory_bytes: 16072
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
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()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

#素因数分解
def factorization(n):
	arr = []
	tmp = n
	for i in range(2, int(-(-n**0.5//1))+1):
		if tmp%i == 0:
			cnt = 0
			while tmp%i == 0:
				cnt += 1
				tmp //= i
			arr.append([i, cnt])
	if tmp != 1:
		arr.append([tmp, 1])
	if arr == []:
		arr.append([n, 1])
	return arr

N = INT()
A = LIST()

def max_gcd(n):
	g = []
	for p, q in factorization(n):
		g += [p]*q
	g.sort(reverse = True)
	cnt = [0]*len(g)
	cnt_memo = [-1]*len(g)
	for i in range(N):
		a = A[i]
		for j in range(len(g)):
			if a%g[j] == 0:
				cnt[j] += 1
				a //= g[j]
			elif cnt_memo[j] == -1:
				cnt_memo[j] = i

	ans = 1
	flg = True
	for i in range(len(g)):
		if cnt[i] == N:
			ans *= g[i]
		elif cnt[i] == N-1 and flg:
			ans *= g[i]
			flg = False
			tmp = cnt_memo[i]
		elif cnt[i] == N-1 and cnt_memo[i] == tmp:
			ans *= g[i]

	return ans

print(max(max_gcd(A[0]), max_gcd(A[1])))


Measured memory_bytes: 22020
#include<stdio.h>

int f(int angka){
	int v=100000000,panjang,total=0;
	
	for(int i=0; i<9; i++){
		total=total+(angka/v);
		angka=angka%v;
		v/=10;
		
	}
	
	
	return total;
}

int main(){
	int a;
	scanf("%d", &a);
	int b=f(a);
	printf("%s\n", a%b==0?"Yes":"No");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long       ll;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define PI                acos(-1)
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define f first
#define s second
#define fore(i,b,e)		  for(int i=(int)b;i<(int)e;++i)
#define forr(i,b,e)		  for(int i=(int)b;i<(int)e;++i)
int faster_in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

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;
const int INF = int(1e9 + 7);

double ex[1010];

ll nck(ll a, ll b)
{
	if (a < b) return 0;
	if (a == b) return 1;
	if (b <= 1) return a;
	return nck(a-1, b-1) + nck(a-1, b);
}

ll dp[110][3][2];
string s;

ll f(ll dig, ll k, bool less)
{
	if (dig == -1) return (k == 0);
	if (k == 0) return 1;
	ll &res = dp[dig][k][less];
	if (res != -1) return res;
	res = 0;
	if (less == true) 
		res = 9LL*f(dig-1, k-1, true) + f(dig-1, k, true);
	else if (s[dig] > '0')
	{
		res = (ll(s[dig]-'0')-1)*f(dig-1, k-1, true) + f(dig-1, k-1, false) + f(dig-1, k, true);
	}
	else
	{
		res = f(dig-1, k, less);
	}
	//cout << dig << "," << k << "," << less << " = " << res << endl;
	return res;
}

int main()
{
    std::ios::sync_with_stdio(false); cin.tie(0);
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    clr(dp, -1);
    cin >> s;
    ll n = s.size();
    ll k;
    cin >> k;
    assert(s[0] != '0');
    ll res = 0;
    reverse(all(s));
    res = f(n-1, k, false);
    cout << res << '\n';
    return 0;
}
// PLUS ULTRA!

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "
int main(){
    int n;cin>>n;
    int a[n+1], b[n];
    rep(i,n+1){cin>>a[i];}
    rep(i,n){cin>>b[i];}
    ll cnt=0;

    rep(i,n){
        cnt+=min(a[i],b[i]);
        b[i]-=min(a[i], b[i]);
        cnt+=min(b[i], a[i+1]);
        a[i+1]-=min(b[i], a[i+1]);
    }
    co(cnt);

}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
    int H,W;
    int i = 0;
    char sh = '#';
for (; i < 10000; i++){
    scanf("%d %d", &H, &W);
    if( H == 0 && W == 0){
        break;
    }
    int j = 0;
    for(; j < H;j++){
        int k = 0;
        for(; k < W; k++){
            printf("%c",sh);
        }
        printf("\n");
    }
     printf("\n");
    
}
    
    return 0;
}


Measured memory_bytes: 2084
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.math.BigInteger;
import java.io.PrintWriter;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    in.close();
    long gcd = gcd(a,b);
    System.out.println(a/gcd*b);
  }
  
  static long gcd(long i, long j) {
    if(i>j)
      return gcd(j,i);
    while(i>0) {
      long r = j%i;
      j=i;
      i=r;
    }
    return j;
  }
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

void insert(int);
void print(void);
Node treeMaximum(Node);
Node treeMinimum(Node);
Node treeSearch(Node, int);
Node treeSuccessor(Node);
void delete(Node);
void inorder(Node);
void preorder(Node);

int main()
{
  int m,i,x;
  char com[10];
  Node t;

  scanf("%d",&m);
  
  for(i = 0; i < m; i++){
    scanf("%s",com);
    if(com[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if(com[0] == 'd'){
      scanf("%d",&x);
      delete(treeSearch(root, x));
    }
    else if(com[0] == 'i'){
      scanf("%d",&x);
      insert(x);
    }
    else if(com[0] == 'f'){
      scanf("%d",&x);
      t = treeSearch(root, x);
      if(t != NIL)printf("yes\n");
      else printf("no\n");
    }
  }

  return 0;
}

void insert(int k)
{
  Node y;
  Node x;
  Node z;
  
  y = NIL; //xの親
  x = root;

  z = malloc(sizeof(struct 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;
}

Node treeMaximum(Node x)
{
  while(x->left != NIL){
    x = x->right;
  }
  return x;
}

Node treeMinimum(Node x)
{
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeSearch(Node x, int k)
{
  while(x != NIL && k != x->key){
    if(k < x->key)x = x->left;
    else x = x->right;
  }
  
    return x;
}

Node treeSuccessor(Node x)
{
  Node y;
  
  if(x->right != NIL)return treeMinimum(x->right);

  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }

  return y;
}

void delete(Node z)
{
  Node y; //消去候補
  Node x; //yの子

  if(z->left == NIL || z->right == NIL)
    y = z;
  else
    y = treeSuccessor(z);

  if(y->left != NIL)
    x = y->left;
  else
    x = y->right;

  if(x != NIL)x->parent = y->parent;
  
  if(y->parent == NIL)root = x;
  else if(y == y->parent->left)y->parent->left = x;
  else y->parent->right = x;

  if(y != z)z->key = y->key;
}

void inorder(Node x)
{
  if(x != NIL){
    inorder(x->left);
    printf(" %d",x->key);
    inorder(x->right);
  }
}

void preorder(Node x)
{
  if(x == NIL)return;
  printf(" %d",x->key);
  preorder(x->left);
  preorder(x->right);
}



Measured memory_bytes: 25228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

// 逆元 a^{-1} mod m
// aがmの倍数でないことが前提。O(log m)
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

// 二項係数計算(O(k))
ll COM(ll n, ll k){
	ll res = 1;
	rep(i,k){
		(res *= ((n+1-(i+1)) * modinv(i+1, MOD)) % MOD) %= MOD;
	}
	return res;
}


// n^k
ll pp(ll a, ll k){
	ll res = 1;
	    while(k > 0){
        if(k & 1){
            (res *= a) %= MOD;
        }
        (a *= a) %= MOD;
        k >>= 1;
    }
	return res;
}

void mainsolve(){

	ll n,a,b;
	cin >> n >> a >> b;

	ll res = (pp(2,n) - 1 + MOD) % MOD;
	res = (res - COM(n,a) + MOD) % MOD;
	res = (res - COM(n,b) + MOD) % MOD;
	cout << res << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b,a%b));
}

ll lcm(ll a,ll b){
   return a/gcd(a,b)*b;
}

// 木上の探索
// v: 現在探索中の頂点、p: v の親 (v が根のときは -1)
vec<vec<ll>> g;
vec<ll> ans(200010);
void dfs(ll v,ll p){
    if(p!=-1) ans[v] += ans[p];
    for(auto nv : g[v]){
        if(nv==p) continue;//nvが親 p だったら駄目
        dfs(nv,v);//vが新たにnvの親になる
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,q;
    cin>>n>>q;
    g.resize(n);
    rep(i,n-1){
        ll a,b;
        cin>>a>>b; --a; --b;
        g[a].pb(b);
        g[b].pb(a);
    }
    rep(i,q){
        ll p,x;
        cin>>p>>x; p--;
        ans[p]+=x;
    }
    dfs(0,-1);
    rep(i,n) cout<<ans[i]<<" ";
    cout<<endl;
    return 0;
}


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

#define N 1000000

int main() {
    int n;
    bool prime[N+1];
    int count[N];
    for(int i=2; i<N; i++){
        prime[i] = true;
    }
    for(int i=2; i<N; i++){
        if(prime[i]){
            count[i] = count[i-1]+1;
            if(i<1000){
                for(int j=i*2; j<N; j+=i){
                    prime[j] = false;
                }
            }
        }else{
            count[i] = count[i-1];
        }
    }
    
    while(cin >> n){
        cout << count[n] << endl;
    }
    return 0;
}

Measured memory_bytes: 6040
n, k = map(int, input().split())
ans = 0
list_N = [0]*k
for num in range(1, n+1):
    m = num % k
    list_N[m] += 1

for a in range(k):
    b = (k-a)%k
    c = (k-a)%k
    if (b+c) % k == 0:
        ans += list_N[a]*list_N[b]*list_N[c]

print(ans)

Measured memory_bytes: 4596
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    int dmax = A[0] + K - A[N - 1];
    rep(i, N - 1) dmax = max(dmax, A[i + 1] - A[i]);

    write(K - dmax);
}

Measured memory_bytes: 1024
import copy
import heapq
import fractions

N = int(input())
A = list(map(int, input().split()))

gcd_l = [0]
gcd_r = [0]

for i in range(N):
  gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
  gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))

gcd_r = gcd_r[::-1]
ans = []

for i in range(N):
  ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))


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

int main()
{
	int x;
	scanf("%d",&x);
	if(x>=400&x<=599) printf("8"); 
	else if(x>=600&x<=799) printf("7"); 
	else if(x>=800&x<=999) printf("6"); 
	else if(x>=1000&x<=1199) printf("5"); 
	else if(x>=1200&x<=1399) printf("4"); 
	else if(x>=1400&x<=1599) printf("3"); 
	else if(x>=1600&x<=1799) printf("2"); 
	else if(x>=1800&x<=1999) printf("1"); 
    return 0;
}

Measured memory_bytes: 3704
import Control.Monad

main=readLn>>=print.solve

solve :: Int -> Int
solve n = solve3x5x5 n + solve3x25 n + solve5x15 n + solve75 n
solve3x5x5 n = length $ do
    x <- filter (has n 4) smallPrimes
    y <- filter (has n 4) smallPrimes
    guard $ x < y
    z <- filter (has n 2) smallPrimes
    guard $ z /= x && z /= y
    return ()
solve3x25 n = length $ do
    x <- filter (has n 2) smallPrimes
    y <- filter (has n 24) smallPrimes
    guard $ x /= y
    return ()
solve5x15 n = length $ do
    x <- filter (has n 4) smallPrimes
    y <- filter (has n 14) smallPrimes
    guard $ x /= y
    return ()
solve75 n = length $ do
    x <- filter (has n 74) smallPrimes
    return ()

has :: Int -> Int -> Int -> Bool
has n k x = k <= sum[quot n (x ^ i)|i<-takeWhile((<=n).(x^))[1..]]

smallPrimes :: [Int]
smallPrimes = 2 : [ n | n<-[3,5..97], all ((>0).rem n) $ takeWhile (\x->x*x<=n) smallPrimes]


Measured memory_bytes: 508
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int n,f[210000],nex[210000][26],t;
char s[210000];
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	fo(i,0,25) nex[n+1][i]=n+1;
	f[n+1]=1;
	fd(i,n,1){
		fo(j,0,25) nex[i][j]=nex[i+1][j];
		nex[i][s[i]-'a']=i;
		f[i]=n+1;
		fo(j,0,25) f[i]=min(f[i],f[nex[i][j]+1]);//f[nex[i][j]]
		f[i]++;
	}
	//printf("%d\n",f[1]);
	t=1;
	while (t<=n){
		fo(i,0,25) if (nex[t][i]>n||f[nex[t][i]+1]<f[t]){//f[nex[t][i]+1]<f[i]!!!
			putchar('a'+i);
			t=nex[t][i]+1;
			break;
		
		}
	}
	return 0;
}

Measured memory_bytes: 21504
#include <bits/stdc++.h>
using namespace std;
//#define che
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define MP make_pair
#define PB push_back
#define fi first
#define se second

typedef long long LL;
typedef pair<int, int> PII;
const int N=3e5 +10;
const LL MOD = 998244353;
LL C[N],n,a,b,k;

LL ppow(LL bas, LL pw){
	LL res= 1;
	for (;pw ; pw>>=1, bas=(bas*bas)%MOD)
		if ( pw&1) res= (res*bas)%MOD;
	return res;
}
int main(){
	#ifdef che
	freopen("input.txt","rt",stdin);
	freopen("output.txt","wt",stdout);
	#endif
	cin>>n>>a>>b>>k;
	C[0] = 1;
	for (LL m= 1; m<=n; m++)C[m] = (C[m-1]*(n-m+1)%MOD)*ppow(m,MOD-2)%MOD;
	LL ans=0 ;
	for (LL x=0; x<=n; x++){
		if ( (k-x*a)%b!=0) continue;
		LL y= (k-x*a)/b;
		if ( y<0 || y>n) continue;
		ans=(ans+C[x]*C[y])%MOD;
	}
	cout<<ans;
	return 0;
}

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

int main() {
int N,M;
  cin >> N >> M;
  vector<int> height(N);
  vector<int> count(N);
  for(int i =0; i < N; i++){
  	cin >> height[i];
  }
  int M_1, M_2, maxmm;
  for(int i = 0; i < M; i++){
  	cin >> M_1 >> M_2;
    if(height[M_1-1] > height[M_2-1]){
    	maxmm = M_2-1;
      count[maxmm]++;
    }
    else if(height[M_1-1] < height[M_2-1]){
    	maxmm = M_1-1;
      	count[maxmm]++;
    }
    else {
      count[M_1-1]++;
      count[M_2-1]++;
    }   
  }
int ans = 0;
  for(int i = 0; i < N; i++){
  	if(count[i] == 0){
    	ans++;
    }
  }
    cout << ans << endl;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>     
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)330;
const int mod = (int)1e9 + 7;
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

                
int n, a[maxn], c1, c2, c3, used[maxn][maxn][maxn];
double dp[maxn][maxn][maxn];

double calc(int i, int j, int k){
	if(!i && !j && !k)
		return 0.0;
	double &res = dp[i][j][k];
	if(used[i][j][k])
		return res;
	used[i][j][k] = 1;
	double prob1, probi, probj, probk;
	probi = probj = probj = 0.0;
    prob1 = 1.0 / (i + j + k + .0);
	double s1 = (i + j + k);
	if(i)
		probi = i / s1;
	if(j)
		probj = j / s1;
	if(k)
		probk = k / s1;
	if(i){
		res += calc(i - 1, j, k) * (probi);
	}
	if(j)
		res += calc(i + 1, j - 1, k) * (probj);
	if(k)
		res += calc(i, j + 1, k - 1) * (probk);
	res += (n+.0)/(i+j+k+.0);
	return res;
}
double s;
main () {
	cin >> n;
	forn(i, 1, n){
		cin >> a[i];
		if(a[i] == 1) c1++;
		if(a[i] == 2) c2++;
		if(a[i] == 3) c3++;
	}
	cout << fixed<<setprecision(10)<<calc(c1, c2, c3);
}

Measured memory_bytes: 512128
#include <cstdio>
#include <iostream>
#include <set>
#include <algorithm>
#include <queue>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#define For(i,n) for(int i=0;i<n;i++) 
using namespace std; 
const int maxn=1e5+5;
typedef long long ll;
int a[maxn];
int main()
{
	int n,d,x;
	cin>>n>>d>>x;
	int ans=0;
	For(i,n) cin>>a[i],ans+=(d-1)/a[i]+1;
	ans+=x;
	cout<<ans<<endl;
	
	 
}

Measured memory_bytes: 256
N, M = map(int, input().split())
if N == 1 and M == 1:
    print(1)
elif (N == 1 and M >= 2) or (M == 1 and N >= 2):
    print(max(N, M) - 2)
else:
    print((N - 2) * (M - 2))

Measured memory_bytes: 3064