akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif
const int N = 21;
int allmask;
int dp[N][1<<21];
vector<int>women[N+1];
int n;
int add(int a,int b){
    return ((a % MOD) + (b % MOD)) % MOD;
}
int mul(int a,int b){
    return ((a % MOD) * (b % MOD)) % MOD;
}
int sub(int a,int b){
    return ((a % MOD) - (b % MOD) + MOD) % MOD;
}
int solve(int curMen,int mask){

    // if all women are taken;
    if(mask == allmask) return 1;

    if(curMen > n){
        // if all men are used
        return 0;
    }
    int &ans = dp[curMen][mask];
    if(ans != -1) return ans;

    int res = 0;
    // try mathing curMen with all compatible women if that women is not already matched;
    for(auto x:women[curMen]){
        if(mask & (1<<x)){
            // if women is already taken
            continue;
        }
        // set current women;
        res = add(res,solve(curMen+1,mask | (1<<x)));
    }
    return ans = res % MOD;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            int x;
            cin>>x;
            if(x) women[i].push_back(j);
        }
    }
    allmask = (1<<n) - 1;
    memset(dp,-1,sizeof(dp));
    cout<<solve(0,0)<<endl;
    return 0;
    
}



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

int n;
int a[1000];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

    sort(a, a + n);
    
    int ans = 0;
    for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
    for (int k = j + 1; k < n; ++k) {
        if (a[i] == a[j] || a[i] == a[k] || a[j] == a[k])
            continue;
                                                                             
        if (a[i] + a[j] > a[k])
            ++ans;
    }

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

Measured memory_bytes: 3656
#include <stdio.h>

struct Node{
  int parent;
  int left;
  int right;
};

void setup(struct Node node[], int n) {
  for (int i = 0; i < n; i++) {
    node[i].parent = -1;
    node[i].left = -1;
    node[i].right = -1;
  }
}

void input(struct Node node[], int n) {
  int id, k, c1, c2;

  for (int i = 0; i < n; i++) {
    scanf("%d%d", &id, &k);
    for(int j = 0; j < k; j++) {
      if (j == 0) {
	scanf("%d", &c1);
	node[c1].parent = id;
	node[id].left = c1;
      }
      else {
	scanf("%d", &c2);
	node[c1].right = c2;
	node[c2].parent = id;
	c1 = c2;
      }
    }
  }
}

int search_depth(struct Node node[], int id) {
  id = node[id].parent;
  if (id != -1) {
    return search_depth(node, id) + 1;
  }
  else
    return 0;
}

void print_type(struct Node node[], int id) {
  if (node[id].parent == -1)
    printf("root, ");
  else if (node[id].left == -1)
    printf("leaf, ");
  else
    printf("internal node, ");
}

void print_clist(struct Node node[], int id) {
  id = node[id].left;
  printf("[");
  while (id != -1) {
    if (node[id].right != -1)
      printf("%d, ", id);
    else
      printf("%d", id);
    id = node[id].right;
  }
  printf("]");
}

void output(struct Node node[], int n) {
  int depth;
  for (int i = 0; i < n; i++) {
    printf("node %d: parent = %d, ", i, node[i].parent);
    printf("depth = %d, ", search_depth(node, i));
    print_type(node, i);
    print_clist(node, i);
    printf("\n");
  }
}

int main(void) {
  int n;

  struct Node node[100000];
  
  scanf("%d", &n);

  setup(node, n);
  input(node, n);

  output(node, n);

  return 0;
}



Measured memory_bytes: 2892
#include<stdio.h>
#include<stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(long*)a - *(long*)b;
}

int main(){
	int n,m,i;
	long x[100000];
	long long ans=0;
	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++)scanf("%ld",&x[i]);
	if(n>=m){
		puts("0");
		return 0;
	}
	long sa[100000]={0};
	qsort(x,m,sizeof(long),compare_int);
	for(i=0;i<m-1;i++)sa[i]=x[i+1]-x[i];
	qsort(sa,m-1,sizeof(long),compare_int);
	for(i=0;i<m-n;i++)ans+=sa[i];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2556
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
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;}
const ll INF = 1LL<<60;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    ll n, m; cin >> n >> m;
    vector<pair<ll, ll>> vp, origin;
    REP(i, m){
        ll p, y; cin >> p >> y;
        vp.pb({p, y});
        origin.pb({p, y});
    }
    sort(ALL(vp));
    map<ll, ll> mp;
    ll id = vp[0].fi, cnt = 0;
    for(int i=0; i<vp.size(); i++){
        ll nid = vp[i].fi;
        cnt++;
        if(nid == id){
            mp[vp[i].se] = cnt;
        }
        else{
            cnt = 1;
            mp[vp[i].se] = cnt;   
        }
        id = nid;
    }
    REP(i, m){
        string s, t;
        ll l = origin[i].fi, r = mp[origin[i].se];
        string sleft = to_string(l), sright = to_string(r);
        cout << setfill('0') << right << setw(6) << sleft;
        cout << setfill('0') << right << setw(6) << sright << endl;
    }
}

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

Measured memory_bytes: 10852
#include <iostream>

using namespace std;

int main() {

	int n, a, b;
	string s;
	int kakutei = 0;
	int kaigai = 0;

	cin >> n >> a >> b >> s;

	for (int i = 0; i < n; i++) {
		if (s.at(i) == 'a') {
			if (kakutei < a + b) {
				kakutei++;
				cout << "Yes" << endl;
				continue;
			}
		}
		else if (s.at(i) == 'b') {
			kaigai++;
			if (kakutei < a + b && kaigai <= b) {
				kakutei++;
				cout << "Yes" << endl;
				continue;
			}
		}

		cout << "No" << endl;
	}
}


Measured memory_bytes: 1336
n=int(input())
l=[]
for i in range(n):
	a=list(map(str,input().split()))
	l.append(a)

x=[]
y=[]
for i in range(n):
	x.append(float(l[i][0]))
	y.append(l[i][1])
count_j=0
count_b=0
for i in range(n):
	if(y[i]=="JPY"):
		count_j+=x[i]
	elif(y[i]=="BTC"):
		count_b+=380000*x[i]

ans=count_j+count_b
print(ans)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.io.IOException;
import java.io.InputStream;

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

    static class CFennecVsMonster {
        PrintWriter out;
        InputReader in;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            this.out = out;
            this.in = in;
            int n = ni();
            int k = ni();
            long[] arr = new long[n];
            int i = 0;
            for (i = 0; i < n; i++)
                arr[i] = nl();
            sort(arr);
            long sum = 0;
            for (i = 0; i < n - k; i++)
                sum += arr[i];
            pn(sum);
        }

        void sort(long[] A) {
            PriorityQueue<Long> pq = new PriorityQueue();
            int i = 0;
            for (i = 0; i < A.length; i++)
                pq.add(A[i]);
            for (i = 0; i < A.length; i++)
                A[i] = pq.poll();
        }

        int ni() {
            return in.nextInt();
        }

        long nl() {
            return in.nextLong();
        }

        void pn(long zx) {
            out.println(zx);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

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

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

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 46876
def lscan; gets.split.map(&:to_i); end

A,B,N = lscan

# p 0.upto(N).map{|x|
#   print x
#   print ' '
#   p A*x/B-A*(x/B)
# }.max

x = [B-1, N].min
p A*x/B-A*(x/B)

Measured memory_bytes: 14272
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long zero_K = 0, half_K = 0;
		for(int i = 1; i <= N; i++) {
			if(i % K == 0) zero_K++;
			if(i % K == K / 2) half_K++;
		}
		if(K % 2 == 0) {
			System.out.println(zero_K * zero_K * zero_K + half_K * half_K * half_K);
		}
		else {
			System.out.println(zero_K * zero_K * zero_K);
		}
	}
}

Measured memory_bytes: 24020
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  ll N;
  ll K;
  cin >>N>>K;
  vl a(N);
  vl b(N);
  rep(i,N) {
    cin >>a.at(i)>>b.at(i);
  }
  vector<pl> vec(N);
  rep(i,N) {
vec.at(i).fi=a.at(i);
    vec.at(i).se=b.at(i);
  }
  sort(all(vec));
  
  
  ll sum=0;
  rep(i,N) {
    sum+=vec.at(i).se;
    if(sum<K) {
      continue;
    }
    if(sum>=K) {
      cout<<vec.at(i).fi<<endl;
      break;
    }
    
      
      
      
      
      
      
      
    
  }
  
  
}
    
  
  
  

Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Pavel Mavrin
 */
public class Main {

    private void solve() throws IOException {
        int n = nextInt();
        int m = nextInt();
        int[] d = new int[n];
        for (int i=  0; i < m; i++) {
            int x = nextInt() - 1;
            int y = nextInt() - 1;
            d[x]++;
            d[y]++;
        }
        boolean ok = true;
        for (int i = 0; i < n; i++) {
            if (d[i] % 2 == 1) {
                ok = false;
            }
        }
        out.println(ok ? "YES" : "NO");
    }

    // ------------------

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;
    PrintWriter out = new PrintWriter(System.out);

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

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

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

    private void run() throws IOException {
        solve();
        out.close();
    }

}


Measured memory_bytes: 41520
#include<stdio.h>
int main()
{
  int a,b,c,p=2;
  scanf("%d %d %d", &a,&b,&c);
  if(a==b && b==c) p=1;
  else if(a!=b && b!=c && c!=a) p=3;
  printf("%d\n", p);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;

#define rep(i,n)  for(int i = 0; i < (int)(n);    i++)
#define sz(x)     ((int)(x).size())
#define all(x)    (x).begin(),(x).end()

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int L, R, d; std::cin >> L >> R >> d;
  std::cout << R/d - (L-1)/d << std::endl;
  return 0;
}



Measured memory_bytes: 3608
n=int(input())
s=[*input()]
q=int(input())
# BIT
B={chr(97+i):[0]*(n+1) for i in range(26)}
def bsum(c,i):
  s=0
  while i:
    s+=B[c][i]
    i-=i&-i
  return s
def badd(c,i,x):
  while i<=n:
    B[c][i]+=x
    i+=i&-i
for i,c in enumerate(s):
  badd(c,i+1,1)
for _ in range(q):
  x,y,z=input().split()
  y=int(y)-1
  if x=='1':
    badd(s[y],y+1,-1)
    s[y]=z
    badd(z,y+1,1)
  else:
    print(sum(1 for c in B if bsum(c,int(z))-bsum(c,y)))

Measured memory_bytes: 207472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int MOD = 1000000007;

int main()
{
	int a, b ,c = 0;
	cin >> a >> b >> c;
	bool flg = false;
	if (a < b)
	{
		while(a != b)
		{
			if (a == c)
			{
				flg = true;
				break;
			}
			a++;
		}
	}
	else
	{
		while (a != b)
		{
			if (a == c)
			{
				flg = true;
				break;
			}
			a--;
		}
	}

	string ans = flg ? "Yes" : "No";
	cout << ans << "\n";
	return 0;
}

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

int main ()
{
	int counts[26];
	for (int i=0; i<26; i++) counts[i] = 0;
	
	std::string buf;
	while (true) {
		std::cin >> buf;
		if (std::cin.eof()) break;
		
		for (std::string::iterator it = buf.begin(); it != buf.end(); ++it) {
			if (isupper(*it)) counts[(*it)-65]++;
			else if (islower(*it)) counts[(*it)-97]++;
		}
	}
	
	for (int i=0; i<26; i++) {
		std::cout << (char)(i + 97) << " : " << counts[i] << std::endl;
	}
	
	return 0;
}




Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int s[200005];
int vis[200005];
int main(){
	cin>>n;
	int k=0,ans=0;
	for(int i=1;i<=n;i++){
		scanf("%d",s+i);
		vis[s[i]]=vis[s[i]-1]+1;
		ans=max(vis[s[i]],ans);
	}
	cout<<n-ans;
	return 0;
}

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

int main() {
	int a, b, x;
	cin >> a >> b >> x;

	if (a == x) cout << "YES" << endl;
	else if (a < x && x - a <= b) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

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

int main(){
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    for(int i=0;i<n;i++){
        cout<<s[i]<<t[i];
    }
    cout<<"\n";
    return 0;
}


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

using namespace std;

bool isPalindrome(string s) {
	int n = s.length();
  	for (int i = 0; i < (n >> 1); ++i)
      if (s[i] != s[n - i - 1]) return false;
  	return true;
}

int main() {
  string s;
  cin >> s;
  int n = s.length();
  if (isPalindrome(s) && isPalindrome(s.substr(0, (n - 1) >> 1))) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

wa = {}
ans = 0
for i in range(len(a)):
    temp_wa = (i + 1) + a[i]
    if temp_wa in wa.keys():
        wa[temp_wa]+=1
    else:
        wa[temp_wa] = 1

    temp_sa = (i+1) - a[i]
    if temp_sa in wa.keys():
        ans += wa[temp_sa]

print(ans)


Measured memory_bytes: 40380
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int v[n],c[n];
  for(int i=0;i<n;i++)
    cin>>v[i];
  for(int i=0;i<n;i++)
    cin>>c[i];
  int total=0;
  for(int i=0;i<n;i++)
  {
    if(v[i]>c[i])
      total+=(v[i]-c[i]);
  }
  cout<<total<<"\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define md 1000000007
#define ll long long 
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fastmap mp.reserve(1024);mp.max_load_factor(0.25);
#define fastset st.reserve(1024);st.max_load_factor(0.25);
ll int mpw(ll int a,ll int b,ll int m)
{
	ll int ans=1;
	if(a==0)return 0;
	if(a==1 || b==0)return 1;
	while(b)
	{
		if(b&1)
		{
			ans=(ans*a)%m;
		}
		a=(a*a)%m;
		b>>=1;
	}
	return ans;
}

ll int pw(ll int a,ll int b)
{
	ll int ans=1;
	if(a==0)return 0;
	if(a==1 || b==0)return 1;
	while(b)
	{
		if(b&1)
		{
			ans*=a;
		}
		a*=a;
		b>>=1;
	}
	return ans;
}

ll int mn(ll int a,ll int b)
{
	if(a<=b)
	{
		return a;
	}
	return b;
}

ll int mx(ll int a,ll int b)
{
	if(a>=b)
	{
		return a;
	}
	return b;
}

int main()
{
	fio
	int n,m;
	cin>>n>>m;
	vector<vector<int>>g(n);
	for(int i=0;i<m;++i)
	{
		int a,b;
		cin>>a>>b;
		g[a-1].push_back(b-1);
	}
	vector<int>D(n,0);
	vector<int>vis(n,0);
	int ans=0;
	std::function<int(int)>dfs=[&](int node)->int{
		if(vis[node]==1)return D[node];
		else{
			vis[node]=1;
			for(int i=0;i<g[node].size();++i)
			{
				D[node]=max(D[node],1+dfs(g[node][i]));
			}
			ans=max(ans,D[node]);
			return D[node];
		}
	};
	for(int i=0;i<n;++i)
	{
		if(vis[i]==0)
		{
			dfs(i);
		}
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 12120
import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

md=10**9+7
n=II()
ans=(pow(10,n,md)+pow(8,n,md)-pow(9,n,md)*2)%md
print(ans)


Measured memory_bytes: 9196
import java.util.*;
import java.lang.Math;
public class Main
{
    public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	for(int a=1;;a++){
	    Polygo pol =new Polygo();
	    int n=sc.nextInt();
	    if(n==0)break;
	    for(int i=0;i<n;i++){
		pol.addXY(sc.nextDouble(),sc.nextDouble());
	    }
	    System.out.println(a+" "+Math.abs(pol.getArea()));
	}
    }
    
}
class Polygo
{
    ArrayList<Double> x=new ArrayList<Double>();
    ArrayList<Double> y=new ArrayList<Double>();
    Polygo()
    {
    }
    public void addXY(double x,double y)
    {
	this.x.add(x);
	this.y.add(y);
    }
    public StringBuffer getX()
    {
	StringBuffer s= new StringBuffer();
	for(int i=0;i<x.size();i++){
	    s.append(x.get(i));
	    s.append(" ");
	}
	return s;
    }
    public StringBuffer getY()
    {
	StringBuffer s= new StringBuffer();
	for(int i=0;i<y.size();i++){
	    s.append(y.get(i));
	    s.append(" ");
	}
	return s;
    }
    public double getArea()
    {
	double S=0;
	double[] x1=new double[2];
	double[] y1=new double[2];
	int d[]={1,0};
	
	x1[0]=x.get(0);
	y1[0]=y.get(0);
      
	for(int i=1;i<x.size();i++){
	    x1[i%2]=x.get(i);
	    y1[i%2]=y.get(i);
	    S+=(x1[d[i%2]]-x1[i%2])*(y1[d[i%2]]+y1[i%2]);
	}
	S+=(x.get(x.size()-1)-x.get(0))*(y.get(x.size()-1)+y.get(0));
	
	return S/2;
	
    }
}

Measured memory_bytes: 13000
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  a,b,c:Integer;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(a);
    Read(b);
    Readln(c);
    Writeln(a xor b xor c);
    readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 128
import math

N = int(input())

def isPrime(n):
  if n==2 or n==3: return True
  for i in range(2, int(n**0.5)+1):
    if n%i == 0:
      return False
  return True

primes = [str(i) for i in range(2, 55555+1) if i%5==1 and isPrime(i)]
print(' '.join(primes[0:N]))



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define dbg(x) cerr<<#x<<" = "<<x<<endl;
#define dbg_v(v,n) {cerr<<#v<<" = [";for(int III=0;III<=n;III++)cerr<<v[III]<<(III!=n?",":"]\n");}
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int,int>
#define MOD 1000000007
#define zeros(x) x&(x-1)^x
#define fi first
#define se second
#define Nmax 200005
using namespace std;

template<typename T = int>
struct AIB{
    #define INIT_VALUE (type == 2 ? INF : (type == 1 ? -INF : 0))
    map<int,T> A;
    int N, type;
    bool isReversed;
    const T INF = 0;
    const int OFF = 4;
 
    // type 0 = sum, 1 = max, 2 = min
    AIB(int _N = Nmax + 5,int _type = 0, bool _isReversed = false) : N(_N), type(_type), isReversed(_isReversed){
        assert(type >= 0 && type <= 2);
        //A.resize(N+5, INIT_VALUE);
    }
 
    void operation(T &A, T B){
        if (type == 0) A += B;
        else if (type == 1) A = max(A, B);
        else A = min(A, B);
    }

    void add(T pos, T val){
        for (pos=(isReversed ? N-pos-OFF : pos+OFF);pos < N; pos += pos & (-pos))
            operation(A[pos], val);
    }
 
    T sum(T pos){
        T ans = INIT_VALUE;
        for (pos=(isReversed ? N-pos-OFF : pos+OFF);pos > 0; pos -= pos & (-pos))
            operation(ans, A[pos]);
        return ans;
    }
 
    T sum(T L, T R){
        return sum(R) - sum(L-1);
    }
 
    T lowerBound(T val){
        long long p = 1, st = 0;
        for (;p<N;p<<=1);
        for (;p>=1;p>>=1) if (st + p < N && A[st+p] < val) {st += p;val -= A[st];}
        return st + 1 - OFF;
    }
    #undef INIT_VALUE
};
AIB<long long> aib(2e8, 1, false);

int x,y,x2,y2,n,ok;
pii P[Nmax];

int main(){
    ios::sync_with_stdio(false);
    
    cin >> x >> y >> x2 >> y2;
    cin >> n;
    if (x2 < x){
    	swap(x,x2);
    	swap(y,y2);
    }
    for (int i=1;i<=n;i++){
    	cin >> P[i].fi >> P[i].se;
    	
    	if (x <= P[i].fi && P[i].fi <= x2 && y <= P[i].se && P[i].se <= y2){
    		ok = 1;
    	}
    	if (y2 < y){
    		P[i].se = 1e8 - P[i].se;
    	}
    }
	if (y2 < y){
		y2 = 1e8 - y2;
		y = 1e8 - y;
	}

	if (x == x2 || y == y2){
		long double ans = (x2 - x) + (y2 - y);
		ans *= 10;
		if (ok) ans += -2 + acos(-1) * 1;
		cout << fixed << setprecision(9) << ans * 10 << '\n';
		return 0;
	}
	sort(P+1,P+n+1);

	for (int i=1;i<=n;i++){
		if (P[i].fi < x) continue;
		if (P[i].se < y) continue;
		if (P[i].fi > x2) break;
		int crt = aib.sum(P[i].se);
		aib.add(P[i].se, crt+1);
	}

	long double xx = 1,ans = (x2 - x) + y2 - y;
	ans *= 10;
	if (aib.sum(y2) == (x2 - x + 1) || aib.sum(y2) == (y2 - y + 1)){
		ans += xx * (-2 + acos(-1) / 2.0) * (aib.sum(y2) - 1);
		ans += (-2 + acos(-1));
	}
	else ans += xx * ((-2) + acos(-1) / 2.0) * aib.sum(y2);
	// cout << aib.sum(y2) << '\n';
	cout << fixed << setprecision(9) << ans * 10 << '\n'; 


    return 0;
}

Measured memory_bytes: 103168
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001; // const 書き換え禁止
const double PI = 3.14159265358979323846; //M_PI はライブラリ

int main(void){
    int n;
    string s;
    cin >> n >> s;
    string t;
    string u;
    for(int i= 0;i< n/2;i++){
        t += s[i];
    }
    for(int i = n/2;i<n;i++){
        u += s[i];
    }
    // cout << t << endl;
    // cout << u << endl;
    if(t == u){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}   

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

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

#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; 
		//order_of_key (k) : Number of items strictly smaller than k .
		//find_by_order(k) : K-th element in a set (counting from zero) (returns an iterator)           


void inp_out()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("debug.txt", "w", stderr);
	#endif
}

int32_t main()
{
	fastIO
	inp_out();

	int n; 
	cin >> n; 

	vi a(n); 

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

	sort(a.begin(), a.end()); 

	int ans = 0; 

	for(int i = 0; i < n; ++ i)
	{
		for(int j = i + 1; j < n; ++ j)
		{
			for(int k = j + 1; k < n; ++ k)
			{
				if(a[i] != a[j] && a[j] != a[k] && a[i] != a[k] && a[i] + a[j] > a[k])
					++ ans; 
			}
		}
	}

	cout << ans; 

	return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?-1:*p1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*p1=buf,*p2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=3e5;
typedef int fuko[yuzu|10];
typedef multiset<int> mts;
fuko a,dp,k;
int main() {
  int n=read(),i,j,m=1<<n;
  for (i=0;i<m;++i) a[i]=read();
  for (i=0;i<m;++i) {
    for (j=i;j<m;j=(j+1)|i) {
      dp[j]=max(dp[j],a[i]+k[j]);
      k[j]=max(k[j],a[i]);
    }
  }
  for (i=1;i<m;++i) 
    printf("%d\n",dp[i]=max(dp[i],dp[i-1]));
}

Measured memory_bytes: 6804
#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
#define MOD 1000000007
#define MAX 500005
lli p[MAX];
lli arr[MAX];
lli n;
lli a,b;
void DFS1(lli s,  lli dist, unordered_set <lli> &color){
    if(dist %a == 0){
        color.insert(s);
    }
    if(s == 1)
        return;
    DFS1(p[s], dist+1, color);
}
void DFS2(lli s,  lli dist, unordered_set <lli> &color){
    if(dist %b == 0)
        color.insert(s);
    if(s == 1)
        return;
    DFS2(p[s], dist+1, color);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n;
    cin>>n;
    lli a = 0;
    for(lli i = 0; i<n; i++){
        cin>>arr[i];
        if(i%2== 0 && arr[i]%2)
            a++;
    }
    cout<<a;
}


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

int main() {
    long long X;
    cin >> X;
    long long A, B;
    for (long long i = -200; i <= 200; i++) {
        long long B5 = i*i*i*i*i;
        for (long long j = 0; j < 400; j++) {
            long long A5 = j*j*j*j*j;
            if (A5 == X + B5) {
                A = j;
                B = i;
            }
            
        }
        
    }
    cout << A << " " << B << endl;
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main(){
    int n, num, cards[5][14] = {};
    char ch;
    cin >> n;
    for(int i = 0; i<n; i++){
        cin >> ch >> num;
        if(ch=='S') cards[0][num] = true;
        else if(ch=='H') cards[1][num] =true;
        else if(ch=='C') cards[2][num] =true;
        else if(ch=='D') cards[3][num] = true;
    }
    for(int i = 0; i<4; i++){
        for(int j = 1; j<14; j++){
            if (cards[i][j] == 0){
                if (i == 0) cout<<'S';
                else if(i == 1) cout<<'H';
                else if(i == 2) cout<<'C';
                else if(i == 3) cout<<'D';
                cout << " " << j << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3088
n = int(input())
l = input()
c = 0
if n%2 == 0:
    for i in range(0,n//2):
        if l[i] == l[i + n//2]:
            continue
        else:
            print('No')
            c = 1
            break
else:
    c = 1
    print('No')
    
if c == 0:
    print('Yes')

Measured memory_bytes: 3060
s = input()
n = len(s)
ans = 0
i = 0
prev = ''
while i < n:
  #文字列を増やしていく
  for j in range(i+1, n+1):
    tmp = s[i:j]
    #print("tmp:", tmp)
    if prev != tmp or prev =='':
      prev = tmp
      ans = ans +1
      break
  #print(i, j, tmp)
  #文字をずらす
  i = j
print(ans)

Measured memory_bytes: 3500
def function(args):
    N, X, Y = map(int, args.split())
    dests = [0] * (N)
    
    for i in range(1, N):
        for j in range(i+1, N+1):
            dist_direct = j - i
            dist_throughX = abs(X - i) + 1 + abs(Y - j)
            shortest = min(dist_direct, dist_throughX)
            dests[shortest] += 1
    dests.pop(0)
    return dests

if __name__ == '__main__':
    dests = function(input())
    for d in dests:
        print(d)


Measured memory_bytes: 3444
#include<bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v) cerr<<#v":[ ";for (auto macro_vi:v){cerr<<macro_vi<< " ";}cerr<<"]"<<endl;
#define ddump(v) cerr<<#v":"<<endl;for(auto macro_row:v) {cerr<<"["; for (auto macro__vi:macro_row){cerr<<macro__vi<< " ";}cerr<<"]"<<endl;}
#define damp(m) for(auto macro_pair:m){cerr<< macro_pair.first<<":"<<macro_pair.second<<endl;}
#define dpair(p) cerr << #p":"<<"(" << p.first << "," << p.second << ")" << endl;
// iterate
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define all(v) v.begin(), v.end()
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int>B(n-1);
    rep(i,n-1) cin >> B[i];
    int ans=0;
    ans+=B[0]+B[n-2];
    d(ans)
    for(int i=0; i<=n-3;i++){
        d(ans)
        ans+=min(B[i],B[i+1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 

int main(){
  int n;
  cin >>n;
  vector<ll> x(n),y(n);
  rep(i,n)cin >> x.at(i) >> y.at(i);
  vector<ll> xx(n);
  rep(i,n)xx.at(i)=mm+1-x.at(i);
  vector<ll> len1(n),len2(n);
  rep(i,n){
    len1.at(i)=x.at(i)+y.at(i);
    len2.at(i)=xx.at(i)+y.at(i);
  }
  sort(len1.begin(),len1.end());
  sort(len2.begin(),len2.end());
  ll ans1=len1.at(n-1)-len1.at(0);
  ll ans2=len2.at(n-1)-len2.at(0);
  ll ans=max(ans1,ans2);
  cout << ans << endl;
}

Measured memory_bytes: 11172
/// Updated! https://www.youtube.com/watch?v=U07_n9xGIlM
#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define dbug printf("I am here\n");
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int maxn = 1e6+100;

const ll inf = 1e18;
bool prime[maxn];
vector < int > primes;
ll mod = 1e9+7;
void seive(){
    for(int i = 2; i<maxn; i++){
        if(prime[i] == false){
            primes.push_back(i);
            for(int j = i + i; j<maxn; j+=i){
                prime[j] = true;
            }
        }
    }
}
ll arr[maxn];
map < ll , ll > mp;

ll bgmod(ll n , ll p){
    if(p == 0)return 1ll;
    if(p & 1){
        return (n % mod * bgmod(n,p-1)%mod) % mod;
    }
    else{
        ll ret = bgmod(n , p / 2);
        return ( ( ret % mod ) * ( ret % mod ) ) % mod;
    }
}


int main()
{
    seive();
    //cout << primes.size() << endl;
    fast;
    int n;
    cin >> n;
    for(int i = 1; i<=n; i++)cin >> arr[i];
    ll ans = 1;
    for(int i = 1; i<=n; i++){
        ll num = arr[i];
        for(ll j = 0; j<primes.size(); j++){
            ll co = 0;
            ll pr = primes[j];
            if(pr*pr>num)break;
            if(num%pr==0){
                while(num%pr==0){
                    co++;
                    num/=pr;
                }
                mp[pr] = max(mp[pr] , co);
            }
        }
        if(num != 1){
            mp[num] = max(mp[num] , 1ll);
        }
    }

    ll lcm = 1;
    for(auto v : mp){
        lcm = (lcm * bgmod(v.first,v.second));
        lcm %= mod;
    }

    for(int i = 1; i<=n; i++){
        ll num = arr[i];
        ans += (lcm * bgmod(num,mod-2));
        ans %= mod;
//        for(ll j = 0; j<primes.size(); j++){
//            ll co = 0;
//            ll pr = primes[j];
//            if(pr*pr>num)break;
//            if(num%pr==0){
//                while(num%pr==0){
//                    co++;
//                    num/=pr;
//                }
//                ll ab = abs(co-mp[pr]);
//                ok *= bgmod(pr,ab);
//                ok %= mod;
//            }
//        }
//        if(num != 1){
//            ll ab = abs(1-mp[num]);
//            ok *= bgmod(num,ab);
//            ok %= mod;
//        }
//        ans += ok;
//        ans %= mod;
    }
    cout << (ans-1)%mod << endl;
    return 0;
}
/*



*/



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

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> vec(H);
	int i, j, l;
	for (i = 0; i < H; i++) {
		cin >> vec.at(i);
	}

	for (l = 0; l < W + 2; l++) {
		cout << "#" ;
	}
	cout << endl;
	for (j = 0; j < H; j++) {
		cout << "#" << vec.at(j) << "#" << endl;
	}
	for (l = 0; l < W + 2; l++) {
		cout << "#" ;
	}
	cout << endl;


}

Measured memory_bytes: 256
import collections
def subarraySum(nums, k):
    count = total = 0
    cache = collections.defaultdict(int)
    cache[0] = 1
    for num in nums:
        total += num
        count += cache[total - k]
        cache[total] += 1
    return count
A = input()
nums = list(map(int,input().split()))
k = 0
print(subarraySum(nums, 0))

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

int main() {
  int N; cin>>N;
  vector<tuple<int, int>> A;
  for (int i = 1; i < N+1; i++) {
    int a;
    cin>>a;
    A.emplace_back(a, i);
  }

  sort(A.begin(), A.end());

  for (int i = 0; i < N-1; i++) {
    cout << get<1>(A[i]) << " ";
  }
  cout << get<1>(A[N-1]) << endl;


  return 0;
}

Measured memory_bytes: 1780
#include<stdio.h>

int main(void){
  long long n , x;
  scanf("%lld %lld",&n ,&x);

  long long a[n];
  for(int i = 0;i < n;i ++){
    scanf("%lld",&a[i]);
  }

  long long count = 0;

  for(int i = 0;i < n-1;i ++){
    if(a[i] + a[i+1] > x){
      int b = a[i] + a[i+1] - x; 
      a[i+1] -= b;
      count += b;
      //printf("%d\n",a[i+1]);
      if(a[i+1] < 0){
        a[i+1] = 0;
      }
    }
  }

  printf("%lld\n",count);

  return 0;
}

Measured memory_bytes: 896
/*
Author: CNYALI_LK
LANG: C++
PROG: a.cpp
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
template<class T>ll chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>ll chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
ll a[100100],b[100100],c[100100],f[100100];
int main(){
#ifdef cnyali_lk
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	ll n;
	scanf("%lld",&n);
	for(ll i=1;i<=n;++i)scanf("%lld",a+i);
	sort(a+1,a+n+1);
	for(ll i=1;i<=n;++i)scanf("%lld",b+i);
	sort(b+1,b+n+1);
	for(ll i=1,j=0;i<=n;++i){
		while(j<n&&a[j+1]<b[i])++j;
		f[i]=j+f[i-1];
	}
	for(ll i=1;i<=n;++i)scanf("%lld",c+i);
	sort(c+1,c+n+1);
	ll ans=0;
	for(ll i=1,j=0;i<=n;++i){
		while(j<n&&b[j+1]<c[i])++j;
		ans+=f[j];
	}
	printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 3328
#include <stdio.h>

int main()
{
	int N, sum = 0;
	scanf("%d", &N);
	for (; N > 0; N /= 10) sum += N % 10;
	if (sum == 1) printf("10\n");
	else printf("%d\n", sum);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1712
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int M, K;
  cin >> M >> K;
  if (K == 0) {
    REP(i, 1LL << M) {
      if (i > 0) cout << " ";
      cout << i << " " << i;
    }
    cout << endl;
    return 0;
  }

  if (M == 1 || K >= (1LL << M)) {
    cout << -1 << endl;
    return 0;
  }

  i64 s = 0;
  REP(i, 1LL << M) { s ^= i; }
  DEBUG(s);
  assert(s == 0);
  vector<int> ans;
  ans.reserve(1LL << (M + 1));
  REP(i, 1LL << M) {
    if (i != K) ans.push_back(i);
  }
  ans.push_back(K);
  for (int i = (1LL << M) - 1; i >= 0; --i) {
    if (i != K) ans.push_back(i);
  }
  ans.push_back(K);
  REP(i, ans.size()) { cout << (i == 0 ? "" : " ") << ans[i]; }
  cout << endl;
}


Measured memory_bytes: 4180
#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 300100;
int amt[N];
int amts[N];
using ii=long long;
ii sums[2][N];
int val[N];
int ind[N];
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        int x;
        scanf("%d", &x);
        amt[x]++;
    }
    for (int i = 1; i <= n; ++i) {
        amts[amt[i]]++;
    }
    for (int i = 1; i <= n; ++i) {
        sums[0][i]=sums[0][i-1]+amts[i]*i;
        sums[1][i]=sums[1][i-1]+amts[i];
    }
    for (int i = 1; i <= n; ++i) {
        val[i] = (sums[0][i] + 1ll * i * (sums[1][n] - sums[1][i])) / ((ii) i);
    }
    for (int i = n; i; --i) {
        int u = val[i];
        if (ind[u] == 0) {
            ind[u] = i;
        }
    }
    for (int i = n; i; --i) {
        ind[i - 1] = max(ind[i - 1], ind[i]);
    }
    for (int i = 1; i <= n; ++i) {
        printf("%d\n", ind[i]);
    }
}


Measured memory_bytes: 10112
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,i,j;
    cin>>n>>m;
    int dp[n+1][m+1];
    for(i=0;i<=n;i++) dp[i][0]=0;
    for(i=0;i<=m;i++) dp[0][i]=0;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
        {
            char x;
            cin>>x;
            if(x=='#')
                dp[i][j]=0;
            else dp[i][j]=1;
        }
    }
    /*for(i=0;i<=n;i++)
    {
        for(j=0;j<=m;j++)
        {
            cout<<dp[i][j]<<" ";
        }
        cout<<"\n";
    }
    */
    dp[0][1]=1;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
        {
            if(dp[i][j])
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
           // cout<<dp[i][j]<<" ";
        }
        //cout<<"\n";
    }
    cout<<dp[n][m]<<"\n";
}

Measured memory_bytes: 4096
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 20;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	double ans = 0;
	int N, K;
	scanf("%d %d", &N, &K);
	for (int i = 1; i <= N; i++) {
		int c = 0;
		double p = 1.0 / N;
		int t = i;
		while (t < K) {
			t *= 2;
			p /= 2;
		}
		ans += p;
	}
	return !printf("%.20lf\n", ans);
}

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

void big(int,int);
void medium(int,int);
void small(int,int);

int paper[10][10];

int main() {
	int x, y, num;
	char comma1, comma2;
	
	while (cin >> x >> comma1 >> y >> comma2 >> num) {
		switch (num) {
			case 1:
				small(x, y);
				break;
			case 2:
				medium(x, y);
				break;
			case 3:
				big(x, y);
				break;
			default:
				break;
		}
	}

	int count = 0, deep = 0;
	for (int i = 0; i < 10;i++) {
		for (int j = 0;j < 10;j++) {
			if (paper[i][j] == 0) count++;
			if (paper[i][j] > deep) deep = paper[i][j];
		}
	}

	cout << count << endl;
	cout << deep << endl;

	return 0;
}

void big(int x, int y) {
	medium(x, y);
	if (y + 2 < 10) paper[x][y + 2]++;
	if (y - 2 >= 0) paper[x][y - 2]++;
	if (x + 2 < 10) paper[x + 2][y]++;
	if (x - 2 >= 0) paper[x - 2][y]++;
	
	return;
}

void medium(int x, int y) {
	small(x, y);
	if (x + 1 < 10 && y + 1 < 10) paper[x + 1][y + 1]++;
	if (x - 1 >= 0 && y + 1 < 10) paper[x - 1][y + 1]++;
	if (x + 1 < 10 && y - 1 >= 0) paper[x + 1][y - 1]++;
	if (x - 1 >= 0 && y - 1 >= 0) paper[x - 1][y - 1]++;

	return;
}

void small(int x, int y) {
	paper[x][y]++;
	if (y + 1 < 10) paper[x][y + 1]++;
	if (y - 1 >= 0) paper[x][y - 1]++;
	if (x + 1 < 10) paper[x + 1][y]++;
	if (x - 1 >= 0) paper[x - 1][y]++;

	return;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    string a,b;
    map<string,int>m;
    cin>>N;
    cin>>b;
    m[b]=1;
    for(int i=1;i<N;i++){
        a=b;cin>>b;
        if(m[b]==1){cout<<"No"<<endl;exit(0);}
        m[b]=1;
        if(a[a.size()-1]!=b[0]){cout<<"No"<<endl;exit(0);}
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int n, m; cin >> n >> m;
    vector<int> H(n);
    rep(i,n) cin >> H[i];
    vector<vector<int>> G(n);
    rep(i,m){
        int a, b; cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int ans = 0;
    rep(v,n){
        bool highest = true;
        for(auto nv : G[v]){
            if(H[v] <= H[nv]) {
                highest = false;
                break;
            }
        }
        if(highest) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8752
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int n,m,a,b;
  vector<int> vec;
  
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a;
    vec.push_back(a);
  }
 
  cin >> m;
  for(int i=0;i<m;i++){
    cin >> b;
    cout << binary_search(vec.begin(),vec.end(),b) << endl;
  }

  return(0);
}



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

int main() {
  int n;
  cin >> n;
  vector<int> t(n + 1), x(n + 1), y(n + 1);
  t[0] = 0;
  x[0] = 0;
  y[0] = 0;
  rep(i, n) cin >> t[i + 1] >> x[i + 1] >> y[i + 1];

  bool able = true;
  rep(i, n) {
    int dx = abs(x[i + 1] - x[i]);
    int dy = abs(y[i + 1] - y[i]);
    int dt = t[i + 1] - t[i];
    if (dt < dx + dy || dt % 2 != (dx + dy) % 2) able = false;
  }
  if (able) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 4580
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using P = pair<int,int>;
using ll = long long;
const int INF = 100005;
const int MAX_N = 100005;

ll x,y;

int main(){
    cin >> x >> y;
    ll count =1;
    while(true){
        x = x*2;
        if(x > y) break;
        count ++ ;
        
    }

    cout << count << endl;

}

Measured memory_bytes: 256