First pair with frequency sum over limit X57552


Statement
 

pdf   zip

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,55, 7, 6, 5, 8, 4, 5 are 12,13,11,13,12,912, 13, 11, 13, 12, 9. Note that pair sums 1212 and 1313 have frecuency two, and the first pair in the sequence achieving a frecuency sum greater than one is 5,85, 8. Write a program that given a limit kk and a sequence of integers computes the first pair of consecutive numbers achieving a frequency sum greater than kk. For instance, provided that kk is one and given the previous input sequence the first pair achieving a frequency sum greater than kk is 5,85, 8.

Input

Input consists of a nonnegative integer kk 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 kk. 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
    Language
    English
    Official solutions
    Python
    User solutions
    Python