26 lines
392 B
C++
26 lines
392 B
C++
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
ios::sync_with_stdio(0);
|
|
cin.tie(0);
|
|
|
|
vector<int> l1;
|
|
multiset<int> l2;
|
|
string line;
|
|
while (getline(cin, line) && !line.empty()) {
|
|
istringstream l(line);
|
|
int a, b;
|
|
l >> a >> b;
|
|
l1.push_back(a);
|
|
l2.insert(b);
|
|
}
|
|
|
|
long long result = 0;
|
|
for (auto i : l1) {
|
|
result += i * l2.count(i);
|
|
}
|
|
|
|
cout << result << '\n';
|
|
}
|