akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	vector<vector<long long>> choose(55, vector<long long>(55, 0));
	choose[0][0] = 1;
	for(int i = 1; i < 55; i++) {
		for(int j = 0; j <= i; j++) {
			if(j == 0 || j == i) {
				choose[i][j] = 1;
			}
			else {
				choose[i][j] = choose[i - 1][j] + choose[i - 1][j - 1];
			}
		}
	}

	int n, a, b;
	cin >> n >> a >> b;
	vector<long long> arr(n);
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr.rbegin(), arr.rend());
	

	long long sum = 0;
	long long last, rem = 0;
	map<long long, int> mp;
	for(int i = 0; i < n; i++) {
		if(i < a) {
			sum += arr[i];
			last = arr[i];
			mp[arr[i]]++;
		}
		else if(last == arr[i]) {
			rem++;
		}
	}
	long double ave = 1.0 * sum / (1.0 * a);
	int total = mp[last] + rem;
	if(mp.size() == 1) {
		long long comb = 0;
		for(int i = a; i <= b; i++) {
			comb += (long long)choose[total][i];
		}
		cout << setprecision(20) << ave << endl << comb << endl;
	}
	else {
		cout << setprecision(20) << ave << endl << choose[total][mp[last]] << endl;
	}
	return 0;	
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define MOD_Q 998244353
#define PI 3.14159265358979
#define ll long long
using namespace std;

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define MOD_Q 998244353
#define PI 3.14159265358979
#define ll long long
using namespace std;


int main()
{
	double a, b;
	int  h, m;
	cin >> a >> b >> h >> m;
	int rada = 6 * m;
	double radb = (60.0 * h + m) / 2.0;

	double rad = radb - rada;
	rad = rad * PI / 180;
	//printf(" %f %f", rad, cos(rad));
	double c2 = (double)a * a + (double)b * b - 2.0 * a * b * cos(rad);

	printf("%.12f", sqrt(c2));

}



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

const int N = 510;

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

    int n, m, q;
    cin >> n >> m >> q;

    int A[N][N] = {};
    for(int i = 0; i < m; i++){
        int l, r;
        cin >> l >> r;
        A[l][r]++;
    }

    for(int i = 0; i < N; i++){
        for(int j = 1; j < N; j++){
            A[i][j] += A[i][j - 1];
        }
    }

    for(int i = 1; i < N; i++){
        for(int j = 0; j < N; j++){
            A[i][j] += A[i - 1][j];
        }
    }

    while(q--){
        int p, q;
        cin >> p >> q;
        int cnt = A[q][q];
        cnt -= A[p - 1][q];
        cnt -= A[q][p - 1];
        cnt += A[p - 1][p - 1];
        cout << cnt << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(int& a){printf("%d",a);}
void print(long long& a){printf("%lld",a);}
void print(double& a){printf("%.15lf",a);}
template<class T> void print(T& a){cout<<a;}
template<class T> void print(vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(Head& head, Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(T& a){cerr<<a;}
template<class T> void dprint(vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(Head& head, Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    int n;
    in(n);
    vector<int> vec(10001,0);
    int x;
    rep(i,n){
        in(x);
        vec[x]++;
    }
    int d=1;
    rep(i,10001){
        if(vec[i]>=1){
            for(int j=0;j<vec[i];j++){
                if(d){
                    printf("%d",i);
                    d=0;
                }else{printf(" %d",i);}
            }
        }
    }
    printf("\n");
}


Measured memory_bytes: 3244
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
typedef bitset<4000> b4000;

const int MOD = 998244353;

int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}

int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}

int pow2[4444];
b4000 cyc[4001];
int dp[4111];
int curmin;
b4000 smallest;

int getmx(b4000 &x)
{
	for(int i=3999;i>=0;i--)
	{
		if(x[i]) return i;
	}
	return -1;
}

void solve(vector<b4000> &vec)
{
	int n=vec.size();
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			while(vec[i].count()>0&&vec[j].count()>0)
			{
				//cerr<<vec[i].count()<<' '<<vec[j].count()<<'\n';
				int i2=i; int j2=j;
				int siz1=getmx(vec[i]); int siz2=getmx(vec[j]);
				if(siz1<siz2) 
				{
					swap(i2,j2); swap(siz1,siz2);
				}
				vec[i2] = (vec[i2]^(vec[j2]<<(siz1-siz2)));
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		//cerr<<i<<' '<<vec[i].count()<<'\n';
		if(!vec[i].count()) continue;
		smallest=vec[i];
		return ;
	}
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	pow2[0]=1;
	for(int i=1;i<=4440;i++)
	{
		pow2[i]=add(pow2[i-1],pow2[i-1]);
	}
	int n; string s; cin>>n>>s;
	vector<b4000> vec;
	for(int i=0;i<n;i++)
	{
		string z; cin>>z;
		b4000 tmp; tmp.reset();
		reverse(z.begin(),z.end());
		for(int j=0;j<z.length();j++)
		{
			if(z[j]=='1') tmp.set(j,1);
		}
		vec.pb(tmp);
	}
	solve(vec);
	//cerr<<smallest<<'\n';
	for(int i=3999;i>=0;i--)
	{
		if(smallest[i])
		{
			cyc[i]=smallest;
			for(int j=i+1;j<4000;j++)
			{
				smallest<<=1;
				cyc[j]=smallest;
			}
			break;
		}
	}
	b4000 cur; cur.reset();
	b4000 tmp;
	dp[0]=(cyc[0].count()>0?1:0);
	for(int i=1;i<4000;i++)
	{
		if(cyc[i].count()>0) dp[i]=1;
		dp[i]+=dp[i-1];
	}
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='1') tmp.set(int(s.length())-1-i,1);
	}
	int ans=0;
	for(int i=int(s.length())-1;i>=0;i--)
	{
		if(tmp[i])
		{
			if(cur[i])
			{
				if(cyc[i].count()>0)
				{
					int v=1;
					if(i-1>=0) v=pow2[dp[i-1]];
					ans=add(ans,v);
				}
				if(i==0) ans++;
				//otherwise proceed as usual
			}
			else
			{
				int v=1;
				if(i-1>=0) v=pow2[dp[i-1]];
				ans=add(ans,v);
				if(cyc[i].count()==0) break;
				if(i==0) ans++;
				cur^=cyc[i];
			}
		}
		else
		{
			if(cur[i])
			{
				if(cyc[i].count()>0)
				{
					if(i==0) ans++;
					else
					{
						cur^=cyc[i];
					}
				}
				else break;
			}
			else
			{
				if(i==0) ans++;
			}
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
int main () {
  double a, b, x;
  cin >> a >> b >> x;
  x /= a;
  double ans;
  if(a * b / 2 >= x)cout << setprecision(10) << 90 - (atan( 2 * x / (b * b)) / M_PI) * 180 << endl;
  else cout << setprecision(10) << (atan((2 * (a * b - x) / (a * a))) / M_PI) * 180 << endl;
  return 0;
}

Measured memory_bytes: 256
a, b, c, d, e, f = map(int, input().split())

ans, cont = [0]*2, 0

for i in range(f//100+1):
    if i%a == 0 or i%b == 0:
        water = i*100
        x = min(f-water, i*e)

        suger = 0

        for j in range(x//c+1):
            s3 = j*c
            suger = max(suger, s3+((x-s3)//d)*d)

        if water != 0:
            if cont <= (100*suger) / (water+suger):
                ans = [water, suger]
                cont = (100*suger) / (water+suger)

print(sum(ans), ans[1])

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func main() {
	var n, m int
	var s, t string
	fmt.Scanf("%d %d\n%s\n%s", &n, &m, &s, &t)
	//fmt.Println(n, m, s, t)

	i := 1
	j := 1
	for {
		if i*n == j*m {
			break
		} else if i*n > j*m {
			j++
		} else {
			i++
		}
	}

	l := i * n
	ln := l / n
	lm := l / m

	var step, dv int
	if ln < lm {
		step = lm
		dv = ln
	} else {
		step = ln
		dv = lm
	}

	for ll := 0; ll < l; ll += step {
		if ll%dv == 0 {
			c0 := s[ll/ln]
			c1 := t[ll/lm]
			if c0 != c1 {
				fmt.Println(-1)
				return
			}
		}
	}

	fmt.Println(l)
}


Measured memory_bytes: 1152
#include<cstdio>
#include<bitset>
using namespace std;

bitset<50001> pt;

void MakeTable(int n){
  pt.reset();
  pt.set(2);
  
  int i;
  for(i=3;i<=n;i+=2)pt.set(i);
  
  i = 3;
  while(i*i<=n){
    for(int j=3*i;j<=n;j+=2*i)pt.reset(j);
    do{i+=2;}while(!pt[i]);
  }
}

int main(){
  int n,ans;
  MakeTable(50000);

  while(scanf("%d",&n) && n){
    if(n&1)pt[n-2]?printf("1\n"):printf("0\n");
    else{
      ans = 0;
      for(int i=0;i<=n/2;i++)
	if(pt[i] && pt[n-i])ans++;
      printf("%d\n",ans);
    }
  }
}
	

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

string yorn(bool a){if(a) return "Yes" ; return "No" ;}

int main(){
	int n ; cin >> n ;
	int two = 0 ;
	int four = 0 ;
	for(int i=0;i<n;i++){
		int a ; cin >> a ;
		if(a%2==0) two++ ;
		if(a%4==0) four++ ;
	}
	two -= four ;
	cout << yorn(n/2<=four||2*four+two>=n) << endl ;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

int main() {
  int a,b;
  S2(a,b);
  if(a <= 0 && b >= 0) {
    printf("Zero\n");
  } else {
    if(a > 0 || (b - a) & 1) {
      printf("Positive\n");
    } else {
      printf("Negative\n");
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
long long MOD=1000000007;
long long MOD2=998244353;

long long beki[66];
long long A[303030];
int cnt[66];

int main(){
  beki[0]=1;
  for(int i=1;i<=60;i++) beki[i]=2*beki[i-1]%MOD;
  int N; cin>>N;
  for(int i=0;i<N;i++){
    cin>>A[i];
    for(int j=0;j<60;j++){
      cnt[j]+=(A[i]>>j)&1;
    }
  }
  long long ans=0;
  for(int i=0;i<60;i++){
    (ans+=beki[i]*(N-cnt[i])%MOD*cnt[i])%=MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
n = int(input())
d = list(map(int,input().split()))
mod = 998244353
from collections import Counter
c = Counter(d)
if c[0] != 1 or d[0] != 0:
    print(0)
else:
    ans = 1
    for i in range(1,max(d) + 1):
        ans *= c[i-1]**c[i]
        ans %= mod
    print(ans)

Measured memory_bytes: 18932
#include<iostream>
#include<set>
#include<cstdio>
#include<cstring>

using namespace std;
int main(){
  int n;
  string s1,s2;
  set<string>st;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> s1 >> s2;
    if(s1 == "insert"){
      st.insert(s2);
    } else {
      if(st.find(s2) != st.end()){
	cout << "yes" << endl;
      } else cout << "no" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 32584
from sys import stdin
import numpy as np
from operator import itemgetter

M, D = [int(x) for x in stdin.readline().rstrip().split()]

D10=D//10
D1=D%10

ans=0
for i in range(2,D10):
    for j in range(2,10):
        if i*j<=M:
            ans+=1
i=D10
if i < 2:
    print(0)
else:
    for j in range(2,D1):
        if i*j<=M:
            ans+=1

    j=D1
    if j>1:
        if i*j<=M:
            ans+=1
    print(ans)


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

using namespace std;

int main()
{
  int r, n;
  int height[2][44];
  while(cin >> r >> n, r || n) {
    memset(height, 0, sizeof(height));
    while(n--) {
      int xl, xr, h; cin >> xl >> xr >> h;
      for(int i = xl; i < xr; i++) height[0][i+22] = max(height[0][i+22], h);
      for(int i = xr; i > xl; i--) height[1][i+22] = max(height[1][i+22], h);     
    }
    
    double ans = 1 << 25;
    for(int i = -r; i < r; i++) ans = min(ans, height[0][i+22] + r - sqrt(r*r - i*i));
    for(int i = r; i > -r; i--) ans = min(ans, height[1][i+22] + r - sqrt(r*r - i*i));    
    printf("%.4f\n", ans);
  }
  
  return 0;
}

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int x; cin>>x;
  int ans=0;
  int s=0;
  irep(i,1,x+1){
    s+=i;
    ans++;
    if(s>=x){
      cout<<ans<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define all(v) v.begin(), v.end()
#define vl vector<ll>
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define ff first
#define ss second
const int N=100005;
void solve()
{
    ll n,m=0,k=0,i=1,j,p,f,x, y, z;
    ll ans=1e9, a[N], b[N] = {};
    string s, t;
    cin>>s>>t;
    for(i=0;i<=s.size()-t.size();i++)
    {
        ll c=0;
        for(j=0;j<t.size();j++)
        {
            s[i+j]==t[j]?1:c++;
        }
        ans=min(ans,c);
    }
    cout<<ans;
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif 
    int t=1;
    //cin>>t;
    while(t--)solve();
    return 0;
}

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

#include <math.h>
#include <stdlib.h>


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


class UnionFind{
public:
  vector<int> Parents;

  UnionFind(int N){
    Parents.assign(N, -1);
  }

  int root(int A){
    if(Parents[A] < 0) return A;
    return Parents[A] = root(Parents[A]);
  }

  int size(int A){
    return -Parents[root(A)];
  }

  bool connect(int A, int B){
    A = root(A);
    B = root(B);

    if(A == B) return false;

    if(size(A) < size(B)) swap (A, B);

    Parents[A] += Parents[B];
    Parents[B] = A;
    return true;
  }
};


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n, m , k;
    cin >> n >> m >> k;

    UnionFind uF = UnionFind(n);

    vector<int> connect(n);
    for(int i = 0; i < m ; i++){
        int a, b; cin >> a >> b;
        a--; b--;
        uF.connect(a,b);
        connect[a]++;
        connect[b]++;
    }

    vector<int> block(n);
    for(int i = 0; i < k; i++){
        int c,d; cin >> c >> d;
        c--; d--;
        if(uF.root(c) == uF.root(d)){
            block[c]++;
            block[d]++;
        }
    }

    for(int i = 0; i < n; i++){
        int ans =  uF.size(i) -1 - connect[i] - block[i];
        if(ans < 0) cout << 0 << " ";
        else cout << ans << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 2048
// Sky's the limit :)
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    //int t=1 ; cin>>t ; while(t--)
    {
        int h, a;
        cin >> h >> a;

        cout << (h/ a + (h%a != 0));
        
    }
    
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 256
s = input()
x = int(s) // 100
y = int(s) % 100
if 1 <= x <= 12:
  if 1 <= y <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= y <= 12:
    print("YYMM")
  else:
    print("NA")

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

int main(){
    long long int N,ans,mid;
    cin >> N;

    vector<long long int> A(N,0),B(N,0),C(N,0);
    for (int i=0;i<N;i++) cin >> A[i];
    for (int i=0;i<N;i++) cin >> B[i];
    for (int i=0;i<N;i++) cin >> C[i];
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());

    for(int i=0 ; i<N ; i++){
        mid = B[i];
        auto low = lower_bound(A.begin(), A.end(), mid)- A.begin();
        auto upp = C.end() - upper_bound(C.begin(),C.end(),mid);
        ans += low*upp;
    }
    cout << ans << endl;
    return 0;

}




Measured memory_bytes: 2560
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
int lcm(int a, int b){
  return a / gcd(a,b) * b;
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int n;
struct P { double x,y;};
vector<P> p;

double dist(P a, P b){ //2点間の距離を求める関数
  double dx = a.x-b.x;
  double dy = a.y-b.y;
  return sqrt(dx*dx + dy*dy);
}

double f(double x, double y){
  double res = 0;
  rep(i,n){
    res = max(res, dist((P){x,y}, p[i])); //与えられたx,y座標から最も遠い点までの距離を探索
  }
  return res; //与えられたx,yで全ての点を包含できる半径
}

double g(double x){//xを決め打った時に半径を最小化できるyを探す
  double l = 0, r = 1000;
  rep(i,80){
    double c1 = (l*2 + r)/3;
    double c2 = (l + r*2)/3;
    if(f(x,c1)>f(x,c2)) l = c1;
    else r = c2;
  }
  return f(x,l); //その時の半径を返す
}

int main(){
  cin >> n;
  p = vector<P>(n);
  rep(i,n) cin >> p[i].x >> p[i].y;
  
  double l = 0, r = 1000;
  rep(i,80){
    double c1 = (l*2 + r)/3;
    double c2 = (l + r*2)/3;
    if(g(c1)>g(c2)) l = c1; //
    else r = c2;
  }
  
  double ans = g(l);
  printf("%.10f\n",ans);
  
  return 0;
}


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

int main(){
    int a,b;
    
    cin >> a >> b;
    
    if (a<b){
        cout << "a < b" << endl;
    }   else if(a>b){
        cout << "a > b" << endl;
    }   else {
        cout << "a == b" << endl;
    }
}


Measured memory_bytes: 3076
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


ll power(ll a, ll e){
    if(e==0) return 1;
    if(e%2==0){
        ll r = power(a, e/2);
        return r * r % MOD;
    } else {
        ll r = power(a, e/2);
        return r * r % MOD * a % MOD;
    }
}

ll Inv(ll a){
    return power(a, MOD-2);
}

ll Fact(ll a){
    ll r = 1;
    for(int i=2; i<=a; i++)
        r = r * i % MOD;
    return r;
}


ll Combi(ll a, ll b){
    if(a < b) return 0;
    return Fact(a) % MOD * Inv(Fact(b)) % MOD * Inv(Fact(a-b)) % MOD;
}


int main() {
    ll N, K; cin >> N >> K;
    for(ll i=1; i<=K; i++){
    
        ll a = N-K+1;
        ll b = Combi(N-K+1, i);
        ll c = K - i;
        ll d = Combi(K-1, i-1);
        
        cout << Combi(N-K+1, i) % MOD * Combi(K - 1, i - 1) % MOD << endl;
    }
    
    
    return 0;
}



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

int main() {
  int N, ans, conti;
  conti = 1;
  ans = 0;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i < N;i++){
    cin >> A.at(i);
  }
  while(conti){
    for(int i=0; i < N;i++){
      if(A.at(i) % 2 == 1){
        conti = 0;
      }
      A.at(i) /= 2;
    }
    ans++;
  }
  cout << ans-1 << endl;

}


Measured memory_bytes: 256
#include<stdio.h>

int score[200];

int main(void) {
	int n,i,j,p=0,k=0,flag;
	scanf("%d",&n);

	int date[n][3];

	for (i = 0; i < n; i++) {
		for (j = 0; j < 3; j++)
			scanf("%d",&date[i][j]);
	}

	for (i = 0; i < 3; i++) {
		for (j = 0; j < n; j++) {
			p = date[j][i];
			flag = 0;
			for (k = j+1; k < n; k++) {
				if (p == date[k][i]) {
					flag = 1;
					date[k][i] = 0;
				}
			}
			if (!flag)score[j] += p;
		}
	}
	for (i = 0; i < n; i++)printf("%d\n",score[i]);
	return 0;
}

Measured memory_bytes: 596
(declaim (ftype (function (string &optional character) (values (vector string *) &optional)) split))
(defun split (text &optional (delim #\Space))
    (let* ((result (make-array 0
                               :element-type 'string
                               :adjustable t
                               :fill-pointer 0)))
          (loop :for c character :across text
                :with temp = ""
                :do
                (cond ((char= c delim)
                       (vector-push-extend temp result)
                       (setf temp ""))
                    (t
                     (setf temp (concatenate 'string temp (string c)))))
                :finally
                (vector-push-extend temp result))
          result))

(declaim (ftype (function (integer integer) (values integer &optional)) solve))
(defun solve (d n)
    (cond ((not (= n 100))
           (* (expt 100 d) n))
        (t (+ (expt 100 (+ d 1)) (expt 100 d)))))

(defun main ()
    (let* ((input (map 'vector #'parse-integer (split (read-line))))
           (d (aref input 0))
           (n (aref input 1)))
          (format t "~A~%" (solve d n))))

(main)

Measured memory_bytes: 17376
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, ans;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    rep(i, 1, n+1) {
        if (i%2) {
            int cnt = 0, t = i;
            rep(j, 1, i+1) {
                if (i%j == 0) cnt++;
            }  
            if (cnt == 8) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v
#define NUM(x,v) (POSU(x,v)-POSL(x,v))
const ll INF=1e9+7;
const ll N = 100001;
ll n,x;
ll gcd(ll x,ll y){
	if(y==0)return x;
	return gcd(y,x%y);
}

int main(){
	cin>>n>>x;
	cout<<3*(n-gcd(n,x))<<endl;
	return 0;
}

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

int main(){
    string S,T;
    cin>>S>>T;
    bool ok=true;
    map<char,char> ma,ima;
    for(int i=0;i<S.size();i++){
        char s=S[i],t=T[i];
        if(ma.count(s)) if(ma[s]!=t) ok=false;
        if(ima.count(t))if(ima[t]!=s)ok =false;
        ma[s]=t;ima[t]=s;

    }
    if(ok)puts("Yes");
    else puts("No");
}

Measured memory_bytes: 776
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  string str;
  
  while(getline(cin, str)){
    if(str == "END OF INPUT") break;
    
    string ans = "";
    int cnt = 0;
    
    for(int i = 0 ; i < str.size() ; i++){
      if(i == str.size()-1) ans += cnt+1 + '0';
      else if(str[i] != ' ') cnt++;
      else{
	ans += cnt + '0';
	cnt = 0;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
N,K = map(int,input().split())
res = [False] * (N+1)
res[0] = True

for _ in range(K):
    d = int(input())
    A = list(map(int,input().split(" ")))
    for id,value in enumerate(A):
        res[A[id]] = True

ans = res.count(False)
print(ans)

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

int main() {
	int N, T;
	cin >> N >> T;
	vector<int> times(N, 0);
	for (int i = 0; i < N; i++) {
		cin >> times[i];
	}
	int result = 0;
	int left = times[0];
	int right = times[0] + T;
	for (int i = 1; i < N; i++) {
		if (times[i] <= right) {
			right = right > times[i] + T ? right : times[i] + T;
		}
		else {
			result += right - left;
			left = times[i];
			right = times[i] + T;
		}
	}
	result += right - left;
	cout << result << endl;
}

Measured memory_bytes: 1024
def gcd(n,m):
    while n > 0:
        a = n
        n = m % n
        m = a
    return m

R,G,B,N = map(int,input().split(" "))

C = G * B // gcd(G,B)

s = 0
b = 0
while b <= N:
    bb = b
    while bb <= N:
        if (N - bb) % B == 0:
            s += (N - bb) // C + 1
            bb = N + 1
        else:
            bb += G
    b += R

print(s)

Measured memory_bytes: 3060
//すぬけ君の塗り絵 2 イージー

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) int n;cin>>n;vector<int>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<int,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    int w,h,n;cin>>w>>h>>n;
    int a=h,b=0,c=0,d=w;//上下左右
    rep(i,0,n){
        int l,m,n;
        cin>>l>>m>>n;
        if(n==1){
            c=max(c,l);
        }else if(n==2){
            d=min(d,l);
        }else if(n==3){
            b=max(b,m);
        }else{
            a=min(a,m);
        }
    }
    if(a-b>0&&d-c>0){
        cout<<(a-b)*(d-c)<<nnn;
    }else{
        cout<<0<<nnn;
    }
    return 0;
}

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

public class Main {
    int n;
    int[] as;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        solve();
    }

    void solve() {
        Arrays.sort(as);
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            set.add(as[i]);
        }
        if (set.size() % 2 == 1) {
            System.out.println(set.size());
        } else {
            System.out.println(set.size() - 1);
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 41916
n, k = list(map(int, input().rstrip().split()))
ans = 0
for i in range(1, n + 1):
    if i >= k:
        ans += 1 / n
    else:
        m = 1
        while i * 2 ** m < k:
            m += 1
        ans += 1 / n * 0.5 ** m
print(ans)

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

ll f(ll b,ll n){
  if(n<b)return n;
  else return f(b,n/b)+n%b;
}

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

  //b進数のnの桁和がs
  ll n,s;
  cin>>n>>s;
  if(n==s){
    cout<<n+1<<endl;
    return 0;
  }
  if(n<s){
    cout<<-1<<endl;
    return 0;
  }
  ll ans=LONG_MAX;
  for(ll i=2;i*i<=n;i++){
    if(s==f(i,n))ans=min(ans,i);
  }
  //n=bp+q
  //s=p+q
  //b=s/p (b>sqrt(n))
  for(ll i=1;i*i<n;i++){
    ll b=(n-s)/i+1;
    if(s==n/b+n%b)ans=min(ans,b);
  }

  if(ans==LONG_MAX)cout<<-1<<endl;
  else cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
    int n, m ;
    static int a[4][13];
    char c, s[5]={'S','H', 'C', 'D' ,'\0'};
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%*c%c%d", &c, &m);
        for (int j = 0; j <= 3; j++) {
            if (s[j] == c)a[j][m-1] = 1;
        }
    }
    for (int i = 1; i <= 4; i++) {
        for (int j = 1; j <= 13; j++) {
            if (a[i - 1][j - 1] == 0)printf("%c %d\n", s[i - 1], j);
        }
    }
    return 0;
}


Measured memory_bytes: 2064
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    int x,n,p,i,q,ans;
    cin>>x>>n;
    int vis[105]={0};
    for(i=0;i<n;i++)
    {
        cin>>p;
        vis[p]=1;
    }
    for(i=x;i>=0;i--)
    {
        if(vis[i]==0)
        {
            p=i;
            break;
        }
    }
    for(i=x;i<=101;i++)
    {
        if(vis[i]==0)
        {
            q=i;
            break;
        }
    }
    if(abs(x-p)<=abs(x-q))
        ans=p;
    else
        ans=q;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

const int MAX_N = 55555+1;
vector<int> primes;
vector<int> isPrime(MAX_N, 1);
void buildPrimes() {
    isPrime[0] = isPrime[1] = 0;
    REP(i, 2, MAX_N) {
        if(isPrime[i]) {
            primes.push_back(i);
            for(int j = i+i; j < MAX_N; j += i) isPrime[j] = false;
        }
    }
}

int main(){
    int n;
    cin >> n;
    buildPrimes();
    vector<int> ans;
    for(auto& p : primes) {
        if(p%5 == 1) ans.pb(p);
    }
    rep(i, n) {
        cout << ans[i];
        if(i == n-1) cout << endl;
        else cout << " ";
    }    
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n;
    cin>>n;
    int m;
    cin>>m;
    vvi vec(m,vi(1e5+100));
    REP(i,n){
        int a,b,c;
        cin>>a>>b>>c;
        c--;
        vec[c][a]++;
        vec[c][b]--;
    }
    REP(i,m){
        REP(j,1e5+99){
            vec[i][j+1]+=vec[i][j];
        }
    }
    vi sum(1e5+100);
    REP(i,m){
        REP(j,1e5+100){
            if(!vec[i][j]){
                continue;
            }
            int r=j;
            while(r+1<1e5+100&&vec[i][r]){
                r++;
            }
            sum[j-1]++;
            sum[r]--;
            j=r;
        }
    }
    int ans=0;
    REP(i,1e5+99){
        sum[i+1]+=sum[i];
        chmax(ans,sum[i]);
    }
    cout<<ans<<endl;
    return 0;
}

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

struct union_find{
	int N;
	vector<int> parent;
	vector<int> siz;

	union_find(int N) : parent(N), siz(N, 1){
		for (int i = 0; i < N; i++) parent[i] = i;
	}

	int root(int x){
		if(parent[x] == x) return x;
		else return parent[x] = root(parent[x]);
	}

	void merge(int x, int y){
		x = root(x), y = root(y);
		if(x == y) return;
		if(siz[x] < siz[y]) swap(x, y);
		parent[y] = x;
		siz[x] += siz[y];
		siz[y] = 0;
	}

	bool are_same(int x, int y){
		return root(x) == root(y);
	}

	int size(int x){
		return siz[root(x)];
	}
};

signed main(){
	int N, M, i;
	scanf("%lld%lld", &N, &M);
	vector<int> A(M), B(M), ans(M + 1);
	for(i = 0; i < M; i++){
		scanf("%lld%lld", &A[i], &B[i]);
		A[i]--;
		B[i]--;
	}
	union_find uf(N);
	ans[M] = ((N - 1) * N) / 2;
	for(i = M - 1; i >= 0; i--){
		ans[i] = ans[i + 1];
		if(uf.are_same(A[i], B[i]) == 0){
			ans[i] -= uf.size(A[i]) * uf.size(B[i]);
		}
		uf.merge(A[i], B[i]);
	}
	for(i = 1; i <= M; i++){
		printf("%lld\n", ans[i]);
	}
	return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

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

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N; cin >> N;
    vec<lint> P_list(N);
    range(i, 0, N) cin >> P_list.at(i);
    lint cur_min = P_list.at(0);
    lint ans = 1;
    range(i, 1, N) {
        lint P = P_list.at(i);
        if (P <= cur_min) {
            ans += 1;
            cur_min = P;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
int main(void){
    int a,b;
    cin >> a >> b;
    if(a >= 13) cout << b << endl;
    else if(a <= 12 && a >= 6) cout << b/2 << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

typedef long long ll;
typedef pair<ll, ll> P;

ll n = 0;
ll func(ll x)
{
  ll ret = 0;
  REP(i, n) {
    if (i == 0) {
      if (x % 4 == 1 || x % 4 == 2) ret += 1;
      continue;
    }
    ll nx = x % (1LL << (i + 1)) - (1LL << i) + 1;
    if (nx > 0) ret += (nx % 2) * (1LL << i);
  }
  return ret;
}

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

  ll tmp = B;
  while (tmp) n++, tmp /= 2;

  ll ans = func(A - 1) ^ func(B);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import functools

import os

INF = float('inf')


def inp():
    return int(input())


def inpf():
    return float(input())


def inps():
    return input()


def inl():
    return list(map(int, input().split()))


def inlf():
    return list(map(float, input().split()))


def inls():
    return input().split()


def debug(fn):
    if not os.getenv('LOCAL'):
        return fn

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        print('DEBUG: {}({}) -> '.format(
            fn.__name__,
            ', '.join(
                list(map(str, args)) +
                ['{}={}'.format(k, str(v)) for k, v in kwargs.items()]
            )
        ), end='')
        ret = fn(*args, **kwargs)
        print(ret)
        return ret

    return wrapper

a = inp()
if a >= 1000:
    print('ABD')
else:
    print('ABC')

Measured memory_bytes: 3700
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var st = Console.ReadLine().Trim().Split(' ');
            Console.WriteLine(st[1] + st[0]);
        }
    }
}


Measured memory_bytes: 11092
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n,m,i,j,ans;cin>>n>>m;
	vector<llint>gen(n,-big);
	gen[0]=0;
	vector<int>A(m);
	vector<int>B(m);
	vector<llint>C(m);
	for(i=0;i<m;i++){cin>>A[i]>>B[i]>>C[i];A[i]--;B[i]--;}
	for(i=0;i<n*2;i++){
		for(j=0;j<m;j++){maxeq(gen[B[j]],gen[A[j]]+C[j]);}
	}
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			if(gen[B[j]]<gen[A[j]]+C[j]){gen[B[j]]=big;}
		}
	}
	if(gen[n-1]==big){cout<<"inf\n";}
	else{cout<<gen[n-1]<<endl;}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;

int main() {
    string S, T; cin >> S >> T;
    int N = S.size();
    for(int i=0; i<N; i++){
        if(S==T){
            cout << "Yes" << endl;
            return 0;
        }else{
            S = S.substr(1) + S[0];
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
 
int main() {
  long long N; cin >>N;
  string kazu;
  kazu=to_string(N);
  int kotae=0;
  int j=0;
  int k=0;
  int count=0;
  string atai;
  string atai2;
  rep(i,kazu.size()){
    if(kazu.at(i)=='9'){
      count++;
    }
  }
  atai=kazu.at(0);
  j=stoi(atai);
  atai2=kazu.at(kazu.size()-1);
  k=stoi(atai2);
  int m;
  m=9*kazu.size()+j-10;
  //cout<<k<<endl;
  if(N<=9){
     kotae=N;
  }else if(count>=kazu.size()-1){
    kotae=9*kazu.size()-9+j;
    if(k!=9){
      kotae=kotae-9+k;
      m=9*kazu.size()+j-10;
      kotae=max(kotae,m);
    }
  }else{
    kotae=9*kazu.size()-9+j-1;
  }
  cout <<kotae<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1e5;
typedef long long LL;

int main(void)
{
	string str1;string str2;
	while(cin>>str1>>str2)
	{
		int flag=1;
		for(int i=0;i<str1.size();i++)
		{
			if(str2[i]!=str1[i])
			{
				flag=0;cout<<"No"<<endl;break;
			}
		}
		if(flag)
			cout<<"Yes"<<endl;
	}

return 0;
}



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

int main() {
    int a, b;
    char op;

    while(true){
        cin >> a >> op >> b;
        if(op == '?') { break; }

        if(op == '+') { cout << a + b << endl; }
        else if(op == '-') { cout << a - b << endl; }
        else if(op == '*') { cout << a * b << endl; }
        else if(op == '/') { cout << a / b << endl; }
    }

    return 0;
}


Measured memory_bytes: 3084
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <map>
using namespace std;

int n;
long long L;
long long x[100001];

int MAIN()
{
	cin >> n >> L;
	for(int i = 1; i <= n; i++)
		cin >> x[i];
	int which = -1;
	for(int i = 1; i < n; i++)
		if(x[i] + x[i+1] >= L)
			which = i;
	if(which == -1)
		cout << "Impossible" << endl;
	else
	{
		cout << "Possible" << endl;
		for(int i = 1; i < which; i++)
			cout << i << endl;
		for(int i = n-1; i > which; i--)
			cout << i << endl;
		cout << which << endl;
	}
	return 0;
}

int main()
{
	int start = clock();
	#ifdef LOCAL_TEST
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	ios :: sync_with_stdio(false);
	cout << fixed << setprecision(16);
	int ret = MAIN();
	#ifdef LOCAL_TEST
		cout << "[Finished in " << clock() - start << " ms]" << endl;
	#endif
	return ret;
}


Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<iterator>
#include<algorithm>
#include<cmath>
#include<functional>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<utility>
#include<string>
#include<numeric>
//#include<bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	map<string,int> m;
	for (int i = 0; i < n; i++)
	{
		string ss;
		cin >> ss;
		sort(ss.begin(),ss.end());
		if(m.find(ss) == m.end()){
			m[ss] =0;
        }
		else{
			m[ss] +=1;
        }
	}
	
  	long long sum = 0;
  for (auto i = m.begin(); i != m.end(); i++)
	{
      if(i->second <= 1){
        	sum+= i->second;
      }else{
        for(int j = 1;j<=i->second;j++){
        	sum+= j;
        } 
      }
	}
	cout << sum;
}


Measured memory_bytes: 11136