#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1024
Task: Write a Python function that implements an LRU cache class with get and put methods
Generated: 2026-02-12T17:27:27.133275
"""

class LRU_Cache:
    def __init__(self, capacity):
        self.capacity = capacity
        self.cache = {}
        self.usage_order = []

    def get(self, key):
        if key in self.cache:
            # Move the accessed key to the end of the usage_order to mark it as recently used
            self.usage_order.remove(key)
            self.usage_order.append(key)
            return self.cache[key]
        else:
            return -1

    def put(self, key, value):
        if key in self.cache:
            # Update the value and move the key to the end of the usage_order
            self.cache[key] = value
            self.usage_order.remove(key)
            self.usage_order.append(key)
        else:
            if len(self.cache) >= self.capacity:
                # Remove the least recently used item (first in usage_order)
                lru_key = self.usage_order[0]
                del self.cache[lru_key]
                self.usage_order.pop(0)
            self.cache[key] = value
            self.usage_order.append(key)

    def print_cache(self):
        print("Current cache:", self.cache)


if __name__ == "__main__":
    # Example usage
    cache = LRU_Cache(3)
    cache.put(1, "a")
    cache.put(2, "b")
    cache.put(3, "c")
    cache.print_cache()
    print("Get key 1:", cache.get(1))
    cache.put(4, "d")  # Should evict key 2
    cache.print_cache()
    print("Get key 2:", cache.get(2))
    cache.put(5, "e")  # Should evict key 3
    cache.print_cache()