...And you didn't bother to even change the name of the code blocks.
If you're just straight out copy-pasting a problem along with their test data sets from another OJ site, don't do it. That's a very poor practice (plagiarizing content from other sites are never a good idea), and in CW you need test code that is at least descriptive, informative and has random tests. Which you have done none of.
Besides being a duplicate, the initial code and kata designs needs lots of revise:
using namespace std;
int n,int* a
const std::vector<int> xs
it is strange for soo many 0s lol