akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define y1 ___y1
const int N=105;
short dp[N][N][N][N],p;
char s[N][N];
int a[N][N],n,m,x,y;
int get(int x1,int y1,int x2,int y2){
	if (x1>x2||y1>y2)return 0;
	return a[x2][y2]-a[x2][y1-1]-a[x1-1][y2]+a[x1-1][y1-1];
}
int Max(int x,int y){
	if (x>y)return x;
	return y;
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)scanf("%s",s[i]+1);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++){
			if (s[i][j]=='o')a[i][j]=1;
			else if (s[i][j]=='E')x=i,y=j;
			a[i][j]+=a[i-1][j];
		}
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)a[i][j]+=a[i][j-1];
	for (int d=0;d<=n-x;d++)
		for (int u=0;u<x;u++)
			for (int l=0;l<y;l++)
				for (int r=0;r<=m-y;r++){
					if (d!=n-x)dp[d+1][u][l][r]=Max(dp[d+1][u][l][r],dp[d][u][l][r]+
					(x+d+1>n-u?p:get(x+d+1,max(r+1,y-l),x+d+1,min(m-l,y+r))));
					if (u!=x-1)dp[d][u+1][l][r]=Max(dp[d][u+1][l][r],dp[d][u][l][r]+
					(x-u-1<=d?p:get(x-u-1,max(r+1,y-l),x-u-1,min(m-l,y+r))));
					if (l!=y-1)dp[d][u][l+1][r]=Max(dp[d][u][l+1][r],dp[d][u][l][r]+
					(y-l-1<=r?p:get(max(d+1,x-u),y-l-1,min(n-u,x+d),y-l-1)));
					if (r!=m-y)dp[d][u][l][r+1]=Max(dp[d][u][l][r+1],dp[d][u][l][r]+
					(y+r+1>m-l?p:get(max(d+1,x-u),y+r+1,min(n-u,x+d),y+r+1)));
				}
	cout<<dp[n-x][x-1][y-1][m-y];		
}

Measured memory_bytes: 205056
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define vin ll n; cin>>n; vector<ll>x(n); for(ll i=0; i<n; i++) cin>>x[i]
#define vout for(ll i=0; i<n; i++) cout<<x[i]<<" "
#define T ll t = 1; cin>>t; while(t--)
#define ain ll n,i; cin>>n; ll a[n]; for( i=0; i<n; i++) cin>>a[i]
#define aout for(ll i=0; i<n; i++) cout<<a[i]<<" "
#define matin ll m,n; cin>>m>>n; ll a[m][n]; for(ll i=0;i<m;i++) for(ll j=0;j<n;j++) cin>>a[i][j];
#define matout for(ll i=0;i<m;i++){for(ll j=0;j<n;j++) cout<<a[i][j]<<" "; cout<<"\n";}
#define F first
#define S second
#define I insert
#define sin set<ll>s; ll n; cin>>n; ll tmp; for(ll i=0;i<n;i++){cin>>tmp; s.I(tmp);}
#define sout for(auto it=s.begin();it!=s.end();++it) cout<<*it<<" "
#define AISORT sort(a,a+n)
#define ADSORT sort(a,a+n,greater<ll>())
#define VISORT sort(x.begin(),x.end())
#define VDSORT sort(x.begin(),x.end(),greater<ll>())
#define pb push_back
#define ppb pop_back
#define N_ cout<<"\n"
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
 
const ll maxs = 1e6+3;
const ll maxs1 = 1e3+4;
const ll mod = 1e9+7;
//MODULO OPEARTIONS
inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }
//POWER
ll fastpow(ll x,ll y)
{ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}
//MODULAR INVERSE
ll inv(ll x){ return pow(x , mod - 2);}

ll fact[maxs];
ll fib[maxs];
ll ncr[maxs1][maxs1];
bool vis[maxs];
vector<ll>graph[maxs];

//FACTORIAL
void FACT()
{fact[0]=1;for(ll i=1; i<maxs; i++)fact[i] = (i % mod * fact[i-1] % mod) % mod;}
//FIBONACCI
void FIB()
{ fib[0]=0; fib[1]=1; for(ll i=2; i<maxs; i++)fib[i] = (fib[i-1] % mod + fib[i-2] % mod)% mod;}
//NCR
void NCR()
{ll i,j;ncr[1][0] = 1;ncr[1][1] = 1;for(i=2; i<maxs1; i++){for(j=0; j<=i; j++) { if(j==0)ncr[i][j]=1;else ncr[i][j] = (ncr[i-1][j] + ncr[i-1][j-1] ) % mod;} }}
//PRIME CHECK
bool soe(ll n)
{ bool prime[maxs+1];memset(prime, true, sizeof(prime));for (ll p=2; p*p<=maxs; p++) { if (prime[p] == true){ for (ll i=p*p; i<=maxs; i += p) prime[i] = false; } }
 if(prime[n]) return true;else return false;}    

ll find(ll n,ll base) 
{ 
    
    ll dig = (ll)(floor( log(n) /  
                         log(base)) + 1);  
      

   return dig;
} 
  


int main()
{
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,a,b;
    cin >> n >> a;
    cout << find(n,a);
    
}

Measured memory_bytes: 24832
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	char S[10], T[10]; scanf("%s%s", S, T);
	int ret = 0;
	for (int i = 0; i < 3; i++){
		if (S[i] == T[i]){
			ret++;
		}
	}
	printf("%d", ret);

	return 0;
}

Measured memory_bytes: 128
// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

int t, n;

LL a, b, c;

int main(int argc, char const *argv[]) {
    // code
    cin >> a >> b >> c;
    LL times = a / (b + c);
    LL ans = times * b;
    LL remain = a % (b + c);
    ans += min(remain, b);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,s,e) for(int i=s;i<e;i++)

int main(){
    int n;
    cin>>n;
    if(n<1200)
        cout<<"ABC";
    else if(n<2800)
        cout<<"ARC";
    else
        cout<<"AGC";
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] height= new int[n];
		boolean[] isGood= new boolean[n];
		
		for(int i = 0; i < n; i++){
			height[i] = sc.nextInt();
			isGood[i] = true;
		}

		for(int i = 0; i < m; i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(height[a - 1] < height[b - 1]) {
				isGood[a - 1] = false; 
			}else if(height[b - 1] < height[a - 1]) {
				isGood[b - 1] = false;
			}else {
				isGood[a - 1] = false;
				isGood[b - 1] = false;
			}
		}
		
		int ans = 0;
		for(int i = 0; i < n; i++){
			if(isGood[i]) {
				ans++;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}

}

Measured memory_bytes: 59584
S  = int(input())
S_12 = S%100
S_34 = int((S-S_12)/100)
if 1 <= S_12 and S_12 <= 12 and 1 <= S_34 and S_34 <= 12:
    print("AMBIGUOUS")
elif 1<= S_12 and S_12 <= 12:
    print("YYMM")
elif 1 <= S_34 and S_34 <= 12:
    print("MMYY")
else:
    print("NA")


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

int main(){
	int n, k;
	int ans=0;
	cin >> n >> k;
	vector<int> in(n);
	for (int i = 0;i < n;i++) {
		cin >> in[i];
	}
	sort(in.begin(),in.end());
	for (int i = 0;i < k;i++) {
		ans += in[i];
	}
	std::cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3540
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
using namespace std;

int main(){
	string str="";cin>>str;
	for(int i=0; i<str.length(); i++)
		if(str[i] != ',')cout<<str[i];
		else cout<<" ";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
N = input()
F = []
P = []
for _ in xrange(N):
    F.append(map(int, raw_input().split()))
for _ in xrange(N):
    P.append(map(int, raw_input().split()))

calendar = [[]]
for _ in xrange(10):
    newCalendar = []
    for y in calendar:
        newCalendar.append(y + [0])
        newCalendar.append(y + [1])
    calendar = newCalendar
calendar.pop(0)

profits = []
for timeTable in calendar:
    currentProfit = 0
    for shopProfit, shopCalendar in zip(P, F):
        currentProfit += shopProfit[len([1 for (i, j) in zip(timeTable, shopCalendar) if i and j])]
    profits.append(currentProfit)
print max(profits)

Measured memory_bytes: 2820
# coding: utf-8
# Your code here!
l = input()
le =len(l)
dp = [[0]*le for _ in range(2)]
mod = 10**9 + 7
dp[0][-1] = 1
dp[1][-1] = int(l[-1])*2##2倍
for i in range(2,le+1):
    if int(l[-i])==1:
        dp[1][-i] = 2*(dp[1][-i+1] + dp[0][-i+1])%mod##2倍
        dp[0][-i] = pow(3,i-1,mod)#pow使っておく
    else:
        dp[1][-i] = 0
        dp[0][-i] = (dp[1][-i+1] + dp[0][-i+1])%mod
#print(dp)
print((dp[0][0]+dp[1][0])%mod)

        



Measured memory_bytes: 11140
/*
 * FileName:     A
 * CreatedDate:  2020-03-14 21:00:58 +0900
 * LastModified: 2020-03-14 21:04:03 +0900
 */

#include <stdio.h>

int main(void){
    int a[32]={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 K;
    scanf("%d",&K);
    printf("%d\n",a[K-1]);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
// cout << fixed << setprecision(10);
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

long long dp[110][10100]; //(N,価値)

int main(){
    long long N,W; cin >> N >> W;
    for (int i = 0; i < 101; i++){
        for (int j = 0; j <= 10010; j++){
            dp[i][j] = INF;
        }
    }


    long long v,w; 
    cin >> v >> w;
    dp[0][0] = 0;
    dp[0][v] = w;
    for (int i = 1; i < N; i++){
        cin >> v >> w;
        for (int j = 0; j <= 10010; j++){
            if (dp[i-1][j-v] != INF && j >= v){
                dp[i][j] = min(dp[i-1][j],dp[i-1][j-v] + w);
            } else {
                dp[i][j] = dp[i-1][j];
            }
        }
    }
    long long mx = 0;
    for (long long i = 0LL; i <= 10010LL; i++){
        if (dp[N-1][i] <= W){
            mx = max(mx,i);
        }
    }
    cout << mx << endl;
}


Measured memory_bytes: 11068
#include <bits/stdc++.h>
using namespace std;
#define int long long int
typedef pair<int,int> pii;
pii points[100005];
int times[100005];
int dist(pii a,pii b){
	return abs(a.first-b.first)+abs(a.second-b.second);
}
int32_t main(){
	int n;cin>>n;
	points[0]={0,0};
	for(int i=1;i<=n;i++){
		cin>>times[i]>>points[i].first>>points[i].second;
		int d = dist(points[i],points[i-1]);
		int el = times[i]-times[i-1];
		//cout<<d<<" "<<el<<"\n";
		if(d>el || (d&1)!=(el&1)){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}


Measured memory_bytes: 2560
N, M, K = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
rs = [sorted(X)[0]+sorted(X)[0]]
for _ in range(K):
    a, b, c = map(int, input().split())
    rs.append(X[a-1]+Y[b-1]-c)

rs.sort()
print(rs[0])


Measured memory_bytes: 74220
#include <cstdio>
#include <cctype>

int main(void){
    char sent[1001];
    int i, n, a;
    
    while(true){
        scanf("%s", sent);
        if(sent[0] == '0') break;
        
        for(i = 0; sent[i] != '\0'; i++){
            n = sent[i] - '0';
            a = a + n;
        }
        
        printf("%d\n", a);
        a = 0;
    }
}



Measured memory_bytes: 2688
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j, key;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);

  for(i = 2; i <= n; i++){
    key = A[i];
    j = i - 1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;
    trace(A,n);
  }	
  
  return 0;
}

Measured memory_bytes: 608
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
int ddx[8]={0,0,-1,1,1,1,-1,-1};
int ddy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//int arr[SIZE]={};
//ここまでテンプレ
int main(){
	int H,W;
	cin>>H>>W;
	char S[60][60];
	for(int i=0;i<H;i++){
		cin>>S[i];
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(S[i][j]=='.'){
				int bomb=0;
				for(int k=0;k<8;k++){
					if(S[i+ddx[k]][j+ddy[k]]=='#')
						bomb++;
				}
				S[i][j]='0'+bomb;
			}
		}
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cout<<S[i][j];
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
signed main() {
    int N;
    cin >> N;
    rep(i, N) {
        char S;
        cin >> S;
        if(S == 'Y') {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
}


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

int main()
{
  int N;
  cin >>N;
  vector<string> s(N);
  for(int i=0; i<N; i++)
  {
    cin >>s.at(i);
  }
  int M;
  cin >>M;
  vector<string> t(M);
  for(int i=0; i<M; i++)
  {
    cin >>t.at(i);
  }
  int ans=0;
  for(int i=0; i<N; i++)
  {
    int sum=0;
    for(int j=i; j<N; j++)
    {
      if (s.at(i)==s.at(j)) sum++;
    }
    for(int j=0; j<M; j++)
    {
      if (s.at(i)==t.at(j)) sum--;
    }
    if (ans<sum) ans=sum;
  }
  
  cout<<max(0,ans)<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val S = sc.next

    var max = 0
    var n = 0
    S.foreach { c =>
      if ("ACGT".indexOf(c) >= 0) {
        n += 1
      } else {
        n = 0
      }
      if (max < n) max = n
    }
    max.toString
  }
}


Measured memory_bytes: 25672
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int N,X;
    cin >> N >> X;
    vector<int>x(N);
    for(int i = 0; i < N; i++) {
        cin >> x[i];
        x[i] = abs(x[i]-X);
    }
    int ans = x[0];
    for(int i = 0; i < N; i++) {
        ans = __gcd(ans,x[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
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; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

lint N, arr[100000];
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	REP(i, N) {
		cin >> arr[i];
	}
	sort(arr, arr + N);
	REP(i, N - 1) {
		arr[i + 1] += arr[i];
	}
	lint cnt = 1;
	IREP(i, N - 1) {
		if ((arr[i + 1] - arr[i]) <= arr[i] * 2) {
			cnt++;
		}
		else break;
	}
	cout << cnt;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval<newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int D=in();
  if(D==25) cout << "Christmas" << endl;
  else if(D==24) cout << "Christmas Eve" << endl;
  else if(D==23) cout << "Christmas Eve Eve" << endl;
  else if(D==22) cout << "Christmas Eve Eve Eve" << endl;
  return 0;
}


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

using namespace std;
using ll = long long;

int main() {

	ll N, K, C;
	cin>>N>>K>>C;
	string s;
	cin>>s;
	vector<ll> L(K);
	vector<ll> R(K);

	int k = 0;
	int i = 0;
	while (i < N && k < K) {
		if (s[i] == 'o') {
			L[k++] = i;
			i += C;
		}

		i += 1;
	}

	i = N - 1;
	k = K-1;
	while (i >= 0 && k >= 0) {
		if (s[i] == 'o') {
			R[k--] = i;
			i -= C;
		}

		i -= 1;
	}

	vector<ll> ans;
	for (int i = 0;i < K;++i) {
		if (L[i] == R[i]) {
			ans.push_back(L[i]);
		}
	}

	/*
	for (auto const& x : L) {
		cout<<x<<" ";
	}

	cout<<endl;
	for (auto const& x : R) {
		cout<<x<<" ";
	}
	*/

	for (auto const& x : ans) {
		cout<<x+1<<" ";
	}

	cout<<endl;

	return 0;
}


Measured memory_bytes: 6516
using System;
using System.Collections.Generic;
using System.Linq;
namespace CsProgramSpace
{
    class Program
    {
        static void Main(string[] args)
        {
            short[] u = (Console.ReadLine().Split(' ').Select(_ => short.Parse(_)).ToArray());
            if (u[0] < u[1])
                Console.WriteLine("a < b");
            else if (u[0] > u[1])
                Console.WriteLine("a > b");
            else
                Console.WriteLine("a == b");
        }
    }
}


Measured memory_bytes: 18348
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    string S;
    cin >> S;
    int size = S.size();
    int cnt_N=0;
    int cnt_W=0;
    int cnt_S=0;
    int cnt_E=0;
    for(int i=0;i<size;i++){
        if(S[i]=='N'){
            cnt_N++;
        }
        else if(S[i]=='S'){
            cnt_S++;
        }
        else if(S[i]=='W'){
            cnt_W++;
        }
        else if(S[i]=='E'){
            cnt_E++;
        }
    }
    bool frg1 = true;
    if(cnt_N > 0){
        if(cnt_S>0){
            frg1 = true; // Yes
        }
        else{
            frg1 = false; // No
        }
    }
    if(cnt_S > 0){
        if(cnt_N>0){
            frg1 = true; // Yes
        }
        else{
            frg1 = false; // No
        }
    }
    bool frg2= true;
    if(cnt_W>0){
        if(cnt_E>0){
            frg2 = true;
        }
        else{
            frg2=false;
        }
    }
    if(cnt_E>0){
        if(cnt_W>0){
            frg2 = true;
        }
        else{
            frg2=false;
        }
    }
    if(frg1 && frg2){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <algorithm>

using namespace std;

int _now[50*3001];
int _next[50*3001];

int main(){
	while(1){
		int n,m,s;
		scanf("%d%d%d",&n,&m,&s);
		if(n==0&&m==0&&s==0)
			break;
		int* now = _now;
		fill(now,now+(n*n+1)*(s+1),0);
		int* next = _next;
		fill(next,next+(n*n+1)*(s+1),0);
		now[0] = 1;
		for(int i=1;i<=m;i++){
			for(int j=0;j<=n*n;j++){
				for(int k=0;k<=s;k++){
					if(k+i<=s && j < n*n){
						next[(j+1)*(s+1)+k+i] += now[j*(s+1)+k];
						if(next[(j+1)*(s+1)+k+i] >= 100000)
							next[(j+1)*(s+1)+k+i] -= 100000;
					}
					next[j*(s+1)+k] += now[j*(s+1)+k];
					if(next[j*(s+1)+k] >= 100000)
						next[j*(s+1)+k] -= 100000;
					now[j*(s+1)+k] = 0;
				}
			}
			swap(now,next);
		}
		printf("%d\n",now[(n*n)*(s+1)+s]);
	}
}

Measured memory_bytes: 2200
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let m: usize = itr.next().unwrap().parse().unwrap();
    let mut s: Vec<char> = itr.next().unwrap().chars().collect();
    s.reverse();

    let mut used = vec![false; n + 1];
    let mut q = std::collections::VecDeque::new();
    let mut ans = Vec::new();
    q.push_back(0);
    while let Some(v) = q.pop_front() {
        for nv in (1..m+1).rev() {
            if v + nv <= n && s[v + nv] != '1' && !used[v + nv] {
                used[nv + v] = true;
                ans.push(nv);
                q.push_back(nv + v);
                break;
            }
        }
    }
    if used[n] {
        ans.reverse();
        let mut out = Vec::new();
        for i in 0..ans.len() {
            write!(out, "{}", ans[i]).ok();
            if i == ans.len() - 1 {
                writeln!(out, "").ok();
            } else {
                write!(out, " ").ok();
            }
        }
        stdout().write_all(&out).unwrap();
    } else {
        println!("-1");
    }
}


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


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  string s;
  cin>>s;
  int n=s.length();
if(s[n-1]=='s')
  s+="es";
else
 s+='s';
 cout<<s;  
  return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>


typedef long long ll;
typedef unsigned long long ull;

using namespace std;

#define drobucs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main() {
	drobucs;
	
	int n;
	cin >> n;

	vector<int> v(n);
	for (auto &t : v) {
		cin >> t;
	}
	int cnt = 0;
	for (int i = 1; i < n - 1; ++i) {
		if (v[i] !=  max(v[i], max(v[i - 1], v[i + 1])) && v[i] != min(v[i] , min(v[i - 1], v[i + 1]) )) {
			cnt++;
		}
	}
	cout << cnt;
	return 0;
}

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

int main()
{
	string s; cin >> s;
	int ans = 0, br = 0;
	for(int i=0; i<3; i++){
		if(s[i] == 'R') br++;
		else{
			ans = max(ans, br);
			br = 0;
		}
	}
	ans = max(ans, br);
	cout << ans;

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int temp = n;
  int sum = 0;
  while (temp != 0) {
    sum += temp % 10;
    temp /= 10;
  }
  cout << (n % sum == 0 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <set>
#include <algorithm>
 
using namespace std;
typedef long long ll;

int main(){
	ll N;
	cin >> N;
	ll now=0;
	vector<ll> bitn(40,0);
	for(int i=0;i<N;i++){
		ll A;
		cin >> A;
		for(int k=0;1;k++){
			if((A&((ll)1<<k))!=0){
				now^=A^(1<<k);
				bitn[k]++;
				break;
			}
		}
	}
	bool rev=0;
	ll ans=0;
	for(ll i=35;i>=0;i--){
		ll k=(ll)1<<i;
		if((bitn[i] + ((now&k)!=0) + rev) % 2 == 1){
			if(bitn[i]==0){
				ans=-1;
				break;
			}else{
				rev=!rev;
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(declaim (ftype (function * (values fixnum &optional)) read-fixnum))
(defun read-fixnum (&optional (in *standard-input*))
  (declare #.OPT)
  (macrolet ((%read-byte ()
               `(the (unsigned-byte 8)
                     #+swank (char-code (read-char in nil #\Nul))
                     #-swank (sb-impl::ansi-stream-read-byte in nil #.(char-code #\Nul) nil))))
    (let* ((minus nil)
           (result (loop (let ((byte (%read-byte)))
                           (cond ((<= 48 byte 57)
                                  (return (- byte 48)))
                                 ((zerop byte) ; #\Nul
                                  (error "Read EOF or #\Nul."))
                                 ((= byte #.(char-code #\-))
                                  (setf minus t)))))))
      (declare ((integer 0 #.most-positive-fixnum) result))
      (loop
        (let* ((byte (%read-byte)))
          (if (<= 48 byte 57)
              (setq result (+ (- byte 48) (* 10 (the (integer 0 #.(floor most-positive-fixnum 10)) result))))
              (return (if minus (- result) result))))))))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (declare #.OPT
           (inline sort))
  (let* ((n (read))
         (as (make-array n :element-type 'uint62))
         (base 0))
    (dotimes (i n) (setf (aref as i) (read-fixnum)))
    (setq as (sort as #'<))
    (dotimes (i (- n 1))
      (when (< (* 2 (aref as i)) (aref as (+ i 1)))
        (setq base (+ i 1)))
      (incf (aref as (+ i 1)) (aref as i)))
    (println (- n base))))

#-swank(main)


Measured memory_bytes: 30820
def c_takahashi_information(C):
    b = [C[0][i] - 0 for i in range(3)]
    a = [0] + [C[i][0] - b[0] for i in range(1, 3)]  # a_1=0と仮定してよい
    for i in range(3):
        for j in range(3):
            if a[i] + b[j] != C[i][j]:
                return 'No'
    return 'Yes'

C = [[int(i) for i in input().split()] for j in range(3)]
print(c_takahashi_information(C))

Measured memory_bytes: 3064
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    in_arr(string, s, h);
    vector<bool> col(h, false), row(w, false);
    rep(i, h){
        rep(j, w){
            if(s[i][j] == '#'){
                col[i] = true;
                break;
            }
        }
    }
    rep(i, w){
        rep(j, h){
            if(s[j][i] == '#'){
                row[i] = true;
                break;
            }
        }
    }
    
    rep(i, h){
        if(!col[i]){
            continue;
        }
        rep(j, w){
            if(!row[j]){
                continue;
            }
            cout << s[i][j];
        }
        cout << endl;
    }
    return 0;
}


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

int main() {
    int a = 1, b;
    char pm;
    int ans;

    cin >> a >> pm >> b;

    if(pm == '+'){
        ans = a + b;
    } else if(pm == '-'){
        ans = a - b;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
template<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const { long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }
        return ModInt(u); }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& st, const ModInt<MOD> a) { st << a.get(); return st; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; }
typedef ModInt<1000000007> mint;
//------------------------------------------------------------------------------
int N;
int a[21][21];

mint dp[22][1 << 21];

void _main()
{
    int N;
    cin >> N;
    rep(i, 0, N) rep(j, 0, N) cin >> a[i][j];

    dp[0][0] = 1;
    rep(i, 0, N)
    {
        rep(mask, 0, 1 << N)
        {
            if (i != __builtin_popcount(mask)) continue;

            rep(j, 0, N)
            {
                if (!(mask & (1 << j)) && a[i][j])
                {
                    dp[i + 1][mask | (1 << j)] += dp[i][mask];
                }
            }
        }
    }
    cout << dp[N][(1 << N) - 1] << endl;
}


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

using namespace std;

int main()
{
    vector <char> s;
    for (char x; cin >> x; ) {
        s.push_back(x);
        // If input ends with enter, break loop
        if (cin.peek() == '\n') break;
    }
    
    vector<char>::iterator it;
    int n=0;
    for (it = s.begin(); it != s.end(); ++it) {
        n++;
    }
    
    int count=0;
    
    for(int x=0;x<n;x++){
        
        if(x%2==0){
          if(s[x]=='L'){
            // cout<<"No"<<endl;
            count=1;
            break;}
        }
          
        else if(x%2!=0){
         if(s[x]=='R'){
        //   cout<<"No"<<endl; 
          count=1;
          break;}
        }
        
    }
    
    if(count==0)
     cout<<"Yes";
    else
     cout<<"No";

    return 0;
}


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

//

#define RESIDUE(u,v) (capacity[u][v] - flow[u][v])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

int segt[400000];
int depth=0;
int best=0;
vector<LL> mytime;

int par(int i){
  if(i==0)
    return -1;
  return (i-1)/2;
}

void update(int d,int x){
  int i=d+(1<<depth)-1;
  segt[i]+=x;
  while(par(i)!=-1){
    segt[par(i)]=max(segt[i],segt[(i+1)/2*4-1-i]);
    i=par(i);
  }
  i=0;
  while(i<(1<<depth)-1){
    i=(segt[i]==segt[2*i+1])?2*i+1:2*i+2;
  }
  best=i-((1<<depth)-1);
}

int main(){
  LL n,r,l;
  cin >> n>>r>>l;

  while((1<<depth)-1<n){
    depth++;
  }
  REP(i,n)
    mytime.push_back(0);

  REP(i,1<<(depth+1)){
    if(i<((1<<depth)-1)+n)
      segt[i]=0;
    else
      segt[i]=-INT_MAX;
  }

  int d,x,t_prev,t_now=0;
  REP(i,r){
    t_prev=t_now;
    cin>>d>>t_now>>x;
    if(i==0)
      mytime[0]+=t_now;
    else
      mytime[best]+=t_now-t_prev;
    update(d-1,x);
  }
  mytime[best]+=l-t_now;
  
  cout<<1+distance(mytime.begin(),max_element(mytime.begin(),mytime.end()))<<endl;
  return 0;
}

Measured memory_bytes: 4636
//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
#define DD 1
#else
#define DD 0
#endif
#define Debug if(DD) printf("line %d\n",__LINE__)
#define deb(x) if(DD) cerr<<#x<<'='<<x<<endl
#define debug if(DD) printf
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void gg1(){write2(-1);exit(0);}
	void gg2(){puts("No");exit(0);}
	
	const double eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int N=2e6+10;
	
	
	void main()
	{
		int a=qread(),b=qread(),c=qread();
		if(a==b and a!=c) puts("Yes");else if(a==c and a!=b) puts("Yes");else if(c==b and a!=c) puts("Yes");else puts("No");
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	#endif
	srand(time(0));
	mine::main();
	if(DD) cerr<<"Time: " <<1.0*clock()/CLOCKS_PER_SEC<<"s";
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long d = sc.NextLong();
        long[] c = sc.LongArray();
        long[,] s = new long[d, 26];
        for (int i = 0; i < d; i++)
        {
            for (int j = 0; j < 26; j++)
            {
                s[i, j] = sc.NextLong();
            }
        }

        long[] last = new long[26];

        for (int i = 0; i < d; i++)
        {
            long maxDiff = long.MinValue;
            long answerIndex = 0;
            for (int j = 0; j < 26; j++)
            {
                long diff = 0;
                diff += s[i, j];
                diff += c[j] * (i + 1 - last[j]);
                if (diff > maxDiff)
                {
                    maxDiff = diff;
                    answerIndex = j;
                }
            }
            last[answerIndex] = i;
            Console.WriteLine(answerIndex + 1);
        }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

int main() {
  long N, M;
  string S, T;
  cin >> N >> M >> S >> T;
  long L = lcm(N, M);
  map<long, char> MA;
  for (long i = 0; i < N; i++) MA[i * (L / N)] = S.at(i);
  for (long i = 0; i < M; i++) if (MA[i * (L / M)] != 0 && MA[i * (L / M)] != T.at(i)) return cout << -1 << "\n", 0;
  cout << L << "\n";
}

Measured memory_bytes: 14112
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    vector<int64_t> p(n);
    for (auto&& pp : p) {
        cin >> pp;
    }

    vector<bool> sorted(n, false);
    int64_t cur = 0;
    int64_t prev = -1;
    for (auto i : irange(0L, n)) {
        if (p[i] < prev) {
            cur = i;
        }
        if (i - cur + 1 >= k) {
            sorted[i - k + 1] = true;
        }
        prev = p[i];
    }

    multiset<int64_t> s;
    for (auto i : irange(0L, k)) {
        s.insert(p[i]);
    }

    bool has_sorted = false;
    int64_t ans = 1;
    vector<int64_t> pos;
    if (sorted[0]) {
        has_sorted = true;
    }
    for (int64_t i = 1; i <= n - k; ++i) {
        if (!(*s.begin() == p[i - 1] && *s.rbegin() <= p[i + k - 1])) {
            if (!sorted[i]) {
                ++ans;
            } else {
                if (!has_sorted) {
                    ++ans;
                }
                has_sorted = true;
            }
        }

        s.erase(s.find(p[i - 1]));
        s.insert(p[i + k - 1]);
    }

    cout << ans << endl;
}

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

int main() {
    string s;
    string new_s ="";
    cin >> s;
    for(int i=0; i<s.length(); i++) {
        if (s[i] == 'B') {
            if (new_s.empty()) {
                continue;
            } else {
                new_s.erase(new_s.length()-1);
            }
        } else {
            new_s += s[i];
        }
    }
    cout << new_s << "\n";
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); 
int main() {
	ios;
	string s,t,u;
	int a,b;
	cin>>s>>t>>a>>b>>u;
	if(u==s) cout<<a-1<<" "<<b;
	else cout<<a<<" "<<b-1;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

const ll INF = 1e9;

int main() {
	#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
	#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	string s, t = "AKIHABARA";
	cin >> s;
	ll idx = 0;
	REP(i, t.size()) {
		if (s[idx] == t[i]) {
			idx++;
		} else if (t[i] != 'A') {
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << (idx == s.size() ? "YES" : "NO") << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	char s[100010],c[][5]={"bdpq","dbqp"};
	int i,j,l;
	scanf("%s",s);
	for(l=0;s[l];l++);
	for(i=0;s[i];i++){
		for(j=0;c[0][j]-s[i];j++);
		if(s[l-i-1]-c[1][j])break;
	}//printf("%d\n",s[i]);
	printf("%s\n",s[i]+l%2?"No":"Yes");
	return 0;
}

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

void bfs(long k,vector<long> &ans,vector<set<pair<long,long>>> &edge,vector<bool> &used){
    for(set<pair<long,long>>::iterator ite=edge.at(k).begin();ite!=edge.at(k).end();++ite){
        if(!used.at(ite->first)){
            used.at(ite->first)=true;
            ans.at(ite->first)=(ans.at(k)+ite->second)%2;
            bfs(ite->first,ans,edge,used);
        }
    }
}

int main() {
    long N;
    cin>>N;
    
    vector<long> u(N-1),v(N-1),w(N-1);
    
    for(int i=0;i<N-1;i++){
        cin>>u.at(i)>>v.at(i)>>w.at(i);
    }
    
    vector<set<pair<long,long>>> edge(N,set<pair<long,long>>());
    for(int i=0;i<N-1;i++){
        edge.at(u.at(i)-1).insert(make_pair(v.at(i)-1,w.at(i)));
        edge.at(v.at(i)-1).insert(make_pair(u.at(i)-1,w.at(i)));
    }
    
    vector<long> ans(N,-1);
    vector<bool> used(N,false);
    ans.at(0)=0;
    used.at(0)=true;
    bfs(0,ans,edge,used);
    for(int i=0;i<N;i++) cout<<ans.at(i)<<endl;
}


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

using ll = long long int;

const int MAX_N = (int)(2e5 + 5);

int n, k;

int cnt[MAX_N];
map<int, pair<int, int>> mp;

ll ans;

int main(void){
  scanf("%d %d", &n, &k);

  if (k % 2 == 0) {
    int cnt_zero = 0;
    int cnt_half = 0;
    for (int i = 1; i <= n; ++i) {
      if (i % k == 0) cnt_zero += 1;
      else if (i % k == (k / 2)) cnt_half += 1;
    }
    ans = pow(cnt_zero, 3) + pow(cnt_half, 3);
  }
  else {
    int cnt_zero = 0;
    for (int i = 1; i <= n; ++i) {
      if (i % k == 0) cnt_zero += 1;
    }
    ans = pow(cnt_zero, 3);
  }

  printf("%lld\n", ans);
  return 0;
}


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

int main() {
  int l, r, d;
  cin >> l >> r >> d;

  int cnt = 0;
  for (int i = l; i <= r; ++i) {
    if (i % d == 0) cnt++;
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 3588
require 'prime'
require 'set'
require 'tsort'
include Math
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

a,b,c = gi

puts c >= a && c<=b ? 'Yes' : 'No'



Measured memory_bytes: 2428