I am trying to find a data structure that takes in a particular value from a range of values and map it to a key.
For example, I have the following conditions:
This type of data structure is called an Interval Tree. (The Wikipedia page only presents the case where intervals may overlap, but one can imagine a case where you want to remove mappings for any overlapped intervals when you add a new interval. Do a Google search for implementations and see if any fit your needs.