Language: C++

#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <bitset>
#include <climits>
#include <utility>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#define REP(i,n) for(int (i)=0;i<(int)(n);++(i))
#define REPIT(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define PB push_back
#define FT first
#define SD second
#define ZERO(x) memset(x,0,sizeof(x))
#define NEG(x) memset(x,-1,sizeof(x))
#define RI(x) scanf("%d",&(x))
#define RII(x,y) scanf("%d%d",&(x),&(y))
#define RIII(x,y,z) scanf("%d%d%d",&(x),&(y),&(z))
#define OIII(x,y,z) printf("%d %d %d\n",(x),(y),(z))
#define OII(x,y) printf("%d %d\n",(x),(y))
#define OI(x) printf("%d\n",(x))
#define OL(x) cout<<(x)<<endl
#define OLL(x,y) cout<<(x)<<" "<<(y)<<endl
#define OLLL(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define RS(s) scanf("%s",(s))
#define MP(x,y) make_pair((x),(y))
#define SZ(x) ((int)(x).size())
#define FIN(f) freopen(f,"r",stdin)
#define FOUT(f) freopen(f,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<int,int> PII;
const int MOD = 1e9+7;
const int maxn = 222222;
int a[maxn];
PII b[maxn];
LL L;
int n;
bool tie[maxn];
vector<int> ans;
LL sz[maxn];
int pa[maxn];
int findp(int x){return pa[x] == x ? x : pa[x] = findp(pa[x]);}
int main(int argc, char const *argv[])
{
    RI(n);
    cin>>L;
    REP(i,n){
        RI(a[i]);
        b[i].SD = i;
        b[i].FT = a[i];
    }
    sort(b,b+n);
    REP(i,n) {
        int x = b[i].SD;
        if(x>0 && x < n && !tie[x]) {
            ans.push_back(x);
            tie[x] = 1;
        }
        x++;
        if(x>0 && x < n && !tie[x]) {
            ans.push_back(x);
            tie[x] = 1;
        }
    }

    for(int i=0;i<n;++i){
        pa[i] = i;
        sz[i] = a[i];
    }
    bool f = 1;
    for(int i=SZ(ans)-1;i>=0;--i) {
        int j = ans[i];
        int a = findp(j), b = findp(j-1);
        if(a!=b) {
            pa[a] = b;
            sz[b] += sz[a];
            //OLL(sz[b],sz[a]);
            if(sz[b] < L)f = 0;
        }
    }
    if(f){
        puts("Possible");
        for(int i=0;i<SZ(ans);++i)
            printf("%d\n", ans[i]);
    } else puts("Impossible");

    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:63:29: error: reference to 'tie' is ambiguous
   63 |         if(x>0 && x < n && !tie[x]) {
      |                             ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/vector:87,
                 from a.cc:2:
/usr/include/c++/14/tuple:2791:5: note: candidates are: 'template<class ... _Elements> constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...)'
 2791 |     tie(_Elements&... __args) noexcept
      |     ^~~
a.cc:46:6: note:                 'bool tie [222222]'
   46 | bool tie[maxn];
      |      ^~~
a.cc:65:13: error: reference to 'tie' is ambiguous
   65 |             tie[x] = 1;
      |             ^~~
/usr/include/c++/14/tuple:2791:5: note: candidates are: 'template<class ... _Elements> constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...)'
 2791 |     tie(_Elements&... __args) noexcept
      |     ^~~
a.cc:46:6: note:                 'bool tie [222222]'
   46 | bool tie[maxn];
      |      ^~~
a.cc:68:29: error: reference to 'tie' is ambiguous
   68 |         if(x>0 && x < n && !tie[x]) {
      |                             ^~~
/usr/include/c++/14/tuple:2791:5: note: candidates are: 'template<class ... _Elements> constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...)'
 2791 |     tie(_Elements&... __args) noexcept
      |     ^~~
a.cc:46:6: note:                 'bool tie [222222]'
   46 | bool tie[maxn];
      |      ^~~
a.cc:70:13: error: reference to 'tie' is ambiguous
   70 |             tie[x] = 1;
      |             ^~~
/usr/include/c++/14/tuple:2791:5: note: candidates are: 'template<class ... _Elements> constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...)'
 2791 |     tie(_Elements&... __args) noexcept
      |     ^~~
a.cc:46:6: note:                 'bool tie [222222]'
   46 | bool tie[maxn];
      |      ^~~