func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1000;   int dist[N * N], memo[N * N];   vector<pair<int, int>> H, T;   vector<int> ladj[N * N];   int vis[N * N];   inline int f(int x, int y) { return x * N + y; }   int bfs(int start) {     int n = N * N;     fill(dist, dist + n, INT_MAX);     fill(memo, memo + n, -1);     dist[start] = 0;     queue<int> Q;     Q.push(start);     while (!Q.empty()) {       int u = Q.front();       Q.pop();       for (int i = 0; i < (int)ladj[u].size(); i++) {         int v = ladj[u][i];         if (dist[v] > dist[u] + 1) {           dist[v] = dist[u] + 1;           Q.push(v);         }       }     }     return dist[0];   }   bool hasCycle(int start) {     if (vis[start] == -1) return true;     if (vis[start]) return false;     vis[start] = -1;     for (int i = 0; i < (int)ladj[start].size(); i++) {       int u = ladj[start][i];       if (hasCycle(u)) return true;     }     vis[start] = 1;     return false;   }   int dp(int u) {     int &ans = memo[u];     if (ans != -1) return ans;     ans = 0;     if (ladj[u].empty()) return 0;     for (int i = 0; i < (int)ladj[u].size(); i++) {       int v = ladj[u][i];       ans = max(ans, dp(v));     }     return ++ans;   }   int main() {     int h, t, r;     cin >> h >> t >> r;     int n;     cin >> n;     H.resize(n);     for (int i = 0; i < n; i++) cin >> H[i].first >> H[i].second;     int m;     cin >> m;     T.resize(m);     for (int i = 0; i < m; i++) cin >> T[i].first >> T[i].second;     for (int i = 0; i <= r; i++)       for (int j = 0; j <= r; j++)         if (i + j <= r) {           for (int k = 1; k <= n && k <= i; k++)             ladj[f(i, j)].push_back(                 f(i - k + H[k - 1].first, j + H[k - 1].second));           for (int k = 1; k <= m && k <= j; k++)             ladj[f(i, j)].push_back(                 f(i + T[k - 1].first, j - k + T[k - 1].second));         }     int start = f(h, t), ans = bfs(start);     if (ans < INT_MAX)       cout <<  Ivan  << endl << ans << endl;     else if (hasCycle(start))       cout <<  Draw  << endl;     else       cout <<  Zmey  << endl << dp(start) << endl;     return 0;   }   