fork download
  1. #include<iostream>
  2. #include<vector>
  3. #include<algorithm>
  4. using namespace std;
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(false);
  8. long long n;
  9. cin>>n;
  10. vector<long long int> a(n);
  11. for(int i=0;i<n;i++)
  12. cin>>a[i];
  13. sort(a.begin(),a.end());
  14. int k=0;
  15. while(k<n)
  16. {
  17. if(a[k]!=a[k+1]&&a[k]!=a[k-1])
  18. break;
  19. else if(a[k]==a[k+1])
  20. k+=2;
  21. else
  22. k++;
  23. }
  24. cout<<a[k];
  25. }
  26.  
Runtime error #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty