Codeforces Round 921 (Div. 2)


A. We Got Everything Covered!
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2
2 1
2 2
2 3
Output
ab
aa
baab
abcbac
----------------------------------------------------------------------------------------------------
B. A Balanced Problemset?
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
10 3
5 5
420 69
Output
2
1
6
----------------------------------------------------------------------------------------------------
C. Did We Get Everything Covered?
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 2 4
abba
2 2 3
abb
3 3 10
aabbccabab
Output
YES
NO
aa
NO
ccc
----------------------------------------------------------------------------------------------------
D. Good Trip
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
100 0 24
2 1 10
1 2 1
3 1 2
2 1 1
5 2 4
1 2 25
3 2 24
Output
0
55
777777784
40000020
----------------------------------------------------------------------------------------------------
E. Space Harbour
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8 3 4
1 3 8
3 24 10
2 2 5
1 5 15
2 5 5
2 7 8
Output
171
0
15
----------------------------------------------------------------------------------------------------
F. Fractal Origami
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1
2
3
Output
0
1
714285638
----------------------------------------------------------------------------------------------------
