For this Question: Given an array A of size N, find all combination of four elements in the array whose sum is equal to a given value K. For example, if the given array is {10, 2, 3, 4, 5, 9, 7, 8} and K = 23, one of the quadruple is “3 5 7 8” (3 + 5 + 7 + 8 = 23).

The output should contain only unique quadruple For example, if the input array is {1, 1, 1, 1, 1, 1} and K = 4, then the output should be only one quadruple {1, 1, 1, 1}The first line of input contains two integers N and K. Then in the next line there are N space-separated values of the array.

Constraints:
1 <= N <= 1000
-20000 <= K <= 20000
-50000 <= A[i] <= 50000
All elements are pairwise distinctPrint all the quadruples present in the array separated by space which sums up to the value of K. Each quadruple is unique which are separated by a new line and are in increasing order.

NOTE
The order of printing each quadruple should be from lowest lexicographical quadruple to the highest and each quadruple must be printed in sorted order and only once.
It is guaranteed that at least one solution will always exist.Sample Input
5 3
0 0 2 1 1

Sample Output
0 0 1 2

Sample Input 
7 23
10 2 3 4 5 7 8

Sample Output
2 3 8 10 
2 4 7 10 
3 5 7 8 , I have written this Solution Code: #include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

map<int, vector<pi> > m;
map<pair<pi, pi>, int> m1;
int a[N];

signed main() {
	IOS;
	int n, k;	cin >> n >> k;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	sort(a + 1, a + n + 1);
	for(int i = 1; i <= n; i++)
		for(int j = i+1; j <= n; j++)
			m[a[i]+a[j]].push_back({i, j});
	for(int i = 1; i <= n; i++){
		for(int j = i+1; j <= n; j++){
			int cur = a[i] + a[j];
			int rem = k - cur;
			if(m.find(rem) != m.end()){
				for(auto p: m[rem]){
					if(p.fi != i && p.fi != j && p.se != i && p.se != j && j <= p.fi)
						m1[{{a[i], a[j]}, {a[p.fi], a[p.se]}}]++;
				}
			}
		}
	}
	for(auto i: m1){
		cout << i.fi.fi.fi << " " << i.fi.fi.se << " " << i.fi.se.fi << " " << i.fi.se.se << endl;
	}
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?