Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdlib>
- #include<vector>
- #include<unordered_map>
- #define long long long
- #define nln '\n'
- using namespace std;
- int main()
- {
- cin.tie(0)->sync_with_stdio(0);
- cout.tie(0)->sync_with_stdio(0);
- //freopen("capdoi.inp", "r", stdin);
- long n, x;
- cin >> n >> x;
- unordered_map<long, long> sum;
- long ans = 0;
- while (n--){
- long y;
- cin >> y;
- ans += sum[x-y];
- ++sum[y];}
- cout << ans << nln;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment