For this Question: You are given an array of <b>N</b> integers A<sub>1</sub>, A<sub>2</sub>,. . A<sub>N</sub>.
You need to answer Q queries.
In each query you are given three integers l, r and k. You need to find the minimum mean of the subarray of length at least k of the array A<sub>l</sub>, A<sub>l+1</sub>.. , A<sub>r</sub>.The first line contains two space- separated integers – N and Q.

The second line contains N space- separated integers A<sub>1</sub>, A<sub>2</sub>,. . A<sub>N</sub>.

Next Q lines contains three integers each L, R and K.

<b> Constraints: </b>
1 ≤ N ≤ 200000
1 ≤ Q ≤ 100000
1 ≤ A<sub>i</sub> ≤ 10<sup>9</sup>
1 ≤ L ≤ R ≤ N
1 ≤ K ≤ min(10, R- L+1)Qutput Q lines each containing a single integer the <b>floor</b> of the minimum mean.INPUT
4 2
8 62 2 4
1 3 2
1 4 2

OUTPUT
32
3, I have written this Solution Code: //HEADER FILES AND NAMESPACES
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp>  
#pragma GCC target("popcnt") 
using namespace std;
using namespace __gnu_pbds;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; 

using cd = complex<double>;
const double PI = acos(-1);
// DEFINE STATEMENTS
const long long infty = 1e18;
#define num1 1000000007
#define num2 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define REPd(i,a,n) for(ll i=a; i>=n; i--)
#define pb push_back
#define pob pop_back
#define fr first
#define sc second
#define int long long
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
#define all(x) x.begin(), x.end()
#define M_PI 3.14159265358979323846
#define epsilon (double)(0.000000001)
#define popcount __builtin_popcountll
#define fileio(x) freopen("input.txt", "r", stdin); freopen(x, "w", stdout);
#define out(x) cout << ((x) ? "Yes\n" : "No\n")
#define sz(x) x.size()
 
 
typedef long long ll;
// typedef long long unsigned int llu;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;
typedef vector<pair<long long, long long>> vpll;
typedef vector<int> vii;
 
// DEBUG FUNCTIONS 
#ifndef ONLINE_JUDGE
 
template<typename T>
void __p(T a) {
    cout<<a;
}
template<typename T, typename F>
void __p(pair<T, F> a) {
    cout<<"{";
    __p(a.first);
    cout<<",";
    __p(a.second);
    cout<<"}";
}
template<typename T>
void __p(std::vector<T> a) {
    cout<<"{";
    for(auto it=a.begin(); it<a.end(); it++)
        __p(*it),cout<<",}"[it+1==a.end()];
}
template<typename T>
void __p(std::set<T> a) {
    cout<<"{";
    for(auto it=a.begin(); it!=a.end();){
        __p(*it); 
        cout<<",}"[++it==a.end()];
    }
 
}
template<typename T>
void __p(std::multiset<T> a) {
    cout<<"{";
    for(auto it=a.begin(); it!=a.end();){
        __p(*it); 
        cout<<",}"[++it==a.end()];
    }
}
template<typename T, typename F>
void __p(std::map<T,F> a) {
    cout<<"{\n";
    for(auto it=a.begin(); it!=a.end();++it)
    {
        __p(it->first);
        cout << ": ";
        __p(it->second);
        cout<<"\n";
    }
    cout << "}\n";
}
 
template<typename T, typename ...Arg>
void __p(T a1, Arg ...a) {
    __p(a1);
    __p(a...);
}
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cout<<name<<" : ";
    __p(arg1);
    cout<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    int bracket=0,i=0;
    for(;; i++)
        if(names[i]==','&&bracket==0)
            break;
        else if(names[i]=='(')
            bracket++;
        else if(names[i]==')')
            bracket--;
    const char *comma=names+i;
    cout.write(names,comma-names)<<" : ";
    __p(arg1);
    cout<<" | ";
    __f(comma+1,args...);
}
#define trace(...) cout<<"Line:"<<__LINE__<<" ", __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...)
#define error(...)
#endif

struct SegTree
{
	vector<int> tree;
	SegTree(int N){
		tree.resize(4*N+5);
	}
	int merge(int a, int b){
		return min(a,b);
	}
	void build(vector<int> &A, int v, int lx, int rx){
		if(lx == rx)
		{
			tree[v] = A[lx];
			return;
		}
		int mid = (lx + rx)/2;
		build(A, 2*v+1, lx, mid);
		build(A, 2*v+2, mid+1, rx);
		tree[v] = merge(tree[2*v+1], tree[2*v+2]);
	}

	void point_update(int v, int lx, int rx, int pos, int val)
	{
		if(lx == rx){
			tree[v] = val;
			return;
		}
		int mid = (lx + rx)/2;
		if(pos <= mid) 
			point_update(2*v+1, lx, mid, pos, val);
		else
			point_update(2*v+2, mid+1, rx, pos, val);
 
		tree[v] = merge(tree[2*v+1], tree[2*v+2]);
	}

 	int range_query(int v, int lx, int rx, int ql, int qr){
		//lx <= ql <= qr <= rx
		if(lx == ql && rx == qr)
		{
			return tree[v];
		}
		int mid = (lx + rx)/2;
 
		int left_ans = 1e18, right_ans = 1e18;
		if(mid >= ql)
			left_ans = range_query(2*v+1, lx, mid, ql, min(qr, mid));
		if(qr > mid)
			right_ans = range_query(2*v+2, mid+1, rx, max(mid+1, ql), qr);
 
		return merge(left_ans, right_ans);
	}
};

void solve(){
    int n,q; cin >> n >> q;
    vector<int>a(n);
    for(int i = 0;i<n;i++)cin >> a[i];
    trace(a);
    vector<SegTree>S(20,n);
    vector<int>b = a;
    for(int i = 1;i<20;i++){
        S[i].build(b,0,0,n-1);
        for(int j = 0;j<n-i;j++)b[j] = b[j] + a[j+i];
        trace(b);
    }
    // trace(b);
    while(q--){
        int l,r,k; cin >> l >> r >> k;
        l--; r--;
        int ans = 1e18;
        for(int i = k;i<=min(2*k-1,r-l+1);i++){
            ans = min(ans,S[i].range_query(0,0,n-1,l,r-i+1)/i);
        }
        cout << ans << "\n";
    }

}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // cout.tie(NULL);
 
    #ifdef LOCALFLAG 
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ll t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?