Codeforces Round 126 (Div. 2)


A. Cinema
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4 6
1 1
1 1
1 1
1 2
1 3
1 3
Output
1 1
1 2
2 1
1 3
1 4
2 3
Input
4 3 12
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
Output
2 2
1 2
2 1
2 3
3 2
1 1
1 3
3 1
3 3
4 2
4 1
4 3
----------------------------------------------------------------------------------------------------
B. Drinks
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
50 50 100
Output
66.666666666667
Input
4
0 25 50 75
Output
37.500000000000
----------------------------------------------------------------------------------------------------
C. Football Championship
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
AERLAND DERLAND 2:1
DERLAND CERLAND 0:3
CERLAND AERLAND 0:1
AERLAND BERLAND 2:0
DERLAND BERLAND 4:0
Output
6:0
Input
AERLAND DERLAND 2:2
DERLAND CERLAND 2:3
CERLAND AERLAND 1:3
AERLAND BERLAND 2:1
DERLAND BERLAND 4:1
Output
IMPOSSIBLE
----------------------------------------------------------------------------------------------------
D. Programming Language
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
void f(int,T)
void  f(T, T)
 void foo123   ( int,  double,  string,string  ) 
  void  p(T,double)
3
int a
 string    s
double x123 
5
f(a,  a)
  f(s,a   )
foo   (a,s,s)
 f  (  s  ,x123)
proc(a)
Output
2
1
0
1
0
Input
6
void f(string,double,int)
void f(int)
   void f  ( T  )
void procedure(int,double)
void f  (T, double,int)   
void f(string, T,T)
4
 int a
 int x
string  t
double  val  
5
f(t, a, a)
f(t,val,a)
f(val,a, val)
 solve300(val, val)
f  (x)
Output
1
3
0
0
2
----------------------------------------------------------------------------------------------------
E. Tractor College
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 11
3 4 3 5 5
Output
1 3 3
Input
6 15
5 3 3 4 4 5
Output
-1
----------------------------------------------------------------------------------------------------
