First pair with frequency sum over limit X87305


Statement
 

pdf   zip

html

Given a sequence of integers we are interested in frequencies of the sums of consecutive number pairs. For instance, the sums of consecutive number pairs of the input sequence 5, 7, 6, 5, 8, 4, 5 are 12, 13, 11, 13, 12, 9. Note that pair sums 12 and 13 have frecuency two, and the first pair in the sequence achieving a frecuency sum greater than one is 5, 8. Write a program that given a limit k and a sequence of integers computes the first pair of consecutive numbers achieving a frequency sum greater than k. For instance, provided that k is one and given the previous input sequence the first pair achieving a frequency sum greater than k is 5, 8.

Input

Input consists of a nonnegative integer k followed by a sequence of two or more integers.

Output

The first pair of consecutive numbers in the input sequence achieving frequency sum greater than k. If there is no such a pair, the message not found must be printed.

Public test cases
  • Input

    1
    5 7 6 5 8 4 5
    
    

    Output

    5 8
    
  • Input

    2 
    5 7 6 5 8 4 5

    Output

    not found
    
  • Input

    2
    1 2 2 1 0 0 0 1 5 3 -3 -1 4

    Output

    3 -3
    
  • Information
    Author
    ProAl
    Language
    English
    Official solutions
    Python
    User solutions
    Python