akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

#ifdef DEBUG
#define debug(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

template <class T> inline void setmin(T & a, T const & b) { a = min(a, b); }
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }


ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
// ll comb(ll n, ll k) { ll v=1; for(ll i=1; i<=k; i++) v = DIV(MUL(v, n-i+1),i); return v; }
//

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == 0) {
        v.clear();
        return 0;
    }
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    // assert(i <= N);
    return i;
}
void read_cr() {
    fgets(_buf, 256, stdin);
}


int main() {
    vi a(3);
    loadvec(a,3);
    sort(ALL(a));
    cout << (a[0] * a[1] / 2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const LL MOD = 1000000007LL;
typedef pair<int, int> P;
char a[8][9];
int main() {
	int H, W;
	cin >> H >> W;
	vector<P> v;
	for (int i = 0; i < H; i++) {
		cin >> a[i];
		for (int j = 0; j < W; j++) {
			if (a[i][j] == '#') v.emplace_back(j, i);
		}
	}
	for (int i = 0; i < v.size(); i++) {
		for (int j = 0; j < v.size(); j++) {
			if (v[i].first<v[j].first && v[i].second > v[j].second) {
				cout << "Impossible" << endl;
				return 0;
			}
		}
	}
	cout << "Possible" << endl;
}

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

int main(void){
   int N,W;
   cin>>N>>W;
   vector<long long> w(N),v(N);
   for(int i=0;i<N;i++){
      cin>>w[i]>>v[i];
   }
   vector<vector<long long>> dp(N+1,vector<long long>(W+1));
   for(int i=0;i<=N;i++){
      for(int j=0;j<=W;j++){
         dp[i][j]=0;
      }
   }

   for(int i=0;i<N;i++){
      for(int j=0;j<=W;j++){
         if(j-w[i]>=0){
            dp[i+1][j]=max(dp[i+1][j],dp[i][j-w[i]]+v[i]);
         }
         dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
      }
   }
   cout<<dp[N][W]<<endl;
   return 0;
}


Measured memory_bytes: 83176
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

void Atoi(vector<int>&, string);
int Blackjack(vector<int>);
bool Searhone(int);

int main(){
  int i, n, result;
  string line;
  vector<int> Number; 

  while(1){
    getline(cin, line);
    if(line == "0") break;

    Atoi(Number, line);
    result = Blackjack(Number);
    cout << result << endl;
    Number.clear();
  }
  return 0;
}

void Atoi(vector<int>& n, string s){
  int i=0, x;

  while(i < s.size()){
    if(s[i+1] == ' ' || i == s.size()-1){
      x = s[i] - 48;
      i += 2;
    }else{
      x = 10 * (s[i] - 48) + (s[i+1] - 48);
      i += 3;
    }
    n.push_back(x);
  }
}

int Blackjack(vector<int> n){
  int k, sum=0, onecount=0;
  vector<int>::iterator i, j;

  for(k=0; k<n.size(); ++k){
    if(n[k] > 10) n[k] = 10;
  }

  i = partition(n.begin(), n.end(), Searhone);
  j = n.begin();
  while(j != i){
    if(sum <= 21 - *j)
      sum += *j;
    else
      return 0;
    ++j;
  }

  if(i != n.end()){
    while(i != n.end()){
      ++onecount;
      ++i;
    }

    if(onecount == 1){
      if(sum <= 10)
	sum += 11;
      else if(sum <= 20)
	sum++;
      else
	sum = 0;
    }else{
      if(sum <= 10 - (onecount-1))
	sum = sum + 11 + (onecount-1);
      else if(sum <= 20 - onecount)
	sum += onecount;
      else
	sum = 0;
    }
  }

  return sum;
}

bool Searhone(int n){
  if(n == 1)
    return false;
  else
    return true;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
const int dx[] = { -1 , -1 , -1 , 0 , 0 , 0 , 1 , 1 , 1 };
const int dy[] = { -1 , 0 , 1 , -1 , 0 , 1 , -1 , 0 , 1 };
#define NN 8010000
#define TC int t;cin>>t;for(int T=1;T<=t;T++)
#define mod 1000000007
#define PI acos(-1)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mem(a,n) memset(a,n,sizeof(a))
void AIA() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
//cout<<fixed<<setprecision(20);
// freopen("stand.in","r",stdin);
// freopen("stand.out","w",stdout);
bool isprime(ll n) {
	for (ll i = 2; i * i <= n; i++) {
		if (n % i == 0)return 0;
	}
	return (n!=1);
}
ll gcd(ll x, ll y)
{
	return (y == 0 ? x : gcd(y, x % y));
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll rem(int x, int N){
	return (x % N + N) % N;
}
int n,m;
ll dp[1007][1007];
char arr[1007][1007];

int main()
{
	//cout<<fixed<<setprecision(6);
	AIA();
	int n,m;
	cin>>n>>m;
	dp[0][0] = 1;
	for(int i=0;i<n;i++)for(int j=0;j<m;j++)cin>>arr[i][j];
	for(int i = 0;i<n;i++)for(int j=0;j<m;j++){
		if(arr[i][j] == '#')continue;
		if(i == 0 && j == 0)continue;
		if(i == 0)dp[i][j] = dp[i][j - 1];
		else if(j == 0)dp[i][j] = dp[i-1][j];
		else dp[i][j] = ((dp[i][j] % mod) + (dp[i - 1][j] % mod) + (dp[i][j - 1] % mod)) % mod;
	}	
	cout << dp[n-1][m-1];
	return 0;
}

Measured memory_bytes: 12508
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  string N;
  cin >> N;
  if (N.at(0)==N.at(1) && N.at(1)==N.at(2)) {
    cout << "Yes" << endl;
  }
  else {
    if (N.at(1)==N.at(2) && N.at(2)==N.at(3)) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 3632
from sys import maxsize
from heapq import heappop, heappush


class Node:
    WHITE = 0
    GRAY = 1
    BLACK = 2

    def __init__(self):
        self.adjs = []
        self.color = Node.WHITE
        self.dist = maxsize

    def __lt__(self, other):
        return self.dist < other.dist

    def __repr__(self):
        return "Node({},{},{})".format(self.adjs, self.color, self.dist)


def read_adj():
    n = int(input())
    nodes = [Node() for _ in range(n)]

    for i in range(n):
        u, _, *rest = [int(x) for x in input().split()]
        for i in range(0, len(rest) - 1, 2):
            nodes[u].adjs.append((nodes[rest[i]], rest[i+1]))

    return nodes


def shortest_path(nodes):
    h = []

    nodes[0].dist = 0
    nodes[0].color = Node.GRAY
    heappush(h, nodes[0])

    while True:
        while len(h) > 0:
            min_node = heappop(h)
            if min_node.color != Node.BLACK:
                break
        else:
            break

        min_node.color = Node.BLACK

        for adj, c in min_node.adjs:
            if min_node.dist + c < adj.dist:
                adj.dist = min_node.dist + c
                adj.color = Node.GRAY
                heappush(h, adj)


def print_dist(nodes):
    for u, n in enumerate(nodes):
        print(u, n.dist)


def main():
    nodes = read_adj()
    shortest_path(nodes)
    print_dist(nodes)


if __name__ == '__main__':
    main()



Measured memory_bytes: 56844
import itertools

N,A,B,C=map(int,input().split())
l=[int(input()) for _ in range(N)]

d=list(itertools.product([0,1,2,3], repeat=N))

MIN=10**10
for i in range(len(d)):
    ans=0
    a_num=0
    b_num=0
    c_num=0
    a_kadomatu=A
    b_kadomatu=B
    c_kadomatu=C
    if {0,1,2} <= set(d[i]):
        for g in range(len(d[i])):
            if d[i][g]==0:
                a_num+=1
                a_kadomatu-=l[g]
            elif d[i][g]==1:
                b_num+=1
                b_kadomatu-=l[g]
            elif d[i][g]==2:
                c_num+=1
                c_kadomatu-=l[g]
        ans=abs(a_kadomatu)+abs(b_kadomatu)+abs(c_kadomatu)+10*(a_num-1)+10*(b_num-1)+10*(c_num-1)
        MIN=min(MIN,ans)
print(MIN)

Measured memory_bytes: 10996
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

struct edge{
	ll to;
	ll cost;
};

vector<edge>g[110];

vector<P>used;

int main(void){
	ll n;
	cin>>n;
	ll ans = 0;
	for(ll k=1;k<=n;k++){
		ll cnt=n/k;
		ans += k*(cnt)*(cnt+1)/2;
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;

int w, h;
int c[51][51];
int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};

void dfs(int y, int x){
	c[y][x] = 0;
	for(int i = 0; i < 8; i++){
		int ny = y + dy[i], nx = x + dx[i];
		if(0<=ny and ny<h and 0<=nx and nx<w and c[ny][nx]==1){
			dfs(ny, nx);
		}
	}
}

int solve(){
	int res = 0;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(c[i][j] == 1){
				dfs(i, j);
				res++;
			}
		}
	}

	return res;
}

int main(void){
	while(scanf("%d%d", &w, &h) != EOF){
		if(w == 0 and h == 0) break;
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				scanf("%d", &(c[i][j]));
			}
		}
		printf("%d\n", solve());
	}

	return 0;
}



Measured memory_bytes: 3160
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#define int long long
using namespace std;

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

int k,m,n;
signed main(){
	n=read();m=read();k=read();
	if(n+m<k){puts("0 0");return 0;}
	if(n<k){
		printf("0 %lld\n",m-(k-n));
		return 0;
	}
	else printf("%lld %lld\n",n-k,m);
	return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, N) for(ll i=0; i<N; ++i)

ll max(ll a, ll b) {return a < b ? b : a; }

char revc(char w) { 
  return w == 'W' ? 'S' : 'W';
}

int N; 
string s;

bool check(char c1, char c2) {
  string en;
  //狼，狼
  en.push_back(c1);
  en.push_back(c2);
  
  for(int i=1; i<N-1; ++i) {
    if(en.back() == 'W' && s.at(i) == 'o' ||
      en.back() == 'S' && s.at(i) == 'x') {
      en.push_back(revc(en[i-1]));
    } else {
      en.push_back(en[i-1]);
    }
  }
  
  char first =
    en.back() == 'W' && s.at(N-1) == 'o' ||
    en.back() == 'S' && s.at(N-1) == 'x' ?
    revc(en[N-1-1]) : en[N-1-1];
  
  char last = 
    en.front() == 'W' && s.front() == 'o' ||
    en.front() == 'S' && s.front() == 'x' ?
    revc(en[1]) : en[1];
    
  if(first == en[0] && last == en.back()) {
    cout << en << endl;
    return true;
  }
  return false;
}

int main() {
  cin >> N >> s;
  
  // bool found = false;
    //4パターンしか無い
    //狼=0, 羊=1 と置く
  if(check('W', 'W')) return 0;
  if(check('W', 'S')) return 0;
  if(check('S', 'W')) return 0;
  if(check('S', 'S')) return 0;
  
  cout << "-1" << endl;
  
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    queue<int> q[3];
    
    int n;
    cin >> n;
    rep(i, n) {
        int a;
        cin >> a;
        if (a % 4 == 0) q[0].push(a);
        else if (a % 2 == 0) q[1].push(a);
        else q[2].push(a);
    }
    
    int flg = 0;
    if (sz(q[1]) == 0) flg ^= 1;
    rep(i, n) {
        if (sz(q[1])) q[1].pop();
        else {
            if (flg == 0) {
                if (sz(q[0])) {
                    q[0].pop();
                    
                } else {
                    cout << "No" << endl;
                    return 0;
                }
                
            } else {
                if (sz(q[2])) {
                    q[2].pop();
                   
                } else {
                    
                }
            }
            flg ^= 1;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 640
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int K = sc.nextInt();
		int S = sc.nextInt();

		sc.close();

		int[] ans = new int[N];
		
		for(int i=0;i<ans.length;i++) {
			if(i<K) {
				ans[i] = S;
			}else {
				ans[i] = S==1000000000 ? 1 : S+1;
			}
		}
		
//		if (N == K) {
//			for (int i = 0; i < ans.length; i++) {
//				ans[i] = S;
//			}
//		}else if(K == 0) {
//			for(int i=0;i<ans.length;i++) {
//				ans[i] = S+1;
//			}
//		} else if(S==1) {
//			for(int i=0;i<ans.length;i++) {
//				if(i<K) {
//					ans[i] = 1;
//				}else {
//					ans[i] = 100;
//				}
//			}
//		} else {
//			for (int i = 0; i < ans.length; i++) {
//				if (i <= K) {
//					if (i % 2 == 0) {
//						ans[i] = 1;
//					} else {
//						ans[i] = S - 1;
//					}
//				} else {
//					ans[i] = S + 1;
//				}
//			}
//		}

		out.println(join(" ", ans));
	}

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

	@SuppressWarnings("unused")
	private String join(String delimiter, int[] a) {
		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < a.length; i++) {
			sb.append(a[i]);
			sb.append(delimiter);
		}
		return sb.substring(0, Math.max(sb.length() - delimiter.length(), 0));
	}
}


Measured memory_bytes: 31456
#include<iostream>
using namespace std;
int main()
{
	int n, squares[105], ans=0; cin>>n;

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

		}
	for(int i=1; i<= n;++i)
	{
		if(squares[i]%2 !=0 && i %2 !=0) ans++;
	}
	cout<<ans<<endl;





}

Measured memory_bytes: 3584
#!/usr/bin/env python3

N, A, B, C = list(map(int, input().split()))
l_list = []

for _ in range(N):
    l = int(input().split()[0])
    l_list.append(l)


def cost(no, a_len, b_len, c_len):
    if no == N:
        # 最後のノードでは
        # 差分を延長魔法 or 短縮魔法で補う
        if min(a_len, b_len, c_len) <= 0:
            # 竹の長さを0以下にすることはできないので
            # このパターンはありえない
            return float("inf")

        a_cost = abs(a_len - A)
        b_cost = abs(b_len - B)
        c_cost = abs(c_len - C)
        # 最初にA,B,Cを選ぶときは余分に+10されているので、減らす
        return sum([a_cost, b_cost, c_cost]) - 30

    l = l_list[no]
    a_cost = 10 + cost(no + 1, a_len + l, b_len, c_len)
    b_cost = 10 + cost(no + 1, a_len, b_len + l, c_len)
    c_cost = 10 + cost(no + 1, a_len, b_len, c_len + l)
    d_cost = cost(no + 1, a_len, b_len, c_len)

    # このノードより上（以前）のルートは同じなので、
    # この時点で最小のものを1つだけ返せば良い
    return min([a_cost, b_cost, c_cost, d_cost])


ans = cost(0, 0, 0, 0)
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl;
#define printD(a) cout << setprecision(6) << (a) << endl;
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<int>& a,int n);

int n;

//重み付きUF
struct UnionFind_w {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> diff_weight;
    UnionFind_w(int n){ //最初は全てが根であるとして初期化
        init(n);
    }
    void init(int n) {
        par.resize(n);
        diff_weight.resize(n);
        REP(i,n){
            par[i] = i;
            diff_weight[i] = 0;
        }
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        int r = root(par[x]);
        if(par[par[x]] != par[x]) diff_weight[x] += diff_weight[par[x]];
        return par[x] = r;
    }

    int weight(int x){
        root(x);
        return diff_weight[x];
    }

    void unite(int x, int y,int w) { // xとyの木を併合
        w -= weight(x);
        w += weight(y);
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        diff_weight[rx] = w;
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int diff(int x,int y){
        return weight(x) - weight(y);
    }
};

signed main(){
    int n;
    cin >> n;
    vector<double> a(n);
    REP(i,n){
        cin >> a[i];
    }
    Sort(a);
    REP(i,n-1){
        a[i+1] = (double)(a[i]+a[i+1])/2;
    }
    print(a[n-1]);


    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<int>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
#define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        1e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}


int a[200002],b[200002];
void solve()
{

 int n,m,k;
 cin >> n >> m >> k;

 for(int i=1;i<=n;i++) cin >> a[i]; 
 for(int i=1;i<=m;i++) cin >> b[i];

 for(int i=2;i<=m;i++) b[i]+=b[i-1];

 int an = 0;

 
 int cur =0 ;
 b[m+2] = big;
 for(int i=0;i<=n;i++)
 {
   cur += a[i];
   if(cur > k ) break;
   int rm = k-cur;
   auto it = upper_bound(b,b+m+1,rm) - b;
   it--;
   an = max(an,i+it);
   //cout<<i<<" "<<it<<endl;
 }

 cout<<an<<endl; 
}


int32_t main()
{
 // pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

Measured memory_bytes: 6740
using System;

namespace A
{
	class Program
	{
		static void Main(string[] args)
		{
			string N = Console.ReadLine();
			for (int i = 0; i < N.Length; i++)
			{
				if (N[i] == '7')
				{
					Console.WriteLine("Yes");
					return;
				}
			}
			Console.WriteLine("No");
			return;
		}
	}
}


Measured memory_bytes: 25872
import math
def factrization_prime(number):
    factor = {}
    div = 2
    s = math.sqrt(number)
    while div < s:
        div_cnt = 0
        while number % div == 0:
            div_cnt += 1
            number //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
    if number > 1:
        factor[number] = 1
    return factor

N = int(input())
dic = factrization_prime(N)
ans = 0
for d in dic.keys():
    x = dic[d]
    minus = 1
    while(x>0):
        x -= minus
        minus += 1
        if x >= 0:
            ans += 1
print(ans)


Measured memory_bytes: 63396
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	int s=0;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if(a<b)
	{
		s+=a;
	}
	else
	{
		s+=b;
	}
	if(c<d)
	{
		s+=c;
	}
	else
	{
		s+=d;
	}
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)

{
    int H,h,W,w,a,b,c;

    scanf("%d%d",&H,&W);
    scanf("%d%d",&h,&w);

    if((1<=H)&&(H<=20)&&(1<=W)&&(W<=20)){
    if((1<=h)&&(h<=H)&&(1<=w)&&(w<=W)){

    a = H * W;
    b = h * W + w * H - h * w;

    c = a -b;

    printf("%d\n",c);
    }
    }
    return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> P;
#define INF 10000000000000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

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

	cout << ((N - 1) * N) / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

// 1行読み込み
func nextLine() string {
	sc.Scan()
	return sc.Text()
}

// 読み込みをint型へキャスト
func nextInt() int {
	sc.Scan()
	num, err := strconv.Atoi(sc.Text())
	if(err != nil) {
		panic(err)
	}
	return num
}

func main() {
	// scannerの挙動を改行区切り → 空白区切りに変更
	sc.Split(bufio.ScanWords)
	a, b := nextInt(), nextInt()

	fmt.Println(a * b)
}

Measured memory_bytes: 1756
#include <iostream>

using namespace std;

int main()
{
	int M, D;
	cin >> M >> D;

	int ans = 0;

	for (int m = 1; m <= M; ++m) {
		for (int d = 1; d <= D; ++d) {
			int d1 = d % 10;
			int d10 = d / 10;
			if (d1 >= 2 && d10 >= 2 && d1 * d10 == m) {
				++ans;
			}
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int q;
  cin >> q;
  vector<set<int>> table(26);
  rep(i,s.size()) table[s[i]-'a'].insert(i);
  rep(query,q){
    int com,l;cin >> com >> l;
    --l;
    if(com == 1){
      char ch;
      cin >> ch;
      //int i;
      // cin >> i >> ch;
      // --i;
      table[s[l]-'a'].erase(l);
      s[l] = ch;
      table[ch-'a'].insert(l);
    }else{
      int ans = 0;
      int r;cin >> r;--r;
      // int l,r;cin >> l >> r;
      // --r;--l;
      rep(j,26){
        set<int>::iterator it = table[j].lower_bound(l);
        if(it != table[j].end() && *it <= r) ans++;
      }
      printf("%d\n",ans);
    }
  }
}

Measured memory_bytes: 27216
#include <iostream>
using namespace std;
int main()
{
	int a, b, c;
		cin >> a >> b >> c;
	if (a > b) {
		if (c > b&&a > c)cout << "Yes" << "\n";
		else cout << "No" << "\n";
	}
	else {
		if (a < c&&c < b)cout << "Yes" << "\n";
		else cout << "No" << "\n";
	}
	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();


int main(void)
{
  int k,x; cin>>k>>x;
  if (k*500>=x)

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define x first
#define y second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ve vector
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define sz(a) (int)(a.size())
//using namespace __gnu_pbds;
using namespace std;

// // // functions: find_by_order  & order_of_key
// typedef tree<
// int,
// null_type,
// less<int>,
// rb_tree_tag,
// tree_order_statistics_node_update>
// ordered_set;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

const int inf=(int)2e9;
const long long mod=1000000007; //1E9+7
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

ll powmod(ll a,ll p){
	ll ans=1;
	while(p){
		if(p&1) ans*=a;
		p/=2;a*=a; ans%=mod;a%=mod;
	}
	return ans;
}
ll mdinv(ll a){return powmod(a,mod-2); }

signed main(){
	IOS
	string s,t;cin>>s>>t;
	int n=sz(s),m=sz(t);
	vvi D(n,vi(m));
	vvi p(n,vi(m)); //0 i 1 j 2 both
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			int h=0;
			if(s[i]==t[j]){
				if(i && j)
					h=1+D[i-1][j-1];
				else
					h=1;
				p[i][j]=2;
			}
			else{
				p[i][j]=0;
				if(i)
					h=max(h,D[i-1][j]);

				if(j){
					h=max(h,D[i][j-1]);
					if(h==D[i][j-1])
						p[i][j]=1;
				}
			}
			D[i][j]=h;
		}
	}
	string ans;
	int a=n-1,b=m-1;
	while(a>=0 && b>=0){
		if(p[a][b]==2) ans.pb(s[a]);
		if(p[a][b]==0) a--;
		else if(p[a][b]==1) b--;
		else a--,b--;
	}
	reverse(all(ans));
	cout<<ans;
}


Measured memory_bytes: 141184
package main

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

func main() {
	sc := NewScanner()

	n := sc.ReadInt()

	ans := false
	sameEyesCount := 0
	for i := 0; i < n; i++ {
		d1 := sc.ReadInt()
		d2 := sc.ReadInt()
		if d1 == d2 {
			sameEyesCount++
		} else {
			sameEyesCount = 0
		}

		if sameEyesCount == 3 {
			ans = true
		}
	}

	if ans {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

// from [my library](https://github.com/ikngtty/go-contestlib)
// -   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base, exponent int) int {
	if exponent < 0 {
		panic(fmt.Sprintf("exponent (%d) should not be a minus", exponent))
	}

	answer := 1
	for i := 0; i < exponent; i++ {
		answer *= base
	}
	return answer
}

func Ceil(divident, dividor int) int {
	if dividor == 0 {
		panic("dividor should not be 0")
	}

	quo := divident / dividor
	rem := divident % dividor

	if rem != 0 {
		if (divident > 0 && dividor > 0) ||
			(divident < 0 && dividor < 0) {
			return quo + 1
		}
	}
	return quo
}

// -   sortutil

func ReverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func ReverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// -   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}

func (sc *Scanner) ReadFloat() float64 {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.ParseFloat(text, 64)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 1776
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int N,i,cnt[9],cnt2;
vector<int> a;

inline void solve(){
  IN(N);
  a.resize(N);
  REP(i,N){
    IN(a[i]);
    if(a[i]<400)cnt[0]++;
    else if(a[i]<800)cnt[1]++;
    else if(a[i]<1200)cnt[2]++;
    else if(a[i]<1600)cnt[3]++;
    else if(a[i]<2000)cnt[4]++;
    else if(a[i]<2400)cnt[5]++;
    else if(a[i]<2800)cnt[6]++;
    else if(a[i]<3200)cnt[7]++;
    else cnt[8]++;
  }
  REP(i,8)if(cnt[i])cnt2++;
  if(cnt2)cout<<cnt2;
  else cout<<1;
  if(!cnt[8])cout<<" "<<cnt2<<endl;
  // else cout<<" "<<min(9,cnt2+cnt[8])<<endl;
  else cout<<" "<<cnt2+cnt[8]<<endl;
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

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

int main() { 
    int N;
    long long ans=0;
    cin >> N;
    vector<long long> A(N);
    rep(i, N) {
        cin >> A.at(i);
    }

    for(int i = 1; i < N; ++i) {
        if (A[i-1] > A[i]) {
            // 前の人が高い場合
            ans += A[i-1] - A[i];
            A[i] += A[i-1] - A[i];
        }
    }
    cout << ans << endl;



    return 0;
}


Measured memory_bytes: 4796
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define REP(var,init,cnt) for(int (var)=(init); (var)<=(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) (flag)?1:0
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

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

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

constexpr int MOD=1e9+7;

int main(void){
    int N,M; cin>>N>>M;
    val<ll> A(N); cin>>A;
    vec<pl> BC(M); cin>>BC;
    sort(begin(A),end(A));
    sort(all(BC),[](pl x,pl y){
        if(x.second==y.second) return x.first>y.first;
        return x.second>y.second;
    });
    
    int pnt=0,next=0;
    while(next<M){
        ll b,c; tie(b,c)=BC[next];
        //cout<<b<<" "<<c<<endl;
        rep(i,b){
            if(pnt+i>=N) goto END;
            if(A[pnt+i]>=c) goto END;
            A[pnt+i]=c;
        }
        pnt+=b,++next;
    }
    END :
    //cout<<A<<endl;
    cout<<A.sum()<<endl;
}












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

int h, w, x, y;

int main() {
    cin >> h >> w >> x >> y;

    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) cout << ((i<y) xor (j<x));
        cout << '\n';
    }
}

Measured memory_bytes: 1280
n=gets.chomp.to_i
ab=[]
for n in 1..n do
  ab<<gets.chomp.split(' ').map(&:to_i)
end

d=ab.sort {|a, b| a[1] <=> b[1] }
t=0
s='Yes'
for n in 0..(n-1) do
  now=d[n][0]+t
  if now > d[n][1]
    s='No'
    break
  end
  t=now
end
print("#{s}\n")

Measured memory_bytes: 19320
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int n, m, k;
    cin >> n >> m >> k;

    string ans = "No\n";
    eFOR(i, 0, n)FOR(j, 0, m) {
        int sum = i * m;
        sum += j * (n - i);
        sum -= i * j;
        if (sum == k)ans = "Yes\n";
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (){
	int h1, h2, m1, m2, k;
	scanf ("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
	int minutes1 = h1*60 + m1, minutes2 = h2*60 + m2;
	int totalMinutes = minutes2 - minutes1;
	printf ("%d\n", totalMinutes - k);
return 0;
}

Measured memory_bytes: 1696
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let s = sc.chars();
    let result: Vec<char> = (0..s.len()).map(|_| 'x').collect();
    for x in result.iter() {
        print!("{}", x);
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8444
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
typedef long long LL;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const LL N = 3005;

LL ec = 0,hed[N] = {0},nxt[N << 1],to[N << 1];
void add_edge(LL f,LL t){
	++ ec; to[ec] = t; nxt[ec] = hed[f]; hed[f] = ec;
}

LL dep[N],siz[N],l[N],r[N];
LL s[N],n; string t;
void dfs(LL u,LL f){
	LL sr = 0,id = 0;
	dep[u] = dep[f] + 1;
	if(s[u]) siz[u] = 1;
	for(LL i = hed[u];i;i = nxt[i]){
		LL v = to[i];
		if(v == f) continue;
		dfs(v,u);
		siz[u] += siz[v];
	}
	for(LL i = hed[u];i;i = nxt[i]){
		LL v = to[i];
		if(v == f) continue;
		l[v] += siz[v]; r[v] += siz[v];
		sr += r[v];
		if(l[v] > l[id]) id = v;
	}
	l[u] = max(0LL,l[id] + r[id] - sr); r[u] = sr;
}

LL solve(LL x){
	LL sum = 0; dep[0] = -1;
	for(LL i = 1;i <= n;i ++) l[i] = r[i] = siz[i] = 0;
	dfs(x,0);
	for(LL i = 1;i <= n;i ++) if(s[i]) sum += dep[i];
	if(l[x] == 0 && sum % 2 == 0) return sum / 2;
	return INF;
}

int main(){
	ios::sync_with_stdio(false);
	LL u,v,ans = INF;
	cin >> n;
	cin >> t; for(LL i = 0;i < n;i ++) s[i + 1] = t[i] - '0';
	for(LL i = 1;i < n;i ++){
		cin >> u >> v;
		add_edge(u,v);
		add_edge(v,u);
	}
	for(LL i = 1;i <= n;i ++) ans = min(ans,solve(i));
	if(ans == INF) ans = -1;
	cout << ans << '\n';
	return 0;
}
//

Measured memory_bytes: 512
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;

public class Main {
	static InputStream is;
	static PrintWriter out;
	static String INPUT = "";

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

	void solver() {
		String a="CODEFESTIVAL2016";
		String s=ns();
		int ans=0;
		for(int i=0;i<s.length();i++){
			if(a.charAt(i)!=s.charAt(i))ans++;
		}
		out.println(ans);
	}

	void run() {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		solver();
		out.flush();

	}

	static long nl() {
		try {
			long num = 0;
			boolean minus = false;
			while ((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'))
				;
			if (num == '-') {
				num = 0;
				minus = true;
			} else {
				num -= '0';
			}

			while (true) {
				int b = is.read();
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	static char nc() {
		try {
			int b = skip();
			if (b == -1)
				return 0;
			return (char) b;
		} catch (IOException e) {
		}
		return 0;
	}

	static double nd() {
		try {
			return Double.parseDouble(ns());
		} catch (Exception e) {
		}
		return 0;
	}

	static String ns() {
		try {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			if (b == -1)
				return "";
			sb.append((char) b);
			while (true) {
				b = is.read();
				if (b == -1)
					return sb.toString();
				if (b <= ' ')
					return sb.toString();
				sb.append((char) b);
			}
		} catch (IOException e) {
		}
		return "";
	}

	public static char[] ns(int n) {
		char[] buf = new char[n];
		try {
			int b = skip(), p = 0;
			if (b == -1)
				return null;
			buf[p++] = (char) b;
			while (p < n) {
				b = is.read();
				if (b == -1 || b <= ' ')
					break;
				buf[p++] = (char) b;
			}
			return Arrays.copyOf(buf, p);
		} catch (IOException e) {
		}
		return null;
	}

	public static byte[] nse(int n) {
		byte[] buf = new byte[n];
		try {
			int b = skip();
			if (b == -1)
				return null;
			is.read(buf);
			return buf;
		} catch (IOException e) {
		}
		return null;
	}

	static int skip() throws IOException {
		int b;
		while ((b = is.read()) != -1 && !(b >= 33 && b <= 126))
			;
		return b;
	}

	static boolean eof() {
		try {
			is.mark(1000);
			int b = skip();
			is.reset();
			return b == -1;
		} catch (IOException e) {
			return true;
		}
	}

	static int ni() {
		try {
			int num = 0;
			boolean minus = false;
			while ((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'))
				;
			if (num == '-') {
				num = 0;
				minus = true;
			} else {
				num -= '0';
			}

			while (true) {
				int b = is.read();
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}


Measured memory_bytes: 8148
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = input()
res = 0
for x in s:
    if x == '+':
        res += 1
    else:
        res -= 1
print(res)

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

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define pp pop_back()
#define ll long long
#define ld long double
#define ok puts("OK");
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

inline ll min(ll a, ll b) {
    return (a > b) ? b : a;
}

inline ll max(ll a, ll b) {
    return (a > b) ? a : b;
}

const int N = 2e5 + 7;
const int inf = 1e9 + 7;
const ll linf = 1e18 + 9;

int n, m;

vector < int > v;

int main() {
    scanf ("%d", &n);
    for (int i = 1; i <= n; i++) {
        int d; scanf ("%d", &d);
        v.pb(d);
    }
    sort(all(v));
    scanf ("%d", &m);
    for (int i = 1; i <= m; i++) {
        int t; scanf ("%d", &t);
        if (upper_bound(all(v), t) - v.begin() == lower_bound(all(v), t) - v.begin()) {
            puts("NO"); return 0;
        }
        v.erase(v.begin() + (lower_bound(all(v), t) - v.begin()));
    }
    puts("YES");
}


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

int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

int n, k;
int a[400005];
int lmx[400005], rmn[400005];
int bb[400005], l[400005];
int main() {
    n = read(), k = read();
    for (int i = 1; i <= n; ++i) a[i] = read();
    for (int i = 1; i <= n; ++i) {
        lmx[i] = i;
        while (lmx[i] > 1 && a[i] > a[lmx[i] - 1]) lmx[i] = lmx[lmx[i] - 1];
    }
    for (int i = n; i >= 1; --i) {
        rmn[i] = i;
        while (rmn[i] < n && a[i] < a[rmn[i] + 1]) rmn[i] = rmn[rmn[i] + 1];
    }

    int res = 1, tb = 0;
    bb[1] = ((l[1] = 1) >= k);
    for (int i = 2; i <= n; ++i) {
        l[i] = (a[i] > a[i - 1]) ? l[i - 1] + 1 : 1;
        // cerr << l[i] << endl;
        bb[i] = (l[i] >= k);
        if (bb[i] && !tb) tb = 1;
    }

    res += (bb[k] != 1) * tb;
    for (int i = k + 1; i <= n; ++i) {
        if (bb[i]) continue;
        res++;
        if ((lmx[i] <= i - k && rmn[i - k] >= i)) res--;
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 6400
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <vector>
#include <stack>
using namespace std;
typedef long long ll;
ll a, b, c, d;

int main(){
    cin >> a >> b >> c >> d;
    ll e = a * c;
    ll f = a * d;
    ll g = b * c;
    ll h = b * d;
    cout << max(max(e, f), max(g, h)) << '\n';
    return 0;
}


Measured memory_bytes: 3636
# https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/1/DSL_1_A


class UnionFind:

    def __init__(self, size: int):
        # 負の値はルート (集合の代表) で集合の個数
        # 正の値は次の要素を表す
        self.size = size
        self.parent = [-1] * size

    def find(self, x: int) -> int:
        """
        xを含む集合の代表を求める
        """
        if self.parent[x] < 0:
            return x
        # 集合の代表にリンクを繋ぎ変える
        same_group_items = []
        while self.parent[x] >= 0:
            same_group_items.append(x)
            x = self.parent[x]
        for child in same_group_items:
            self.parent[child] = x
        return x

    def unite(self, x: int, y: int):
        """
        xを含む集合とyを含む集合を併合する
        """
        root_x = self.find(x)
        root_y = self.find(y)
        if root_x != root_y:
            if self.parent[root_x] >= self.parent[root_y]:
                self.parent[root_x] += self.parent[root_y]
                self.parent[root_y] = root_x
            else:
                self.parent[root_y] += self.parent[root_x]
                self.parent[root_x] = root_y

    def same(self, x: int, y: int):
        return self.find(x) == self.find(y)


def solve():
    n, q = map(int, input().split())
    uf = UnionFind(n)
    for _ in range(q):
        com, x, y = map(int, input().split())
        if com == 0:
            uf.unite(x, y)
        else:
            print(1 if uf.same(x, y) else 0)


if __name__ == "__main__":
    solve()



Measured memory_bytes: 6048