Codeforces Beta Round 7


A. Kalevitch and Chess
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
WWWBWWBW
BBBBBBBB
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW
WWWBWWBW
Output
3
Input
WWWWWWWW
BBBBBBBB
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
WWWWWWWW
Output
1
----------------------------------------------------------------------------------------------------
B. Memory Manager
time limit per test: 1 second
memory limit per test: 64 megabytes
input: standard input
output: standard output

Examples
Input
6 10
alloc 5
alloc 3
erase 1
alloc 6
defragment
alloc 6
Output
1
2
NULL
3
----------------------------------------------------------------------------------------------------
C. Line
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 5 3
Output
6 -3
----------------------------------------------------------------------------------------------------
D. Palindrome Degree
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
a2A
Output
1
Input
abacaba
Output
6
----------------------------------------------------------------------------------------------------
E. Defining Macros
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
#define sum x + y
1 * sum
Output
Suspicious
Input
1
#define sum  (x + y)
sum - sum
Output
OK
Input
4
#define sum  x + y
#define mul  a * b
#define div  a / b
#define expr sum + mul * div * mul
expr
Output
OK
Input
3
#define SumSafe   (a+b)
#define DivUnsafe  a/b
#define DenominatorUnsafe  a*b
((SumSafe) + DivUnsafe/DivUnsafe + x/DenominatorUnsafe)
Output
Suspicious
----------------------------------------------------------------------------------------------------
