url
stringlengths 49
92
| description
stringlengths 22
4.78k
| cases
listlengths 0
6
|
---|---|---|
https://atcoder.jp/contests/newjudge-2308-algorithm/tasks/abc260_f | Problem Statement
We have a simple undirected graph
G
with
(S+T)
vertices and
M
edges. The vertices are numbered
1
through
(S+T)
, and the edges are numbered
1
through
M
. Edge
i
connects Vertices
u_i
and
v_i
.
Here, vertex sets
V_1 = \lbrace 1, 2,\dots, S\rbrace
and
V_2 = \lbrace S+1, S+2, \dots, S+T \rbrace
are both independent sets.
A cycle of length
4
is called a 4-cycle.
If
G
contains a 4-cycle, choose any of them and print the vertices in the cycle. You may print the vertices in any order.
If
G
does not contain a 4-cycle, print
-1
.
What is an independent set?
An independent set of a graph
G
is a set
V'
of some of the vertices in
G
such that no two vertices of
V'
have an edge between them. | [
{
"input": "2 3 5\n1 3\n1 4\n1 5\n2 4\n2 5\n",
"output": "1 2 4 5\n"
},
{
"input": "3 2 4\n1 4\n1 5\n2 5\n3 5\n",
"output": "-1\n"
},
{
"input": "4 5 9\n3 5\n1 8\n3 7\n1 9\n4 6\n2 7\n4 8\n1 7\n2 9\n",
"output": "1 7 2 9\n"
}
] |
https://atcoder.jp/contests/newjudge-2308-algorithm/tasks/abc254_g | Problem Statement
There is a complex composed of
N
10^9
-story skyscrapers. The skyscrapers are numbered
1
to
N
, and the floors are numbered
1
to
10^9
.
From any floor of any skyscraper, one can use a skybridge to get to the same floor of any other skyscraper in one minute.
Additionally, there are
M
elevators. The
i
-th elevator runs between Floor
B_i
and Floor
C_i
of Skyscraper
A_i
. With this elevator, one can get from Floor
x
to Floor
y
of Skyscraper
A_i
in
|x-y|
minutes, for every pair of integers
x,y
such that
B_i \le x,y \le C_i
.
Answer the following
Q
queries.
Determine whether it is possible to get from Floor
Y_i
of Skyscraper
X_i
to Floor
W_i
of Skyscraper
Z_i
, and find the shortest time needed to get there if it is possible. | [
{
"input": "3 4 3\n1 2 10\n2 3 7\n3 9 14\n3 1 3\n1 3 3 14\n3 1 2 7\n1 100 1 101\n",
"output": "12\n7\n-1\n"
},
{
"input": "1 1 1\n1 1 2\n1 1 1 2\n",
"output": "1\n"
}
] |
https://atcoder.jp/contests/newjudge-2308-algorithm/tasks/abc294_h | Problem Statement
You are given a simple undirected graph with
N
vertices numbered
1
to
N
and
M
edges numbered
1
to
M
. Edge
i
connects vertex
u_i
and vertex
v_i
.
Find the number, modulo
998244353
, of ways to write an integer between
1
and
K
, inclusive, on each vertex of this graph to satisfy the following condition:
two vertices connected by an edge always have different numbers written on them. | [
{
"input": "4 3 2\n1 2\n2 4\n2 3\n",
"output": "2\n"
},
{
"input": "4 0 10\n",
"output": "10000\n"
},
{
"input": "5 10 5\n3 5\n1 3\n1 2\n1 4\n3 4\n2 5\n4 5\n1 5\n2 3\n2 4\n",
"output": "120\n"
},
{
"input": "5 6 294\n1 2\n2 4\n1 3\n2 3\n4 5\n3 5\n",
"output": "838338733\n"
},
{
"input": "7 12 1000000000\n4 5\n2 7\n3 4\n6 7\n3 5\n5 6\n5 7\n1 3\n4 7\n1 5\n2 3\n3 6\n",
"output": "418104233\n"
}
] |
https://atcoder.jp/contests/codequeen2023-final-open/tasks/codequeen2023_final_a | 問題文
文字列
S
と文字
c
が与えられます。
文字列
S
のすべての文字
x
に対して、以下の操作を同時に一度だけ行ってできる文字列を出力してください。
x
が
c
と等しいとき、
x
を
xx
に置き換える。そうでないときは何もしない。 | [
{
"input": "quen\ne\n",
"output": "queen\n"
},
{
"input": "kenkoo\no\n",
"output": "kenkoooo\n"
},
{
"input": "abracadabra\na\n",
"output": "aabraacaadaabraa\n"
}
] |
https://atcoder.jp/contests/codequeen2023-final-open/tasks/codequeen2023_final_b | 問題文
縦に
N
マス、横に
N
マスからなる、マス目状に区切られた盤面があります。上から
i
番目
(1 \leq i \leq N)
、左から
j
番目
(1 \leq j \leq N)
のマスを、マス
(i, j)
と呼ぶことにします。
盤面には
N-1
個のクイーンが配置されており、
i
番目のクイーンはマス
(r_i, c_i)
にあります。
ここで、盤面が次の条件を満たすとき、盤面は
良い状態
です。
盤面上のどの縦・横・斜め 45 度のマス目の列を見ても、クイーンが
2
つ以上存在しない。
また、与えられる盤面は
良い状態
であることが保証されます。
この盤面に対して、
良い状態
を保ちつつクイーンを追加で
1
個配置することができるかを判定し、できる場合は配置する位置を出力してください。 | [
{
"input": "5\n5 5\n3 1\n1 2\n4 3\n",
"output": "2 4\n"
},
{
"input": "5\n2 5\n3 1\n1 2\n4 4\n",
"output": "-1\n"
}
] |
https://atcoder.jp/contests/codequeen2023-final-open/tasks/codequeen2023_final_c | 問題文
頂点に
1, 2, \ldots, N
の番号がついた
N
頂点の木と、頂点の番号
S, T
が与えられます。
i = 1, 2, \ldots, N-1
について、
i
番目の辺は頂点
u_i
と頂点
v_i
を結んでいます。
木のそれぞれの頂点
j
について、以下の質問に答えてください。
頂点
S
から頂点
j
までの最短経路に含まれる頂点集合(頂点
S
や頂点
j
を含む)と、頂点
T
から頂点
j
までの最短経路に含まれる頂点集合(頂点
T
や頂点
j
を含む)の両方に属する頂点の数はいくつでしょうか? | [
{
"input": "11 1 4\n1 2\n2 3\n3 5\n3 6\n2 4\n4 7\n1 8\n8 9\n8 10\n9 11\n",
"output": "1\n1\n2\n1\n3\n3\n2\n2\n3\n3\n4\n"
}
] |
https://atcoder.jp/contests/codequeen2023-final-open/tasks/codequeen2023_final_d | 問題文
縦に
R
マス、横に
C
マスからなる、マス目状に区切られた盤面があります。上から
i
番目
(1 \leq i \leq R)
、左から
j
番目
(1 \leq j \leq C)
のマスを、マス
(i, j)
と呼ぶことにします。
現在マス
(r_s, c_s)
に
1
個のクイーンが配置されています。 以下の行動を
三回
繰り返した時、 クイーンが
(r_t, c_t)
にある様な動き方は何通りありますか。
クイーンを盤面上の現在配置されているマスを含む縦・横・斜め 45 度のマス目の列上の
他のマス
に移動する(現在配置されているマスに留まることはできない) | [
{
"input": "3 3 1 1 3 3\n",
"output": "29\n"
},
{
"input": "3 3 2 2 2 2\n",
"output": "40\n"
},
{
"input": "100000 100000 1 1 100000 100000\n",
"output": "10001499973\n"
}
] |
https://atcoder.jp/contests/codequeen2023-final-open/tasks/codequeen2023_final_e | 問題文
長さ
N
の数列
A = \left( a_1, a_2, \ldots, a_N \right)
が与えられます。
この数列を、いくつかの連続する空でない部分列
B_1, B_2, \ldots, B_K
に分割することを考えます。たとえば、
A = (5, -3, 6, 2, 4)
のとき、
A
の分割の例は以下のとおりです。
B_1 = (5), B_2 = (-3, 6, 2), B_3 = (4)
B_1 = (5, -3), B_2 = (6, 2, 4)
B_1 = (5, -3, 6, 2, 4)
部分列
B_i
の
スコア
S \left( B_i \right)
を、
B_i
に含まれる項の最大値と最小値の差
\max B_i - \min B_i
と定義します。
A
を最適に分割したときの、部分列のスコアの和
\sum_i S \left( B_i \right)
の最大値を求めてください。 | [
{
"input": "9\n1 2 2 4 5 2 3 4 1\n",
"output": "9\n"
},
{
"input": "12\n3 -1 4 1 5 -9 2 6 5 -3 5 9\n",
"output": "37\n"
}
] |
https://atcoder.jp/contests/codequeen2023-final-open/tasks/codequeen2023_final_f | 問題文
以下の条件を満たす様に二次元平面上に
N
個の点
P_1
,
P_2
,
\ldots
,
P_N
を置きます。この条件の元、
N
角形
P_1 P_2 \dots P_N
の面積の最大値を求めてください。ただし、原点と点
P_i
を結ぶ直線の
x
軸正の向きとのなす角を
\theta_i\ \mathrm{rad}
とします。
i
番目の点
P_i
は原点を中心とする半径
R_i
の円周上に存在する
与えられる
R
は、
\displaystyle R_1 = R_N
かつ
\displaystyle R_1, R_N \leq R_i
(1 \leq i \leq N)
を満たすことが保証されます
\displaystyle \frac{\pi}{2N} \leq \theta_{i+1} -\theta_{i}
(1 \leq i \leq N-1)
(14:07 修正)
\displaystyle \theta_1 = 0
,
\displaystyle \theta_N = \frac{2\pi}{3}
\displaystyle x\ \mathrm{rad}
の定義
半径が
1
で弧の長さが
x
である様な扇形の中心角を
\displaystyle x\ \mathrm{rad}
と定義します。
\displaystyle x\ \mathrm{rad}
は
\displaystyle \frac{180}{\pi} x
度と等しい角度となります。 | [
{
"input": "3\n1 1 1\n",
"output": "0.433012701892219\n"
},
{
"input": "7\n1 2 1 3 1 2 1\n",
"output": "2.147031208123904\n"
}
] |
https://atcoder.jp/contests/abc313/tasks/abc313_a | Problem Statement
There are
N
people numbered
1
through
N
.
Each person has a integer score called programming ability; person
i
's programming ability is
P_i
points.
How many more points does person
1
need, so that person
1
becomes the strongest?
In other words, what is the minimum non-negative integer
x
such that
P_1 + x > P_i
for all
i \neq 1
? | [
{
"input": "4\n5 15 2 10\n",
"output": "11\n"
},
{
"input": "4\n15 5 2 10\n",
"output": "0\n"
},
{
"input": "3\n100 100 100\n",
"output": "1\n"
}
] |
https://atcoder.jp/contests/abc313/tasks/abc313_b | Problem Statement
There are
N
competitive programmers numbered person
1
, person
2
,
\ldots
, and person
N
.
There is a relation called
superiority
between the programmers. For all pairs of distinct programmers
(
person
X
, person
Y
)
, exactly one of the following two relations holds: "person
X
is stronger than person
Y
" or "person
Y
is stronger than person
X
."
The superiority is
transitive
. In other words, for all triplets of distinct programmers
(
person
X
, person
Y
, person
Z
)
, it holds that:
if person
X
is stronger than person
Y
and person
Y
is stronger than person
Z
, then person
X
is stronger than person
Z
.
A person
X
is said to be the
strongest programmer
if person
X
is stronger than person
Y
for all people
Y
other than person
X
. (Under the constraints above, we can prove that there is always exactly one such person.)
You have
M
pieces of information on their superiority. The
i
-th of them is that "person
A_i
is stronger than person
B_i
."
Can you determine the strongest programmer among the
N
based on the information?
If you can, print the person's number. Otherwise, that is, if there are multiple possible strongest programmers, print
-1
. | [
{
"input": "3 2\n1 2\n2 3\n",
"output": "1\n"
},
{
"input": "3 2\n1 3\n2 3\n",
"output": "-1\n"
},
{
"input": "6 6\n1 6\n6 5\n6 2\n2 3\n4 3\n4 2\n",
"output": "-1\n"
}
] |
https://atcoder.jp/contests/abc313/tasks/abc313_c | Problem Statement
You are given an integer sequence
A=(A_1,A_2,\dots,A_N)
.
You can perform the following operation any number of times (possibly zero).
Choose integers
i
and
j
with
1\leq i,j \leq N
. Decrease
A_i
by one and increase
A_j
by one.
Find the minimum number of operations required to make the difference between the minimum and maximum values of
A
at most one. | [
{
"input": "4\n4 7 3 7\n",
"output": "3\n"
},
{
"input": "1\n313\n",
"output": "0\n"
},
{
"input": "10\n999999997 999999999 4 3 2 4 999999990 8 999999991 999999993\n",
"output": "2499999974\n"
}
] |
https://atcoder.jp/contests/abc313/tasks/abc313_d | Problem Statement
This is an
interactive task
(where your program and the judge interact via Standard Input and Output).
You are given an integer
N
and an
odd number
K
.
The judge has a hidden length-
N
sequence
A = (A_1, A_2, \dots, A_N)
consisting of
0
and
1
.
While you cannot directly access the elements of sequence
A
,
you are allowed to ask the judge the following query at most
N
times.
Choose distinct integers
x_1, x_2, \dots
, and
x_K
between
1
and
N
, inclusive, to ask the parity of
A_{x_1} + A_{x_2} + \dots + A_{x_K}
.
Determine
(A_1, A_2, \dots, A_N)
by at most
N
queries, and print the answer.
Here,
the judge is adaptive
. In other words, the judge may modify the contents of
A
as long as it is consistent with the responses to the past queries.
Therefore, your program is considered correct if the output satisfies the following condition, and incorrect otherwise:
your program prints a sequence consistent with the responses to the queries so far, and that is the only such sequence. | [] |
https://atcoder.jp/contests/abc313/tasks/abc313_e | Problem Statement
For a string
S
consisting of digits from
1
through
9
, let
f(S)
be the string
T
obtained by the following procedure. (
S_i
denotes the
i
-th character of
S
.)
Let
T
be an initially empty string.
For
i=1, 2, \dots, |S| - 1
, perform the following operation:
Append
n
copies of
S_i
to the tail of
T
, where
n
is the value when
S_{i+1}
is interpreted as an integer.
For example,
S =
313
yields
f(S) =
3111
by the following steps.
T
is initially empty.
For
i=1
, we have
n = 1
. Append one copy of
3
to
T
, which becomes
3
.
For
i=2
, we have
n = 3
. Append three copies of
1
to
T
, which becomes
3111
.
Terminate the procedure. We obtain
T =
3111
.
You are given a length-
N
string
S
consisting of digits from
1
through
9
.
You repeat the following operation until the length of
S
becomes
1
: replace
S
with
f(S)
.
Find how many times, modulo
998244353
, you perform the operation until you complete it. If you will repeat the operation indefinitely, print
-1
instead. | [
{
"input": "3\n313\n",
"output": "4\n"
},
{
"input": "9\n123456789\n",
"output": "-1\n"
},
{
"input": "2\n11\n",
"output": "1\n"
}
] |
https://atcoder.jp/contests/abc313/tasks/abc313_f | Problem Statement
There are
N
cards numbered
1
through
N
.
Each face of a card has an integer written on it; card
i
has
A_i
on its front and
B_i
on its back.
Initially, all cards are face up.
There are
M
machines numbered
1
through
M
.
Machine
j
has two (not necessarily distinct) integers
X_j
and
Y_j
between
1
and
N
. If you power up machine
j
,
it flips card
X_j
with the probability of
\frac{1}{2}
, and flips card
Y_j
with the remaining probability of
\frac{1}{2}
.
This probability is independent for each power-up.
Snuke will perform the following procedure.
Choose a set
S
consisting of integers from
1
through
M
.
For each element in
S
in ascending order, power up the machine with that number.
Among Snuke's possible choices of
S
, find the maximum expected value of the sum of the integers written on the face-up sides of the cards after the procedure. | [
{
"input": "3 1\n3 10\n10 6\n5 2\n1 2\n",
"output": "19.500000\n"
},
{
"input": "1 3\n5 100\n1 1\n1 1\n1 1\n",
"output": "100.000000\n"
},
{
"input": "8 10\n6918 9211\n16 1868\n3857 8537\n3340 8506\n6263 7940\n1449 4593\n5902 1932\n310 6991\n4 4\n8 6\n3 5\n1 1\n4 2\n5 6\n7 5\n3 3\n1 5\n3 1\n",
"output": "45945.000000\n"
}
] |
https://atcoder.jp/contests/abc313/tasks/abc313_g | Problem Statement
There are
N
plates numbered
1
through
N
. Dish
i
has
a_i
stones on it. There is also an empty bag.
You can perform the following two kinds of operations any number of times (possibly zero) in any order.
Remove one stone from each plate with one or more stones. Put the removed stones into the bag.
Take
N
stones out of the bag, and put one stone to each plate. This operation can be performed only when the bag has
N
or more stones.
Let
b_i
be the number of stones on plate
i
after you finished the operations. Print the number, modulo
998244353
, of sequences of integers
(b_1, b_2, \dots, b_N)
of length
N
that can result from the operations. | [
{
"input": "3\n3 1 3\n",
"output": "7\n"
},
{
"input": "1\n0\n",
"output": "1\n"
},
{
"input": "5\n1 3 5 7 9\n",
"output": "36\n"
},
{
"input": "10\n766294629 440423913 59187619 725560240 585990756 965580535 623321125 550925213 122410708 549392044\n",
"output": "666174028\n"
}
] |
https://atcoder.jp/contests/abc313/tasks/abc313_h | Problem Statement
(2N+1)
people are forming two rows to take a group photograph.
There are
N
people in the front row; the
i
-th of them has a height of
A_i
.
There are
(N+1)
people in the back row; the
i
-th of them has a height of
B_i
.
It is guaranteed that the heights of the
(2N+1)
people are distinct.
Within each row, we can freely rearrange the people.
Suppose that the heights of the people in the front row are
a_1,a_2,\dots,a_N
from the left, and those in the back row are
b_1,b_2,\dots,b_{N+1}
from the left.
This arrangement is said to be
good
if all of the following conditions are satisfied:
a_i < b_i
or
a_{i-1} < b_i
for all
i\ (2 \leq i \leq N)
.
a_1 < b_1
.
a_N < b_{N+1}
.
Among the
N!
ways to rearrange the front row, how many of them, modulo
998244353
, are such ways that we can rearrange the back row to make the arrangement good? | [
{
"input": "3\n1 12 6\n4 3 10 9\n",
"output": "2\n"
},
{
"input": "1\n5\n1 10\n",
"output": "0\n"
},
{
"input": "10\n189330739 910286918 802329211 923078537 492686568 404539679 822804784 303238506 650287940 1\n125660016 430302156 982631932 773361868 161735902 731963982 317063340 880895728 1000000000 707723857 450968417\n",
"output": "3542400\n"
}
] |
https://atcoder.jp/contests/agc063/tasks/agc063_a | Problem Statement
You are given a string of length
N+1
consisting of
A
and
B
:
S = S_0\cdots S_N
.
For each
k=1, \ldots, N
, solve the following problem.
Alice and Bob will play a game using a set
X
, which is initially empty. For
t=1,\ldots, k
in this order, they will do the following action:
if
t
is odd, Alice will choose a non-negative integer
x
and replace
X
with
X\cup \{x\}
;
if
t
is even, Bob will choose a non-negative integer
x
and replace
X
with
X\cup \{x\}
.
Let
x
be
\mathrm{mex}(X)
after all
k
actions. If the character
S_x
is
A
, Alice wins; if
S_x
is
B
, Bob wins. Note that
X
has at most
k
elements, so
x = \mathrm{mex}(X) \leq k
and the character
S_x
exists.
Print the name of the winner when both players play optimally.
What is
\mathrm{mex}(X)
?
For a finite set
X
consisting of non-negative integers,
\mathrm{mex}(X)
is the smallest non-negative integer
x
such that
x\notin X
. | [
{
"input": "2\nABB\n",
"output": "Alice\nBob\n"
},
{
"input": "4\nAAAAA\n",
"output": "Alice\nAlice\nAlice\nAlice\n"
},
{
"input": "7\nBBAABABA\n",
"output": "Bob\nBob\nAlice\nBob\nAlice\nBob\nAlice\n"
}
] |
https://atcoder.jp/contests/agc063/tasks/agc063_b | Problem Statement
A sequence
a = (a_1, \ldots, a_n)
consisting of positive integers is said to be
generatable
when one can obtain
a
by repeating the following operation on an empty sequence.
Operation: Choose a positive integer
k
, and insert
(1, 2, \ldots, k-1, k)
into some position in the sequence. More formally, for a sequence
a = (a_1, \ldots, a_m)
, choose an integer
i
such that
0\leq i\leq m
and a positive integer
k
, and replace
a
with
(a_1,\ldots,a_{i}, 1, 2, \ldots, k-1, k, a_{i+1}, \ldots, a_m)
.
For instance,
a = (1,2,1,1,2,1,3,4,2,3)
is generatable. Here is one way to generate it:
() \to (\boldsymbol{1,2}) \to (1,2,\boldsymbol{1,2,3}) \to (1,2,1,\boldsymbol{1,2,3,4},2,3) \to (1,2,1,1,2,\boldsymbol{1},3,4,2,3).
You are given a sequence
A = (A_1, \ldots, A_N)
consisting of positive integers. Find the number of pairs of integers
(L, R)
such that:
1\leq L\leq R\leq N
and the contiguous subsequence
(A_L, \ldots, A_R)
is generatable. | [
{
"input": "6\n1 2 1 2 1 3\n",
"output": "11\n"
},
{
"input": "5\n1 1 1 1 1\n",
"output": "15\n"
},
{
"input": "7\n1 2 1 2 1 3 4\n",
"output": "13\n"
}
] |
https://atcoder.jp/contests/agc063/tasks/agc063_c | Problem Statement
You are given sequences of non-negative integers:
A = (A_1, \ldots, A_N)
and
B=(B_1, \ldots, B_N)
.
Determine whether one can make
A
equal
B
by performing the following operation between
0
and
N
times, inclusive.
Operation: Choose integers
x,y
such that
0\leq x < y\leq 10^{18}
. For every
i
, replace
A_i
with
(A_i+x)\bmod y
.
If one can make
A
equal
B
, print one way to do so. | [
{
"input": "4\n7 2 4 5\n3 3 5 0\n",
"output": "Yes\n2\n3 5\n3 6\n"
},
{
"input": "1\n5\n3\n",
"output": "Yes\n1\n2 4\n"
},
{
"input": "2\n3 1\n3 1\n",
"output": "Yes\n0\n"
},
{
"input": "2\n0 0\n1 2\n",
"output": "No\n"
}
] |
https://atcoder.jp/contests/agc063/tasks/agc063_d | Problem Statement
You are given positive integers
N, a, b, c, d
.
Determine whether there is a non-negative integer
x
such that
x\equiv a+kb \pmod{c+kd}
for every
k=0,1,\ldots,N-1
. If it exists, find the smallest such
x
modulo
998244353
. | [
{
"input": "2 1 2 3 4\n",
"output": "10\n"
},
{
"input": "2 1 1 10 10\n",
"output": "-1\n"
},
{
"input": "100 20 30 2 3\n",
"output": "0\n"
},
{
"input": "9 12 34 56 78\n",
"output": "827501367\n"
}
] |
https://atcoder.jp/contests/agc063/tasks/agc063_e | Problem Statement
There is a rooted tree with
N
vertices numbered
1
to
N
. Vertex
1
is the root, and the parent of vertex
i
(
2\leq i\leq N
) is
P_i
.
You are given a non-negative integer
r
and a sequence of non-negative integers
A = (A_1, \ldots, A_N)
. You can perform the following operation on the sequence any number of times, possibly zero.
Choose an
i
such that
i\geq 2
and
A_i \geq 1
. Replace
A_i
with
A_i - 1
and
A_{P_i}
with
A_{P_i}+r
.
Find the number, modulo
998244353
, of possible final states of the sequence
A
. | [
{
"input": "3\n1 1\n2\n1 1 1\n",
"output": "4\n"
},
{
"input": "3\n1 2\n1\n1 1 1\n",
"output": "5\n"
},
{
"input": "3\n1 2\n2\n1 1 1\n",
"output": "6\n"
},
{
"input": "5\n1 1 3 3\n2\n0 1 0 1 2\n",
"output": "48\n"
},
{
"input": "5\n1 1 3 3\n123456789\n1 2 3 4 5\n",
"output": "87782255\n"
}
] |
https://atcoder.jp/contests/agc063/tasks/agc063_f | Problem Statement
You are given pairs of non-negative integers
a = (a_1,a_2)
and
b = (b_1,b_2)
.
You can perform the following operation on the pair
a
any number of times, possibly zero.
Operation: Choose a
positive real number
x
. Replace
a = (a_1,a_2)
with
(\lfloor a_1x\rfloor, \lfloor a_2x\rfloor)
.
Your objective is to make the pair
a
equal the pair
b
. Determine whether it is achievable. If it is, find the minimum number of times you must perform the operation to achieve it.
You have
T
test cases to solve. | [
{
"input": "7\n2 3 1 1\n1 1 2 3\n3 2 9 8\n12 34 56 78\n56 78 12 34\n87 65 43 21\n43 21 87 65\n",
"output": "1\n-1\n3\n-1\n4\n2\n-1\n"
},
{
"input": "9\n5 5 5 5\n5 5 3 3\n3 9 0 2\n3 9 0 3\n0 3 3 9\n3 0 2 0\n5 2 0 0\n0 0 5 2\n0 0 0 0\n",
"output": "0\n1\n1\n2\n-1\n1\n1\n-1\n0\n"
}
] |
https://atcoder.jp/contests/abc312/tasks/abc312_a | Problem Statement
Given a length-
3
string
S
consisting of uppercase English letters, print
Yes
if
S
equals one of
ACE
,
BDF
,
CEG
,
DFA
,
EGB
,
FAC
, and
GBD
; print
No
otherwise. | [
{
"input": "ABC\n",
"output": "No\n"
},
{
"input": "FAC\n",
"output": "Yes\n"
},
{
"input": "XYX\n",
"output": "No\n"
}
] |
https://atcoder.jp/contests/abc312/tasks/abc312_b | Problem Statement
Takahashi invented Tak Code, a two-dimensional code. A TaK Code satisfies all of the following conditions:
It is a region consisting of nine horizontal rows and nine vertical columns.
All the
18
cells in the top-left and bottom-right three-by-three regions are black.
All the
14
cells that are adjacent (horizontally, vertically, or diagonally) to the top-left or bottom-right three-by-three region are white.
It is not allowed to rotate a TaK Code.
You are given a grid with
N
horizontal rows and
M
vertical columns.
The state of the grid is described by
N
strings,
S_1,\ldots
, and
S_N
, each of length
M
. The cell at the
i
-th row from the top and
j
-th column from the left is black if the
j
-th character of
S_i
is
#
, and white if it is
.
.
Find all the nine-by-nine regions, completely contained in the grid, that satisfy the conditions of a TaK Code. | [
{
"input": "19 18\n###......###......\n###......###......\n###..#...###..#...\n..............#...\n..................\n..................\n......###......###\n......###......###\n......###......###\n.###..............\n.###......##......\n.###..............\n............###...\n...##.......###...\n...##.......###...\n.......###........\n.......###........\n.......###........\n........#.........\n",
"output": "1 1\n1 10\n7 7\n10 2\n"
},
{
"input": "9 21\n###.#...........#.###\n###.#...........#.###\n###.#...........#.###\n....#...........#....\n#########...#########\n....#...........#....\n....#.###...###.#....\n....#.###...###.#....\n....#.###...###.#....\n",
"output": "1 1\n"
},
{
"input": "18 18\n######............\n######............\n######............\n######............\n######............\n######............\n..................\n..................\n..................\n..................\n..................\n..................\n............######\n............######\n............######\n............######\n............######\n............######\n",
"output": "\n"
}
] |
https://atcoder.jp/contests/abc312/tasks/abc312_c | Problem Statement
There are
N
sellers and
M
buyers in an apple market.
The
i
-th seller may sell an apple for
A_i
yen or more (yen is the currency in Japan).
The
i
-th buyer may buy an apple for
B_i
yen or less.
Find the minimum integer
X
that satisfies the following condition.
Condition: The number of people who may sell an apple for
X
yen is greater than or equal to the number of people who may buy an apple for
X
yen. | [
{
"input": "3 4\n110 90 120\n100 80 120 10000\n",
"output": "110\n"
},
{
"input": "5 2\n100000 100000 100000 100000 100000\n100 200\n",
"output": "201\n"
},
{
"input": "3 2\n100 100 100\n80 120\n",
"output": "100\n"
}
] |
https://atcoder.jp/contests/abc312/tasks/abc312_d | Problem Statement
You are given a non-empty string
S
consisting of
(
,
)
, and
?
.
There are
2^x
ways to obtain a new string by replacing each
?
in
S
with
(
and
)
, where
x
is the number of occurrences of
?
in
S
. Among them, find the number, modulo
998244353
, of ways that yield a
parenthesis string
.
A string is said to be a parenthesis string if one of the following conditions is satisfied.
It is an empty string.
It is a concatenation of
(
,
A
, and
)
, for some parenthesis string
A
.
It is a concatenation of
A
and
B
, for some non-empty parenthesis strings
A
and
B
. | [
{
"input": "(???(?\n",
"output": "2\n"
},
{
"input": ")))))\n",
"output": "0\n"
},
{
"input": "??????????????(????????(??????)?????????(?(??)\n",
"output": "603032273\n"
}
] |
https://atcoder.jp/contests/abc312/tasks/abc312_e | Problem Statement
There are
N
rectangular cuboids in a three-dimensional space.
These cuboids do not overlap. Formally, for any two different cuboids among them, their intersection has a volume of
0
.
The diagonal of the
i
-th cuboid is a segment that connects two points
(X_{i,1},Y_{i,1},Z_{i,1})
and
(X_{i,2},Y_{i,2},Z_{i,2})
, and its edges are all parallel to one of the coordinate axes.
For each cuboid, find the number of other cuboids that share a face with it.
Formally, for each
i
, find the number of
j
with
1\leq j \leq N
and
j\neq i
such that the intersection of the surfaces of the
i
-th and
j
-th cuboids has a positive area. | [
{
"input": "4\n0 0 0 1 1 1\n0 0 1 1 1 2\n1 1 1 2 2 2\n3 3 3 4 4 4\n",
"output": "1\n1\n0\n0\n"
},
{
"input": "3\n0 0 10 10 10 20\n3 4 1 15 6 10\n0 9 6 1 20 10\n",
"output": "2\n1\n1\n"
},
{
"input": "8\n0 0 0 1 1 1\n0 0 1 1 1 2\n0 1 0 1 2 1\n0 1 1 1 2 2\n1 0 0 2 1 1\n1 0 1 2 1 2\n1 1 0 2 2 1\n1 1 1 2 2 2\n",
"output": "3\n3\n3\n3\n3\n3\n3\n3\n"
}
] |
https://atcoder.jp/contests/abc312/tasks/abc312_f | Problem Statement
There are
N
items.
Each of these is one of a pull-tab can, a regular can, or a can opener.
The
i
-th item is described by an integer pair
(T_i, X_i)
as follows:
If
T_i = 0
, the
i
-th item is a pull-tab can; if you obtain it, you get a happiness of
X_i
.
If
T_i = 1
, the
i
-th item is a regular can; if you obtain it and use a can opener against it, you get a happiness of
X_i
.
If
T_i = 2
, the
i
-th item is a can opener; it can be used against at most
X_i
cans.
Find the maximum total happiness that you get by obtaining
M
items out of
N
. | [
{
"input": "8 4\n0 6\n0 6\n1 3\n1 5\n1 15\n2 1\n2 10\n2 100\n",
"output": "27\n"
},
{
"input": "5 5\n1 5\n1 5\n1 5\n1 5\n1 5\n",
"output": "0\n"
},
{
"input": "12 6\n2 2\n0 1\n0 9\n1 3\n1 5\n1 3\n0 4\n2 1\n1 8\n2 1\n0 1\n0 4\n",
"output": "30\n"
}
] |
https://atcoder.jp/contests/abc312/tasks/abc312_g | Problem Statement
You are given a tree with
N
vertices. The vertices are numbered from
1
through
N
, and the
i
-th edge connects vertex
A_i
and vertex
B_i
.
Find the number of tuples of integers
(i,j,k)
such that:
1 \leq i < j < k \leq N
; and
the given tree does not contain a simple path that contains all of vertices
i
,
j
, and
k
. | [
{
"input": "5\n1 2\n2 3\n2 4\n1 5\n",
"output": "2\n"
},
{
"input": "6\n1 2\n2 3\n3 4\n4 5\n5 6\n",
"output": "0\n"
},
{
"input": "12\n1 6\n3 4\n10 4\n5 9\n3 1\n2 3\n7 2\n2 12\n1 5\n6 8\n4 11\n",
"output": "91\n"
}
] |
https://atcoder.jp/contests/abc312/tasks/abc312_h | Problem Statement
Takahashi is going to decide nicknames of
N
people, person
1,\ldots,N
.
Person
i
wants a nickname
S_i
. To avoid giving the same nickname to multiple people, he is going to decide their nicknames as follows:
For each
i=1,\ldots,N
in order, decide person
i
's nickname as follows:
Initialize a variable
k_i
with
1
.
Repeatedly increment
k_i
by one while the
k_i
-time repetition of
S_i
is someone's nickname.
Let person
i
's nickname be the
k_i
-time repetition of
S_i
.
Find
k_1,\ldots
, and
k_N
after deciding nicknames of the
N
people. | [
{
"input": "3\nsnuke\nsnuke\nrng\n",
"output": "1 2 1\n"
},
{
"input": "4\naa\na\na\naaa\n",
"output": "1 1 3 2\n"
},
{
"input": "5\nx\nx\nx\nx\nx\n",
"output": "1 2 3 4 5\n"
}
] |
https://atcoder.jp/contests/abc311/tasks/abc311_a | Problem Statement
You are given a string
S
consisting of
A
,
B
, and
C
.
S
is guaranteed to contain all of
A
,
B
, and
C
.
If the characters of
S
are checked one by one from the left, how many characters will have been checked when the following condition is satisfied for the first time?
All of
A
,
B
, and
C
have appeared at least once. | [
{
"input": "5\nACABB\n",
"output": "4\n"
},
{
"input": "4\nCABC\n",
"output": "3\n"
},
{
"input": "30\nAABABBBABABBABABCABACAABCBACCA\n",
"output": "17\n"
}
] |
https://atcoder.jp/contests/abc311/tasks/abc311_b | Problem Statement
There are
N
people numbered
1
to
N
.
You are given their schedule for the following
D
days. The schedule for person
i
is represented by a string
S_i
of length
D
. If the
j
-th character of
S_i
is
o
, person
i
is free on the
j
-th day; if it is
x
, they are occupied that day.
From these
D
days, consider choosing some
consecutive
days when all the people are free.
How many days can be chosen at most? If no day can be chosen, report
0
. | [
{
"input": "3 5\nxooox\noooxx\noooxo\n",
"output": "2\n"
},
{
"input": "3 3\noxo\noxo\noxo\n",
"output": "1\n"
},
{
"input": "3 3\noox\noxo\nxoo\n",
"output": "0\n"
},
{
"input": "1 7\nooooooo\n",
"output": "7\n"
},
{
"input": "5 15\noxooooooooooooo\noxooxooooooooox\noxoooooooooooox\noxxxooooooxooox\noxooooooooxooox\n",
"output": "5\n"
}
] |
https://atcoder.jp/contests/abc311/tasks/abc311_c | Problem Statement
There is a directed graph with
N
vertices and
N
edges.
The
i
-th edge goes from vertex
i
to vertex
A_i
. (The constraints guarantee that
i \neq A_i
.)
Find a directed cycle without the same vertex appearing multiple times.
It can be shown that a solution exists under the constraints of this problem.
Notes
The sequence of vertices
B = (B_1, B_2, \dots, B_M)
is called a directed cycle when all of the following conditions are satisfied:
M \geq 2
The edge from vertex
B_i
to vertex
B_{i+1}
exists.
(1 \leq i \leq M-1)
The edge from vertex
B_M
to vertex
B_1
exists.
If
i \neq j
, then
B_i \neq B_j
. | [
{
"input": "7\n6 7 2 1 3 4 5\n",
"output": "4\n7 5 3 2\n"
},
{
"input": "2\n2 1\n",
"output": "2\n1 2\n"
},
{
"input": "8\n3 7 4 7 3 3 8 2\n",
"output": "3\n2 7 8\n"
}
] |
https://atcoder.jp/contests/abc311/tasks/abc311_d | Problem Statement
There is an
N \times M
grid and a player standing on it.
Let
(i,j)
denote the square at the
i
-th row from the top and
j
-th column from the left of this grid.
Each square of this grid is ice or rock, which is represented by
N
strings
S_1,S_2,\dots,S_N
of length
M
as follows:
if the
j
-th character of
S_i
is
.
, square
(i,j)
is ice;
if the
j
-th character of
S_i
is
#
, square
(i,j)
is rock.
The outer periphery of this grid (all squares in the
1
-st row,
N
-th row,
1
-st column,
M
-th column) is rock.
Initially, the player rests on the square
(2,2)
, which is ice.
The player can make the following move zero or more times.
First, specify the direction of movement: up, down, left, or right.
Then, keep moving in that direction until the player bumps against a rock. Formally, keep doing the following:
if the next square in the direction of movement is ice, go to that square and keep moving;
if the next square in the direction of movement is rock, stay in the current square and stop moving.
Find the number of ice squares the player can touch (pass or rest on). | [
{
"input": "6 6\n######\n#....#\n#.#..#\n#..#.#\n#....#\n######\n",
"output": "12\n"
},
{
"input": "21 25\n#########################\n#..............###...####\n#..............#..#...###\n#........###...#...#...##\n#........#..#..#........#\n#...##...#..#..#...#....#\n#..#..#..###...#..#.....#\n#..#..#..#..#..###......#\n#..####..#..#...........#\n#..#..#..###............#\n#..#..#.................#\n#........##.............#\n#.......#..#............#\n#..........#....#.......#\n#........###...##....#..#\n#..........#..#.#...##..#\n#.......#..#....#..#.#..#\n##.......##.....#....#..#\n###.............#....#..#\n####.................#..#\n#########################\n",
"output": "215\n"
}
] |
https://atcoder.jp/contests/abc311/tasks/abc311_e | Problem Statement
There is a grid with
H
rows and
W
columns. Let
(i, j)
denote the square at the
i
-th row from the top and
j
-th column from the left of the grid.
Each square of the grid is holed or not. There are exactly
N
holed squares:
(a_1, b_1), (a_2, b_2), \dots, (a_N, b_N)
.
When the triple of positive integers
(i, j, n)
satisfies the following condition, the square region whose top-left corner is
(i, j)
and whose bottom-right corner is
(i + n - 1, j + n - 1)
is called a
holeless square
.
i + n - 1 \leq H
.
j + n - 1 \leq W
.
For every pair of non-negative integers
(k, l)
such that
0 \leq k \leq n - 1, 0 \leq l \leq n - 1
, square
(i + k, j + l)
is not holed.
How many holeless squares are in the grid? | [
{
"input": "2 3 1\n2 3\n",
"output": "6\n"
},
{
"input": "3 2 6\n1 1\n1 2\n2 1\n2 2\n3 1\n3 2\n",
"output": "0\n"
},
{
"input": "1 1 0\n",
"output": "1\n"
},
{
"input": "3000 3000 0\n",
"output": "9004500500\n"
}
] |
https://atcoder.jp/contests/abc311/tasks/abc311_f | Problem Statement
There is an
N \times M
grid and a player standing on it.
Let
(i,j)
denote the square at the
i
-th row from the top and
j
-th column from the left of this grid.
Each square of this grid is black or white, which is represented by
N
strings
S_1,S_2,\dots,S_N
of length
M
as follows:
if the
j
-th character of
S_i
is
.
, square
(i,j)
is white;
if the
j
-th character of
S_i
is
#
, square
(i,j)
is black.
The grid is said to be
beautiful
when the following condition is satisfied.
For every pair of integers
(i,j)
such that
1 \le i \le N, 1 \le j \le M
, if square
(i,j)
is black, the square under
(i,j)
and the square to the immediate lower right of
(i,j)
are also black (if they exist).
Formally, all of the following are satisfied.
If square
(i,j)
is black and square
(i+1,j)
exists, square
(i+1,j)
is also black.
If square
(i,j)
is black and square
(i+1,j+1)
exists, square
(i+1,j+1)
is also black.
Takahashi can paint zero or more white squares black, and he will do so to make the grid beautiful.
Find the number of different beautiful grids he can make, modulo
998244353
.
Two grids are considered different when there is a square that has different colors in those two grids. | [
{
"input": "2 2\n.#\n..\n",
"output": "3\n"
},
{
"input": "5 5\n....#\n...#.\n..#..\n.#.#.\n#...#\n",
"output": "92\n"
},
{
"input": "25 25\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n.........................\n",
"output": "604936632\n"
}
] |
https://atcoder.jp/contests/abc311/tasks/abc311_g | Problem Statement
There is an
N \times M
grid, where the square at the
i
-th row from the top and
j
-th column from the left has a non-negative integer
A_{i,j}
written on it.
Let us choose a rectangular region
R
.
Formally, the region is chosen as follows.
Choose integers
l_x, r_x, l_y, r_y
such that
1 \le l_x \le r_x \le N, 1 \le l_y \le r_y \le M
.
Then, square
(i,j)
is in
R
if and only if
l_x \le i \le r_x
and
l_y \le j \le r_y
.
Find the maximum possible value of
f(R) =
(the sum of integers written on the squares in
R
)
\times
(the smallest integer written on a square in
R
). | [
{
"input": "3 3\n5 4 3\n4 3 2\n3 2 1\n",
"output": "48\n"
},
{
"input": "4 5\n3 1 4 1 5\n9 2 6 5 3\n5 8 9 7 9\n3 2 3 8 4\n",
"output": "231\n"
},
{
"input": "6 6\n1 300 300 300 300 300\n300 1 300 300 300 300\n300 300 1 300 300 300\n300 300 300 1 300 300\n300 300 300 300 1 300\n300 300 300 300 300 1\n",
"output": "810000\n"
}
] |
https://atcoder.jp/contests/abc311/tasks/abc311_h | Problem Statement
There is a rooted tree
T
with
N
vertices numbered
1
to
N
. The root is vertex
1
, and the parent of vertex
i
(2 \leq i \leq N)
is
P_i
.
Each vertex has two non-negative integer values called
beauty
and
weight
. The beauty and weight of vertex
i
are
B_i
and
W_i
, respectively.
Additionally, each vertex is painted red or blue. The color of vertex
i
is represented by an integer
C_i
: vertex
i
is painted red if
C_i = 0
, and blue if
C_i = 1
.
For vertex
v
, let
F(v)
be the answer to the following problem.
Let
U
be the rooted tree that is the subtree of
T
rooted at
v
.
You can perform the following sequence of operations on
U
zero or more times. (The operations do not affect the beauties, weights, or colors of the vertices that are not being deleted.)
Choose a vertex
c
other than the root. Let
p
be the parent of
c
.
For each edge whose endpoint on the parent side is
c
, do the following:
Let
u
be the endpoint of the edge other than
c
. Delete the edge and connect
p
and
u
with a new edge, with
p
on the parent side.
Delete the vertex
c
, and the edge connecting
p
and
c
.
A rooted tree that can be obtained as
U
after some operations is called a
good rooted tree
when all of the following conditions are satisfied.
For every edge in
U
, the edge's endpoints have different colors.
The vertices have a total weight of at most
X
.
Find the maximum possible total beauty of the vertices in a good rooted tree.
Find all of
F(1), F(2), \dots, F(N)
. | [
{
"input": "4 10\n1 2 2\n2 1 0\n4 2 1\n6 8 0\n7 4 1\n",
"output": "9\n10\n6\n7\n"
},
{
"input": "5 5\n1 2 2 3\n1 1 0\n10 1 1\n100 1 0\n1000 1 1\n10000 1 1\n",
"output": "11001\n10110\n10100\n1000\n10000\n"
},
{
"input": "20 100\n1 2 1 1 1 6 6 5 1 7 9 4 6 4 15 16 8 2 5\n887945036308847 12 0\n699398807312293 20 1\n501806283312516 17 0\n559755618233839 19 1\n253673279319163 10 1\n745815685342299 11 1\n251710263962529 15 0\n777195295276573 15 0\n408579800634972 17 0\n521840965162492 17 1\n730678137312837 18 1\n370007714721362 14 1\n474595536466754 17 0\n879365432938644 15 0\n291785577961862 20 0\n835878893889428 14 1\n503562238579284 10 0\n567569163005307 18 1\n368949585722534 15 0\n386435396601075 16 0\n",
"output": "5329161389647368\n1570154676347343\n501806283312516\n2665577865131167\n1418696191276572\n3952333977838189\n982388401275366\n1344764458281880\n778587515356334\n521840965162492\n730678137312837\n370007714721362\n474595536466754\n879365432938644\n1631226710430574\n1339441132468712\n503562238579284\n567569163005307\n368949585722534\n386435396601075\n"
}
] |
https://atcoder.jp/contests/abc310/tasks/abc310_a | Problem Statement
Takahashi wants a beverage called AtCoder Drink in a restaurant.
It can be ordered at a regular price of
P
yen.
He also has a discount coupon that allows him to order it at a lower price of
Q
yen.
However, he must additionally order one of the restaurant's
N
dishes to use that coupon.
For each
i = 1, 2, \ldots, N
, the price of the
i
-th dish is
D_i
yen.
Print the minimum total amount of money that he must pay to get the drink. | [
{
"input": "3 100 50\n60 20 40\n",
"output": "70\n"
},
{
"input": "3 100 50\n60000 20000 40000\n",
"output": "100\n"
}
] |
https://atcoder.jp/contests/abc310/tasks/abc310_b | Problem Statement
AtCoder Shop has
N
products.
The price of the
i
-th product
(1\leq i\leq N)
is
P _ i
.
The
i
-th product
(1\leq i\leq N)
has
C_i
functions. The
j
-th function
(1\leq j\leq C _ i)
of the
i
-th product
(1\leq i\leq N)
is represented as an integer
F _ {i,j}
between
1
and
M
, inclusive.
Takahashi wonders whether there is a product that is strictly superior to another.
If there are
i
and
j
(1\leq i,j\leq N)
such that the
i
-th and
j
-th products satisfy all of the following conditions, print
Yes
; otherwise, print
No
.
P _ i\geq P _ j
.
The
j
-th product has all functions of the
i
-th product.
P _ i\gt P _ j
, or the
j
-th product has one or more functions that the
i
-th product lacks. | [
{
"input": "5 6\n10000 2 1 3\n15000 3 1 2 4\n30000 3 1 3 5\n35000 2 1 5\n100000 6 1 2 3 4 5 6\n",
"output": "Yes\n"
},
{
"input": "4 4\n3 1 1\n3 1 2\n3 1 2\n4 2 2 3\n",
"output": "No\n"
},
{
"input": "20 10\n72036 3 3 4 9\n7716 4 1 2 3 6\n54093 5 1 6 7 8 10\n25517 7 3 4 5 6 7 9 10\n96930 8 2 3 4 6 7 8 9 10\n47774 6 2 4 5 6 7 9\n36959 5 1 3 4 5 8\n46622 7 1 2 3 5 6 8 10\n34315 9 1 3 4 5 6 7 8 9 10\n54129 7 1 3 4 6 7 8 9\n4274 5 2 4 7 9 10\n16578 5 2 3 6 7 9\n61809 4 1 2 4 5\n1659 5 3 5 6 9 10\n59183 5 1 2 3 4 9\n22186 4 3 5 6 8\n98282 4 1 4 7 10\n72865 8 1 2 3 4 6 8 9 10\n33796 6 1 3 5 7 9 10\n74670 4 1 2 6 8\n",
"output": "Yes\n"
}
] |
https://atcoder.jp/contests/abc310/tasks/abc310_c | Problem Statement
There are
N
sticks with several balls stuck onto them. Each ball has a lowercase English letter written on it.
For each
i = 1, 2, \ldots, N
, the letters written on the balls stuck onto the
i
-th stick are represented by a string
S_i
.
Specifically, the number of balls stuck onto the
i
-th stick is the length
|S_i|
of the string
S_i
, and
S_i
is the sequence of letters on the balls starting from one end of the stick.
Two sticks are considered the same when the sequence of letters on the balls starting from one end of one stick is equal to the sequence of letters starting from one end of the other stick.
More formally, for integers
i
and
j
between
1
and
N
, inclusive, the
i
-th and
j
-th sticks are considered the same if and only if
S_i
equals
S_j
or its reversal.
Print the number of different sticks among the
N
sticks. | [
{
"input": "6\na\nabc\nde\ncba\nde\nabc\n",
"output": "3\n"
}
] |
https://atcoder.jp/contests/abc310/tasks/abc310_d | Problem Statement
There are
N
sports players.
Among them, there are
M
incompatible pairs. The
i
-th incompatible pair
(1\leq i\leq M)
is the
A_i
-th and
B_i
-th players.
You will divide the players into
T
teams.
Every player must belong to exactly one team, and every team must have one or more players.
Additionally, for each
i=1,2,\ldots,M
, the
A_i
-th and
B_i
-th players must not belong to the same team.
Find the number of ways to satisfy these conditions.
Here, two divisions are considered different when there are two players who belong to the same team in one division and different teams in the other. | [
{
"input": "5 2 2\n1 3\n3 4\n",
"output": "4\n"
},
{
"input": "5 1 2\n1 3\n3 4\n",
"output": "0\n"
},
{
"input": "6 4 0\n",
"output": "65\n"
},
{
"input": "10 6 8\n5 9\n1 4\n3 8\n1 6\n4 10\n5 7\n5 6\n3 7\n",
"output": "8001\n"
}
] |
https://atcoder.jp/contests/abc310/tasks/abc310_e | Problem Statement
You are given a string
S
of length
N
consisting of
0
and
1
.
It describes a length-
N
sequence
A=(A _ 1,A _ 2,\ldots,A _ N)
. If the
i
-th character of
S
(1\leq i\leq N)
is
0
, then
A _ i=0
; if it is
1
, then
A _ i=1
.
Find the following:
\[\sum _ {1\leq i\leq j\leq N}(\cdots((A _ i\barwedge A _ {i+1})\barwedge A _ {i+2})\barwedge\cdots\barwedge A _ j)\]
More formally, find
\displaystyle\sum _ {i=1} ^ {N}\sum _ {j=i} ^ Nf(i,j)
for
f(i,j)\ (1\leq i\leq j\leq N)
defined as follows:
\[f(i,j)=\left\{\begin{matrix}
A _ i&(i=j)\\
f(i,j-1)\barwedge A _ j\quad&(i\lt j)
\end{matrix}\right.\]
Here,
\barwedge
, NAND, is a binary operator satisfying the following:
\[0\barwedge0=1,0\barwedge1=1,1\barwedge0=1,1\barwedge1=0.\] | [
{
"input": "5\n00110\n",
"output": "9\n"
},
{
"input": "30\n101010000100101011010011000010\n",
"output": "326\n"
}
] |
https://atcoder.jp/contests/abc310/tasks/abc310_f | Problem Statement
We have
N
dice.
For each
i = 1, 2, \ldots, N
, when the
i
-th die is thrown, it shows a random integer between
1
and
A_i
, inclusive, with equal probability.
Find the probability, modulo
998244353
, that the following condition is satisfied when the
N
dice are thrown simultaneously.
There is a way to choose some (possibly all) of the
N
dice so that the sum of their results is
10
.
How to find a probability modulo
998244353
It can be proved that the sought probability is always a rational number. Additionally, the constraints of this problem guarantee that if the sought probability is represented as an irreducible fraction
\frac{y}{x}
, then
x
is not divisible by
998244353
.
Here, there is a unique integer
z
such that
xz \equiv y \pmod{998244353}
. Report this
z
. | [
{
"input": "4\n1 7 2 9\n",
"output": "942786334\n"
},
{
"input": "7\n1 10 100 1000 10000 100000 1000000\n",
"output": "996117877\n"
}
] |
https://atcoder.jp/contests/abc310/tasks/abc310_g | Problem Statement
There are
N
Takahashi.
The
i
-th Takahashi has an integer
A_i
and
B_i
balls.
An integer
x
between
1
and
K
, inclusive, will be chosen uniformly at random, and they will repeat the following operation
x
times.
For every
i
, the
i
-th Takahashi gives all his balls to the
A_i
-th Takahashi.
Beware that all
N
Takahashi simultaneously perform this operation.
For each
i=1,2,\ldots,N
, find the expected value, modulo
998244353
, of the number of balls the
i
-th Takahashi has at the end of the operations.
How to find a expected value modulo
998244353
It can be proved that the sought probability is always a rational number. Additionally, the constraints of this problem guarantee that if the sought probability is represented as an irreducible fraction
\frac{y}{x}
, then
x
is not divisible by
998244353
.
Here, there is a unique
0\leq z\lt998244353
such that
y\equiv xz\pmod{998244353}
, so report this
z
. | [
{
"input": "5 2\n3 1 4 1 5\n1 1 2 3 5\n",
"output": "3 0 499122179 499122178 5\n"
},
{
"input": "3 1000\n1 1 1\n1 10 100\n",
"output": "111 0 0\n"
},
{
"input": "16 1000007\n16 12 6 12 1 8 14 14 5 7 6 5 9 6 10 9\n719092922 77021920 539975779 254719514 967592487 476893866 368936979 465399362 342544824 540338192 42663741 165480608 616996494 16552706 590788849 221462860\n",
"output": "817852305 0 0 0 711863206 253280203 896552049 935714838 409506220 592088114 0 413190742 0 363914270 0 14254803\n"
},
{
"input": "24 100000000007\n19 10 19 15 1 20 13 15 8 23 22 16 19 22 2 20 12 19 17 20 16 8 23 6\n944071276 364842194 5376942 671161415 477159272 339665353 176192797 2729865 676292280 249875565 259803120 103398285 466932147 775082441 720192643 535473742 263795756 898670859 476980306 12045411 620291602 593937486 761132791 746546443\n",
"output": "918566373 436241503 0 0 0 455245534 0 356196743 0 906000633 0 268983266 21918337 0 733763572 173816039 754920403 0 273067118 205350062 0 566217111 80141532 0\n"
}
] |
https://atcoder.jp/contests/abc310/tasks/abc310_h | Problem Statement
A monster with health
H
has appeared right in front of you.
Your magic power is now
0
.
You can use
N
moves called move
1
, move
2
,
\ldots
, move
N
, any number of times in any order.
For each
i = 1, 2, \ldots, N
, move
i
can only be used when your magic power is at least
C_i
, and its use will decrease your magic power by
C_i
and the monster's health by
D_i
.
Here, if
C_i
is negative, decreasing your magic power by
C_i
means increasing it by
-C_i
.
Find the minimum possible number of times you use moves before the monster's health is
0
or lower.
The constraints of this problem guarantee that a finite number of uses of moves can make it
0
or lower (see below). | [
{
"input": "3 48\n3 20\n-4 2\n1 5\n",
"output": "5\n"
},
{
"input": "20 583988303060450752\n-64 273760634\n-238 960719353\n-114 191410838\n-250 357733867\n232 304621362\n-286 644706927\n210 37849132\n-230 556412112\n-142 136397527\n101 380675202\n-140 152300688\n190 442931589\n-187 940659077\n-12 312523039\n32 126515475\n-143 979861204\n105 488280613\n240 664922712\n290 732741849\n69 541282303\n",
"output": "595990842\n"
}
] |
https://atcoder.jp/contests/arc164/tasks/arc164_a | Problem Statement
You are given integers
N
and
K
.
Is it possible to express
N
as the sum of exactly
K
numbers of the form
3^m
(
m
is a non-negative integer)?
In other words, is there a sequence of non-negative integers
(m_1, m_2,\ldots, m_K)
such that:
N= 3^{m_1}+3^{m_2}+...+3^{m_K}
?
You are given
T
test cases. Answer each of them. | [
{
"input": "4\n5 3\n17 2\n163 79\n1000000000000000000 1000000000000000000\n",
"output": "Yes\nNo\nYes\nYes\n"
}
] |
https://atcoder.jp/contests/arc164/tasks/arc164_b | Problem Statement
There is a simple connected undirected graph with
N
vertices numbered from
1
to
N
.
This graph has
M
edges, and the
i
-th edge connects two vertices
a_i
and
b_i
.
Each vertex has a color, either white or black, and the initial state is given by
c_i
.
c_i
is either
0
or
1
, where
c_i=0
means that vertex
i
is initially white, and
c_i=1
means that vertex
i
is initially black.
On this graph, you can choose any vertex as your starting point and repeat the following operation as many times as you like.
Move to a vertex of a different color connected by an edge from the current vertex. Immediately after moving, reverse the color of the vertex you moved from (change to black if it was white, and vice versa).
Is it possible to return to the starting point after performing the operation at least once? | [
{
"input": "4 4\n1 2\n2 3\n3 4\n4 2\n0 1 0 1\n",
"output": "Yes\n"
},
{
"input": "5 6\n1 2\n2 3\n3 4\n4 5\n1 4\n2 5\n0 1 0 1 0\n",
"output": "No\n"
}
] |
https://atcoder.jp/contests/arc164/tasks/arc164_c | Problem Statement
There are
N
cards, each with a number written on both sides. On the
i
-th card, the number
A_i
is written in red on one side, and the number
B_i
is written in blue on the other side. Initially, all cards are placed with the red number side facing up. Alice and Bob play a game in which they repeat the following steps.
First, Alice chooses one of the remaining cards and flips it over. Next, Bob removes one of the remaining cards. Then, Bob scores points equal to the number written on the face-up side of the removed card.
The game ends when there are no cards left.
Alice tries to minimize Bob's score at the end of the game, and Bob tries to maximize it. What is Bob's score at the end of the game when both players take optimal steps? | [
{
"input": "3\n6 4\n2 1\n5 3\n",
"output": "12\n"
},
{
"input": "5\n166971716 552987438\n219878198 619875818\n918378176 518975015\n610749017 285601372\n701849287 307601390\n",
"output": "3078692091\n"
}
] |
https://atcoder.jp/contests/arc164/tasks/arc164_d | Problem Statement
Consider the following problem for a string
s
of length
2N
formed by
N
+
and
N
-
, and let
p(s)
denote the answer.
There are
2N
balls lined up at positions
x=1,2,3,\ldots , 2N
on a number line, of which
N
have a charge of
+1
and the remaining
N
have a charge of
-1
. The arrangement of the charges of the balls is represented by
s
. If the
i
-th character of
s
is
+
, a ball with a charge of
+1
is placed at
x=i
; if it is
-
, a ball with a charge of
-1
is placed at
x=i
.
Each ball starts motion simultaneously according to the following rules. Here, we call the direction where smaller numbers are located on the number line "left", and the direction where larger numbers are located "right".
For each ball, define
F
at each moment by the following formula:
F=\lbrace
(
the sum of the charges of the balls strictly to the left of itself
)
-
(
the sum of the charges of the balls strictly to the right of itself
)
\rbrace
\times
(
the charge of itself
)
.
At each moment, each ball moves to the right if
F
is positive, and to the left if
F
is negative, at a speed of
1
per second.
If a ball with a charge of
+1
and a ball with a charge of
-1
exist at the same coordinate simultaneously, they cancel out each other and disappear.
Then, what is the sum of the distances moved by the balls after they start motion and before they disappear (the distance moved by a ball is the absolute difference between the coordinates where it starts and where it disappears)?
You are given a string
T
of length
2N
consisting of
+
,
-
, and
?
. Find the sum of
p(s)
over all strings
s
formed by
N
+
and
N
-
that can be obtained by replacing each
?
in
T
with
+
or
-
, modulo
998244353
.
Under the given constraints and the rules of motion, it can be shown that all balls disappear in finite time, that the value of
F
for each ball does not become
0
until that ball disappears, that there is no moment when three or more balls are at the same coordinate simultaneously, and that
p(s)
is an integer. | [
{
"input": "2\n+??-\n",
"output": "6\n"
},
{
"input": "17\n??????????????????????????????????\n",
"output": "285212526\n"
}
] |
https://atcoder.jp/contests/arc164/tasks/arc164_e | Problem Statement
There is a sequence of
N
terms, and
Q
queries will be given on this sequence. The
i
-th query is for the interval
[L_i, R_i]
(the interval
[a,b]
is a set of integers between
a
and
b
, inclusive).
You will answer this problem using a binary tree that satisfies the following conditions. Here,
i,j,k
represent integers.
Each node has an interval.
The root node has the interval
[1, N]
.
The node with the interval
[i, i]
is a leaf. Also, the interval of a leaf can be represented as
[i,i]
.
Each non-leaf node has exactly two children. Also, if the interval of a non-leaf node is
[i,j]
, the intervals of the children of this node are
[i,k]
and
[k+1,j]
(
i\leq k<j
).
In this binary tree, when a query for the interval
[L,R]
is given, a search is performed recursively according to the following rules.
Initially, the root is investigated.
When a node is investigated, if the interval of this node is included in
[L, R]
, its descendants are not investigated.
When a node is investigated, if the interval of this node have no intersection with
[L,R]
, its descendants are not investigated.
When a node is investigated, if neither 2. nor 3. applies, the two child nodes are investigated. (It can be shown that either 2. or 3. always applies to a leaf node.)
When answering
Q
queries, let
d
be the maximum depth (distance from the root) of the investigated nodes, and
c
be the total number of times nodes of depth
d
are investigated. Here, if multiple nodes of depth
d
are investigated in a single query, or if the same node is investigated in multiple queries, all those investigations count separately.
You want to design the binary tree to minimize
d
, and then to minimize
c
while minimizing
d
. What are the values of
d
and
c
then? | [
{
"input": "6 4\n2 3\n3 4\n2 4\n3 3\n",
"output": "3 4\n"
},
{
"input": "12 6\n1 10\n2 7\n3 6\n4 9\n5 8\n11 12\n",
"output": "4 4\n"
}
] |
https://atcoder.jp/contests/arc164/tasks/arc164_f | Problem Statement
You are given a rooted tree with
N
vertices numbered from
1
to
N
, rooted at vertex
1
. The parent of vertex
i
is vertex
p_i
(
2\leq i\leq N
).
Alice and Bob play a game using this tree as follows.
Alice goes first, and Bob goes second. They take turns placing a stone, with a white side and a black side, on a vertex of the tree. Alice places the stone with the white side up, and Bob places the stone with the black side up.
In each turn, a stone can only be placed on a vertex that does not have a stone on itself while all its descendants already have stones on them.
When placing a stone on a vertex, all the stones on the descendants of that vertex are flipped over (the placed stone itself is not flipped).
The game ends when all vertices have stones. Alice's score is the number of stones with the white side up at this point.
Alice tries to maximize her score, and Bob tries to minimize Alice's score. If both play optimally, what will be Alice's score? | [
{
"input": "4\n1 1 2\n",
"output": "2\n"
},
{
"input": "7\n1 1 2 4 4 4\n",
"output": "5\n"
}
] |
https://atcoder.jp/contests/abc309/tasks/abc309_a | Problem Statement
We have the following
3 \times 3
board with integers from
1
through
9
written on it.
You are given two integers
A
and
B
between
1
and
9
, where
A < B
.
Determine if the two squares with
A
and
B
written on them are adjacent horizontally. | [
{
"input": "7 8\n",
"output": "Yes\n"
},
{
"input": "1 9\n",
"output": "No\n"
},
{
"input": "3 4\n",
"output": "No\n"
}
] |
https://atcoder.jp/contests/abc309/tasks/abc309_b | Problem Statement
You are given a grid with
N
rows and
N
columns. An integer
A_{i, j}
is written on the square at the
i
-th row from the top and
j
-th column from the left. Here, it is guaranteed that
A_{i,j}
is either
0
or
1
.
Shift the integers written on the outer squares clockwise by one square each, and print the resulting grid.
Here, the outer squares are those in at least one of the
1
-st row,
N
-th row,
1
-st column, and
N
-th column. | [
{
"input": "4\n0101\n1101\n1111\n0000\n",
"output": "1010\n1101\n0111\n0001\n"
},
{
"input": "2\n11\n11\n",
"output": "11\n11\n"
},
{
"input": "5\n01010\n01001\n10110\n00110\n01010\n",
"output": "00101\n11000\n00111\n00110\n10100\n"
}
] |
https://atcoder.jp/contests/abc309/tasks/abc309_c | Problem Statement
Snuke the doctor prescribed
N
kinds of medicine for Takahashi. For the next
a_i
days (including the day of the prescription), he has to take
b_i
pills of the
i
-th medicine. He does not have to take any other medicine.
Let the day of the prescription be day
1
. On or after day
1
, when is the first day on which he has to take
K
pills or less? | [
{
"input": "4 8\n6 3\n2 5\n1 9\n4 2\n",
"output": "3\n"
},
{
"input": "4 100\n6 3\n2 5\n1 9\n4 2\n",
"output": "1\n"
},
{
"input": "15 158260522\n877914575 2436426\n24979445 61648772\n623690081 33933447\n476190629 62703497\n211047202 71407775\n628894325 31963982\n822804784 50968417\n430302156 82631932\n161735902 80895728\n923078537 7723857\n189330739 10286918\n802329211 4539679\n303238506 17063340\n492686568 73361868\n125660016 50287940\n",
"output": "492686569\n"
}
] |
https://atcoder.jp/contests/abc309/tasks/abc309_d | Problem Statement
We have an undirected graph with
(N_1+N_2)
vertices and
M
edges. For
i=1,2,\ldots,M
, the
i
-th edge connects vertex
a_i
and vertex
b_i
.
The following properties are guaranteed:
Vertex
u
and vertex
v
are connected, for all integers
u
and
v
with
1 \leq u,v \leq N_1
.
Vertex
u
and vertex
v
are connected, for all integers
u
and
v
with
N_1+1 \leq u,v \leq N_1+N_2
.
Vertex
1
and vertex
(N_1+N_2)
are disconnected.
Consider performing the following operation exactly once:
choose an integer
u
with
1 \leq u \leq N_1
and an integer
v
with
N_1+1 \leq v \leq N_1+N_2
, and add an edge connecting vertex
u
and vertex
v
.
We can show that vertex
1
and vertex
(N_1+N_2)
are always connected in the resulting graph; so let
d
be the minimum length (number of edges) of a path between vertex
1
and vertex
(N_1+N_2)
.
Find the maximum possible
d
resulting from adding an appropriate edge to add.
Definition of "connected"
Two vertices
u
and
v
of an undirected graph are said to be connected if and only if there is a path between vertex
u
and vertex
v
. | [
{
"input": "3 4 6\n1 2\n2 3\n4 5\n4 6\n1 3\n6 7\n",
"output": "5\n"
},
{
"input": "7 5 20\n10 11\n4 5\n10 12\n1 2\n1 5\n5 6\n2 4\n3 5\n9 10\n2 5\n1 4\n11 12\n9 12\n8 9\n5 7\n3 7\n3 6\n3 4\n8 12\n9 11\n",
"output": "4\n"
}
] |
https://atcoder.jp/contests/abc309/tasks/abc309_e | Problem Statement
There is a family consisting of person
1
, person
2
,
\ldots
, and person
N
. For
i\geq 2
, person
i
's parent is person
p_i
.
They bought insurance
M
times. For
i=1,2,\ldots,M
, person
x_i
bought the
i
-th insurance, which covers that person and their descendants in the next
y_i
generations.
How many people are covered by at least one insurance? | [
{
"input": "7 3\n1 2 1 3 3 3\n1 1\n1 2\n4 3\n",
"output": "4\n"
},
{
"input": "10 10\n1 1 3 1 2 3 3 5 7\n2 1\n5 1\n4 3\n6 3\n2 1\n7 3\n9 2\n1 2\n6 2\n8 1\n",
"output": "10\n"
}
] |
https://atcoder.jp/contests/abc309/tasks/abc309_f | Problem Statement
There are
N
boxes. The
i
-th box has a shape of a rectangular cuboid whose height, width, and depth are
h_i,w_i
, and
d_i
, respectively.
Determine if there are two boxes such that one's height, width, and depth are strictly greater than those of the other after rotating them if necessary. | [
{
"input": "3\n19 8 22\n10 24 12\n15 25 11\n",
"output": "Yes\n"
},
{
"input": "3\n19 8 22\n10 25 12\n15 24 11\n",
"output": "No\n"
},
{
"input": "2\n1 1 2\n1 2 2\n",
"output": "No\n"
}
] |
https://atcoder.jp/contests/abc309/tasks/abc309_g | Problem Statement
Find the number, modulo
998244353
, of permutations
P=(P_1,P_2,\dots,P_N)
of
(1,2,\dots,N)
such that:
|P_i - i| \ge X
for all integers
i
with
1 \le i \le N
. | [
{
"input": "3 1\n",
"output": "2\n"
},
{
"input": "5 2\n",
"output": "4\n"
},
{
"input": "98 5\n",
"output": "809422418\n"
}
] |
https://atcoder.jp/contests/abc309/tasks/abc309_h | Problem Statement
We have a grid with
N
rows and
M
columns. We denote by
(i,j)
the cell in the
i
-th row from the top and
j
-th column from the left.
You are given integer sequences
A=(A_1,A_2,\dots,A_K)
and
B=(B_1,B_2,\dots,B_L)
of lengths
K
and
L
, respectively.
Find the sum, modulo
998244353
, of the answers to the following question over all integer pairs
(i,j)
such that
1 \le i \le K
and
1 \le j \le L
.
A piece is initially placed at
(1,A_i)
. How many paths are there to take it to
(N,B_j)
by repeating the following move
(N-1)
times?
Let
(p,q)
be the piece's current cell. Move it to
(p+1,q-1),(p+1,q)
, or
(p+1,q+1)
, without moving it outside the grid. | [
{
"input": "3 4 1 2\n1\n1 2\n",
"output": "4\n"
},
{
"input": "5 8 4 5\n3 1 4 1\n2 7 1 8 2\n",
"output": "137\n"
},
{
"input": "883671387 87719 10 12\n86879 64174 47274 41688 17713 50897 53989 7210 30894 5714\n60358 28835 48036 48450 67149 36558 35929 69025 77539 19195 60762 60721\n",
"output": "941873621\n"
}
] |
https://atcoder.jp/contests/arc163/tasks/arc163_a | Problem Statement
You are given a string
S
of length
N
consisting of lowercase English letters. Determine whether it is possible to divide
S
into two or more consecutive substrings so that they are strictly increasing in lexicographical order.
To be precise, determine whether there is a sequence of strings
t=(t_1,t_2,\dots,t_k)
that satisfies all of the following conditions.
The length of the sequence
k
is at least
2
.
t_i
is not empty. (
1 \le i \le k
)
Concatenating
t_1,t_2,\dots,t_k
in this order results in
S
.
t_i
is lexicographically smaller than
t_{i+1}
for every integer
i
such that
1 \le i < k
.
You are given
T
test cases. Find the answer for each of them.
What is lexicographical order?
A string
S = S_1S_2\ldots S_{|S|}
is said to be
lexicographically smaller
than a string
T = T_1T_2\ldots T_{|T|}
if either 1. or 2. below holds.
Here,
|S|
and
|T|
represent the lengths of
S
and
T
, respectively.
|S| \lt |T|
and
S_1S_2\ldots S_{|S|} = T_1T_2\ldots T_{|S|}
.
There is an integer
1 \leq i \leq \min\lbrace |S|, |T| \rbrace
such that both of the following hold.
S_1S_2\ldots S_{i-1} = T_1T_2\ldots T_{i-1}
.
The character
S_i
comes before
T_i
in alphabetical order. | [
{
"input": "5\n4\nabac\n3\ncac\n2\nab\n12\nabababababab\n5\nedcba\n",
"output": "Yes\nNo\nYes\nYes\nNo\n"
}
] |
https://atcoder.jp/contests/arc163/tasks/arc163_b | Problem Statement
You are given an integer sequence of length
N
:
A=(A_1,A_2,\dots,A_N)
. You can perform the following operation any number of times (possibly zero).
Choose an integer
i
such that
1 \le i \le N
, and increase or decrease
A_i
by
1
.
Your goal is to make at least
M
integers
i(3 \le i \le N)
satisfy
A_1 \le A_i \le A_2
. Find the minimum number of operations required to achieve this goal. | [
{
"input": "3 1\n2 3 5\n",
"output": "2\n"
},
{
"input": "5 2\n1 4 2 3 5\n",
"output": "0\n"
},
{
"input": "8 5\n15 59 64 96 31 17 88 9\n",
"output": "35\n"
}
] |
https://atcoder.jp/contests/arc163/tasks/arc163_c | Problem Statement
Determine whether there is a length-
N
sequence of positive integers
A=(A_1,A_2,\dots,A_N)
that satisfies all of the following conditions, and if it exists, construct one.
\sum_{i=1}^{N} \frac{1}{A_i} = 1
All elements of
A
are distinct.
1 \le A_i \le 10^9(1 \le i \le N)
You are given
T
test cases. Find the answer for each of them. | [
{
"input": "2\n3\n5\n",
"output": "Yes\n2 3 6 \nYes\n3 4 5 6 20 \n"
}
] |
https://atcoder.jp/contests/arc163/tasks/arc163_d | Problem Statement
Consider a directed graph
G
with
N
vertices numbered
1
to
N
that satisfies all of the following conditions.
G
is a tournament. In other words,
G
has no multi-edges or self-loops, and for any two vertices
u,v
of
G
, exactly one of the edges
u \rightarrow v
and
v \rightarrow u
exists.
Among the edges of
G
, exactly
M
are directed from a vertex with a smaller number to a vertex with a larger number.
Find the total number of strongly connected components over all such directed graphs
G
, modulo
998244353
. | [
{
"input": "3 1\n",
"output": "7\n"
},
{
"input": "6 2\n",
"output": "300\n"
},
{
"input": "25 156\n",
"output": "902739687\n"
}
] |
https://atcoder.jp/contests/arc163/tasks/arc163_e | Problem Statement
Alice and Bob are playing a game using a length-
N
sequence of non-negative integers
A=(A_1,A_2,\dots,A_N)
.
Starting with Alice, they take turns performing the following operation. The player who cannot make a move first loses.
Choose a non-negative integer
X
such that there is an integer
i
satisfying
A_i > A_i \oplus X
.
For each
1 \le i \le N
, replace
A_i
with
\min(A_i,A_i \oplus X)
.
Determine who wins when both players play optimally.
Here,
\oplus
represents the bitwise XOR.
You are given
T
test cases. Find the answer for each of them. | [
{
"input": "5\n2\n3 1\n5\n1 1 1 1 1\n4\n0 0 0 0\n4\n8 1 6 4\n5\n3 8 7 12 15\n",
"output": "Bob\nAlice\nBob\nBob\nAlice\n"
}
] |
https://atcoder.jp/contests/arc163/tasks/arc163_f | Problem Statement
PCT-kun created the following problem.
Increasing Problem
You are given a length-
N
sequence of non-negative integers
A_1,A_2,\dots,A_N
. You can perform the following operation any number of times (possibly zero).
Choose an integer
i
such that
1 \le i \le N
, and increase or decrease
A_i
by
1
.
Your goal is to make
A
non-decreasing. Find the minimum number of operations required to achieve this goal.
Thinking that this problem is too easy to be placed at the end of the contest, PCT-kun has revised it as follows.
Many Increasing Problems
There are
M^N
integer sequences
A
of length
N
where all elements are between
1
and
M
, inclusive. Find the sum of the answers to
Increasing Problem
for all those sequences, modulo
998244353
.
Solve
Many Increasing Problems
. | [
{
"input": "2 2\n",
"output": "1\n"
},
{
"input": "6 4\n",
"output": "14668\n"
},
{
"input": "163 702\n",
"output": "20728656\n"
},
{
"input": "98765 99887\n",
"output": "103564942\n"
}
] |
https://atcoder.jp/contests/abc308/tasks/abc308_a | Problem Statement
Given eight integers
S_1,S_2,\dots
, and
S_8
,
print
Yes
if they satisfy all of the following three conditions, and
No
otherwise.
The sequence
(S_1,S_2,\dots,S_8)
is monotonically non-decreasing. In other words,
S_1 \leq S_2 \leq \dots \leq S_8
.
S_1,S_2,\dots
, and
S_8
are all between
100
and
675
, inclusive.
S_1,S_2,\dots
, and
S_8
are all multiples of
25
. | [
{
"input": "125 175 250 300 400 525 600 650\n",
"output": "Yes\n"
},
{
"input": "100 250 300 400 325 575 625 675\n",
"output": "No\n"
},
{
"input": "0 23 24 145 301 413 631 632\n",
"output": "No\n"
}
] |
https://atcoder.jp/contests/abc308/tasks/abc308_b | Problem Statement
Takahashi ate
N
plates of sushi at a sushi restaurant. The color of the
i
-th plate is represented by a string
C_i
.
The price of a sushi corresponds to the color of the plate. For each
i=1,\ldots,M
, the sushi on a plate whose color is represented by a string
D_i
is worth
P_i
yen a plate (yen is the currency of Japan). If the color does not coincide with any of
D_1,\ldots
, and
D_M
, it is worth
P_0
yen a plate.
Find the total amount of the prices of sushi that Takahashi ate. | [
{
"input": "3 2\nred green blue\nblue red\n800 1600 2800\n",
"output": "5200\n"
},
{
"input": "3 2\ncode queen atcoder\nking queen\n10 1 1\n",
"output": "21\n"
}
] |
https://atcoder.jp/contests/abc308/tasks/abc308_c | Problem Statement
N
people numbered
1
through
N
tossed a coin several times. We know that person
i
's tosses resulted in
A_i
heads and
B_i
tails.
Person
i
's
success rate
of the tosses is defined by
\displaystyle\frac{A_i}{A_i+B_i}
. Sort people
1,\ldots,N
in descending order of their success rates, with ties broken in ascending order of their assigned numbers. | [
{
"input": "3\n1 3\n3 1\n2 2\n",
"output": "2 3 1\n"
},
{
"input": "2\n1 3\n2 6\n",
"output": "1 2\n"
},
{
"input": "4\n999999999 1000000000\n333333333 999999999\n1000000000 999999997\n999999998 1000000000\n",
"output": "3 1 4 2\n"
}
] |
https://atcoder.jp/contests/abc308/tasks/abc308_d | Problem Statement
We have a grid with
H
horizontal rows and
W
vertical columns.
We denote by
(i,j)
the cell at the
i
-th row from the top and
j
-th column from the left.
Each cell in the grid has a lowercase English letter written on it. The letter written on
(i,j)
equals the
j
-th character of a given string
S_i
.
Snuke will repeat moving to an adjacent cell sharing a side to travel from
(1,1)
to
(H,W)
.
Determine if there is a path
in which the letters written on the visited cells (including initial
(1,1)
and final
(H,W)
) are
s
\rightarrow
n
\rightarrow
u
\rightarrow
k
\rightarrow
e
\rightarrow
s
\rightarrow
n
\rightarrow \dots
, in the order of visiting.
Here, a cell
(i_1,j_1)
is said to be an adjacent cell of
(i_2,j_2)
sharing a side if and only if
|i_1-i_2|+|j_1-j_2| = 1
.
Formally, determine if there is a sequence of cells
((i_1,j_1),(i_2,j_2),\dots,(i_k,j_k))
such that:
(i_1,j_1) = (1,1),(i_k,j_k) = (H,W)
;
(i_{t+1},j_{t+1})
is an adjacent cell of
(i_t,j_t)
sharing a side, for all
t\ (1 \leq t < k)
; and
the letter written on
(i_t,j_t)
coincides with the
(((t-1) \bmod 5) + 1)
-th character of
snuke
, for all
t\ (1 \leq t \leq k)
. | [
{
"input": "2 3\nsns\neuk\n",
"output": "Yes\n"
},
{
"input": "2 2\nab\ncd\n",
"output": "No\n"
},
{
"input": "5 7\nskunsek\nnukesnu\nukeseku\nnsnnesn\nuekukku\n",
"output": "Yes\n"
}
] |
https://atcoder.jp/contests/abc308/tasks/abc308_e | Problem Statement
You are given a length-
N
sequence
A=(A_1,A_2,\dots,A_N)
consisting of
0
,
1
, and
2
,
and a length-
N
string
S=S_1S_2\dots S_N
consisting of
M
,
E
, and
X
.
Find the sum of
\text{mex}(A_i,A_j,A_k)
over all tuples of integers
(i,j,k)
such that
1 \leq i < j < k \leq N
and
S_iS_jS_k=
MEX
.
Here,
\text{mex}(A_i,A_j,A_k)
denotes the minimum non-negative integer that equals neither
A_i,A_j
, nor
A_k
. | [
{
"input": "4\n1 1 0 2\nMEEX\n",
"output": "3\n"
},
{
"input": "3\n0 0 0\nXXX\n",
"output": "0\n"
},
{
"input": "15\n1 1 2 0 0 2 0 2 0 0 0 0 0 2 2\nEXMMXXXEMEXEXMM\n",
"output": "13\n"
}
] |
https://atcoder.jp/contests/abc308/tasks/abc308_f | Problem Statement
You are in a store to buy
N
items. The regular price of the
i
-th item is
P_i
yen (the currency in Japan).
You have
M
coupons. You can use the
i
-th coupon to buy an item whose regular price is at least
L_i
yen at a
D_i
-yen discount.
Here, each coupon can be used only once. Besides, multiple coupons cannot be used for the same item.
If no coupon is used for an item, you will buy it for a regular price.
Find the minimum possible total amount of money required to buy all the
N
items. | [
{
"input": "3 3\n4 3 1\n4 4 2\n2 3 1\n",
"output": "4\n"
},
{
"input": "10 5\n9 7 1 5 2 2 5 5 7 6\n7 2 7 8 2\n3 2 4 1 2\n",
"output": "37\n"
}
] |
https://atcoder.jp/contests/abc308/tasks/abc308_g | Problem Statement
There is a blackboard on which you can write integers. Initially, no integer is written on the blackboard. Given
Q
queries, process them in order.
The query is of one of the following three kinds:
1 x
: write an
x
on the blackboard.
2 x
: erase an
x
from the blackboard. At the point this query is given, it is guaranteed that at least one
x
is written on the blackboard.
3
: print the minimum possible bitwise XOR of two of the integers written on the blackboard. At the point this query is processed, it is guaranteed that at least two integers are written on the blackboard.
What is bitwise XOR?
The bitwise XOR of non-negative integers
A
and
B
,
A \oplus B
, is defined as follows.
When
A \oplus B
is written in binary, the
2^k
s place (
k \geq 0
) is
1
if exactly one of the
2^k
s places of
A
and
B
is
1
, and
0
otherwise.
For instance,
3 \oplus 5 = 6
(in binary:
011 \oplus 101 = 110
). | [
{
"input": "9\n1 2\n1 10\n3\n1 3\n3\n2 2\n3\n1 10\n3\n",
"output": "8\n1\n9\n0\n"
}
] |
https://atcoder.jp/contests/abc308/tasks/abc308_h | Problem Statement
There is a simple undirected graph with
N
vertices and
M
edges. The edges are initially painted white.
The vertices are numbered
1
through
N
, and the edges are numbered
1
through
M
.
Edge
i
connects vertex
A_i
and vertex
B_i
, and the cost required to paint it black is
C_i
.
"Making a Q" means painting four or more edges so that:
all but one of the edges painted black form a simple cycle, and
the edge painted black not forming the cycle connects a vertex on the cycle and another not on the cycle.
Determine if one can make a Q. If one can, find the minimum total cost required to make a Q. | [
{
"input": "5 6\n1 2 6\n2 3 4\n1 3 5\n2 4 3\n4 5 2\n3 5 1\n",
"output": "15\n"
},
{
"input": "4 4\n1 2 1\n2 3 1\n3 4 1\n1 4 1\n",
"output": "-1\n"
},
{
"input": "6 15\n2 6 48772\n2 4 36426\n1 6 94325\n3 6 3497\n2 3 60522\n4 5 63982\n4 6 4784\n1 2 14575\n5 6 68417\n1 5 7775\n3 4 33447\n3 5 90629\n1 4 47202\n1 3 90081\n2 5 79445\n",
"output": "78154\n"
}
] |
https://atcoder.jp/contests/ahc021/tasks/ahc021_a | Problem Statement
There are
N(N+1)/2
balls arranged in an
N
-tiered pyramid as shown in the figure below.
Let
(0, 0)
be the coordinates of the ball at the top of the pyramid, and let
(x,y)
be the coordinates of the
y (0\leq y\leq x)
-th ball from the left in the
x (0\leq x-1)
-th tier from the top.
Each ball is labeled with a number from
0
to
N(N+1)/2-1
, and the numbers on each ball are all different.
You can swap two adjacent balls in six directions in a single operation.
Here, the balls at coordinates
(x_1,y_1)
and
(x_2,y_2)
are adjacent in six directions if one of the following conditions is satisfied.
x_1=x_2-1
and
y_1=y_2-1
x_1=x_2-1
and
y_1=y_2
x_1=x_2
and
y_1=y_2-1
x_1=x_2
and
y_1=y_2+1
x_1=x_2+1
and
y_1=y_2
x_1=x_2+1
and
y_1=y_2+1
By performing this operation at most
10000
times, please arrange the balls so that every ball
(x,y) (0\leq x\leq N-2, 0\leq y\leq x)
except those in the lowest tier has a smaller number than the two balls
(x+1,y), (x+1,y+1)
directly below it.
Please achieve this with as few operations as possible. | [
{
"input": "236\n11 200\n453 2 378\n85 410 239 54\n50 240 113 25 294\n303 231 146 65 155 252\n368 327 321 251 451 182 142\n101 17 43 403 217 161 347 398\n350 287 363 48 80 447 385 233 197\n438 424 439 121 357 380 51 245 57 304\n141 91 100 344 194 250 432 322 58 281 219\n412 266 26 318 269 111 59 450 99 301 36 320\n218 135 278 225 227 268 313 162 420 214 42 166 55\n181 191 75 335 332 372 144 342 29 94 427 62 334 409\n377 213 369 117 307 428 280 152 242 88 460 175 351 340 230\n209 139 288 132 47 456 167 205 455 38 27 326 306 134 108 34\n389 441 393 361 120 296 331 316 458 183 170 40 397 274 402 103 408\n136 463 82 0 364 150 462 157 67 92 419 371 156 228 1 138 53 349\n174 129 71 169 199 367 87 443 359 172 298 22 244 415 401 373 417 160 305\n254 158 84 9 435 130 118 430 203 345 185 388 379 207 220 238 196 208 289 153\n425 356 109 237 116 212 358 396 270 179 262 76 370 444 308 229 105 148 365 429 248\n386 93 376 86 442 184 273 243 81 69 189 204 355 106 154 257 464 107 70 215 77 241\n127 404 180 123 362 124 234 300 173 222 72 329 140 147 232 3 187 114 381 133 44 387 60\n145 4 210 49 382 433 457 343 315 354 149 255 299 12 28 421 394 211 102 297 360 8 314 328\n46 256 416 336 423 295 90 112 168 309 64 96 260 437 440 366 323 35 383 346 79 293 61 312 202\n18 23 20 221 31 452 178 461 6 21 201 143 324 277 341 283 291 5 41 66 411 317 258 406 19 188\n164 261 16 137 426 264 98 78 45 310 246 176 319 95 384 68 392 37 265 190 249 73 198 15 32 330 311\n131 282 434 271 400 445 104 56 119 263 374 337 216 177 449 353 24 192 390 39 33 223 407 348 195 279 290 110\n267 89 375 284 13 63 391 422 272 259 30 97 125 459 413 333 52 448 399 122 83 126 275 302 115 14 338 446 339\n171 206 74 163 292 454 405 247 395 285 193 325 418 352 286 186 128 7 159 431 226 165 224 436 10 276 414 151 235 253\n",
"output": "15\n2 0 3 1\n8 5 9 5\n24 5 25 6\n9 5 10 6\n10 10 11 10\n1 0 2 1\n28 9 29 10\n0 0 1 0\n18 7 19 8\n18 18 19 19\n20 5 21 5\n11 0 12 1\n27 12 28 12\n19 1 20 2\n7 3 8 3\n"
}
] |
https://atcoder.jp/contests/abc307/tasks/abc307_a | Problem Statement
Takahashi has recorded the number of steps he walked for
N
weeks. He walked
A_i
steps on the
i
-th day.
Find the total number of steps Takahashi walked each week.
More precisely, find the sum of the steps for the first week (the
1
-st through
7
-th day), the sum of the steps for the second week (the
8
-th through
14
-th day), and so on. | [
{
"input": "2\n1000 2000 3000 4000 5000 6000 7000 2000 3000 4000 5000 6000 7000 8000\n",
"output": "28000 35000\n"
},
{
"input": "3\n14159 26535 89793 23846 26433 83279 50288 41971 69399 37510 58209 74944 59230 78164 6286 20899 86280 34825 34211 70679 82148\n",
"output": "314333 419427 335328\n"
}
] |
https://atcoder.jp/contests/abc307/tasks/abc307_b | Problem Statement
You are given
N
strings
S_1,S_2,\ldots,S_N
consisting of lowercase English letters.
Determine if there are
distinct
integers
i
and
j
between
1
and
N
, inclusive, such that the concatenation of
S_i
and
S_j
in this order is a palindrome.
A string
T
of length
M
is a palindrome if and only if the
i
-th character and the
(M+1-i)
-th character of
T
are the same for every
1\leq i\leq M
. | [
{
"input": "5\nab\nccef\nda\na\nfe\n",
"output": "Yes\n"
},
{
"input": "3\na\nb\naba\n",
"output": "No\n"
},
{
"input": "2\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n",
"output": "Yes\n"
}
] |
https://atcoder.jp/contests/abc307/tasks/abc307_c | Problem Statement
Takahashi has two sheets
A
and
B
, each composed of black squares and transparent squares, and an infinitely large sheet
C
composed of transparent squares.
There is also an ideal sheet
X
for Takahashi composed of black squares and transparent squares.
The sizes of sheets
A
,
B
, and
X
are
H_A
rows
\times
W_A
columns,
H_B
rows
\times
W_B
columns, and
H_X
rows
\times
W_X
columns, respectively.
The squares of sheet
A
are represented by
H_A
strings of length
W_A
,
A_1, A_2, \ldots, A_{H_A}
consisting of
.
and
#
.
If the
j
-th character
(1\leq j\leq W_A)
of
A_i
(1\leq i\leq H_A)
is
.
, the square at the
i
-th row from the top and
j
-th column from the left is transparent; if it is
#
, that square is black.
Similarly, the squares of sheets
B
and
X
are represented by
H_B
strings of length
W_B
,
B_1, B_2, \ldots, B_{H_B}
, and
H_X
strings of length
W_X
,
X_1, X_2, \ldots, X_{H_X}
, respectively.
Takahashi's goal is to create sheet
X
using
all black squares
in sheets
A
and
B
by following the steps below with sheets
A
,
B
, and
C
.
Paste sheets
A
and
B
onto sheet
C
along the grid. Each sheet can be pasted anywhere by translating it, but it cannot be cut or rotated.
Cut out an
H_X\times W_X
area from sheet
C
along the grid. Here, a square of the cut-out sheet will be black if a black square of sheet
A
or
B
is pasted there, and transparent otherwise.
Determine whether Takahashi can achieve his goal by appropriately choosing the positions where the sheets are pasted and the area to cut out, that is, whether he can satisfy both of the following conditions.
The cut-out sheet includes
all black squares
of sheets
A
and
B
. The black squares of sheets
A
and
B
may overlap on the cut-out sheet.
The cut-out sheet coincides sheet
X
without rotating or flipping. | [
{
"input": "3 5\n#.#..\n.....\n.#...\n2 2\n#.\n.#\n5 3\n...\n#.#\n.#.\n.#.\n...\n",
"output": "Yes\n"
},
{
"input": "2 2\n#.\n.#\n2 2\n#.\n.#\n2 2\n##\n##\n",
"output": "No\n"
},
{
"input": "1 1\n#\n1 2\n##\n1 1\n#\n",
"output": "No\n"
},
{
"input": "3 3\n###\n...\n...\n3 3\n#..\n#..\n#..\n3 3\n..#\n..#\n###\n",
"output": "Yes\n"
}
] |
https://atcoder.jp/contests/abc307/tasks/abc307_d | Problem Statement
You are given a string
S
of length
N
consisting of lowercase English letters and the characters
(
and
)
.
Print the string
S
after performing the following operation as many times as possible.
Choose and delete a contiguous substring of
S
that starts with
(
, ends with
)
, and does not contain
(
or
)
other than the first and last characters.
It can be proved that the string
S
after performing the operation as many times as possible is uniquely determined without depending on how it is performed. | [
{
"input": "8\na(b(d))c\n",
"output": "ac\n"
},
{
"input": "5\na(b)(\n",
"output": "a(\n"
},
{
"input": "2\n()\n",
"output": "\n"
},
{
"input": "6\n)))(((\n",
"output": ")))(((\n"
}
] |
https://atcoder.jp/contests/abc307/tasks/abc307_e | Problem Statement
There are
N
people numbered from
1
to
N
standing in a circle. Person
1
is to the right of person
2
, person
2
is to the right of person
3
, ..., and person
N
is to the right of person
1
.
We will give each of the
N
people an integer between
0
and
M-1
, inclusive.
Among the
M^N
ways to distribute integers, find the number, modulo
998244353
, of such ways that no two adjacent people have the same integer. | [
{
"input": "3 3\n",
"output": "6\n"
},
{
"input": "4 2\n",
"output": "2\n"
},
{
"input": "987654 456789\n",
"output": "778634319\n"
}
] |
https://atcoder.jp/contests/abc307/tasks/abc307_f | Problem Statement
There are
N
rooms numbered
1
,
2
,
\ldots
,
N
, each with one person living in it, and
M
corridors connecting two different rooms. The
i
-th corridor connects room
U_i
and room
V_i
with a length of
W_i
.
One day (we call this day
0
), the
K
people living in rooms
A_1, A_2, \ldots, A_K
got (newly) infected with a virus. Furthermore, on the
i
-th of the following
D
days
(1\leq i\leq D)
, the infection spread as follows.
People who were infected at the end of the night of day
(i-1)
remained infected at the end of the night of day
i
.
For those who were not infected, they were newly infected if and only if they were living in a room within a distance of
X_i
from at least one room where an infected person was living at the end of the night of day
(i-1)
.
Here, the distance between rooms
P
and
Q
is defined as the minimum possible sum of the lengths of the corridors when moving from room
P
to room
Q
using only corridors.
If it is impossible to move from room
P
to room
Q
using only corridors, the distance is set to
10^{100}
.
For each
i
(
1\leq i\leq N
), print the day on which the person living in room
i
was newly infected. If they were not infected by the end of the night of day
D
, print
-1
. | [
{
"input": "4 4\n1 2 2\n2 3 1\n2 4 3\n3 4 2\n1\n1\n2\n3 3\n",
"output": "0\n1\n1\n2\n"
},
{
"input": "7 7\n1 2 2\n2 3 3\n3 4 1\n4 5 1\n5 6 3\n3 7 1\n4 7 1\n2\n1 6\n2\n2 3\n",
"output": "0\n1\n2\n-1\n2\n0\n-1\n"
},
{
"input": "5 1\n1 2 5\n2\n1 3\n3\n3 7 5\n",
"output": "0\n2\n0\n-1\n-1\n"
}
] |
https://atcoder.jp/contests/abc307/tasks/abc307_g | Problem Statement
You are given an integer sequence of length
N
:
A=(A_1,A_2,\ldots,A_N)
.
Takahashi can perform the following two operations any number of times, possibly zero, in any order.
Choose an integer
i
such that
1\leq i\leq N-1
, and decrease
A_i
by
1
and increase
A_{i+1}
by
1
.
Choose an integer
i
such that
1\leq i\leq N-1
, and increase
A_i
by
1
and decrease
A_{i+1}
by
1
.
Find the minimum number of operations required to make the sequence
A
satisfy the following condition:
\lvert A_i-A_j\rvert\leq 1
for any pair
(i,j)
of integers between
1
and
N
, inclusive. | [
{
"input": "3\n2 7 6\n",
"output": "4\n"
},
{
"input": "3\n-2 -5 -2\n",
"output": "2\n"
},
{
"input": "5\n1 1 1 1 -7\n",
"output": "13\n"
}
] |
https://atcoder.jp/contests/abc307/tasks/abc307_h | Problem Statement
There is a length
L
string
S
consisting of uppercase and lowercase English letters displayed on an electronic bulletin board with a width of
W
. The string
S
scrolls from right to left by a width of one character at a time.
The display repeats a cycle of
L+W-1
states, with the first character of
S
appearing from the right edge when the last character of
S
disappears from the left edge.
For example, when
W=5
and
S=
ABC
, the board displays the following seven states in a loop:
ABC..
BC...
C....
....A
...AB
..ABC
.ABC.
(
.
represents a position where no character is displayed.)
More precisely, there are distinct states for
k=0,\ldots,L+W-2
in which the display is as follows.
Let
f(x)
be the remainder when
x
is divided by
L+W-1
. The
(i+1)
-th position from the left of the board displays the
(f(i+k)+1)
-th character of
S
when
f(i+k)<L
, and nothing otherwise.
You are given a length
W
string
P
consisting of uppercase English letters, lowercase English letters,
.
, and
_
.
Find the number of states among the
L+W-1
states of the board that coincide
P
except for the positions with
_
.
More precisely, find the number of states that satisfy the following condition.
For every
i=1,\ldots,W
, one of the following holds.
The
i
-th character of
P
is
_
.
The character displayed at the
i
-th position from the left of the board is equal to the
i
-th character of
P
.
Nothing is displayed at the
i
-th position from the left of the board, and the
i
-th character of
P
is
.
. | [
{
"input": "3 5\nABC\n..___\n",
"output": "3\n"
},
{
"input": "11 15\nabracadabra\n__.._________ab\n",
"output": "2\n"
},
{
"input": "20 30\nabaababbbabaabababba\n__a____b_____a________________\n",
"output": "2\n"
},
{
"input": "1 1\na\n_\n",
"output": "1\n"
}
] |
https://atcoder.jp/contests/atcoder11live/tasks/atcoder11live_a | 問題文
n \times n
マスの盤面がある。
一番左上のマスの座標を
(0, 0)
とし、そこから下方向に
i
マス、右方向に
j
マス進んだ先のマスの座標を
(i, j)
とする。
初期状態で
(si, sj)
の位置に右向きの状態で車のおもちゃが置かれている。
いくつかのマスには初期状態で障害物が設置されており、これらの障害物は取り除いたり他のマスに移動させたりすることは出来ない。
また、
n\times n
の範囲外のマスは全て障害物が置かれているものとして扱う。
残りの空きマスに好きなように障害物を設置せよ。
ただし、車のおもちゃの初期位置には障害物は設置されていないことが保証されており、新たに障害物を設置することも出来ない。
障害物の設置が完了すると、以下のルールに従って車のおもちゃが移動する。
現在の向きに1マス進んだ先に障害物がある場合、その場で右方向に90度回転する。
現在の向きに1マス進んだ先に障害物がない場合、その方向に1マス進む。
この動作を繰り返していると、そのうち既に通ったことのあるマスを同じ向きで通過し、そこから先は同じルートを無限ループすることになる。
無限ループに突入するまでの移動距離が出来るだけ長くなるように障害物を設置せよ。
ここで「無限ループに突入するまでの移動距離」は、以前と同じ位置かつ同じ向きの状態に初めてなった時点での、それまでのルール2の適用回数(最後がルール2の場合はそれを含む)を表す。 | [
{
"input": "20\n10 8\n....................\n........#...........\n....................\n....................\n....................\n.....#.............#\n....................\n...................#\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n",
"output": "31\n19 19\n18 7\n2 9\n16 0\n17 18\n19 9\n0 12\n16 11\n13 0\n14 18\n16 17\n15 12\n11 13\n12 18\n13 17\n8 0\n9 7\n11 6\n10 1\n6 2\n9 18\n3 1\n0 5\n6 4\n5 2\n2 3\n3 17\n6 16\n5 12\n3 19\n2 14\n"
}
] |
https://atcoder.jp/contests/arc162/tasks/arc162_a | Problem Statement
There are
N
people, numbered from
1
to
N
, who participated in a round-trip race between two points. The following information is recorded about this race.
The
outward
times of any two people were different, and person
i
(1 \leq i \leq N)
had the
i
-th fastest outward time.
The
round-trip
times (the sum of the outward and return times) of any two people were different, and person
i
(1 \leq i \leq N)
had the
P_i
-th fastest round-trip time.
The person (or persons) with the fastest
return
time was awarded the
fastest return award
.
Here,
P_1, P_2, \dots, P_N
is a permutation of
1, 2, \dots, N
.
How many people could have received the
fastest return award
?
There are
T
test cases. Answer each of them. | [
{
"input": "3\n2\n2 1\n4\n1 2 3 4\n20\n13 2 7 1 5 9 3 4 12 10 15 6 8 14 20 16 19 18 11 17\n",
"output": "1\n4\n7\n"
}
] |
https://atcoder.jp/contests/arc162/tasks/arc162_b | Problem Statement
A permutation
P=(P_1,P_2,\ldots,P_N)
of
(1,2,\ldots,N)
is given.
Determine whether it is possible to rearrange
P
in ascending order by performing the following operation at most
2\times 10^3
times, and if possible, show one such sequence of operations.
Choose integers
i
and
j
such that
1\leq i \leq N-1,0 \leq j \leq N-2
. Let
Q = (Q_1, Q_2,\ldots,Q_{N-2})
be the sequence obtained by removing
(P_i,P_{i+1})
from
P
. Replace
P
with
(Q_1,\ldots,Q_j, P_i, P_{i+1}, Q_{j+1},\ldots,Q_{N-2})
. | [
{
"input": "5\n1 4 2 3 5\n",
"output": "Yes\n1\n3 1\n"
},
{
"input": "2\n2 1\n",
"output": "No\n"
},
{
"input": "4\n3 4 1 2\n",
"output": "Yes\n3\n3 0\n1 2\n3 0\n"
}
] |
https://atcoder.jp/contests/arc162/tasks/arc162_c | Problem Statement
You are given a rooted tree with
N
vertices numbered
1
to
N
. Vertex
1
is the root, and the parent of vertex
i\ (2\leq i \leq N)
is
P_i
.
Some vertices of the rooted tree have non-negative integers from
0
to
N
written on them. This information is given by the sequence
A=(A_1,A_2,\ldots,A_N)
. If
A_i \neq -1
, vertex
i
has the integer
A_i
written on it; if
A_i=-1
, vertex
i
does not have an integer written on it.
Alice and Bob play a game. Alice goes first, and they take turns performing the following operation until all vertices have an integer written on them.
Choose one vertex without an integer written on it and write a non-negative integer between
0
and
N
on it.
After the operations, for each vertex
v
, let
f(v)
be the smallest non-negative integer not written on any vertex (including
v
) in the subtree rooted at vertex
v
.
If there is a vertex
v
such that
f(v) = K
, Alice wins. Otherwise, Bob wins. Determine the winner when both players play optimally.
There are
T
test cases. Answer each of them. | [
{
"input": "2\n4 2\n1 1 2\n-1 -1 3 1\n6 4\n1 2 2 1 3\n-1 -1 -1 -1 -1 -1\n",
"output": "Alice\nBob\n"
}
] |
https://atcoder.jp/contests/arc162/tasks/arc162_d | Problem Statement
In this problem, a rooted directed tree is a rooted tree where all edges are directed from the root to the leaves.
You are given a sequence of non-negative integers
d=(d_1,d_2,\ldots,d_N)
with a sum of
N-1
.
Among the
N
-vertex rooted directed trees with vertex numbered
1
to
N
and vertex
1
as the root, a
good tree
is one that satisfies the following condition:
the out-degree of vertex
i\ (1\leq i \leq N)
is
d_i
.
Furthermore, for a vertex
v
of a good tree, let
f(v)
be the minimum vertex number of the vertices (including
v
) in the subtree rooted at vertex
v
, and
v
is called a
good vertex
if it satisfies
f(v)=v
.
Find the sum of the numbers of good vertices for all good trees, modulo
998244353
. | [
{
"input": "4\n2 0 1 0\n",
"output": "7\n"
},
{
"input": "10\n3 1 0 0 2 0 1 2 0 0\n",
"output": "37542\n"
}
] |
https://atcoder.jp/contests/arc162/tasks/arc162_e | Problem Statement
You are given a sequence of length
N
consisting of integers from
1
to
N
,
A=(A_1,A_2,\ldots,A_N)
.
Find the number, modulo
998244353
, of sequences of length
N
consisting of integers from
1
to
N
,
B=(B_1,B_2,\ldots,B_N)
, that satisfy the following conditions for all
i=1,2,\ldots,N
.
The number of occurrences of
i
in
B
is at most
A_i
.
The number of occurrences of
B_i
in
B
is at most
A_i
. | [
{
"input": "3\n1 2 3\n",
"output": "10\n"
},
{
"input": "4\n4 4 4 4\n",
"output": "256\n"
},
{
"input": "5\n1 1 1 1 1\n",
"output": "120\n"
},
{
"input": "14\n6 5 14 3 6 7 3 11 11 2 3 7 8 10\n",
"output": "628377683\n"
}
] |
https://atcoder.jp/contests/arc162/tasks/arc162_f | Problem Statement
You are given positive integers
N
and
M
. Among the
2^{NM}
matrices
A
with
N
rows and
M
columns where each element is
0
or
1
, find the number, modulo
998244353
, of ones that satisfy the following condition:
A_{a, b} \times A_{c, d} \leq A_{a, d} \times A_{c, b}
for every quadruple of integers
(a, b, c, d)
such that
1 \leq a < c \leq N
and
1 \leq b < d \leq M
. | [
{
"input": "2 2\n",
"output": "13\n"
},
{
"input": "1 30\n",
"output": "75497471\n"
},
{
"input": "400 400\n",
"output": "412670892\n"
}
] |
https://atcoder.jp/contests/abc306/tasks/abc306_a | Problem Statement
You are given a string
S
of length
N
consisting of lowercase English letters.
We denote the
i
-th character of
S
by
S_i
.
Print the string of length
2N
obtained by concatenating
S_1,S_1,S_2,S_2,\dots,S_N
, and
S_N
in this order.
For example, if
S
is
beginner
, print
bbeeggiinnnneerr
. | [
{
"input": "8\nbeginner\n",
"output": "bbeeggiinnnneerr\n"
},
{
"input": "3\naaa\n",
"output": "aaaaaa\n"
}
] |
https://atcoder.jp/contests/abc306/tasks/abc306_b | Problem Statement
You are given a sequence
A=(A_0,A_1,\dots,A_{63})
of length
64
consisting of
0
and
1
.
Find
A_0 2^0 + A_1 2^1 + \dots + A_{63} 2^{63}
. | [
{
"input": "1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n",
"output": "13\n"
},
{
"input": "1 0 1 0 1 0 0 0 0 1 0 0 1 1 0 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0\n",
"output": "766067858140017173\n"
}
] |
https://atcoder.jp/contests/abc306/tasks/abc306_c | Problem Statement
You are given a sequence
A=(A_1,A_2,\dots,A_{3N})
of length
3N
where each of
1,2,\dots
, and
N
occurs exactly three times.
For
i=1,2,\dots,N
, let
f(i)
be the index of the middle occurrence of
i
in
A
.
Sort
1,2,\dots,N
in ascending order of
f(i)
.
Formally,
f(i)
is defined as follows.
Suppose that those
j
such that
A_j = i
are
j=\alpha,\beta,\gamma\ (\alpha < \beta < \gamma)
. Then,
f(i) = \beta
. | [
{
"input": "3\n1 1 3 2 3 2 2 3 1\n",
"output": "1 3 2\n"
},
{
"input": "1\n1 1 1\n",
"output": "1\n"
},
{
"input": "4\n2 3 4 3 4 1 3 1 1 4 2 2\n",
"output": "3 4 1 2\n"
}
] |
https://atcoder.jp/contests/abc306/tasks/abc306_d | Problem Statement
Takahashi has decided to enjoy a wired full-course meal consisting of
N
courses in a restaurant.
The
i
-th course is:
if
X_i=0
, an
antidotal
course with a tastiness of
Y_i
;
if
X_i=1
, a
poisonous
course with a tastiness of
Y_i
.
When Takahashi eats a course, his state changes as follows:
Initially, Takahashi has a healthy stomach.
When he has a
healthy stomach
,
if he eats an
antidotal
course, his stomach
remains healthy
;
if he eats a
poisonous
course, he
gets an upset stomach
.
When he has an
upset stomach
,
if he eats an
antidotal
course, his stomach
becomes healthy
;
if he eats a
poisonous
course, he
dies
.
The meal progresses as follows.
Repeat the following process for
i = 1, \ldots, N
in this order.
First, the
i
-th course is served to Takahashi.
Next, he chooses whether to "eat" or "skip" the course.
If he chooses to "eat" it, he eats the
i
-th course. His state also changes depending on the course he eats.
If he chooses to "skip" it, he does not eat the
i
-th course. This course cannot be served later or kept somehow.
Finally, (if his state changes, after the change) if he is not dead,
if
i \neq N
, he proceeds to the next course.
if
i = N
, he makes it out of the restaurant alive.
An important meeting awaits him, so he must make it out of there alive.
Find the
maximum possible sum of tastiness of the courses that he eats
(or
0
if he eats nothing) when he decides whether to "eat" or "skip" the courses under that condition. | [
{
"input": "5\n1 100\n1 300\n0 -200\n1 500\n1 300\n",
"output": "600\n"
},
{
"input": "4\n0 -1\n1 -2\n0 -3\n1 -4\n",
"output": "0\n"
},
{
"input": "15\n1 900000000\n0 600000000\n1 -300000000\n0 -700000000\n1 200000000\n1 300000000\n0 -600000000\n1 -900000000\n1 600000000\n1 -100000000\n1 -400000000\n0 900000000\n0 200000000\n1 -500000000\n1 900000000\n",
"output": "4100000000\n"
}
] |
https://atcoder.jp/contests/abc306/tasks/abc306_e | Problem Statement
We have a sequence
A=(A_1,A_2,\dots,A_N)
of length
N
. Initially, all the terms are
0
.
Using an integer
K
given in the input, we define a function
f(A)
as follows:
Let
B
be the sequence obtained by sorting
A
in descending order (so that it becomes monotonically non-increasing).
Then, let
f(A)=B_1 + B_2 + \dots + B_K
.
We consider applying
Q
updates on this sequence.
Apply the following operation on the sequence
A
for
i=1,2,\dots,Q
in this order, and print the value
f(A)
at that point after each update.
Change
A_{X_i}
to
Y_i
. | [
{
"input": "4 2 10\n1 5\n2 1\n3 3\n4 2\n2 10\n1 0\n4 0\n3 1\n2 0\n3 0\n",
"output": "5\n6\n8\n8\n15\n13\n13\n11\n1\n0\n"
}
] |
https://atcoder.jp/contests/abc306/tasks/abc306_f | Problem Statement
For two sets of integers,
A
and
B
, such that
A \cap B = \emptyset
, we define
f(A,B)
as follows.
Let
C=(C_1,C_2,\dots,C_{|A|+|B|})
be a sequence consisting of the elements of
A \cup B
, sorted in ascending order.
Take
k_1,k_2,\dots,k_{|A|}
such that
A=\lbrace C_{k_1},C_{k_2},\dots,C_{k_{|A|}}\rbrace
.
Then, let
\displaystyle f(A,B)=\sum_{i=1}^{|A|} k_i
.
For example, if
A=\lbrace 1,3\rbrace
and
B=\lbrace 2,8\rbrace
, then
C=(1,2,3,8)
, so
A=\lbrace C_1,C_3\rbrace
; thus,
f(A,B)=1+3=4
.
We have
N
sets of integers,
S_1,S_2\dots,S_N
, each of which has
M
elements. For each
i\ (1 \leq i \leq N)
,
S_i = \lbrace A_{i,1},A_{i,2},\dots,A_{i,M}\rbrace
.
Here, it is guaranteed that
S_i \cap S_j = \emptyset\ (i \neq j)
.
Find
\displaystyle \sum_{1\leq i<j \leq N} f(S_i, S_j)
. | [
{
"input": "3 2\n1 3\n2 8\n4 6\n",
"output": "12\n"
},
{
"input": "1 1\n306\n",
"output": "0\n"
},
{
"input": "4 4\n155374934 164163676 576823355 954291757\n797829355 404011431 353195922 138996221\n191890310 782177068 818008580 384836991\n160449218 545531545 840594328 501899080\n",
"output": "102\n"
}
] |
https://atcoder.jp/contests/abc306/tasks/abc306_g | Problem Statement
We have a directed graph with
N
vertices and
M
edges.
The vertices are numbered from
1
through
N
, and the
i
-th edge goes from vertex
U_i
to vertex
V_i
.
You are currently at vertex
1
.
Determine if you can make the following move
10^{10^{100}}
times to end up at vertex
1
:
choose an edge going from the vertex you are currently at, and move to the vertex that the edge points at.
Given
T
test cases, solve each of them. | [
{
"input": "4\n2 2\n1 2\n2 1\n3 3\n1 2\n2 3\n3 1\n7 10\n1 6\n6 3\n1 4\n5 1\n7 1\n4 5\n2 1\n4 7\n2 7\n4 3\n7 11\n1 6\n6 3\n1 4\n5 1\n7 1\n4 5\n2 1\n4 7\n2 7\n4 3\n3 7\n",
"output": "Yes\nNo\nNo\nYes\n"
}
] |
https://atcoder.jp/contests/abc306/tasks/abc306_h | Problem Statement
There are
N
weights numbered
1,2, \dots,N
.
Using a balance, we will compare weights
M
times.
Before the comparisons, prepare an empty string
S
.
For the
i
-th comparison, put just weight
A_i
to the left bowl, and just weight
B_i
to the right.
Then, one of the following three results is obtained.
If weight
A_i
is heavier than weight
B_i
,
append
>
to the tail of
S
.
If weight
A_i
and weight
B_i
have the same mass,
append
=
to the tail of
S
.
If weight
A_i
is lighter than weight
B_i
,
append
<
to the tail of
S
.
The result is always accurate.
After the experiment, you will obtain a string
S
of length
M
.
Among the
3^M
strings of length
M
consisting of
>
,
=
, and
<
, how many can be obtained as
S
by the experiment?
Since the answer can be enormous, print the answer modulo
998244353
. | [
{
"input": "3 3\n1 2\n1 3\n2 3\n",
"output": "13\n"
},
{
"input": "4 4\n1 4\n2 3\n1 3\n3 4\n",
"output": "39\n"
},
{
"input": "14 15\n1 2\n1 3\n2 4\n2 5\n2 6\n4 8\n5 6\n6 8\n7 8\n9 10\n9 12\n9 13\n10 11\n11 12\n11 13\n",
"output": "1613763\n"
}
] |
https://atcoder.jp/contests/ahc020/tasks/ahc020_a | Problem Statement
You are given a weighted planar undirected graph
G
with
N
vertices and
M
edges.
The coordinates of vertex
i
are
(x_i, y_i)
.
The
j
-th edge connects vertices
u_j
and
v_j
with the weight
w_j
.
Let
D_j=\mathrm{round}\left(\sqrt{(x_{u_j}-x_{v_j})^2+(y_{u_j}-y_{v_j})^2}\right)
be the rounded Euclidean distance between vertices
u_j
and
v_j
.
Then, weight
w_j
satisfies
100D_j\le w_j\le 2500D_j
.
You are also given
K
coordinates of the residents, and the coordinates of
k
-th resident are
(a_k, b_k)
.
You should set the
power
ON/OFF for each edge and the
output strength
integer
P_i\ (0\le P_i\le 5000)
for each vertex
i=1,2,\cdots,N
.
Let
E'
be the set of edges whose
power
is ON.
Consider a subgraph
G'
obtained from
G
by removing edges not included in
E'
, and let
V'
be the set of vertices reachable from vertex
1
in
G'
.
For each
i\in V'
, residents living within a circular region of radius
P_i
centered at coordinates
(x_i, y_i)
(including the circumference) will be able to view the live broadcast.
Setting the
power
of edge
j
to ON incurs a cost
w_j
.
Also, setting the
output strength
of vertex
i
to
P_i
incurs a cost
P_i^2
.
You may set
P_i
to a positive value for
i\notin V'
, but this will not expand the broadcasting coverage area and incurs unnecessary costs.
Please build a TV network that can deliver live broadcasts to all residents while reducing the sum of the costs
S=\sum_{i=1}^N{P_i^2}+\sum_{j\in E'} w_j
as small as possible. | [
{
"input": "100 284 5000\n0 0\n957 -6517\n-412 -5500\n-299 4489\n-8357 6534\n1974 -6619\n1410 -8691\n8833 -9829\n7785 2682\n-9839 443\n-5084 6063\n8064 4821\n7008 1946\n2894 -5980\n-3445 9927\n-1403 3591\n5030 5758\n3178 1199\n-9263 -3926\n-3126 -2879\n4179 4360\n5715 595\n7209 -8569\n823 1184\n-746 749\n-3409 7622\n5468 -6147\n-7479 1331\n1299 8707\n-9525 5693\n6952 -1036\n-1847 7832\n-8129 -632\n2575 -8725\n4839 -8823\n-1227 -2757\n-865 9847\n9455 -8941\n2105 1380\n-8588 675\n-3585 -8061\n-543 2285\n7669 -4769\n3977 7810\n-6819 7984\n4477 -3530\n279 -3858\n-3531 6521\n6752 7090\n-3589 3467\n8840 9058\n1138 4829\n5927 9169\n-7256 -8695\n-5914 5270\n7778 -9846\n-283 7559\n6475 3086\n6568 -5629\n1368 3290\n-2612 -6222\n5559 4602\n-4431 8668\n-2072 4991\n-6171 666\n1183 -2097\n425 6606\n-7755 -7400\n-4505 -5471\n-5776 -1337\n3414 2515\n-9779 7048\n-9781 -9234\n3446 -7015\n-6939 9996\n-8407 -5104\n-5700 -8465\n2124 7411\n-7239 -1981\n-3340 -4625\n8108 288\n-9886 2218\n-6628 6156\n-5001 1060\n-1090 -8501\n9653 -2947\n7313 8497\n8828 -1973\n-9054 -7660\n972 2185\n-9188 4513\n-1869 1170\n-8734 -6359\n-5730 7662\n-6406 2570\n-605 -9813\n8601 5913\n-4170 -2869\n9790 4013\n-5790 -5997\n1 24 1961044\n1 25 803653\n1 36 2149178\n1 39 720570\n1 66 2666245\n2 3 198863\n2 6 981819\n2 7 1002029\n2 14 1390847\n2 47 301699\n2 85 6492902\n3 36 3720981\n3 47 972093\n3 61 1755622\n3 80 3855920\n3 85 2673331\n4 16 269170\n4 42 2257144\n4 52 384550\n4 60 3282144\n4 64 1608380\n4 67 2739694\n5 30 302160\n5 45 479283\n5 72 3777471\n5 83 1793800\n5 91 4240666\n6 7 3372544\n6 14 1088387\n6 34 2853452\n6 74 1681663\n7 34 334110\n7 85 5195354\n7 96 2122187\n8 23 1612119\n8 38 796325\n8 56 2170213\n9 12 339711\n9 13 179371\n9 58 1600443\n9 81 2137212\n9 99 3223426\n10 19 2104800\n10 33 3223016\n10 40 1052534\n10 73 19940454\n10 82 276713\n11 26 5559911\n11 48 1121239\n11 50 506384\n11 55 1601136\n11 83 3304135\n11 94 385023\n12 49 1635427\n12 58 565334\n12 62 4806528\n12 97 518106\n12 99 466285\n13 22 1945433\n13 58 1109618\n13 81 3783667\n14 27 4477802\n14 46 4807662\n14 47 7935716\n14 74 869544\n15 26 1285472\n15 32 4557285\n15 37 3494866\n15 63 1443214\n15 75 6807855\n16 42 843799\n16 50 3992263\n16 64 2231942\n16 92 5838277\n17 21 2535473\n17 44 5683991\n17 49 728267\n17 62 639200\n17 78 2768275\n18 22 2407337\n18 39 1174245\n18 46 5272611\n18 66 1396847\n18 71 2170381\n19 33 5995791\n19 73 857598\n19 76 155059\n19 79 2214286\n19 89 7776467\n19 93 4595312\n20 36 2849583\n20 80 1023302\n20 84 3777074\n20 92 4863881\n20 98 1403641\n21 52 606174\n21 58 724586\n21 60 4579338\n21 62 788171\n21 71 214051\n21 78 3645910\n22 31 1140709\n22 46 1315835\n22 58 1155185\n22 71 3695671\n22 81 1015839\n23 27 306793\n23 35 1672314\n23 38 2524742\n23 43 1052692\n23 56 2914962\n23 59 2909619\n24 25 659513\n24 39 528757\n24 42 2122367\n24 90 1653434\n25 36 1576870\n25 42 3589112\n25 92 2642427\n26 32 2061585\n26 48 2330034\n26 63 1774641\n26 94 2208248\n27 35 1421525\n27 46 2563136\n27 59 234128\n27 74 1075987\n28 33 1726387\n28 40 1203167\n28 65 2435204\n28 82 3614853\n28 91 3108610\n28 95 2541293\n29 37 659862\n29 44 363301\n29 53 2203971\n29 57 618234\n29 67 2386457\n29 78 392887\n30 72 480864\n30 82 5087445\n30 91 2017021\n31 43 472273\n31 46 2357133\n31 81 3031311\n31 88 3993946\n32 37 1110037\n32 48 3124964\n32 57 450365\n32 64 3744171\n33 40 320720\n33 65 1307750\n33 70 796949\n33 79 597053\n34 35 5211179\n34 74 4086417\n34 96 4965161\n35 56 616180\n35 74 1537344\n35 96 10296120\n36 47 3639923\n36 66 3312415\n36 80 4432286\n36 92 9798847\n37 51 6294966\n37 53 13099145\n37 57 751706\n38 43 10872435\n38 86 1113751\n39 60 1402549\n39 66 4818354\n39 71 1706215\n39 90 307747\n40 82 4831351\n41 61 964684\n41 69 481023\n41 77 3573120\n41 85 374575\n41 96 1521337\n41 100 2683506\n42 60 1432260\n42 90 3034147\n42 92 1686226\n43 46 1526992\n43 59 671191\n43 86 6370295\n43 88 538619\n44 49 6065634\n44 53 4807753\n44 78 4177840\n45 72 2618880\n45 75 3972537\n45 83 304056\n45 94 2123857\n46 47 3745842\n46 59 444678\n46 66 2562672\n47 66 646770\n48 50 659372\n48 64 3058337\n49 53 4344772\n49 62 858487\n49 87 3280762\n49 97 2922149\n50 55 4031112\n50 64 3738887\n50 84 2124241\n50 92 557352\n50 95 2374059\n51 53 1147341\n51 87 2727398\n51 97 6756121\n51 99 4446056\n52 60 518027\n52 67 4493902\n52 78 6489428\n53 87 2002471\n54 68 279235\n54 73 1224859\n54 77 2377049\n54 89 1727779\n54 96 9031630\n55 83 2525675\n55 91 5090649\n55 95 1274396\n56 96 4511336\n57 64 4110717\n57 67 974227\n58 62 1928055\n58 71 3735557\n60 71 5457620\n60 90 1590347\n61 69 1753311\n61 80 1242557\n61 85 6147456\n63 75 895640\n63 94 237995\n64 67 1308487\n65 70 367910\n65 84 1007231\n65 95 2071917\n67 78 1058484\n68 76 1865709\n68 77 2241143\n68 89 666494\n68 93 862676\n68 100 2664834\n69 80 634528\n69 98 885866\n69 100 2812839\n70 79 2126522\n70 84 3340579\n70 98 4123611\n72 75 4878159\n72 82 2591727\n73 82 13001596\n73 89 3893961\n73 96 13722741\n75 94 2394029\n76 79 4446208\n76 93 1243258\n76 100 379726\n77 96 828346\n77 100 5256971\n79 98 999057\n79 100 6305125\n80 98 4507234\n81 88 667462\n81 99 3127110\n82 91 1579832\n83 91 7020945\n83 94 1442016\n84 92 3331086\n84 95 2263243\n84 98 3139166\n85 96 2367805\n86 88 2291872\n86 99 1479464\n87 97 787230\n88 99 3739897\n89 93 849855\n91 95 5642404\n97 99 816778\n98 100 4857434\n0 9050\n-8434 -5520\n8434 -5520\n-1310 3740\n-6670 -5520\n4050 -5520\n0 -1560\n-4208 -8830\n4208 -8830\n-5738 -957\n-3044 -8175\n399 4516\n-669 -3886\n5889 -3395\n2649 -817\n31 -3195\n-3271 -8565\n-7515 -4319\n-16 -5127\n6091 -4920\n-2785 2290\n-210 -3577\n4279 -1060\n2889 -8597\n-1215 -3791\n4387 -2243\n2575 -2330\n4326 -4050\n-3630 2013\n-423 -5827\n261 -4012\n3928 -8438\n-2304 2679\n-219 -2281\n1238 -6814\n-7909 -4917\n-56 -8242\n-4487 59\n550 2368\n-1054 5548\n-1389 5862\n4967 -2804\n-6457 -3365\n4419 -693\n3128 -38\n-5167 -2436\n-489 7647\n173 -6999\n4263 -5362\n5502 -3630\n-7797 -4590\n4108 -188\n4244 -2835\n-6275 -2569\n4007 1559\n-3270 3101\n-548 4064\n-1187 5091\n362 -3634\n-1477 3818\n-3019 3386\n-473 5895\n1749 1826\n-6605 -2446\n5373 -2166\n2790 340\n2517 -6525\n-1015 -5440\n1327 709\n-467 5377\n-4537 1089\n633 2010\n-1894 4739\n-1599 -8350\n5219 -506\n7635 -4185\n5650 -3879\n940 5487\n-2698 -8664\n2539 684\n-1015 -6439\n3106 1770\n-1728 4767\n-1760 3744\n-951 -5308\n-2327 3602\n2498 -1452\n-2442 -7518\n4092 1057\n284 -4439\n1296 4216\n-3731 1188\n445 -7090\n-1406 -6666\n-112 2242\n-4749 482\n1697 5304\n5334 -3939\n2304 1648\n6157 -4079\n1272 -6979\n2332 -7483\n-1053 -4096\n3029 2683\n-6817 -4790\n1059 5473\n-3709 -159\n1299 -703\n-97 7234\n3057 1294\n604 -6253\n5935 -4216\n832 -3922\n-5475 -3087\n2658 -8807\n5356 -1433\n2208 4168\n-6780 -2928\n-905 -6784\n-7492 -4591\n6253 -5307\n1923 4332\n4107 -1996\n768 7089\n3222 2873\n5526 -2266\n-5473 -1446\n-3056 736\n-674 4328\n3396 2071\n2328 3609\n-2916 3417\n-1185 3618\n580 -5564\n-107 -7022\n5648 -5505\n-6665 -3556\n4887 590\n1692 589\n-2865 1988\n-2530 -6293\n4114 -3672\n-5086 -1203\n4018 1387\n4111 -2777\n6672 -3697\n-2203 -6839\n5424 -4827\n2673 1694\n7666 -4521\n1761 1360\n683 -3665\n2280 -8206\n3525 -513\n4181 1048\n6783 -5487\n-1668 5137\n601 4712\n3038 -709\n-6332 -4252\n-3447 1426\n737 2621\n1063 4678\n4027 -5465\n-1264 -4177\n-5220 -90\n1655 -7641\n-3765 -8589\n-811 4604\n3915 -8354\n2917 1360\n414 5300\n-3253 519\n-6176 -3308\n184 -8115\n-2107 -8378\n868 -7904\n3756 -2874\n207 -5438\n2359 -1644\n268 -5465\n5625 -1514\n5478 -4923\n235 -3315\n2875 961\n1301 6358\n-1131 -8141\n1210 -6224\n1008 -251\n3810 -4641\n-2323 -7478\n-967 -5708\n3889 -2205\n1344 3088\n4393 -3872\n1067 4243\n6954 -4505\n-4843 -860\n3198 -1413\n-2221 3370\n2991 -2697\n3529 -2246\n6073 -3598\n-1268 -7039\n-5366 -220\n700 -7891\n70 -6630\n916 2782\n507 -3632\n-2828 -6618\n2757 -1109\n2645 -1166\n-5294 -1578\n2890 3200\n-137 7255\n1580 5245\n40 2869\n-292 -4165\n-3200 760\n450 -4289\n103 1573\n-6830 -4490\n-1300 -7147\n2706 -2603\n6276 -1836\n1260 -333\n421 7489\n5540 -3458\n399 -8009\n4728 -4865\n1859 -5905\n7128 -5198\n2755 2726\n4198 1487\n-6066 -1873\n-671 -7931\n-7257 -5012\n1578 5716\n-1125 -7332\n-1937 -8418\n4066 -1807\n-230 4114\n2377 -8061\n1690 4749\n-681 -7976\n3111 -8384\n1953 5631\n6286 -2051\n3298 -1542\n-1494 5425\n1666 1370\n-1371 5524\n3442 -136\n2762 -6751\n2758 1206\n184 5115\n997 5500\n4220 -3163\n4689 -1281\n256 3464\n-1553 3587\n3212 1295\n551 5120\n853 5531\n3160 -1202\n3835 -4380\n-16 3641\n3017 3741\n-59 8001\n5682 -1389\n-3438 1435\n-1907 4781\n4116 -8765\n1419 5470\n-4728 -129\n4435 -5477\n403 -2892\n394 5823\n6248 -2935\n-1431 -8717\n-1885 -8435\n-5107 -122\n4299 259\n-1259 3811\n796 -3834\n-6754 -3337\n-2348 -8288\n6618 -4856\n-6550 -4833\n3522 1118\n1318 4041\n1076 -6557\n3305 -1543\n-340 6737\n-4799 694\n356 2005\n5206 -4015\n-2544 -8119\n285 6483\n-3673 1649\n775 3137\n-2229 4793\n-442 -7989\n-3000 3381\n-1523 4090\n-182 -4874\n-1646 4627\n2806 1816\n-1191 5851\n4198 -2721\n-839 -8814\n7924 -5423\n4942 -3776\n1459 1744\n-435 5524\n-2768 3007\n857 -4735\n829 6644\n6867 -2876\n6591 -2629\n-5405 -489\n1329 1192\n-185 -5114\n1217 5717\n3320 1715\n1852 -1200\n-235 -6545\n-4150 -757\n1942 1570\n2739 85\n1193 5916\n1179 -5146\n2844 -6927\n5228 -3074\n-2302 -8245\n-2507 3762\n595 -3832\n1113 -7435\n3917 453\n2147 -7826\n7368 -5456\n-443 4488\n-1049 -6000\n-1391 -6294\n-1530 4157\n-3379 278\n2414 -8506\n1137 6730\n5156 -1878\n-401 7568\n992 -5664\n986 1968\n160 -4132\n6516 -4807\n1246 -8207\n-2094 4525\n5076 -4515\n-2027 -7505\n-2726 2230\n1258 4149\n-345 6717\n1147 2316\n2029 -8575\n-6955 -4212\n1926 -1281\n6729 -2796\n802 708\n2906 469\n4487 378\n601 -8689\n2025 2483\n3548 -2416\n2765 -8436\n-198 7847\n689 -7695\n3488 -2858\n-6466 -4848\n4929 -1969\n2714 4250\n-34 -4796\n-5078 -2238\n1076 692\n-6362 -4070\n-989 -3546\n1193 2431\n694 -5130\n-678 6319\n536 -6804\n-6362 -2117\n1369 6410\n1358 4407\n-4877 -1457\n6733 -3196\n-1232 -6973\n-3416 1904\n6182 -3313\n7675 -4676\n-2119 -8409\n-5184 -2758\n507 5135\n-7134 -4568\n-7173 -3657\n-4384 -384\n4366 -3546\n3739 -3870\n418 -7427\n-1715 3967\n-695 -2884\n7357 -5011\n4095 -999\n-434 -8313\n4694 -4241\n3494 2181\n-7202 -4197\n3709 -1270\n3121 -8773\n-4659 237\n-322 -7873\n4614 -2904\n2446 3729\n-430 -6549\n5092 -2558\n2547 3378\n-4715 830\n1965 1031\n3957 -8780\n-724 5529\n3531 1979\n283 -6288\n391 -6110\n5299 -4908\n5581 -1644\n-2342 -7477\n2219 1973\n6769 -4387\n-1266 5774\n4537 -2569\n1008 2891\n3305 -1652\n-6197 -3068\n7458 -5297\n930 7219\n2305 -1105\n-2558 2492\n655 -7749\n-2499 4175\n-63 -5713\n-1745 -7437\n7990 -4914\n5784 -4854\n-54 -2379\n4634 -360\n-3188 2683\n3723 -1695\n4385 -2823\n4810 498\n-2525 -8292\n2397 -7973\n695 -3718\n-150 8117\n6643 -4723\n1566 1314\n-2585 -7303\n1806 5856\n434 -5992\n1694 4782\n7572 -4479\n7257 -5189\n5482 -4868\n-1902 -6477\n-190 -7750\n-826 -3352\n1982 -7856\n-3810 247\n-5898 -1608\n4870 -2996\n-5821 -1358\n-3849 1723\n570 -4273\n-1131 6145\n-1308 -8090\n-161 -2490\n-7 -5636\n-583 -3316\n-3263 1914\n-548 -4057\n6136 -3609\n3141 255\n-768 -3152\n-3521 -8519\n-195 7705\n-1152 6074\n594 1922\n-840 -8823\n-3128 -7170\n1316 -5408\n6291 -2702\n6090 -1854\n2898 371\n-258 5131\n652 -5980\n-1791 -7272\n4215 1485\n1078 2285\n395 -2481\n394 -8049\n1043 -7156\n-733 3083\n-4493 208\n3895 -4505\n-5619 -2764\n-1248 4858\n-49 6385\n-1511 -6952\n278 -4774\n343 -6673\n2418 4753\n4146 -1808\n405 7036\n1660 2794\n-7618 -5018\n140 -2127\n1575 -5031\n-2028 -6027\n-1397 6013\n1245 -7257\n3604 -2271\n137 3303\n-5523 -771\n2998 265\n-3066 -7726\n-1030 -7889\n6625 -4814\n5099 -2427\n-923 6194\n655 3496\n-3564 2153\n4968 -3158\n-612 -4143\n1504 -8460\n-88 1682\n-2328 -7267\n-2317 -7028\n-3513 252\n3818 937\n1854 -1651\n3728 2122\n97 4857\n-506 4018\n3285 -3681\n6119 -4149\n2091 -6905\n178 -6860\n6954 -3122\n-1429 -5821\n-5569 -1698\n6561 -2797\n4408 -453\n1508 4056\n1182 -194\n-2725 2354\n2447 780\n3423 2719\n1914 -6293\n4675 -3340\n-1407 -5910\n-2856 -7132\n228 -3799\n-4050 -784\n4604 -2170\n2550 1215\n1285 1637\n478 2913\n-148 3552\n2364 2611\n-1860 -4836\n-5831 -3333\n590 1358\n1277 -5412\n-1259 -8350\n5698 -4208\n4550 -2794\n4032 -2645\n-1796 5832\n7082 -4793\n2656 -6245\n-349 3283\n-4108 847\n1727 -44\n2483 1349\n-658 4690\n-1440 -7396\n378 6127\n3089 2702\n2794 -1655\n-4646 -1632\n208 5862\n-4577 -552\n-2855 -8418\n-1745 3421\n-6297 -2313\n1612 1604\n-2038 -7170\n4478 927\n-81 -8807\n4001 -1420\n-635 4177\n5409 -4278\n7158 -3334\n94 -5845\n3085 -7565\n290 4362\n2931 -7953\n-731 -5280\n4993 -2020\n7388 -3871\n7085 -5467\n5091 -3769\n4167 -4158\n-3775 840\n3934 -3103\n-2927 -6978\n-3510 982\n3170 2768\n988 57\n1357 6143\n3261 -1886\n681 -7615\n1749 615\n4612 227\n-1858 5297\n151 -5209\n2012 4220\n3586 -3609\n-1479 -7522\n-7420 -4839\n2211 -6781\n5983 -3322\n-823 3700\n-20 9012\n1466 -8602\n-5465 -3150\n-1811 -8699\n-1541 4321\n-2523 4046\n2485 4174\n1798 -5580\n1802 -69\n852 4072\n-243 7996\n5047 -2270\n-6999 -5059\n-1823 -7109\n-8 -4301\n1629 952\n-595 -3641\n3224 999\n-2813 -7474\n-2664 3389\n2912 3306\n0 -4655\n3520 -600\n114 -5005\n4719 -2418\n1579 2421\n-2253 -6372\n1175 -4168\n-1779 3221\n-427 -7109\n271 -8012\n5179 -1012\n-2998 -8676\n933 6150\n5460 -1459\n-92 1693\n767 5758\n4167 -2912\n5389 -2387\n5411 -3682\n1435 -7680\n-5210 -2946\n-1256 6420\n2154 1712\n4007 -235\n-1175 6567\n2294 -7580\n-1441 4931\n3076 -3117\n-448 7902\n4644 -5439\n514 1735\n-1656 -6706\n802 -5943\n2435 -2096\n6257 -2209\n1896 -5336\n1162 -189\n-1549 -7782\n-170 2362\n2413 3339\n-534 -3992\n4668 -5192\n8127 -5159\n5064 -955\n-6318 -4869\n4114 -466\n-7683 -5468\n2251 4852\n-2484 2854\n-5829 -1496\n-1495 -7254\n183 -8291\n-1833 2993\n2775 1884\n495 -7415\n-1603 5073\n-2094 4613\n-3653 470\n948 -8156\n3124 2833\n1880 3266\n-3214 1273\n-1843 -6908\n250 -3434\n-6488 -3443\n235 3453\n-675 6410\n-5977 -3408\n-2676 3922\n809 -8345\n2525 2418\n2534 2900\n-3219 1390\n31 3871\n4687 -4445\n3442 -2655\n617 749\n-930 5053\n6175 -2893\n2229 2818\n3262 -2093\n-138 4616\n3602 1350\n168 8757\n1604 -8340\n1550 -5764\n2074 -229\n1935 -1508\n270 7102\n2672 799\n2043 2468\n5520 -1830\n-3552 -7998\n-1381 -5252\n4180 -1800\n3994 -987\n5652 -4095\n642 -6030\n-2285 2690\n1139 3243\n3609 -864\n-2674 4010\n2908 -2978\n-6949 -4646\n-4747 163\n-126 4937\n-1200 5714\n-1716 -5151\n17 -4312\n5987 -3829\n1218 -5744\n2253 -6439\n1943 -5993\n2920 -30\n-4486 -147\n-7261 -4955\n-303 4817\n1024 3452\n1568 160\n554 -8160\n4365 -1083\n-2833 2106\n5340 -2131\n3009 2783\n-2003 -7597\n-7307 -3635\n-1694 -6636\n-1206 -3684\n4314 -1952\n-1846 5397\n148 4053\n1070 3586\n1853 -7921\n-1255 -6615\n-4617 -34\n-2734 -8532\n-11 2673\n-169 1979\n-56 7190\n-3721 -145\n-858 -4485\n-1883 -7720\n2739 -1160\n-347 -7247\n5456 -4465\n6552 -2406\n498 -5972\n4521 358\n-2512 -5979\n-4604 723\n5736 -3242\n-1018 3566\n-2217 -8544\n-923 -6950\n5796 -2984\n-2588 1574\n2820 -7072\n7257 -4885\n885 -4170\n4553 -3370\n1648 4099\n-6688 -4784\n5499 -2935\n-4255 -502\n-55 6125\n3434 -2843\n7274 -4143\n2904 2601\n-1208 -7477\n1083 -6361\n65 4960\n818 207\n-2760 -6681\n2314 -858\n945 3560\n-2923 1641\n2751 -1450\n-4956 -2316\n-561 6895\n-79 -3491\n137 3846\n-7889 -4618\n886 300\n675 -3404\n-725 4336\n-7507 -4671\n1521 -1066\n1454 5502\n-6907 -4999\n-2099 2918\n1552 -5260\n454 -8632\n-3658 1928\n1873 -5492\n1176 -4110\n3869 -2697\n-1403 -3992\n1165 342\n2783 -51\n1474 -6942\n-832 4919\n5029 -2566\n348 -2560\n755 -4328\n2901 32\n1493 3051\n498 5617\n2884 -7048\n-3156 -8364\n3600 -397\n-371 6318\n-334 -2563\n4371 -2424\n427 -7134\n-1932 5095\n-1101 -7511\n-5966 -3556\n-3895 1122\n91 -2919\n3486 -1360\n4019 1020\n243 2010\n1495 3560\n-270 4273\n-1194 -8320\n873 1533\n-5350 -3011\n70 -6080\n-915 -6279\n3083 -354\n-1312 -5003\n252 4025\n-1194 5281\n-69 -4755\n-1102 -4186\n841 -8231\n3981 -2130\n7310 -5420\n3838 -2358\n-2073 2857\n1725 5367\n5146 -464\n1098 -49\n-202 -3301\n-3214 716\n-1864 3925\n884 -6382\n-2215 3905\n-3703 2471\n-6205 -4685\n-3154 2335\n3071 961\n1355 5062\n-1084 6317\n5877 -1234\n-586 3755\n-805 3468\n2980 -733\n800 6975\n-826 3900\n609 -2869\n-3871 -8416\n2072 2599\n2642 -8157\n716 -7259\n-1456 -8063\n-5977 -2551\n-2562 -6238\n1936 -7320\n3127 2556\n1971 3939\n-5753 -1566\n4182 1399\n-8198 -5510\n-2118 -7427\n1816 4142\n803 -4515\n2847 -8800\n7979 -5355\n452 3626\n-614 3373\n-2118 -5424\n1021 -184\n-3789 -8451\n-1849 4164\n-40 5667\n3124 3235\n-2000 3327\n2074 1392\n874 2909\n1118 3391\n-1270 -5739\n2179 3102\n-108 4820\n4324 -4841\n-6147 -2645\n-122 -5736\n2202 2040\n5416 -4350\n-5948 -2893\n-2134 -8708\n2770 -6758\n1098 -8567\n-1655 3951\n-130 4519\n-1283 -4620\n1996 2961\n-422 -8330\n-2976 2451\n2992 -8108\n-937 7069\n4537 -4419\n75 6641\n149 -6147\n-3024 -8580\n-664 4561\n-195 -7460\n-536 7155\n1289 2738\n466 5656\n2946 374\n4624 -5284\n6829 -3444\n105 -2108\n1421 -7933\n3859 -4101\n-6772 -3332\n2943 -3378\n-1634 4134\n2383 -7885\n-1824 -7612\n-3465 -8017\n3364 -3384\n-1010 6344\n3460 -3151\n346 4960\n1337 -4040\n1170 3994\n-3763 1268\n1106 -5310\n1186 2886\n1042 6067\n5231 -448\n903 4885\n217 6525\n70 -6140\n59 -6178\n-492 -3754\n163 6165\n-3857 1221\n2685 3092\n-1973 -6413\n1546 2979\n-2348 -6936\n3767 -8828\n1908 -7172\n994 -6229\n2408 3847\n3334 -528\n6063 -3842\n1690 -1287\n5934 -1345\n207 3165\n-3112 1470\n6360 -2387\n1350 -305\n-2331 -6155\n5678 -3664\n-2335 -7446\n1821 4979\n-758 4953\n-6852 -4480\n-4072 -378\n468 7807\n4044 -617\n6351 -4989\n1205 2743\n-675 -7606\n-2278 -7580\n3868 186\n1664 2102\n5603 -2396\n-1540 5307\n-2470 2322\n-2682 2366\n1992 3271\n-1149 4420\n-3325 540\n-111 5399\n-655 -3224\n-3926 223\n128 -7358\n-3837 2124\n-195 5551\n1058 -125\n1887 1810\n1193 2694\n-559 6672\n-1662 5231\n-3802 -144\n3289 -8775\n-1073 -6731\n-445 -3807\n-1676 -5575\n-1662 -8774\n1408 5700\n-624 -6348\n233 4244\n-816 2992\n4723 -3603\n3946 -1554\n-814 -3900\n-648 5242\n-3695 1952\n1199 3380\n1147 -7467\n-75 -4755\n-1258 6228\n475 6681\n959 4698\n413 6301\n-1333 -4296\n941 -3986\n-1246 -7941\n2766 -2078\n3946 -793\n-444 4305\n-1519 -5300\n1295 -4254\n7519 -4524\n1640 6177\n3263 -2744\n-5364 -2274\n-4474 998\n-5537 -974\n4317 -1380\n1722 -537\n3003 -1139\n-4480 -1521\n1354 -8665\n-3285 1561\n2176 583\n-1797 -8190\n-4300 -325\n-6333 -1909\n-3486 656\n2498 -1031\n-99 -8410\n443 3621\n-192 7733\n833 4726\n-914 -5533\n3563 704\n-7024 -5098\n4486 -1267\n-329 -2833\n2319 3830\n-6051 -3372\n284 3904\n931 -8176\n-719 6644\n970 6257\n-522 -7681\n887 3371\n1689 -7564\n-2665 -7718\n-352 -4259\n1951 -685\n4637 -4011\n-7561 -4102\n316 2089\n-1278 -7598\n2441 -7315\n-253 8400\n828 -5728\n-337 -2546\n3553 -2517\n769 3259\n206 -6397\n-1868 5462\n3751 1901\n-2403 2546\n-815 -7141\n1360 5904\n1463 3567\n2139 504\n3567 -3810\n5021 -1718\n3969 1506\n-2156 2566\n-1017 -4964\n2718 -1097\n-4031 822\n-1447 -8100\n-1602 -4653\n-5255 -2529\n-1579 -7014\n-605 -5684\n-4481 828\n968 144\n-2346 4982\n-3787 -8801\n936 6755\n2063 -8176\n1212 3028\n661 -5304\n-1157 5762\n2039 -8274\n26 -6554\n-405 3882\n2626 -2516\n6334 -4124\n-3049 -8346\n1270 -5189\n-7590 -5473\n-598 5847\n3984 818\n557 585\n5806 -2157\n-3696 1987\n-2387 -8134\n1931 -6664\n140 -6984\n1060 -7855\n217 -3748\n-2817 4146\n-1387 4474\n-2235 3306\n2178 -8326\n1333 -4352\n-7073 -4742\n-2509 3931\n3303 -2039\n-171 2457\n1225 4289\n1771 -7934\n-6606 -3041\n-3075 1957\n578 1720\n4293 -4030\n-3126 -8348\n-6239 -3005\n-2530 -6602\n-4000 224\n-5121 -995\n2641 -1074\n-3043 -7186\n2965 1200\n-2824 3660\n4693 -2586\n1692 -1059\n6809 -2959\n-1748 3091\n734 4463\n2236 3797\n5116 -4560\n-5047 -206\n4100 -2142\n-543 -8296\n1189 5965\n2381 -1488\n2452 1033\n1278 -7208\n3278 -8413\n-632 6800\n1847 3239\n4061 -1733\n3415 -3929\n5339 -2463\n-2939 -7750\n1481 -88\n-3644 2136\n2038 4955\n-348 -2780\n5355 -1814\n88 2143\n1009 -5789\n5182 -4492\n-579 -5281\n-146 -6431\n712 -8361\n631 4671\n-6538 -2392\n-89 -5560\n-589 6810\n-1847 3424\n216 4873\n378 -7162\n-2323 -7114\n-3364 2055\n3170 -8551\n-1073 7022\n-2140 3010\n1823 -6579\n1041 -8365\n3227 3160\n2129 1496\n366 931\n-2723 -6526\n-4674 -1360\n375 8288\n1518 -5844\n3614 1860\n-696 3598\n-1793 -8012\n-400 -3504\n-2560 -6561\n3624 1778\n2783 1413\n2842 953\n-941 4147\n1011 6862\n-3850 -56\n88 4186\n5348 -4507\n-7173 -5370\n-275 2755\n3328 2052\n614 -7169\n4089 -489\n4000 -4083\n-829 -8503\n-4332 -584\n-638 -8007\n674 3236\n1385 -7905\n820 6561\n1510 -7654\n788 5187\n-1106 -4972\n989 4387\n-1412 -8795\n6115 -5402\n-399 -4856\n174 -7478\n3658 1584\n-2910 2680\n2833 3181\n3428 200\n1210 4097\n2419 -2293\n4192 -4812\n-1971 -7116\n-761 -8230\n-1152 4942\n2564 3236\n48 2794\n1570 -5924\n3025 -8492\n4586 -3072\n-7016 -3734\n5332 -1689\n-1326 -4970\n947 -3640\n-1565 -5379\n3887 -769\n4443 -2833\n-6944 -5280\n-630 -7668\n679 -4891\n1219 2077\n4617 -1974\n4933 -1260\n139 -6853\n-2386 3228\n-3710 498\n-2985 2011\n1440 -8462\n3489 1332\n4956 -2578\n802 -3909\n143 2265\n-1340 -6987\n-292 -2222\n1975 -1237\n4370 -3675\n2110 -2083\n-5544 -2556\n3682 -1350\n-168 -7600\n1443 -4129\n-4101 1719\n3512 1752\n-5311 -1723\n1400 -479\n1292 5939\n5858 -3160\n4916 -4272\n-468 -3403\n-829 -7898\n1421 -8004\n1232 -5762\n2863 3061\n-861 6207\n-362 3889\n-823 -5337\n6420 -4060\n-1014 5687\n-4799 640\n2882 2900\n2511 2961\n3227 -1598\n1457 3437\n1639 4209\n1254 5367\n611 2974\n2461 -5989\n1725 752\n6174 -3832\n1400 -4651\n256 -8804\n658 -4893\n-2744 3006\n62 1667\n-3026 2297\n3234 -17\n7346 -5470\n1690 -5961\n7079 -3872\n-1561 3824\n-3453 290\n7003 -5218\n640 4620\n-3946 -435\n4110 -5068\n2050 -1126\n1541 2143\n-339 -2443\n-5462 -1891\n1996 527\n-2395 -5887\n-3111 -7241\n2093 -8697\n7727 -5070\n-5909 -3147\n50 -5299\n-1010 5170\n-606 -6509\n7010 -4803\n-5196 -1710\n1256 1451\n-978 -3911\n1271 4930\n2483 -7794\n-6330 -1976\n1921 -247\n3972 -8676\n577 5489\n330 6399\n6163 -4262\n-754 -5392\n-274 4260\n-200 -6296\n-1675 -5182\n5898 -4973\n2880 -8209\n-4685 477\n2495 2887\n-3004 2832\n-299 6370\n-7384 -4083\n8320 -5448\n796 5200\n6591 -3484\n105 -2868\n-2410 -7156\n2478 3883\n599 -6789\n-3558 2068\n1784 3684\n-4261 256\n1789 -6473\n3633 -3154\n1141 4580\n-166 -6835\n-535 7563\n2111 -1293\n4567 -1511\n6954 -3350\n1869 -5176\n926 1454\n3592 2187\n440 3254\n3669 -8499\n-437 2979\n1898 -5737\n-3123 1108\n735 5739\n-6480 -2574\n4279 -130\n-5492 -1003\n1846 -1359\n-3640 1895\n2147 1182\n3576 -2006\n-1307 4007\n-1511 4734\n1051 437\n127 -7912\n1090 -3510\n167 6149\n3228 -2325\n6713 -3303\n1893 1144\n2293 1570\n2779 -8332\n6550 -4033\n5932 -5235\n2353 -1919\n-1317 4357\n6017 -3364\n1820 2203\n-7992 -5062\n-5304 -746\n-593 3871\n666 -4588\n2961 -7181\n-2675 -6650\n-1132 -4714\n5351 -1278\n122 5572\n3140 -7865\n-4872 -2271\n-1686 4631\n-1046 5807\n3960 -4103\n4368 -1765\n-436 -4826\n1501 -8090\n-4824 228\n-751 -5527\n1365 293\n3958 -1850\n-142 -8073\n-1869 4877\n-1042 4380\n4083 -413\n-7869 -5209\n1026 3421\n-2566 -7019\n-5360 -2355\n2097 3764\n-3123 -7596\n-3756 2427\n7245 -5083\n100 5580\n2021 -1000\n1418 -8468\n3775 -4331\n-2749 3230\n3138 -2178\n2488 -1818\n-2544 1878\n6357 -2488\n3896 172\n6790 -5274\n837 5532\n607 4121\n2411 2096\n-467 3219\n6413 -4868\n3562 2390\n1561 -6272\n5958 -1900\n3354 -1713\n856 1668\n1673 -6805\n-925 6657\n-5125 -426\n7413 -5006\n6580 -5032\n-1472 -5188\n-203 1997\n-3374 2054\n-6997 -5292\n-5510 -1568\n4466 -2569\n40 -7950\n5879 -5200\n505 6350\n-2547 2901\n1459 -8359\n-3574 2345\n1576 -4771\n1398 -620\n1071 5162\n-167 -7083\n-5151 -1943\n-1744 5810\n5593 -833\n103 -4932\n-2177 2609\n-2432 -6514\n1057 4260\n1470 1297\n-135 2983\n3979 -795\n1765 -8323\n1499 302\n2941 -8372\n449 -4481\n954 1502\n3714 -2834\n1359 -6141\n2492 4303\n-738 -5395\n-5875 -3855\n1217 -6437\n1761 1130\n1270 4499\n826 -3823\n-1306 -5697\n742 812\n-4295 -139\n3183 1835\n2380 3123\n-7262 -4134\n5704 -1098\n3973 1484\n-335 -4963\n4562 30\n1414 -487\n-2996 2675\n1105 3365\n2921 -6968\n4160 1200\n5145 -1999\n-4466 -1436\n-4699 -266\n71 -4357\n-173 6154\n-806 -7506\n2860 2177\n-2436 2283\n4105 -1936\n-972 -8148\n366 -3166\n1307 -305\n-6199 -4448\n-235 8128\n1966 -6770\n-3260 -8390\n1948 138\n732 -7741\n495 -6526\n1339 -8562\n3099 962\n-1727 -6524\n5155 -2300\n5474 -2779\n-2258 -6542\n229 -6678\n143 2426\n2644 -2289\n2520 -2527\n2529 3152\n4169 285\n2570 2365\n-6595 -2630\n-1882 4967\n6874 -3341\n1770 4278\n-532 6820\n140 6552\n7090 -4061\n3587 451\n7195 -4712\n-1067 -5633\n3481 1900\n-624 6441\n2071 -6297\n-4184 813\n-665 4155\n2207 4084\n-7685 -4920\n-438 3275\n-2995 1542\n3056 -3679\n1764 -5992\n-4416 -1498\n-1564 -8796\n961 6890\n-1366 -7742\n-141 -2971\n3272 18\n3274 2376\n1241 3127\n-670 -3286\n-600 -5673\n-218 4145\n1441 -1\n3816 -3453\n-3044 -8628\n-466 -4299\n-3052 -8421\n5751 -923\n4 -5689\n3122 -1593\n3422 -4287\n-2131 5233\n808 -3345\n-277 -4823\n4823 -3746\n7227 -4955\n-3359 2989\n-6013 -2361\n1279 -544\n4444 1182\n-1558 4619\n-3022 2801\n-1527 -8579\n809 6116\n-2584 -8424\n290 -6710\n4333 -3486\n-751 7170\n-6039 -1480\n521 -7952\n5559 -4815\n347 1561\n121 7618\n4300 -4450\n2943 102\n-3179 -7742\n4541 -4935\n-2078 -5454\n-1789 4124\n5473 -609\n7927 -4674\n1060 -233\n-190 4116\n-3254 -7768\n640 4445\n-608 7392\n863 -5287\n3974 -8546\n-5308 -2908\n3205 -3846\n4641 -895\n1880 -1002\n-4569 -1735\n-232 -5031\n2297 4066\n4707 -4700\n1082 -8440\n-1152 -8468\n-1297 -8394\n888 5645\n2795 -8277\n3481 2276\n7502 -3934\n-5113 -1255\n-5446 -2488\n-6897 -4748\n-1277 5785\n269 5062\n3104 -8072\n2632 -284\n4410 937\n-3478 230\n4910 -4188\n-1861 3497\n848 4578\n4199 -5051\n1906 5350\n-1254 -5857\n-2405 3038\n-1772 -4715\n1135 3443\n3116 -8140\n2854 3683\n2519 -2286\n4425 -2714\n3213 270\n3292 -3775\n-2342 -8100\n-2418 -6174\n4223 1640\n2464 -8243\n-597 -5382\n2269 -2367\n2166 4018\n-3593 -8503\n2039 5361\n-2253 2838\n-544 3145\n-772 6273\n-5807 -1919\n-7933 -5424\n2719 -8808\n2975 -925\n1031 5161\n-2199 -6353\n-1919 4730\n2992 3155\n217 -5884\n5739 -3293\n466 6635\n3474 1347\n-1207 6577\n106 8719\n-7935 -4971\n-1932 3116\n5162 -1234\n-3801 -8550\n-6042 -2654\n553 7078\n-713 7357\n-5532 -797\n1146 1005\n803 5956\n-94 7710\n-5060 27\n597 -5063\n-1200 5674\n7367 -3694\n4199 -1203\n-706 -3329\n778 -4172\n-2881 3106\n209 -3714\n-1340 -6899\n2138 1842\n-5623 -1331\n2316 2002\n863 2977\n5144 -967\n1645 -4905\n5279 -5419\n-959 -5112\n1427 -7723\n478 -6823\n-994 -3553\n-2657 2008\n-3760 873\n-3147 -7763\n2643 3656\n1909 -8211\n-6933 -3212\n-1994 -6820\n-5825 -3293\n134 8467\n3161 1932\n-2721 2738\n-613 -7755\n5335 -2988\n7092 -4708\n-8195 -5322\n2213 -7355\n-5811 -1301\n2425 -2168\n8 3049\n-579 -7736\n-687 5763\n5188 -1220\n4203 -3835\n128 6811\n-962 5347\n-7660 -5050\n1785 -6115\n6044 -1833\n-6809 -3885\n-1278 -5462\n3608 -4044\n3337 2126\n-783 -5928\n5243 -3517\n2378 -6311\n1401 -6219\n-5284 -2449\n295 -8292\n5488 -2004\n4737 -5070\n2869 3048\n3775 1146\n5127 -130\n4617 -1485\n1432 -596\n-855 -6100\n231 8216\n6277 -5291\n-3446 1380\n6664 -2591\n391 -2678\n4933 -1155\n3885 -5225\n7184 -5461\n-2208 -8643\n-6214 -1756\n2299 -624\n1398 6318\n5406 -3764\n3458 -568\n-4175 -489\n7077 -5192\n2633 3326\n-6915 -4350\n7277 -4385\n-1504 -5119\n4461 -2784\n-2778 2717\n2736 -2040\n485 -5781\n1945 4310\n-26 -8217\n4589 -2096\n4077 4\n-749 -6537\n1711 -89\n4887 -2491\n944 6346\n-6060 -2785\n1249 2617\n-619 -4809\n-1899 5155\n-956 -7809\n-4842 -1237\n3226 2741\n-337 3945\n2443 355\n677 1934\n-1485 -7369\n-1187 -8347\n-3271 2628\n-3021 -8349\n3068 -2545\n-2354 2489\n4111 -1205\n-6108 -3662\n1314 5505\n1483 -4288\n2763 1085\n-2261 5031\n-605 -5967\n166 5084\n4513 -5333\n-4162 -784\n2088 -6052\n2654 -6451\n1176 -7535\n2809 -746\n-5994 -1493\n3463 -3336\n-1607 5391\n-1112 -7062\n2870 1012\n-2406 4848\n-3012 -7658\n2213 4724\n-600 3446\n-3133 -8746\n5156 -11\n5419 -3773\n4168 975\n-778 -7782\n1133 -3654\n-1142 -4166\n4394 -4128\n457 1108\n-5443 -3060\n1840 -6330\n-2698 2479\n-2459 -6264\n2180 -8452\n2326 -7311\n-785 5308\n-406 7801\n3898 -8442\n-962 3856\n-5857 -1478\n-6943 -4805\n2717 1089\n7348 -4947\n5801 -3435\n-138 4015\n-1738 4502\n5747 -2614\n4429 -1881\n-543 -7145\n-4300 1124\n2652 -409\n5260 -3052\n1219 -6798\n-618 6037\n2294 -7103\n4658 -4460\n7472 -5228\n2253 -7011\n2289 -1868\n2911 -2810\n-2501 -6372\n-83 7219\n5372 -3340\n-3430 608\n468 6954\n-6382 -3384\n-4174 917\n1780 3910\n-1030 3427\n-1827 5772\n1257 1410\n5381 -639\n6333 -4745\n4178 1695\n-3808 609\n1800 -1526\n-7038 -5316\n-3044 -8283\n-404 -5965\n431 -7741\n8294 -5314\n3262 169\n4183 -1578\n-6661 -4873\n5166 -5241\n2199 -1140\n-515 6624\n1152 -8529\n-1382 -5007\n1935 -5345\n1651 1960\n4673 -3652\n6589 -2554\n-2534 -6747\n-402 7513\n3860 -4371\n2265 -6857\n-611 5869\n4039 -2907\n2879 3832\n2691 609\n-6153 -3601\n-8219 -5290\n-1857 5119\n4375 -217\n126 1429\n1350 -7371\n1629 5654\n-364 3909\n1165 -6658\n1614 1396\n5721 -4514\n1842 2872\n832 4953\n41 -4790\n-7041 -3582\n2667 -2806\n2153 -1970\n-1470 5306\n-3521 391\n-271 5424\n-979 -8518\n1041 -4701\n7008 -5087\n-5577 -1439\n-6352 -4590\n4843 -340\n-3323 2888\n-6252 -1980\n2349 4706\n4249 -2689\n-6722 -4358\n4890 -375\n-1823 3669\n467 1444\n3863 -5030\n2475 -8182\n711 -3347\n1808 4397\n3716 -3005\n-607 -7627\n3122 -248\n-1141 3874\n3075 488\n-5246 -2492\n-447 -7775\n638 4407\n1207 -8542\n-5749 -3696\n3511 959\n1611 -6322\n-82 7568\n-120 8127\n-3653 271\n-6572 -5315\n6939 -3769\n-326 3852\n1336 -4920\n3346 858\n-2909 4017\n1518 -6737\n559 4953\n3007 -8738\n2046 67\n-671 5975\n-1240 4110\n468 -3707\n-2223 -8693\n-6641 -4516\n-4989 -1960\n-657 7779\n3448 -1357\n3970 1031\n-603 -6732\n-5415 -2777\n3885 71\n7078 -4887\n3692 -7945\n3579 -3145\n1056 -5411\n2385 3842\n1390 -6217\n-4517 925\n-769 4442\n-537 -8332\n-729 -5144\n-613 3805\n2057 2729\n-4054 64\n-118 -4640\n1445 4986\n1925 -6146\n-3285 681\n-1394 -7349\n-1014 3627\n1990 -7866\n3914 -2015\n3461 2414\n-6148 -3431\n2844 -2528\n-186 -7401\n13 3427\n-4158 386\n-1301 -8445\n-1621 6131\n-2525 4026\n2316 -7424\n2364 803\n2210 5098\n6010 -3982\n105 -4492\n3979 1122\n-3765 495\n342 -7317\n2445 549\n1446 5532\n-6623 -3747\n3635 -438\n3842 -8614\n5084 -3177\n4063 1398\n-566 4767\n-1367 -7003\n5025 -4203\n-8120 -5283\n4525 -920\n300 -7505\n-3909 -238\n-2699 3551\n-3248 1126\n2370 921\n3521 350\n-1478 6371\n1259 -4849\n56 -8155\n-1367 5149\n6008 -5119\n1862 3965\n2079 3667\n515 625\n4875 -2351\n-1055 -7483\n82 -5069\n-4551 -1828\n1404 -6856\n2880 -717\n6353 -3759\n4540 -496\n-395 -4150\n-6176 -2847\n-1757 -6340\n2352 2612\n-285 8286\n1831 -5733\n158 -4208\n2365 3355\n-5031 -430\n3608 -1129\n-3488 -8226\n1668 -7737\n500 5873\n-5990 -3213\n-1036 -8571\n7223 -4226\n-2524 2309\n-6163 -4535\n3960 -328\n-2268 3794\n-1381 -7771\n1945 213\n-4563 -84\n839 7159\n3000 3226\n-398 -6479\n-162 -3557\n5166 -2354\n-1044 6272\n1053 578\n-1904 -5110\n1856 1718\n3504 -826\n3296 3033\n-271 -3531\n691 1531\n795 5449\n3375 -8509\n-224 7900\n6032 -1729\n751 4393\n488 -7503\n3956 -1657\n-135 7324\n-1429 5587\n-266 -5785\n-822 5363\n2857 -7042\n1921 -1633\n1889 3547\n2066 985\n1837 -7347\n3775 -461\n4722 -1842\n287 5690\n-7033 -3417\n5467 -1330\n-1581 5339\n-7598 -4438\n3266 -271\n1848 -1066\n6536 -2468\n-133 5948\n3039 -8046\n2999 -2427\n82 -2889\n2118 804\n-76 6082\n873 -5944\n383 3222\n-2381 -5748\n7244 -5083\n670 -8794\n-6673 -4752\n-5891 -2833\n-1556 -8338\n-4 4545\n1774 4081\n-1043 -4876\n-567 2793\n-3922 179\n-371 -5041\n1227 -3778\n1476 2532\n2034 -1450\n3628 -4433\n1522 -168\n-5312 -2585\n371 -7896\n-432 -4434\n-181 1854\n6182 -4599\n3406 -3665\n484 1508\n4727 -3197\n-3351 -8071\n5162 -1178\n-1403 5660\n-1954 2760\n2765 -993\n4935 -5256\n2036 -1928\n720 2533\n2584 -2252\n2072 -173\n-2697 4104\n5457 -2679\n6858 -4845\n3920 -8703\n-6848 -3120\n-4302 -758\n-407 5462\n3199 -7174\n2360 -7695\n7989 -5055\n-2767 -8450\n4035 -8580\n-2476 -6109\n4968 -4371\n-285 2592\n5550 -4957\n1858 1761\n-3773 634\n-763 -6068\n-1445 -4204\n4063 -288\n-1066 -4179\n2506 -8447\n-4420 492\n6372 -4960\n490 -3952\n-2915 2222\n-98 8279\n1550 4778\n1419 5464\n-6619 -5155\n-1118 -4369\n-5235 -1516\n1095 -4674\n8011 -4871\n1916 -7534\n6665 -4960\n4033 -2933\n-154 8431\n6512 -4172\n667 1766\n5640 -2647\n-2280 2449\n4750 -5338\n1013 2279\n678 4912\n-5227 -1629\n5397 -4300\n1114 2982\n1330 3566\n2170 -1811\n2703 466\n-5866 -1784\n4377 -3895\n-706 -5346\n-600 7581\n-2711 -7719\n-1419 -7122\n5726 -1230\n-5941 -1854\n-2558 2619\n-5266 -2736\n6326 -3385\n1495 3481\n3705 -1159\n446 7460\n1624 377\n3189 -7713\n2625 -2017\n196 8299\n5043 -2448\n-2476 -8245\n5461 -3514\n581 3032\n2657 -8607\n228 -6782\n-890 -7681\n672 387\n7129 -5391\n-1853 -7900\n2032 56\n3654 2192\n600 5793\n1827 3631\n-587 -4320\n-3778 869\n939 -5798\n4125 -2159\n3575 -3718\n1863 3902\n2486 -8223\n526 2166\n533 -8227\n1511 862\n2293 2126\n1867 2698\n360 1129\n2914 -7995\n-549 3422\n-3468 -8772\n4190 -2939\n1848 -6399\n2055 4347\n4933 -2895\n2930 3901\n1129 3026\n-864 -5513\n5255 -3275\n6212 -1999\n-657 4037\n2882 -630\n1524 -8542\n718 2428\n1790 -5487\n3037 -454\n1344 2031\n1281 2719\n-1101 4689\n96 -8429\n181 3190\n-2217 4574\n1548 -259\n179 6826\n-6275 -4136\n773 6125\n4176 -1140\n3363 -1200\n7066 -3977\n1253 -114\n997 6037\n168 1244\n-115 2616\n-6418 -3796\n4590 -1554\n4498 -1343\n-3325 -8138\n-3165 2038\n-7645 -4994\n864 -3443\n854 -7242\n-3004 -8017\n-8131 -5432\n3058 -3539\n-495 -3428\n-4564 -736\n6879 -4959\n-2478 -7367\n-3222 718\n149 1451\n309 -4142\n489 -4687\n233 4694\n578 -6645\n709 -7628\n-882 -6663\n1465 4814\n-5428 -645\n783 -3482\n7261 -5346\n-958 -8133\n-833 4375\n7221 -4781\n1987 79\n-417 -5639\n-534 6530\n-1531 3965\n322 4130\n2072 -6755\n1401 -97\n-1183 6666\n-6605 -5197\n-818 6758\n4248 1222\n1693 1250\n4589 975\n3715 -3467\n-4738 -577\n2781 -1401\n-1441 3884\n201 8685\n2186 -2152\n6081 -4209\n-7245 -4547\n648 -7815\n-7908 -5307\n771 6416\n4159 -4470\n-3935 929\n-936 -6981\n5213 -3125\n-6404 -4755\n2301 2057\n-3819 2054\n2153 -5606\n3839 -8714\n-2682 4061\n-1469 5109\n-6510 -4733\n292 -3329\n3935 -2918\n1566 -274\n4562 -3847\n-7480 -5348\n-334 3525\n-3866 -8394\n-739 -4458\n4247 -3301\n791 -7275\n362 897\n2491 -8303\n-1597 -5256\n-1772 4028\n1954 -6681\n-6034 -1487\n-1975 -6638\n-3526 2753\n-234 -8600\n3934 -4065\n3866 -2884\n1369 -4278\n1680 3613\n2039 -7616\n342 2957\n-3968 -8433\n-1978 2716\n-563 3661\n1224 2460\n1947 -8786\n4205 843\n742 5847\n-6898 -4806\n3308 -8331\n5417 -4493\n3365 -2918\n2696 -8371\n2109 -5884\n3533 -8290\n428 6092\n132 5824\n365 -8076\n-4317 1479\n-3477 2551\n5503 -2361\n-2535 4460\n3985 1015\n5260 -4675\n1204 6607\n2208 -8242\n-3110 -8772\n2073 -891\n-5402 -2253\n1951 4659\n2080 -5836\n1291 -7576\n4553 -2220\n691 -4749\n-2180 -7909\n-1361 -5014\n1067 2813\n8 -2764\n6070 -2419\n743 2406\n1297 4603\n-720 7675\n-3154 -7609\n-1559 -4415\n2463 2222\n3733 -8744\n5335 -3454\n3819 -8209\n2979 -1604\n-579 5214\n1089 1516\n-948 -8029\n6073 -2708\n-1099 6152\n366 2639\n5226 -2641\n1960 4012\n-1425 -8701\n3175 -8501\n-6462 -4461\n1779 -37\n-102 7730\n-2291 4992\n1464 4851\n1200 6190\n-891 4165\n5868 -4993\n-1090 5802\n1755 209\n-4437 -105\n-787 -7465\n-2162 -6722\n4233 805\n1225 -7594\n6096 -3184\n2436 -8141\n3937 -5212\n-708 -8424\n1289 -7744\n3259 3241\n3747 -170\n300 3223\n-947 3134\n-879 7309\n-356 4508\n3385 -3058\n1782 2825\n823 4080\n-5778 -3331\n3480 2113\n-2356 -7335\n4593 -2238\n733 -7641\n-268 -3050\n1323 -3956\n-6513 -2467\n5320 -2090\n2856 1350\n1394 -6502\n-193 4504\n455 -6273\n-6650 -5391\n7692 -4565\n4767 -3436\n64 7400\n31 -6534\n1314 -7276\n988 -8418\n5896 -4849\n5250 -467\n-5927 -4169\n-7380 -5021\n1427 1145\n-158 7520\n-2809 -7956\n-1017 6564\n2189 3315\n5743 -1132\n-4959 -1503\n6079 -4556\n3246 745\n5913 -5033\n2346 -846\n6884 -5136\n1633 427\n-3400 1021\n-2720 4179\n534 5552\n4620 -2003\n-1135 3589\n-1139 6359\n-5679 -1958\n807 -3263\n4443 -4563\n3263 2291\n906 -8828\n2396 -7960\n-914 -8379\n-2351 -8621\n-533 -4199\n5820 -1700\n47 -3127\n625 -7763\n-304 -7133\n-6588 -4149\n1063 4947\n6857 -5414\n1064 -4972\n4969 -170\n1480 5107\n3907 -3582\n118 -6174\n-1521 -6361\n-2724 -6406\n1829 -6747\n4142 -2819\n850 -3671\n577 1458\n5559 -5394\n307 5501\n3268 -3386\n-2977 -7901\n2353 1534\n-226 7400\n-3615 1978\n-918 6691\n-5814 -1906\n4613 -1947\n2651 -2619\n-610 -5088\n55 7286\n4448 -2337\n1594 -8052\n-1276 -5520\n-4167 -472\n6884 -4558\n4942 -3303\n-3179 2471\n-3249 465\n-3700 794\n-97 7637\n-1989 5567\n7813 -5023\n6279 -2779\n1416 5172\n-2 1889\n3779 2218\n997 4220\n5905 -3851\n-2896 -6957\n1883 -6948\n-7046 -4126\n-349 3062\n-353 -5424\n-4558 576\n7011 -3663\n-1920 -7422\n807 5298\n1376 690\n869 315\n401 -3811\n1426 5588\n3691 2256\n29 3161\n2013 743\n-6429 -3975\n-1230 -8823\n3883 -5209\n-6297 -3984\n-7179 -4720\n1917 -1607\n2086 3965\n-366 -2723\n-66 -3362\n3287 874\n1776 -688\n965 5727\n3232 3345\n4786 -3386\n197 -4997\n2222 -2057\n-815 -4427\n-877 4139\n791 2413\n-2471 2656\n5332 -4197\n1607 2683\n4089 -4082\n5260 -449\n6545 -5347\n-6233 -1822\n1234 6305\n-630 5089\n-1814 -6803\n32 -3713\n1110 -3812\n-4007 -596\n1525 -530\n4270 -1077\n2799 2485\n1234 4713\n2654 -1968\n-1957 4008\n-1324 6528\n6466 -3358\n-1467 -8489\n1895 -5888\n-300 -4538\n1477 2076\n318 7783\n-4867 398\n726 6768\n-1380 6602\n-2928 -7470\n1847 -8713\n795 2949\n187 1220\n723 5018\n1783 -7888\n1774 -6870\n7045 -3238\n-4212 -94\n6846 -2831\n779 4930\n1341 3077\n-600 7279\n-1013 -8044\n1782 2445\n4898 -2241\n-3042 -7284\n-519 -5285\n-4594 -1822\n-1064 4819\n1519 -6029\n1828 514\n1499 -6868\n3784 -3679\n2208 -1741\n4898 -4178\n114 4092\n5907 -4782\n-4021 1626\n1672 -6121\n568 2782\n-202 8060\n-4995 -205\n3004 -8401\n433 -3110\n-1291 3744\n4268 1565\n-1790 -8508\n-1713 -6749\n4135 -1473\n-224 3367\n-2181 -8798\n1465 3565\n-177 8202\n-1040 -7631\n5051 -4989\n751 5110\n-7000 -4577\n3683 1682\n3527 -1554\n6663 -3361\n2318 3739\n3476 -1601\n634 -4613\n293 -4473\n4528 -5276\n-2387 3390\n3560 1623\n-1168 -4474\n-7307 -4417\n1870 2294\n-2450 -6170\n1088 5295\n2746 -994\n-6448 -4964\n1542 4108\n1250 -3862\n2817 3937\n306 1301\n3971 -1041\n1855 -5211\n-1089 6382\n-2981 3027\n6583 -2481\n-3122 -8431\n-240 -4468\n-4541 -720\n1501 -7290\n754 -3967\n-1186 -8608\n-144 -5321\n641 -8341\n-191 -3372\n-2947 -8630\n543 5232\n2430 -898\n1901 3762\n265 -6683\n2283 -846\n-506 -8351\n-6439 -4045\n-639 2729\n-1629 -6365\n-588 -6829\n5700 -3552\n-1808 -7796\n2495 591\n145 -6367\n-1077 -4850\n5086 -380\n-276 3590\n-1515 5635\n998 5340\n7166 -3941\n1137 -4129\n-6861 -4550\n3061 2137\n-224 4687\n2166 3990\n1748 723\n-102 1751\n-7753 -5208\n2634 -3023\n-606 7081\n4923 -582\n-737 -6511\n-3562 1136\n3822 1232\n-2148 -6649\n5498 -1745\n-1541 -6940\n4750 764\n-2706 -7002\n5867 -4474\n-3360 -8553\n177 -3850\n2152 -6274\n6820 -3302\n-78 -6745\n11 -1765\n2608 -7834\n4104 -1969\n-2073 4737\n2987 -3623\n4509 -729\n1279 2314\n-4011 -567\n3606 169\n1772 1978\n3135 -2518\n-3469 2361\n2242 1215\n4119 -4125\n-7339 -4036\n-2221 5199\n-2873 -7655\n-3177 1859\n-18 1674\n488 7399\n6294 -5442\n682 3089\n40 3478\n6250 -3480\n977 338\n4805 -1737\n-107 7857\n-6580 -5038\n-2213 4052\n-5776 -965\n1384 -5025\n3217 1375\n5344 -993\n2492 2326\n514 7641\n-1803 -8150\n1015 6559\n-6156 -4377\n-489 7509\n3505 791\n1808 -4942\n4600 -1254\n-818 -7688\n3667 -8776\n-3169 3009\n-989 6199\n156 -7138\n728 1095\n-897 4048\n308 -5832\n-3101 2958\n2427 4441\n1853 -8139\n2304 615\n-423 4574\n555 -7846\n-1768 -6478\n2883 -6807\n-1998 -7205\n-2122 -5962\n-793 6173\n-388 5110\n2788 -6782\n2302 -7826\n1901 1435\n-68 -5193\n6710 -4634\n-2138 3499\n-481 -4618\n-5504 -3241\n3700 -3080\n-5365 -3024\n4988 -5124\n4391 -639\n2706 -400\n-1969 5067\n1675 -989\n4667 -5375\n54 -3910\n4585 -5141\n-1403 -6136\n3116 -502\n1027 -7593\n768 5452\n648 1808\n1586 -302\n1355 3599\n-1094 -6768\n1078 -6025\n-809 6114\n2046 1986\n717 -5163\n522 2405\n1672 -1033\n-3423 -8164\n-3766 974\n3904 -1797\n-2069 -8617\n-2432 1911\n-1375 -6354\n408 7781\n-2837 1709\n3613 663\n2722 3740\n1347 6436\n4894 -5358\n-3586 559\n924 4951\n-1653 4382\n-1895 -5407\n3564 -4529\n-5480 -1350\n3482 -2387\n-1305 -4918\n179 -5424\n846 1570\n-83 2412\n-4622 -564\n-5121 -732\n1033 -8254\n3046 3067\n3124 -2771\n5627 -3517\n-1243 5759\n-2357 3119\n2506 -7072\n2239 -6930\n-1157 4750\n5079 -3234\n6676 -3514\n-849 5899\n-5061 -670\n5473 -2500\n3152 850\n-2854 1767\n-55 4783\n192 5948\n-1507 5159\n576 1883\n4870 -4966\n-7710 -5212\n3622 892\n-987 -6005\n-1130 -4418\n-6503 -4758\n2051 -8611\n-2004 3382\n3101 -3280\n-7093 -4121\n6611 -3501\n2149 -6739\n-586 -4604\n1530 4297\n1464 2830\n624 -8640\n4481 -1184\n-2842 1868\n889 -3123\n3484 -1157\n2989 -8444\n5726 -3787\n-1658 -5832\n979 2405\n1231 6897\n3401 1640\n2536 -753\n3465 -7968\n471 3785\n-6467 -4118\n-2747 -8060\n-3532 1828\n883 2465\n-324 6297\n-6284 -4165\n28 -1885\n-6892 -4912\n6012 -2562\n157 5102\n-649 -7821\n1219 4478\n3933 -3106\n216 -5849\n2336 -6581\n-1462 -7160\n4030 375\n-997 -5217\n2740 -303\n2356 130\n1196 -7764\n-2864 -7185\n4976 -1681\n2990 -2801\n2787 -2854\n1288 1528\n964 -7466\n1509 -5922\n-237 -7023\n1564 5313\n-6644 -4373\n1712 -8226\n4049 -2974\n1509 -6614\n5468 -4030\n-1631 6150\n-949 6027\n4296 650\n-38 -4784\n-3912 -8749\n1547 6034\n3102 3014\n-2897 -7723\n-5331 -2103\n-5096 192\n624 3735\n-4247 -163\n-70 -6789\n-5258 -1775\n-3521 585\n-310 -2439\n-6469 -3810\n1934 -5024\n420 2595\n1479 -4493\n172 2379\n6351 -4982\n2485 -7562\n3732 -1883\n-1748 -7850\n5379 -5419\n-2419 4079\n3015 2742\n-1243 -5700\n-5490 -2869\n-607 5479\n-2042 4287\n-1611 3618\n-2427 4299\n-3234 923\n-2439 -7311\n-589 -3155\n-6210 -3469\n-475 4548\n316 5901\n6473 -3505\n4861 -3891\n-1968 -8301\n83 4701\n-862 4687\n2115 3590\n663 2238\n2850 -6572\n-3193 3154\n-7476 -4890\n-3541 1152\n-19 -6817\n326 -6583\n2520 -8764\n3996 -1952\n1177 4703\n1417 -4922\n5766 -2838\n-1764 -6739\n5838 -1957\n5331 -2104\n-5613 -3588\n6862 -3127\n-6836 -4272\n-63 2373\n4468 -471\n3350 -1876\n2150 4656\n-5807 -1183\n-236 -3368\n-1293 5081\n-5194 -2640\n6850 -3734\n-6045 -1641\n675 -4593\n-2978 1297\n1913 1542\n-3824 -107\n2595 448\n3427 393\n-327 8093\n-5456 -1081\n6162 -2448\n-1113 7058\n-5490 -1614\n2774 -6475\n-5819 -3482\n2464 731\n-104 -7243\n7329 -4616\n3281 1551\n3422 -1314\n-6740 -4135\n-1129 5730\n4552 -2512\n2843 -6976\n7187 -4193\n3408 -3265\n1910 -4866\n-735 7028\n2398 -7614\n-134 2613\n1440 -8669\n4796 68\n3060 -1428\n3440 -1202\n-318 -3641\n-592 -3968\n2814 -2245\n5347 -2877\n1285 -5400\n-5793 -2269\n6601 -2392\n-2295 -6587\n6056 -3325\n2352 2082\n-3941 879\n1823 3190\n1613 -6949\n-446 -3570\n-472 -6649\n-4189 -532\n1566 2869\n3311 3047\n1166 -8565\n585 1580\n1636 -4559\n4048 1682\n-188 5176\n-1530 -4674\n-46 -6214\n2497 -900\n6916 -3432\n-1850 -7487\n2919 -29\n2756 -6748\n1926 4006\n3053 -892\n-2012 -7831\n-3102 977\n-2405 3161\n1551 -5882\n-5393 -1493\n-2992 -6935\n-1859 5187\n-181 8443\n1030 -5336\n2163 -8334\n-3684 1780\n4302 -1399\n2087 2021\n4983 -2088\n679 380\n998 -8675\n2443 1510\n-6551 -2799\n4968 -4268\n1373 6307\n3138 -1523\n840 -7497\n-3259 719\n-1947 -5081\n2528 971\n-731 -4753\n1372 895\n82 7105\n3488 -2230\n38 -5236\n-3736 1904\n5517 -3329\n1781 1115\n370 -3618\n2824 -8366\n6205 -2287\n6342 -3325\n-769 -3976\n6392 -4878\n747 1267\n265 8534\n-7212 -5170\n2214 -8088\n3929 3\n582 -4902\n415 -2854\n671 -6261\n2648 660\n-3098 2598\n-3863 -8693\n-509 -4192\n-20 3305\n475 4916\n4963 -1250\n7243 -5449\n-2291 4932\n3334 -2811\n-1064 -7787\n-2974 -8563\n985 -5173\n3369 -8028\n1759 766\n-2459 -6060\n2812 -849\n-6035 -4360\n-6979 -4881\n-252 -7357\n-2066 -7644\n75 5143\n-2329 -6649\n-6612 -5069\n1545 -6256\n-1799 3721\n4685 -1331\n-5643 -2970\n-2273 3643\n-1156 -8817\n-6953 -3352\n6289 -3057\n4162 -4316\n983 1203\n1799 5510\n790 2699\n-3 -6194\n-605 -3337\n-693 -5798\n-1887 4164\n-4327 1317\n2169 -7582\n892 2778\n1679 -8438\n-2408 -6646\n5914 -4022\n3491 -8020\n2274 4539\n5603 -2866\n-3419 1915\n-444 5654\n3014 2031\n-173 -4771\n4034 -3561\n434 8017\n-2996 1194\n-1819 4664\n2513 2223\n2394 -6785\n-52 -2592\n-1970 -8139\n3117 -2951\n4557 -473\n1488 1514\n-749 7458\n-6137 -3751\n4306 -4467\n6080 -3779\n-2631 -7353\n-6416 -3931\n-4818 -1713\n105 -2663\n-1204 -6854\n-5116 -865\n-2153 -8288\n-4004 -768\n2998 -1247\n4105 -4549\n-2661 -6968\n5869 -2163\n4928 -5395\n-5184 -1856\n4845 -2657\n2568 2906\n-7678 -5301\n3572 -105\n-1397 -5973\n241 7849\n993 -4739\n766 514\n-5292 -1628\n2335 -136\n804 4448\n-2524 -7827\n-1003 4036\n-994 -4586\n-1672 4297\n6310 -2645\n1441 -611\n5974 -5400\n5726 -5025\n607 1497\n-334 -6012\n-5668 -3768\n295 7486\n-1735 5473\n-3091 -8034\n6310 -5377\n1303 -4556\n-3210 -7814\n-6397 -3031\n1739 5991\n24 -4383\n1788 -138\n2739 -535\n3085 -512\n2645 -7670\n-7496 -4489\n2796 -7884\n2094 1553\n-1188 -5890\n3560 -272\n5082 -1825\n-443 -5183\n1544 2555\n-1068 6622\n6099 -1613\n444 -5733\n5007 -3537\n-5742 -1964\n1587 -245\n-273 -7642\n1393 3615\n336 2663\n-725 5526\n78 1572\n1967 -6502\n1848 3591\n-7719 -4848\n3160 -1232\n1913 -8604\n-72 2935\n-918 -7170\n1708 -1012\n845 5820\n3892 1435\n-2687 4013\n3742 -4003\n2695 -1547\n1425 1360\n3011 1418\n6719 -3961\n-1247 -5735\n3404 -2618\n-4252 -734\n6624 -5518\n2726 2503\n492 8076\n4768 -3874\n4295 809\n4484 -4737\n5833 -2300\n-3437 2552\n-312 2217\n1287 2728\n-3071 2776\n4094 -2138\n5870 -3497\n5188 -587\n5938 -2771\n-5190 -1629\n1109 -7463\n-7369 -4233\n-1595 -5966\n-1951 3477\n6868 -2881\n-2682 4299\n-6767 -5484\n3591 -4538\n-6295 -3029\n-6474 -2409\n675 1909\n-1288 -3968\n-5925 -1279\n-1323 6218\n-592 3028\n4291 1551\n6195 -3364\n2527 4532\n2034 1911\n5812 -2129\n1148 -3753\n4548 -86\n-2598 4412\n2330 -6438\n5488 -1091\n-292 3072\n298 6338\n-2351 -7130\n-1350 3846\n-4515 811\n2611 -1694\n1815 1462\n2806 -1425\n-201 -2981\n-524 3171\n1166 -499\n5848 -2746\n256 5666\n7492 -5394\n-939 6282\n2490 3282\n185 4362\n758 5409\n-176 5759\n7064 -5277\n6382 -5083\n-5773 -2886\n6354 -3146\n503 5034\n1268 3368\n-4027 -558\n2378 1130\n291 3829\n3023 -214\n5653 -1296\n-6549 -5130\n5775 -4542\n4061 -2562\n-895 -3963\n-82 -2154\n1728 -8416\n178 -8609\n-6443 -2180\n5859 -2047\n-1406 4479\n-973 -3970\n4831 326\n-6363 -3849\n4570 1124\n6700 -4941\n-1788 3183\n2320 3304\n5103 -1625\n173 8347\n-6429 -4868\n3772 -2700\n1304 526\n5644 -4327\n2229 651\n2983 3563\n-3471 2364\n-1115 -6753\n1531 -7997\n6190 -5432\n1356 -512\n-5731 -3141\n6931 -4820\n-6044 -4127\n344 6183\n9 -3906\n1868 -6196\n4183 -1710\n-1150 6035\n1696 5696\n-1329 -6791\n2215 -169\n3660 -3292\n-2407 2053\n3112 359\n-1135 -6933\n-428 -3432\n3453 2771\n-3168 -7781\n867 5902\n146 -6265\n1012 -4215\n6027 -2575\n-1345 -4024\n-6775 -4187\n3529 146\n-2453 -8082\n3678 -2860\n4354 -4808\n308 -7166\n3148 -602\n-404 6699\n-5150 -2172\n2083 4295\n-748 3099\n2613 3337\n3446 -4393\n-6506 -4601\n2842 1628\n2544 -483\n4385 -2561\n1232 -8669\n-5445 -438\n2040 5478\n4564 -358\n2057 -99\n-5890 -3424\n787 3447\n-22 -8191\n-2834 -8065\n-371 -7110\n2343 3449\n4652 -69\n-1799 3576\n3821 -246\n4354 -969\n7352 -4775\n-5764 -2051\n819 894\n-6207 -3644\n1207 -3955\n-420 2856\n-1007 5105\n-99 -3312\n-3476 1981\n101 -3299\n-1281 4472\n1892 237\n-750 -5815\n375 -8357\n5550 -4329\n5866 -1513\n4139 -3908\n3728 1462\n-3065 -8509\n3695 -2942\n4181 -1441\n4378 677\n133 -7201\n-1695 -8496\n3039 -3392\n4879 -2541\n-167 -8185\n-2239 -7687\n-4696 -1315\n659 6467\n1162 -4637\n1634 2993\n6082 -3536\n1215 -5422\n-2487 4020\n-5944 -4118\n340 -4926\n-5906 -2668\n466 -8515\n6593 -4840\n980 -5302\n1059 4189\n2813 -1307\n2478 -8694\n2693 -6983\n-6997 -3949\n1444 -8313\n365 5239\n-6399 -3909\n2454 943\n-389 5908\n1572 2444\n1096 -7681\n-792 -8116\n2254 -8266\n-95 8324\n-294 -6780\n23 -1944\n-256 -7624\n-1131 5703\n-194 6323\n-1650 5155\n-1446 4611\n-3286 -8731\n872 -5932\n2284 352\n-4688 629\n-694 -4432\n2516 -693\n-1338 -6821\n562 -3962\n93 -2992\n1223 -7908\n5444 -1449\n3489 -3461\n3174 2495\n3129 -1800\n-1211 4366\n7328 -4604\n-7040 -4733\n1621 4912\n1280 4733\n7217 -4560\n3716 -3160\n-1639 4621\n1650 5621\n-593 3628\n901 -7978\n3797 -73\n4298 -2700\n-5895 -3888\n2273 -7937\n-8100 -5178\n-1005 6789\n7151 -3735\n2981 -6921\n7155 -3487\n-286 -5972\n1612 -5121\n-6668 -3955\n480 6745\n1482 5521\n-7812 -5501\n3635 -8727\n2141 4987\n669 3039\n-1133 6894\n3790 -4889\n-1325 -4267\n-1482 -7107\n-2666 -7051\n586 -4511\n-1131 -6204\n-1936 -7325\n1636 -450\n2723 -2399\n6029 -1824\n-7099 -4971\n2470 379\n3289 2620\n3857 -8771\n-2792 1599\n-6138 -3655\n351 5522\n3886 1584\n1977 -8648\n2799 2999\n74 -6006\n-880 -7186\n1842 -7717\n-2624 -8825\n1807 -1542\n374 5611\n5964 -5410\n189 6606\n3154 -1370\n693 4983\n1628 -6369\n2576 3768\n2055 5314\n5021 -1301\n662 1778\n2517 4326\n1162 -6328\n6352 -4242\n7974 -5397\n-2397 -8699\n1688 4049\n-3494 -8801\n7722 -4461\n-923 -5268\n-4023 1729\n3461 -1492\n2409 -7477\n1932 -5519\n5116 -2784\n-4248 1182\n3484 -3866\n222 1212\n3825 -2052\n1248 967\n1841 1293\n820 -3374\n1178 -6671\n4056 773\n2922 -1244\n-738 5421\n-1120 -6285\n5057 -930\n3740 -8479\n3507 -1652\n-1831 -7467\n1215 4988\n23 7886\n5253 -3682\n1850 -1611\n4065 -4577\n395 -5258\n-3627 -8013\n-285 -4672\n3148 993\n6738 -3886\n3596 1494\n1971 1355\n-541 7211\n599 -3745\n-7395 -5099\n2482 4203\n-1142 5462\n391 2994\n1476 4826\n-2054 -7479\n-833 -4917\n3376 -699\n2518 2977\n2966 -1074\n-1339 -5048\n3709 -2394\n3645 150\n-620 -5295\n-1564 -6737\n475 2165\n1929 -1203\n880 1905\n-354 -5551\n-1162 -7841\n2448 2741\n-3313 -7353\n2243 -1793\n-1248 -6900\n1623 -6799\n5791 -1033\n1086 -4956\n2137 1068\n25 3600\n3569 -7765\n-2442 -8528\n6178 -4121\n-1771 -8764\n-3528 -7881\n1505 890\n-214 -7638\n7210 -3453\n-2053 -8112\n-502 -5937\n3489 2127\n-2521 1876\n-6045 -1977\n-1114 5390\n2051 2163\n1275 497\n2389 -2024\n-245 8384\n4441 410\n-6466 -3180\n4447 -3019\n3860 -2610\n604 -4725\n7434 -4829\n78 -6806\n228 -8228\n-7207 -4040\n682 -8186\n2678 -1101\n-1329 -7513\n783 -7017\n-1127 -6502\n7764 -5302\n480 5955\n4634 -3041\n1747 4798\n-5241 -1107\n-1789 -6405\n-1914 -8757\n2662 1163\n1841 5606\n4879 188\n3194 -8345\n3078 -8816\n-3173 3489\n4260 -4956\n4613 40\n3896 1250\n5709 -5261\n1582 4936\n3061 -8007\n-7410 -4331\n-7646 -4423\n322 -5877\n3434 -3096\n3205 -8379\n-2130 -8203\n-2438 2196\n2039 62\n1889 -5687\n-1295 5520\n525 -2634\n7093 -3406\n-1166 -8250\n1798 -5016\n7153 -3787\n1640 -8809\n1266 1745\n-1561 3682\n389 4110\n974 -6534\n-5832 -2074\n-7278 -5251\n3576 2223\n1589 3840\n-5723 -2824\n6703 -4619\n1301 -8149\n2057 17\n-4029 1699\n1992 -47\n-1469 -4234\n-2316 -7413\n2599 4294\n2556 -8618\n2689 3741\n-127 2802\n-941 -8185\n-1355 5632\n-101 4694\n1890 4245\n-5579 -613\n-691 -4331\n2746 -311\n4417 604\n-690 -6281\n-4427 -393\n2696 -7057\n4804 -4042\n4350 -3395\n-1057 -6288\n1842 -6395\n3705 -8686\n-370 3483\n-755 6606\n-6418 -3674\n-946 -5276\n-43 -4633\n-692 5955\n-3285 2500\n-3696 -8377\n-4984 -1322\n-7301 -5186\n34 4273\n451 5179\n1793 -7234\n2047 1364\n6055 -3991\n-4332 -747\n2998 -3021\n1038 -4601\n2007 -1739\n-3716 1301\n-33 8824\n-131 -6941\n-7234 -5185\n2926 -8820\n887 -3390\n3654 -8525\n6993 -5293\n4761 -4326\n-799 -5688\n1499 -8547\n-1218 4737\n5962 -5129\n2957 -2793\n-2800 -8557\n2124 -456\n5596 -1711\n-7107 -3249\n3488 2349\n184 2294\n1749 -6636\n-28 -4127\n2383 3562\n2714 -2029\n761 5982\n2987 3018\n-529 -3656\n3255 -8744\n4462 -1647\n-6600 -3480\n-591 -3580\n2612 -8592\n2055 3368\n4293 -5498\n-540 -3950\n-6056 -2538\n6972 -3879\n277 -2618\n3914 -182\n484 -5532\n-3025 1399\n-679 4419\n2882 4070\n1216 -5796\n6753 -4095\n3900 -1451\n3801 932\n2452 -1956\n7301 -5230\n-3685 -8453\n-748 4295\n-1536 -4574\n3239 -2843\n-2039 -7816\n-5837 -2304\n-2458 -7105\n3039 -312\n2734 2193\n2526 1993\n-1982 4473\n-2674 2803\n-1406 -8124\n2190 2806\n45 -3193\n-5734 -1915\n-3945 854\n3047 -7658\n6473 -4631\n2028 -7336\n-2376 2151\n499 6935\n2587 1172\n-5164 -1394\n4005 1494\n1926 -134\n1386 5105\n842 -6351\n2866 -2653\n7696 -5204\n4895 495\n1998 -1651\n295 5231\n226 4462\n-212 -2635\n1171 -6438\n389 913\n-511 -8672\n5520 -3577\n4600 -3677\n781 -6737\n-5601 -2156\n6098 -5412\n-961 6069\n3647 35\n-6349 -3054\n-958 -6994\n1222 2127\n324 2384\n-5974 -1596\n-2522 3146\n1332 6581\n2154 -6229\n-6667 -3698\n-1869 4668\n6817 -2841\n4160 -2789\n2025 -5320\n1255 3097\n218 -5891\n6588 -3242\n-2316 -5862\n3822 -8692\n-236 -6765\n151 7700\n-324 3044\n7662 -5010\n977 2954\n-8141 -1090\n5770 276\n7238 607\n681 6908\n-4835 1484\n4181 3148\n-5279 -3375\n7043 5800\n2982 -7898\n-1960 7661\n4105 5673\n-7225 -3970\n-5979 -7191\n3871 -5782\n-4279 2784\n4474 5752\n314 2112\n3355 7823\n-7569 4754\n-5744 -425\n-3604 1981\n4280 8480\n3852 7169\n2835 1653\n-7439 7046\n-1650 -4892\n7479 7150\n5502 1622\n7069 7545\n5824 2842\n-1945 6411\n-2418 4396\n-6486 -6534\n6697 5504\n30 -7409\n312 -5382\n177 -5767\n7477 -5418\n7925 2817\n356 -7121\n-3816 -548\n6716 5503\n5717 -7192\n-2085 8550\n-4723 2336\n-6267 -2391\n4405 -3671\n-2193 -1886\n-5839 8495\n3967 -5750\n2103 3632\n-5076 -903\n8230 3242\n6229 -7057\n-4057 3514\n8039 2791\n-5800 8369\n578 6951\n-2918 3299\n-7503 495\n77 -5029\n4903 -3657\n-7280 7742\n610 7394\n-8085 -2558\n4358 -3562\n-1378 -8291\n-289 -5712\n7600 718\n4604 -3601\n3113 -7405\n-3402 115\n2845 -1948\n1771 3277\n1900 3737\n-1943 6648\n-485 2692\n3748 -5796\n6863 -3664\n6158 -2701\n2220 -3424\n-4790 4921\n4201 7836\n537 7407\n-411 -4775\n686 7273\n-1203 -6403\n-3697 -356\n-1149 2476\n928 -3258\n-3320 -217\n-2805 -4123\n3201 2403\n8461 3396\n7515 -3005\n1901 1916\n4383 6007\n3582 -3474\n1917 4508\n3582 -5917\n8316 213\n-2908 2255\n6426 -3355\n-6083 -4432\n1169 6860\n-7703 3757\n7492 3620\n5378 1996\n3043 -3108\n1528 3398\n-9473 -4653\n3967 -6080\n2004 3679\n7759 -5595\n-3052 -251\n2381 -2127\n283 105\n-3664 2419\n1377 3545\n5713 853\n6417 -3328\n-407 1560\n-2063 -3822\n-5347 -4509\n4863 -3989\n6255 438\n-2459 7365\n4333 6148\n6182 555\n7453 59\n1762 -3037\n-8333 7068\n-1919 -4788\n8923 -720\n7006 -3428\n2334 3954\n2759 -7458\n4591 5361\n7856 3503\n1631 3809\n5451 786\n646 7431\n-8176 7175\n-2741 -2081\n-1457 7707\n804 1086\n3022 -7502\n-5161 -793\n2892 -7694\n6810 -3655\n-5794 4079\n1825 4044\n-5309 4917\n3926 -5752\n-1349 -5572\n-2755 -1955\n6754 -5749\n3376 -7771\n-218 543\n-3782 3207\n-2296 -1788\n-1607 7496\n4353 5544\n162 -6163\n7286 7481\n6637 5072\n-2359 7002\n-5820 -2159\n492 486\n-6804 -1019\n-1255 -5027\n-2309 -1793\n-3465 -453\n5575 263\n-2985 2076\n5864 754\n-6482 3570\n6459 5302\n423 -6399\n-1930 -7347\n-6813 1366\n8190 967\n-8139 7705\n2130 -4505\n-9206 -4309\n-2439 -7341\n561 7157\n7596 3458\n-457 -5197\n8274 -5353\n8009 -5569\n4395 561\n8130 335\n7023 8171\n-5503 1279\n297 -7422\n7730 3753\n-2529 7481\n-4195 -4148\n4840 357\n4472 5758\n4156 5054\n-5914 -6582\n-5379 -919\n3875 -5850\n-4691 2065\n-3054 4882\n1520 3557\n-2074 -7548\n7759 3631\n-1547 4123\n6508 -2998\n-4006 -698\n-6015 7033\n4755 6247\n8236 763\n7554 3137\n4962 1852\n-421 -5637\n-1638 7872\n1768 -1770\n-677 -6818\n-3316 -342\n1388 -2134\n240 -7369\n-7861 -454\n-7571 -4297\n7214 7537\n6876 7447\n-7202 -1692\n-2434 -3051\n-645 3327\n1534 3908\n-1727 7748\n-4795 1858\n-6036 -6426\n8293 3468\n7925 -3617\n2964 -7587\n-9024 -4615\n-3440 -6613\n2860 -2424\n212 -5802\n6232 726\n706 -3623\n4234 1131\n-6321 -7027\n-1141 -3971\n8225 1108\n-1924 -1547\n7763 795\n-5198 -854\n-4322 7774\n-7848 7454\n5406 485\n5820 -7369\n-4646 7520\n-4671 1401\n6403 3861\n-5644 -3476\n-876 -5049\n-7669 4698\n5225 44\n-1993 -2860\n-1657 2235\n7542 -502\n6923 7800\n3790 -8062\n-5429 -2031\n-2172 -1010\n4067 -193\n7050 -404\n8045 317\n-8726 6798\n-7021 2136\n-7719 7829\n-5190 -785\n-269 1264\n4080 -5709\n6657 5582\n-7145 3590\n-1865 6972\n4693 -3990\n308 -7489\n-863 -6304\n5804 -7540\n4461 5789\n7237 -2913\n-172 -5248\n-2515 8183\n-8627 -3781\n8299 2931\n2862 -7958\n-7033 8233\n1460 393\n-2303 6634\n-1794 8320\n-5871 6503\n-6563 6859\n-7804 -776\n6789 7723\n-5107 5374\n835 -1918\n-6081 -561\n-535 -6860\n2680 -2774\n1076 -5213\n3632 -5693\n2051 3539\n1794 3672\n821 -7233\n-151 -7410\n-7452 -3782\n-458 -1583\n5594 -7503\n7414 8261\n-7065 8531\n5277 2794\n100 -7034\n-4959 -222\n3513 7959\n-361 -4727\n745 -7494\n4841 2076\n3325 -6982\n3829 -5639\n-2168 4482\n7124 -3415\n606 -7761\n-2145 3508\n7138 7571\n-5915 1623\n8150 1532\n7609 -5026\n5420 1673\n-5786 -2284\n-7257 -3867\n6253 -6783\n4215 5378\n-6093 7396\n-5645 -5976\n5119 1342\n-1882 -7596\n2881 -3271\n-3549 212\n-1501 -2475\n-6334 -5997\n5671 -7386\n-7790 -2152\n6633 -3292\n1056 4247\n-3028 15\n6806 -2413\n941 -5299\n8278 3554\n5541 2452\n4486 7830\n1268 -5525\n4826 -3378\n6734 7623\n-4862 6369\n5080 8004\n-951 -4043\n-5523 -4259\n254 -7275\n6731 402\n-2500 -2686\n-588 12\n-4985 -6663\n-4807 -3572\n-6099 -6297\n-247 -7517\n5664 -7343\n-3313 -491\n639 1576\n928 7008\n-472 1164\n5744 476\n-1726 7776\n628 -5390\n-5684 -4283\n2917 -7310\n-1 6835\n-7129 -282\n6158 5993\n8108 -5268\n-3056 -1923\n-6525 5864\n-6668 7756\n-6173 -1360\n-5515 4842\n5544 1602\n-6624 8486\n5204 7991\n-3535 115\n5907 -7542\n-6464 -7242\n-8243 -1887\n3671 1979\n-8057 7527\n-5115 -3477\n2429 -959\n-5329 6120\n8429 28\n-321 1280\n-1965 7210\n1004 -574\n2746 -1981\n4386 -3740\n6042 74\n3867 -6034\n374 4743\n-1379 -3029\n-313 1865\n-5490 613\n-7645 3469\n6916 7802\n-138 -6121\n-2735 -6913\n-1902 2649\n-5602 2573\n4580 -3699\n1035 7589\n5786 245\n-5644 -6621\n3035 -533\n-5943 -1179\n-6823 -4132\n-7130 1222\n1379 762\n-2717 4406\n-2465 7775\n8548 2312\n-1012 1672\n4423 5917\n4849 5097\n-6132 6947\n-5762 4496\n-3783 -7175\n-1201 -5425\n-7709 1887\n4411 5563\n-1888 -4516\n4463 6000\n8717 -78\n-6546 -5773\n3641 -5630\n3814 -5930\n5632 364\n-5568 7497\n8440 -4742\n-3321 -5802\n-9296 -2079\n8029 1709\n-5394 1491\n6333 -7398\n3098 -4085\n219 -7479\n242 -7276\n4899 5714\n13 2166\n2953 -7381\n-918 3904\n5988 996\n-3127 -7142\n-6346 7747\n4809 -3644\n-2734 -3480\n-3871 -745\n-770 -6453\n517 -3989\n1295 7141\n2991 -3865\n-5067 991\n4175 5766\n2731 1282\n5930 2541\n3881 6036\n3043 -7397\n-7513 2338\n2794 -1683\n1 852\n6863 5545\n6046 -6764\n-5074 5356\n1466 -1463\n-5555 -3880\n4862 8206\n7150 -3431\n227 -3970\n2690 -7655\n-5366 -3201\n7701 3422\n1939 3978\n-2251 7423\n6730 -3447\n4556 8253\n6822 -2607\n4734 -4070\n5168 1894\n-1585 -7476\n-6899 -4222\n5707 471\n8213 1275\n7276 7671\n4805 5292\n3923 -5895\n6683 2452\n4747 3439\n3671 -5411\n1824 -2073\n7073 -3495\n-4488 -3332\n1354 2550\n3135 -8105\n-5315 7272\n3972 6151\n46 830\n-4948 6661\n7375 -3889\n2133 -1904\n3981 -5762\n5322 -7561\n3722 -5913\n-8539 -1871\n5290 542\n7133 7786\n-4329 6810\n6336 -3434\n188 -5343\n3223 -3968\n-2683 -1388\n-7224 -4392\n1203 -5191\n5736 1816\n-2962 -7171\n-5973 -3680\n1827 3786\n7671 2639\n-3284 5844\n-6894 1333\n904 6814\n-3278 -503\n374 -2022\n4881 -3499\n-221 -7562\n-2754 -1593\n8243 -5192\n-6052 -319\n7176 3649\n-4781 8133\n6770 5248\n332 -6960\n4118 -5793\n3368 634\n2184 3598\n3046 -7916\n3660 -5898\n7505 -5169\n-5302 -7123\n7502 -36\n6961 8024\n4815 8286\n-467 -1936\n2234 3458\n21 -5864\n3446 -3199\n-6212 8754\n5315 665\n3071 319\n292 7178\n4259 -3703\n7169 7812\n3728 -5816\n3736 -5769\n317 924\n-5262 -560\n8395 1819\n412 518\n-4738 3526\n-4219 5015\n-3667 4042\n6834 5838\n-7977 7665\n-8144 -4078\n7004 -5501\n-645 -3298\n-7289 -3722\n3308 -5529\n8043 -5314\n-5862 -6823\n5238 114\n3543 5867\n3229 -7492\n-2854 -11\n2243 -787\n6064 -7784\n8814 1047\n-3152 -657\n4487 5590\n-5893 -6860\n-8123 4146\n-6609 3954\n-2193 -1331\n-6247 -5967\n4657 -3735\n-3308 4643\n4650 4139\n2324 -1441\n4288 2815\n6534 5450\n3128 -4575\n9073 121\n1036 7736\n-336 -7584\n-7908 4752\n5788 2917\n-7179 9492\n-6793 -3889\n-5846 -3860\n979 1920\n-1775 -7192\n1757 -4362\n4679 -3434\n-7525 4608\n-6062 -5832\n56 3441\n5641 -370\n-766 -6971\n121 885\n-7195 -3631\n3527 7067\n4655 -3445\n5598 897\n-5896 -6571\n7998 3730\n4413 -3606\n-3153 4719\n260 -7406\n7582 4144\n7445 4066\n198 -7623\n-1937 -2293\n-4642 4338\n-2087 1930\n-2790 -8425\n-5404 -3389\n1314 6775\n-6336 162\n-5157 3250\n57 -1392\n-556 -5691\n2661 -1265\n-5023 -1311\n-7053 3094\n6617 -3405\n-1035 -4099\n-3784 3137\n5982 -7456\n3599 -5644\n1629 3492\n-3146 -208\n-7476 -2304\n-3717 -333\n2006 3619\n-440 -5986\n8545 -3800\n3841 8207\n1223 -3063\n-8614 4168\n3377 -3668\n-4002 5405\n-5871 9338\n-5640 9680\n-3871 2377\n-6582 8204\n956 416\n-3529 56\n-2854 -2319\n7469 -3255\n-7216 -437\n-6742 -1372\n-6210 -6836\n8578 1091\n-3424 -574\n3635 -5604\n-2250 -2777\n6079 136\n-6965 5583\n4811 5705\n-5625 -4443\n-370 2647\n3642 -5706\n8041 3664\n-5520 -6682\n-2161 750\n3310 -642\n-5940 -6798\n7264 7634\n5615 769\n8360 -5706\n-6353 -4490\n4621 8627\n2968 8055\n-5294 -7444\n-3572 -215\n926 7029\n-823 -4134\n-882 -3267\n4692 5735\n6323 -7543\n-559 -2322\n-8445 7122\n-4359 7375\n-4403 2035\n394 -7187\n6020 -7409\n-1938 7234\n-7327 6021\n-357 -5539\n-2721 1683\n6464 -5185\n4423 5850\n5937 1158\n-2327 -2264\n2987 -8092\n3033 -7499\n-5413 4491\n7005 -3318\n-7648 1712\n3997 8081\n-7859 4964\n-5158 5341\n1422 3734\n5453 219\n-5783 -6691\n6889 5192\n-6935 -1208\n-1883 4518\n6776 5428\n6393 5409\n1694 2163\n331 900\n-4008 1259\n7164 7679\n6922 -3759\n7131 -3804\n-1602 -5019\n8326 3172\n7100 -3044\n-616 3755\n-4719 4910\n5501 3430\n-7134 2363\n-7749 -5007\n-4523 -51\n-6064 94\n6601 -2877\n-3423 -25\n-6392 2561\n-7761 5568\n57 -7371\n-373 -6326\n-5220 -3554\n-2558 -2183\n199 -7573\n4175 8161\n131 -2645\n-1144 -4965\n-2998 -1195\n-6010 -6130\n300 -7257\n-471 -2314\n6886 7412\n6874 7689\n-6581 8015\n-131 -5641\n-3144 -154\n5919 -7290\n485 1303\n-2455 4849\n-3479 -1562\n6630 1565\n-2503 6408\n-2123 8011\n6310 5326\n-3350 -8919\n-2697 -7068\n6626 5510\n6459 -3112\n7312 3612\n988 994\n7249 5959\n-8148 8693\n6144 1364\n5185 5841\n6297 -2826\n576 678\n467 -7258\n-5589 -6529\n6000 282\n1958 -499\n4175 1846\n6425 -3280\n-4903 8704\n-6229 -1198\n292 -7050\n4605 8051\n-3678 4865\n7033 -3809\n-2086 7412\n4433 1546\n6537 -2823\n8469 1120\n-5226 4804\n-1942 -5282\n-7318 4297\n791 1365\n-7040 -1697\n4680 -3550\n-8762 -3555\n-8423 5714\n2352 -3631\n-1060 -4578\n-1834 -4688\n-7445 -4984\n2541 -7721\n4044 5370\n-4357 -457\n-973 1726\n4199 3103\n-1730 7229\n-4485 -3802\n-7187 -5158\n-4204 5074\n-90 -5322\n660 417\n8800 3102\n4959 5790\n3787 -5629\n-1216 -7386\n-7042 1594\n-5713 -7063\n-4493 4168\n7012 7361\n-2072 -5433\n-550 -6825\n-2530 -3126\n4107 8514\n3202 -8057\n-3453 378\n3897 -5582\n-7696 1645\n-5354 -934\n96 -5109\n-6544 -2858\n4690 -3655\n499 -5863\n659 7311\n-8743 -6831\n6237 5324\n-4089 3416\n4009 -5680\n6012 -7471\n1541 -3180\n6779 -2971\n-7749 8034\n5457 -7192\n-311 2982\n4883 -3569\n5080 5775\n-6198 -140\n-6617 1610\n-1168 -4652\n4709 -8054\n-3045 5632\n3880 8107\n5755 -7521\n-2303 5316\n6399 5528\n5550 -7435\n4288 551\n443 -5495\n3577 1116\n3009 -865\n-5709 -6232\n3564 -5303\n-4482 -672\n6953 -3099\n2734 -4098\n-7915 -760\n-8794 -5570\n3264 387\n-1833 -7301\n7539 8138\n-5258 -7272\n-1453 1766\n5033 2183\n-4990 4987\n-4464 -3604\n-4955 2109\n7027 -3408\n982 7091\n6715 7782\n4548 7754\n3524 2864\n-8185 -2337\n3945 8817\n5888 3692\n-7968 -4384\n304 -7435\n1262 1210\n5870 3787\n-2315 -7470\n-5936 -6518\n928 1241\n4707 -3238\n4714 7568\n211 7318\n6831 5425\n4328 6539\n593 -3038\n6510 -3648\n7660 -2885\n5286 347\n-6283 -6501\n-6463 1465\n8524 3182\n4487 5562\n-5661 -6580\n-1686 7712\n1776 3655\n-845 140\n5604 2289\n197 -6594\n4220 5895\n8250 3533\n6049 2265\n8170 -5058\n4043 -5732\n5708 213\n-6128 8628\n3941 6938\n-5600 -376\n3895 2838\n-1969 -4198\n7015 5632\n49 1261\n5966 325\n-4511 7769\n-5927 -3342\n1696 -2962\n-1800 -4640\n5527 2540\n3663 -5652\n661 619\n7744 -788\n-7752 7626\n3174 -7785\n-894 2399\n4762 -3586\n3218 -7728\n2764 -7657\n350 -6947\n-1461 5852\n-3859 -7622\n3992 7998\n8291 1346\n-4649 4972\n640 -7398\n319 -7695\n5447 1881\n-5621 -6950\n5060 8401\n240 -7306\n4341 5909\n-3049 -2216\n340 1319\n-3207 -2267\n6721 5372\n-1660 7475\n6932 7954\n1535 -2955\n3406 -6021\n1495 4281\n-6255 -6749\n-3195 -7819\n2162 3315\n789 6868\n3895 8196\n1519 3870\n-4968 -3437\n345 -6979\n4066 -5634\n3262 -2842\n-2671 6742\n2096 3533\n-1959 -7025\n5819 4192\n3711 -5822\n",
"output": "687 0 580 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1795 1156 0 0 672 1358 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 438 0 0 0 0 0 0 0 0 0 0 0 447 0 2681 0 0 0 0 0 0 0 0 0 1942 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.