akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
    vector<vector<int>> c(3, vector<int>(3));
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 3; j++){
            cin >> c.at(i).at(j);
        }
    }
    
    vector<int> a(3);
    vector<int> b(3);
    
    for (int i = 0; i < 3; i++){
        a.at(i) = c.at(i).at(0) - c.at(0).at(0);
        b.at(i) = c.at(0).at(i);
    }
    
    bool ans = true;
    
    for (int i = 1; i < 3; i++){
        if (ans){
            for (int j = 1; j < 3; j++){
                if (c.at(i).at(j) != a.at(i)+b.at(j)){
                    ans = false;
                    break;
                }
            }
        }
    }
    
    if (ans){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
 
static int V[30];
static int C[30];
int main(){
  int N;
  scanf("%d",&N);
  for(int i=0;i<N;i++)scanf("%d",&V[i]);
  for(int i=0;i<N;i++)scanf("%d",&C[i]);
 
  int sum=0;
  for(int i=0;i<N;i++){
    if(V[i]>C[i]) sum+=V[i]-C[i];
  }
  
  printf("%d\n",sum);
  
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
using namespace std;
 
 
int main(){
    long long int N;
    long long int A,B;
    cin>>N>>A>>B;
    long long int sum=N/(A+B)*A;
    long long int amari=N%(A+B);
    cout<<sum+min(amari,A)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	//if (s.at(2) == s.at(3) && s.at(4) && s.at(5)){
	if(s[2] == s[3] && s[4] == s[5]){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int combine(const int& n, const int& x) {
    int s = 0;
    for(int i = 1; i <= n - 2; ++i) {
        for(int j = i + 1; j <= n - 1; ++j) {
            for(int k = j + 1; k <= n; ++k) {
                if(i + j + k == x) ++s;
            }
        }
    }
    return s;
}
int main() {
    int n, x;
    while(true) {
        cin >> n >> x;
        if(n == 0 && x == 0) break;
        cout << combine(n, x) << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
#include <iostream>
#include<vector>
#include<algorithm>
#include<algorithm>
#include<utility>
#define rep(i,n) for(int i = 0; i < (n); i++)

using namespace std;

int main() {
    int x,n;
    cin>>x>>n;
    vector<int>d(102);
    rep(i,n){
        int p;
        cin>>p;
        d[p]=1;
    }
    pair<int,int> ans(99999, -1);
    for(int i = 0; i <=101; i++){
        if(d[i]==1)continue;
        int dif = abs(x-i);
        ans = min(ans, pair<int,int>(dif,i));
    }
    cout<<ans.second<<endl;
    return 0;
}

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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int N, d; cin >> N;
	vector <int> A(N);
	for (int i = 0; i < N; ++i){
		int cnt = 0;
		cin >> d;
		while (d % 2 == 0){
			d /= 2;
			++cnt;
		}
		A[i] = cnt;
	}
	cout << *min_element(A.begin(),A.end()) << "\n";
	return 0;
}


Measured memory_bytes: 3648
/*
注意范围！
short范围：-32768~32767
unsigned short范围：0~65535
int范围：-2147483648~2147483647
uint范围：0~4294967295
INT范围：-9223372036854775808~9223372036854775807
UINT范围：0~18446744073709551615
float范围：-3.4e38～3.4e38，精度：6~7位
double范围：-1.7e308~1.7e308，精度：15~16位
ldouble范围：-1.2e4932~1.2e4932，精度：18~19位
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define LL long long
#define pb push_back
#define pob pop_back
#define mp make_pair
#define FILL(a,v) memset((void*)a,v,sizeof(a))
#define FILL0(a) FILL(a,0)
#define FILL1(a) FILL(a,-1)
#define ALL(a) (a).begin(),(a).end()
#define Inf 1e9
#define Mod 1000000007
#define foreach(it,x) for(typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define FOR(i,x) for(int i=0;i<x;i++)
#define RFOR(i,x) for(int i=x-1;i>=0;i--)
#define FFOR(i,a,b) for(int i=a;i<b;i++)
#define FRFOR(i,a,b) for(int i=a-1;i>=b;i--)
#define SZ(a) ((int)(a).size())
#define FI first
#define SE second
#define OVER(a) return puts(a),0
#define fastio ios::sync_with_stdio(0)
#define filei(f) freopen(f,"r",stdin)
#define fileo(f) freopen(f,"w",stdout)
using namespace std;
using namespace __gnu_cxx;
typedef pair<int,int> pii;
typedef unsigned long long UINT;
typedef unsigned int Uint;
typedef long long INT;
typedef pair<INT,INT> PII;

inline INT cfun(INT dishu,INT zhishu)
{
	if(zhishu==0)return 1;
	else if(zhishu%2)
	{
		INT ds=cfun(dishu,zhishu/2);
		ds=ds*ds%Mod;
		ds=ds*dishu%Mod;
		return ds;
	}
	else
	{
		INT ds=cfun(dishu,zhishu/2);
		ds=ds*ds%Mod;
		return ds;
	}
}

int n,a[100007],dd;
int hv[100007];

int main()
{
	scanf("%d",&n);
	for(int i=0;i<=n;i++)
	{
		scanf("%d",&a[i]);
		hv[a[i]]++;
	}
	int lnc;
	for(int i=1;i<=n;i++)
		if(hv[i]==2)
			lnc=i;
	for(int i=0;i<=n;i++)
		if(a[i]==lnc)
		{
			dd+=i;
			break;
		}
	for(int i=n;i>=0;i--)
		if(a[i]==lnc)
		{
			dd+=n-i;
			break;
		}
	INT aa=1,bb=1;
	for(int i=1;i<=n+1;i++)
	{
		aa=aa*(n-i+2)%Mod*cfun(i,Mod-2)%Mod;
		printf("%I64d\n",(aa-bb+Mod)%Mod);
		bb=bb*(dd-i+1)%Mod*cfun(i,Mod-2)%Mod;
	}
	return 0;
}

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

int foo(char ch){
  if(ch == 'y' ||ch == 'u' || ch == 'i' ||ch == 'o' ||ch == 'p' ||
     ch == 'h' || ch == 'j' ||ch == 'k' || ch == 'l' ||
     ch == 'n'|| ch == 'm') return 1;
  else return 0;
}

int main(){
  int temp, temp2;
  int i, j, k;
  string str;
  while(1){
    int count = 0;
    cin>>str;
    if(str == "#") break;
    for(i = 0; i < (int)str.size(); i++){
      
      if(i){
	temp2 = temp;
	temp = foo(str[i]);
	if(temp != temp2) count++;
	
      }else {
	temp = foo(str[0]);
	temp2 = foo(str[0]);
      }

      
    }


    cout<<count<<endl;
    
  }
  return 0;
}



Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>

typedef long long ll;
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    if (b % a == 0){
        cout << a + b << endl;
    }
    else{
        cout << b - a << endl;
    }

    return 0;
}

Measured memory_bytes: 256
s = input()
children_after_move = [0] * len(s)

children = 1
last_r_pos = 0
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        children += 1
    elif s[i] == 'L' and s[i - 1] == 'R':
        children_after_move[i] += children // 2
        children_after_move[i - 1] += children - children // 2
        children = 1
        last_r_pos = i - 1
    elif s[i] == 'R' and s[i - 1] == 'L':
        children_after_move[last_r_pos] += children // 2
        children_after_move[last_r_pos + 1] += children - children // 2
        children = 1
children_after_move[last_r_pos] += children // 2
children_after_move[last_r_pos + 1] += children - children // 2

print(' '.join((str(v) for v in children_after_move)))


Measured memory_bytes: 50416
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long LL;
const LL MOD=1e9+7;
const LL N=2e7+5;
LL JC[N],inv[N];
void Init (LL n)
{
	JC[0]=1;for (LL u=1;u<=n;u++) JC[u]=JC[u-1]*u%MOD;
	inv[1]=1;for (LL u=2;u<=n;u++) inv[u]=(MOD-MOD/u)*inv[MOD%u]%MOD;
	inv[0]=1;for (LL u=1;u<=n;u++) inv[u]=inv[u-1]*inv[u]%MOD;
}
LL C (LL x,LL y)	{return JC[x]*inv[y]%MOD*inv[x-y]%MOD;}
int main()
{
	Init(2e7);
	LL n,m,k;
	scanf("%lld%lld%lld",&n,&m,&k);
	LL nn=n+m;
	LL ans=0;
	for (LL u=1;u<=k;u++)//第i位有贡献 
	{
		if (u>=2) 
		{
	ans=ans+u*(u-1)%MOD*n%MOD*m%MOD*C(nn-2,u-2)%MOD*JC[u-2]%MOD*C(nn-u,k-u)%MOD*JC[k-u]%MOD;
		}
		if (u>=1) 
		{
	ans=ans+u*C(nn,u)%MOD*JC[u]%MOD*C(nn-u,k-u)%MOD*JC[k-u]%MOD;
		}
	ans=ans+C(nn,k)*JC[k]%MOD;
		ans=ans%MOD;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 312704
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=1e9+7;
const llint big=1e15+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
int main(void){
	llint n,K,i;cin>>n>>K;
	vector<pair<llint,llint>>hana(n);
	for(auto &it:hana){cin>>it.fir>>it.sec;}
	llint bmax=2e18,bmin=0;
	while(bmax-bmin>1){
		llint bgen=(bmax+bmin)/2,fra=0;
		for(auto it:hana){
			if(bgen<it.fir){continue;}
			if(fra>K){break;}
			fra+=1+((bgen-it.fir)/it.sec);
		}
		if(fra>=K){bmax=bgen;}
		else{bmin=bgen;}
	}
	cout<<bmax<<endl;RE;
}

Measured memory_bytes: 1792
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(lo i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

lo n,m,b[li],a[li],k,flag,t;
lo cev;
string s;
vector<int> v;

int main(void){
	scanf("%lld %lld",&n,&m);
	lo iki=(n-1)*(n-2)/2;
	if(m>iki){printf("-1\n");return 0;}
	m=iki-m;
	printf("%lld\n",n-1+m);
	for(lo i=2;i<=n;i++){
		printf("1 %lld\n",i);
	}
	lo bas=2;
	lo bas1=3;
	//~ m=iki-m;
	for(lo i=1;i<=m;i++){
		
		printf("%lld %lld\n",bas,bas1);
		bas1++;
		if(bas1>n){bas++;bas1=bas+1;}
	}
	return 0;
}


Measured memory_bytes: 256
$N=int(<STDIN>);
$t=0;$x=0;$y=0;
for($i=0;$i<$N;$i++){
	($t1,$x1,$y1)=split " ",<STDIN>;
	$d=$t1-$t-abs($x1-$x)-abs($y1-$y);
	if($d<$0 || $d%2>0) { print "No"; exit;  }
	$t=$t1;$x=$x1;$y=$y1;
}
print "Yes";


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
#define MAX_N 364364
#define fi first
#define sc second
int N;
P B[MAX_N];
int main()
{
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%lld%lld",&B[i].fi,&B[i].sc);
    }
    sort(B,B+N);
    int ans=0;
    priority_queue<P,vector<P>,greater<P> >que;
    ll sum=0;
    for(int i=0;i<N;i++){
        sum+=B[i].fi;
        que.push(P(B[i].sc,B[i].fi));
        while(!que.empty()&&(ll)que.size()*que.top().fi<sum){
            sum-=que.top().sc;
            que.pop();
        }
        ans=max(ans,(int)que.size());
    }
    printf("%d\n",ans);
    return 0;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
//#define ll __int128
//#define int ll
//#define int ll
//#define char ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(4) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

void smain() {

    ll a, b, c, d, n;
    cin >> a >> b >> c >> d >> n;
    inmin(b, a * 2);
    inmin(c, b * 2);
    inmin(d, c * 2);
    cout << (n / 2) * d + (n % 2) * c;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int,int> P;

int main() {
  int n, d;
  cin >> n >> d;
  map<int,int> mp;
  int cnt = 0;
  rep(i,n){
    int x, y;
    cin >> x >> y;
    double k = sqrt(pow(x,2)+pow(y,2));
    if(k<=d) ++cnt;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3592
N, M = map(int,input().split())
K = []
S = []
for _ in range(M):
    KS = list(map(int,input().split()))
    k = KS.pop(0)
    K.append(k)
    S.append(KS)
P = list(map(int,input().split()))

cnt = 2 ** N
ans = 0

sum = [0] * M

for j in range(M):
    for x in S[j]:
        sum[j] += 2 ** (x - 1)

for i in range(cnt):
    flg = 1
    for j in range(M):
        calc = sum[j] & i
        sum_str = bin(calc)
        div = sum_str.count('1') % 2
        if P[j] == div:
            continue
        else:
            flg = 0
            break
    if flg == 1:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define md 1000000007
#define inf 1e18
#define rep(i,a,b) for(int i=a;i<b;++i)
using namespace std;
#define M 1000010

int h,w;
char a[1010][1010];
bool ok(int i,int j){
	if(i<0 or j<0 or i>=h or j>=w)return 0;
	return a[i][j]!='#';
}
int32_t main(){
	
	
	cin>>h>>w;
	int ch,cw;cin>>ch>>cw;ch--,cw--;
	int dh,dw;cin>>dh>>dw;dh--,dw--;
	rep(i,0,h)rep(j,0,w)cin>>a[i][j];
	int dx[]={0,0,-1,1};
	int dy[]={1,-1,0,0};
	int ans[h][w],vis[h][w];
	rep(i,0,h)rep(j,0,w)ans[i][j]=inf,vis[i][j]=0;
	multiset< pair<int,pii> >s;
	s.insert({0,{ch,cw}});
	ans[ch][cw]=0;
	while(!s.empty()){
		auto it=s.begin();
		pair<int,pii> p1=*it;
		s.erase(it);
		int now=p1.fi,i=p1.se.fi,j=p1.se.se;
		if(vis[i][j])continue;
		vis[i][j]=1;
		rep(k,0,4){
			int nx=i+dx[k],ny=j+dy[k];
			if(!ok(nx,ny))continue;
			if(ans[i][j]<ans[nx][ny]){
				ans[nx][ny]=now;
				s.insert({now,{nx,ny}});
			}
		}
		int X=i-2,Y=j-2;
		rep(x,0,5)rep(y,0,5){
			int nx=X+x,ny=Y+y;
			if((nx==i and ny==j) or !ok(nx,ny))continue;
			if(ans[i][j]+1<ans[nx][ny]){
				ans[nx][ny]=now+1;
				s.insert({now+1,{nx,ny}});
			}
		}
	}
	int now=ans[dh][dw];
	cout<<((now==inf)?-1:now);
		
    return 0;
}

Measured memory_bytes: 20868
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

signed main(){
    unsigned long long n,a,b;cin >> n >> a >> b;
    if(a>=b) swap(a,b);
   
    if((b-a)&1){
       cout << min(a-1,n-b)+1+((b-a)-1)/2 << endl;
    }else{
        cout << ((b-a)>>1) << endl;;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb1(x) cout<<#x<<" :: "<<x<<"\n";
#define deb2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define deb3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define lli long long int
#define pii pair<lli,lli>
#define f first
#define sE second
lli n,x,y,t,mod=1e9+7,ans=0;
int main() { 
    fast
    cin>>n;
    vector<lli>a(n+1),dp(n+1,0);
    for(int i=1;i<=n;i++)
        cin>>a[i];
    dp[2]=abs(a[2]-a[1]);
    for(int i=3;i<=n;i++){
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n]<<endl;
} 

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

int main() {
    string S, T; cin >> S >> T;
    int size = S.size();
    vector<int> sc(30, 100);
    vector<int> tc(30);
    bool ok = true;
    rep(i, size){
        int s = S[i] - 'a';
        int t = T[i] - 'a';
        if(sc[s] == 100 && tc[t] == 0){
            sc[s] = t;
            tc[t] = 1;
            continue;
        } else if (sc[s] == t){
            continue;
        } else {
            ok = false;
            break;
        }
    }

    if(ok){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3920
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;
char a[3][60];
const long long  mod=1000000007;
int main()
{
    int n;
    long long ans=1,pre;
    scanf("%d",&n);
    scanf("%s",&a[0]);
    scanf("%s",&a[1]);
    for(int i=0;i<n;i++)
    {
        if(i==0)
        {
            ans*=3;
            if(a[0][i]==a[0][i+1])
            {
                pre=0;//row
                ans*=2;
                i++;
            }
            else pre=1;
        }
        else
        {
            if(a[0][i]==a[0][i+1]&&pre==1)
            {
                ans=((ans%mod)*2)%mod;
                pre=0;
                i++;
               // printf("nmb1");
            }
            else if(a[0][i]==a[0][i+1]&&pre==0)
            {
                ans=((ans%mod)*3)%mod;
                pre=0;
                i++;
                //printf("nmb2");
            }
            else if(a[0][i]!=a[0][i+1]&&pre==1)
            {
                ans=((ans%mod)*2)%mod;
                pre=1;
                //printf("nmb3");
            }
            else if(a[0][i]!=a[0][i+1]&&pre==0)
            {
                pre=1;
                //printf("nmb4");
            }
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
w = [input()]
ans = 'Yes'
for _ in range(n-1):
  s = input()
  if s in w:
    ans = 'No'
    break
  if w[-1][-1] != s[0]:
    ans = 'No'
    break
  w.append(s)

print(ans)  

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


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


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    return 'YES' if len(set(A)) == len(A) else 'NO'


def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 27520
#include <bits/stdc++.h>
    using namespace std;
    #define INF 2000000000
    typedef long long int ll;
    typedef pair<ll,ll> ii;
    typedef pair<ii,ll> iii;
    typedef vector<ll> vi;
    typedef vector<ii> vii;
    #define getbit(n,i) (((n)&(1<<(i)))!=0)
    #define setbit0(n,i) ((n)&(~(1<<(i))))
    #define setbit1(n,i) ((n)|(1<<(i)))
    #define togglebit(n,i) ((n)^(1<<(i)))
    #define lastone(n) ((n)&(-(n)))
    #define read freopen("debug\\in.txt","r",stdin)
    #define write freopen("debug\\out.txt","w",stdout)
    #define fi first
    #define se second
    #define getI(a) scanf("%d",&a)
    #define getII(a,b) scanf("%d%d",&a,&b)
    #define PI (acos(-1))
    #define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
    #define mod (1000000007)
    #define asz 500005
    #define pb push_back
    #define ppf pop_front
    #define ppb pop_back
    #define pf push_front
    map<string,ll>mp;
    int main()
    {
        fastread;
        string s1,s2;
        cin>>s1;
        ll sz1=s1.size();
        for(ll i=0;i<sz1;i++)
        cout<<'x';
    	return 0;
    }

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void)
{
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);

  int ans = min(c, b / a);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

N = int(input())
ss = [input() for _ in range(N)]

ans = 0
fb = 0
la = 0
dottimo = 0
for s in ss:
    L = len(s)
    flag1 = flag2 = False
    for i in range(L-1):
        if s[i:i+2] == 'AB':
            ans += 1

    if s[0] == 'B':
        fb += 1
        flag1 = True

    if s[-1] == 'A':
        la += 1
        flag2 = True

    if flag1 and flag2:
        dottimo += 1

if fb == 0:
    print(ans)
elif fb == la and fb == dottimo:
    print(ans+dottimo-1)
else:
    print(ans+min(la,fb))


Measured memory_bytes: 5224
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <stack>
#include <set>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;

void solve() {
	int n; cin >> n;
	vector<int> ans(n + 1, 0);
	for (int i = 1; i < 103; i++)for (int j = 1; j < 103; j++)for (int k = 1; k < 103; k++) {
				int cur = i * i + j * j + k * k + i * j + i * k + j * k;
				if (cur <= n + 1)ans[cur]++;
			}
	for (int i = 1; i <= n; i++)cout << ans[i] << endl;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	// int t; cin >> t;
	// while (t--)
	solve();

}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;;
int main(){
  long long int A,B=999999999999,C,L,R;
  cin>>L>>R;
  if(R-L>2018)B=0;
  else{
    L%=2019;
    R%=2019;
    if(L>=R)B=0;
    else{
      for(int i=L;i<R;i++){
      for(int j=i+1;j<R+1;j++){
        A=i*j%2019;
        if(B>A)B=A;
      }
    }
  }
  }
  cout << B << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int count_bit(int x)
{
	int cnt=0;
	while(x)
	{
		++cnt;
		x/=10;
	}
	return cnt;
}
int main()
{
	cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(count_bit(i)%2)
			++ans;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
int x, y = 0, b = 0;
scanf("%d", &x);
int n = x%2==0?x-(x/2-1):x-(x/2);
for(int i = 0; y < x; i++){
y += i;
if(y==x){
	printf("%d\n", i);
	break;
}
else if(y<x && x<=(y+i+1)){
	printf("%d\n", i+1);
	break;
}
}
return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
#define l(i,a,b) for(auto i=a;i<b;i++)
#define lr(i,a,b) for(auto i=a;i>=b;i--)
#define ll long long
#define lli long long int
#define ld long double
#define vec vector<int>
#define mii map<ll,ll>
#define vl vector<long long>
#define se set <long long int>
#define pi pair<long long,long long>
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define in(x) cin>>x
#define o(x) cout<<x
#define SYNC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.14159265359
using namespace std;
 
ll modulo(ll a, ll b, ll n){
    long long x=1, y=a; 
    while (b > 0) {
        if (b%2 == 1) {
            x = (x*y) % n; 
        }
        y = (y*y) % n;
        b /= 2;
    }
    return x % n;
}

int main()
{
    SYNC
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    string s,t;
    in(s)>>t;
    ll n=s.size();
    ll m=t.size();
    ll dp[n+2][m+2]={0};
    l(i,0,n+1)
    {
        dp[i][0]=0;
    }
    l(j,0,m+1)
    {
        dp[0][j]=0;
    }
    l(i,1,n+1)
    {
        l(j,1,m+1)
        {
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            if(s[i-1]==t[j-1])
            dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
        }
    }
    string ans="";
    ll i=n;
    ll j=m;
    while(dp[i][j]>0)
    {
        if(s[i-1]==t[j-1] && dp[i][j]==dp[i-1][j-1] + 1)
        {
            ans+=s[i-1];
            i--;
            j--;
        }
        else if(dp[i][j]==dp[i-1][j])
        {
            i--;
        }
        else
        {
            j--;
        }
    }
    reverse(ans.begin(),ans.end());
    o(ans)<<endl;
    
 
    
 
}


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

#define ll long long
#define mod 1000000007
#define eb emplace_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fo(i,n) for(i=0;i<n;i++)
#define fok(i,k,n) for(i=k;i<n;i++)
#define dbg(x) cout<<#x<<" "<<x
#define sci(x) scanf("%d",&x)
#define scd(x) scanf("%lf",&x)
#define scl(x) scanf("%lld",&x)
#define pfi(x) printf("%d",x)
#define pfd(x) printf("%lf",x)
#define pfl(x) printf("%lld",x)


auto fatafat=[](){std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); return 0;}();

long double solve(int n,int headCount,int totalCoins,vector<long double>&v,vector<vector<long double>>& dp)
{
	if(n==0 and headCount>=((totalCoins+1)/2))
	{
		return 1;
	}
	else if(n==0)
	{
		return 0;
	}

	if(dp[n][headCount]!=-1)
		return dp[n][headCount];

	dp[n][headCount]= v[n-1]*solve(n-1,headCount+1,totalCoins,v,dp) + (1-v[n-1])*solve(n-1,headCount,totalCoins,v,dp);

	return dp[n][headCount];

}


int main()
{
	int n;
	cin>>n;
	vector<long double>v(n);

	vector<vector<long double>> dp(n+1,vector<long double>(n+1,-1));

	for(int i=0;i<n;i++)
	{
		cin>>v[i];
	}

	cout<<fixed<<setprecision(10)<<solve(n,0,n,v,dp)<<endl;

}

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

using namespace std;

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

  int N;
  string S;
  cin >> N >> S;
  for (char& c : S) {
    int x = c - 'A';
    auto x2 = (x + N) % ('Z' - 'A' + 1);
    c = 'A' + x2;
  }
  cout << S << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> A(Q);
    rep(i, Q) {
        cin >> A[i];
        A[i]--;
    }

    vector<int> score(N, K - Q);
    rep(i, Q) {
        score[A[i]]++;
    }

    rep(i, N) {
        if (score[i] > 0) {
            write("Yes");
        }
        else {
            write("No");
        }
    }
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <ll> ms;
typedef queue <ll> mq;
typedef deque <ll> mdq;
typedef stack <ll> mst;
typedef priority_queue <ll> mpq;
typedef priority_queue <ll, vector<ll>, greater<ll> > mmh;
typedef complex<double> cd; 
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define flush cout.flush();
#define all(v) v.begin(),v.end()
#define pb(v) push_back(v)
#define cn continue
#define forl(i,n) for(ll i=0;i<n;i++)
#define forlr(i,n) for(ll i=n-1;i>=0;i--)
#define rev(s) reverse(s.begin(),s.end())
void swap(ll &a,ll &b)
{
	ll tmp=a;
	a=b;
	b=tmp;
}
ll atoistring(string s)
{
	stringstream lol(s);
	ll x;
	lol>>x;
	return x;
}
void pv(mv v)
{
	forl(i,v.size())
	{
		cout<<v[i]<<" ";
	}
	cout<<"\n";
}
void pa(ll *v,ll size)
{
	forl(i,size)
	{
		cout<<v[i]<<" ";
	}
	cout<<"\n";
}
// ll nck(ll N,ll K,ll mod)
// {
// 	if(N<K)
// 	{
// 		return 0;
// 	}
// 	return (((facs[N]*facsinv[N-K])%mod)*facsinv[K])%mod;
// }
ll power(ll x,ll y,ll p)
{
	ll res=1;
	x=x%p;
	while(y>0)
	{
		if(y&1)
		{
			res=(res*x)%p;
		}
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void checkmod(ll &x,ll mod)
{
	if(x>=mod)
	{
		x%=mod;
	}
}
ll sumofgp(ll a,ll n,ll m)
{
	// n = number of terms - 1
	if(n<0)
	{
		return 0;
	}
	if(n==0)
	{
		return 1;
	}
	if(n==1)
	{
		return (1+a)%m;
	}
	ll ans;
	if(n%2)
	{
        ans=(1+a)*sumofgp((a*a)%m,(n-1)/2,m);
	}
    else
    {
        ans=1+((a*(1+a))%m)*sumofgp((a*a)%m,n/2-1,m);
    }
    return ans%m;
}
ll power_of_2_not_less(ll n)
{
	if(!n)
	{
		return 1;
	}
	n--;
	n |= n>>1;
	n |= n>>2;
	n |= n>>4;
	n |= n>>8;
	n |= n>>16;
	n |= n>>32;
	n++;
	return n;
}
// void checktime()
// {
// 	struct timespec ts;
// 	printf("Running Program\n");
// 	clock_gettime(CLOCK_MONOTONIC_RAW,&ts);
// 	long double st=ts.tv_nsec/(1e9)+ts.tv_sec;
// 	// Call Funcn Here
// 	clock_gettime(CLOCK_MONOTONIC_RAW,&ts);
// 	long double en=ts.tv_nsec/(1e9)+ts.tv_sec;
// 	printf("Program ended\nTime = %Lf\n",en-st);
// }
ll arr[200005],dist[200005];
ll k;
ll getdist(ll x,ll y)
{
	// cout<<x<<" "<<y<<"-\n";
	ll a,b;
	a = min(x,y);
	b = max(x,y);
	return min(b - a,a + k - b);
}
int main(void)
{
	fastio
	ll n;
	cin>>k>>n;
	forl(i,n)
	{
		cin>>arr[i];
		dist[i] = arr[i]%k;
	}
	sort(dist,dist+n);
	ll maxi = getdist(arr[0],arr[n-1]);
	for(ll i=1;i<n;i++)
	{
		maxi = max(maxi,getdist(dist[i-1],dist[i]));
	}
	cout<<k - maxi<<"\n";
	return 0;
}

Measured memory_bytes: 3328
(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))
 
(setq *n* (read))
(setq *ai* (mapcar #'parse-integer (split " " (read-line))))
 
(print (float (/ 1 (apply #'+ (mapcar #'(lambda (a) (/ 1 a)) *ai*)))))

Measured memory_bytes: 4068
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const long long N = 1e3 + 17;
ll a[N], b[N], cnt, ans, lnt, n, m, r1, r0, l1, l0, sum, mx, h, c[N], t[N], mn = N, x, y, k;
pair<ll,ll>pr[N];
vector<ll>v,v2;
map<ll,ll>mp;
bool used[N];
char ch[1005][1005];
ll prime[N] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    for(ll i = 1; i <= 3; i ++)
    {
        for(ll j = 1; j <= 3; j ++)
        {
            cin >> ch[i][j];
        }
    }
    for(ll i = 1; i <= 3; i ++)
    {
        for(ll j = 1; j <= 3; j ++)
        {
            if(i == j)
            {
                cout << ch[i][j];
            }
        }
    }
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

S = input()
X, Y = list(map(int, input().split()))


def turn(d):
    return 'x' if d == 'y' else 'y'


i = 0
while i < len(S) and S[i] == 'F':
    i += 1
xs = {i}
ys = {0}
direction = 'x'
while i < len(S):
    while i < len(S) and S[i] == 'T':
        direction = turn(direction)
        i += 1
    cnt = 0
    while i < len(S) and S[i] == 'F':
        i += 1
        cnt += 1
    if direction == 'x':
        xs = {x + cnt for x in xs} | {x - cnt for x in xs}
    else:
        ys = {x + cnt for x in ys} | {x - cnt for x in ys}
if X in xs and Y in ys:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 72156
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	string s, ak="KIHBR";
	cin >> s;
	string t;
	for(int i=0; i<s.length(); i++){
		if(s[i]!='A') t+=s[i];
	}
	if(t!=ak){
		cout << "NO" << endl;
		return 0;
	}
	vector<int> c(5);
	int d=0;
	for(int i=0; i<s.length(); i++){
		if(s[i]==ak[d]){
			c[d]=i;
			d++;
		}
	}
	c.push_back(s.length());
	int cc[]={1,1,1,2,2,2};
	bool b=true;
	if(c[0]>cc[0]) b=false;
	for(int i=1; i<=5; i++){
		if(c[i]-c[i-1]>cc[i]) b=false;
	}
	if(b) cout << "YES" << endl;
	else cout << "NO" << endl;
 	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder.Contests.ABC167
{
    /// <summary>
    /// 
    /// </summary>
    static class B
    {
        static void Main(string[] args)
        {
            var a = NextInt();
            var b = NextInt();
            var c = NextInt();
            var k = NextInt();

            if (a >= k)
            {
                Console.WriteLine(k);
            }
            else if(a + b >= k)
            {
                Console.WriteLine(a);
            }
            else
            {
                Console.WriteLine(a - (k - a - b));
            }
        }

        #region Console
        static int _index = 0;
        static string[] _buffer;

        static string Next()
        {
            if (_buffer == null || _index >= _buffer.Length)
            {
                _buffer = Console.ReadLine().Split();
                _index = 0;
            }

            return _buffer[_index++];
        }
        static int NextInt()
        {
            return int.Parse(Next());
        }
        static long NextLong()
        {
            return long.Parse(Next());
        }
        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        static int[] ReadIntArray(int n)
        {
            var a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadInt();
            }
            return a;
        }
        static long[] ReadLongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }
        static long[] ReadLongArray(int n)
        {
            var a = new long[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = ReadLong();
            }
            return a;
        }
        static List<T> ReadObjects<T>(int n, Func<int[], T> creator)
        {
            var l = new List<T>(n);

            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                l.Add(creator(a));
            }

            return l;
        }

        static int[,] ReadMatrix(int n, int m)
        {
            var r = new int[n, m];
            for (int i = 0; i < n; i++)
            {
                var a = ReadIntArray();
                for (int j = 0; j < m; j++)
                {
                    r[i, j] = a[j];
                }
            }
            return r;
        }
        #endregion
    }
}


Measured memory_bytes: 27544
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N = get_int
X = get_ints

xx = X.sort

length = N - 1
index = (length + 1)/2 - 1 # 0 indexed なので

first = xx[1..][index]
second = xx[0..-2][index]

i = 0
while i < N
  if X[i] < first
    puts first
  else
    puts second
  end
  i += 1
end


Measured memory_bytes: 37024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long unsigned int llu;
ll mod = 1000000007;
ll INF = 1000000009;


int main(){

  long long int a,b[100010],c[100010],ans=0,ant=1;
  cin >> a;
  
  for(int i=0;i<a;i++)
    cin >> b[i];
  
for(int i=0;i<a;i++){
  c[i] =0;
}
  
  for(int i=0;i<a;i++){    
  c[b[i]]++; 
  }
  
  {
    if(a %2 == 0 && c[0] != 0){
      cout << "0" << endl;
      
      return 0;
    }
    
    else if(a%2 == 1 && c[0] != 1){
      cout << "0" << endl;
      
      return 0;
    
  }
  }
  
  {
  for(int i=1;i<a;i++){
    
    if(c[i] !=0 && c[i] !=2){
      
      cout << "0" << endl;
      
      return 0;
    }
  }
  }
  
  
    for(int i=1;i<a;i++){

     if(c[i] == 2){
      ans++;
       ant *= 2;
    ant %= mod;
    }
  }
  
 
  
  cout << ant << endl;
}
    
    
    


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF INT_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main(){
	int a,b;
	cin>>a>>b;
	if(b>=0)cout<<a*(b+a+b-1)/2-b<<endl;
	else if(a+b>0)cout<<a*(b+b+a-1)/2<<endl;
	else cout<<a*(b+b+a-1)/2-(a+b-1)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  long int l;
  long double hen, result;
  scanf("%ld" , &l);
  
  //printf("%d\n", l);
  
  hen = (double)l / 3;
  
  //printf("%.10Lf\n", hen);
  
  result = hen * hen * hen;
  
  printf("%.15Lf\n", result);
  
  
  return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
const int inf = 0x3f3f3f3f;
const ll linf = 123456789012345678;
const ll mod = 1000000007;
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " = " << x << endl
#define sz(x) ((int)(x).size())


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

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

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
     public static void main(String[] args){

        Scanner as = new Scanner(System.in);
        int W = as.nextInt();
        int H = as.nextInt();
        int x = as.nextInt();
        int y = as.nextInt();
        int r = as.nextInt();
        int tr;

        if(x>=W || y>=H){
          System.out.println("No");
 
        
         }
        else if(r>x || r>y){
        
          System.out.println("No");
             
               }
              else{

                 System.out.println("Yes");
               
        }  
              
 
 
   }
 
 
}

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

using namespace std;

int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> hist(N + 1, 0);
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    hist[A]++;
  }

  sort(hist.begin(), hist.end());
  int ans = 0;
  for (int i = 0; i <= N - K; i++) {
    ans += hist[i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    int s[10][10];
    int k[10];
    int p[10];
    rep(i, M) {
        cin >> k[i];
        rep(j, k[i]) {
            cin >> s[i][j];
            s[i][j]--;
        }
    }
    rep(i, M) cin >> p[i];
    int ans = 0;
    rep(bit, (1 << N)) {
        int cnt[10] = {};
        rep(i, N) {
            if(!(bit & (1 << i))) continue;
            rep(j, M) {
                rep(t, k[j]) {
                    if(s[j][t] == i) cnt[j]++;
                }
            }
        }
        bool ok = true;
        rep(i, M) {
            if(cnt[i] % 2 != p[i]) ok = false;
        }
        ans += ok;
    }  
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3644
n, k = map(int, input().split())

if k <= (n - 1) * (n - 2) // 2:
    g = [0] * (n * n)
    for i in range(n * n):
        u = i // n
        v = i % n
        if u < v:
            g[i] = 1

    i = 0
    for _ in range(k):
        while g[i] == 0 or i % n == n - 1:
            i += 1
        g[i] = 0

    cnt = sum(g)
    print(cnt)
    for i, e in enumerate(g):
        if e:
            u = i // n + 1
            v = i % n + 1
            print(u, v)

else:
    print(-1)


Measured memory_bytes: 3700
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
	let s = get_input();
    let year:i64 = s[0..4].parse().unwrap();
    let month:i64 = s[5..7].parse().unwrap();
    let day:i64 = s[8..10].parse().unwrap();

    let l = (2019 * 365) + (4 * 30) + 30;
    let m = (year * 365) + (month * 30) + day;
    
    if m <= l {
        println!("Heisei");
    } else {
        println!("TBD");
    }
 }

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int INF = 2e9;
#define pb push_back
#define mp make_pair
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 (a>b) { a=b; return 1; } return 0; }

int main(){
    int n;
    cin >> n;
    vector<int> t(n);
    ll sum = 0;
    for (int i = 0; i<n; i++){
        cin >> t[i];
        sum += t[i];
    }
    int m;
    cin >> m;
    vector<int> p(m), x(m);
    for (int i = 0; i < m; i++){
        cin >> p[i] >> x[i];
    }
    vector<int> ans(m, sum);
    for (int i = 0; i<m; i++){
        ans[i] += x[i] - t[p[i]-1];
    }
    for(auto i : ans){
        cout << i << endl;
    }
}

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

public class Main {

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        
        for (int k = 0; k < n; k++) {
            System.out.print(a[k]);
            if (k < n - 1) {
                System.out.print(' ');
            }
        }
        System.out.println();
        
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            for (int k = 0; k < n; k++) {
                System.out.print(a[k]);
                if (k < n - 1) {
                    System.out.print(' ');
                }
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 34292
from collections import deque
n,x,y = map(int,input().split())
to = [[] for _ in range(n)]
x -= 1
y -= 1
for i in range(n-1):
    to[i].append(i+1)
    to[i+1].append(i)
to[x].append(y)
to[y].append(x)
ans = [0]*(n-1)
Q = deque()
dist = [-1]*n
for i in range(n):
    Q.clear()
    Q.append(i)
    for j in range(n): dist[j] = -1
    dist[i] = 0
    while Q:
        cur = Q.popleft()
        for nxt in to[cur]:
            if dist[nxt] != -1: continue
            Q.append(nxt)
            dist[nxt] = dist[cur]+1
            ans[dist[cur]] += 1
print("\n".join(map(str,map(lambda x:x//2,ans))))

Measured memory_bytes: 43996