Codeforces Round 622 (Div. 2)


A. Fast Food Restaurant
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
1 2 1
0 0 0
9 1 7
2 2 3
2 3 2
3 2 2
4 4 4
Output
3
0
4
5
5
5
7
----------------------------------------------------------------------------------------------------
B. Different Rules
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
5 1 3
Output
1 3
Input
1
6 3 4
Output
2 6
----------------------------------------------------------------------------------------------------
C1. Skyscrapers (easy version)
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 3 2 1
Output
1 2 3 2 1 
Input
3
10 6 8
Output
10 6 6 
----------------------------------------------------------------------------------------------------
C2. Skyscrapers (hard version)
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 3 2 1
Output
1 2 3 2 1 
Input
3
10 6 8
Output
10 6 6 
----------------------------------------------------------------------------------------------------
D. Happy New Year
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 5 3
1 3
2 4
3 5
Output
4
----------------------------------------------------------------------------------------------------
E. Concatenation with intersection
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
6 5
aabbaa
baaaab
aaaaa
Output
4
Input
5 4
azaza
zazaz
azaz
Output
11
Input
9 12
abcabcabc
xyzxyzxyz
abcabcayzxyz
Output
2
----------------------------------------------------------------------------------------------------
