akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }



int main()
{
	string s; cin >> s;
	int n = SZ(s);
	int c = 0;
	int ans = 0;
	REP(i, n)
	{
		if (s[i] == 'g')
		{
			if (c)
			{
				++ans;
				--c;
			}
			else
				++c;
		}
		else
		{
			if (c)
				--c;
			else
			{
				++c;
				--ans;
			}
		}

	}

	cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	int ind1;
	int n1,n2;
	n1 = n2 = 0;
	for (int i = 0; i < N; ++i) {
		int temp;
		cin >> temp;
		if (temp > n1) {
			n1 = temp;
			ind1 = i;
		}
		else if (temp > n2) {
			n2 = temp;
		}
	}
	for (int i = 0; i < N; ++i) {
		if (i == ind1) {
			cout << n2 << endl;
		}
		else {
			cout << n1 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.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 perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll dp[200010];
int main(){
    ll n;cin >> n;
    ll ans=0;
    rep(i,n){
        ll p;cin >> p;
        dp[p]=dp[p-1]+1;
        chmax(ans,dp[p]);
    }
    cout <<n-ans <<endl;
}

Measured memory_bytes: 1792
import numpy as np
c = np.array([list(map(int, input().split())) for i in range(3)])
c[0,:]-=c[2,:]
c[1,:]-=c[2,:]
c[2,:]-=c[2,:]
c[:,0]-=c[:,2]
c[:,1]-=c[:,2]
c[:,2]-=c[:,2]
if np.all(c==0):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 12500
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    vector<int> C;
    for(int i=0;i<10;i++){
        
        int a;cin >>a;
        C.push_back(a);
    }
    
    sort(C.begin(),C.end(),greater<int>());
    cout << C[0] << '\n' << C[1]<< '\n' << C[2] << '\n';
    return 0;
    
}

Measured memory_bytes: 3132
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#define int long long
using namespace std;
const int mod = 1e9+7;
const int inf = 1e9+10;
const int maxn = 5e3+10;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
char c[300005];
int ksm(int x,int y){
	int sum=1;
	while(x){
		if(x&1){(sum*=y)%=mod;}
		(y*=y)%=mod;
		x>>=1;
	}
	return sum;
}

struct node{
	int ans,id;
}a[maxn];
int sum[maxn];
int cmp(node x,node y){
	if(x.ans==y.ans)return x.id<y.id;
	return x.ans<y.ans;
}
bool check(int len){
	memset(a,0,sizeof(a));
	memset(sum,0,sizeof(sum));
	int x=1;
	for(register int i=1;i<=len;i++){
		x=x*26%mod;
		(sum[i]=sum[i-1]+x*(c[i]-'a'))%=mod;
	}
	a[len].ans=sum[len];a[len].id=len;
	int i26=ksm(mod-2,26);
	for(register int i=len+1;i<=n;i++){
		x=x*26%mod;
		(sum[i]=sum[i-1]+x*(c[i]-'a'))%=mod;
		a[i].ans=((sum[i]-sum[i-len]+mod)%mod*ksm(i-len,i26))%mod;
		a[i].id=i;
	}
	sort(a+1,a+n+1,cmp);
	int num=inf;
	for(register int i=1;i<=n;i++){
		if(a[i].id==0)continue;
		if(a[i].ans==a[i+1].ans)num=min(num,a[i].id);
		else {
			if(a[i].id-num>=len)return true;
			num=inf;
		}
	}
	return false;
}

signed main(){
	n=read();
	scanf("%s",c+1);
	int l=1,r=n,ans=0;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(mid)){ans=mid;l=mid+1;}
		else r=mid-1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Main {
    int A, B, Q;
    vector<ll> s, t, x;
    const ll INF = 1e11;
    void input() {
        cin >> A >> B >> Q;
        s.resize(A + 2);
        s[0] = -INF;
        s[A + 1] = INF;
        t.resize(B + 2);
        t[0] = -INF;
        t[B + 1] = INF;
        x.resize(Q);
        REP(i, A) { cin >> s[i + 1]; }
        REP(i, B) { cin >> t[i + 1]; }
        REP(i, Q) { cin >> x[i]; }
    }
    void output() {
        REP(q, Q) {
            ll res = INF;
            ll s_plus = *lower_bound(s.begin(), s.end(), x[q]);
            ll s_minus =
                *lower_bound(s.rbegin(), s.rend(), x[q], greater<ll>());
            ll t_plus = *lower_bound(t.begin(), t.end(), x[q]);
            ll t_minus =
                *lower_bound(t.rbegin(), t.rend(), x[q], greater<ll>());
            res = min(res, max(s_plus, t_plus) - x[q]);
            res = min(res, x[q] - min(s_minus, t_minus));
            res = min(res, 2 * s_plus - x[q] - t_minus);
            res = min(res, 2 * t_plus - x[q] - s_minus);
            res = min(res, x[q] - 2 * s_minus + t_plus);
            res = min(res, x[q] - 2 * t_minus + s_plus);
            cout << res << endl;
        }
    }

public:
    Main() {
        input();
        output();
    }
};

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

    Main();

    return 0;
}


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

using namespace std;

using i64 = long long;

const i64 MOD = 1000003;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


bool solve(){
    int h, w;
    cin >> h >> w;
    if(h == 0)
        return false;
    vector<int> a{0};
    vector<int> b{0};
    int p = 0;
    for(int i = 0; i < h; ++i){
        int x;
        cin >> x;
        p += x;
        a.push_back(p);
    }
    p = 0;
    for(int j = 0; j < w; ++j){
        int x;
        cin >> x;
        p += x;
        b.push_back(p);
    }

    map<int,int> m1, m2;
    vector<int> c, d;
    for(int i = 0; i < h; ++i)
        for(int j = i + 1; j <= h; ++j)
            ++m1[a[j] - a[i]];
    for(int i = 0; i < w; ++i)
        for(int j = i + 1; j <= w; ++j)
            ++m2[b[j] - b[i]];

    i64 ans = 0;
    for(auto& p : m1){
        ans += p.second * m2[p.first];
    }
    cout << ans << endl;
    return true;
}


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


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

int main(){
  int G[302][302];
  int n;
  cin>>n;
  for(int i =1;i<=n;++i)
  for(int j=1;j<=n;++j){
    scanf("%d",&G[i][j]);
  }
  bool ok = true;
  long long total =0;
  for(int i=1;i<=n;++i){
    for(int j=i+1;j<=n;++j){
    bool big = true;
    for(int k =1;k<=n;++k){
        if(k!=i&&k!=j&&G[i][j]>G[i][k]+G[k][j]){
            ok = false;
            break;
        }
        if(k!=i&&k!=j&&G[i][j]==G[i][k]+G[k][j])
            big = false;
    }
    if(ok == false)
        break;
    if(big)
        total +=G[i][j];
  }
  if(ok == false)
    break;
  }
  if(ok==false)
    cout<<"-1"<<endl;
  else
    cout<<total<<endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<int, int>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int>
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
#define INF 1e18
#define NINF -1e16

#define nax 200005
bool isPrime(ll n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
} 
bool isPowerOfTwo (unsigned int x) 
{ 
  return (!(x&(x-1))); 
}
vll prime;
signed main() {
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	srand (static_cast <unsigned> (time(0)));
	int t=1;
	//cin >> t;
	while (t--) 
	{
		int x;
      cin >>x;
      if (x>=400 && x<=599)
        cout <<8<<endl;
      else if(x>=600 && x<=799) 
        cout <<7;
      else if (x>=800 && x<1000)
        cout <<6;
      else if (x>=1000 && x<1200)
        cout <<5;
      else if (x>=1200 && x<1400)
        cout <<4;
      else if (x>=1400 && x<1600)
        cout <<3;
      else if (x>=1600 && x<1800)
        cout <<2;
      else
        cout <<1;
		
	}
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t


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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}


long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

//ここまでライブラリ
//ここから本文

long long int tpimin(vector<int> a) {
	int MIN = 1000000000;
	int number = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
		number = i;
	}
	return number;
}
int main() {

	int x, y, z;
	cin >> x >> y >> z;
	x -= z;
	cout << x / (y + z)  << endl;
}


Measured memory_bytes: 256
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a - 1)) in
    let rec loop i acc =
        if i = n then acc else
            let acc = if a.(i) > i && a.(a.(i)) = i then acc + 1 else acc in
            loop (i + 1) acc
    in
    loop 0 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 5376
h,w = map(int, input().split())

bignum = pow(10,9) + 7

mee = [[0 for i in range(w+1)] for j in range(h)]
#starting should all be 1
#walled = -1

for j in range(h):
    mee[j][0] = 0


for i in range(h):
    temp = input()
    for j in range(w):
        if temp[j] == "#":
            mee[i][j+1] = -1

for i in range(w+1):
    if mee[0][i] == -1:
        break
    mee[0][i] = 1

#from top and from left >0 --> +1
#
for i in range(1,h):
    for j in range(1,w+1):
        if mee[i][j] == -1:
            continue
        if mee[i - 1][j] > 0 and mee[i][j - 1] > 0:
            mee[i][j] = mee[i - 1][j] % bignum + mee[i][j - 1] %bignum

        elif mee[i - 1][j] > 0 or mee[i][j - 1] >0:
            mee[i][j] = max(mee[i-1][j],mee[i][j-1])

print(mee[-1][-1] % bignum)






Measured memory_bytes: 43492
n=int(input())
s=str(input())
arr=[]
k=0
for i in range(n):
    if(s[i]=='W'):
        k+=1
    arr.append(k)
arr1=[]
k=0
for i in range(n-1,-1,-1):
    if(s[i]=='E'):
        k+=1
    arr1.append(k)
sumx=300000
sumx=arr1[n-2]
#print(sumx)
if(arr[n-2]<sumx):
    sumx=arr[n-2]
for i in range(1,n-1):
    if(arr[i-1]+arr1[n-2-i]<sumx):
        sumx=arr[i-1]+arr1[n-2-i]
print(sumx)

Measured memory_bytes: 18080
/**********************************
	author:  mariogzsl
**********************************/

#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,b,a) for(int i=b-1;i>=a;i--)
#define f first
#define s second
#define puts(x) cout<<x<<endl
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	double A, B, T;
	cin>>A>>B>>T;

	double ans=0;

	cout<<B*int(T/A)<<endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace TestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                 
                var st = Console.ReadLine()
                    .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(x => int.Parse(x))
                    .ToArray();
                int n = st[0];
                int m = st[1];
                int p = st[2];
                if (n + m + p == 0)
                    break;
                var ls = new List<int>();
                var coun = 0;
                for (int i = 0; i < n; i++)
                {
                    var a = int.Parse(Console.ReadLine());
                    coun += a;
                    ls.Add(a);
                }
                var money = 100 * coun * 0.01 * (100 - p);
                if (ls[m - 1] != 0)
                    Console.WriteLine(((int)money / ls[m-1]));
                else
                    Console.WriteLine(0);
            }
        }
         
    }
 
}


Measured memory_bytes: 9664
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int Get_sum(int x){
	int sum = 0;
	int dig;
	for(int i=10000; i>=1; i/=10){
		dig = x / i;
		// printf("dig[%d] = %d\n",i,dig);
		sum += dig;
		x -= dig * i;
	}
	return sum;
}

int main(){
	int N,A,B;
	int sum = 0;
	scanf("%d %d %d",&N,&A,&B);
	for(int i=1; i<=N; i++){
		if(Get_sum(i) >= A && Get_sum(i) <= B){
			sum += i;
		}
	}
	printf("%d\n",sum);

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
using namespace std;

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

typedef long long ll;
typedef pair<int, int> pii;
#define mp make_pair

const int M = 50;
const int N = 100100;
int dist[N];
vector<int> q[M];
int n;

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		dist[i] = M - 1;
	for (int i = 1; i < 10; i++)
		dist[i % n] = min(i, dist[i % n]);
	for (int i = 0; i < n; i++)
		q[dist[i]].push_back(i);
	for (int d = 0; d < M; d++) {
		for (int i = 0; i < (int)q[d].size(); i++) {
			int x = q[d][i];
			if (dist[x] != d) continue;
			for (int y = 0; y < 10; y++) {
				int z = (10 * x + y) % n;
				int w = d + y;
				if (w < dist[z]) {
					dist[z] = w;
					q[w].push_back(z);
				}
			}
		}
	}
	printf("%d\n", dist[0]);

	return 0;
}


Measured memory_bytes: 2936
obj = {}
("a".."z").each do |s|
  obj[s] = 0
end

while line = gets
  line.chomp.downcase.chars do |key|
    obj[key] += 1 if /[a-z]/ === key
  end
end

obj.each do |key, val|
  puts "#{key} : #{val}"
end

Measured memory_bytes: 6096
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

int main() {
    char c[101];
    cin >> c;
    cin >> c;

    cout << 'A' << c[0] << 'C' << endl;

    return 0;
}

Measured memory_bytes: 764
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int data[101];
int bs(int head,int tail,int m, int n){
  int mid = (head+tail)/2;
  if(head>tail) return(n-1);
  if(data[mid]>m){
    return bs(head,mid-1,m,n+1);
  }else if(data[mid]<m){
    return bs(mid+1,tail,m,n+1);
  }else{
    return (n);
  }
}
int main(void){
  int n;
  while(cin>>n){
    if(n==0) break;
    int m;
    REP(i,n)cin>>data[i];
    cin>>m;
    if(n==1) cout<<1<<endl;
    else cout<<bs(0,n-1,m,1)<<endl;
  }
  return 0;
}

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, K; cin >> N >> K;
  using Pair = pair<ll, ll>;
  vector<ll> X, Y;
  vector<Pair> P;
  for (ll i = 0; i < N; i++) {
    ll x, y; cin >> x >> y;
    X.push_back(x);
    Y.push_back(y);
    P.emplace_back(x, y);
  }
  // sort(X.begin(), X.end());
  sort(P.begin(), P.end());
  sort(Y.begin(), Y.end());
  ll ans = LLONG_MAX;
  for (ll i = 0; i < N; i++) {
    ll p = Y.at(i);
    for (ll j = i+1; j < N; j++) {
      ll q = Y.at(j);
      vector<ll> vec;
      for (ll k = 0; k < N; k++) {
	const Pair& pr = P.at(k);
	if (p <= pr.second && pr.second <= q) vec.push_back(pr.first);
      }
      ll M = vec.size();
      if (M < K) continue;
      for (ll k = 0; k + (K-1) < M; k++) {
	ans = min(ans, (vec.at(k + (K-1)) - vec.at(k)) * (q - p));
      }
    }
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
MOD = 10**9 + 7
S = input()

cur = [0] * 13
cur[0] = 1
r = 1
for i in range(len(S)):
    s = S[-(i+1)]
    if s == '?':
        digits = range(10)
    else:
        digits = [int(s)]

    prev = cur
    cur = [0] * 13
    for m in range(13):
        for d in digits:
            cur[(m + r*d) % 13] += prev[m]
    for m in range(13):
        cur[m] %= MOD
    r = (10 * r) % 13

print(cur[5])

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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
    
int main(){
    int N;
    cin>>N;
    vector<LL> A(N);
    cin>>A;
    LL up=1;
    LL down=1;
    FOR(i,1,N){
        LL nd=min(up,down)+1;
        LL nu=min(up,down)+1;
        if(A[i]>=A[i-1])chmin(nu,up);
        if(A[i]<=A[i-1])chmin(nd,down);
        up=nu;
        down=nd;
    }
    cout<<min(up,down)<<endl;
    
    return 0;
}


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

#define ll long long
#define PB push_back
#define PII pair<int, int>
#define MP make_pair
#define all(x) x.begin(), x.end()
#define REP(x, y, z) for(int x = (y); x <= (z); x++)
#define REPP(x, y, z) for(int x = (y); x >= (z); x--)
#define F first
#define S second
#define MSET(x, y) memset(x, y, sizeof(x)) 
#define EB emplace_back
#define maxn
#define IOS ios::sync_with_stdio(false); cin.tie(0);

//structure

//declaration

//functions

int main(void)
{
	#ifdef DBG
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
	#endif

	IOS;

	string str1;
  	string str2;
  	cin >> str1 >> str2;
  	int a, b;
  	string str3;
  cin >> a >> b;
  cin >> str3;
  
  if(str1 == str3)
    cout << a-1 << ' ' << b << '\n';
  else
    cout << a << ' ' << b-1 << '\n';

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string T;
int main()
{
	cin >> T;
	for (auto i = 0; i < T.length(); i++)
	{
		cout << ((T[i] != '?') ? T[i] : 'D');
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3760
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long long gcd(long long a,long long b){
	while(a){
		b%=a;swap(a,b);
	}return b;
}
long long p(long long a){
	long long ret=a;
	long long b=a;
	for(int i=2;i*i<=a;i++){
		if(b%i==0){
			ret=ret/i*(i-1);
			while(b%i==0)b/=i;
		}
	}
	if(b>1){
		ret=ret/b*(b-1);
	}
	return ret;
}
long long gojo(long long a,long long b,long long &x,long long &y){
	if(b){long long g=gojo(b,a%b,y,x);y-=(a/b)*x;return g;}
	x=1;y=0;return a;
}
long long po(long long a,long long b,long long m){
	long long ret=1%m;
	while(b){
		if(b%2)ret=ret*a%m;
		a=a*a%m;
		b/=2;
	}
	return ret;
}
pair<long long,long long> solve(long long a,long long b){
	if(b==1)return make_pair(0LL,0LL);
	long long c=p(b);
	pair<long long,long long>ret=solve(a,c);
	return make_pair(po(a,ret.first+50*c,b),ret.first);
}
int main(){
	int T;scanf("%d",&T);
	while(T--){
		int a,b;scanf("%d%d",&a,&b);
		if(a==0){
			printf("%d\n",b);continue;
		}
		if(a==1){
			printf("%d\n",1);continue;
		}
		pair<long long,long long> ret=solve(a,b);
	//	printf("%lld %lld, %lld %lld\n",b,ret.first,p(b),ret.second);
		long long g=gcd(b,p(b));
		long long sm=b;
		long long tm=p(b);
		long long x,y;
		gojo(sm,tm,x,y);
		long long v=sm*tm;
		long long nm=sm*tm/g;
		long long q=ret.first+x*(ret.second-ret.first)/g%tm*sm;
		q%=v;q+=v;q%=v;
		//printf("%lld\n",q);
		while(q<50)q+=v;
		printf("%lld\n",q);
	}
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_132
{
    class C
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] vals = ReadInts();
            Array.Sort(vals);
            WriteLine(vals[n / 2] - vals[n / 2 - 1]);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 18912
#include <iostream>
#include <cstdlib>
#include<algorithm>
using namespace std;
int main(){
	int N,M, p;
	cin>>N>>M>>p;
	int d[10001];
	d[0]=p;
	for(int i=1;i<=M;i++){
		cin>>d[i];
	}
	sort(d,d+M+1);
	int cmin=N-1;
	for(int i=0;i<M+1;i++){
		int q=d[i];
		int r1=d[(i-1+M+1)%(M+1)];
		int r2=d[(i+1)%(M+1)];
		int c1=((p-q+N)%N)*2+(r1-p+N)%N;
		int c2=((q-p+N)%N)*2+(p-r2+N)%N;
		cmin=min(cmin,min(c1,c2));
	}
	cout<<cmin*100<<endl;
	return 0;
}

Measured memory_bytes: 1216
#include<iostream>
#define MOD 10000
using namespace std;
int main(){
    int n,k,P[100]={0};
    cin>>n>>k;
    for(int i=0;i<k;i++){
        int d,s;
        cin>>d>>s;
        P[d-1]=s;
    }
    int dp[100][3][2]={{{0}}};
    for(int i=0;i<3;i++)dp[0][i][0]=1;

    for(int i=0;i<n;i++){
        if(P[i])
            for(int j=0;j<3;j++)
                if(!(P[i]-1==j))dp[i][j][0]=dp[i][j][1]=0;
        if(i+1==n)break;
        for(int j=0;j<3;j++){
            for(int k=0;k<2;k++){
                int c;
                for(int l=0;l<3;l++){
                    if(j==l)c=k+1;
                    else c=0;
                    if(c==2)continue;
                    dp[i+1][l][c]+=dp[i][j][k];
                    dp[i+1][l][c]%=MOD;
                }
            }
        }

    }
    int sum=0;
    for(int i=0;i<3;i++){
        for(int j=0;j<2;j++){
            sum+=dp[n-1][i][j];
            sum%=MOD;
        }
    }
    cout<<sum<<endl;

}

Measured memory_bytes: 1160
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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










int main(){
    int x; std::cin >> x;
    std::cout << !x << std::endl;
    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  string s;
  cin >> s;
  ll y=0,m=0,d=0;
  for(ll i=0;i<4;i++) {
    y*=10;
    y+=(s[i]-'0');
  }
  for(ll i=0;i<2;i++) {
    m*=10;
    m+=(s[i+5]-'0');
  }
  for(ll i=0;i<2;i++) {
    d*=10;
    d+=(s[i+8]-'0');
  }
  if(y<2019||(y==2019&&m<4)||(y==2019&&m==4&&d<=30)) {
    cout << "Heisei" << endl;
  }
  else {
    cout << "TBD" << endl;
  }
}

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

using namespace std;

typedef long long ll;

ll c[55][55];
int n, p, o, e;

int main() {
	for (int i = 0; i < 55; ++i) {
		c[i][0] = 1;
	}
	for (int i = 1; i < 55; ++i) {
		for (int j = 1; j < 55; ++j) {
			c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
		}
	}
	cin >> n >> p;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		if (x & 1) ++o;
		else ++e;
	}
	ll ans = 0;
	if (p) {
		for (int i = 1; i <= o; i += 2) {
			ans += c[o][i] * (1LL << e);
		}
	} else {
		for (int i = 0; i <= o; i += 2) {
			ans += c[o][i] * (1LL << e);
		}
	}
	cout << ans << '\n';
	return 0;
}



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

int main(){
string S;
cin >> S;
if(S == "RRR"){
    cout << 3 << endl;
}
else if(S=="RRS" || S=="SRR"){
    cout << 2 << endl;
}

else if(S=="SSS"){
    cout << 0 << endl;
}

else{
    cout << 1 << endl;
}

return 0;
}

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

int main()

{
    int h,i;
    string a,b,c;
    c="";
    i=0;
  

    cin >> h;
    cin >> a >> b;
    
    for(i=0;i<h;i++){
       c.push_back(a.at(i));
       c.push_back(b.at(i));
       
    }

    cout << c<<endl;
    }




Measured memory_bytes: 256
def solve(N):
    ret = 0
    for i in range(3, N + 1, 2):
        div = 0
        for j in range(1, i + 1, 2):
            div += 1 if not i % j else 0
            if 8 < div:
                break
        ret += 1 if div == 8 else 0
    return ret

if __name__ == '__main__':
    N = int(input())
    print(solve(N))

Measured memory_bytes: 38768
n = 10
f,s,t = -1,-2,-3
for _ in range(n):
    inp = int(input())
    if inp > f:
        f,s,t = inp,f,s
    elif inp > s:
        s,t = inp,s
    elif inp > t:
        t = inp
print(f)
print(s)
print(t)


Measured memory_bytes: 7660
#include <bits/stdc++.h>
#define in_arr(n,A)                     for(int i=0;i<n;i++)cin>>A[i];
#define IOS                             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi                              vector <int>
#define vl                              vector <ll>
#define out_arr(n,A)                    for(int i=0;i<n;i++)cout<<A[i]<<" ";
#define LINE                            cout << endl
#define SPACE                           cout << " "
#define pb                              push_back
#define Fr                              first
#define Sc                              second
#define YES                             cout << "YES"
#define NO                              cout << "NO"
#define wrong                           cout << -1
#define pll                             pair <ll, ll>
#define pii                             pair <int, int>
#define OO                              INT_MAX
#define SMALL                           INT_MIN
#define BIGx2                           LONG_LONG_MAX
#define sz                              size()
//BIT_OP
#define isOn(s, j)                      (s & (1<<j))
#define setBit(s, j)                    (s |= ( 1<< j))
#define clearBit(s, j)                  (s &= ~( 1 << j ))
#define lowBit(s)                       (s & (-s))
#define setAll(s, n)                    ( s = ( 1 << n ) - 1)
#define modulo(s, n)                    ((s) & ( n - 1 ))
#define isPowerOfTwo(s)                 (!(s & (s - 1)))
#define nearestPowerOfTwo(s)            ((int)pow(2.0, (int)((log((double)s) / log(2.0)) + 50. )))
#define nextnearestPowerOfTwo(s)        (1<<(32 - __builtin_clz(s)))
#define turnoffLastBit(s)               ((s) & (s - 1))
#define turnonLastZero(s)               ((S) | (s + 1))
#define turnoffLastConsecutiveBits(s)   ((s) & (s + 1))
typedef long long ll;
using namespace std;
int n;
int A[200200];

int main()
{
    IOS
    cin >> n;
    for(int i = 0 ; i < n ; i++)
        cin >> A[i];
    reverse(A, A + n);
    ll Targ = A[0], Cnt = 0, Ans = -1;
    for(int i = 1 ; i < n ; i++)
    {
        if(Targ <= A[i])
        {
            Cnt++;
        }
        else
        {
            Ans = max(Cnt, Ans);
            Cnt = 0;
        }
        Targ = A[i];
    }
    Ans = max(Ans, Cnt);
    cout << max(Ans, 0ll) << endl;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 2000000

void insert(int S[],int k);
void increase(int S[],int i,int k);
int extract(int S[]);
void maxheapify(int S[],int i);

int A[MAX];
int size = 0;

int main()
{
    char a[10];
    int k,l;
    
    while(1){
        scanf("%s",a);
        if(strcmp(a,"end") == 0) break;
        else if(strcmp(a,"insert") == 0){
            scanf("%d",&k);
            insert(A,k);
        }
        else{
            l = extract(A);
            printf("%d\n",l);
        }
    }
    return 0;
}

void insert(int S[],int k)
{
    size = size + 1;
    S[size] = -1;
    increase(S,size,k);
}

void increase(int S[],int i,int k)
{
    int n;
    if(k < S[i]){
        printf("error\n");
        exit(1);
    }
    S[i] = k;
    while(i > 1 && S[i/2] < S[i]){
        n = S[i];
        S[i] = S[i/2];
        S[i/2] = n;
        i = i / 2;
    }
}

int extract(int S[])
{
    int max;
    if(size < 1){
        printf("error\n");
        exit(2);
    }
    max = S[1];
    S[1] = A[size];
    size = size - 1;
    maxheapify(S,1);
    return max;
}

void maxheapify(int S[],int i)
{
    int l,r,largest,n;
    
    l = 2 * i;
    r = 2 * i + 1;
    
    if(l <= size && S[l] > S[i]) largest = l;
    else largest = i;
    
    if(r <= size && S[r] > S[largest]) largest = r;
    if(largest != i){
        n = S[i];
        S[i] = S[largest];
        S[largest] = n;
        maxheapify(S,largest);
    }
}



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

int main() {
	int n;
	int b, f, r, v;
	int count[4][3][10];

		for (int i = 0; i < 4; i++)
			for (int j = 0; j < 3; j++)
				for (int k = 0; k < 10; k++)
					count[i][j][k] = 0;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		count[b-1][f-1][r-1] += v;
	}
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				cout << " ";
				cout << count[i][j][k];
			}
			cout << endl;
		}
		if (i < 3) cout << "####################" << endl;
	}
	return 0;
}


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

int main() {
  int v;
  cin >> v;
  char op;
  while (cin >> op) {
    if (op == '=')
      break;
    int t;
    cin >> t;
    if (op == '+')
      v += t;
    if (op == '-')
      v -= t;
    if (op == '*')
      v *= t;
    if (op == '/')
      v /= t;
  }
  cout << v << endl;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    cin >> n;
    int maxv = -1, ind = 100;
    rep(i, n)
    {
        int a, b;
        cin >> a >> b;
        if (maxv <= b)
        {
            if (maxv == b)
            {
                ind = min(ind, a);
                continue;
            }
            ind = a;
            maxv = b;
        }
    }
    cout << ind << " " << maxv << endl;

    return 0;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

struct you{
    int ma;
    set<P> st;
};

int main() {
    int n; cin >> n;
    vector<int> ar(n);
    rep(i,n) cin >> ar[i];
    int ans = 0;
    repp(i,n-1,1){
        if (ar[i-1] < ar[i] && ar[i] < ar[i+1]) ans++;
        if (ar[i-1] > ar[i] && ar[i] > ar[i+1]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N, M;
  cin >> N >> M;
  string S;
  cin >> S;
  reverse(S.begin(), S.end());

  vector<int> back(N + 1);
  int prev = 0;
  for (int i = 1; i <= N; ++i) {
    if (S[i] == '0') prev = i;
    else back[i] = prev;
  }
  
  vector<int> steps;
  int cur = 0;
  while (true) {
    int next = cur + M;
    if (next >= N) {
      next = N;
      steps.push_back(next - cur);
      break;
    }
    if (S[next] == '1') {
      // while (S[next] == '1') {
      // 	--next;
      // }
      next = back[next];
      if (next == cur) {
	cout << -1 << endl;
	return 0;
      }
    }
    steps.push_back(next - cur);
    cur = next;
  }
  
  reverse(steps.begin(), steps.end());
  for (auto step : steps) {
    cout << step << " ";
  }
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 1528
using System;

namespace Test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            while (true)
            {
                var inputs = Console.ReadLine().ToCharArray();
                if (inputs[0] == '0') return;
                var result = 0;

                foreach (var item in inputs)
                {
                    result += int.Parse(item.ToString());
                }

                Console.WriteLine(result);
            }
        }
    }
}

Measured memory_bytes: 5676
import java.util.List;
import java.util.Scanner;

public class Main {
	static int v = 0;
	static List<List<Integer>> ansList = null;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long k = sc.nextInt();
		long a = sc.nextInt();
		long b = sc.nextInt();
		sc.close();

		if (b - a < 2 || k <= a) {
			System.out.println(k + 1);
			return;
		}

		long c = k - a + 1;
		long d = c / 2;
		long ans = a + (b - a) * d + c % 2;
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<int, int> p;

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

    int N;
    cin >> N;

    ll x = 0;

    vector<int> a(N);
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        x ^= a[i];
    }

    for(int i = 0; i < N; i++) {
        cout << (x ^ a[i]) << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3968
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e9;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200005;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,n;
    cin >> h >> n;
    ll a,c = 0;
    rep(i,n){
        cin >> a;
        c += a;
    }
    Yes(c >= h);
}


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

distance = [k] * n

for i in range(n - 1):
  distance[i] -= houses[i + 1] - houses[i]

distance[n - 1] -= k - houses[n - 1] + houses[0]

print(min(distance))

Measured memory_bytes: 26436
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    string s;
    cin >> s;
    int n = s.length();
    int i;
    char last='a';
    for(i=0;i<n;i++){
        if(s[i]=='?'){
            s[i]='D';
        }
    }
    cout << s << endl;
    return 0;
}

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

using namespace std;

int n, p, a[50];
long long f[50][2];

int main() {
	cin >> n >> p;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	f[0][0] = 1 + (a[0] % 2 == 0);
	f[0][1] = (a[0] % 2 != 0);
	for(int i = 1; i < n; i++) {
		f[i][0] = f[i - 1][0];
		f[i][1] = f[i - 1][1];
		if(a[i] % 2 == 0) {
			f[i][0] += f[i - 1][0];
			f[i][1] += f[i - 1][1];
		} else {
			f[i][0] += f[i - 1][1];
			f[i][1] += f[i - 1][0];
		}
	}
	cout << f[n - 1][p];
}

Measured memory_bytes: 256
N, = map(int, raw_input().split())
A, B = map(int, raw_input().split())
P = map(int, raw_input().split())
c = [0]*3
for p in P:
  if p<=A:
    c[0]+=1
  elif A<p<=B:
    c[1]+=1
  else:
    c[2]+=1
print min(c)

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

int main()
{
  int N, K, Q, who;

  cin >> N >> K >> Q;

  vector<int> score(N, K);

  for (int i = 0; i < Q; i++)
  {
    cin >> who;
    score[who - 1]++;
  }

  for (int i = 0; i < N; i++)
  {
    if (score[i] - Q < 1)
    {
      cout << "No" << endl;
    }

    else
    {
      cout << "Yes" << endl;
    }
  }
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
using namespace std;

typedef unsigned int uint;
typedef long long int64;
typedef unsigned long long uint64;
typedef pair<int, int> ii;
typedef pair<int64, int64> int64int64;
typedef vector<int> vint;
typedef vector<int64> vint64;
typedef vector<uint64> vuint64;
typedef vector<vint> vvint;
typedef vector<vint64> vvint64;
typedef vector<vuint64> vvuint64;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;

#define mp make_pair
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define fori(n) for(int i = 0; i < n; ++i)
#define forj(n) for(int j = 0; j < n; ++j)
#define fork(n) for(int k = 0; k < n; ++k)
#define INF9 (int64)(1e9)
#define INF18 (int64)(1e18)

template<typename T>
struct compF{
	bool operator()(const pair<T, T> &a, const pair<T, T> &b){
		return a.first < b.first;
	}
};

template<typename T>
struct compS{
	bool operator()(const pair<T, T> &a, const pair<T, T> &b){
		return a.second < b.second;
	}
};

template<typename T>
void printMatrix(const string &txt, vector<vector<T>> &a){
	cout << txt;
	fori(a.size()){
		forj(a[i].size())
			cout << a[i][j] << ' ';

		cout << endl;
	}
}

template<typename T>
void printVector(const string &txt, vector<T> &a){
	cout << txt;
	for (int i = 0; i < a.size(); ++i)
		cout << a[i] << ' ';
	cout << endl;
}

template<typename T>
void readVector(int n, vector<T> &a){
	if (a.size() < n)
		a.resize(n);

	fori(n) cin >> a[i];
}

template<typename T1, typename T2>
bool exist(map<T1, T2> &m, T1 x){
	if (m.find(x) == m.end())
		return false;

	return true;
}

int64 gcd(int64 a, int64 b){
	while (a != 0 && b != 0){
		if (b > a)
			b %= a;
		else
			a %= b;
	}

	return a + b;
}

int64 minFactor(int64 x){
	for (int64 i = 2; i * i <= x; ++i)
		if (x % i == 0)
			return i;

	return x;
}

int64 allFactors(int64 x, vint64 &prms, vint64 &prm_cnt){
	prms.clear();
	prm_cnt.clear();
	while (x > 1){
		int64 t = minFactor(x);
		prms.push_back(t);
		int s = prms.size() - 1;
		prm_cnt.push_back(0);
		while (x % t == 0){
			x /= t;
			++prm_cnt[s];
		}
	}

	return 0;
}

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie();
	
	char c;
	cin >> c;
	if (c >= 'a' && c <= 'z')
		cout << "a";
	else
		cout << "A";

	return 0;
}


Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine().Split(' ').Select(int.Parse).Sum();
            var T = Console.ReadLine().Split(' ').Select(int.Parse).Sum();
            Console.WriteLine(Math.Max(T, S));
        }
    }
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

#define bp __builtin_popcountll
#define bf __builtin_ffsll

void solve( ll a, ll b, ll k, ll v, ll n )
{
	if( k == 1 ) { cout << b << " "; return; }
	ll x = bf( a ^ b ) - 1;
	v |= 1 << x;
	ll c;
	REP(i,n) if( !( v & ( 1 << i ) ) ) { c = a ^ ( 1 << i ); break; }
	ll cn = c ^ ( 1 << x );
	solve( a, c, k - 1, v, n );
	cout << cn << " ";
	solve( cn, b, k - 1, v, n );
}

int main()
{
	ll n, a, b;
	cin >> n >> a >> b;
	if( bp(a^b) % 2 == 0 )
	{
		cout << "NO" << endl;
		return 0;
	}
	
	cout << "YES" << endl;
	cout << a << " ";
	solve( a, b, n, 0, n );
	return 0;
}

Measured memory_bytes: 1024