akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b!=0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

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

bool prime_number(int n){
   if(n==0||n==1) return false;
   vector<bool> a(n+1);
   fill(ALL(a),true);
   FOR(i,2,n/2+1){
      if(!a[i]) continue;
      for(int j=2;i*j<=n;j++){
         a[i*j]=false;
      }
   }
   return a[n];
}

int main(){
   double a,b;
   cin >> a >> b;
   printf("%.6lf\n",a*b/3.305785);
}

Measured memory_bytes: 1228
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll N, M;
    cin >> N >> M;
    ll sum = 0;
    rep(i, M){
        ll a;
        cin >> a;
        sum += a;
    }
    if(sum <= N){
        cout << N-sum << endl;
    }else{
        cout << -1 << endl;
    }
}

Measured memory_bytes: 3640
#include<stdio.h>
#include<math.h>
#define PI 3.1415926535898
#define ANGLE (PI/180.0)

int main(void){
	int step,dir;
	double x=0.0,y=0.0,angle=0.0;

	while(1){
		scanf("%d,%d",&step,&dir);
		if(step==0 && dir==0)break;

		x+=(double)(step)*sin(angle*ANGLE);
		y+=(double)(step)*cos(angle*ANGLE);
		angle+=(double)dir;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int N,W;
int main() {
	ll n;
	cin >> n;
	ll a[n+1];
	ll b[n];
	rep(i,n+1) cin >> a[i];
	rep(i,n) cin >> b[i];
	ll ans = 0;
	rep(i,n){
		if(a[i]>=b[i]){
			ans += b[i];
			continue;
		}else{
			ans += a[i];
			b[i]-=a[i];
		}
		if(b[i]<=a[i+1]){
			ans += b[i];
			a[i+1]-=b[i];
		}else{
			ans += a[i+1];
			a[i+1] = 0;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
// 1 3 4 5 2
// 1 3 4 2 5  -1
// 1 2 4 3 5  -1
// 1 2 3 4 5  -2
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
// 1-indexedで座標圧縮してmax(奇数座標にある偶数の数,偶数座標にある奇数の数)
// 奇数座標にある偶数の数 == 偶数座標にある奇数の数じゃん.........
// 座標圧縮使う問題初めて解いた
// デバッグ用に要素数減らした後戻してなかった......................................
int main() {
    int n; cin >> n;
    int a[100000];
    rep(i,n) cin >> a[i];

    int sorta[100000];
    rep(i,n) sorta[i] = a[i];
    sort(sorta, sorta+n);
    map<int,int> zip;
    rep(i,n) zip[sorta[i]] = i+1;
    rep(i,n) a[i] = zip[a[i]];
    int ans = 0;
    rep(i,n) {
        if (a[i]%2 != (i+1)%2) ans ++;
    }
    cout << ans/2 << endl;
}

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

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

  vector<int> h(n);

  for (int i = 0; i < n; i++) { cin >> h.at(i); }

  int ans = 0;

  for (int i = 0; i < n; i++) {
    if (h.at(i) >= k) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<stdio.h>

int main(){
  int n,q,i,key,j,k=0,left,reight,mid;
  scanf("%d",&n);
  int S[n];
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  int T[q];
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }
  for(j=0;j<q;j++){
    left=0;
    reight=n;
    key=T[j];
    while(left<reight){
      mid=(left+reight)/2;
      if(S[mid]==key){
        k++;
        break;
      }
      else if(key<S[mid]){
        reight = mid;
      }
      else{
        left = mid +1;
      }
    }
  }
  printf("%d\n",k);
  return 0;
}



Measured memory_bytes: 2380
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
tmp=int(math.sqrt(n*2))
if tmp*(tmp+1)!=n*2:
    print("No")
    exit()

lst=[]
cnt=1

for i in range(tmp+1):
    lsttmp=[len(lst)+1]
    for j in range(len(lst)):
        lsttmp.append(lst[j][lst[j][0]])
        lst[j][0]+=1
    # print(lst)
    # print(lsttmp)
    while len(lsttmp)<tmp+1:
        lsttmp.append(cnt)
        cnt+=1
    lst.append(lsttmp)
# print(lst)
print("Yes")
print(tmp+1)
for i in range(tmp+1):
    print(*([tmp]+lst[i][1:]))

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

struct Observatory {
    unsigned int height;
    bool good;
};

int main () {
    int N, M;
    std::vector<Observatory> obs_vec;
    std::cin >> N >> M;
    for (int i=0; i<N; i++) {
        unsigned int height;
        std::cin >> height;
        Observatory obs = {height, true};
        obs_vec.push_back(obs);
    }
    for (int i=0; i<M; i++) {
        int A, B;
        std::cin >> A >> B;
        if (obs_vec[A-1].height == obs_vec[B-1].height) {
            obs_vec[A-1].good = false;
            obs_vec[B-1].good = false;
        } else if (obs_vec[A-1].height > obs_vec[B-1].height) {
            obs_vec[B-1].good = false;
        } else {
            obs_vec[A-1].good = false;
        }
    }
    auto good_num = std::count_if(obs_vec.begin(), obs_vec.end(), [](Observatory o){ return o.good; });
    std::cout << good_num << std::endl;
}

Measured memory_bytes: 4320
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <(n); (i)++) 
using ll = long long;
int main() {
  ll n,m;
  cin>>n>>m;
  ll h[n],c[n];rep(i,n){
      cin>>h[i];
      c[i]=0;
  }
  ll a[m],b[m];
  rep(i,m){
      cin>>a[i]>>b[i];
      a[i]--;b[i]--;
  } 
  ll sum=0;
  rep(i,m){
      if(h[a[i]]>=h[b[i]])c[b[i]]++;
      if(h[a[i]]<=h[b[i]])c[a[i]]++;
  }
  /*rep(i,m){
      cout<<c[i]<<endl;
  }*/
  rep(i,n){
      if(c[i]==0)sum++;
  }
    cout<<sum<<endl;
}

Measured memory_bytes: 6752
#include <cstdio>
#include <queue>
typedef long long ll;
inline int rd(){
    int x=0,p=1;
    char a=getchar();
    while((a<48||a>57)&&a!='-')a=getchar();
    if(a=='-')p=-p,a=getchar();
    while(a>47&&a<58)x=(x<<1)+(x<<3)+(a&15),a=getchar();
    return x*p;
}
inline int max(int x,int y){return x>y?x:y;}
const int N=102;
int n,m,ans;
int a[22][22];
int dis[22][22];
int dx[]={-1,0,0,1,-1};
int dy[]={-1,1,-1,0,0};
struct node{
	int x,y;
	node(int X=0,int Y=0){x=X,y=Y;}
};
inline int bfs(int x,int y){
	std::queue<node> q;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			dis[i][j]=-1;
	dis[x][y]=0;
	q.push(node(x,y));
	while(!q.empty()){
		node u=q.front();q.pop();
		int px=u.x,py=u.y,tx,ty;
		for(int i=1;i<=4;i++){
			tx=px+dx[i],ty=py+dy[i];
			if(tx<1||tx>n||ty<1||ty>m||a[tx][ty]||dis[tx][ty]!=-1)continue;
			dis[tx][ty]=dis[px][py]+1;
			q.push(node(tx,ty));
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++){
			if(dis[i][j]==-1)continue;
			if(dis[i][j]>ans)ans=dis[i][j];
		}
	return ans;
}
int main(){
	n=rd(),m=rd();
	char s[22];
	for(int i=1;i<=n;i++){
		scanf("%s",s+1);
		for(int j=1;j<=m;j++)
			if(s[j]=='#')a[i][j]=1;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(!a[i][j])ans=max(ans,bfs(i,j));
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
base_data = list(map(int,input().split()))
line = base_data[0]
last_num = base_data[2]

elements = 0
result = 0

multi_data = list(map(int,input().split()))

for i in range(line):
  elements = 0
  num = base_data[1]
  data = list(map(int,input().split()))
  
  while num > 0:
    elements += data[num-1] * multi_data[num-1]
    num -= 1

  if elements + last_num > 0:
    result += 1
    
print(result)

Measured memory_bytes: 3064
#define LOCAL

#undef _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define LLINF 1e18
#define INF (int)1e9+1

// Copied from Gennady-Korotkevich's template

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
	return '"' + s + '"';
}

string to_string(const char* s) {
	return to_string((string)s);
}

string to_string(bool b) {
	return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
	bool first = true;
	string res = "{";
	for (int i = 0; i < static_cast<int>(v.size()); i++) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(v[i]);
	}
	res += "}\n";
	return res;
}

template <size_t N>
string to_string(bitset<N> v) {
	string res = "";
	for (size_t i = 0; i < N; i++) {
		res += static_cast<char>('0' + v[i]);
	}
	return res;
}

template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto& x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}\n";
	return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

template <typename A, typename B, typename C, typename D, typename E>
string to_string(tuple<A, B, C, D, E> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + "," + to_string(get<4>(p)) + ")";
}

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 << "\n[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// End of Gennady-Korotkevich's template 

using llong = long long;
using PII = pair<int, int>;

const llong MOD = 998244353LL;

int main() {
	IOS;
	int n, k; cin >> n >> k;
	vector<double> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] = (a[i] + 1) / 2;
	}
	double sum = 0;
	double mx = -1;
	for (int i = 0; i < k; i++) {
		sum += a[i];
	}
	mx = sum;
	for (int i = k; i < n; i++) {
		sum += a[i];
		sum -= a[i - k];
		mx = max(mx, sum);
	}
	cout << fixed << setprecision(10);
	cout << mx;
}

Measured memory_bytes: 4748
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def main():
  n,m = input_list()
  a = input_list()
  div = 1/(4*m)
  sum_a = sum(a)
  border = math.ceil(sum_a * div)
  popular = []
  for v in a:
    if v < border:
      continue
    popular.append(v)
    
  if len(popular) >= m:
    print('Yes')
  else:
    print('No')
    
  
import math
import fractions
import collections
import itertools
from functools import reduce
main()

Measured memory_bytes: 66156
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cmath>

using namespace std;

int main() {
    size_t n;
    cin >> n;
    cout << n * n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//do {
//    print(v);
//  } while (std::next_permutation(v.begin(), v.end()));


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

	int A,B,C;
	cin >> A>>B>>C;
	cout << min(C, B / A) << endl;
	return 0;
}



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

int n;
ll a[100010];
ll b[100010];

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%lld%lld", a + i, b + i);
	ll c = 0, ans = 0;
	for(int i = n - 1; i >= 0; i--){
		a[i] += c;
		a[i] %= b[i];
		ll t = (b[i] - a[i]) % b[i];
		ans += t;
		c += t;
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 1920
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
 
int n, pos;
vector<int>pre, in, post;
 
void rec(int l, int r) {
    if (l >= r)return;
    int root = pre[pos++];
    int m = distance(in.begin(), find(in.begin(), in.end(), root));
    rec(l, m);
    rec(m + 1, r);
    post.push_back(root);
}
 
void solve() {
    pos = 0;
    rec(0, pre.size());
    for(int i = 0; i < n; i++) {
        if (i)cout << " ";
        cout << post[i];
    }
    cout << endl;
}
 
int main() {
    int k;
    cin >> n;
     
    for (int i = 0; i < n; i++) {
        cin >> k;
        pre.push_back(k);
    }
 
    for (int i = 0; i < n; i++) {
        cin >> k;
        in.push_back(k);
    }
 
    solve();
 
    return 0;
}


Measured memory_bytes: 3168
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main extends EuclideanSpace {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static int[] requireConvexHull(final Point[] ps) {
		int n = ps.length;
		if (n < 3) return null;
		Integer[] idx = new Integer[n];
		for (int i=0; i<n; i++) idx[i] = i;
		Arrays.sort(idx,new Comparator<Integer>(){
			public int compare(Integer a, Integer b) {
				return ps[a].compareTo(ps[b]);
			}
		});

		int[] res = new int[n*2];
		int ptr = 0;
		//lower hull
		for (int i=0; i<n; i++) {
			if (ptr > 0
				&& epsEquals(ps[res[ptr-1]].getX(), ps[idx[i]].getX())
				&& epsEquals(ps[res[ptr-1]].getY(), ps[idx[i]].getY())) continue;
			while (ptr > 1
				&& -Line2D.relativeCCW(ps[res[ptr-2]].getX(), ps[res[ptr-2]].getY(),
					ps[idx[i]].getX(), ps[idx[i]].getY(),
					ps[res[ptr-1]].getX(), ps[res[ptr-1]].getY()) > 0) ptr--;
			res[ptr++] = idx[i];
		}

		int end = ptr;
		//upper hull
		for (int i=n-2; i>=0; i--) {
			if (epsEquals(ps[res[ptr-1]].getX(), ps[idx[i]].getX())
				&& epsEquals(ps[res[ptr-1]].getY(), ps[idx[i]].getY())) continue;
			while (ptr > end
				&& -Line2D.relativeCCW(ps[res[ptr-2]].getX(), ps[res[ptr-2]].getY(),
					ps[idx[i]].getX(), ps[idx[i]].getY(),
					ps[res[ptr-1]].getX(), ps[res[ptr-1]].getY()) > 0) ptr--;
			res[ptr++] = idx[i];
		}

		return Arrays.copyOf(res,ptr-1);
	}

	static boolean solve() {
		int n = in.nextInt();
		if (n == 0) return false;

		Point[] ps = new Point[n];
		for (int i=0; i<n; i++) {
			String[] s = in.next().split(",");
			ps[i] = new Point(Double.parseDouble(s[0]), Double.parseDouble(s[1]));
		}

		int[] res = requireConvexHull(ps);
		out.println(n-res.length);

		return true;
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		while(solve());
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

class EuclideanSpace{
	public static final double EPS = 1E-10;
	public static boolean epsEquals(double a, double b) { return Math.abs(a-b) < EPS; };
}


class Point extends EuclideanSpace implements Comparable, Cloneable {

	private double x, y;
	public Point(double x, double y) {
		this.x = x; this.y = y;
	}

	public double getX() {
		return this.x;
	}
	public double getY() {
		return this.y;
	}

	public void set(double x, double y) {
		this.x = x; this.y = y;
	}

	public int compareTo(Object another) {
		Point p = (Point)another;
		if (!epsEquals(this.x,p.x)) return this.x < p.x ? -1 : 1;
		if (!epsEquals(this.y,p.y)) return this.y < p.y ? -1 : 1;
		return 0;
	}

	public boolean equals(Point p) {
		return epsEquals(this.x,p.x) && epsEquals(this.y,p.y);
	}

	public Point clone() {
		return new Point(this.x, this.y);
	}

	public String toString() {
		return "("+x+","+y+")";
	}
}

Measured memory_bytes: 26516
#include<iostream>

using namespace std;

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

long long dp[4444][4444];
int cut[4444][4444];

int main() {
  long long n, w[4444], sum[4444];
  cin >> n;
  rep (i, n) cin >> w[i];
  sum[0] = w[0];
  rep (i, n - 1) sum[i + 1] = sum[i] + w[i + 1];
  rep (i, n) dp[i][i] = 0;
  rep (i, n - 1) {
    cut[i][i + 1] = i;
    dp[i][i + 1] = w[i] + w[i + 1];
  }
  rep (i, n) if (i > 1) rep (j, n - i) {
    long long res = 1234567890123456789LL;
    int a = j, b = j + i;
    for (int k = cut[a][b - 1]; k <= cut[a + 1][b]; ++k) {
      long long r = dp[a][k] + dp[k + 1][b];
      if (r < res) {
	res = r;
	cut[a][b] = k;
      }
      dp[a][b] = sum[b] - (a >= 0 ? sum[a - 1] : 0) + res;
    }
  }
  cout << dp[0][n - 1] << endl;
  return 0;
}

Measured memory_bytes: 212164
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999999
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> LV;

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

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

int main() {
	llong N;
    cin >> N;

    vector<pair<int,int>> pairs(N);
    llong a,b;
    REP(i,N){
        cin >> a >> b;
        pairs[i]=make_pair(a,b);
    }

    sort(pairs.begin(),pairs.end(),compare_by_b);
    
    llong now=0;
    REP(i,N){
        now+=pairs[i].first;
        if(now>pairs[i].second){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


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

int P [10]={0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,1 ,2};
int Q [10]={1 ,1 ,1 ,2 ,2 ,3 ,2 ,2 ,3 ,3};
int R [10]={2 ,3 ,4 ,3 ,4 ,4 ,3 ,4 ,4 ,4};

int main()
{
    int n;
    char name[] = {'M','A','R','C','H'};
    long long cnt[5]={};

    cin >> n;
    for(int i = 0;i < n;i++){
        string s;
        cin >> s;
        for(int j = 0;j < 5;j++){
            if(s[0] == name[j]){
                cnt[j]++;
            }
        }
    }
    /*int check = 0;
    for(int i = 0;i < 5;i++){
        if(!cnt[i]) check++;
    }*/
    
    long long ans = 0;
    //組み合わせ数iは高々5C3通りしかない
    for(int i = 0;i < 10;i++){
        ans += cnt[P[i]]*cnt[Q[i]]*cnt[R[i]];
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> black(n,0);
    if(s[0] == '#') black[0] = 1;
    for(int i = 1; i < n; i++){
        black[i] = black[i-1];
        if(s[i] == '#') black[i]++;
    }
    int ans = n - black[n-1];
    for(int i = 0; i < n; i++){
        int temp = black[i] + ((n-1-i) - (black[n-1] - black[i]));
        ans = min(ans, temp);
    }
    cout << ans << endl;
}

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

int main() {
  long long n,d;
  cin>>n>>d;
  int kotae=0;
  for(int i=0;i<n;i++){
    long long x,y;
    cin>>x>>y;
    if(x*x+y*y<=d*d)kotae++;
  }
  cout<<kotae<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    string s;cin >> s;
    if(s[0]=='7' or s[1]=='7' or s[2]=='7')cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3640
from sys import stdin

S = stdin.readline().rstrip().split()
# A,B = [int(x) for x in stdin.readline().rstrip().split()]
# U = stdin.readline().rstrip().split()
#print(S)
if "AAA"==S[0]:
    print("No")
elif "BBB"==S[0]:
  	print("No")
else :
    print("Yes")

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

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < 3; i++) {
		if (s.at(i) == s.at(i + 1)) {
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;
}

Measured memory_bytes: 256
def cmb(n, r, p):
  if (r < 0) or (n < r):
    return 0
  r = min(r, n - r)
  return fac[n] * finv[r] * finv[n-r] % p

N , M , K = map(int,input().split())
MOD = 998244353

fac = [-1]*(N+1); fac[0] = 1; fac[1] = 1
finv = [-1]*(N+1); finv[0] = 1; finv[1] = 1
inv = [-1]*(N+1); inv[0] = 0; inv[1] = 1
for i in range(2,N+1):
  fac[i] = fac[i-1]*i%MOD
  inv[i] = MOD - inv[MOD%i]*(MOD//i)%MOD
  finv[i] = finv[i-1]*inv[i]%MOD

ans = 0
for t in range(K+1):
    temp = M*pow(M-1,N-t-1,MOD)
    temp = temp*cmb(N-1,t,MOD)
    ans = (ans+temp)%MOD
print(ans)

Measured memory_bytes: 77692
import fractions as f
n,m=map(int,input().split())
s=list(input())
t=list(input())
ans=0
N=n//f.gcd(n,m)
M=m//f.gcd(n,m)
for i in range(f.gcd(n,m)):
    if s[i*N]!=t[i*M]:
        ans=-1
        break
if ans!=-1:
    print(n*m//f.gcd(n,m))
else:
    print(-1)
#print(cnt)



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

/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

using namespace std;

typedef long long ll;

const int NM_MAX = 3002;

int n, m, k;

ll ma[NM_MAX][NM_MAX];

ll dp[NM_MAX][NM_MAX][4];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m >> k;
    for(int i = 1; i <= k; i++)
    {
        int a, b, v;
        cin >> a >> b >> v;
        ma[a][b] = v;
    }
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            for(int c = 0; c < 4; c++)
            {
                ll up = max({dp[i - 1][j][0], dp[i - 1][j][1], dp[i - 1][j][2], dp[i - 1][j][3]});
                dp[i][j][c] = max(dp[i][j - 1][c], up);
                if(c > 0)
                    dp[i][j][c] = max(dp[i][j][c], max(dp[i][j - 1][c - 1], up) + ma[i][j]);
            }
    cout << max({dp[n][m][0], dp[n][m][1], dp[n][m][2], dp[n][m][3]});
    return 0;
}



Measured memory_bytes: 355388
#include <bits/stdc++.h>
#define IOS   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mp    make_pair
#define pb    push_back
#define F     first
#define pi 	  3.14159265358979323846
#define S     second
#define ll    long long
#define ld    long double
#define sz(s) (ll)s.size() 
#define vl    vector < ll >
#define pll   pair < ll, ll >
#define ml    map < ll, ll >
#define mod   1000000007
#define qe	  998244353
#define MAXN  50005 
#define mx    100005
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define inv(i,a,b)  for(i=a;i>=b;i--)
#define all(a)  (a).begin(),(a).end()
using namespace std;
int main(){
  int t,d,s;
  cin>>d>>t>>s;
  if(d<=t*s)cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int d=scn.nextInt();
		int [][]arr=new int[n][d];
		for(int i=0;i<n;i++) {
			for(int j=0;j<d;j++) {
				arr[i][j]=scn.nextInt();
			}
		}
		int count=0;
		for(int i=0;i<n;i++) {
			for(int k=i+1;k<n;k++) {
				long x=0;
				for(int j=0;j<d;j++) {
					x+=Math.pow(arr[k][j]-arr[i][j],2);
				}
				long y=(long)Math.sqrt(x);
				if(y*y==x) {
					count++;
				}
			}
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 23764
import math

n = int(input())
li = []
for i in range(n):
    li.append(list(map(int,input().split())))

ans = 0

for i in range(n):
    for j in range(n):
        length = math.sqrt((li[i][0] - li[j][0]) ** 2 + (li[i][1] - li[j][1]) ** 2)
        ans += length

ans = (math.factorial(n-1) * ans) / math.factorial(n)
print(ans)

Measured memory_bytes: 3064
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string a;
        if (n < 1200) a = "ABC";
        else if (n < 2800) a = "ARC";
        else a = "AGC";
        Console.WriteLine(a);
    }
}


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

int main() {

    int r, g, b;
    cin >> r >> g >> b;

    if ((r*100+g*10+b)%4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e5+1;
vector<int> isprime(N1,1);
set<int>prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.insert(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.insert(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};
void solve(){
  int n,c,s,t,cha;
  cin>>n>>c;
  vector<int> a(100005,0);
  rep(i,0,n){
    cin>>s>>t>>cha;
    a[s-1]++;
    a[t]--;
  }
  int mx=0;
  rep(i,0,100005){if(i!=0) a[i]=a[i-1]+a[i]; mx=max(mx,a[i]);}
  cout<<min(mx,c)<<endl;
}

int main(){
    optimizeIO();

    {solve();}
}


Measured memory_bytes: 3988
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);

	int D;
	cin >> D;

	vector<int> c(26);

	REP(i, 26)
	{
		cin >> c[i];
	}

	vector<vector<int>> s(D, vector<int>(26));

	REP(d, D)
	{
		REP(j, 26)
		{
			cin >> s[d][j];
		}
	}


	vector<int> last(26, 0);
	int sat = 0;

	REP(d, D)
	{
		int t = 0;
		REP(i, 26)
		{
			if (s[d][t] < s[d][i])t = i;
		}
		last[t] = d + 1;


		sat += s[d][t];
		REP(i, 26)
		{
			sat -= c[i] * (d + 1 - last[i]);
		}
		cout << t + 1 << endl;
	}
	return 0;
}

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

int main(){
  map<char, char> m;
  string a,b;
  cin >> a;
  cin >> b;
  
  bool flg_a = true;
  for(int i = 0; i < a.size(); i++){
    char c = a[i];
    if(m.count(c) == 0){
      m[c] = b[i];
    } else { 
      if(m[c] == b[i]){
        continue;
      } else {
        flg_a = false;
        break;
      }
    }
  }

  map<char, char> mb;

  bool flg_b = true;
  string tmp;
  tmp = a;
  a = b;
  b = tmp;
  for(int i = 0; i < a.size(); i++){
    char c = a[i];
    if(mb.count(c) == 0){
      mb[c] = b[i];
    } else { 
      if(mb[c] == b[i]){
        continue;
      } else {
        flg_b = false;
        break;
      }
    }
  }

  
  if(flg_a && flg_b){
    cout << "Yes" << endl;
  } else { 
    cout << "No" << endl;
  }
}


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

int main()
{
    long long n, ans=1, f=0;
    cin>>n;
    long long a[n];
    for(long long i=0;i<n;++i)
    {
        cin>>a[i];
        if(a[i]==0)
        f=1;
    }
    if(f)
    {
        cout<<0<<endl;
        return 0;
    }
    for(long long i=0;i<n;++i)
    {
        if(1000000000000000000/ans < a[i])
        {
            cout<<-1<<endl;
            return 0;
        }
        ans*=a[i];
    }
    cout<<ans<<endl;
    return 0;
}

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


static int dp[ 2001 ] = { 0 };

int
main (
  int   argc,
  char *argv[ ]
  )
{
  int i, j;

  for ( i = 0; i <= 1000; ++i )
  for ( j = 0; j <= 1000; ++j )
    ++dp[ i + j ];

  for ( ; ; )
  {
    int res = 0;
    int n;

    if ( scanf ( "%d", &n ) != 1 )
      break ;

    for ( i = 0; i <= 2000; ++i )
      res += dp[ i ] * ( n - i >= 0 && n - i <= 2000 ? dp[ n - i ] : 0 );

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

  return ( EXIT_SUCCESS );
}

Measured memory_bytes: 604
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int a, b, c, i, j, k, x;
	set<int> s;
	s.insert(1);
	for (i = 2; i <= 1000; i++) {
		x = i * i;
		while (x <= 1000) {
			s.insert(x);
			x *= i;
		}
	}

	cin >> x;
	c = 0;
	for (auto a : s) {
		if (a <= x) c = max(c, a);
	}
	cout << c << "\n";


	return 0;
}


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

int main() {
  char c;
  cin >> c;
  if( c == 'a'){
  	cout << "vowel" <<endl;
  }
  else  if( c == 'i'){
  	cout << "vowel" <<endl;
  }
  else  if( c == 'u'){
  	cout << "vowel" <<endl;
  }
  else  if( c == 'o'){
  	cout << "vowel" <<endl;
  }
  else  if( c == 'e'){
  	cout << "vowel" <<endl;
  }else{
  	cout << "consonant" << endl;
  }
  
  return 0;



}

Measured memory_bytes: 384
<?php
fscanf(STDIN, "%d", $n);

$a = explode(' ', trim(fgets(STDIN)));
$manzoku = explode(' ', trim(fgets(STDIN)));
$c = explode(' ', trim(fgets(STDIN)));


$result = 0;
$before_index = null;
foreach ($a as $i => $food) {
    $food_index = $food - 1;
    $result += $manzoku[$food_index];

    if ($i === 0) {
        $before_index = $food_index;
        continue;
    }
    
    if ($food_index == $before_index + 1 && isset($c[$before_index])) {
        $result += $c[$before_index];
    }
    $before_index = $food_index;
}
echo $result . "\n";

Measured memory_bytes: 4728
N = int(input())
T, A = map(int, input().split())
H = input().split()
mean_A = []
for i in range(N):
    H[i] = int(H[i])
    mean_A.append(T - H[i]*0.006 - A)
    if (mean_A[i]<0):
        mean_A[i] = -mean_A[i]
min_value = 1e+5
min_index = 0
for i in range(N):
    if (mean_A[i]<min_value):
        min_value = mean_A[i]
        min_index = i
print(min_index+1)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>

int main() {
  int N = 0, K = 0;
  int i = 0, j = 0;
  int c = 0;
  int count = 0;
  scanf("%d",&N);

  int b[N];
  for(i = 0; i < N; i++) {
      b[i] = 1;
  }
  scanf("%d",&K);
  
  for(i = 0; i < K; i++) {
    int d = 0;
    scanf("%d",&d);
    
    for(j = 0; j < d; j++) {
      scanf("%d",&c);
      b[c - 1] = 0;
    }
  }

  for(i = 0; i < N; i++) {
    if(b[i] == 1)
      count += 1;
  }
  printf("%d",count);
  return 0;
}


Measured memory_bytes: 1692
tax = ->(x, t){
     (x + x * t * 0.01).to_i
}
loop {
    a, b, c = gets.split.map(&:to_i)
    break if a == 0
    ans = -1
    (1..c).each{|x|
        (1..c).each{ |y|
            ans = [ans, tax[x,b] + tax[y,b]].max if tax[x,a] + tax[y,a] == c
        }
    }
    puts ans
}


Measured memory_bytes: 6900
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

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

    int cnt0=0,cnt1=0;
    for(int i=0;i<s.size();i++){
        if(i%2==0){
            if(s.at(i)!='0') cnt0++;
        }else{
            if(s.at(i)!='1') cnt0++;
        }
    }

    for(int i=0;i<s.size();i++){
        if(i%2==0){
            if(s.at(i)=='0') cnt1++;
        }else{
            if(s.at(i)=='1') cnt1++;
        }
    }

    cout << min(cnt0,cnt1) << endl;
}

Measured memory_bytes: 3752
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    func count() -> Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
}
extension Array where Element: Comparable {
    func max() -> Element! {
        return self.maxElement()
    }
    func min() -> Element! {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let D = readInt()!
var str = ""
switch D {
case 22:
    str = "Christmas Eve Eve Eve"
case 23:
    str = "Christmas Eve Eve"
case 24:
    str = "Christmas Eve"
case 25:
    str = "Christmas"
default:
    break
}
print(str)

Measured memory_bytes: 6756
def solve(l):
    e = l.pop()
    if e == '*':
        return solve(l) * solve(l)
    elif e == '+':
        return solve(l) + solve(l)
    elif e == '-':
        return - solve(l) + solve(l)
    else:
        return int(e)

formula = input().split()
print(solve(formula))

Measured memory_bytes: 7732
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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 main() {
  int n, y;
  cin >> n >> y;
  y /= 1000;
  rep (i, n + 1) {
    ll man = i * 10;
    rep (j, n + 1 - i) {
      ll gosen = j * 5;
      ll sen   = n - i - j;
      if (man + gosen + sen == y) {
        cout << i << " " << j << " " << n - i - j << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
  return 0;
}







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

using Value = long long int;
const Value INI = 0;


namespace perseg {

	struct lazy_segtree {
		Value val;
		Value lazy;
		int l, r;
		vector < shared_ptr<lazy_segtree>>chs;
		lazy_segtree(const int size_) :val(INI), lazy(INI), l(0), r(size_), chs(2, nullptr) {

		}
		lazy_segtree(const int l_,const int r_):val(INI),lazy(INI),l(l_),r(r_),chs(2,nullptr) {

		}
		Value add_val(const Value&l, const Value&r) {
			return l + r;
		}
		Value add_lazy(const Value&l, const Value&r) {
			return l + r;
		}
		Value ltov(const Value&la) {
			return la*(r - l);
		}
		shared_ptr<lazy_segtree>getch(const int num) {
			if (chs[num] == nullptr) {
				const int m = (l + r) / 2;
				if (!num) {
					chs[0] = make_shared<lazy_segtree>(l, m);
				}
				else {
					chs[1] = make_shared<lazy_segtree>(m,r);
				}
			}
			return chs[num];
		}
		void push() {
			if (lazy!=INI) {
				val += ltov(lazy);
				if (l + 1 != r) {
					const int m = (l + r);
					for (int i = 0; i < 2; ++i) {
						auto ch = getch(i);
						ch->lazy = add_lazy(ch->lazy, lazy);
					}
				}
				lazy = INI;
			}
		}
		Value query(int a, int b) {
			if (r <= a or b <= l)return 0;
			else if (a<=l&&r<=b) {
				return val + ltov(lazy);
			}
			else {
				push();
				const int m = (l + r) / 2;
				const Value lval=getch(0)->query(a, b);
				const Value rval=getch(1)->query(a, b);
				return val=add_val(lval, rval);
			}
		}
		void update(int a,int b,int k) {
			if (r <= a or b <= l)return;
			else if (a<=l && r<=b)lazy += k;
			else {
				push();
				const int m = (l + r) / 2;
				getch(0)->update(a, b, k);
				getch(1)->update(a, b, k);
				val = chs[0]->val + chs[0]->ltov(chs[0]->lazy) + chs[1]->val + chs[1]->ltov(chs[1]->lazy);
			}
		}
	};
}

struct query {
	int l;
	int r;
	int v;
};
using namespace perseg;

int main() {
	int N, Q; cin >> N >> Q;
	lazy_segtree seg(1<<17);
	while (Q--) {
		int a; cin >> a;
		if (a) {
			int i; cin >> i;
			i--;
			Value ans = seg.query(i, i + 1);
			cout << ans << endl;
		}
		else {
			int s, t, x; cin >> s >> t >> x;
			s--;
			seg.update(s, t, x);
		}
	}

	return 0;
}

Measured memory_bytes: 26288
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w ;
  cin >> h >> w ;
  int cnt = 0 ;
  vector<vector<char>> gra(h+2,vector<char>(w+2,'#')) ;
  vvint seen(h+2,vint(w+2,0)) ;
  vvint ans(h+2,vint(w+2,0)) ;
  
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      cin >> gra[i][j] ;
      if(gra[i][j]=='.'){
        cnt++ ;
      }
    }
  }
  queue<pii> Q ;
  Q.push(MP(1,1)) ;
  while(!Q.empty()){
    int x, y ;
    x = Q.front().FI ;
    y = Q.front().SE ;
    REP(i,4){
      int X, Y ;
      X = x+dx[i] ;
      Y = y+dy[i] ;
      if(seen[X][Y]==0 && gra[X][Y]=='.'){
        seen[X][Y] = 1 ;
        ans[X][Y] = ans[x][y] + 1 ;
        Q.push(MP(X,Y)) ;
      }
    }
    Q.pop() ;
  }
  
  if(ans[h][w]==0){
    cout << -1 <<endl ;
  }
  else{
    cout << cnt - ans[h][w] -1 <<endl ;
  }
  
  
  
  
  
  
  return 0 ;
}

Measured memory_bytes: 256
month = [0,31,60,91,121,152,182,213,244,274,305,335]
day = ["Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"]
while True:
    a,b = map(int,input().split())
    if a == 0:
        break
    num = month[a-1]+b
    print(day[num%7])
    
    


Measured memory_bytes: 5592
# include <iostream>
# include <deque>
using namespace std; 
int n,*a;
deque<int> d; 
int cnt = 0;
void shell_sort()
{
	int y,h,k;
	for(int i = 0;i < d.size();i++)
	{
		h = d[i];
		for(int j = h;j < n;j++)
		{
			y = a[j];
			for(k = j-h; k >= 0 && y <a[k]; k -= h) 
			{
				cnt++;
				a[k+h] = a[k];
			}
			a[k+h] = y;
		}
	} 
}

int main(void)
{
	d.push_back(1);
	scanf("%d",&n);
	a = new int [n];
	for(int i = 2;i < n;i++)
	{
		if(d.size() == 100 || 3*d[0]+1 >= n) break;
		d.push_front(3*d[0]+1);
	}
	for(int i = 0;i < n;i++) scanf("%d",&a[i]);
	shell_sort();
	printf("%d\n",d.size());
	for(int i = 0;i < d.size();i++) printf("%d%c",d[i],i == d.size()-1?'\n':' ');
	printf("%d\n",cnt);
	for(int i = 0;i < n;i++) printf("%d\n",a[i]);
	return 0;
}




Measured memory_bytes: 7112