akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
using namespace std;
using pii = pair<int,int>;
using vi = vector<int>;

struct UnionFind
{
    vi uni;
    UnionFind(int n): uni(n+1, -1) {}

    int root(int x) { return (uni[x] < 0? x : uni[x] = root(uni[x])); }
    bool same(int x, int y){ return (root(x) == root(y)); }
    bool unite(int x, int y)
    {
        x = root(x); y = root(y);
        if (x == y) return (false);
        if (uni[y] < uni[x]) swap(x, y);
        uni[x] += uni[y];
        uni[y] = x;
        return (true);
    }
};

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

   int n, q;
   cin >> n >> q;
   UnionFind uf(n);

   int com, x, y;

   while (q--) {
       cin >> com >> x >> y;
       if (com == 1) {
           outl(uf.same(x,y));
       }
       else {
           uf.unite(x,y);
       }
   }
}




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

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll countDigit(ll n) { return floor(log10(n) + 1); } 
typedef pair <ll,ll> P;
static const ll dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};

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

template <typename T1, typename T2> 
ostream& operator<<(ostream& os, const map<T1, T2>& m) 
{ 
    for (auto p : m) os << "<" << p.first << ", " << p.second << "> "; 
    return os; 
}

int main()
{
    string s;
    cin >> s;
    ll K;
    cin >> K;
    rep(i, s.size()) {
        if (s[i] != 'a') {
            ll diff = 'z' + 1 - s[i];
            if (diff <= K) {
                s[i] = 'a';
                K -= diff;
            }
        }
        if (i == (ll)s.size()-1) {
            ll tmp = K % 26;
            while(tmp > 0) {
                s[i]++;
                if (s[i] == 'z'+1) s[i] = 'a';
                tmp--;
            }
        }
    }
    print(s);
    return 0;
} 

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;

}

Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->right;
  }
  return x;

}

Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key) return u;

  if(k < u->key) return treeSearch(u->left, k);
  else return treeSearch(u->right,k);

}

Node treeSuccessor(Node x){
  Node y;
  
  if(x->right != NIL) return treeMinimum(x->right);

  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) x = y->left;
  else x = y->right;

  if(x != NIL) x->parent = y->parent;

  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;

  if(y != z) z->key = y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  
  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;

}

void inorder(Node u){  
  if(u == NIL) return;

  inorder(u->left); 
  printf(" %d",u->key);
  inorder(u->right);
	 
}
void preorder(Node u){
  if(u == NIL) return;

  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n,i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 19364
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	long long int n;
	cin>>n;
	if(n&1)
	cout<<0;
	else
	{
		long long int c=0;
		while(n>0)
		{
			n/=5;
			c+=n>>1;
		}
		cout<<c;
	}
}
	

Measured memory_bytes: 256
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

inline void up(int &x,const int &y){if(x<y)x=y;}
const int maxn = 2100;

int n,m;
char str[maxn];
int col[maxn][maxn],v[maxn][maxn];
int h[maxn],L[maxn],R[maxn];
int t[maxn],tp;

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",str);
		for(int j=0;j<=m;j++) col[i][j+1]=str[j]=='.'?0:1;
	}
	for(int i=1;i<n;i++) for(int j=1;j<m;j++) v[i][j]=col[i][j]^col[i+1][j]^col[i][j+1]^col[i+1][j+1];
	int ans=max(n,m);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<m;j++) h[j]++;
		t[tp=1]=0;
		for(int j=1;j<m;j++)
		{
			while(h[t[tp]]>=h[j]) tp--;
			L[j]=t[tp]; t[++tp]=j;
		}
		t[tp=1]=m;
		for(int j=m-1;j>=1;j--)
		{
			while(h[t[tp]]>=h[j]) tp--;
			R[j]=t[tp]; t[++tp]=j;
		}
		for(int j=1;j<m;j++) up(ans,h[j]*(R[j]-L[j]));
		for(int j=1;j<m;j++) if(v[i][j]) h[j]=0;
	}
	printf("%d\n",ans);
	
	return 0;
}


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

int main(){

    char c;

    cin >> c;

    if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
        cout << "vowel" << endl;
    }
    else{
        cout << "consonant" << endl;
    }

    return 0;

}



Measured memory_bytes: 3568
//Author:  Pranta
//Date:    2020-Aug-22
//Problem: B_Multiple_of_9
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
using namespace std;
void solve()
{
    string s;
    cin>>s;
    int sum =0;
    for(int i=0;i<s.size();++i){
        sum+=s[i]-'0';
    }
    if(sum%9) cout<<"No";
    else cout<<"Yes";
}
int main()
{
    fast;
    int t;
    //cin>>t;
   // while(t--)
    solve();
}

Measured memory_bytes: 3736
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

const int max_n = 202222, inf = 1011111111;

int n, m, a[max_n], b[max_n];

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d%d", &n, &m);
    while (m--) {
        int u, v;
        scanf("%d%d", &u, &v);
        if (u == 1) {
            a[v] = 1;
        }
        if (v == n) {
            b[u] = 1;
        }
    }
    for (int i = 1; i <= n; ++i) {
        if (a[i] && b[i]) {
            printf("POSSIBLE\n");
            return 0;
        }
    }
    printf("IMPOSSIBLE\n");
    return 0;
}


Measured memory_bytes: 1792
class WeightedUnionFind:
    def __init__(self, N):
        # negative value: represents the root of a tree; its absolute value is the size of the tree
        # positive value: the parent's index
        self.vertices = [-1 for _ in range(N)]
        self.rank = [0] * N
        self.diff_weight = [0] * N
    
    def weight(self, v):
        self.find(v) # path compression
        return self.diff_weight[v]
    
    def dist(self, u, v):
        if self.is_connected(x, y):
            return self.weight(v) - self.weight(u)
        else:
            return None
    
    def find(self, v):
        if self.vertices[v] < 0:
            return v
        else:
            # path compression: reconnect v to the root
            root = self.find(self.vertices[v])
            self.diff_weight[v] += self.diff_weight[self.vertices[v]]
            self.vertices[v] = root
            return self.vertices[v]
    
    def union(self, u, v, w):
        s1 = self.find(u) # the root of the tree including vertex u
        s2 = self.find(v) # the root of the tree including vertex v
        
        if s1 == s2: # u and v is in the same tree
            return False
        
        if self.rank[s1] > self.rank[s2]: # the tree including u is taller
            self.vertices[s1] += self.vertices[s2] # update the size of the bigger tree
            self.vertices[s2] = s1
            self.diff_weight[s2] = w - self.diff_weight[v] + self.diff_weight[u]
        else: # the tree including v is taller
            self.vertices[s2] += self.vertices[s1] # update the size of the bigger tree
            self.vertices[s1] = s2
            self.diff_weight[s1] = -w - self.diff_weight[u] + self.diff_weight[v]
            if self.rank[s1] == self.rank[s2]:
                self.rank[s2] += 1
        return True
        
    def is_connected(self, u, v):
        return self.find(u) == self.find(v)
    
    def size(self, v):
        return -self.vertices[self.find(v)]
    
n, q = map(int, input().split())
wuf = WeightedUnionFind(n)
for _ in range(q):
    txt = input().split()
    if txt[0] == '0':
        x, y, z = map(int, txt[1:])
        wuf.union(x, y, z)
    else:
        x, y = map(int, txt[1:])
        res = wuf.dist(x, y)
        if res is not None:
            print(res)
        else:
            print('?')


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

int s(int n) {
  int sum = 0;

  while(n != 0) {
    sum += n % 10;
    n /= 10;
  }

  return sum;
}

int main(int argc, char** argv){
  int n;

  while (cin >> n) {
    int sum = s(n);

    if (n % sum == 0) {
      cout << "Yes" << endl;      
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
//#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
//#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
//#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
//#include <string.h>
#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define LL long long
#define pii pair<int,int>
using namespace std;
int main()
{
	int h,w;
	cin>>h>>w;
	char c[51][51];
	rep(i,51)
		rep(j,51) c[i][j]='.';
	rep(i,h)
		rep(j,w) cin>>c[i][j];
	rep(i,h)
		rep(j,w) if((c[i][j]=='#')and(c[i][j+1]=='.')and(c[i][j-1]=='.')and(c[i+1][j]=='.')and(c[i-1][j]=='.'))
				 {
				 	puts("No");
				 	rt0;
				 }
	puts("Yes");
    rt0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

ll gcd(ll m, ll n) {
    ll tmp;
    while (m % n != 0) {
        tmp = n;
        n = m % n;
        m = tmp;
    }
    return n;
}

ll lcm(ll m, ll n) {
    return max(m, n)/gcd(m,n) * min(m,n);
}


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

    ll tmp = n % 11;
    if(tmp == 0) {
        cout << (n/11)*2 << endl;
        return 0;
    }
    ll odd = (n/11)%2;
    if(odd == 1) {
        if(tmp <= 5) {
            cout << ((n/11)*2)+1 << endl;
        } else {
            cout << ((n/11)*2)+2 << endl;
        }
    } else {
        if(tmp <= 6) {
            cout << ((n/11)*2)+1 << endl;
        } else {
            cout << ((n/11)*2)+2 << endl;
        }
    }


    return 0;
}


Measured memory_bytes: 384
n = int(input())
ab = []
for i in range(n):
    ab.append(list(map(int,input().split())))

ab.sort(key=lambda x:x[1])

count = 0
can = True
for i in range(n):
    count = count + ab[i][0]
    if count > ab[i][1]:
        print("No")
        can = False
        break

if can:
    print("Yes")

Measured memory_bytes: 53720
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6+5;
int fac[N];
int invFac[N];

const int MOD = 1e9 + 7;
int mul(int a, int b)
{
	return (long long)a * b % MOD;
}

int binPow(int a, int b)
{
	int res = 1;
	while (b)
	{
		if (b & 1)
			res = mul(res, a);
		a = mul(a, a);
		b /= 2;
	}
	return res;
}

void pre()
{
	fac[0] = 1;
	invFac[0] = 1;
	for (int i = 1; i < N; i++)
	{
		fac[i] = mul(i, fac[i - 1]);
		invFac[i] = binPow(fac[i], MOD - 2);
	}
}

int binom(int n, int k)
{
	if (n < 0 || k < 0)
		return 0;
	if (k > n)
		return 0;
	return (long long)((fac[n] * invFac[k]) % MOD) * invFac[n - k] % MOD;
}


signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	pre();
	int n, h, m;
	cin >> n >> h >> m;

	vector<pair<int, int>> blocks;
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		a--; b--;
		blocks.emplace_back(a, b);
	}
	sort(blocks.begin(), blocks.end());
	blocks.push_back({ n - 1, h - 1 });
	vector<int> dp(m+1);

	for (int i = 0; i <= m; i++)
	{
		int temp = binom(blocks[i].first + blocks[i].second, blocks[i].second);
		for (int j = 0; j < i; j++)
		{
			if (blocks[j].first <= blocks[i].first && blocks[j].second <= blocks[i].second)
			{
				temp -= mul(dp[j], binom(blocks[i].first - blocks[j].first + blocks[i].second - blocks[j].second, blocks[i].first - blocks[j].first));
				temp = ((temp % MOD) + MOD) % MOD;
			}
		}
		dp[i] = temp;
	}
	cout << dp[m] << "\n";
}



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

int a[100][100];
int n;
int main() {
	cin >> n;
	int p,q,r;
	for (int i=0; i<n; ++i) {
		cin >> p >> q;
		for (int i=0; i<q; ++i) {
			cin >> r;
			a[p][r] = 1;
		}
	}
	for (int i=0; i<n; ++i) {
		for (int j=0; j<n-1; ++j) {
			cout << a[i+1][j+1] << " ";
		}
		cout << a[i+1][n] << endl;
	}
}

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

int main()
{
  char s[101], t[101], u[201];
  int i, j;
  cin >> s >> t;
  strcpy(u, t);
  strcat(u, t);
  int cnt = 0;
  for (i = 0; i < strlen(s); i++) {
    cnt = 0;
    for (j = i; j < i+strlen(s); j++) {
      if (s[j-i] != u[j]) {
        cnt++;
        break;
      }
    }
    if (cnt == 0) {
      cout << "Yes" <<  endl;
      break;
    }
  }
  if (cnt != 0)
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
#define all(V) V.begin(),V.end()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const int MOD=1e9+7;
const double pi=acos(-1);


int main(){
  double l;
  cin >> l;
  cout << fixed << setprecision(10) << l*l*l/27 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;


int main() {
	int n, d;
	int ans = 0;	
	cin >> n >> d;
	int x[n][d];

	rep(i,n) {
		rep(j,d) {
			cin >> x[i][j];
		}
	}

	rep(i,n) {
		for (int j = i+1; j < n; j++) {
			int total = 0;
			rep(k,d) {
				total += pow(x[i][k] - x[j][k], 2.0);
			}
			double x = sqrt(total);
			if (ceil(x) == floor(x))  ++ans;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
using namespace std;

int main(){
  set<int> s;
  rep(i,3){
    int temp;
    cin >> temp;
    s.insert(temp);
  }
  cout << static_cast<int>(s.size()) << endl;
  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto a = RD!string;
	auto b = RD!string;

	long x = a == "H" ? 1 : 0;
	long y = b == "H" ? 1 : 0;

	writeln(x ^ y ? "D" : "H");
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
n=int(input())
bonus=0
amaru=[]
for i in range(n):
  x=int(input())
  if x%10==0:
    bonus+=x
  else:
    amaru.append(x)

if amaru==[]:
  bonus=0
else:
  amaru.sort()
kiso=sum(amaru)
if kiso%10==0 and amaru!=[]:
  kiso-=amaru[0]
print(kiso+bonus)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
//#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define sll                     set<ll>
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define umcl                    um<char,ll>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define test                    ll Testcases;cin>>Testcases;while(Testcases--)
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

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

int main()
{
	fastIO
	//inp_out();
	ld n;
	cin>>n;
	ld ans=(n/3)*(n/3)*(n/3);
	cout<<fixed<<setprecision(8)<<ans;
	return 0;
}



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

int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  
  int ans = 0;
  for (int i = 0; i < N - 2; i++) {
    if (A[i] < A[i+1] && A[i+1] < A[i+2]) {
      ans++;
    }
    else if (A[i] > A[i+1] && A[i+1] > A[i+2]) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
int a[100005];

int main()
{

    int i,j;
    int n,b1,b2;
    cin>>n;
    b1=0;
    b2=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]%4?a[i]%2?:++b1:++b2;
    }
    j=n-b1-b2;
    if((!b1&&b2+1>=j)||(b1&&b2>=j))
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main{
    public static void main(String[] args){
        int cnt=0;
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        String[] array=str.split("");
        for(int i=0;i<3;i++){
            cnt+=Integer.parseInt(array[i]);
        }
        System.out.println(cnt);
    }
}

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

const int N = 2e5;

vector<int> adj[N+5];
int n,q;
int tot[N+5];
int ans[N+5];

void dfs(int cur, int par, int nt){
  nt+=tot[cur];
  ans[cur] = nt;
  for(int i=0;i<adj[cur].size();i++){
    int now = adj[cur][i];
    if(now == par) continue;
    dfs(now,cur,nt);
  }
  return;
}

int main(){
  cin >> n >> q;
  for(int i=1;i<n;i++){
    int u,v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for(int i=1;i<=q;i++){
    int u,v;
    cin >> u >> v;
    tot[u]+=v;
  }
  dfs(1,-1,0);
  for(int i=1;i<=n;i++){
    if(i>1) cout << " ";
    cout << ans[i];
  }
  cout << endl;
  return 0;
}

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

int main(){
	
	int n;
	cin>>n;
	vector<int>a(n);
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	if(n==1){
		cout<<0<<endl;
		return 0;
	}
	sum=(sum)/n;
	int ans1=0,ans2=0,ans3=0;
	for(int i=0;i<n;i++){
		int temp=abs(a[i]-sum);
		ans1+=temp*temp;
	}
	sum+=1;
	for(int i=0;i<n;i++){
		int temp=abs(a[i]-sum);
		ans2+=temp*temp;
	}
	sum-=2;
	for(int i=0;i<n;i++){
		int temp=abs(a[i]-sum);
		ans3+=temp*temp;
	}
	cout<<min({ans1,ans2,ans3})<<endl;
	
	return 0;
}


Measured memory_bytes: 3576
s=input()
# print(list(s))
a=[]
for i in range(len(s)):
    if s[i]=='0':
        a.append(s[i])
    elif s[i]=='1':
        a.append(s[i])
    else:
        if len(a)>0:
            del a[-1]
print(''.join(a))

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while(true)
int main(){
    int m,f,b;
    cin >> m >> f >> b;
    if(m > b){
        cout << 0 << endl;
    }
    else if(m+f < b){
        cout << "NA" << endl;
    }
    else{
        cout << b-m << endl;
    }
}


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

int a[105], x, n;

int main(){
    cin >> n >> x;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(x < a[i]){
            x = 0;
            break;
        }
        x -= a[i];
        cnt++;
    }
    cout << (x == 0 ? cnt : cnt - 1) << '\n';
}


Measured memory_bytes: 256
import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop, heapify
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
ab = [LIST() for _ in range(M)]

contact = [[] for _ in range(N)]

for a, b in ab:
	contact[a-1].append(b-1)
	contact[b-1].append(a-1)

#print(contact)

for x in contact[0]:
	if N-1 in contact[x]:
		print("POSSIBLE")
		break
else:
	print("IMPOSSIBLE")


Measured memory_bytes: 81580
#include<iostream>
using namespace std;
int main(){
  int n,c=0;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0;i<n;i++){
    if(a[a[i]-1]==i+1){
      c++;
    }
  }
  cout << c/2 << endl;
  return 0;
}

Measured memory_bytes: 768
s = list(input())
l = len(s)

for bit in range((l-1)**2):
    ans_sum = int(s[0])
    ans_str = s[0]
    for i in range(l-1):
        if (bit >> i) & 1:
            ans_sum += int(s[i+1])
            ans_str += '+'
        else:
            ans_sum -= int(s[i+1])
            ans_str += '-'
        ans_str += s[i+1]
    if ans_sum == 7:
        print(ans_str+'=7')
        exit(0)

Measured memory_bytes: 3064
N,K,Q = map(int,input().split())
dic = {i+1:0 for i in range(N)}
for i in range(Q):
    a = int(input())
    dic[a] += 1
for i in range(1,N+1):
    if dic[i]+K > Q: print('Yes')
    else: print('No')

Measured memory_bytes: 15084
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}
 
using namespace std;                                                                                  
 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;                                            
typedef pair < long long  , long long > pll ;
const int N = 2005, K = 2e9 + 1 , L = 3e5;

int n, k, m;
int a[3][N];
string s;
int pr[N];
main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[0][i];
		pr[i] = pr[i - 1] + a[0][i];
	}				

	for(int i = 1; i <= n; i++){
		cin >> a[1][i];
	}
	int sum = 0 , ans = 0;
	repb(i , n , 1){
		sum += a[1][i];
		ans = max(ans , sum + pr[i]);
	}
	cout << ans;
}
 


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()
 
#define REP(i,s,e)	for(int i=(s); i<(e); i++)
#define rep(i,n)	REP(i,0,n)
#define REPE(i,s,e)	for(int i=s; i>e; i--)
#define repe(i,n)	REPE(i,n,-1)


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<vi> vvi;
 
const int IMAX=((1<<30)-1)*2+1;
const int INF=100000000;
const double EPS=1e-10;
//int mod=1000000007
 


int main(){
	int n;
	while(cin >> n && n>0){
		map<char,char> m;
		char a,b;
		rep(i,n) cin>>a>>b,m[a]=b;
		int k;
		cin>>k;
		rep(i,k){
			cin>>a;
			if(m[a]>0) cout<<m[a];
			else cout<<a;
		}
		cout<<endl;
	}
}

Measured memory_bytes: 1188
#include<iostream>
#include<algorithm>

using namespace std;
int n;
int H,W,T;
string str;
bool used[26],flg;

int A[26],B[26],C[26],D[26];

char t[500][500];

char tmp;

void input();
void init();

bool check(char ch){

  int z=ch-'A';
  if(A[z]==-1){
    int a=49,b=0,c=0,d=49;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	if(t[i][j]==ch){
	  a=min(a,i);
	  b=max(b,j);
	  c=max(c,i);
	  d=min(d,j);
	}
      }
    }
    A[z]=a;  B[z]=b;  C[z]=c;  D[z]=d;
  }

  for(int i=A[z];i<=C[z];i++){
    for(int j=D[z];j<=B[z];j++){
      if(t[i][j]=='?')continue;
      if(t[i][j]!=ch)return false;
    }
  }
  return true;
  
}

void draw(char ch){
  int z=ch-'A';

  if(A[z]==-1){
    int a=49,b=0,c=0,d=49;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	if(t[i][j]==ch){
	  a=min(a,i);
	  b=max(b,j);
	  c=max(c,i);
	  d=min(d,j);
	}
      }
    }
    A[z]=a;  B[z]=b;  C[z]=c;  D[z]=d;
  }

  for(int i=A[z];i<=C[z];i++){
    for(int j=D[z];j<=B[z];j++){
      t[i][j]='?';
    }
  }
}
int main(){
  cin>>T;
  while(T--){
    init();
    input();

    while(1){
 
      flg=false;

      for(int i=0;i<26;i++){
	if(used[i]==false)continue;
	if(check(i+'A')==true){
	  flg=true;
	  draw(i+'A');
	  used[i]=false;
	  break;
	}
      }
      if(flg==false)break;
    }

    flg=false;
    for(int i=0;i<26;i++)flg|=used[i];
    cout<<(flg?"SUSPICIOUS":"SAFE")<<endl;
  }
  return 0;
}

void input(){
  cin>>H>>W;
  for(int i=0;i<H;i++){
    cin>>str;
    for(int j=0;j<W;j++){
      t[i][j]=str[j];
      if(t[i][j]!='.')
      used[t[i][j]-'A']=true;
    }
  }
}
void init(){
  for(int i=0;i<26;i++){
    A[i]=-1;
    used[i]=false;
  }
}

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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n,ans=0,j;
  int a[100002],b[100001];
  cin >> n;
  for(int i=0;i<=n;i++)cin >> a[i];
  for(int j=0;j<n;j++)cin >> b[j];
  for(int i=0;i<n;i++){
    j=min(a[i],b[i]);
    ans+=j;
    a[i]-=j;
    b[i]-=j;
    j=min(a[i+1],b[i]);
    ans+=j;
    a[i+1]-=j;
    b[i]-=j;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4312
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<set>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
ll N,C;
int main(){
    cin >> N >> C;
    vector<ll> x(N+1),v(N+1);
    for(int i = 0; i < N; i++){
        cin >> x.at(i+1) >> v.at(i+1);
    }
    ll sum_v = 0;
    vector<ll> max_sum(N+1);
    ll mx = 0;
    for(int i = 1; i <= N; i++){
        sum_v += v.at(i);
        mx = max(mx,(sum_v - x.at(i)));
        max_sum.at(i) = mx;
    }
    ll ans = max_sum.at(N);
    sum_v = 0;
    for(int i = N; i >= 1; i--){
        sum_v += v.at(i);
        ans = max(ans, (sum_v - (C - x.at(i)) *2 + max_sum.at(i-1)));
    }
    vector<ll> max_sum2(N+1);
    sum_v = 0;
    mx = 0;
    for(int i = N; i >= 1; i--){
        sum_v += v.at(i);
        mx = max(mx, (sum_v - (C - x.at(i))));
        max_sum2.at(i) = mx;
    }
    ans = max(ans, max_sum2.at(1));
    sum_v = 0;
    for(int i = 1; i < N; i++){
        sum_v += v.at(i);
        ans = max(ans, (sum_v - x.at(i)*2 + max_sum2.at(i+1)));
    }
    cout << ans << endl;
}




Measured memory_bytes: 3328
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    tmp = input.split("\n");
    tmp = tmp.map(Number);
    k = tmp[5];
    a = new Array;
    for(i = 0; i < 5; i++){
        for(j=0;j< 5;j++ ){
            a[5*i+j] = Math.abs(tmp[i]-tmp[j])
            }
        }
    if(Math.max.apply(null, a) > k){
        console.log(":(");
    }else{
        console.log("Yay!");
    }

    
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));




Measured memory_bytes: 21064
package main

import (
	"fmt"
)

func main() {
	var a,b int
	fmt.Scan(&a,&b)

	if a >= 13 {
		fmt.Println(b)
	} else if a >= 6 {
		fmt.Println(b/2)
	} else {
		fmt.Println(0)
	}
}

Measured memory_bytes: 512
N = int(input())
Wn = list(map(int,input().split(' ')))

min_indx = -1
min_diff = 10**9
for i in range(1,N):
    before = sum(Wn[0:i])
    after = sum(Wn[i:N])
    min_sum = min(before,after)
    max_sum = max(before,after)
    if (max_sum - min_sum ) < min_diff:
        min_indx = i
        min_diff = max_sum - min_sum
print(min_diff)


Measured memory_bytes: 38680
#include<bits/stdc++.h>
using namespace std;
char a[110],b[10];
int j;
int main()
{
	scanf("%s",&a);
	int n=strlen(a);
	for (int i=0;i<n;i++)
	{
		if (a[i]=='C')
		{
			for (int j=i+1;j<n;j++)
			{
				if (a[j]=='F')
				{
					cout<<"Yes";
					return 0;
				}
			}
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String aStr = sc.next();
		String bStr= sc.next();
		int a = 0;
		int b = 0;
		try {
			a = Integer.parseInt(aStr);
			b = Integer.parseInt(bStr);
		} catch (Exception e) {
			System.out.println("error");
		}
		while (true) {
			if (a >= 1 && b <= 100) {
				int area = a * b;
				int circ = 2 * a + 2 * b;
				System.out.println(area + " " + circ);
				break;
			} else {
				continue;
			} 
		}
		sc.close();
	}
}

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

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fast_work {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}

const ll INF = 1e9 + 7, NMAX = 1e6 + 5, MOD = 1000000007, N = 1e9 + 5, LOG = 25;
const ld EPS = 1e-8, pi = 3.14159265358979323846;


signed main() {
    fast_work

    string s;
    cin >> s;

    if(s == "RRR") return cout << 3, 0;
    if(s == "RRS" || s == "SRR") return cout << 2, 0;
    if(s == "RSR" || s == "SRS" || s == "RSS" || s == "SSR") return cout << 1, 0;
    cout << 0;

}






Measured memory_bytes: 3644
local DBG = false
local function dbgpr(...)
    if DBG then
        io.write("[dbg]")
        print(...)
    end
end

local function dbgpr_t(tbl, use_pairs)
    if DBG then
        local enum = ipairs
        if use_pairs then
            enum = pairs
        end
        dbgpr(tbl)
        io.write("[dbg]")
        for i,v in enum(tbl) do
            io.write(i)
            io.write(":")
            io.write(tostring(v))
            io.write(" ")
        end
        print("")
    end
end

-- SegTree
-- 参考にしました: http://tsutaj.hatenablog.com/entry/2017/03/29/204841
local SegTree = {}
function SegTree.new(func, ident, vec)
    -- func: binary function
    -- ident: identity element
    -- vec: table
    local self = setmetatable({}, {__index = SegTree})
    self.func = func
    self.ident = ident
    local a = {}
    self.a = a
    local n = 1
    while n < #vec do
        n = n * 2
    end
    -- n is smallest power of 2 that is greater than or equal to #vec
    self.n = n
    local size = 2*n - 1
    for i=1, size do
        a[i] = ident
    end
    -- for verification
    --[[
    for i=1, #vec do
        a[i+n-1] = vec[i]
    end
    for i=n-1,1,-1 do
        a[i] = func(a[2*i], a[2*i+1])
    end
    ]]
    return self
end

function SegTree:update(idx, val)
    local a = self.a
    local func = self.func
    idx = idx + self.n - 1
    a[idx] = val
    while true do
        idx = math.floor(idx / 2)
        a[idx] = func(a[idx*2], a[idx*2 + 1])
        if idx == 1 then
            break
        end
    end
end

function SegTree:query(left, right)
    -- query to [left, right)
    -- **be careful about right half open interval**
    local func = self.func
    local ident = self.ident
    local a = self.a
    local function q(k, l, r)
        if r <= left or l >= right then
            return ident
        end
        if l >= left and r <= right then
            return a[k]
        end
        local h = math.floor((l+r)/2)
        local vl = q(2*k  , l, h)
        local vr = q(2*k+1, h, r)
        return func(vl, vr)
    end
    return q(1, 1, self.n + 1)
end
------
local function gcd(a,b)
    if b == 0 then
        return a
    else
        return gcd(b, a % b)
    end
end
----

local N = io.read("*n")
local A = {}
for i=1,N do
    A[i] = io.read("*n")
end
local st = SegTree.new(gcd, 0, A)

-- for verification
for i=1, #st.a do
    st.a[i] = 0
end
for i=1, N do
    st:update(i, A[i])
end

dbgpr_t(st.a)
local maxval = 0
for i=1, N do
    local left = st:query(1, i)
    local right = st:query(i+1, N+1)
    local g = gcd(left, right)
    dbgpr(i, left, right, g)
    maxval = math.max(maxval, g)
end
print(maxval)


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

int main(void){
    int K;
    cin >> K;

    int start = 7 % K;
    int mod_value = start;
    int ans = 1;
    for(int i=0;i<K;i++){
        if(mod_value == 0){
            cout << ans << endl;
            return 0;
        }
        mod_value = (mod_value*10+7) % K;
        if(mod_value == start){
            cout << -1 << endl;
            return 0;
        }
        ans++;
    }

    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3640
n,k = map(int,input().split())
ans = 0
list = [0] * n
for i in range(k):
    d = int(input())
    A = map(int,input().split())
    for j in A:
        list[j-1]+=1

for u in  list:
    if u == 0:
        ans += 1
        
print(ans)

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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int n,w,x,y,i,j;
    cin>>n>>w;
    long long int dp[n+1][w+1],A[n+1][2];
    for(i=1;i<=n;i++){
        cin>>A[i][0]>>A[i][1];
        dp[i][0]=0;
    }
    for(i=0;i<=w;i++){
        dp[0][i]=0;
    }
    for(i=1;i<=n;i++){
        for(j=1;j<=w;j++){
            dp[i][j]=dp[i-1][j];
            if(A[i][0]<=j)
                dp[i][j]=max(dp[i-1][j-A[i][0]]+A[i][1],dp[i][j]);
        }
    }
    cout<<dp[n][w];
    return 0;
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
 
 
int main(){
  int n;
  cin>>n;
  
  vector<int>b(n-1);
  rep(i,n-1)cin>>b[i];
  int a=b[0]+b[n-2];
  rep(i,n-2){
    if(b[i]<=b[i+1])a+=b[i];
    else a+=b[i+1];
  }
  cout<<a<<endl;
}
  

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n;

	cin >> n;

	vector<ll> v(n);

	REP(i, n) {
		cin >> v[i];
	}

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

	double ans = v[0];

	REP(i, n - 1) {
		ans = ((double)v[i + 1] + ans) / 2.0;
	}

	cout << setprecision(10) << scientific << ans << endl;
}

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

int main() {
	string A,s,C;
	cin >> A >> s >> C;
	char A1, s1,C1;
	A1='A';
	s=s.at(0);
	C1='C';
	cout << A1 + s+ C1<< endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
//	"sort"
//	"math"
//	"regexp"
)


var A,B,C,D,ans int

func main(){
	fmt.Scan(&A,&B,&C,&D)

	if B<C || D<A {
		fmt.Println(0)
	}else if A<=C && C<=B && B<=D{
		fmt.Println(B-C)
	}else if C<=A && B<=D {
		fmt.Println(B-A)
	}else if A<=C && D<=B {
		fmt.Println(D-C)
	}else{
		fmt.Println(D-A)
	}
}


Measured memory_bytes: 512
/*---------------------------*\
____________Mari000____________         
________Mostafa  Shehab________    
\*---------------------------*/

#include <bits/stdc++.h>
using namespace std;
 
#define PI  3.14159265  // PI = acos(-1)
#define EPS (1e-10)
#define endl "\n"
typedef long long ll;
typedef long double ld;
//template <class Type>

ll power(ll x,ll y,ll p);
int Bit(ll x);
 
inline int D(){
	int t;
	scanf("%d",&t);
	return t;
}
inline ll llD(){
	ll t;
	scanf("%lld",&t);
	return t;
}

const int N=1e5 + 5;
unordered_map<int,int> mp;
int n,m;


int main(){
	n=D();
	if(n%10 == 9 || n/10 == 9)
		puts("Yes");
	else
		puts("No");

}










ll power(ll x,ll y,ll p){ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
    while (y > 0){ 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;
    }
    return res; 
}


int Bit(ll x){
	if(!x)
		return 0;
	return 1+Bit(x>>1);
}


















Measured memory_bytes: 256
N = int(input())
A = [0] * N
d = [0] * N 
B = [0] * N
for i in range(N):
    A[i] = list(map(int, input().split()))
    d[i] = A[i][1]
for i in range(N):
    B[i] = list(map(int, input().split()))

B.sort()

tmp = []

for i in range(N):
    t = -10
    for j in range(N):
        if A[j][0] < B[i][0] and A[j][1] < B[i][1] and j not in tmp:
            t = max(t, A[j][1]) 
    if t > -1 :
        tmp.append(d.index(t))
    #print(t)

ans = len(tmp)
print(ans)



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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int n , d;

int main()
{
    _FastIO;
    cin >> n >> d;
    int k = 2 * d + 1;
    int ans = n / k;
    if(n % k) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	string s;
	cin >> s;
	int n = s.size();
	int count = 0;
	if(s[0] != 'A'){
		cout << "WA" << endl;
		return 0;
	}
	if(s[1] < 'a' || s[1] > 'z'){
		cout << "WA" << endl;
		return 0;
	}
	for(int i = 2;i < (n - 1);i++){
		if(s[i] < 'a' || s[i] > 'z'){
			if(s[i] == 'C'){
				count++;
			}else{
				cout << "WA" << endl;
				return 0;
			}
		}
	}
	if(s[n - 1] < 'a' || s[n - 1] > 'z'){
		cout << "WA" << endl;
		return 0;
	}
	if(count != 1){
		cout << "WA" << endl;
		return 0;
	}
	cout << "AC" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int w, a, b;
  cin >> w >> a >> b;
  if(a + w < b)
    cout << b - a - w;
  if((a + w >= b && a + w <= b + w) || (b + w >= a && b + w <= a + w))
    cout << 0;
  if(b + w < a)
    cout << a - b - w;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;

int main()
{
    long long int N; cin >> N;
    vector<long long int> B;
    for (long long int i = 0; i < N; i++){
        long long int A;
        cin >> A;
        B.push_back(A - i + 1);
    }
   
    sort(B.begin(), B.end());

    long long int mid;
    if (N % 2 == 0){
        mid = (B[N / 2] + B[N / 2 - 1]) / 2;
    }else{
        mid = B[(N - 1) / 2];
    }

    long long int sum = 0;
    for (long long int i = 0; i < N; i++){
        sum += abs(B[i] - mid);
    }
    cout << sum << endl;
}

Measured memory_bytes: 2420
#include <iostream>
#include <iomanip>
#include <climits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>

using namespace std;

#define INF (int)1e8
#define _INF (int)-1e8  
#define INFLL (long long)1e15
#define _INFLL (long long)-1e15
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

/*******************************************************/

typedef double coordinate_t;

struct coordinate {
  coordinate_t x, y;
  bool operator<(const coordinate & another) const {
    return x != another.x ? x < another.x : y < another.y;
  }
};

struct line {
  coordinate_t a;
  coordinate_t b;
  coordinate_t c;
};

// the intersections of 2 lines
coordinate cross_of_2_lines(line k, line l) {
  coordinate_t dn = l.a * k.b - k.a * l.b;
  if (dn == 0) return{ NAN, NAN };
  else {
    coordinate_t x = (l.b * k.c - k.b * l.c) / dn;
    coordinate_t y = (k.a * l.c - l.a * k.c) / dn;
    return{ x,y };
  }
}


// the intersections of n lines
vector<coordinate> crosses_of_lines(vector<line> lines) {
  int n = lines.size();
  set<coordinate> st;
  Loop(i, n) {
    Loop(j, i) {
      coordinate p = cross_of_2_lines(lines[i], lines[j]);
      if (p.x != NAN && p.y != NAN) st.insert(p);
    }
  }
  vector<coordinate> ret;
  for (auto itr = st.begin(); itr != st.end(); itr++) {
    ret.push_back(*itr);
  }
  return ret;
}


// the line through 2 coordinates
line line_through_2_coordinates(coordinate p, coordinate q) {
  if (p.x == q.x && p.y == q.y) return{ NAN, NAN, NAN };
  else {
    if (p.x == q.x) {
      return { 1, 0, -p.x };
    }
    else {
      return { (q.y - p.y), (p.x - q.x), q.x * p.y - p.x * q.y };
    }
  }
}



int main() {
  int q; cin >> q;
  cout << setprecision(18);
  Loop(i, q) {
    coordinate p, q;
    line s, t;
    cin >> p.x >> p.y >> q.x >> q.y;
    s = line_through_2_coordinates(p, q);
    cin >> p.x >> p.y >> q.x >> q.y;
    t = line_through_2_coordinates(p, q);
    coordinate r = cross_of_2_lines(s, t);
    cout << r.x << " " << r.y << endl;
  }
}


Measured memory_bytes: 3304
#include<iostream>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
double pi= 3.14159265358979323846;
int main(){
	double R;
	cin>>R;
	printf("%.20lf\n",2*pi*R);
	return 0;
} 
//458.67252742410977361942
//458.67252742410977361942

//6.28318530717958623200
//6.28318530717958623200

Measured memory_bytes: 3176