func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 10005;   long long n, m, a[maxn], b[maxn];   int k;   long long gcd(long long a, long long b) {     if (!b) return a;     return gcd(b, a % b);   }   long long exgcd(long long a, long long b, long long &x, long long &y) {     if (!b) {       x = 1, y = 0;       return a;     }     long long r = exgcd(b, a % b, x, y), x0 = x;     x = y;     y = x0 - (a / b) * y;     return r;   }   long long CRT(long long *m, long long *a) {     long long lcm = 1, X = m[1], Y = a[1];     for (int i = 1; i <= k; i++) lcm = lcm / gcd(lcm, m[i]) * m[i];     for (int i = 2; i <= k; i++) {       long long A = X, B = m[i], d, x, y, c = a[i] - Y;       d = exgcd(A, B, x, y);       if (c % d) return -1;       long long mod = m[i] / d;       long long K = ((x * c / d) % mod + mod) % mod;       Y = X * K + Y;       X = X * m[i] / d;     }     if (Y == 0) return lcm;     return Y;   }   bool check() {     long long I = CRT(a, b), J;     if (I > n || I <= 0) return 0;     for (int i = 1; i <= k; i++) b[i] = 1 - i;     J = CRT(a, b);     if (J + k - 1 > m || J <= 0) return 0;     for (int i = 1; i <= k; i++)       if (gcd(I, J + i - 1) != a[i]) return 0;     return 1;   }   int main() {     cin >> n >> m >> k;     for (int i = 1; i <= k; i++) cin >> a[i];     if (check())       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }   