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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    int n,m; cin >> n >> m;
    bool can = 0;
    string s;
    rep(i,n) s.push_back('0');
    rep(i,m) {
        int p,q;
        cin >> p >> q;
        if(s[p-1] != '0' && s[p-1] !=char(q+'0')) {
            cout << -1 << '\n';
            return 0;
        }
        if(p-1 == 0 && q == 0) {
            can = 1;
        }
        s[p-1] = char(q+'0');
    }
    if(s[0]=='0' && s.size()!=1) {
        if(can) {
            cout << -1 << '\n';
            return 0;
        }
        s[0] = '1';
    }

    cout << s << '\n';

//     printf("ExcutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

bool func_a(int *N, int *count);

int main()
{
	while(true)
	{
		int N = 0;
		int count = 0;
		bool flag = true;


		cin >> N;

		if(N == 0)
		{
			break;
		}

		if(N == 6174)
		{
			cout << 0 << endl;
			flag = false;
		}

		for(int i = 0; i <= 9; i++)
		{
			if(N == i + i * 10 + i * 100 + i * 1000)
			{
				cout << "NA" << endl; 
				flag = false;
			}
		}
	
		if(flag)
		{
			while( func_a(&N, &count) ){};

			cout << count << endl;
		}
	}

	return false;
}

bool func_a(int *N, int *count)
{	
	int num = *N;
	int Nmax[4];
	int Nmin[4];
	int L = 0, S = 0;

	*count += 1;

	for(int i = 0; i < 4; i++)
	{
		Nmax[i] = Nmin[i] = num % 10;
		num /= 10;
	}

	for(int i = 0; i < 4; i++)
	{
		for(int j = 0; j < 4; j++)
		{
			if(Nmax[i] < Nmax[j])
			{
				int tmp = Nmax[i];
				Nmax[i] = Nmax[j];
				Nmax[j] = tmp;
			}
			if(Nmin[i] > Nmin[j])
			{
				int tmp = Nmin[i];
				Nmin[i] = Nmin[j];
				Nmin[j] = tmp;
			}
		}
	}

	int dz[4] = {1, 10, 100, 1000};

	for(int i= 0; i < 4; i++)
	{
		L += Nmax[i] * dz[i];
		S += Nmin[i] * dz[i];
	}

	*N = L - S;

	if(*N == 6174)
	{
		return false;
	}
	else
	{
		return true;
	}
}

Measured memory_bytes: 1164
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <stdio.h>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <queue>
#include <bitset>
#include <stack>
#include <unordered_map>

using namespace std;

#define all(v) (v).begin(),(v).end()
#define SRT(v) sort(all(v))
#define rall(v) (v).rbegin(),(v).rend()
#define rSRT(v) sort(rall(v))
#define sz(a) int((a).size())
#define sc(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define PB push_back
#define mem(a, b) memset(a, b, sizeof(a))
#define MP make_pair
#define EPS 1e-9
#define Mod (ll)1000000007
#define oo (int)1<<30
#define OO (ll)1ll<<60
#define PI 3.141592653589793
#define F first
#define S second
#define pw(x) (x)*1LL*(x)

typedef stringstream ss;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii>vii;
typedef pair<int, ll> il;
typedef vector<vector<ii>> vvii;
typedef vector<vector<il>> vvil;

//ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
//int dcmp(long double x, long double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }

//string alpha = "abcdefghijklmnopqrstuvwxyz";
//string vowels = "aeoui";
//string pm = "AHIMOTUVWXY";

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

string a, b, ans;
short int dp[4005][4005];

int solve(int i, int j)
{
	if (i == a.size() || j == b.size()) return 0;
	if (~dp[i][j]) return dp[i][j];
	if (a[i] == b[j]) return dp[i][j] = solve(i + 1, j + 1) + 1;
	return dp[i][j] = max(solve(i + 1, j), solve(i, j + 1));
}

void build(int i, int j)
{
	if (i == a.size() || j == b.size()) return;
	if (a[i] == b[j]) {
		ans += a[i];
		build(i + 1, j + 1);
	}
	else {
		if (solve(i, j) == solve(i + 1, j)) build(i + 1, j);
		else build(i, j + 1);
	}
}

int main()
{
	cin >> a >> b;
	mem(dp, -1);
	solve(0, 0);
	build(0, 0);
	cout << ans;
	//int wait; sc(wait);
}


Measured memory_bytes: 35232
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::cerr;
using std::endl;

namespace chrono = std::chrono;
using namespace std::literals;

[[gnu::constructor]]
void fast_iostream() {
    std::ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);
}

struct edge {
    int to;
    long long d;

    edge() {}
    edge(int to, long long d): to(to), d(d) {}
};

std::vector<std::vector<edge>> g;
std::vector<long long> a;

bool dfs(int v, long long pos) {
    a[v] = pos;
    for (edge next: g[v]) {
        if (a[next.to] == -1488228228) {
            if (!dfs(next.to, pos + next.d)) {
                return false;
            }
        } else if (a[next.to] == pos + next.d) {
            continue;
        } else {
            return false;
        }
    }
    return true;
}

int main() {
    int n; cin >> n;
    g.resize(n);
    a.assign(n, -1488228228);
    int m; cin >> m;
    while (m--) {
        int l; cin >> l; --l;
        int r; cin >> r; --r;
        long long d; cin >> d;
        g[l].emplace_back(r, +d);
        g[r].emplace_back(l, -d);
    }
    bool flag = true;
    for (int i = 0; i < n; ++i) {
        if (a[i] == -1488228228) {
            flag &= dfs(i, 0);
        }
    }
    cout << (flag ? "Yes" : "No") << endl;
}


Measured memory_bytes: 15616
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int n;cin >> n;
    vector<int> a(n),b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    auto c=a,d=b;
    sort(ALL(c));
    sort(ALL(d));
    bool fl = false;
    vector<int> nx(n);
    for (int i = 0; i < n; i++) {
        if(c[i]>d[i]){
            puts("No");
            return 0;
        }
        if(i){
            if(c[i]<=d[i-1]){
                fl = true;
            }
        }
        nx[lower_bound(ALL(c),a[i])-c.begin()] = lower_bound(ALL(d),b[i]) - d.begin();
    }
    if(fl){
        puts("Yes");
        return 0;
    }
    vector<bool> used(n,false);
    function<int(int)> f = [&](int l){
        if(used[l]) return 0;
        used[l] = true;
        return f(nx[l]) + 1;
    };
    if(f(0)==n) puts("No");
    else puts("Yes");
    return 0;
}


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

using namespace std;

int main()
{
  int n;
  scanf("%d", &n);
  unordered_map <int, int> X;
  for(int i=0; i<n; i++)
  {
    int x;
    scanf("%d", &x);
    X[x]++;
  }
  vector <int> Y;
  for(auto ele : X)
  {
    if(ele.second >= 2)
      Y.push_back(ele.first);
    if(ele.second >= 4)
      Y.push_back(ele.first);
  }
  sort(Y.begin(), Y.end());
  reverse(Y.begin(), Y.end());
  if(Y.size() < 2)
    printf("0\n");
  else
    printf("%lld\n", 1LL*Y[0]*Y[1]);
}


Measured memory_bytes: 4388
#include <bits/stdc++.h>
using namespace std;
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; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


using Edge = pair<int,int>; // (隣接頂点, 辺番号)
using Graph = vector<vector<Edge>>;
int N;
Graph G;

// v: 頂点、p: 親、pc: 親から来た辺の色、res: 色
void dfs(int v, int p, int pc, vector<int> &res) {
    int color = 1;
    if (color == pc) ++color;
    for (auto e : G[v]) {
        if (e.first == p) continue; // 逆流しない
        res[e.second] = color;
        dfs(e.first, v, color, res);
        ++color;
        if (color == pc) ++color;
    }
}

int main() {
    cin >> N;
    G.assign(N, vector<Edge>());
    for (int i = 0; i < N-1; ++i) {
        int a, b; cin >> a >> b; --a, --b;
        G[a].emplace_back(b, i); 
        G[b].emplace_back(a, i);
    }
    int max_color = 0;
    for (int i = 0; i < N; ++i) chmax(max_color, (int)G[i].size());
    vector<int> res(N-1, -1);
    dfs(0, -1, -1, res);
    cout << max_color << endl;
    for (auto v : res) cout << v << endl;
}

Measured memory_bytes: 8320
n, k = map(int, input().split())
p = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
goukei = 0
ind = 0
kitai = 0

for i in range(k):
    goukei = goukei + p[i]

list = [goukei]

for j in range(1, n-k+1):
    list.append(list[j-1] - p[j-1] + p[j+k-1])

ind = list.index(max(list))

for j in range(ind, ind+k):
    kitai = kitai + (p[j]+1)/2
'''
print(max(list))
print(p)
print(list)
print(ind)
'''
print(kitai)


Measured memory_bytes: 25060
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}


int main(){
    ll x,y,n,m,p,h,k,max=-10000000,min=1000000000,ans=0,sum=0;
    string s,t;
    bool f=true;
    cin >> n >> p;
    VI a(n);
    rep(i,n){
        cin >> a[i];
        if(a[i]%2!=0)
            f = false;
	}
    if(f && p==0){
        cout << (ll) pow(2,n) << endl;
        return 0;
    }
    else if(f && p==1){
        cout << 0 << endl;
        return 0;
    }
    else{
        cout << (ll) pow(2,n-1) << endl;
        return 0;
    }
}

Measured memory_bytes: 384
#include <stdio.h>
#include <utility>
#include <vector>
#include <bitset>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int,int> >vpi;
typedef pair<int,int> pi;
#define R return
#define W while
#define FOR(i,a) for(int i=0;i<a;i++)
#define MP make_pair
#define PB push_back
#define F first
#define S second
vi v[510];
bitset<510>b,x;
int m[510];
bool dfs(int now){
    FOR(i,v[now].size())if(!b[v[now][i]]){
        b[v[now][i]]=true;
        if(m[v[now][i]]==-1||dfs(m[v[now][i]])){
            m[v[now][i]]=now;
            R x[now]=true;
        }
    }
    R false;
}
int main(){
    int n,y,k,l,r,ans=0;
    x.reset();
    scanf("%d%d%d",&n,&y,&k);
n=max(n,y);
    n++;
    FOR(i,n)m[i]=-1;
    W(k--){
        scanf("%d%d",&l,&r);
        v[l].PB(r);
    }
    FOR(i,n)if(!x[i]){
        b.reset();
        if(dfs(i))ans++;
    }
    printf("%d\n",ans);
}

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

int main() {
    int A, B, C, D;
    std::cin >> A >> B >> C >> D;

    while (true) {
        C -= B;
        if (C <= 0) {
            std::cout << "Yes" << std::endl;
            return 0;
        }

        A -= D;
        if (A <= 0) {
            std::cout << "No" << std::endl;
            return 0;
        }
    }

    
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    int n, q;
    string s;
    cin >> n >> s >> q;
    set<int> is[27];
    rep(i, n) is[s[i] - 'a'].insert(i);
    rep(qi, q) {
        int ty;
        cin >> ty;
        if (ty == 1) {
            int i; char c;
            cin >> i >> c;
            --i;
            is[s[i] - 'a'].erase(i);
            s[i] = c;
            is[s[i] - 'a'].insert(i);
        } else {
            int l, r;
            cin >> l >> r;
            l--;
            int ans = 0;
            rep(i, 26) {
                auto t = is[i].lower_bound(l);
                if (t != is[i].end() && *t < r) ans++;
            }
            cout << ans << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 24196
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}










int main() {
    string s,t;
    cin >> s >> t;
    vector<char> ans{};
    rep(i,s.size()){
      ans.push_back(s[i]);
    }
    bool ok = false;
    rep(i,s.size()){
      rep (j,s.size()){
        //cout << ans[j] << " " << t[j] << endl;
      if (ans[j] != t[j]){
        break;
        }
      if (j==s.size()-1){
          ok = true;
        
      }
      }
      //cout << endl;
      ans.insert(ans.begin(),ans[s.size()-1]);
      ans.pop_back();

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

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

void solve(){
   string s;
   cin >> s;
   cout << s.substr(0,3);
}

int32_t main(){
   fast;
   int t = 1;
   //cin >> t;
   while(t--)  solve();   
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define int long long
#define Matrix vector<vector<int> >
// #define Matrix vector<vector<int> >
#define double long double
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define td(v) v.begin(),v.end()
#define tdr(v) v.rbegin(),v.rend()
// #define endl "\n"
#define Matrix vector<vector<int> >
using namespace std;
const int MOD = 1e9+7;
const long long INF = 5e18;
const double pi = acos(-1.0);
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
 
inline long long mod(long long n, long long m){
    long long ret = n%m;
    if(ret < 0) ret += m;
    return ret;
}
 
double rad(double x){
    return x*pi/180.0;
}
 
bool isleft(pair<int,int> a, pair<int,int> b, pair<int,int> c){
    int det = (b.first-a.first)*(c.second-a.second) - (c.first-a.first)*(b.second-a.second);
    if(det>=0) return true;
    if(det<0) return false;
    return false;
}
 
int exp(int a, int b){
    int result = 1;
    while (b > 0){
        if (b & 1)
            result = mod(result*a,MOD);
 
        b >>= 1;
        a = mod(a*a,MOD);
    }
    return result;
}

double memo[3124][3124];
int n;
vector<pair<double,double> >vet;
double ans = 0;
double dp(int v, int qnt){
	if(v==n and qnt>n-qnt){
		return 1;
	}
	else if(v==n){
		return 0;
	}
	double &x = memo[v][qnt];
	if(x!=-1){
		ans+=x;
		return x;
	}
	x = 0;
	x+=dp(v+1,qnt+1)*vet[v].first;
	x+=dp(v+1,qnt)*vet[v].second;
	return x;
}
void solve(){
	cin>>n;
	for(int i=0;i<3124;i++){
		for(int j=0;j<3124;j++){
			memo[i][j]=-1;
		}
	}
	for(int i=0;i<n;i++){
		double x;
		cin>>x;
		vet.push_back({x,1.0-x});
	}
	cout<<fixed<<setprecision(10);
	cout<<dp(0,0)<<endl;
}

signed main(){
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}

Measured memory_bytes: 156536
// O O O O O O O O O O O O O O O OO O OO O OO O O O TTCH O TTTCH O TTTCH O O O O
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
// #include <random>
#include <iomanip>
#include <bitset>
#include <cassert>
 
using namespace std;

#define int long long
#define y1 y11
#define double long double
#define less less228
#define left left228
#define right right228
#define list list228
#define all(v) v.begin(), v.end()
 
 
 
template<typename T> void uin(T &a, T b) {
    if (b < a) a = b;
}
template<typename T> void uax(T &a, T b) {
    if (b > a) a = b;
}

const int N = 1000 * 1000 + 228;

int a[N];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        char c;
        cin >> c;
        a[i] = c - '0';
        a[i] -= 1;
    }
    int par = 0;
    for (int i = 1; i <= n; ++i) {
        if (a[i] & 1) {
            par ^= (((n - 1) & (i - 1)) == (i - 1));
        }
    }
    if (par & 1) {
        cout << 1 << endl;
    } else {
        for (int i = 1; i <= n; ++i) {
            if (a[i] == 1) {
                cout << 0 << endl;
                return 0;
            }
        }
        par = 0;
        for (int i = 1; i <= n; ++i) {
            a[i] >>= 1;
            if (a[i]) {
                par ^= (((n - 1) & (i - 1)) == (i - 1));
            }
        }
        if (par == 1) cout << 2 << endl;
        else cout << 0 << endl;
    }
    return 0;
}
// RU_023
 
/*
5
1 3 4 2 3 
3
1 5 3
4 3 2
2 4 2
-------
2


7
5 6 2 3 6 7 6
5
7 7 5
3 3 7
3 7 10
1 7 6
4 7 8
-------
16

*/

Measured memory_bytes: 8064
N, Y = map(int, input().split())
flg = False
        
for a in range(N+1):
    if flg: break
    for b in range(N+1-a):
        c = N - a - b
        if a*10000 + b*5000 + c*1000 == Y:
            ans = [a, b, c]
            flg = True
            break
if flg:
    print(*ans)
else:
    print(-1,-1,-1)

Measured memory_bytes: 3064
//
//  sublime text 3,
//  emre yazicioglu
//

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
#define pb push_back
#define fi first
#define se second
#define INF (ll) 1e18 + 7
#define MOD (ll) 1e9 + 7

const int N = 2e6 + 7;
ll mn = INF, mx = -INF;
ll n, m, k, s, q, t;
ll a, b, c, d, e;
ll ans, cur, sum, cnt;
ll ar[N], p[N], dp[N];
string str; bool h[N];
pll pp[N]; vll v;

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

  // freopen("../in.txt","r",stdin);
  // freopen("../out.txt","w",stdout);

  cin >> n >> str;
  // n = str.size();
  string a, b;
  for(int i = 0; i < n / 2; i++)
    a += str[i];
  for(int i = n / 2; i < n; i++)
    b += str[i];
  cout << (a == b ? "Yes" : "No");
}

Measured memory_bytes: 2304
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdlib.h>
#include <stdio.h>

using namespace std;

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

int my_abs_A(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

int my_abs_B(long long num,long long numb) {
    if (num - numb >= 0)
        return num - numb;
    else
        return -1 * (num - numb);
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}



const long long INF = 1LL << 60;

int main() {
    int N;
    cin >> N;
    vector<unsigned long long> retu(87);
    retu.at(0) = 2;
    retu.at(1) = 1;
    for (int i = 2; i < 87; i++) {
        retu.at(i) = retu.at(i - 1) + retu.at(i - 2);
    }
    cout << retu.at(N) << endl;
}



Measured memory_bytes: 256
def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2
w=list(input())
w.sort()
w=groupby(w)
for i in w:
    if i[1]%2==1:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 3064
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//  10:00-
//A 10:05 AC
int solve(void){
	string S,T;cin>>S;
	int i;
	if(S=="."){return 0;}
	cin>>T;
	if(S==T){cout<<"IDENTICAL"<<endl;return 1;}
	vector<string>Saa(1);
	vector<string>Taa(1);
	int bas=0;
	for(auto it:S){
		if(it=='"'){
			if(bas%2==0){Saa[0].pub('#');Saa.pub(string());}
			bas++;
		}else{
			if(bas%2==0){Saa[0].pub(it);}
			else{Saa[bas/2+1].pub(it);}
		}
	}
	bas=0;
	for(auto it:T){
		if(it=='"'){
			if(bas%2==0){Taa[0].pub('#');Taa.pub(string());}
			bas++;
		}else{
			if(bas%2==0){Taa[0].pub(it);}
			else{Taa[bas/2+1].pub(it);}
		}
	}
	if(Saa[0]!=Taa[0]||Saa.size()!=Taa.size()){cout<<"DIFFERENT"<<endl;return 1;}
	int tiga=0;
	for(i=1;i<Saa.size();i++){
		if(Saa[i]!=Taa[i]){tiga++;}
	}
	if(tiga<=1){cout<<"CLOSE"<<endl;}
	else{cout<<"DIFFERENT"<<endl;return 1;}
	return 1;
}
int main(void){
	while(solve()){}
}



Measured memory_bytes: 3180
#include <iostream>
#include <string>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    char a[60][60],b[60][60];
    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<m;++i){
        for(int j=0;j<m;++j){
            cin>>b[i][j];
        }
    }
    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j){
            int cnt=0;
            for(int k=0;k<m;++k){
                for(int l=0;l<m;++l){
                    if(a[i+k][j+l]==b[k][l]){
                        ++cnt;
                    }
                }
            }
            if(cnt==m*m){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

map<string, int> mp;

int main() {
    string s;
    cin >> s;
    cout << s[0];
    cout << s.size() - 2;
    cout << s[s.size() - 1] << endl;
  
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_H = 64;
const int MAX_W = 64;

/* typedef */

typedef unsigned long long ull;
typedef vector<ull> vull;

struct Block {
  int h, w;
  vull bits;

  void read() {
    cin >> h >> w;
    bits.assign(h, 0ULL);
    
    for (int y = 0; y < h; y++) {
      string line;
      cin >> line;
      for (int x = 0; x < w; x++) {
	if (line[x] == '#') bits[y] |= (1ULL << x);
      }
    }
  }

  void normalize() {
    while (bits.front() == 0) bits.erase(bits.begin()), h--;
    while (bits.back() == 0) bits.erase(bits.end() - 1), h--;

    int min_lsp = w, min_rsp = w;
    for (vull::iterator vit = bits.begin(); vit != bits.end(); vit++) {
      int lsp, rsp;
      for (lsp = 0; (*vit & (1ULL << lsp)) == 0; lsp++);
      for (rsp = 0; (*vit & (1ULL << (w - 1 - rsp))) == 0; rsp++);
      if (min_lsp > lsp) min_lsp = lsp;
      if (min_rsp > rsp) min_rsp = rsp;
    }
    //printf("min_lsp = %d, min_rsp = %d\n", min_lsp, min_rsp);

    if (min_lsp > 0) {
      for (vull::iterator vit = bits.begin(); vit != bits.end(); vit++)
	*vit >>= min_lsp;
      w -= min_lsp;
    }
    w -= min_rsp;
    //printf("h=%d,w=%d\n", h, w);
  }

  void rotate() {
    vull bits0(bits);

    swap(h, w);
    bits.assign(h, 0ULL);

    for (int y = 0, x0 = h - 1; y < h; y++, x0--)
      for (int x = 0, y0 = 0; x < w; x++, y0++)
	if (bits0[y0] & (1ULL << x0)) bits[y] |= (1ULL << x);
  }

  void print() {
    printf("h=%d,w=%d\n", h, w);
    for (int y = 0; y < h; y++) {
      for (int x = 0; x < w; x++)
	cout << ((bits[y] & (1ULL << x)) != 0 ? '#' : '.');
      cout << endl;
    }
  }
};

/* global variables */

/* subroutines */

int max_fill_len(Block& blk, Block& brd) {
  int mfl = -1;
  int dh = brd.h - blk.h, dw = brd.w - blk.w;
  if (dh < 0 || dw < 0) return mfl;

  ull allbits = (~0ULL >> (MAX_W - brd.w));
  
  for (int h0 = 0; h0 <= dh; h0++)
    for (int w0 = 0; w0 <= dw; w0++) {
      int fl = 0;
      bool ok = true;

      for (int y = 0; y < blk.h; y++) {
	ull blkbit = (blk.bits[y] << w0), brdbit = brd.bits[y + h0];
	if ((blkbit & brdbit) != 0) {
	  ok = false;
	  break;
	}
	if ((blkbit | brdbit) == allbits) fl++;
      }
  
      if (ok && mfl < fl) mfl = fl;
      //printf("(h0,w0)=(%d,%d): ok=%d, fl=%d\n", h0, w0, ok, fl);
    }

  return mfl;
}

/* main */

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

  while (n--) {
    Block blk, brd;
    blk.read();
    brd.read();

    blk.normalize();
    //blk.print();

    int max_fl = -1;
    
    for (int di = 0; di < 4; di++) {
      //blk.print();
      int fl = max_fill_len(blk, brd);
      if (max_fl < fl) max_fl = fl;

      blk.rotate();
    }

    cout << max_fl << endl;
  }

  return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int mount[10];
    for(int i=0; i<10; i++){
        cin>>mount[i];
    }
    sort(mount, mount+10, greater<int>());
    cout<<mount[0]<<endl<<mount[1]<<endl<<mount[2]<<endl;
    return 0;
}


Measured memory_bytes: 3080
//@HelloElwin20190819
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
using namespace std;

int main() {
	
	int n;
	double a[1005];

	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%lf",  a + i);
	
	priority_queue<double> Q;

	for (int i = 0; i < n; i++) Q.push(-a[i]);

	for (int i = 1; i < n; ++i) {
		double a = -Q.top(); Q.pop();
		double b = -Q.top(); Q.pop();
		// cerr<<a<<" "<<b<<endl;
		Q.push(-(a + b) / 2);
	}

	printf("%lf", -Q.top());

	return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc075/tasks/abc075_c
class UnionFind():
    def __init__(self, N):
        self._root = [-1 for _ in range(N)]

    def find(self, x):
        if self._root[x] < 0: return x
        self._root[x] = self.find(self._root[x])
        return self._root[x]

    def unite(self, x, y):
        gx = self.find(x)
        gy = self.find(y)
        if gx == gy: return False
        if self._root[gx] > self._root[gy]:
            gx, gy = gy, gx
        self._root[gx] += self._root[gy]
        self._root[gy] = gx
        return True

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

    def size(self, x):
        return -(self._root[self.find(x)])

    def roots(self):
        return [i for i in self._root if i < 0]


n, m = map(int, input().split())

nodes = []
for _ in range(m):
    a, b = map(int, input().split())
    nodes.append((a, b))

cnt = 0
for i in range(m):
    uf = UnionFind(n)
    for j in range(m):
        if i != j:
          uf.unite(nodes[j][0]-1, nodes[j][1]-1)
    cnt += (len(uf.roots()) != 1)
print(cnt)

Measured memory_bytes: 3192
# -*- coding: utf-8 -*-
N , Y = map(int,input().split())
z = 0
for i in range(N+1):
    rest = Y - 10000 * i
    for j in range(N+1-i):
        if rest < 0:
            break
        rest1 = rest - (5000 * j) -(1000 * (N-i-j))
        if rest1 == 0:
            print(i, j, N-i-j)
            z = 1
        if z == 1:
            break
    if z == 1:
        break
if z == 0:
    print("-1 -1 -1")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  string s1,s2;
  cin >> s1 >> s2;
  bool seq = false;
  vector<int> data;
  rep(i,n-1){
    if(s1.at(i) == s1.at(i+1)) seq = true;
    else{
      if(seq){
        seq = false;
        data.push_back(2);
      }else{
        data.push_back(1);
      }
    }
  }
  if(seq) data.push_back(2);
  else data.push_back(1);
  long ans = 1;
  rep(i,data.size()){
    if(i == 0){
      if(data.at(i) == 1) ans *= 3;
      else ans *= 6;
      continue;
    }
    if(data.at(i-1) == 1 && data.at(i) == 1) ans = (ans*2)%MOD;
    else if(data.at(i-1) == 1 && data.at(i) == 2) ans = (ans*2)%MOD;
    else if(data.at(i-1) == 2 && data.at(i) == 2) ans = (ans*3)%MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
a = list(input())
b = list(input())
c = list(input())

num = 0

while len(a) >= 0 and len(b) >= 0 and len(c) >= 0:
    if num == 0:
        tar = a[0]
        del a[0]
        num += 1
    else:
        if tar == "a":
            if len(a) > 0:
                tar = a[0]
                del a[0]
            elif len(a) == 0:
                print("A")
                break
        elif tar == "b":
            if len(b) > 0:
                tar = b[0]
                del b[0]
            elif len(b) == 0:
                print("B")
                break
        elif tar == "c":
            if len(c) > 0:
                tar = c[0]
                del c[0]
            elif len(c) == 0:
                print("C")
                break


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n;
    cin >> n;

    vvl a(2, vl(n));
    rep(i, 2) {
        rep(j, n) {
            cin >> a[i][j];
        }
    }

    ll ans = 0;
    rep(x, n) {
        ll now = 0;
        exrep(j, 0, x) {
            now += a[0][j];
        }
        now += a[1][x];
        exrep(j, x+1, n-1) {
            now += a[1][j];
        }
        chmax(ans, now);
    }
        
    out(ans);
    re0;
}

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

int solve(){
    int n; cin>>n; 
    if(n==0) return -1;
    vector<int> v(n); 
    for(int i=0;i<n;i++){cin>>v[i];}
    vector<vector<int>> dp(n+1,vector<int>(n+1,0));
    for(int W = 2; W <= n; W++){ //区間の大きさ
        for(int l = 0; l < n; l++){
            int r = l + W;
            if(r > n) continue;
            if(W==2){
                if(abs(v[l]-v[r-1]) <= 1){dp[l][r]=2;}
                else dp[l][r] =0;
            }else{
                if(dp[l+1][r-1]==W-2 && abs(v[l]-v[r-1]) <= 1) dp[l][r] = W; //遷移1
                for(int m = l+1; m < r;m++) //遷移2
                dp[l][r] = max(dp[l][r],dp[l][m]+dp[m][r]);
            }
        }
    }
    return dp[0][n];
}
 
int main(){
    while(1){
        int ans=solve();
        if(ans==-1) break;
        cout << ans << endl;
    }
}




Measured memory_bytes: 3252
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX




 
void solve()
{
    double l;
    cin >> l;
    cout << setprecision(25);
    cout << l*l*l/27 << endl;
}   


signed main()
{


  
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        final int H, W, N; {int[] a = in.ii(); H = a[0]; W = a[1]; N = a[2];}
        HashMap<Long, Integer> hm = new HashMap<>();
        long b = 1_000_000_001;
        for(int i = 0; i < N; i++){
            int[] c = in.ii();
            for(int j = 0; j < 9; j++){
                int h = c[0] - j/3;
                int w = c[1] - j%3;
                if(0 < h && h < H-1 && 0 < w && w < W-1){
                    long d = h*b + w;
                    hm.put(d, hm.getOrDefault(d, 0)+1);
                }
            }
        }
        int[] ans = new int[10];
        long ans0 = (long)(H-2)*(W-2);
        for(Map.Entry<Long, Integer> e : hm.entrySet()){
            ans[e.getValue()]++;
        }
        for(int i = 1; i < ans.length; i++){
            ans0 -= ans[i];
        }
        out.println(ans0);
        for(int i = 1; i < ans.length; i++){
            out.println(ans[i]);
        }
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 114480
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

	void run() {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int[] A = new int[N];

		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}

		Set<Integer> kisyutu=new HashSet<Integer>();


		int over3200=0;
		for (int i = 0; i < N; i++) {

			if(A[i]>=3200) {
				over3200++;
			}else {
				int index=A[i]/400;

				kisyutu.add(index);
			}

		}

		int size=kisyutu.size();

		int max=size+over3200;

		int min=0;

		if(size>0) {
			min=size;
		}else {
			min=1;
		}


		System.out.println(min+" "+max);

	}

	//以下テンプレート

	public static int[] extgcd(int a, int b) {

		int x0 = 1;
		int x1 = 0;

		int y0 = 0;
		int y1 = 1;

		while (b != 0) {
			int q = a / b;
			int r = a % b;

			int x2 = x0 - q * x1;
			int y2 = y0 - q * y1;

			a = b;
			b = r;

			x0 = x1;
			x1 = x2;

			y0 = y1;
			y1 = y2;
		}

		return new int[] { a, x0, y0 };

	}

	static int gcd(int a, int b) {

		if (b == 0)
			return a;

		if (a < b) {
			int t = a;
			a = b;
			b = t;
		}

		return gcd(b, a % b);

	}

	static int lcm(int a, int b) {
		return a * b / gcd(a, b);
	}

	static void swap(int[] a) {
		int t;

		t = a[0];
		a[0] = a[1];
		a[1] = t;

		return;
	}

	static <T> void output(List<T> list) {

		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));

			if (i != list.size() - 1) {
				System.out.print(" ");
			} else {
				nl();
			}
		}

	}

	static void output(String[][] str) {

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				print(str[i][j]);
			}

			nl();
		}

	}

	static void output(boolean flg, String Yes, String No) {

		if (flg) {
			pln(Yes);
		} else {
			pln(No);
		}

	}

	static void output(String[][] str, int digit) {

		String dig = "%" + String.valueOf(digit) + "s";

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.printf(dig, str[i][j]);
			}
			nl();
		}

	}

	static void pln(String str) {
		System.out.println(str);
	}

	static void pln(int x) {
		System.out.println(x);
	}

	static void print(String str) {
		System.out.print(str);
	}

	static void print(int x) {
		System.out.print(x);
	}

	static void print(String str, int times) {
		for (int i = 0; i < times; i++) {
			print(str);
		}
	}

	static void print(int x, int times) {
		for (int i = 0; i < times; i++) {
			print(x);
		}
	}

	static void nl() {
		System.out.println();
	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <iomanip>
using namespace std;
int main(void){
    double a, b, c, d, e, f;
    cout << fixed << setprecision(3);
    while(cin >> a >> b >> c >> d >> e >> f){
        if(a != 0){
            if(a != 1){
                b = b / a;
                c = c / a;
                a = a / a;
            }
            e = e - b * d / a;
            f = f - c * d / a;
            d = d - d / a;
            if(e != 1){
                f = f / e;
                e = e / e;
            }
            c = c - f * b / e;
            b = b - b / e;
        }
        cout << c << " " << f << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
using namespace std;
string s;
int cnt[3];
main()
{
  cin>>s;
  for(int i=0;i<s.size();i++)cnt[s[i]-'a']++;
  sort(cnt,cnt+3);
  cout<<(cnt[2]-cnt[0]<2?"YES":"NO")<<endl;
}

Measured memory_bytes: 512
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
prev_eat = None
ans = 0
for i in range(N):
    dish_idx = A[i]
    ans += B[dish_idx-1]
    if prev_eat is not None and prev_eat + 1 == dish_idx:
        ans += C[prev_eat-1]
    prev_eat = dish_idx
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(void) {

    unsigned int N, M;
    while (cin >> N >> M, N || M) {
        vector<unsigned int> P(N+1);
        P[0] = 0;
        for (int i = 1; i <= N; i++) cin >> P[i];

        vector<unsigned int> P2;
        for (int i = 0; i <= N; i++) {
            for (int j = i; j <= N; j++) {
                P2.push_back(P[i]+P[j]);
            }
        }
        sort(P2.begin(), P2.end());

        unsigned int ans = 0;
        for (int i = 0; i < P2.size(); i++) {
            if (P2[i] > M) break;
            unsigned int left = 0, right = P2.size()-1;
            unsigned int mid;
            for (int j = 0; j < 100; j++) {
                mid = (left+right)/2;
                if (P2[i]+P2[mid] > M) {
                    right = mid;
                } else {
                    left = mid;
                }
            }
            ans = max(ans, P2[i]+P2[mid]);
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 6832
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
int n,p,f[200000];
vector<int> s[200000];
int dp(int x)
{
	if(s[x].empty())return 0;
	vector<int> d;
	for(auto i:s[x])d.push_back(dp(i));
	sort(d.begin(),d.end(),greater<int>());
	int ans=0;
	for(auto i=0;i<d.size();i++)ans=max(ans,d[i]+i+1);
	return ans;
}
int main()
{
	scanf("%d",&n);
	for(int i=2;i<=n;i++)scanf("%d",&p),s[p].push_back(i);
	printf("%d\n",dp(1));
	return 0;
}

Measured memory_bytes: 19072