Codeforces Round 215 (Div. 1)


A. Sereja and Algorithm
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
zyxxxxxxyyz
5
5 5
1 3
1 11
1 4
3 6
Output
YES
YES
NO
YES
NO
----------------------------------------------------------------------------------------------------
B. Sereja ans Anagrams
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3 1
1 2 3 2 1
1 2 3
Output
2
1 3
Input
6 3 2
1 3 2 2 3 1
1 2 3
Output
2
1 2
----------------------------------------------------------------------------------------------------
C. Sereja and the Arrangement of Numbers
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2
1 2
2 3
Output
5
Input
100 3
1 2
2 1
3 1
Output
4
Input
1 2
1 1
2 100
Output
100
----------------------------------------------------------------------------------------------------
D. Sereja and Sets
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2 2
1 2
2 1 3
Output
1
Input
5 1 1
5 4 5 3 2 1
Output
1
Input
7 3 1
4 1 3 5 7
2 2 6
1 4
Output
3
----------------------------------------------------------------------------------------------------
E. Sereja and Intervals
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 1
Output
1
Input
3 5 1
Output
240
Input
2 3 3
Output
6
----------------------------------------------------------------------------------------------------
