iidai/codenet huggingface dataset:
Language: C++

#include <cstdio>
#define int long long
int n, m, mod, C[310][310], pre[310][310], f[310][310];
using namespace std;
signed main() {
    scanf("%lld%lld%lld", &n, &m, &mod);
    C[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        C[i][0] = C[i][i] = 1;
        for (int j = 1; j < i; j++)
            C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
    }
    for (int i = 0; i <= m; i++) f[1][i] = 1, pre[1][i] = m - i + 1;
    for (int i = 2; i <= n + 1; i++) {
        for (int j = 0; j <= m; j++)
            for (int k = 1; k < i; k++)
                (f[i][j] +=
                 f[i - k][j] * pre[k][j + 1] % mod * C[i - 2][k - 1]) %= mod;
        for (int j = m; j >= 0; j--)
            pre[i][j] = (pre[i][j + 1] + f[i][j]) % mod;
    }
    printf("%lld\n", f[n + 1][0]);
}

Example test case(s):
input: 2 2 100

output: 5
Language: C++

#include <iostream>
using namespace std;
int N, A;
int main() {
    cin >> N >> A;
    cout << (N % 500 <= A ? "Yes" : "No") << endl;
    return 0;
}

Example test case(s):
input: 2018
218

output: Yes
Language: C++

#include <cstring>
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

template <int V>
struct BitMatching {
    vector<int> G[2 * V];
    int match[2 * V];
    bool used[2 * V];

    void init() {
        for (int i = 0; i < 2 * V; i++) {
            G[i].clear();
        }
    }

    void add(int a, int b) {
        G[a].push_back(b + V);
        G[b + V].push_back(a);
    }

    bool dfs(int v) {
        used[v] = true;
        for (int i = 0; i < G[v].size(); i++) {
            int u = G[v][i], w = match[u];
            if (w < 0 || (!used[w] && dfs(w))) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }

    int exec() {
        int res = 0;
        memset(match, -1, sizeof(match));
        for (int v = 0; v < V; v++) {
            if (match[v] < 0) {
                memset(used, 0, sizeof(used));
                if (dfs(v)) {
                    res++;
                }
            }
        }
        return res;
    }
};

const int MN = 520;
BitMatching<MN> bm;
ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int main() {
    while (true) {
        int n, m;
        cin >> n >> m;
        if (!n) break;
        bm.init();
        int a[n], b[m];
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        for (int i = 0; i < m; i++) {
            cin >> b[i];
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (gcd(a[i], b[j]) != 1) {
                    bm.add(i, j);
                }
            }
        }
        cout << bm.exec() << endl;
    }
    return 0;
}

Example test case(s):
input: 4 3
2 6 6 15
2 3 5
2 3
4 9
8 16 32
4 2
4 9 11 13
5 7
5 5
2 3 5 1001 1001
7 11 13 30 30
10 10
2 3 5 7 9 11 13 15 17 29
4 6 10 14 18 22 26 30 34 38
20 20
195 144 903 63 137 513 44 626 75 473
876 421 568 519 755 840 374 368 570 872
363 650 155 265 64 26 426 391 15 421
373 984 564 54 823 477 565 866 879 638
100 100
195 144 903 63 137 513 44 626 75 473
876 421 568 519 755 840 374 368 570 872
363 650 155 265 64 26 426 391 15 421
373 984 564 54 823 477 565 866 879 638
117 755 835 683 52 369 302 424 513 870
75 874 299 228 140 361 30 342 750 819
761 123 804 325 952 405 578 517 49 457
932 941 988 767 624 41 912 702 241 426
351 92 300 648 318 216 785 347 556 535
166 318 434 746 419 386 928 996 680 975
231 390 916 220 933 319 37 846 797 54
272 924 145 348 350 239 563 135 362 119
446 305 213 879 51 631 43 755 405 499
509 412 887 203 408 821 298 443 445 96
274 715 796 417 839 147 654 402 280 17
298 725 98 287 382 923 694 201 679 99
699 188 288 364 389 694 185 464 138 406
558 188 897 354 603 737 277 35 139 556
826 213 59 922 499 217 846 193 416 525
69 115 489 355 256 654 49 439 118 961
0 0

output: 3
1
0
4
9
18
85
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int64_t> A(N);
    rep(i, N) cin >> A[i];

    int64_t answer = 0;
    for (int i = 0; i < N - 1; ++i) {
        for (int j = i + 1; j < N; ++j) {
            int64_t diff = abs(A[i] - A[j]);
            answer = max(answer, diff);
        }
    }
    cout << answer << endl;
    return 0;
}

Example test case(s):
input: 4
1 4 6 3

output: 5
Language: C++

#include <iostream>
using namespace std;

int main() {
    int A, B;
    cin >> A >> B;
    if (A < 13 && A >= 6) {
        cout << B / 2 << endl;
    }
    if (A < 6) {
        cout << 0 << endl;
    }
    if (A >= 13) {
        cout << B << endl;
    }
}

Example test case(s):
input: 30 100

output: 100
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
    int minA = pow(10, 9) + 1;
    int num = 0;

    int n, t, f = 0;
    cin >> n >> t;
    vector<int> A(n);

    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }

    for (int i = 0; i < n; i++) {
        if (minA > A[i]) {
            minA = A[i];
        } else {
            if (f == A[i] - minA)
                num++;
            else if (f < A[i] - minA) {
                num = 1;
                f = A[i] - minA;
            }
        }
    }

    cout << num << endl;
}

Example test case(s):
input: 3 2
100 50 200

output: 1
Language: C++

#include <iostream>
using namespace std;

class Cube {
   public:
    int f[6];
    Cube() {}
    void roll_z() { roll(1, 2, 4, 3); }
    void roll_y() { roll(0, 2, 5, 3); }
    void roll_x() { roll(0, 1, 5, 4); }
    void roll(int i, int j, int k, int l) {
        int t = f[i];
        f[i] = f[j];
        f[j] = f[k];
        f[k] = f[l];
        f[l] = t;
    }
};

bool eq(Cube c1, Cube c2) {
    for (int i = 0; i < 6; i++)
        if (c1.f[i] != c2.f[i]) return false;
    return true;
}

bool equal(Cube c1, Cube c2) {
    for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 4; j++) {
            if (eq(c1, c2)) return true;
            c1.roll_z();
        }
        if (i % 2 == 0)
            c1.roll_y();
        else
            c1.roll_x();
    }
    return false;
}

int main() {
    Cube c1, c2;

    for (int i = 0; i < 6; i++) cin >> c1.f[i];
    for (int i = 0; i < 6; i++) cin >> c2.f[i];

    if (equal(c1, c2))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Example test case(s):
input: 1 2 3 4 5 6
6 2 4 3 5 1

output: Yes
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main() {
    int i, n, ans;
    cin >> n;
    vector<int> p(n);
    for (i = 0; i < n; i++) {
        cin >> p[i];
    }
    ans = 0;
    for (i = 0; i < n - 1; i++) {
        if (p[i] == i + 1) {
            p[i + 1] = p[i];
            ans += 1;
        }
    }
    if (p[n - 1] == n) {
        ans += 1;
    }
    cout << ans << endl;
}

Example test case(s):
input: 5
1 4 3 5 2

output: 2
Language: C++

#include <math.h>

#include <iostream>
using namespace std;
typedef long long ll;

int n, a[50], p, b = 0, c = 0;

ll nPr(ll n, ll r) {
    ll res = 1;
    for (int i = 0; i < r; i++) {
        res *= (n - i);
    }

    return res;
}

ll nCr(ll n, ll r) {
    double res = 1;
    for (int i = 0; i < r; i++) {
        res *= (n - i);
        res /= (i + 1);
    }
    return (ll)res;
}

int main() {
    cin >> n >> p;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] % 2 == 0) {
            b++;
        } else {
            c++;
        }
    }

    ll bsum = 0, csum = 0;
    bsum = (ll)pow(2, b);

    if (p == 0) {
        for (int i = 0; i <= c; i++) {
            if (i % 2 == 0) {
                csum += nCr(c, i);
            }
        }
    } else {
        for (int i = 0; i <= c; i++) {
            if (i % 2 == 1) {
                csum += nCr(c, i);
            }
        }
    }

    ll ans = bsum * csum;
    cout << ans << endl;
}

Example test case(s):
input: 2 0
1 3

output: 2
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef pair<int, string> P;
P v[22];
vector<int> d[33];
int main(void) {
    int n;
    while (cin >> n && n) {
        int m;
        for (int i = 0; i < 33; i++) d[i].clear();
        for (int i = 0; i < n; i++) {
            v[i].first = 0;
            cin >> v[i].second >> m;
            for (int j = 0; j < m; j++) {
                int a;
                cin >> a;
                v[i].first += n - (int)d[a].size();
                for (int k = 0; k < (int)d[a].size(); k++) {
                    v[d[a][k]].first--;
                }
                d[a].push_back(i);
            }
        }
        sort(v, v + n);
        cout << v[0].first << " " << v[0].second << endl;
    }
}

Example test case(s):
input: 4
akzakr 2 1 8
fnmyi 5 2 3 4 6 9
tsnukk 5 2 3 4 7 9
yskwcnt 6 3 4 7 8 9 10
4
akzakr 1 2
fnmyi 3 10 11 12
tsnukk 2 1 8
yskwcnt 2 1 8
5
knmmdk 2 13 19
akmhmr 4 13 15 19 22
mksyk 6 3 7 12 13 15 19
skrkyk 3 1 4 8
tmemm 3 1 17 24
5
knmmdk 5 5 6 16 18 26
akmhmr 9 3 4 7 11 14 15 17 18 20
mksyk 5 6 13 25 27 28
skrkyk 4 3 16 23 24
tmemm 3 6 12 20
14
hrkamm 6 4 6 8 10 20 22
mkhsi 6 1 10 12 15 22 27
hbkgnh 2 4 9
chyksrg 8 3 4 12 15 16 20 25 28
mktkkc 6 0 1 8 15 17 20
tknsj 6 6 8 18 19 25 26
yyitktk 3 3 12 18
ykhhgwr 5 3 9 10 11 24
amftm 7 2 6 8 12 13 14 17
mmftm 4 6 12 16 18
rtkakzk 3 14 15 21
azsmur 7 1 2 4 12 15 18 20
iormns 2 4 20
ktrotns 6 7 12 14 17 20 25
14
hrkamm 2 4 21
mkhsi 6 2 3 8 11 18 20
hbkgnh 4 4 16 28 29
chyksrg 5 0 3 9 17 22
mktkkc 2 7 18
tknsj 3 3 9 23
yyitktk 3 10 13 25
ykhhgwr 2 18 26
amftm 3 13 18 22
mmftm 4 1 20 24 27
rtkakzk 2 1 10
azsmur 5 2 5 10 14 17
iormns 3 9 15 16
ktrotns 5 7 12 16 17 20
0

output: 7 akzakr
4 akzakr
6 knmmdk
12 tmemm
19 iormns
24 mktkkc
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int N, T;
    cin >> N >> T;
    int A[N];
    vector<int> B(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    int m = A[0];
    B[1] = A[1] - m;
    m = min(m, A[1]);
    for (int i = 2; i < N; i++) {
        B[i] = A[i] - m;
        m = min(m, A[i]);
    }
    cout << count(B.begin(), B.end(), *max_element(B.begin(), B.end())) << endl;
}

Example test case(s):
input: 3 2
100 50 200

output: 1
Language: C++

#include <math.h>
#include <string.h>

#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
#define REP(i, n) for (long long i = 0; i < (long long)(n); i++)
#define pb push_back
#define INF (ll)1e18

ll mod = 1e9 + 7;

int main() {
    ll N, K;
    cin >> N >> K;
    ll A[N];
    REP(i, N) cin >> A[i];

    ll ans1 = 0;
    REP(i, N) {
        REP(j, N) {
            if (i >= j) continue;
            if (A[i] > A[j]) ans1++;
            ans1 %= mod;
        }
    }

    ll count[2005] = {0};
    REP(i, N) { count[A[i] - 1]++; }

    ll ans2 = 0;
    ll remain = N;
    REP(i, 2005) {
        remain -= count[i];
        ans2 += count[i] * remain;
    }

    ll ans = 0;
    ll tmp = K * (K - 1);
    tmp /= 2;
    tmp %= mod;
    tmp *= ans2;
    tmp %= mod;
    ans += ans1 * K;
    ans %= mod;
    ans += tmp;
    ans %= mod;

    cout << ans << endl;
}

Example test case(s):
input: 2 2
2 1

output: 3
Language: C++

#include <algorithm>
#include <iostream>
#include <string>
int main() {
    using namespace std;
    string s, t;
    cin >> s;
    t = s[0];
    t += to_string(s.size() - 2);
    t += s[s.size() - 1];
    cout << t << endl;
}

Example test case(s):
input: internationalization

output: i18n
Language: C++

#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <vector>

using namespace std;

bool solve() {
    int maxsize = 0;
    int maxcnt = 0;
    int ans_num;
    int ans_num2;
    vector<string> str_v;

    string in;
    while (cin >> in) {
        str_v.push_back(in);
        if (maxsize < in.size()) {
            maxsize = in.size();
            ans_num = str_v.size() - 1;
        }
    }
    for (int i = 0; i < str_v.size(); i++) {
        int cnt = 0;
        for (int j = 0; j < str_v.size(); j++) {
            if (str_v[i] == str_v[j]) cnt++;
        }
        if (maxcnt < cnt) {
            maxcnt = cnt;
            ans_num2 = i;
        }
    }

    cout << str_v[ans_num2] << " " << str_v[ans_num] << endl;

    return true;
}

int main() {
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();

    return 0;
}

Example test case(s):
input: Thank you for your mail and your lectures

output: your lectures
Language: C++

#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>

using namespace std;
using ll = long long int;

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    int r;
    while ((r = a % b) > 0) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    int n;
    cin >> n;

    int ans;
    cin >> ans;

    for (int i = 1; i < n; ++i) {
        int a;
        cin >> a;
        ans = gcd(ans, a);
    }

    cout << ans << endl;

    return 0;
}

Example test case(s):
input: 4
2 10 8 40

output: 2
Language: C++

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy[4] = {-1, 0, +1, 0};
int dx[4] = {0, +1, 0, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s) {
    return f.second > s.second;
}

int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main(void) {
    int n;

    cin >> n;

    string s = "";

    if (n == 0) {
        cout << '0' << endl;
        return 0;
    }

    int i = 1;
    while (n != 0) {
        if (n % 2 == 0) {
            s += '0';
        } else {
            s += '1';
        }

        n -= abs(n % 2);

        n /= -2;
    }

    reverse(s.begin(), s.end());

    cout << s << endl;
}

Example test case(s):
input: -9

output: 1011
Language: C++

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;
using Pll = pair<ll, ll>;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;

int main() {
    ll a, b;
    cin >> a >> b;
    cout << max(a + b, max(a - b, a * b)) << endl;

    return 0;
}

Example test case(s):
input: -13 3

output: -10
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

const int SIZE = (1e5 * 2) + 13;

vector<int> a;
vector<int> cnt(SIZE);

int main() {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        cnt[x]++;
    }
    for (int i = 0; i < cnt.size(); ++i) {
        if (cnt[i] > 0) a.push_back(cnt[i]);
    }
    int ans = 0;
    sort(a.begin(), a.end());
    int m = a.size() - k;
    for (int i = 0; i < m; ++i) {
        ans += a[i];
    }
    cout << ans << endl;
}

Example test case(s):
input: 5 2
1 1 2 2 5

output: 1
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int r;
    cin >> r;

    cout << (r * r) << endl;
}

Example test case(s):
input: 2

output: 4
Language: C++

#include <math.h>
#include <stdio.h>

#include <algorithm>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
const ll MOD = 1e9 + 7;

ll pow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res *= a;
        a *= a;
        n >>= 1;
    }
    return res;
}

ll mod_pow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll a, ll mod) { return mod_pow(a, mod - 2, mod); }

ll mod_nCk(int n, int k, int mod) {
    if (n == 0 || k == 0) return 1;
    ll p = 1, q = 1;
    for (int i = n - k + 1; i <= n; i++) p = (p * i) % MOD;
    for (int i = 2; i <= k; i++) q = (q * i) % MOD;
    q = mod_inv(q, MOD);
    return (p * q) % MOD;
}

int main() {
    int n, k;
    cin >> n >> k;
    cout << mod_nCk(k, n, MOD) << endl;
}

Example test case(s):
input: 3 5

output: 10
Language: C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

#define reps(i, f, n) for (int i = f; i < int(n); i++)
#define rep(i, n) reps(i, 0, n)

int here[100001];
int dp1[100001];
int dp2[100001];

int main() {
    while (1) {
        int n, m;
        cin >> n >> m;
        if (n == 0) break;

        rep(i, 100001) here[i] = dp1[i] = dp2[i] = 0;

        bool dpflg = false;

        rep(i, m) {
            int a;
            cin >> a;
            if (a == 0) dpflg = true;

            here[a] = 1;
        }

        int maxi1 = 0;
        int maxi2 = 0;

        reps(i, 1, n + 1) {
            if (here[i] == 1) dp1[i] = dp1[i - 1] + 1;
            maxi1 = max(dp1[i], maxi1);
        }

        reps(i, 1, n + 1) {
            if (here[i] == 1)
                dp2[i] = dp2[i - 1] + 1;
            else
                dp2[i] = dp1[i - 1] + 1;
            maxi2 = max(dp2[i], maxi2);
        }

        if (!dpflg) {
            printf("%d\n", maxi1);
        } else {
            printf("%d\n", maxi2);
        }
    }
}

Example test case(s):
input: 7 5
6
2
4
7
1
7 5
6
2
0
4
7
0 0

output: 2
4
Language: C++

#include <cstdio>
#include <iostream>
using namespace std;

inline int read() {
    int k = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        k = k * 10 + ch - '0';
        ch = getchar();
    }
    return k * f;
}

inline void write(int x) {
    if (x < 0) x = -x, putchar('-');
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

inline void writeln(int x) {
    write(x);
    puts("");
}

int n, m, l, r, vi, fa[100005], v[200005];

inline int get(int x) {
    if (x == fa[x]) return x;
    int f = get(fa[x]);
    v[x] += v[fa[x]];
    return fa[x] = f;
}

int main() {
    n = read();
    m = read();
    for (int i = 1; i <= n; i++) fa[i] = i;
    for (int i = 1; i <= m; i++) {
        l = read();
        r = read();
        vi = read();
        int li = get(l), ri = get(r);
        if (li != ri) {
            v[ri] = vi - v[r] + v[l];
            fa[ri] = li;
        } else {
            if (v[r] - v[l] != vi) {
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";
    return 0;
}

Example test case(s):
input: 3 3
1 2 1
2 3 1
1 3 2

output: Yes
Language: C++

#include <stdio.h>

int main() {
    int A[100], n, i, j, t, sw = 0, mini;

    scanf("%d", &n);
    for (i = 0; i < n; i++) scanf("%d", &A[i]);

    for (i = 0; i < n; i++) {
        mini = i;
        for (j = i; j < n; j++) {
            if (A[j] < A[mini]) mini = j;
        }
        t = A[i];
        A[i] = A[mini];
        A[mini] = t;
        if (i != mini) sw++;
    }

    for (i = 0; i < n; i++) {
        if (i) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n");
    printf("%d\n", sw);

    return 0;
}

Example test case(s):
input: 6
5 6 4 2 1 3

output: 1 2 3 4 5 6
4
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
using namespace std;

typedef long long ll;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << (a - c) * (b - d) << endl;
}

Example test case(s):
input: 3 2
2 1

output: 1
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <vector>
using namespace std;
#define int long long int
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string str;
    cin >> str;
    int sum = 0;
    for (char x : str) {
        sum += (x - 48);
    }
    if (sum % 9 == 0) {
        cout << "Yes" << endl;
    } else
        cout << "No" << endl;
}

Example test case(s):
input: 123456789

output: Yes
Language: C++

#include <iostream>
using namespace std;

long long Euclid(long long x, long long y) {
    long long tmp;

    if (x < y) {
        tmp = x;
        x = y;
        y = tmp;
    }

    if (!(x % y)) return y;
    return Euclid(y, x % y);
}

int main() {
    long long A, B;
    cin >> A >> B;

    cout << (A * B) / Euclid(A, B) << endl;
}

Example test case(s):
input: 2 3

output: 6
Language: C++

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iostream>
using namespace std;
int main(void) {
    int n, a[100];
    double avg = 0, s, ans;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        avg += a[i];
    }
    avg /= n;
    s = abs(a[0] - avg);
    ans = 0;
    for (int i = 1; i < n; i++) {
        if (s > abs(a[i] - avg)) {
            s = abs(a[i] - avg);
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}

Example test case(s):
input: 3
1 2 3

output: 1
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int ans = 0;
    bool ok = true;
    while (ok) {
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 == 1) {
                cout << ans << endl;
                return 0;
            } else {
                a[i] /= 2;
            }
        }
        ans++;
    }

    cout << ans << endl;
}

Example test case(s):
input: 3
8 12 40

output: 2