akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
template<class T> bool INRANGE(T x,T a,T b) { return a<=x&&x<=b; }
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;


typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

vector<ll> divisor(ll n){
    vector<ll> res{n};
    ll div = 2;
    while (div*div <= n){
        if (n%div == 0){
            res.emplace_back(div);
            if(div != 1 and div*div != n) res.emplace_back(n/div);
        }
        div++;
    }

    return res;
}


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


    ll N;
    cin >> N;


    ll ans = 0;
    for (ll d : divisor(N)){
        if (d-1<=0) continue;
        if (N/(d-1) == N%(d-1)) {
            ans += d-1;
            //cout << d-1 << endl;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<algorithm>
struct S{int p,q,r,b;}a[101];
typedef long long L;
L GCD(L x,L y)
{
	if(!y)return x;
	return GCD(y,x%y);
}
L LCM(L x,L y)
{
	return x/GCD(x,y)*y;
}
L F(int i)
{
	if(!i)return 1;
	S&s=a[i];
	L r=F(s.r),b=F(s.b);
	L l=LCM(s.p*r,s.q*b);
	return l/s.p+l/s.q;
}
int main()
{
	int n,i,g;
	S s;
	while(scanf("%d",&n),n)
	{
		int f[101]={1};
		for(i=0;i<n;++i)
		{
			scanf("%d%d%d%d",&s.p,&s.q,&s.r,&s.b);
			f[s.r]=1;
			f[s.b]=1;
			g=GCD(s.p,s.q);
			s.p/=g;
			s.q/=g;
			a[i+1]=s;
		}
		printf("%lld\n",F(std::find(f,f+n,0)-f));
	}
	return 0;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <limits>
#include <vector>
#include <algorithm>
#include <functional>
#include <cctype>
#include <sstream>
#include <numeric>

typedef long long lint;
typedef long double ldouble;
using namespace std;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);++i)
#define all(x) (x).begin(),(x).end()
#define sl(c) (('a')<=(c)&&(c)<=('z'))
#define ll(c) (('A')<=(c)&&(c)<=('Z'))
#define PI 3.141592653589793
#define cout (cout<<fixed<<setprecision(15))
#define makeupper(t) (transform(all(t),t.begin(),::toupper))
#define makelower(t) (transform(all(t),t.begin(),::tolower))
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define sum(a) accumulate(all(a),0)
#define NEXT_LINE string junk; getline(cin, junk);
inline lint* arr1(lint x) {
	lint *array = new lint[x];
	rep(i, x)array[i] = 0;
	return array;
}
inline lint** arr2(lint x, lint y) {
	lint **array = new lint*[x];
	rep(i, x)array[i] = new lint[y];
	rep(i, x)rep(j, y)array[i][j] = 0;
	return array;
}
inline vector<string> split(const string &s, char delim) {
	vector<string> elems;
	stringstream ss(s);
	string item;
	while (getline(ss, item, delim)) {
		if (!item.empty()) {
			elems.push_back(item);
		}
	}
	return elems;
}
inline ldouble max(vector<ldouble> a) {
	ldouble M = a[0];
	rep(i, a.size())if (M < a[i])M = a[i];
	return M;
}
inline ldouble min(vector<ldouble> a) {
	ldouble m = a[0];
	rep(i, a.size())if (m > a[i])m = a[i];
	return m;
}
inline lint max(vector<lint> a) {
	lint M = a[0];
	rep(i, a.size())if (M < a[i])M = a[i];
	return M;
}
inline lint min(vector<lint> a) {
	lint m = a[0];
	rep(i, a.size())if (m > a[i])m = a[i];
	return m;
}
inline ldouble sum2(vector<ldouble> a, int n) {
	vector<ldouble> b;
	b.resize(a.size());
	rep(i, a.size())b[i] = powl(a[i], n);
	return sum(b);
}
inline lint sum2(vector<lint> a, int n) {
	lint sum=0;
	rep(i, a.size())sum += powl(a[i], n);
	return sum;
}
inline ldouble dist2(vector<ldouble> a, vector<ldouble> b,int num) {
	if (a.size() != b.size())return -1;
	vector<ldouble> c;
	c.resize(a.size());
	rep(i, a.size())c[i] = abs(b[i] - a[i]);
	if (num == 0)return max(c);
	else return pow(sum2(c, num), 1. / num);
}
inline ldouble dist2(vector<lint> a, vector<lint> b, int num) {
	if (a.size() != b.size())return -1;
	vector<lint> c;
	c.resize(a.size());
	rep(i, a.size())c[i] = abs(b[i] - a[i]);
	if (num == 0)return max(c);
	else return pow(sum2(c, num),1./num);
}
inline vector<int> cross(vector<int> a, vector<int> b) {
	return { a[1] * b[2] - a[2] * b[1],a[2] * b[0] - a[0] * b[2],a[0] * b[1] - a[1] * b[0] };
}

inline int GCD(int a, int b) {
	if (a < b)swap(a, b);
	if (a%b != 0)GCD(b, a%b);
	else return b;
}
int main() {
	int a, b;
	cin >> a >> b;
	cout<<GCD(a, b)<<"\n";
}


Measured memory_bytes: 3080
#include <stdio.h>
long long min(long long x, long long y) { return x < y ? x : y; }
int main() {
	long long n, a, b, c, d, e;
	scanf("%lld%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d, &e);
	long long m = min(a, min(b, min(c, min(d, e))));
	printf("%lld\n", n % m == 0 ? n / m + 4 : n / m + 5);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var I = GL;
		long N = I[0], P = I[1];
		var ps = Func.GetPrimes(1001000);
		var fac = P.Factorize(ps);
		var ans = 1L;
		foreach (var f in fac)
		{
			ans *= Func.Pow(f.Key, f.Value / N);
		}
		WriteLine(ans);
	}
}
static class Func
{
	public static long Pow(long a, long b)
	{
		var p = 1L;
		var x = a;
		while (b > 0)
		{
			if ((b & 1) == 1) p = p * x;
			b >>= 1;
			x = x * x;
		}
		return p;
	}
	public static Dictionary<long, int> Factorize(this long n, List<int> primes)
	{
		var d = new Dictionary<long, int>();
		for (var j = 0; j < primes.Count; j++)
		{
			long i = primes[j];
			if (i * i > n) break;
			if (n % i == 0)
			{
				d.Add(i, 0);
				while (n % i == 0) { n /= i; d[i]++; }
			}
		}
		if (n > 1) d.Add(n, 1);
		return d;
	}
	public static List<int> GetPrimes(int n)
	{
		if (n < 3) n = 3;
		var m = (n - 1) >> 1;
		var primes = new List<int>((int)(n / Math.Log(n)));
		primes.Add(2);
		var composites = new bool[m];
		composites[0] = false;
		for (var p = 0; p < m; p++)
		{
			if (!composites[p])
			{
				var pnum = 2 * p + 3;
				primes.Add(pnum);
				for (var k = 3 * p + 3; k < m; k += pnum) composites[k] = true;
			}
		}
		return primes;
	}
}

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

int main(void)
{
    IOS
    ll N,A,B;
    cin >> N >> A >> B;

    if ( (B-A) %2 == 0 ) {
        OUT((B-A)/2)
    } else {
        OUT(min(A-1,N-B)+1 + (B-A-1)/2)
    }

    return 0;
}

Measured memory_bytes: 256
h,w,k=map(int,input().split())
dot=[list(input()) for i in range(h)]
ans=0
for i in range(2**h):
    for j in range(2**w):
        
        count=0
        
        for ii in range(h):
            for jj in range(w):
                if(i >> ii)&1==0 and (j>>jj)&1==0:
                    if dot[ii][jj]=='#':
                        count+=1
        if count==k:
            ans+=1
print(ans)



Measured memory_bytes: 9184
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <queue>
using namespace std;

int main()
{
  string s;
  while (cin >> s) {
    if (s == "0")
      break;

    queue<pair<int, string> > que;
    que.push(make_pair(0, s));
    set<string> memo;
    int ans = -1;
    while (!que.empty()) {
      const pair<int, string> p = que.front();
      que.pop();

      if (p.second.find_first_of("rg") == string::npos ||
	  p.second.find_first_of("rb") == string::npos ||
	  p.second.find_first_of("gb") == string::npos) {
	ans = p.first;
	break;
      }

      if (memo.find(p.second) != memo.end())
	continue;
      memo.insert(p.second);

      for (int i = 0; i < p.second.size()-1; ++i) {
	if (p.second[i] != p.second[i+1]) {
	  s = p.second;
	  if (s[i] == 'r' && s[i+1] == 'g' || s[i] == 'g' && s[i+1] == 'r')
	    s[i] = s[i+1] = 'b';
	  else if (s[i] == 'r' && s[i+1] == 'b' || s[i] == 'b' && s[i+1] == 'r')
	    s[i] = s[i+1] = 'g';
	  else if (s[i] == 'g' && s[i+1] == 'b' || s[i] == 'b' && s[i+1] == 'g')
	    s[i] = s[i+1] = 'r';

	  if (memo.find(s) == memo.end())
	    que.push(make_pair(p.first+1, s));
	}
      }

    }

    if (ans == -1)
      cout << "NA" << endl;
    else
      cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1840
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MAXN = 1e6+10;
int spf[MAXN+3]; 
  
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<=MAXN; i++) 
        spf[i] = i; 
  
    for (int i=4; i<=MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<=MAXN; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (int j=i*i; j<=MAXN; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
  
vector<int> getFactorization(int x) 
{ 
    vector<int> ret; 
    while (x != 1) 
    { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
} 

signed main()
{
    IOS;
    int n; cin>>n;
    sieve();
    int ans = 0;
    for ( int c=1; c<=n-1; ++c )
    {
        int rem = n - c;
        vector<int>temp = getFactorization(rem);
        unordered_map<int,int>freq;
        for (auto it:temp)
            freq[it]++;
        int fct = 1;
        for (auto it:freq)
            fct*=( it.second + 1 );
        ans+=fct;
    }

    cout<< ans <<endl;
    
}


Measured memory_bytes: 11464
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var K = int.Parse(Console.ReadLine());
            var cnt = -1;

            for (var j = 0; j < 10; j++)
            {
                for (var i = 0; i < 10; i++)
                {
                    if (j != 0 && 1 < Math.Abs(j - i)) continue;
                    for (var h = 0; h < 10; h++)
                    {
                        if ((j != 0 || i != 0 )&& 1 < Math.Abs(i - h)) continue;
                        for (var g = 0; g < 10; g++)
                        {
                            if ((j != 0 || i != 0 || h != 0 )&& 1 < Math.Abs(h - g)) continue;
                            for (var f = 0; f < 10; f++)
                            {
                                if ((j != 0 || i != 0 || h != 0 || g != 0) && 1 < Math.Abs(g - f)) continue;
                                for (var a = 0; a < 10; a++)
                                {
                                    if ((j != 0 || i != 0 || h != 0 || g != 0 || f != 0 )&& 1 < Math.Abs(f - a)) continue;
                                    for (var b = 0; b < 10; b++)
                                    {
                                        if ((j != 0 || i != 0 || h != 0 || g != 0 || f != 0 || a != 0 )&& 1 < Math.Abs(a - b)) continue;
                                        for (var c = 0; c < 10; c++)
                                        {
                                            if ((j != 0 || i != 0 || h != 0 || g != 0 || f != 0 || a != 0 || b != 0 )&& 1 < Math.Abs(b - c)) continue;
                                            for (var d = 0; d < 10; d++)
                                            {
                                                if ((j != 0 || i != 0 || h != 0 || g != 0 || f != 0 || a != 0 || b != 0 || c != 0 )&& 1 < Math.Abs(c - d)) continue;
                                                for (var e = 0; e < 10; e++)
                                                {
                                                    if ((j != 0 || i != 0 || h != 0 || g != 0 || f != 0 || a != 0 || b != 0 || c != 0 || d != 0 )&& 1 < Math.Abs(d - e)) continue;
                                                    cnt++;
                                                    if (cnt == K)
                                                    {
                                                        Console.WriteLine(long.Parse($"{j}{i}{h}{g}{f}{a}{b}{c}{d}{e}"));
                                                        return;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string s, t;
  cin >> s >> t;
  cout << t + s << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int n,sq[100010];
int main()
{
	cin.sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	cin >> n;
	for(int i = 1 ; i <= n ; i ++)
		cin >> sq[i];
	sq[n + 1] = 1e9 + 1;
	for(int i = 1 ; i <= n ; i ++)
	{
		sq[i] -= 1;
		if(!(sq[i] <= sq[i + 1] && sq[i] >= sq[i - 1]))
			sq[i] ++;
	}
	for(int i = 1; i < n ; i ++)
	{
		if(sq[i] > sq[i + 1] || sq[i] < sq[i - 1])
		{
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
 } 

Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
#include<string>

using namespace std;

int main(){
    char s[101];
    char t[101];
    scanf("%s", s);
    scanf("%s", t);
    int s_num = 0;
    int t_num = 0;
    int i = 0;
    while (s[i] != 0){
        s_num++;
        i++;
    }
    i = 0;
    while (t[i] != 0){
        t_num++;
        i++;
    }
    sort(s, s + s_num);
    sort(t, t + t_num, greater<char>());
    // printf("%s %s", s, t);
    for(int i = 0; i < min(s_num, t_num); i++){
        if (s[i] > t[i]) {
            puts("No");
            return 0;
        }else if (s[i] < t[i]){
            puts("Yes");
            return 0;
        }
    }
    if (s_num >= t_num) puts("No");
    else puts("Yes");
    
}

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

int n;
string s;

int main(){
    cin>>n>>s;
    int max=0;
    int x=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='I')x++;
        else x--;
        if(max<x)max=x;
    }
    cout<<max<<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++)
int n;
double a[55], ac;
int main(){
	scanf("%d", &n);
	rep(i,n) scanf("%lf", a+i);
	sort(a, a+n);
	ac = a[0];
	rep(i,n-1) ac = (ac + a[i+1]) / 2;
	printf("%.8f\n", ac);
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
class Combination:
  def __init__(self, n_max, mod=10**9+7):
    self.mod = mod
    self.modinv = self.make_modinv_list(n_max)
    self.fac, self.facinv = self.make_factorial_list(n_max)

  def __call__(self, n, r):
    return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

  def make_factorial_list(self, n):
    # 階乗のリストと階乗のmod逆元のリストを返す O(n)
    # self.make_modinv_list()が先に実行されている必要がある
    fac = [1]
    facinv = [1]
    for i in range(1, n+1):
      fac.append(fac[i-1] * i % self.mod)
      facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
    return fac, facinv

  def make_modinv_list(self, n):
    # 0からnまでのmod逆元のリストを返す O(n)
    modinv = [0] * (n+1)
    modinv[1] = 1
    for i in range(2, n+1):
        modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
    return modinv

N,K = map(int,input().split())
adj = [ [ ]for _ in range(N) ]
comb = Combination(10**5)

def nPr(n,r):
  if n < r: return 0
  return comb(n, r) * comb.fac[r]

for _ in range(N-1):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  adj[a].append(b)
  adj[b].append(a)

def dfs(v, p=-1):
  global ans
  c = 0
  for nei in adj[v]:
    if nei == p: continue
    c += 1
    dfs(nei, v)

  nk = K-1 if p==-1 else K-2
  ans *= nPr(nk, c)
  ans %= 10**9+7

ans = K
dfs(0)
print(ans)

Measured memory_bytes: 122928
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNextInt()){
			int a=sc.nextInt();
			int b=sc.nextInt();
			System.out.println(gcd(a,b)+" "+lcm(a,b));
		}
		sc.close();
	}
	
	static int gcd(long a,long b){	//最大公約数
		if(a<b) return gcd(b,a);	//入れ換えて再実行
		long d=0;
		do{
			d=a%b;
			a=b;
			b=d;
		}while(d!=0);
		return (int)a;
	}

	static int lcm(long a,long b){	//最小公倍数
		return (int)(a*b/gcd(a,b));
	}
}

Measured memory_bytes: 17224
import sys

while 1:
	h, w = map(int, raw_input().split())
	if h == 0 and w == 0:
		break
	else:
		for i in xrange(h):
			if (i%2) == 0:
				for j in xrange(w):
					if (j%2) == 0:
						sys.stdout.write("#")
					else:
						sys.stdout.write(".")
				print ""
			else:
				for j in xrange(w):
					if (j%2) == 0:
						sys.stdout.write(".")
					else:
						sys.stdout.write("#")
				print ""
	print ""

Measured memory_bytes: 6432
#include<bits/stdc++.h>
#include <cstdio>   
#define pb          push_back 
#define endl        "\n"
#define mostrar(x,y) cout<<x<<" "<<y<<endl;
#define f           first
#define s           second
#define mod         1000000007
#define EPS         1e-9
using namespace std;
typedef pair<int,int> ii;
typedef pair<pair<int,int>,int> iii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef long long ll;

vii datos;

/*bool criterio(ii a,ii b){
    if(a.f<b.f) return true;
    if(b.f>a.f) return false;
    return a.s<b.s;
}*/
bool cmp(ii a,ii b){
    if(a.s<b.s) return true;
    if(a.s>b.s) return false;
    return a.f<b.f;
}
 
int main(){
    ofstream out("output.txt");

    int n,a,b;
    cin>>n;

    for(int i = 0; i<n; i++){
        cin>>a>>b;
        datos.pb({a,b});
    }

    sort(datos.begin(),datos.end(),cmp);

    /*for(int i = 0; i<n; i++){
        cout<<datos[i].f<<" "<<datos[i].s<<endl;
    }*/

    bool sePuede = true;
    ll tiempoTotal = 0;
    for(int i = 0; i<n && sePuede; i++){
        //cout<<i<<" "<<datos[i].f<<" "<<datos[i].s<<endl;
        tiempoTotal += datos[i].f;
        if(tiempoTotal>datos[i].s){
            sePuede = false;
            //cout<<i<<endl;
        }
    } 

    if(sePuede){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 2424
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int d; cin>>d;
    string ans = "";
    switch (d)
    {
    case 25:
ans = "Christmas";
        /* code */
        break;
    case 24:
        /* code */
ans = "Christmas Eve";
        break;
    case 23:
        /* code */
ans = "Christmas Eve Eve";
        break;
    case 22:
        /* code */
ans = "Christmas Eve Eve Eve ";
        break;
    default:
        break;
    }
    cout << ans <<endl;

}

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

int main() {
  int64_t n, m;
  std::cin >> n >> m;
  const auto count = static_cast<int64_t>(1) << m;

  std::cout << count * (m * 1900 + (n - m) * 100) << std::endl;
  return 0;
}


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

signed main() {
    int x;
    cin >> x;
    int x500, x5;
    x500 = x / 500 * 1000;
    x5 = (x - x / 500 * 500) /5 * 5;
    cout << x500 + x5 << endl;
}

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

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N; cin >> N;
  rep(i, N) {
    cout << "ACL";
  }
  cout << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


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

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; }

int dp[50][500][500];

int main() {
    int n, ma, mb;
    cin >> n >> ma >> mb;
    vector<int> a(n), b(n), c(n);
    rep(i, n) cin >> a[i] >> b[i] >> c[i];
    vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(500, vector<int>(500, 1e9)));
    dp[0][0][0] = 0;
    rep(i, n) rep(sss, 500) rep(ttt, 500) {
        dp[i + 1][sss][ttt] = min(dp[i + 1][sss][ttt], dp[i][sss][ttt]);
        if (sss + a[i] < 500 && ttt + b[i] < 500) {
            dp[i + 1][sss + a[i]][ttt + b[i]] = min(dp[i + 1][sss + a[i]][ttt + b[i]], dp[i][sss][ttt] + c[i]);
        }
    }
    int ans = 1e9;
    int i = 1;
    while (ma * i < 500 && mb * i < 500) {
        ans = min(ans, dp[n][ma * i][mb * i]);
        i++;
    }
    cout << (ans == 1e9 ? -1 : ans) << endl;
}

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

using namespace std;

main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin >> x;
    vector < int > a = {599, 799, 999, 1199, 1399, 1599, 1799, 1999};
    int ans = 8;
    for (auto key : a) {
        if (x > key) ans--;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,y;
    cin>>x>>y;
    ll ans=0;
    if(x>=0 && y>=0){
      if(y>x){
        ans=y-x;
      }else{
        x*=-1;
        ans++;
        if(y==0){
          ans+=y-x;
        }else if(y>abs(x)){
          ans++;
          x*=-1;
          ans+=y-x;
        }else{
          ans+=abs(x)-y;
          ans++;
        }
      }
    }else if(x>=0 && y<0){
      if(x==0){
        ans+=abs(y)-x+1;
      }else if(x>abs(y)){
        ans++;
        x*=-1;
        ans+=y-x;
      }else{
        ans+=abs(y)-x;
        ans++;
      }
    }else if(x<0 && y>=0){
      if(y==0){
        ans+=y-x;
      }else if(y>abs(x)){
        ans++;
        x*=-1;
        ans+=y-x;
      }else{
        ans+=abs(x)-y;
        ans++;
      }
    }else{
      if(y>x){
        ans=y-x;
      }else{
        ans++;
        x*=-1;
        if(x==0){
          ans+=abs(y)-x+1;
        }else if(x>abs(y)){
          ans++;
          x*=-1;
          ans+=y-x;
        }else{
          ans+=abs(y)-x;
          ans++;
        }
      }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
N = int(input())

evidences = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        evidences[i].append((x-1, y))

result = 0
for i in range(1, 2 ** N):
    consistent = True
    for j in range(N):
        if (i >> j) & 1 == 0:
            continue
        for x, y in evidences[j]:
            if (i >> x) & 1 != y:
                consistent = False
                break
        if not consistent:
            break
    if consistent:
        result = max(result, bin(i)[2:].count('1'))
print(result)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>

using namespace std;

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

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>

using namespace std;

int w,h;
int c[50][50];

typedef struct Point{
    int x;
    int y;
}Point;

bool solve(Point p, int *a){
    
    int res = *a;
    if(c[p.y][p.x] == 1){
        res++;
        c[p.y][p.x] = 0;
        for(int i=-1; i<2; i++){
            for(int j=-1; j<2; j++){
                if(!(i==0 && j==0)){
                    if(0<=p.y+i && p.y+i <h && 0<=p.x+j && p.x+j <w){
                        if(c[p.y+i][p.x+j] == 1){
                        solve(Point{p.x+j,p.y+i}, &res);
                        }
                    }
                }
            }
        }
    }
    
    if(res>0)
    return true;
    
    return false;
}

int main(int argc, const char * argv[]) {
    // insert code here...
    /////////
    //write//
    /////////
    
    while(1){
        cin >> w >> h;
        
        if(w==0 && h==0)break;
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                cin >> c[i][j];
            }
        }
        
        int a = 0;
        int cnt = 0;
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                if(solve(Point{j,i}, &a)){
                    //cout << "x:" << j << ",y:" << i << endl;
                    cnt++;
                }
            }
        }
        
        cout << cnt << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3308
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define INF 1e18
#define vec vector<int>
#define REP(i,a,b) for(i=a;i<b;i++)
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int x;
  cin>>x;
  if(x>=400 && x<=599)
    cout<<"8\n";
  else if(x>=600 && x<=799)
    cout<<"7\n";
  else if(x>=800 && x<=999)
    cout<<"6\n";
  else if(x>=1000 && x<=1199)
    cout<<"5\n";
 else if(x>=1200 && x<=1399)
    cout<<"4\n";
    else if(x>=1400 && x<=1599)
    cout<<"3\n";
    else if(x>=1600 && x<=1799)
    cout<<"2\n";
    else if(x>=1800 && x<=1999)
    cout<<"1\n";
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstring>
#include <queue>

using namespace std;

typedef pair<int,pair<int,int> > pp;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
int level[2][250001];
int room[500][500];
bool visited[500][500];

int main(){
    int r;
    while(cin>>r,r){
        int w,h,ex,ey;
        int e[2];
        for(int i=0;i<2;++i){
            cin>>w>>h>>ex>>ey;
            for(int j=0;j<h;++j){
                for(int k=0;k<w;++k){
                    cin>>room[j][k];
                }
            }
            memset(visited,0,sizeof(visited));
            visited[--ey][--ex]=1;
            level[i][0]=0;
            int mlevel=0,index=1;
            priority_queue<pp,vector<pp>,greater<pp> > pq;
            pq.push(make_pair(room[ey][ex],make_pair(ex,ey)));
            while(!pq.empty()){
                pp cur=pq.top();pq.pop();
                mlevel=max(mlevel,cur.first);
                level[i][index++]=mlevel;
                for(int j=0;j<4;++j){
                    int cx=cur.second.first+dx[j];
                    int cy=cur.second.second+dy[j];
                    if(cx>=0&&cx<w&&cy>=0&&cy<h&&visited[cy][cx]==0){
                        visited[cy][cx]=1;
                        pq.push(make_pair(room[cy][cx],make_pair(cx,cy)));
                    }
                }
            }
            e[i]=index-1;
        }
        int ans = 1000000000;
        for(int i=0;i<=r;++i){
            if(e[0]<r-i||e[1]<i) continue;
            ans=min(ans,level[1][i]+level[0][r-i]);
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 6640
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate など
#include <stdexcept>
#include <cassert> // assert
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

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

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

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

typedef pair<ll, ll> coord;
constexpr inline ll MOD = 1000000007;

// constexpr int MAX_N = 200'000 + 9;
int n;
map<coord, int> dir;
ll ans = 1;

ll gcd(ll a, ll b)
{
    a = abs(a); b = abs(b);
    while (b > 0)
    {
        ll tmp = a;
        a = b;
        b = tmp % b;
    }
    return a;
}

ll pw(ll b, int a)
{
    ll res = 1;
    while (a > 0)
    {
        if (a & 1)
        {
            res = res * b % MOD;
            a--;
        }
        else
        {
            b = b * b % MOD;
            a /= 2;
        }
    }
    return res;
}

int main()
{
    // 入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n;
    REP(i, n)
    {
        ll a,b;
        cin >> a >> b;
        ll g = gcd(a,b);
        a = (g == 0) ? 0 : (a / g);
        b = (g == 0) ? 0 : (b / g);
        if (! ((a >= 0 && b >= 0) || (a < 0 && b > 0)))
        {
            a = -a;
            b = -b;
        }
        dir[coord(a, b)]++;
    }

    for (auto tup : dir)
    {
        ll a = tup.first.first;
        ll b = tup.first.second;
        int cnt = tup.second;
        ll c = (a > 0) ? (-b) : b;
        ll d = abs(a);
        if ((a == 0 && b == 0) || (a <= 0 && (dir.count(coord(c, d)) > 0)))
        {
            continue;
        }
        auto it = dir.find(coord(c, d));
        int cnt2 = (it == dir.end()) ? 0 : it->second;
        ans = ans * (pw(2, cnt) + pw(2, cnt2) - 1) % MOD;
    }
    ans = (ans + dir[coord(0, 0)] - 1 + MOD) % MOD;

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 16004
import std.stdio, std.string, std.conv, std.array, std.algorithm, std.range, std.typecons, std.numeric, std.math;

void main() {
    ulong n = readln.strip.to!ulong;
    auto as = readln.strip.split.to!(ulong[]).array;
    auto bs = readln.strip.split.to!(ulong[]).array;
    ulong ans = 0;

    foreach (i; 0..n) {
        if (bs[i] >= as[i]) {
            ans += as[i];
            bs[i] -= as[i];

            if (bs[i] >= as[i+1]) {
                ans += as[i+1];
                as[i+1] = 0;
            }
            else {
                ans += bs[i];
                as[i+1] -= bs[i];
            }
        } else {
            ans += bs[i];
        }
    }

    writeln(ans);
}


Measured memory_bytes: 11948
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int,int>;
using ll = long long;
using namespace std;
char in[120];
pair<pair<string,int>,int> p[110];

int main(){
    ll n, k;
    cin >> n >> k;
    ll mini;
    mini = min(n%k, k-(n%k));
    cout << mini;
    return 0;
}

Measured memory_bytes: 3596
require 'pp'

n = gets.to_i
a_n = gets.split.map(&:to_i)

i = 1
sum = 0
while i < n
    if a_n[i-1] > a_n[i]
       diff = a_n[i-1] - a_n[i]
       sum += diff
       a_n[i] += diff
    end
    i += 1
end

puts sum


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

#define ll long long int

using namespace std;

int main() {
    ll n;
    cin >> n;
    vector<ll> A(n);
    for (auto & a : A) cin >> a;
    ll sum = 0;
    for (auto a : A) sum = sum ^ a;

    for (auto a : A) {
        cout << (sum ^ a) << " ";
    }
    cout << endl;
}


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

string S;
string S1 = "";
string S2 = "";

int main(){
    cin >> S;
    int length = S.length();
    // 2種類生成
    for (int i = 0; i < length; i++){
        if((i % 2) == 0){
            S1 += "0";
            S2 += "1";
        }else{
            S1 += "1";
            S2 += "0";
        }
    }
    // 比べる
    int n1 = 0;
    int n2 = 0;
    for (int i = 0;i < length; i++){
        if (S[i] != S1[i]){
            n1 += 1;
        }
        if (S[i] != S2[i]){
            n2 += 1;
        }
    }
    // cout << n1 << endl;
    // cout << n2 << endl;
    cout << min(n1, n2) << endl;
    return 0;
}

Measured memory_bytes: 768
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

from collections import deque

def bfs(sy, sx, gy, gx):
    INF = 10 ** 5
    d = [[INF] * W for _ in range(H)]
    dy = [0, 1]
    dx = [1, 0]
    que = deque()
    que.append((sy, sx))
    d[sy][sx] = 0
    if grid[sy][sx] == '#':
        d[sy][sx] = 1
    while que:
        y, x = que.popleft()
        if y == gy and x == gx:
            break
        for i in range(2):
            ny = y + dy[i]
            nx = x + dx[i]
            if ny >= H or nx >= W:
                continue
            if grid[y][x] == grid[ny][nx]:
                if d[ny][nx] > d[y][x]:
                    d[ny][nx] = d[y][x]
                    que.append((ny, nx))
            elif grid[y][x] == '#' and grid[ny][nx] == '.':
                if d[ny][nx] > d[y][x]:
                    d[ny][nx] = d[y][x]
                    que.append((ny, nx))
            else:
                if d[ny][nx] > d[y][x] + 1:
                    d[ny][nx] = d[y][x] + 1
                    que.append((ny, nx))
    return d[gy][gx]

H, W = lr()
grid = [list(sr()) for _ in range(H)]
answer = bfs(0, 0, H-1, W-1)
print(answer)


Measured memory_bytes: 42352
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val m = sc.nextInt()
    println(problem069a(n, m))
}

fun problem069a(n: Int, m: Int): Int {
    return (n - 1) * (m - 1)
}

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


int main() {
	int n;
	int F[10000];
	cin >> n;

	F[0] = F[1] = 1;
	
	for (int i = 2; i <= n; i++)
		F[i] = F[i - 1] + F[i - 2];

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

Measured memory_bytes: 3112
d, g = gets.chomp.split.map(&:to_i)
p = []
c = []

d.times do |i|
  p[i], c[i] = gets.chomp.split.map(&:to_i)
end

ans = 10**10

[0, 1].repeated_permutation(d) do |bits|
  count = 0
  point = 0
  max_i = -1
  
  d.times do |i|
    if bits[i] == 1
      count += p[i]
      point += 100 * (i+1) * p[i] + c[i]

      if point >= g
        ans = [ans, count].min
      end
    else
      max_i = [max_i,i].max
    end
  end

  gap = g - point
  next if gap <= 0

  rest_cnt = (gap.to_f / ( 100 * (max_i + 1) )).ceil
  next if rest_cnt > p[max_i] - 1

  ans = [ans, count + rest_cnt].min
end

p ans


Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
  int N, T; cin >> N >> T;
  vector<int> c(N);
  vector<int> t(N);
  for(int i = 0; i < N; i++){
    cin >> c[i] >> t[i];
  }

  vector<int> a;
  for(int i = 0; i < N; ++i){
    if(t[i] <= T){
      a.push_back(c[i]);
    }
  }
  if(a.size() == 0){
    cout << "TLE" << endl;
  }
  else {
    cout << *min_element(a.begin(), a.end()) << endl;
  }
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

fn main() {
    input! {
        n: usize,
        a: [u64; n]
    }

    let cnt = count(&a);
    let mut ret = 0;
    for (&key, &value) in cnt.iter() {
        if value as u64 >= key {
            ret += value as u64 - key;
        } else {
            ret += value as u64;
        }
    }
    println!("{}", ret);
}

#[allow(dead_code)]
fn count<T: Eq + std::hash::Hash + Clone>(slice: &[T]) -> std::collections::HashMap<T, usize> {
    let mut hmap = std::collections::HashMap::new();
    for item in slice {
        *hmap.entry(item.clone()).or_insert(0) += 1;
    }
    hmap
}

Measured memory_bytes: 12540
#include <stdio.h>

int main(void){

    int A = 0;
    int B = 0;

    scanf("%d", &A);
    scanf("%d", &B);

    if (A != 1 && B != 1){
        printf("1\n");
    } else if (A != 2 && B != 2){
        printf("2\n");
    } else {
        printf("3\n");
    }

    return 0;
}

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

using namespace std;

typedef long long ll;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"
const int N = 3e5;
int a[1 + N];
int ans[1 + N];
int used[1 + N];
int main() {
    ios::sync_with_stdio (false);
    cin.tie (0); cout.tie (0);
    int n; ll k;
    cin >> n >> k; k++;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    int cur = 1;
    int nr = 0;
    while (used[cur] == 0) {
        used[cur] = ++nr;
        ans[nr] = cur;
        cur = a[cur];
    }
    int period = nr - used[cur] + 1;
    if (k <= nr) {
        cout << ans[k] << "\n";
    }
    else {
        cout << ans[used[cur] + (k - used[cur]) % period] << "\n";
    }
    return 0;
}


Measured memory_bytes: 5996
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

  int result = 0;
  for (int i = 1; i <= t; i++) {
    if (i % a == 0) {
      result += b;
    }
  }

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        ww: i64,
        wv: [(i64, usize); n],
    }
    const V: usize = 1 << 17;
    const INF: i64 = 1 << 40;
    let mut dp = vec![vec![INF; V + 1]; 2];
    dp[0][0] = 0;
    for i in 0 .. n {
        let (w, v) = wv[i];
        for j in 0 .. V + 1 {
            dp[1][j] = dp[0][j];
        }
        for j in 0 .. V - v + 1 {
            dp[1][j + v] = min(dp[1][j + v], dp[0][j] + w);
        }
        dp.swap(0, 1);
    }
    let mut ma = 0;
    for i in 0 .. V + 1 {
        if dp[0][i] <= ww { ma = i; }
    }
    puts!("{}\n", ma);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 10492
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n;
    cin >> n;
    vll a(n);
    rep(i, n) {
        cin >> a[i];
    }
    rep(i, n) if (a[i] == 0) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    rep(i, n) {
        if (ans > (ll)1e18 / a[i]) {
            cout << -1 << endl;
            return 0;
        }
        ans *= a[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3936
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std;
int n, p, ans;
template <typename T>inline void in(T &x){
	T ch = getchar(), f = 1; x = 0;
	while(!isdigit(ch)) f = ch == '-' ? -1 : f, ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	x *= f;
}
signed main(){
	in(n);
	for(int i = 1; i <= n; i++){
		int x;
		in(x);
		if(x & 1) {
			ans = 1;
			break;
		}//continue;
	//	ans++;
	}
	if(ans )
		cout<<"first";
	else
		cout<<"second";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

LL mod = 1000000007;

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

  LL X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  vector<LL> A(X);
  vector<LL> B(Y);
  vector<LL> C(Z);

  REP(i,X){
    cin >> A[i];
  }
  REP(i,Y){
    cin >> B[i];
  }
  REP(i,Z){
    cin >> C[i];
  }

  vector<LL> v;

  REP(i,X){
    REP(j,Y){
      v.push_back(A[i] + B[j]);
    }
  }

  BACKSORT(v);

  vector<LL> vv;

  REP(i,Z){
    REP(j,min(3000LL,(LL)v.size())){
      vv.push_back(C[i] + v[j]);
    }
  }

  BACKSORT(vv);

  REP(i,K){
    cout << vv[i] << endl;
  }
}


Measured memory_bytes: 43368