Here is my solution using if else and it is easy to understand. #include<cmath>#include<cstdio>#include<vector>#include<iostream>#include<set>#include<algorithm>usingnamespacestd;intmain(){intn,y,x;set<int>s;cin