akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e6+7;
const int maxm = 2e6+7;
const ll mod = 998244353 ;
int n,m,ar[maxn];

int l[maxn],r[maxn];

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d", ar+i);
    for(int i=1;i<=n;i++){
        l[i] = l[i-1]+ar[i];
    }
    for(int i=n;i>0;i--){
        r[i] = r[i+1]+ar[i];
    }
    int ans = 1000000;
    for(int i=1;i<n;i++){
        ans = min(ans, abs(l[i] - r[i+1]));
    }
    printf("%d\n", ans);





    return 0;
}


Measured memory_bytes: 4352
def main():
    N = int(input())
    
    data = []
    for i in range(N):
        s, p = input().split()
        data.append({"num": i+1, "s":s, "p":int(p)})
    data.sort(key=lambda x: x["p"])
    data.reverse()
    data.sort(key=lambda x: x["s"])

    for tmp in data:
        print(tmp["num"])

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
s=list(input())
a=int(s[0])*10+int(s[1])
b=int(s[2])*10+int(s[3])
if (1<=a and a<=12) and (1<=b and b<=12):
    print('AMBIGUOUS')
elif 1<=a and a<=12:
    print('MMYY')
elif 1<=b and b<=12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 38384
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <set>
using namespace std;
#define REP(i,a,n) for(int i = a; i < n; ++i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
typedef long long LL;

int N, A, B;
string S;
int main() {
	cin >> N >> A >> B >> S;
	int lim = 0, b_lim = 0;
	REP(i, 0, S.size()) {
		bool flg = false;
		switch (S[i]) {
		case 'a':
			if (lim < A + B) {
				flg = true;
				++lim;
			}
			break;
		case 'b':
			if (lim < A + B && b_lim < B) {
				flg = true;
				++lim;
				++b_lim;
			}
			break;
		case 'c':
			break;
		}
		cout << (flg ? "Yes" : "No") << endl;
	}
	return 0;
}

Measured memory_bytes: 896
#include<stdio.h>
#include<stdlib.h>
typedef unsigned long long ll;
#define max 1000000000000000000
int main(void)
{
  ll a;
  double b;
  scanf("%lld%lf",&a,&b);
  ll ans,tmp;
  //tmp=(ll)(100.0*b);
  ans=(ll)(((double)a)*b);
  printf("%lld",ans);
  return 0;
 
}

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

int main(){
    int n,k;
    cin >> n >> k;
    set<int> s;
    rep(i,k){
        int d;
        cin >> d;
        rep(j,d){
            int a;
            cin >> a;
            s.insert(a);
        }
    }
    cout << n-s.size() << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s;
    cin>>s;
    if((s[0]=='A' || s[1]=='A' || s[2]=='A') && (s[0]=='B' ||s[1]=='B' ||s[2]=='B'))
    cout<<"Yes";
    else
    cout<<"No";
}

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

int main(){
    while(1){
        int n, p; cin>>n>>p;
        if(n == 0) return 0;

        vector<int> cnt(n, 0);
        int sum = p;
        int step = 0;
        while(1){
            if(0 < p){
                cnt[step%n]++;
                p--;
            }
            else if(0 < cnt[step % n]){
                p += cnt[step%n];
                cnt[step%n] = 0;
            }

            if(cnt[step%n] == sum){
                cout << step % n << endl;
                break;
            }

            step++;
        }
    }
}


Measured memory_bytes: 2984
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LaL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
using namespace std;

int main(){
  ll N,ans=0;
  cin>>N;
  ll A[N];
  for(ll i=0; i<N; ++i) cin>>A[i];
  
  map<ll,ll> P,Q;
  for(ll i=0; i<N; ++i) P[1+i+A[i]]++;
  for(ll i=0; i<N; ++i) Q[1+i-A[i]]++;
  
  
  for(auto iter=P.begin(); iter!=P.end(); iter++){
      if(Q.find(iter->first)!=Q.end()){
        auto it=Q.find(iter->first);
        ans+=iter->second*it->second;
      }
  }
  
  cout<<ans<<endl;
}

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

int main(void) {
	// your code goes here
	
	int a,b;
	
	cin >> a >> b;
	
	if(a%3==0 || b%3==0 || (a+b)%3==0) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  int n, t, x, y;
  cin >> n;
  int nt = 0, nx = 0, ny = 0;
  for(int i = 0; i < n; ++i)
  {
    cin >> t >> x >> y;

    int dt = t - nt;
    int dd = abs(x - nx) + abs(y - ny);
    if (dt < dd || ((dt - dd) & 1))
    {
      cout << "No";
      return;
    }
    nt = t;
    nx = x;
    ny = y;
  }
  cout << "Yes";
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

using namespace std;

using ll = long long;

int main(){
   string s;
   cin >> s;
   ll ans = INT_MAX;
   for(ll i = 0; i < s.length() - 2; ++i){
        ans = min(ans, abs(753LL - stoi(s.substr(i, 3))));
   }
   cout << ans;
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <tuple>

using namespace std;

using lint = long long;
using ldouble = long double;

tuple<string, int, string> parse(string S) {
    string L;
    int itr, depth = 1;
    for (itr = 1; depth > 0; ++itr) {
        L.push_back(S[itr]);
        if (S[itr] == '(') {
            ++depth;
        } else if (S[itr] == ')') {
            --depth;
        }
    }
    L.pop_back();

    string V;
    for (++itr; S[itr] != ']'; ++itr) {
        V.push_back(S[itr]);
    }

    string R;
    depth = 1;
    for (itr += 2; depth > 0; ++itr) {
        R.push_back(S[itr]);
        if (S[itr] == '(') {
            ++depth;
        } else if (S[itr] == ')') {
            --depth;
        }
    }
    R.pop_back();
    return make_tuple(L, stoi(V), R);
}

string compose(string L, int v, string R) {
    return "(" + L + ")[" + to_string(v) + "](" + R + ")";
}

string merge(string S, string T) {
    if (S.empty() || T.empty()) return "";

    string sl, sr, tl, tr;
    int sv, tv;
    tie(sl, sv, sr) = parse(S);
    tie(tl, tv, tr) = parse(T);

    return compose(merge(sl, tl), sv + tv, merge(sr, tr));
}

int main() {
    string S, T;
    cin >> S >> T;
    cout << merge(S, T) << endl;
    return 0;
}



Measured memory_bytes: 3456
N, X, Y = list(map(int, input().split()))
res = [0] * N
for i in range(1, N + 1):
    for j in range(1, N + 1):
        if i >= j:
            continue
        if i == X and Y == j:
            key = 1
        else:
            key = int(min(j - i, abs(X - i) + abs(Y - j) + 1))
        res[key] += 1

for i in range(1, N):
    print(res[i])


Measured memory_bytes: 3444
#include<iostream>
#include<string>
using namespace std;
int main(){
  int a,b,cost;
  cin >> a >> b;
  if(a >= 13){
    cost = b;
  }else if(a >= 6){
    cost = b/2;
  }else{
    cost = 0;
  }
  cout << cost;
  return 0;
}  

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

using namespace std;

const int NMAX = 100000;

bool c[NMAX+2];
int N, sp[NMAX+2];

void ciur()
{
    c[0] = c[1] = 1;
    for( int i = 2;  i <= NMAX;  ++i ) {
        if( c[i] ) continue;
        for( int j = i + i;  j <= NMAX;  j += i ) c[j] = 1;
    }
}

int main()
{
    cin.tie();
    cout.tie();
    ciur();
    for( int i = 1;  i <= NMAX;  ++i ) {
        sp[i] = sp[i - 1];
        if( i % 2 == 0 ) continue;
        if( !c[i] && !c[(i+1)/2] ) ++sp[i];
    }
    cin >> N;
    for( int i = 1;  i <= N;  ++i ) {
        int x,y;
        cin >> x >> y;
        cout << sp[y] - sp[x - 1] << '\n';
    }
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template <typename T>
using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template <class S, class T>
void map_init(map<S, T> &m, S k, T v) {
    if (!m.count(k)) m[k] = v;
}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }

i64 s[1000][1000] = {0};

int main() {
    int N, K;
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        i64 x, y;
        char c;
        bool b;
        cin >> x >> y >> c;
        x %= 2 * K, y %= 2 * K;
        b = (c == 'B') ^ (x >= K) ^ (y >= K);
        x %= K, y %= K;
        s[y][x] += b ? 1 : -1;
    }
    for (int i = 0; i < K; i++) {
        for (int j = 0; j < K; j++) {
            if (i > 0) s[i][j] += s[i - 1][j];
            if (j > 0) s[i][j] += s[i][j - 1];
            if (i > 0 && j > 0) s[i][j] -= s[i - 1][j - 1];
        }
    }
    i64 ans = -1e15;
    for (int i = 0; i < K; i++) {
        for (int j = 0; j < K; j++) {
            i64 tmp = s[K - 1][K - 1];
            if(i > 0) tmp += -2 * s[i - 1][K - 1];
            if(j > 0) tmp += -2 * s[K - 1][j - 1];
            if(i > 0 && j > 0) {
                tmp += 4 * s[i - 1][j - 1];
            }
            ans = max(ans, abs(tmp));
        }
    }
    ans = (ans + N) / 2;
    cout << ans << endl;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
// Welcome to my source code!

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int x = n/2;
    int cnt = 0;
    for (int i = 0; i < x; i++) {
        if (s[i] != s[(n-i)-1]) cnt++;
    }
    cout << cnt << endl;
}

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

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

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

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

int main() {
  int N,K;
  cin >> N >> K;
  
  VI h(N),a(N,INF);
  
  REP(i,N){
    cin >> h.at(i);
  }
  a.at(0) = 0;
  REP(i,N){
    FOR(j,1,K+1){
      if(i+j >= N){
        break;
      }
      chmin(a.at(i+j),a.at(i)+abs(h.at(i)-h.at(i+j)));
    }
    
  }
  
  
  
  cout << a.at(N-1) << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
typedef struct {
  int parent;
  int child;
  int brother;

} node;

node n[100000];
int main()
{
  int a,c,d,e,i,j,num,depth;
  scanf("%d", &num);
  for(i=0;i<num;i++){
    n[i].parent=-1;
    n[i].brother=-1;
 n[i].child=-1;
  }
  for(i=0;i<num;i++){

    scanf("%d%d",&a,&c);

    for(j=0;j<c;j++){
      scanf("%d",&d);
      if(j==0)n[a].child=d;
      else n[e].brother=d;
      e=d;
      n[d].parent=a;
    }

  }
  for(i=0;i<num;i++){
    printf("node %d: parent = %d, depth = ",i,n[i].parent);
    c=n[i].parent;    
    depth=0;    
while(c!=-1){
depth++;
      c=n[c].parent;


}
    printf("%d, ",depth);

    if(n[i].parent==-1)
      printf("root, [");
    else if(n[i].child==-1)printf("leaf, [");
    else printf("internal node, [");





    if(n[i].child!=-1){
printf("%d",n[i].child);
      c=n[i].child;
      while(1){ 
	if(n[c].brother!=-1){  
	  printf(", %d",n[c].brother);
	  c=n[c].brother;

	}
	else break;
      }}
      printf("]\n");

    }

    return 0;
  }

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

int main() {
	int n; cin >> n;
	vector<pair<int, int>>s(n), t(n);
	for (auto&& x : s)cin >> x.first >> x.second;
	for (auto&& x : t)cin >> x.first >> x.second;
	sort(s.begin(), s.end()); sort(t.begin(), t.end());

	int ans = 0;
	for (int i = 0; i < n; i++) {
		int cur = -1;
		for (int j = 0; j < n; j++) {
			if (s[j].first > t[i].first)break;
			if (t[i].second < s[j].second)continue;
			
			if (cur == -1) { cur = j; ans++; }
			else {
				if (s[cur].second < s[j].second)cur = j;
			}
		}
		if (cur != -1)s[cur].second = 100000;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int K[50] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int i,n;
  
  scanf("%d",&n);
  
  printf("%d\n",K[n-1]);
  
  return 0;
}

Measured memory_bytes: 128
import itertools

N,M,K=map(int, input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))

sumA = list(itertools.accumulate(A))
sumB = list(itertools.accumulate(B))
j=M-1
while K<sumB[j] and j>=0:
    j-=1
ans=j+1
for i in range(N):
    if sumA[i]>K:
        break
    while K<sumA[i]+sumB[j] and j>=0:
        j-=1
    ans=max(ans,i+j+2)
print(ans)

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

const ll mod = 998244353;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

vector<mint> fac(300001); //n!(mod M)
vector<mint> ifac(300001); //k!^{M-2} (mod M)

mint mpow(ll x, ll n){//x^n(mod M)
    mint ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x;
        x = x*x % mod;
        n = n >> 1;
    }
    return ans;
}

mint comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    mint tmp = ifac[a-b]* ifac[b];
    return tmp * fac[a];
}


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

    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<300000; i++){
        fac[i+1] = fac[i]*(i+1); // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, mod-2); // k!^{M-2} (mod M) ←累乗にmpowを採用
    }
    mint ans = 0;
    mint m2 = m;
    for(int i = 0; i <= k; i++){
        ans += m2 * (m2-1).pow(n-i-1) * comb(n-1, i);
    }
    cout << ans << endl;

}

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


#define	INF	400000000
#define	MIN(a, b)	a < b ? a : b


int *p;
int **DP, *S_DP;

int rec(int r, int c)
{
	int min = INF;
	int num = c - r;
	int i;

	for(i = 0; i < num; i++)
		min = MIN(min, DP[r][r+i] + DP[r+i+1][c] + p[r-1] * p[r+i] * p[c]);

	return min;
}


int main()
{
	int n;
	int gyou, retu;
	int i, j;


	scanf("%d", &n);

	p = (int *)malloc(sizeof(int) * (n + 1));
	S_DP = (int *)malloc(sizeof(int) * (n + 1) * (n + 1));
	DP = (int **)malloc(sizeof(int *) * (n + 1));
	for(i = 0; i < n + 1; i++)
		DP[i] = S_DP + (i * (n + 1));

	for(i = 0; i < n; i++){
		scanf("%d %d", &gyou, &retu);
		p[i + 1] = retu;
		if(i == 0)
			p[0] = gyou;
	}

	for(i = 1; i <= n; i++)
		DP[i][i] = 0;

	for(i = 1; i < n; i++)
		DP[i][i + 1] = p[i - 1] * p[i] * p[i + 1];

	for(j = 0; j <= n - 3; j++)
		for(i = 3 + j; i <= n; i++)
			DP[i - 2 - j][i] = rec(i - 2 - j, i);

	printf("%d\n", DP[1][n]);

	return 0;
}


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

int main() {
	int n;
	int legs;
	cin>>n>>legs;
	if(legs%2==0){
		if(n*4>=legs and n*2<=legs){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3132
n,m = map(int,input().split())
py = {}
for i in range(m):
    p,y = map(int,input().split())
    py[i] = [p,y]
ans = sorted(py.items(),key=lambda x:x[1])
#print(ans)
#print(ans[0][1])
count = 1
ans[0][1].append(count)
#print(ans)
for i in range(1,m):
    if ans[i][1][0] == ans[i-1][1][0]:
        count += 1
    else:
        count = 1
    ans[i][1].append(count)
#print(number)
ans = sorted(ans)
#print(ans)
for i in range(m):
    a = "{0:06d}".format(ans[i][1][0])
    b = "{0:06d}".format(ans[i][1][2])
    print(a,end="")
    print(b)

Measured memory_bytes: 44468
import sys
input = sys.stdin.readline

def main():
    while True:
        m, f, r = map(int, input().split())
        if m == -1 and f == -1 and r == -1:
            break
        if m == -1 or f == -1:
            print("F")
        else:
            score = m + f
            if score >= 80:
                print("A")
            elif score >= 65:
                print("B")
            elif score >= 50:
                print("C")
            elif score >= 30:
                if r >= 50:
                    print("C")
                else:
                    print("D")
            else:
                print("F")


if __name__ == "__main__":
    main()


Measured memory_bytes: 5604
#include <bits/stdc++.h>
    using namespace std;
     
    int main(){
    	int d;
      	cin >> d;
      
    	if(d==25)
    		cout << "Christmas\n";
    	else if(d==24)
      		cout << "Christmas Eve\n";
      	else if(d==23)
      		cout << "Christmas Eve Eve\n";
      	else
         	cout << "Christmas Eve Eve Eve\n";
      
    	return 0;
    }

Measured memory_bytes: 256
// Z.cpp
#include <iostream>
#include <cstdio>
#include <cstring>
#include <deque>
#include <algorithm>
#define ll long long
using namespace std;
const ll MAX_N = 2e5 + 200;
ll n, h[MAX_N], dp[MAX_N], C, q[MAX_N], head, tail;
ll pow2(ll base) { return base * base; }
double calc(ll a, ll b) { return 1.0 * (dp[a] - dp[b] + pow2(h[a]) - pow2(h[b])) / (h[a] - h[b]); }
int main()
{
    scanf("%lld%lld", &n, &C);
    for (ll i = 1; i <= n; i++)
        scanf("%lld", &h[i]);
    q[++tail] = 1;
    for (ll i = 2; i <= n; i++)
    {
        while (head < tail && calc(q[head], q[head + 1]) <= 2 * h[i])
            head++;
        dp[i] = pow2(h[i] - h[q[head]]) + dp[q[head]] + C;
        while (head < tail && calc(q[tail], q[tail - 1]) > calc(i, q[tail]))
            tail--;
        q[++tail] = i;
    }
    printf("%lld", dp[n]);
    return 0;
}

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

int main() {
  int n;
  string s;
  cin >>  n >> s;
  int ans = 0, x = 0;
  rep(i,n) {
    if (s[i] == 'I') x++;
    if (s[i] == 'D') x--;
    ans = max(ans, x);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3580
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


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

	string S;
	cin >> S;
	int cnt1 = 0, cnt2 = 0;
	for (int i = 0; i < 3; i++) { cnt1 += (S[i] == 'A'); cnt2 += (S[i] == 'B'); }
	if (cnt1 == 3 || cnt2 == 3)puts("No");
	else puts("Yes");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5+5;
const int mod = 1e9+7;
ll qpow(ll a,ll b){ll res=1;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int main()
{
    set<int>s;
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i = 1;i <= n;++i)s.insert(i);
    for(int i = 1,a;i <= k;++i){
        scanf("%d",&a);
        for(int j = 1,b;j <= a;++j){
            scanf("%d",&b);
            s.erase(b);
        }
    }
    cout<<s.size()<<endl;
    return 0;
}


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

int main(){
    int x, y, z ;
cin >> x >> y >> z;
if (x < y && x < z){
    if (y < z){
    cout << x << " " << y << " " << z <<endl;    
    } else {
    cout << x << " " << z << " " << y <<endl;
    }
} else if (y < x && y < z){
    if (x < z){
    cout << y << " " << x << " " << z <<endl;    
    } else {
    cout << y << " " << z << " " << x <<endl;
    }
} else {
    if (x < y){
    cout << z << " " << x << " " << y <<endl;    
    } else {
    cout << z << " " << y << " " << x <<endl;
    }
}
return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

typedef long long ll;

const ll MOD = 998244353;
const int N_MAX = 300;
const int A_MAX = 300;

vector<vector<ll>> dp(N_MAX+1, vector<ll>(N_MAX*A_MAX+1, 0)), dp2(N_MAX+1, vector<ll>(N_MAX*A_MAX+1, 0));

ll modpow(ll a, ll t) {
    ll ret = 1LL;
    while(t){
        if(t & 1LL){
            ret *= a;
            ret %= MOD;
        }
        a *= a;
        a %= MOD;
        t >>= 1;
    }
    return ret;
}

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i=0;i<n;++i){
        cin >> a[i];
    }
    ll s = accumulate(a.begin(), a.end(), 0LL);

    dp[0][0] = 1;
    dp2[0][0] = 1;
    for(int i=0;i<n;++i) {
        for(int r=0;r<=s;++r) {
            if(!dp[i][r]) continue;
            dp[i+1][r] += 2 * dp[i][r];
            dp[i+1][r] %= MOD;
            dp[i+1][r+a[i]] += dp[i][r];
            dp[i+1][r] %= MOD;
            dp2[i+1][r+a[i]] += dp2[i][r];
            dp2[i+1][r+a[i]] %= MOD;
            dp2[i+1][r] += dp2[i][r];
            dp2[i+1][r] %= MOD;
        }
    }

    ll ans = 0LL;
    for(int r=(s+1)/2;r<=s;++r) {
        ans += dp[n][r];
        ans %= MOD;
    }
    if(s % 2 == 0) ans += MOD - dp2[n][s/2];
    ans = (3 * ans) % MOD;
    ans = (modpow(3LL, n) + MOD - ans) % MOD;

    cout << ans << endl;
}


Measured memory_bytes: 424640
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N, K;
ll MOD = 1000000007;

mat mul(mat &A, mat &B) {
  mat C(A.size(), vec(B[0].size()));

  for (int i = 0; i < A.size(); ++i) {
    for (int k = 0; k < B.size(); ++k) {
      for (int j = 0; j < B[0].size(); ++j) {
        C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % MOD;
      }
    }
  }

  return C;
}

mat pow(mat A, ll n) {
  mat B(A.size(), vec(A.size()));

  for (int i = 0; i < A.size(); ++i) {
    B[i][i] = 1;
  }

  while (n > 0) {
    if (n & 1) B = mul(B, A);
    A = mul(A, A);
    n >>= 1;
  }

  return B;
}

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

  mat M(N);

  ll a;

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      cin >> a;
      M[i].push_back(a);
    }
  }

  mat C = pow(M, K);
  ll ans = 0;

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      ans = (ans + C[i][j]) % MOD;
      /*
      cout << C[i][j];

      if (j == N - 1) {
        cout << endl;
      } else {
        cout << " ";
      }
      */
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

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

int main()
{
  int n,k; cin >> n >> k;
  vector<int> data(n); REP(i,n) cin >> data[i];
  vector<ll> dp(100010);  REP(i,n) dp[i] = INF;
 
  dp[0] = 0;
  
  REP(i,n){
    FOR(j,1,k+1)
      chmin(dp[i+j],dp[i] + abs(data[i] - data[i+j]));   
  }
  cout << dp[n-1] << endl;
}

Measured memory_bytes: 4516
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

string S,T;

int main(){
    cin >> S >> T;
    if(T.size() > S.size()){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    // if(T.size() == S.size()){
    //     int flag = 1;
    //     for(int j=0;j<T.size();j++){
    //         if(S[j] == T[j] || S[j] == '?') continue;
    //         else{
    //             flag = 0;
    //             break;
    //         }
    //     }
    //     if(flag == 0){
    //         cout << "UNRESTORABLE" << endl;
    //         return 0;
    //     }
    //     cout << T << endl;
    //     return 0;
    // }
    int pos = -1;
    for(int i=S.size()-T.size();i >= 0; i--){
        int flag = 1;
        for(int j=0;j<T.size();j++){
            if(S[i+j] == T[j] || S[i+j] == '?') continue;
            else{
                flag = 0;
                break;
            }
        }
        if(flag == 1){
            pos = i;
            break;
        }
    }
    if(pos == -1){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    for(int i=0;i<S.size();i++){
        if(i == pos){
            cout << T ;
            i += T.size()-1;
            continue;
        }
        if(S[i] =='?'){
            cout << "a";
            continue;
        }
        cout << S[i];
    }
    return 0;
}


Measured memory_bytes: 256
S = input()
T = input()
 
if len(set(S)) != len(set(T)):
    print("No")
    exit()
 
D = {}
for s, t in zip(S, T):
    if s not in D:
        D[s] = t
    elif D[s] != t:
        print("No")
        exit()
 
print("Yes")

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}



signed main(){

    int N, A, B; cin >> N >> A >> B;
    vec P(N); readv(P);
    int cnt[3] = {0, 0, 0};
    REP(i, N){
        if(P[i] <= A) cnt[0]++;
        else if(P[i] <= B) cnt[1]++;
        else cnt[2]++;
    }
    cout << min(cnt[0], min(cnt[1], cnt[2]));
    
    return 0;
}

Measured memory_bytes: 256
n = int(input())
x = [int(i) for i in input().split()]
min_x, max_x = min(x), max(x)
min_cost = float('inf')
for i in range(min_x, max_x + 1):
    cost = 0
    for j in range(n):
        cost += (x[j] - i)**2
    if cost < min_cost:
        min_cost = cost
print(min_cost)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    double ans=0,x;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%lf",&x);
        ans=ans+1.0/x;
    }
    printf("%lf\n",1.0/ans);
    return 0;
}


Measured memory_bytes: 256
c = [[int(i) for i in input().split()] for j in range(3)]

a = [0 for i in range(3)]
b = [0 for i in range(3)]

a[0] = 0

b[0] = c[0][0]
b[1] = c[0][1]
b[2] = c[0][2]
a[1] = c[1][0] - b[0]
a[2] = c[2][0] - b[0]

if a[1] + b[0] == c[1][0] and a[2] + b[0] == c[2][0] and a[1] + b[1] == c[1][1] and a[2] + b[1] == c[2][1] and a[1] + b[2] == c[1][2] and a[2] + b[2] == c[2][2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//#ifndef ONLINE_JUDGE
//#include <custom/prettyprint.hpp>
//#endif
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef pair<db,db> pd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b) - 1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define rb(i,x) for (auto& i : x)
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define UNIQUE(x) (x).resize(unique(all(x)) - begin(x))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define pow10(n) stoll("1"+string(n,'0'))
#define dbg(x) cout << ">>> " << #x << ": " << x << '\n'

const int MOD = 1e9+7; //998244353
const int inf = 1e9+3;
const ll INF = ll(3e18)+3;
const ld PI = acos((ld)-1);
const int dx[8] = {1,0,-1,0,1,1,-1,-1}, dy[8] = {0,1,0,-1,-1,1,1,-1};
mt19937_64 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll n) { return uniform_int_distribution<ll>(0, n)(rng); }
template<class T> bool ckmin(T& a, const T& b) {
	return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
	return a < b ? a = b, 1 : 0; }
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void setIO(const string& s) {
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	freopen((s+".in").c_str(),"r",stdin);
//	freopen((s+".out").c_str(),"w",stdout);
#endif
}

int main() {

    setIO("input");
    int a,b,c; cin >> a >> b >> c;
    int k; cin >> k;
    while(k && b <= a) {
        b <<= 1;
        k--;
    }
    while(k && c <= b) {
        c <<= 1;
        k--;
    }
    cout << (a < b && b < c ? "Yes\n" : "No\n");

}

/*  ! CHECK THIS IF YOU GET IT WRONG !
	* int overflow, array bounds, NO VLAs
	* uninitialized local variables, rounding errors
	* intermediate result type, scientific
	* special cases (n = 0 or 1?)
	* reset your variables in scope
	* INF not large enough for ans, adding value to _MAX
	* using wrong variables, sorting extra 0s in global array
	* comment out input from file
	* operator precedence
*/

Measured memory_bytes: 3664
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define fi first
#define se second
#define pt(num) cout << num << "\n"
#define mCalc(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;



int main(void) {
    ll N;
    cin >> N;
    ll dp[MAX];
    ll i, j;
    
    for(i=1; i<=N; i++) dp[i]=INF;
    dp[0]=0;
    
    for(i=1; i<=N; i*=6) {
        for(j=0; i+j<=N; j++) {
            chmin(dp[i+j], dp[j]+1);
        }
    }
    
    for(i=1; i<=N; i*=9) {
        for(j=0; i+j<=N; j++) {
            chmin(dp[i+j], dp[j]+1);
        }
    }
    
    pt(dp[N]);
    
}













Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))
INF = 10 ** 18
if n % 2:
    dp = [[[-INF,-INF,-INF] for i in range(2)] for i in range(n+1)]
    dp[0][0][0] = 0
    # 初期化条件考える
    for i,v in enumerate(a):
        for j in range(2):
            if j:
                dp[i+1][0][0] = max(dp[i+1][0][0],dp[i][1][0])
                dp[i+1][0][1] = max(dp[i+1][0][1],dp[i][1][1])
                dp[i+1][0][2] = max(dp[i+1][0][2],dp[i][1][2])
            else:
                dp[i+1][1][0] = max(dp[i+1][1][0],dp[i][0][0] + v)
                dp[i+1][0][1] = max(dp[i+1][0][1],dp[i][0][0])
                dp[i+1][1][1] = max(dp[i+1][1][1],dp[i][0][1] + v)
                dp[i+1][0][2] = max(dp[i+1][0][2],dp[i][0][1])
                dp[i+1][1][2] = max(dp[i+1][1][2],dp[i][0][2] + v)
    print(max(max(dp[n][0]),max(dp[n][1])))
else:
    odd_sum,even_sum = 0,0
    cumsum = []
    for k,v in enumerate(a):
        if k % 2:
            odd_sum += v
            cumsum.append(odd_sum)
        else:
            even_sum += v
            cumsum.append(even_sum)
    ans = max(cumsum[n-2],cumsum[n-1])
    for i in range(2,n,2):
        ans = max(ans, cumsum[i-2]+cumsum[n-1]-cumsum[i-1])
    print(ans)

Measured memory_bytes: 150812
n, k = map(int, input().split())
s = input()
grp = 0
now = ""
for c in s:
  if c != now:
    grp += 1
    now = c
hap = 0
for i in range(n):
  if (i>0 and s[i]=='L' and s[i-1]=='L') or (i<n-1 and s[i]=='R' and s[i+1]=='R'):
    hap += 1
p_2 = (grp - 1) // 2
p_1 = (grp + 1) % 2
print(hap + 2 * min(k, p_2) + int(k > p_2) * p_1)

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

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

  int x;
  cin >> x;

  int answer = 0;
  for (int k = 1; k <= 360; k++) {
    if((k*x)%360 == 0) {
      answer = k;
      break;
    }
  }
  cout << answer << endl;
}

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

#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof (a))

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

const int N = 2005;
const int INF = (int)1e+9;

int n;
int dp[N][N];
int BIT[N * 2][2];
int posBlack[N], posWhite[N];

void update(int id, int k, int v) {
	for (; k <= 2*n; k += k & -k) {
		BIT[k][id] += v;
	}
}

int query(int id, int k) {
	int ret = 0;
	for (; k > 0; k -= k & -k) {
		ret += BIT[k][id];
	}
	return ret;
}

int query(int id, int x, int y) {
	return query(id, y) - query(id, x-1);
}

int DP(int white, int black) {
	if (white == n && black == n) {
		return 0;
	}
	int& ret = dp[white][black];
	if (ret != -1) return ret;
	ret = INF;
	int total = white + black;
	int pos;
	if (white < n) {
		pos = posWhite[white + 1] + query(0, posWhite[white + 1], 2*n) + query(1, posWhite[white + 1], 2*n);
		//printf("white -> %d %d %d\n", white, black, pos);
		update(0, posWhite[white + 1], 1);
		ret = min(ret, abs(pos - (total + 1)) + DP(white + 1, black));
		update(0, posWhite[white + 1], -1);
	}
	if (black < n) {
		pos = posBlack[black + 1] + query(0, posBlack[black + 1], 2*n) + query(1, posBlack[black + 1], 2*n);
		//printf("black -> %d %d %d\n", white, black, pos);
		update(1, posBlack[black + 1], 1);
		ret = min(ret, abs(pos - (total + 1)) + DP(white, black + 1));
		update(1, posBlack[black + 1], -1);
	}
	return ret;
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= 2 * n; ++i) {
		char color[3];
		int id;
		scanf("%s %d", color, &id);
		if (color[0] == 'W') {
			posWhite[id] = i;
		}
		else if (color[0] == 'B') {
			posBlack[id] = i;
		}
	}
	reset(dp, -1);
	printf("%d\n", DP(0, 0));
	return 0;
}

Measured memory_bytes: 16256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 100100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll l[3][3];
    for (ll i=0;i<3;i++){
        for (ll j=0;j<3;j++){
            cin >> l[i][j];
        }
    }
    ll flag=l[0][0]-l[0][1];
    for (ll i=0;i<3;i++){
        if (l[i][0]-l[i][1]!=flag){
            cout << "No" << endl;
            return 0;
        }
    }
    flag=l[0][1]-l[0][2];
    for (ll i=0;i<3;i++){
        if (l[i][1]-l[i][2]!=flag){
            cout << "No" << endl;
            return 0;
        }
    }
    flag=l[0][0]-l[1][0];
    for (ll i=0;i<3;i++){
        if (l[0][i]-l[1][i]!=flag){
            cout << "No" << endl;
            return 0;
        }
    }
    flag=l[2][0]-l[1][0];
    for (ll i=0;i<3;i++){
        if (l[2][i]-l[1][i]!=flag){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N, X, T;
  cin >> N >> X >> T;
  
  if (N % X == 0)
  {
    cout << T * N / X << endl;
  }
  else if (N % X != 0)
  {
    cout << T * (N / X + 1) << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;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 INF 2e9
#define ALL(v) v.begin(), v.end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;


const int MAX = 510000;
const int MOD = 1000000007;

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

// 二項係数計算
long long 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(){
    ios::sync_with_stdio(false); cin.tie(0);
    COMinit();
    int n,m;
    cin>>n>>m;
    int n_,m_;
    if(n==1){
        n_=0;
    }
    else{
        n_ = COM(n,2);
    }
    if(m==1){
        m_=0;
    }
    else{
        m_ = COM(m,2);
    }
    cout << n_+m_ << endl;

    }

Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N,A,B,C,D,cnt;
  cin>>N>>A>>B>>C>>D;
  
  for(int K=1;K<=N-1;K++){
    if(A+C*K-D*(N-1-K)<=B && B<=A+D*K-C*(N-1-K)){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 3540
#include<stdio.h>
 
int N[10000];
int n;
 
int search(int key) {
	int i=0;
	
	N[n] = key;
	while(N[i] != key) i++;
		if(i == n) return 0;
		else return 1;
	}
	
int main(void) {
	int i,p=0,q;
	int m[500];
		
	scanf("%d",&n);
	for(i=0;i < n; i++) {
		scanf("%d",&N[i]);
	}
		
	scanf("%d", &q);
	for(i=0;i < q; i++) {
		scanf("%d",&m[i]);
	}
		
	 for(i = 0; i < q; i++){
   		 if(search(m[i])) p++;
  	 }
 
  printf("%d\n", p);
 
  return 0;
}







Measured memory_bytes: 2104
from collections import defaultdict
N = int(input())
m = 0
dic = defaultdict(int)
for i in range(N):
  s = input()
  dic[s] += 1
  if dic[s]>m:
    m = dic[s]
ans = []
for k in dic.keys():
  if dic[k]==m:
    ans += [str(k)]
ans.sort()
for a in ans:
  print(a)

Measured memory_bytes: 32472
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep0(i,n) for (int i=0; i<=(int)(n); ++i)
#define rep1(i,n) for (int i=1; i<=(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vl>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

template<typename T>
struct is_vector : false_type{};

template<typename T>
struct is_vector<vector<T>> : true_type{};

template<typename T>
ostream &operator << (ostream &ostr, const vector<T> &vec) {
  if (vec.empty()) {
    return ostr;
  }
  ostr << vec.front();
  for (auto itr = ++vec.begin(); itr != vec.end(); ++itr) {
    if (is_vector<T>()) ostr << "\n" << *itr;
    else ostr << ' ' << *itr;
  }
  return ostr;
}

template<typename T>
bool CompareBySecond(pair<T, T> a, pair<T, T> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

void solve() {
  int N, M; cin >> N >> M;
  Graph G(N, vl(2));
  rep(i,N) rep(j,2) cin >> G[i][j];

  sort(ALL(G));
  ll ans = 0;

  rep(i,N) {
    if (M > G[i][1]) {
      ans += G[i][0] * G[i][1];
      M -= G[i][1];
    } else {
      ans += G[i][0] * M;
      break;
    }
  }

  cout << ans << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


Measured memory_bytes: 5760
function main(arg) {
	arg = arg.split("\n")[0]
	arg = arg.split(" ").map((e) => Number(e))
	arg.sort((a,b) => {
		if (a > b) {
			return -1
		}
		return 1
	})
	console.log(arg[0]*10+arg[1] + arg[2])
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21192
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    int a, b,cnt=0;
    cin >> a >> b;
    for (int i = a; i <= b; i++) {
        //if ((i / 1000) == (i % 100))cnt++;
        string s = to_string(i);
        if (s[0] == s[4] && s[1] == s[3])cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
o = n // 5
if n > 1000:
    o =n //100
a = [0]* n * 2
for i in range(1,o):
    for j in range(1,o):
        for k in range(1,o):
            num = i * i + j * j + k * k + i * j + j * k + k * i
            if  num > n:
                break
            a[num-1] +=1
           # print("#" + str(num)+" "+str(i) + " " + str(j) + " "+ str(k))
for  i in range(n*2):
    if i >= n:
        break
    print(a[i])



Measured memory_bytes: 9444
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<ll>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    int n;
    ll k;
    cin >> n >> k;
    vi a(n), f(n);
    rep(i, n) {
        cin >> a[i];
    }
    rep(i, n) {
        cin >> f[i];
    }

    sort(all(a));
    sort(rall(f));
    vi mul(n);
    rep(i, n) {
        mul[i] = a[i] * f[i];
    }
    
    auto check = [&](ll X) {
        ll cou = 0;
        rep(i, n) {
            if(mul[i] > X) {
                cou += (mul[i]-X + f[i] - 1)/f[i];
            }
        }
        return cou;
    };

    ll al = -1, ga = LINF;
    ll be;
    while(ga-al != 1) {
        be = (al + ga)/2;
        if(check(be) <= k) {
            ga = be;
        } else {
            al = be;
        }
    }

    cout << ga << endl;
}

Measured memory_bytes: 4992
from sys import stdin
input = stdin.readline

n = int(input())
dic = {}
cou = 0
for _ in range(n):
    a = int(input())
    if a not in dic:
        dic[a] = 1
    else:
        dic[a] += 1
for a in dic:
    if dic[a] % 2 == 1:
        cou += 1

print(cou)


Measured memory_bytes: 15072