Educational Codeforces Round 75 (Rated for Div. 2)


A. Broken Keyboard
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
a
zzaaz
ccff
cbddbb
Output
a
z
bc
----------------------------------------------------------------------------------------------------
B. Binary Palindromes
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1
0
3
1110
100110
010101
2
11111
000001
2
001
11100111
Output
1
2
2
2
----------------------------------------------------------------------------------------------------
C. Minimize The Integer
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0709
1337
246432
Output
0079
1337
234642
----------------------------------------------------------------------------------------------------
D. Salary Changing
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 26
10 12
1 4
10 11
1 1337
1 1000000000
5 26
4 4
2 4
6 8
5 6
2 7
Output
11
1337
6
----------------------------------------------------------------------------------------------------
E1. Voting (Easy Version)
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
3
1 5
2 10
2 8
7
0 1
3 1
1 1
6 1
1 1
4 1
4 1
6
2 6
2 3
2 8
2 7
4 4
5 5
Output
8
0
7
----------------------------------------------------------------------------------------------------
E2. Voting (Hard Version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
1 5
2 10
2 8
7
0 1
3 1
1 1
6 1
1 1
4 1
4 1
6
2 6
2 3
2 8
2 7
4 4
5 5
Output
8
0
7
----------------------------------------------------------------------------------------------------
F. Red-White Fence
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 2
3 3 1 1 1
2 4
7
6 8 10 12 14 16 18
Output
1
2
2
4
6
4
1
Input
5 5
1 2 3 4 5
1 2 3 4 5
4
4 8 10 14
Output
1
3
5
20
----------------------------------------------------------------------------------------------------
