```if:python 
Note: Python may currently have some performance issues. If you find them, please let me know and provide suggestions to improve the Python version! It's my weakest language... any help is much appreciated :)
```

Artlessly stolen and adapted from Hackerrank.

Kara Danvers is new to CodeWars, and eager to climb up in the ranks. We want to determine Kara's rank as she progresses up the leaderboard. 

This kata uses Dense Ranking, so any identical scores count as the same rank (e.g, a scoreboard of `[100, 97, 97, 90, 82, 80, 72, 72, 60]` corresponds with rankings of `[1, 2, 2, 3, 4, 5, 6, 6, 7]`

You are given an array, `scores`, of leaderboard scores, descending, and another array, `kara`, representing Kara's Codewars score over time, ascending. Your function should return an array with each item corresponding to the rank of Kara's current score on the leaderboard.

**Note:** This kata's performance requirements are significantly steeper than the Hackerrank version. Some arrays will contain millions of elements; optimize your code so you don't time out. If you're timing out before 200 tests are completed, you've likely got the wrong code complexity. If you're timing out around 274 tests (there are 278), you likely need to make some tweaks to how you're handling the arrays.

Examples:

(For the uninitiated, Kara Danvers is Supergirl. This is important, because Kara thinks and moves so fast that she can complete a kata within microseconds. Naturally, latency being what it is, she's already opened many kata across many, many tabs, and solves them one by one on a special keyboard so she doesn't have to wait hundreds of milliseconds in between solving them. As a result, the only person's rank changing on the leaderboard is Kara's, so we don't have to worry about shifting values of other codewarriors. Thanks, Supergirl.)

Good luck! Please upvote if you enjoyed it :)

Difficulty: introductory

Starter code:

def leaderboard_climb(arr, kara):
	

Solutions:
def leaderboard_climb(arr, kara):
    scores = sorted(set(arr), reverse=True)
    position = len(scores)
    ranks = []
    
    for checkpoint in kara:
        while position >= 1 and checkpoint >= scores[position - 1]:
            position -= 1
        ranks.append(position + 1)    
    
    return ranks

import numpy as np
def leaderboard_climb(arr, kara):
    a = np.unique(arr)
    return list(len(a) + 1 - np.searchsorted(a, kara, side='right'))

#Previously saved by accident before removing debug or refectoring.Doh!
import bisect
def leaderboard_climb(arr, kara):
    arr=sorted(list(set(arr)))
    return [(len(arr) + 1 -bisect.bisect_right(arr,score) ) for score in kara]

leaderboard_climb=lambda A,K:(lambda S:[len(S)-__import__('bisect').bisect(S,i)+1for i in K])(sorted(set(A)))

from bisect import bisect
def leaderboard_climb(arr, kara):
    scoreboard = sorted(set(arr))
    scores = len(scoreboard)
    return [scores - bisect(scoreboard, i) + 1 for i in kara] 
    


def leaderboard_climb(scores, kara):
    answer = []
    kara = kara[::-1]
    rank, iScore, lastScore = 1, 0, scores[0]
    l = len(scores)
    for karaScore in kara:
        while True:
            if karaScore >= lastScore or iScore >= l:
                answer.append(rank)
                break
            iScore += 1
            if iScore < l:
                score = scores[iScore]
                if lastScore != score:
                    lastScore = score
                    rank += 1
            else:
                rank += 1
    return answer[::-1]

import numpy as np

def leaderboard_climb(arr, kara):
    uniq_scores = np.unique(arr)
    l = len(uniq_scores) + 1
    t = l - np.searchsorted(uniq_scores, kara, side='right')
    return t.tolist()

from bisect import bisect_left

def leaderboard_climb(arr, kara):
    arr.append(float('inf'))
    arr = sorted([-a for a in set(arr)])
    result = [bisect_left(arr, -k) for k in kara]
    return result

from bisect import bisect_left

def leaderboard_climb(arr, kara):
    result = []
    arr.append(float('inf'))
    arr = sorted([-a for a in set(arr)])
    for k in kara:
        i = bisect_left(arr, -k)
        result.append(i)
    return result

def leaderboard_climb(arr, kara):
    arr = sorted(set(arr),reverse=True)
    rank = []
    pos = len(arr)
    
    for x in kara:
        while pos>=1 and x >= arr[pos-1]:
            pos -= 1
        rank.append(pos+1)
    return rank