akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define D_SIZE 100
using namespace std;

int main()
{
  while(1){
    int N, Q;
    cin >> N >> Q;
    if(N == 0 && Q == 0){
      break;
    }else{
      int D[D_SIZE + 1];
      fill(D, D + D_SIZE + 1, 0);
      int M, x;
      REP(i, N){
        cin >> M;
        REP(j, M){
          cin >> x;
          D[x]++;
        }
      }
      x = 0;
      REP(i, D_SIZE)
        if(D[i] >= Q && D[i] > D[x])
          x = i;
      cout << x << endl;
    }
  }
}

Measured memory_bytes: 1160
package main

import (
	"fmt"
	"sort"
	"strconv"
)

var memo []int

func solve(v int) int {
	if v == 6174 {
		return 0
	}
	if memo[v] == 0 {
		a := make([]int, 4)
		for i := 0; i < 4; i++ {
			a[i] = v % 10
			v /= 10
		}
		sort.Slice(a, func(i, j int) bool {
			return a[i] > a[j]
		})
		l := int(0)
		for i := 0; i < 4; i++ {
			l *= 10
			l += a[i]
		}
		sort.Slice(a, func(i, j int) bool {
			return a[i] < a[j]
		})
		s := int(0)
		for i := 0; i < 4; i++ {
			s *= 10
			s += a[i]
		}
		memo[v] = solve(l-s) + 1
	}
	return memo[v]
}

func main() {
	var v int
	memo = make([]int, 10000)
	for {
		var s string
		fmt.Scan(&s)
		v, _ = strconv.Atoi(s)
		if v == 0 {
			break
		}
		if v%1111 == 0 {
			fmt.Println("NA")
			continue
		}
		fmt.Println(solve(v))
	}
}



Measured memory_bytes: 5828
#include<stdio.h>
#include<algorithm>
#include<string.h>

using namespace std;

char str[5];

int main(void)
{
	scanf("%s",str);
	int l = strlen(str);
	if(l==2) printf("%s",str);
	else
	{
		for(int i=l-1;i>=0;i--)
			printf("%c",str[i]);
	}
	return 0;
}

Measured memory_bytes: 128
function dist(s,N,G)
	ret=ones(Int,N)*1145141919
	queue=Int[s]
	ret[s]=0
	while !isempty(queue)
		u=shift!(queue)
		for v=G[u]
			if ret[v]>ret[u]+1
				ret[v]=ret[u]+1
				push!(queue,v)
			end
		end
	end
	ret
end
function main()
	N,T,A=map(x->parse(Int,x),split(readline()))
	G=[Int[] for _=1:N]
	for s=readlines()
		u,v=map(x->parse(Int,x),split(s))
		push!(G[u],v)
		push!(G[v],u)
	end
	td=dist(T,N,G)
	ad=dist(A,N,G)
	ans=0
	for i=1:N
		if td[i]<ad[i]
			ans=max(ans,ad[i]-1)
		end
	end
	println(ans)
end
main()


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repiins(x, y, z, s) for ((x) = (z); (x) <= (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define repit2(x) for (__typeof((x).begin()) it2 = (x).begin(); it2 != (x).end(); it2++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

// can be applied to string type
#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
template<typename T>
void Debug(const T &val) { cerr << val << End; }
template<typename T, typename... Args>
void Debug(const T &val, Args... args) {
    cerr << val << ' ';
	Debug(std::forward<Args>(args)...);
}

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

// can be applied to string type
#define Sort(v) sort(All(v))
#define SortR(v) sort(All(v), std::greater<__typeof(v[0])>())
// array sorters
#define Sart(a) sort(a, a + sizeof(a) / sizeof(__typeof(a[0])));
#define SartR(a) sort(a, a + sizeof(a) / sizeof(__typeof(a[0])), std::greater<__typeof(a[0])>())

#define pb push_back
#define mp make_pair
#define a first
#define b second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    long n, a, b;
	string s;

	cin >> n >> a >> b;
	cin >> s;

	long c = a + b;
	char ch;
	long pass = 0;
	long rank = 0;

	long i;

	rep(i, n) {
		ch = s[i];

		if (pass < c) {
			if (ch == 'a') {
				Out("Yes");

				pass++;
			} else if (ch == 'b') {
				rank++;

				if (rank <= b) {
					Out("Yes");
					
					pass++;
				} else {
					Out("No");
				}
			} else {
				Out("No");
			}
		} else {
			Out("No");
		}
	}
	
	return 0;
}


Measured memory_bytes: 848
#include<bits/stdc++.h>
using namespace std;
int n;
int c[500];
int s[500];
int f[500];
int ans[500];
 
int main(){
    cin>>n;
    for(int i=0;i<n-1;i++){
        cin>>c[i]>>s[i]>>f[i];
    }
    for(int i=n-2;i>=0;i--){
        int time=s[i]+c[i];
        if(i==n-2){
            ans[i]=time;
            continue;
        }
        for(int j=i+1;j<n-1;j++){
            if(s[j]>=time){
                ans[i]=ans[j];
                break;
            }
            else{
              
              
                if(time%f[j]==0) time=time+c[j];
                else time=(time/f[j]+1)*f[j]+c[j];
                if(j==n-2) ans[i]=time;
            }
        }
    }
  
  
    ans[n-1]=0;
    for(int i=0;i<n;i++){
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    int ans = inf;
    for(int i = -101; i <= 101; ++ i) {
        int res = 0;
        rep(j, n) {
            res += (i - a[j]) * (i - a[j]);
        }
        chmin(ans, res);
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define deb(a) cout << #a << ": " << a << ENDL;
#define all(a) begin(a), end(a)
#define sz(a) (int)(a.size())
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,fma")

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;

lli INF = 1e16;

struct LazySegTree {
    #define mid (l + r) / 2
    #define left(u) (u + 1)
    #define right(u) (u + ((mid - l + 1) << 1 ))

    struct Node{
        lli s, lazy;
        Node(lli s = 0, lli lazy = 0): s(s), lazy(lazy){}
        Node operator+(const Node &n) const {
            return Node(s + n.s, 0);
        }
    };

    int n;
    Node z;
    vector<Node> st;

    LazySegTree(int n): n(n) {
        st.resize(2 * n);
    }

    void push(int u, int l, int r) {
        if(st[u].lazy) {
            st[left(u)].s += st[u].lazy;
            st[right(u)].s += st[u].lazy;
            st[left(u)].lazy += st[u].lazy;
            st[right(u)].lazy += st[u].lazy;
            st[u].lazy = 0;
        }
    }

    void update(int u, int l, int r, int ll, int rr, lli x) {
        if(r < ll or l > rr or l > r) return;
        if(ll <= l and r <= rr) {
            st[u].s += x;
            st[u].lazy += x;
            return;
        }
        push(u, l, r);
        update(left(u), l, mid, ll, rr, x);
        update(right(u), mid + 1, r, ll, rr, x);
        st[u] = st[left(u)] + st[right(u)];
    }

    lli query(int u, int l, int r, int ll, int rr) {
        if(r < ll or rr < l or r < l) return 0;
        if(ll <= l and r <= rr) return st[u].s;
        push(u, l, r);
        return query(left(u), l, mid, ll, rr) + query(right(u), mid + 1, r, ll, rr);
    }
};


int main()
{   //_
    lli n, q, num, l, r; cin >> n >> q;
    vi v(n);
    vector<vector<int>> mat(n);
    fore(i, 0, n) {
        cin >> v[i]; --v[i];
        mat[v[i]].pb(i);
    }
    vector<int> cnt(n);
    vector<int> cur(n, 0);
    fore(i, 0, n) cnt[i] = sz(mat[i]);
    fore(i, 0, n) mat[i].pb(n);
    LazySegTree segtree(n + 1);
    fore(i, 0, n) {
        segtree.update(0, 0, n - 1, mat[i][0], mat[i][cnt[i]], 1);
    }
    vector<lli> ans(q);
    vector<vector<ii>> queries(n);
    fore(i, 0, q) {
        cin >> l >> r; --l;--r;
        queries[l].pb({r, i});
    }
    fore(i, 0 ,n) {
        for(auto it : queries[i]) {
            ans[it.s] = segtree.query(0, 0, n - 1, it.f ,it.f);
        }
        if(cur[v[i]] > cnt[v[i]]) continue;
        ++cur[v[i]];
        segtree.update(0, 0, n - 1, i, mat[v[i]][cur[v[i]]] - 1, -1);
    }
    fore(i, 0, q) cout << ans[i] << ENDL;
    return 0;
}


Measured memory_bytes: 85272
import java.util.Scanner;
import java.util.Arrays;

class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int n = 0;
		for(int i = 0; i <= a; i++){
			n += i;
		}
		System.out.println(n);
		in.close();

	}

}

Measured memory_bytes: 10068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll b[70];
ll f[70];
void init(){
	b[0]=1;
	for(int i=1;i<=60;i++)b[i]=b[i-1]*2;
	f[0]=1;
	for(int i=1;i<=60;i++)f[i]=1+(f[i-1]*2);
}
int main(int argc, char const *argv[])
{
	init();
	ll h;cin>>h;
	int id=60;
	for(;id>=0;id--){
		if(b[id]<=h){break;}
	}
	printf("%lld\n",f[id]);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
//int dx[]={+1,-1,+0,+0};///Four Directions
//int dy[]={+0,+0,+1,-1};///Four directions
//int dx [] = {+1,-1,+0,+0,-1,-1,+1,+1};///Eight Directions
//int dy [] = {+0,+0,+1,-1,+1,-1,-1,+1};///Eight Directions

//int mark[10007];vi prime;void seive(){for(int i=2;i<10000;i++){if(mark[i]==0){prime.pb(i);for(int j=i+i;j<=10000;j+=i)mark[j]=1;}}}

//freopen("input.txt", "r", stdin);



int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

   ll a,b,c,d;
   cin>>a>>b>>c>>d;
   bool f=1;
   while(1) {
    if(f) {
      c=c-b;
      if(c<1){
        cout<<"Yes"<<endl;
        return 0;
      }
      f=0;
    }

    else {
        a-=d;
        if(a<1){
        cout<<"No"<<endl;
        return 0;
      }
      f=1;
    }
   }

   End;
}


Measured memory_bytes: 3652
#!/usr/bin/env python3
import sys
from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def main():
    n, m, k = MI()
    a = deque(LI())
    b = deque(LI())

    A, B = [0], [0]

    for i in range(len(a)):
        A.append(A[i]+a[i])
    for i in range(len(b)):
        B.append(B[i]+b[i])

    index = m
    ans = [0]
    for i in range(len(a)+1):
        rest = k - A[i]
        if rest < 0:
            break

        while B[index] > rest:
            index -= 1

        ans.append(i + index)

    print(max(ans))


    # oj t -c "pypy3 main.py"
    # acc s main.py -- --guess-python-interpreter pypy
main()


Measured memory_bytes: 141416
#include <bits/stdc++.h>
#include <math.h>
#include <regex>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    ld n,m,d;
    cin >> n >> m >> d;
    ld ans;
    if(d){
        ans = 2.0*(n-d)*(m-1)/(n*n);
    }else{
        ans = (m-1)/n;                
    }
    cout << setprecision(15) << ans << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define MO(a) AS_MOD(a,mod)
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define PrintArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;
#define PrintPairs(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i].fi <<"," << cont[__i].se<<")";} cout<<endl;
#define Print(v) cout<<v<<endl;
#define PDBG() cout<<"Line:"<<__LINE__<<endl;
#define PrintArray2D(cont, fh, th, fw, tw) for(int __i=fh;__i<th;++__i){for(int __j=fw;__j<tw;++__j) {cout<<cont[__i][__j]<<" ";} cout<<endl;}cout<<endl;
#define Resize2D(cont,H,W,V) cont.resize(H);for(int i=0;i<H;++i)cont[i].resize(W,V);
#define Resize3D(cont,H,W,D,V) cont.resize(H);for(int i=0;i<H;++i)cont[i].resize(W);for(int i=0;i<H;++i)for(int j=0;j<W;++j)cont[i][j].resize(D,V);
/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 * priority_queue<int,vector<int>, greater<int>> Q;
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
/*
struct PairComp{
    int operator()(P l, P r) const {
        return l.fi==r.fi?l.se<r.se:l.fi<r.fi;
    }
};*/
struct Vec;
//set<int, Comparator> S;

// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
int main() {
    cout.precision(15);
    cout << fixed;
    ll N;
    cin >> N;
    ll v=26;
    ll s=0;
    ll d=0;
    ll z=0;
    while(s<N) {
        z=N-s;
        s+=v;
        v*=26;
        ++d;
    }
    --z;
    string ans;
    REP(i,d)
        ans+="a";
    for(ll it=0;it<d;++it) {
        ans[it]+=z%26;
        z/=26;
    }
    reverse(ALL(ans));
    cout<<ans<<endl;

}


Measured memory_bytes: 3584
#include<stdio.h>

int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a==b)
    {
        printf("a == b\n");
    }
    else if(a>b)
    {
        printf("a > b\n");
    }
    else if(a<b)
    {
        printf("a < b\n");
    }
    return 0;
}



Measured memory_bytes: 2100
#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>;

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;}

const long long INF = 1LL << 60;


int main(void){
	int n,m;cin >> n >> m;
	rep(i,m){
		int a;cin >> a;
		n -= a;
	}
	if(n>=0)cout << n << endl;
	else cout << -1 << endl;
	return 0; 
}


Measured memory_bytes: 3624
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	vector<int> a(n), b(n);
	long long sum_a = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		sum_a += a[i];
	}

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

	if (sum_a > sum_b) {
		cout << "No\n";
		return 0;
	}

	long long needed = 0;
	for (int i = 0; i < n; ++i) {
		if (a[i] < b[i]) {
			needed += ceil((double) (b[i] - a[i]) / 2);
		}
	}

	if (needed <= sum_b - sum_a) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}

	return 0;

}

Measured memory_bytes: 3716
#include<stdio.h>
int main()
{
	int w,h,i,j,N=100000;
	while(scanf("%d%d",&w,&h),w)
	{
		struct S{int e1,e2,n1,n2;}a[102][102],s;
		s.e1=s.e2=s.n1=s.n2=0;
		for(i=0;i<h;++i)for(j=0;j<w;++j)a[i][j]=s;
		a[0][0].n2=a[0][0].e2=1;
		for(i=0;i<h;++i)for(j=0;j<w;++j)
		{
			s=a[i][j];
			a[i][j+1].e1=(a[i][j+1].e1+s.e1+s.e2)%N;
			a[i][j+1].e2=s.n1;
			a[i+1][j].n1=(a[i+1][j].n1+s.n1+s.n2)%N;
			a[i+1][j].n2=s.e1;
		}
		s=a[h-1][w-1];
		printf("%d\n",(s.e1+s.e2+s.n1+s.n2)%N);
	}
	return 0;
}

Measured memory_bytes: 920
using System;
class Tenka1_2019_C
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();

        int[] black = new int[N];
        int[] white= new int[N];

        int blackCount = 0;
        for (int i = 0; i < N; i++)
        {
            if(S[i]=='#') { blackCount++; }
            black[i] = blackCount;
            white[i] = (i+1) - blackCount;
        }

        if(black[N-1]==0 || white[N-1] == 0)
        {
            Console.WriteLine("0");
            return;
        }

        int min = int.MaxValue;
        for (int i = 0; i < N; i++)
        {
            if (S[i] == '.')
            {
                // 白
                if (black[N-1] < min) min = black[N-1];
            }
            else
            {
                // 黒
                int left = black[i] - 1;
                int right = white[N - 1] - white[i];

                if (left + right < min) min = left + right;
            }
        }

        Console.WriteLine(min);
    }
}


Measured memory_bytes: 13280
while True:
    [H, W] = [int(x) for x in raw_input().split()]
    if [H, W] == [0, 0]:
        break
    print('#' * W)
    counter = 0
    while counter < H - 2:
        print('#' + '.' * (W - 2) + '#')
        counter += 1
    print('#' * W + '\n')

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, m; cin >> n >> m;
	vector<string> s(n);
	for (int i = 0; i < n; i++) cin >> s[i];
	vector<bool> f1(n, true), f2(m, true);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (s[i][j] == '#') {
				f1[i] = false;
				f2[j] = false;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		if (f1[i]) continue;
		for (int j = 0; j < m; j++) {
			if (f2[j]) continue;
			cout << s[i][j];
		}
		cout << "\n";
	}
	return 0;
}


Measured memory_bytes: 3636
N = int(input())

for h in range(1, 3501):
  for n in range(1, 3501):
    a = (4 * h * n) - N * h - N * n
    if a <= 0:
      continue
    w = (N * h * n) / a
    if w.is_integer() and 0 < w:
      print(h, n, int(w))
      exit(0)

Measured memory_bytes: 9152
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var (A, B, C, D) = Read4Longs();
            return A * B > C * D ? A * B : C * D;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 28204
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1e9 + 7;
const int N = 100010;
VI e[N];
ll dp[N][2];

void dfs(int now, int past){
    dp[now][0] = dp[now][1] = 1;
    for (int next : e[now]){
        if (next == past) continue;
        dfs(next, now);
        (dp[now][0] *= (dp[next][0] + dp[next][1])) %= mod;
        (dp[now][1] *= dp[next][0]) %= mod;
    }
}

int main() {
    int n;
    cin >> n;
    REP(i,n-1){
        int u = in() - 1, v = in() - 1;
        e[u].push_back(v);
        e[v].push_back(u);
    }
    dfs(0, -1);
    ll ans = (dp[0][0] + dp[0][1]) % mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 14208
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ull unsigned long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
ll n,a[100005],dp[3000][3000]={0};
ll g(int f,int l)
{
	if(dp[f][l]!=-1)
		return dp[f][l];
	if(f==l)
		return dp[f][l]=a[f];
	if(f+1==l)
		return dp[f][l]=max(a[f],a[l]);
	return dp[f][l]=max(a[f]+min(g(f+2,l),g(f+1,l-1)),a[l]+min(g(f,l-2),g(f+1,l-1)));
	
}
int main()
{fast
	cin>>n;
	ll i,sum=0;
	memset(dp,-1,sizeof(dp));
	for(i=0;i<n;i++){cin>>a[i];
	sum+=a[i];
	}
 	ll ans=2*g(0,n-1)-sum;
 	cout<<ans<<endl;
	
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<map>
#include<math.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    int n;
    cin >> n;
    v_int a(n+1), b(n+1);
    
    irep2(i,1,n) {
        cin >> a[i];
    }

    for(int i = n; i >= 1; i--) {
        int cnt = 0;
        for(int j = i; j <= n; j += i) {
            if(b[j]) { cnt++; }    
        }
        if(cnt % 2 != a[i]) {
            b[i] = 1;
        }
    }
    int m = 0;
    irep2(i,1,n) {
        if(b[i]) { m++; }
    }

    cout << m << endl;
    irep2(i,1,n) {
        if(b[i]) { cout << i << " "; }
    }

    return 0;
} /*atcoder*/


Measured memory_bytes: 4756
S=input()
dp=[False]*(len(S)+1)
dp[0]=True
for i in range(len(S)):
    if i>=4 and S[i-4:i+1]=="dream":
        dp[i+1]|=dp[i-4]
    if i>=4 and S[i-4:i+1]=="erase":
        dp[i+1]|=dp[i-4]
    if i>=6 and S[i-6:i+1]=="dreamer":
        dp[i+1]|=dp[i-6]
    if i>=5 and S[i-5:i+1]=="eraser":
        dp[i+1]|=dp[i-5]
print("YES" if dp[len(S)] else "NO")

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

#define INF (1<<18)

ll f(ll n){
    if(n == 1) return 1;
    else return 2*f(n/2) + 1;
}


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

    cout<<setprecision(30)<<f(h)<<endl;
    return 0;
}

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

using namespace std;

using ll = long long int;

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

inline
ll gcd(ll a, ll b)
{
    if (a < b) swap(a, b);
    if (b == 0){
        return a;
    }else{
        return gcd(b, a % b);
    }
}

int main()
{
    scanLLInt(N);
    scanLLInt(M);
    string S;
    string T;
    cin >> S;
    cin >> T;
    const ll g = gcd(N, M);
    const ll ng = N / g;
    const ll mg = M / g;
    const ll lcm = ng * mg * g;
    bool flag = true;
    REP(i, g){
        if (S[ng * i] != T[mg * i]){
            flag = false;
            break;
        }
    }
    if (flag){
        cout << lcm << endl;
    }else{
        cout << "-1" << endl;
    }
}

Measured memory_bytes: 512
#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>;

const int MAX_N = 200005;
const int INF = 1001001001;

vector<int> a, ans;
vector<int> to[MAX_N];
int dp[MAX_N];

void dfs(int v, int p = -1) {
	int i = lower_bound(dp, dp + MAX_N, a[v]) - dp;
	int old = dp[i];
	dp[i] = a[v];
	//ans[v] = i;
	//if (p != -1) ans[v] = max(ans[v], ans[p]);
	ans[v] = lower_bound(dp, dp + MAX_N, INF) - dp -1;
	for (int u : to[v]) {
		if (u == p) continue;
		dfs(u, v);
	}
	dp[i] = old;
}

int main() {
	int n;
	cin >> n;
	a = ans = vector<int>(n);
	rep(i, n) cin >> a[i];
	rep(i, n - 1) {
		int u, v;
		cin >> u >> v;
		--u; --v;
		to[v].push_back(u);
		to[u].push_back(v);
	}
	rep(i, MAX_N) dp[i] = INF;
	dp[0] = -INF;
	dfs(0);
	rep(i, n) cout << ans[i] << endl;
	return 0;
}

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

int main() {
    int N,x,y;
    cin>>N;
    vector<string> W(N);
    for(int i=0;i<N;i++){
        cin>>W.at(i);
    }
    for(int i=0;i<N;i++){
        if(i!=0){
            //x=W.at(i).size();
            y=W.at(i-1).size();
            if(W.at(i).at(0)!=W.at(i-1).at(y-1)){
                cout<<"No"<<endl;
                return 0;
            }
        }
        for(int j=0;j<N;j++){
            if(j!=i){
                if(W.at(i)==W.at(j)){
                    cout<<"No"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"Yes"<<endl;
return 0;}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n; cin >> n;
    vector<vector<ll>> g(n);
    vector<ll> deg(n, 0);
    REP(i, n-1) {
        ll a, b; cin >> a >> b;
        a--; b--; // 0-indexed
        g[a].push_back(b);
        g[b].push_back(a);
        deg[a]++;
        deg[b]++;
    }
    vector<ll> c(n); REP(i, n) cin >> c[i];
    vector<ll> ans_c(n, -1);
    sort(ALL_OF(c));
    
    deque<ll> q = {0};
    vector<bool> vst(n, false);
    vst[0] = true;
    ll hun = n;
    while (!q.empty()) {
        ll v = q.front();
        q.pop_front();
        ans_c[v] = c[--hun];
        for (ll tonari : g[v]) {
            if (!vst[tonari]) {
                q.push_back(tonari);
                vst[tonari] = true;
            }
        }
    }

    cout << accumulate(ALL_OF(c), 0LL) - *max_element(ALL_OF(c)) << endl;
    REP(i, n) cout << ans_c[i] << " \n"[i == i_len-1];

}

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

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair

const int MAX_N = 8;

int N, P[MAX_N], Q[MAX_N];

int perm[MAX_N];

int main() {
    cin >> N;
    REP(i, N) cin >> P[i];
    REP(i, N) cin >> Q[i];
    REP(i, N) perm[i] = i+1;

    int a, b;
    int cnt = 0;
    do {
        bool is_P = true, is_Q = true;
        REP(i, N) {
            if (perm[i] != P[i]) is_P = false;
            if (perm[i] != Q[i]) is_Q = false;
        }
        if (is_P) a = cnt;
        if (is_Q) b = cnt;
        cnt++;
    } while (next_permutation(perm, perm + N));
    int ans = abs(a - b);
    PRINT(ans);
    return 0;
}

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

using namespace std;

int n, w, weight, value, sol;
vector <long long> dp(nmax, INT_MAX);

int main() {
    dp[0] = 0;

    cin >> n >> w;
    while (n--) {
        cin >> weight >> value;

        for (int j = nmax - value; j >= 0; --j)
            dp[j + value] = min(dp[j + value], dp[j] + weight);
    }

    for (int i = 0; i < nmax; ++i)
        if (dp[i] <= w)
            sol = max(sol, i);

    cout << sol;
    return 0;
}

Measured memory_bytes: 3740
using System;
using System.Collections.Generic;
using System.Linq;
//using System.Numerics;
class Program
{       
    public void Slove()
    {
        int n = int.Parse(Console.ReadLine());
        int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int odd = array.Count(x => (x & 1) == 1);
        if(odd % 2 == 0)
        {
            System.Console.WriteLine("YES");
        }
        else
        {
            System.Console.WriteLine("NO");
        }

    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


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

using namespace std;
int power[3005];
vector<int> AdjList[3005];
set<int> ans;

bool DFS(int u)
{
    for(int v:AdjList[u])
    {
        if(power[u]>power[v]&&!DFS(v))
            return 1;
    }
    return 0;
}

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

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

    for(int i=1; i<n; i++)
    {
        int u,v;
        cin>>u>>v;
        AdjList[u].push_back(v);
        AdjList[v].push_back(u);
    }

    for(int i=1;i<=n;i++)
    {
        if(DFS(i))
            cout<<i<<' ';
    }
}


Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
long long a[200010], ans = 0, ans1 = 0;
int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] -= i + 1;
	}
	sort(a, a + n);
	for (int i = 0; i < n; i++)
		ans += abs(a[i] - a[n / 2]);
	if (n % 2) ans1 = ans + 1;
	else for (int i = 0; i < n; i++)
		ans1 += abs(a[i] - a[n / 2 - 1]);
	cout << min(ans, ans + 1) << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;

typedef long long ll;
const int INF = 1e8;
// const ll INF = 1LL << 60;
typedef pair<int, int> P;

// const int mod = 1000000007;
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

ll N, S;
vector<ll> A;

mint dp[3010][3010][3];

int main() {
    cin >> N >> S;
    A.resize(N);

    mint ans = 0;

    rep(i, N) cin >> A[i];

    dp[0][0][0] = 1;
    // 0: LもRも決まっていない
    // 1: L は決まった
    // 2: L、Rが決まった

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= S; j++) {
            // 配らない
            dp[i + 1][j][0] += dp[i][j][0];
            dp[i + 1][j][1] += dp[i][j][1];
            dp[i + 1][j][2] += dp[i][j][2];

            // 配る
            if (j + A[i] <= S) {
                // from 0 
                dp[i + 1][j + A[i]][1] += dp[i][j][0] * (i + 1);
                dp[i + 1][j + A[i]][2] += dp[i][j][0] * (i + 1) * (N - i);

                // from 1 
                dp[i + 1][j + A[i]][1] += dp[i][j][1];
                dp[i + 1][j + A[i]][2] += dp[i][j][1] * (N - i);
            } 
        }
    }
    ans = dp[N][S][2];

    cout << ans << endl;
}

Measured memory_bytes: 212608
import math as ma
# import statistics as stat
while True:
    n = int(input())

    if (n == 0):
        break

    score = list(map(int,input().split()))
    m = sum(score)/len(score)
    tmp = [0]*len(score)
    for i in range(len(score)):
        tmp[i] = float((score[i]-m)**2)

    s = sum(tmp)
    div =ma.sqrt(s/len(score))
    print(div)



Measured memory_bytes: 5712
#include <iostream>
#include <vector>
#include <functional>
#include <limits>

template <class Data, class Operator>
class LazySegmentTree {
    using DataMerger = std::function<Data(Data, Data)>;
    using OperatorMerger = std::function<Operator(Operator, Operator)>;
    using Applier = std::function<Data(Data, Operator, int)>;

public:
    int length;
    std::vector<Data> dat;
    std::vector<Operator> ope;
    Data dat_id;
    Operator ope_id;
    DataMerger datm;
    OperatorMerger opem;
    Applier app;

    explicit LazySegmentTree(int N, Data dat_id, Operator ope_id, DataMerger datm, OperatorMerger opem, Applier app)
        : length(1), dat_id(dat_id), ope_id(ope_id), datm(datm), opem(opem), app(app) {
        while (length < N) length *= 2;
        dat.assign(length * 2, dat_id);
        ope.assign(length * 2, ope_id);
    }

    void eval(int nidx, int len) {
        if (ope[nidx] == ope_id) return;
        // 子に作用素を伝播
        if (nidx * 2 + 1 < length * 2) {
            ope[nidx * 2] = opem(ope[nidx * 2], ope[nidx]);
            ope[nidx * 2 + 1] = opem(ope[nidx * 2 + 1], ope[nidx]);
        }
        // 値に作用素を反映
        dat[nidx] = app(dat[nidx], ope[nidx], len);
        ope[nidx] = ope_id;
    }

    // half-open interval [ql, qr)
    Data update(int ql, int qr, Operator e) { return update(ql, qr, e, 1, 0, length); }
    Data update(int ql, int qr, Operator e, int nidx, int nl, int nr) {
        eval(nidx, nr - nl);
        if (nr <= ql || qr <= nl) return dat[nidx];
        if (ql <= nl && nr <= qr) {
            ope[nidx] = opem(ope[nidx], e);
            return app(dat[nidx], ope[nidx], nr - nl);
        }
        // 子を再帰的に更新
        Data vl = update(ql, qr, e, nidx * 2, nl, (nl + nr) / 2);
        Data vr = update(ql, qr, e, nidx * 2 + 1, (nl + nr) / 2, nr);
        // 子の更新後から値を更新
        return dat[nidx] = datm(vl, vr);
    }

    // half-open interval [ql, qr)
    Data query(int ql, int qr) { return query(ql, qr, 1, 0, length); }
    Data query(int ql, int qr, int nidx, int nl, int nr) {
        eval(nidx, nr - nl);
        if (nr <= ql || qr <= nl) return dat_id;
        if (ql <= nl && nr <= qr) return dat[nidx];
        Data vl = query(ql, qr, nidx * 2, nl, (nl + nr) / 2);
        Data vr = query(ql, qr, nidx * 2 + 1, (nl + nr) / 2, nr);
        return datm(vl, vr);
    }
};

using ll = long long;
const ll INF = std::numeric_limits<ll>::max();

int main() {
    int N, Q;
    std::cin >> N >> Q;
    LazySegmentTree<ll, ll> seg(N, 0, -INF,
                                [](ll a, ll b) { return a + b; },
                                [](ll e, ll f) { return (f == -INF ? e : f); },
                                [](ll a, ll e, int k) { return (e == -INF ? a : e * k); });

    for (int q = 0; q < Q; ++q) {
        int k;
        std::cin >> k;
        if (k == 0) {
            int l, r;
            ll x;
            std::cin >> l >> r >> x;
            seg.update(l, r + 1, x);
        } else {
            int l, r;
            std::cin >> l >> r;
            std::cout << seg.query(l, r + 1) << std::endl;
        }
    }
    return 0;
}



Measured memory_bytes: 7052
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
ll k=1e9+7;
ll powe(ll x,ll y){
	x%=k;ll s=1;
	while(y){
		if(y%2) s=(s*x)%k;
		y/=2;x=(x*x)%k;
	}return s;
}
int main(){
	ll n,tn,a,b,x=1,y=1;cin>>n>>a>>b;tn=n;n=(powe(2,n)-1+k)%k;
	vi f(max(a,b)+1,1);for(ll i=1;i<f.size();i++) f[i]=(i*f[i-1])%k;
	for(ll i=0;i<a;i++) x=(x*(tn-i))%k;
	for(ll i=0;i<b;i++) y=(y*(tn-i))%k;
	a=(x*powe(f[a],k-2))%k;b=(y*powe(f[b],k-2))%k;
	n-=a+b;while(n<0) n+=k;cout<<n<<endl;
}


Measured memory_bytes: 1792
/**
*    author:  boutarou
*    created: 21.06.2020 21:13:27
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define fcout cout << fixed << setprecision(15)
using lint = long long;
using P = pair<int, int>;

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

const double PI = 3.1415926535897932;

lint n;
lint a[200005];
lint all = 0;
lint bit[50];
lint allbit[50];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n;
    rep(i, n) cin >> a[i];
    rep(i, n) all ^= a[i];
    lint now = 0;
    while (all > 0) {
        allbit[now] = all % 2;
        all /= 2;
        now++;
    }
    rep(i, n) {
        rep(j, 50) bit[j] = 0;
        now = 0;
        while (a[i] > 0) {
            bit[now] = a[i] % 2;
            a[i] /= 2;
            now++;
        }
        lint beki = 1;
        lint ans = 0;
        rep(j, 50) {
            if (allbit[j] != bit[j]) {
                ans += beki;
            }
            beki *= 2;
        }
        cout << ans << " ";
    }
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 5144
#!/usr/bin/ruby
#encoding: utf-8

n,m = gets.split.map(&:to_i)
a = Array.new(m)
b = Array.new(m)
(0..m-1).each do |i|
  a[i],b[i] = gets.split.map(&:to_i)
  a[i] -= 1
  b[i] -= 1
end

ans = Array.new(n,0)
(0..n-1).each do |i|
  (0..m-1).each do |j|
    if a[j] == i or b[j] == i
      ans[i] += 1
    end
  end
end

(0..n-1).each do |i|
  puts ans[i]
end

Measured memory_bytes: 1788
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
sumdigits(n) = sum(digits(n))

function main()
    s=chomp(readline())
    n=parseInt(s)
    if length(s)==1
        println(n)
    else
        println(max(sumdigits(n),sumdigits(parseInt(join([s[1]-1,"9"^(length(s)-1)])))))
    end
end
main()

Measured memory_bytes: 113912
#include <bits/stdc++.h>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int maxC = 0;
int n;
vector<P> v[100000];

void solve(int tar,int x){
  int y = x;
  REP(i,v[tar].size()){
    if(v[tar][i].second <= 0){
      y++;
     if(y>maxC)y -= maxC;
     v[tar][i].second = y;

     int k = v[tar][i].first;
     int t;
     REP(j,v[k].size()){
      if(v[k][j].first == tar){
        t = j;
        break;
      }
     }
     v[k][t].second = y;

     solve(v[tar][i].first,y);
    }
  }
  return;
}

int main(){

  cin>>n;
  //vector<P> v[n];
  P ps[n];
  REP(i,n-1){
    int a,b;cin>>a>>b;
    a--;b--;
    ps[i].first = a;
    ps[i].second = b;
    P p;
    p.first = b;
    p.second = 0;
    v[a].pb(p);
    p.first = a;
    p.second = 0;
    v[b].pb(p);
  }

  REP(i,n){
    VSORT(v[i]);
    int c = v[i].size();
    maxC = max(maxC,c);
  }

  cout<<maxC<<endl;

  solve(0,-1);

  REP(i,n-1){
    int t;
    REP(j,v[ps[i].first].size()){
      if(v[ps[i].first][j].first == ps[i].second){
        t = j;
        break;
      }
    }
    cout<<v[ps[i].first][t].second<<endl;
  }



 

  return 0;
}

Measured memory_bytes: 8576