Codeforces Round 309 (Div. 2)


A. Kyoya and Photobooks
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
a
Output
51
Input
hi
Output
76
----------------------------------------------------------------------------------------------------
B. Ohana Cleans Up
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0101
1000
1111
0101
Output
2
Input
3
111
111
111
Output
3
----------------------------------------------------------------------------------------------------
C. Kyoya and Colored Balls
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2
2
1
Output
3
Input
4
1
2
3
4
Output
1680
----------------------------------------------------------------------------------------------------
D. Kyoya and Permutation
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
Output
1 3 2 4
Input
10 1
Output
1 2 3 4 5 6 7 8 9 10
----------------------------------------------------------------------------------------------------
E. Love Triangles
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 0
Output
4
Input
4 4
1 2 1
2 3 1
3 4 0
4 1 0
Output
1
Input
4 4
1 2 1
2 3 1
3 4 0
4 1 1
Output
0
----------------------------------------------------------------------------------------------------
