akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#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, a, b)   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)

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<typename T1, typename T2> istream& operator >>(istream& i, pair<T1, T2>& p) {
        i >> p.first >> p.second; return i;
    }
    template<typename T, size_t N> istream& operator >>(istream& i, array<T, N>& v) {
        for (auto& e : v) { i >> e; } return i;
    }
    template<typename T> istream& operator >>(istream& i, vector<T>& v) {
        for (auto& e : v) { i >> e; } return i;
    }
}
using namespace __input;

namespace __output {
    template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& t) {
        return o << "(" << t.first << ", " << t.second << ")";
    }
    template<typename T, size_t N> ostream& operator<<(ostream& o, const array<T, N>& a) {
        o << "["; for (int i = 0; i < N; i++) { if (i) o << ", "; o << a[i]; } return o << "]";
    }
    template<typename T> ostream& operator<<(ostream& o, const vector<T>& v) {
        o << "["; for (int i = 0; i < sz(v); i++) { if (i) o << ", "; o << v[i]; } return o << "]";
    }
}
using namespace __output;

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

    int N, M;
    cin >> N >> M;

    vvi graph(N);
    for (int e = 0, u, v; e < M; e++) {
        cin >> u >> v;
        --u, --v;
        graph[u].pb(v);
    }

    int S, T;
    cin >> S >> T;
    --S, --T;

    vi dist(N << 2, INT_MAX);
    dist[S << 2] = 0;

    priority_queue<pair<int, int>> pq;
    pq.push(mp(0, S << 2));

    while (!pq.empty()) {
        int len, loc; tie(len, loc) = pq.top(); pq.pop();
        if ((len *= -1) != dist[loc]) continue;

        int v = loc >> 2, vr = loc & 0b11;
        for (int u : graph[v]) {
            int ul = (u << 2) + (vr < 2 ? vr + 1 : 0);

            if (len + 1 < dist[ul]) {
                dist[ul] = len + 1;
                pq.push({ -dist[ul], ul });
            }
        }
    }

    cout << (dist[T << 2] == INT_MAX ? -1 : dist[T << 2]/3) << "\n";

    return 0;
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<pll> vpll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  ll N, K, S;
  IN(N,K,S);
  REP(i,K) printf("%lld ", S);
  if(S>=100000000){
    REP(i,N-K) printf("%lld ", 1);
  }else{
    REP(i,N-K) printf("%lld ", S+1);
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 1280
class Dice():
    def __init__(self, nums):
        self.nums = nums
        self.top, self.front, self.right = 0, 1, 2
 
    def move(self, op):
        for c in op:
            if c == 'N':
                self.top, self.front = self.front, 5 - self.top
            elif c == 'S':
                self.top, self.front = 5 - self.front, self.top
            elif c == 'E':
                self.top, self.right = 5 - self.right, self.top
            else:
                self.top, self.right = self.right, 5 - self.top
 
dice = Dice([int(n) for n in input().split()])
dice.move(input())
print(dice.nums[dice.top])

Measured memory_bytes: 7756
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string a;
    cin>>a;
    if(a[0]==a[1]&&a[1]==a[2])
        {
            cout<<"Yes";
        }
    else if(a[1]==a[2]&&a[2]==a[3])
        {
            cout<<"Yes";
        }
    else
        {
            cout<<"No";
        }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define ll long long
using namespace std;
const int mod=1000000007;
int N;
ll dp[110][5][5][5];
int main(){
  cin >> N;
  for(int i=0; i<N; i++){
    if (i==0||i==1){
      for(int j=0; j<5; j++){
        for(int k=0; k<5; k++){
          for(int l=0; l<5; l++){
          dp[i][j][k][l]=0;
          }
        }
      }
    }
    else if (i==2){
     for(int j=0; j<5; j++){
        for(int k=0; k<5; k++){
          for(int l=0; l<5; l++){
            dp[i][j][k][l]= 1;
          }
        }
     }
      dp[i][0][2][1] =0;
      dp[i][0][1][2] =0;
      dp[i][2][0][1] =0;  
    }
    else {
      for(int j=0; j<4; j++){
        for(int k=0; k<4; k++){
          for(int l=0; l<4; l++){
            dp[i][j][k][l] = dp[i-1][0][j][k] + dp[i-1][1][j][k] + dp[i-1][2][j][k] + dp[i-1][3][j][k];
          }
        }
      }
      dp[i][3][2][1] -= dp[i-1][0][3][2];
      dp[i][1][2][1] -= dp[i-1][0][1][2];
      dp[i][2][2][1] -= dp[i-1][0][2][2];
      dp[i][0][2][1] -= dp[i-1][0][0][2];
      for(int j =0; j<4; j++){
        dp[i][0][2][1] -= dp[i-1][j][0][2];
        dp[i][0][1][2] -= dp[i-1][j][0][1];
        dp[i][2][0][1] -= dp[i-1][j][2][0];
      }
    }
     for(int j=0; j<4; j++){
        for(int k=0; k<4; k++){
          for(int l=0; l<4; l++){
            dp[i][j][k][l] %=mod;
          }
        }
     }
  }
  ll ans =0;
  for(int j=0; j<4; j++){
    for(int k=0; k<4; k++){
      for(int l=0; l<4; l++){
        ans += dp[N-1][j][k][l];
      }
    }
  }
  cout << ans%mod << endl;
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()




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


Measured memory_bytes: 256
def main():
    s = input()
    s_len = len(s)
    mod = 2019
    d = [0] * mod
    d[0] = 1
    rev_num = 0
    t = 1
    # 2以上なら共通するmodがあったということになる
    for i in reversed(s):
        rev_num += int(i) * t
        rev_num %= mod
        d[rev_num] += 1
        t *= 10
        t %= mod
    # 2以上同じmodがあったらそこから2つ選ぶ選び方
    # それを全てのmodで
    print(sum(i*(i-1)//2 for i in d))
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 9200
N=parse(Int,readline())
F=[map(x->parse(Int,x),split(readline())) for _=1:N]
P=[map(x->parse(Int,x),split(readline())) for _=1:N]
ans=-1145141919810
for i=1:1023
	now=0
	for j=1:N
		cnt=0
		for k=1:10
			if F[j][k]==1&&(i>>(k-1))%2==1
				cnt+=1
			end
		end
		now+=P[j][cnt+1]
	end
	ans=max(ans,now)
end
println(ans)


Measured memory_bytes: 124752
# coding: utf-8
import re
import math
import fractions
import random
from heapq import heappop,heappush
import time
import sys
input = sys.stdin.readline
#import numpy as np
mod=int(10**9+7)
inf=int(10**20)
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def comb(n,r):return math.factorial(n)//math.factorial(n-r)//math.factorial(r)
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
 

 
#main
L=input()
dp=[[0,0] for _ in range(len(L)+5)]
dp[0][0]=1

ans=0
for a in range(len(L)-1):
    c=L[a]
    #a+b=0
    if c=="0":
        dp[a+1][0]=dp[a][0]
        dp[a+1][1]=dp[a][1]
    else:
        dp[a+1][1]=dp[a][1]+dp[a][0]
    #a+b=1
    if c=="0":
        dp[a+1][1]+=dp[a][1]*2
    else:
        dp[a+1][0]+=dp[a][0]*2
        dp[a+1][1]+=dp[a][1]*2
    dp[a+1][0]%=mod
    dp[a+1][1]%=mod
print((dp[len(L)-1][0]+dp[len(L)-1][1])%mod)

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

using namespace std;

int main() {
	int a,b;
	cin >> a >> b;
	int count = 1;
	int ans = 0;
	while(count < b) {
		count += a - 1;
		ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
package main

import (
	"bufio"
	"fmt"
	"os"
)

var E, F []int

func main() {
	N := ReadInt()
	D := ReadInts(N)
	m := make(map[int]int)
	for _, d := range D {
		if d == 0 {
			fmt.Println(0)
			return
		}
		m[d]++
	}

	E = []int{}
	F = []int{}
	for d, cnt := range m {
		if cnt >= 3 {
			fmt.Println(0)
			return
		}
		if d == 12 {
			if cnt == 2 {
				fmt.Println(0)
				return
			}
			F = append(F, 12)
			continue
		}
		if cnt == 2 {
			F = append(F, d, 24-d)
		} else {
			E = append(E, d)
		}
	}
	fmt.Println(dfs(0, make([]int, len(E))))
}

func dfs(depth int, prefix []int) int {
	if depth == len(E) {
		g := append([]int{0}, prefix...)
		g = append(g, F...)
		min := 12
		for i := 0; i < len(g)-1; i++ {
			for j := i + 1; j < len(g); j++ {
				min = Min(min, Abs(g[i]-g[j]), 24-Abs(g[i]-g[j]))
			}
		}
		return min
	}
	prefix[depth] = E[depth]
	ans := dfs(depth+1, prefix)
	prefix[depth] = 24 - E[depth]
	ans = Max(ans, dfs(depth+1, prefix))
	return ans
}

func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func Min(xs ...int) int {
	min := xs[0]
	for _, x := range xs[1:] {
		if min > x {
			min = x
		}
	}
	return min
}

func Max(xs ...int) int {
	max := xs[0]
	for _, x := range xs[1:] {
		if max < x {
			max = x
		}
	}
	return max
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1932
def cal_a(a_prev):
    """Calculate a[i] when i > 1, according to below formula
    f(n) = n/2 if n is even, and f(n) = 3n + 1 if n is odd.
    """
    return a_prev // 2 if a_prev % 2 == 0 else a_prev * 3 + 1

a_cur = int(input())
found = set()
index = 1
while a_cur not in found:
    found.add(a_cur)
    a_cur = cal_a(a_cur)
    index += 1

print(index)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define mp make_pair
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pii pair<ll,ll>
#define pb push_back
#define F first
#define S second
#define mi map<ll,ll>
#define mii map<pii,ll>
const ll N=(1e7+1);//mod=998244353;
ll n,m,k;//
ll a[N],dp[N];
string s;
ll l=(1e7+2);
char ch[1000][1000];
int h,w,c=0;
//bool vis[1000][1000]={0}
bool valid(int p,int q){
	if(p<0||p>=h)return 0;
	if(q<0||q>=w)return 0;
	if(ch[p][q]=='#'){return 0;}
	return 1;
}
int main(){
	cin>>h>>w;
	queue<pii> q,q1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>ch[i][j];
			if(ch[i][j]=='#'){
				q.push(mp(i,j));
				//vis[i][j]=1;
				c++;
			}
		}
	}
	int ans=0;
	while(c<h*w){
		//cout<<"c="<<c<<endl;
		ans++;
		while(q.size()){
			int x=q.front().F,y=q.front().S;q.pop();
			if(valid(x+1,y)){
				ch[x+1][y]='#';
				q1.push(mp(x+1,y));c++;
			}
			if(valid(x-1,y)){
				ch[x-1][y]='#';
				q1.push(mp(x-1,y));c++;
			}
			if(valid(x,y+1)){
				ch[x][y+1]='#';
				q1.push(mp(x,y+1));c++;
			}
			if(valid(x,y-1)){
				ch[x][y-1]='#';
				q1.push(mp(x,y-1));c++;
			}
		}
		q=q1;
		while(q1.size())q1.pop();
	}
	cout<<ans<<endl;
}
/*
2
5 2
3 6 4 7 2
5 3
3 -5 6 3 10


*/


Measured memory_bytes: 17860
n,m=map(int,input().split())
ans=0
import math
for i in range(1,int(math.sqrt(m))+1):
  if m%i!=0:
    continue
  i2=m//i
  if i*n<=m:
    ans=max(ans,i)
  if i2*n<=m:
    ans=max(ans,i2)
print(ans)


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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define all(a) (a.begin(), a.end())

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

void solve() {
	int N,M,X,Y,x[101],y[101];
	cin >> N >> M >> X >> Y;
	x[0] = X, y[0] = Y;
	for (int i = 1; i <= N; ++i) {
		cin >> x[i];
	}
	for (int i = 1; i <= M; ++i) {
		cin >> y[i];
	}
	sort(x,x+N+1);
	sort(y,y+M+1);
	if (x[N] < y[0]) {
		cout << "No War";
	} else {
		cout << "War";
	}
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

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

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#define VMAX 10001
#define NMAX 2000001
using namespace std; 
int n, k=VMAX;
int A[NMAX], B[NMAX], C[VMAX];


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

	for(i=n; i>0; i--)
	{
		B[C[A[i]]] = A[i];
		C[A[i]]--;
	}
	
	for(i=1; i<n+1; i++)
	{
		if(i-1) cout << " ";
		cout << B[i];
	}
	cout << endl;
//	system("pause");	
	return 0;
}


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

int main() {
	int L;
	vector<int> bit;

	cin >> L;

	while (L) {
		bit.push_back(L & 1);
		L >>= 1;
	}

	reverse(bit.begin(), bit.end());

	int n = 1;
	vector<pair<pair<int,int>, int>> g;

	for (int i = 1; i < bit.size(); i++) {
		n *= 2;

		for (int j = 0; j < g.size(); j++) {
			g[j].second *= 2;
		}
		g.push_back(make_pair(make_pair(i, i + 1), 1));
		g.push_back(make_pair(make_pair(i, i + 1), 0));

		if (bit[i]) {
			g.push_back(make_pair(make_pair(1, i + 1), n));
			n++;
		}
	}
	
	cout << bit.size() << " " << g.size() << endl;

	for (int i = 0; i < g.size(); i++) {
		cout << g[i].first.first << " " << g[i].first.second << " " << g[i].second << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import math

def plot(x,y):
    print(f'{x:.8f} {y:.8f}')

def Koch(n, x1,y1,x2,y2):
    if n == 0:
        plot(x1,y1)
        return
    sx = (2*x1+x2)/3
    sy = (2*y1+y2)/3
    tx = (x1+x2*2)/3
    ty = (y1+y2*2)/3
    ux = (tx-sx)*(1/2)-(ty-sy)*(math.sqrt(3)/2)+sx
    uy = (tx-sx)*(math.sqrt(3)/2)+(ty-sy)*(1/2)+sy
    Koch(n-1, x1,y1, sx,sy)
    Koch(n-1, sx,sy, ux,uy)
    Koch(n-1, ux,uy, tx,ty)
    Koch(n-1, tx,ty, x2,y2)

n = int(input())
Koch(n, 0,0, 100,0)
plot(100,0)


Measured memory_bytes: 5748
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
#define inf 2123333333
 
struct node { ll x,y; }a[200010];
 
ll n,h1,h2,mn,minn,maxn,rmin,rmax,bmin,bmax,ans;
 
inline int rd()
{
    int x=0;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar());
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x;
}
 
inline bool cmp(node x,node y) { return x.x<y.x; }
 
int main()
{
    n=rd();minn=inf;maxn=0;
    for (int i=1;i<=n;i++)
    {
        a[i].x=rd();a[i].y=rd();
        if (a[i].x>a[i].y) swap(a[i].x,a[i].y);
        if (a[i].x<minn) h1=i,minn=a[i].x;
        if (a[i].y>maxn) h2=i,maxn=a[i].y;
    }
    sort(a+1,a+n+1,cmp);
    rmax=rmin=maxn,bmin=bmax=minn;
    for (int i=1;i<=n;i++) bmax=max(bmax,a[i].x),rmin=min(rmin,a[i].y);
    ans=(rmax-rmin)*(bmax-bmin);
    if (h1!=h2)
    {
        ll hh=maxn-minn,res=inf;
        rmax=max(a[n].x,a[1].y);
        rmin=min(a[2].x,mn=a[1].y);
        for (int i=2;i<n;i++)
        {
            rmax=max(a[i].y,rmax);
            mn=min(mn,a[i].y);
            rmin=min(mn,a[i+1].x);
            res=min(res,rmax-rmin);
        }
        ans=min(ans,hh*res);
    }
    printf("%lld\n",ans);
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 22;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  int d; cin >> d;
  cout << "Christmas";
  REP(i, 25-d) {
    cout << " Eve";
  }
  cout << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
////////////////////////////////////////

int main() {
	int r, g, b, n;
	cin >> r >> g >> b >> n;
	int ans = 0;
	for (int i = 0; i <= n/r+1; ++i) {
		for (int j = 0; j <= n/g+1; ++j) {
			if (i*r+j*g<=n&&(n - i * r - j * g) % b == 0 && (n - i * r - j * g) / b <= 3000) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include<string.h>

int selectionSort(int R[], int N);

void swap(int *a, int *b);

int main(void) {

	int N;
	scanf("%d\n", &N);//半角スペースで区切ることができる。

	int R[100];

	int t,k,x;
	for (t = 0; t < N ; t++) {
		scanf("%d", &R[t]);
	}
	
	x = selectionSort(R, N);
	
	for (k = 0; k < N; k++) {
        if(k > 0){printf(" ");}
	printf("%d", R[k]);
	}
	printf("\n%d\n",x);

	return 0;
	
	}

int selectionSort(int R[],int N) {
	int i,j,minj;
	int count = 0;
	for (i = 0; i < N-1; i++) {
		minj = i;
		for (j = i; j < N; j++) {
			if (R[j] < R[minj]) {
				minj = j;
			}
		}
		
		if (i != minj) {
swap(&R[i], &R[minj]);
			count++;
		}
	}
	return count;
}

void swap(int *a, int *b) {
	int k;
	k = *a;
	*a = *b;
	*b = k;
}


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

long long meow(long long x, long long y) {
    if(y == 0) {
        return -x;
    } else {
        return x / y * y * 2 + meow(y, x %y);
    }
}

void MAIN() {
    long long n, x;
    scanf("%lld%lld", &n, &x);
    printf("%lld\n", n + meow(std::max(n - x, x), std::min(n - x, x)));
}

int main() {
    MAIN();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main()
{
	int n;
	cin >> n;
	
	switch(n) {
		case 25:
		  cout << "Christmas" << endl;
		  return 0;
		case 24:
		  cout << "Christmas Eve" << endl;
		  return 0;
		case 23:
		  cout << "Christmas Eve Eve" << endl;
		  return 0;
		case 22:
		  cout << "Christmas Eve Eve Eve" << endl;
		  return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstdlib>
using namespace std;

int main(){
	int l;
	while(scanf("%d",&l)==1,l){
		int m,n,sum=0,month=-1;
		for(int x=0;x<12;++x){
			scanf("%d %d",&m,&n);
			sum += m-n;
			if(sum>=l && month==-1)month=x+1;
		}
		if(month==-1)cout<<"NA"<<endl;
		else cout<<month<<endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 1000000 + 5;

int n;

void solve()
{
    int lft = 0;
    int ans = 0;
    cin >> n;
    int lst = -1;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x == lst) lft ++;
        else {
            ans += lft / 2;
            lft = 1;
        }
        lst = x;
    }
    ans += lft / 2;
    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}



Measured memory_bytes: 256
#define  _USE_MATH_DEFINES

#define  rep(i, n) for(int i = 0; i < n; i++)
#define  repx(i, a, n) for(int i = a; i < n; i++)
#define  loop while(1)
#define  lli long long int
#define  aryout(ary) rep(i, ary.size()) cout << ary[i] << (i < ary.size() - 1 ? " " : "\n");
#define  arysort(v) sort(v.begin(), v.end())
#define  aryreverse(v) reverse(v.begin(),v.end())
#define  arysum(v) accumulate(v.begin(), v.end(), 0)
 
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <utility>
#include <set>

using namespace std;

long long int knapsack(int n, int w, vector<pair<int, int>> trs) {

  vector<vector<lli>> dp(n+1, vector<lli>(w+1, 0));

  repx (var, 1, n+1) {
    repx (hor, 1, w+1) {
      if (trs[var-1].first > hor) {
        dp[var][hor] = dp[var-1][hor];
      } else {
        lli tmp1 = dp[var-1][hor-(trs[var-1].first)] + trs[var-1].second;
        lli tmp2 = max(dp[var-1][hor], dp[var][hor-1]);
        dp[var][hor] = max(tmp1, tmp2);
      }
    }
  }
  return dp[n][w];
}

int main() {

  int n, w;
  cin >> n >> w;

  vector<pair<int, int>> treasure(n); //{weight, value}
  rep (i, n) {
    pair<int, int> tmp;
    cin >> tmp.first >> tmp.second;
    treasure[i] = tmp;
  }
  cout << knapsack(n, w, treasure) << endl;

  return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	ll N, ans=0;
	map<int,int> A;
	vector<ll> v;

	cin >> N;
	rep(i,N){
		int a;
		cin >> a;
		A[a]++;
		if( A[a] % 2 == 0 ) v.push_back(a);
	}

	sort(all(v));

	if( v.size() >= 2 ){
		ans = v[v.size()-1] * v[v.size()-2];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4992
N, K = map(int, input().split())
a = list(map(int, input().split()))
dp = [False]*(K+1)

for i in range(K+1):
    for ai in a:
        if i-ai>=0:
            dp[i] |= not dp[i-ai]

if dp[K]:
    print('First')
else:
    print('Second')

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

    int a,b,c,i;
    int count;
    scanf("%d %d %d",&a,&b,&c);
    for(i=a,count=0;i<=b;i++){
            if(c%i==0)count++;



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



    return 0;
}

Measured memory_bytes: 596
s = input()
a=int(s[0:2])
b=int(s[2:4])
if 0<a<=12 and 0<b<=12:
    print('AMBIGUOUS')
elif 0<b<=12:
    print('YYMM')
elif 0<a<=12 :
    print('MMYY')

else:
    print('NA')



Measured memory_bytes: 9164
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int number = scanner.nextInt();
        final int[] ints = new int[number];

        for (int i = 0; i < number; i++) {
            ints[i] = scanner.nextInt();
        }

        final int[] leftGCD = new int[number];
        leftGCD[0] = ints[0];
        for (int i = 1; i < leftGCD.length; i++) {
            leftGCD[i] = getGCD(leftGCD[i - 1], ints[i]);
        }

        final int[] rightGCD = new int[number];
        rightGCD[number - 1] = ints[number - 1];
        for (int i = rightGCD.length - 2; i >= 0; i--) {
            rightGCD[i] = getGCD(rightGCD[i + 1], ints[i]);
        }

        final int[] maxGCDIfIndexDeleted = new int[number];
        maxGCDIfIndexDeleted[0] = rightGCD[1];
        maxGCDIfIndexDeleted[number - 1] = leftGCD[number - 2];
        for (int i = 1; i < maxGCDIfIndexDeleted.length - 1; i++) {
            maxGCDIfIndexDeleted[i] = getGCD(leftGCD[i - 1], rightGCD[i + 1]);
        }

        Arrays.sort(maxGCDIfIndexDeleted);
        System.out.println(maxGCDIfIndexDeleted[number - 1]);
    }

    private static int getGCD(final int a, final int b) {
        if (b > a) {
            return getGCD(b, a);
        }

        if (b == 0) {
            return a;
        }

        return getGCD(b, a % b);
    }

    /*
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int counter = scanner.nextInt();
        final int[] ints = new int[counter];

        int min1 = Integer.MAX_VALUE;
        int min2 = Integer.MAX_VALUE;
        for (int i = 0; i < counter; i++) {
            ints[i] = scanner.nextInt();
            if (ints[i] < min1) {
                min1 = ints[i];
            }
            if (min1 < ints[i] && ints[i] < min2) {
                min2 = ints[i];
            }
        }

        List<Integer> gs = new ArrayList<>();
        if (min1 % 2 == 0 || min2 % 2 == 0)
            gs.add(2);
        for (int i = 3; i <= min2 / 2; i += 2) {
            if (min1 % i == 0 || min2 % i == 0) {
                gs.add(i);
            }
        }

        gs.add(min1);
        if (min1 != min2)
            gs.add(min2);

        final boolean[][] table = new boolean[counter][gs.size()];

        for (int i = 0; i < counter; i++) {
            for (int j = 0; j < gs.size(); j++) {
                if (ints[i] % gs.get(j) == 0) {
                    table[i][j] = true;
                }
            }
        }

        for (int i = gs.size() - 1; i >= 0; i--) {
            int cont = 0;
            for (int j = 0; j < counter; j++) {
                if (table[j][i]) {
                    cont++;
                }
            }

            if (cont == counter || cont == counter - 1) {
                System.out.println(gs.get(i));
                return;
            }
        }

        System.out.println(1);
    }

     */
}


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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

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

	int n;
	cin >> n;

	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	vector<ll> b(n);
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}

	ll aSum = accumulate(a.begin(), a.end(), 0LL);
	ll bSum = accumulate(b.begin(), b.end(), 0LL);

	ll cnt = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] > b[i]) {
			cnt += a[i] - b[i];
		} else if ((a[i] & 1) != (b[i] & 1)) {
			cnt++;
		}
	}

	cout << (cnt <= bSum - aSum ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n,k;
    string s;
    cin >> n >> k;
    cin >> s;

    int tmp = 1;
    int cnt = 0;
    vector<int> sum;
    for(int i = 0; i < n; i++){
        if(tmp == (int)(s[i] - '0')) cnt++;
        else{
            sum.push_back(cnt);
            cnt = 1;
            tmp = 1 - tmp;
        }
    }
    if(cnt != 0) sum.push_back(cnt);

    if(sum.size() % 2 == 0) sum.push_back(0);

    vector<int> ruiseki(sum.size()+1);
    ruiseki[0] = 0;
    for(int i = 0; i < sum.size(); i++){
        ruiseki[i+1] = ruiseki[i] + sum[i];
    }

    int max_val = 0;
    int x = k * 2 + 1;


    for(int j = 0; j < sum.size(); j += 2){
        int left = j;
        int right = min(x+j, (int)(sum.size()));

        int y = ruiseki[right] - ruiseki[left];
        max_val = max(max_val, y);
    }

    cout << max_val << endl;
    return 0;
}


Measured memory_bytes: 1272
#include <stdio.h>
int main(){
  int N,K,r=0;
  int h;
  scanf("%d%d%*c",&N,&K);
  while(N){
    N--;
    scanf("%d",&h);
    if(h >= K){
      r++;
    }
  }
  printf("%d\n",r);
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, k, n, m, a = 0, b, c, ans = 0;
  scanf("%lld%lld", &n, &k);
  if(k == 1) printf("%lld", n * n * n);
  else if(k % 2) {
    ans = n / k;
    printf("%lld", ans * ans * ans);
  } else {
    k /= 2;
    if((n / k) % 2) a = 1;
    n /= (k * 2);
    ans = n * n * n;
    if(a) n++;
    ans += n * n * n;
    printf("%lld", ans);
  }
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

using namespace std;

int top, S[1000];

void push(int x) {
    S[++top] = x;
}

int pop() {
    top--;
    return S[top+1];
}

int main() {
    int a, b;
    top = 0;
    char s[100];

    while(scanf("%s", s) != EOF) {
        if (s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);
        } else if (s[0] == '-') {
            b = pop();
            a = pop();
            push(a - b);
        } else if (s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }

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

    return 0;
}


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

ll sub(ll x,ll y){
    if(x==y) return 0;
    if(x<0&&abs(x)<=y) return y-abs(x)+1;
    else if(x<0&&y>0) return -y-x+1;
    else return y-x;
}

int main(){
    ll x,y,ans=0;
    cin >> x >> y;
    if(x<=y){
        ans = sub(x,y);
    }else if(x>y){
        if(abs(y)>=x) {y *= (-1);ans = sub(x,y)+1;}
        else {x *= (-1);ans = sub(x,y)+1;}
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
class aoj
{
    static void Main()
    {
        int h, w, e = 0, f = 0;
        string[] a = Console.ReadLine().Split(' ');
        h = int.Parse(a[0]);
        w = int.Parse(a[1]);
        int[,] c = new int[h, w];
        for(int i = 0; i < h; i++)
        {
            for(int j = 0; j < w; j++) { c[i, j] = 1000000; }
        }
        bool[,] d = new bool[h, w];
        for(int i = 0; i < h; i++)
        {
            string b = Console.ReadLine();
            for(int j = 0; j < w; j++)
            {
                if (b[j] == 'c') { c[i, j] = 0;d[i, j] = true; e++; }
            }
        }
        while (e != 0)
        {
            f++;
            for(int i = h-1; i >=0; i--)
            {
                for(int j = w-1; j >=0;j-- )
                {
                    if (d[i, j] == true && j != w - 1)
                    {
                        d[i, j + 1] = true;
                        d[i, j] = false;
                    }
                    else if (d[i, j] == true && j == w - 1) { d[i, j] = false; e--; }
                }
            }
            for(int i = 0; i < h; i++)
            {
                for(int j = 0; j < w; j++)
                {
                    if (d[i, j]&&c[i,j]>f)
                    {
                        c[i, j] = f;
                    }
                }
            }
        }
        for(int i = 0; i < h; i++)
        {
            for(int j = 0; j < w; j++)
            {
                if(c[i,j]== 1000000) { c[i, j] = -1; }
            }
        }
        for(int i = 0; i < h; i++)
        {
            for(int j = 0; j < w; j++)
            {
                if (j == 0) Console.Write(c[i, j]);
                else Console.Write(" " + c[i, j]);
            }
            Console.WriteLine();
        }
    }
}

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


int main() {
  ll n;
  cin >> n;
  ll a[n+1],b[n];
  REP(i,n+1) cin >> a[i];
  REP(i,n) cin >> b[i];
  ll ans=0;

  REP(i,n) {
    if(a[i]<b[i]) {
      if(b[i]<=a[i]+a[i+1]) {
        ans+=b[i];
        a[i+1]-=b[i]-a[i];
      } else {
        ans+=a[i]+a[i+1];
        a[i+1]=0;
      }
    } else {
      ans+=b[i];
    }
  } 
  cout << ans << endl;
  return 0;
}


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

typedef long long LL;

const int N=100000;

int n,m;
struct side{
  int y,next,id;
}e[N*2+9];
int lin[N+9],cs;

void Ins(int x,int y,int id){e[++cs].y=y;e[cs].id=id;e[cs].next=lin[x];lin[x]=cs;}
void Ins2(int x,int y,int id){Ins(x,y,id);Ins(y,x,id);}

void into(){
  scanf("%d%d",&n,&m);
  for (int i=1;i<=m;++i){
	int x,y;
	scanf("%d%d",&x,&y);
	Ins2(x,y,i);
  }
}

int vis[N+9],vis0[N+9];
int deg[N+9];
int ans0,ans[N+9][2];

void Dfs_ans0(int k,int fa){
  vis[k]=1;
  for (int i=lin[k];i;i=e[i].next){
	int y=e[i].y,id=e[i].id;
	if (y==fa) continue;
	if (!vis[y]) Dfs_ans0(y,k);
	else if (!vis0[id]){
	  vis0[id]=1;
	  ans[id][0]=k;ans[id][1]=y;
	  deg[k]^=1;
	}
  }
}

void Dfs_ans1(int k,int fa){
  for (int i=lin[k];i;i=e[i].next){
	int y=e[i].y,id=e[i].id;
	if (y==fa||vis0[id]) continue;
	Dfs_ans1(e[i].y,k);
	if (deg[y]){
	  vis0[id]=1;
	  ans[id][0]=y;ans[id][1]=k;
	  deg[y]^=1;
	}else{
	  vis0[id]=1;
	  ans[id][0]=k;ans[id][1]=y;
	  deg[k]^=1;
	}
  }
}

void Get_ans(){
  if (m&1) return;
  ans0=1;
  Dfs_ans0(1,0);
  Dfs_ans1(1,0);
}

void work(){
  Get_ans();
}

void outo(){
  if (!ans0) {puts("-1");return;}
  for (int i=1;i<=m;++i)
	printf("%d %d\n",ans[i][0],ans[i][1]);
}

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 16324
import std.stdio, std.string, std.conv;
import std.math;

void main() {
    auto input = getStdin!(string[]);
    foreach (line; input) {
    	auto num = line.split(" ").to!(long[]);
    	auto sum = num[0] + num[1];
    	auto digit = sum.to!(string).length;
    	digit.writeln;
    }
}

T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}

Measured memory_bytes: 2396
using System;
using System.Collections.Generic;

namespace ABC043
{
    class B
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            List<char> l = new List<char>();

            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == '0') l.Add('0');
                if (s[i] == '1') l.Add('1');
                if (s[i] == 'B' && 0 < l.Count) l.RemoveAt(l.Count - 1);
            }
            Console.WriteLine(string.Join("", l));
        }
    }
}


Measured memory_bytes: 13268
#include<stdio.h>
using namespace std;

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

int main(){
  char a,b;
  int A,B;
  scanf("%c %c",&a,&b);
  A = (int)a;
  B = (int)b; 

  if(A<B){
    printf("<\n");
  }else if(A>B){
    printf(">\n");
  }else{
    printf("=\n");
  }

  return 0;
}


Measured memory_bytes: 128
/* 2017.4.15 Celicath */
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stdint.h>
#include <queue>

int A[100005];
int main()
{
	int N;
	scanf("%d", &N);

	for (int i = 0; i < N; i++)
		scanf("%d", A + i);

	int inc = 0;
	int prev = 0;
	int result = 0;
	for (int i = 0; i < N; i++)
	{
		if (prev == 0)
			result++;
		else if ((prev - A[i]) * inc < 0)
		{
			inc = 0;
			result++;
		}
		else
		{
			if (prev > A[i])
				inc = 1;
			else if (prev < A[i])
				inc = -1;
		}
		prev = A[i];
	}

	printf("%d\n", result);
	return -0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void){
    int n,i,a;
    scanf("%d",&n);
    int day[n], value;
    for(i=0;i<n;i++){
        scanf("%d",&day[i]);
    }
     for(a = n - 1; a >= 0; a--){
        value = day[a];
        printf("%d", value);
        if(a)printf(" ");
    }
    printf("\n");
    return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, x, y;
  cin >> n >> x >> y;
  int cnt[2010] = {};
  for (int i = 1; i <= n - 1; i++) {
    for (int j = i + 1; j <= n; j++) {
      cnt[min(j - i, abs(x - i) + abs(j - y) + 1)]++;
    }
  }
  for (int i = 1; i <= n - 1; i++) {
    cout << cnt[i] << '\n';
  }
  return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <utility>
#include <cmath>
#include <string>
#include <bitset>
#include <queue>
#include <cstdio>
#include <cstring>
#include <deque>
#include <unordered_map>
#include <climits>
#include <map>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <ctime>
#include <cstdint>

#define ci(t) cin>>t
#define co(t) cout<<t
#define LL long long
#define fa(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>b;--i)
#define setp pair<pair<int,int>,int>
#define setl pair<LL,LL>
#define M_PI 3.14159265358979323846

using namespace std;

LL gcd(LL a, LL b) { return a % b ? gcd(b, a % b) : b; }
LL lcm(LL a, LL b) { return (a * b) / gcd(a, b); }
pair <int, int> vu[8] = { {0,1}, {1,0} , {1,-1},{0,-1},{-1,0},{-1,1},{0,1}, {1,0} }; // EWSN

const int max_v = 2e5 + 7;
const int INF = 1e7 + 7;



int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);	
	LL a, b;
	ci(a >> b);
	co(a * b);
	return 0;
}

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

int parity(int n){
  if(n*n*n*n%10 == 1)
    return 1;
  else
    return 0;
}

int power(int x, int y){
  int64_t n = 1ll;
  for(int i = 0; i < y; i++)
    n *= x;
  return n;
}
int digit(int x, int y){
  return x%power(10,y+1)/power(10,y);
}

int main(){
  int n, l;
  cin >> n >> l;
  vector<string> v(n);
  for(int i = 0; i < n; i++){
    cin >> v.at(i);
  }
  sort(v.begin(),v.end());
  for(string s : v)
    cout << s;
  cout << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, x: "List[int]", y: "List[int]", h: "List[int]"):
    for cx in range(101):
        for cy in range(101):
            chs = {
                hi + abs(xi - cx) + abs(yi - cy)
                for xi, yi, hi in zip(x, y, h)
                if hi != 0
            }
            if len(chs) != 1:
                continue
            ch, = chs
            if any(max(ch - abs(xi - cx) - abs(yi - cy), 0) != hi
                   for xi, yi, hi in zip(x, y, h)):
                print(cx, cy, ch, file=sys.stderr)
                continue
            print(cx, cy, ch)
            return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    h = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        h[i] = int(next(tokens))
    solve(N, x, y, h)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3596
from heapq import heappop, heappush

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

hq = []
for aa in a:
    heappush(hq, (-aa, 1))

for _ in range(m):
    b, c = map(int, input().split())
    heappush(hq, (-c, b))

rest = n
ans = 0
while rest > 0:
    num, cnt = heappop(hq)

    num *= (-1)
    use = min(rest, cnt)
    ans += use * num
    rest -= use

print(ans)


Measured memory_bytes: 31964
#include<stdio.h>
int main(void)
{
	int n,sum,i;
	sum=100000;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		sum=sum*1.05;
		if(sum%1000!=0){
		sum=(sum/1000)*1000+1000;
		}
	}
	printf("%d\n",sum);
	return 0;
}



Measured memory_bytes: 2052
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<cstring>
#include<unordered_map>
#define int long long
using namespace std;

int a[100000], b[100000];
signed main() {
	int c; cin >> c;
	for (int d = 0; d < c; d++) {
		scanf("%lld%lld", &a[d], &b[d]);
	}
	int sum = 0;
	for (int d = c - 1; d >= 0; d--) {
		a[d] += sum;
		int k = a[d] / b[d];
		if (a[d] % b[d])k++;
		sum += k*b[d] - a[d];
	}
	cout << sum << endl;
}

Measured memory_bytes: 1792
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll a, b, c;
    cin >> a >> b >> c;
    ll d = c - a - b;
    if(d > 0 && d * d > 4 * a * b){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    string S, T;
    cin >> S >> T;
    int64_t s = S.size();
    int64_t sum = 0;
    for (int64_t i=0; i<s; i++) {
        if (S[i] != T[i]) {
            sum += 1;
        }

    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3860
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

typedef long long llt;

const int MaxN = 200000 + 5;

int N;
int H[MaxN]; llt W[MaxN];
llt dp[MaxN], Bit[MaxN];

void init() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) scanf("%d", &H[i]);
  for (int i = 1; i <= N; ++i) scanf("%lld", &W[i]);
}

inline int lowbit(int i) {
  return i & -i;
}

inline void update(int x, llt v) {
  for (int i = x; i <= N; i += lowbit(i))
    Bit[i] = max(Bit[i], v);
}

inline llt query(int x) {
  llt res = 0;
  for (int i = x; i > 0; i -= lowbit(i))
    res = max(res, Bit[i]);
  return res;
}

void solve() {
  for (int i = 1; i <= N; ++i) {
    dp[i] = query(H[i]) + W[i];
    update(H[i], dp[i]);
  }

  llt ans = 0;
  for (int i = 1; i <= N; ++i) ans = max(ans, dp[i]);
  cout << ans << endl;
}

int main() {
  init();
  solve();
  return 0;
}

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

using namespace std;
typedef long long ll;
//ループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//コンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
    ll x, yokin=100, cnt=0;
    cin >> x;

    while(true){
        if(yokin>=x) break;
        else cnt++;
        yokin *= 1.01;
    }
    cout << cnt;
}

Measured memory_bytes: 3636