QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#691035#9518. 观虫我 (旧版数据)hos_lyric#80 8943ms523592kbC++146.6kb2024-10-31 09:30:282024-10-31 09:30:29

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 09:30:29]
  • 评测
  • 测评结果:80
  • 用时:8943ms
  • 内存:523592kb
  • [2024-10-31 09:30:28]
  • 提交

answer

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#pragma GCC target("avx2")

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


// fast IO by yosupo
// sc.read(string &) appends the input
struct Scanner {
    FILE* fp = nullptr;
    char line[(1 << 15) + 1];
    size_t st = 0, ed = 0;
    void reread() {
        memmove(line, line + st, ed - st);
        ed -= st;
        st = 0;
        ed += fread(line + ed, 1, (1 << 15) - ed, fp);
        line[ed] = '\0';
    }
    bool succ() {
        while (true) {
            if (st == ed) {
                reread();
                if (st == ed) return false;
            }
            while (st != ed && isspace(line[st])) st++;
            if (st != ed) break;
        }
        if (ed - st <= 50) reread();
        return true;
    }
    template <class T, enable_if_t<is_same<T, string>::value, int> = 0>
    bool read_single(T& ref) {
        if (!succ()) return false;
        while (true) {
            size_t sz = 0;
            while (st + sz < ed && !isspace(line[st + sz])) sz++;
            ref.append(line + st, sz);
            st += sz;
            if (!sz || st != ed) break;
            reread();            
        }
        return true;
    }
    template <class T, enable_if_t<is_integral<T>::value, int> = 0>
    bool read_single(T& ref) {
        if (!succ()) return false;
        bool neg = false;
        if (line[st] == '-') {
            neg = true;
            st++;
        }
        ref = T(0);
        while (isdigit(line[st])) {
            ref = 10 * ref + (line[st++] - '0');
        }
        if (neg) ref = -ref;
        return true;
    }
    template <class T> bool read_single(vector<T>& ref) {
        for (auto& d : ref) {
            if (!read_single(d)) return false;
        }
        return true;
    }
    void read() {}
    template <class H, class... T> void read(H& h, T&... t) {
        bool f = read_single(h);
        assert(f);
        read(t...);
    }
    Scanner(FILE* _fp) : fp(_fp) {}
};

struct Printer {
  public:
    template <bool F = false> void write() {}
    template <bool F = false, class H, class... T>
    void write(const H& h, const T&... t) {
        if (F) write_single(' ');
        write_single(h);
        write<true>(t...);
    }
    template <class... T> void writeln(const T&... t) {
        write(t...);
        write_single('\n');
    }
    void flush() {
        fwrite(line, 1, pos, fp);
        pos = 0;
    }

    Printer(FILE* _fp) : fp(_fp) {}
    ~Printer() { flush(); }

  private:
    static constexpr size_t SIZE = 1 << 15;
    FILE* fp;
    char line[SIZE], small[50];
    size_t pos = 0;
    void write_single(const char& val) {
        if (pos == SIZE) flush();
        line[pos++] = val;
    }
    template <class T, enable_if_t<is_integral<T>::value, int> = 0>
    void write_single(T val) {
        if (pos > (1 << 15) - 50) flush();
        if (val == 0) {
            write_single('0');
            return;
        }
        if (val < 0) {
            write_single('-');
            val = -val;  // todo min
        }
        size_t len = 0;
        while (val) {
            small[len++] = char('0' + (val % 10));
            val /= 10;
        }
        for (size_t i = 0; i < len; i++) {
            line[pos + i] = small[len - 1 - i];
        }
        pos += len;
    }
    void write_single(const string& s) {
        for (char c : s) write_single(c);
    }
    void write_single(const char* s) {
        size_t len = strlen(s);
        for (size_t i = 0; i < len; i++) write_single(s[i]);
    }
    template <class T> void write_single(const vector<T>& val) {
        auto n = val.size();
        for (size_t i = 0; i < n; i++) {
            if (i) write_single(' ');
            write_single(val[i]);
        }
    }
    void write_single(long double d){
        {
            long long v=d;
            write_single(v);
            d-=v;
        }
        write_single('.');
        for(int _=0;_<8;_++){
            d*=10;
            long long v=d;
            write_single(v);
            d-=v;
        }
    }
};

Scanner sc(stdin);
Printer pr(stdout);


// [0, E), [E, F), [F, 32)
constexpr int E = 6;
constexpr int F = 20;
constexpr unsigned MASK_A = (1U << E) - 1U;
constexpr unsigned MASK_B = (1U << F) - (1U << E);
constexpr unsigned MASK_C = 0U - (1U << F);

int N, Q;
unsigned long long zs[1 << (32 - E)];

int main() {
  unsigned long long small[1 << E] = {};
  for (int a = 0; a < 1 << E; ++a) for (int b = 0; b < 1 << E; ++b) if (!(a & ~b)) {
    small[a] |= 1ULL << b;
  }
  
  // scanf("%d%d", &N, &Q);
  sc.read(N, Q);
if(N==32)chmin(Q,500'000);
  for (int q = 0; q < Q; ++q) {
    // char O;
    string O;
    unsigned I;
    // scanf(" %c%u", &O, &I);
    sc.read(O, I);
    
    const unsigned A = (I & MASK_A);
    const unsigned B = (I & MASK_B) >> E;
    const unsigned C = (I & MASK_C) >> E;
    // if (O == '!') {
    if (O == "!") {
      // superset of B
      for (unsigned b = B; b < 1U << (F - E); ++b |= B) {
        zs[b | C] ^= small[A];
      }
    } else {
      unsigned long long ans = 0;
      // subset of C
      for (unsigned c = C; ; (c -= 1U << (F - E)) &= C) {
        ans ^= zs[B | c];
        if (!c) break;
      }
      ans = ans >> A & 1;
      // printf("%llu\n", ans);
      pr.writeln(ans);
    }
  }
  return 0;
}

詳細信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 647ms
memory: 6664kb

input:

24 1000000
! 9475137
! 4501536
? 14277831
? 16695039
? 5723102
? 6093887
? 3014539
! 475969
? 12500973
! 8750136
? 15617895
! 4589313
! 152300
? 3612579
? 15248179
! 764162
! 4461105
? 7274495
? 13299697
! 8388872
? 13490383
! 3875594
! 9439685
? 16776189
! 6443172
? 13864879
! 395691
? 7142271
? 16...

output:

1
0
0
1
0
1
0
0
0
0
0
0
0
1
0
0
1
1
1
0
1
1
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
1
1
0
1
1
0
0
0
0
0
0
0
0
1
1
0
0
1
0
1
1
1
0
0
0
1
0
0
0
1
1
1
1
1
0
0
0
1
0
1
1
0
1
1
0
0
0
0
1
1
0
0
1
1
0
1
0
0
0
0
0
0
1
1
1
1
1
0
1
0
0
0
0
0
1
1
0
1
1
0
1
0
1
1
1
1
1
0
0
1
1
1
1
1
1
0
1
0
0
0
0
0
1
1
1
0
0
0
1
1
0
...

result:

ok Accepted.

Test #2:

score: 20
Accepted
time: 5194ms
memory: 5432kb

input:

24 1000000
! 0
? 16777215
! 0
! 0
! 262144
? 16777215
? 16777215
? 15728639
! 0
? 16777215
? 16777215
! 16384
? 16777211
! 0
? 16777215
! 0
! 0
? 16760831
! 0
! 0
? 16777215
! 0
? 16777215
! 0
? 16777215
! 0
? 16777215
? 16777215
! 0
! 0
? 16777215
? 16777215
? 16777215
? 16777215
! 32768
? 16777215...

output:

1
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
0
0
0
1
0
0
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
1
1
0
0
1
1
0
0
0
1
0
1
0
1
0
1
0
1
1
1
0
0
1
0
1
0
0
0
0
0
1
0
0
1
0
1
1
1
1
1
0
0
0
0
0
0
0
0
1
1
1
0
1
0
1
0
0
1
1
1
1
0
0
0
0
1
1
1
1
1
0
1
1
1
0
0
1
1
0
0
0
0
0
0
0
0
0
0
...

result:

ok Accepted.

Test #3:

score: 20
Accepted
time: 2728ms
memory: 5800kb

input:

24 1000000
! 197632
! 1075232
? 16775167
! 65792
? 16777147
? 8388575
? 16252927
? 15825369
? 16775135
! 4194304
! 552
? 16775871
? 8125439
? 16252667
? 16768703
? 7864319
? 16773113
! 4722688
! 1048760
! 1028
? 16576484
! 2136320
? 16776703
? 16707039
? 12580831
! 100
? 16776191
! 17476
? 16773119
...

output:

1
1
0
1
1
0
1
0
0
1
1
1
1
0
0
1
0
1
1
1
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
1
1
0
1
0
1
1
0
0
1
0
0
0
1
0
0
1
0
1
0
1
1
1
1
0
0
1
1
0
1
1
0
0
1
1
0
1
0
1
0
0
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
0
0
1
0
0
1
1
0
1
0
1
0
0
0
0
0
0
1
1
1
1
0
1
1
1
1
1
0
0
1
0
1
1
1
0
1
0
0
...

result:

ok Accepted.

Test #4:

score: 20
Accepted
time: 679ms
memory: 6828kb

input:

24 1000000
! 6820106
! 443659
! 3080
? 525571
! 377345
? 5504934
! 13641450
? 12039421
! 12866772
? 14514068
! 6489651
? 2882394
? 15728506
? 1559551
! 11885066
! 15575062
! 13885663
! 4246041
? 12441078
? 16742263
! 8407354
? 16773116
! 739912
? 14397343
? 8220285
? 15727728
? 3146756
? 14536632
? ...

output:

0
0
0
0
0
0
1
0
1
1
1
1
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
1
1
0
0
1
1
0
1
0
0
0
0
1
0
1
1
1
1
0
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
1
1
0
0
1
1
1
0
0
0
1
0
0
1
1
0
1
1
1
0
0
1
1
0
0
0
0
1
0
0
0
1
0
0
1
1
0
1
1
1
1
1
0
1
1
0
1
1
0
0
1
0
1
1
0
1
1
1
0
0
1
0
1
0
0
1
0
1
1
1
0
0
0
0
0
1
1
1
1
1
1
1
0
0
...

result:

ok Accepted.

Test #5:

score: 20
Accepted
time: 1515ms
memory: 5712kb

input:

24 1000000
! 131592
? 15728123
! 544
? 11780584
? 10477567
! 256
! 1032
? 15728638
? 16777207
? 15717887
! 8358425
! 0
! 237735
? 12582399
? 15777814
! 2240422
? 3878186
? 16777215
! 48
! 10322848
! 7758449
! 4994634
? 6696114
? 16760828
! 6295624
! 5329776
! 69648
! 0
! 6276117
! 9364500
! 11781556...

output:

0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
1
0
0
0
0
0
1
1
0
0
1
1
0
1
1
1
1
0
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
0
1
0
1
0
1
1
0
1
1
1
1
0
0
1
1
0
1
0
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
0
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
0
1
0
0
1
1
0
0
0
0
0
1
0
1
0
1
1
1
1
0
0
0
1
0
1
0
1
0
1
1
0
1
...

result:

ok Accepted.

Test #6:

score: 20
Accepted
time: 1411ms
memory: 6764kb

input:

24 1000000
! 10467318
! 16738876
! 2
! 0
! 16384
! 4194562
! 8204
? 18603
? 12862536
! 49
! 132168
! 6213595
! 16220133
? 12582863
? 680960
! 9441304
! 64
! 4195328
! 4194304
? 12617956
! 5369125
? 16072703
? 4915492
? 10729472
? 11067810
! 32
? 16777085
? 16711677
? 16774655
! 16334796
? 3121151
! ...

output:

1
0
1
0
1
1
0
1
1
0
0
0
0
1
1
0
0
0
1
0
1
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
0
0
0
1
0
1
0
1
0
0
0
0
1
0
1
0
0
0
1
0
1
0
1
1
1
0
0
0
1
1
1
0
0
1
1
0
0
1
0
0
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
1
0
0
0
1
0
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
0
0
0
1
1
1
1
1
0
1
1
1
1
0
1
0
1
0
0
0
0
0
1
1
1
1
1
1
1
1
0
...

result:

ok Accepted.

Test #7:

score: 20
Accepted
time: 1454ms
memory: 6716kb

input:

24 1000000
! 16773119
! 16515007
? 32
? 14647295
! 65536
! 16773117
? 12582895
! 12582879
? 16744447
? 9907711
! 8405120
? 16244446
! 256
! 393217
? 16711167
! 66048
? 16302047
! 1179648
! 199680
? 16777211
? 16773117
? 8126463
? 16777215
! 512
? 16777135
? 0
! 8192
! 8257535
? 1
! 4
! 16744187
? 21...

output:

0
0
1
1
1
0
1
1
1
0
1
1
0
0
0
0
0
1
0
1
0
1
0
0
1
1
0
1
1
0
1
1
1
1
1
0
0
1
1
1
0
0
0
1
1
1
1
0
1
1
0
0
0
1
0
1
0
1
0
1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
1
1
1
1
0
0
1
0
0
1
0
1
0
1
1
0
1
0
1
1
1
1
0
1
1
0
0
1
1
0
1
0
0
0
0
1
1
0
1
0
1
0
1
0
0
1
1
1
0
1
0
0
0
1
1
1
1
1
0
1
1
1
0
1
1
0
0
1
1
0
1
1
0
1
1
0
...

result:

ok Accepted.

Test #8:

score: 20
Accepted
time: 271ms
memory: 6544kb

input:

24 1000000
! 16764936
? 16776419
? 16775574
! 3182592
? 16773120
? 16775168
? 16775459
! 5369856
! 2310660
! 10965249
? 16758952
? 16776921
? 16642080
! 16773128
! 835717
? 16766163
? 16234302
! 11759872
? 5108382
? 16773120
! 16773120
? 16776864
! 8450048
! 6909952
! 16773120
! 15298560
! 16758762
...

output:

0
0
1
1
1
1
1
0
1
1
0
0
1
1
1
0
0
0
1
0
0
1
0
0
0
0
1
1
0
1
1
0
1
0
0
1
1
0
0
1
0
0
1
1
0
1
0
1
1
1
1
1
0
0
0
1
1
0
1
0
1
1
0
1
0
1
1
0
0
0
0
1
0
0
0
1
0
1
1
1
1
1
1
1
1
0
0
0
0
0
1
0
0
1
1
0
1
0
1
0
1
1
0
1
1
0
1
0
1
0
0
0
0
1
1
1
1
1
1
1
1
1
0
1
0
0
0
0
1
1
0
1
1
0
1
1
0
0
0
1
1
1
0
0
1
1
1
1
1
1
...

result:

ok Accepted.

Test #9:

score: 20
Accepted
time: 1504ms
memory: 5904kb

input:

24 1000000
! 2084864
? 16743423
! 2375680
? 8323006
? 16777199
! 1052676
! 8192
! 9675264
! 13045904
? 16776639
? 16710836
? 0
? 16251250
? 16768646
! 14974976
? 16776000
? 16775832
? 15728320
? 16217979
! 2101248
? 16777215
! 4128768
! 2080768
! 14213120
! 16285824
? 16668655
? 16776188
! 6037508
?...

output:

0
1
0
1
1
0
0
1
1
0
1
0
0
1
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
1
1
1
0
0
1
0
0
1
1
0
1
1
1
1
1
0
1
0
1
0
0
0
0
1
1
0
1
1
0
1
0
0
1
1
0
0
0
0
1
1
1
1
1
0
1
1
1
1
0
1
1
0
1
1
1
0
1
1
1
0
1
0
0
0
0
1
0
1
0
1
1
0
1
0
0
1
0
0
0
1
1
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0
1
0
0
1
1
0
1
0
0
...

result:

ok Accepted.

Test #10:

score: 20
Accepted
time: 813ms
memory: 7596kb

input:

24 1000000
! 1204808
! 5230471
? 295200
! 16709503
? 427666
? 0
! 1376552
! 4728839
! 262272
? 13408158
? 14352383
! 11955895
! 16515067
? 16777215
! 65569
! 5855981
? 11352945
! 16314879
? 1909256
! 16375558
! 3185312
? 11836419
! 9433711
? 2036849
! 4202562
! 8192
! 16777215
? 2056884
? 8421401
! ...

output:

0
0
0
1
0
0
1
0
0
1
0
0
1
1
1
0
0
0
0
0
0
1
0
1
0
0
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
0
1
0
0
0
1
0
1
1
0
1
0
0
1
1
0
0
0
1
0
0
1
0
0
1
0
0
0
0
1
1
1
0
1
0
0
1
0
1
0
1
1
1
1
1
0
1
1
1
1
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
0
...

result:

ok Accepted.

Subtask #2:

score: 20
Accepted

Test #11:

score: 20
Accepted
time: 766ms
memory: 12052kb

input:

26 1000000
! 18006034
? 66957270
! 2133064
! 147618
! 34621442
? 49715575
? 62879287
! 18620682
? 67073751
! 62941186
! 7634532
? 67100031
? 12517237
! 4804997
? 65991126
! 138275
? 65722687
? 66043391
! 19147234
? 45743743
! 2242648
! 44378336
? 48226020
! 34341926
! 665045
? 55433083
! 5554254
? 4...

output:

0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
0
0
1
0
0
1
1
0
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
1
1
1
0
1
1
1
0
1
0
1
1
0
0
0
0
1
1
0
0
1
0
1
0
0
1
0
1
1
0
1
1
0
0
1
0
1
0
1
0
1
1
1
1
0
0
1
0
0
0
0
1
0
1
0
1
1
0
0
1
0
1
1
0
0
0
1
0
1
1
0
1
1
1
0
1
0
1
0
0
0
1
1
0
1
1
0
1
1
1
0
1
...

result:

ok Accepted.

Test #12:

score: 20
Accepted
time: 5202ms
memory: 8680kb

input:

26 1000000
! 0
! 16779264
! 4
? 67092479
? 67108863
! 1048832
! 0
? 67108863
? 67108863
? 67108863
? 67108863
! 0
! 0
! 0
? 67108863
! 2048
? 67108863
! 0
? 66584575
! 8192
! 0
? 67108863
? 67108863
! 0
! 0
? 67092479
? 67108863
! 0
? 67108863
? 67108863
? 67108863
? 67108863
? 67108863
! 0
? 671088...

output:

1
1
1
1
1
1
0
1
0
0
0
0
0
1
1
1
1
1
0
0
0
0
1
0
0
0
1
1
0
0
0
0
1
1
0
0
0
0
0
0
1
0
1
0
0
1
0
1
1
0
0
1
0
1
1
1
1
1
0
0
1
1
0
1
1
1
0
0
1
0
0
0
1
1
1
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
1
0
1
1
0
0
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
1
0
0
0
0
0
0
1
0
1
1
1
1
0
0
1
1
0
1
1
0
1
0
0
0
1
0
1
0
1
1
...

result:

ok Accepted.

Test #13:

score: 20
Accepted
time: 2914ms
memory: 12048kb

input:

26 1000000
! 34816
! 229376
? 33554422
? 62504959
! 271362
? 66965439
! 16777346
? 66977630
? 67108831
! 8194
? 58653671
! 8224
? 67108735
! 16793616
? 58589055
! 18874880
! 34816
? 58720191
! 526432
! 8397312
? 66977663
! 2097704
! 9437312
? 66060223
? 50331647
? 67108863
? 67104767
! 64
! 106497
?...

output:

0
1
1
0
0
1
1
1
1
1
1
0
1
1
1
1
0
1
0
1
0
1
0
0
1
0
1
0
0
1
1
1
1
1
0
0
1
1
1
0
0
0
0
1
0
0
0
0
1
1
1
1
1
0
1
1
1
0
1
1
0
0
1
1
1
0
1
0
1
0
0
0
0
1
0
0
0
1
0
1
0
0
1
0
1
0
0
0
0
1
0
0
0
1
0
1
1
1
0
1
1
0
1
1
1
0
0
0
1
0
0
1
1
0
1
1
0
0
1
0
1
0
0
1
0
0
0
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1
1
1
1
0
1
0
0
...

result:

ok Accepted.

Test #14:

score: 20
Accepted
time: 806ms
memory: 11792kb

input:

26 1000000
! 12239560
? 11240340
? 56270731
! 15892480
? 66054107
? 58653679
? 67097875
? 29022650
! 44635136
! 9765921
? 46792429
? 41933503
! 311312
! 38289409
! 8912897
? 43515829
? 52935717
! 10028228
? 17263997
! 36244352
! 37748760
! 4816901
! 40788992
! 1180229
! 38429834
? 29015917
! 3296346...

output:

0
0
0
0
1
0
0
0
0
0
0
0
1
1
1
0
0
0
0
1
1
1
0
0
0
0
1
1
0
0
0
0
1
1
0
1
0
1
0
0
0
1
1
1
1
0
1
1
0
1
1
0
1
1
0
1
0
0
0
0
0
0
1
1
1
1
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
0
0
1
1
0
1
1
0
1
1
1
1
1
1
1
1
0
1
0
1
1
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
0
0
1
1
1
...

result:

ok Accepted.

Test #15:

score: 20
Accepted
time: 1650ms
memory: 11852kb

input:

26 1000000
! 17894450
! 28643972
! 33554432
! 528
? 14168274
! 2537556
! 44889809
? 31675344
? 8351743
! 43354354
! 65537
! 39790768
? 66579959
? 65994748
? 21499891
? 34735264
? 58720255
! 20972688
? 46437446
? 62910207
! 4210689
? 66060243
? 1181484
! 16851026
! 50331648
! 50374762
? 52527805
? 17...

output:

0
1
1
0
1
1
1
0
1
1
0
0
0
1
0
1
1
1
0
1
0
0
0
0
1
0
1
1
1
1
1
1
0
1
0
1
1
1
0
1
0
1
1
0
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
1
0
0
0
0
1
1
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
0
0
1
0
1
1
0
0
0
0
0
1
1
1
0
1
1
1
0
1
0
1
1
0
0
0
1
0
0
0
1
0
1
0
1
1
1
1
0
1
1
1
1
1
0
0
1
0
0
1
1
0
1
...

result:

ok Accepted.

Test #16:

score: 20
Accepted
time: 1528ms
memory: 13000kb

input:

26 1000000
! 64945459
! 2130432
! 2532046
! 12599424
! 56282647
? 19344017
? 45090833
? 4805144
? 46960018
? 16943286
! 12584068
! 50327645
! 64749309
! 67005375
? 66944887
? 31721023
? 66584446
! 2048
! 50257395
? 45236384
! 7858013
? 1079434
! 2
! 10518528
? 67108863
! 34615298
! 33824768
? 628490...

output:

0
0
0
0
0
0
0
1
0
1
0
1
1
0
0
1
0
1
0
1
1
0
0
0
0
1
1
1
0
0
0
1
1
1
0
1
1
1
0
0
1
0
1
1
1
1
0
1
1
1
1
0
0
0
0
1
1
1
0
0
0
1
0
0
0
0
1
1
1
0
0
0
0
1
0
1
0
0
1
0
0
1
1
1
0
0
0
1
0
1
1
0
1
0
1
0
1
0
1
0
0
1
1
0
0
1
1
1
0
0
1
1
0
0
0
0
1
1
0
1
1
1
1
0
1
0
0
0
1
0
0
0
0
0
1
1
1
1
0
1
0
1
1
1
1
1
1
1
0
1
...

result:

ok Accepted.

Test #17:

score: 20
Accepted
time: 1495ms
memory: 11856kb

input:

26 1000000
! 50265974
? 67103483
? 33550318
! 67107839
! 2053
! 66772981
! 2150528
? 62906358
! 67027965
? 65544
? 67108863
! 50265903
? 16781313
? 67108863
? 66048
? 66567159
? 25243672
? 67108859
! 60129279
? 65007615
! 50331262
? 4718592
! 49283071
! 0
? 2261536
? 256
? 62914047
! 6815872
! 8262
...

output:

0
0
1
0
0
0
1
0
1
0
1
1
0
1
1
1
1
1
1
0
1
1
0
0
1
1
0
1
0
1
0
1
1
1
0
0
1
1
1
0
1
1
1
1
1
1
0
0
0
0
1
0
1
1
1
1
0
1
1
1
0
1
1
0
1
0
0
1
0
0
1
1
1
0
1
1
1
0
0
0
0
1
1
0
1
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
1
1
0
0
1
0
1
1
1
1
0
0
0
1
0
1
0
0
1
1
1
1
0
0
0
1
0
1
0
0
1
0
0
0
0
1
0
1
1
0
1
1
1
0
1
0
1
1
0
0
...

result:

ok Accepted.

Test #18:

score: 20
Accepted
time: 460ms
memory: 13992kb

input:

26 1000000
! 66052096
? 42209280
? 67104857
! 67100800
! 67100672
? 67093698
? 67102967
! 67100736
! 65003520
! 57491456
? 66969856
? 67105249
? 67101966
? 67103853
! 65626112
? 27226114
? 67100674
? 66969600
! 67100688
! 67100672
! 20259584
? 67100680
! 58220584
? 67105285
! 33548292
! 36084616
! 5...

output:

0
1
0
1
1
0
0
1
0
1
0
0
0
1
0
0
1
1
0
1
0
1
0
0
1
1
1
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
1
0
0
1
1
0
1
0
0
0
1
0
1
0
1
1
1
0
1
1
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
1
1
0
1
0
0
0
1
1
1
0
0
0
1
0
1
0
0
1
0
0
1
0
0
1
1
0
0
0
0
1
1
1
1
0
1
1
0
0
0
0
0
0
1
1
0
1
1
1
1
1
1
0
0
0
1
0
0
1
0
1
0
1
0
0
0
0
1
1
1
0
1
...

result:

ok Accepted.

Test #19:

score: 20
Accepted
time: 1827ms
memory: 11860kb

input:

26 1000000
! 13918736
? 49807334
? 65011455
? 67102822
? 67108726
! 57503776
? 67105367
! 17432832
? 67074047
? 67107284
? 67090997
! 491520
! 10436672
? 66971808
? 67107137
! 5545984
? 67100784
? 67102789
! 21217280
! 20914176
? 67104416
! 30859264
! 20201472
! 27369480
? 67106623
? 67107466
? 6710...

output:

0
1
0
1
1
1
1
0
0
1
1
1
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
1
1
1
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
0
1
1
1
0
1
0
0
1
0
1
1
1
0
1
0
1
1
0
1
0
0
0
0
0
1
0
1
0
0
1
1
1
1
1
0
1
0
0
0
0
1
1
1
1
0
1
0
1
1
1
1
0
0
1
0
1
0
1
0
1
0
0
0
0
1
1
0
1
0
0
0
1
0
0
0
1
1
0
0
1
1
0
1
1
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
1
...

result:

ok Accepted.

Test #20:

score: 20
Accepted
time: 932ms
memory: 11852kb

input:

26 1000000
! 59739044
? 37748736
? 28249674
? 34779261
! 1408249
? 66289518
? 67108863
! 2772107
? 58719741
! 10498082
? 66052095
! 688328
! 49649064
? 49739239
! 12582912
! 33478607
? 0
! 26083666
! 20736
? 56016858
! 1097
! 47696511
? 40296265
? 48219897
! 62242430
! 58515375
? 17563672
! 62806902...

output:

0
0
0
0
0
1
0
1
0
0
0
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
1
1
0
1
1
1
1
1
1
1
0
1
0
0
0
1
0
0
0
1
1
0
0
1
0
0
1
1
1
0
1
0
0
0
0
0
0
0
1
0
0
0
0
1
1
0
1
1
0
1
0
1
0
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
1
1
1
1
0
1
0
0
1
1
0
0
1
1
1
1
1
1
1
1
1
0
0
0
1
0
0
0
0
1
1
0
1
1
1
1
...

result:

ok Accepted.

Subtask #3:

score: 20
Accepted

Test #21:

score: 20
Accepted
time: 1348ms
memory: 36628kb

input:

28 1000000
! 1081468
! 128476263
! 67930241
? 94304031
! 103698752
! 19982
! 198050624
? 249519591
? 71286719
? 255700799
! 103309888
! 819340
! 12852092
? 124739445
? 192734967
! 101320328
! 117594711
? 252032927
! 134267948
? 262940285
! 3155972
? 267876218
! 41984160
? 246413294
? 246824252
? 163...

output:

0
0
1
0
1
0
0
0
0
0
1
1
1
0
0
0
1
0
1
1
1
0
0
0
1
1
0
1
1
1
0
0
1
0
1
1
1
0
0
0
1
0
1
1
1
0
0
1
1
0
0
1
0
0
1
1
1
0
1
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
0
1
0
1
1
1
0
0
0
0
0
0
1
0
1
0
1
0
1
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1
1
1
1
1
1
0
0
0
0
0
0
1
1
1
1
0
0
0
1
0
1
1
1
0
0
0
1
0
1
1
1
0
1
1
0
1
0
1
...

result:

ok Accepted.

Test #22:

score: 20
Accepted
time: 5321ms
memory: 11448kb

input:

28 1000000
! 0
? 268435455
? 268435455
? 268435455
? 268435455
? 268435454
! 262144
! 2097152
? 268435455
? 266338303
! 0
? 268435455
? 268431359
? 268435455
? 268435199
? 268435455
! 0
? 268435455
? 268304383
? 268435455
? 267386871
! 0
! 0
! 0
! 8192
? 234881023
? 268435455
? 268435455
? 268435455...

output:

1
1
1
1
1
1
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
0
0
0
0
1
1
0
0
0
0
1
1
0
0
0
0
1
1
1
1
1
0
0
0
1
0
1
1
1
1
0
0
1
0
1
1
0
0
0
1
0
0
1
1
0
0
0
0
0
0
1
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
1
0
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
1
1
0
1
...

result:

ok Accepted.

Test #23:

score: 20
Accepted
time: 3466ms
memory: 36332kb

input:

28 1000000
! 67108864
? 268369919
? 108724215
! 2621440
! 360576
? 259319807
? 62414335
? 267911039
? 268434111
! 204968
! 3670272
? 255844319
! 8404992
? 267643903
? 264239485
? 268435451
! 67469313
! 136314896
? 268435455
! 0
? 268361727
? 266268671
! 131074
? 268271607
! 16384
! 1705984
! 270464
...

output:

1
1
1
1
1
1
0
1
0
0
0
0
1
0
0
1
0
1
1
1
1
0
1
0
0
1
1
0
1
0
0
0
1
0
0
0
0
0
0
1
1
0
0
1
0
1
0
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
0
1
1
0
1
0
1
0
1
1
0
0
1
0
0
1
1
1
0
0
1
0
1
0
1
1
1
0
0
1
1
1
1
1
0
1
1
1
0
0
1
0
1
0
1
1
0
1
0
0
1
1
0
0
1
0
1
0
0
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
1
0
0
1
1
1
0
0
0
1
1
1
0
0
...

result:

ok Accepted.

Test #24:

score: 20
Accepted
time: 1463ms
memory: 36592kb

input:

28 1000000
! 1902096
? 81641694
? 247381723
? 268423692
! 117194752
? 75033877
? 226360807
! 88368128
? 38723567
! 50598934
! 144779282
? 130765271
! 211109508
! 9496640
? 259837397
? 192822463
! 17358848
! 23330881
! 199852673
? 201030356
! 8467396
? 249459704
! 142884899
! 34112802
! 167781384
? 1...

output:

0
0
0
0
0
0
0
0
1
0
0
0
1
1
0
0
0
1
1
0
0
0
1
0
0
1
1
0
1
0
1
1
0
1
0
0
1
0
0
1
1
0
0
0
0
0
1
1
0
0
1
0
0
1
0
1
1
1
0
0
0
1
1
0
0
0
1
1
0
1
1
0
1
0
0
0
1
1
1
0
1
0
0
0
1
0
1
1
1
1
0
0
1
0
1
1
1
1
0
0
0
0
0
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
0
1
0
1
0
1
1
0
1
1
1
1
0
1
0
1
0
1
1
0
0
1
0
1
0
0
1
0
1
0
1
...

result:

ok Accepted.

Test #25:

score: 20
Accepted
time: 2058ms
memory: 36316kb

input:

28 1000000
! 210829378
? 36947522
? 259790155
? 268433343
? 233308142
? 205687805
! 262177
? 246208617
? 268173279
! 35651584
! 8520002
? 234749947
? 180634441
! 147279353
! 192794271
! 131076
? 268353534
? 130268453
? 101299305
? 228765468
! 33685506
! 557056
! 260
? 268434428
? 207609440
? 2572858...

output:

0
0
0
0
0
1
1
0
0
1
1
0
1
0
1
0
1
1
0
0
0
1
0
0
0
0
0
1
0
0
1
1
0
1
1
0
0
1
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
0
1
0
0
1
0
0
0
1
0
0
1
1
1
0
0
1
0
1
0
1
1
0
0
1
1
1
1
0
0
0
1
0
0
1
0
0
0
1
1
0
0
1
0
1
1
1
0
0
0
1
0
1
0
0
1
1
1
0
0
0
1
1
1
0
0
...

result:

ok Accepted.

Test #26:

score: 20
Accepted
time: 1821ms
memory: 37916kb

input:

28 1000000
! 64484791
! 33554496
! 134217748
? 15770753
? 234878457
! 112293486
! 268426430
? 168308817
! 8389248
? 251656191
? 267991807
? 151001904
? 201325631
? 218124361
! 33556752
! 67108864
! 4
! 265177583
! 263691254
! 206307327
? 268304383
? 268034047
! 266253730
? 6427266
? 268435455
? 1851...

output:

0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
0
0
0
1
0
0
0
1
1
0
0
1
1
0
0
0
1
1
1
0
1
1
0
1
0
0
1
0
0
0
1
0
1
1
0
0
1
1
1
0
0
1
1
1
1
1
1
0
0
1
1
1
1
0
0
1
1
1
0
1
0
1
1
0
0
0
1
0
1
1
0
1
1
1
0
0
1
0
0
1
1
0
1
1
1
1
1
0
0
1
1
0
0
0
1
0
1
1
0
1
1
0
1
1
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
1
1
0
1
1
1
0
0
0
1
0
0
1
1
...

result:

ok Accepted.

Test #27:

score: 20
Accepted
time: 1771ms
memory: 38132kb

input:

28 1000000
! 4202592
? 262144
? 134217728
? 134217727
! 268433915
? 8667202
! 266174462
? 10487808
! 266338303
? 268435455
! 267370495
! 131072
? 268434879
! 248501679
! 0
? 268434935
! 268429303
? 125693919
? 268432895
? 1048704
! 257912703
! 72324
? 268337150
! 33619972
? 67108866
! 199097855
? 26...

output:

0
0
1
0
0
0
1
1
1
0
1
1
1
1
1
0
0
1
1
0
1
0
1
1
0
0
1
0
1
0
1
1
0
0
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
0
0
1
1
1
1
0
1
0
1
1
0
0
1
0
1
0
1
1
1
1
1
0
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
0
0
1
0
0
1
0
1
1
0
0
0
0
1
0
0
0
1
1
1
0
0
0
0
1
0
0
0
0
1
1
0
0
1
1
1
1
1
1
1
1
1
0
1
1
0
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
...

result:

ok Accepted.

Test #28:

score: 20
Accepted
time: 991ms
memory: 36968kb

input:

28 1000000
! 268435455
? 268404569
! 201285633
! 268427264
? 201310256
! 126173184
! 266326028
? 268420376
? 134207050
! 268288000
? 267898882
? 268433315
! 87539712
? 267370496
! 257802240
? 266289152
! 134135808
! 268419072
? 268421951
? 268422248
! 175866400
! 268419072
? 268419104
? 201310208
? ...

output:

0
0
1
1
1
0
1
1
0
0
1
0
1
0
1
0
1
1
1
1
0
1
0
0
0
0
0
0
1
0
1
0
0
1
0
0
1
1
1
0
1
1
1
0
1
0
1
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
1
0
1
1
0
1
0
0
0
1
1
0
0
1
0
1
0
1
1
1
0
0
0
1
0
0
1
0
1
0
0
0
0
1
1
0
1
1
1
0
1
1
0
0
1
1
0
1
0
1
1
0
1
1
0
1
1
1
1
1
0
1
1
0
0
1
0
1
1
1
...

result:

ok Accepted.

Test #29:

score: 20
Accepted
time: 2843ms
memory: 36428kb

input:

28 1000000
! 98304
! 17301505
! 246243328
? 268427255
! 103022880
! 33554432
? 268288300
? 66974465
? 268393616
! 250662912
! 148521024
? 268148687
? 260046591
? 268427804
? 268424330
! 152322048
! 268435071
! 220708864
! 186187776
? 268422639
? 268435287
? 268421745
! 249331729
! 204685312
! 244465...

output:

0
1
1
1
1
1
1
1
0
1
1
1
0
0
1
0
1
0
1
1
0
1
0
0
1
1
0
1
1
1
1
1
0
0
0
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
0
0
1
1
0
0
0
1
0
1
0
0
1
1
0
0
0
0
1
0
1
0
1
0
0
0
1
0
1
0
1
1
0
0
1
0
0
0
1
1
1
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
0
1
0
1
1
1
1
0
0
1
1
1
0
1
0
1
0
1
1
1
1
0
1
1
0
0
1
0
0
1
1
0
1
1
0
1
1
1
...

result:

ok Accepted.

Test #30:

score: 20
Accepted
time: 1242ms
memory: 38112kb

input:

28 1000000
! 102051418
? 2048
? 213870324
! 50323454
! 16908290
! 216060049
! 268237299
! 265797110
? 266959613
! 34131606
! 215308128
? 98433979
! 251658239
! 0
! 268434427
? 21560592
! 250565469
? 238864954
? 3670016
! 267384827
! 126104535
! 169446416
! 139149481
? 254782395
! 1581056
? 210929166...

output:

0
0
0
0
1
1
1
0
1
1
0
1
0
0
0
1
1
0
1
0
0
0
1
0
0
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
1
0
1
1
1
1
1
0
1
0
1
1
1
0
1
1
1
1
0
1
0
0
1
0
1
1
1
0
0
1
1
1
1
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
1
1
1
0
1
0
0
0
0
1
1
1
1
1
1
0
0
1
0
0
0
1
1
0
0
0
0
0
0
1
1
1
0
1
1
0
1
0
0
0
1
0
0
1
0
0
1
1
1
1
1
1
1
1
1
0
0
...

result:

ok Accepted.

Subtask #4:

score: 20
Accepted

Test #31:

score: 20
Accepted
time: 2839ms
memory: 134740kb

input:

30 1000000
! 33852274
? 1017904007
? 1046413001
! 151029382
? 466826079
? 250568375
! 6769874
! 2106474
? 536832803
? 209627867
! 167104971
? 1048372157
! 245380745
! 25174496
? 819646460
! 539548800
! 671358165
? 402955591
? 527753201
! 582494209
? 862862931
? 938974695
? 263672827
? 366968669
? 87...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
1
1
0
0
0
1
1
0
0
1
1
0
0
0
1
0
0
0
0
0
1
0
0
1
1
0
1
0
0
0
0
1
1
0
0
0
1
0
0
1
0
0
0
1
0
0
1
1
0
1
0
1
1
1
1
0
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
0
0
0
1
1
1
1
0
1
1
0
1
1
1
0
1
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
1
1
1
1
1
1
0
0
1
0
0
1
0
1
1
1
...

result:

ok Accepted.

Test #32:

score: 20
Accepted
time: 5711ms
memory: 16236kb

input:

30 1000000
! 16777216
? 1073741823
! 0
! 0
! 0
? 1073741823
? 1073741823
? 1056964607
? 1073741823
! 0
? 1073741823
! 0
! 0
? 1073741823
? 1073741823
! 0
! 0
? 1073741823
! 0
? 1069408255
! 0
? 1073741823
! 0
? 1073741823
! 0
? 1073741823
! 128
! 131072
? 1073741823
? 1073741823
? 1073741823
? 10737...

output:

1
0
0
1
0
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
0
0
0
0
1
0
1
0
0
0
1
0
1
1
0
0
1
1
1
1
1
0
0
0
1
0
0
0
1
1
1
1
0
1
1
1
0
0
0
0
0
0
0
1
1
1
0
0
1
0
0
0
0
1
1
1
1
0
0
1
0
0
0
1
1
1
1
1
1
1
0
0
0
0
0
1
1
0
0
0
0
0
1
0
0
1
1
0
0
1
0
0
1
0
0
1
0
0
0
1
0
1
1
1
1
0
0
1
1
0
0
1
1
0
...

result:

ok Accepted.

Test #33:

score: 20
Accepted
time: 5894ms
memory: 123992kb

input:

30 1000000
! 1073661373
? 1069547518
? 1040187327
? 1064828927
! 268435584
! 54526017
! 536870912
? 1071644655
! 8519680
? 1071640575
! 1073741823
! 1064992
! 64
? 1072160767
? 805298175
? 1006628831
! 2752512
? 1073737724
! 1024
! 536870912
? 939524067
! 4204544
! 0
! 142671904
! 134742202
? 106482...

output:

0
0
0
1
0
1
1
1
0
1
1
0
1
0
1
1
1
0
1
0
1
0
1
0
0
0
1
1
1
1
0
1
0
0
1
0
1
1
1
1
0
0
0
1
0
1
1
1
0
0
0
1
1
1
0
0
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
1
0
0
1
1
0
0
0
0
0
1
0
1
0
0
1
0
1
1
1
1
0
0
0
0
0
1
0
1
1
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
1
0
1
1
1
0
1
0
0
0
1
1
1
0
1
0
0
1
...

result:

ok Accepted.

Test #34:

score: 20
Accepted
time: 2774ms
memory: 134712kb

input:

30 1000000
! 814786940
! 940688522
! 341410458
! 42352898
! 860209250
! 514633857
! 26763330
! 243310796
! 25600418
! 68363333
? 938056250
! 251896592
! 553651236
! 100810789
? 506984941
? 116056774
! 616784901
! 276957332
! 75829252
! 25231922
! 673186852
! 808545586
? 330911500
! 268996754
? 79272...

output:

0
1
0
0
0
0
1
0
0
0
1
1
1
1
1
0
0
1
1
0
1
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
0
0
1
0
0
0
1
1
0
0
0
0
1
1
0
0
1
0
1
1
1
0
1
0
0
1
0
1
0
1
0
1
1
0
0
1
1
0
1
0
0
0
1
1
0
0
0
1
0
0
0
0
1
1
0
0
0
1
0
0
1
1
0
0
0
1
1
0
1
1
1
0
0
0
0
0
1
1
1
1
1
0
1
1
0
0
1
0
0
1
0
1
0
0
1
1
0
1
1
0
1
0
0
0
0
0
0
1
0
0
1
...

result:

ok Accepted.

Test #35:

score: 20
Accepted
time: 3601ms
memory: 134740kb

input:

30 1000000
! 947623540
? 1073709055
! 536727820
! 757142973
? 514413951
! 541065216
? 1073741823
! 728124554
! 131072
! 2114632
? 1071349757
! 128
? 346158708
! 736032396
? 848072391
! 786688
? 463405431
? 348336648
! 1024
? 973078525
? 1073217535
? 270010037
? 804255743
! 471525397
? 1064302589
! 1...

output:

0
0
0
0
0
1
0
1
1
1
0
1
1
1
0
0
1
0
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
0
0
1
0
1
0
1
1
0
0
0
0
0
1
0
0
0
0
1
1
0
0
1
0
0
1
1
0
1
1
0
1
0
1
1
0
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
1
0
0
0
1
1
0
1
0
0
0
0
1
1
1
1
0
0
0
1
1
1
0
0
1
1
0
0
1
0
0
1
1
0
1
1
1
0
1
0
0
0
0
0
1
1
1
1
0
1
1
1
1
1
0
1
1
0
1
1
1
1
...

result:

ok Accepted.

Test #36:

score: 20
Accepted
time: 3310ms
memory: 134280kb

input:

30 1000000
! 62316343
? 1073676223
! 2097160
! 359907021
! 0
! 138
? 1073463023
? 1006632947
! 67109000
? 1073741311
! 1037934173
! 326717363
? 838852607
? 74195224
! 4194434
? 86115012
! 276963330
! 137428992
! 0
? 398458847
! 247461197
! 790030063
! 1005752186
? 1023377407
? 276827768
? 1073740735...

output:

1
0
1
0
1
0
1
0
0
0
0
1
1
0
0
0
1
0
0
1
0
1
0
0
1
0
1
0
0
1
1
1
1
0
0
0
0
1
0
1
1
0
0
1
0
0
1
0
0
1
0
0
1
0
1
0
0
0
1
1
0
1
1
1
0
0
0
0
1
1
0
0
0
0
1
0
1
1
0
1
0
1
0
0
1
0
0
1
0
1
0
0
0
0
1
1
1
1
1
1
1
1
0
1
0
0
0
0
0
1
1
1
1
1
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
1
1
1
1
1
0
1
1
0
1
...

result:

ok Accepted.

Test #37:

score: 20
Accepted
time: 3057ms
memory: 123368kb

input:

30 1000000
! 33818632
? 32898
! 1071644543
? 1073217023
! 134225920
! 98306
? 1072660475
! 989839343
? 139264
! 536937472
! 16448
! 1073725183
? 268435456
? 989331455
! 939655170
? 376728390
! 52428800
? 0
? 939491071
! 939524017
! 536215549
? 4196352
! 131072
? 67108866
! 16777216
! 269504512
? 805...

output:

0
1
0
0
0
1
1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
0
1
1
0
0
0
1
0
0
1
0
1
0
1
0
0
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
1
1
1
0
0
1
0
0
0
1
1
1
0
1
1
1
0
0
1
1
1
0
1
0
1
0
0
1
1
0
0
0
1
0
1
1
1
0
1
1
1
1
1
0
1
1
1
1
0
1
0
0
1
1
0
1
0
1
1
1
0
0
0
0
0
1
0
0
0
1
1
0
1
1
...

result:

ok Accepted.

Test #38:

score: 20
Accepted
time: 3232ms
memory: 136340kb

input:

30 1000000
! 715751424
! 752582658
! 1069514754
! 223576192
! 393480192
! 332922880
! 1073709064
! 1071622152
! 398393344
! 409174016
! 1001848896
? 1073719187
? 1073578048
? 1073728087
? 754317263
? 1073728377
! 986611712
! 267026432
! 536846352
? 1073710080
? 930145416
? 1069514944
! 1073709073
? ...

output:

1
0
0
0
1
0
0
1
1
1
1
1
1
0
1
0
0
0
0
0
0
1
0
1
1
0
0
1
1
0
0
0
1
1
1
1
1
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
1
1
1
0
0
0
0
0
1
1
1
1
1
0
0
0
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
0
0
1
1
1
0
1
0
1
1
1
0
1
1
1
0
0
1
0
0
0
0
1
0
0
0
1
0
1
0
1
0
0
0
0
1
0
0
1
1
0
0
1
0
1
1
0
0
1
1
0
1
0
1
1
0
1
0
0
0
0
0
1
1
0
0
...

result:

ok Accepted.

Test #39:

score: 20
Accepted
time: 6049ms
memory: 134668kb

input:

30 1000000
! 778207233
! 5374208
? 1073741311
? 1073737215
! 276824064
! 643579904
! 1023213568
! 985070382
! 151011332
? 1073712036
? 1073710389
? 1056948256
? 1072168959
! 937688703
! 613318656
? 1071622071
? 1073733503
? 1040155944
! 553517056
? 1073726692
! 773292036
? 1073684637
! 5308416
! 131...

output:

0
0
1
0
1
1
1
1
0
0
1
0
1
1
0
0
0
1
1
1
1
1
0
1
1
0
1
0
0
0
0
0
0
0
1
0
0
0
1
1
1
0
1
0
0
1
1
0
1
1
1
0
0
1
0
1
1
0
1
0
1
1
1
0
1
1
1
1
1
0
1
0
1
1
1
1
0
1
1
0
0
0
0
1
1
1
0
1
0
0
0
1
1
0
0
0
1
0
0
0
0
1
0
0
0
1
0
1
0
0
1
1
0
0
1
1
1
1
1
0
1
0
1
0
0
1
0
1
0
0
0
1
1
1
1
1
0
0
1
1
1
0
1
0
1
0
0
1
0
0
...

result:

ok Accepted.

Test #40:

score: 20
Accepted
time: 2156ms
memory: 134776kb

input:

30 1000000
! 1034944509
! 939523935
? 1073741823
! 993976731
? 536838141
? 1073741823
! 673341776
! 1056948222
? 33818282
! 1035993023
? 1073694470
? 269496832
! 187690975
? 272782352
! 1031782331
? 951778952
! 1073741823
? 1073675743
? 181122811
? 0
? 1039532031
? 345064149
! 531988
? 1073741822
? ...

output:

0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
1
1
1
1
1
1
0
0
1
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
1
0
0
0
1
1
0
0
0
1
0
0
1
0
0
0
0
0
0
1
1
1
1
0
0
0
1
1
1
0
1
1
1
0
1
1
0
1
1
1
1
1
1
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
1
1
0
0
1
0
0
0
0
1
0
0
1
0
1
0
1
1
0
0
1
0
0
0
1
1
0
1
1
1
1
0
1
0
1
0
0
...

result:

ok Accepted.

Subtask #5:

score: 0
Time Limit Exceeded

Test #41:

score: 10
Acceptable Answer
time: 2992ms
memory: 503100kb

input:

32 1000000
! 2474971548
! 348268033
? 1055293046
? 3382525679
? 1805515707
? 3210332902
? 2805668987
? 4025974780
! 2217771280
! 176949664
! 4213841344
! 1477473321
? 3150869759
? 2127418041
! 1610631720
! 3624477314
! 2288149532
! 70909964
! 40117153
! 1343751456
? 3758095615
! 513059275
! 31956816...

output:

0
0
0
0
0
0
0
0
1
1
1
0
1
1
0
1
0
0
1
1
0
0
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
1
0
0
0
0
0
1
0
1
0
0
0
1
1
0
1
0
1
0
0
1
1
1
0
1
1
0
1
0
0
0
0
1
0
1
1
1
0
0
0
0
0
1
0
0
0
1
0
1
1
0
0
0
1
1
1
0
1
1
0
1
0
0
0
0
0
0
0
0
1
0
1
1
1
0
0
1
1
0
1
0
0
1
1
1
0
0
1
1
1
1
1
1
1
...

result:

points 0.5 Wrong answer at operation #500005: Missing output for a query.

Test #42:

score: 10
Acceptable Answer
time: 3689ms
memory: 20684kb

input:

32 1000000
! 0
? 4294965247
? 4294967295
? 4278189567
? 4294967293
? 4294959103
? 4290772991
! 0
! 0
! 0
! 0
! 32768
? 4294967295
! 0
? 4294967295
! 0
! 0
? 4294967295
? 4160749567
? 4294967295
! 0
? 4294967295
? 4294967295
! 8192
! 0
? 3221225471
! 0
? 4294966783
! 0
? 4160749567
! 0
! 0
? 42949672...

output:

1
1
1
1
1
1
0
1
1
1
1
0
0
0
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
0
1
1
1
1
1
0
1
1
0
0
0
1
0
0
1
1
1
1
1
1
1
1
0
0
1
1
0
1
1
0
1
1
1
0
1
1
1
0
0
1
1
0
1
1
1
0
1
1
1
1
1
0
0
0
0
1
1
1
0
0
0
0
1
0
1
1
1
0
0
0
0
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
0
0
1
1
1
1
0
0
0
0
1
1
0
0
1
1
0
1
1
1
1
0
0
1
1
1
1
0
...

result:

points 0.5 Wrong answer at operation #500001: Missing output for a query.

Test #43:

score: 10
Acceptable Answer
time: 8504ms
memory: 261872kb

input:

32 1000000
! 0
! 67371008
? 4290772735
? 4294442943
? 3219118063
? 4158652415
? 4227186542
? 4294950911
? 3753869311
! 73728
! 34832
? 4025483231
! 1073741824
! 33555456
! 536870914
? 4026531839
? 4211015679
! 2560
? 4294967295
? 4294967279
? 4290510847
? 3137339390
! 268566528
? 2062530029
! 335544...

output:

0
0
0
0
1
0
0
0
1
1
0
1
1
0
1
0
0
1
0
0
0
0
1
1
1
1
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
1
0
1
0
1
0
1
0
1
0
0
1
1
0
1
1
1
1
1
1
1
0
0
0
0
1
0
0
0
1
0
0
1
0
0
1
1
0
1
0
0
1
0
1
1
0
0
0
0
1
1
0
1
1
0
1
1
0
0
0
1
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0
1
1
1
0
1
1
0
0
0
1
0
0
1
0
1
1
0
0
0
1
1
0
...

result:

points 0.5 Wrong answer at operation #500001: Missing output for a query.

Test #44:

score: 10
Acceptable Answer
time: 3118ms
memory: 508916kb

input:

32 1000000
! 1755841544
! 573047496
! 16778565
! 2785673864
? 129892336
! 3293577794
! 14942209
? 4191678459
! 565320
? 2291867647
! 136852497
! 372265921
? 2078127419
! 3524808720
? 3741015384
? 4007450330
! 1083707211
! 268443921
? 4113519611
! 1183502594
? 671233048
! 1113114717
? 3210182381
! 38...

output:

0
0
0
0
1
1
0
0
0
1
1
1
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
1
1
0
0
0
1
1
0
0
0
1
0
1
1
0
0
1
1
0
1
0
0
1
1
1
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
1
1
1
1
1
1
0
0
1
1
0
1
1
0
1
0
1
1
1
1
0
0
1
0
0
1
0
1
1
1
0
1
1
0
1
1
0
0
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
0
1
0
1
1
1
0
0
1
1
1
0
0
0
1
0
1
1
...

result:

points 0.5 Wrong answer at operation #500002: Missing output for a query.

Test #45:

score: 10
Acceptable Answer
time: 5007ms
memory: 523592kb

input:

32 1000000
! 105373520
! 473126059
? 836554967
? 4294966655
? 1017917278
! 33554496
! 936097420
! 4098
? 4227334143
? 3217020903
? 4261402095
! 2064
? 388354464
! 33556480
? 4273994239
! 10502152
? 244136115
! 4194308
? 4294443007
! 131281
! 466808739
! 2361409608
! 225471362
! 131104
? 867749959
! ...

output:

0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
0
0
0
0
1
1
0
0
1
0
0
1
1
0
0
1
1
0
1
1
1
0
1
0
0
0
0
0
1
0
0
0
0
1
1
1
1
0
0
0
1
1
0
1
1
1
0
1
0
0
0
1
0
0
1
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
0
1
1
0
0
0
0
0
0
1
1
1
0
1
0
1
1
0
0
0
1
1
0
0
0
1
1
1
1
1
1
1
1
1
0
1
1
1
0
0
1
0
0
1
0
1
0
1
1
0
0
0
1
0
0
0
...

result:

points 0.5 Wrong answer at operation #500002: Missing output for a query.

Test #46:

score: 10
Acceptable Answer
time: 4583ms
memory: 436744kb

input:

32 1000000
! 268439685
! 1073807360
? 4294967135
? 4160684031
! 1775730655
! 1614842369
? 129245452
? 2006188086
? 1246017555
? 4294933491
? 4286578558
? 4275566271
! 4152178530
! 2348767807
? 4290740218
! 65536
? 3220635135
! 2148042756
! 3454528470
! 4126785535
! 163846
! 4001021815
? 3749699519
!...

output:

1
1
0
0
0
1
1
0
1
1
1
1
0
1
1
0
0
0
1
0
0
1
1
0
1
1
0
1
1
1
0
1
0
1
0
1
1
0
1
0
0
1
0
1
1
0
1
0
0
1
1
1
0
0
0
1
0
1
0
1
1
0
0
1
1
1
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
1
1
1
0
0
0
0
1
1
0
1
0
1
1
0
1
0
0
0
1
0
1
1
0
1
0
0
1
1
1
1
1
1
1
1
0
0
1
0
1
1
0
1
0
1
0
1
1
0
1
1
1
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
...

result:

points 0.5 Wrong answer at operation #500003: Missing output for a query.

Test #47:

score: 10
Acceptable Answer
time: 4505ms
memory: 260064kb

input:

32 1000000
! 2164374266
! 12583009
! 4294402047
! 4093640127
! 4294179839
? 1077957264
? 2097152
? 65600
? 2147352511
? 1073742144
? 4026515455
? 1350697216
? 4160749559
? 4026531837
! 805306355
! 263176
! 1077936136
! 531488
! 4294836223
? 4291820991
! 4294819743
! 2
? 8192
? 0
? 167776386
! 429470...

output:

0
0
0
0
0
0
0
1
1
1
0
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
0
0
1
0
1
1
1
0
0
1
1
0
1
1
1
0
1
1
1
1
1
1
0
0
0
0
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
1
0
0
0
0
1
1
1
1
1
1
1
0
0
1
0
0
0
1
0
1
1
0
0
0
1
1
0
0
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
0
0
0
0
0
1
0
1
1
1
0
0
0
1
1
...

result:

points 0.5 Wrong answer at operation #500004: Missing output for a query.

Test #48:

score: 10
Acceptable Answer
time: 8943ms
memory: 518024kb

input:

32 1000000
! 4261348608
? 4294902784
! 4290506559
? 4294932691
! 4026466560
? 4294770688
! 4261281792
! 3345809408
! 2147418240
? 4294901760
! 4293853184
! 4294901760
! 1039925252
! 4293853184
? 4286513152
? 4293826460
? 4026466304
? 4293896996
! 4294901760
? 4294920722
! 4227792896
? 3758030848
! 4...

output:

0
0
0
0
1
0
1
1
0
1
1
0
1
1
0
0
1
0
0
1
1
0
0
1
0
1
1
1
1
0
1
0
1
1
1
0
0
0
1
1
1
0
0
1
0
1
0
1
1
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
1
1
1
1
1
1
1
0
1
1
1
0
0
0
0
0
0
0
0
1
1
1
0
0
0
1
1
1
0
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
0
0
0
0
0
1
1
0
0
0
1
0
1
1
1
1
0
0
0
1
1
0
1
1
0
0
1
0
1
1
1
0
1
0
0
0
0
0
0
1
0
1
...

result:

points 0.5 Wrong answer at operation #500005: Missing output for a query.

Test #49:

score: 0
Time Limit Exceeded

input:

32 1000000
! 3928096769
! 743243776
! 3790422144
? 4294907850
? 4294967294
? 3690970111
! 2135949314
? 4294967279
! 134217984
! 1107296288
? 2146889723
? 4293917695
! 2164523264
? 4294919973
? 4294967295
? 4291816959
! 3783330848
? 4294967295
! 138674176
? 4292870015
? 4294932538
? 4294944684
? 4227...

output:

1
0
0
0
1
1
1
1
0
0
1
0
1
1
0
1
0
0
0
0
1
0
1
1
0
0
0
1
1
0
1
0
1
1
0
0
1
1
1
0
1
0
1
1
0
1
1
0
1
0
1
1
1
0
0
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
0
0
1
1
0
0
1
0
0
1
0
0
1
1
1
1
1
1
0
0
0
0
1
0
1
0
0
0
0
1
1
1
0
1
1
1
1
1
1
1
1
0
1
0
0
0
0
0
0
1
1
0
0
1
0
1
0
1
1
0
0
1
1
1
1
1
0
0
0
1
0
1
1
1
1
0
...

result: