akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N; cin>>N;
  if(N <9)
    cout << N << endl;
  else if(N < 100)
    cout << 9 << endl;
  else if(N < 999)
    cout << 9 + N - 100 + 1 << endl;
  else if(N < 10000)
    cout << 909 << endl;
  else if(N < 99999)
    cout << 909 + N - 10000  + 1<< endl;
  else cout << 90909 << endl;
}


Measured memory_bytes: 3600
#include<stdio.h>
#include<math.h>
double dist(int *,int *,int,int);
int main(void){
int N;
  scanf("%d",&N);
  int x[N+1],y[N+1];
  for(int i=0;i<N;i++){
    scanf("%d %d",&x[i],&y[i]);
  }
double len=0;
  for(int i=0;i<N-1;i++){
    for(int j=i+1;j<N;j++){
      len+=dist(x,y,i,j);
    }
  }
  int num=2;
  for(int i=N-1;i>=1;i--){
num*=i;
  }
int all=1;
  for(int i=N;i>=1;i--){
all*=i;
  }
  double ave=len*num/all;
  printf("%.10lf",ave);
  return 0;
}
double dist(int x[],int y[],int i,int j){
  
  double dx=x[i]-x[j];
  double dy=y[i]-y[j];
  //printf("%dと%dの差 %lf\n",x[i],x[j],dx);
  //printf("%dと%dの差 %lf\n",y[i],y[j],dy);          
  return sqrt(dx*dx+dy*dy);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
struct point
{
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll k;
    cin>>k;
    ll ans=0;
    rep (i,1,k+1)
    {
        rep (j,1,k+1)
        {
            rep (z,1,k+1)
            {
                ans+=__gcd(__gcd(i,j),z);
            }
        }
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define MIN(a,b) (((a)<(b))?(a):(b))
using namespace std;

int main(){
    int mod = 2019;
    int l, r, i, j;
    cin >> l >> r;
    int ml = l % mod;
    int mr = r % mod;
    if(r - l >= mod || mr < ml){
        cout << 0 << endl;
    }
    else{
        int m = mod;
        for(i = ml; i <= mr; i++){
            for(j = i+1; j <= mr; j++){
                m = MIN(i * j % mod, m);
            }
        }
        cout << m << endl;
    }
}

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

/***Crazy Macros***/
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define reu(i,a,b) for (ll i = (a); i <= (b); ++i)
#define red(i,a,b) for (ll i = (a); i >= (b); --i)
typedef int64_t ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
const ll inf = 1e18;
const ll mod = 998244353;

/***Graph Variables***/
vector<vi> adj;
vector<vi> radj;
vi visited;
vi level;

/***Common Functions***/
ll inp() {ll x; cin >> x; return x;}
string inpStr() {string x; cin >> x; return x;}

ll power(ll a, ll b) {
    a %= mod;
    ll res = 1;
    reu(i, 0, log2(b)) {
        if (b & (1<<i)) res = (res*a) % mod;
        a = (a*a) % mod;
    }
    return res;
}
ll gcd(ll a, ll b) {
    while (b > 0) {ll tmp = a%b; a = b; b = tmp;}
    return a;
}
void fast_io() {ios::sync_with_stdio(0); cin.tie(0);}

void file_io(string in, string out) {
    freopen(in.c_str(), "r", stdin);
    freopen(out.c_str(), "w", stdout);
}
/***Main Code***/
bool pal(string s, ll b, ll e) {
    reu(i, b, (b+e)/2)
        if (s[i] != s[b+e-i]) return false;
    return true;
}
int main()
{
    fast_io();
    string s = inpStr();
    ll n = s.length();
    s = ' ' + s;
    if (pal(s, 1, n) && pal(s, 1, (n-1)/2) && pal(s, (n+3)/2, n))
        cout << "Yes";
    else cout << "No";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

char toLowerCase(char c){
  if(isLowerCase(c)){
    return c;
  }else{
    return c+'a'-'A';
  }
}
char toUpperCase(char c){
  if(isLowerCase(c)){
    return c-('a'-'A');
  }else{
    return c;
  }
}
ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  string n;cin>>n;
  int ans=0;
  for(int i=0;i<n.size();i++){
    if(n[i]=='2'){
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3564
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
#define long long long

const int N = 50 + 10;
const int MOD = 1e9 + 7;

typedef vector< vector<long> > matrix;
long n, k;
matrix X(N, vector<long>(N, 0)), Y(N, vector<long>(N, 0));

matrix mul(const matrix& a, const matrix& b)
{
    matrix c;
    c.resize(N, vector<long> (N, 0));
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            for (int k = 0; k < n; ++k)
                (c[i][j] += a[i][k] * b[k][j]) %= MOD;
    return c;
}

void pow(long k)
{
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) Y[i][j] = 0;
        Y[i][i] = 1;
    }

    while (k) {
        if (k & 1) Y = mul(Y, X);
        X = mul(X, X);
        k >>= 1;
    }
}

int main()
{
//    freopen("tam.inp", "r", stdin);
    cin.tie(nullptr); ios_base::sync_with_stdio(false);

    cin >> n >> k;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j) cin >> X[i][j];

    pow(k);
    long cnt = 0;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j) (cnt += Y[i][j]) %= MOD;
    cout << cnt;

    return 0;
}


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

int n, m, c[15] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
bool v[10005];
string a[15], d[10005];

string f(string p, string q) {
	if (p.size() > q.size()) return p;
	if (p.size() < q.size()) return q;
	if (p > q) return p;
	return q;
}

int main()
{
	int i, j, t;
	cin >> n >> m;
	for (i = 0; i < m; i++) cin >> a[i];
	v[0] = 1;
	for (i = 1; i <= n; i++) {
		for (j = 0; j < m; j++) {
			t = c[a[j][0] - '0'];
			if (t <= i) {
				if (v[i - t]) v[i] = 1, d[i] = f(d[i], d[i - t] + a[j]);
			}
		}
	}
    cout << d[n] << endl;
    return 0;
}

Measured memory_bytes: 41472
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const long double pi = acos(-1);

int main()
{
	long long x , d , r ; 
	cin >> r >> d  >> x ;
	for (int i = 0; i < 10; ++i)
	{
		x = r*x - d ;
		cout << x << endl ;
	}
	return 0 ;
}


Measured memory_bytes: 384
rest = Array.new
3.times do
  ps = Array.new
  8.times do
    num,t =  gets.split
    num = num.to_i
    t = t.to_f
    ps << [num,t]
  end
  ps.sort!{|a,b| a[1]-b[1]}
  puts "%d %.2f" % ps[0]
  puts "%d %.2f" % ps[1]
  rest << ps[2]
end
rest.sort!{|a,b| a[1]-b[1]}
puts "%d %.2f" % rest[0]
puts "%d %.2f" % rest[1]

Measured memory_bytes: 2348
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define int long long int
#define mod 1000000007
void fast(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
main()
{
	int n;
	cin>>n;
	int a[n+5];
	int h[1005]={0};
	int h1[1005]={0};
	for(int i=1;i<=n;i++){
		cin>>a[i];
		h1[a[i]]++;
		h[a[i]]++;
	}
	int ans=0;
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		h[i]+=h[i-1];
		// cout<<a[i]<<" ";
	}
	// cout<<endl;
	for(int i=1;i<=n;i++){
		int k=i+2;
		for(int j=i+1;j<n;j++){
			while(k<=n&&(a[i]+a[j])>a[k]){
				k++;
			}
			// cout<<a[i]<<" "<<a[j]<<" "<<k<<endl;
			ans+=((k-1)-(j));
			// for(int k=j+1;k<=n;k++){
			// 	if((a[i]+a[j])>a[k]){cout<<a[i]<<" "<<a[j]<<" "<<a[k]<<endl;}
			// }
		}
	}
	cout<<ans<<endl;
}

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

int main() {
    int64_t n, x;
    cin >> n >> x;
    vector<int64_t> cnt_all = {1};
    for(int i = 1; i <= n; i++){
        cnt_all.push_back(2*cnt_all[i-1]+3);
    }
    vector<int64_t> cnt_p = {1};
    for(int i = 1; i <= n; i++){
        cnt_p.push_back(2*cnt_p[i-1]+1);
    }
    int64_t ans = 0;
    for(int i = n; i >= 0; i--){
        int64_t cai = cnt_all[i];
        int64_t cpi = cnt_p[i];
        if(x < cai-i){
            x--;
            //cout << i << " " << 0 << " " << x << " " << ans << endl;
            if(x <= 0) break;
        }
        else if(x <= cai){
            ans += cpi;
            // << i << " " << 1 << " " << x << " " << ans << endl;
            break;
        }
        else if(x <= cai+2){
            ans += cpi+1;
            //cout << i << " " << 2 << " " << x << " " << ans << endl;
            break;
        }
        else{
            ans += cpi+1;
            x -= cai+2;
            //cout << i << " " << 3 << " " << x << " " << ans << endl;
            if(x <= 0) break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int[] alpha = new int [26];
        String s;
        while(sc.hasNextLine()){
            s = sc.nextLine();
            s = s.toLowerCase();
            char[] s_ch = new char[s.length()];
            for(int i = 0;i < s.length();i++){
                s_ch[i] = s.charAt(i);
                if(s_ch[i]-'a'>=0&& s_ch[i] - 'a' < 26){
                    alpha[s_ch[i]-'a']++;
                }
            }
            
        }
        for(int i = 0;i<26;i++){
            System.out.printf("%c : %d%n",'a'+i,alpha[i]);
        }
        sc.close();
    }
}


Measured memory_bytes: 26404
n,x,y = map(int,input().split())
A = [0]*n
for i in range(1,n):
    for j in range(i+1,n+1):
        A[min(j-i,abs(i-x)+1+abs(j-y))] += 1

for i in range(1,n):
    print(A[i])

Measured memory_bytes: 3444
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://beta.atcoder.jp/contests/agc029/tasks/agc029_b>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int N; cin >> N;
    vector<ll> A(N); for(auto& in:A) cin >> in;
    sort(A.begin(),A.end());
    map<ll,ll> mp; for(auto a:A) mp[a]++;
    for(int i = N-1;i>=0;i--){
        if(mp[A[i]]==0) continue;
        ll v = 1; while(v <= A[i]) v *= 2;
        ll r = v-A[i];
        mp[A[i]]--;
        if(mp[r]==0) continue;
        mp[r]--;
        res++;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 26880
/*input

*/


// assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;

// order_of_key (k) : Number of items strictly smaller than k .
// find_by_order(k) : K-th element in a set (counting from zero).
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll          long long int
#define pb          push_back
#define pii         pair<ll ,ll >
#define vpii        vector< pii >
#define vi          vector<ll >
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define debug(x)     cout << #x << " " << x << endl;
#define debug_p(x)   cout << #x << " " << x.F << " " << x.S << endl;
#define debug_v(x)   {cout << #x << " "; for (auto ioi : x) cout << ioi << " "; cout << endl;}
#define debug_vp(x)  {cout << #x << " "; for (auto ioi : x) cout << '[' << ioi.F << " " << ioi.S << ']'; cout << endl;}
#define debug_v_v(x) {cout << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cout << ioi2 << " "; cout << '\n';} cout << "*/" << #x << endl;}
ll n,k;
vi a;

ll check(ll x)
{
	ll ans = 0;
	rep(i,0,n) ans+=(a[i]-1)/x;
	return ans<=k;
}

int solve()
{
	cin>>n>>k;
	a.clear();
	a.resize(n);
	rep(i,0,n) cin>>a[i];
	sort(a.begin(), a.end(),greater<ll> ());
	ll low = 1,high = a[0];
	while(low<high) 
	{
		ll mid = low+(high-low)/2;
		if(check(mid)) high = mid;
		else low = mid+1; 
	}
	cout<<low<<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	//cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    map<int32,int32> m;
    REP(i,n){
        int32 a;
        cin >> a;
        m[a]++;
        if(m[a] >= 3)m[a] = 1;
    }
    int32 ans = 0;
    int32 cnt = 0;
    for(pii p : m){
        ans += p.second;
        if(p.second >= 2)cnt++;
    }
    ans -= (cnt + 1) / 2 * 2;
    ANS(ans);
    return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <queue>
#include <cstdio>
#include <cstring>
#include <string>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); ++i)
#define rep(i,n) REP(i,0,n)
#define DEB 0

/*
  [VtCh
   ém[hKðoR·éP[Xðl¦é
  s©çKÌÅZoHAK©çg1,g2ÌÅZoH
 */

int n,m,s,g1,g2;
int node[128][128];
int main(){
  while(cin>>n>>m>>s>>g1>>g2, n|m|s|g1|g2){
    s--; g1--; g2--;
    rep(i,128)rep(j,128)node[i][j] = INT_MAX;
    rep(i,128)node[i][i] = 0;

    // input
    rep(i,m){
      int a,b,c; cin>>a>>b>>c;
      node[a-1][b-1] = c;
    }
    // [VtCh
    rep(k,n){
      rep(i,n){
	rep(j,n){
	  if( node[i][k]==INT_MAX || node[k][j]==INT_MAX )continue;
	  node[i][j] = min(node[i][j] , node[i][k]+node[k][j]);
	}
      }
    }
#if DEB
    rep(i,n){
      rep(j,n){
	printf("%2d ",node[i][j]);
      }
      puts("");
    }
#endif
    int ans = INT_MAX;
    rep(k,n){ //oR·ém[hðßé
      if( k==g1 ){
	if( node[s][g1]!=INT_MAX && node[g1][g2]!=INT_MAX ){
	  ans = min(ans, node[s][g1] + node[g1][g2]);
	}
      }else if( k==g2 ){
	if( node[s][g2]!=INT_MAX && node[g2][g1]!=INT_MAX ){
	  ans = min(ans, node[s][g2] + node[g2][g1]);
	}
      }else{
	if( node[s][k]!=INT_MAX && node[k][g1]!=INT_MAX && node[k][g2]!=INT_MAX ){
	  ans = min(ans, node[s][k]+node[k][g1]+node[k][g2]);
	}
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 932
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b;
    cin>>a>>b;
    ll ans1=0;
    a--;
    for(ll i=1;i<=a;i*=2)
    {
        //cout<<i<<" "<<a+1<<" "<<((a+1)/(i*2))*(i)<<" "<<(((a+1)%(i*2)>i)?((a+1)%i):0)<<endl;
        ll temp=((a+1)/(i*2))*(i)+(((a+1)%(i*2)>i)?((a+1)%i):0);
        if(temp%2==1)
        {
            ans1=ans1+i;
        }
    }
    //cout<<ans1<<endl;
    ll ans2=0;
    a=b;
    for(ll i=1;i<=b;i*=2)
    {
        //cout<<i<<" "<<a+1<<" "<<((a+1)/(i*2))*(i)<<" "<<(((a+1)%(i*2)>i)?((a+1)%i):0)<<endl;
        ll temp=((b+1)/(i*2))*(i)+(((b+1)%(i*2)>i)?((b+1)%i):0);
        if(temp%2==1)
        {
            ans2+=i;
        }
    }
    //cout<<ans2<<endl;
    cout<<(ans1^ans2);
	return 0;
}


Measured memory_bytes: 256
line = input().split(' ')
X = int(line[0])
Y = int(line[1])

c = 1
count = 1
while 1:
	if (Y > 2*c*X):
		c *= 2
		count += 1
	elif (Y == 2*c*X):
		count += 1
		print(count)
		break
	elif (Y < 2*c*X):
		print(count)
		break

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
std::string S;
std::vector<P> v[3];

P rem(std::string &s){
    int l = 0, r = 0;
    
    for(char &c : s){
        if(c == '('){
            l += 1;
        }else if(l > 0){
            l -= 1;
        }else{
            r += 1;
        }
    }

    return std::make_tuple(r, l);
}

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

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> S;

        auto [r, l] = rem(S);

        if(r < l){
            v[0].emplace_back(r, l);
        }else if(r == l){
            v[1].emplace_back(r, l);
        }else{
            v[2].emplace_back(r, l);
        }
    }
    
    std::sort(v[0].begin(), v[0].end(), [](P &p, P &q){return fst(p) < fst(q);});
    std::sort(v[2].begin(), v[2].end(), [](P &p, P &q){return snd(p) > snd(q);});

    int cur = 0;
    bool ok = true;

    for(int i=0;i<3;++i){
        for(auto [r, l] : v[i]){
            if(cur < r){
                ok = false;
                break;
            }

            cur -= r;
            cur += l;
        }

        unless(ok){
            break;
        }
    }

    if(ok && cur == 0){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 11156
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll X;

    cin >> X;

    if(X>=30) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int n, ksize;
string key, nosuchprop = "no such property", obj = "object";
vector<string> s, keys;

string solve();

int main() {
  string tmp;
  cin >> key;
  cin.ignore();
  while(getline(cin, tmp)) s.push_back(tmp);
  n = s.size();
  cout << solve() << endl;
  return 0;
}

string solve() {
  int id = -1, nowdep = -1;
  for(int i = 0; i < key.size();) {
    assert(key[i] == '.');
    ++i;
    string tmp;
    while(i < key.size() && key[i] != '.') tmp += key[i++];
    keys.push_back(tmp);
  }
  ksize = keys.size();
  for(int i = 0; i < ksize; ++i) {
    int nextdep = -1;
    while(++id < n) {
      int dep = 0, j = 0, ssize = s[id].size();
      string nowkey;
      while(j < ssize && s[id][j] == ' ') ++dep, ++j;
      // depth check
      if(nextdep == -1 && dep == nowdep) continue;
      if(dep > nowdep) {
        if(nextdep != -1 && nextdep != dep) continue;
        nextdep = dep;
      }
      if(dep < nowdep || (nextdep != -1 && dep == nowdep))
        return nosuchprop;
      while(j < ssize && s[id][j] != ':')
        nowkey += s[id][j++];
      if(keys[i] == nowkey) {
        nowdep = dep;
        break;
      }
    }
    if(id == n) return nosuchprop;
    if(i == ksize - 1) {
      int j = 0, ssize = s[id].size();
      string tmp = "string \"";
      while(j < ssize && s[id][j] != ':') ++j;
      if(++j == ssize) return obj;
      ++j;
      while(j < ssize) tmp += s[id][j++];
      return tmp + "\"";
    }
  }
  assert(0);
  return "-1";
}


Measured memory_bytes: 3280
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    string s;
    cin >> s;
    if (count(s.begin(), s.end(), 'A') == 2 && count(s.begin(), s.end(), 'B') == 1
            || count(s.begin(), s.end(), 'B') == 2 && count(s.begin(), s.end(), 'A') == 1)
        yn;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
using namespace std;
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; }
typedef long long ll;

int main() {
    int n;
    string s, t;
    cin >> n >> s >> t;
    rep(i, n) {
        cout << s[i] << t[i];
    }
    
    return 0;
}



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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

ll pow_mod(ll a, ll n, ll p)
{
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*a%p;
        a = a*a%p;
        n >>= 1;
    }
    return res;
}

ll modinv(ll a, ll MOD)
{
    ll b = MOD, u = 1, v = 0;
    while(b){
        ll t = a/b;
        a -= t*b;   swap(a,b);
        u -= t*v;   swap(u,v);
    }
    u %= MOD;
    if(u < 0) u+= MOD;
    return u;
}

int main()
{
    ll MOD = 1e9+7;
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    map<ll,ll> mp;
    vector<map<ll,ll>> vmp(n);
    for(i = 0;i < n;++i){
        ll tmp = a.at(i);
        ll sn = sqrt(tmp);
        vector<pair<ll,ll>> insuu;
        ll so = 2;
        ll num = 0;
        while(true){
            if(tmp%so == 0){
                tmp /= so;
                ++num;
            }else{
                if(num != 0){
                    insuu.emplace_back(so,num);
                    num = 0;
                }
                ++so;
            }
            if(tmp == 1){
                insuu.emplace_back(so,num);
                break;
            }
            if(so > sn){
                insuu.emplace_back(tmp,1);
                break;
            }
        }
        for(auto x:insuu){
            vmp.at(i)[x.first] = x.second;
            if(mp.count(x.first)){
                if(mp[x.first] < x.second) mp[x.first] = x.second;
            }else{
                mp[x.first] = x.second;
            }
        }
    }
    ll ans = 0;
    ll lsd = 1;
    for(auto x:mp){
        ll so = x.first;
        ll num = x.second;
        ll tmp = pow_mod(so, num, MOD);
        lsd *= tmp;
        lsd %= MOD;
    }
    map<ll,ll> somap;
    for(i = 0;i < n;++i){
        ll tmp = lsd;
        for(auto x:vmp.at(i)){
            ll so =  x.first;
            ll num = x.second;
            ll tmp2;
            if(somap.count(so)){
                tmp2 = somap[so];
            }else{
                tmp2 = modinv(so, MOD);
                somap[so] = tmp2;
            }
            ll tmp3 = pow_mod(tmp2, num, MOD);
            tmp *= tmp3;
            tmp %= MOD;
        }
        ans += tmp;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;

    int cnt_ac=0;
    vector<bool> check(N+1, false);
    vector<int> miss(N+1, 0);

    for(int i = 0; i < M; i++){
        int p;
        string S;
        cin >> p >> S;

        if(check.at(p)) continue;
        else if(S != "AC") miss.at(p)++;
        else {
            cnt_ac++;
            check.at(p) = true;
        }
    }

    int cnt_miss=0;

    for(int i = 0; i < N+1; i++){
        if(check.at(i)) cnt_miss += miss.at(i);
    }

    cout << cnt_ac << " " << cnt_miss << endl;
}


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

void solve() {
    ll a, b;
    cin >> a >> b;

    // a - k = b - k -> a = b
    // a - k = k - b -> a + b = 2 * k

    if (a == b) {
        cout << 0 << endl;
    } else if ( (a + b) % 2 == 0 ) {
        cout << (a + b) / 2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        l: [i128; 4],
    }

    let a = l[0];
    let b = l[1];
    let c = l[2];
    let d = l[3];

    let ac = a*c;
    let ad = a*d;

    let bc = b*c;
    let db = d*b;

    println!("{}", std::cmp::max(std::cmp::max(ac, ad), std::cmp::max(bc, db)));

}


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

int64_t MOD = 1e9+7;

//---------- べき乗 ----------
int64_t modpower(int64_t a, int64_t n, int64_t mod){
    if(n == 0) return 1;
    
    int64_t res = 1;
    while(n > 0){
        if(n % 2 == 1) res = res * a % mod;
        a = a * a % mod;
        n /= 2;
    }

    return res;
}

//---------- 逆元 ----------
int64_t modinv(int64_t a, int64_t mod){
    return modpower(a, mod-2, mod);
}

//---------- 階乗 ----------
vector<int64_t> modfactorial(int64_t n, int64_t mod){
    vector<int64_t> res(n+1);

    res[0] = 1; 
    for(int i=1; i<=n; i++) res[i] = i * res[i-1] % mod;

    return res; // nまでの階乗の配列を返す
}


//--------- 組み合わせ ---------
int64_t modcombination(int64_t n, int64_t r, vector<int64_t> f, int64_t mod){
    return (f[n] * modinv(f[r], mod) % mod) * modinv(f[n-r], mod) % mod;
}

int main(){
  int64_t N, K;
  cin >> N >> K;
  
  vector<int64_t> f = modfactorial(N, MOD);

  for(int64_t i = 1; i<=K; i++){
    if(i > N-K+1){
      cout << 0 << endl;
    } else {
      cout << modcombination(N-K+1, i, f, MOD) * modcombination(K-1, i-1, f, MOD) % MOD << endl;
    }
  }
}
  
  

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Kenji
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC113A solver = new ABC113A();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC113A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            out.println(in.nextInt() + (in.nextInt() / 2));
        }

    }
}



Measured memory_bytes: 22612
#include <bits/stdc++.h>
const int N=200005,mu=1e9+7,inv2=(mu+1)/2;
int s[N],a[N],n,S,T[N],c[N],ans,d[N],zero[N];
void reduce(int &x) { x+=x>>31&mu; }
int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=x*1ll*x%mu)
		if (y&1) ans=ans*1ll*x%mu;
	return ans;
}
int lowbit(int x){
	return x&(-x);
}
void upd(int x,int y){
	while (x<=n){
		reduce(c[x]+=y-mu);
		x=x+lowbit(x);
	}
}
int getsum(int x){
	int res=0;
	while (x>0){
		reduce(res+=c[x]-mu);
		x-=lowbit(x);
	}
	return res;
}
void upd2(int x,int y){
	while (x<=n){
		reduce(d[x]+=y-mu);
		x=x+lowbit(x);
	}
}
int getsum2(int x){
	int res=0;
	while (x>0){
		reduce(res+=d[x]-mu);
		x-=lowbit(x);
	}
	return res;
}
int solve(){
	int res=0;
	memset(c,0,sizeof(c));
	for (int i=n;i>=1;i--){
		reduce(res+=getsum(a[i]-1)-mu);
		upd(a[i],1);
	}
	return res;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		s[a[i]]++;
	}
	S=1;
	for (int i=n-1;i;i--) s[i]+=s[i+1]-1;
	for (int i=1;i<=n;i++) {//总个数 
		if (s[i]<=0){
			puts("0");
			return 0;		
		}
		S=S*1ll*s[i]%mu;
	}
	T[0]=1;
	for (int i=1;i<=n;i++) {
		zero[i]=zero[i-1];
		if (s[i]-1==0) T[i]=T[i-1],zero[i]++;
		else T[i]=T[i-1]*1ll*(s[i]-1)%mu*ksm(s[i],mu-2)%mu;
	}
	int sum=0; 
	for (int i=n;i>=1;i--){//a[i]<=a[j] 
		int t=(sum-getsum(a[i]-1)-(sum-getsum2(zero[a[i]]))+mu)%mu;
		ans=(ans+t*1ll*S%mu*ksm(T[a[i]],mu-2))%mu;
		reduce(sum+=T[a[i]]-mu);
		upd(a[i],T[a[i]]);
		upd2(zero[a[i]],T[a[i]]);
	}
	ans=ans*1ll*inv2%mu;
	memset(c,0,sizeof(c)),memset(d,0,sizeof(d)),sum=0;
	for (int i=1;i<=n;i++){//a[i]>a[j] 从a[i]->a[j] 
		int t=(sum-getsum(a[i])-(sum-getsum2(zero[a[i]]))+mu)%mu;
		ans=(ans-t*1ll*inv2%mu*S%mu*ksm(T[a[i]],mu-2))%mu;
		reduce(sum+=T[a[i]]-mu);
		upd(a[i],T[a[i]]);
		upd2(zero[a[i]],T[a[i]]);
	}
	ans=(ans+solve()*1ll*S)%mu;
	printf("%d\n",ans);
} 

Measured memory_bytes: 4992
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
using namespace std;

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

int n, m;
string u[257], t;
bool is_locked = true, flag;

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

    cin >> n;
    rep(i,n) {
        cin >> u[i];
    }
    cin >> m;
    rep(i,m) {
        cin >> t;
        flag = false;
        rep(j,n) {
            if (u[j] == t) {
                if (is_locked) {
                    cout << "Opened by " << t << endl;
                    is_locked = false;
                } else {
                    cout << "Closed by " << t << endl;
                    is_locked = true;
                }
                flag = true;
                break;
            }
        }
        if (!flag) cout << "Unknown " << t << endl;
    }
    return 0;
}

Measured memory_bytes: 3236
def solve(n):
    if (n % 2 == 0) or (n % 5 == 0):
        print(-1)
    else:
        k = 7
        count = 1
        while True:
            if k % n == 0:
                print(count)
                break
            if count > n:
                print(-1)
                break
            else:
                k = 10*(k%n) + 7
                count += 1
n = int(input())
solve(n)

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

using namespace std;

int main() {
  int A, B;
  cin >> A >> B;

  int count = 0;
  for (int i = A; i <= B; i++) {
    string source, reversed;
    source = reversed = to_string(i);

    reverse(reversed.begin(), reversed.end());

    if (source == reversed) {
      count++;
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    ll x,y;
    cin>>x>>y;
    ll ans=longinf;
    ll cur=x,cnt=0;
    while(cur<inf){
        if(cur==y)ans=min(ans,cnt);
        if(cur==-y)ans=min(ans,cnt+1);
        ++cur,++cnt;
    }
    cur=-x,cnt=0;
    while(cur<inf){
        if(cur==y)ans=min(ans,cnt+1);
        if(cur==-y)ans=min(ans,cnt+2);
        ++cur,++cnt;
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef struct{
  int p,l,r;
  int num;
  string s;
}Tr;
Tr Thread[1001];

void preorder(int n)
{
  if(n==-1)return;
  for(int i=0;i<Thread[n].num;i++)cout<<'.';
  cout<<Thread[n].s<<endl;
  preorder(Thread[n].l);
  preorder(Thread[n].r);
}
int main()
{
  int n,m,now;
  cin>>n;
  for(int i=0;i<n;i++)Thread[i].p=Thread[i].l=Thread[i].r=-1;
  cin>>m>>Thread[0].s;
  Thread[0].num=0;
  for(int i=1;i<n;i++){
    cin>>m>>Thread[i].s;
    Thread[i].num=Thread[m-1].num+1;
    if(Thread[m-1].l==-1)Thread[m-1].l=i;
    else{
      now=Thread[m-1].l;
      while(1){
        if(Thread[now].r==-1)break;
	now=Thread[now].r;
      }
      Thread[now].r=i;
    }
  }
  preorder(0);
  return 0;
}

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

class dice{
public:
    int num[6], new_num[6];
    void refresh();
    void turnN();
    void turnS();
    void turnE();
    void turnW();
};
void dice::refresh(){
    for(int i=0;i<6;i++){
        num[i] = new_num[i];
    }
}

void dice::turnN(){
    new_num[0] = num[1];
    new_num[1] = num[5];
    new_num[2] = num[2];
    new_num[3] = num[3];
    new_num[4] = num[0];
    new_num[5] = num[4];
    
}

void dice::turnS(){
    new_num[0] = num[4];
    new_num[1] = num[0];
    new_num[2] = num[2];
    new_num[3] = num[3];
    new_num[4] = num[5];
    new_num[5] = num[1];
}

void dice::turnE(){
    new_num[0] = num[3];
    new_num[1] = num[1];
    new_num[2] = num[0];
    new_num[3] = num[5];
    new_num[4] = num[4];
    new_num[5] = num[2];
}

void dice::turnW(){
    new_num[0] = num[2];
    new_num[1] = num[1];
    new_num[2] = num[5];
    new_num[3] = num[0];
    new_num[4] = num[4];
    new_num[5] = num[3];
}


int main(){
    
    dice a, b;
    bool flag = false;
    
    for(int i=0;i<6;i++){
        cin >> a.num[i];
    }
    for(int i=0;i<6;i++){
        cin >> b.num[i];
    }
    for(int k=0;k<4;k++){
        for(int j=0;j<4;j++){
            for(int i=0;i<4;i++){
                if(a.num[1]==b.num[1] && a.num[2]==b.num[2] && a.num[3]==b.num[3] && a.num[4]==b.num[4] && a.num[5]==b.num[5] && a.num[0]==b.num[0]){
                    flag = true;
                }
                a.turnW();
                a.refresh();
            }
            a.turnS();
            a.refresh();
        }
        a.turnW();
        a.refresh();
    }
   
    if(flag == true){
        cout << "Yes" << endl;
    }else{
        cout << "No" <<endl;
    }
    
    return 0;
    
}



Measured memory_bytes: 3088
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int main() {
	int ans=1,n,k;
	cin>>n>>k;
	for(int i=0; i<n; i++) {
		ans+=min(ans,k);
	}
	cout<<ans<<endl;
}

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

using namespace std;

typedef vector<double> vd;
const double INF=1e10;

class OBST
{
public:
    int n;
    vd p,q;
    vector<vd> e,w;

    OBST(int _n=1)
    {
        n=_n;
        p.resize(n+1);
        q.resize(n+1);
        e.resize(n+2,vd(n+1));
        w.resize(n+2,vd(n+1));
    }

    void get()
    {
        for(int i=1;i<=n;i++)
        {
            cin>>p[i];
        }
        for(int i=0;i<=n;i++)
        {
            cin>>q[i];
        }
    }

    double go()
    {
        for(int i=1;i<=n+1;i++){
            e[i][i-1]=w[i][i-1]=q[i-1];
        }

        for(int len=1;len<=n;len++)
        {
            for(int i=1;i<=n-len+1;i++)
            {

                int j=i+len-1;
                e[i][j]=INF;
                w[i][j]=w[i][j-1]+p[j]+q[j];
                for(int k=i;k<=j;k++)
                {
                    e[i][j]=min(e[i][j],e[i][k-1]+e[k+1][j]+w[i][j]);
                }
            }
        }
        return e[1][n];
    }
};

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

    OBST obst(n);

    obst.get();

    cout<<obst.go()<<endl;

    return 0;
}



Measured memory_bytes: 6840
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << (x) << '\n'
#pragma GCC optimize("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	string s;
	cin >> s;
	if (s == "SSS") cout << "0\n";
	else if (s == "RRR") cout << "3\n";
	else if (s == "RRS" || s == "SRR") cout << "2\n";
	else cout << "1\n";
}

Measured memory_bytes: 3636
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

oa = ord('a')
n = ni()

def dfs(v, m, cur):
    if v == n:
        s = ''.join(map(lambda x: chr(x+oa), cur))
        return [s]
    ret = list()
    for i in range(m):
        ret.extend(dfs(v+1, m, cur + [i]))
    ret.extend(dfs(v+1, m+1, cur + [m]))
    return ret

l = dfs(0, 0, list())

l.sort()
print(*l, sep='\n')


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

int main() {
  int n;cin>>n;
  vector<double> v(n);
  rep(i,n){
    cin>>v.at(i);
  }
  sort(v.begin(),v.end());
  double a=(v.at(0)+v.at(1))/2;
  for(int i=2; i<n; i++){
    a=(v.at(i)+a)/2;
  }
  cout<<a;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define pb push_back
#define eb emplace_back
#define ALL(v) v.begin(),v.end()
const long long INF = 1LL << 60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define vi vector<int>
#define vii vector<vi>
#define vll vector<ll>
#define vs vector<string>
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; }
using Graph = vector<vector<int>>;
int main()
{
    int n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];
    int cnt = 0;
    rep(i, n){
        int id;
        rep2(k, 1, 100){
            if(a[i]%(1<<k) == 0) id = k;
            else break;
        }
        if(i == 0) cnt = id;
        chmin(cnt, id);

        
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

// arr[i] - par*n + (k-par)*1 <= n-1
// arr[i] - n + 1 <= n*par - k + par
// par >= (arr[i]-n+k+1) / (n+1)

// => arr[i]-n+k+1 >= 0
// => k >= n-1-arr[i]

// arr[i] - par*n + (k-par)*1 >= 0
// arr[i] + k >= (n+1) * par
// par <= arr[i]+k / (n+1)

ll bs(vector<ll>& arr, ll k, ll n) {
    ll ops = 0;
    for(ll& val: arr) {
        ll tmp = (val-n+k+1 <= 0) ? 0 : (1 + (val-n+k+1-1) / (n+1));
        // cout << "=>" << tmp << " ";
        ops += tmp;
    }
    // cout << "k = " << k << ", ops = " << ops << endl;
    return ops;
}
int main() {
    int n;
    cin >> n;
    vector<ll> arr(n, 0);
    for(ll& val: arr)
        cin >> val;
    // ll m = *min_element(arr.begin(), arr.end());
    // ll l = max(n-1-m, 0LL);
    ll l = 0;
    ll r = 8e18+ 7;
    for(int i = 0; i < 40; i++)
        bs(arr, i, n);
    while (l+2400 < r) {
        ll mid = l + (r-l)/2;
        ll ops = bs(arr, mid, n);
        if (ops > mid) {
            l = mid + 1;
        } else {
            r = mid;
        }
    }
    for(ll i = max(0LL, l-1200); i <= r; i++) {
        if (bs(arr, i, n) == i) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}




Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:char = read::<String>().chars().next().unwrap();
    if n.is_lowercase(){
        println!("a");
    }else{
        println!("A");
    }
    
}

Measured memory_bytes: 2076
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include "bitset"

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 2e3 + 10, MX = 4e6 + 10;

int a[N];
bitset <MX> b[2];

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

	int sum = 0;
	b[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		b[i % 2] = b[!(i % 2)] | (b[!(i % 2)] << a[i]);
		sum += a[i];
	}

	for (int i = (sum + 1) / 2; ; ++i) {
		if (b[n % 2][i]) {
			cout << i << endl;
			break;
		}
	}
}

Measured memory_bytes: 2688