QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212247#5096. 千百hos_lyric#100 ✓383ms23832kbC++149.4kb2023-10-13 13:24:342024-07-04 02:49:55

Judging History

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

  • [2024-07-04 02:49:55]
  • 评测
  • 测评结果:100
  • 用时:383ms
  • 内存:23832kb
  • [2023-10-13 13:24:34]
  • 提交

answer

#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>

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")


// floor(a / b)
Int divFloor(Int a, Int b) {
  return a / b - (((a ^ b) < 0 && a % b != 0) ? 1 : 0);
}

// ceil(a / b)
Int divCeil(Int a, Int b) {
  return a / b + (((a ^ b) > 0 && a % b != 0) ? 1 : 0);
}


// point add, rectangle sum
template <class X, class Y, class T> struct Bit2d {
  vector<X> xs;
  vector<pair<Y, X>> yxs;
  vector<vector<Y>> yss;
  int m;
  vector<int> ns;
  vector<vector<T>> bit;
  Bit2d() {}
  void book(X x, Y y) {
    xs.push_back(x);
    yxs.emplace_back(y, x);
  }
  void build() {
    sort(xs.begin(), xs.end());
    xs.erase(unique(xs.begin(), xs.end()), xs.end());
    m = xs.size();
    yss.assign(m, {});
    sort(yxs.begin(), yxs.end());
    for (const auto &yx : yxs) {
      const X x = yx.second;
      const Y y = yx.first;
      const int a = lower_bound(xs.begin(), xs.end(), x) - xs.begin();
      assert(a < m); assert(xs[a] == x);
      for (int u = a; u < m; u |= u + 1) yss[u].push_back(y);
    }
    ns.assign(m, 0);
    bit.assign(m, {});
    for (int u = 0; u < m; ++u) {
      yss[u].erase(unique(yss[u].begin(), yss[u].end()), yss[u].end());
      ns[u] = yss[u].size();
      bit[u].assign(ns[u], 0);
    }
  }
  void add(X x, Y y, T val) {
    const int a = lower_bound(xs.begin(), xs.end(), x) - xs.begin();
    assert(a < m); assert(xs[a] == x);
    for (int u = a; u < m; u |= u + 1) {
      const int b = lower_bound(yss[u].begin(), yss[u].end(), y) - yss[u].begin();
      assert(b < ns[u]); assert(yss[u][b] == y);
      for (int v = b; v < ns[u]; v |= v + 1) bit[u][v] += val;
    }
  }
  T get(X x0, X x1, Y y0, Y y1) const {
    const int a0 = lower_bound(xs.begin(), xs.end(), x0) - xs.begin();
    const int a1 = lower_bound(xs.begin(), xs.end(), x1) - xs.begin();
    T ret = 0;
    for (int u = a0; u; u &= u - 1) ret -= get(u - 1, y0, y1);
    for (int u = a1; u; u &= u - 1) ret += get(u - 1, y0, y1);
    return ret;
  }
 private:
  T get(int u, Y y0, Y y1) const {
    T ret = 0;
    const int b0 = lower_bound(yss[u].begin(), yss[u].end(), y0) - yss[u].begin();
    const int b1 = lower_bound(yss[u].begin(), yss[u].end(), y1) - yss[u].begin();
    for (int v = b0; v; v &= v - 1) ret -= bit[u][v - 1];
    for (int v = b1; v; v &= v - 1) ret += bit[u][v - 1];
    return ret;
  }
};


int N, Q;
vector<Int> A;
vector<int> P;
vector<Int> V;

Int M;
vector<Int> B;


namespace brute {
Int solve(vector<Int> bs) {
  vector<Int> qs(N), rs(N);
  for (int i = 0; i < N; ++i) {
    qs[i] = divFloor(bs[i], M);
    rs[i] = bs[i] - M * qs[i];
  }
  Int ans = 0;
  for (int i = 0; i < N; ++i) for (int j = i + 1; j < N; ++j) {
    if (rs[i] == rs[j]) {
      return -1;
    }
    ans += abs(qs[j] - qs[i] - ((rs[i] > rs[j]) ? 1 : 0));
  }
  return ans;
}
vector<Int> run() {
cerr<<"[brute::run]"<<endl;
  vector<Int> ans(Q, -1);
  auto bs = B;
  for (int q = 0; q < Q; ++q) {
    bs[P[q]] += V[q];
// cerr<<COLOR("33")<<bs<<COLOR()<<endl;
    ans[q] = solve(bs);
    bs[P[q]] -= V[q];
  }
  return ans;
}
}  // brute


namespace brute2 {
Int solve(vector<Int> bs) {
  vector<Int> qs(N), rs(N);
  for (int i = 0; i < N; ++i) {
    qs[i] = divFloor(bs[i], M);
    rs[i] = bs[i] - M * qs[i];
  }
  for (int i = 0; i < N; ++i) for (int j = i + 1; j < N; ++j) {
    if (rs[i] == rs[j]) {
      return -1;
    }
  }
  Int ans = 0;
  for (int i = 0; i < N; ++i) for (int j = i + 1; j < N; ++j) {
    ans += abs(qs[j] - qs[i]);
  }
  for (int i = 0; i < N; ++i) for (int j = i + 1; j < N; ++j) {
    if (rs[i] > rs[j]) {
      ans += (1 - 2 * ((qs[i] < qs[j]) ? 1 : 0));
    }
  }
  return ans;
}
vector<Int> run() {
cerr<<"[brute2::run]"<<endl;
  vector<Int> ans(Q, -1);
  auto bs = B;
  for (int q = 0; q < Q; ++q) {
    bs[P[q]] += V[q];
// cerr<<COLOR("33")<<bs<<COLOR()<<endl;
    ans[q] = solve(bs);
    bs[P[q]] -= V[q];
  }
  return ans;
}
}  // brute2


namespace fast {
vector<Int> run() {
cerr<<"[fast::run]"<<endl;
  vector<Int> C(N), D(N);
  for (int i = 0; i < N; ++i) {
    C[i] = divFloor(B[i], M);
    D[i] = B[i] - M * C[i];
  }
  vector<Int> X(Q), Y(Q);
  for (int q = 0; q < Q; ++q) {
    const Int b = B[P[q]] + V[q];
    X[q] = divFloor(b, M);
    Y[q] = b - M * X[q];
  }
/*
cerr<<"C = "<<C<<endl;
cerr<<"D = "<<D<<endl;
cerr<<"P = "<<P<<endl;
cerr<<"X = "<<X<<endl;
cerr<<"Y = "<<Y<<endl;
*/
  
  vector<Int> ans(Q, 0);
  // [i < j] |qs[j] - qs[i]|
  {
    vector<pair<Int, int>> cis(N);
    for (int i = 0; i < N; ++i) cis[i] = make_pair(C[i], i);
    sort(cis.begin(), cis.end());
    vector<Int> sums(N + 1, 0);
    for (int j = 0; j < N; ++j) sums[j + 1] = sums[j] + cis[j].first;
    Int base = 0;
    vector<Int> contris(N, 0);
    for (int j = 0; j < N; ++j) {
      const int i = cis[j].second;
      contris[i] += (j * C[i] - sums[j]);
      contris[i] += ((sums[N] - sums[j + 1]) - (N - (j + 1)) * C[i]);
      base += contris[i];
    }
    assert(base % 2 == 0);
    base /= 2;
// cerr<<"base = "<<base<<", contris = "<<contris<<endl;
    for (int q = 0; q < Q; ++q) {
      const int i = P[q];
      const int j = lower_bound(cis.begin(), cis.end(), make_pair(X[q], -1)) - cis.begin();
      ans[q] += base;
      ans[q] -= contris[i];
      ans[q] += (j * X[q] - sums[j]);
      ans[q] += ((sums[N] - sums[j]) - (N - j) * X[q]);
      ans[q] -= abs(X[q] - C[i]);
    }
  }
  // [i < j] [rs[i] > rs[j]]
  // [i < j] [rs[i] > rs[j]] [qs[i] < qs[j]] 2
  {
    vector<vector<int>> qss(N);
    for (int q = 0; q < Q; ++q) qss[P[q]].push_back(q);
    Int base = 0;
    vector<Int> contris(N, 0);
    Bit2d<Int, Int, Int> bit2d;
    for (int i = 0; i < N; ++i) bit2d.book(C[i], D[i]);
    bit2d.build();
    const Int xL = *min_element(C.begin(), C.end());
    const Int xR = *max_element(C.begin(), C.end()) + 1;
    const Int yL = *min_element(D.begin(), D.end());
    const Int yR = *max_element(D.begin(), D.end()) + 1;
    auto getL = [&](Int x, Int y) -> Int {
      const Int res0 = bit2d.get(xL, xR, y + 1, yR);
      const Int res1 = bit2d.get(xL, x, y + 1, yR);
      return res0 - 2 * res1;
    };
    auto getR = [&](Int x, Int y) -> Int {
      const Int res0 = bit2d.get(xL, xR, yL, y);
      const Int res1 = bit2d.get(x + 1, xR, yL, y);
      return res0 - 2 * res1;
    };
    for (int i = 0; i < N; ++i) {
      contris[i] += getL(C[i], D[i]);
      base += contris[i];
      for (const int q : qss[i]) ans[q] += getL(X[q], Y[q]);
      bit2d.add(C[i], D[i], +1);
    }
    for (int i = 0; i < N; ++i) {
      bit2d.add(C[i], D[i], -1);
      contris[i] += getR(C[i], D[i]);
      for (const int q : qss[i]) ans[q] += getR(X[q], Y[q]);
    }
    for (int q = 0; q < Q; ++q) {
      const int i = P[q];
      ans[q] += base;
      ans[q] -= contris[i];
    }
  }
  
  vector<int> can(Q, 0);
  {
    map<Int, int> freq;
    int bad = 0;
    auto add = [&](Int d, int sig) -> void {
      bad -= max(freq[d] - 1, 0);
      freq[d] += sig;
      bad += max(freq[d] - 1, 0);
    };
    for (int i = 0; i < N; ++i) {
      add(D[i], +1);
    }
    for (int q = 0; q < Q; ++q) {
      const int i = P[q];
      add(D[i], -1);
      add(Y[q], +1);
      can[q] = (bad == 0);
      add(Y[q], -1);
      add(D[i], +1);
    }
  }
// cerr<<"can = "<<can<<endl;
  for (int q = 0; q < Q; ++q) if (!can[q]) {
    ans[q] = -1;
  }
  return ans;
}
}  // fast


int main() {
  for (; ~scanf("%d%d", &N, &Q); ) {
    A.resize(N);
    for (int i = 0; i < N; ++i) {
      scanf("%lld", &A[i]);
      if (i & 1) A[i] *= -1;
    }
    P.resize(Q);
    V.resize(Q);
    for (int q = 0; q < Q; ++q) {
      scanf("%d%lld", &P[q], &V[q]);
      if (P[q] & 1) V[q] *= -1;
      ++P[q] %= N;
    }
    
    B.assign(N + 1, 0);
    for (int i = 0; i < N; ++i) {
      B[i + 1] = B[i] + A[i];
    }
    M = B[N];
    B.pop_back();
    if (M < 0) {
      M *= -1;
      for (int i = 0; i < N; ++i) {
        B[i] *= -1;
      }
      for (int q = 0; q < Q; ++q) {
        V[q] *= -1;
      }
    }
cerr<<"M = "<<M<<endl;
    
    vector<Int> ans(Q, -1);
    if (N % 2 == 0 && M > 0) {
      ans = fast::run();
    }
    for (int q = 0; q < Q; ++q) {
      printf("%lld\n", ans[q]);
    }
  }
  return 0;
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 3800kb

input:

49 50
1 1 -21 8 15 -2 33 -15 49 -24 -7 13 -8 18 -16 -13 50 -42 -4 8 -22 -5 38 -20 7 18 -10 -34 -11 18 36 -47 2 -42 40 -4 15 2 37 4 29 -28 6 -6 -6 25 -8 1 -4
5 -7
27 15
14 -50
15 -44
1 -38
34 -19
17 -41
5 6
5 -5
6 -10
8 -6
3 46
25 26
32 -50
3 37
2 23
5 -29
14 -36
14 48
2 6
13 -38
15 -20
16 -45
33 39
...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 50 numbers

Test #2:

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

input:

48 50
-38 32 -4 49 -31 9 -24 -2 14 -9 -43 39 17 13 -20 3 -3 7 -27 21 -18 5 -42 36 7 5 -44 28 11 39 -11 -21 -9 42 16 -19 -26 30 -41 5 -29 28 -37 30 -8 23 -8 19
43 41
32 -19
3 45
30 0
32 -36
10 -21
6 -14
32 -28
2 -27
8 -19
15 17
1 18
19 12
42 38
25 5
13 31
20 21
27 -18
36 -35
19 -14
18 -45
42 13
42 16...

output:

24
20
24
21
22
21
21
21
21
19
23
22
21
22
20
23
22
20
21
21
24
21
21
-1
21
22
21
17
20
21
23
22
22
21
20
22
23
22
22
22
21
-1
21
21
23
21
22
21
22
21

result:

ok 50 numbers

Test #3:

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

input:

48 50
-32 32 -35 -15 -7 48 -18 -22 -42 30 -4 30 15 29 25 24 5 16 5 27 6 4 -32 5 3 19 -27 17 -40 -8 21 -15 -19 -15 12 -17 7 35 2 45 3 37 -11 39 -35 5 9 -5
4 -22
7 -34
17 18
13 -16
24 -30
7 -4
36 -40
14 -35
22 3
35 -3
15 4
8 31
32 9
47 27
44 10
22 21
25 -33
38 35
20 -34
39 -22
46 43
40 -9
1 30
10 36
3...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
72
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 50 numbers

Test #4:

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

input:

46 50
14 -43 -9 -35 -4 18 -24 -48 11 -25 33 5 27 24 4 -47 -19 -48 38 -35 44 -21 3 -33 30 -36 -12 3 -12 25 16 -35 14 2 47 -41 7 13 37 10 32 -41 50 -50 -22 -19
24 42
17 18
11 -10
26 42
21 -30
19 40
14 34
39 30
6 -18
0 -34
5 -34
4 43
9 43
13 41
10 -36
6 17
8 31
31 -35
35 -20
32 39
20 -35
24 44
0 -5
14 ...

output:

42
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
42
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 50 numbers

Test #5:

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

input:

46 50
-22 5 -48 9 -12 11 -24 -11 -29 27 -22 -3 -32 46 -6 10 -27 -6 -11 34 -46 12 -27 34 14 0 3 45 13 27 4 -3 -6 -7 4 -25 -11 17 14 37 -12 36 -48 47 5 12
3 31
7 -10
37 -7
8 -23
21 -19
37 25
45 46
39 -45
25 41
17 -28
28 48
41 -32
20 4
2 -2
26 -28
20 -22
33 20
24 -29
29 39
40 50
8 -9
26 28
22 -34
12 22...

output:

-1
-1
-1
-1
-1
-1
-1
-1
54
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
51
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 50 numbers

Test #6:

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

input:

44 50
-40 34 -22 -18 17 14 -46 44 -42 5 -48 32 -37 43 -28 37 -38 -2 -40 38 -15 48 -33 1 -26 -6 -39 13 -19 19 -41 -23 -26 17 -33 -8 -15 21 0 35 -24 35 -9 13
8 0
15 9
22 -49
6 11
33 -13
21 31
4 -28
10 -31
18 38
15 -22
21 48
23 48
18 -32
20 12
28 13
16 37
43 -40
27 23
10 15
27 -49
19 -19
24 45
18 -13
2...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
12
-1
-1
-1
-1
-1
-1
-1
-1
12
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 50 numbers

Test #7:

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

input:

44 50
-23 39 17 -25 11 -14 -44 -23 -2 45 -41 34 -10 29 14 -19 -31 -13 -44 33 -47 -16 -18 -8 -49 35 -25 26 -30 29 -22 7 -5 33 -17 9 -15 4 22 15 -8 12 -39 -12
30 23
23 1
2 34
7 -38
14 45
10 -34
13 -16
10 47
25 -6
1 24
43 20
17 -6
17 -41
16 15
23 0
1 -24
37 -38
17 -19
21 49
25 -28
43 -48
6 36
13 36
29 ...

output:

46
45
43
49
45
-1
42
47
45
46
-1
45
48
45
45
43
46
47
46
45
49
47
46
48
44
43
42
46
42
45
46
-1
45
45
46
45
43
-1
45
-1
-1
45
-1
46
46
46
48
45
44
49

result:

ok 50 numbers

Test #8:

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

input:

42 50
-8 -11 17 -24 34 -7 35 4 -8 13 42 -29 5 -17 4 -10 43 -6 21 3 18 -20 18 -9 47 -33 31 -20 8 -14 13 -11 44 -28 -22 -30 13 -23 8 3 9 -21
34 -12
25 34
25 -5
24 36
31 37
38 32
32 5
22 -4
10 1
14 -15
41 -15
34 34
10 19
8 34
36 -7
37 -13
11 6
14 49
36 27
16 32
31 3
19 -23
25 4
16 -25
21 -45
36 21
6 39...

output:

11
11
10
11
12
14
10
10
10
11
11
10
10
9
10
12
10
11
11
13
10
10
10
10
12
10
11
12
12
11
-1
11
13
10
12
10
9
12
11
10
10
11
13
13
11
13
11
12
10
14

result:

ok 50 numbers

Test #9:

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

input:

42 50
16 6 24 49 -16 14 -36 -9 -46 31 -49 3 -39 6 -34 30 -44 27 -33 17 12 29 -34 7 -44 -7 -43 -11 -34 29 -17 38 -19 -8 8 50 11 35 -37 -14 22 27
1 -43
22 47
36 42
36 32
31 -22
24 -27
30 13
29 -48
34 12
33 -21
19 2
7 48
33 9
4 -29
25 -5
27 29
10 -35
2 17
29 28
15 -39
21 34
3 0
32 24
32 -33
4 -25
31 -4...

output:

28
26
-1
27
25
26
25
26
26
25
25
25
24
26
25
24
26
25
26
26
-1
25
24
26
26
26
25
25
28
28
26
25
26
27
26
26
27
27
26
19
25
25
25
26
27
25
26
25
25
25

result:

ok 50 numbers

Test #10:

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

input:

40 50
-15 18 -30 27 4 3 15 50 4 10 -30 1 11 21 -25 -24 -42 37 6 -22 -3 48 -41 21 -38 43 -32 9 11 36 -40 -21 -1 -18 -43 43 20 48 -42 -19
35 -42
35 -1
28 4
20 35
0 6
25 43
28 33
19 39
0 0
10 45
7 -18
34 6
1 -41
7 -25
35 19
26 -1
8 34
8 -26
10 17
20 9
9 -33
22 -5
32 9
17 -9
35 23
10 3
28 23
3 45
10 -29...

output:

23
24
24
27
24
27
25
23
24
26
23
25
27
23
24
24
-1
24
23
25
26
24
25
23
24
24
24
27
27
26
-1
25
22
25
24
25
23
26
23
24
24
24
24
24
25
23
24
26
23
24

result:

ok 50 numbers

Test #11:

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

input:

50 50
-47 49 -50 47 -47 48 -49 50 -49 49 -48 47 -47 49 -49 49 -46 48 -50 49 -49 47 -46 50 -48 -22 21 -22 21 -25 24 -25 22 -21 24 -25 22 -25 25 -23 23 -24 21 -22 22 -24 22 -21 25 -24
34 -24
42 20
29 -28
7 31
35 47
36 -50
3 33
48 40
35 38
24 10
42 18
17 -22
33 -23
47 44
20 18
5 -25
11 -31
24 -25
36 45...

output:

-1
665
-1
663
664
663
664
665
664
665
-1
664
665
-1
664
667
667
666
664
665
666
665
664
665
664
665
663
665
665
664
664
664
664
-1
664
665
-1
-1
-1
663
664
664
667
664
-1
663
663
667
663
665

result:

ok 50 numbers

Test #12:

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

input:

48 50
-48 50 -48 46 -46 50 -50 48 -48 48 -49 50 -50 49 -46 48 -47 46 -48 49 -48 50 -47 50 23 -24 23 -25 23 -25 24 -23 22 -24 21 -22 25 -21 21 -24 22 -22 23 -21 22 -22 23 -22
19 4
39 -17
20 -32
21 -27
27 37
3 -26
47 41
33 23
7 -18
41 26
32 33
8 2
29 -3
14 34
45 33
24 -37
6 -19
16 6
43 37
27 45
22 32
...

output:

613
614
615
611
613
614
611
613
614
613
613
613
613
610
612
613
-1
613
612
-1
611
614
614
612
613
614
613
613
612
613
614
613
613
613
613
612
614
613
613
614
611
614
613
612
611
612
614
611
-1
612

result:

ok 50 numbers

Test #13:

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

input:

48 50
-46 46 -50 50 -50 48 -47 48 -46 49 -49 50 -49 47 -47 48 -48 47 -47 50 -48 47 -46 49 24 -24 22 -24 25 -24 22 -23 23 -25 22 -23 24 -22 24 -21 22 -23 23 -24 21 -22 24 -24
0 -8
35 -46
39 6
9 -50
12 -4
25 -41
47 -26
30 36
30 -21
18 -1
33 -38
1 -38
21 40
25 -41
13 -17
27 1
10 19
23 -36
36 15
3 -39
3...

output:

620
-1
621
625
621
620
622
620
621
621
620
624
624
620
620
621
621
619
620
624
620
619
618
-1
621
621
621
622
621
618
621
620
620
621
620
625
620
619
619
623
622
621
621
620
618
619
620
620
623
619

result:

ok 50 numbers

Test #14:

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

input:

46 50
47 -50 46 -46 48 -46 46 -47 46 -47 48 -49 48 -49 46 -50 48 -50 48 -48 46 -50 49 21 -22 24 -25 23 -22 25 -21 25 -25 24 -24 23 -24 24 -23 21 -24 21 -23 24 -24 24
31 -27
13 36
26 -46
11 -38
29 27
31 -46
30 8
9 26
17 9
37 25
23 20
38 42
35 -32
45 0
34 2
7 -13
17 23
19 -41
37 43
41 -38
4 -48
36 -6
...

output:

-1
-1
-1
-1
-1
-1
-1
576
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 50 numbers

Test #15:

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

input:

46 50
-46 49 -48 46 -46 48 -46 46 -50 47 -50 49 -48 48 -47 50 -50 46 -50 47 -49 50 -49 -22 24 -25 21 -25 22 -22 25 -24 22 -22 22 -21 21 -25 23 -21 21 -21 21 -25 23 -24
40 21
40 -16
5 8
40 -46
40 45
22 -35
42 -10
20 -10
38 25
5 -44
7 31
38 -2
34 -13
28 47
29 32
21 48
32 22
45 30
36 -39
19 15
1 0
32 -...

output:

-1
-1
-1
-1
-1
561
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
561
-1
562
-1
-1

result:

ok 50 numbers

Test #16:

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

input:

50 50
-48 39 -4 47 -47 30 -42 42 -36 40 -8 48 -7 12 -42 45 -28 48 -16 28 -43 16 -34 10 -31 19 -17 26 -49 3 -24 8 -9 32 -45 29 -3 4 -5 20 -8 18 -7 39 -1 10 -2 26 -50 -41
33 -33
20 -44
45 11
0 -14
39 -37
29 47
10 45
27 -23
5 -2
28 24
17 21
6 34
35 -50
45 36
17 -14
48 -11
25 -20
14 -38
1 -2
41 -9
37 -4...

output:

2
2
2
1
5
4
2
1
1
1
2
1
2
3
1
2
2
1
1
1
4
3
1
1
2
2
1
1
-1
1
1
1
2
1
1
1
1
1
1
1
1
5
1
1
1
1
3
2
3
3

result:

ok 50 numbers

Test #17:

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

input:

48 50
-8 41 41 -27 40 -48 11 -16 43 -1 26 -34 13 -3 48 -33 4 -18 4 -23 7 -4 34 -18 5 -46 21 -16 20 -50 28 -26 9 -10 20 -33 26 -27 6 -28 11 -17 20 -30 49 -3 18 -7
34 -4
24 37
32 3
34 17
46 7
28 43
37 -36
37 17
42 -20
20 6
16 -16
35 -15
7 -42
46 -35
31 -38
41 -40
1 -34
42 2
0 7
6 2
13 15
11 -4
32 10
4...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
9
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
7
-1

result:

ok 50 numbers

Test #18:

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

input:

48 50
-32 8 -11 9 -32 16 -15 46 -22 9 -18 28 -37 37 -25 -47 7 -39 39 -44 35 -45 40 -23 19 -42 32 -18 19 -24 41 -37 1 -14 12 -30 41 -35 2 -25 7 -13 21 -36 24 -14 25 -22
5 21
29 4
30 -41
21 -50
6 8
24 47
30 0
11 -34
38 41
38 20
5 24
30 -48
0 17
1 -47
11 26
27 12
35 -2
19 -21
5 -12
19 -49
21 5
36 28
32...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
372
-1
370
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
374
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 50 numbers

Test #19:

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

input:

46 50
-30 46 -38 9 -21 22 -23 35 -25 24 -47 19 -46 18 -5 2 -28 34 -2 12 -46 37 -40 5 -15 42 -13 13 -12 45 -50 13 -10 11 -22 45 -13 37 -7 27 -42 40 22 -39 49 -33
25 40
22 -48
19 -21
1 8
7 39
41 45
4 -11
35 19
14 -46
41 9
41 -49
23 -2
35 -28
45 41
42 0
36 -35
23 25
20 7
22 32
7 2
0 -19
15 -43
5 7
39 4...

output:

35
34
34
31
33
34
32
33
34
33
30
32
32
30
32
33
33
32
32
32
30
35
32
34
34
-1
32
33
32
32
33
33
35
32
32
33
32
32
34
33
33
32
32
34
33
32
33
33
34
33

result:

ok 50 numbers

Test #20:

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

input:

46 50
-2 12 -34 37 -36 47 -10 44 -10 5 -18 13 -12 32 -49 43 -46 16 -9 20 -17 47 -27 30 -28 32 -25 13 -10 44 -16 15 -30 45 -31 15 7 -38 40 -18 38 -13 4 -35 21 -37
28 27
30 6
0 -3
35 -32
24 32
3 -8
27 -31
24 19
1 -10
43 9
7 -31
9 -6
39 -43
20 25
22 5
18 -20
16 36
44 44
2 36
26 34
24 -16
13 -3
3 42
44 ...

output:

198
197
198
195
199
198
-1
198
199
198
200
200
198
199
198
-1
198
197
202
196
198
198
194
199
203
195
197
197
199
203
198
195
197
199
198
199
198
198
201
202
196
198
199
-1
203
200
196
200
199
196

result:

ok 50 numbers

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #21:

score: 20
Accepted
time: 1ms
memory: 4140kb

input:

399 400
939 55 800 -165 170 -114 -416 365 744 327 192 422 -411 385 396 346 -89 -521 556 -206 805 306 191 295 894 127 87 -464 55 59 459 -122 -328 -312 -124 -962 918 -667 813 -404 -257 -998 -59 404 772 253 222 44 -261 51 -117 -785 849 -425 45 -996 233 -757 842 -637 363 -755 967 282 735 74 122 -199 112...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 400 numbers

Test #22:

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

input:

390 400
-13 871 -961 127 453 -479 2 392 -483 278 226 385 -746 401 -434 939 238 -257 -823 -269 37 248 289 299 -808 -229 -75 766 -180 -195 -737 393 -884 560 -292 105 212 354 292 608 45 -180 48 -432 -598 831 -922 359 -584 545 180 504 300 645 490 -316 271 113 335 -103 -581 830 97 -58 -708 -162 -890 916 ...

output:

583
577
-1
585
579
581
580
581
582
582
578
578
580
580
590
582
580
578
580
581
580
578
586
582
580
580
580
582
588
580
580
580
583
582
578
580
580
583
580
579
580
581
579
577
580
580
579
588
580
580
582
581
583
578
581
580
588
579
581
581
577
582
585
580
579
579
583
581
581
579
588
580
585
580
581
5...

result:

ok 400 numbers

Test #23:

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

input:

390 400
14 -297 471 793 7 909 91 -401 -190 885 -265 -417 -675 197 311 -159 424 -383 191 -115 -989 760 -95 582 -409 -495 -777 765 11 -352 85 -306 -434 504 290 -350 -430 753 -929 698 -809 -109 -338 654 -128 285 -908 762 233 889 193 -450 199 -441 -966 -172 472 771 -477 -328 279 597 -548 -70 -100 18 -82...

output:

-1
-1
-1
601
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
600
-...

result:

ok 400 numbers

Test #24:

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

input:

380 400
288 993 315 98 -905 803 -162 460 271 678 -119 537 -146 954 468 -255 -163 654 333 753 -476 50 133 -42 -732 417 -591 508 -122 -127 -347 -230 269 461 -602 621 -767 -109 -371 681 -368 -255 -214 962 -994 883 -954 569 -21 126 354 237 -786 631 -93 -151 -123 661 376 907 -971 741 -190 761 -436 428 -1...

output:

475
477
478
478
478
476
477
479
477
477
480
478
476
480
477
477
476
478
477
478
477
476
477
477
477
482
477
477
481
477
477
477
483
478
478
477
478
475
478
477
479
480
479
478
477
479
475
479
474
477
477
478
475
477
478
476
480
477
477
481
477
476
476
479
479
474
479
478
476
478
472
476
470
474
472
...

result:

ok 400 numbers

Test #25:

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

input:

380 400
344 -166 995 -12 786 160 235 -31 -196 -470 856 -99 244 -600 603 -753 469 -898 -75 156 -209 222 -274 -327 -390 -974 235 253 -393 469 -66 -743 235 -34 667 14 342 -734 903 160 -167 -438 345 292 -350 -411 -129 205 383 28 863 -400 -273 -760 -420 -964 570 -198 -500 -1000 439 196 601 -439 -178 -321...

output:

511
516
516
518
514
517
516
515
516
519
516
514
516
517
513
515
515
517
518
514
516
516
523
511
515
515
525
520
517
516
516
516
520
516
518
516
513
516
516
516
517
516
516
516
517
517
516
513
511
521
519
513
516
522
516
516
517
517
518
519
515
517
516
518
517
516
521
520
516
517
516
520
518
516
519
...

result:

ok 400 numbers

Test #26:

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

input:

400 400
-938 969 -978 912 -987 920 -952 915 -988 912 -927 930 -922 972 -972 909 -908 976 -998 912 -923 962 -952 957 -944 941 -965 914 -914 986 -964 956 -992 917 -936 971 -942 954 -958 993 -966 933 -977 947 -926 987 -995 942 -958 914 -959 950 -975 919 -983 949 -997 931 -992 970 -906 996 -940 971 -933...

output:

43336
43336
43336
43339
43336
43335
43336
43337
43335
43339
43336
43336
43334
43339
43334
43335
43335
43334
43338
43335
43336
43335
43335
43336
43337
43334
43335
43335
43335
43339
43336
43335
43336
43338
43336
43339
43336
43335
43336
43338
43336
43336
43336
43336
43335
43334
43334
43335
43334
43336
...

result:

ok 400 numbers

Test #27:

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

input:

390 400
905 -927 946 -932 1000 -957 947 -934 950 -960 945 -932 944 -911 969 -924 905 -916 950 -938 942 -976 937 -994 964 -937 969 -996 903 -931 911 -922 938 -951 978 -951 949 -981 945 -912 912 -959 990 -984 929 -974 981 -943 925 -960 998 -960 913 -905 930 -984 978 -988 908 -936 903 -912 996 -954 911...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 400 numbers

Test #28:

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

input:

390 400
-981 966 -902 922 -910 939 -936 902 -905 906 -921 914 -970 911 -940 959 -953 931 -913 986 -913 956 -927 958 -906 957 -952 910 -987 956 -931 993 -917 911 -984 983 -978 949 -948 908 -941 953 -983 923 -901 996 -955 982 -977 938 -939 918 -928 982 -946 933 -948 979 -935 938 -915 960 -905 995 -962...

output:

41418
41418
41418
41420
41421
41419
41419
41420
41420
41420
41419
41417
41421
41422
41421
41419
41419
41418
41419
41420
41419
41421
41420
41423
41420
41420
41420
41420
41422
41421
41418
41418
41420
41420
41420
41418
41420
41417
41419
41419
41420
41421
41420
41420
41420
41419
41419
41418
41419
41419
...

result:

ok 400 numbers

Test #29:

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

input:

380 400
-909 988 -957 951 -967 969 -904 974 -982 963 -901 907 -926 927 -901 953 -934 915 -943 994 -965 987 -911 906 -957 951 -943 963 -930 968 -972 944 -912 1000 -995 902 -970 942 -986 997 -912 987 -914 921 -917 984 -959 991 -980 992 -926 963 -929 976 -961 954 -989 952 -992 985 -979 992 -901 981 -93...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 400 numbers

Test #30:

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

input:

380 400
997 -917 934 -923 966 -975 991 -933 942 -972 983 -941 969 -962 958 -999 938 -954 907 -944 948 -928 933 -969 935 -952 935 -967 937 -967 947 -972 976 -960 941 -973 977 -902 918 -908 936 -920 992 -901 933 -978 940 -913 913 -953 985 -904 970 -956 913 -916 962 -986 909 -985 910 -977 968 -922 916 ...

output:

39313
39308
39309
39314
39310
39310
39308
39309
39311
39310
39308
39311
39309
39309
39307
39313
39310
39309
39310
39309
39309
39310
39308
39308
39310
39311
39310
39310
39310
39307
39312
39310
39311
39311
39308
39309
39310
39310
39308
39311
39309
39310
39313
39310
39309
39309
39309
39308
39310
39309
...

result:

ok 400 numbers

Test #31:

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

input:

400 400
-673 566 -94 913 -247 554 -251 244 -750 925 -69 80 -679 104 -749 878 -436 231 -116 849 -19 243 -548 105 -998 442 -990 323 -309 381 -864 961 -135 700 -269 776 -761 577 -58 224 -904 989 -192 901 -253 214 -720 178 -217 943 -886 732 -446 691 -754 558 -903 305 -692 238 -551 161 -298 756 -731 856 ...

output:

14336
14335
14335
14338
14332
14335
14334
14335
14336
14335
14334
14333
14337
14335
14333
14337
14335
14335
14335
14336
14337
14335
14331
-1
14335
14335
14337
14336
14335
14336
14335
14336
14335
14336
14331
14332
14333
14336
14333
14335
14335
14335
14336
14337
14338
14333
14338
14335
14336
14332
-1
...

result:

ok 400 numbers

Test #32:

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

input:

390 400
814 -432 680 -633 560 -619 110 -101 141 -400 684 -891 515 -60 970 -682 832 -713 665 -688 449 -186 154 -437 287 -270 761 -163 684 -776 926 -808 371 -82 736 -878 19 -49 345 -460 289 -675 435 -441 785 -188 42 -909 668 -225 630 -342 152 -626 224 -104 708 -219 420 -857 329 -986 859 -765 471 -473 ...

output:

26332
26327
26329
26325
26329
26332
26328
26327
26328
26328
26327
26327
26332
26324
26324
26328
26326
26335
26327
26328
26328
26332
26328
26323
26327
26325
26326
26331
26328
26323
26328
26327
26327
26327
26326
26327
26326
26323
26327
26327
26327
26326
26327
26326
26325
26326
26331
26326
26326
26327
...

result:

ok 400 numbers

Test #33:

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

input:

390 400
530 -332 956 -468 358 -627 225 -427 425 -919 228 -483 46 -286 632 -529 18 -717 239 -467 160 -826 657 -607 103 -151 332 -708 493 -824 630 -438 554 -157 205 -412 925 -891 994 -660 516 -251 516 -101 996 -679 945 -704 982 -588 685 -447 869 -675 824 -112 209 -653 786 -683 251 -784 351 -816 216 -4...

output:

2827
2828
2827
2826
2827
2828
2827
2827
2829
2827
2826
-1
2826
2826
2827
2826
2827
2826
2826
2826
2827
2827
2829
2827
2826
2826
2826
2824
2826
2826
2826
2827
2826
2826
2830
2827
2828
2826
2826
2826
2823
2827
2827
2825
2826
2826
2826
2826
2825
2827
2822
2826
2827
2828
2827
2826
2826
2826
2826
2825
28...

result:

ok 400 numbers

Test #34:

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

input:

380 400
-689 880 -882 605 -619 731 -312 459 -591 404 -639 388 -150 802 -229 391 -96 477 -125 443 -23 932 -783 217 -680 267 -889 61 -973 558 -10 464 -756 908 -96 195 -712 921 -415 192 -339 924 -830 766 -868 1 -705 621 -13 776 -291 388 -910 824 -893 72 -168 485 -218 994 -225 274 -694 287 -845 814 -926...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 400 numbers

Test #35:

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

input:

380 400
300 -985 529 -700 910 -245 972 -232 134 -197 53 -203 41 -67 489 -695 594 -30 234 -9 510 -376 759 -947 246 -850 822 -41 727 -815 817 -240 468 -343 83 -103 435 -158 598 -902 812 -246 993 -820 51 -128 191 -611 774 -713 371 -404 926 -230 283 -454 920 -995 383 -7 208 -601 355 -295 135 -975 918 -6...

output:

28130
28128
28128
28127
28130
28128
28131
28131
28127
28130
28125
28131
28129
28127
28126
28126
28129
28127
28127
28126
28131
28127
28128
28128
28132
28130
28130
28128
28128
28129
28130
28128
28128
28130
28129
28126
28130
28129
28126
28128
28130
28127
28128
28126
28132
28124
28125
28132
28129
28133
...

result:

ok 400 numbers

Test #36:

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

input:

400 400
30000491 3 -1 9 -4 10 -2 3 -5 7 -5 9 -8 7 -6 10 -7 5 -1 5 -9 3 -5 1 -6 4 -9 7 -7 9 -9 10 -3 3 -3 8 -9 10 -3 7 -6 9 -1 10 -8 2 -3 3 -2 9 -4 3 -10 1 -4 8 -3 8 -1 7 -9 5 -10 10 -6 4 -8 3 -2 1 -3 5 -2 2 -10 9 -2 6 -8 5 -10 8 -6 1 -3 7 -4 7 -9 1 -7 1 -1 3 -5 4 -10 6 -5 1 -9 8 -4 2 -5 1 -4 9 -4 1 ...

output:

264379838
264379979
264379881
264379917
264379767
264380069
264379805
264379978
264379857
264379903
264379833
264379996
264379800
264379921
-1
264379962
264379915
264380011
264379890
264379836
264379962
264379933
264379884
264379775
264379834
264380012
264379951
264380030
-1
264379951
264379829
2643...

result:

ok 400 numbers

Test #37:

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

input:

390 400
30003873 3 -1 10 -6 6 -6 3 -6 1 -3 6 -2 2 -7 3 -2 5 -8 5 -6 2 -10 2 -5 7 -9 8 -5 1 -10 4 -8 4 -3 2 -3 2 -2 1 -6 8 -3 4 -5 1 -9 2 -5 4 -3 10 -3 6 -7 1 -9 10 -3 8 -2 8 -9 10 -3 10 -6 4 -5 6 -3 9 -8 9 -1 10 -3 7 -9 9 -6 7 -10 9 -4 4 -6 8 -1 2 -2 1 -6 3 -6 4 -4 3 -10 8 -7 9 -5 1 -2 4 -5 3 -8 7 -...

output:

104815804
104815897
104815772
104815690
104815705
-1
104815683
104815906
104815861
104815683
104815971
104815753
104815809
104815936
-1
104815797
104815776
104815784
104815887
104815852
104815934
104815807
104815716
104815823
104815693
104815700
104815813
104815768
104815861
104815831
-1
104815786
-...

result:

ok 400 numbers

Test #38:

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

input:

390 400
30001047 3 -2 10 -2 7 -6 8 -8 3 -5 10 -10 10 -1 10 -7 8 -7 10 -5 4 -10 8 -4 5 -4 7 -1 9 -6 4 -6 6 -3 1 -6 8 -5 1 -10 5 -1 9 -5 7 -1 9 -3 4 -9 6 -4 9 -9 2 -6 8 -3 9 -4 6 -7 5 -10 8 -9 1 -8 10 -1 5 -7 6 -2 2 -2 1 -9 5 -5 8 -10 7 -7 3 -3 2 -2 10 -7 2 -6 9 -8 6 -7 3 -9 10 -5 2 -7 8 -10 10 -3 4 -...

output:

-1
131661456
131661603
131661356
131661501
131661530
131661552
-1
131661467
131661501
131661506
131661379
131661502
131661621
131661408
131661511
131661507
131661525
131661382
131661533
131661591
131661516
131661529
131661341
131661428
131661432
131661355
131661498
131661361
131661550
131661396
-1
1...

result:

ok 400 numbers

Test #39:

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

input:

380 400
30002216 9 -8 8 -9 4 -9 3 -2 7 -1 9 -6 2 -6 9 -7 10 -4 5 -9 3 -1 5 -7 8 -1 3 -3 4 -7 2 -5 2 -2 10 -2 7 -1 1 -1 2 -8 10 -1 1 -4 9 -8 7 -9 9 -9 10 -4 8 -5 3 -7 2 -9 3 -1 1 -10 8 -3 8 -5 7 -4 5 -3 6 -9 2 -5 7 -6 5 -1 2 -7 2 -10 4 -6 5 -6 1 -8 9 -2 8 -8 8 -4 4 -9 4 -8 7 -3 2 -9 10 -8 9 -5 1 -5 4...

output:

174344916
174344836
174344799
174344775
-1
174344827
174344785
174344817
174344900
174345031
174344825
174344971
174344716
174344882
174344797
174344793
174344816
174344853
174344956
174344998
174344844
174344785
174344816
-1
174344875
174344923
174344845
174344895
174345029
-1
-1
-1
174344845
-1
17...

result:

ok 400 numbers

Test #40:

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

input:

380 400
30003575 5 -7 3 -3 9 -3 7 -3 7 -10 2 -3 9 -3 8 -5 9 -1 1 -6 6 -4 1 -4 1 -5 6 -4 2 -6 9 -8 4 -1 1 -7 8 -4 3 -5 7 -9 1 -8 9 -9 6 -9 2 -4 3 -7 6 -10 9 -4 3 -6 9 -1 4 -7 4 -1 2 -5 6 -7 7 -10 9 -7 9 -8 10 -3 2 -8 4 -1 4 -5 7 -1 1 -1 10 -2 8 -6 3 -8 1 -8 10 -2 7 -6 4 -10 8 -6 10 -2 4 -2 2 -6 1 -8 ...

output:

104707953
104707883
104707962
104708058
104707943
104708001
104707937
104708064
104707942
104708054
104708013
104708053
104707961
104707839
104708012
-1
104708012
104707993
104708031
104707902
104707916
104707802
104707950
-1
104708048
104707971
104707869
104707871
104707960
104707894
104707802
1047...

result:

ok 400 numbers

Subtask #3:

score: 30
Accepted

Test #41:

score: 30
Accepted
time: 14ms
memory: 5524kb

input:

399 100000
-549 -68 -447 880 -896 -305 -570 840 -360 643 49 53 141 975 23 -201 331 -250 150 615 33 876 379 -299 -370 538 -124 -183 -384 337 294 -408 -276 -280 -480 405 293 -57 -459 -491 -447 167 381 617 -40 -413 95 376 -754 -399 458 -390 -534 90 443 472 41 -320 -682 -180 276 634 -204 5 -263 705 -469...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #42:

score: 0
Accepted
time: 64ms
memory: 8480kb

input:

390 100000
-458 -278 597 352 760 -735 327 319 -491 -395 385 180 -243 -230 -212 -596 403 356 729 499 887 -817 902 -710 628 -2 564 -299 828 -389 129 -702 557 260 -48 30 901 125 543 -918 -466 482 13 -508 892 -927 765 -783 871 -782 -46 -582 -14 375 142 -538 791 113 -14 300 -209 -586 702 146 636 -85 -276...

output:

438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
438
...

result:

ok 100000 numbers

Test #43:

score: 0
Accepted
time: 65ms
memory: 8664kb

input:

390 100000
-422 -811 -303 -203 -56 -773 93 237 31 -277 -475 -774 140 -687 -46 393 -1 133 827 39 154 -782 -447 -47 -298 -332 -287 157 620 250 -379 -76 -385 235 177 376 686 -177 -454 -437 -73 271 696 77 302 253 647 -626 -116 -195 589 -825 -242 -854 710 -292 502 -806 353 297 169 251 558 200 695 -644 62...

output:

601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
601
...

result:

ok 100000 numbers

Test #44:

score: 0
Accepted
time: 65ms
memory: 8560kb

input:

380 100000
295 -251 -38 565 362 -373 39 731 -809 -100 -241 -416 -334 -262 -800 547 -411 233 -180 618 -891 884 -723 316 -893 -294 -817 920 -528 131 -408 212 -689 -453 152 483 -75 145 367 706 -115 -211 -316 991 -530 -57 330 437 -820 121 252 135 408 11 -62 -74 -780 -240 -326 941 -989 596 483 -97 -443 5...

output:

533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
533
...

result:

ok 100000 numbers

Test #45:

score: 0
Accepted
time: 61ms
memory: 8584kb

input:

380 100000
267 747 -783 647 -770 395 -647 671 -428 148 -356 744 157 -174 134 897 -188 39 -194 68 -46 373 -438 30 165 49 -331 964 -975 -478 -6 -423 408 379 263 -416 -147 275 -198 640 -748 -300 283 -355 290 51 -785 494 -419 -51 167 71 387 931 310 531 -828 843 37 -38 -623 -120 -471 250 -979 135 -749 98...

output:

475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
475
...

result:

ok 100000 numbers

Test #46:

score: 0
Accepted
time: 279ms
memory: 20596kb

input:

100000 100000
-505 -458 713 -881 971 -770 434 -947 510 -211 400 -954 514 -201 888 -606 457 -911 63 -192 499 -559 559 -155 216 -108 222 -575 563 -328 185 -459 674 -401 414 -367 694 -642 133 -258 585 -508 676 -89 898 -367 505 -885 364 -733 662 -388 649 -192 22 -649 906 -740 457 -627 587 -642 933 -175 ...

output:

2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 100000 numbers

Test #47:

score: 0
Accepted
time: 285ms
memory: 20596kb

input:

99900 100000
769 -866 77 -660 447 -76 67 -405 779 -160 252 -775 467 -821 505 970 -232 412 -911 698 -250 769 -377 604 -316 772 -71 298 -767 838 -743 322 -874 207 -290 866 -54 209 -207 448 -193 220 -950 341 -559 793 -77 416 -474 576 -970 355 -840 876 -872 430 -788 190 -154 430 -70 921 -468 764 -184 34...

output:

343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
343
...

result:

ok 100000 numbers

Test #48:

score: 0
Accepted
time: 289ms
memory: 20624kb

input:

99900 100000
-759 591 -815 56 -472 137 -739 211 -954 87 -784 333 -802 490 -546 779 -114 340 -844 389 -403 743 -272 506 -658 516 -769 3 -477 107 -635 756 -440 615 -138 711 -294 207 -985 538 -39 882 -63 228 -633 594 -775 282 -471 743 -497 161 -394 582 -430 952 -900 439 -852 112 -906 120 -843 597 -858 ...

output:

72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
72908
...

result:

ok 100000 numbers

Test #49:

score: 0
Accepted
time: 301ms
memory: 20660kb

input:

99800 100000
-673 700 -554 43 -683 713 -706 219 -564 86 -899 852 -577 222 -150 281 -115 180 -991 -857 723 -69 311 -660 577 -922 638 -791 683 -18 982 -453 591 -570 142 -742 11 -584 645 -510 577 -292 932 -488 691 -947 257 -765 237 -34 330 -426 306 -844 562 -597 511 -924 947 -846 146 -262 602 -860 187 ...

output:

667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
667
...

result:

ok 100000 numbers

Test #50:

score: 0
Accepted
time: 298ms
memory: 20792kb

input:

99800 100000
-846 736 -609 310 -422 342 -804 677 -736 39 -643 785 -940 372 -915 55 -997 62 -120 130 -726 822 -266 989 -873 401 -499 89 -202 748 -929 72 -304 791 -268 676 -471 639 -638 154 -607 155 -587 149 -565 946 -974 385 -339 606 -867 279 -385 979 -221 729 -539 854 -505 267 -592 676 -880 680 -73 ...

output:

13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
13056
...

result:

ok 100000 numbers

Test #51:

score: 0
Accepted
time: 297ms
memory: 21464kb

input:

100000 100000
30816666 1 -10 5 -5 7 -4 1 -3 5 -7 6 -6 3 -3 6 -9 5 -1 4 -8 2 -2 6 -8 7 -10 4 -2 2 -2 7 -8 4 -5 7 -2 10 -2 2 -5 4 -10 6 -4 1 -3 2 -3 7 -3 1 -3 4 -4 7 -7 8 -8 1 -1 5 -3 2 -1 6 -2 8 -9 4 -8 1 -6 6 -4 1 -10 7 -6 8 -10 4 -4 6 -7 10 -8 8 -2 7 -9 6 -6 4 -2 9 -6 8 -4 10 -5 5 -3 1 -10 7 -9 8 -...

output:

33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
33749975000
...

result:

ok 100000 numbers

Test #52:

score: 0
Accepted
time: 295ms
memory: 21532kb

input:

99900 100000
30843266 2 -6 10 -5 6 -7 3 -9 1 -3 9 -6 6 -2 4 -1 6 -5 3 -9 7 -9 6 -3 2 -3 2 -1 4 -4 3 -7 10 -1 5 -7 5 -6 6 -5 5 -7 3 -3 10 -1 6 -10 6 -3 10 -10 1 -4 9 -4 6 -8 3 -9 6 -10 1 -7 1 -7 10 -8 2 -9 5 -9 7 -9 10 -10 3 -3 10 -6 6 -4 9 -1 10 -3 6 -2 10 -9 2 -7 7 -8 9 -1 2 -6 7 -4 6 -8 5 -10 1 -1...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #53:

score: 0
Accepted
time: 287ms
memory: 21460kb

input:

99900 100000
30554791 2 -4 7 -8 7 -8 2 -9 8 -5 10 -6 10 -5 7 -10 5 -1 8 -7 2 -4 4 -4 6 -5 9 -3 1 -1 7 -10 2 -10 3 -4 3 -1 2 -6 2 -5 6 -9 5 -1 1 -4 4 -2 7 -2 3 -2 7 -10 4 -4 5 -5 5 -10 7 -2 4 -8 8 -6 6 -2 10 -5 9 -1 7 -9 4 -6 8 -1 4 -4 10 -10 3 -4 1 -10 9 -10 7 -8 2 -10 1 -3 10 -4 2 -9 3 -2 10 -1 1 -...

output:

48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
48652523775
...

result:

ok 100000 numbers

Test #54:

score: 0
Accepted
time: 291ms
memory: 21416kb

input:

99800 100000
30508135 8 -2 10 -8 9 -5 7 -7 6 -10 3 -10 5 -6 3 -10 2 -1 7 -2 9 -9 5 -8 5 -3 9 -10 10 -2 1 -10 5 -6 2 -1 8 -10 8 -10 6 -7 1 -7 8 -7 7 -7 7 -9 8 -1 2 -7 10 -2 1 -3 3 -1 4 -2 6 -5 6 -4 2 -4 6 -1 5 -1 7 -2 3 -4 2 -10 4 -4 1 -9 10 -4 1 -6 1 -5 10 -5 3 -6 6 -9 10 -10 8 -9 7 -4 4 -5 3 -3 1 -...

output:

38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
38595130050
...

result:

ok 100000 numbers

Test #55:

score: 0
Accepted
time: 300ms
memory: 21348kb

input:

99800 100000
30391567 10 -9 9 -4 10 -3 2 -6 7 -8 4 -8 5 -8 3 -5 4 -2 3 -10 10 -2 10 -8 5 -2 6 -4 10 -1 5 -4 10 -6 2 -4 9 -3 8 -2 4 -5 1 -3 1 -6 8 -10 3 -5 1 -3 7 -1 8 -4 7 -9 5 -1 5 -6 5 -2 8 -3 8 -1 9 -8 4 -10 4 -6 7 -9 2 -7 1 -10 6 -6 1 -10 1 -8 8 -4 2 -7 3 -8 2 -8 8 -8 2 -1 1 -10 3 -9 7 -2 8 -10 ...

output:

46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
46065160050
...

result:

ok 100000 numbers

Test #56:

score: 0
Accepted
time: 285ms
memory: 21440kb

input:

99700 100000
30123156 10 -5 2 -1 3 -4 4 -4 3 -6 4 -2 2 -2 6 -5 10 -2 5 -1 5 -2 4 -3 7 -10 7 -2 8 -4 5 -8 6 -7 5 -5 5 -4 3 -5 9 -4 8 -5 4 -3 7 -8 7 -7 6 -6 5 -7 4 -7 8 -8 2 -7 6 -7 6 -2 10 -2 3 -3 7 -1 1 -5 10 -5 3 -10 5 -2 6 -4 2 -3 9 -8 2 -1 4 -9 1 -2 7 -3 6 -2 8 -5 7 -10 4 -1 5 -7 7 -1 4 -6 6 -8 7...

output:

45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
45972891325
...

result:

ok 100000 numbers

Test #57:

score: 0
Accepted
time: 261ms
memory: 21580kb

input:

99700 100000
30612985 10 -1 9 -8 7 -1 5 -1 1 -5 3 -1 10 -8 2 -9 8 -8 1 -8 9 -5 10 -3 5 -4 4 -2 8 -8 10 -7 7 -8 2 -2 2 -7 9 -6 2 -3 10 -7 5 -5 7 -4 3 -7 5 -10 9 -5 8 -3 5 -4 9 -10 3 -8 3 -1 1 -10 3 -6 1 -5 4 -4 2 -2 3 -8 5 -10 1 -2 1 -3 10 -7 7 -9 6 -1 2 -3 2 -9 4 -6 3 -10 1 -6 4 -10 6 -7 6 -5 3 -6 8...

output:

43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
43487868825
...

result:

ok 100000 numbers

Test #58:

score: 0
Accepted
time: 270ms
memory: 21580kb

input:

99600 100000
30974298 3 -8 10 -9 9 -8 10 -5 1 -5 5 -9 4 -2 1 -10 7 -8 10 -10 9 -3 3 -7 3 -9 6 -6 1 -5 7 -4 4 -2 5 -1 5 -7 7 -3 6 -1 4 -8 2 -6 7 -6 3 -2 5 -1 9 -5 3 -2 2 -2 6 -10 5 -8 8 -2 3 -6 9 -7 8 -4 4 -6 4 -4 2 -10 2 -9 4 -6 2 -2 5 -6 4 -3 4 -10 4 -4 6 -3 10 -7 6 -4 8 -5 6 -9 3 -8 8 -4 8 -3 8 -1...

output:

38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
38440595100
...

result:

ok 100000 numbers

Test #59:

score: 0
Accepted
time: 255ms
memory: 21580kb

input:

99600 100000
30614832 6 -10 4 -7 2 -5 3 -10 9 -2 2 -7 4 -10 4 -6 1 -4 7 -6 8 -1 9 -4 10 -2 1 -8 9 -8 7 -7 5 -4 1 -6 6 -1 4 -1 10 -4 9 -6 9 -4 7 -6 6 -9 6 -6 9 -5 3 -9 2 -1 10 -6 2 -2 4 -2 5 -4 3 -5 3 -6 2 -10 2 -5 8 -5 5 -1 1 -10 10 -3 6 -4 2 -4 5 -9 4 -9 9 -2 3 -4 8 -2 2 -7 2 -6 5 -4 10 -10 10 -3 6...

output:

33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
33480515100
...

result:

ok 100000 numbers

Test #60:

score: 0
Accepted
time: 250ms
memory: 21584kb

input:

99500 100000
30216834 6 -5 9 -5 7 -6 8 -1 4 -5 7 -5 8 -8 4 -1 2 -7 10 -10 1 -5 3 -2 9 -9 9 -10 1 -6 3 -6 4 -9 8 -3 10 -8 5 -2 5 -3 3 -3 4 -7 1 -10 9 -9 5 -9 7 -7 10 -1 5 -10 4 -8 8 -8 2 -1 1 -4 4 -6 10 -5 5 -7 3 -3 5 -1 4 -6 4 -6 2 -8 8 -7 10 -1 2 -7 3 -4 4 -8 3 -6 7 -3 1 -1 6 -3 10 -7 5 -10 3 -10 7...

output:

35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
35888381375
...

result:

ok 100000 numbers

Test #61:

score: 0
Accepted
time: 8ms
memory: 5388kb

input:

99 100000
30000232 7 -7 1 -5 9 -3 10 -8 7 -8 6 -4 4 -5 1 -7 6 -1 4 -4 2 -9 8 -10 1 -5 5 -10 7 -9 8 -9 7 -10 1 -6 9 -2 5 -7 7 -9 6 -8 3 -2 8 -10 29998735 6 -5 4 -8 5 -1 5 -3 1 -6 3 -6 5 -2 1 -4 9 -9 10 -4 7 -5 9 -7 7 -4 8 -9 4 -7 6 -2 1 -2 10 -9 5 -1 5 -6 10 -7 6 -3 4 -3 9 -6 1
4 0
16 0
79 0
29 0
60 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #62:

score: 0
Accepted
time: 40ms
memory: 8468kb

input:

98 100000
30000734 6 -8 7 -4 8 -4 9 -2 10 -8 5 -7 6 -5 6 -8 8 -2 8 -6 10 -7 9 -6 8 -5 5 -9 1 -1 10 -7 1 -9 3 -4 5 -10 6 -3 5 -10 1 -7 5 -2 3 -7 29998394 7 -4 2 -9 2 -3 6 -1 6 -7 4 -2 3 -2 10 -8 9 -2 10 -5 7 -2 4 -3 1 -8 2 -10 1 -6 9 -1 6 -1 10 -7 9 -7 10 -8 5 -7 1 -3 6 -6 9 -9
39 0
72 0
85 0
13 0
2 ...

output:

31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
31127740
311...

result:

ok 100000 numbers

Test #63:

score: 0
Accepted
time: 36ms
memory: 8260kb

input:

98 100000
30000593 7 -8 6 -1 2 -1 2 -10 3 -6 10 -5 7 -8 2 -5 4 -4 7 -7 3 -9 1 -4 3 -4 1 -2 6 -5 5 -2 5 -9 8 -3 1 -8 10 -5 7 -10 3 -7 3 -8 5 -7 29998810 8 -3 1 -1 9 -6 3 -10 6 -6 1 -4 10 -3 6 -6 10 -4 1 -10 10 -9 2 -6 1 -9 9 -9 5 -2 10 -4 4 -3 5 -7 7 -10 6 -7 7 -4 10 -9 8 -1 2 -6
17 0
22 0
14 0
37 0
...

output:

39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
39708914
397...

result:

ok 100000 numbers

Test #64:

score: 0
Accepted
time: 41ms
memory: 8548kb

input:

96 100000
30000327 3 -7 9 -9 7 -9 8 -5 3 -3 10 -7 1 -10 4 -7 7 -10 2 -5 1 -1 10 -5 10 -3 9 -2 7 -6 2 -7 7 -6 8 -7 4 -6 10 -10 6 -9 7 -1 10 -2 1 -29998396 -2 5 -7 6 -4 3 -3 1 -1 4 -4 2 -6 6 -4 8 -1 1 -8 9 -10 10 -10 7 -2 5 -4 10 -4 3 -2 2 -7 8 -7 1 -6 5 -5 2 -5 5 -7 4 -8 3 -1
66 0
6 0
36 0
18 0
16 0
...

output:

36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
36844392
368...

result:

ok 100000 numbers

Test #65:

score: 0
Accepted
time: 38ms
memory: 8584kb

input:

96 100000
30000053 9 -8 10 -1 3 -8 7 -4 2 -10 10 -3 3 -2 6 -10 10 -1 2 -5 3 -2 4 -5 10 -1 10 -5 5 -3 9 -2 5 -6 8 -2 8 -6 9 -3 3 -9 6 -9 8 -5 8 -29998168 -2 5 -4 9 -4 7 -10 9 -1 1 -6 1 -1 6 -10 5 -6 7 -3 7 -5 9 -1 7 -5 7 -9 5 -2 1 -5 1 -7 2 -10 9 -7 9 -3 1 -7 4 -1 4 -7 10 -5
93 0
41 0
84 0
41 0
59 0
...

output:

37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
37081704
370...

result:

ok 100000 numbers

Test #66:

score: 0
Accepted
time: 40ms
memory: 8520kb

input:

94 100000
30000750 10 -3 2 -10 3 -3 2 -9 9 -5 2 -1 10 -1 6 -3 5 -10 5 -5 5 -10 1 -8 7 -8 3 -3 8 -9 9 -4 4 -7 4 -3 8 -1 5 -5 5 -6 1 -6 10 -4 29998811 5 -7 9 -6 3 -3 6 -5 1 -2 4 -6 3 -10 9 -3 5 -4 7 -8 7 -7 8 -6 2 -5 4 -10 7 -4 9 -4 8 -1 7 -10 5 -8 2 -5 10 -2 4 -1 5 -9
84 0
42 0
51 0
67 0
80 0
61 0
64...

output:

34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
34037353
340...

result:

ok 100000 numbers

Test #67:

score: 0
Accepted
time: 36ms
memory: 8508kb

input:

94 100000
30000399 7 -4 3 -6 5 -6 9 -2 9 -10 6 -6 8 -6 9 -4 1 -6 8 -5 1 -4 3 -8 2 -2 9 -1 3 -2 7 -1 5 -10 2 -5 2 -4 4 -5 10 -6 2 -1 10 -9 29998618 8 -8 3 -7 2 -7 10 -9 3 -1 1 -10 6 -8 1 -9 2 -8 7 -3 5 -7 10 -6 10 -7 6 -4 2 -8 10 -3 7 -9 4 -6 2 -1 10 -2 6 -10 8 -7 10 -5
31 0
62 0
26 0
39 0
90 0
30 0
...

output:

36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
36392147
363...

result:

ok 100000 numbers

Test #68:

score: 0
Accepted
time: 37ms
memory: 8520kb

input:

92 100000
30000287 6 -5 8 -8 3 -3 8 -4 9 -9 6 -5 9 -5 7 -8 2 -6 4 -7 8 -5 2 -10 7 -9 2 -4 3 -8 7 -8 9 -6 9 -8 5 -7 2 -4 9 -1 9 -3 1 -29998168 -6 2 -4 6 -2 6 -1 6 -1 3 -2 10 -7 2 -6 5 -3 10 -3 8 -4 3 -6 10 -4 4 -6 1 -7 2 -2 8 -5 8 -8 8 -1 9 -6 4 -10 5 -5 3 -9
16 0
4 0
80 0
58 0
88 0
35 0
54 0
75 0
59...

output:

30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
30490479
304...

result:

ok 100000 numbers

Test #69:

score: 0
Accepted
time: 40ms
memory: 8632kb

input:

92 100000
30000150 4 -5 8 -6 1 -4 3 -8 5 -4 6 -10 6 -4 6 -8 6 -3 1 -5 10 -8 10 -3 4 -8 4 -10 1 -7 9 -2 7 -9 10 -5 10 -1 2 -2 10 -7 1 -4 10 -29998286 -3 2 -10 1 -4 9 -6 10 -8 1 -6 6 -7 10 -4 8 -10 4 -1 4 -8 8 -4 2 -7 7 -10 1 -3 10 -4 4 -10 3 -7 7 -10 2 -6 8 -5 1 -7 2 -7
45 0
27 0
2 0
40 0
13 0
83 0
1...

output:

34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
34055939
340...

result:

ok 100000 numbers

Test #70:

score: 0
Accepted
time: 42ms
memory: 8596kb

input:

90 100000
30000246 3 -6 7 -7 8 -2 6 -5 10 -1 4 -4 6 -7 7 -5 9 -8 10 -9 9 -1 7 -6 3 -7 7 -4 6 -5 3 -4 2 -10 3 -7 9 -7 9 -10 1 -3 9 -1 29998965 7 -1 5 -5 9 -10 8 -4 2 -6 5 -7 2 -10 5 -6 10 -7 5 -6 3 -3 10 -8 5 -7 2 -2 9 -7 9 -7 6 -6 7 -6 8 -8 9 -5 8 -3 4 -1
37 0
51 0
13 0
8 0
48 0
43 0
21 0
67 0
31 0
...

output:

47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
47203740
472...

result:

ok 100000 numbers

Subtask #4:

score: 40
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #71:

score: 40
Accepted
time: 15ms
memory: 5384kb

input:

399 100000
319 388 883 439 690 -901 283 -212 924 206 -23 375 -298 -79 989 -20 602 203 532 -653 662 -208 845 -374 -287 -662 696 -999 -350 -697 -127 -226 757 -514 721 181 -267 464 -312 91 677 88 -363 245 151 -550 480 -578 503 -838 910 400 -464 -176 328 347 556 71 963 -993 907 172 78 -511 714 -134 521 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #72:

score: 0
Accepted
time: 120ms
memory: 11576kb

input:

390 100000
28 -791 -184 305 -182 -993 66 61 12 -544 573 116 -263 -157 48 256 399 294 423 -318 879 339 284 -272 -430 406 605 -38 -192 -200 -332 458 249 -93 627 -31 -478 -387 315 173 -438 417 -213 404 952 -864 855 300 -121 -513 -280 -963 158 -495 620 -176 839 -579 520 -65 841 -534 58 -257 487 -187 218...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #73:

score: 0
Accepted
time: 132ms
memory: 11628kb

input:

390 100000
678 196 697 -107 705 309 314 255 -261 -701 886 -790 943 -46 346 -783 -320 317 768 -738 -336 168 72 -916 355 64 -274 -334 801 -637 -153 -512 390 159 142 120 476 -560 877 87 -155 -111 388 -696 122 359 -12 -466 -128 -841 52 -205 158 -412 782 -672 466 340 921 -359 -328 183 520 -161 498 -518 1...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #74:

score: 0
Accepted
time: 125ms
memory: 11780kb

input:

380 100000
69 490 943 274 324 -757 560 487 -292 -167 611 499 980 439 395 2 -28 -146 -108 262 794 -264 811 -677 55 214 953 -39 52 -637 402 -703 250 -437 -126 -683 -366 -241 695 -481 202 455 774 -934 -108 350 950 -903 351 381 254 75 -190 321 -274 -373 -220 198 -14 -805 85 -389 984 -965 -346 192 738 48...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #75:

score: 0
Accepted
time: 126ms
memory: 11628kb

input:

380 100000
636 -90 -10 -441 -416 -28 -253 -861 -464 351 -447 -103 405 -582 -106 307 658 -698 281 -376 -217 -804 499 -866 338 -874 757 -215 -409 406 644 -610 729 300 -53 235 -156 -609 -294 -268 511 10 610 -853 474 -915 366 -46 94 -296 486 148 -190 203 375 -105 6 -729 885 226 913 446 -320 467 -42 -324...

output:

376
376
377
377
378
377
376
373
376
375
378
376
376
375
383
376
376
375
379
379
376
381
377
376
378
378
376
376
377
376
374
376
376
375
376
377
378
377
383
-1
375
378
377
380
377
376
381
376
378
378
375
380
376
377
376
377
377
374
380
379
377
381
374
378
378
378
374
377
374
377
379
379
378
377
378
3...

result:

ok 100000 numbers

Test #76:

score: 0
Accepted
time: 330ms
memory: 23820kb

input:

100000 100000
359 -589 195 -349 542 -544 185 -475 561 -235 685 -854 106 -71 414 -639 694 -780 299 -135 368 -990 226 -580 766 -182 392 -205 426 -497 789 -133 413 -314 978 -126 766 -759 149 -239 274 -832 93 -746 181 -549 836 -362 278 -720 704 -725 527 -863 525 -494 576 -432 326 -269 300 -549 63 -581 2...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #77:

score: 0
Accepted
time: 334ms
memory: 23716kb

input:

99900 100000
280 -176 901 -280 634 -675 12 -874 463 -785 19 -820 757 -437 800 -209 928 -945 356 -445 100 -886 468 -427 229 -45 768 -603 266 -327 597 -432 136 -954 339 -737 181 -101 18 -425 75 -867 223 -515 628 -988 890 -653 652 -238 532 -378 93 -958 91 -696 983 -516 968 -851 78 -604 681 -611 280 -87...

output:

18831
18831
18831
18829
18830
18829
18830
18830
18829
18830
18830
18829
18829
18830
18831
18830
18830
18829
18830
18829
18830
18832
18829
18830
18831
18829
18829
18829
18830
18829
18829
18831
18829
18830
18829
18830
18831
18829
18829
18829
18830
18829
18829
18830
18829
18830
18829
18829
18829
18831
...

result:

ok 100000 numbers

Test #78:

score: 0
Accepted
time: 345ms
memory: 23832kb

input:

99900 100000
667 -187 952 -592 537 -130 947 -575 426 -255 472 -398 193 -409 826 -297 869 -295 392 -80 151 -725 19 -933 807 790 -412 843 -66 526 -920 206 -340 174 -194 158 -744 885 -561 661 -327 93 -594 535 -4 359 -659 231 -777 6 -820 11 -524 325 -103 16 -838 780 -363 628 -446 27 -837 16 -702 366 -63...

output:

1119
1120
1119
1120
1119
1119
1120
1119
1119
1119
1119
1119
1121
1120
1119
1122
1120
1119
1119
1120
1119
1120
1122
1119
1120
1119
1119
1119
1119
1120
1120
1119
1119
1119
1121
1119
1120
1120
1120
1121
1119
1119
1119
1119
1120
1119
1120
1119
1120
1120
1121
1119
1122
1120
1120
1119
1119
1119
1119
1119
...

result:

ok 100000 numbers

Test #79:

score: 0
Accepted
time: 343ms
memory: 23636kb

input:

99800 100000
677 -253 998 -421 660 -145 759 -10 774 -484 166 -733 715 -629 389 -579 258 -558 811 -994 179 -470 359 -806 330 -519 51 -738 497 -571 727 -717 915 -480 43 -292 713 -919 436 -763 772 -783 507 -130 161 -452 122 -670 7 -939 929 -749 335 -782 102 -476 988 -985 345 -225 752 -934 406 -168 520 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #80:

score: 0
Accepted
time: 340ms
memory: 23684kb

input:

99800 100000
391 -549 667 -463 847 -187 924 -345 201 -951 534 -659 324 -940 247 -129 146 -672 938 -879 169 -406 899 -316 531 -11 686 -421 485 -971 933 -538 916 -832 197 -283 152 -354 907 -243 397 -653 225 -739 191 -628 952 -558 850 -396 713 -638 88 -866 580 -548 974 -517 335 -570 841 -959 710 -776 5...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #81:

score: 0
Accepted
time: 362ms
memory: 22864kb

input:

100000 100000
30916966 2 -1 10 -7 9 -2 10 -8 4 -9 7 -6 10 -3 3 -1 9 -8 7 -3 10 -4 7 -9 10 -1 6 -9 10 -7 9 -4 1 -4 3 -10 10 -3 5 -2 2 -9 7 -1 8 -5 10 -7 6 -8 10 -10 8 -4 1 -3 5 -6 5 -9 10 -8 7 -5 1 -2 4 -2 6 -9 6 -1 10 -2 5 -4 3 -6 8 -4 7 -8 2 -1 9 -5 3 -10 4 -4 9 -8 1 -5 9 -4 8 -3 9 -9 2 -3 10 -5 8 ...

output:

26249974991
26249974960
26249975058
26249974889
26249974826
26249974957
26249975008
-1
-1
26249975120
26249974902
26249975101
26249974986
26249974945
26249975087
26249975185
26249974980
26249974895
26249975111
26249975016
26249975076
-1
26249975161
-1
26249974943
26249974864
26249975121
26249974917
...

result:

ok 100000 numbers

Test #82:

score: 0
Accepted
time: 376ms
memory: 22320kb

input:

99900 100000
30261310 7 -1 4 -4 1 -4 7 -6 1 -3 8 -10 10 -1 2 -6 1 -6 10 -9 7 -10 7 -7 4 -8 9 -8 7 -9 6 -9 6 -7 5 -10 10 -2 5 -8 10 -5 9 -8 5 -3 10 -4 3 -10 4 -10 10 -10 3 -6 7 -4 7 -1 2 -9 3 -3 3 -3 4 -4 6 -2 7 -5 9 -5 2 -10 5 -3 5 -6 7 -8 7 -2 2 -5 7 -3 4 -4 8 -8 9 -10 5 -1 10 -4 10 -1 9 -4 3 -1 8 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #83:

score: 0
Accepted
time: 348ms
memory: 22488kb

input:

99900 100000
30150671 6 -1 1 -6 8 -6 3 -1 1 -2 7 -9 6 -6 3 -3 5 -4 7 -9 9 -4 8 -5 1 -8 9 -4 7 -2 10 -8 7 -10 9 -7 4 -6 2 -6 9 -1 7 -4 3 -1 8 -5 5 -10 6 -8 8 -6 4 -9 4 -10 7 -4 6 -4 7 -7 3 -4 7 -7 1 -1 4 -1 5 -9 7 -9 6 -3 8 -6 10 -6 1 -10 4 -3 3 -2 6 -9 3 -2 10 -10 9 -7 6 -9 5 -3 5 -10 3 -9 1 -8 3 -2...

output:

36177511377
36177511193
36177511167
36177511228
36177511391
-1
36177511307
36177511348
36177511145
36177511302
36177511290
36177511436
36177511336
36177511189
36177511275
-1
-1
36177511317
36177511404
36177511192
-1
36177511293
36177511457
36177511258
36177511304
36177511144
36177511347
-1
361775113...

result:

ok 100000 numbers

Test #84:

score: 0
Accepted
time: 332ms
memory: 22616kb

input:

99800 100000
30554493 7 -2 4 -5 5 -2 10 -3 10 -5 8 -9 9 -4 3 -10 6 -7 6 -10 1 -1 7 -4 1 -7 8 -1 4 -10 7 -7 6 -4 9 -7 6 -10 6 -4 1 -8 2 -3 6 -5 5 -5 2 -6 10 -4 6 -9 3 -4 1 -8 10 -3 5 -7 7 -10 8 -10 5 -8 3 -9 8 -1 1 -6 7 -2 9 -1 1 -1 7 -7 2 -4 8 -6 6 -6 7 -3 1 -1 5 -4 4 -3 1 -4 7 -10 5 -2 6 -5 1 -7 10...

output:

38595129956
38595129903
38595130133
38595130161
38595130168
-1
38595129881
-1
38595129968
38595130206
38595130074
38595129993
38595129944
38595130166
38595130126
38595130163
38595130199
38595130174
-1
38595129882
-1
38595130163
38595129990
38595130018
38595130111
38595130023
38595130038
38595130066
...

result:

ok 100000 numbers

Test #85:

score: 0
Accepted
time: 328ms
memory: 22836kb

input:

99800 100000
30976930 3 -8 7 -5 9 -5 10 -8 2 -4 7 -5 5 -8 9 -8 9 -2 4 -8 8 -2 6 -7 6 -10 7 -9 10 -5 3 -10 5 -1 2 -5 4 -1 4 -6 8 -2 10 -7 7 -9 8 -4 9 -3 2 -5 3 -2 3 -5 1 -6 1 -10 5 -3 8 -4 5 -2 9 -2 9 -10 7 -6 2 -4 6 -9 1 -9 3 -3 5 -10 6 -8 7 -3 6 -1 6 -7 6 -8 5 -1 7 -3 6 -10 1 -10 1 -7 8 -7 10 -10 2...

output:

31125099981
31125100109
31125100069
31125100167
31125100107
31125099979
-1
-1
31125099934
-1
-1
31125099976
31125099924
31125099974
31125099968
31125099913
31125099878
-1
31125100205
-1
31125100111
31125100006
31125100145
-1
-1
-1
31125100221
31125099874
31125099973
31125099907
31125100093
311251001...

result:

ok 100000 numbers

Test #86:

score: 0
Accepted
time: 381ms
memory: 22836kb

input:

99700 100000
30912065 7 -2 6 -3 5 -3 3 -10 5 -4 1 -1 6 -1 6 -5 1 -10 2 -3 1 -2 8 -3 10 -8 10 -2 4 -10 9 -6 7 -7 6 -5 2 -5 8 -8 2 -3 10 -2 4 -10 3 -3 3 -10 8 -8 7 -6 10 -10 5 -5 3 -3 9 -6 4 -10 8 -7 9 -5 1 -3 3 -1 4 -8 9 -9 10 -3 6 -4 4 -5 7 -6 9 -4 7 -7 4 -2 7 -3 6 -3 3 -4 7 -9 10 -7 4 -4 4 -7 3 -5 ...

output:

31062756295
31062756313
31062756360
-1
31062756374
31062756496
31062756226
31062756207
31062756405
31062756172
31062756459
-1
31062756466
31062756394
31062756301
31062756166
31062756290
-1
31062756376
31062756507
31062756402
31062756256
31062756483
-1
31062756272
-1
31062756283
31062756284
310627562...

result:

ok 100000 numbers

Test #87:

score: 0
Accepted
time: 383ms
memory: 22732kb

input:

99700 100000
30575429 8 -10 10 -2 4 -1 9 -3 1 -7 1 -5 10 -7 3 -3 2 -5 10 -8 10 -6 8 -10 8 -5 4 -8 1 -5 5 -9 2 -5 4 -6 2 -2 10 -1 10 -2 10 -3 10 -9 10 -5 10 -4 2 -8 10 -6 8 -5 9 -3 5 -9 2 -3 2 -5 10 -7 2 -2 10 -10 6 -6 8 -7 3 -1 1 -2 5 -1 2 -4 6 -10 10 -9 7 -3 4 -10 5 -8 2 -8 2 -6 5 -10 3 -5 6 -9 4 -...

output:

36032801183
36032801300
36032801341
-1
-1
36032801310
36032801298
36032801358
36032801488
36032801444
36032801338
36032801261
36032801479
36032801434
36032801341
36032801324
36032801193
36032801453
36032801180
36032801334
36032801164
36032801522
36032801151
36032801376
36032801476
36032801469
360328...

result:

ok 100000 numbers

Test #88:

score: 0
Accepted
time: 367ms
memory: 22512kb

input:

99600 100000
30404626 9 -9 3 -10 3 -9 2 -8 1 -4 10 -8 6 -8 10 -10 7 -1 10 -9 2 -7 4 -8 9 -8 9 -3 8 -1 7 -9 8 -10 8 -9 6 -4 3 -7 5 -1 3 -3 1 -5 4 -4 10 -7 7 -8 9 -8 4 -8 3 -9 10 -7 1 -3 5 -5 3 -7 10 -6 9 -6 8 -1 3 -10 9 -2 4 -4 2 -1 7 -5 3 -3 4 -4 10 -7 2 -10 1 -2 2 -5 8 -10 1 -8 3 -10 2 -9 6 -4 8 -1...

output:

35960555208
35960555268
35960555036
35960555002
35960555251
35960555156
35960555231
35960555175
35960555008
35960555279
35960555130
-1
35960554935
35960555234
35960555138
35960554944
-1
35960554941
35960555151
35960555099
-1
35960555258
35960555257
35960555114
-1
35960555145
35960555179
35960555183
...

result:

ok 100000 numbers

Test #89:

score: 0
Accepted
time: 371ms
memory: 22728kb

input:

99600 100000
30160394 9 -3 1 -6 9 -1 3 -5 2 -10 9 -8 1 -7 2 -1 2 -1 9 -6 4 -9 5 -8 6 -10 1 -7 4 -10 2 -4 5 -5 5 -6 10 -5 6 -6 8 -1 10 -4 7 -2 8 -7 4 -8 1 -10 1 -1 6 -8 3 -3 10 -8 3 -8 4 -7 4 -7 3 -2 6 -8 1 -2 5 -3 6 -6 4 -5 5 -6 7 -6 8 -8 8 -3 10 -10 5 -5 6 -3 10 -3 9 -8 2 -10 2 -1 3 -9 7 -10 1 -1 7...

output:

55800875162
55800874961
55800874969
55800875258
55800874995
55800875208
55800875104
55800875125
55800875175
-1
55800875247
55800875211
55800875058
55800874928
55800875201
55800874924
55800875186
55800875277
55800875210
55800874994
-1
55800875084
55800875097
55800874936
-1
55800875140
-1
55800874975
...

result:

ok 100000 numbers

Test #90:

score: 0
Accepted
time: 378ms
memory: 22560kb

input:

99500 100000
30813232 3 -10 4 -4 1 -10 8 -6 6 -10 4 -4 10 -10 1 -6 6 -2 4 -3 2 -1 5 -2 4 -8 1 -7 4 -7 6 -3 10 -3 9 -3 5 -9 7 -1 3 -8 8 -4 1 -8 10 -3 8 -1 4 -8 10 -1 10 -8 3 -7 2 -9 4 -6 8 -3 2 -9 6 -9 6 -7 6 -7 10 -3 7 -6 1 -4 2 -4 1 -2 5 -6 4 -5 10 -7 6 -10 1 -3 9 -7 1 -2 9 -10 6 -7 5 -6 2 -9 4 -2 ...

output:

40838506210
40838506401
40838506491
40838506460
40838506406
40838506360
40838506494
40838506517
40838506425
-1
40838506569
40838506210
40838506400
40838506336
-1
40838506497
40838506293
-1
-1
40838506236
-1
40838506544
40838506197
40838506471
40838506237
40838506299
40838506252
40838506211
408385062...

result:

ok 100000 numbers

Test #91:

score: 0
Accepted
time: 11ms
memory: 5304kb

input:

99 100000
30000871 6 -2 3 -10 8 -3 5 -2 2 -6 2 -4 6 -6 9 -8 1 -4 4 -6 5 -3 1 -1 1 -10 7 -2 10 -9 6 -7 5 -8 4 -8 1 -8 9 -1 8 -10 5 -3 10 -8 9 -10 29998493 6 -6 8 -3 8 -5 9 -7 4 -2 3 -4 6 -7 2 -6 2 -6 1 -2 1 -10 2 -5 1 -4 5 -10 3 -10 7 -7 8 -6 9 -6 1 -6 4 -7 9 -3 7 -6 7 -10 9 -9 8
24 -220
45 217
47 -5...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #92:

score: 0
Accepted
time: 81ms
memory: 8440kb

input:

98 100000
30000451 8 -3 4 -4 9 -4 9 -5 5 -6 1 -1 8 -6 1 -8 7 -3 5 -2 7 -10 4 -10 5 -7 4 -6 6 -7 10 -3 3 -10 5 -10 6 -5 3 -7 8 -2 5 -9 7 -8 3 -9 29998937 9 -9 4 -6 3 -3 6 -10 9 -10 10 -6 8 -7 7 -9 7 -7 9 -1 9 -6 4 -4 6 -8 8 -9 2 -5 10 -7 4 -6 5 -5 10 -3 7 -9 10 -1 10 -6 8 -6 9 -3
46 -281
5 -534
40 38...

output:

46292454
46292459
46292450
46292423
46292403
46292426
46292486
46292459
46292464
46292456
46292456
46292387
46292399
46292447
46292474
46292423
46292481
46292471
46292420
46292468
46292376
46292407
46292473
46292498
46292383
46292388
46292494
46292472
46292515
46292468
46292475
46292421
46292503
462...

result:

ok 100000 numbers

Test #93:

score: 0
Accepted
time: 83ms
memory: 8216kb

input:

98 100000
30000516 8 -10 3 -5 8 -8 6 -1 5 -9 6 -1 5 -8 9 -2 2 -5 2 -1 5 -1 9 -5 10 -7 4 -8 8 -3 6 -10 8 -7 6 -9 9 -6 7 -4 6 -1 4 -7 1 -7 2 -8 29998786 5 -9 2 -4 8 -4 2 -8 1 -5 5 -1 5 -10 8 -9 3 -5 3 -7 1 -6 4 -4 3 -6 5 -1 8 -7 5 -7 10 -5 4 -6 8 -1 9 -10 4 -6 10 -3 6 -4 6 -4
86 -154
29 999
86 -472
65...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #94:

score: 0
Accepted
time: 79ms
memory: 8752kb

input:

96 100000
30000544 10 -8 10 -7 4 -7 2 -8 8 -1 4 -9 8 -6 6 -1 3 -2 8 -7 7 -10 3 -5 4 -2 5 -8 9 -6 4 -6 8 -3 3 -7 4 -10 2 -8 9 -6 7 -9 6 -10 5 -29999029 -5 3 -8 1 -8 6 -9 6 -10 10 -10 10 -3 2 -3 3 -3 5 -4 8 -5 4 -5 10 -8 5 -5 4 -7 6 -5 4 -8 3 -6 5 -8 1 -10 9 -1 6 -7 3 -3 7 -10
62 509
61 1000
70 -715
6...

output:

46018953
46018981
46018990
46018974
46018904
46018928
46018908
46018939
46018947
46018901
46018876
46018927
46018953
46018945
46018960
46018888
46018948
46018940
46018930
46018886
46018886
46018873
46018912
46018941
46018920
46018902
46018957
46018918
46018909
46018874
46018902
46018924
46018893
460...

result:

ok 100000 numbers

Test #95:

score: 0
Accepted
time: 85ms
memory: 8520kb

input:

96 100000
30000702 9 -2 6 -5 7 -7 1 -9 2 -3 2 -10 9 -2 1 -5 9 -2 5 -1 3 -8 7 -2 4 -8 6 -2 5 -7 4 -9 7 -3 2 -7 4 -10 8 -8 1 -9 3 -9 4 -9 10 -29998646 -8 8 -6 4 -4 6 -10 7 -3 1 -3 4 -2 4 -9 5 -5 7 -5 7 -7 2 -9 2 -5 10 -3 6 -4 1 -3 9 -7 1 -7 4 -1 8 -6 9 -5 10 -4 2 -8 6 -2
4 -495
90 858
90 -508
28 664
6...

output:

33733949
33733997
33734034
33733967
33734004
33734063
33733969
33733971
33733974
33733979
33734034
33733946
33733985
33734030
33733952
33734028
33733967
33733994
33733981
33734030
-1
33734037
33733975
33733992
33733972
33733992
33733956
33733968
33733959
33734001
33733993
33733998
33734006
33734026
...

result:

ok 100000 numbers

Test #96:

score: 0
Accepted
time: 80ms
memory: 8640kb

input:

94 100000
30000732 9 -9 10 -6 5 -4 2 -2 9 -1 4 -6 5 -10 6 -3 7 -7 1 -7 2 -3 3 -2 9 -6 4 -5 4 -8 10 -1 4 -2 3 -4 4 -1 9 -4 4 -4 6 -4 5 -2 29998991 4 -9 3 -1 1 -9 9 -1 8 -3 7 -6 6 -1 1 -4 5 -3 1 -8 6 -8 3 -9 10 -7 9 -9 7 -2 5 -10 4 -7 6 -3 1 -10 10 -5 7 -8 4 -9 5 -8
35 -814
49 728
39 -813
63 -324
52 -...

output:

37293431
37293468
37293427
37293449
37293436
37293391
37293450
37293377
37293465
37293445
37293447
37293479
37293434
37293382
37293432
37293414
37293443
37293441
37293424
37293452
37293393
37293429
37293489
37293380
37293397
37293418
37293382
37293470
37293453
37293374
37293417
37293454
37293411
372...

result:

ok 100000 numbers

Test #97:

score: 0
Accepted
time: 79ms
memory: 8536kb

input:

94 100000
30000132 1 -3 4 -9 1 -5 4 -2 2 -1 7 -3 8 -1 9 -10 4 -10 9 -3 9 -4 8 -8 10 -1 7 -10 8 -4 9 -4 4 -2 2 -9 7 -2 7 -6 4 -3 1 -9 1 -10 29999038 9 -1 9 -10 1 -4 3 -3 3 -1 6 -7 9 -8 9 -2 7 -5 7 -4 5 -8 3 -7 6 -5 1 -3 3 -5 6 -1 1 -4 8 -4 3 -6 5 -3 2 -8 2 -5 2 -4
71 -45
18 234
72 -852
27 10
63 345
7...

output:

62109336
62109307
62109394
-1
62109341
62109299
62109315
62109411
62109278
62109293
62109325
-1
62109354
62109259
62109309
62109298
62109306
62109315
62109380
62109349
62109302
62109335
-1
62109282
62109353
62109306
62109327
62109317
62109290
62109307
62109296
62109412
62109319
62109321
62109378
621...

result:

ok 100000 numbers

Test #98:

score: 0
Accepted
time: 86ms
memory: 8520kb

input:

92 100000
30000396 4 -9 1 -4 1 -1 4 -8 3 -1 6 -7 1 -2 6 -8 8 -8 8 -7 6 -8 9 -1 4 -3 3 -5 8 -7 7 -2 8 -3 3 -6 9 -8 7 -3 4 -5 10 -9 5 -29998512 -4 3 -1 4 -4 3 -5 2 -7 2 -6 3 -2 3 -1 5 -6 6 -4 9 -9 4 -8 5 -5 9 -2 2 -4 1 -6 3 -3 9 -9 6 -1 8 -10 9 -5 9 -3 9 -3
65 -253
30 -272
61 604
61 335
60 813
5 -871
...

output:

34019993
34019952
34019982
34019982
-1
34019962
34019969
34019940
34019959
34019959
34019957
34019972
34019957
34019948
34019960
34019937
34019986
34019941
34019930
34020010
34019923
34019959
34019930
-1
34020006
34019982
34019963
34019971
34019883
34020006
34019942
34019995
34019935
34019952
340199...

result:

ok 100000 numbers

Test #99:

score: 0
Accepted
time: 75ms
memory: 8612kb

input:

92 100000
30000076 8 -1 2 -3 6 -10 6 -1 2 -9 2 -7 6 -4 6 -8 6 -7 1 -9 3 -3 10 -8 2 -7 4 -5 7 -10 1 -6 8 -5 6 -4 8 -4 7 -10 6 -4 6 -8 9 -29998705 -6 2 -8 2 -1 10 -9 6 -5 3 -2 10 -4 7 -1 6 -2 8 -10 2 -9 5 -9 2 -9 5 -5 7 -5 6 -3 10 -2 4 -2 10 -7 10 -5 8 -2 7 -10 4 -5
51 610
70 103
74 -89
49 -695
66 48
...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
46301505
-1
-1
-1
-1
-1
-1
46301439
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
46301440
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 100000 numbers

Test #100:

score: 0
Accepted
time: 82ms
memory: 8760kb

input:

90 100000
30000651 5 -9 10 -10 6 -5 1 -4 3 -10 5 -3 3 -6 7 -8 9 -1 10 -3 4 -6 7 -1 2 -3 8 -5 7 -9 2 -10 4 -9 4 -3 5 -9 7 -2 1 -2 5 -5 29998281 9 -7 1 -6 8 -10 1 -8 4 -9 4 -9 6 -8 1 -10 3 -1 1 -1 9 -8 8 -3 9 -8 4 -10 8 -8 5 -3 7 -8 10 -9 5 -6 8 -3 1 -10 5 -6
41 -874
5 -510
4 -67
71 22
29 804
78 -988
...

output:

25313449
25313485
25313478
25313493
25313430
25313523
25313495
25313453
25313447
25313418
25313474
25313513
25313504
25313497
25313484
25313510
25313437
25313478
25313500
25313512
25313527
25313447
25313522
25313442
25313448
25313455
25313482
25313454
25313430
25313427
25313495
25313502
25313483
253...

result:

ok 100000 numbers

Extra Test:

score: 0
Extra Test Passed