Kotlin Heroes: Practice 7


A. A+B (Trial Problem)
time limit per test: 2.0 s
memory limit per test: 512 MB
input: standard input
output: standard output

Examples
Input
4
1 5
314 15
-99 99
123 987
Output
6
329
0
1110
----------------------------------------------------------------------------------------------------
B. Frog Jumping
time limit per test: 2.0 s
memory limit per test: 512 MB
input: standard input
output: standard output

Examples
Input
6
5 2 3
100 1 4
1 10 5
1000000000 1 6
1 1 1000000000
1 1 999999999
Output
8
198
-17
2999999997
0
1
----------------------------------------------------------------------------------------------------
C. Uniform String
time limit per test: 2.0 s
memory limit per test: 512 MB
input: standard input
output: standard output

Examples
Input
3
7 3
4 4
6 2
Output
cbcacab
abcd
baabab
----------------------------------------------------------------------------------------------------
D. Teams Forming
time limit per test: 2.0 s
memory limit per test: 512 MB
input: standard input
output: standard output

Examples
Input
6
5 10 2 3 14 5
Output
5
Input
2
1 100
Output
99
----------------------------------------------------------------------------------------------------
E. Good Array
time limit per test: 2.0 s
memory limit per test: 512 MB
input: standard input
output: standard output

Examples
Input
5
2 5 1 2 2
Output
3
4 1 5
Input
4
8 3 5 2
Output
2
1 4 
Input
5
2 1 2 4 3
Output
0
----------------------------------------------------------------------------------------------------
F. Prefixes and Suffixes
time limit per test: 2.0 s
memory limit per test: 512 MB
input: standard input
output: standard output

Examples
Input
5
ba
a
abab
a
aba
baba
ab
aba
Output
SPPSPSPS
Input
3
a
aa
aa
a
Output
PPSS
Input
2
a
c
Output
PS
----------------------------------------------------------------------------------------------------
