Codeforces Round 747 (Div. 2)


A. Consecutive Sum Riddle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
1
2
3
6
100
25
3000000000000
Output
0 1
-1 2 
1 2 
1 3 
18 22
-2 7
999999999999 1000000000001
----------------------------------------------------------------------------------------------------
B. Special Numbers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 4
2 12
105 564
Output
9
12
3595374
----------------------------------------------------------------------------------------------------
C. Make Them Equal
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4 a
aaaa
4 a
baaa
4 b
bzyx
Output
0
1
2
2 
2 3
----------------------------------------------------------------------------------------------------
D. The Number of Imposters
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3 2
1 2 imposter
2 3 crewmate
5 4
1 3 crewmate
2 5 crewmate
2 4 imposter
3 4 imposter
2 2
1 2 imposter
2 1 crewmate
3 5
1 2 imposter
1 2 imposter
3 2 crewmate
3 2 crewmate
1 3 imposter
5 0
Output
2
4
-1
2
5
----------------------------------------------------------------------------------------------------
E1. Rubik's Cube Coloring (easy version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
24576
Input
14
Output
934234
----------------------------------------------------------------------------------------------------
E2. Rubik's Cube Coloring (hard version)
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2
5 orange
2 white
Output
1024
Input
2
2
1 white
2 white
Output
0
Input
10
3
1 blue
4 red
5 orange
Output
328925088
----------------------------------------------------------------------------------------------------
F. Ideal Farm
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 1 1
1 1 2
100 50 200
56220 47258 14497
Output
YES
NO
NO
YES
----------------------------------------------------------------------------------------------------
