Codeforces Beta Round 6 (Div. 2 Only)


A. Triangle
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
4 2 1 3
Output
TRIANGLE
Input
7 2 2 4
Output
SEGMENT
Input
3 5 9 1
Output
IMPOSSIBLE
----------------------------------------------------------------------------------------------------
B. President's Office
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
3 4 R
G.B.
.RR.
TTT.
Output
2
Input
3 3 Z
...
.H.
..Z
Output
0
----------------------------------------------------------------------------------------------------
C. Alice, Bob and Chocolate
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
5
2 9 8 2 7
Output
2 3
----------------------------------------------------------------------------------------------------
D. Lizards and Basements 2
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
3 2 1
2 2 2
Output
3
2 2 2 
Input
4 3 1
1 4 1 1
Output
4
2 2 3 3 
----------------------------------------------------------------------------------------------------
E. Exposition
time limit per test: 1.5 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
3 3
14 12 10
Output
2 2
1 2
2 3
Input
2 0
10 10
Output
2 1
1 2
Input
4 5
8 19 10 13
Output
2 1
3 4
----------------------------------------------------------------------------------------------------
