akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
using namespace std;
char a[8000][8000]; int h, w, loop, cx, cy;
int main() {
	while (true) {
		cin >> h >> w;
		if (!h) { break; }
		memset(a, ' ', sizeof(a));
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				cin >> a[i][j];
			}
		}
		cx = 0; cy = 0; loop = 0;
		while (true) {
			if (loop > 15000000) { cout << "LOOP" << endl; break; }
			if (a[cy][cx] == '.') { cout << cx << ' ' << cy << endl; break; }
			if (a[cy][cx] == '<') { cx--; }
			if (a[cy][cx] == '>') { cx++; }
			if (a[cy][cx] == '^') { cy--; }
			if (a[cy][cx] == 'v') { cy++; }
			loop++;
		}
	}
}

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

typedef long long ll;									//XD
#define int long long   
#define PB push_back 
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define ii pair <int,int>
#define mii map <int,int>
#define vi vector<int> 
#define vii vector< ii >
#define F first
#define S second 
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a; i>=b; --i)
#define sz(x) (int)((x).size())
//#define kill(x) {cout<<x; return;}
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
inline void io(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);         
#endif
}

const int mod = 1e9+7;
const int maxn = 1e7+5;
int sof[maxn];
void sieve(){
	for(int i=1; i<maxn; i++){
		for(int j = i; j<maxn; j+=i){
			sof[j]++;
		}
	}
}
void solve(){
	int n; cin>>n;
	int ans=0; sieve();
	rep(i, 1, n+1){
		//cout<<sof[i]<<" ";
		ans += i*sof[i];
	}
	cout<<ans;
}
signed main() 
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); //io();
    //cout<<setprecision(100);
    int tc=1; //cin>>tc;
    while(tc--){
        solve();cout<<'\n';
    }

    #ifndef ONLINE_JUDGE
        cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif

    return 0;
}


Measured memory_bytes: 81772
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll k; cin >> k;
    string s; cin >> s;
    if (s.size() > k){
        REP(i, k){
            cout << s[i];
        }
        cout << "..." << endl;
        return 0;
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3568
N, K = map(int, input().split())
S = list(input())
count = 0
f = True
for i in range(N - 1):
    if S[i] == S[i + 1]:
        count += 1
ans = count + 2 * K
if ans < N - 1:
    print(ans)
else:
    print(N - 1)


Measured memory_bytes: 3956
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(in i=(in)(a);i<(in)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
using P=pair<in,in>;
vector<in> dx={0,1,-1,0};
vector<in> dy={1,0,0,-1};

//全2点間の距離をO(V^3)で求める、V:辺の数
//負の辺があっても大丈夫
in MAX_dist=2e16;
vector<vector<in>> d(0,vector<in>(0,MAX_dist));//d[x][y]:=x->yのcost,枝が無ければMAX_dist,ただし、d[i][i]=0

void warshall(){
    in V=d[0].size();
    rep(k,V)rep(i,V)rep(j,V) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
}

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in n,m,r;
    cin>>n>>m>>r;
    vector<in> a(r,0);
    rep(i,r) cin>>a.at(i);
    d=vector<vector<in>>(n,vector<in>(n,MAX_dist));
    in x,y,z;
    rep(i,m){
        cin>>x>>y>>z;
        x--,y--;
        d[x][y]=z;
        d[y][x]=z;
    }
    rep(i,n) d[i][i]=0ll;
    warshall();
    vector<in> nex(r);
    rep(i,r) nex[i]=i;
    in ans=MAX_dist;
    in cop=0ll;
    do{
        cop=0ll;
        rep(i,r-1){
            cop+=d[a[nex.at(i)]-1ll][a[nex.at(i+1)]-1ll];
        }
        ans =min(ans,cop);
    }while(next_permutation(all(nex)));
    cout<<ans<<endl;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, ans = 0, a, even = 0;
  unordered_map<ll, ll> mp;
  cin >> n;
  rep(i, n) cin >> a, mp[a]++;

  for (auto m : mp) {
    if (m.second > 1 && m.second % 2 == 0) even++;
    ans++;
  }

  cout << (even % 2 == 0 ? ans : ans - 1) << endl;
  return 0;
}


Measured memory_bytes: 4388
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ll = long long;
#define MAX_N 1000001
#define MAX_M 100010
const long long mod = 1e9 + 7;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecBvec vector<vector<bool>>
#define vecst vector<string>
#define veche vector<char>
#define vecd vector<double>
#define vecvec vector<vector<int>>
#define vecDvec vector<vector<double>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
#define ent cout<<endl
#define printvec(vec) for(int aqw=0;aqw<vec.size();aqw++){cout<<vec[aqw]<<" ";}ent;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,m,n) for(int i=m;i<(int)n;++i)
#define INF 1e+9
#define P pair<int, int>;
#define MAX_V 1000
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

int main()
{
	int ans = 0;
	string s;
	cin >> s;
	for (int i = 0;i < 3;i++) {
		if (s[i] == '1') ans++;
	}
	cout << ans << endl;
}


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

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

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    ll K; cin >> K;
    vector<ll> ans;
    queue<ll> runrun;
    for (int i = 1; i < 10; i++) runrun.push(i);
    while (ans.size() <= 100000)
    {
        ll cur = runrun.front(); runrun.pop();
        ans.push_back(cur);
        ll first_keta = cur % 10;
        if(first_keta == 0) {
            runrun.push(cur*10+first_keta);
            runrun.push(cur*10+first_keta + 1);
        }
        else if (first_keta == 9) {
            runrun.push(cur*10+first_keta-1);
            runrun.push(cur*10+first_keta);
        }
        else {
            runrun.push(cur*10+first_keta-1);
            runrun.push(cur*10+first_keta);
            runrun.push(cur*10+first_keta + 1);         
        }
    }
    cout << ans[K-1] << endl;
    return 0;
}


Measured memory_bytes: 2676
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

const int maxn = 1e5+5 ;
int arr[maxn] ;
int main()
{
    int n ;
    cin >> n ;
    int l = 0 ;
    for (int i = 0 ; i < n ; i++) {
        cin >> arr[i] ;
        if (arr[i]<0)  l++ ;
    }
    sort(arr,arr+n) ;
    int ans = 0 ;
    for(int i = 1 ; i < n-1 ; i++) ans += abs(arr[i]) ;
    ans-=arr[0] ;
    ans+=arr[n-1] ;
    cout << ans << endl ;
    if (l==0) l = 1 ;
    else if (l==n) l=n-1 ;
    for(int i = l ; i < n-1 ; i++) {
        cout << arr[0] << " "<< arr[i] <<endl;
        arr[0] -=arr[i] ;
    }
    for(int i = 0 ; i < l ; i++) {
        cout << arr[n-1] << " " <<arr[i] << endl ;
        arr[n-1] -=arr[i] ;
    }
    return 0;
}


Measured memory_bytes: 2304
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int gcd(int a, int b) {
    if (a < b) gcd(b, a);
    int r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}


int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int n = 0; n < N; n++) cin >> A[n];

    vector<int> L(N), R(N);
    L[0] = A[0];
    for (int n = 1; n < N; n++) L[n] = gcd(L[n - 1], A[n]);
    R[N - 1] = A[N - 1];
    for (int n = N - 2; n >= 0; n--) R[n] = gcd(R[n + 1], A[n]);

    vector<int> M(N);
    M[0] = R[1];
    for (int n = 1; n < N - 1; n++) M[n] = gcd(L[n - 1], R[n + 1]);
    M[N - 1] = L[N - 2];

    sort(M.begin(), M.end(), greater<int>());

    cout << M[0] << endl;

    return 0;
}


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

int main(){
  int ans;
  string str;

  ans = 0;
  cin >> str;

  for(int i=0;i< str.size()/2;i++){
    if(str[i] == 'w' || str[i] == 'i'){
      if(str[i] != str[str.size()-1-i])ans++;
    }else if(str[i] == '('){
      if(str[str.size()-1-i] != ')')ans++;
    }else{
      if(str[str.size()-1-i] != '(')ans++;
    }
  }
  if(str.size()%2){
    if(str[str.size()/2] != 'w' && str[str.size()/2] != 'i')ans++;
  }

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

Measured memory_bytes: 0
a,b=map(int,input().split())

if a%2==0:
  if b%2==0:
    c=((b-1)//2-a//2+1)%2
    if c==0:
      print(b)
    else:
      if b%2==0:
        print(b+1)
      else:
        print(b-1)
  else:
    print((b//2-a//2+1)%2)
else:
  if b%2==0:
    c=(b//2-a//2-1)%2
    ans=list(format(b,"b")[::-1])
    ans[0]=str((int(ans[0])+c)%2)
    for i,x in enumerate(format(a,"b")[::-1]):
      ans[i]=str((int(ans[i])+int(x))%2)

    ans=str("0b"+"".join(ans[::-1]))
    print(int(ans,0))
    
  else:
    c=(b//2-(a+1)//2+1)%2
    if c==0:
      print(a)
    else:
      if a%2==0:
        print(a+1)
      else:
        print(a-1)

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

using namespace std;

int main(void){  
    int n, q, l, r;
    string S;
    cin>>n>>q>>S;
    vector<int> v(n+1, 0);
    vector<int> ans(n+1, 0);

    v[0] = 0;
    for(unsigned int i=1; i<S.size(); i++){
        v[i+1] = v[i];
        if(S[i-1] == 'A' && S[i] == 'C')v[i+1]++;
    }

    for(int i=0; i<q; i++){
        cin>>l>>r;
        ans[i] = v[r]-v[l];
    }

    for(int i=0; i<q; i++){
        cout<<ans[i]<<endl;
    }

    return 0;
    
}

Measured memory_bytes: 1792
a,b,k = map(int, input().split())
for i in range(k):
    if i%2 == 0:
        if a%2:
            a = (a-1)//2
            b = b+a
        else:
            a = a//2
            b = b+a
    else:
        if b%2:
            b = (b-1)//2
            a = b+a
        else:
            b = b//2
            a = b+a
print(a,b)

Measured memory_bytes: 3064
#include <stdio.h>
#define large 2000
// #define large 50

char s[large+5][large+5];
int memo[large+5][large+5];

int main()
{
    int h,w;
    
    scanf("%d %d",&h,&w);
    for(int i=0;i<h;i++) scanf("%s",s[i]);
    
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(s[i][j]=='.')
            {
                int tmp=0;
                for(;j<w;j++)
                {
                    if(s[i][j]=='#') break;
                    else tmp++;
                }
                for(int k=j-1;k>j-tmp-1;k--)
                {
                    memo[i][k]+=tmp;
                }
            }
        }
    }
    
    for(int j=0;j<w;j++)
    {
        for(int i=0;i<h;i++)
        {
            if(s[i][j]=='.')
            {
                int tmp=0;
                for(;i<h;i++)
                {
                    if(s[i][j]=='#') break;
                    else tmp++;
                }
                for(int k=i-1;k>i-tmp-1;k--)
                {
                    memo[k][j]+=tmp;
                }
            }
        }
    }
    int max=0;
    for(int i=0;i<h;i++)
    {
    for(int j=0;j<w;j++)
    {
        // printf("%d ",memo[i][j]);
        if(max<memo[i][j]) max=memo[i][j];
    }
    // printf("\n");
    }
    printf("%d\n",max-1);
}

Measured memory_bytes: 19840
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int tmp,w,k,i,j,ans;
  int H;
  ans=0;
  cin >> H >> w >> k;
  char c[H][w]; //1個目の[]は列数、2個目の[]は行数
  int ss[6][6];
  for(i=0;i<H;++i)
  {
   for(j=0;j<w;++j)
   {cin >> c[i][j];
   }
  }
  
  for(i=0;i<6;++i)
  {
   for(j=0;j<6;++j)
   {ss[i][j]=0;
   }
  }
  
  for(tmp=0; tmp< (1<<H+w);tmp++)
  {
  bitset<12> s(tmp);
  int sw=0;
   for(i=0;i<H;++i)
   { if(s.test(i)){
     for(j=0;j<w;j++) {ss[i][j]++;}
     
   }
   }
    
    for(i=H;i<H+w;++i){
    if(s.test(i)){
     for(j=0;j<H;j++) {ss[j][i-H]++;}
   }
   }
    
   for(i=0;i<H;++i)
  {
   for(j=0;j<w;++j)
   {if(ss[i][j]==0 && c[i][j]=='#') {sw++; } }
  }
    
    for(i=0;i<6;++i)
  {
   for(j=0;j<6;++j)
   {
     ss[i][j]=0;
   }

  }
    
    
  if(sw==k) {ans++;}
  sw=0;
  }
  cout << ans << endl;
  
return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define MAX 100005
using namespace std;

int B[MAX];
bool R[MAX];
int main(){
	int n,m,x,y;
	cin >> n >> m;
	//for(int i = 1; i <= n;i++)
	R[1] = true;
	//int sol = 1;
	while(m--){
		cin >> x >> y;
		B[x]--;
		B[y]++;
		if(R[x]){
			//sol++;
			R[y] = true;
		}
		//cout << B[x] << endl;
		if(B[x] == -1){
			//sol--;
			//cout << "I dec\n";
			R[x] = false;
		}
	}
	int sol = 0;
	for(int i = 1; i <= n;i++)
		sol += R[i];
	cout << sol << endl;
}

Measured memory_bytes: 768
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	X := nextLine()
	switch X {
	case "3":
		fmt.Println("YES")
	case "5":
		fmt.Println("YES")
	case "7":
		fmt.Println("YES")
	default:
		fmt.Println("NO")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const ll inf=100100100100;
const int Inf=1001001001;
const int mod=1000000007;
const double pi=3.141592653589793;
int main(){
    ll n,k;
    string s;
    cin>>s>>k;
    n=s.size();
    vector<string> v;
    rep(i,n){
        string p;
        rep(j,5){
            if(i+j>=n)break;
            p+=s[i+j];
            v.pb(p);
        }
    }
    sort(all(v));
    k--;
    int p=0;
    while(p!=k){
        if(v[p]==v[p+1])k++;
        p++;
    }
    cout<<v[k]<<endl;
}

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

int main() {
  ll N; cin >> N;
  ll h,n,w;
  for (int i = N/4+1; i <= 3500; i++) {
    for (int j = i; j <= 3500; j++) {
      if (4 * i * j - N * (i + j) > 0 && (N * i * j) % (4 * i * j - N * (i + j)) == 0) {
        w = (N * i * j) / (4 * h * n - N * (h + n));
        h = i;
        n = j;
        goto OUT;
      }
    }
  }
  OUT:
  
  cout << h << " " << n << " " << w << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
 
struct unionfind {
    vi r; // 各要素の根
    vi size; // 自分以下の子の数(根の場合は集合の要素数)
    unionfind(int n) {
        r.resize(n);
        size.resize(n, 1);
        rep(i, n) {
            r[i] = i;
        }
    }
    int root(int x) { // 要素xの根を返す
        if (x == r[x]) return x;
        return r[x] = root(r[x]);
    }
    void unite(int x, int y) { // 要素xとyを同一の集合(根)に結合する
        x = root(x);
        y = root(y);
        if (x == y) return;
        if (size[x] >= size[y]) swap(x,y);
            size[y] += size[x];
            r[x] = y;
    }
    bool same(int x, int y) { // 要素xとyが同一の集合に属するか真偽値を返す
        return root(x) == root(y);
    }
};
 
int main() {
    // input
    int n, k , l;
    cin >> n >> k >> l;
    unionfind road(n);
    unionfind train(n);
    rep(i, k) {
        int p, q;
        cin >> p >> q;
        p--; q--;
        road.unite(p, q);
    }
    rep(i, l) {
        int r, s;
        cin >> r >> s;
        r--; s--;
        train.unite(r, s);
    }
    // solve
    map<pii, int> m;
    rep(i, n) {
        pii p = make_pair(road.root(i), train.root(i));
        m[p]++;
    }
    // output
    rep(i, n) {
        pii p = make_pair(road.root(i), train.root(i));
        printf("%d ", m[p]);
    }
}


Measured memory_bytes: 17616
using System;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(WhiteCells());
    }

    private static int WhiteCells()
    {
        int H = 0, W = 0, h = 0, w = 0;

        readData(ref H, ref W, ref h, ref w);

        return (H-h)*(W-w);
    }

    /// <summary>
    /// データを読み込む
    /// </summary>
    private static void readData(ref int H, ref int W, ref int h, ref int w)
    {
        int[] line = Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), int.Parse);
        H = line[0];
        W = line[1];

        line = Array.ConvertAll<string, int>(Console.ReadLine().Split(' '), int.Parse);
        h = line[0];
        w = line[1];
    }
}




Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <cmath>
#include <limits>
using namespace std;
typedef long long ll;
int main(void){
    ll n,p,a[1000010] = {},ans = 1;
    cin >> n >> p;
    if(n == 1){
        cout << p << endl;
        return 0;
    }
    if(n <= 12){
    for(ll i = 2;i <= pow(10,12/n)+10;i++){
        ll k = i;
        while(p % k == 0){
            p /= k;
            a[i]++;
        }
        if(p == 1) break;
    }
    for(ll i = 2;i <= pow(10,12/n)+10;i++){
        ll tmp = (a[i]/n);
        if(tmp >= 1) ans *= pow(i,tmp);
    }
    cout << ans << endl;
    return 0;
    }
    
    for(ll i = 2;i <= 7;i++){
        ll k = i;
        while(p % k == 0){
            p /= k;
            a[i]++;
        }
        if(p == 1) break;
    }
    for(ll i = 2;i <= 7;i++){
        ll tmp = (a[i]/n);
        if(tmp >= 1) ans *= pow(i,tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8064
import math
import sys
from collections import Counter
N=int(input())
a=sys.stdin.readline().split()
A=[int(b) for b in a]
numbers=[0]*N
count=Counter(A)
kotae=0
for a in range(N+1):
    b=count[a]
    kotae+=b*(b-1)//2
for a in A:
    print(kotae+1-count[a])


Measured memory_bytes: 84684
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let d: usize = iter.next().unwrap().parse().unwrap();
    println!("{}", match d {
        25 => "Christmas",
        24 => "Christmas Eve",
        23 => "Christmas Eve Eve",
        22 => "Christmas Eve Eve Eve",
        _ => panic!(),
    });
}


Measured memory_bytes: 4352
import java.util.*;
import java.awt.geom.Point2D;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		while(true){
			int n = sc.nextInt();
			if(n == 0) break;
			Point2D[] ps = new Point2D[n];
			for(int i=0;i<n;i++){
				String[] s = sc.next().split(",");
				ps[i] = new Point2D.Double(Double.parseDouble(s[0]),Double.parseDouble(s[1]));
			}
			System.out.println(n-makeConvexHull(ps));
		}
	}

	static int num;
	private static int makeConvexHull(Point2D[] ps){
		num = ps.length;
		int minIndex = 0;
		double minY = ps[0].getY();
		double maxX = ps[0].getX();
		for(int i=1;i<num;i++){
			if(minY > ps[i].getY()
				 || (minY == ps[i].getY() && maxX < ps[i].getX())){
				maxX = ps[i].getX();
				minY = ps[i].getY();
				minIndex = i;
			}
		}

		double rad,find,now=0.0,dist=0.0;
		int j;
		for(j=0;j<num;j++){
			Point2D tmp = ps[j];
			ps[j] = ps[minIndex];
			ps[minIndex] = tmp;
			find = 360;
			for(int i=j+1;i<num;i++){
				rad = getTheta(ps[j],ps[i]);
				if(!ps[j].equals(ps[i]) && find >= rad && rad >= now){
					if(find != rad || find == rad
						 && dist < ps[j].distance(ps[i])){
						dist = ps[j].distance(ps[i]);
						find = rad;
						minIndex = i;
					}
				}
			}
			if(find == 360 || minIndex == num){
				break;
			}
			now = find;
		}
		j++;
		while(ps[0].equals(ps[j-1])){
			j--;
		}
		num = j;
		return num;
	}

	private static double getTheta(Point2D p1, Point2D p2){
		double dx,dy,ax,ay;
		double t;
		dx = p2.getX() - p1.getX();
		ax = dx >= 0 ? dx : -dx;
		dy = p2.getY() - p1.getY();
		ay = dy >= 0 ? dy : -dy;

		t = (ax + ay == 0) ? 0 : dy / (ax + ay);
		if(dx < 0){
			t = 2 - t;
		}
		else if(dy < 0){
			t += 4;
		}
		return t * 90.0;
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h> 
    #include<ext/pb_ds/assoc_container.hpp> 
    #include<ext/pb_ds/tree_policy.hpp>
    using namespace __gnu_pbds;
    using namespace std;
    template <typename T>
    using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
    #define int long long  
    typedef long double ld;
    #define pb push_back
    #define f(i,a,b) for(int i=a;i<b;i++)
    #define fd(i,a,b) for(int i=a-1;i>=b;i--)
    #define pf push_front
    #define fi first
    #define se second
    #define ps(x,y)         fixed<<setprecision(y)<<x
    #define INF 1e10
    const double pi=3.14159265358979323;
    const int mod=998244353;
    const int MAX=1000000+5;
    int p[MAX]={0};

     int gcd(int a, int b) 
    { 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
    } 
    void swap(int a,int b)
    {
      int temp=a;
      a=b;
      b=temp;
    } 
    int  binpow(int  a,int  b) 
    {
    int res = 1;
    while (b > 0) {
        if (b%2 == 1)
            res = (res * a)%mod;
        a = (a* a)% mod;
        b >>= 1;
    }
    return res;
}
    int modinv(int y)
    {
        return binpow(y,mod-2);
    }

    int fact[500000+5];
    void precal()
    {
    fact[0]=1;
    for(int i=1;i<500000+5;i++)
    {
        fact[i]=(i*fact[i-1])%mod;
    }
}
    bool isPrime(int n) 
    { 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
   
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
    } 
    int mm[200000+5];
    int vis[200000+5]={0};
    signed main() {

 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    #ifndef ONLINE_JUDGE
      if(fopen("INPUT.txt","r"))
      {
      freopen ("INPUT.txt" , "r" , stdin);
      freopen ("OUTPUT.txt" , "w" , stdout); 
      }
    #endif  
    // -------------------------------------Code starts here--------------------------------------------------------------------- 
    int t=1; 
   // cin>>t;
    while(t--)
    {
       int n;
       cin>>n;
       int a[n];
       f(i,0,n)
       cin>>a[i];
       int k=n-2;
       int sum=0;
       sort(a,a+n,greater<int>());
       sum+=a[0];
       f(i,1,n)
       {
            if(k==0)
                break;
            else if(k-2>=0)
            {
                sum+=2*a[i];
                k-=2;
            }
            else
                {
                    sum+=a[i];
                    k=0;
                }
       }
       cout<<sum<<endl;
    }
}



Measured memory_bytes: 5224
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

ll mod_pow(ll x, ll n, ll mod){ // x ^ n % mod
    ll res = 1;
    while(n > 0){
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    string s;
    cin >> s;
    ll ans = 0;
    int n = s.size();
    ll a[n+1] = {};
    rep(i,n){
        a[i] = s[i] - '0';
    }
    ll f[n+1] = {};
    ll g[n+1] = {};

    rep(i,n){
        g[i] = a[i] * mod_pow(10, n-1-i, 2019);
    }
    drep(i,n){
        f[i] = (f[i+1] + g[i]) % 2019;
    }

    ll b[2020] = {};
    rep(i,n+1){
        b[f[i]]++;
    }

    rep(i,2020){
        ans += b[i] * (b[i]-1) / 2;
    }

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




Measured memory_bytes: 8428
#include<iostream>
#include<cstdio>
#include<algorithm>
int deg[5];
int main() {
    int u,v;
    for(int i=1;i<4;i++) {
        scanf("%d%d",&u,&v);
        deg[u]++;deg[v]++;
    }
    std::sort(deg+1,deg+5);
    if(deg[1]==deg[2]&&deg[3]==deg[4]&&deg[1]==1&&deg[3]==2) printf("YES");
    else printf("NO");
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Set<Integer> d = new HashSet<>();
		for (int i = 0; i < n; i++) {
			d.add(in.nextInt());
		}

		System.out.println(d.size());

	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans = 1;

int main()
{
ll n,k;
cin >> n >> k ;
vector<ll> G[n];
bool see[n]={};
ll info[n]={};
rep(i, n-1)
{
    ll a,b;
    cin >> a>>b;
    G[a-1].push_back(b-1);
    G[b-1].push_back(a-1); 
}
info[0]=k;
see[0]=1;
bool syo=1;
queue<ll> q;
q.push(0);
while(!q.empty()){
    ll a=q.front();
    q.pop();
    see[a]=1;
    ll cnt=0;
    rep(i,G[a].size()){
        if(see[G[a][i]])continue;
        if(syo){
            info[G[a][i]]=k-1-cnt;
        }
        else {
            info[G[a][i]]=k-2-cnt;
        }
        cnt++;
        q.push(G[a][i]);
    }
    syo=0;
}
rep(i,n){
    if(info[i]<1){
        ans=0;
        break;
    }
    ans*=info[i];
    ans%=mo;
}

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


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long a;
    double b;
    cin >> a >> b;
    int c = round(b * 100);
    long long ans = (a * c) / 100;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3728
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std ;
int main () {
    int n,x,m[1000000],a;
    int zennbu = 0;
    int saisyou = 1000000;
    cin >> n;
    cin >>x;
    
    for(int i = 0; i < n; i++)
    {
        cin >> m[i];
        zennbu += m[i];
        
        if (saisyou > m[i]) {
            saisyou = m[i];
        }
        
    }
    x -= zennbu;
    cout << n + x/saisyou << endl;

    return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ld long double
#define zeros(x) x^(x-1)&x
#define pii pair<ll,ll>
#define cd complex<double>
#define dbg(x) cerr<<x<<endl;
#define Nmax 500005
using namespace std;

ll n, DP[Nmax];

vector<int> solve(ll n){
    vector<int> ans;
    if (n==1){
        return {};
    }
    if (n%2){
        vector<int> ans2 = solve(n-1);
        int x = ans2.size() + 1;
        ans = {x};
        ans.insert(ans.end(), ans2.begin(), ans2.end());
    }
    else{
        ans = solve(n/2);
        int x = ans.size()+1;
        ans.push_back(x);
    }
    return ans;
}

void print(vector<int> v){
    cout << v.size() * 2 << '\n';
    for (auto it : v) cout << it << ' ';
    for (int i=1;i<=v.size();i++) cout << i << ' ';
    cout << '\n';
}

int main()
{
    cin >> n;
    print(solve(n+1));

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

int main()
{
    string ar;
   cin>>ar;
   int n=ar.length();
    for(int i=0;i<n;)
    {
        if(i%2==0)
        {
        if(ar[i] =='R' || ar[i] =='U' ||ar[i] == 'D')
            i++;
        else
           { cout << "No"; return 0;}
        }
        else
        {  if(ar[i] =='L' || ar[i] =='U' ||ar[i] == 'D')
                i++;
           else
            {cout << "No"; return 0;}
        }

    }
cout << "Yes";

return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool vis[100010];
int ans[100010];
int main(){
	memset(ans,0,sizeof(ans));
	int n,m;
	cin>>n>>m;
	int ac=0;
	int wa=0;
	for(int i=0;i<m;i++){
		int a;
		string s;
		cin>>a>>s;
		if(s=="AC"&&!vis[a]){
			ac++;
			wa+=ans[a];
			vis[a]=1;
		}
		else if(s=="WA"&&!vis[a]){
			ans[a]++;
		}
	}
	cout<<ac<<" "<<wa<<endl;
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0; i<(n); i++)
#define PI 3.14159265359
int main() {
    /*変数定義，入力*/
    ll N, M;
    cin >> N >> M;
    int day;
    int play = N;
    rep(i, M){
        cin >> day;
        play -= day;
    }
    

    //ll A, B;cin >> A >> B;
    //vector<ll> a(N);  rep(i, N) cin >> a[i];
    if(play < 0){
        cout << -1 << endl;
    }else{
        cout << play << endl;
    }
    /*終了*/
    return 0;
}

Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		// int n = Integer.parseInt(br.readLine());

		String s = br.readLine();
		long count = s.chars().filter(ch -> ch == '?').count();
		count += s.chars().filter(ch -> ch == 'D').count();
		s = s.replace("?", "D");

		String str[] = s.split("");

		for (int i = 0; i < str.length - 1; i++) {
			if (str[i].equals("P") && str[i + 1].equals("D")) {
				count++;
			}
		}

		System.out.println(s);
	}
}

Measured memory_bytes: 51772
n, m = gets.chomp.split("\s").map(&:to_i)

input = Array.new
m.times do
    input.push(gets.chomp.split("\s").map(&:to_i))
end

input.sort! do |a, b|
    a[1] <=> b[1]
end

result = 0
bridge = 0

input.each do |item|
    a, b = item

    # print "bridge: #{bridge}, a: #{a}, b: #{b}\n"
    if (bridge >= a && bridge < b) then
        # do nothing
    else
        bridge = b - 1
        result += 1
    end
end

p result


Measured memory_bytes: 10488
#include <bits/stdc++.h>
#include<algorithm>//next_permutation
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rrepa(i,a,n) for(int i=n-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
 
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
const int ddx[]={-1,-1,-1,0,0,1,1,1};
const int ddy[]={-1, 0, 1,-1,1,-1,0,1};

int main (){    
    int n;
    cin >> n;
    vector<int> a(n),b(n);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    vector<int>A(n),B(n);
    int tota=0;
    int totb=0;
    rep(i,n)totb+=b[i];
    rep(i,n){
        tota+=a[i];
        A[i]=tota;
    }
    B[0]=totb;
    for(int i = 1;i<n;++i){
        totb-=b[i-1];
        B[i]=totb;
    }
    int ma = 0;
    rep(i,n){
        ma = max(ma,A[i]+B[i]);
    }
    cout << ma <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1000000007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }


int main(){
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<pair<long long, int>> v;
    REP(i, A){
        int p; cin >> p;
        v.push_back(make_pair(p, 0));
    }
    REP(i, B){
        int p; cin >> p;
        v.push_back(make_pair(p, 1));
    }
    REP(i, C){
        int p; cin >> p;
        v.push_back(make_pair(p, 2));
    }
    sort(v.begin(), v.end(), greater<pair<long long, int>>());

    int z = X + Y;
    long long ans = 0;
    for(int i=0; i<A+B+C; i++){
        if(z == 0) break;
        long long p = v[i].first;
        int k = v[i].second;
        if(k == 0){
            if(X == 0) continue;
            X--;
            ans += p;
            z--;
        }else if(k == 1){
            if(Y == 0) continue;
            Y--;
            ans += p;
            z--;
        }else{
            ans += p;
            z--;
        }
    }
    cout << ans << endl;
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const ll MOD = 1000000007;

int binsearch_lower_bound(vector<int>& vec, int val) {
  int low = 0;            // テァツッツ?・ツ崢イテ」ツ?ョテ、ツクツ凝ゥツ卍?
  int high = vec.size();  // テァツッツ?・ツ崢イテ」ツ?ョテ、ツクツ甘ゥツ卍静」ツ?づィツァツ」テ」ツ?ッテ」ツ?づ」ツつ古」ツ?ー [low, high] テ」ツ?ョテ、ツクツュテ」ツ?ォテ・ツュツ佚・ツ慊ィテ」ツ?凖」ツつ?
  while (low < high) {
    int mid = (low + high) / 2;  // テ、ツクツュテ・ツソツεァツつケテッツシツ暗」ツ?禿」ツ?ョテ・ツョツ淌ィツ」ツ?」ツ?ァテ」ツ?ッテ」ツつェテ」ツδシテ」ツδ静」ツδシテ」ツδ陛」ツδュテ」ツδシテ」ツ?療」ツ??」ツつ凝」ツ??
                                 // テ」ツ??・ツ篠ウテ・ツッツ?」ツ?ォテ」ツ?ッ mid=low+(high-low)/2 テ」ツ?ィテ」ツ?凖」ツ?ケテ」ツ?催ッツシツ?
    int midval = vec[mid];       // テ、ツクツュテ・ツソツε」ツ?ァテ」ツ?ョテ・ツ?、

    // ティツァツ」テ」ツ?ョテァツッツ?・ツ崢イテ」ツつ津ァツ仰ュテ」ツつ?」ツつ?
    if (midval < val) low = mid + 1;
    else high = mid;
  }
  return low;
}

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

  int n,t;
  cin >> n >> t;
  std::vector<int> v;
  for(int i=0;i<n;i++){
    int d;
    cin >> d;
    v.push_back(d);
  }
  sort(v.begin(),v.end());
  ll res=1;
  for(int i=1;i<n;i++){
    if(v[i-1]>=v[i]-t){
      int idx=binsearch_lower_bound(v,v[i]-t);
      res = (res*(i-idx+1))%MOD;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 3536
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout<<endl
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string> 
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

int main()
{
	int n; cin >> n;
	vs s(n);
	vi t(n);
	rep(i, n)cin >> s[i] >> t[i];
	string x; cin >> x;
	int k = 0;
	rep(i, n)if (s[i] == x)k = i;
	int ans = 0;
	rep(i, n)ans += t[i];
	rep(i, k + 1)ans -= t[i];
	co(ans);
	return 0;
}


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

  int N;
  cin >> N;
  vector<int> A(N);
  bool flag = false;//入国
  for(int i=0;i<N;i++)
  {
    cin >> A.at(i);
    if(A.at(i)%2==0)
    {
      if(A.at(i)%3!=0 && A.at(i)%5!=0)
      {
        flag = true;
        break;
      }
    }
  }
  if(flag==true)
  cout << "DENIED" << endl;
  else
    cout << "APPROVED" << endl;
  
  
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
        while (true)
        {
        	String[] list = br.readLine().split(" ");
        	int x = Integer.parseInt(list[1]);
            int y = Integer.parseInt(list[0]);
            if (x == 0 && y == 0)
            	break;
            for (int i = 0; i < y; i++)
            {
            	for (int j = 0; j < x; j++)
            	{
            		if (i == 0 || i == y - 1 || j == 0 || j == x - 1)
            			System.out.print("#");
            		else
            			System.out.print(".");
            	}
            	System.out.println("");
            }
            System.out.println("");
        }
        
	}

}

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

int main(){
  int water ,lastmonth=4280 ,price=1150;
  while( true ){
    price = 1150;
    cin >> water;
    if( water == -1 ){
      break;
    }

    for(int i = 11 ; i <= water && i <= 20 ; i++ ){
      price += 125;
    }
    for(int i = 21 ; i <= water && i <= 30 ; i++ ){
      price += 140;
    }
    for(int i = 31 ; i <= water ; i++ ){
      price += 160;
    }
    cout << lastmonth - price << endl;
  }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 10000000000000000;
const ll mod = 1000000007;
//printf("%.10f\n", n);
signed main() {
	ll n, m, k, s, t, cnt = 0, ans = 0; cin >> n >> m >> k >> s >> t;
	ll l = 0, r = 0, u = 0, d = 0;
	string st, sr; cin >> st >> sr;
	reverse(st.begin(), st.end()); reverse(sr.begin(), sr.end());
	for (int h = 0; h < k; h++) {
		if (st[h] == 'L' && sr[h] == 'R') {
			if (l == 0) { l++; }
			continue;
		}
		if (st[h] == 'L') { l++; } if (sr[h] == 'R') { l = max((ll)0, l - 1); }
		if (st[h] == 'R' && sr[h] == 'L') {
			if (r == 0) { r++; }
			continue;
		}
		if (st[h] == 'R') { r++; } if (sr[h] == 'L') { r = max((ll)0, r - 1); }
		if (st[h] == 'U' && sr[h] == 'D') {
			if (u == 0) { u++; }
			continue;
		}
		if (st[h] == 'U') { u++; } if (sr[h] == 'D') { u = max((ll)0, u - 1); }
		if (st[h] == 'D' && sr[h] == 'U') {
			if (d == 0) { d++; }
			continue;
		}
		if (st[h] == 'D') { d++; } if (sr[h] == 'U') { d = max((ll)0, d - 1); }
		if (l >= m) { cout << "NO" << endl; return 0; }
		if (r >= m) { cout << "NO" << endl; return 0; }
		if (u >= n) { cout << "NO" << endl; return 0; }
		if (d >= n) { cout << "NO" << endl; return 0; }
	}
	if (t - l < 1) { cout << "NO" << endl; return 0; }
	if (t + r > m) { cout << "NO" << endl; return 0; }
	if (s - u < 1) { cout << "NO" << endl; return 0; }
	if (s + d > n) { cout << "NO" << endl; return 0; }
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 776
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rep(i, n) for(int i = 0; i < n; i++)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
using namespace std;

int dvrc(int n){
    int c=0;
    for(int i=1; i<=n; i++){
        if(n%i==0){
            c++;
        }
    }
    return c;
}

int main(){
    int N;
    cin >> N;
    int c=0;
    for(int i=1; i<=N; i+=2){
        if(dvrc(i) == 8){
            c++;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    vector<int> num(101, 0);
    int maxNum = 0;

    for(;;){
        int a;
        if(!(cin >> a))
            break;
        maxNum = max(maxNum, ++num[a]);
    }

    for(int i=1; i<=100; ++i){
        if(num[i] == maxNum)
            cout << i << endl;
    }
}

Measured memory_bytes: 0
/*COMPETITIVE PROGRAMMING C++ TEMPLATE */

#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>

#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n"
#define MOD 998244353

const long double PI = 3.141592653589793236L;

typedef long long int ll;
typedef long double ld;

using namespace std;

int gcd(int x, int y)
{
    if(x == 0)
    {
        return y;
    }

    return gcd(y % x, x);
}

void solve()
{
    int n;
    cin >> n;

    vector<int> a(n);

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

    int GCD = gcd(a[0], a[1]);

    for(int i = 0; i < n; i++)
    {
        GCD = gcd(GCD, a[i]);
        if(GCD == 1) break;
    }

    bool setwise = false;

    if(GCD == 1)
    {
        setwise = true;
    }
    else {
        setwise = false;
    }

    map<int, int> mp;
    bool is_pairwise = true;

    for(int i = 0; i < n; i++)
    {
        if(a[i] % 2 == 0)
        {
            mp[2]++;
            while(a[i] % 2 == 0)
            {
                a[i] /= 2;    
            }
            if(mp[2] > 1)
            {
                is_pairwise = false;
                break;
            }
        }

        for(int j = 3; j * j <= n; j += 2)
        {
            if(a[i] % j == 0)
            {
                mp[j]++;
                while(a[i] % j == 0)
                {
                    a[i] /= j;
                }
                if(mp[j] > 1)
                {
                    is_pairwise = false;
                    break;
                }
            }
        }

        if(a[i] > 2)
        {
            mp[a[i]]++;
            if(mp[a[i]] > 1)
            {
                is_pairwise = false;
                break;
            }
        }
    }

    if(is_pairwise)
    {
        cout << "pairwise coprime\n";
    }
    else if(setwise)
    {
        cout << "setwise coprime\n";
    }
    else {
        cout << "not coprime\n";
    }
   
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int T = 1;
    //cin >> T;
    
    while (T--)
    {
        solve();
    }
    
    return 0;
}




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

using namespace std;

int main() {

	int n, ans;

	cin >> n;
	if (n % 2 == 0) {
		cout << n << endl;
	}
	else
	{
		cout << n * 2 << endl;
	}


}



Measured memory_bytes: 256
import sys
import heapq
from decimal import Decimal

input = sys.stdin.readline
k, s = map(int, input().split())

ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if z >= 0 and z <= k:
            ans += 1
    
print(ans)

Measured memory_bytes: 9748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
vector<ll> V;
int pre[maxn];
int main() {
    int n,m;cin>>n>>m;
    int l=1,r=n-1;
    for(;m;l++,r--,m--){
        if(r-l<=n/2&&n%2==0) printf("%d %d\n",l+1,r);
        else printf("%d %d\n",l,r);
    }
    return 0;
}

Measured memory_bytes: 3756
#include <algorithm>
#include <iostream>

using namespace std;

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

  sort(a, a+n, greater<int>());

  int alice = 0;
  int bob   = 0;
  for (int i=0; i<n; ++i) {
    if (0 == i%2)
      alice += a[i];
    else
      bob += a[i];
  }

  cout << (alice-bob) << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int K = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();
        if (S.Length <= K)
            Console.WriteLine(S);
        else
            Console.WriteLine(S.Substring(0, K) + "...");
    }
}

Measured memory_bytes: 27532
#include<bits/stdc++.h>
using namespace std;
int ssww(long double x){
	return (int)x;
}
int main(){
	int a,b;
	cin>>a>>b;
	int i;
	long double ma=a*12.5,mb=b*10;
	for(i=min(ma,mb);i<=max(ma,mb)+1;++i){
		if(ssww(i*0.08)==a and ssww(i*0.1)==b){
			cout<<i;
			return 0;
		}
	}
	cout<<-1;
}

Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
d=int(input())
count=0
for i in range(a+1):
    for j in range(b+1):
        for z in range(c+1):
            if i*500+j*100+z*50 == d:
                count+=1
print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;


int32_t main(){
	ios::sync_with_stdio(false);
    int n, m;
    cin>>n>>m;
    int ans=-1;
    for(int i=1;i*i<=m;i++){
        if(m%i==0){

            int d=i;
            if((m-(m/d)*m)%d==0 && n*d<=m){
                ans=max(ans,d);
            }
             d=m/i;
            if((m-(m/d)*m)%d==0 && n*d<=m){
                ans=max(ans,d);
            }
        }
    }
    cout<<ans<<"\n";



	return 0;
}

Measured memory_bytes: 256