# [C++ (clang)], <sup><s>280</s> <s>278</s></sup> 277 bytes <!-- language-all: lang-cpp --> #import<bits/stdc++.h> #define S(v)sort(v.begin(),v.end()); using namespace std;using V=vector<int>;V f(V&v){vector<V>w;map<int,int>m;S(v)for(int a:v)for(int b:v)for(int c:v)if(a+b+c==v.back()){V x={a,b,c};S(x)m[x[2]-x[0]]=w.size();w.push_back(x);}return w[m.begin()->second];} [Try it online!][TIO-kxqe9w0c] [C++ (clang)]: http://clang.llvm.org/ [TIO-kxqe9w0c]: https://tio.run/##pdTvb6IwGAfw9/4VT1xiYKI3foOI9@Jyf8ElvnHkglgd2QRCUckZ/vVz3xZRd9uSS2aCKe2n7UOftklRjJKXONucTnfptsjLarpMK/6NV6tkOBw/zXp3K7ZOM0a/lL3K0a7sx0u2STNF1fZjlq0UVQ16O55mG8riLeNFnDBC96Ctm4d7llR5OU2zahbMaa3MB3v1eK6czw7BNi5EoybANhDTrPNSwRvFk2t5eVNOUE7XSjxcDpMwRDxx8owwjnOqw2OsLbWkwTi1ul3UCyMa1YuHKAoPY57@YYoaHMbFjj/9lp1qNWhKVu3KjA6LbfdhoxlnSZ6toqA5ifm2sag99gg/1HNE8BSX9/hnyTMrFxGFdOw/1j@Nx9r/gcfua3T7bvabQPbGukwml2@nivGKi85HXSNDI1MjSyNbI0cjVyNPI18j/aHR6C14V/FvDzxo1wF0CB1Eh9GBdCgdTIcz4AwxDpwBZ8AZcAacAWfAGXAmnAlnignhTDgTzoQz4Uw4E86Cs@AsOEtEBmfBWXAWnAVnwdlwNpwNZ8PZ4hPgbDgbzoaz4Rw4B86Bc@AcOEd8K5wD58A5cC6cC@fCuXAunAvnikWBc@FcOA/Og/PgPDgPzoPz4DyxenAenA/nw/lwPpwP58P5cD6cL5ZZrnOXmjYHbT58mQa3TYNzBd5NQpzz4osFd5uPNwerC5TZSu4Ps031NfGGKMpkyITItzdGzmN2Y@PokDw7abZiNYZ8CM7FabsLu9NBw6GsV6nd7@I3pwo9JFvIxii4tMmgk3xX0XRK/UX/2iKnbI9LvKvyAaVVSROqbkd@N4IyECoMaXBfdceRvlO/j57iUKkCgVynaT4JJaLRjG7CmZM4aWulUr8QPP/f4PlXg38TOUPk3Xb4OAPyZmaXm5nY5Wru2DLPX6iIuVgFJoLkn6xDd6sJG8loHrNzNE2vOf1N1i/xhp9Gh1c "C++ (clang) – Try It Online" Inputs a vector of integers. Returns the vector with the minimum difference between the smallest and the largest element from all the cartesian products of 3 elements that add up to the maximum of the input vector.