Implement an LRU (Least Recently Used) cache supporting get and put. The standard variant uses a fixed item-count capacity: get(key) returns the value if present and marks it most recently used; put(key, value) inserts or updates, evicting the least recently used entry when capacity is exceeded. A weighted variant…