Submission details
Task:Weak rook
Sender:aalto26km_049
Submission time:2026-11-16 16:51:15 +0200
Language:C++ (C++20)
Status:READY
Result:
Test results
testverdicttime
#10.00 sdetails
#20.00 sdetails
#30.00 sdetails
#40.00 sdetails
#50.00 sdetails
#60.00 sdetails
#70.00 sdetails
#80.00 sdetails
#90.00 sdetails
#100.00 sdetails
#110.00 sdetails
#120.00 sdetails
#130.00 sdetails
#140.00 sdetails
#150.00 sdetails
#160.00 sdetails
#170.00 sdetails
#180.00 sdetails
#190.00 sdetails
#200.00 sdetails
#210.00 sdetails
#220.00 sdetails
#230.00 sdetails
#240.00 sdetails
#250.00 sdetails
#260.00 sdetails
#270.00 sdetails
#280.00 sdetails
#290.00 sdetails
#300.00 sdetails
#310.00 sdetails
#320.00 sdetails
#330.00 sdetails
#340.00 sdetails
#350.00 sdetails
#360.00 sdetails
#370.00 sdetails
#380.00 sdetails
#390.00 sdetails
#400.00 sdetails
#410.00 sdetails
#420.00 sdetails
#430.00 sdetails
#440.00 sdetails
#450.00 sdetails
#460.01 sdetails
#470.01 sdetails
#480.01 sdetails
#490.01 sdetails
#500.01 sdetails
#510.01 sdetails
#520.01 sdetails
#530.01 sdetails
#540.01 sdetails
#550.00 sdetails
#560.00 sdetails
#570.01 sdetails
#580.00 sdetails
#590.00 sdetails
#600.01 sdetails
#610.01 sdetails
#620.01 sdetails
#630.01 sdetails
#640.01 sdetails
#650.01 sdetails
#660.01 sdetails
#670.01 sdetails
#680.01 sdetails
#690.01 sdetails
#700.06 sdetails
#710.06 sdetails
#720.06 sdetails
#730.06 sdetails
#740.06 sdetails

Code

#include <iostream>
#include <vector>
#include <functional>
#include <set>
#include <algorithm>
#include <stack>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <limits>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
 
typedef long long LL;
typedef std::tuple<LL>          TUP1LL;
typedef std::tuple<LL,LL>       TUP2LL;
typedef std::tuple<LL,LL,LL>    TUP3LL;
typedef std::tuple<LL,LL,LL,LL> TUP4LL;

 
std::tuple<LL> readLL1(){
    LL a;
    std::cin >> a;
    return {a};
}

std::tuple<LL,LL> readLL2(){
    LL a, b;
    std::cin >> a >> b;
    return {a,b};
}

std::tuple<LL,LL,LL> readLL3(){
    LL a, b, c;
    std::cin >> a >> b >> c;
    return {a,b,c};
}
std::tuple<LL,LL,LL,LL> readLL4(){
    LL a, b, c, d;
    std::cin >> a >> b >> c >> d;
    return {a,b,c,d};
}
 
std::vector<LL> readVecLL(LL n){
    std::vector<LL> arr(n);
    for (LL i = 0; i < n; i++){
        LL a;
        std::cin >> a;
        arr[i] = a;
    }
    return arr;
}

std::string readStr(){
    std::string a;
    std::cin >> a;
    return a;
}

std::vector<std::string> readVecStr(LL n){
    std::vector<std::string> arr(n);
    for (LL i = 0; i < n; i++){
        std::string a;
        std::cin >> a;
        arr[i] = a;
    }
    return arr;
}
 
std::vector<std::tuple<LL,LL>> readVecTup2(LL n){
    std::vector<std::tuple<LL,LL>> arr(n);
    for (LL i = 0; i < n; i++){
        arr[i] = readLL2();
    }
    return arr;
}
 
std::vector<std::tuple<LL,LL,LL>> readVecTup3(LL n){
    std::vector<std::tuple<LL,LL,LL>> arr(n);
    for (LL i = 0; i < n; i++){
        arr[i] = readLL3();
    }
    return arr;
}
std::vector<std::tuple<double,double,double>> readVecTup3Dup(LL n){
    std::vector<std::tuple<double,double,double>> arr(n);
    for (LL i = 0; i < n; i++){
        double a, b, c;
        std::cin >> a;
        std::cin >> b;
        std::cin >> c;
        arr[i] = {a,b,c};
    }
    return arr;
}
std::vector<std::tuple<LL,LL,LL,LL>> readVecTup4(LL n){
    std::vector<std::tuple<LL,LL,LL,LL>> arr(n);
    for (LL i = 0; i < n; i++){
        arr[i] = readLL4();
    }
    return arr;
}
 
void printNewLine(){std::cout << "\n";}
template<typename T, typename... Ts>
std::tuple<Ts...> tail(std::tuple<T,Ts...> as){
    return std::apply([](T &a, Ts... b){return std::make_tuple(b...);},as);
}
 
template<typename T>
void print(T a){std::cout << std::setprecision(19) << a;}
template<typename... T>
void println(T... a);
 
template<typename T, typename Ts>
void print(std::tuple<T,Ts> a){
    print(std::get<0>(a));
    print(" ");
    print(std::get<1>(a));
}
 
template<typename T, typename... Ts>
void print(std::tuple<T,Ts...> a){
    print(std::get<0>(a));
    print(" ");
    print(tail(a));
}
 
template<typename T>
void print(const std::vector<T> &arr, LL width = -1){
    if (width == -1) width = arr.size();
    for (LL i = 0; i < (LL)arr.size(); i++){
        print(arr[i]);
        if (i+1 == (LL)arr.size()) continue;
        if ((i%width) == width-1) printNewLine();
        if ((i%width) != width-1) print(" ");
    }    
}
template<typename... T>
void println(T... a){print(a...);printNewLine();}
 
 
 
template<typename T>
void sorted(std::vector<T> &arr){
    std::sort(arr.begin(),arr.end(),[](const T &a, const T &b){ return a < b; });
}

template<typename T>
std::set<T> toSet(const std::vector<T> &vec){
    std::set<T> c;
    for (T a : vec){ c.emplace(a);}
    return c;
}
 
template<typename T, typename N>
std::vector<N> map(const std::vector<T> &a, const std::function<N(T)> &transform){
    std::vector<N> b(a.size());
    LL i = 0;
    for (T x : a){
        b[i] = transform(x);
        i++;
    }
    return b;
}
 
template<typename N, typename M, typename R>
std::vector<R> zip(const std::vector<N> &a, const  std::vector<M> &b, const std::function<R(N,M)> &transform){
    LL n = std::min(a.size(),b.size());
    std::vector<R> res(n);
    for (LL i = 0; i < n; i++){
        res[i] = transform(a[i],b[i]);
    }
    return res;
}
 
template<typename T, typename N>
std::vector<N> convertVec(const std::vector<T> &a){
    std::vector<N> b(a.size());
    LL i = 0;
    for (T x : a){
        b[i] = x;
        i++;
    }
    return b;
}

template<typename T>
std::vector<T> reverse(const std::vector<T> &a){
    std::vector<T> b(a.size());
    LL i = 0;
    for (T x : a){
        b[a.size()-1-i] = x;
        i++;
    }
    return b;
}

template<typename T, typename R>
R reduce(const std::vector<T> &arr, R init, const std::function<R(const R,const T)> &transform){
    R current = init;
    for (LL idx = 0; idx < (LL)arr.size(); idx++){
        current = transform(current,arr[idx]);
    };
    return current;
}
template<typename T>
T max(const std::vector<T> &arr){return reduce(arr, arr[0], static_cast<std::function<T(const T,const T)>>(static_cast<const T& (*)(const T&, const T&)>(std::max<T>)));}
template<typename T>
T min(const std::vector<T> &arr){return reduce(arr, arr[0], static_cast<std::function<T(const T,const T)>>(static_cast<const T& (*)(const T&, const T&)>(std::min<T>)));}

template<typename T>
std::function<T(const T,const T)> add(){return [](T a,T b){return a+b;};}
template<typename T>
std::function<T(const T,const T)> modAdd(T mod){return [mod](T a,T b){return (((a+b)%mod)+mod)%mod;};}
template<typename T, typename R>
std::function<R(const R,const T)> mulAdd(R mul){return [mul](R a,T b){return a+b*mul;};}
template<typename T>
T sum(const std::vector<T> &arr){return reduce(arr, 0, add<T>());}
template<typename T>
T avg(const std::vector<T> &arr){return reduce(arr, 0.0, mulAdd<double,T>(1.0/arr.size()));}

template<typename T>
T binarySearch(T min, T max, const std::function<bool(T)> &leq){
    if (min == max) return max;
    T guess = (min+max)/2;
    if (leq(guess)){
        return binarySearch(min,guess,leq);
    }else{
        return binarySearch(guess+1,max,leq);
    }
}

template<typename T>
T binarySearchDecending(T min, T max, const std::function<bool(T)> &leq){
    std::function<bool(T)> gt = [leq](T x){
        return !leq(x);
    };
    return binarySearch(min,max+1, gt)-1;
}

template<typename T>
std::vector<T> cloneVec(std::vector<T> a){return a;}

template<typename T>
std::vector<T> padding(const std::vector<T> &initial, T num, LL start, LL end){
    std::vector<T> arr(start+initial.size()+end);
    for (LL i = 0; i < start; i++){
        arr[i] = num;
    }
    for (LL i = 0; i < (LL)initial.size(); i++){
        arr[start+i] = initial[i];
    }
    for (LL i = 0; i < end; i++){
        arr[start+initial.size()+i] = num;
    }
    return arr;
}

template<typename T>
LL findMax(LL start, LL end, const std::function<T(LL)> &maxHeuristic){
    T initialGuess = maxHeuristic(start);
    LL index = start;
    for (LL i = start; i <= end; i++){
        if (initialGuess < maxHeuristic(i)){
            initialGuess = maxHeuristic(i);
            index = i;
        }
    }
    return index;
}

template<typename T>
void operateOnMax(LL start, LL end, const std::function<T(LL)> &maxHeuristic, const std::function<void(LL)> &found){
    found(findMax(start,end,maxHeuristic));
}

template<typename T>
void stackOperate(std::vector<T> init, const std::function<std::vector<T>(T)> operate){
    std::stack<T> stack;
    for (auto x : init){
        stack.push(x);
    }
    while (!stack.empty()){
        T next = stack.top();
        stack.pop();
        std::vector<T> nextSteps = operate(next);
        for (T a : nextSteps){
            stack.push(a);
        }
    }
}

template<typename T>
void queueOperate(std::vector<T> init, const std::function<std::vector<T>(T)> operate){
    std::queue<T> que;
    for (auto x : init){
        que.push(x);
    }
    while (!que.empty()){
        T next = que.front();
        que.pop();
        std::vector<T> nextSteps = operate(next);
        for (T a : nextSteps){
            que.push(a);
        }
    }
}

template<typename T>
void priorityQueueOperate(std::vector<T> init, const std::function<std::vector<T>(T)> operate){
    std::priority_queue<T> que;
    for (auto x : init){
        que.push(x);
    }
    while (!que.empty()){
        T next = que.top();
        que.pop();
        std::vector<T> nextSteps = operate(next);
        for (T a : nextSteps){
            que.push(a);
        }
    }
}
 
template<typename T>
void recursiveVectorSplit(LL start, LL end, LL distl, LL distr, const std::function<T(LL)> &maxHeuristic, const std::function<void(LL)> &found){
    if (start == end){
        return found(start);
    }else if (end < start){
        return;
    }
    std::tuple<LL,LL> range = {start,end};
    std::function<std::vector<std::tuple<LL,LL>>(std::tuple<LL,LL>)> splitter = [distl, distr,&maxHeuristic,&found](std::tuple<LL,LL> range){
        auto [start,end] = range;
        LL idx = findMax(start, end, maxHeuristic);
        found(idx);
        std::vector<std::tuple<LL,LL>> next;
        if (idx+distl+1 <= end){
            next.push_back({idx+distl+1,end});
        }
        if (start <= idx-distr-1){
            next.push_back({start, idx-distr-1});
        }
        return next;
    };
    stackOperate({range},splitter);
}
 
 
template<typename T>
std::vector<T> dynamicallyComputableList(LL n, std::function<T(std::vector<T>&,LL)> next){
    std::vector<T> arr(n);
    for (LL i = 0; i < n; i++){
        arr[i] = next(arr,i);
    }
    return arr;
}
template<typename T>
LL indexOfBinarySearch(const std::vector<T> &arr, const T &find){
    return binarySearch((LL)0,(LL)arr.size()-1,(std::function<bool(LL)>)[&arr, &find](LL guess){return find <= arr[guess];});
}

template<typename T>
std::unordered_map<T, LL> indexCompress(const std::vector<T> &arr){
    std::unordered_map<T, LL> compressed;
    LL i = 0;
    for (T x : arr){
        if (compressed.find(x) != compressed.end()) compressed[x] = i++;
    }
    return compressed;
}   

template<typename... Ts>
std::tuple<std::vector<std::tuple<LL,Ts...>>, std::vector<LL>> edgeIndexing(int n, std::vector<std::tuple<LL,Ts...>> edges){
    sorted(edges);
    std::vector<LL> edgeIndex(n+1);
    {
        LL j = 0;
        for (LL i = 0; i < (LL)edges.size(); i++) {
            auto a = std::get<0>(edges[i]);
            while (j <= a){
                edgeIndex[j++] = i;
            }
        }
        while (j < n){
            edgeIndex[j++] = edges.size();
        }
        edgeIndex[n] = edges.size(); 
    }
    return {edges,edgeIndex};
}


template<typename T>
std::tuple<std::vector<T>, std::vector<LL>> shortestPathDirected(const LL n, std::vector<std::tuple<LL, LL, T>> edgesInit, LL start){
    //assumes all paths are between 0 <= c < n
    //assumes 0 indexing
    std::vector<LL> path(n);
    std::vector<bool> edgeUpdated(n);
    std::vector<T> distance(n);
    for (LL i = 0; i < n; i++) path[i] = i;
    for (LL i = 0; i < n; i++) edgeUpdated[i] = true;
    edgeUpdated[start] = false;
    for (LL i = 0; i < n; i++) distance[i] = std::numeric_limits<T>::max()/4;
    distance[start] = 0;
    auto [edges,edgeIndex] = edgeIndexing(n,edgesInit);
    std::function<std::vector<std::tuple<LL,LL>>(std::tuple<LL,LL>)> func = [&distance,&edgeIndex,&edges,&path,&edgeUpdated](std::tuple<LL,LL> propagateW){
        auto& [weight,propagate] = propagateW;
        std::vector<std::tuple<LL,LL>> next;
        if (distance[propagate] != -weight) return next;
        if (edgeUpdated[propagate]) return next;
        for (LL i = edgeIndex[propagate]; i < edgeIndex[propagate+1]; i++){
            auto& [a, b, w] = edges[i];
            if (distance[a]+w < distance[b]){
            //if (std::min(distance[a],w) > distance[b]){
                next.push_back({-(distance[a]+w),b});
                //next.push_back({std::min(distance[a],w),b});
                distance[b] = std::min(distance[a],w);
                path[b] = a;
                edgeUpdated[b] = false;
            }
        }
        edgeUpdated[propagate] = true;
        return next;
    };
    priorityQueueOperate((std::vector<std::tuple<LL,LL>>){{0,start}},func);
    //for (LL i = 0; i < n; i++) {
    //    bool changed = false;
    //    for (auto& e : edges) {
    //        auto& [a, b, w] = e;
    //        if (!changed) {changed = (distance[b] != std::min(distance[b], distance[a]+w));}
    //        if (distance[a]+w < distance[b]){
    //            distance[b] = distance[a]+w;
    //            path[b] = a;
    //        }
    //    }
    //    if (!changed) break;
    //    if (changed && i == n){
    //        return std::tuple((std::vector<T>){},(std::vector<LL>){});
    //    }
    //}
    return std::tuple(distance,path);
}
 
std::vector<LL> pathFromPathMap(std::vector<LL> &map, LL goal){
    std::stack<LL> fullPath;
    fullPath.push(goal);
    while (map[fullPath.top()] != fullPath.top()){
        fullPath.push(map[fullPath.top()]);
    }
    std::vector<LL> p;
    while (!fullPath.empty()){
        p.push_back(fullPath.top());
        fullPath.pop();
    }
    return p;
}
 
 
template<typename T>
std::tuple<std::vector<T>, std::vector<LL>> shortestPath(const LL n, std::vector<std::tuple<LL, LL, T>> &edgesMessy, LL start){
    std::vector<std::tuple<LL, LL, T>> edges;
    for (auto e : edgesMessy){
        auto [a,b,t] = e;
        edges.push_back({a,b,t});
        edges.push_back({b,a,t});
    }
    return shortestPathDirected(n, edges, start);
}



template<typename T>
std::vector<T> range(const std::vector<T> &a, LL from, LL to){
    std::vector<T> b;
    for (LL i = from; i < to; i++){
        b.push_back(a[i]);
    }
    return b;
}

template<typename T>
bool forall(const std::vector<T> &a, std::function<bool(T)> &test){
    bool res = true;
    for (auto v : a){
        res = res & test(v);
    }
    return res;
}
LL gcd(LL a, LL b){
    if (b == 0) return a;
    return gcd(b,a%b);
}
LL moduloPower(LL a, LL b, LL modulo){
    std::vector<LL> powers(65);
    powers[0] = a;
    for (int i = 0; i < 64; i++){
        powers[i+1] = (powers[i]*powers[i])%modulo;
    }
    LL res = 1;
    for (int i = 0; i < 64; i++){
        if ((b>>i)&1){
            res *= powers[i];
            res %= modulo;
        }
    }
    return res;
}
// a*x + b*y = 1; return {x,y};
std::tuple<LL,LL> inverse(LL a, LL b){
    if (b == 0) return {1,0};
    auto [n,m] = inverse(b,a%b);
    return {m,n-(a/b)*m};
}
LL solution(LL n, LL a, LL b){
    if (n == 1){
        return 1+b-a;
    }
    return solution(n-1,a,b);
}

int main() {
    //LL modulo = 998244353;
    //auto [n, a, b] = readLL3();
    auto [n,y] = readLL2();

    auto arr = readVecLL(n);
    LL divisor = arr[0];
    for (auto i : arr){
        divisor = gcd(divisor,i);
    }
    if ((y%divisor)==0){
        println("YES");
    }else {
        println("NO");
    }
    //auto [n,q] = readLL2();
    //auto arr = readVecTup2(q);
    //for (auto [a,b] : arr){
    //    println(n/gcd(n,a));
    //}
    //if (gcd(a,m) != 1) {
    //    println(-1);
    //    exit(0);
    //}
    //// a*x = 1 mod (M)
    //auto [res,b] = inverse(a,m);
    //res %= m;
    //res += m;
    //res %= m;
    //println(res);
    //println(((a*res)%m));
    //if (gcd(a,m) == 1) for (int i = m-1; i > 0; i--) {
    //    if (moduloPower(a,i,m) == 1){
    //        println(moduloPower(a,i-1,m));
    //        break;
    //    }
    //}

    return 0;
}

Test details

Test 1

Verdict:

input
1 9
95 

correct output
No

user output
NO

Test 2

Verdict:

input
1 9
2 

correct output
No

user output
NO

Test 3

Verdict:

input
1 85
85 

correct output
Yes

user output
YES

Test 4

Verdict:

input
1 86426376
172852752 

correct output
No

user output
NO

Test 5

Verdict:

input
2 8
10 8 

correct output
Yes

user output
YES

Test 6

Verdict:

input
2 9
43972028 43972028 

correct output
No

user output
NO

Test 7

Verdict:

input
2 31
62 62 

correct output
No

user output
NO

Test 8

Verdict:

input
2 20
10 6 

correct output
Yes

user output
YES

Test 9

Verdict:

input
2 22
44 44 

correct output
No

user output
NO

Test 10

Verdict:

input
3 9
10 8 10 

correct output
No

user output
NO

Test 11

Verdict:

input
3 9
96 96 96 

correct output
No

user output
NO

Test 12

Verdict:

input
3 12
1 8 9 

correct output
Yes

user output
YES

Test 13

Verdict:

input
3 61518795
123037590 123037590 123037590 

correct output
No

user output
NO

Test 14

Verdict:

input
3 5
1 9 9 

correct output
Yes

user output
YES

Test 15

Verdict:

input
2 48
96 96 

correct output
No

user output
NO

Test 16

Verdict:

input
2 28
56 56 

correct output
No

user output
NO

Test 17

Verdict:

input
2 97550429
97550429 97550429 

correct output
Yes

user output
YES

Test 18

Verdict:

input
2 11
89 89 

correct output
No

user output
NO

Test 19

Verdict:

input
2 14
7 7 

correct output
Yes

user output
YES

Test 20

Verdict:

input
3 4
1 1 7 

correct output
Yes

user output
YES

Test 21

Verdict:

input
3 4
5 8 9 

correct output
Yes

user output
YES

Test 22

Verdict:

input
3 18096412
36192824 36192824 36192824 

correct output
No

user output
NO

Test 23

Verdict:

input
3 11
38 38 38 

correct output
No

user output
NO

Test 24

Verdict:

input
3 17
9 2 6 

correct output
Yes

user output
YES

Test 25

Verdict:

input
4 9
10 8 10 1 

correct output
Yes

user output
YES

Test 26

Verdict:

input
4 9
45 45 45 45 

correct output
No

user output
NO

Test 27

Verdict:

input
4 12
1 8 9 3 

correct output
Yes

user output
YES

Test 28

Verdict:

input
4 20
140955392 140955392 140955392 ...

correct output
No

user output
NO

Test 29

Verdict:

input
4 5
1 9 9 3 

correct output
Yes

user output
YES

Test 30

Verdict:

input
5 9
10 8 10 1 2 

correct output
Yes

user output
YES

Test 31

Verdict:

input
5 9
2 1 10 6 10 

correct output
Yes

user output
YES

Test 32

Verdict:

input
5 12
88295480 88295480 88295480 882...

correct output
No

user output
NO

Test 33

Verdict:

input
5 20
60359262 60359262 60359262 603...

correct output
No

user output
NO

Test 34

Verdict:

input
5 99
99 99 99 99 99 

correct output
Yes

user output
YES

Test 35

Verdict:

input
10 417021999
997184809 720324490 932557362 ...

correct output
Yes

user output
YES

Test 36

Verdict:

input
10 435994903
185082082 25926228 931540864 5...

correct output
Yes

user output
YES

Test 37

Verdict:

input
10 550797905
70724881 708147823 839949043 2...

correct output
Yes

user output
YES

Test 38

Verdict:

input
10 967029839
900621455 547232254 172695325 ...

correct output
Yes

user output
YES

Test 39

Verdict:

input
10 196621664
49155416 835642072 786486656 3...

correct output
Yes

user output
YES

Test 40

Verdict:

input
100 417021999
997184809 720324490 932557362 ...

correct output
Yes

user output
YES

Test 41

Verdict:

input
100 435994884
185082066 25926212 931540844 5...

correct output
Yes

user output
YES

Test 42

Verdict:

input
100 550797905
70724850 708147800 839949000 2...

correct output
No

user output
NO

Test 43

Verdict:

input
100 967029839
900621455 547232254 172695325 ...

correct output
Yes

user output
YES

Test 44

Verdict:

input
100 221993172
55180121 870732304 831327840 3...

correct output
Yes

user output
YES

Test 45

Verdict:

input
1000 180269695
68306839 19475202 194115593 72...

correct output
No

user output
NO

Test 46

Verdict:

input
1000 154162842
446221746 740049692 873387158 ...

correct output
Yes

user output
YES

Test 47

Verdict:

input
1000 777702400
607341320 237541200 859434000 ...

correct output
Yes

user output
YES

Test 48

Verdict:

input
1000 513482004
920566836 772535988 658428876 ...

correct output
Yes

user output
YES

Test 49

Verdict:

input
1000 848817694
813580451 178895924 591354998 ...

correct output
Yes

user output
YES

Test 50

Verdict:

input
1000 607412037
105636876 158455314 264092190 ...

correct output
No

user output
NO

Test 51

Verdict:

input
1000 375057125
707575540 640304620 313920847 ...

correct output
Yes

user output
YES

Test 52

Verdict:

input
1000 851985493
123192958 73903599 127631563 8...

correct output
Yes

user output
YES

Test 53

Verdict:

input
1000 151631969
126418774 868745277 791821142 ...

correct output
Yes

user output
YES

Test 54

Verdict:

input
1000 196092300
291566900 702774400 371456400 ...

correct output
Yes

user output
YES

Test 55

Verdict:

input
1000 95549203
430019348 925003626 255457566 ...

correct output
No

user output
NO

Test 56

Verdict:

input
1000 79140426
236255163 217522690 571460714 ...

correct output
Yes

user output
YES

Test 57

Verdict:

input
1000 981035661
719087312 821247849 495848292 ...

correct output
Yes

user output
YES

Test 58

Verdict:

input
1000 151197835
530814538 122812139 317928176 ...

correct output
Yes

user output
YES

Test 59

Verdict:

input
1000 401784348
321879453 663365514 253894053 ...

correct output
Yes

user output
YES

Test 60

Verdict:

input
1000 838888356
877465120 478931880 934942330 ...

correct output
No

user output
NO

Test 61

Verdict:

input
1000 59986888
112756706 31053551 245978320 6...

correct output
Yes

user output
YES

Test 62

Verdict:

input
1000 246908805
481360546 799505092 360715440 ...

correct output
No

user output
NO

Test 63

Verdict:

input
1000 448688751
695523111 690101138 4718705 56...

correct output
Yes

user output
YES

Test 64

Verdict:

input
1000 255260751
894709657 648628357 584397616 ...

correct output
Yes

user output
YES

Test 65

Verdict:

input
10000 48724830
799271756 289109506 679842084 ...

correct output
Yes

user output
YES

Test 66

Verdict:

input
10000 701962979
481681060 730506644 420538032 ...

correct output
Yes

user output
YES

Test 67

Verdict:

input
10000 517297884
669097120 946962605 184988486 ...

correct output
Yes

user output
YES

Test 68

Verdict:

input
10000 960017302
699512050 52854618 999867295 3...

correct output
Yes

user output
YES

Test 69

Verdict:

input
10000 870124133
696065977 582276932 278838947 ...

correct output
Yes

user output
YES

Test 70

Verdict:

input
100000 286053826
28991600 958105500 322333000 7...

correct output
No

user output
NO

Test 71

Verdict:

input
100000 858889273
59656511 421037985 330388054 9...

correct output
Yes

user output
YES

Test 72

Verdict:

input
100000 248510127
689682575 449975422 669281141 ...

correct output
Yes

user output
YES

Test 73

Verdict:

input
100000 38561680
195763855 780100460 423375572 ...

correct output
Yes

user output
YES

Test 74

Verdict:

input
100000 458054905
449795038 308349580 231487025 ...

correct output
Yes

user output
YES