Design a O(1) data structure
You can use the union of two different data structures to have an O(1) data structure (thinking in terms of # of operations):


You need random access to element K in constant time (get and set), a hash table is a good candidate for this.
You want constant time inserts and deletes at the front and back of the structure (add_front, remove_back, etc.). This is what a deque is good for (double-ended queue).


So you can use both structures at the same time, and you'll solve some operations using one or the other structure. The key part is how to keep them synchronized in constant time, and the answer to that is: you only insert/remove elements using the deque, so once you insert/remove an element in the deque (which is O(1)) you go and insert/remove from the hash table too (which is also O(1)).

Some considerations:


This solution uses O(n) memory, but that is not a restriction of the statement of the problem.
A hash table's insert isn't actually O(1), they call it "amortized constant time" because at times the hash table needs to resize its internal storage to accommodate for the new element, which takes O(n) time.
A hash table's get/set is not O(1) either, it depends on the hash function and your elements (worst case scenario all elements fall in the same bucket and you have O(n) search time).