Menu

Hello Im Working Problem Homework Although Code Showing Fine Test Cases Shown Saying Faili Q43899536

Hello!

So im working on a problem for my homework and although my codeis showing as fine for all the test cases that are shown, itssaying that its failing one of the tests which i cant see. Illleave the problem down here as well as my code, and if you couldpoint out whats wrong with my code i would really appreciateit!

Mishka started participating in a programming contest. There arenn problems in the contest. Mishka’s problem-solving skill is equalto kk.

Mishka arranges all problems from the contest into a list.Because of his weird principles, Mishka only solves problems fromone of the ends of the list. Every time, he chooses which end (leftor right) he will solve the next problem from. Thus, each problemMishka solves is either the leftmost or the rightmost problem inthe list.

Mishka cannot solve a problem with difficulty greater than kk.When Mishka solves the problem, it disappears from the list, so thelength of the list decreases by 11. Mishka stops when he is unableto solve any problem from any end of the list.

How many problems can Mishka solve?

Input

The first line of input contains two integers nn and kk(1≤n,k≤1001≤n,k≤100) — the number of problems in the contest andMishka’s problem-solving skill.

The second line of input contains nn integersa1,a2,…,ana1,a2,…,an (1≤ai≤1001≤ai≤100), where aiai is thedifficulty of the ii-th problem. The problems are given in orderfrom the leftmost to the rightmost in the list.

Output

Print one integer — the maximum number of problems Mishka cansolve.

Examples

input

Copy

8 44 2 3 1 5 1 6 4

output

Copy

5

input

Copy

5 23 1 2 1 3

output

Copy

0

input

Copy

5 10012 34 55 43 21

output

Copy

5

Note

In the first example, Mishka can solve problems in the followingorder:[4,2,3,1,5,1,6,4]→[2,3,1,5,1,6,4]→[2,3,1,5,1,6]→[3,1,5,1,6]→[1,5,1,6]→[5,1,6][4,2,3,1,5,1,6,4]→[2,3,1,5,1,6,4]→[2,3,1,5,1,6]→[3,1,5,1,6]→[1,5,1,6]→[5,1,6],so the number of solved problems will be equal to 55.

In the second example, Mishka can’t solve any problem becausethe difficulties of problems from both ends are greater thankk.

In the third example, Mishka’s solving skill is so amazing thathe can solve all the problems.

****************************************************************MYCODE**********************************************************************************************************

n=list(map(int,input().split()))

ran=n[0]

skill=n[1]

lis=list(map(int,input().split()))

tracker=0

for i in range(ran):

   

   

    if len(lis)==1:

        ifskill>=lis[0]:

            tracker+=1

            print(tracker)

            exit()

        else:

            print(tracker)

            exit()

    if len(lis)>1:

        start=lis[0]

        end=lis[-1]

    

        ifstart<=skill:

            tracker+=1

            lis.remove(start)

    

    

        ifend<=skill:

            tracker+=1

            lis.remove(end)

            

print(tracker)

Expert Answer


Answer to Hello! So im working on a problem for my homework and although my code is showing as fine for all the test cases that ar…

OR