QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#614965#9438. Two Boxucup-team087#AC ✓2273ms21580kbC++1411.6kb2024-10-05 17:15:252024-10-05 17:15:31

Judging History

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

  • [2024-10-05 17:15:31]
  • 评测
  • 测评结果:AC
  • 用时:2273ms
  • 内存:21580kb
  • [2024-10-05 17:15:25]
  • 提交

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

////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
  static constexpr unsigned M = M_;
  unsigned x;
  constexpr ModInt() : x(0U) {}
  constexpr ModInt(unsigned x_) : x(x_ % M) {}
  constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
  constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
  constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
  ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
  ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
  ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
  ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
  ModInt pow(long long e) const {
    if (e < 0) return inv().pow(-e);
    ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
  }
  ModInt inv() const {
    unsigned a = M, b = x; int y = 0, z = 1;
    for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
    assert(a == 1U); return ModInt(y);
  }
  ModInt operator+() const { return *this; }
  ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
  ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
  ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
  ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
  ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
  template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
  template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
  template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
  template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
  explicit operator bool() const { return x; }
  bool operator==(const ModInt &a) const { return (x == a.x); }
  bool operator!=(const ModInt &a) const { return (x != a.x); }
  friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////

constexpr unsigned MO = 998244353;
using Mint = ModInt<MO>;


// T: monoid representing information of an interval.
//   T()  should return the identity.
//   T(S s)  should represent a single element of the array.
//   T::pull(const T &l, const T &r)  should pull two intervals.
template <class T> struct SegmentTreePoint {
  int logN, n;
  vector<T> ts;
  SegmentTreePoint() : logN(0), n(0) {}
  explicit SegmentTreePoint(int n_) {
    for (logN = 0, n = 1; n < n_; ++logN, n <<= 1) {}
    ts.resize(n << 1);
  }
  template <class S> explicit SegmentTreePoint(const vector<S> &ss) {
    const int n_ = ss.size();
    for (logN = 0, n = 1; n < n_; ++logN, n <<= 1) {}
    ts.resize(n << 1);
    for (int i = 0; i < n_; ++i) at(i) = T(ss[i]);
    build();
  }
  T &at(int i) {
    return ts[n + i];
  }
  void build() {
    for (int u = n; --u; ) pull(u);
  }

  inline void pull(int u) {
    ts[u].pull(ts[u << 1], ts[u << 1 | 1]);
  }

  // Changes the value of point a to s.
  template <class S> void change(int a, const S &s) {
    assert(0 <= a); assert(a < n);
    ts[a += n] = T(s);
    for (; a >>= 1; ) pull(a);
  }

  // Applies T::f(args...) to point a.
  template <class F, class... Args>
  void ch(int a, F f, Args &&... args) {
    assert(0 <= a); assert(a < n);
    (ts[a += n].*f)(args...);
    for (; a >>= 1; ) pull(a);
  }

  // Calculates the product for [a, b).
  T get(int a, int b) {
    assert(0 <= a); assert(a <= b); assert(b <= n);
    if (a == b) return T();
    T prodL, prodR, t;
    for (a += n, b += n; a < b; a >>= 1, b >>= 1) {
      if (a & 1) { t.pull(prodL, ts[a++]); prodL = t; }
      if (b & 1) { t.pull(ts[--b], prodR); prodR = t; }
    }
    t.pull(prodL, prodR);
    return t;
  }

  // Calculates T::f(args...) of a monoid type for [a, b).
  //   op(-, -)  should calculate the product.
  //   e()  should return the identity.
  template <class Op, class E, class F, class... Args>
#if __cplusplus >= 201402L
  auto
#else
  decltype((std::declval<T>().*F())())
#endif
  get(int a, int b, Op op, E e, F f, Args &&... args) {
    assert(0 <= a); assert(a <= b); assert(b <= n);
    if (a == b) return e();
    auto prodL = e(), prodR = e();
    for (a += n, b += n; a < b; a >>= 1, b >>= 1) {
      if (a & 1) prodL = op(prodL, (ts[a++].*f)(args...));
      if (b & 1) prodR = op((ts[--b].*f)(args...), prodR);
    }
    return op(prodL, prodR);
  }

  // Find min b s.t. T::f(args...) returns true,
  // when called for the partition of [a, b) from left to right.
  //   Returns n + 1 if there is no such b.
  template <class F, class... Args>
  int findRight(int a, F f, Args &&... args) {
    assert(0 <= a); assert(a <= n);
    if ((T().*f)(args...)) return a;
    if (a == n) return n + 1;
    a += n;
    for (; ; a >>= 1) if (a & 1) {
      if ((ts[a].*f)(args...)) {
        for (; a < n; ) {
          if (!(ts[a <<= 1].*f)(args...)) ++a;
        }
        return a - n + 1;
      }
      ++a;
      if (!(a & (a - 1))) return n + 1;
    }
  }

  // Find max a s.t. T::f(args...) returns true,
  // when called for the partition of [a, b) from right to left.
  //   Returns -1 if there is no such a.
  template <class F, class... Args>
  int findLeft(int b, F f, Args &&... args) {
    assert(0 <= b); assert(b <= n);
    if ((T().*f)(args...)) return b;
    if (b == 0) return -1;
    b += n;
    for (; ; b >>= 1) if ((b & 1) || b == 2) {
      if ((ts[b - 1].*f)(args...)) {
        for (; b <= n; ) {
          if (!(ts[(b <<= 1) - 1].*f)(args...)) --b;
        }
        return b - n - 1;
      }
      --b;
      if (!(b & (b - 1))) return -1;
    }
  }
};  // SegmentTreePoint<T>

////////////////////////////////////////////////////////////////////////////////


#include <chrono>
#ifdef LOCAL
mt19937_64 rng(58);
#else
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#endif


constexpr int INF = 1001001001;

struct NodeMin {
  // ((A, rnd), pos)
  pair<pair<int, unsigned long long>, int> mn;
  int mx;
  NodeMin() : mn(make_pair(+INF, -1), 0), mx(-INF) {}
  NodeMin(const pair<pair<int, unsigned long long>, int> &val, int tm) : mn(val), mx(tm) {}
  void pull(const NodeMin &l, const NodeMin &r) {
    mn = min(l.mn, r.mn);
    mx = max(l.mx, r.mx);
  }
};


constexpr int LIM = 15;
Mint bn[LIM + 1][LIM + 1];
Mint coef[LIM + 1][LIM + 1][LIM + 1][LIM + 1];
void init() {
  for (int n = 0; n <= LIM; ++n) {
    bn[n][0] = bn[n][n] = 1;
    for (int k = 1; k < n; ++k) bn[n][k] = bn[n - 1][k - 1] + bn[n - 1][k];
  }
  for (int b = 0; b <= LIM; ++b) {
    for (int kL = 0; kL <= b; ++kL) for (int kR = 0; kR <= b; ++kR) {
      for (int c = max((kL + kR - b + 1) / 2, 0); c <= kL && c <= kR; ++c) {
        const int k = (kL - c) + (kR - c);
        coef[b][kL][kR][c] = bn[b-k][c] * bn[k][kL-c];
      }
    }
  }
}

vector<Mint> merge(int a, int ar, const vector<Mint> &fs, const vector<Mint> &gs) {
  assert(fs.size() == gs.size());
  const int b = (int)fs.size() - 1;
  assert(a <= b);
  vector<Mint> hs(b + 1, 0);
  for (int kL = 0; kL <= b; ++kL) for (int kR = 0; kR <= b; ++kR) {
    for (int c = max((kL + kR - b + 1) / 2, 0); c <= kL && c <= kR; ++c) {
      const int k = (kL - c) + (kR - c);
      hs[k] += coef[b][kL][kR][c] * fs[kL] * gs[kR];
    }
  }
  ar = min(max(ar, a), b);
  hs.resize(ar + 1);
  if (a < ar) {
    vector<Mint> hhs(a + 1, 0);
    for (int k = 0; k <= a; ++k) for (int dk = 0; dk <= ar - a; ++dk) {
      hhs[k] += bn[ar - a][dk] * hs[k + dk];
    }
    hs.swap(hhs);
  }
  return hs;
}


int N, M, Q;
vector<int> A;
vector<int> X, Y;

vector<Mint> brute(int l, int r) {
  const int a = max(A[l], (r == N) ? 0 : A[r]);
  if (l + 1 == r) {
    vector<Mint> ret(a + 1, 0);
    for (int k = 0; k <= a; ++k) {
      ret[k] = (k == 0) ? (max(A[r], a) - a) : (k == 1) ? 1 : 0;
    }
// cerr<<l<<" "<<r<<": "<<ret<<endl;
    return ret;
  } else {
    const int m = min_element(A.begin() + (l + 1), A.begin() + r) - A.begin();
    const auto resL = brute(l, m);
    const auto resR = brute(m, r);
    const auto ret = merge(a, A[r], resL, resR);
// cerr<<l<<" "<<r<<": "<<ret<<endl;
    return ret;
  }
}


SegmentTreePoint<NodeMin> seg;
map<pair<int, int>, pair<int, vector<Mint>>> cache;

vector<Mint> solve(int l, int r) {
  const auto res = seg.get(l + 1, r);
  const int tm = max({seg.at(l).mx, res.mx, seg.at(r).mx});
  auto it = cache.find(make_pair(l, r));
  if (it != cache.end() && it->second.first == tm) return it->second.second;
  vector<Mint> ret;
  
  const int a = max(A[l], (r == N) ? 0 : A[r]);
  if (l + 1 == r) {
    ret.assign(a + 1, 0);
    for (int k = 0; k <= a; ++k) {
      ret[k] = (k == 0) ? (max(A[r], a) - a) : (k == 1) ? 1 : 0;
    }
    return ret;
  } else {
    const int m = res.mn.second;
// cerr<<l<<" "<<r<<": m = "<<m<<endl;
    const auto resL = solve(l, m);
    const auto resR = solve(m, r);
    ret = merge(a, A[r], resL, resR);
  }
// cerr<<l<<" "<<r<<": "<<ret<<endl;
  
  cache[make_pair(l, r)] = make_pair(tm, ret);
  return ret;
}


int main() {
  init();
  
  for (; ~scanf("%d%d%d", &N, &M, &Q); ) {
    A.assign(N + 1, 0);
    for (int i = 1; i <= N; ++i) {
      scanf("%d", &A[i]);
    }
    X.resize(Q);
    Y.resize(Q);
    for (int q = 0; q < Q; ++q) {
      scanf("%d%d", &X[q], &Y[q]);
    }
    
    cache.clear();
    
    seg = SegmentTreePoint<NodeMin>(N);
    for (int i = 0; i < N; ++i) {
      seg.at(i) = NodeMin(make_pair(make_pair(A[i], rng()), i), -1);
    }
    seg.build();
    
    for (int q = 0; q < Q; ++q) {
      if (A[X[q]] != Y[q]) {
        A[X[q]] = Y[q];
        seg.change(X[q], NodeMin(make_pair(make_pair(Y[q], rng()), X[q]), q));
      }
// cerr<<COLOR("33")<<"A = "<<A<<COLOR()<<endl;
      const auto res = solve(0, N);
      printf("%u\n", res[0].x);
    }
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3 2
1 3 1
3 2
1 3

output:

5
14

result:

ok 2 tokens

Test #2:

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

input:

6 8 1
3 8 7 7 1 6
1 4

output:

2100

result:

ok "2100"

Test #3:

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

input:

12 10 8
1 3 2 6 3 6 7 7 5 5 4 7
12 4
7 10
4 2
9 8
9 9
8 3
4 9
10 2

output:

2741280
3007680
1503840
1916160
1972800
728640
1821600
621440

result:

ok 8 tokens

Test #4:

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

input:

1939 5 1
5 1 1 2 1 5 4 5 3 1 2 1 3 3 1 2 3 5 5 3 2 2 1 3 1 5 1 4 2 5 4 1 5 4 3 4 5 3 3 3 3 2 1 2 3 5 1 4 2 1 4 1 3 5 2 2 1 4 4 5 3 2 3 2 1 1 5 5 5 5 3 4 3 1 3 1 1 1 3 5 3 5 1 5 4 3 2 1 2 2 2 3 5 2 4 2 3 1 2 5 5 1 2 5 2 5 3 3 3 4 5 1 5 4 5 3 3 5 4 5 3 5 3 2 2 5 3 2 4 3 3 4 2 2 1 3 1 3 5 2 3 4 2 3 2 4...

output:

894246250

result:

ok "894246250"

Test #5:

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

input:

245 9 1
2 2 3 6 7 5 7 4 7 9 7 6 3 1 6 8 2 1 1 5 3 1 1 3 1 6 8 4 8 4 8 1 8 6 6 9 3 4 7 1 5 2 3 9 5 7 5 7 7 5 5 5 5 1 5 4 7 1 2 6 8 9 5 4 1 8 6 3 9 9 1 3 6 5 5 5 1 6 5 1 2 5 5 4 1 1 8 3 8 2 9 7 9 5 7 8 8 5 9 1 1 4 4 9 9 6 3 9 8 9 2 1 2 6 9 2 1 3 7 3 2 5 9 3 7 2 2 3 4 7 5 1 8 5 8 6 7 9 7 4 8 7 2 2 7 5 ...

output:

99945033

result:

ok "99945033"

Test #6:

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

input:

1919 9 1
7 1 7 6 6 9 8 5 1 8 9 9 7 3 4 2 8 9 4 8 7 4 8 8 8 4 2 9 5 9 3 7 2 3 2 8 7 9 1 1 3 7 7 2 5 9 2 1 3 6 7 6 4 4 1 9 3 7 3 2 5 5 1 4 7 8 6 2 1 4 7 1 4 7 4 7 6 3 8 4 3 7 3 1 7 5 2 2 2 4 9 1 5 5 7 7 3 1 5 4 7 2 9 5 4 9 3 2 6 8 2 3 8 3 6 5 5 5 9 7 2 8 2 9 5 1 8 6 3 1 2 9 1 9 1 3 9 6 7 2 3 2 2 7 9 7...

output:

292474819

result:

ok "292474819"

Test #7:

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

input:

1985 5 1
1 5 5 1 4 4 3 2 1 4 4 1 1 2 5 5 5 3 3 1 2 4 3 3 5 5 2 4 1 1 5 4 3 1 2 5 5 4 1 5 2 5 2 4 1 4 5 1 3 4 4 2 2 4 5 2 1 5 5 3 2 5 5 2 4 4 5 2 5 1 1 5 5 1 1 3 4 2 4 5 2 1 2 1 1 2 3 5 1 5 2 4 1 5 3 2 2 3 1 3 4 5 1 4 4 2 4 3 5 5 1 4 3 4 5 5 2 5 2 2 2 2 2 3 5 1 4 4 3 3 4 5 5 4 3 5 1 4 5 5 2 3 2 2 3 3...

output:

810807913

result:

ok "810807913"

Test #8:

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

input:

357 5 1
1 3 2 5 4 4 3 4 3 1 1 1 4 5 5 2 1 3 4 1 3 1 2 3 4 1 5 3 1 3 5 1 4 4 2 4 5 1 3 4 2 5 2 3 2 5 3 2 2 1 4 3 1 1 2 3 2 3 2 1 4 4 5 5 1 4 2 1 2 2 2 4 1 3 5 1 1 2 4 4 5 4 1 2 4 1 2 3 2 4 3 4 3 4 1 4 1 1 4 5 4 4 4 3 2 5 4 5 4 2 4 1 2 5 5 3 5 5 2 4 2 1 2 1 4 1 2 1 3 1 5 2 2 1 5 2 2 4 5 1 3 4 5 3 3 3 ...

output:

836628563

result:

ok "836628563"

Test #9:

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

input:

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

output:

699591879

result:

ok "699591879"

Test #10:

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

input:

884 7 1
7 2 6 7 1 7 2 5 5 1 7 5 4 5 2 5 4 2 2 4 3 2 7 1 6 3 3 2 1 1 2 1 7 7 4 3 5 1 1 6 6 7 5 1 6 6 4 3 5 2 3 1 6 3 7 2 7 4 6 6 6 3 7 6 1 3 2 1 1 5 4 3 1 4 4 4 7 2 5 7 5 7 5 3 6 5 5 1 4 5 6 6 6 3 6 7 3 2 3 1 5 5 6 7 6 5 3 2 7 3 1 2 5 5 1 2 7 5 3 1 3 6 4 7 2 4 4 5 6 7 4 7 4 2 4 1 2 1 2 6 7 1 7 4 1 1 ...

output:

298342150

result:

ok "298342150"

Test #11:

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

input:

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

output:

593281642

result:

ok "593281642"

Test #12:

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

input:

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

output:

635535966

result:

ok "635535966"

Test #13:

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

input:

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

output:

336713065

result:

ok "336713065"

Test #14:

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

input:

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

output:

85227947

result:

ok "85227947"

Test #15:

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

input:

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

output:

913697441

result:

ok "913697441"

Test #16:

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

input:

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

output:

298067446

result:

ok "298067446"

Test #17:

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

input:

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

output:

307824286

result:

ok "307824286"

Test #18:

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

input:

2000 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

1

result:

ok "1"

Test #19:

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

input:

1 1 1
1
1 1

output:

1

result:

ok "1"

Test #20:

score: 0
Accepted
time: 3ms
memory: 4460kb

input:

2000 10 1
9 10 10 10 10 9 10 9 9 10 10 9 9 10 9 10 10 10 10 10 10 9 9 10 10 9 10 10 9 10 9 10 10 10 10 9 10 10 9 10 10 10 9 10 9 10 9 9 9 10 9 10 9 10 10 9 9 10 10 9 10 10 10 10 10 9 9 10 9 10 10 9 9 10 9 9 10 9 10 10 9 9 9 10 9 10 10 9 10 10 9 9 10 10 10 10 9 10 10 10 9 9 9 10 10 9 9 10 9 10 10 10 ...

output:

214050412

result:

ok "214050412"

Test #21:

score: 0
Accepted
time: 3ms
memory: 4324kb

input:

2000 10 1
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10...

output:

527357103

result:

ok "527357103"

Test #22:

score: 0
Accepted
time: 3ms
memory: 4252kb

input:

2000 10 1
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10...

output:

106236082

result:

ok "106236082"

Test #23:

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

input:

5484 3 1
1 3 1 3 3 1 1 2 3 1 3 3 3 3 3 2 2 3 1 3 3 2 1 3 3 1 2 2 2 3 2 2 3 2 3 2 1 2 1 1 1 1 2 2 3 1 1 3 3 1 3 1 1 2 2 2 3 1 3 1 3 2 1 3 1 3 2 1 3 1 1 1 3 1 3 1 2 2 1 2 2 1 3 3 3 2 3 1 2 1 1 3 1 1 1 2 2 1 3 2 3 2 3 1 3 2 2 2 3 1 3 2 2 2 3 2 3 1 2 3 1 1 1 3 3 3 2 3 3 3 3 2 2 1 3 1 1 1 2 1 2 2 1 1 2 3...

output:

886224409

result:

ok "886224409"

Test #24:

score: 0
Accepted
time: 6ms
memory: 5520kb

input:

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

output:

835287489

result:

ok "835287489"

Test #25:

score: 0
Accepted
time: 33ms
memory: 9028kb

input:

29076 14 1
14 12 7 10 5 11 7 12 1 14 2 7 12 1 14 13 9 10 13 1 14 2 10 11 5 4 8 13 8 1 5 9 5 10 1 4 9 13 10 9 12 6 7 2 14 13 11 3 6 6 4 6 11 1 2 12 6 1 12 1 3 8 6 6 3 11 4 10 2 10 11 2 5 11 13 14 12 11 2 9 4 12 3 4 2 2 14 2 10 8 11 4 5 11 2 7 11 1 9 13 2 2 12 10 5 4 5 4 4 9 9 2 7 13 12 2 14 6 12 3 4 ...

output:

428714926

result:

ok "428714926"

Test #26:

score: 0
Accepted
time: 16ms
memory: 7920kb

input:

21530 8 1
5 1 1 7 2 2 4 1 1 6 3 3 4 8 1 8 3 8 6 6 2 6 7 4 8 8 4 5 2 1 4 2 4 7 7 8 7 1 5 1 1 2 8 3 4 3 8 1 4 4 4 2 5 3 3 3 8 1 5 7 8 7 6 1 6 4 3 7 7 4 6 8 3 1 2 8 1 6 1 6 6 1 1 4 7 1 4 5 4 1 4 7 1 6 2 6 6 2 1 6 1 4 3 1 7 4 4 6 8 3 8 8 8 4 2 2 3 5 3 3 7 8 4 6 3 1 4 7 7 2 5 1 4 5 2 7 7 7 4 1 5 6 5 6 8 ...

output:

682167889

result:

ok "682167889"

Test #27:

score: 0
Accepted
time: 4ms
memory: 4716kb

input:

6134 7 1
6 7 4 4 2 2 5 2 2 3 3 1 5 4 5 6 7 6 7 2 1 1 5 3 1 6 2 2 6 2 5 2 1 2 4 7 5 2 6 1 5 5 1 6 1 3 3 3 5 5 3 7 3 6 2 3 5 3 3 4 6 2 3 4 3 1 3 3 7 1 5 6 2 7 3 7 4 7 7 4 2 2 3 6 1 1 7 1 3 4 5 3 6 4 2 7 4 6 2 1 5 7 1 5 3 5 7 1 7 3 2 1 5 7 6 4 1 7 6 1 7 7 3 1 1 3 1 4 5 5 7 4 5 4 2 1 2 2 3 1 2 4 2 6 1 6...

output:

479862425

result:

ok "479862425"

Test #28:

score: 0
Accepted
time: 5ms
memory: 4768kb

input:

5712 9 1
1 3 9 3 2 9 8 7 4 5 1 2 1 1 3 9 9 5 2 1 9 2 4 5 3 9 9 6 3 1 5 5 2 5 2 8 2 2 1 9 8 5 2 8 6 5 3 3 9 9 6 5 6 7 1 2 3 4 4 5 3 6 6 6 6 2 8 5 3 7 2 5 3 9 6 4 7 2 6 5 1 2 4 3 3 5 9 3 9 6 9 5 4 6 2 4 7 8 3 1 9 7 4 8 1 7 1 7 1 3 8 6 2 4 1 7 6 3 2 3 1 8 6 4 1 6 6 8 7 6 3 5 1 2 7 4 6 5 8 3 2 3 7 7 9 3...

output:

800069213

result:

ok "800069213"

Test #29:

score: 0
Accepted
time: 12ms
memory: 6196kb

input:

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

output:

840192715

result:

ok "840192715"

Test #30:

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

input:

30000 15 1
7 14 1 2 8 11 12 11 15 9 6 2 12 12 15 1 4 5 12 9 5 8 5 11 13 6 2 5 12 10 14 3 8 9 12 11 4 7 5 15 9 2 11 15 11 14 11 15 15 1 1 11 11 1 9 6 4 14 9 6 14 8 6 1 7 7 10 5 8 7 5 7 9 3 5 6 3 11 13 2 14 14 5 10 12 14 6 10 9 13 13 10 6 15 7 15 1 6 15 8 1 13 2 15 13 5 10 8 14 9 1 12 3 8 10 15 2 6 6 ...

output:

930560461

result:

ok "930560461"

Test #31:

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

input:

30000 15 1
11 5 10 8 7 7 3 11 9 13 14 7 12 7 2 8 14 6 6 5 12 13 4 2 2 12 14 10 8 14 12 10 6 11 6 15 3 5 15 15 11 15 9 6 4 3 13 4 1 14 7 10 6 15 6 8 15 15 10 3 7 9 7 6 14 14 11 5 11 5 11 13 12 7 6 12 3 1 15 2 10 8 7 15 10 1 2 13 9 1 9 6 3 4 4 5 2 1 4 7 6 14 2 5 3 2 4 8 4 6 12 14 9 2 15 15 13 4 5 5 12...

output:

486842491

result:

ok "486842491"

Test #32:

score: 0
Accepted
time: 46ms
memory: 9292kb

input:

30000 15 1
14 15 10 14 13 2 12 13 6 8 7 15 2 6 8 15 10 3 5 3 5 11 8 12 5 9 12 13 4 13 1 5 2 12 3 14 15 6 13 9 13 5 15 2 14 13 6 3 12 14 6 15 1 14 3 1 5 13 11 5 13 8 13 12 13 10 10 6 1 10 1 1 9 11 1 10 12 4 12 8 11 13 10 12 15 3 6 3 14 10 1 15 7 13 15 3 8 5 11 7 6 13 10 3 2 10 2 13 12 9 7 2 12 11 9 4...

output:

50307243

result:

ok "50307243"

Test #33:

score: 0
Accepted
time: 45ms
memory: 9268kb

input:

30000 15 1
1 14 14 11 14 13 4 13 12 10 8 3 3 10 11 6 9 8 4 5 4 10 9 6 4 6 9 5 14 4 10 12 2 4 15 2 8 3 12 7 4 13 14 6 9 9 4 11 7 14 4 13 8 7 11 9 14 15 5 1 3 15 5 15 1 8 4 4 15 6 1 4 6 14 1 7 5 11 5 4 3 7 7 11 3 8 11 3 6 8 11 8 3 1 9 11 7 6 14 6 8 11 1 7 15 8 14 9 15 5 11 3 11 12 6 2 4 2 13 12 14 3 7...

output:

630828146

result:

ok "630828146"

Test #34:

score: 0
Accepted
time: 45ms
memory: 9316kb

input:

30000 15 1
7 7 11 14 7 10 7 6 10 9 12 2 2 8 11 10 15 12 2 8 11 13 8 9 14 10 4 3 4 10 9 11 3 6 6 13 6 11 7 11 8 10 9 1 9 7 14 1 6 8 10 13 11 10 14 13 2 13 4 13 15 5 8 2 2 1 10 1 10 13 3 7 14 11 4 4 6 5 5 6 15 3 7 14 6 13 11 2 1 6 15 7 7 5 5 9 13 6 15 6 5 10 3 13 4 15 10 1 15 12 5 11 12 7 2 3 3 8 7 15...

output:

953149809

result:

ok "953149809"

Test #35:

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

input:

30000 15 1
14 13 9 7 2 8 9 2 6 1 10 6 3 4 8 15 12 6 15 9 12 9 11 5 4 4 12 2 10 7 12 5 14 10 4 9 7 7 8 3 2 7 5 1 1 9 1 9 11 13 12 9 8 14 12 14 3 13 5 1 1 9 12 9 13 12 2 1 12 1 1 7 7 10 2 13 11 3 10 15 15 12 1 13 9 2 3 3 1 12 5 5 11 15 15 5 12 12 4 13 5 5 4 2 2 3 9 10 6 5 8 4 1 1 14 6 4 14 8 8 3 15 12...

output:

54181826

result:

ok "54181826"

Test #36:

score: 0
Accepted
time: 45ms
memory: 9360kb

input:

30000 15 1
13 2 6 13 3 1 15 9 4 13 11 14 13 5 3 15 3 12 2 12 11 2 3 13 5 8 2 4 9 11 14 14 8 1 1 7 1 15 4 4 12 13 7 1 11 10 15 6 14 5 4 15 5 8 9 6 14 15 3 3 15 11 10 3 12 3 7 2 8 3 7 2 9 5 4 8 5 14 11 2 7 11 6 11 6 11 14 1 15 1 1 15 5 15 7 5 11 1 3 5 8 11 1 11 4 10 4 10 6 15 1 12 5 10 12 13 15 7 8 6 ...

output:

415874796

result:

ok "415874796"

Test #37:

score: 0
Accepted
time: 9ms
memory: 9100kb

input:

30000 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

1

result:

ok "1"

Test #38:

score: 0
Accepted
time: 97ms
memory: 10352kb

input:

30000 15 1
14 15 15 15 15 15 14 14 14 15 15 15 14 14 14 15 15 14 15 15 15 15 14 15 15 15 14 15 14 15 14 14 15 14 14 14 14 14 15 14 14 15 14 14 14 15 14 14 15 14 15 15 15 15 15 14 15 15 15 14 15 15 14 15 14 15 15 15 15 15 15 14 15 14 14 14 15 15 15 14 14 15 14 15 14 15 14 14 15 14 15 14 15 14 14 14 1...

output:

886986198

result:

ok "886986198"

Test #39:

score: 0
Accepted
time: 94ms
memory: 10536kb

input:

30000 15 1
15 15 15 14 14 15 15 14 14 14 14 15 14 15 14 15 15 14 14 14 14 15 14 15 14 14 14 14 15 15 15 14 14 14 15 15 15 15 15 15 15 15 14 14 15 14 15 15 14 14 14 14 15 15 14 15 14 15 15 15 14 15 15 15 14 15 14 15 14 15 14 14 14 15 15 14 14 15 14 15 14 14 14 14 14 14 15 14 15 15 15 14 15 15 14 15 1...

output:

668247064

result:

ok "668247064"

Test #40:

score: 0
Accepted
time: 90ms
memory: 10348kb

input:

30000 15 1
15 14 15 14 15 15 15 14 14 14 15 14 15 15 14 14 15 14 15 15 15 14 15 15 14 14 14 14 15 15 14 14 15 15 15 14 15 15 15 15 15 14 14 15 14 14 14 14 15 15 15 14 14 14 14 14 14 15 14 14 14 14 14 15 15 14 15 15 15 14 14 15 15 15 14 14 15 14 15 14 15 14 15 15 15 15 15 15 14 15 15 14 15 14 14 15 1...

output:

562849724

result:

ok "562849724"

Test #41:

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

input:

30000 15 1
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 1...

output:

673429076

result:

ok "673429076"

Test #42:

score: 0
Accepted
time: 104ms
memory: 10368kb

input:

30000 15 1
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 1...

output:

516022986

result:

ok "516022986"

Test #43:

score: 0
Accepted
time: 60ms
memory: 9272kb

input:

30000 15 1
1 15 1 15 1 1 1 15 1 1 15 15 15 1 1 15 15 15 1 1 1 1 15 1 15 15 1 1 15 1 1 1 1 1 1 15 1 15 15 1 15 15 15 1 1 15 1 1 1 15 15 15 1 1 1 1 1 15 15 1 1 1 15 1 1 15 15 15 15 1 1 15 1 1 1 1 15 15 15 15 15 1 15 15 1 1 15 1 1 15 15 1 15 15 15 1 15 1 1 15 15 15 15 1 15 1 1 15 1 15 1 15 1 1 1 15 1 1...

output:

115103138

result:

ok "115103138"

Test #44:

score: 0
Accepted
time: 51ms
memory: 9188kb

input:

30000 15 1
15 1 15 15 1 15 15 15 15 1 15 1 1 1 15 15 15 1 1 1 1 1 1 15 15 15 1 1 1 15 15 15 15 1 1 15 1 15 1 15 1 1 15 15 15 1 1 1 1 1 1 1 1 1 15 15 1 15 1 15 15 1 15 1 1 1 1 1 15 15 15 1 15 15 15 15 1 15 1 1 15 15 1 15 15 15 1 15 15 15 15 1 1 1 1 15 1 15 1 15 1 15 1 15 15 15 1 15 15 1 15 1 1 1 1 1 ...

output:

777366768

result:

ok "777366768"

Test #45:

score: 0
Accepted
time: 55ms
memory: 9272kb

input:

30000 15 1
1 1 15 1 1 15 1 15 1 1 15 15 1 1 1 1 15 1 1 1 15 15 15 15 1 15 1 1 15 1 1 1 15 15 15 1 15 15 1 1 15 1 15 15 1 1 15 15 15 1 1 1 1 15 1 1 1 15 15 15 1 15 15 15 1 1 15 1 15 1 1 1 1 15 1 15 15 1 1 1 1 1 15 1 1 15 15 1 15 1 1 15 15 1 15 15 1 1 1 1 1 1 15 15 15 1 1 15 1 15 15 15 1 1 15 15 1 15 ...

output:

879322138

result:

ok "879322138"

Test #46:

score: 0
Accepted
time: 104ms
memory: 10416kb

input:

30000 15 1
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 1...

output:

354391629

result:

ok "354391629"

Test #47:

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

input:

30000 15 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

666493861

result:

ok "666493861"

Test #48:

score: 0
Accepted
time: 33ms
memory: 9308kb

input:

30000 15 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1...

output:

640857910

result:

ok "640857910"

Test #49:

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

input:

30000 15 1
1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1...

output:

370646039

result:

ok "370646039"

Test #50:

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

input:

30000 15 1
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1...

output:

553300345

result:

ok "553300345"

Test #51:

score: 0
Accepted
time: 157ms
memory: 10812kb

input:

23069 10 12025
4 2 8 7 5 4 10 6 5 10 1 10 1 4 4 10 5 7 7 3 5 5 7 4 7 2 6 8 9 2 7 8 2 7 3 7 9 5 10 2 5 10 9 10 8 10 9 3 4 1 4 6 5 5 10 7 1 7 2 8 2 3 8 8 10 9 9 4 1 3 7 5 1 1 4 7 3 6 9 8 7 6 1 7 8 1 7 9 9 8 3 4 8 6 4 8 8 8 7 1 1 5 5 10 9 1 8 8 5 10 9 2 3 10 9 2 7 8 10 5 10 10 8 6 7 8 6 8 9 5 6 1 10 10...

output:

968505026
55485091
361959346
283015680
679237632
483478779
307144355
11544202
502008227
137763897
982935997
27264320
127349300
99734190
670547928
841455638
841455638
301643587
83331998
691289897
731349157
61957510
947528086
947528086
675446634
225148878
288646400
742863125
381490210
381490210
469827...

result:

ok 12025 tokens

Test #52:

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

input:

23602 8 25014
1 8 2 8 2 6 5 4 5 7 1 7 5 1 1 7 5 1 7 5 1 2 2 3 7 2 6 7 7 3 3 5 4 2 5 2 1 5 6 2 6 8 3 8 7 3 2 1 1 7 1 6 2 1 2 2 4 1 4 2 8 6 1 4 5 4 6 3 7 4 7 5 8 2 6 4 5 3 2 3 2 6 2 1 1 2 6 7 3 5 3 1 6 5 1 4 8 8 4 2 4 4 2 6 5 2 4 2 7 1 5 1 5 5 5 3 4 6 5 7 4 8 1 8 2 1 8 2 1 2 1 1 6 8 2 7 1 5 3 1 1 2 2 ...

output:

541177119
162234248
440904283
440904283
579266741
971024033
656440670
656440670
925808612
104007635
778759007
559638022
39631014
252123373
106588833
786024463
450259677
62557367
636807778
642532807
989365725
69307623
348298986
464398648
464398648
766281407
791933041
922191335
51856525
51856525
51856...

result:

ok 25014 tokens

Test #53:

score: 0
Accepted
time: 312ms
memory: 13580kb

input:

25107 7 28960
1 5 1 1 6 1 1 6 2 6 5 5 7 1 7 5 4 2 3 2 5 2 1 4 4 1 2 1 3 7 7 4 7 6 6 7 2 4 5 3 3 5 1 3 6 5 2 4 3 2 5 3 5 5 7 2 6 2 6 2 5 3 6 6 7 2 7 5 6 2 6 4 6 4 2 6 4 4 5 1 3 5 5 3 5 3 2 4 1 4 4 1 5 3 7 1 6 3 4 1 5 3 2 7 2 4 2 4 6 4 4 2 2 5 1 4 7 7 2 4 3 5 1 5 5 6 7 6 6 6 4 3 1 2 7 2 3 5 7 1 4 6 6 ...

output:

199053210
516843380
93977920
994981348
442686656
623060698
732931746
589908424
84272632
951269247
416915741
492718603
859538916
104801350
104801350
864382357
205550713
106464008
99814418
199959150
341431732
341431732
934166748
281772142
976679351
447471840
34027970
897467716
119027561
756889039
7680...

result:

ok 28960 tokens

Test #54:

score: 0
Accepted
time: 54ms
memory: 7108kb

input:

13962 13 3707
4 6 12 5 13 11 7 10 1 7 10 2 3 10 3 13 8 5 12 13 4 9 1 13 8 4 7 1 6 12 13 1 13 10 10 6 9 2 9 9 4 3 10 12 3 4 9 10 6 4 7 9 7 10 3 1 3 1 11 13 7 11 2 13 2 10 5 5 11 1 11 13 9 6 8 8 4 4 1 11 7 7 13 1 9 8 7 13 7 6 6 9 4 7 10 12 9 2 10 8 3 12 5 5 12 8 5 2 5 11 10 7 6 2 4 9 3 3 9 8 4 11 3 7 ...

output:

276109416
840238204
694858458
664652304
286153540
666015604
443262601
575437164
359340320
157504118
352213706
58396765
546877234
614428039
609590093
795973112
178492641
825384521
941188876
714749531
548944676
548944676
364923716
729847432
591148054
978781901
736900663
736900663
692684825
647423253
9...

result:

ok 3707 tokens

Test #55:

score: 0
Accepted
time: 194ms
memory: 10644kb

input:

18584 13 14364
10 11 4 10 8 10 10 8 9 3 11 9 9 7 4 8 4 12 10 8 10 12 2 13 2 4 7 12 10 3 10 4 6 5 9 8 11 4 2 6 8 7 1 4 13 8 11 11 4 2 2 12 2 4 8 1 13 6 4 7 10 11 3 7 10 12 9 1 3 10 12 5 10 7 11 3 10 13 2 10 4 6 11 8 7 8 2 5 10 7 7 1 1 5 12 10 7 5 3 2 8 4 12 2 4 11 12 5 9 2 4 5 3 11 13 7 1 9 5 13 1 1 ...

output:

658709022
497231145
871575369
258501464
499540539
482627339
341365782
144778896
808883262
565147088
113575925
728645018
388249791
312547060
94372671
50816229
816496597
891308538
261249127
639631151
291100596
941452278
323552752
278537075
90711667
930283262
258822286
674851472
792959367
968689642
704...

result:

ok 14364 tokens

Test #56:

score: 0
Accepted
time: 164ms
memory: 11364kb

input:

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

output:

885664536
885664536
23889076
456414884
456414884
539163546
952326779
952326779
193910068
715078137
893170269
377884337
361564758
212928322
959212520
746410474
704821236
759627885
3694311
740124339
46628499
338179891
242514922
255559380
64018819
308244426
877375429
756506505
956562987
956562987
89896...

result:

ok 10076 tokens

Test #57:

score: 0
Accepted
time: 28ms
memory: 5340kb

input:

1407 3 8746
2 3 1 2 3 1 1 3 2 2 3 3 1 2 3 2 2 3 3 1 2 3 3 3 2 3 1 1 1 1 3 2 1 1 1 3 1 2 3 1 2 3 1 2 2 2 1 2 2 2 2 1 2 3 1 3 2 1 1 2 2 1 3 2 2 2 2 2 1 2 3 1 3 1 3 2 3 2 2 3 3 3 1 3 1 3 2 1 1 2 2 2 2 2 2 2 2 1 2 3 2 2 3 3 1 2 2 3 1 3 3 1 1 3 3 1 2 2 1 3 3 1 2 3 3 1 3 3 3 1 1 1 3 3 1 3 2 2 3 3 2 2 2 1 ...

output:

523300148
523300148
48355943
523300148
48355943
523300148
784950222
784950222
784950222
784950222
71672392
71672392
71672392
71672392
71672392
390161532
390161532
390161532
390161532
390161532
24605749
24605749
24605749
24605749
511425051
340950034
340950034
392559473
404218891
701231622
382777659
3...

result:

ok 8746 tokens

Test #58:

score: 0
Accepted
time: 547ms
memory: 15596kb

input:

30000 15 30000
12 7 10 15 5 2 11 4 7 12 2 12 6 6 1 5 11 7 1 4 14 12 15 6 1 15 7 1 4 5 9 5 11 6 4 12 1 11 14 8 8 6 15 10 11 11 11 4 4 2 11 10 3 5 10 1 1 6 5 11 11 8 12 2 5 4 7 4 2 5 3 6 5 1 13 4 2 11 10 7 3 15 6 15 13 4 10 2 11 4 4 11 12 5 4 2 9 15 4 9 12 5 9 1 10 7 15 14 14 11 14 7 10 7 7 10 10 3 3 ...

output:

422825564
173618451
369359593
320019089
822965970
520883044
806325492
369272646
490312261
276458720
297112238
902887719
359707127
648508474
460078842
111250807
233596313
332001014
694787936
388363595
505553734
125839435
353657423
74619701
520944322
978282345
871352168
159818860
620006959
333023627
5...

result:

ok 30000 tokens

Test #59:

score: 0
Accepted
time: 542ms
memory: 15468kb

input:

30000 15 30000
6 2 2 11 3 3 2 5 4 1 9 11 2 10 1 10 9 9 10 2 8 10 14 8 10 13 6 8 8 3 4 4 14 4 14 2 12 12 7 8 3 2 9 2 14 11 9 4 9 1 10 8 3 2 4 7 14 11 6 15 14 12 6 1 10 13 4 10 11 2 8 4 7 10 2 5 15 8 8 9 7 11 15 14 12 1 7 13 5 14 6 7 8 11 14 13 13 4 5 5 7 7 15 11 14 14 9 4 2 13 6 6 15 15 15 8 12 10 13...

output:

911850639
306319924
704128449
774810437
723572106
745848746
996839028
540861711
690484474
567044611
532989909
837374986
604256643
228528261
479173379
91352124
76735246
510362953
812042680
822703379
96627561
31861849
705093455
806658813
38850320
823895999
763777444
63070413
444277867
143317154
829787...

result:

ok 30000 tokens

Test #60:

score: 0
Accepted
time: 523ms
memory: 15288kb

input:

30000 15 30000
1 3 3 2 1 6 11 6 4 5 8 8 2 8 14 9 10 3 8 2 10 13 2 4 13 14 3 11 14 4 4 10 1 13 8 12 2 10 13 10 5 13 10 7 1 12 10 1 14 12 13 14 14 6 11 13 4 8 9 2 9 2 7 12 13 1 3 9 12 12 14 1 3 13 14 4 9 1 13 3 7 8 6 4 6 5 5 11 6 13 9 12 14 7 5 14 11 10 7 3 2 12 4 15 13 8 3 7 4 7 9 6 1 14 4 13 10 11 1...

output:

695654402
44021274
254792959
693770195
566765790
324209157
119611695
617317219
301196910
804178987
382874052
942441736
413566869
409687723
414634185
669694655
543808857
256146538
67809146
834834286
653593698
860384091
992193686
414986262
14111135
354882059
802547633
318815276
592492221
810356830
498...

result:

ok 30000 tokens

Test #61:

score: 0
Accepted
time: 536ms
memory: 15408kb

input:

30000 15 30000
2 7 15 12 15 10 7 15 9 12 5 15 15 6 7 5 6 13 9 7 4 2 15 6 14 3 8 3 6 12 2 6 7 1 2 15 11 13 12 14 7 13 8 1 9 14 11 5 3 8 14 3 5 3 4 12 1 12 11 3 2 3 2 10 1 13 1 7 13 15 7 3 9 10 6 5 1 2 7 11 4 15 12 4 13 14 14 7 12 5 9 3 10 13 1 10 7 6 3 1 2 7 1 1 2 9 13 15 13 13 10 13 8 6 11 5 14 11 1...

output:

144411293
269002213
124284731
376229243
210868296
130318287
767330290
100032485
686506705
436229375
366854883
535501260
655239997
723808410
311160595
716934593
813285259
608332841
336926304
673852608
7184886
267547351
300856584
656010697
867332696
84392952
552200686
624771665
570597968
841674781
309...

result:

ok 30000 tokens

Test #62:

score: 0
Accepted
time: 529ms
memory: 15564kb

input:

30000 15 30000
10 2 5 11 7 14 13 2 14 12 15 11 14 5 10 8 11 7 4 9 8 15 2 9 7 15 3 2 3 13 14 5 6 5 10 13 6 4 9 14 6 1 13 1 13 10 9 1 1 13 8 4 1 9 12 14 11 6 14 8 6 7 12 13 8 13 14 14 12 11 9 5 8 14 3 14 3 12 13 1 12 14 7 1 12 1 14 15 13 5 13 9 3 9 12 13 11 11 10 15 5 15 10 12 5 10 10 15 4 5 2 15 5 1 ...

output:

277733635
237579028
180832486
704228788
605345120
891501570
230297208
717621293
16772585
519449810
349956873
317148184
882401416
391888896
613464099
573145292
210929203
699445337
206163165
514952921
164680380
717412599
167755887
664483528
617617081
294884241
646564297
772905926
696720290
529046725
8...

result:

ok 30000 tokens

Test #63:

score: 0
Accepted
time: 535ms
memory: 15408kb

input:

30000 15 30000
4 11 7 4 4 12 11 4 12 14 14 8 14 4 14 3 8 4 3 3 12 11 5 4 13 1 6 13 15 15 14 5 12 11 1 15 11 6 10 2 2 11 10 10 7 10 11 2 11 6 4 8 9 6 7 7 15 9 13 15 15 13 14 15 13 11 5 13 1 4 12 8 1 2 2 5 13 8 15 4 3 6 9 14 13 3 12 9 15 6 2 13 9 4 8 15 10 13 7 6 3 8 6 15 9 10 11 2 11 11 14 8 10 6 13 ...

output:

176911054
192496265
229759211
677501694
730256044
125595902
97624243
125426053
505701065
670834234
143071404
67409584
197160379
754101840
532983156
190029336
183929637
157999763
684942416
752527933
77521510
677163517
293235383
635573878
970359073
379556449
258040697
352726849
992955172
92948500
2684...

result:

ok 30000 tokens

Test #64:

score: 0
Accepted
time: 518ms
memory: 15444kb

input:

30000 15 30000
9 8 10 11 12 14 8 13 4 3 8 15 12 14 1 9 11 8 7 2 5 13 10 13 12 9 9 14 14 9 15 1 9 15 4 12 5 12 12 15 12 3 10 7 10 5 3 1 9 6 10 15 9 10 3 15 1 11 1 11 8 9 3 6 4 10 10 1 3 13 6 7 11 8 8 8 9 10 2 14 13 1 8 3 4 3 8 3 1 5 6 1 8 6 12 10 12 3 1 14 2 9 3 11 15 6 8 5 6 2 14 11 9 1 8 8 3 1 2 6 ...

output:

288608384
479424503
19861618
965843147
666999743
826900204
200513189
55241793
266573584
522764094
608828540
888444240
684634228
308258526
799673534
784028889
603264038
994290278
795285562
234659887
512038296
595129357
414604643
972952179
44656275
287014373
518293475
657934701
778817341
766374702
731...

result:

ok 30000 tokens

Test #65:

score: 0
Accepted
time: 106ms
memory: 10584kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
...

result:

ok 30000 tokens

Test #66:

score: 0
Accepted
time: 107ms
memory: 10608kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
...

result:

ok 30000 tokens

Test #67:

score: 0
Accepted
time: 110ms
memory: 10684kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
516022986
...

result:

ok 30000 tokens

Test #68:

score: 0
Accepted
time: 2137ms
memory: 20724kb

input:

30000 15 30000
15 15 15 14 14 14 15 15 14 15 15 15 14 15 15 15 14 15 15 15 14 15 14 15 14 14 14 14 14 14 15 15 14 14 15 14 14 15 14 15 14 14 14 15 14 14 14 15 14 15 14 14 14 15 15 15 14 15 14 15 14 14 14 15 14 14 14 14 15 15 15 15 14 15 14 14 14 15 14 15 14 14 14 15 14 15 14 15 15 14 15 15 14 15 14 ...

output:

271303973
393197562
242411169
564512217
413395002
830609754
19828254
648605494
468904844
761697230
409067600
761697230
892942863
281479889
735134544
300358846
130831501
467669709
718657262
467669709
288885758
353802173
514478210
988186286
200140084
801984458
202058806
801984458
103702931
206100357
8...

result:

ok 30000 tokens

Test #69:

score: 0
Accepted
time: 2097ms
memory: 20968kb

input:

30000 15 30000
15 15 14 15 15 15 14 15 14 15 14 15 15 15 14 15 15 14 15 14 14 14 14 14 15 14 14 14 15 15 15 15 14 15 14 14 15 15 14 14 15 14 15 14 15 14 15 15 14 14 14 15 15 14 14 14 14 14 15 15 15 14 14 15 14 14 15 14 14 15 14 14 15 15 15 14 15 15 14 14 14 14 15 15 15 14 15 14 15 15 15 15 15 14 14 ...

output:

144286857
139929931
482364038
778779991
373367544
640112819
767474108
166148260
439230524
454881360
64049068
555245277
481485550
555245277
158950371
567652772
158950371
289891502
810282968
483253164
974654751
658763223
757484856
569464391
278295284
809395835
577462905
737197266
628910641
393789076
1...

result:

ok 30000 tokens

Test #70:

score: 0
Accepted
time: 2030ms
memory: 20684kb

input:

30000 15 30000
14 15 14 15 14 14 15 15 14 14 15 14 15 15 15 14 14 14 15 15 15 15 14 14 14 15 14 15 15 14 14 15 14 14 15 15 14 15 14 15 15 14 14 14 15 15 15 15 14 15 14 14 14 14 15 15 15 14 14 14 15 15 14 14 14 14 15 15 15 15 14 14 14 14 14 14 14 14 15 14 14 14 14 15 15 15 15 15 15 15 14 15 15 15 15 ...

output:

934044862
786017894
123126924
132826079
123126924
389860364
4703120
389860364
45519774
901100612
330646678
703911303
481508126
106354267
764554326
587180464
793987507
273450870
589200097
407757573
437947314
650915897
219753770
460144593
141417431
574726287
516090915
250056301
152233410
388242277
731...

result:

ok 30000 tokens

Test #71:

score: 0
Accepted
time: 594ms
memory: 17320kb

input:

30000 15 30000
15 1 15 1 1 15 15 15 15 15 1 15 15 15 1 15 15 15 1 1 15 1 1 1 1 15 1 15 15 15 1 1 1 15 15 15 15 15 15 15 1 15 1 1 15 15 1 1 1 15 1 1 1 1 15 1 1 15 1 15 15 15 1 1 1 1 15 15 15 1 1 15 15 1 15 15 15 1 15 15 15 15 15 1 1 1 15 1 1 15 15 15 15 15 15 1 1 1 1 1 1 1 1 1 1 1 15 15 15 15 15 1 15...

output:

327899433
273530187
109975393
131223449
109975393
548940291
248149541
644812394
248149541
727510056
930207310
370920892
91277683
272283673
91277683
370920892
572591615
137191735
674642351
577373145
667351777
488161966
123859088
859641967
915697269
859641967
915697269
760513994
915697269
813823203
43...

result:

ok 30000 tokens

Test #72:

score: 0
Accepted
time: 590ms
memory: 17280kb

input:

30000 15 30000
1 1 1 15 1 1 1 15 1 15 1 1 15 1 1 1 15 1 15 1 1 15 1 1 1 15 1 1 15 1 1 15 15 15 1 1 1 1 15 15 1 15 15 15 1 15 1 1 1 1 15 15 15 1 15 15 15 1 15 15 1 15 15 15 1 1 15 15 1 15 15 15 15 1 15 15 15 1 15 1 1 15 15 15 1 15 1 1 1 1 1 15 15 1 15 15 1 15 1 1 1 15 15 1 1 1 1 15 15 1 1 15 1 15 1 1...

output:

957107477
381191213
134732105
24492869
367393035
24492869
692199425
589689690
692199425
816738972
145619034
687023420
322907770
403792323
67418727
366686312
585320063
793846121
212653884
195075201
212653884
842925198
664945734
989986833
874381553
967413046
113235969
319501450
583156039
441860480
103...

result:

ok 30000 tokens

Test #73:

score: 0
Accepted
time: 593ms
memory: 17144kb

input:

30000 15 30000
1 15 1 1 1 1 1 15 1 1 15 15 15 15 1 1 15 1 1 1 15 15 15 15 1 15 15 15 1 1 15 15 15 1 1 15 1 15 1 15 15 1 15 15 15 15 1 1 1 15 15 15 1 1 15 15 1 1 15 1 15 1 1 15 1 1 15 1 1 15 1 1 15 1 15 1 15 15 1 15 15 1 15 15 1 15 15 1 15 1 1 1 15 15 15 15 15 1 15 15 15 15 15 1 15 1 15 1 1 15 1 15 1...

output:

885998411
312799576
689490755
378714168
624194223
378714168
885998411
591463549
378906488
855869619
859112049
624700039
957051983
380358803
906974272
127014575
485392124
165458722
485392124
293171389
195129029
930446729
195129029
930446729
979524346
930446729
445450889
12516368
241242971
12516368
44...

result:

ok 30000 tokens

Test #74:

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

input:

30000 15 30000
14 14 15 14 14 14 14 14 14 15 15 14 14 14 15 14 14 14 15 14 15 15 14 14 15 15 15 15 15 15 15 14 15 15 14 14 14 14 14 14 15 14 15 15 15 14 14 14 14 14 14 15 14 14 14 15 14 14 14 15 15 15 14 14 15 14 15 14 14 14 15 14 14 14 14 15 14 14 14 15 14 15 15 15 15 14 14 14 14 14 15 15 15 15 14 ...

output:

559144059
176936220
761538112
813251100
876179632
226602662
10077336
37101663
764478744
764478744
808524556
17222647
433042077
433042077
154037043
154037043
958908974
958908974
550285500
582629587
783558978
348842093
444809574
879511458
347755031
347755031
938745588
938745588
636055074
636055074
974...

result:

ok 30000 tokens

Test #75:

score: 0
Accepted
time: 671ms
memory: 21232kb

input:

30000 15 30000
14 15 15 14 14 15 14 15 14 14 14 14 14 15 14 15 15 14 14 14 15 15 15 15 15 14 14 14 15 14 15 14 15 14 15 14 15 15 14 14 14 15 15 15 14 14 14 15 15 15 15 14 14 15 15 15 14 15 14 15 15 14 14 14 15 14 15 15 14 15 14 15 15 15 14 14 14 15 15 14 14 14 14 15 14 15 14 14 15 14 15 15 14 14 15 ...

output:

891448418
866843958
176519646
176519646
116756294
116756294
594445301
361980982
540094246
540094246
125976558
162978189
395234138
395234138
734739729
734739729
12865452
12865452
689667580
689667580
180876541
784234043
300268952
810166468
993459747
993459747
970699461
762374651
849852584
849852584
18...

result:

ok 30000 tokens

Test #76:

score: 0
Accepted
time: 641ms
memory: 21488kb

input:

30000 15 30000
14 14 14 14 14 15 14 14 15 15 15 14 14 14 14 15 14 14 15 15 15 15 15 15 15 15 14 14 14 14 15 14 14 15 14 14 15 15 14 15 15 14 15 14 14 14 15 14 15 14 14 14 15 15 14 15 15 15 14 14 14 14 14 14 14 15 14 15 14 14 14 14 14 14 14 15 14 14 15 14 15 15 14 14 14 14 15 15 15 15 15 15 15 14 15 ...

output:

692028145
692028145
62484031
62484031
867622764
867622764
724766884
724766884
88791421
88791421
573896963
146947883
60463571
193535368
537511842
394110625
715438485
895531038
125966928
298144165
427567018
812712667
434027841
434027841
875969697
875969697
262350710
262350710
542268879
542268879
78945...

result:

ok 30000 tokens

Test #77:

score: 0
Accepted
time: 2072ms
memory: 10604kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
141948272
516022986
...

result:

ok 30000 tokens

Test #78:

score: 0
Accepted
time: 1406ms
memory: 10612kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022986
41762758
516022...

result:

ok 30000 tokens

Test #79:

score: 0
Accepted
time: 2273ms
memory: 10624kb

input:

30000 15 30000
15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 ...

output:

237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
237763401
516022986
...

result:

ok 30000 tokens

Test #80:

score: 0
Accepted
time: 12ms
memory: 9044kb

input:

30000 1 30000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 30000 tokens

Extra Test:

score: 0
Extra Test Passed