For this Question: You are given an integer array nums. The unique elements of an array are the elements that appear exactly once in the array.

Return the sum of all the unique elements of nums.first line contains an integer n, that tell about size of array.
then next line line contains n space separated integers.

Constrains:
1<= n <=100000 
1 <= nums[i] <= 1000print the sum of all the unique elements of nums.Sample Input:
4
1 2 3 2

Sample Output:
4

Explanation:The unique elements are (1, 3), and the sum is 4., I have written this Solution Code: #include <iostream>
#include <unordered_set>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

// Function to find a pair with the given difference in an array.
// This method handles duplicates in the array

int main()
{
   int n;
   cin>>n;
   vector<int> v(n);
   map<int,int> mp;
   for(int i=0;i<n;i++){
    cin>>v[i];
    mp[v[i]]++;
    }
    int ans=0;
    for(auto x:mp){
        if(x.second==1)ans+=x.first;
    } 
    cout<<ans<<endl;

    return 0;
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?