fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a,b,c,d,e,f;
  6. cin >> a >> b >> c >> d >> e >> f;
  7.  
  8. vector<int> t1 = {a,b,c}, t2 = {d,e,f};
  9. sort(t1.begin(), t1.end());
  10. sort(t2.begin(), t2.end());
  11.  
  12. if (t1[0] + t2[0] == t1[1] && t1[1] == t2[1] && t1[2] == t2[2])
  13. cout << t1[1] * t1[2];
  14. else
  15. cout << -1;
  16. }
  17.  
Success #stdin #stdout 0.01s 5320KB
stdin
3 4 5 3 4 5

stdout
-1