#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define PI 3.14159265359
#define dmin 1e-9
#define dd double
#define ll long long
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define pb push_back
#define vi vector<ll>
#define vpi vector<pair<ll, int>>
#define srt(a) sort(a.begin(), a.end())
#define rsrt(a) sort(a.rbegin(), a.rend())
#define nn "\n"
#define nl cout << "\n"
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL);
#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rloop(i, a, b) for (int i = (a); i <= (b); ++i)
void print(vector<ll> &a) { loop(i, 0, a.size()) cout << a[i] << ' '; }
template <typename T>
using my_ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void mdmerazulislam()
{
ll n, k, k1;
cin >> n >> k >> k1;
vi a(n);
loop(i, 0, n) cin >> a[i];
srt(a);
ll s = 0, mx = 0, cnt = n-k1;
loop(i,0,n)
{
if (i < cnt)
s += a[i];
else
s -= a[i];
}
ll rst = s;
for (int i = n - 1; i >= n - k; i--)
{
if (i >= cnt)
{
s += a[i];
if (cnt - 1 >= 0)
s -= 2 * a[cnt - 1];
cnt--;
rst = max(s, rst);
}
}
cout << rst << endl;
}
int main()
{
fast;
int t;
cin >> t;
while (t--)
mdmerazulislam();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxleHQvcGJfZHMvYXNzb2NfY29udGFpbmVyLmhwcD4KI2luY2x1ZGUgPGV4dC9wYl9kcy90cmVlX3BvbGljeS5ocHA+CnVzaW5nIG5hbWVzcGFjZSBfX2dudV9wYmRzOwp1c2luZyBuYW1lc3BhY2Ugc3RkOwojZGVmaW5lIFBJIDMuMTQxNTkyNjUzNTkKI2RlZmluZSBkbWluIDFlLTkKI2RlZmluZSBkZCBkb3VibGUKI2RlZmluZSBsbCBsb25nIGxvbmcKI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YgKGkgPCBjbnQpCiAgICAgICAgICAgIHMgKz0gYVtpXTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHMgLT0gYVtpXTsKICAgIH0KCiAgICBsbCByc3QgPSBzOwogICAgZm9yIChpbnQgaSA9IG4gLSAxOyBpID49IG4gLSBrOyBpLS0pCiAgICB7CiAgICAgICAgaWYgKGkgPj0gY250KQogICAgICAgIHsKICAgICAgICAgICAgcyArPSBhW2ldOwogICAgICAgICAgICBpZiAoY250IC0gMSA+PSAwKQogICAgICAgICAgICAgICAgcyAtPSAyICogYVtjbnQgLSAxXTsKICAgICAgICAgICAgY250LS07CiAgICAgICAgICAgIHJzdCA9IG1heChzLCByc3QpOwogICAgICAgIH0KICAgIH0KICAgIGNvdXQgPDwgcnN0IDw8IGVuZGw7CgogICAgCn0KCmludCBtYWluKCkKewogICAgZmFzdDsKCiAgICBpbnQgdDsKICAgIGNpbiA+PiB0OwogICAgd2hpbGUgKHQtLSkKICAgICAgICBtZG1lcmF6dWxpc2xhbSgpOwoKICAgIHJldHVybiAwOwp9
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
^
Main.java:2: error: illegal character: '#'
#include <ext/pb_ds/assoc_container.hpp>
^
Main.java:3: error: illegal character: '#'
#include <ext/pb_ds/tree_policy.hpp>
^
Main.java:5: error: class, interface, or enum expected
using namespace std;
^
Main.java:6: error: illegal character: '#'
#define PI 3.14159265359
^
Main.java:6: error: class, interface, or enum expected
#define PI 3.14159265359
^
Main.java:7: error: illegal character: '#'
#define dmin 1e-9
^
Main.java:8: error: illegal character: '#'
#define dd double
^
Main.java:9: error: illegal character: '#'
#define ll long long
^
Main.java:10: error: illegal character: '#'
#define yes cout << "YES\n"
^
Main.java:11: error: illegal character: '#'
#define no cout << "NO\n"
^
Main.java:12: error: illegal character: '#'
#define pb push_back
^
Main.java:13: error: illegal character: '#'
#define vi vector<ll>
^
Main.java:14: error: illegal character: '#'
#define vpi vector<pair<ll, int>>
^
Main.java:15: error: illegal character: '#'
#define srt(a) sort(a.begin(), a.end())
^
Main.java:16: error: illegal character: '#'
#define rsrt(a) sort(a.rbegin(), a.rend())
^
Main.java:17: error: illegal character: '#'
#define nn "\n"
^
Main.java:18: error: illegal character: '#'
#define nl cout << "\n"
^
Main.java:19: error: illegal character: '#'
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL);
^
Main.java:20: error: illegal character: '#'
#define loop(i, a, b) for (int i = (a); i < (b); ++i)
^
Main.java:20: error: class, interface, or enum expected
#define loop(i, a, b) for (int i = (a); i < (b); ++i)
^
Main.java:20: error: class, interface, or enum expected
#define loop(i, a, b) for (int i = (a); i < (b); ++i)
^
Main.java:20: error: class, interface, or enum expected
#define loop(i, a, b) for (int i = (a); i < (b); ++i)
^
Main.java:21: error: illegal character: '#'
#define rloop(i, a, b) for (int i = (a); i <= (b); ++i)
^
Main.java:21: error: class, interface, or enum expected
#define rloop(i, a, b) for (int i = (a); i <= (b); ++i)
^
Main.java:21: error: class, interface, or enum expected
#define rloop(i, a, b) for (int i = (a); i <= (b); ++i)
^
Main.java:22: error: class, interface, or enum expected
void print(vector<ll> &a) { loop(i, 0, a.size()) cout << a[i] << ' '; }
^
Main.java:26: error: class, interface, or enum expected
void mdmerazulislam()
^
Main.java:29: error: class, interface, or enum expected
cin >> n >> k >> k1;
^
Main.java:30: error: class, interface, or enum expected
vi a(n);
^
Main.java:31: error: class, interface, or enum expected
loop(i, 0, n) cin >> a[i];
^
Main.java:32: error: class, interface, or enum expected
srt(a);
^
Main.java:33: error: class, interface, or enum expected
ll s = 0, mx = 0, cnt = n-k1;
^
Main.java:34: error: class, interface, or enum expected
loop(i,0,n)
^
Main.java:38: error: class, interface, or enum expected
else
^
Main.java:40: error: class, interface, or enum expected
}
^
Main.java:43: error: class, interface, or enum expected
for (int i = n - 1; i >= n - k; i--)
^
Main.java:43: error: class, interface, or enum expected
for (int i = n - 1; i >= n - k; i--)
^
Main.java:43: error: class, interface, or enum expected
for (int i = n - 1; i >= n - k; i--)
^
Main.java:48: error: class, interface, or enum expected
if (cnt - 1 >= 0)
^
Main.java:50: error: class, interface, or enum expected
cnt--;
^
Main.java:51: error: class, interface, or enum expected
rst = max(s, rst);
^
Main.java:52: error: class, interface, or enum expected
}
^
Main.java:57: error: class, interface, or enum expected
}
^
Main.java:63: error: class, interface, or enum expected
int t;
^
Main.java:64: error: class, interface, or enum expected
cin >> t;
^
Main.java:65: error: class, interface, or enum expected
while (t--)
^
Main.java:68: error: class, interface, or enum expected
return 0;
^
Main.java:69: error: class, interface, or enum expected
}
^
50 errors