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

int main(){
    int d;
    int ans;

    cin >>d;

    if(d==25)cout << "Christmas" <<endl;
    if(d==24)cout << "Christmas Eve" <<endl;
    if(d==23)cout << "Christmas Eve Eve" <<endl;
    if(d==22)cout << "Christmas Eve Eve Eve" <<endl;
    return 0;
}


Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var len = int.Parse(Console.ReadLine());
        var S = Console.ReadLine();

        var left = new int[len];
        for (int i = 1; i < len; i++)
        {
            if (S[i - 1] == 'W')
            {
                left[i] = left[i - 1] + 1;
            }
            else
            {
                left[i] = left[i - 1];
            }
        }

        var right = new int[len];
        for (int i = len - 2; i >= 0; i--)
        {
            if (S[i + 1] == 'E')
            {
                right[i] = right[i + 1] + 1;
            }
            else
            {
                right[i] = right[i + 1];
            }
        }

        var min = int.MaxValue;
        for (int i = 0; i < len; i++)
        {
            min = Math.Min(min,
                left[i] + right[i]);
        }

        Console.WriteLine(min);
    }
}


Measured memory_bytes: 14432
#include <iostream>
using namespace std;
int main()
{
    int a;
    cin >> a;
    int h,m,s;
    h = a/3600;
    m = (a - (h*3600))/60;
    s = a % 60;
    cout << h <<":"<< m << ":" << s <<endl;
    return 0;
}


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

typedef long long ll;
#define nl "\n"
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define pb emplace_back
#define pp pop_back
#define bs binary_search
#define all(x) x.begin(),x.end()
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define test ll t ; cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);

ll dp[1000000]={0};

ll rec(ll a[],ll n)
{
   if(n==1)     return 0;
   else if(n<=0)     return INT_MAX;
   
   if(dp[n]!=-1)    return dp[n];
   return   dp[n]=min(abs(a[n]-a[n-1])+rec(a,n-1),abs(a[n]-a[n-2])+rec(a,n-2));
}

int main() {
	fast_io;
	
	ll n,ans;
	cin>>n;
	ll a[n+1]={0};
	loop(i,1,n+1)     cin>>a[i];
	memset(dp,-1,sizeof(dp));
	ans=rec(a,n);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 12032
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);





int main() 
{
  char c; cin>>c;
  if(c-'a'>=0) {cout<<"a"<<endl; return 0;}
  cout<<"A"<<endl;
  return 0;
}


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

mod = 998244353
dp = [[0]*(S+1) for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
  for j in range(S+1):
    if j - A[i] >= 0:
      dp[i+1][j] = (dp[i][j-A[i]]+dp[i][j]*2)%mod
    else:
      dp[i+1][j] = dp[i][j]*2%mod
    
# print(dp)
print(dp[N][S])

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/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; }

void WarshallFloyd(int n, V<V<int>> &g) {
    rep(k,n)rep(i,n)rep(j,n) {
        chmin(g[i][j], g[i][k] + g[k][j]);
    }
}


int main(){
    
    int h, w;
    cin >> h >> w;
    V<V<int>> g(10, V<int>(10));
    rep(i,10)rep(j,10) {
        int c;
        cin >> c;
        if(c == 0) c = inf;
        g[i][j] = c;
    }
    V<V<int>> a(h, V<int>(w));
    WarshallFloyd(10, g);

    int ans = 0;
    rep(i,h)rep(j,w) {
        int c;
        cin >> c;
        if(c == -1 || c == 1) continue;
        ans += g[c][1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    int main()
    {
        string s;
        cin>>s;
        stack <char> x;
        for(ll i=0;i<s.size();i++){
            if(s[i]!='B'){
                x.push(s[i]);
            }
            else{
                if(!x.empty()){
                    x.pop();
                }
            }
        }
        std::vector<char> v ;
        while(!x.empty()){
            v.push_back(x.top());
            x.pop();
        }

        reverse(v.begin(),v.end());
        for(auto z : v){
            cout<<z;
        }
        return 0;
    }

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))

int main(void){
    int n;
    cin>>n;
    vector<pair<string,pair<int,int>>> vc(n);
    rep(i,0,n){
        cin>>vc[i].first>>vc[i].second.first;
        vc[i].second.first*=-1;
        vc[i].second.second=i+1;
    }
    sort(vc.begin(),vc.end());
    rep(i,0,n)cout<<vc[i].second.second<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

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

  if( a < 10 && b < 10 )
  {
    ans = a*b;
  }else{
    ans = -1;
  }
  printf("%d\n",ans);

  return 0;
}

Measured memory_bytes: 128
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

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

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, K;
    cin >> N >> K;

    vector<P> items(N);
    for (int i = 0; i < N; i++) {
        int t, d;
        cin >> t >> d;
        t--;
        items.push_back(make_pair(d, t));
    }
    sort(items.begin(), items.end(), greater<>());

    vector<int> selected_num(N, 0);
    int d_score = 0;
    int t_num = 0;
    priority_queue<P, vector<P>, greater<>> selected_heap;
    priority_queue<P> unselected_heap;

    for (int i = 0; i < K; i++) {
        P item = items[i];
        if (selected_num[item.second] == 0) t_num++;
        selected_num[item.second]++;
        d_score += item.first;
        selected_heap.push(item);
    }

    for (int i = K; i < N; i++) {
        unselected_heap.push(items[i]);
    }

    int ret = d_score + t_num * t_num;

    while (true) {
        P removed_item;
        P added_item;
        bool flag1 = false;
        bool flag2 = false;

        while (!unselected_heap.empty()) {
            P item = unselected_heap.top(); unselected_heap.pop();
            if (selected_num[item.second] == 0) {
                added_item = item;
                flag1 = true;
                break;
            }
        }
        if (!flag1) break;

        while (!selected_heap.empty()) {
            P item = selected_heap.top(); selected_heap.pop();
            if (selected_num[item.second] >= 2) {
                removed_item = item;
                flag2 = true;
                break;
            }
        }
        if (!flag2) break;

        d_score = d_score + added_item.first - removed_item.first;
        t_num++;
        selected_num[added_item.second]++;
        selected_num[removed_item.second]--;
        ret = max(ret, d_score + t_num * t_num);
    }

    cout << ret << endl;
    return 0;
}

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

int main()
{
  int H, W;
  cin >> H >> W;
  char c;
  vector<vector<int>> G(H + 2, vector<int>(W + 2, 0));
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      cin >> c;
      if (c == '#')
        G[i + 1][j + 1] = 9;
    }
  }
  for (int i = 1; i <= H; i++)
  {
    for (int j = 1; j <= W; j++)
    {
      if (G[i][j] == 9)
      {
        cout << '#';
        continue;
      }
      int tmp = 0;
      tmp += (G[i - 1][j - 1] == 9);
      tmp += (G[i - 1][j] == 9);
      tmp += (G[i - 1][j + 1] == 9);
      tmp += (G[i][j - 1] == 9);
      tmp += (G[i][j + 1] == 9);
      tmp += (G[i + 1][j - 1] == 9);
      tmp += (G[i + 1][j] == 9);
      tmp += (G[i + 1][j + 1] == 9);
      cout << tmp;
    }
    cout << endl;
  }
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define PI acos(-1.0)
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define MOD 1000000007
#define MOD1 1000000005
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, 1};
int dy4[] = {1, -1, 1, -1};
//#define fio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main()
{
    #ifndef ONLINE_JUDGE
    freopen ("in.txt", "r", stdin);
    freopen ("out.txt", "w", stdout);
    #endif
    int n, i, R=0, x;
    string s;
    cin>>n;
    cin>>s;
    for(i=0;i<n;i++){
        if(s[i]=='R')R++;
    }
    x=R;
    for(i=0;i<x;i++){
        if(s[i]=='R')R--;
    }
    cout<<R<<endl;
    return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

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

	int cnt = 0;
	for(int i = 0; i < n; i++){
		while(a[i] % 2 == 0){
			a[i] /= 2;
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 892
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <climits>
#include <functional>

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

using namespace std;
typedef long long ll;
const int INF = 2e9;

typedef vector<ll> VLL;
typedef tuple<ll, bool, ll> Event;

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

  int N, Q;
  cin >> N >> Q;
  ll s, t, x;
  vector<Event> events;
  REP(i, N) {
    cin >> s >> t >> x;
    events.push_back(make_tuple(s - x, true, x));
    events.push_back(make_tuple(t - x, false, x));
  }

  ll D[Q];
  REP(i, Q) {
    cin >> D[i];
  }

  sort(events.begin(), events.end());
  set<ll> stops;

  auto i = events.begin();
  for (auto d: D) {
    while (i != events.end() && get<0>(*i) <= d) {
      if (get<1>(*i)) {
	stops.insert(get<2>(*i));
      }
      else {
	stops.erase(get<2>(*i));
      }
      ++i;
    }
    cout << (stops.empty() ? -1 : *stops.begin()) << "\n";
  }

  return 0;
}


Measured memory_bytes: 22376
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	in := readLine()
	ins := strings.Split(in, " ")

	l, _ := strconv.Atoi(ins[0])
	r, _ := strconv.Atoi(ins[1])

	if r-l >= 2019 {
		fmt.Println(0)
		return
	}

	min := 2019
	for i := l; i <= r-1; i++ {
		for j := i + 1; j <= r; j++ {
			if a := (i * j) % 2019; min > a {
				min = a
			}
		}
	}

	fmt.Println(min)
}


Measured memory_bytes: 640
#include<iostream>

using namespace std;

int main()
{
    int n,a,b;
    cin>>n>>a>>b;
    if(n==2) { cout << "Borys" << endl; }
    else if((b-a-1)%2==1) {
        cout << "Alice" << endl;
    }
    else if((b-a-1)%2==0) { cout << "Borys" << endl;}
    else { cout << "Draw" << endl; }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=200010,INF=0x3f3f3f3f;
const double PI=acos(-1);
inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define nc getchar
inline int rd(){
    char ch=nc();int sum=0;
    while(!(ch>='0'&&ch<='9'))ch=nc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();
    return sum;
} 
int g[N],d[N];
int x[N],y[N],x2[N],y2[N];
struct data{
	int x,y;
}q[N],t[N];
int mnx,mxy;
void rot(int &x,int &y){
	int t=x;
	x=mxy-y;
	y=t-mnx;
}

bool cmp(data&x,data&y){
	return x.x<y.x;
}

int main(){
	int sx,sy,tx,ty;
	sx=rd(),sy=rd(),tx=rd(),ty=rd();
	if(tx<sx) swap(sx,tx),swap(sy,ty);
	int n;
	scanf("%d",&n);
	mnx=sx,mxy=sy;
	for(int i=1;i<=n;i++){
		x[i]=rd(),y[i]=rd();
		mnx=min(mnx,x[i]),mxy=max(mxy,y[i]);
	}	
	if(ty<sy){
		for(int i=1;i<=n;i++)
			rot(x[i],y[i]);	
		rot(sx,sy),rot(tx,ty);
	}	
	int n2=0;
	for(int i=1;i<=n;i++) if(x[i]>=sx&&x[i]<=tx&&y[i]>=sy&&y[i]<=ty){
		n2++;
		q[n2].x=x[i],q[n2].y=y[i];
		x2[i]=x[i],y2[i]=y[i];
	}
	double tmp;
	const int D=20;
	sort(q+1,q+1+n2,cmp);
	for(int i=1;i<=n2;i++) g[i]=INF;
	g[0]=-1,q[0].y=0;
	for(int i=1;i<=n2;i++){
		int k=lower_bound(g,g+n2+1,q[i].y)-g;
		d[i]=k;
		g[k]=q[i].y;
	}
	int mxc=0;
	for(int i=1;i<=n2;i++) mxc=max(mxc,d[i]);
	if(mxc==tx-sx+1||mxc==ty-sy+1) tmp=-(1-0.5*PI)*D+(1-0.25*PI)*D;
	else tmp=0;
	printf("%.13f\n",1.0*(ty-sy)*100+1.0*(tx-sx)*100-(1-0.25*PI)*mxc*D+tmp);
	return 0;
}


Measured memory_bytes: 6528
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

n = int(sys.stdin.readline())
s = list(map(int, sys.stdin.readline().split()))
q = int(sys.stdin.readline())
t = list(map(int, sys.stdin.readline().split()))

s_set = set(s)
total = 0

for x in t:
    if x in s_set:
        total += 1

print(total)



Measured memory_bytes: 6592
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef int in;
typedef long long ll;
typedef vector<in> VI;
typedef vector<VI> VVI;
const in mdl=1000000007;
in p2(in a){
  return 1<<a;
}
vector<ll> wys;
in n;
void goup(){
  in pn=p2(n);
  in pi;
  in tmsk;
  forn(i,n){
    pi=p2(i);
    in pl=p2(n-1-i);
    in pr=p2(i);
    forn(msk,pn){
      if(msk&pi)
	continue;
      tmsk=msk&(~(pi-1));
      tmsk&=~(tmsk-1);
      wys[(msk|pi)^tmsk]+=wys[msk];
    }
  }
}

VI condmembers;
VI condvalue;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in m,k;
  cin>>n>>m>>k;
  --n;
  wys.resize(p2(n));
  wys[0]=1;
  condmembers.resize(m);
  condvalue.resize(m);
  in a,b,c;
  forn(z,k){
    cin>>a>>b>>c;
    --a;
    --b;
    condmembers[a]|=p2(b);
    condvalue[a]|=c*p2(b);
  }
  forn(z,m){
    goup();
    forn(msk,p2(n)){
      if((msk&condmembers[z])!=condvalue[z])
	wys[msk]=0;
      wys[msk]%=mdl;
    }
  }
  ll sm=0;
  forn(i,p2(n))
    sm+=wys[i];
  sm%=mdl;
  if(sm<0)
    sm+=mdl;
  cout<<sm<<endl;
  return 0;
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    bool f = false;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] % 2 == 1) f = true;
    }
    cout << (f? "first" : "second") << endl;
    return 0;
}


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

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

    vector<int> price(N);
    for(int i=0; i<N; i++) { cin >> price[i]; }

    int sum = accumulate(price.begin(), price.end(), 0);
    sum -= *max_element(price.begin(), price.end())/2;

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

Measured memory_bytes: 256
// schedule lectures codechef
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define clr clear()
#define ins insert
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define mem(x,val) memset((x),(val),sizeof(x));
#define cusmem(x,val) for(auto &i:x) i=val;
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false);\
            cin.tie(NULL);\
            cout.tie(NULL);
using namespace std;
typedef pair<int,int> pii;
typedef pair<ll,ll>pll;
typedef vector<ll> vl;
typedef vector<pll> vpll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pii> vpii;
string imp="Impossible\n";

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
clock_t startTime;
double getCurrentTime() {
    return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}
// const int N=10;
const int N=2e4+5;
ll MOD=1e9+7;
ll m,k,i,j;
bool f0,f1,f2;
const int MAXN=2e3;
int main(){
    #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin); 
            freopen("output.txt","w",stdout);
    #endif
    fastio
	cout<<fixed<<setprecision(11);
    int tests=1;    
    // cin>>tests;
    while(tests--){
        ll n,k; cin>>n>>k;
        ll a[n];
        for(int i=0;i<k;i++){
            cin>>a[i];
        }
        ll s=0;
        for(int i=k;i<n;i++){
            cin>>a[i];
            if(a[i]>a[s])   cout<<"Yes\n";
            else    cout<<"No\n";
            s++;
        }
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<v.size()-1) cout<<sep;} cout<<endl

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int d;
    cin>>d;
    string ans="Christmas";
    d = abs(d-25);
    REP(i,d)
        ans += " Eve";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
A, B, C = map(int, input().split())
li = [A,B,C]
if A&1 ==1 or B&1 ==1 or C&1 ==1:
    print(0)
else:
    num = 1
    a = (B+C)//2
    b = (A+C)//2
    c = (A+B)//2
    flag = True
    while li != [a,b,c]:
        if a&1 ==1 or b&1 ==1 or c&1 ==1:
            flag = False
            break
        a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
        num += 1
    if flag:
        print(-1)
    else:
        print(num)

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	String s=sc.next();
	char c[]=s.toCharArray();
	for(int i=0;i<=s.length()-1;i++){
if(i!=3){System.out.print(c[i]);}else{
	System.out.print(8);
}

	}
System.out.println();
	}}

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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FORD(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

ll aabs(ll a) {
	if(a  >= 0) {
		return a;
	} else {
		return -a;
	}
}

ll max(ll a, ll b) {
	if (a > b) {
		return a;
	}
	return b;
}

int main() {
    string a,b;
    cin >> a >> b;
	int cnt = 0;
	REP(i,3) {
		if(a[i] == b[i]) cnt++;
	}

    cout << cnt << endl;
}



Measured memory_bytes: 256
import math
n,d=map(int,input().split())
l=[]
x=[]
c=0
for i in range(n):
    l.append(list(map(int,input().split())))
    
for i in range(n-1):
    for j in range(i+1,n):
        for k in range(d):
            x.append(abs(l[i][k]-l[j][k])**2)
        if math.sqrt(sum(x))%1==0:
            c+=1
        x=[]
print(c)

Measured memory_bytes: 3064
<?php

class IO {

	//input
	private $buf = [];
	private $count = 0;
	private $pointer = 0;

	public function nextLine() {
		$ret = '';
		if($this->hasNext()){
			while($this->hasNext()){
				$ret .= $this->next();
			}
		}else{
			$ret = trim(fgets(STDIN));
		}

		return $ret;
	}

	public function next() {
		if(!$this->hasNext()) {
			$str = trim(fgets(STDIN));
			$this->buf = explode(' ',$str);
			$this->count = count($this->buf);
			$this->pointer = 0;
		}

		return $this->buf[$this->pointer++];
	}

	public function hasNext() {
		return $this->pointer < $this->count;
	}

	public function nextInt() {
		return (int)$this->next();
	}

	public function nextDouble() {
		return (double)$this->next();
	}

	//output
	public function println($str = '') {
		echo $str . PHP_EOL;
	}
}

class Math {
	public static function gcd($x,$y) {
		if ($y === 0)return $x;
		else return Math::gcd($y,$x % $y);
	}

	public static function lcm($x,$y) {
		return $x / Math::gcd($x,$y) * $y;
	}
}

$io = new IO();


$N = $io->nextInt();
$K = $io->nextInt();
$x = array();
for($i = 0;$i < $N;$i++) {
	$x[] = $io->nextInt();
}

$ans = 0;
for($i = 0;$i < $N;$i++) {
	$ans += min(abs($K-$x[$i]),$x[$i]) * 2;
}

$io->println($ans);

?>


Measured memory_bytes: 4856
#include <iostream>
#define rep(i,n) for(int i=1;i<n;i++)
using namespace std;

int main(){
	int n,x,y;
	cin >> n >> x >> y;
	int ans[n]={};
	rep(i,n){
		for(int j=i+1;j<=n;j++){
			ans[min(j-i,abs(j-y)+abs(x-i)+1)]++;
		}
	}
	rep(i,n){
		cout << ans[i]<<endl;
	}
}

Measured memory_bytes: 256
s = input()
q = int(input())

for i in range(q):
    lis = input().split()
    a = int(lis[1])
    b = int(lis[2])

    if lis[0] == "print":
        print(s[a : b + 1])
    elif lis[0] == "replace":
        p = lis[3]
        s = s[:a] + p + s[b + 1 :]
    else:  # reverse
        slice = (s[a : b + 1])[::-1]
        s = s[:a] + slice + s[b + 1 :]



Measured memory_bytes: 5612
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    vector<pair<double ,string> > moon;
    while(n--){
      string w;
      double p,a,b,c,d,e,f,s,m;
      double val,pr,time;
      cin >>w>>p>>a>>b>>c>>d>>e>>f>>s>>m;
      pr = m*f*s-p;
      time = a+b+c+(d+e)*m;
      val = pr/time;
      moon.push_back(make_pair(-val,w));
    }
    sort(moon.begin(),moon.end());
    for(int i=0; i<moon.size(); i++){
      cout <<moon[i].second<<endl;
    }
    cout <<"#"<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val m = scanner.nextInt()
    val s = Array(m, { IntArray(n) })
    val p = IntArray(m)
    for (i in 0 until m) {
        val k = scanner.nextInt()
        for (j in 0 until k) s[i][j] = scanner.nextInt()
    }
    for (i in 0 until m) p[i] = scanner.nextInt()
    var cnt = 0
    val sc = IntArray(m)
    val po = Math.pow(2.0, n.toDouble())
    for (i in 0 until po.toInt()) {
        sc.fill(0)
        for (j in 0 until n) {
            if (1 and (i shr j) == 1) {
                for (k in 0 until m) {
                    if (s[k].contains(j + 1)) sc[k]++
                }
            }
        }
        for (k in 0 until m) {
            if ((sc[k] % 2) != p[k]) break
            if (k == m - 1) cnt++
        }
    }
    println(cnt)
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<ll> a(n);
  vector<bool> b(n,true);
  rep(i,n){
    cin >> a[i];
  }
  ll ans = 0;
  rep(i,n){
    if(a[a[i]-1] == i+1 && b[i] && b[a[i]-1]){
      b[i] = false;
      b[a[i]-1] = false;
      ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll INF = LLONG_MAX/4;
    ll n,m,r; cin >> n >> m >> r;
    vector<ll> r_vec(r);
    rep(i,r){
        cin >> r_vec[i];
        r_vec[i]--;
    }
    sort(all(r_vec));
    vvl ab(n,vector<ll>(n,INF));
    rep(i,m){
        ll a,b,c; cin >> a >> b >> c;
        a--;b--;
        ab[a][b] = c;
        ab[b][a] = c;
    }

    rep(k,n)rep(i,n)rep(j,n){
        ab[i][j] = min(ab[i][j], ab[i][k] + ab[k][j]);
    }

    ll res = INF;
    do{
        ll temp = 0;
        rep(i,r-1){
            temp += ab[r_vec[i]][r_vec[i+1]];
        }
        res = min(res,temp);
    }while(next_permutation(all(r_vec)));

    cout << res << endl;
}

Measured memory_bytes: 512
use std::io;
use std::str::FromStr;
use std::collections::HashMap;

static MOD: u64 = 2019;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_char_vec() -> Vec<char> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.chars().collect()
}

fn combination(n: u64, mut m: u64) -> u64 {
    if n < m {
        return 0;
    }
    if m > n - m {
        m = n - m
    }

    let mut ret = 1u64;
    for i in 0..m {
        ret *= n - i;        
    }

    let mut div = 1u64;
    for i in 1..(m+1) {
        div *= i;
    }
    ret / div
}

fn main() {
    let mut tens_vec: Vec<u64> = Vec::new();
    let mut buf = 1;
    for _ in 0..1_000_000 {
        buf %= MOD;
        tens_vec.push(buf);
        buf *= 10;        
    }

    let mut s: Vec<char> = input_char_vec();
    // let mut s: Vec<char> = Vec::new();
    // for _ in 0..200_000 {
    //     s.push('1');
    // }
    s.remove(s.len() - 1);
    let mut s_sum: Vec<u64> = Vec::new();
    s_sum.push(tens_vec.get(s.len() - 1).unwrap() * (s[0] as u64 - 48));    
    for i in 1..s.len() {
        let mut num = s_sum.get(i - 1).unwrap() + tens_vec.get(s.len() - i - 1).unwrap() * (s[i] as u64 - 48);
        num %= MOD;
        s_sum.push(num);
    }
    s_sum.insert(0, 0);

    let mut map: HashMap<u64, u64> = HashMap::new();
    for n in s_sum {
        let e = map.entry(n).or_insert(0);
        *e += 1;
    }

    let mut sum = 0;
    for v in map.values() {
        if *v > 1 {
            sum += combination(*v, 2);
        }
    }
    println!("{}", sum);
    // println!("{:?}", map);
}


Measured memory_bytes: 12392
x1,y1,x2,y2 = [int(x) for x in input().split()]

def calc(x1,y1,x2,y2):
    return x2-y2+y1,y2+x2-x1

x3,y3 = calc(x1,y1,x2,y2)
x4,y4 = calc(x2,y2,x3,y3)

print(x3,y3,x4,y4)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);
    vector<ll> a(n), b(n);
    int i;
    ll sum=0;
    for(i=0; i<n; i++) {
        scanf("%lld%lld", &a[i], &b[i]);
    }

    for(i=n-1; i>=0; i--) {
        a[i]+=sum;
        ll tmp=(a[i]+b[i]-1)/b[i];
        ll tmp2=b[i]*tmp-a[i];
        sum+=tmp2;
    }
    printf("%lld\n", sum);

    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
int A[3333];
vint G[3333];

bool dfs(int v){
    bool flag=false;
    for(auto u:G[v]){
        if(A[v]<=A[u])continue;
        if(!dfs(u))flag=true;
    }
    return flag;
}

signed main(){
    cin>>N;
    rep(i,N)cin>>A[i];

    rep(i,N-1){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].pb(b);G[b].pb(a);
    }

    rep(i,N){
        if(dfs(i))cout<<i+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 512
from collections import defaultdict

n, m = list(map(int, input().split()))

g = defaultdict(list)

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

visited = [False]*n

q = [0]
visTime = 0
Found = False
while q and visTime < 2:
    
    nL = []
    for vert in q:
        visited[vert] = True
        for v in g[vert]:
            if v == n-1:
                Found = True
                break
            if not visited[v]:
                nL.append(v)
    if Found:
        break
    q = nL
    visTime += 1
    
print('POSSIBLE' if Found else 'IMPOSSIBLE')


Measured memory_bytes: 139816
// Template
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0;i < n;i++)
#define INF 1 << 30

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int MOD = 1000000007;



int main(){
    std::ios_base::sync_with_stdio(false);

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

    UnionFind uf1(n);
    UnionFind uf2(n);

    REP(i,k){
        int s,t; cin >> s >> t; s--; t--;
        uf1.unionSet(s, t);
    }

    REP(i,l){
        int s,t; cin >> s >> t; s--; t--;
        uf2.unionSet(s, t);
    }

    map<pair<int, int>, int> cnt;

    REP(i,n){
        cnt[make_pair(uf1.root(i), uf2.root(i))]++;
    }

    REP(i,n){
        cout << cnt[make_pair(uf1.root(i), uf2.root(i))] << " ";
    }
    cout << '\n';




    return 0;
}


Measured memory_bytes: 13568
#include<iostream>
#include<map>
#include<string>
#include<algorithm>
#include<iso646.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<n;i++)
int main(){
ll n;
cin>>n;
ll min=n;
for(ll i=1;i<n;i++){
ll a=i;
ll b=n-a;
ll count=0;
while(a>9){
count+=a%10;
a=a/10;
}
count+=a;
while(b>9){
count+=b%10;
b=b/10;
}
count+=b;
if(count<min){
min=count;
}

}

cout<<min;
return 0;
}

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

int main(){
  int N;
  cin>>N;
  int j=N;
  for(int i=0;i<=N;i++){
    int k=0;
    for(int l=i;l>0;l/=6)
      k+=l%6;
    for(int l=N-i;l>0;l/=9)
      k+=l%9;
    j=min(j,k);
  }
  cout<<j<<endl;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
long long INF = (1LL<<62);

long long N;
vector<long long> A;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N;
	for(int i=0; i<3*N; i++){
		long long a;
		cin >> a;
		A.push_back(a);
	}
	sort(A.begin(), A.end());

	long long ans = 0;
	for(int i=A.size()-2; i>=N; i -= 2){
		ans += A[i];
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 7316
#!/usr/bin/env python3
#ABC58 D

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,m = LI()
x = LI()
y = LI()
x.sort()
y.sort()
tmpx,tmpy = 0,0
for i in range(n):
    tmpx += x[i]*i
    tmpx -= x[i]*(n-1-i)
for i in range(m):
    tmpy += y[i]*i
    tmpy -= y[i]*(m-1-i)
ans = tmpx*tmpy
ans %= mod
print(ans)


Measured memory_bytes: 74468
#include<bits/stdc++.h>
#define ll  long long
#define ff first
#define ss second
#define pb push_back
#define pp pair<ll,ll>
#define maxn 1000005
#define db double
#define mod 1000000007
using namespace std;
void solve()
{
	ll n,m;
	cin >> n >> m;
	ll cnt=0;
	for(ll i=0;i<m;i++)
	{
		ll x;
		cin >> x;
		cnt+=x;
	}
	cout << (cnt <= n?n-cnt:-1);
}
int main()
{
	ll t=1,i=1;
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
    std::cout.precision(6);
    std::cout.setf( std::ios::fixed, std:: ios::floatfield ); 
	//cin >> t;
	//cin >> n;
	while(i<=t)
	{
		solve();
		i++;
	}
	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
const int maxn=100+10;
int n,dis[maxn],vis[maxn];
vector<int>G[maxn];
void bfs(){
    memset(dis,0,sizeof dis);
    memset(vis,0,sizeof vis);
    queue<int>que;
    que.push(1);vis[1]=1;dis[1]=0;
    while(!que.empty()){
        int cur=que.front();que.pop();
        for(auto i:G[cur]){
            if(!vis[i]){
                que.push(i);
                dis[i]=dis[cur]+1;
                vis[i]=1;
            }
        }
    }
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++){
        int u,k;cin>>u>>k;
        for(int j=0;j<k;j++){
            int v;cin>>v;
            G[u].push_back(v);
        }
    }
    bfs();
    for(int i=1;i<=n;i++) if(!vis[i]) dis[i]=-1;//在bfs完以后还没到达的点到1点的距离设置为-1
    for(int i=1;i<=n;i++) cout<<i<<" "<<dis[i]<<"\n";
}
/*
4
1 2 2 4
2 1 4
3 0
4 1 3
*/



Measured memory_bytes: 3164
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define Yes()           printf("Yes\n")
#define No()            printf("No\n")
#define YES()           printf("YES\n")
#define NO()            printf("NO\n")
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

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

const ll MOD = 1000000007; // 10^9 + 7

int sumOfDigits(ll n) {
  int ret = 0;
  while (n > 0) {
    ret += n % 10;
    n /= 10;
  }
  return ret;
}

void solve() {
  int n; cin >> n;
  int ans = __INT_MAX__;
  for (int a = 1; a <= n / 2; a++) {
    ans = min(ans, sumOfDigits(a) + sumOfDigits(n - a));
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define int long long

using namespace std;
int MOD = 1000000007;

int modpow(int a, int p){
    if(p == 0){
        return 1;
    }else if(p % 2 == 0){
        int t = modpow(a, p/2);
        return t * t % MOD;
    }else{
        int t = modpow(a, p/2);
        return t * t % MOD * a % MOD;
    }
}

int modinv(int n) { return modpow(n, MOD - 2); }

signed main() {
    int n, k;
    cin >> n >> k;
    k = min({k, n - 1});
    int ans = 0, fa = 1, fap = 1, ifa = 1;
    for(auto i = 0LL; i < k; i++){
        fa *= (n - i);
        fap *= (n - 1 - i);
        fa %= MOD;
        fap %= MOD;
        ifa *= modinv(i+1);
        ifa %= MOD;
        ans += fa * ifa % MOD * fap % MOD * ifa % MOD;
        ans %= MOD;
    }
    cout << ans + 1 << endl;

    return 0;
}

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

using namespace std;

int s[5001];

int main()
{
    int n;

    while (cin >> n, n) {
        memset(s, 0, sizeof(s));

        for (int i = 1; i <= n; ++i) {
            int a; cin >> a;
            s[i] = a + s[i - 1];
        }

        int ma = INT_MIN;

        for (int i = 1; i <= n; ++i) for (int j = 1; j <= i; ++j) {
            ma = max(ma, s[i] - s[j - 1]);
        }

        cout << ma << endl;
    }
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int main(){
	vector<double> v;
	double d;
	while(~scanf("%lf",&d))v.push_back(d);
	sort(all(v));
	printf("%lf\n",v[v.size()-1]-v[0]);
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <sstream>
#include <algorithm>
using namespace std;
#define pb push_back
#define mp make_pair
#define ms(a, b)  memset((a), (b), sizeof(a))
//#define LOCAL
typedef long long LL;
const int inf = 0x3f3f3f3f;
const int maxn = 100000+10;
const int mod = 1e9+7;
LL x[maxn];
LL y[maxn];
int main()
{
    #ifdef LOCAL
        freopen("input.txt" , "r", stdin);
    #endif // LOCAL
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i=1;i<=n;i++)   scanf("%lld", &x[i]);
    for(int i=1;i<=m;i++)   scanf("%lld", &y[i]);
    LL ans =0;
    LL sumx = 0, sumy=0;
    for(int i=1;i<=n;i++)
        sumx =(sumx+ ( (i-1)*x[i] - (n-i)*x[i] )%mod)%mod;
    for(int i=1;i<=m;i++)
        sumy =(sumy+ ( (i-1)*y[i] - (m-i)*y[i] )%mod)%mod;
//    printf("%lld %lld\n", sumx, sumy);
    printf("%lld\n", (sumx * sumy) %mod);
    return 0;
}


Measured memory_bytes: 1792
#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 reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll h;
  cin >> h;
  int r = log2(h);
  vector<ll> vec(100,-1);
  vec.at(0) = 1;
  ll ans = 1;
  reps(i, 1, r+1) {
    vec.at(i) = vec.at(i-1) * 2;
    ans += vec.at(i);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3848
x1, y1, x2, y2 = map(int, input().split())

x4, y4 = x1 + y1 - y2, y1 - x1 + x2
x3, y3 = x2 + y1 - y2, -x1 + x2 + y2

print(x3, y3, x4, y4)

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

#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using ll = long long;
using namespace std;

// 150 -c
int main() {
    int k;
    int a, b;
    cin >> k;
    cin >> a >> b;

    repe(i, a, b) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;

    return 0;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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 (a > b) { a = b; return 1; } return 0; }

int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<ll> b = a;
    rep(i, n-1) {
        b[i+1] += b[i];
        b[i+1] %= MOD;
    }

    ll ans = 0;
    rep(i, n) {
        ll t = a[i] * (b[n-1] - b[i]) % MOD;
        ans += t;
        ans %= MOD;
        if (ans < 0) ans += MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 6372
using System;
					
public class Program
{
	public static void Main()
	{
		String str = Console.ReadLine();
		String A = str.Substring(0,1);
		String B = str.Substring(1,1);
		String C = str.Substring(2);

		if(A=="7" || B=="7"|| C=="7")
		{
			Console.WriteLine("Yes");
		}else{
			Console.WriteLine("No");
		}		
	}
}

Measured memory_bytes: 17348
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int n,m;
  scanf("%d\n",&n);
  map<int,int> a;
  int i = 0;
  while (scanf("%d",&m)!=EOF) {
    a[m]=i;
    i++;
  }
  int count =0;
  for (size_t i = 1; i <= 100; i++) {
    if (a.find(i)!=a.end()) count++;
  }
  printf("%d\n",count );
  return 0;
}


Measured memory_bytes: 256
a,b,h,m = gets.split.map(&:to_f)

mr = ((m / 60) * 2 * Math::PI) - (Math::PI / 2)
h = h * 60 + m
hr = ((h / 60 / 12) * 2 * Math::PI) - (Math::PI / 2)

hx = Math.cos(hr) * a
hy = Math.sin(hr) * a
mx = Math.cos(mr) * b
my = Math.sin(mr) * b

puts (((hx - mx) ** 2) + ((hy - my) ** 2)) ** 0.5

Measured memory_bytes: 14868
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>

int main() {
	int A, B;
	std::cin >> A >> B;
	std::string S;
	std::cin >> S;
	std::string s1 = S.substr(0, A), s2 = S.substr(A + 1, B);
	int flag = 0;
	if (!std::all_of(s1.cbegin(), s1.cend(), isdigit)) {
		flag = 1;
	}
	if (!std::all_of(s2.cbegin(), s2.cend(), isdigit)) {
		flag = 1;
	}
	if (S.at(A) != '-') {
		flag = 1;
	}

	if (flag == 0) {
		std::cout << "Yes" << std::endl;
	} else {
		std::cout << "No" << std::endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PREP(i, s, x) for(ll i = (s); i < (x); i++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i--)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
using ll = long long;
typedef long long ll;
typedef pair<ll, ll> P;
template<typename T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

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

constexpr ll INF = (1ll << 60);
constexpr ll MOD = 1000000007ll;

int main() {
    string s, t;
    cin >> s >> t;
    ll n = s.length();
    string tt = t.substr(0, n);
    if(s == tt) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// 散歩後の石数は 0 | e | o | e | 0 に区分される
// この状態を0, 1, 2, 3, 4とする
ll cost(int k, ll a){
	if(k == 0 || k == 4) return a;

	if(k == 1 || k == 3){
		if(a == 0) return 2;
		if(a % 2 == 1) return 1;
		return 0;
	}

	// k = 2;
	if(a % 2 == 0) return 1;
	return 0;
}

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

	int L;
	cin >> L;

	ll A[L];
	rep(i, L) cin >> A[i];

	ll INF = 1e15;
	ll dp[L+1][5];
	rep(i, L+1) rep(j, 5) dp[i][j] = INF;
	dp[0][0] = 0;

	for(int i = 1; i <= L; i++){
		for(int j = 0; j < 5; j++){
			for(int k = j; k < 5; k++){
				dp[i][k] = min(dp[i][k], dp[i-1][j] + cost(k, A[i-1]));
			}
		}
	}

	ll ans = INF;
	rep(i, 5) ans = min(ans, dp[L][i]);
	cout << ans << endl;
}


Measured memory_bytes: 9600