akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    ll a,b,k;
    cin >> a >> b >> k;
    rep(i,k){
        a /= 2;
        b += a;
        i++;
        if(i == k) break;
        b /= 2;
        a += b;
    }
    cout << a << ' ' << b << endl;
}

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

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

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

    ll N;
    std::cin >> N;
    std::cout << (N * (N - 1)) / 2 << std::endl;

    return 0;
}


Measured memory_bytes: 256
/*
 * main.c
 *
 *  Created on: 2019/03/24
 *      Author: family
 */

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

int main()
{
    char b;
    char ans;
    scanf("%c",&b);
    switch(b) {
    case 'A':
        ans = 'T';
        break;
    case 'T':
        ans = 'A';
        break;
    case 'C':
        ans = 'G';
        break;
    case 'G':
    default:
        ans = 'C';
        break;
    }
    printf("%c\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;


int main() {
	int n, m;
	cin >> n >> m;
	vector<int> data(m, 0);

	rep(i, 0, n) {
		int k;
		cin >> k;
		rep(j, 0, k) {
			int a;
			cin >> a;
			a--;
			data[a]++;
		}
	}

	int cnt = 0;
	rep(i, 0, m) {
		if (data[i] == n)cnt++;
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
using namespace std;
const int SIZE=5*1e5;
const LL INF=1LL<<58;
const LL p=1e9+7;
class UnionFind{
 
	vector<int> unions,talls,sents,dists,sizes;
	int size;
public:
	UnionFind(){}
	UnionFind(int size):size(size){
		init();
	}
	void init(){
	 	unions=vector<int>(size);
	 	talls=vector<int>(size);
	 	sents=vector<int>(size);
	 	dists=vector<int>(size);
	 	sizes=vector<int>(size);
		FOR(i,0,size){
			unions[i]=i;
			sents[i]=0;
			sizes[i]=1;
//			ns[i].PB(pr(0,1));
			talls[i]=1;
		}
	}
	int find(int x,int t=0){
		if(unions[x]==x || sents[x]>t) return x;
		return find(unions[x],t);
 
	}
	int minisize(int x){
		if(x==unions[x]) return sizes[x];
		return minisize(find(x));
	}
	bool isFriend(int a,int b,int t=0){
		return find(a,t)==find(b,t);	
	}
	void unite(int a,int b,int t=0){
		if(isFriend(a,b,t)) return;
		a=find(a,t);
		b=find(b,t);
		if(talls[a]<talls[b]) unite(b,a,t);
		else{
 			sizes[a]+=sizes[b];
			sents[b]=t;
			talls[a]=max(talls[a],talls[b]+1);
			unions[b]=a;
			dists[b]=1;
//			ns[a].PB(pr(t,ns[b].back().second+ns[a].back().second));
		}
	}
};
UnionFind uf=UnionFind(1e5+5);
int L[SIZE];
bool userable[SIZE];
bool solve(){
	int N,K,M;
	cin.tie(0);
	cin >> N >> M;
	REP(i,N){
		cin >> K;
		REP(i,K){
			cin >> L[i];
			userable[L[i]]=true;
			uf.unite(L[0],L[i]);
		}
	}
	int roots=0;
	FOR(i,1,M+1){
		if(userable[i]&&uf.find(i)==i) roots++;
	}
	return roots==1;
}
int main(){
	if(solve()) cout <<"YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

#define facMax 200010

long long int factorial[facMax];

long long int reciprocal[facMax];

long long int MOD = static_cast<long long int>(1e9) + 7;

inline long long int my_pow(long long int a, long long int k) {
    if (k == 0) return 1;
    long long int res = my_pow(a, k / 2);
    res = res * res % MOD;
    if (k & 1) res = res * a % MOD;
    return res;
}

inline long long int comb(long long int n,long long int r){

    if(n < r){
        return 0;
    }

    if(r == 0){
        return 1;
    }

    return (factorial[n] * reciprocal[n-r] % MOD * reciprocal[r]) % MOD;

}


int main() {

    factorial[0] = 1;
    reciprocal[0] = 1;

    for(long long int i=1; i<facMax; i++) {
        factorial[static_cast<int>(i)] = factorial[static_cast<int>(i - 1)] * i;
        factorial[static_cast<int>(i)] %= MOD;
        reciprocal[static_cast<int>(i)] = my_pow(factorial[static_cast<int>(i)], MOD - 2);
        reciprocal[static_cast<int>(i)] %= MOD;
    }

    long long int h,w,a,b;

    cin >> h >> w >> a >> b;

    long long int ans = 0;

    //*
    for(long long int i = b; i<=w-1; i++){
        ans += comb(h-a-1+i,i)*comb(a-1+w-i-1,a-1);
        ans %= MOD;
    }//*/

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3456
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>

using namespace std;
using llong = long long;
const int MOD=1000000007;


int main(int argc, char**argv){
    int w, h, n;
    cin >> w >> h >> n;
    vector<int> x(n), y(n), a(n);
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i] >> a[i];
    }
    // (x, y)
    pair<int, int> tl = make_pair(0, h);
    pair<int, int> tr = make_pair(w, h);
    pair<int, int> bl = make_pair(0, 0);
    pair<int, int> br = make_pair(w, 0);

    for (int i = 0; i < n; i++){
        if (a[i] == 1){
            if (tl.first < x[i]){
                tl.first = x[i];
                bl.first = x[i];
            }
        }
        if (a[i] == 2){
            if (tr.first > x[i]) {
                tr.first = x[i];
                br.first = x[i];
            }
        }
        if (a[i] == 3){
            if (bl.second < y[i]) {
                bl.second = y[i];
                br.second = y[i];
            }
        }
        if (a[i] == 4){
            if (tl.second > y[i]) {
                tl.second = y[i];
                tr.second = y[i];
            }
        }
        if (tr.first - tl.first <= 0 || tr.second - br.second <= 0){
            cout << 0 << endl;
            return 0;
        }
    }


    cout << max(0, (tr.first - tl.first) * (tr.second - br.second)) << endl;

    return 0;
}










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

struct Card { char suit, value; };   //構造体の宣言

void bubble(struct Card A[], int N){   //バブルソートで配列を並び替え
    for(int i = 0; i < N; i++){
        for(int j = N - 1; j >= i + 1; j--){
            if(A[j].value < A[j - 1].value){
                Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t;   //隣同士を比較していき、左側の方が小さい場合中身を入れ替える
            }
        }
    }
}

void selection(struct Card A[], int N){   //選択ソートで配列を並び替え
    for(int i = 0; i < N; i++){
        int minj = i;                     //minjには最小となるi(インデックス)を格納
        for(int j = i; j < N; j++){
            if(A[j].value < A[minj].value) minj = j;
        }
        Card t = A[i]; A[i] = A[minj]; A[minj] = t;
    }
}

void print(struct Card A[], int N){
    for(int i = 0; i < N; i++){
        if(i > 0) cout << " ";
        cout << A[i].suit << A[i].value;     //配列を渡すだけではダメなのか?
    }
    cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N){
    for(int i = 0; i < N; i++){
        if(C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

int main(){
    Card C1[100], C2[100];
    int N;
    char ch;
    
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> C1[i].suit >> C1[i].value;   //1文字ずつ取り出し(例：H4 ⇨ C1.suit=H C1.value=4)
    }
    
    for(int i = 0; i < N; i++) C2[i] = C1[i];
    
    bubble(C1, N);
    selection(C2, N);
    
    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);
    if(isStable(C1, C2, N)){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3096
a,b,c=map(int,input().split())
d=a%b
e=(d*2)%b
i=3
f=[]
f.append(d)
f.append(e)
while e!=d:
  x=d*i
  e=x%b
  i+=1
  f.append(e)

if c in f:
  print('YES')
else:
  print('NO')







Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define maxn 1005
#define maxm 5005
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
#define LL long long int
#define mod 10007
#define local
struct Edge{
	int f,t,nxt;
}edge[maxm];
int etot=1,head[maxn];
void add_edge(int f,int t){
	edge[++etot]=(Edge){f,t,head[f]};
	head[f]=etot;
}
int n,m,a[maxn],f[maxn],g[maxm];
template <typename Tp>
void read(Tp &x){x=0;int f=1;char c=getchar();
	while((c>'9'||c<'0')){if(c=='-'){f=-1;}c=getchar();}
	while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c&15);c=getchar();}x*=f;
}
int dfs(int x){
	for(int i=head[x];i;i=edge[i].nxt){
		int y=edge[i].t;
		dfs(y);
	}
	memset(g,0x3f,sizeof(g));
	g[0]=0;
	for(int i=head[x];i;i=edge[i].nxt){
		int y=edge[i].t;
		for(int j=a[x];j>=0;j--){
			int tmp=inf;
			if(j-a[y]>=0)tmp=min(tmp,g[j-a[y]]+f[y]);
			if(j-f[y]>=0)tmp=min(tmp,g[j-f[y]]+a[y]);
			g[j]=tmp;
		}
	}
	f[x]=inf;
	for(int i=0;i<=a[x];i++)f[x]=min(f[x],g[i]);
	return f[x]!=inf;
}
int main(){
	int x;
	read(n);
	for(int i=2;i<=n;i++){
		read(x);add_edge(x,i);
	}
	for(int i=1;i<=n;i++)read(a[i]);
	puts(dfs(1)?"POSSIBLE":"IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 256
def examA():
    N = I()
    A = LI()
    d = defaultdict(int)
    d[0] = 1; cur = 0
    for i in A:
        cur +=i
        d[cur] +=1
#    print(d)
    ans = 0
    for i in d.values():
        ans +=i*(i-1)//2
    print(ans)
    return

def examB():
    N = I()
    S = [SI() for _ in range(N)]
    cur = 0
    for k in range(N):
        flag = True
        for i in range(N):
            for j in range(i+1,N):
                if S[i][j-k]!=S[j][i-k]:
                    flag = False
                    break
            if not flag:
                break
        if flag:
            cur +=1
    ans = cur*N
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examB()


Measured memory_bytes: 41452
#include <cstdio>
#include <vector>

typedef long long LL;

std::vector<int> Solve(LL N) {
	if (N == 1) return std::vector<int>();
	if (N & 1) {
		auto v = Solve(N - 1);
		v.insert(v.begin(), (int)v.size() + 1);
		return v;
	}
	auto v = Solve(N / 2);
	v.push_back((int)v.size() + 1);
	return v;
}

int main() {
	LL N;
	scanf("%lld", &N);
	auto Ans = Solve(N + 1);
	printf("%d\n", 2 * (int)Ans.size());
	for (int x : Ans) printf("%d ", x);
	for (int i = 1; i <= (int)Ans.size(); ++i) printf("%d ", i);
	puts("");
	return 0;
}

Measured memory_bytes: 3176
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ull, ull> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 
ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}


ll cnt[100005];


int main(){

    ios_base::sync_with_stdio(0);

    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    	cin>>cnt[i];

    ll ans = 0;
    for(int i=1;i<=n;i++){
    	ll temp = cnt[i]/2;
    	ans += temp;
    	cnt[i] -= 2*temp;
    	if(cnt[i] > 0){
    		temp = min(cnt[i], cnt[i+1]);
    		ans += temp;
    		cnt[i]--;	cnt[i+1]--;
    	}
    }

    cout<<ans;
    return 0;
}






Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
import heapq
n,m,s,t = map(int, input().split())
g = [[] for _ in range(n+1)]
for _ in range(m):
    u,v,a,b = map(int, input().split())
    g[u].append((v,(a,b)))
    g[v].append((u,(a,b)))

inf = 10**18
def dijkstra(s, currency):
    d = [inf]*(n+1)
    d[s] = 0

    que = [(d[s],s)]
    heapq.heapify([que])
    while len(que)>0:
        _,v = heapq.heappop(que)
        for u,c in g[v]:
            if d[v]+c[currency]>=d[u]:
                continue
            d[u] = d[v]+c[currency]
            heapq.heappush(que, (d[u], u))
    return d

yen_c = dijkstra(s,0)
snuuk_c = dijkstra(t,1)

res = [0]*n
res[n-1] = yen_c[n] + snuuk_c[n]
for i in range(n-2,-1,-1):
    res[i] = min(res[i+1], yen_c[i+1]+snuuk_c[i+1])

for r in res:
    print(10**15-r)


Measured memory_bytes: 68820
#include <bits/stdc++.h>
#define int long long
#define For(i,a,b) for(register int i=a;i<=b;i++)
using namespace std;
int read() {
	register int x=0,f=0;
	register char ch=getchar();
	while(!isdigit(ch)) {
		f|=(ch=='-');
		ch=getchar();
	}
	while(isdigit(ch)) {
		x=x*10+ch-'0';
		ch=getchar();	
	}
	return f?-x:x;
}
void write(int x) {
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x>=10) write(x/10);
	putchar(x%10+'0');
}
vector <int> q[100005];
int n,m,a,b,ans=1;
const int mod=1e9+7;
void dfs(int at,int which,int fa) {
	ans=(ans*which)%mod;
	int now=(at==1?m-1:m-2);
	for(int i=0;i<(int)q[at].size();i++) {
		if(q[at][i]==fa) continue;
		if(now<0) {
			puts("0");
			exit(0);	
		}
		dfs(q[at][i],now,at);
		now--;
	}
}
signed main() {
	n=read(),m=read();
	For(i,1,n-1) {
		cin>>a>>b;
		q[a].push_back(b);
		q[b].push_back(a); 
	}
	dfs(1,m,0);
	cout<<ans;
	return 0;
}

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

int main(void){
	int h, w;
	cin >> h >> w;
	vector<vector<char>> a(h+2, vector<char>(w+2, '#'));
	for (int i = 1; i <= h; ++i){
		for (int j = 1; j <= w; ++j){
			cin >> a[i][j];
		}
	}
	vector<vector<ll>> dp(h+2, vector<ll>(w+2, 0));
	bool f = true;
	for (int i = 1; i <= h; ++i){
		for (int j = 1; j <= w; ++j){
			if(f && a[i][j] == '.'){
				f = false;
				dp[i][j] = 1;
			}
			if(a[i][j+1] == '.'){
				dp[i][j+1] += dp[i][j];
				dp[i][j+1] %= MOD;
			}
			if(a[i+1][j] == '.'){
				dp[i+1][j] += dp[i][j];
				dp[i+1][j] %= MOD;
			}
		}
	}
	cout << dp[h][w] << endl;
	return 0;
}


Measured memory_bytes: 9216
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, k; cin >> n >> k;
  int ans = 1;
  REP(i, n) {
    if (ans < k) ans *= 2;
    else ans += k;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int     main(void)
{
    int     i, j;
    int     a;
    int     num[3];
    scanf("%d%d%d", &num[0], &num[1], &num[2]);
    
    j = 0;
    while (j <= 3)
    {
        if (num[0] > num[1])
        {
            a = num[0];
            num[0] = num[1];
            num[1] = a;
        }
        
        if (num[1] > num[2])
        {
            a = num[1];
            num[1] = num[2];
            num[2] = a;
        }
        j++;
    }
    
    i = 0;
    while (num[i])
    {
        printf("%d", num[i]);
        if (i != 2)
            printf("%c", ' ');
        else
            printf("%c", '\n');
        i++;
    }
}


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

struct queue
{
string name;
int time;
};

int tail, head;
const static int MAX=100000;
queue Q[MAX];

void enqueue(queue x);
queue dequeue();

int main()
{
	int n, q, t = 0, sum = 0;
	cin >> n >> q;
	tail = n;
	head = 0;
	for(int i = 0; i < n; i++)
		cin >> Q[i].name >> Q[i].time;

	while(sum != n)
	{	
		if(Q[head].time < q)
			t += Q[head].time;
		else
			t += q;
		Q[head].time -= q;
		if(Q[head].time<=0)
		{
			cout << Q[head].name << ' ' << t << endl;
			head = (head+1)%MAX;
			sum++;
		}
		else
			enqueue(dequeue());
	}
	return 0;
}

void enqueue(queue x) { Q[tail] = x;tail = (tail+1)%MAX;  }

queue dequeue() { queue x = Q[head]; head=(head+1)%MAX; return x; }

Measured memory_bytes: 5112
#!/usr/bin/env python3
n, k = map(int, input().split())
"""
bを固定して、aの数を数える
(b-k) * (N//b) + min(0,n%b - k +1)
注意するのは、k >= b なら0 
"""
ans = 0
# b を動かす
for b in range(k + 1, n + 1):
    ans += (b - k) * (n // b) + max(0, n % b - k + 1)
    # print(ans, b)
if k == 0:
    print(n ** 2)
else:
    print(ans)


Measured memory_bytes: 9120
#include <iostream>
#include <vector>
#include <map>
#include <queue>

using namespace std;
typedef pair<int, int> pii;
const int INF = 1000000000;

inline int swap(int cur, int i, int j){
	int result = cur & ~(7 << (i * 3)) & ~(7 << (j * 3));
	result |= ((cur >> (i * 3)) & 7) << (j * 3);
	result |= ((cur >> (j * 3)) & 7) << (i * 3);
	return result;
}

void recur(map<int, int> &mp, int cur, int mask){
	if(mask == 0){
		mp.insert(pii(cur, mp.size()));
	}else{
		for(int i = 0; i < 8; ++i){
			if(!(mask & (1 << i))){ continue; }
			recur(mp, (cur << 3) | i, mask & ~(1 << i));
		}
	}
}

int main(){
	int n;
	cin >> n;
	vector< vector<int> > c(n, vector<int>(n));
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < n; ++j){ cin >> c[i][j]; }
	}
	int init = 0;
	for(int i = 0; i < n; ++i){ init |= i << (i * 3); }
	map<int, int> mp;
	recur(mp, 0, (1 << n) - 1);
	vector<int> minval(mp.size(), INF);
	priority_queue< pii, vector<pii>, greater<pii> > pq;
	pq.push(pii(0, init));
	minval[mp[init]] = 0;
	while(!pq.empty()){
		pii p = pq.top();
		pq.pop();
		int v = p.second, cost = p.first;
		for(int i = 0; i < n; ++i){
			for(int j = i + 1; j < n; ++j){
				int w = swap(v, i, j), wi = mp[w];
				int nc = cost + c[i][j];
				if(nc < minval[wi]){
					pq.push(pii(nc, w));
					minval[wi] = nc;
				}
			}
		}
	}
	int answer = 0;
	for(int i = 0; i < minval.size(); ++i){
		answer = max(answer, minval[i]);
	}
	cout << answer << endl;
	return 0;
}

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

using namespace std;

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

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

    if (n % 2 != 0) {
        cout << "No" << endl;
        return 0;
    }
    for(int i = 0; i < n/2; i++) {
        if(s[i] != s[i + (n/2)]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 256
from bisect import bisect_right
n = int(input())
d = {}
for a in map(int, input().split()):
  if a in d:
    d[a] += 1
  else:
    d[a] = 1
t = 1
valids = []
while t < 2 * 10 ** 9:
  t *= 2
  valids.append(t)
result = 0
while True:
  prev = result
  keys = list(d.keys())
  keys.sort(reverse = True)
  for x in keys:
    if x not in d:
      continue
    t = valids[bisect_right(valids, x)] - x
    while True:
      if t not in d:
        break
      if x == t and d[x] == 1:
        break
      result += 1
      if d[x] == 1:
        del d[x]
      else:
        d[x] -= 1
      if d[t] == 1:
        del d[t]
      else:
        d[t] -= 1
      if x not in d:
        break
  if prev == result:
    break
print(result)

Measured memory_bytes: 44592
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int a,b;
    cin>>a>>b;
    int ans=0;

    for(int i=1;i<=a;i++){
        for(int j=1;j<=31;j++){
            if(i==j){
                ans++;
            }
            if(i==a&&j>=b){
                break;
            }
        }
    }
    cout<< ans <<endl;

    return 0;
}

Measured memory_bytes: 256
import sys
import bisect

readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int 
nl = lambda: list(map(int, readline().split())) # input multiple int to list

n = ni()
l = sorted(nm())

ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        a = l[i]
        b = l[j]
        idx = bisect.bisect_left(l, a + b)
        if idx > j: ans += idx - j - 1
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
 
bool ok[27];

int main(){
    string S;
    cin >> S;
    int N=S.length();
    int n=(unsigned char)('a');
    for(int i=0;i<N;i++){
        ok[(unsigned char)(S[i])-n]=true;
    }
    for (int i=0;i<26;i++){
        if(ok[i]==false){
            cout << (unsigned char)(n+i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;

    return 0;
    
}

Measured memory_bytes: 512
from statistics import median
N = int(input())
A = list(map(int, input().split()))
B = list()
sad = 0

for i in range(N):
  B.append(A[i]-i)

b = median(B)

for i in range(N):
  sad = sad + abs(A[i] - (b+i))

print(int(sad))

Measured memory_bytes: 27260
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class Main {

  public static void main(String[] args) throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] head = br.readLine().split(" ");
    int n = Integer.parseInt(head[0]);
    int k = Integer.parseInt(head[1]);
    int[] p = Stream.of(br.readLine().split(" ")).mapToInt(value -> Integer.parseInt(value) - 1).toArray();
    long[] c = Stream.of(br.readLine().split(" ")).mapToLong(Long::parseLong).toArray();
    br.close();

    boolean[] used = new boolean[n];
    Arrays.fill(used, false);
    ArrayList<Cycle> cycleList = new ArrayList<>();
    for(int i = 0; i < n; i++){
      if(used[i]){
        continue;
      } else {
        int pos = i;
        ArrayList<Long> list = new ArrayList<>();
        while(used[pos] == false){
          list.add(c[pos]);
          used[pos] = true;
          pos = p[pos];
        }
        Cycle cycle = new Cycle(list);
        cycleList.add(cycle);
      }
    }
    long ans = Long.MIN_VALUE;
    for(int i = 0; i < cycleList.size(); i++){
      Cycle cycle = cycleList.get(i);
      long size = cycle.list.size();
      long base = 0;
      long limit = 0;
      long loop = Math.max(0, (k / size) - 1);

      if(cycle.sum > 0){
        base = cycle.sum * loop;
        limit = k - (size * loop);
      } else {
        limit = Math.min(k, size - 1);
      }
      for(int j = 0; j < cycle.list.size(); j++){
        long count = 0;
        long sum = base;
        int idx = j;
        while(count < limit){
          sum += cycle.list.get(idx % cycle.list.size());
          ans = Math.max(ans, sum);
          idx++;
          count++;
        }
      }
    }
    System.out.println(ans);
  }
}
class Cycle {
  long sum;
  List<Long> list;
  Cycle(List<Long> list){
    this.list = list;
    sum = this.list.stream().mapToLong(Long::longValue).sum();
  }
}


Measured memory_bytes: 38660
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

int main(){
  ll n,ans=1;cin>>n;
  vll cnt(n,0);
  rep(i,0,n){
    ll a;cin>>a;
    if(cnt[a]==0){
      if(a!=0)ans*=cnt[a-1];
      else{ans*=3;}
    }
    else{
      ans*=min(cnt[a-1]-cnt[a],(3-cnt[a]));
    }
    ans%=MOD;
    cnt[a]++;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
int count(ll x){
	int cnt = 0;
	while(x != 0){
		cnt++;
		x /= 10;
	}
	return cnt;
}
int main()
{

	int a[] = {1 , 3 , 5, 7 , 8 , 10 , 12};
	int b[] = {4 , 6 , 9 , 11};
	//int c[] = {2};
	int flag = 0;
	int x , y;
	cin >> x >> y;
	int cnt = 0;
	for(int i = 0 ; i < 7 ; i++){
		if(x  == a[i])
			cnt++;
		if(y == a[i])
			cnt++;
	}
	if(cnt == 2)
		flag = 1;
	cnt = 0;
	for(int i = 0 ; i < 4 ; i++){
		if(x  == b[i])
			cnt++;
		if(y == b[i])
			cnt++;
	}
	if(cnt == 2)
		flag = 1;
	if(x == 2 && y == 2)
		flag = 1;
	if(flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
} 




Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    int n;
    cin >> n;

    double a, b, c, d, e, f, g, h;
    while(cin >> a >> b >> c >> d >> e >> f >> g >> h) {
        double vx = c - a;
        double vy = d - b;
        double wx = g - e;
        double wy = h - f;

        if(vx * wy - vy * wx == 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
     
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
typedef vector<int> vi;
#define PB push_back
#define MP make_pair
#define ln "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define rforn(i,e) for(ll i=e; i>=0; i--)
#define rforsn(i,s,e) for(ll i=s; i>=e; i--)
#define vasort(v) sort(v.begin(), v.end())
#define vdsort(v) sort(v.begin(), v.end(),greater<int>())
#define F first
#define S second

#define out1(x1) cout << x1 << ln
#define out2(x1,x2) cout << x1 << " " << x2 << ln
#define out3(x1,x2,x3) cout << x1 << " " << x2 << " " << x3 << ln
#define out4(x1,x2,x3,x4) cout << x1 << " " << x2 << " " << x3 << " " << x4 << ln
#define out5(x1,x2,x3,x4,x5) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << ln
#define out6(x1,x2,x3,x4,x5,x6) cout << x1 << " " << x2 << " " << x3 << " " << x4 << " " << x5 << " " << x6 << ln

#define in1(x1) cin >> x1
#define in2(x1,x2) cin >> x1 >> x2
#define in3(x1,x2,x3) cin >> x1 >> x2 >> x3
#define in4(x1,x2,x3,x4) cin >> x1 >> x2 >> x3 >> x4
#define in5(x1,x2,x3,x4,x5) cin >> x1 >> x2 >> x3 >> x4 >> x5
#define in6(x1,x2,x3,x4,x5,x6) cin >> x1 >> x2 >> x3 >> x4 >> x5 >> x6

#define arrin(a,n) forn(i,n) cin >> a[i];
#define arrout(a,n) forn(i,n) {cout << a[i] << " ";} cout << ln;

#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)



int main() {
    ll n,k;
    in2(n,k);
    vl a(n);
    arrin(a,n);
    vl p(k+1,-1);
    forn(i,n){
        p[a[i]]=1;
    }
    forsn(i,1,k+1){
        if (p[i]!=1){
            p[i]=0;
            forn(j,n){
                if (i+a[j]<=k) p[i+a[j]]=1;
                else break;
            }
        }
    }
    //arrout(p,k+1);
    if (p[k]) out1("First");
    else out1("Second");
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x ,n) for(int i = x; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    string s;
    cin >> s;
    rep(i,s.size()){
        if(i%2==0)cout << s[i];
    }
	return 0;
}

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


vector<long long int>all1;




int solve(long long int number)
{
  int siz=all1.size()-1;
  int i=0,j=siz;
  while(i<j)
  {

    int mid=i+(j-i)/2;
    if(all1[mid]==number)
        return mid;

    else if(all1[mid]>number)
    {
      j=mid-1;
    }
    else
     i=mid;

   cout<<i<<" "<<j<<endl;

  }

  return i;

}


int main()
{


     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
   

    long long int a,b,c;
    cin>>a>>b>>c;
    vector<long long int>all;
    all.push_back(0);
    all1.push_back(0);

    for(int i=1;i<=a;i++)
    {
      int first;
      cin>>first;
      all.push_back(first+all[i-1]);
    }
    for(int i=1;i<=b;i++)
    {
      int first;
      cin>>first;
      all1.push_back(first+all1[i-1]);
    }

   /* for(int i=0;i<a;i++)
    {
      cout<<all[i]<<" "<<all1[i]<<endl;
    }*/


    int count=0;
    for(int i=0;i<=a;i++)
    {
      int temp=0;
      if(c-all[i]>=0){
      int index=upper_bound(all1.begin(),all1.end(),c-all[i])-all1.begin();
      temp=(i+index-1);
      count=max(count,temp);
      }
      else
        break;

    }

    cout<<count<<endl;


    return 0;
    
}

Measured memory_bytes: 7948
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
int N,M;
ll A[100010] = {0};
int main(){
	cin >> N >> M;
	map<ll,ll> m;
	for(int i=1;i<=N;i++){
		cin >> A[i];
		A[i] += A[i-1];
		m[A[i]%M]++;
//		cout << A[i] << endl;
	}
	ll ans = 0;
	for(auto x:m){
		if(x.first==0) ans += x.second;
	//	cout << x.second << endl;
		ans += x.second*(x.second-1)/2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 4992
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;

const int N = (int) 305, mod = (int) 1e9 + 7;
int dp[N][N], odp[N][N];
vector<pair<int, int>> proc[N];
void sadd(int &x, int y) {
	x += y;
	while (x >= mod) x -= mod;
}
int main() {
	int n, m;
	cin >> n >> m;
	for (int j = 0; j < m; ++j) {
		int l, r, k;
		cin >> l >> r >> k;
		proc[r].push_back(mp(l, k));
	}
	dp[0][0] = 1;
	for (int j = 1; j <= n; ++j) {
		memcpy(odp, dp, sizeof dp);
		memset(dp, 0, sizeof dp);
		for (int pl = 0; pl < j; ++pl)
			for (int pr = 0; pr < j; ++pr) {
				sadd(dp[pl][pr], odp[pl][pr]);
				sadd(dp[j - 1][pl], odp[pl][pr]);
				sadd(dp[j - 1][pr], odp[pl][pr]);
			}
		for (int pl = 0; pl < j; ++pl)
			for (int pr = 0; pr < j; ++pr) {
				for (auto q : proc[j]) {
					int l = q.first, k = q.second;
					int cnt = 1;
					if (l <= pl) ++cnt;
					if (l <= pr) ++cnt;
					if (k != cnt) dp[pl][pr] = 0;
				}
			}
	}
	int res = 0;
	for (int a = 0; a < N; ++a)
		for (int b = 0; b < N; ++b)
			sadd(res, dp[a][b]);
	cout << res << endl;
}










Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
typedef struct node{
  int id;
  int par, lft, rit;
}T_node;
T_node *T;
int cntdeg(T_node *);
int cntdpt(T_node *);
int gethig(T_node *, int);
int main(){
  int n;
  scanf("%d", &n);
  T = (T_node *)malloc(sizeof(T_node) * n);
  int i, id, lcl, rcl;
  for(i = 0; i < n; i++)
    T[i].par = T[i].rit = T[i].lft = -1;
  for(i = 0; i < n; i++){
    scanf("%d", &id);
    T[id].id = id;
    scanf("%d %d", &lcl, &rcl);
    if(lcl >= 0){
      T[id].lft = lcl;
      T[T[id].lft].rit = rcl;
      T[T[id].lft].par = id;
      if(T[T[id].lft].rit >= 0)
	T[T[T[id].lft].rit].par = id;
    }
    else{
      T[id].lft = rcl;
      if(T[id].lft >= 0)
	T[T[id].lft].par = id;
    }
  }
  int sib;
  for(i = 0; i < n; i++){
    sib = -1;
    if(T[i].par < 0){
      if(T[i].lft >= 0)
	printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, root\n", i, T[i].par, sib, cntdeg(&T[T[i].lft]), cntdpt(&T[i]), gethig(&T[i], 0));
      else
	printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, root\n", i, T[i].par, sib, 0, cntdpt(&T[i]), gethig(&T[i], 0));
    }
    else{
      if(T[i].rit >= 0)
	sib = T[i].rit;
      else
	sib = T[T[i].par].lft != i ? T[T[i].par].lft : -1;
      if(T[i].lft >= 0)
	printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, internal node\n", i, T[i].par, sib, cntdeg(&T[T[i].lft]), cntdpt(&T[i]), gethig(&T[i], 0));
      else
	printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, leaf\n", i, T[i].par, sib, 0, cntdpt(&T[i]), gethig(&T[i], 0));
    }
  }
  free(T);
  return 0;
}

int cntdeg(T_node *t){
  if(t->rit < 0)
    return 1;
  return cntdeg(&T[t->rit]) + 1;
}

int cntdpt(T_node *t){
  if(t->par >= 0)
    return cntdpt(&T[t->par]) + 1;
  else
    return 0;
}
  
int gethig(T_node *t, int hig){
  if(t->lft < 0)
    return hig;
  int lhi = gethig(&T[t->lft], hig + 1), rhi = -1;
  if(T[t->lft].rit >= 0)
    rhi = gethig(&T[T[t->lft].rit], hig + 1);
  return rhi < lhi ? lhi : rhi;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    int n;cin >> n;
    vector<int> d(n);
    REP(i, n) { cin >> d[i];}
    int ans=0;
    REP(i,n-1){
        FOR(j,i+1,n){
            ans += d[j]*d[i];
        }
    }

    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256
package main

import (
    "bufio"
    "fmt"
	"os"
	"sort"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
    sc.Scan()
    return sc.Text()
}

func main() {
	var n int
	fmt.Scan(&n)
	d := map[string]int{}
	ans := 0
	for i:=0; i<n; i++ {
		tmp := nextLine()
		strLst := strings.Split(tmp,"")
		sort.Strings(strLst)
		tmp = strings.Join(strLst,"")
		if _, ok := d[tmp]; ok {
			ans += d[tmp]
			d[tmp]++
		} else {
			d[tmp] = 1
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 11776
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = a; i <= b; ++i)
#define PER(i, a, b) for (int i = a; i >= b; --i)
#define RVC(i, S) for (int i = 0; i < S.size(); ++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;

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

inline int read(){
	int x = 0, ch = getchar(), f = 1;
	while (!isdigit(ch)){if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return x * f;
}

const int N=(int)(2e5)+5;
char s[N];
int a[N];
int sgn,ps,bnd,n,m;

inline void print() {
    REP(c,1,n) {
        printf("%c",(a[ps]^sgn)+'A');
        ps++;if(ps>n) ps-=n;
    } putchar('\n');
}

inline int orzcbh(int m) {
    REP(c,1,m) {
        if(!(a[ps]^sgn)) a[ps]^=1;
        else {
            sgn^=1;ps++;
            if(ps>n) ps-=n;
        }
    }
}

int main() {
    n = read(), m = read();
    scanf("%s",s+1);
    REP(i,1,n) a[i]=s[i]-'A';
    sgn=0;ps=1;bnd=n<<1;
    if(m&1) bnd++;
    if(m<=bnd) {
        orzcbh(m);
        print();
        return 0;
    }
    orzcbh(bnd);print();
    return 0;
}


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

ll gcd(ll x, ll y) {return y ? gcd(y,x%y) : x;}

vector<pair<ll,int>> factorize(ll n){
  vector<pair<ll,int>> res;
  for (ll i=2; i*i<=n;++i){
    if(n%i) continue;
    //res.emplace_back(i,0);
    res.push_back(pair<ll,int>(i,0));
    while (n%i==0){
      n/=i;
      res.back().second++;
    }
  }
  if (n!=1)res.emplace_back(n,1);
  return res;
}

int main(){
  ll a,b;
  cin>>a>>b;
  ll g=gcd(a,b);
  auto f= factorize(g);
  int ans =f.size()+1;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
#include <map>
#include <queue>
using namespace std;

int main() {
	queue<char> a, b, c;
	string sa, sb, sc; cin >> sa >> sb >> sc;
	for (int i = 0; i < sa.size(); i++) {
		a.push(sa.at(i));
	}
	for (int i = 0; i < sb.size(); i++) {
		b.push(sb.at(i));
	}
	for (int i = 0; i < sc.size(); i++) {
		c.push(sc.at(i));
	}
	char now = 'a';
	bool flg = true;
	while(flg) {
		switch (now) {
		case 'a':
			if (a.size() == 0) {
				flg = false;
				break;
			}
			now = a.front();
			a.pop();
			break;
		case 'b':
			if (b.size() == 0) {
				flg = false;
				break;
			}
			now = b.front();
			b.pop();
			break;
		case 'c':
			if (c.size() == 0) {
				flg = false;
				break;
			}
			now = c.front();
			c.pop();
			break;
		}
	} 
	cout << char(now + ('A' - 'a')) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
struct edge{int from,to,cost;};
signed main(){
  string a;
  cin>>a;
  if(a[0]==a[1]&&a[1]==a[2])
    cout<<"No";
  else
    cout<<"Yes";
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
str_A = [str(a) for a in A]
result = ' '.join(str_A)
print(result)
for i in range(1, N, 1):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j + 1] = A[j]
        j -= 1
    A[j+1] = v
    str_A = [str(a) for a in A]
    result = ' '.join(str_A)
    print(result)


Measured memory_bytes: 5604
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			int n = sc.nextInt();
			int[] a = new int[6];
			
			double d;
			for(int i=0;i<n;i++){
				d = sc.nextDouble();
				if(d<165)a[0]++;
				else if(d>=165 && d<170)a[1]++;
				else if(d>=170 && d<175)a[2]++;
				else if(d>=175 && d<180)a[3]++;
				else if(d>=180 && d<185)a[4]++;
				else if(d>=185)a[5]++;
			}
			for(int i=0;i<6;i++){
				System.out.print((i+1) + ":");
				for(int j=0;j<a[i];j++){
					System.out.print("*");
				}
				System.out.println();
			}
				
		}
	
	}	
}

Measured memory_bytes: 20360
#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 INF = 1001001001;
vector<int> f(200005, INF);

int fkeisan(int x){
    if(f[x] != INF){
        return f[x];
    } else {
        int b = __builtin_popcount(x);
        int x2 = x % b;
        if(x2 == 0){
            return f[x] = 1;
        } else {
            return f[x] = fkeisan(x2) + 1;
        }
    }

    return 0;
}

int main() {
    int N; cin >> N;
    string X; cin >> X;
    int cnt = 0;
    rep(i, N){
        if(X[i] == '1')cnt++;
    }

    vector<int> amarip1(N);
    int cntp1 = cnt+1;
    int nowp1 = 1 % cntp1;
    int totalp1 = 0;
    rep(i, N){
        int a = nowp1;
        amarip1[i] = a;
        if(X[N-1-i] == '1'){
            totalp1 += a;
            totalp1 %= cntp1;
        }
        nowp1 *= 2;
        nowp1 %= cntp1;
    }

    vector<int> amarim1(N);
    int cntm1 = cnt-1;
    int totalm1 = 0;
    if(cntm1 > 0){
        int nowm1 = 1 % cntm1;
        rep(i, N){
            int a = nowm1;
            amarim1[i] = a;
            if(X[N-1-i] == '1'){
                totalm1 += a;
                totalm1 %= cntm1;
            }
            nowm1 *= 2;
            nowm1 %= cntm1;
        }
    }
    
    //cout << "total" << total << endl;

    f[0] = 0;
    f[1] = 1;
    f[2] = 1;
    for (int i = 0; i < N; i++){
        if(cnt == 1 && X[i] == '1'){
            cout << 0 << endl;
            continue;
        }
        int ans;
        if(X[i] == '0'){
            int totalpp = totalp1 + amarip1[N-1-i];
            totalpp %= cntp1;
            ans = fkeisan(totalpp) + 1;
        } else {
            int totalmm = totalm1 - amarim1[N-1-i];
            if(totalmm < 0){
                totalmm += cntm1;
            }
            ans = fkeisan(totalmm) + 1;
        }
        cout << ans << endl;
    }

    return 0;
}

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

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

    vector<int> a(N);
    vector<int> aCount(N + 1, 0);
    for(int i = 0; i < N; ++i){
        cin >> a[i];
        aCount[a[i]] += 1;
    }

    vector<int> b(N);
    vector<int> bCount(N + 1, 0);
    for(int i = 0; i < N; ++i){
        cin >> b[i];
        bCount[b[i]] += 1;
    }

    bool isPossible = true;
    for(int elem = 1; elem <= N; ++elem){
        if(aCount[elem] + bCount[elem] > N){
            isPossible = false;
        }
    }

    if(isPossible){
        set<pair<int, int>> countVal;
        for(int elem = 1; elem <= N; ++elem){
            if(bCount[elem] > 0){
                countVal.insert({aCount[elem] + bCount[elem], elem});
            }
        }

        for(int i = 0; i < N; ++i){
            if(bCount[a[i]] > 0){
                countVal.erase({aCount[a[i]] + bCount[a[i]], a[i]});
                aCount[a[i]] -= 1;
                countVal.insert({aCount[a[i]] + bCount[a[i]], a[i]});
            }

            set<pair<int, int>>::iterator it = prev(countVal.end());
            if(a[i] == it->second){
                it = prev(prev(countVal.end()));
            }
            
            b[i] = it->second;
            countVal.erase(it);

            bCount[b[i]] -= 1;
            if(bCount[b[i]] > 0){
                countVal.insert({aCount[b[i]] + bCount[b[i]], b[i]});
            }
        }

        cout << "Yes\n";
        for(int i = 0; i < N; ++i){
            cout << b[i] << " ";
        }
    }else{
        cout << "No";
    }

    return 0;
}

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


/*
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <ctype.h>
*/



using namespace std;

typedef pair<int , int > pii;
typedef pair<long , long> pll;
typedef pair<pii , int > piii;
typedef pair<pll , long > plll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector <pii> vii;
typedef vector<pll> vll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned long long int ulli;
typedef long long int lli;
typedef float f;
typedef char ch;
typedef pair<int,ll> pill;

#define loop(n) for(int i = 0; i < (n); i++)
#define lp(x , s , e) for(int x = (s); x < (e); x++)
#define lpe(x , s , e) for(int x = (s); x <= (e); x++)
#define readline(s) getline(cin,s)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;
#define MP make_pair
#define PB push_back
#define all(a) a.begin(),a.end()
#define clr(x , val) memset((x) , (val) , sizeof(x))
#define Unique(n)   (n).erase(unique(all(n)), (n).end())
#define endl '\n'

ll power(ll a, ll b)
{
    ll res = 1;
    for(int i = 0; i<b; i++)
       res *= a;

    return res;
}

int ans[10000+ 9];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
	for (int j = 1; j <= 100; j++)
	{
		for (int k = 1 ; k <= 100; k++)
		{
			for (int c = 1; c <= 100; c++)
			{
				if ((power(j , 2) + power (k , 2) + power ( c , 2)) + (j * k) + (k * c) + (j * c) <= n)
				{
					ans[(power(j , 2) + power (k , 2) + power ( c , 2)) + (j * k) + (k * c) + (j * c)]++;
				}
			}
		}
	}
	for (int i = 1; i <= n; i++)
	{
		cout << ans[i] << endl;
	}
    return 0;
}


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

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

int main() {
   int K;
   string S;
   cin >> K >> S;

   if (S.size() <= K) {
      cout << S << endl;
   } else {
      for (int i = 0; i < K; i++) {
         if (i < K) {
            cout << S[i];
         } 
      }
      cout << "..." << endl;
   }
}


Measured memory_bytes: 3628
#include <stdio.h>

int main(void){
	char S[10];
    int max=0;
  int kioku=0;
    scanf("%s",&S);
  for(int i=0;i<10;i++){
    if(S[i]=='A')
      max+=1;
    else if(S[i]=='C')
      max+=1;
    else if(S[i]=='G')
      max+=1;
    else if(S[i]=='T')
      max+=1;
    else {
      if(kioku<max)
      kioku=max;
      max=0;
      }

    }
  if(max!=0){
    if(max>kioku)
      printf("%d",max);
    else
    printf("%d",kioku);
}
  else 
    printf("%d",kioku);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main()
{
    int n; cin >> n; int cnt = 0;
    for(int i = 1; i <=n ; i++)
    {
        if(i % 2 != 0) cnt++;
    }
    cout << fixed << setprecision(10) << (double)cnt / n << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x, y;
    for(int i=0;; i++){
        cin >>x >>y;
        if(x==0 && y==0) break;
        if(x>y) swap(x,y);
        cout << x << " " << y << endl;
    }
}


Measured memory_bytes: 3084
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		double n = sc.nextDouble();

		Point a = new Point();

		Point b = new Point();

		a.x = 0;

		a.y = 0;

		b.x = 100;

		b.y = 0;

		System.out.println(a.x+" "+a.y);

		koch(n,a,b);

		System.out.println(b.x+" "+b.y);

		/*public class Point{

			double x, y;
		}*/

	}

	static void koch(double n, Point a, Point b) {

		if(n==0) return;

		Point s, t, u;

		s = new Point();

		t = new Point();

		u = new Point();

		double th = Math.PI*60.0/180.0;

		s.x = (2.0*a.x + 1.0*b.x) / 3.0;

		s.y = (2.0*a.y + 1.0*b.y) / 3.0;

		t.x = (1.0*a.x + 2.0*b.x) / 3.0;

		t.y = (1.0*a.y + 2.0*b.y) / 3.0;

		u.x = (t.x-s.x)*Math.cos(th) - (t.y-s.y)*Math.sin(th) + s.x;

		u.y = (t.x-s.x)*Math.sin(th) + (t.y-s.y)*Math.cos(th) + s.y;

		koch(n-1,a,s);

		System.out.println(s.x+" "+s.y);

		koch(n-1, s, u);

		System.out.println(u.x+" "+u.y);

		koch(n-1,u,t);

		System.out.println(t.x+" "+t.y);

		koch(n-1,t,b);

		return;
	}

	static class Point{

		double x;

		double y;
	}

}



Measured memory_bytes: 32656