Codeforces Round 134 (Div. 1)


A. Ice Skating
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2 1
1 2
Output
1
Input
2
2 1
4 1
Output
0
----------------------------------------------------------------------------------------------------
B. Blackboard Fibonacci
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 10
Output
2
TBBTTB
Input
4 5
Output
0
TBTB
Input
2 1
Output
IMPOSSIBLE
----------------------------------------------------------------------------------------------------
C. Formurosa
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
(?^?)
Output
NO
Input
10
?
Output
YES
Input
2
((?^?)&?)
Output
YES
----------------------------------------------------------------------------------------------------
D. Bitonix' Patrol
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 6 5
5 4 12 6 5
Output
6
Input
3 60 2
10 100
Output
4
----------------------------------------------------------------------------------------------------
E. Alien DNA
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
GAGA
4
0
Output
GAGA
Input
ACGTACGT
16
2
1 2
2 8
Output
ACCAGTACCGACATCG
----------------------------------------------------------------------------------------------------
