func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   T euclideanistance(T x1, T x2, T y1, T y2) {     return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));   }   template <class T>   T digitSum(T n) {     T sum = 0;     while (n > 0) sum += n % 10, n /= 10;     return sum;   }   const double INF = 1e+9;   const double EPS = 1e-9;   const double PI = 3.1415926;   const int knightDir[8][2] = {{-2, -1}, {-2, 1}, {-1, 2},  {1, 2},                                {2, -1},  {2, 1},  {-1, -2}, {1, -2}};   const int dx[] = {-1, 0, 1, 0};   const int dy[] = {0, 1, 0, -1};   int chk(pair<int, int> a, pair<int, int> b) {     if (a.first == b.first && a.first != b.second && a.second != b.first &&         a.second != b.second)       return 1;     if (a.first != b.first && a.first == b.second && a.second != b.first &&         a.second != b.second)       return 1;     if (a.first != b.first && a.first != b.second && a.second == b.first &&         a.second != b.second)       return 1;     if (a.first != b.first && a.first != b.second && a.second != b.first &&         a.second == b.second)       return 1;     return 0;   }   int getIndex(pair<int, int> a, pair<int, int> b) {     if (a.first == b.first && a.first != b.second && a.second != b.first &&         a.second != b.second)       return a.first;     if (a.first != b.first && a.first == b.second && a.second != b.first &&         a.second != b.second)       return a.first;     if (a.first != b.first && a.first != b.second && a.second == b.first &&         a.second != b.second)       return a.second;     if (a.first != b.first && a.first != b.second && a.second != b.first &&         a.second == b.second)       return a.second;   }   int main() {     int n, m, can = 0, all = 0;     vector<pair<int, int> > a, b;     scanf( %d%d , &n, &m);     a.resize(n);     b.resize(m);     for (int i = 0; i < n; i++) scanf( %d%d , &a[i].first, &a[i].second);     for (int i = 0; i < m; i++) scanf( %d%d , &b[i].first, &b[i].second);     vector<int> alls(10);     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (chk(a[i], b[j])) {           vector<int> c1(10);           vector<int> c2(10);           for (int k = 0; k < m; k++) {             if (chk(a[i], b[k])) {               c1[getIndex(a[i], b[k])] = 1;             }           }           for (int k = 0; k < n; k++) {             if (chk(a[k], b[j])) {               c2[getIndex(a[k], b[j])] = 1;             }           }           if (count(c1.begin(), c1.end(), 1) == 1 &&               count(c2.begin(), c2.end(), 1) == 1)             can++;           alls[getIndex(a[i], b[j])] = 1;           all++;         }       }     }     if (count(alls.begin(), alls.end(), 1) == 1) {       for (int i = 1; i <= 10; i++) {         if (alls[i]) {           printf( %d n , i);           return 0;         }       }     }     if (can == all) {       printf( 0 n );       return 0;     }     printf( -1 n );   }   