func_code_string: #include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   long long ext_gcd(long long a, long long b, long long& x, long long& y) {     long long t, ret;     if (!b) {       x = 1, y = 0;       return a;     }     ret = ext_gcd(b, a % b, x, y);     t = x, x = y, y = t - a / b * y;     return ret;   }   long long Invmod(long long a, long long n) {     long long x, y;     if (ext_gcd(a, n, x, y) != 1) return -1;     return (x % n + n) % n;   }   long long mul(long long x, long long y, long long mod) {     x %= mod, y %= mod;     if (!x || !y) return 0;     if (y & 1)       return (x + 2 * mul(x, y >> 1, mod)) % mod;     else       return 2 * mul(x, y >> 1, mod) % mod;   }   long long mergef(long long b1, long long c1, long long b2, long long c2,                    long long& b, long long& c) {     swap(b1, c1);     swap(b2, c2);     c1 = (c1 % b1 + b1) % b1;     c2 = (c2 % b2 + b2) % b2;     long long tb1 = b1, tb2 = b2;     c = ((c2 - c1) % b2 + b2) % b2;     long long G = gcd(b1, b2);     if (c % G) return 0;     c /= G;     b1 /= G;     b2 /= G;     assert(tb1 % G == 0);     b = tb1 / G * tb2;     c = mul(c, Invmod(b1, b2), b);     c = mul(tb1 % b, c, b);     c += c1;     c %= b;     swap(b, c);     return 1;   }   const int maxn = 10000 + 10;   long long data[maxn];   int main() {     long long n, m, k;     while (cin >> n >> m >> k) {       long long lcm = 1;       bool fail = false;       for (int i = 1; i <= k; ++i) {         cin >> data[i];         lcm = lcm / gcd(lcm, data[i]);         if (fail || 1. * lcm * data[i] > 1e13 || lcm * data[i] > n)           fail = true;         else           lcm = lcm * data[i];       }       if (fail) {         puts( NO );         continue;       }       long long b = 0, c = 1;       for (int i = 1; i <= k; ++i) {         if (mergef(b, c, ((-i + 1) % data[i] + data[i]) % data[i], data[i], b, c))           ;         else {           fail = true;           break;         }       }       if (b == 0) b = lcm;       if (b + k - 1 > m) fail = true;       if (fail) {         puts( NO );         continue;       }       for (int i = 1; i <= k; ++i) {         if (gcd(b + i - 1, lcm) != data[i]) {           fail = true;         }       }       puts(fail ?  NO  :  YES );     }     return 0;   }   