akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class DDigitSumReplace {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int m; cin >> m;
      ll digitsum = 0;
      vector<int> d(m);
      vector<ll> c(m);
      rep(i, m) {
        cin >> d[i] >> c[i];
      }
      ll digitcnt = 0;

      rep(i, m) {
        digitsum += c[i]*d[i];
        digitcnt += c[i];
      }

      ll ans = digitcnt-1;
      ans += (digitsum-1)/9;

      cout << ans << endl;
    }
};

signed main() {
  DDigitSumReplace solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(void){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int s=a*b;
  int S=c*d;
  if(s > S){
    cout<<s<<endl;
  }else{
    cout<<S<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N, x;
    cin >> N >> x;
    int a[N];
    rep(i, N) cin >> a[i];
    sort(a, a+N);
    int ans = 0;
    rep(i, N){
        if(x < a[i]) break;
        ans++;
        x -= a[i];
    }
    if(ans == N && x) ans--;
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, M, = map(int, input().split())
a = [list(input().strip())  for _ in range(N)]
b = [list(input().strip())  for _ in range(M)]

for i in range(N - M + 1):
    for j in range(N - M + 1):

        f = True
        for k in range(M):
            for l in range(M):
                if a[i + k][j + l] != b[k][l]:
                    f = False
        if f:
            print("Yes")
            exit()

print("No")

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

const int MAX_V = 1 << 17;
const int MAX_N = 1 << 18;
const int def = 1 << 25;

typedef pair<int, int> Node;
struct MinSegTree {
	int n;
	Node node[2 * MAX_N - 1];
	int dat[2 * MAX_N - 1];
	int minIdx[2 * MAX_N - 1];

	void init(int n_) {
		n = 1;
		while(n < n_) n *= 2;
		for(int i = 0; i < 2 * n - 1; i++) node[i] = make_pair(def, def);
	}

	Node merge(Node l, Node r) {
		if(l.first <= r.first) return l;
		return r;
	}

	void update(int k, int a) {
		k += n - 1;
		node[k] = make_pair(a, k - (n - 1));
		dat[k] = a;
		minIdx[k] = k - (n - 1);
		while(k > 0) {
			k = (k - 1) / 2;
			node[k] = merge(node[k * 2 + 1], node[k * 2 + 2]);
		}
	}

	Node query(int a, int b) { return query(a, b, 0, 0, n); }

	Node query(int a, int b, int k, int l, int r) {
		if(r <= a || b <= l) return make_pair(def, def);
		if(a <= l && r <= b) return node[k];
		Node vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		Node vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return merge(vl, vr);
	}

	void show() {
		for(int i = 0; i < n; i++) cout << dat[i + n - 1] << " ";
		cout << endl;
	}
};

MinSegTree st;

vector<int> G[MAX_V];
int root;

int vs[MAX_V * 2 - 1];
int depth[MAX_V * 2 - 1];
int id[MAX_V];

void dfs(int v, int p, int d, int& k) {
	id[v] = k;
	vs[k] = v;
	depth[k++] = d;
	for(int i = 0; i < G[v].size(); i++) {
		if(G[v][i] != p) {
			dfs(G[v][i], v, d + 1, k);
			vs[k] = v;
			depth[k++] = d;
		}
	}
}

void init(int V) {
	int k = 0;
	dfs(root, -1, 0, k);
	st.init(2 * V - 1);
	for(int i = 0; i < 2 * V - 1; i++) {
		st.update(i, depth[i]);
	}
}

int lca(int u, int v) {
	int l = min(id[u], id[v]);
	int r = max(id[u], id[v]);
	return vs[st.query(l, r + 1).second];
}


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

	int n;
	cin >> n;



	for(int i = 0; i < n; i++) {
		int k;
		cin >> k;
		while(k--) {
			int c;
			cin >> c;
			G[i].push_back(c);
			G[c].push_back(i);
		}
	}

	init(n);

	int q;
	cin >> q;
	while(q--) {
		int u, v;
		cin >> u >> v;
		cout << lca(u, v) << endl;
	}
}

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

long long modpow(long long n, long long k, long long MOD) {
	long long ans = 1; n %= MOD;
	while (k > 0) {
		if (k & 1) ans = (ans*n) % MOD;
		k >>= 1; n = (n*n) % MOD;
	}
	return ans;
}

int rem(int n, string s, int pp) {
	if (pp <= 0) return -1;

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

	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == '1') ans = (ans + modpow(2, i, pp)) % pp;
	}
	return ans;
}

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

	int n; string s; cin >> n >> s;
	int pp = 0;
	for (char c: s) {
		pp += (c == '1');
	}

	int loss = rem(n, s, pp-1);
	int gain = rem(n, s, pp+1);

	for (int i = 0, j = n-1; i < n; i++, j--) {
		int ans = 1, cur = 0;
		if (s[i] == '0') {
			// gain a bit
			cur = gain;
			cur = (cur + modpow(2, j, pp+1)) % (pp+1);
		} else {
			// lose a bit
			if (pp == 1) {
				ans = 0;
				cur = 0;
			} else {
				cur = loss;
				cur = (cur - modpow(2, j, pp-1)) % (pp-1);
				if (cur < 0) cur += (pp - 1);
			}
		}

		while (cur > 0) {
			ans++;
			cur %= __builtin_popcount(cur);
		}
		cout << ans << '\n';
	}

	return 0;
}


Measured memory_bytes: 3856
#include <iostream>
using namespace std;
 
 
 
int main(int argc, char *argv[])
{
	int a,b ;
	cin >> a >> b;

	if ((a+b)%2)
	{
			cout << "IMPOSSIBLE";
	} else {
		cout << (a+b)/2;
	}
	return 0;
}



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

int main(){
    int n,k;
    cin >> n >> k;
    int a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    sort(a,a+n,greater<>());
    set<int>st;
    int x[300000]={0};
    for(int i=0;i<n;i++){
        st.insert(a[i]);
        x[a[i]]++;
    }
    int no=st.size();
    int y=no-k;
    sort(x,x+300000,greater<>());
    int ans=0;
    for(int i=no-y;i<no;i++)ans+=x[i];
    cout << ans << endl;
}

Measured memory_bytes: 11520
use std::io;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let A: i32 = iter.next().unwrap().parse().unwrap();
    let B: i32 = iter.next().unwrap().parse().unwrap();
    let C: i32 = iter.next().unwrap().parse().unwrap();
    let D: i32 = iter.next().unwrap().parse().unwrap();
    println!("{}", if A*B > C*D { A*B } else { C*D });
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <deque>

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  deque<long long> q;
  for (int i = 0; i < N; ++i) {
    long long a;
    cin >> a;
    if (i % 2 == 0)
      q.push_back(a);
    else
      q.push_front(a);
  }

  if ((N - 1) % 2 == 0) {
    for (int i = N - 1; i >= 0; --i) {
      if (i != N - 1)
        cout << " ";
      cout << q[i];
    }
  } else {
    for (int i = 0; i < N; ++i) {
      if (i != 0)
        cout << " ";
      cout << q[i];
    }
  }

  cout << endl;

  return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
    
int main() {
    long A,B;
    long result;
    int i;
    cin >> A >> B;
    for(i=1;i<=2;i++){
        if (A>=B) {
            result = result+A;
            A--;
        } else {
            result = result+B;
            B--;
        }
        
    }

    cout << result << endl;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define int               long long
#define fr                first
#define sc                second
#define vc                vector
#define endl              '\n'
#define pii               pair<int,int>
#define msi               map<string,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define LSB(i)            ((i)&-(i))

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

void solve()
{
    char a, b;
    cin >> a >> b;
    if (a < b)
    {
        int yo = b - '0';
        for (int i = 0; i < yo; i++)
            cout << a;
    }
    else
    {
        int yo = a - '0';
        for (int j = 0; j < yo; j++)
            cout << b ;
    }
}
signed main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

Measured memory_bytes: 256
n=int(input())
s=[]
for _ in range(n):
    s1=sorted(input())
    s1=''.join(s1)
    s.append(s1)
s.sort()
cnt=[1]*len(set(s))
j=0
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt[j]+=1
    else:
        cnt[j]=cnt[j]*(cnt[j]-1)//2
        j+=1
cnt[-1]=cnt[-1]*(cnt[-1]-1)//2
print(sum(cnt))

Measured memory_bytes: 16392
#include <iostream>
using namespace std;
int main() {
    int n, b, f, r, v;
    int room[5][4][11] = {{{0}}};
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> b >> f >> r >> v;
        room[b][f][r] += v;
    }
    for(int i = 1; i < 5; ++i) {
        for(int j = 1; j < 4; ++j) {
            for(int k = 1; k < 11; ++k) {
                cout << " " << room[i][j][k];
            }
            cout << endl;
        }
        if(i == 4) break;
        cout << "####################" << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <stdio.h>

int main(void) {

	int a[100],n,j;

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

	
	for (int j = 0; j < n / 2; j++) {
		int t = a[j];
		a[j] = a[n - j - 1];
		a[n - j - 1] = t;
	}

	for (int k = 0; k < n; k++) {
		printf("%d",a[k]);
		if(k==n-1){
			printf("\n");
		}
		else {
			printf(" ");
		}
	}

	return 0;
}


Measured memory_bytes: 2744
#include <stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INF (1<<21)
#define N 100
int Q[N+1],d[N+1],color[N+1],M[N+1][N+1];
int head,tail,n;
void bfs(int s){
  int i,u,v;
  head=tail=1;
  Q[tail++]=s;
  for(i=0;i<n;i++){
    d[i]=INF;
  }
  d[s]=0;
  while(head!=tail){
    u=Q[head++];
    for(v=0;v<n;v++){
      if(M[u][v]==WHITE) continue;
      if(d[v]!=INF) continue;
	d[v]=d[u]+1;
	Q[tail++]=v;
    }
  }
  for(i=0;i<n;i++) printf("%d %d\n",i+1,((d[i]==INF)?(-1):d[i]));    
}
int main(){
  int i,j,u,k,v;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    for(j=0;j<n;j++) M[i][j]=0;
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }
  bfs(0);
  return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#define up(i,a,b) for(int i=a;i<=b;i++)
#define down(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a-1;i>=b;i--)
#define CL(x) (x<<1)
#define CR(x) (x<<1)+1
#define pb push_back
#define bit1(x) __builtin_popcount(x)
#define self (*this)

using namespace std;

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

template<typename T> inline void _read(T &x){
    char ch; x=0; bool neg=false;
    for(ch=getchar();ch<'0'||ch>'9';ch=getchar())
        if(ch=='-') neg=true;
    for(;ch>='0'&&ch<='9';ch=getchar()) x=10*x+ch-'0';
    if(neg) x=-x;
}
#define read(a) _read(a)
#define Read(a,b) _read(a),_read(b)
#define READ(a,b,c) _read(a),_read(b),_read(c)

const int maxn=1e5+7;
const int Nblocks=400;
const int maxk=1e3+7;
const ll mod=1e9;
const int inf=1e9+7;
const ll linf=1e16+9;
const ll Radix=1e9;
const int Length=9;
const int MaxDigit=2e3+1;
const int nDigits=MaxDigit/Length+1;

int n,m,L;
struct Neko{
    int from,to,cost;
    Neko(){}
    Neko(int from,int to,int cost){
        self.from=from;
        self.to=to;
        self.cost=cost;
    }
};
vector<Neko> e;

inline void Enter(){
    cin>>L;
}

inline int log2(int x){
    int res=0;
    for(x/=2;x;x/=2) res++;
    return res;
}

inline void Solve(){
    int r=log2(L);
    n=r+1,m=2*r;
    up(i,1,r){
        e.pb(Neko(i,i+1,0));
        e.pb(Neko(i,i+1,1<<(i-1)));
    }
    int PowR=1<<r;
    for(int i=r;i && L>PowR;i--){
        int PowI=1<<(i-1);
        if(L-PowR>=PowI){
            L-=PowI;
            e.pb(Neko(i,n,L));
            m++;
        }
    }
    cout<<n<<' '<<m<<'\n';
    rep(i,0,e.size()) cout<<e[i].from<<' '<<e[i].to<<' '<<e[i].cost<<'\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
  
    Enter();
    Solve();

    return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

string s;

bool isp(int lb,int ub)
{
	for(int i=lb,j=ub;i<=ub;i++,j--) if(s[i]!=s[j]) return false;
	return true;
}

int main()
{
	cin>>s;
	int n=s.size();
	if(isp(0,s.size()-1)&&isp(0,(n-1)/2-1)&&isp((n+3)/2-1,s.size()-1)) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

ll euclidean_gcd(ll a, ll b) {
  while (1) {
    if (a < b) swap(a, b);
    if (!b) break;
    a %= b;
  }
  return a;
}

int main() {
  ll A, B;
  ll C, D;
  cin >> A >> B >> C >> D;
  ll l = euclidean_gcd(C, D);
  ll g = C * D / l;
  ll ans = B - (A - 1) - (B / C - (A - 1) / C) - (B / D - (A - 1) / D) +
           (B / g - (A - 1) / g);
  cout << ans << endl;
  return 0;
}

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

 int main()
 {
 	int i, n;
 	cin >> n;
 	int a[n];
 	for(i=0; i<n; i+=1)
 		cin >> a[i];
 	sort(a, a+n);
 	cout << a[n/2]-a[(n/2)-1] << endl;
 }

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef pair<Int,Int> P;

int main(){
    int N; cin >> N;
    vector<Int> A = {500};
    rep(i,N){
        Int a; cin >> a;
        if(a != A.back()) A.push_back(a);
    }
    A.push_back(0);
    N = A.size()-2;


    Int money = 1000, kabu = 0;
    rep1(i,N){
        //cout << A[i] << endl;

        if(A[i-1] < A[i] && A[i] > A[i+1]){
            money += kabu * A[i];
            kabu = 0;
        }

        if(A[i-1] > A[i] && A[i] < A[i+1]){
            kabu += money / A[i];
            money -= kabu * A[i];
        }

        //cout << money << " " << kabu << endl;
    }

    cout << money << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
#include<math.h>
#define ll long long
 ll gcd(ll a, ll b) {

	if (b == 0)return a;
	return gcd(b, a%b);

}
int main() {
	int i, n;
	ll  a[100001];
	scanf("%d", &n);
	for (i = 0; i < n; i++)scanf("%lld", &a[i]);

	ll min = gcd(a[0], a[1]);

	for (i = 2; i < n; i++) {
		if (min > gcd(a[i], min))
			min = gcd(a[i], min);

	}
	printf("%lld", min);

	return 0;
}

Measured memory_bytes: 896
#include <iostream>

int main()
{
    int n_1st;
    int n_2nd;
    int n_3rd;
    int n;
    
    n_1st = n_2nd = n_3rd = 0;

    while (std::cin >> n){
        if (n > n_1st){
            n_3rd = n_2nd;
            n_2nd = n_1st;
            n_1st = n;
        }
        else if (n > n_2nd){
            n_3rd = n_2nd;
            n_2nd = n;
        }
        else if (n > n_3rd){
            n_3rd = n;
        }
    }
    
    std::cout << n_1st << std::endl;
    std::cout << n_2nd << std::endl;
    std::cout << n_3rd << std::endl;
    
    return 0;
}

Measured memory_bytes: 1164
#include<cstdio>
    #include<algorithm>
    #include<vector>
    #define MaxN 20000+100
    using namespace std;
    vector<int> g10[MaxN];
    vector<int> g5[MaxN];
    int main()
    {
    	int N;
    	int H;
    	scanf("%d %d",&N,&H);
    	for(int i=0;i<=2000;i++)
    		for(int k=0;k<=2000;k++)
    		{
    			int sum=10*i+5*k;
    			if(sum<MaxN)
    			{
    				g10[sum].push_back(i);
    				g5[sum].push_back(k);
    			}
    		}
    	H/=1000;
    	int i;
    	for(i=0;i<=N;i++)
    	{
    		int sum=H-i;
    		if(g10[sum].size()!=0)
    		{
    			int p;
    			for(p=0;p<g10[sum].size();p++)
    			{
    				if(i+g10[sum][p]+g5[sum][p]==N)
    				{
    					printf("%d %d %d\n",g10[sum][p],g5[sum][p],i);
    					break;
    				}
    			}
    			if(p!=g10[sum].size())
    				break;
    		}
    	}
    	if(i==N+1)
    		printf("-1 -1 -1\n") ;
    	return 0;
     } 
     
     
        

Measured memory_bytes: 28288
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){

  
    int n,k;
    cin >> n >> k;

    int m = 1;
    rep(i,0,n){
	m = min(m*2,m+k);
    }
    P(m);
    return  0;
}


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

int main() {
   int n,m;
   cin >> n >> m;
   int c[m];
   for (int i=0; i<m; i++) {
       cin >> c[i];
   }
   int count[m][n+1];
   for (int i=0; i<m; i++) {
       for (int j=0; j<=n; j++) {
           count[i][j]=0;
       }
   }
   for (int i=0; i<m; i++) {
       for (int j=0; j<=n; j++) {
           if (j==0) {
               count[i][j]=0;continue;
           }
           if (i==0) {
               if (j%c[0]==0) {
                   count[0][j]=j/c[0];
               }
               else count[0][j]=-1;continue;
           }
           if (j<c[i]) {
               count[i][j]=count[i-1][j];continue;
           }
           if (count[i][j-c[i]]==-1) {
               count[i][j]=count[i-1][j];continue;
           }
           if (count[i-1][j]==-1) {
               count[i][j]=count[i][j-c[i]]+1;continue;
           }
           count[i][j]=min(count[i-1][j],count[i][j-c[i]]+1);
       }
   }
   cout << count[m-1][n] << endl;
}


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

#define INF 1e9
#define LLINF 1e18
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;


int main() {
    string a, b, c, ans;
    cin >> a >> b >> c;
    ans += a.at(0) - 32;
    ans += b.at(0) - 32;
    ans += c.at(0) - 32;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int a[25],b[25],c[25];
	int n;
	cin>>n;
	For(i,n) cin>>a[i];
	For(i,n) cin>>b[i];
	For(i,n-1) cin>>c[i];
	
	int ans=0;
	For(i,n) ans+=b[i];
	For(i,n-1){
		if(a[i+1]==a[i]+1){
			ans+=c[a[i]];
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>//本当は必要なヘッダファイルだけインクルードするべきです
using namespace std;//本当は個別にusingするか変数や関数ごとにstd::をつけるべきです
//本当は関数内に宣言し明示的に初期化するべきです
int m,f,r;
int main(void){
  while(cin>>m>>f>>r){
    if(m==-1&&f==-1&&r==-1)break;
    if(m==-1||f==-1)cout<<'F'<<endl;
    else if(m+f>=80)cout<<'A'<<endl;
    else if(m+f>=65)cout<<'B'<<endl;
    else if(m+f>=50)cout<<'C'<<endl;
    else if(m+f>=30)
      if(r>=50)cout<<'C'<<endl;
      else cout<<'D'<<endl;
    else cout<<'F'<<endl;
  }
  return 0;
}



Measured memory_bytes: 3076
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main (void){

    string s,a;
   
    cin >> s;

    sort(s.begin(),s.end());

    if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
        
return 0;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  string s;
  cin >> s;

  LL ts = s.size();
  REP (i, s.size() - 1) {
    if (s[i] != s[i + 1]) ts = min(ts, max((LL)i + 1, (LL)(s.size() - i - 1)));
  }
  cout << ts << endl;
}


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

//template
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define repr(i,n) for(ll i=n;i>0;i--)
#define all(v) v.begin(),v.end()
#define in cin>>
#define out cout<<
#define en <<endl
const ll INF = 10000000000000;

int main()
{
	int A, B;
	in A >> B;
	if (A != 1 && B != 1)
	{
		out 1 en;
	}
	else if (A != 2 && B != 2)
	{
		out 2 en;
	}
	else
		out 3 en;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000000 + 7
#define PI 3.14159265359

const long long INF = 100000;
typedef pair<int,int> P;
typedef long long ll;

using Graph = vector<vector<int>>;

vector<ll> v;// 753数を格納する配列

// 引数kの末尾に3 or 5 or 7を付けてvに加えるdfs 付け加える数がN以下の時だけ
void dfs(ll k, ll N) {
	if (k > N) return;

	if (k*10 + 3 > N) return;
	v.push_back(k*10 + 3);
	dfs(10*k + 3, N);

	if (k*10 + 5 > N) return;
	v.push_back(k*10 + 5);
	dfs(10*k + 5, N);

	if (k*10 + 7 > N) return;
	v.push_back(k*10 + 7);
	dfs(10*k + 7, N);
}

// Nが753数かどうかチェックする関数
bool check(ll N) {
	bool flag3 = false;
	bool flag5 = false;
	bool flag7 = false;

	while (N) {
		int c = N % 10;// Nの末尾の桁　末尾から見ていく
		N /= 10;
		if (c == 3) flag3 = true;
		if (c == 5) flag5 = true;
		if (c == 7) flag7 = true; 

	}
	if (flag3 && flag5 && flag7) return true;
	else return false;
}

int main() {
    ll N;
	cin >> N;
	dfs(3, N);
	dfs(5, N);
	dfs(7, N);

	/*for (int i = 0; i < v.size(); i++) {
		cout << v[i] << endl;
	}*/
	int ans = 0;
	for (ll i = 0; i < v.size(); i++) {
		if (check(v[i])) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
typedef long long ll;
using namespace std;

int main(int argc, char const *argv[]) {
    ll n;
    cin >> n;
    map<ll, ll> mp;
    ll a;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        mp[a]++;
    }
    ll even = 0ll;
    for (auto x : mp) if (x.second % 2 == 0) even++;
    ll ans = mp.size()-even;
    cout << ans << std::endl;
    return 0;
}

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

using namespace std;

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

int w, h;
string p[60];
bool visited[60][10];

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

pair<bool, pair<int, int> > solve(int y, int x) {
  vector<int> bottom;
  queue<pair<int, int> > que;
  que.push(make_pair(y, x));
  pair<int, int> weight;
  while (!que.empty()) {
    pair<int, int> now = que.front();
    que.pop();
    if (visited[now.first][now.second]) continue;
    visited[now.first][now.second] = true;
    weight.first += now.second;
    weight.second += 1;
    if (now.first == h - 1 || (p[now.first][now.second] != p[now.first + 1][now.second] && p[now.first + 1][now.second] != '.')) bottom.push_back(now.second);
    if (now.first != 0 && p[now.first][now.second] != p[now.first - 1][now.second] && p[now.first - 1][now.second] != '.' && !visited[now.first - 1][now.second]) {
      pair<bool, pair<int, int> > w = solve(now.first - 1, now.second);
      if (w.first == false) return make_pair(false, make_pair(0, 0));
      weight.first += w.second.first;
      weight.second += w.second.second;
    }
    rep (k, 4) {
      int yy = now.first + dy[k];
      int xx = now.second + dx[k];
      if (yy < 0 || h <= yy) continue;
      if (xx < 0 || w <= xx) continue;
      if (p[y][x] != p[yy][xx]) continue;
      que.push(make_pair(yy, xx));
    }
  }
  sort(bottom.begin(), bottom.end());
  if (2 * weight.first + weight.second <= 2 * weight.second * bottom[0]) return make_pair(false, make_pair(0, 0));
  if (2 * weight.first - weight.second >= 2 * weight.second * bottom.back()) return make_pair(false, make_pair(0, 0));
  return make_pair(true, weight);
}

int main() {
  while (true) {
    cin >> w >> h;
    if (w == 0 && h == 0) break;
    rep (i, h) cin >> p[i];
    rep (i, h) rep (j, w) visited[i][j] = false;
    rep (i, h) rep (j, w) if (p[i][j] != '.') rep (k, 4) {
	int ii = i + dy[k];
	int jj = j + dx[k];
	if (ii < 0 || h <= ii) continue;
	if (jj < 0 || w <= jj) continue;
	if (p[i][j] != p[ii][jj]) continue;
      }
    rep (i, w) if (p[h - 1][i] != '.') {
      if (solve(h - 1, i).first) cout << "STABLE" << endl;
      else cout << "UNSTABLE" << endl;
      goto next;
    }
  next:;
  }
}

Measured memory_bytes: 1260
#include<iostream>
#include<map>
using namespace std;
main()
{
	long long int n, sum = 0;
	cin >> n;
	string s;
	cin >> s;
	long long int i, j;
	map<char, long long int>m;
	for(i=0;i<n;i++)
	m[s[i]]++;
	
	for(i=0;i<n-2;i++)
	{
		long long int r = m['R'], g = m['G'], b = m['B'];
	for(j=i+1;j<n-1;j++)
	    {
			if(s[i] == 'R' && s[j] == 'G' || (s[i] == 'G' && s[j] == 'R') )
     			{
     				long long int x = j-i;
     				sum+=m['B'];
     				if(x+j<n)
     				{
					 
					 if(s[x+j] == 'B')
     				sum--;
     			    }
				}
			else if(s[i] == 'R' && s[j] == 'B' || (s[i] == 'B' && s[j] == 'R')  )
     			{
     				long long int x = j-i;
     				sum+=m['G'];
     				if(x+j<n)
     				{
					 
					 if(s[x+j] == 'G')
     				sum--;
     			     }
				}
			else if(s[i] == 'B' && s[j] == 'G' || (s[i] == 'G' && s[j] == 'B'))
     			{
     				long long int x = j-i;
     				sum+=m['R'];
     				if(x+j<n)
     				{
     				if(s[x+j] == 'R')
     				sum--;
     			    }
				}
	 				m[s[j]]--;
		 }
		 m['R'] = r;m['G'] = g;m['B'] = b;
		 m[s[i]]--;
    }	
	cout << sum;
	return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#define N 2000000

int A[N],B[N];
int count[N];
void CountingSort(int [],int [],int);

main(){
  
  int k,i,j;
  
  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d",&A[i]);
  }
  CountingSort(A,B,k);
  for(i=0;i<k;i++){
    printf("%d",B[i]);
    if(i < k-1)
      printf(" ");
    else
      printf("\n");
  }
  return 0;

}

void CountingSort(int a[],int b[],int n){
  int i;

  for(i=0 ; i<=N ; i++){
    count[i] = 0;

    for(i=0 ; i<n ;i++)
      count[a[i]]++;

    for(i=0 ; i < N ; i++)
      count[i+1] += count[i];
  }

  for(i=n-1;i>=0;i--){
    b[--count[a[i]]] = a[i];
  }
}

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

long long n, p, q, sum = 0;
vector<long long> c;

long long solve();

int main() {
  cin >> n >> p >> q;
  c.resize(n);
  for(int i = 0; i < n; ++i) cin >> c[i];
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(int i = 0; i < n; ++i) {
    sum += c[i];
    c[i] += p * i;
  }
  sort(c.begin(), c.end());
  for(int i = 1; i < n; ++i) c[i] += c[i - 1];
  ans = sum;
  for(long long i = 0; i < n; ++i) {
    long long now = sum;
    now += p * (q * (i + 1) + i * (i + 1));
    now -= c[i];
    ans = max(ans, now);
  }
  return ans;
}


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

colors = [0 for _ in range(8)]
over = 0

for a in A:
    if 3200 <= a:
        over += 1
    else: 
        colors[a // 400] = 1

c = colors.count(1)

maxi = c + over

if c == 0:
    mini = 1
else:
    mini = c

print(mini, maxi)


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

/*int main() {
  int N; cin >> N;
  int A[2][N];
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < N; j++)
      cin >> A[i][j];
  }
  vector<int> S;
  int su = 0;
  for (int i = 0; i < N; i++)
    su += A[0][i];
  int sd = A[1][N-1];
  S.push_back(su + sd);
  for (int i = 1; i < N; i++) {
    su -= A[0][N-i]; sd += A[1][N-1-i];
    S.push_back(su + sd);
  }
  sort(S.begin(), S.end());
  cout << S[N-1] << endl;
}*/

int main() {
  int N; cin >> N;
  int A[2][110];
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < N; j++)
      cin >> A[i][j];
  }
  int as[2][110];
  as[0][0] = A[0][0];
  as[1][0] = as[0][0] + A[1][0];
  for (int i = 1; i < N; i++) {
    as[0][i] = as[0][i-1] + A[0][i];
    as[1][i] = max(as[1][i-1], as[0][i]) + A[1][i];
  }
  cout << as[1][N-1] << endl;
}


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

map<vector<int>,int> mp;
map<vector<int>,int>::iterator it;
vector<int> v;

int main(){
	string s;
	int n;
	
	cin >> n;
	while(n--){
		v.clear();
		for(int i = 0;i < 26;i++){
			v.push_back(0);
		}
		cin >> s;
		for(int i = 0;i < s.size();i++){
			v[s[i]-'a']++;
		}
		mp[v]++;
	}
	long long ans = 0;
	for(it = mp.begin();it!=mp.end();it++){
		long long x = it->second;
		ans+=x*(x-1)/2;
	}
	cout << ans << endl;
}

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll N,ans,j;
  vector<string> s;
  map<string,int> mp;
  cin >> N;
  REP(i,N){
		string S;
		cin >> S;
    sort(S.begin(), S.end());
		mp[S]++;
	}
  ans = 0;
  for(auto& p : mp){
    int s = p.second;
    ans = ans + (ll)s*(s-1)/2;
  }
  cout << ans<< endl;
  return 0;
}

Measured memory_bytes: 11136
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	long MODULO = 1_000_000_000 + 7;

	void run() {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] t = new int[n];
		int[] p = new int[n];
		int[] x = new int[s];
		for (int i = 0; i < s; ++i) {
			x[i] = sc.nextInt();
		}
		for (int i = 0; i < n; ++i) {
			t[i] = sc.nextInt();
			p[i] = sc.nextInt();
			--p[i];
		}
		int[] w = new int[n];
		for (int i = 0; i < n; ++i) {
			w[i] = t[i] - x[p[i]];
		}
		Arrays.sort(w);
		long ans = 0;
		for (long v : w) {
			ans -= v;
		}
		long[][] f = new long[n + 1][m + 1];
		for (int i = 0; i < f.length; ++i) {
			for (int j = 0; j < f[i].length; ++j) {
				f[i][j] = Integer.MAX_VALUE / 16;
			}
		}
		for (int i = 1; i < f.length; ++i) {
			f[i][1] = w[i - 1] * i;
		}

		for (int j = 2; j <= m; ++j) {
			// j is fixed.
			// Attention: h[i][k]:=f[k][j-1]+w[i-1]*(i-k) is of Monge.
			// min(h[i][]) can be enumerated in O(n*log(n))
			// f[i][j]=min(h[i][])
			long[] v = calc(f, w, j);
			for (int i = 1; i <= n; ++i) {
				// for (int k = 1; k <= i - 1; ++k) {
				// f[i][j] = Math.min(f[i][j], h(f, w, i, j, k));
				// }
				f[i][j] = v[i];
			}
		}

		long min = Integer.MAX_VALUE / 16;
		for (int j = 1; j <= m; ++j) {
			min = Math.min(min, f[n][j]);
		}
		ans += min;
		System.out.println(ans);
	}

	long[] calc(long[][] f, int[] w, int j) {
		int n = f.length - 1;
		int m = f[0].length - 1;
		long[] ret = new long[n + 1];
		Arrays.fill(ret, Integer.MAX_VALUE / 16);
		rec(ret, 1, n, 2, n + 1, f, w, j);
		return ret;
	}

	// [low,high)
	// [left,right)
	long rec(long[] ret, int low, int high, int left, int right, long[][] f, int[] w, int j) {
		int mid = (left + right) / 2;// the value of the variable i
		long v = Long.MAX_VALUE / 16;
		int arg = -1;
		for (int k = Math.max(0, low); k <= Math.min(mid - 1, high); ++k) {
			v = Math.min(v, h(f, w, mid, j, k));
			if (v == h(f, w, mid, j, k))
				arg = k;
		}
		if (right - left > 1) {
			rec(ret, low, arg, left, mid, f, w, j);
			rec(ret, arg, high, mid, right, f, w, j);
		}
		ret[mid] = v;
		return v;
	}

	long h(long[][] f, int[] w, int i, int j, int k) {
		return f[k][j - 1] + w[i - 1] * (i - k);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

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


using namespace std;


void atcoder_beginner_contest999()
{
  string n;
  cin >> n;

  for (int i = 0; i < n.size(); ++i)
  {
    if (n[i] == '1') n[i] = '9';
    else if (n[i] == '9') n[i] = '1';
  }
  cout << n << "\n";
}


void programming_education()
{
  int n;
  cin >> n;
  
  if (n == 1)
  {
    cout << "Hello World\n";
    return;
  }
  else
  {
    int a, b;
    cin >> a >> b;
    cout << a + b << "\n";
  }
}

void discount_fare()
{
  int x, y;
  cin >> x >> y;

  cout << x + y / 2 << "\n";
}


void A_114()
{
  int x;
  cin >> x;

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


void christmas_eve_eve_eve()
{
  int d;
  cin >> d;

  if (d == 25) cout << "Christmas\n";
  else if (d == 24) cout << "Christmas Eve\n";
  if (d == 23) cout << "Christmas Eve Eve\n";
  if (d == 22) cout << "Christmas Eve Eve Eve\n";

}



int main()
{
  //atcoder_beginner_contest999();
  //programming_education();
  //discount_fare();
  //A_114();
  christmas_eve_eve_eve();
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int P,Q,R,min;
    scanf("%d %d %d",&P,&Q,&R);
    
    min=P+Q;
    if(Q+R<min)
    min=Q+R;
    if(R+P<min)
    min=R+P;
    printf("%d",min);
    
    return(0);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define ll long long
#define ull unsigned long long
#define dd double
#define oo 1001007000
#define ff float
#define ooo 1000000100000000000
#define iii pair<ll,ll>
#define vii vector<ll>
#define viii vector<iii>
#define sss pair<str,str>
#define str string
#define sii set<ll>
#define siii set<iii>
#define st size_t
#define r0 return 0
#define pb push_back
#define sz size
using namespace std;

const char E='\n';
const int N=200005;
const int NN=1000001;
const ll md=998244353;



int main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    ll a[N]={0};
    ll kl[N]={0};
    for (int i=1;i<=n;i++){
        cin >> a[i];
        kl[a[i]]++;
    }
    ll ans=0;
    for (int i=1;i<=n;i++){
        ans+=max(0ll,kl[i]*(kl[i]-1)/2ll);
    }
    for (int i=1;i<=n;i++){
        cout << max(0ll,ans-kl[a[i]]+1) << E;
    }
    r0;
}


Measured memory_bytes: 5760
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int d = sc.nextInt();
        int t = sc.nextInt();
        int s = sc.nextInt();
        
        if(d<=t*s){
            System.out.printf("Yes");
        }else{
            System.out.printf("No");
        }
        
    }
}


Measured memory_bytes: 35620
N = int(input())
if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(N - 90)
elif N < 10000:
    print(909)
elif N < 100000:
    print(N - 9090)
else:
    print(90909)


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

int main() {
    int n;
    cin>>n;
    int sco_taro=0,sco_hana=0;
    for(int i=0;i<n;i++){
        string taro,hana;
        cin>>taro>>hana;
        if(taro==hana){
            sco_taro++;
            sco_hana++;
        }else if(taro>hana) sco_taro+=3;
        else if(taro<hana) sco_hana+=3;
    }
    cout<<sco_taro<<" "<<sco_hana<<endl;
}


Measured memory_bytes: 3144
from queue import PriorityQueue
 
INF=1<<30
n=int(input())
adj=[[]for i in range(n+1)]
maxx = 10010

def dijkstra():
    global adj
    PQ=PriorityQueue()
      
    d=[INF for i in range(n)]
    #p=[-1 for i in range(n)]
    flag=[0 for i in range(n)]
 
    d[0] = 0;
    PQ.put((0, 0))
    while (not PQ.empty()):
        f = PQ.get()
        u = f[1]
        
        # 标记已经加入S
        flag[u] = 1

        #如果不是最小最短路径则忽略
        #if (d[u] >f[0] ):
            #continue
        lens = len(adj[u])
        for j in range(lens):
            v = adj[u][j][0]
            if (flag[v] == 0 and d[v] > d[u] + adj[u][j][1]):
                d[v] = d[u] + adj[u][j][1]
                PQ.put((d[v], v));
            

    for i in range(n):
        if d[i]==INF:
            print("%d %d"%(i, -1))
        else:
            print("%d %d"%(i, d[i]))
        

for i in range(n):
    s=[int(x) for x in input().split()]
    u=s[0]
    k=s[1]
    for j in range(k):
        adj[u].append((s[j*2+2],s[2*j+3]))
 
dijkstra()


Measured memory_bytes: 70196
n,m,c=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int,input().split()))for i in range(n)]
cnt=0
for i in range(n):
    ans=0
    for j in range(m):
        ans+=B[j]*A[i][j]
    ans+=c
    if 0<ans:
        cnt+=1
print(cnt)


Measured memory_bytes: 3060
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    int pro = A*B;

    if(pro%2 == 0) {
      System.out.println("Even");
    }else {
      System.out.println("Odd");
    }
  }
}


Measured memory_bytes: 24020
#include <bits/stdc++.h>
using namespace std;
 
int dfs(int c,int b){
  if(b==0){
    return c;
  }
  dfs(b,c%b);
}

int main() {
  int n;
  cin>>n;
  vector<int> a(1000000,0);
  for(int i=0;i<n;i++){
    cin >>a.at(i);
  }
  int ans=a.at(0);
  for(int i=0;i<n;i++){
    ans=dfs(max(ans,a.at(i)),min(ans,a.at(i)));
  }
  cout <<ans;
}

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

int main() {
    int n,m;
    const int N = 1000000007;

    cin >> n >> m;

    vector<int> v(m);

    for(int i = 0; i < m; ++i) cin >> v[i];

    vector<int> c(n + 1,0);

    c[0] = 1;

    int r = 0;

    for(int i = 1; i <= n; ++i){
        if(r < v.size() && i == v[r]){
            r++;
        }else{
            if(i - 1 >= 0){
                c[i] += c[i - 1];
                c[i] %= N;
            }
            if(i - 2 >= 0){
                c[i] += c[i - 2];
                c[i] %= N;
            }
        }
    }

    cout << c.back() << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

const int N = 1e5 + 1;
const int INF = 1e9;
int dp[N], h[N];

void min_self(int &a, int b) {
	a = min(a, b);
}

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++) scanf("%d", &h[i]);

	dp[0] = 0;
	for (int i = 1; i < n; i++) dp[i] = INF;
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= k; j++)
			if (i + j < n) min_self(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
	}
	//for (int i = 0; i < n; i++) printf("%d ", dp[i]); puts("");
	printf("%d\n", dp[n-1]);
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))

acca = []

def merge(n, l, m, r):
    global acca
    cnt = 0
    n1, n2 = m - l, r - m
    la, ra = [], []
    for i in range(n1):
        la.append(acca[l + i])
    for i in range(n2):
        ra.append(acca[m + i])
    la.append(float("inf"))
    ra.append(float("inf"))
    i, j = 0, 0
    for k in range(l, r):
        if la[i] <= ra[j]:
            acca[k] = la[i]
            i += 1
        else:
            acca[k] = ra[j]
            j += 1
            cnt += n1 - i
    return cnt


def mergesort(n, l, r):
    if l + 1 < r:
        m = (l + r) // 2
        c1 = mergesort(n, l, m)
        c2 = mergesort(n, m, r)
        c3 = merge(n, l, m, r)
        return c1 + c2 + c3
    else:
        return 0


def main():
    global acca
    n, k = map(int, input().split())
    a = [int(input()) for _ in range(n)]
    a = [_a - k for _a in a]
    acca = [0 for i in range(n + 1)]
    for i, _a in enumerate(a):
        acca[i + 1] = acca[i] + _a

    print(n * (n + 1) // 2 - mergesort(n + 1, 0, n + 1))


if __name__ == '__main__':
    main()


Measured memory_bytes: 22256
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
#define N 500005
#define ll long long
ll n;
double a[N];
ll cnt2[N],cnt5[N],ten[N];
ll sum[5005][5005],ans;
ll len1,len2;
int main(){
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++){
		scanf("%lf",a+i);
		ten[i]=9;
		ll JZY=llround(a[i]*1000000000);
//		printf("%lld\n",JZY);
		while(JZY%2==0&&JZY) JZY>>=1,cnt2[i]++;
		while(JZY%5==0&&JZY) JZY/=5,cnt5[i]++;
//		for(ll j=0,mul=1;j<=10;j++,mul*=10){
////			if(i==n)printf("read %lf %lld %lld\n",a[i]*mul,(ll)(a[i]*mul),(a[i]*mul)-(ll)(a[i]*mul)<1e-9);
//			if(a[i]*mul==llround(a[i]*mul)){
//				ten[i]=j;
////				printf("%lld %lld %lld\n",cnt2[i],cnt5[i],ten[i]);
//				break;
//			} 
//		}
	}
	for(ll i=1;i<=n;i++)
		len1=max(len1,cnt2[i]),len2=max(len2,cnt5[i]);
	len1+=20,len2+=20;
//	printf("border %lld %lld\n",len1,len2);
	for(ll i=1;i<=n;i++){
//		printf("num %lf\n",a[i]);
//		printf("check %lld %lld\n",ten[i]-cnt2[i]+10,ten[i]-cnt5[i]+10);
		for(ll x=ten[i]-cnt2[i]+20;x<=len1;x++)
			for(ll y=ten[i]-cnt5[i]+20;y<=len2;y++)
				ans+=sum[x][y];
//		printf("add %lld %lld\n",cnt2[i]-ten[i]+10,cnt5[i]-ten[i]+10);
		sum[cnt2[i]-ten[i]+20][cnt5[i]-ten[i]+20]++;
	}
	printf("%lld",ans);
}
/*
7
0.9
1
1
1.25
2.3
5
70
*/

Measured memory_bytes: 9600