akhauriyash/Code-Regression huggingface dataset:
#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()
{
    for(;;){
        int n, w, h;
        cin >> n >> w >> h;
        if(n == 0)
            return 0;

        vector<vector<bool> > tree(h+1, vector<bool>(w+1, false));
        for(int i=0; i<n; ++i){
            int x, y;
            cin >> x >> y;
            tree[y][x] = true;
        }
        int s, t;
        cin >> s >> t;

        vector<int> m(w+1, 0);
        for(int x=1; x<=w; ++x){
            for(int y=0; y<t; ++y){
                if(tree[y][x])
                    ++ m[x];
            }
        }

        int ret = 0;
        for(int y=1; y+t-1<=h; ++y){
            for(int x=1; x<=w; ++x){
                if(tree[y-1][x])
                    -- m[x];
                if(tree[y+t-1][x])
                    ++ m[x];
            }
            int num = accumulate(m.begin(), m.begin()+s, 0);
            for(int x=1; x+s-1<=w; ++x){
                num -= m[x-1];
                num += m[x+s-1];
                ret = max(ret, num);
            }
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;
// const int INF=1010101010;
using Graph = vector<vector<int>>;

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  // int k = 0;
  // if ((n % (a + b)) - a >= 0) k = n % (a + b) - a;
  cout << (n / (a + b)) * a + min(n % (a + b), a) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>  
#include <functional> // for less
using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int pw(int a,int b,int p){
    if(b==0)return 1;
    int t=pw(a,b/2,p);
    if(b%2)return (((a*t)%p)*t)%p;
    else return ((t*t)%p);
}
int solve(){
    cin>>n;
    int a[n]; rep(i,0,n-1) cin>>a[i];
    sort(a,a+n);
    if(n%2){
        if(a[0]==0){
            int t=2;
            for (int i = 1; i < n; i+=2)
            {
                if(a[i]==a[i+1]&&a[i]==t){
                    t+=2;
                }
                else{
                    cout<<0;
                    return 0;
                }
            }
        }
        else{
            cout<<0;
            return 0;
        }
    }
    else{
        int t=1;
        for (int i = 0; i < n; i+=2)
        {
            if(a[i]==a[i+1]&&a[i]==t){
                t+=2;
            }
            else{
                cout<<0;
                return 0;
            }
        }
    }
    cout<<pw(2,n/2,M);
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int k,a,b;
  cin>>k>>a>>b;
  repeat(i,a,b+1) {
    if(i%k==0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}


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

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;

	writeln(N / 2 - (N % 2 == 0 ? 1 : 0));
	stdout.flush();
	debug readln();
}

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

int main() {
  
  string s;
  cin >> s;
  
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) == ','){
      s.at(i) = ' ';
    }
    else{
      continue;
    }
  }
  
  cout << s << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

class Puzzle
{
public:
	int N ,K;

	void input()
	{
		cin >> N >> K;
	}

	void play()
	{
		long long ans = 0;;

		int cnt_n = N / K;
		int cnt_h = 0;
		if (K % 2 == 0) {
			cnt_h = N / (K / 2) - cnt_n;
		}

		ans = pow(cnt_n, 3) + pow(cnt_h, 3);

		printf("%lld", ans);
	}


};

int main()
{

	Puzzle puz;

	puz.input();
	puz.play();

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
 
int A[100000];
int partition(int A[],int r){
  int x,i,j,tmp,tmp2;
 
  x = A[r];
  i = -1;
  for(j=0 ; j<r ; j++){
    if(A[j]<=x){
      i++;
      tmp=A[i];
      A[i]=A[j];
      A[j]=tmp;
    }
  }
  tmp2=A[i+1];
  A[i+1]=A[r];
  A[r]=tmp2;
  return i+1;
}
 
int main(){
  int i,j,count,q;
 
  scanf("%d",&count);
 
  for(i=0 ; i<count ; i++){
    scanf("%d",&A[i]);
  }
 
  q = partition(A,count-1);
  for(i=0 ; i<count-1 ; i++){
    if(i==q){
      printf("[%d] ",A[q]);
      continue;
    }
    printf("%d ",A[i]);
  }
  printf("%d\n",A[i]);
  return 0;
 
}

Measured memory_bytes: 2964
n = int(input())
G = [[0]*n for i in range(n)]
for i in range(n):
  u,k,*vs = map(int,input().split())
  for j in range(len(vs)):
    G[u-1][vs[j]-1] = 1 
  
for i in range(n):
  print(" ".join(map(str,G[i])))


Measured memory_bytes: 5672
// mapを用いたstringソート

#include <bits/stdc++.h>
using namespace std;

int main(){
  int N; cin >> N;
  map<string, int> mp;
  for(int i=0; i<N; i++){
    string s; cin >> s;
    mp[s]++;
  }

  int ans = 0;
  for(auto itr = mp.begin(); itr != mp.end(); ++itr){
    ans += 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 19224
package main

import "fmt"

func main() {
	var n, a, b, c, d int
	var s string
	fmt.Scan(&n, &a, &b, &c, &d, &s)
	a, b, c, d = a-1, b-1, c-1, d-1

	// for i := 0; i < len(s)-1; i++ {
	// 	if i < len(s)-2 && s[i] == '.' && s[i+1] == '.' && s[i+2] == '.' {
	// 		if b < i && i < d {
	// 			dot3 = true
	// 		}
	// 	}

	// 	if s[i] == '#' && s[i+1] == '#' {
	// 		if (a < i && i < c) || (b < i && i < d) {
	// 			fmt.Println("No")
	// 			return
	// 		}
	// 	}
	// }

	for i := a; i < max(c, d); i++ {
		if s[i] == '#' && s[i+1] == '#' {
			fmt.Println("No")
			return
		}
	}

	if c > d {
		ok := false
		for i := b; i <= d; i++ {
			if s[i-1] == '.' && s[i] == '.' && s[i+1] == '.' {
				ok = true
				break
			}
		}
		if !ok {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")

}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 1664
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	char c1, c2; cin >> c1 >> c2;
	if (c1 == c2) cout << "H" << endl;
	else cout << "D" << endl;
}

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

int main() {
  ll n;
  cin >> n;
  vector<P> p(n);
  rep(i, n) {
    int a;
    cin >> a;
    p[i] = {a, i};
  }
  sort(all(p), greater<>());
  vector<vl> dp(n + 1, vl(n + 1, 0));
  rep(w, n) rep(i, w + 1) {
    int j = w - i;
    ll a, x;
    tie(a, x) = p[w];
    dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + a * abs(x - i));
    dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + a * abs(n - j - x - 1));
  }
  ll ans = 0;
  rep(i, n + 1) ans = max(ans, dp[i][n - i]);
  cout << ans << endl;
}

Measured memory_bytes: 34580
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    MAX_DIGIT = 50

    # dp[桁数][0 or 1] 
    # 0: Kより小さいことが未確定
    # 1: Kより小さいことが確定
    dp = [[-1] * 2 for _ in range(MAX_DIGIT+5)]
    dp[0][0] = 0

    for d in range(MAX_DIGIT):
        mask = 1 << (MAX_DIGIT - d - 1)

        # A で元々d桁目にビットが立っている個数
        num = 0
        for i in range(N):
            if A[i] & mask:
                num += 1
        
        # Xのd桁目を0,1にしたときのコスト
        cost0 = mask * num
        cost1 = mask * (N - num)

        # 1 => 1への遷移
        # cost0 or cost1の大きい方を選択可能
        if dp[d][1] != -1:
            dp[d+1][1] = max(dp[d+1][1], dp[d][1] + max(cost0, cost1))

        # 0 => 1への遷移
        # Kのd桁目が1の時、Xのd桁目を0にする場合
        if dp[d][0] != -1:
            if K & mask:
                dp[d+1][1] = max(dp[d+1][1], dp[d][0] + cost0)
        
        # 0 => 0への遷移
        # Kのd桁目が1の時、Xのd桁目を1
        # Kのd桁目が0の時、Xのd桁目を0にする場合
        if dp[d][0] != -1:
            if K & mask:
                dp[d+1][0] = max(dp[d+1][0], dp[d][0] + cost1)
            else:
                dp[d+1][0] = max(dp[d+1][0], dp[d][0] + cost0)

    print(max(dp[MAX_DIGIT][0],dp[MAX_DIGIT][1]))

main()

Measured memory_bytes: 68696
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	std::cin.tie(0); std::cin.sync_with_stdio(false);
	int n, r, t; std::cin >> n >> r >> t;
	std::vector<int> cups(r, 0);
	std::vector<int> runner(n); for (auto& p : runner) std::cin >> p;
	int sum_cup = 0;
	for (auto i = 1; i <= t; ++i) {
		for (auto p : runner) {
			if (cups[p * i % r] == 0) {
				++sum_cup;
				++cups[p * i % r];
			}
			--cups[p * i % r];
		}
		if (i != 1) for (auto p : runner) ++cups[p * i % r];
	}
	std::cout << sum_cup << std::endl;
}



Measured memory_bytes: 3224
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<vector>
#include<string>
using namespace std;

signed main() {
	string a; cin >> a;
	if (a[1] == a[2] && (a[0] == a[1] || a[2] == a[3]))puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#include<stdio.h>

main(void){
    int i, n;
    
    scanf("%d", &n);
    int num[n][4];
    
    for( i = 0; i < n; i++){
        scanf("%d %d %d", &num[i][0], &num[i][1], &num[i][2]);
        if((num[i][2]*num[i][2]==num[i][0]*num[i][0]+num[i][1]*num[i][1])||(num[i][0]*num[i][0]==num[i][1]*num[i][1]+num[i][2]*num[i][2])||(num[i][1]*num[i][1]==num[i][0]*num[i][0]+num[i][2]*num[i][2])){
            num[i][3] = 1;
        }else{
            num[i][3] = 0;
        }
    }
    
    for( i = 0; i < n; i++){
        switch (num[i][3]){
            case 0:
            printf("NO\n");
            break;
            case 1:
            printf("YES\n");
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<vector<pair<int, long long> > >g(n + 3);
    for(int i = 1; i < n; i++){
        int u, v;
        long long w;
        cin >> u >> v >> w;
        g[u].push_back({v, w});
        g[v].push_back({u, w});
    }
    vector<int>vis(n + 3, 0), col(n + 3);
    vector<long long>dist(n + 3);
    vis[1] = 1;
    dist[1] = 0;
    col[1] = 0;
    queue<int>q;
    q.push(1);
    while(!q.empty()){
        int u = q.front();
        q.pop();
        for(int i = 0; i < g[u].size(); i++){
            pair<int, long long>p = g[u][i];
            int v = p.first;
            if(vis[v] == 0){
                vis[v] = 1;
                dist[v] = dist[u] + p.second;
                col[v] = dist[v] % 2;
                q.push(v);
            }
        }
    }
    for(int i = 1; i <= n; i++){
        cout << col[i] << '\n';
    }
    return 0;
}

Measured memory_bytes: 9472
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

constexpr ll NOT_SPECIFIED_VALUE_MIN = INT64_MIN;
constexpr ll NOT_SPECIFIED_VALUE_MAX = INT64_MAX;

ll mod1000(ll v) {
	if (v % 1000 == 0) {
		return 1000;
	}
	else {
		return v % 1000;
	}
}

int main() {
	ll n;
	cin >> n;
	cout << 1000 - mod1000(n) << endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <utility>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>

#define rep(i, m, n) for (int (i)(m); (i)<(n); ++(i))
#define repv(i, v) for (int (i)(0); (i)<(v.size()); ++(i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define all(v) (v).begin(), (v).end()

using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

int main(){
	ll N, M;
	cin >> N >> M;
	vvll xyz;
	rep(i, 0, N) {
		ll x, y, z;
		cin >> x >> y >> z;
		xyz.push_back({x, y, z});
	}
	ll sign[8][3] = {{1,1,1},{1,1,-1},{1,-1,1},{-1,1,1},
				{1,-1,-1},{-1,1,-1},{-1,-1,1},{-1,-1,-1}};
	ll sum = 0;
	rep(i, 0, 8) {
		vll s;
		rep(j, 0, N) {
			s.push_back(xyz[j][0] * sign[i][0]
						+ xyz[j][1] * sign[i][1]
						+ xyz[j][2] * sign[i][2]);
		}
		sort(all(s), greater<ll>());
		ll t = 0;
		rep(j, 0, M) {
			t += s[j];
		}
		sum = max(sum, t);
	}
	cout << sum << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    string a;
    cin >> a ;
    //*/
    
    if(a.at(0) == '1'){
        a.at(0) = '9';
    } else {
        a.at(0) = '1';
    }

    if(a.at(1) == '1'){
        a.at(1) = '9';
    } else {
        a.at(1) = '1';
    }

    if(a.at(2) == '1'){
        a.at(2) = '9';
    } else {
        a.at(2) = '1';
    }

    /*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    //*/
    
    /*
    if( a * b % 2 == 0 ){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    //*/
    
    cout << a << endl;

    return 0; 
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
using namespace std;
int main(void){
    int N, K;
    cin >> N >> K;
    string D;
    for(int i=0; i<K; i++) {
        char c;
        cin >> c;
        D.push_back(c) ;
    }
 
    for(int i=N; i<1000000; i++) {
        if(to_string(i).find_first_of(D) == string::npos) {
            cout << i << endl;
            return 0;
        }
    }
    return 0 ;
}
    
  

Measured memory_bytes: 3664
using System;
using System.Collections.Generic;

namespace abc175_a
{
  class Program
  {
    static void Main(string[] args)
    {
      var S = CIn.Read().ToCharArray();

      var lastS = -1;
      var max = 0;

      for (int i = 0; i < S.Length; i++)
      {
        if (S[i] == 'S')
        {
          max = Math.Max(max, i - lastS - 1);
          lastS = i;
        }
      }

      max = Math.Max(max, S.Length - lastS - 1);

      Console.WriteLine(max);
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


Measured memory_bytes: 26328
#include <bits/stdc++.h>
    #define rep(i,n) for(int i=0;i<(int)(n);++i)
    #define repone(i,n) for(int i=1;i<(int)(n);++i)

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

    #define int long long

    using namespace std;

    signed main()
    {
        int x=0,y=0,z=0,w,i,j;
        cin>>x;
      if(x==25){
              cout<<"Christmas"<<endl;
      }else if(x==24){
      cout<<"Christmas Eve";
      }else if(x==23){
      cout<<"Christmas Eve Eve";
      }else{
      cout<<"Christmas Eve Eve Eve";
      }

        return 0;
    }


Measured memory_bytes: 256
#include <stdio.h>
#define max(a, b) a<b?b:a
#define INF 1010001000

int board[10][10];
int copy[10][10];
int used[10][10];
int h, w, c, ans, ret;

void init(void);
void clused(void);
void dfs(int color, int x, int y);
void count(int color, int x, int y);

int main(void)
{
    int i, j, k, l, m, n;
    scanf("%d%d%d", &h, &w, &c);
    while (h) {
        init();
        for (i = 0; i < h; i++) {
            for (j = 0; j < w; j++) {
                scanf("%d", &board[i][j]);
                board[i][j]--;
                copy[i][j] = board[i][j];
            }
        }
        for (i = 0; i < 6; i++) {
            for (j = 0; j < 6; j++) {
                for (k = 0; k < 6; k++) {
                    for (l = 0; l < 6; l++) {
                        for (n = 0; n <= h; n++) {
                            for (m = 0; m <= w; m++) {
                                board[n][m] = copy[n][m];
                            }
                        }
                        dfs(i, 0, 0);
                        clused();

                        dfs(j, 0, 0);
                        clused();

                        dfs(k, 0, 0);
                        clused();

                        dfs(l, 0, 0);
                        clused();

                        dfs(c-1, 0, 0);
                        clused();

                        ans = 0;
                        count(c-1, 0, 0);
                        clused();

                        ret = max(ret, ans);
                    }
                }
            }
        }
        printf("%d\n", ret);
        scanf("%d%d%d", &h, &w, &c);
    }
    return 0;
}

void count(int color, int x, int y) 
{
    int i;
    int dx[4] = {0, -1, 0, 1};
    int dy[4] = {1, 0, -1, 0};
    ans++;
    used[x][y] = 1;
    for (i = 0; i < 4; i++) {
        if (0 <= x + dx[i]  && x + dx[i] < h && 
                0 <= dy[i] + y && dy[i] + y < w &&
                !used[x+dx[i]][y+dy[i]] && 
                board[x+dx[i]][y+dy[i]] == board[x][y]) {
            count(color, x+dx[i], y+dy[i]);
        }
    }
}

void dfs(int color, int x, int y)
{
    int i;
    int dx[4] = {0, -1, 0, 1};
    int dy[4] = {1, 0, -1, 0};
    used[x][y] = 1;
    for (i = 0; i < 4; i++) {
        if (0 <= x + dx[i]  && x + dx[i] < h && 
                0 <= dy[i] + y && dy[i] + y < w &&
                !used[x+dx[i]][y+dy[i]] && 
                board[x+dx[i]][y+dy[i]] == board[x][y]) {
            dfs(color, x+dx[i], y+dy[i]);
        }
    }
    board[x][y] = color;
}

void init(void)
{
    int i, j;
    for (i = 0; i <= h; i++) {
        for (j = 0; j <= w; j++) {
            board[i][j] = INF;
            used[i][j] = 0;
        }
    }
    ret = 0;
    ans = 0;
}

void clused(void)
{
    int i, j;
    for (i = 0; i <= h; i++) {
        for (j = 0; j <= w; j++) {
            used[i][j] = 0;
        }
    }
}

Measured memory_bytes: 604
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		sc.close();

		double ans = 0;
		for (int i = 1; i <= n; i++) {
			int s = i;
			double val = 1.0 / n;
			while (s < k) {
				s *= 2;
				val /= 2;
			}
			ans += val;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23380
/*
@author: sharrad99
*/
#include<bits/stdc++.h>
using namespace std;
int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	long double l;
	cin >> l;

	long double x = (l / 3.0);

	cout << fixed << setprecision(12) << (x * x * x) << '\n';
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();

        String ans = "Yes";
        int t0 = 0;
        int x0 = 0;
        int y0 = 0;
        for (int i = 0; i < N; i++) {
            int t1 = in.i();
            int x1 = in.i();
            int y1 = in.i();

            int d = t1 - t0 - Math.abs(x0 - x1) - Math.abs(y0 - y1);
            if (d < 0 || d % 2 == 1) {
                ans = "No";
                break;
            }

            t0 = t1;
            x0 = x1;
            y0 = y1;
        }
        
        System.out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}


Measured memory_bytes: 34960
#include<iostream>
#include<cctype>
#include<vector>
#include <ctype.h>
#include<algorithm>
#include<queue>
#include<string>
#include <math.h>
#include <iomanip>
using namespace std;
int a, b, c, d;
int main() {
	cin >> a >> b >> c >> d;
	cout << max(a*b, c*d) << endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
	int a, b;
	int x, y;

	scanf("%d", &x);
	scanf("%d", &a);
	scanf("%d", &b);

	y = (x - a) / b ;

	printf("%d", x - a - y * b);
	getchar;
	getchar;
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
#include <string.h>
#include <iomanip>

using namespace std;

int main()
{
	vector <int> A(2);
	cin >> A[0] >> A[1];
	
	sort(A.begin(), A.end());
	
	if (A[0] == 1 && A[1] == 2) cout << 3 <<endl;
	else if (A[0] == 2 && A[1] == 3) cout <<1 <<endl;
	else if (A[0] == 1 && A[1] == 3) cout << 2<<endl;
	
	return 0;
	
	
	

}



Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    string S; cin >> S;
    vector<int> A(N);
    bool check = false;
    rep(i,N) {
        A[i] = S[i] - '1';
        if (A[i]==1) check = true;
    }

    if (check) {
        int cnt = 0;
        rep(i,N) {
            if (A[i]%2==1) {
                if (((N-1) & i) == i) cnt++; 
            }
        }
        cout << ((cnt&1) ? 1 : 0) << ln;
    } else {
        int cnt = 0;
        rep(i,N) {
            if (A[i]==2) {
                if (((N-1) & i) == i) cnt++;
            }
        }
        cout << ((cnt&1) ? 2 : 0) << ln;
    }
}


Measured memory_bytes: 5276
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	var N int
	fmt.Sscanf(scanner.Text(), "%d", &N)

	fact := make(map[int]int)
	factorPerm(N, fact)
	//fmt.Println(fact)

	var ans int
	{
		// 5, 5, 3
		fiv := 0
		thr := 0
		for _, v := range fact {
			if v+1 >= 5 {
				fiv++
				thr++
			} else if v+1 >= 3 {
				thr++
			}
		}
		if fiv < 2 || thr < 1 {
			ans = ans + 0
		} else {
			ans = ans + ((fiv*(fiv-1))/2)*(thr-2)
		}
	}

	{
		// 15, 5
		fifteen := 0
		fiv := 0
		for _, v := range fact {
			if v+1 >= 15 {
				fifteen++
				fiv++
			} else if v+1 >= 5 {
				fiv++
			}
		}
		if fifteen < 1 || fiv < 1 {
			ans = ans + 0
		} else {
			ans = ans + fifteen*(fiv-1)
		}
	}

	{
		// 25, 3
		tfiv := 0
		thr := 0
		for _, v := range fact {
			if v+1 >= 25 {
				tfiv++
				thr++
			} else if v+1 >= 3 {
				thr++
			}
		}
		if tfiv < 1 || thr < 1 {
			ans = ans + 0
		} else {
			ans = ans + tfiv*(thr-1)
		}
	}

	{
		// 75
		sfiv := 0
		for _, v := range fact {
			if v+1 >= 75 {
				sfiv++
			}
		}
		if sfiv < 1 {
			ans = ans + 0
		} else {
			ans = ans + sfiv
		}
	}

	fmt.Println(ans)
}

func factorPerm(num int, fact map[int]int) {
	for i := 1; i <= num; i++ {
		factor(i, fact)
	}
}

func factor(n int, fact map[int]int) {
	if isPrime(n) {
		fact[n]++
		return
	}
	for p := 2; p <= int(math.Floor(float64(n)/2)); p++ {
		if isPrime(p) && n%p == 0 {
			fact[p]++
			factor(n/p, fact)
			break
		}
	}
}

func isPrime(value int) bool {
	for i := 2; i <= int(math.Floor(float64(value)/2)); i++ {
		if value%i == 0 {
			return false
		}
	}
	return value > 1
}


Measured memory_bytes: 640
#E
H,N=map(int,input().split())
A=[0 for i in range(N)]
dp=[float("inf") for i in range(10**4+1)]
dp[0]=0
for i in range(N):
    a,b=map(int,input().split())
    A[i]=a
    for j in range(10**4+1):
        if j+a>10**4:
            break
        dp[j+a]=min(dp[j]+b,dp[j+a])


if H+max(A)>10**4:
    print(min(dp[H:]))
else:
    print(min(dp[H:H+max(A)]))

Measured memory_bytes: 51676
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {
    
    int a,b;
    cin>>a>>b;
    cout<<max({a+b,a-b,a*b})<<endl;
}

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

signed main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < int(s.size()); ++i)
		ans += (s[i] != t[i]);
	cout << ans << '\n';
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
 
#define lp(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define ff first
#define ss second
 
const int maxn=105 ;
const int maxv=1005 ;
const int inf=1e9+10 ;
 
using namespace std ;
 
ll dp[maxn*maxv] ;
pair<ll,ll> v[maxn] ;
int ans ;
 
int main()
{
  lp(i,1,maxn*maxv) dp[i]=inf ;
  dp[0]=0;
 
  int n, w ;
 
  scanf("%d%d",&n,&w) ;
  lp(i,0,n) scanf("%lld%lld", &v[i].ff, &v[i].ss) ;
 
  lp(i,0,n)
  {
    for(int j=ans+v[i].ss ; j >= v[i].ss ; j -- )
    {
      if(dp[ j-v[i].ss ] + v[i].ff <= w )
      {
        dp[j] = min(dp[j] , dp[ j-v[i].ss ] + v[i].ff ) , ans=max(ans,j) ;
      }
    }
  }
  printf("%d\n", ans) ;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
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 <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    vector<P> p(m);
    rep (i, n) cin >> a[i];
    // rep (i, m) cin >> b[i] >> c[i];
    rep (i, m) cin >> p[i].second >> p[i].first;
    sort(all(p));reverse(all(p));
    sort(all(a));
    ll sum = 0;
    rep (i, n) sum += a[i];
    ll now = 0, nowi = 0, maxi = 0;
    rep (i, m) maxi += p[i].second;
    for (ll i = 0; i < min((ll)n, maxi); i++) {
        int k = p[now].first;
        nowi = (nowi + 1) % p[now].second;
        if (nowi == 0) now++;
        if (k < a[i]) break;
        else sum += k - a[i];
    }
    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;

int main(){
  int x, y;
  cin >> x >> y;
  if((y-2*x) % 2 == 0 && (4*x-y)%2 == 0 &&y-2*x>=0&&4*x-y>=0) cout << "Yes"<<endl;
  else cout << "No"<<endl;
}



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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

void solve()
{
    int n;
    cin >> n;
    
    string ss;
    cin >> ss;
    
    int p[3] = {0};
    int s[3] = {0};
    
    f(i,n) if(ss[i] == 'R') s[0]++;
           else if(ss[i] == 'G') s[1]++;
           else s[2]++;
        
    int res = 0;  
        
    for(int i=0;i<n;i++)
    {
        if(ss[i] == 'R') s[0]--;
        else if(ss[i] == 'G') s[1]--;
        else s[2]--;
        
        if(ss[i] == 'R') res+=(p[1]*s[2]) + (p[2]*s[1]);
        else if(ss[i] == 'G') res+=(p[0]*s[2]) + (s[0]*p[2]);
        else res+=(p[0]*s[1]) + (s[0]*p[1]);
            
        for(int j=1;j<n;j++)
        {
            int left = i-j;
            int right = i+j;
            
            if(left < 0 || right >= n) break;
                
            if(ss[left] != ss[i] && ss[i] != ss[right] && ss[right] != ss[left])
                res--;
        }
            
            
        if(ss[i] == 'R') p[0]++;
        else if(ss[i] == 'G') p[1]++;
        else p[2]++; 
    }
 
    cout << res;
}

signed main()
{
    fast;
    solve();
}

Measured memory_bytes: 3668
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int INF=2147483647;
const double pi=3.1415926535897932384626;
inline ll read(){
	ll x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*f;
}
const int maxn=1e4+5;
int n,m,u,v,dd,cc,ans,d[maxn],c[maxn],vis[maxn];
struct edge{
	int to,dis,cost;
};
vector<edge> g[maxn];
void Dijkstra(){
	memset(vis,0,sizeof(vis));
	memset(d,inf,sizeof(d));
	memset(c,inf,sizeof(c));
	d[1]=0;
	c[1]=0;
	ans=0;
	while(1){
		int v=-1;
		for(int u=1;u<=n;u++){
			if(!vis[u]&&(v==-1||d[u]<d[v])) v=u;
		}
		if(v==-1) break;
		vis[v]=1;
		ans+=c[v];
		for(int i=0;i<g[v].size();i++){
			int u=g[v][i].to,dis=g[v][i].dis,cost=g[v][i].cost;
			if(d[u]>d[v]+dis||(d[u]==d[v]+dis&&cost<c[u])){
				d[u]=d[v]+dis;
				c[u]=cost;
			}
		}
	}
}
int main(){
	while(~scanf("%d%d",&n,&m)&&(n+m)){
		for(int i=1;i<=n;i++) g[i].clear();
		for(int i=1;i<=m;i++){
			u=read(),v=read(),dd=read(),cc=read();
			g[u].push_back({v,dd,cc});
			g[v].push_back({u,dd,cc});
		}
		Dijkstra();
		printf("%d\n",ans);
	}
	return 0;
}


Measured memory_bytes: 4928
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int d[1000];
int main()
{
	int n, k;
	scanf("%d%d", &n, &k);
	int maxi = 0;
	for (int i = 0; i < k; i++)
	{
		int z;
		scanf("%d", &z);
		maxi = max(maxi, z);
	}
	if (maxi * 2 - 1 <= n)printf("0\n");
	else printf("%d\n", maxi + maxi - n - 1);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
using namespace std;
using ll = long long;

signed main() {
    IO;
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll xor_val = 0, and_val;
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
        if(i > 1) xor_val ^= a[i];
    }
    if((a[0] + a[1] - xor_val < 0) || (a[0] + a[1] - xor_val) % 2 == 1) {cout << -1; return 0;}
    and_val = (a[0] + a[1] - xor_val) / 2;
    if((and_val & xor_val) != 0) {cout << -1; return 0;}
    
    ll a0 = 0, a1 = 0;
    bool pos = true;
    for(ll i = 39; i >= 0; --i) {
        ll two = 1ll << i;
        if(and_val & two) {
            a0 |= two; a1 |= two;
        }
    }
    for(ll i = 39; i >= 0; --i) {
        ll two = 1ll << i;
        if(xor_val & two) {
            ll new_a0 = a0 | two;
            if(new_a0 < a[0]) a0 = new_a0;
            else a1 |= two;
        }
    }

    if(a0 == 0) pos = false;
    if(a0 > a[0]) pos = false;

    if(!pos) cout << -1;
    else cout << a[0] - a0;
    return 0;
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n;
	cin >> n;
	print((1000-(n%1000))%1000);
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
double dp[3010][3010];
int main(){
    // dp[i][j]:i枚まで見てj枚表の確率
    dp[0][0] = 1;
    int n;
    cin >> n;
    vector<double> p(n);
    rep(i,n){
        cin >> p[i];
    }
    rep(i,n){
        rep(j,n){
            dp[i+1][j]+=dp[i][j]*(1-p[i]);
            dp[i+1][j+1] = dp[i][j]*p[i];
        }
    }
    double ans = 0;
    for(int i = n/2+1;i<=n;i++){
        ans += dp[n][i];
    }
    printf("%.10lf\n",ans);
return 0;
}

Measured memory_bytes: 70784
import Control.Applicative
import Control.Monad
import Data.List

main = do
  n <- (read::String -> Int) <$> getLine
  arr <- map (read::String -> Int) . words <$> getLine
  let mismatch = foldl (\acc i -> if arr !! (i - 1) /= i then acc + 1 else acc) 0 [1..n]
  putStrLn $ if mismatch <= 2 then "YES" else "NO"


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define MINIMUM -10000000000

int N;
vector<ll> X;
vector<ll> L;
vector<P> A;
vector<P> B;


int main(){
  cin >> N;

  ll x, l;
  for(int i = 0; i < N; i++){
    cin >> x >> l;
    X.push_back(x); L.push_back(l);
  }

  /*右端重要なので、firstに右端座標を入れる*/
  for(int i = 0; i < N; i++){ P p = make_pair(X[i]+L[i], X[i]-L[i]); A.push_back(p); }
  sort(A.begin(), A.end());

  /*以下、val以上であるsecond値が最も小さいものを選び続ける*/
  int cn = 0; ll end = MINIMUM;
  for(int i = 0; i < N; i++){
    if(end <= A[i].second) {  //前の右端範囲が次の(右端が最小の)ロボの左端とぶつかってない
      cn++; 
      end = A[i].first;
    }
  }
  
  cout << cn << endl;
  return 0;
}


Measured memory_bytes: 3948
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var nx = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var cand = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        Array.Sort(cand);
        for(var i = 0; i < nx[0]; i++)
            if (nx[1] - cand[i] < 0) { WriteLine(i); return; }
            else nx[1] -= cand[i];
        WriteLine(nx[1]==0?nx[0]:nx[0]-1);
    }
}


Measured memory_bytes: 11092
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e6+10;
#define int ll
const long double pi = 3.14159265358979323846;

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

// 高速素因数分解
vector<ll> primes(n_max);
void build_prime(){
    std::iota(primes.begin(), primes.end(), 0);
    primes[0] = 1;
    for(int i = 2; i < n_max; i++){
        if(primes[i] == i){
            for(int j = i * 2; j < n_max; j += i){
                primes[j] = i;
            }
        }
    }
}

map<int, int> prime_factor(int x){
    map<int, int> res;
    while(x != 1){
        res[primes[x]]++;
        x /= primes[x];
    }

    return res;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll ans = 0;
    build_prime();
    rep(c, 1, n) {
        ll m = n - c;
        auto mp = prime_factor(m);
        ll tmp = 1;
        for(auto &p : mp){
            tmp *= p.second + 1;
        }
        ans += tmp;
    }

    cout << ans << "\n";
}

Measured memory_bytes: 18572
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;

int n;

string temp[]={".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		string t[1000];
		bool flag=0;
		int now=0;
		for(int j=0;j<(int)s.length();j++){
			if(s[j]=='0'){
				if(flag){
					now++;
					t[now]="";
					flag=0;
				}
			}else{
				t[now]+=s[j];
				flag=1;
			}
		}
		string ans="";
		for(int j=0;j<now;j++){
			int index=t[j][0]-'1';
			int index2=t[j].length()%temp[index].length();
			if(index2==0)index2=temp[index].length()-1;
			else index2--;
			ans+=temp[index][index2];
		}
		cout<<ans<<"\n";
	}
	return 0;
}

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

int main()
{
  int N, M;

  cin >> N >> M;

  int sum = 0;

  for (int i = 0; i < M; i++)
  {
    int A;
    cin >> A;
    sum += A;
  }

  if (N - sum >= 0)
  {
    cout << N - sum << endl;
  }
  else
  {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 3628