QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#371196#7797. Based Zeroskevinyang#TL 2ms3852kbC++208.9kb2024-03-30 01:47:512024-03-30 01:47:52

Judging History

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

  • [2024-03-30 01:47:52]
  • 评测
  • 测评结果:TL
  • 用时:2ms
  • 内存:3852kb
  • [2024-03-30 01:47:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

/* Macros {{{ */
/*  A lot of this is from some of Benq's submissions
    [https://codeforces.com/profile/Benq]
    Ugly af to the eyes, but with vim fold its barable
    Hopefully c++20 concepts can make all this stuff must cleaner */

/* Basics {{{ */
using ll = long long;
using ld = long double;
using str = string;

using pi = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
#define mp make_pair
#define fi first
#define se second

#define arr array
#define ve vector
using vi = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;

using vpi = vector<pi>;
using vpll = vector<pll>;
using vpld = vector<pld>;

using vvi = vector<vi>;
using vvll = vector<vll>;
using vvld = vector<vld>;

using vvpi = vector<vpi>;
using vvpll = vector<vpll>;
using vvpld = vector<vpld>;

#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz size()
#define rsz(a) resize(a)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

#define For(i, a, b) for (int i = a; i < b; ++i)
#define Rof(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define rep(a) For(_, 0, a)
#define each(a, x) for (auto &a : x)
#define reach(a, x) for (auto a = x.rbegin(); a != x.rend(); ++a)

template <typename T, typename U>
inline void cmin(T &x, U y) {
    if (y < x) x = y;
}
template <typename T, typename U>
inline void cmax(T &x, U y) {
    if (x < y) x = y;
}
/*}}}*/

/* IO {{{ */

/* Template Macros {{{ */
#define tcT template <class T
#define tcTU tcT, class U
#define tcTUU tcT, class... U
/*}}}*/

inline namespace Helpers { /*{{{*/
tcT, class = void > struct is_iterable : false_type {};
tcT > struct is_iterable<
          T, void_t<decltype(begin(declval<T>())), decltype(end(declval<T>()))>>
    : true_type {};
tcT > constexpr bool is_iterable_v = is_iterable<T>::value;

tcT, class = void > struct is_readable : false_type {};
tcT > struct is_readable<T, typename std::enable_if_t<is_same_v<
                                decltype(cin >> declval<T &>()), istream &>>>
    : true_type {};
tcT > constexpr bool is_readable_v = is_readable<T>::value;

tcT, class = void > struct is_printable : false_type {};
tcT > struct is_printable<T, typename std::enable_if_t<is_same_v<
                                 decltype(cout << declval<T>()), ostream &>>>
    : true_type {};
tcT > constexpr bool is_printable_v = is_printable<T>::value;
} /* namespace Helpers */
/*}}}*/

inline namespace Input { /*{{{*/
tcT > constexpr bool needs_input_v = !is_readable_v<T> && is_iterable_v<T>;
tcTUU > void re(T &t, U &...u);
tcTU > void re(pair<T, U> &p); /* pairs */

/* re: read{{{ */
tcT > typename enable_if<is_readable_v<T>, void>::type re(T &x) {
    cin >> x;
} /* default */
tcT > typename enable_if<needs_input_v<T>, void>::type re(
          T &i);                                   // vectors, arrays, etc...
tcTU > void re(pair<T, U> &p) { re(p.fi, p.se); }  // pairs
tcT > typename enable_if<needs_input_v<T>, void>::type re(T &i) {
    each(x, i) re(x);
}
tcTUU > void re(T &t, U &...u) {
    re(t);
    re(u...);
} /* read multiple}}} */

/* rv: resize and read vectors{{{ */
void rv(size_t) {}
tcTUU > void rv(size_t N, ve<T> &t, U &...u);
template <class... U>
void rv(size_t, size_t N2, U &...u);
tcTUU > void rv(size_t N, ve<T> &t, U &...u) {
    t.rsz(N);
    re(t);
    rv(N, u...);
}
template <class... U>
void rv(size_t, size_t N2, U &...u) {
    rv(N2, u...);
} /*}}}*/

/* dumb shortcuts to read in ints{{{ */
void decrement() {} /* subtract one from each */
tcTUU > void decrement(T &t, U &...u) {
    --t;
    decrement(u...);
}
#define ints(...)    \
    int __VA_ARGS__; \
    re(__VA_ARGS__);
#define int1(...)      \
    ints(__VA_ARGS__); \
    decrement(__VA_ARGS__); /*}}}*/
} /* namespace Input */
/*}}}*/

inline namespace ToString { /*{{{*/
tcT > constexpr bool needs_output_v = !is_printable_v<T> && is_iterable_v<T>;

/* ts: string representation to print */
tcT > typename enable_if<is_printable_v<T>, str>::type ts(T v) {
    stringstream ss;
    ss << fixed << setprecision(15) << v;
    return ss.str();
} /* default */
tcT > str bit_vec(T t) { /* bit vector to string */
    str res = "{";
    For(i, 0, t.sz) res += ts(t[i]);
    res += "}";
    return res;
}
str ts(ve<bool> v) { return bit_vec(v); }
template <size_t SZ>
str ts(bitset<SZ> b) {
    return bit_vec(b);
} /* bit vector */
tcTU > str ts(pair<T, U> p); /* pairs */
tcT > typename enable_if<needs_output_v<T>, str>::type ts(
          T v); /* vectors, arrays */
tcTU > str ts(pair<T, U> p) { return "(" + ts(p.fi) + ", " + ts(p.se) + ")"; }
tcT > typename enable_if<is_iterable_v<T>, str>::type ts_sep(T v, str sep) {
    /* convert container to string w/ separator sep */
    bool fst = 1;
    str res = "";
    for (const auto &x : v) {
        if (!fst) res += sep;
        fst = 0;
        res += ts(x);
    }
    return res;
}
tcT > typename enable_if<needs_output_v<T>, str>::type ts(T v) {
    return "{" + ts_sep(v, ", ") + "}";
}

/* for nested DS */
template <int, class T>
typename enable_if<!needs_output_v<T>, ve<str>>::type ts_lev(const T &v) {
    return {ts(v)};
}
template <int lev, class T>
typename enable_if<needs_output_v<T>, ve<str>>::type ts_lev(const T &v) {
    if (lev == 0 || !v.sz) return {ts(v)};
    ve<str> res;
    for (const auto &t : v) {
        if (res.sz) res.back() += ",";
        ve<str> tmp = ts_lev<lev - 1>(t);
        res.insert(end(res), all(tmp));
    }
    For(i, 0, res.sz) {
        str bef = " ";
        if (i == 0) bef = "{";
        res[i] = bef + res[i];
    }
    res.back() += "}";
    return res;
}
} /* namespace ToString */
/*}}}*/

inline namespace Output { /*{{{*/
template <class T>
void pr_sep(ostream &os, str, const T &t) {
    os << ts(t);
}
template <class T, class... U>
void pr_sep(ostream &os, str sep, const T &t, const U &...u) {
    pr_sep(os, sep, t);
    os << sep;
    pr_sep(os, sep, u...);
}
/* print w/ no spaces */
template <class... T>
void pr(const T &...t) {
    pr_sep(cout, "", t...);
}
/* print w/ spaces, end with newline */
void ps() { cout << "\n"; }
template <class... T>
void ps(const T &...t) {
    pr_sep(cout, " ", t...);
    ps();
}
/* debug to cerr */
template <class... T>
void dbg_out(const T &...t) {
    pr_sep(cerr, " | ", t...);
    cerr << endl;
}
void loc_info(int line, str names) {
    cerr << "Line(" << line << ") -> [" << names << "]: ";
}
template <int lev, class T>
void dbgl_out(const T &t) {
    cerr << "\n\n" << ts_sep(ts_lev<lev>(t), "\n") << "\n" << endl;
}
} /* namespace Output */
/*}}}}}}}}}*/


inline __int128 mypow(int a, int b) {
    __int128 res = 1;
    for(__int128 e=1, p=a; e<=b; e<<=1, p=p*p)
        if(e&b) res *= p;
    return res;
}

__int128 n;
void solve(ll tmp) {
    n = tmp;

    vi inds;
    int opt = 0;

    // if base >= n^{1/k}, then n has at most (k-1) 0's mod base
    //  if base^{opt} >= n, then n mod base is suboptimal
    for(int base=2; mypow(base, opt) <= n; ++base) {
        assert(mypow(base, opt) > 0);

        int cnt = 0;
        for(__int128 tmp=n; tmp>0; tmp/=base) cnt += (tmp%base == 0);

        if(cnt > opt) { opt = cnt; inds.clear(); }
        if(cnt == opt) inds.pb(base);
    }

    ps(opt, inds.sz);
    for(auto v : inds) cout << v << ' ';
    cout << '\n';
}


void testing() {
    // ll cv;
    // for(int i=4; i<=62; ++i) {
    //     cv = (1ll<<(i+1))-1;
    //     ps(cv);
    //     solve(cv);
    //
    //     for(int j=i-1; j>=3; --j) {
    //         cv ^= (1ll<<j);
    //         ps(cv);
    //         solve(cv);
    //
    //         for(int k=j-1; k>=2; --k) {
    //             cv ^= (1ll<<k);
    //             ps(cv);
    //             solve(cv);
    //
    //             for(int l=k-1; l>=1; --l) {
    //                 cv ^= (1ll<<l);
    //                 ps(cv);
    //                 solve(cv);
    //
    //                 for(int l2=l-1; l2>=0; --l2) {
    //                     cv ^= (1ll<<l2);
    //                     ps(cv);
    //                     solve(cv);
    //                 }
    //             }
    //         }
    //     }
    //
    // }

    for(int v=2; v<=1e6; ++v) {
        ps(v);
        solve(v);
    }

    ps(1e18);
    solve(1e18);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // testing();

    /* cout << fixed << setprecision(6); */
    int t = 1;
    cin >> t;
    for (int i = 0; i < t; i++) {
        ll tmp;
        re(tmp);
        solve(tmp);
    }

    return 0;
    // you should actually read the stuff at the bottom
}

/* stuff you should look for
 * int overflow, array bounds
 * special cases (n=1?)
 * do smth instead of nothing and stay organized
 * WRITE STUFF DOWN
 * DON'T GET STUCK ON ONE APPROACH
 */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

3
11
1007
239

output:

1 3
2 3 11 
2 2
3 10 
1 4
2 6 15 239 

result:

ok 15 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

1
2

output:

1 1
2 

result:

ok 3 number(s): "1 1 2"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

10
56
20
6
84
25
20
60
73
70
50

output:

3 1
2 
3 1
2 
1 3
2 3 6 
4 1
2 
2 2
2 5 
3 1
2 
2 2
2 3 
4 1
2 
4 1
2 
3 1
2 

result:

ok 34 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 3832kb

input:

100
6211
4783
6225
5664
9709
5455
5424
7394
2329
3880
8260
950
2604
1366
3080
5505
4983
9595
6563
2697
2249
675
1537
5884
6070
2905
3137
5675
8138
1626
5348
8876
6065
8454
9346
3421
8857
8941
2743
9343
6201
45
1651
8575
5327
2577
4553
7595
1185
8775
7241
616
4465
3642
1657
5791
2800
1669
9307
2640
6...

output:

8 1
2 
5 1
2 
8 1
2 
9 1
2 
5 1
2 
5 1
2 
8 1
2 
6 1
2 
7 1
2 
6 1
2 
11 1
2 
3 1
2 
7 1
2 
5 1
2 
9 1
2 
8 1
2 
4 1
2 
5 1
2 
7 1
3 
7 1
2 
7 1
2 
5 1
2 
8 1
2 
4 1
2 
4 1
2 
5 1
2 
8 1
2 
6 1
2 
4 1
2 
5 1
2 
7 1
2 
8 1
2 
5 1
2 
10 1
2 
10 1
2 
4 1
2 
8 1
2 
6 1
2 
4 1
2 
5 1
2 
7 1
2 
2 2
2 3 
4...

result:

ok 309 numbers

Test #5:

score: 0
Accepted
time: 2ms
memory: 3512kb

input:

1000
461349
350342
809551
211152
572968
896101
718511
44614
72871
106360
141199
858436
576392
414585
897161
917037
679916
987675
507878
851589
62793
717573
119037
587678
774831
977964
313698
208868
953676
26986
273250
625834
573172
865274
105345
290197
807126
566514
193786
645978
670847
961765
72414...

output:

11 1
2 
11 1
2 
9 1
2 
10 1
2 
11 1
2 
9 1
2 
6 1
2 
8 1
2 
8 1
2 
6 1
2 
8 1
2 
12 1
2 
12 1
2 
8 1
2 
11 1
2 
6 1
2 
7 1
2 
10 1
2 
4 2
2 3 
8 1
2 
7 1
2 
10 1
2 
6 1
2 
7 1
2 
7 1
2 
9 1
2 
11 1
2 
7 1
2 
10 1
2 
7 1
2 
11 1
2 
11 1
2 
8 1
2 
7 1
2 
9 1
2 
9 1
2 
11 1
2 
11 1
2 
6 1
2 
8 1
2 
7 1...

result:

ok 3016 numbers

Test #6:

score: 0
Accepted
time: 1ms
memory: 3852kb

input:

1000
777059002
567106059
388668775
167791212
42381512
49672608
177050808
261845460
149382624
99056475
130881775
525176452
534623620
238537726
967742710
365633758
326600673
670402852
581698924
947942987
925388803
294998730
302063477
209655322
871274865
966051641
105266482
685127231
675409437
29302600...

output:

13 1
2 
16 1
2 
12 1
2 
19 1
2 
16 1
2 
12 1
2 
15 1
2 
11 2
2 3 
14 1
2 
8 1
2 
10 1
2 
14 1
2 
11 1
2 
8 1
2 
12 1
2 
14 1
2 
12 1
2 
15 1
2 
18 1
2 
17 1
2 
19 1
2 
16 1
2 
16 1
2 
13 1
2 
12 1
2 
14 1
2 
14 1
2 
13 1
2 
16 1
2 
10 1
2 
14 1
2 
16 1
2 
13 1
2 
13 1
2 
15 1
2 
14 1
2 
14 1
2 
13 1...

result:

ok 3004 numbers

Test #7:

score: 0
Accepted
time: 2ms
memory: 3544kb

input:

1000
279846554360
412045752288
342314468812
980743511493
147529260079
909385413888
9636990671
164548629171
115893886661
895700506608
125295918330
957773182610
770786835718
872163538712
414411444790
224773301658
292973214787
413597032696
791272938821
692413707694
335697403673
946050452282
23425062727...

output:

23 1
2 
12 1
2 
20 1
2 
18 1
2 
17 1
2 
22 1
2 
14 1
2 
16 1
2 
15 1
2 
20 1
2 
13 1
2 
12 1
2 
17 1
2 
18 1
2 
20 1
2 
21 1
2 
23 1
2 
22 1
2 
19 1
2 
20 1
2 
17 1
2 
24 1
2 
19 1
2 
15 1
2 
23 1
2 
17 1
2 
16 1
2 
15 1
2 
18 1
2 
17 1
2 
16 1
2 
18 1
2 
11 1
2 
15 1
2 
14 1
2 
18 1
2 
24 1
2 
20 1...

result:

ok 3000 numbers

Test #8:

score: 0
Accepted
time: 2ms
memory: 3784kb

input:

1000
21626098135324
362066820213913
903245463366728
767979280848578
943350043731730
766006854598939
906271674193425
241098338151007
529216400439268
527684685791751
344810587233633
482106213944703
779288647429689
654884279036436
641224195307472
76645831298843
718949620066867
317730034362120
968762933...

output:

20 1
2 
31 1
2 
22 1
2 
24 1
2 
26 1
2 
22 1
2 
24 1
2 
22 1
2 
22 1
2 
27 1
2 
26 1
2 
22 1
2 
28 1
2 
30 1
2 
27 1
2 
20 1
2 
27 1
2 
28 1
2 
25 1
2 
25 1
2 
23 1
2 
26 1
2 
24 1
2 
27 1
2 
22 1
2 
18 1
2 
18 1
2 
19 1
2 
22 1
2 
24 1
2 
20 1
2 
28 1
2 
19 1
2 
30 1
2 
25 1
2 
25 1
2 
23 1
2 
21 1...

result:

ok 3000 numbers

Test #9:

score: 0
Accepted
time: 2ms
memory: 3624kb

input:

1000
649146224195270358
537375873092588506
353240286745598313
757106643795373130
108739720703384089
77261839685307602
834545739369686296
770713958523995317
760140402370150400
49040205175170572
528159421818118348
190796248318634900
439926746082022255
341870645228287665
957088889949442371
193821093331...

output:

31 1
2 
31 1
2 
28 1
2 
35 1
2 
37 1
2 
27 1
2 
28 1
2 
40 1
2 
38 1
2 
29 1
2 
33 1
2 
31 1
2 
25 1
2 
25 1
2 
34 1
2 
26 1
2 
29 1
2 
29 1
2 
25 1
2 
27 1
2 
28 1
2 
29 1
2 
25 1
2 
27 1
2 
27 1
2 
29 1
2 
30 1
2 
27 1
2 
32 1
2 
25 1
2 
28 1
2 
30 1
2 
29 1
2 
28 1
2 
18 1
2 
31 1
2 
29 1
2 
27 1...

result:

ok 3000 numbers

Test #10:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

1000
734186046517055256
165084007156625592
695422127422996908
685293070795327350
764057744212502744
196178700179523314
296662551094725660
661256240068125746
746188231866195473
773477966087011552
635909464109027109
613473160655768595
999391693262114068
759471734621897990
436930535877751376
1246315786...

output:

34 1
2 
30 1
2 
29 1
2 
30 1
2 
29 1
2 
26 1
2 
34 1
2 
32 1
2 
25 1
2 
29 1
2 
32 1
2 
30 1
2 
28 1
2 
34 1
2 
38 1
2 
22 1
2 
33 1
2 
33 1
2 
28 1
2 
29 1
2 
30 1
2 
33 1
2 
34 1
2 
26 1
2 
24 1
2 
32 1
2 
28 1
2 
29 1
2 
33 1
2 
27 1
2 
38 1
2 
26 1
2 
35 1
2 
32 1
2 
26 1
2 
33 1
2 
29 1
2 
31 1...

result:

ok 3000 numbers

Test #11:

score: 0
Accepted
time: 2ms
memory: 3612kb

input:

1000
901200459137203037
678224965966700400
932486108644871288
961482466817641206
991527271642621456
210964052892617534
745560256820374720
497194876946615859
722309708053462640
626344722999754976
994855591433313181
386551877205110888
935004151629090204
287237917737732798
225425762226139679
7169834313...

output:

29 1
2 
30 1
2 
27 1
2 
23 1
2 
29 1
2 
27 1
2 
32 1
2 
32 1
2 
30 1
2 
37 1
2 
24 1
2 
35 1
2 
28 1
2 
23 1
2 
28 1
2 
28 1
2 
33 1
2 
27 1
2 
29 1
2 
25 1
2 
28 1
2 
29 1
2 
25 1
2 
26 1
2 
29 1
2 
26 1
2 
29 1
2 
27 1
2 
32 1
2 
30 1
2 
28 1
2 
31 1
2 
23 1
2 
29 1
2 
26 1
2 
33 1
2 
29 1
2 
24 1...

result:

ok 3000 numbers

Test #12:

score: 0
Accepted
time: 2ms
memory: 3600kb

input:

1000
468214871757350817
714737957336583707
946178057306937168
737671862839955061
595624766512931666
425749405605711754
617829995105832279
909761476970330176
498431179945762512
802583516767274198
330429681902823456
459630598049420479
870616614291033636
615004100853567607
974480810622749088
7262199457...

output:

21 1
2 
33 1
2 
31 1
2 
31 1
2 
35 1
2 
32 1
2 
26 1
2 
36 1
2 
31 1
2 
27 1
2 
39 1
2 
23 1
2 
32 1
2 
31 1
2 
35 1
2 
32 1
2 
31 1
2 
29 1
2 
34 1
2 
26 1
2 
32 1
2 
32 1
2 
36 1
2 
23 1
2 
30 1
2 
36 1
2 
25 1
2 
35 1
2 
25 1
2 
24 1
2 
33 1
2 
36 1
2 
31 1
2 
27 1
2 
28 1
2 
30 1
2 
30 1
2 
27 1...

result:

ok 3000 numbers

Test #13:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

1000
858601321232274393
727878911851691218
583242038528811547
913861254567301620
999722261383241879
840534758318805974
890099741981224430
545700118143787583
897924688692838177
555450273680017624
889375809227109526
756081351453538567
806229072658009773
542770292559337006
454941972865086783
8168811479...

output:

26 1
2 
31 1
2 
34 1
2 
27 1
2 
26 1
2 
27 1
2 
23 1
2 
21 1
2 
27 1
2 
28 1
2 
29 1
2 
23 1
2 
28 1
2 
32 1
2 
30 1
2 
33 1
2 
29 1
2 
31 1
2 
20 1
2 
22 1
2 
36 1
2 
31 1
2 
29 1
2 
26 1
2 
27 1
2 
33 1
2 
30 1
2 
28 1
2 
37 1
2 
32 1
2 
27 1
2 
32 1
2 
25 1
2 
27 1
2 
24 1
2 
22 1
2 
35 1
2 
35 1...

result:

ok 3000 numbers

Test #14:

score: 0
Accepted
time: 2ms
memory: 3600kb

input:

1000
525615733852422174
841019866366798731
520306019750685926
990050650589615474
827191793108327881
955320111031900193
638997447706873492
958266713872534605
674046160585138046
931689067447536844
824949899696619803
529160068002880860
741841535319953205
947164438820396022
512031089662714094
7044362717...

output:

33 1
2 
22 1
2 
24 1
2 
27 1
2 
26 1
2 
31 1
2 
31 1
2 
30 1
2 
25 1
2 
34 1
2 
33 1
2 
27 1
2 
33 1
2 
29 1
2 
31 1
2 
26 1
2 
37 1
2 
27 1
2 
28 1
2 
30 1
2 
26 1
2 
35 1
2 
27 1
2 
28 1
2 
31 1
2 
31 1
2 
31 1
2 
31 1
2 
31 1
2 
26 1
2 
31 1
2 
30 1
2 
32 1
2 
24 1
2 
26 1
2 
28 1
2 
29 1
2 
31 1...

result:

ok 3000 numbers

Test #15:

score: 0
Accepted
time: 2ms
memory: 3520kb

input:

1000
792630146472569957
754160816586938948
657370005267527598
866240046611929326
631289283683670795
670105468039961706
611267185992331048
970833313896248925
650167632477437915
907927861215056060
783896027020905867
702238788847190451
677453993686929341
774930626231198123
792492251905051786
6052304553...

output:

22 1
2 
33 1
2 
24 1
2 
33 1
2 
35 1
2 
31 1
2 
29 1
2 
26 1
2 
31 1
2 
31 1
2 
29 1
2 
26 1
2 
29 1
2 
31 1
2 
29 1
2 
28 1
2 
32 1
2 
25 1
2 
26 1
2 
27 1
2 
34 1
2 
31 1
2 
24 1
2 
27 1
2 
29 1
2 
31 1
2 
30 1
2 
27 1
2 
24 1
2 
33 1
2 
31 1
2 
31 1
2 
34 1
2 
30 1
2 
30 1
2 
33 1
2 
29 1
2 
29 1...

result:

ok 3000 numbers

Test #16:

score: 0
Accepted
time: 2ms
memory: 3808kb

input:

1000
983016595947493522
990673807956822242
994433986489401970
842429438339275879
935386774259013712
884890820753055923
883536928572755895
806771955069706324
826289112959672377
860794622422766788
919470121785383441
975317505396532749
702696809347032922
849581372997646397
806024638905570225
7433556794...

output:

36 1
2 
29 1
2 
32 1
2 
29 1
2 
31 1
2 
28 1
2 
29 1
2 
33 1
2 
30 1
2 
31 1
2 
34 1
2 
36 1
2 
30 1
2 
32 1
2 
27 1
2 
31 1
2 
28 1
2 
25 1
2 
36 1
2 
31 1
2 
32 1
2 
24 1
2 
25 1
2 
29 1
2 
28 1
2 
31 1
2 
29 1
2 
33 1
2 
37 1
2 
37 1
2 
23 1
2 
32 1
2 
28 1
2 
28 1
2 
24 1
2 
30 1
2 
30 1
2 
32 1...

result:

ok 3000 numbers

Test #17:

score: 0
Accepted
time: 2ms
memory: 3628kb

input:

1000
950031004272674007
803814766766897046
908125935151467863
818618830066622424
839484269129323929
899676173466150133
932434638593372261
819338555093420647
802410584851972244
837033416190285996
878416244814702193
871768263095618110
972050955865591970
807090959903059244
930042530945016779
8068188181...

output:

29 1
2 
28 1
2 
32 1
2 
29 1
2 
22 1
2 
30 1
2 
34 1
2 
34 1
2 
34 1
2 
27 1
2 
30 1
2 
35 1
2 
27 1
2 
25 1
2 
29 1
2 
30 1
2 
25 1
2 
23 1
2 
30 1
2 
35 1
2 
22 1
2 
35 1
2 
37 1
2 
22 1
2 
35 1
2 
33 1
2 
28 1
2 
26 1
2 
31 1
2 
25 1
2 
23 1
2 
29 1
2 
30 1
2 
32 1
2 
25 1
2 
35 1
2 
33 1
2 
31 1...

result:

ok 3001 numbers

Test #18:

score: 0
Accepted
time: 2ms
memory: 3548kb

input:

1000
917045416892821794
916955721282004552
945189916373342221
994808226088936235
966953800854409879
914461530474211617
904704376878829784
955277191971910709
978532056744272107
913272209957805169
913990335284212463
944846979644960393
907663418527535358
934857147313861324
987131652037611393
9076130060...

output:

24 1
2 
29 1
2 
27 1
2 
26 1
2 
28 1
2 
30 1
2 
32 1
2 
31 1
2 
30 1
2 
30 1
2 
27 1
2 
30 1
2 
28 1
2 
28 1
2 
27 1
2 
29 1
2 
28 1
2 
31 1
2 
30 1
2 
36 1
2 
32 1
2 
35 1
2 
34 1
2 
24 1
2 
30 1
2 
20 1
2 
28 1
2 
33 1
2 
30 1
2 
23 1
2 
33 1
2 
31 1
2 
27 1
2 
34 1
2 
30 1
2 
34 1
2 
26 1
2 
23 1...

result:

ok 3001 numbers

Test #19:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

1000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
100000000000000...

output:

36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1
2 
36 1...

result:

ok 3000 numbers

Test #20:

score: -100
Time Limit Exceeded

input:

1000
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
16760831
1676083...

output:


result: