akhauriyash/Code-Regression huggingface dataset:
#include "stdio.h"
#include <stdlib.h>
#include <math.h>
 
int main (){
  int L, R;
  scanf("%d %d",&L, &R);
  int valid[2019];
  for (int i=0; i<2019; i++){
    valid[i]=0;
  }

  int mod=0;
  if (R-L>2019*2){
    for (int i=0; i<2019; i++){
      valid[i]=2;
    }
  } else {
    for (int i=L; i<=R; i++){
      mod = i%2019;
      if (valid[mod]<2){
        valid[mod]++;
      }
    } 
  }

  int min_value = 2019*2019;
  for (int i=0; i<2019; i++){
    if (valid[i]==0){
      continue;
    }
    for (int j=0; j<2019; j++){
      if (j==i){
        if (valid[j]<=1){
          continue;
        }
      }
      else {
        if (valid[j]==0){
          continue;
        }
      }
      if (j*i%2019<min_value){
        min_value = j*i%2019;
      }
    }
  }
  printf("%d\n",min_value);
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)

int main()
{
    int h,a;
    cin>>h>>a;
    cout<<(h+a-1)/a<<endl;
}


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

int main(void) {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	vector<int> b(n);
	b = a;
	sort(a.begin(), a.end());
	int max = a[a.size() - 1];
	rep(i, n) {
		if (b[i] == max) cout << a[a.size() - 2] << endl;
		else cout << max << endl; 
	}
	return 0;
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
string side[4], Longitudinal[5];
int mox[2][2] = { { 1, -1 }, { 0, -1 } }, moy[2][2] = { { -1, 1 }, { -1, 0 } };
char str[5] = "URDL";
//1,0,0
void serch(int x, int y, int then)
{
	if (then == -1)
		then = 3;
	if (!x && !y) {
		cout << endl;
		exit(0);
	}

	for (int i = 0; i < 4; i++) {
		int now = (then + i) % 4, ka = now / 2;
		if (!(now % 2) && y + moy[0][ka] < 5 &&
		y + moy[0][ka] > -1 && side[y + moy[1][ka]][x] == '1') {
			cout << str[now];
			serch(x, y + moy[0][ka], now - 1);
		}
		if (now % 2 && x + mox[0][ka] < 5 &&
		x + mox[0][now / 2] > -1 && Longitudinal[y][x + mox[1][ka]] == '1') {
			cout << str[now];
			serch(x + mox[0][ka], y, now - 1);
		}
	}

}

int main()

{
	for (int i = 0; i < 4; i++)
		cin >> Longitudinal[i] >> side[i];
	cin >> Longitudinal[4];
	cout << "R";
	serch(1, 0, 0);
}

Measured memory_bytes: 3064
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

alias Digit = Tuple!(long, "n", long, "keta");

bool incr(ref DList!Digit queue, long keta, long base) {
    if (queue.empty || queue.back.keta != keta) {
        queue.insertBack(Digit(1L, keta));
        return true;
    } else if (queue.back.n + 1 < base) {
        queue.back.n += 1;
        return true;
    }

    long prev_keta = keta + 1;
    while (!queue.empty && queue.back.keta + 1 == prev_keta && queue.back.n + 1 == base) {
        if (queue.back.keta == 1) {
            return false;
        } else {
            prev_keta--;
            queue.removeBack;
        }
    }

    if (queue.empty || queue.back.keta + 1 != prev_keta) {
        queue.insertBack(Digit(1L, prev_keta - 1));
    } else {
        queue.back.n += 1;
    }

    return true;
}

bool check(int N, const long[] A, long base) {
    DList!Digit queue;

    foreach (i; 1..N) {
        if (A[i] > A[i-1]) {
            continue;
        }
        while (!queue.empty && queue.back.keta > A[i]) {
            queue.removeBack;
        }
        if (!incr(queue, A[i], base)) {
            return false;
        }
    }

    return true;
}

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;

    if ((N-1).iota.map!(i => A[i+1] - A[i] > 0).all) {
        writeln(1);
        return;
    }

    long hi = 10^^9 + 1;
    long lo = 1;
    while (hi - lo > 1) {
        long mid = (hi + lo) / 2;
        if (check(N, A, mid))
            hi = mid;
        else
            lo = mid;
    }

    hi.writeln;
}


Measured memory_bytes: 12016
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

const int MAX = 510000;

vector<ll> fac(MAX), finv(MAX), inv(MAX);

// テーブルを作る前処理
void COMinit()
{
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++)
	{
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COM(int n, int k) 
{
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main()
{	
	//回答方針
	//N個の数字からK個の数字を選ぶ方法はNCK通りあるが、これはO(N^K)となるため、
	//1つずつ計算することは不可能。
	//
	//逆に考えて、Aのある数字（aとする）が計算結果に寄与する場合は、
	//aがAのある部分集合の最小値、あるいは最大値をとる場合だけなので、
	//そういった集合が各aに対して何通りあるか考えればよい。
	//
	//aがある部分集合の最大値になる⇔a以下のk-1個の元をAからとることができる。
	//aがある部分集合の最小値になる⇔a以上のk-1個の元をAからとることができる。
	//
	//であるため、上の各場合の数を高速に計算できればよい。
	//同じ数字があることも考慮に入れれば、Aをソートしてインデックスを使用すれば
	//簡単に実現できる。

	int N, K;
	cin >> N >> K;

	vector<ll> A(N);
	rep(i, N)
	{
		cin >> A[i];
	}

	COMinit();

	sort(all(A));

	ll sum = 0;

	rep(i, A.size())
	{
		//aがある部分集合の最大値になる⇔a以下のk-1個の元をAからとることができる。
		ll max_sum = (A[i] * COM(i, K - 1)) % MOD;

		//aがある部分集合の最小値になる⇔a以上のk-1個の元をAからとることができる。
		ll min_sum = (A[i] * COM(N - i - 1, K - 1)) % MOD;

		sum += max_sum - min_sum;
		sum %= MOD;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 13056
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

#define amen ;
#define vec vector
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef double d;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;
typedef unsigned int ui;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    int x, sum = 0;
    cin >> x;
    sum += x;
    for (int i = 1; i < n; i++)
    {
        int y;
        cin >> y;
        sum += y;
        x = max(y, x);
    }
    if (x * 2 < sum)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

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

long long p = 1000000007;
long long mod_fact[200000];

void mod_fact_init(){
    mod_fact[0]=mod_fact[1]=1;
    for(int i=2;i<200000;i++){
        mod_fact[i]=(mod_fact[i-1]*i)%p;
    }
}


long long mod_pow(long long a, long long b){
    a%=p;
    if(b==0){
        return 1;
    }else if(b%2==0){
        return mod_pow(a*a, b/2)%p;
    }else{
        return (a*mod_pow(a, b-1))%p;
    }
}

long long mod_comb(long long a, long long b){
    long long c = (mod_fact[a]*mod_pow(mod_fact[a-b], p-2))%p;
    return (c*mod_pow(mod_fact[b], p-2))%p;
}

int main(void){
    int n,b[100001]={0},l,r;
    cin>>n;
    mod_fact_init();
    for(int i=1;i<=n+1;i++){
        int a;
        cin>>a;
        if(b[a]==0)b[a]=i;
        else{
            l=b[a];
            r=i;
        }
    }
    for(int i=1;i<=n+1;i++){
        long long a=mod_comb(n+1, i);
        if(n-r+l>=i-1)a-=mod_comb(n-r+l,i-1);
        a=(a+p*1000)%p;
        cout<<a<<endl;
    }
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll x,k,d;
	cin>>x>>k>>d;
	x=abs(x);
	ll steps=x/d;
	if(k<=steps){
		ll ans=abs(x-k*d);
		cout<<ans;
	}
	else{
		if((k-steps)%2==0){
			ll ans=abs(x-steps*d);
			cout<<ans;
		}
		else{
			steps++;
			ll ans=abs(x-steps*d);
			cout<<ans;
		}
	}
	return 0;

	
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;

    vector<int> d(N);
    for (int i = 0; i < N; i++){
        cin >> d.at(i);
    }

    sort(d.rbegin(), d.rend());
    d.erase(unique(d.begin(), d.end()), d.end());
    cout << d.size() << endl;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m;
	cin>>n>>m;
	vi in(n);
	rep(i,n)cin>>in[i];
	sort(all(in));
	int l=-inf-10,r=inf+10;
//	int l=-8,r=-6;
	while(r-l>1){
		int h=(l+r)/2;
		int c=0;
		rep(i,n){
			int co;
			if(in[i]==0){
				if(h>=0)co=n-1;
				else co=0;
			}else if(in[i]>0){
				int w;
				if(h%in[i]==0)w=h/in[i];
				else if(h>=0)w=h/in[i];
				else w=h/in[i]-1;
				co=upper_bound(all(in),w)-in.begin();
				//cout<<" "<<w<<" "<<co<<endl;
				if(in[i]<=w)co--;
				
			}else if(in[i]<0){
				int w;
				if(h%in[i]==0)w=h/in[i];
				else if(h>=0)w=h/in[i];
				else w=h/in[i]+1;
				co=in.end()-lower_bound(all(in),w);
				//cout<<w<<" "<<co<<endl;
				if(w<=in[i])co--;
			}
	//		cout<<co<<endl;
			c+=co;
			
		}
		c/=2;
//		cout<<c<<" "<<l<<" "<<h<<" "<<r<<endl;
		if(c<m)l=h;
		else r=h;
	}
	cout<<r<<endl;
	
}









Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main() 
{
  int n, k, cnt=0,d, x, a[1000]={}, i;
  cin >> n >> k;
  while(k--) 
  {
  	cin >> d;
  	while(d--) 
  	{
  		cin >> x;
  		a[x]+=1;
  	} 
  } 
  for(i=1;i<=n;i++) 
  if(a[i]==0)
  cnt+=1;
  
  cout << cnt << endl;
   return 0;
} 

Measured memory_bytes: 3640
#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)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const int MAX = 20;


int n, a[MAX];

bool solve(int m) {
  int d, sum, j;
  rep(i, (1 << n)) {
    d = i;
    sum = 0;
    j = 0;
    while (d != 0) {
      if (d % 2 == 1) {
        sum += a[j];
      }
      d >>= 1;
      j++;
    }
    if (sum == m) return true;
  }
  return false;
}

int main() {
  int q, m;
  cin >> n;
  rep(i, n) cin >> a[i];
  cin >> q;
  rep(i, q) {
    cin >> m;
    if (solve(m)) cout << "yes" << endl;
    else cout << "no" << endl;
  }

  
  return 0;
}


Measured memory_bytes: 3032
#include<stdio.h>

int main(){
	double a;
	double b;
	double c;
	int d = 0;
	double e;
	while(scanf("%lf", &c) != EOF){
		if(d == 0){
			a = c;
			b = c;
			d++;
		}else{
			if(a < c){
				a = c;
			}else if(c < b){
				b = c;
			}
		}
	}
	e = a - b;

	
	printf("%.1f\n", e);
	return 0;
}

Measured memory_bytes: 652
N = int(input())
A = [int(i) for i in input().split()]
MOD = 10 ** 9 + 7
S = 0
sq = 0

for a in A:
    S = (a + S) % (2*MOD)
    sq = (a ** 2 + sq) % (2*MOD)

ans = (S ** 2 - sq) % (2*MOD)

print(ans//2%MOD)



Measured memory_bytes: 94252
n,x,m = map(int,input().split())

place = [0] * m
place[x] = 1
cur = [x]
ends = 0

for i in range(m):
    x = (x**2) % m
    if place[x] == 0:
        place[x] = i+2
        cur.append(x)
    else:
        ends = i+2
        break
        
roopsum = sum(cur[place[x]-1:ends-1])
rooplen = ends - place[x]
curlen = cur[place[x]-1:]

mm = min(n,ends-1)
ans = 0

for i in range(mm):
    ans += cur[i]
    
if n-mm == 0:
    print(ans)
else:
    roopamo = (n-mm) // rooplen
    roopama = (n-mm) % rooplen
    
    ans += roopamo * roopsum
    for i in range(roopama):
        ans += curlen[i]
        
    print(ans)

Measured memory_bytes: 70980
# https://atcoder.jp/contests/code-festival-2017-qualc/tasks/code_festival_2017_qualc_b


n = int(input())
nums = [int(i) for i in input().split()]

odd = 0
even = 0
for num in nums:
    if num % 2 == 0:
        even += 1
    else:
        odd += 1

ans = 3 ** n - 2 ** even
print(ans)

Measured memory_bytes: 38432
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,t,j;
  int c,tt;
  pair<int,int> ct[105];
  cin>>n>>t;

  for(int i=0; i<n; i++){
    cin>>c>>tt;
    ct[i]=make_pair(c,tt);
  }

  sort(ct,ct+n);
  j=10000;
  for(int i=0; i<n; i++){
    if(ct[i].second<=t && j>ct[i].first)j=ct[i].first;
  }
  if(j==10000){
       cout<<"TLE"<<'\n';
  }else{
    cout<<j<<'\n';
  }
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }

void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> acc(n + 1);
  rep(i, n) acc[i + 1] = acc[i] + a[i];

  int ma = 0, id = -1;
  rep3(i, k, n + 1) {
    // cout << acc[i] - acc[i - k] << endl;
    if (chmax(ma, acc[i] - acc[i - k])) {
      id = i - k;
    }
  }
  // cout << id << endl;

  double ans = 0;
  rep3(i, id, id + k) {
    // cout << id << " " << a[id] << endl;
    ans += 1.0 / 2 * (a[i] + 1);
  }
  cout << fixed << setprecision(7) << ans << endl;
}


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

int saidai(int a, int b){
  if( a > b)return a;
  return b;
}

int main(int argc, char const *argv[]) {
  char s[200001];
  int i,flag=0;
  int start=0,end=0;
  int max;
  scanf("%s", s);

  for(i=0;i<strlen(s);i++){
    if(s[i]=='A' && flag != 1){
      start = i;
      flag = 1;
    }else if(s[i] == 'Z' && flag == 1){
      end = i;
      max = saidai(max, end - start + 1);
    }
  }

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


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

vector<int> g[101];
bool used[101];
int ans[101];
void bfs(int sr){
    queue<pint> q;q.push({sr,0});
    used[sr]=true;
    while(!q.empty()){
        pint pi=q.front();q.pop();
        ans[pi.first]=pi.second;
        rep(i,g[pi.first].size()){
            int nx=g[pi.first][i];
            if(!used[nx]){
                used[nx]=true;
                q.push({nx,pi.second+1});
            }
        }
    }
}
int main(){
    int n,u,k,v;
    cin>>n;
    rep(i,n){
        cin>>u>>k;
        --u;
        rep(j,k){
            cin>>v;
            --v;
            g[u].pb(v);
        }
    }
    memset(ans,-1,sizeof(ans));
    bfs(0);
    rep(i,n) cout<<i+1<<" "<<ans[i]<<endl;
    return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
 
int n, k;
 
int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> k;
	vector<pair<ll, ll> > v(n);
	FOR(i, n) cin >> v[i].first >> v[i].second;
	sort(ALL(v));
	ll ans = 5e18;
	FOR(i, n) FOR(j, i-k+2) {
		ll xlen = v[i].first-v[j].first;
		vector<ll> y;
		for (int p = j; p <= i; p++) y.push_back(v[p].second);
		sort(ALL(y));
		ll ylen = 5e18;
		FOR(p, y.size()-k+1) {
			ylen = min(ylen, y[p+k-1]-y[p]);
		}
		ans = min(ans, xlen*ylen);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
#define NIL -1
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<vector<int>>;

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

const double PI=(acos(-1));

int main(){
    int d;
    cin>>d;
    switch(d){
        case 25:
            cout<<"Christmas"<<endl;
            return 0;
        case 24:
            cout<<"Christmas Eve"<<endl;
            return 0;
        case 23:
            cout<<"Christmas Eve Eve"<<endl;
            return 0;
        case 22:
            cout<<"Christmas Eve Eve Eve"<<endl;
            return 0;
    }

}

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

int main(){
  int N;
  cin>>N;
  int f,t;
  int a;
  f=t=0;
  for(int i=0;i<N;i++){
    cin>>a;
    if(a%4==0)f++;
    else if(a%2==0)t++;
  }
  if(t==1)t--;
  if(2*f+1>=N||2*f+t>=N)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n,k = map(int, input().split())
h = list(map(int, input().split()))

ans = 0
h.sort(reverse=True)
for i in h:
    if 0 < k: k -= 1
    else:
        ans += i

print(ans)


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

class Timer {
public:
    void start() {
        start_ = std::chrono::steady_clock::now();
    }
    int64_t elapsedMilliSec() {
        auto n = std::chrono::steady_clock::now();
        auto e = std::chrono::duration_cast<std::chrono::milliseconds>(n - start_);
        return e.count();
    }
private:
    std::chrono::steady_clock::time_point start_;
};

constexpr int64_t NUM = 26;
vector<int64_t> c(NUM);
vector<vector<int64_t>> s;

int64_t score(const vector<int64_t>& v) {
    vector<int64_t> last(NUM, -1);
    int64_t S = 0;
    for (int64_t i = 0; i < v.size(); i++) {
        //開催による満足度増加
        S += s[i][v[i]];

        //最終開催日更新
        last[v[i]] = i;

        //開催されないことによる満足度減少
        for (int64_t j = 0; j < NUM; j++) {
            S -= c[j] * (i - last[j]);
        }
    }

    return S;
}

int main() {
    Timer timer;
    timer.start();

    int64_t D;
    cin >> D;
    for (int64_t& C : c) {
        cin >> C;
    }

    s.resize(D, vector<int64_t>(NUM));
    for (int64_t i = 0; i < D; i++) {
        for (int64_t j = 0; j < NUM; j++) {
            cin >> s[i][j];
        }
    }

    vector<int64_t> t(D);
    for (int64_t i = 0; i < D; i++) {
        cin >> t[i];
        t[i]--;
    }

    int64_t M;
    cin >> M;
    for (int64_t i = 0; i < M; i++) {
        int64_t d, q;
        cin >> d >> q;
        d--; q--;

        t[d] = q;

        cout << score(t) << endl;
    }
}

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

int main() {
	int N;
	cin >> N;
  vector<int> x(N);
  vector<int> y(N);
  vector<int> h(N);
  int without0 = 0;
  rep(i,N){
    cin >> x[i] >> y[i] >> h[i];
    if(h[i] != 0) without0++;
  }
  if(without0 == 1){
    rep(i,N){
      if(h[i] != 0){
        printf("%d %d %d\n",x[i],y[i],h[i]);
        return 0;
      }
    }
  }

  rep(cx,101)rep(cy,101){
    int before = -1;
    int cnt = 0;
    rep(i,N){

      if(h[i] == 0){
        cnt++;
        continue;
      }

      int H = h[i] + abs(x[i]-cx) + abs(y[i]-cy);
      if(before == -1){
        before = H;
        cnt++;
        continue;
      } else if(H == before){
        cnt++;
      } else {
        cnt = 0;
        break;
      }
    }
    if(cnt == N){
      printf("%d %d %d\n",cx,cy,before);
    }
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;

int main(){
    double r,ans1,ans2;
        
    cin >> r;
        
    ans1 = r*r*M_PI;
    ans2 = 2*r*M_PI;
    
    cout << fixed << setprecision(6) << ans1 << " " << ans2 << endl;
    
    return 0;
}

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

max_num = 1
second_max_num = 1
A = [0]*N
for i in range(N):
    j = int(input())
    A[i] = j
    if j > max_num:
        second_max_num = max_num
        max_num = j
    elif j > second_max_num:
        second_max_num = j

for a in A:
    if a == max_num:
        print(second_max_num)
    else:
        print(max_num)

Measured memory_bytes: 12508
#include <cstdio>
#include <algorithm>
using namespace std;
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) REP(i, 0, n)
#define M 1000001
bool p[M];
int dish[31];
int dp[M];
int n, x;
int main()
{
	rep(i, M) p[i] = true;
	p[0] = p[1] = false;
	for (int i = 2; i * i < M; ++i)
		for (int j = 2 * i; j < M; j += i)
			if (p[j]) p[j] = false;

	while (true) {
		scanf("%d%d", &n, &x);
		if ((n | x) == 0) break;
		rep(i, n) scanf("%d", dish + i);
		
		rep(j, x+1) dp[j] = -1;
		dp[0] = (1<<20);

		int k = 1;
		rep(i, n) REP(j, 1, x+1) {
			if (dp[j] >= 0)
				dp[j] = (1<<20);
			else if (j < dish[i] || dp[j-dish[i]] <= 0)
				dp[j] = -1;
			else
				dp[j] = dp[j-dish[i]] - 1;
		}
		int res = 0;
		rep(j, x+1) if (p[j] && dp[j] >= 0) res = j;
		if (res > 0)
			printf("%d\n", res);
		else
			puts("NA");
	}
	return 0;
}

Measured memory_bytes: 5640
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define EQ(a,b) (abs((a)-(b))<EPS)
using namespace std;
typedef long double D;
typedef complex<D> P;
const D EPS = 1e-8;
const D PI = acos(-1);

int n,r,q;
P p[30];
int cur;

inline D dot(P x, P y){return real(conj(x)*y);}

inline P rotate(P v, D s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

inline D arg(P a,P b,P c){return acos(dot(b-a,c-a)/(abs(b-a)*abs(c-a)));}

inline D rot_seta(int end){
  D dis = abs(p[end]-p[cur]);
  D seta = acos( (2*r*r - dis*dis)/(2*r*r) );
  P nxt = rotate(p[cur],-seta);
  return arg(p[cur],p[end],nxt);
}

int main(){
  
  while(cin >> n >> r >> q, n){
    rep(i,n){
      D x,y;
      cin >> x >> y;
      p[i] = P(x,y);
      if(EQ(abs(p[i]),r))cur = i;
    }
    
    vector<int> nxt(n,-1);
    
    rep(i,q){
      int id = -1;
      D min_s = PI;
      if(nxt[cur]>=0)id = nxt[cur];
      else{
	rep(j,n){
	  if(cur==j)continue;
	  D s = rot_seta(j);
	  if(id<0 || s+EPS < min_s)id = j, min_s = s;
	}
	nxt[cur] = id;
      }

      D seta = rot_seta(id);
      rep(i,n){
	if(i==cur)continue;
	p[i] = rotate(p[i]-p[cur],seta) + p[cur];
      }
      cout << fixed << setprecision(10) << p[id].real() << " " << p[id].imag() << endl;
      cur = id;
    }
  }
}

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

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    ll H, W;
    cin >> H >> W;

    ll ans = 1e12;
    if ((H * W) % 3 == 0) ans = 0;
    ans = min (ans, min (H, W));
    for (int i = 1; i < H; i++)
    {
        vector <ll> v;
        v.push_back(i * W);
        v.push_back((H-i) * (W/2));
        v.push_back((H-i) * ((W+1)/2));
        sort(v.begin(), v.end());
        ans = min (ans, v[2] - v[0]);
    }
    for (int i = 1; i < W; i++)
    {
        vector <ll> v;
        v.push_back(i * H);
        v.push_back((W-i) * (H/2));
        v.push_back((W-i) * ((H+1)/2));
        sort(v.begin(), v.end());
        ans = min (ans, v[2] - v[0]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
A, B, K = map(int, input().split())
tmp = [0] * K
for i in range(K):
    aTmp = A + i
    if B >= aTmp:
        print(aTmp)
        tmp[i] = aTmp

for i in range(K):
    bTmp = B - K + 1 + i
    if tmp.count(bTmp) == 0 and A <= bTmp:
        print(bTmp)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <cstring>

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i < (n); ++i)

int a;

int main() {
    cin >> a;
    cout << a + (a*a) + (a*a*a) << endl;

    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
vector<int> vec;
bool dp[1000003];
int vis[1000003];
int vis2[1000003];
int n, c;
int main()
{
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++){
        int t;
        cin >>t;
        vis[t] ++;
        vec.pb(t);
    }
    sort(vec.begin(),vec.end());
    for(int i = 0; i < vec.size(); i++){
        int t = vec[i];
        if(vis2[t])continue;
        if(vis[t] > 1){
            dp[t] = 1;
            vis2[t] = 1;
        }
        for(int j = t+t; j <= 1e6; j+= t)dp[j] = 1;
    }
    for(int i = 0; i < vec.size(); i++){
        int t = vec[i];
        if(!dp[t])c++;
    }
    cout << c << endl;
    return 0;
}



Measured memory_bytes: 12932
#include <iostream>
#include <cstring>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(typeof(a) i=a;i!=(b);++i)
using namespace std;

int main(){
    int H, W;
    cin >> H >> W;
    REP(i,H){
        REP(j,W){
            string S;
            cin >> S;
            if(S == "snuke"){
                cout << (char)('A'+j) << (i+1) << endl;
            }
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h> //ABC 132_a
using namespace std;
char str[5];
int main() {
    for(int i=1;i<=4;i++){
    	cin>>str[i];
    	
	}
	if((str[1]==str[2])&&(str[3]==str[4])&&(str[1]!=str[3])||(str[1]==str[3])&&(str[2]==str[4])&&(str[1]!=str[2])||(str[1]==str[4])&&(str[2]==str[3])&&(str[1]!=str[2])){
		cout<<"Yes";
	}
    else{
      	cout<<"No";
	}
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A, B] = [int(input_raw[0]), int(input_raw[1])]
    s = 0
    if A >= B:
        s += A
        A -= 1
    else:
        s += B
        B -= 1
    s += max(A, B)
    print s


if __name__ == '__main__':
    main()


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

const long long MOD = 1000000007;

// modint: mod 計算を int を扱うように扱える構造体
template <int MOD>
struct Fp
{
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD)
    {
        if (val < 0)
            val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator-() const noexcept
    {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator+(const Fp &r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator-(const Fp &r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator*(const Fp &r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator/(const Fp &r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp &operator+=(const Fp &r) noexcept
    {
        val += r.val;
        if (val >= MOD)
            val -= MOD;
        return *this;
    }
    constexpr Fp &operator-=(const Fp &r) noexcept
    {
        val -= r.val;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr Fp &operator*=(const Fp &r) noexcept
    {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp &operator/=(const Fp &r) noexcept
    {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b)
        {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0)
            val += MOD;
        return *this;
    }
    constexpr bool operator==(const Fp &r) const noexcept
    {
        return this->val == r.val;
    }
    constexpr bool operator!=(const Fp &r) const noexcept
    {
        return this->val != r.val;
    }
    friend constexpr ostream &operator<<(ostream &os, const Fp<MOD> &x) noexcept
    {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept
    {
        if (n == 0)
            return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1)
            t = t * a;
        return t;
    }
};
using mint = Fp<MOD>;

void solve(long long N, std::vector<mint> A)
{

    mint sum = 0;
    for (auto &&e : A)
    {
        sum += e;
    }

    mint ans = 0;
    for (ll i = 0; i < N; i++)
    {
        ans += A[i] * ((sum - A[i]));
    }

    cout << ans / 2 << endl;
}

signed main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<mint> A(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


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

void nb(int);
int cnt = 0;
int main()
{
	long long n,k;
	cin >> n >> k;
	long long a[2005];
	long long b[2005];
	long long c[2005];
	memset(b,0,sizeof(b));
	memset(a,0,sizeof(a));
	memset(c,0,sizeof(c));
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = 0; i < n; i++){
		int cnt1 = 0;
		int cnt2 = 0;
		for(int j = 0; j < n; j++){
			if(j != i) {
				if(i < j){
					if(a[i] > a[j]) {
						cnt1++;	
						cnt2++;	
					}
				}else{
					if(a[i] > a[j]){
						cnt2++;
					}
				}
			}
		}
//		cout << cnt1 << " " << cnt2 << endl;
		b[i] = cnt1;
		c[i] = cnt2;
	}
	long long ans = 0;
	for(int i = 0; i < n; i++){
		ans += (b[i] * k % 1000000007 +  (k * (k - 1) / 2 % 1000000007 * c[i] % 1000000007) % 1000000007) ;
		ans %= 1000000007;
//		cout << ans << " ";
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
N, K = list(map(int, input().split()))

res = 0

for k in range(K, N+2) :

  mini = int(k*(k-1)/2)
  maxi = int(k*(2*N-k+1)/2)

    
  res = (res + (maxi-mini+1)) % (10**9+7)

  
print(res)

Measured memory_bytes: 9128
#include <iostream>
#include <string>

using namespace std;

string s;

int main(void)
{
	cin >> s;
	
	if(s.size() == 2){
		if(s[0] == s[1]){
			cout << 1 << " " << 2 << endl;
			return 0;
		}
	}
	
	for(int i = 0; i < s.size()-2; i++){
		if(s[i] == s[i+1] || s[i+1] == s[i+2] || s[i+2] == s[i]){
			cout << i+1 << " " << i+3 << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << endl;
	return 0;
}

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

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; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main() {
    int n; cin >> n;
    
    vi cnt(1010, 0);
    for(int i = 2; i <= n; i++) {
        int now = i;
        for(int j = 2; j <= now; j++) {
            while(now > 0 && now % j == 0) {
                cnt[j]++;
                now /= j;
            }
        }
    }

    ll ans = 1;
    for(int i = 0; i <= n; i++) {
        ans *= cnt[i] + 1;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
	int n,q,x;
	list<int> L;
	list<int>::iterator it=L.begin();
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>q;
		switch(q){
			case 0:
				cin>>x;
				it=L.insert(it,x);
				break;
			case 1:
				cin>>x;
				advance(it,x);
				break;
			case 2:
				it=L.erase(it);
		}
	}
	for(it=L.begin();it!=L.end();it++){
		cout<<*it<<endl;
	}
	return 0;
}
		


Measured memory_bytes: 18620
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string S, T;
	int A, B;
	string U;

	cin >> S >> T >> A >> B >> U;

	if (U == S) {
		--A;
	}
	else {
		--B;
	}
	cout << A << " " << B << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
using vi = vector<int>;
using vll = vector<ll>;
const ll INF = 1LL<<60;

int main(){
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;

  int x = x2 - x1;
  int y = y2 - y1;

  int x3 = x2 - y;
  int y3 = y2 + x;
  int x4 = x1 - y;
  int y4 = y1 + x;

  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
  return 0;
}


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

long long gc(long long a, long long b) {
	if(b == 0) return a;
	else return gc(b,a%b);
}

int main() {
 	ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0); 
	long long n,ans=0;
	cin>>n;
	for(int i=1; i<=n; i++) {
		for(int j=1; j<=n; j++) {
			for(int k=1; k<=n; k++) {
				ans += gc(gc(i,j),k);
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3652
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>

using namespace std;

#define mp make_pair
#define pb push_back
#define x first
#define y second

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

int a[10010],b[10010];

int main()
{
	int n;scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++) scanf("%d",&b[i]);
	ll s=0,t=0;
	for (int i=1;i<=n;i++) {s+=b[i]-a[i];t+=max(a[i]-b[i],abs(a[i]-b[i])%2);}
	if (t>s) puts("No"); else puts("Yes");
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n); i >= 0; i--)
#define revrepr(i, a, b) for (int i = (a); i >= b; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

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

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

//from https://github.com/spaghetti-source/algorithm/blob/master/number_theory/modular_arithmetics.cc
struct ModInt {
    static ll mod;
    ll val;
    ModInt(ll v = 0) : val(v % mod) {}
    ModInt operator-() const { return ModInt(val ? mod - val : val); }
    ModInt &operator+=(ModInt a) {
        if ((val += a.val) >= mod) val -= mod;
        return *this;
    }
    ModInt &operator-=(ModInt a) {
        if ((val -= a.val) < 0) val += mod;
        return *this;
    }
    ModInt &operator*=(ModInt a) {
        val = (__uint128_t(val) * a.val) % mod;
        return *this;
    }
    ModInt &operator/=(ModInt a) {
        ll u = 1, v = a.val, s = 0, t = mod;
        while (v) {
            ll q = t / v;
            swap(s -= u * q, u);
            swap(t -= v * q, v);
        }
        a.val = (s < 0 ? s + mod : s);
        val /= t;
        return (*this) *= a;
    }
    ModInt inv() const { return ModInt(1) /= (*this); }
    bool operator<(ModInt x) const { return val < x.val; }
};
ll ModInt::mod = 1e9 + 7;

ostream &operator<<(ostream &os, ModInt a) {
    os << a.val;
    return os;
}
ModInt operator+(ModInt a, ModInt b) { return a += b; }
ModInt operator-(ModInt a, ModInt b) { return a -= b; }
ModInt operator*(ModInt a, ModInt b) { return a *= b; }
ModInt operator/(ModInt a, ModInt b) { return a /= b; }
ModInt pow(ModInt a, ll e) {
    ModInt x(1);
    for (; e > 0; e /= 2) {
        if (e % 2 == 1) x *= a;
        a *= a;
    }
    return x;
}

ModInt mod_comb(ll n, ll k) {
    ModInt a = 1;
    rep(i, k) {
        a *= n;
        n--;
    }
    ModInt b = 1;
    rep(i, k) {
        b *= k;
        k--;
    }
    return a / b;
}

ModInt comb(long long n, long long k) {
    if (n < k || n < 0 || k < 0) return ModInt(0);
    if (k == 0) return ModInt(1);

    return n * comb(n - 1, k - 1) / k;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    ModInt ans = pow(ModInt(2), n) - 1 - comb(n, a) - comb(n, b);
    cout << ans << endl;
}

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

int main(){

    char s[3], t[3];
    cin >> s;
    cin >> t;

    int res=0;
    for(int i=0;i<3;i++){
        if(s[i] == t[i]){
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, a[100000], mx, t;
int p[100001];
ll res[100000], c;

int main() {
	cin >> N;
	for (int i = 0; i != N; ++i) {
		cin >> a[i];
		p[i] = a[i];
	}
	sort(p, p + N);
	p[N] = intmax;
	c = N;
	for (int i = 0; i != N; ++i) {
		if (mx < a[i]) {
			for (; p[t] <= a[i]; ++t) {
				res[i] += p[t] - mx;
				--c;
			}
			res[i] += (a[i] - mx)*c;
			mx = a[i];
		}
	}
	for (int i = 0; i != N; ++i)
		cout << res[i] << endl;
	return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define ll          long long int
#define pii         pair<int,int>
#define uu          first
#define vv          second
#define fastIO      ios::sync_with_stdio(0);cin.tie(0);
using namespace std;

const int MAX = 1e6 + 6;
int main()
{
    fastIO;
    int n;
    cin>>n;
    vector< vector<int> >vec(n+1, vector<int>(4)), dp(n+1, vector<int>(4));
    
    for(int i = 1 ; i <=n ; i++ ) {
        cin>>vec[i][1]>>vec[i][2]>>vec[i][3];
    }
    
    for(int i =1 ; i <=n ; i++ ) {
        
        for(int k = 1 ; k <=3 ; k++ ) {
            
            for(int kk = 1 ; kk <=3 ; kk++ ) {
                
                if(kk == k ) continue;
                
                dp[i][k] = max(dp[i][k], dp[i-1][kk] + vec[i][k]);
            }
        }
    }
    
    cout<<max(dp[n][1], max(dp[n][2], dp[n][3]))<<'\n';
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (ull i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
   
int main(void){
	ull N, a, sum=0;
	cin >> N;
	ull v[200010]={};
	ull w[200010]={};
	FOR(i,1,N+1){
		cin>>a;
		v[a]++;
		w[i]=a;
	}
	FOR(i,1,N+1) sum+=v[i]*(v[i]-1)/2;
	//cout<<sum<<endl;
	FOR(i,1,N+1) cout<<sum-(v[w[i]]-1)<<endl;
	
    return 0;
}




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


#define BUF_SIZE 100010
int main(void) {
  char line[BUF_SIZE];
  FILE *fp = stdin;
  if(!fgets(line, BUF_SIZE, fp)) return 0;
  int num;
  sscanf(line, "%d", &num);


  if(!fgets(line, BUF_SIZE, fp)) return 0;
  char prev = 'A';
  int i;
  int cnt = 0;
  for(i = 0; i < num; i++) {
    if(line[i] == prev) continue;
    prev = line[i];
    cnt++;
  }

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

Measured memory_bytes: 256
input()
a = list(map(int, input().split()))
flag = True
counter = 0

while(flag):
  for i in range(len(a)):
    if a[i] % 2 == 0:
      a[i] = a[i] // 2
    else:
      flag = False
      False
  if flag:
    counter += 1
    
print(counter)

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

string s;
int cnt;
int main() {
    cin >> s;
    for (int i = 0; i < s.length(); ++i)
        if (s[i] == 'o')
            ++cnt;
        
    cout << cnt * 100 + 700 << endl;    
    return 0;
}


Measured memory_bytes: 3656
# -*- coding: utf-8 -*-
import collections

N = int(input())

all_str = []
for i in range(N):
    str_temp = input()
    all_str.append(str_temp)
all_str.sort()
coll_str = (collections.Counter(all_str))
count_max = 0
j = 0
max_str = coll_str.most_common()
for i in max_str:
    
    num_of_str =  i[1]
    if num_of_str == count_max or j == 0:
        print(i[0])
        j = 1
        count_max = num_of_str
        
    if num_of_str < count_max:
        break


Measured memory_bytes: 49628
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define st(vvv) sort(vvv.begin(),vvv.end())
#define rvs(vvv) reverse(vvv.begin(),vvv.end())
int inf = 1000000007;

using namespace std;

int main() {
	string s;
	cin >> s;
	int ans = s.size();
	ff(i, 1, s.size()) {
		vector<char> a(s.size()-i);
		int t = 0;
		ff(j, 0, s.size() - i) {
			a[j] = s[j];
		}
		if (a.size() % 2 == 1) continue;
		ff(j, 0, a.size() / 2) {
			if (a[j] != a[j + (a.size() / 2)]) {
				t++;
				break;
			}
		}
		if (t > 0)continue;
		else {
			ans = i;
			break;
		}
	}
	cout << s.size() - ans << endl;
	return 0;
}

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

ll f(ll n){
    if(n<2) return 1;
    else return n*f(n-2);
}

int main(void){
    ll N,M;
    cin >> N;
    M = N;

    if(N%2==1){cout << 0 << endl; return 0;}

    ll count = 0;
    N /= 2;
    while(N>0){
        N /= 5;
        count += N;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
# import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""

import math
from collections import deque, defaultdict
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))
# WideIntPoint


def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  # SingleInt


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  # HeightString


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  # MatrixInt


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  # NumberGrid


def grid(n): return [s_list() for _ in range(n)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def round_up(a, b):
    """ a/b の切り上げ """
    c = (a + b - 1) / b
    return c


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)


def floor(a, b):
    """floor(a/b) 整数値を返す"""
    c = (a - a % b)/b
    return int(c)


def main():
    A, B, H, M = wi()
    r = abs(0.5*(H*60+M) - 6*M)
    t = 360 - r
    y = min(r, t)
    # print(y)
    x = math.radians(y)
    # print(math.cos(x))
    c = A**2 + B**2 - 2 * A * B * math.cos(x)
    print(math.sqrt(c))


if __name__ == '__main__':
    main()


Measured memory_bytes: 68012
#include <stdio.h>
int binarySearch(int key);
int A[10000000], n;

int main() {
	int i, m, key, result = 0;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	
	scanf("%d", &m);
	for(i = 0; i < m; i ++) {
		scanf("%d", &key);
		if (binarySearch(key)) result ++;
	}
	printf("%d\n", result);
	
	return 0;
}

int binarySearch(int key) {
	int left = 0, right = n;
	int mid;
	while(left < right) {
		mid = (left + right) / 2;
		if (A[mid] == key) return 1;
		else if (key < A[mid]) right = mid;
		else left = mid +1;
	}
	return 0;
}


Measured memory_bytes: 2120
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define RREP(i, a, n) for(int i=n-1; i>=a; i++)
typedef long long ll;
const int INF = 1e9;

int n, m;
int a[1001], b[1001], c[1001], dist[101][101];
int main()
{
	cin >> n >> m;
	REP(i, 0, m) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--;
		b[i]--;
	}
	REP(i, 0, n) {
		REP(j, 0, n) {
			if (i == j) dist[i][j] = 0;
			else dist[i][j] = INF;
		}
	}
	REP(i, 0, m) {
		dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
		dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
	}

	// WF
	REP(k, 0, n) {
		REP(i, 0, n) {
			REP(j, 0, n) {
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}

	int ans = m;
	REP(i, 0, m) {
		bool flag = false;
		REP(j, 0, n) {
			if (dist[a[i]][j] + c[i] == dist[b[i]][j]) flag = true;
		}
		if (flag) ans--;
	}

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

Measured memory_bytes: 256