This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#ifdef LIS05ST
    #define _GLIBCXX_DEBUG
    #define _GLIBCXX_DEBUG_PEDANTIC
#endif
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2,popcnt,lzcnt,bmi,bmi2")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef __int128_t i128;
#define int long long
long long count_tastiness(long long x, std::vector<long long> a){
    ll res=0;
    int k=a.size();
    for(int y=0;y<=100000;y++){
        vector<i128>A;
        for(auto e:a)A.push_back(e);
        int ptr=k-1;
        bool good=1;
        for(int bit=62;bit>=0;bit--){
            if(!((y>>bit)&1))continue;
            i128 need=i128(x)*i128(1ll<<bit);
            while(need>0&&ptr>=0){
                if(A[ptr]==0){
                    ptr--;
                    continue;
                }
                i128 cost=1ll<<ptr;
                if(cost>(1ll<<bit)){
                    ptr--;
                    continue;
                }
                i128 cnt=min(need/cost,A[ptr]);
                A[ptr]-=cnt;
                need-=cnt*cost;
                if(need==0)break;
                else ptr--;
            }
            if(need>0){
                good=0;
                break;
            }
        }
        if(good)res++;
    }
    return res;
}
#define MULTITESTS false
void solve(int testCase){
}
void precalc(){
}
/*
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    precalc();
    int t=1;
    if(MULTITESTS)cin>>t;
    for(int i=1;i<=t;i++){
        auto t1=clock();
        solve(i);
        auto t2=clock();
        float delta=t2-t1;
        delta/=CLOCKS_PER_SEC;
        #ifdef LIS05ST
        cout<<"("<<i<<")------------"<<fixed<<setprecision(2)<<delta<<"s\n";
        #endif
    }
}*/
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |