QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#739543#3068. Kitchen KnobsmaspyAC ✓95ms59440kbC++2315.2kb2024-11-12 22:06:032024-11-12 22:06:04

Judging History

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

  • [2024-11-12 22:06:04]
  • 评测
  • 测评结果:AC
  • 用时:95ms
  • 内存:59440kb
  • [2024-11-12 22:06:03]
  • 提交

answer

#line 1 "/home/maspy/compro/library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else

// https://codeforces.com/blog/entry/96344
#pragma GCC optimize("Ofast,unroll-loops")
// いまの CF だとこれ入れると動かない?
// #pragma GCC target("avx2,popcnt")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'010'000'000;
template <>
constexpr ll infty<ll> = 2'020'000'000'000'000'000;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * 2'000'000'000'000'000'000;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;

using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...) \
  vector<vector<vector<vector<type>>>> name(a, vector<vector<vector<type>>>(b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))

// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)

#define FOR_subset(t, s) for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define stoi stoll

int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
int popcnt_sgn(int x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
int popcnt_sgn(u32 x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
int popcnt_sgn(ll x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
int popcnt_sgn(u64 x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }

template <typename T>
T floor(T a, T b) {
  return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
  return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
  return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

template <typename T, typename U>
T SUM(const vector<U> &A) {
  T sm = 0;
  for (auto &&a: A) sm += a;
  return sm;
}

#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()

template <typename T>
T POP(deque<T> &que) {
  T a = que.front();
  que.pop_front();
  return a;
}
template <typename T>
T POP(pq<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(pqg<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(vc<T> &que) {
  T a = que.back();
  que.pop_back();
  return a;
}

template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
  if (check_ok) assert(check(ok));
  while (abs(ok - ng) > 1) {
    auto x = (ng + ok) / 2;
    (check(x) ? ok : ng) = x;
  }
  return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
  FOR(iter) {
    double x = (ok + ng) / 2;
    (check(x) ? ok : ng) = x;
  }
  return (ok + ng) / 2;
}

template <class T, class S>
inline bool chmax(T &a, const S &b) {
  return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
  return (a > b ? a = b, 1 : 0);
}

// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
  vc<int> A(S.size());
  FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
  return A;
}

template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
  int N = A.size();
  vector<T> B(N + 1);
  FOR(i, N) { B[i + 1] = B[i] + A[i]; }
  if (off == 0) B.erase(B.begin());
  return B;
}

// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
  vector<int> ids(len(A));
  iota(all(ids), 0);
  sort(all(ids), [&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
  return ids;
}

// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
  vc<T> B(len(I));
  FOR(i, len(I)) B[i] = A[I[i]];
  return B;
}

template <typename T, typename... Vectors>
void concat(vc<T> &first, const Vectors &... others) {
  vc<T> &res = first;
  (res.insert(res.end(), others.begin(), others.end()), ...);
}
#endif
#line 1 "/home/maspy/compro/library/other/io.hpp"
#define FASTIO
#include <unistd.h>

// https://judge.yosupo.jp/submission/21623
namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf
uint32_t pil = 0, pir = 0, por = 0;

struct Pre {
  char num[10000][4];
  constexpr Pre() : num() {
    for (int i = 0; i < 10000; i++) {
      int n = i;
      for (int j = 3; j >= 0; j--) {
        num[i][j] = n % 10 | '0';
        n /= 10;
      }
    }
  }
} constexpr pre;

inline void load() {
  memcpy(ibuf, ibuf + pil, pir - pil);
  pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
  pil = 0;
  if (pir < SZ) ibuf[pir++] = '\n';
}

inline void flush() {
  fwrite(obuf, 1, por, stdout);
  por = 0;
}

void rd(char &c) {
  do {
    if (pil + 1 > pir) load();
    c = ibuf[pil++];
  } while (isspace(c));
}

void rd(string &x) {
  x.clear();
  char c;
  do {
    if (pil + 1 > pir) load();
    c = ibuf[pil++];
  } while (isspace(c));
  do {
    x += c;
    if (pil == pir) load();
    c = ibuf[pil++];
  } while (!isspace(c));
}

template <typename T>
void rd_real(T &x) {
  string s;
  rd(s);
  x = stod(s);
}

template <typename T>
void rd_integer(T &x) {
  if (pil + 100 > pir) load();
  char c;
  do
    c = ibuf[pil++];
  while (c < '-');
  bool minus = 0;
  if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
    if (c == '-') { minus = 1, c = ibuf[pil++]; }
  }
  x = 0;
  while ('0' <= c) { x = x * 10 + (c & 15), c = ibuf[pil++]; }
  if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
    if (minus) x = -x;
  }
}

void rd(int &x) { rd_integer(x); }
void rd(ll &x) { rd_integer(x); }
void rd(i128 &x) { rd_integer(x); }
void rd(u32 &x) { rd_integer(x); }
void rd(u64 &x) { rd_integer(x); }
void rd(u128 &x) { rd_integer(x); }
void rd(double &x) { rd_real(x); }
void rd(long double &x) { rd_real(x); }
void rd(f128 &x) { rd_real(x); }

template <class T, class U>
void rd(pair<T, U> &p) {
  return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T>
void rd_tuple(T &t) {
  if constexpr (N < std::tuple_size<T>::value) {
    auto &x = std::get<N>(t);
    rd(x);
    rd_tuple<N + 1>(t);
  }
}
template <class... T>
void rd(tuple<T...> &tpl) {
  rd_tuple(tpl);
}

template <size_t N = 0, typename T>
void rd(array<T, N> &x) {
  for (auto &d: x) rd(d);
}
template <class T>
void rd(vc<T> &x) {
  for (auto &d: x) rd(d);
}

void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
  rd(h), read(t...);
}

void wt(const char c) {
  if (por == SZ) flush();
  obuf[por++] = c;
}
void wt(const string s) {
  for (char c: s) wt(c);
}
void wt(const char *s) {
  size_t len = strlen(s);
  for (size_t i = 0; i < len; i++) wt(s[i]);
}

template <typename T>
void wt_integer(T x) {
  if (por > SZ - 100) flush();
  if (x < 0) { obuf[por++] = '-', x = -x; }
  int outi;
  for (outi = 96; x >= 10000; outi -= 4) {
    memcpy(out + outi, pre.num[x % 10000], 4);
    x /= 10000;
  }
  if (x >= 1000) {
    memcpy(obuf + por, pre.num[x], 4);
    por += 4;
  } else if (x >= 100) {
    memcpy(obuf + por, pre.num[x] + 1, 3);
    por += 3;
  } else if (x >= 10) {
    int q = (x * 103) >> 10;
    obuf[por] = q | '0';
    obuf[por + 1] = (x - q * 10) | '0';
    por += 2;
  } else
    obuf[por++] = x | '0';
  memcpy(obuf + por, out + outi + 4, 96 - outi);
  por += 96 - outi;
}

template <typename T>
void wt_real(T x) {
  ostringstream oss;
  oss << fixed << setprecision(15) << double(x);
  string s = oss.str();
  wt(s);
}

void wt(int x) { wt_integer(x); }
void wt(ll x) { wt_integer(x); }
void wt(i128 x) { wt_integer(x); }
void wt(u32 x) { wt_integer(x); }
void wt(u64 x) { wt_integer(x); }
void wt(u128 x) { wt_integer(x); }
void wt(double x) { wt_real(x); }
void wt(long double x) { wt_real(x); }
void wt(f128 x) { wt_real(x); }

template <class T, class U>
void wt(const pair<T, U> val) {
  wt(val.first);
  wt(' ');
  wt(val.second);
}
template <size_t N = 0, typename T>
void wt_tuple(const T t) {
  if constexpr (N < std::tuple_size<T>::value) {
    if constexpr (N > 0) { wt(' '); }
    const auto x = std::get<N>(t);
    wt(x);
    wt_tuple<N + 1>(t);
  }
}
template <class... T>
void wt(tuple<T...> tpl) {
  wt_tuple(tpl);
}
template <class T, size_t S>
void wt(const array<T, S> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}
template <class T>
void wt(const vector<T> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}

void print() { wt('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
  wt(head);
  if (sizeof...(Tail)) wt(' ');
  print(forward<Tail>(tail)...);
}

// gcc expansion. called automaticall after main.
void __attribute__((destructor)) _d() { flush(); }
} // namespace fastio
using fastio::read;
using fastio::print;
using fastio::flush;

#if defined(LOCAL)
#define SHOW(...) SHOW_IMPL(__VA_ARGS__, SHOW6, SHOW5, SHOW4, SHOW3, SHOW2, SHOW1)(__VA_ARGS__)
#define SHOW_IMPL(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define SHOW1(x) print(#x, "=", (x)), flush()
#define SHOW2(x, y) print(#x, "=", (x), #y, "=", (y)), flush()
#define SHOW3(x, y, z) print(#x, "=", (x), #y, "=", (y), #z, "=", (z)), flush()
#define SHOW4(x, y, z, w) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w)), flush()
#define SHOW5(x, y, z, w, v) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v)), flush()
#define SHOW6(x, y, z, w, v, u) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v), #u, "=", (u)), flush()
#else
#define SHOW(...)
#endif

#define INT(...)   \
  int __VA_ARGS__; \
  read(__VA_ARGS__)
#define LL(...)   \
  ll __VA_ARGS__; \
  read(__VA_ARGS__)
#define U32(...)   \
  u32 __VA_ARGS__; \
  read(__VA_ARGS__)
#define U64(...)   \
  u64 __VA_ARGS__; \
  read(__VA_ARGS__)
#define STR(...)      \
  string __VA_ARGS__; \
  read(__VA_ARGS__)
#define CHAR(...)   \
  char __VA_ARGS__; \
  read(__VA_ARGS__)
#define DBL(...)      \
  double __VA_ARGS__; \
  read(__VA_ARGS__)

#define VEC(type, name, size) \
  vector<type> name(size);    \
  read(name)
#define VV(type, name, h, w)                     \
  vector<vector<type>> name(h, vector<type>(w)); \
  read(name)

void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"

/*
差分の列を考える
和が0であるような分割をなるべくたくさん作る

各マスについて:
無視してよい OR 一意に決まる!
よって差分の列は決まっている
*/

int dp[200][260][510];

void solve() {
  LL(N);
  vc<int> A;
  A.eb(0);
  FOR(i, N) {
    STR(S);
    S += S;
    vc<int> X(7);
    FOR(i, 7) X[i] = stoi(S.substr(i, 7));
    vc<int> I;
    FOR(j, 7) if (X[j] == MAX(X)) I.eb(j);
    if (len(I) == 7) continue;
    A.eb(I[0]);
  }
  A.eb(0);
  SHOW(A);
  vc<int> B;
  FOR(i, len(A) - 1) B.eb(A[i + 1] - A[i]);
  swap(A, B);
  for (auto& x: A) x = (x + 70) % 7;
  // (a,b)->(a+b) ができるときに全部 0 にするまでにかかる回数
  vc<int> F(7);
  for (auto& x: A) F[x]++;
  F[0] = 0;
  int ANS = 0;
  FOR(x, 1, 4) {
    while (F[x] > 0 && F[7 - x] > 0) {
      ++ANS;
      --F[x], --F[7 - x];
    }
  }
  vc<int> key;
  A.clear();
  FOR(x, 1, 7) {
    if (F[x] > 0) key.eb(x), A.eb(F[x]);
  }
  FOR(x, 1, 7) {
    if (F[x] > 0) continue;
    if (len(key) < 3) key.eb(x), A.eb(F[x]);
  }
  {
    auto I = argsort(A);
    A = rearrange(A, I);
    key = rearrange(key, I);
  }
  int N0 = A[0], N1 = A[1], N2 = A[2];

  vc<tuple<int, int, int>> cand;
  FOR(a, 8) FOR(b, 8) FOR(c, 8) {
    if (a + b + c > 7) break;
    if (a + b + c == 0) continue;
    int x = 0;
    x += a * key[0] + b * key[1] + c * key[2];
    if (x % 7 == 0) cand.eb(a, b, c);
  }

  dp[0][0][0] = 0;
  SHOW(ANS);
  SHOW(key);
  SHOW(A);
  SHOW(cand);
  auto dfs = [&](auto& dfs, int N0, int N1, int N2) -> int {
    int& ANS = dp[N0][N1][N2];
    if (ANS > 0) return ANS;
    for (auto& [a, b, c]: cand) {
      if (a <= N0 && b <= N1 && c <= N2) chmax(ANS, dfs(dfs, N0 - a, N1 - b, N2 - c) + 1);
    }
    return ANS;
  };
  int k = dfs(dfs, N0, N1, N2);
  SHOW(k);
  ANS += N0 + N1 + N2 - k;
  print(ANS);
}

signed main() { solve(); }

詳細信息

Test #1:

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

input:

6
9689331
1758824
3546327
5682494
9128291
9443696

output:

3

result:

ok single line: '3'

Test #2:

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

input:

7
5941186
3871463
8156346
9925977
8836125
9999999
5987743

output:

2

result:

ok single line: '2'

Test #3:

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

input:

51
3555761
7422821
8888888
5411437
7917269
4779593
8271171
5969885
6849719
1357882
4735754
5375583
5842146
9964175
5388317
8339466
3333333
7481921
6395917
6392978
5824522
9933964
4212836
3178337
1459877
1298258
5852153
8658819
2222222
4668254
9672735
7531775
9126135
8452455
6525554
9761325
6148958
2...

output:

18

result:

ok single line: '18'

Test #4:

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

input:

51
1111111
5555555
5497193
1811365
8859453
6886872
7634217
3237143
4444444
3422896
6353449
3791691
9188945
7244531
7112132
8922591
7448166
6576374
7189671
7985791
3825273
9642994
8876381
4823917
3855491
3723917
9424184
5263364
5542214
6319672
5138439
7212896
9999999
2122863
3284475
4376758
1841928
5...

output:

21

result:

ok single line: '21'

Test #5:

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

input:

51
3885762
4118864
9921617
3335965
1822764
5744394
9817478
4557176
8112546
9628449
9713863
1588215
5876996
4753245
2853457
3333333
2176772
8674961
8641232
5164675
8562597
8146869
6472344
6314241
2781648
5928614
8866321
4459945
5544153
4772424
5663954
4754993
6666666
4221456
7777777
7777777
5555555
1...

output:

21

result:

ok single line: '21'

Test #6:

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

input:

51
6396697
2523219
7231274
1715163
2928783
1981893
6899714
6245971
5434197
2243552
8174924
5555555
5865894
1111111
6136617
6426943
6187732
5555555
3519418
4457136
8417951
5597211
9777175
6984215
6547928
4175958
6729992
5341321
4444444
2223526
5768214
9868634
9587224
5587211
6167595
8376976
1412143
5...

output:

21

result:

ok single line: '21'

Test #7:

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

input:

51
3864398
3253111
1937697
5555555
5613781
7166933
1324457
9159784
2986134
9964216
5544259
1479392
2886833
7391646
5878713
7719184
9999999
9769541
3627295
1154842
5335345
7388372
3131149
5555555
9711632
4286754
5694997
3333333
2144339
6227491
9377943
4444444
3994521
5521189
4724266
6314553
7747535
8...

output:

22

result:

ok single line: '22'

Test #8:

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

input:

51
1238726
6881635
8815928
5819136
4999373
7554353
8568338
5563827
4156219
2222222
2855343
5743448
7713182
2944998
9814549
9268696
1777455
7224612
5513126
7518786
9849792
8692727
4444444
4444444
4191115
2431737
8128872
6431688
2342998
7777777
6125939
9162365
3414189
9831497
3333333
9824459
3333333
3...

output:

25

result:

ok single line: '25'

Test #9:

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

input:

51
7615668
1554548
7838368
2467759
2239731
4658292
5628288
4714388
8927558
5498392
9999999
8888888
2757577
1232975
2262325
7846755
6517255
1782411
9999999
3876119
4444444
6392116
4999576
4128895
2659852
2222222
4792892
3298654
1962473
2121433
7512856
3333333
9511678
9555285
1797148
6383958
4164727
4...

output:

20

result:

ok single line: '20'

Test #10:

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

input:

51
1285735
8857172
3466382
9245574
1615615
2367584
6975624
6666666
1666952
8849174
1936841
8794421
9623237
4597433
6689625
9246191
5185289
9418899
3871279
7944547
3116586
1111111
6712299
7364935
9937983
7154986
7847191
3333333
6435167
4761273
8781441
4568366
5662478
8742777
2478191
3447537
1111111
3...

output:

22

result:

ok single line: '22'

Test #11:

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

input:

51
1898662
5331337
3238833
2462836
8131352
6164124
3593319
3815977
9471867
6262696
3228483
6666666
9527982
9715868
2599935
2962276
2799552
9999999
8142393
3333333
8888888
3384767
4259944
4327641
5229181
9297532
2367987
1613251
9428858
6657259
3687457
4431526
2825917
8272551
2873294
2826724
7598178
2...

output:

22

result:

ok single line: '22'

Test #12:

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

input:

51
2732691
9932888
6887733
3861682
3257653
2871448
2216146
6219394
2367341
8957117
5775675
6838288
1241783
6936372
7235918
8296563
5495663
7777777
4923111
5555555
8274848
9435679
4461655
8725189
8573185
8888888
4444444
3798946
5195444
5354113
2352777
2754172
8547983
8749527
9999999
2654574
6839833
2...

output:

22

result:

ok single line: '22'

Test #13:

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

input:

501
9855186
5377477
9995239
4269513
5814449
4919345
5437349
6858875
7448293
5658363
2919227
6889698
6576467
1564438
9716731
7689782
6573576
5898873
5544874
5697242
7426272
3175551
8222953
4335851
2562859
3542296
3146239
1871825
7612561
6644996
2698228
3491284
1223565
3437956
8662475
6577889
7652283
...

output:

211

result:

ok single line: '211'

Test #14:

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

input:

501
7315431
1155621
7286394
9241797
9888184
5234699
6148135
2661694
2343419
9967944
7447676
7774774
9853969
9669751
4785115
7261323
2692775
8997531
7636868
3975313
5494471
9614158
1135881
1937315
6762717
5318224
3257327
9387668
3392585
6342959
8647441
5966959
1947341
3389988
8653817
2449934
1729731
...

output:

226

result:

ok single line: '226'

Test #15:

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

input:

501
1538397
5486846
2725362
8473155
9745259
9539136
2268619
5244651
2953717
2576983
7122574
3741214
2647473
5322229
3686571
3384482
9894855
2278164
2743225
2461822
1666734
6254168
6285333
9559662
2315516
4988245
6882624
1228191
7618237
2793382
3869588
5311688
9551194
8828441
9445131
8332364
5447512
...

output:

219

result:

ok single line: '219'

Test #16:

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

input:

501
5761285
8161464
9773717
3551779
2246655
3216943
6391458
1966779
8192525
6246918
8495267
3244687
3451518
7191126
6823194
9211395
5769238
4574791
9584222
9532633
3141846
5347659
8973215
9393992
5963797
2121414
5736444
9327353
5167879
4863124
7134387
3893278
4414959
8685335
4132524
5739687
6283282
...

output:

223

result:

ok single line: '223'

Test #17:

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

input:

501
5437387
3419651
9686648
6199693
4594294
8614818
4482159
7411718
5764754
6386495
2293131
5814915
5926843
9471699
1947678
7118323
9749712
4581252
7447721
8452184
7694582
9968263
4892597
3343473
3958318
1481742
1513617
5447639
7343192
2275952
6889446
6872229
7157835
2796514
8269986
6722268
3365979
...

output:

223

result:

ok single line: '223'

Test #18:

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

input:

501
5173266
2695272
1157418
4172411
1877985
7588368
1665151
3695589
4987956
7976777
4729527
6159788
3866922
8354748
6937136
3963615
6693171
1257238
9823243
2586821
4399717
7344651
4916423
5341274
1584127
6934595
3732329
6626562
9618834
5356672
3948455
5478351
3699473
1999353
1896525
2242516
8811346
...

output:

224

result:

ok single line: '224'

Test #19:

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

input:

501
3752381
3486725
1297884
4385331
1192681
2536631
5177346
9819587
5687333
5388998
6871523
4331357
7446744
1413223
9355766
6637188
5776852
1147728
6312227
1191377
3953877
8797245
5422681
7736473
6644625
7683322
5857143
5557933
5768341
8874357
6753337
2726881
2633885
7735429
3691258
3259149
6855259
...

output:

222

result:

ok single line: '222'

Test #20:

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

input:

501
5191541
6729978
2312133
3595482
1831669
7667832
5126562
9977282
3717561
5579638
8751393
3552437
4695931
7739983
4484451
4261361
7178823
3123914
3743993
6576394
5648574
3637175
4431282
7849638
9273148
3389399
7534689
8255335
4756493
2566479
4157478
8168532
2932752
9163961
4994247
8858328
9623626
...

output:

225

result:

ok single line: '225'

Test #21:

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

input:

501
9715269
5133283
5537258
6126971
7113749
6876964
3737429
7334222
1126133
4261437
9237545
4485496
7869991
5533396
2785495
3665269
1862151
3597979
7397231
3383546
2769138
2298816
9499839
1756125
2454687
5316645
8743195
9784114
9348192
1245723
2425689
5113147
3738573
3739418
1938913
2243871
6822865
...

output:

225

result:

ok single line: '225'

Test #22:

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

input:

501
9697366
2789615
3859492
4851398
1236615
4658246
3526631
2995224
4112645
6148347
6922226
4356596
4933239
2469168
6833597
7696582
4216712
2737555
6295484
5847274
8443256
8851128
5138215
1686913
1712545
6869772
9779761
8223237
4589894
8189481
4283995
3623991
5398224
3864237
9123515
5681728
1791898
...

output:

213

result:

ok single line: '213'

Test #23:

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

input:

501
2311443
9578199
8738639
9878365
3972513
6371544
2114342
3478932
5926895
3414336
7567373
6842235
5594351
4167626
9763994
2376284
4553869
9145752
1991672
7283517
4219655
4577926
2844797
3135257
7675461
4986924
7793237
1356243
5655967
1244593
3321447
9718647
3953582
1384766
8249954
2653663
1482697
...

output:

429

result:

ok single line: '429'

Test #24:

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

input:

501
1441131
3538817
3911397
8848823
4292167
1375928
2422749
7817331
6648543
2161493
8575622
2573225
4545972
7953429
1863246
3729828
2482684
8722833
8183673
9161944
6247189
8993373
1859331
1378594
9856494
3493511
4574926
5938129
3935384
2319258
1535264
7561461
2492831
5491942
1686349
7915675
4125113
...

output:

429

result:

ok single line: '429'

Test #25:

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

input:

501
6884388
7642513
5685681
1739947
6413994
3436428
9726834
1764713
8288618
1129678
2945797
9654285
4391561
5194985
7318184
9863845
1833821
6485336
4443746
7886729
9995984
1851714
2329173
5622277
9516474
4973735
2492864
9134997
6551791
7154336
8952877
8219531
3611462
5865679
9767945
6989534
5678556
...

output:

395

result:

ok single line: '395'

Test #26:

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

input:

501
3852423
5554775
9392744
5118847
6957389
6171715
7152486
3916821
7815937
8532784
4729723
7327728
3676117
2667281
6721316
4513943
8747867
5259758
8256959
6797575
4537483
7853261
6161635
9613174
6329631
5141578
6292815
6147198
6988828
7866937
9941596
1747736
9487229
4699589
5716577
3636243
2446933
...

output:

429

result:

ok single line: '429'

Test #27:

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

input:

501
7899879
4787491
7221358
6697917
6369663
7315689
8387141
5466676
8863638
5484275
2789932
5381168
9772632
7886853
4738943
1614563
6852628
9612524
7924342
9565976
5617493
1883153
8892121
5779412
2132842
2342351
5452539
9254354
3469451
5488978
9413123
2128233
5566821
9418473
6831163
8897396
1748253
...

output:

359

result:

ok single line: '359'

Test #28:

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

input:

501
8466232
6198383
2294954
7767613
9169742
6492249
7937576
1556763
9756569
5996559
3312777
7515716
7189562
6914779
8958384
4629163
1355382
2991731
2136515
5372181
9992396
9139236
2634576
9624935
9719875
3715447
2927318
8574982
9559382
4869742
6674529
1881752
5442883
7731678
4931435
3349772
8849429
...

output:

356

result:

ok single line: '356'

Test #29:

score: 0
Accepted
time: 95ms
memory: 56732kb

input:

501
5385256
6658463
4175769
9894514
7239938
4716138
1973311
6688228
3819846
7152547
1974891
2347224
2874489
5961524
3929729
7926958
2427583
6512522
2927811
6389736
7353999
9928456
1619588
1567911
3546829
2838167
3739437
3613916
9964364
3192386
3149296
7931877
7121834
1442729
8664325
3552131
1279948
...

output:

360

result:

ok single line: '360'

Test #30:

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

input:

501
2672584
2254512
6565638
1138648
7262413
1826937
6887184
4231174
3487545
7178349
8259864
9651738
7572971
3854127
4342692
6491286
1833329
3268232
7671174
4415941
1711464
8281595
5784572
5633539
1247651
7441143
1253857
5715543
6472493
2694586
1142378
2426132
9941836
4241643
3765615
5361493
6699229
...

output:

430

result:

ok single line: '430'

Test #31:

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

input:

501
3115537
9465655
7883226
4444453
1196833
7622118
7629255
9535744
7956687
5354161
3236518
3539778
5793957
1337393
8939549
9736374
8116923
7132293
7785234
2153659
6619113
4435815
4932218
7542382
1254869
4267152
4852981
6165599
6683959
6919365
2866916
3133166
7821889
9538478
7993438
1846697
2796131
...

output:

394

result:

ok single line: '394'

Test #32:

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

input:

501
3526551
5532272
9837567
2242444
8923452
3591299
5495784
7846965
2878112
1778587
9967951
1696212
3636168
2579478
7747642
2399927
5123734
5189159
7958795
8849535
8854124
9199859
6164449
2119953
9943474
9815996
7388659
3873747
6779226
7711535
5293711
2561913
9532529
7977465
7418187
9585514
8396538
...

output:

392

result:

ok single line: '392'

Test #33:

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

input:

501
7711654
5191962
4992641
3793462
8739996
7537836
8868738
8119849
9231433
5273573
4593539
8553544
9493965
3854564
6251171
8115318
9677462
4274412
4479169
5736421
9499218
6658379
3649456
9835121
2343828
2354137
5928116
1218518
5452682
4221369
1589347
6443471
1474233
9179372
7483588
9722923
1392624
...

output:

334

result:

ok single line: '334'

Test #34:

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

input:

501
5918965
9271562
6441857
7541331
4617655
9755159
2559853
9594188
4158425
6767438
5229993
5676138
1291883
3563475
8931472
3611868
9897376
3479565
9536514
1358382
9857116
4257657
9456412
5568858
9852111
6635975
9255725
6779381
9487254
4914982
3885365
4425492
6963215
6221265
2732351
1261887
8934235
...

output:

262

result:

ok single line: '262'

Test #35:

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

input:

501
2948942
2195812
7356575
1331689
8552126
3669517
9913118
3259748
6781429
9665723
4961611
2176261
2869533
8516821
2144753
9883723
2842842
1828193
8698759
1789797
6823999
9761438
1128275
4734935
3664435
4152396
5791573
6321469
7259287
9619474
7758883
9712434
6843433
2352843
8431677
4778998
1999984
...

output:

311

result:

ok single line: '311'

Test #36:

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

input:

501
9955584
5171954
9757834
4337254
4183869
4883248
5716743
1478789
5858233
6527223
2422357
5479591
8472788
7771562
3581475
7674668
7529851
8157422
3559871
1231859
5831312
8694965
9683682
8513976
3776354
7258484
5538593
4875648
8131864
9523483
1579532
9694677
1165413
8727993
4222148
9359435
5355646
...

output:

305

result:

ok single line: '305'

Test #37:

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

input:

501
6333967
1994298
3265435
5663148
5129148
1251682
9112827
5467924
1487759
1935215
6698132
1665178
9329625
3334826
9653398
8212554
7898339
2142886
5284486
8727419
3415522
8611347
8228315
7273199
2421212
5127686
7588143
9719775
7482784
9884781
4715989
5361569
9858496
8538675
4455218
3458325
5583669
...

output:

328

result:

ok single line: '328'

Test #38:

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

input:

501
2747568
3131751
5792168
9961117
8393294
3429581
2923432
3754559
6872915
3598597
5532154
6157498
6219424
2826756
2639139
8126947
7792663
9963188
7692198
7518635
7986836
5562449
1127993
2153442
9629317
3337186
1549343
5777221
5484569
1367916
8386771
9165912
5545262
1758572
2973228
6523769
7584861
...

output:

429

result:

ok single line: '429'

Test #39:

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

input:

501
2712847
4366381
2144849
9793731
2445473
3632259
9792332
8798199
4468884
1957874
4684821
7328732
5947377
8294331
9972794
6972948
2893939
7679869
2935516
3783567
9347743
6483292
4281448
5844858
2788692
3285729
6513422
1455273
5238261
2954348
6491637
8261571
6434474
1163468
4447884
3525365
1517233
...

output:

355

result:

ok single line: '355'

Test #40:

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

input:

501
7261922
1181172
9133715
4815599
3548883
6928874
2783839
6918468
2239662
2954699
4118755
6569299
3138845
3977217
8941559
4868271
7471418
7761986
3344347
3973432
3415117
1856873
2218539
4991742
6443259
3965982
7156179
1997771
4848865
8128796
8716744
5427172
7754523
7797973
8321212
8293746
5112714
...

output:

256

result:

ok single line: '256'

Test #41:

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

input:

501
8116496
6444259
5247961
6514194
9184467
1951223
7679485
4763681
9145834
1646412
2683639
5611876
4318169
8979425
7138879
2451962
7763194
3627537
5872416
7192851
4683961
1291864
7768636
3314277
6279842
8243487
6269251
7161945
8536297
9649312
1765536
7294534
4141964
6597792
9825753
3341264
9363869
...

output:

311

result:

ok single line: '311'

Test #42:

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

input:

501
5653343
5451639
2375981
2892818
9339172
6566477
6679876
9766589
1592134
8641484
8926592
6864213
4616959
9741221
1282198
2969984
4874746
4893429
2564343
8352676
1189172
6152279
8599315
6355483
4419165
1847452
2771854
1782671
7133386
7912176
2381866
8176664
7749191
5661524
5948962
8768377
6161691
...

output:

393

result:

ok single line: '393'

Test #43:

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

input:

501
2437278
8142991
9738438
1427585
7248317
1232952
4597811
8153483
6838653
8938672
2784622
4336574
8138619
6891574
9312634
8954187
4532348
5392482
6778657
1967591
4737329
3374342
5474585
1862373
5761942
9598377
1144254
2382168
4513978
4371456
7667146
3886578
8148359
9153826
6958554
4674578
5422937
...

output:

358

result:

ok single line: '358'

Test #44:

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

input:

501
2624377
1945826
3455478
1878364
1267317
1142117
2281234
3681944
3361119
5969323
4759218
8624188
8264536
8399341
9223831
6172666
8856937
1554117
4627847
1397549
5673997
8153461
1596435
7928974
4334334
7685921
9216213
8486767
7422623
8497654
4141847
6357219
2377931
9164919
6411934
2322617
4925713
...

output:

316

result:

ok single line: '316'

Test #45:

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

input:

501
9999483
7369463
1868285
8241973
3181449
6894671
6648926
1297783
7344183
5529997
3223833
7381141
5226886
9325657
6569278
6874746
4325823
3146592
6148715
2851541
1596773
8821292
8683525
5286334
9573195
1861837
6835982
5664747
4995262
1428125
8892945
6787692
5339459
2155445
2366387
8613227
7578595
...

output:

308

result:

ok single line: '308'

Test #46:

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

input:

501
5258297
4391211
8554459
3315968
3914318
6376899
2128252
2935691
8418278
1279491
9897285
7386697
1799351
1181339
6682956
4295119
9732754
6426915
9699881
4287219
3337811
2524433
3518687
4367535
1971721
5553829
2727457
9125211
3137787
6589261
3832165
2841784
4869621
9853636
2444913
7582781
9443585
...

output:

354

result:

ok single line: '354'

Test #47:

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

input:

501
4595586
6187169
9549143
2737785
5296588
4168671
8247137
5937612
5442159
2889875
6532613
4763725
5894461
9467591
6527491
4783274
4138642
1535214
3561531
3737771
9538672
3466746
6433185
6556238
8156264
1272958
4894132
9623527
2324815
5984527
1912792
2528627
1823574
6765199
1787355
7674371
8973478
...

output:

360

result:

ok single line: '360'

Test #48:

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

input:

501
4243262
5155311
7643887
5496331
2651138
4148534
4254185
5452133
4433481
7549232
8383356
1217788
8439792
7882737
8547395
5451321
2177586
5534413
6817842
1191849
9824328
6212593
5478824
3287393
2328466
5122444
7681667
5347964
3774574
3175286
6582575
7111911
4955732
1184679
5911634
6879116
7411576
...

output:

309

result:

ok single line: '309'

Test #49:

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

input:

501
3198214
1343763
4985611
1184178
4218671
5812386
2536454
2865251
2585581
6191982
8966559
5138243
8877948
3526288
5669788
7541511
7593745
8684484
7193772
3537835
8583149
1624918
6123268
2437734
6214963
5842241
5499983
3156924
3946751
6418294
3181312
9788341
4273942
9194911
3459588
5944526
1588288
...

output:

317

result:

ok single line: '317'

Test #50:

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

input:

501
4233939
2726952
9461334
1188951
7757723
2658292
1798717
5432778
3626871
2884812
6949497
2818884
5835362
5142699
5769754
5454116
7196676
5316718
2699276
7412532
6236452
9383351
4655685
1396813
9284476
5411892
1238822
4657119
3781724
6177787
2832632
7253936
5751726
8618318
3587932
8223376
7639435
...

output:

318

result:

ok single line: '318'

Test #51:

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

input:

501
2749399
2729352
4673846
1785295
9539993
8224646
7933135
6881914
8164716
4932966
4741234
3791494
6825776
1611949
4366183
4878183
2143513
1713173
1616344
9867219
4559549
8562456
6358462
9161262
8976868
8495446
8656341
6554584
7946945
8692854
8346535
3157162
5825865
3993163
1261847
9983526
8633989
...

output:

307

result:

ok single line: '307'

Test #52:

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

input:

501
9982866
1452251
4157549
2592156
9227879
6397117
9475339
4168578
6316134
4148515
5684139
2946426
9492529
3714671
3526747
7527324
5479853
9775358
5773287
9348831
6236782
2796195
1122713
7236114
7412867
8859229
9498623
9966525
4554395
9788364
9139464
1483687
5848174
6527331
5425193
9693388
6549296
...

output:

259

result:

ok single line: '259'

Test #53:

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

input:

501
8693843
9659667
5871976
9673637
1672642
8863864
7576937
8884527
6151286
6945241
6768954
7687217
9981328
1352691
6878341
7648396
5664434
7764228
3659928
8675674
4225823
1882548
2793764
4737179
7598357
6914931
5791181
9181738
7698545
3555943
5998384
5868419
8187174
9187647
7362477
8514515
6886852
...

output:

285

result:

ok single line: '285'

Test #54:

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

input:

501
3317787
1524857
3719172
1394234
5942935
7675672
4652679
4867593
4151916
2718372
3565522
4921341
9616768
9173559
6423793
7724995
9189724
8788325
1981186
9874361
5847739
2446476
8283927
5339674
5695314
3611532
9965346
3738318
5816692
2251872
5329168
1799346
8985976
8631612
9953669
6644366
5631642
...

output:

430

result:

ok single line: '430'

Test #55:

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

input:

501
8568381
2634462
9284132
8231239
8273462
5717539
9581124
6885168
9598413
1734547
7317156
5444129
9548636
8914919
3532177
6878992
7379624
5653776
1559559
2241755
7811196
7512319
4241172
2815378
9868881
7516257
6314362
6681168
5211799
4525663
6871897
7826518
9127327
3886454
2164413
6838533
6522938
...

output:

252

result:

ok single line: '252'

Test #56:

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

input:

501
4569732
2275413
7893952
3715428
6311191
9844271
8287877
7246744
4238145
2697598
9625121
6197661
6263915
9429732
3493616
2722997
8312169
6813484
5442969
7616738
6953892
9359986
1791678
8132983
5241369
1352463
8786723
8492128
4514991
4546153
3691313
8972794
9467458
2372458
6441593
8877973
3217746
...

output:

360

result:

ok single line: '360'

Test #57:

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

input:

501
2928155
9613475
1382289
5815682
3132347
9117674
1725448
1367595
5384985
1664898
1135638
2144364
6513367
9177644
7787142
7882757
6459326
6586522
2738412
1936899
7445871
9649958
7814847
7838881
3311976
3258369
5235794
3552889
2353355
1222888
4661459
2465171
3214625
9253889
9634771
5937543
3687461
...

output:

311

result:

ok single line: '311'

Test #58:

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

input:

501
3139498
1474826
9874245
8839857
4185338
2565471
2853122
9292214
4849835
7625757
4722682
1721162
8717346
6669693
2686144
7841454
9565338
4929854
1299381
5227595
2948138
9877393
6545316
5593413
1856713
9256561
8828169
1595532
2214564
8235938
5769669
7861278
2793933
2921483
6326125
4326818
2383417
...

output:

394

result:

ok single line: '394'

Test #59:

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

input:

501
7448945
7763112
8768729
8637242
4334818
8655463
2544528
8843781
4654144
2778951
9926936
8771568
2877399
1137989
9431646
6976673
3334936
9634514
1947849
7434956
9385124
7841559
5174344
2669988
7163872
1274794
8714478
2172323
7718786
8861818
3237188
8122882
4592199
9558976
9445875
3189143
2538932
...

output:

309

result:

ok single line: '309'

Test #60:

score: 0
Accepted
time: 93ms
memory: 57060kb

input:

501
9917849
2851697
9921833
5212238
2885281
4179367
4399469
3954184
9239986
9354269
7892214
4313554
8113465
6686314
1442878
9231489
7692752
4734151
6725927
8322771
2339664
6854539
2945214
7379712
4187832
7538897
9891493
2117326
5157267
7426492
4973469
4412741
8675615
8623849
2364216
2947799
7426833
...

output:

359

result:

ok single line: '359'

Test #61:

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

input:

501
1893264
1456252
4839496
4338933
3742785
6998533
5394756
5248166
5356577
6165739
7936292
1261333
6936887
2694735
8975692
3528522
3417897
5674946
4936679
8894261
3282786
5417689
7328297
1242914
7217559
3787424
4749137
4873889
4771372
6749214
9648985
5182879
4777731
7669133
5397265
5669157
2784661
...

output:

306

result:

ok single line: '306'

Test #62:

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

input:

501
2682714
7315637
2278545
8352163
5685968
2856231
6622361
5411257
4148764
9254714
4875991
6981213
6957896
5454831
4966556
9965735
3411619
2426188
4613832
7815476
9636664
2863389
9529596
3225924
9189251
8437267
2335885
5815231
7332252
1657468
1345683
7781616
7922523
9897192
1233548
2932298
6599216
...

output:

360

result:

ok single line: '360'

Test #63:

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

input:

501
6233398
7769289
8128514
6296935
4337658
9818681
7945281
5214332
2532334
9418576
2687968
6652377
5696831
2945885
2791723
9451839
8657383
7867716
6752497
7245928
1817262
9987846
1852284
6584776
4648554
9145857
6311346
8327376
4927861
8834416
6917421
3695624
9536949
8546296
6688725
1128326
4582613
...

output:

315

result:

ok single line: '315'

Test #64:

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

input:

501
4838984
7467646
9892723
3255426
8944518
5511566
2311925
6639853
9718151
8247869
6279594
1799546
6946274
1449323
3687225
7968988
5539896
8747335
7283649
2158356
9661794
4584843
7432775
4331149
5422495
5497151
3872317
8415714
5272863
4318225
1476526
6171726
4178852
5885498
5693214
6125764
6447713
...

output:

356

result:

ok single line: '356'

Test #65:

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

input:

501
2742796
9299719
4124738
3992121
8785453
5894386
1925892
8248631
6367797
7197662
6957629
8853877
2947537
9714191
8791161
8982964
7737388
3316269
2822123
5227323
8765985
3439669
4388353
1747262
3465196
3867946
6837286
5785983
2223577
9557385
2352814
5337151
1876936
2268257
9699416
3421644
8234768
...

output:

320

result:

ok single line: '320'

Test #66:

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

input:

501
5772831
1469334
2261779
3474664
5568138
4728672
8313562
5756851
9954411
1385479
2549776
4166749
4715681
3854577
9574932
7222589
7322792
1522744
9359675
2291743
7886135
4747698
4875989
1766376
2831295
5755554
3942499
6743952
3755346
5733948
8269683
1111239
4695213
2414335
2385382
8983978
8316787
...

output:

316

result:

ok single line: '316'

Test #67:

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

input:

501
7941945
8445194
2795145
1632111
9656638
3939469
2293763
7212694
4699748
1335472
4471937
3759379
3383987
1319364
2853914
5638262
3284963
8339748
7587642
5315729
6188687
8149542
7674158
2429448
9813296
5169943
7581179
5468598
6712346
8247194
8627459
9465226
4863957
2138122
7791226
1833181
6267976
...

output:

254

result:

ok single line: '254'

Test #68:

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

input:

501
3979992
6649298
6793564
5955594
1227917
5249174
4252477
7125995
1253869
5127493
6542155
9298649
2986315
4576858
1829746
7885788
6199725
1373797
1292762
4885669
2638232
7841791
1414878
1966414
3931998
3812879
1292647
2914246
7219953
9929359
6199876
2767894
8713131
2581427
1313958
2979496
1331574
...

output:

311

result:

ok single line: '311'

Test #69:

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

input:

501
7384849
4877752
9928296
8618773
2621963
4572329
4675277
1198976
5231924
2123317
4719558
4484241
2624916
3221478
6762374
6292131
5142843
4712696
6938865
2175915
5372638
5719632
2892884
2969434
9388418
1663889
1997993
5471766
9692867
4356996
2885744
3677667
1561924
8594469
9751456
1674133
2554644
...

output:

283

result:

ok single line: '283'

Test #70:

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

input:

501
2561669
4112531
5149354
2971183
9552389
1256845
4787163
2935592
9997211
7264627
1213393
7753941
2698166
5747444
8648819
6435797
7283927
8679572
4163244
8653157
2237197
7229968
4783775
9717791
6887697
9515951
1398911
7998199
9886642
2683649
4124611
3728172
4965721
7623869
3455255
6519665
6698139
...

output:

394

result:

ok single line: '394'

Test #71:

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

input:

501
5498367
1979885
8931181
9377455
5746533
8281649
9931526
6436359
3522497
3428951
1926795
7138121
3394922
2874228
6487483
5885658
9854145
6592598
7357468
2665754
7678821
1154123
8366425
5813413
8877567
7927929
4754846
8815291
2472923
1185118
8976387
9333321
3468491
3318752
1345989
5148535
5495575
...

output:

304

result:

ok single line: '304'

Test #72:

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

input:

501
5925941
4366124
6612355
6476891
9257863
6522347
3444696
4549172
5928173
6619734
6584314
3776673
8354442
6164838
3681996
8329978
2866571
9187277
9551298
5168972
5429962
2199963
5445656
3797637
8952792
2919938
1512121
8449966
3712155
9564368
1497925
7567242
7256447
2723177
9671962
6583367
9366946
...

output:

313

result:

ok single line: '313'

Test #73:

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

input:

501
2376947
5297789
9449445
9144294
3658369
9136213
3154294
3626764
1531282
8675972
5178362
4286974
3373495
6281219
7991997
8323395
7539211
8215932
8459213
1634283
1338373
4997588
1748247
8927441
3147219
9965923
6954756
7411734
7964274
2534226
6111797
6446549
7831699
9319965
2941816
9645888
5858582
...

output:

257

result:

ok single line: '257'

Test #74:

score: 0
Accepted
time: 76ms
memory: 55988kb

input:

501
1821742
7287974
5539965
5934457
3634378
2281287
2786878
2198982
5416397
4985691
8556779
4695832
1953449
9826686
7274849
2296551
5968792
6717819
4772792
3845915
9791293
9964539
1488185
7423388
1559679
7591139
5331543
8262576
4636727
4452944
7264412
6187579
8271188
4639568
7824161
3831528
8668193
...

output:

337

result:

ok single line: '337'

Test #75:

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

input:

501
5919169
1398679
2289525
1742871
4236784
5792953
8594371
9822763
9466496
3458847
9563966
7454544
7813436
6651532
2343317
2515593
5239223
5856555
9814386
5777365
7723349
5135978
3698362
1148166
1477632
8559911
5951192
7379529
2552918
4438244
2917481
4484266
2848641
3716226
8897163
8717715
2418124
...

output:

328

result:

ok single line: '328'

Test #76:

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

input:

501
6984915
6246877
5897687
7355746
6928749
2851899
2983654
9183666
8436868
3995382
9638395
5569463
4979597
7838442
5935167
3827946
8429135
8955622
8858744
3384469
7975597
5993586
3335234
4997923
5117625
2986932
5825239
7588957
4451618
3898691
9393667
8796549
2864465
4371367
2887526
4219886
1583189
...

output:

324

result:

ok single line: '324'

Test #77:

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

input:

501
2362788
3493991
8684532
2372589
9146153
5573163
2852623
6147675
1916765
3372862
8472811
4339198
5216113
9177295
1276158
7995517
8448272
1497299
4573859
6721436
4613712
4589576
2111387
7239747
6453516
2724121
8591966
8289413
7248749
4885974
4732282
9477656
7285438
9741533
4347329
7425827
9736237
...

output:

287

result:

ok single line: '287'

Test #78:

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

input:

501
9783537
4638934
1952741
7133571
3327332
6635163
8785694
2513918
3458813
5676255
8585857
5431979
6974589
9587938
4665954
2896629
9689237
5914459
1568951
6859832
2393487
9653162
4214668
6313813
3299158
9768737
6461376
5627872
2844767
4271375
3359784
6844283
8591297
4458741
5376415
3376648
5919916
...

output:

356

result:

ok single line: '356'

Test #79:

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

input:

501
1449686
9465885
3581497
6468447
5216764
2284561
9465768
1935914
7173174
2573734
5947159
6441918
3969425
5546267
8318325
9934444
7257282
3347646
8281116
1379299
2247336
1977133
9997917
9816769
5758787
5615813
1488666
5963192
7497793
3537321
5971791
6255551
5125758
2259186
8596521
6999749
9635479
...

output:

303

result:

ok single line: '303'

Test #80:

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

input:

501
1455276
1215311
7372653
6555779
4884731
6495659
2263885
5326138
8262977
5383411
8913211
9944587
2783325
7562835
4117463
3522499
2642942
5878438
1679455
4552372
4724972
8948283
9835384
6135674
1576861
4869857
1566331
5754216
1668398
3727643
9828526
6684218
1187294
4218976
2554355
7412693
5422344
...

output:

306

result:

ok single line: '306'

Test #81:

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

input:

501
7228549
1266484
8639936
9695221
8889129
8358747
3924583
6593757
8916147
7332111
9599783
3958951
1518367
2895986
2484273
6766189
4232747
4759222
4621176
1355968
7673549
7359363
2362224
8166757
2623284
3818527
3811957
8597859
3747837
8249667
7392999
2443272
7189386
1846646
1482475
7671213
3171867
...

output:

291

result:

ok single line: '291'

Test #82:

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

input:

501
4416868
3772751
4333516
6195563
9327393
6955526
5626848
5614622
1816473
8598559
7369482
4959122
8512539
4228725
8294684
9986429
6558926
8874582
8672795
3858736
1695348
7551115
3364184
4828312
9132882
3132247
4262275
8579386
9388817
5246236
7159583
4582527
8952388
8227397
4931628
5554372
7762985
...

output:

322

result:

ok single line: '322'

Test #83:

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

input:

501
9835558
5415658
5522814
3639861
6397863
5221516
7249636
5283555
9817799
5712971
4668522
9372922
8892294
2782481
8549616
5167957
7888463
5155845
4134675
4916277
1327813
1274312
2217793
6814775
5263342
9444789
6722587
5957355
8545185
8255349
1428332
9362476
1279737
6425424
1246781
5537589
9218462
...

output:

283

result:

ok single line: '283'

Test #84:

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

input:

501
1682244
9911713
3635429
6948842
8377242
6518376
1814382
4981978
5372418
3279739
9552281
4134457
1733187
2365928
6487312
2746699
9728568
5713861
4491541
5256338
5911773
5467121
6823618
4933494
8782236
2317924
3395834
8827511
7411999
5796124
8924415
6818377
6266251
5811757
8949791
3386265
5647887
...

output:

279

result:

ok single line: '279'

Test #85:

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

input:

501
2895255
9291715
1964668
4448864
2153847
7973235
3559265
6572887
9585548
4695895
5972748
6382498
4212865
2552676
7832741
6652534
1519836
9394448
7524443
1448944
7751894
6181741
7631213
8362962
6835929
1281577
6631138
4451584
9568465
7973424
6381643
4974824
1435828
1651437
8226582
5625651
3319375
...

output:

253

result:

ok single line: '253'

Test #86:

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

input:

501
7777777
7777777
5555555
6666666
4444444
8888888
5555555
4444444
9999999
3333333
9999999
9999999
5555555
7777777
5555555
7777777
2222222
3333333
6666666
5555555
5555555
8888888
6666666
9999999
3333333
8888888
1111111
6666666
7777777
2222222
6666666
5555555
6666666
9999999
1111111
3333333
4444444
...

output:

1

result:

ok single line: '1'