Codeforces Round 282 (Div. 2)


A. Digital Counter
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
89
Output
2
Input
00
Output
4
Input
73
Output
15
----------------------------------------------------------------------------------------------------
B. Modular Equations
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
21 5
Output
2
Input
9435152 272
Output
282
Input
10 10
Output
infinity
----------------------------------------------------------------------------------------------------
C. Treasure
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
(((#)((#)
Output
1
2
Input
()((#((#(#()
Output
2
2
1
Input
#
Output
-1
Input
(#)
Output
-1
----------------------------------------------------------------------------------------------------
D. Obsessive String
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
ababa
aba
Output
5
Input
welcometoroundtwohundredandeightytwo
d
Output
274201
Input
ddd
d
Output
12
----------------------------------------------------------------------------------------------------
E. Helping People
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 2
1 7 2 4 3
1 3 0.500
2 2 0.500
Output
8.000000000
Input
5 2
281 280 279 278 282
1 4 1.000
1 4 0.000
Output
282.000000000
Input
3 5
1 2 3
1 3 0.500
2 2 0.250
1 2 0.800
1 1 0.120
2 2 0.900
Output
4.465000000
----------------------------------------------------------------------------------------------------
