Response:
    uint256 private storedValue;
    address public owner;
    bool private locked;

    event ValueStored(uint256 indexed newValue, address indexed sender);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the contract owner");
        _;
    }

    modifier nonReentrant() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
        storedValue = 0;
    }

    /// @notice Stores a new value in the contract
    /// @param _value The value to be stored
    function store(uint256 _value) public onlyOwner nonReentrant {
        storedValue = _value;
        emit ValueStored(_value, msg.sender);
    }

    /// @notice Retrieves the currently stored value
    /// @return The stored uint256 value
    function retrieve() public view returns (uint256) {
        return storedValue;
    }
}

error: [WinError 2] The system cannot find the file specified


Response:
    uint256 private storedValue;
    address public owner;
    bool private locked;

    event ValueStored(uint256 indexed newValue, address indexed sender);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the contract owner");
        _;
    }

    modifier nonReentrant() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
        storedValue = 0;
    }

    /// @notice Stores a new value in the contract
    /// @param _value The value to be stored
    function store(uint256 _value) public onlyOwner nonReentrant {
        storedValue = _value;
        emit ValueStored(_value, msg.sender);
    }

    /// @notice Retrieves the currently stored value
    /// @return The stored uint256 value
    function retrieve() public view returns (uint256) {
        return storedValue;
    }
}


Response:
    uint256 private storedValue;
    address private immutable owner;

    event ValueStored(uint256 indexed newValue, address indexed sender);

    error Unauthorized();

    modifier onlyOwner() {
        if (msg.sender != owner) revert Unauthorized();
        _;
    }

    constructor() {
        owner = msg.sender;
        storedValue = 0;
    }

    /// @notice Stores a new value in the contract
    /// @param _value The uint256 value to be stored
    function store(uint256 _value) external {
        storedValue = _value;
        emit ValueStored(_value, msg.sender);
    }

    /// @notice Retrieves the currently stored value
    /// @return The current uint256 value
    function retrieve() external view returns (uint256) {
        return storedValue;
    }
}


Response:
    uint256 private count;
    bool private locked;

    event CounterIncremented(uint256 newValue);
    event CounterDecremented(uint256 newValue);

    modifier noReentrancy() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        count = 0;
        locked = false;
    }

    /// @notice Increases the counter by 1
    function increment() external noReentrancy {
        count += 1;
        emit CounterIncremented(count);
    }

    /// @notice Decreases the counter by 1
    /// @dev Reverts if the counter is 0 to prevent underflow
    function decrement() external noReentrancy {
        require(count > 0, "Counter: cannot decrement below zero");
        count -= 1;
        emit CounterDecremented(count);
    }

    /// @notice Returns the current counter value
    /// @return The current count
    function getCount() external view returns (uint256) {
        return count;
    }
}


Response:
    uint256 private count;
    bool private locked;

    event Incremented(uint256 newValue);
    event Decremented(uint256 newValue);

    modifier noReentrancy() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        count = 0;
        locked = false;
    }

    /// @notice Increases the counter by 1
    function increment() external noReentrancy {
        count += 1;
        emit Incremented(count);
    }

    /// @notice Decreases the counter by 1
    /// @dev Reverts if the counter is already 0
    function decrement() external noReentrancy {
        require(count > 0, "Counter: cannot decrement below zero");
        count -= 1;
        emit Decremented(count);
    }

    /// @notice Returns the current counter value
    /// @return The current count
    function getCount() external view returns (uint256) {
        return count;
    }
}


Response:
    uint256 private count;
    bool private locked;

    event Incremented(uint256 newValue);
    event Decremented(uint256 newValue);

    modifier noReentrancy() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        count = 0;
        locked = false;
    }

    /// @notice Increases the counter by 1
    function increment() external noReentrancy {
        count += 1;
        emit Incremented(count);
    }

    /// @notice Decreases the counter by 1
    /// @dev Reverts if the counter is 0 to prevent underflow
    function decrement() external noReentrancy {
        require(count > 0, "Counter: cannot decrement below 0");
        count -= 1;
        emit Decremented(count);
    }

    /// @notice Returns the current counter value
    /// @return The current count
    function getCount() external view returns (uint256) {
        return count;
    }
}


Response:
    /// @notice Event emitted when an addition is performed
    event Addition(uint256 a, uint256 b, uint256 result);
    /// @notice Event emitted when a subtraction is performed
    event Subtraction(uint256 a, uint256 b, uint256 result);
    /// @notice Event emitted when a multiplication is performed
    event Multiplication(uint256 a, uint256 b, uint256 result);
    /// @notice Event emitted when a division is performed
    event Division(uint256 a, uint256 b, uint256 result);

    /// @notice Adds two numbers
    /// @param a First number
    /// @param b Second number
    /// @return result The sum of a and b
    function add(uint256 a, uint256 b) external returns (uint256 result) {
        result = a + b;
        emit Addition(a, b, result);
    }

    /// @notice Subtracts b from a
    /// @param a Minuend
    /// @param b Subtrahend
    /// @return result The difference of a and b
    function subtract(uint256 a, uint256 b) external returns (uint256 result) {
        require(a >= b, "Calculator: subtraction result would be negative");
        result = a - b;
        emit Subtraction(a, b, result);
    }

    /// @notice Multiplies two numbers
    /// @param a First number
    /// @param b Second number
    /// @return result The product of a and b
    function multiply(uint256 a, uint256 b) external returns (uint256 result) {
        result = a * b;
        emit Multiplication(a, b, result);
    }

    /// @notice Divides a by b
    /// @param a Dividend
    /// @param b Divisor
    /// @return result The quotient of a and b
    function divide(uint256 a, uint256 b) external returns (uint256 result) {
        require(b != 0, "Calculator: division by zero");
        result = a / b;
        emit Division(a, b, result);
    }
}


Response:
    /// @notice Event emitted when an addition is performed
    event Addition(uint256 a, uint256 b, uint256 result);
    /// @notice Event emitted when a subtraction is performed
    event Subtraction(uint256 a, uint256 b, uint256 result);
    /// @notice Event emitted when a multiplication is performed
    event Multiplication(uint256 a, uint256 b, uint256 result);
    /// @notice Event emitted when a division is performed
    event Division(uint256 a, uint256 b, uint256 result);

    /// @notice Adds two numbers
    /// @param a First operand
    /// @param b Second operand
    /// @return result The sum of a and b
    function add(uint256 a, uint256 b) external returns (uint256 result) {
        result = a + b;
        emit Addition(a, b, result);
    }

    /// @notice Subtracts b from a
    /// @param a First operand
    /// @param b Second operand
    /// @return result The difference of a and b
    function subtract(uint256 a, uint256 b) external returns (uint256 result) {
        require(a >= b, "Calculator: subtraction underflow");
        result = a - b;
        emit Subtraction(a, b, result);
    }

    /// @notice Multiplies two numbers
    /// @param a First operand
    /// @param b Second operand
    /// @return result The product of a and b
    function multiply(uint256 a, uint256 b) external returns (uint256 result) {
        result = a * b;
        emit Multiplication(a, b, result);
    }

    /// @notice Divides a by b
    /// @param a First operand
    /// @param b Second operand
    /// @return result The quotient of a divided by b
    function divide(uint256 a, uint256 b) external returns (uint256 result) {
        require(b != 0, "Calculator: division by zero");
        result = a / b;
        emit Division(a, b, result);
    }
}


Response:
    /// @notice Event emitted when an addition is performed
    event Addition(uint256 a, uint256 b, uint256 result);

    /// @notice Event emitted when a subtraction is performed
    event Subtraction(uint256 a, uint256 b, uint256 result);

    /// @notice Event emitted when a multiplication is performed
    event Multiplication(uint256 a, uint256 b, uint256 result);

    /// @notice Event emitted when a division is performed
    event Division(uint256 a, uint256 b, uint256 result);

    /// @notice Adds two numbers
    /// @param a First operand
    /// @param b Second operand
    /// @return The sum of a and b
    function add(uint256 a, uint256 b) external returns (uint256) {
        uint256 result = a + b;
        emit Addition(a, b, result);
        return result;
    }

    /// @notice Subtracts b from a
    /// @param a First operand
    /// @param b Second operand
    /// @return The difference of a and b
    /// @dev Reverts if b > a to prevent underflow
    function subtract(uint256 a, uint256 b) external returns (uint256) {
        require(a >= b, "Calculator: subtraction result would be negative");
        uint256 result = a - b;
        emit Subtraction(a, b, result);
        return result;
    }

    /// @notice Multiplies two numbers
    /// @param a First operand
    /// @param b Second operand
    /// @return The product of a and b
    function multiply(uint256 a, uint256 b) external returns (uint256) {
        uint256 result = a * b;
        emit Multiplication(a, b, result);
        return result;
    }

    /// @notice Divides a by b
    /// @param a First operand
    /// @param b Second operand
    /// @return The quotient of a and b
    /// @dev Reverts if b is 0
    function divide(uint256 a, uint256 b) external returns (uint256) {
        require(b != 0, "Calculator: division by zero");
        uint256 result = a / b;
        emit Division(a, b, result);
        return result;
    }
}


Response:
    uint256[] private values;

    /// @notice Event emitted when a new value is added to the array
    event ValueAdded(uint256 value);

    /// @notice Appends a value to the array
    /// @param _value The value to be added
    function push(uint256 _value) external {
        values.push(_value);
        emit ValueAdded(_value);
    }

    /// @notice Returns the minimum value in the array
    /// @dev Reverts if the array is empty
    /// @return min The smallest value found
    function getMin() external view returns (uint256 min) {
        require(values.length > 0, "Array is empty");
        min = values[0];
        for (uint256 i = 1; i < values.length; i++) {
            if (values[i] < min) {
                min = values[i];
            }
        }
    }

    /// @notice Returns the maximum value in the array
    /// @dev Reverts if the array is empty
    /// @return max The largest value found
    function getMax() external view returns (uint256 max) {
        require(values.length > 0, "Array is empty");
        max = values[0];
        for (uint256 i = 1; i < values.length; i++) {
            if (values[i] > max) {
                max = values[i];
            }
        }
    }

    /// @notice Returns the number of elements in the array
    /// @return The length of the array
    function getLength() external view returns (uint256) {
        return values.length;
    }
}


Response:
    uint256[] private values;

    /// @notice Event emitted when a new value is added
    event ValueAdded(uint256 value);

    /// @notice Appends a value to the array
    /// @param _value The value to be added
    function push(uint256 _value) external {
        values.push(_value);
        emit ValueAdded(_value);
    }

    /// @notice Returns the minimum value in the array
    /// @return min The smallest value found
    function getMin() external view returns (uint256 min) {
        require(values.length > 0, "Array is empty");
        min = values[0];
        for (uint256 i = 1; i < values.length; i++) {
            if (values[i] < min) {
                min = values[i];
            }
        }
    }

    /// @notice Returns the maximum value in the array
    /// @return max The largest value found
    function getMax() external view returns (uint256 max) {
        require(values.length > 0, "Array is empty");
        max = values[0];
        for (uint256 i = 1; i < values.length; i++) {
            if (values[i] > max) {
                max = values[i];
            }
        }
    }

    /// @notice Returns the number of elements in the array
    /// @return length The total count of elements
    function getLength() external view returns (uint256 length) {
        return values.length;
    }
}


Response:
    uint256[] private values;

    /// @notice Event emitted when a new value is added to the array
    event ValueAdded(uint256 indexed value);

    /// @notice Appends a value to the array
    /// @param _value The value to be added
    function push(uint256 _value) external {
        values.push(_value);
        emit ValueAdded(_value);
    }

    /// @notice Returns the minimum value in the array
    /// @return min The smallest value found
    function getMin() external view returns (uint256 min) {
        require(values.length > 0, "Array is empty");
        min = values[0];
        for (uint256 i = 1; i < values.length; i++) {
            if (values[i] < min) {
                min = values[i];
            }
        }
    }

    /// @notice Returns the maximum value in the array
    /// @return max The largest value found
    function getMax() external view returns (uint256 max) {
        require(values.length > 0, "Array is empty");
        max = values[0];
        for (uint256 i = 1; i < values.length; i++) {
            if (values[i] > max) {
                max = values[i];
            }
        }
    }

    /// @notice Returns the number of elements in the array
    /// @return length The total count of elements
    function getLength() external view returns (uint256 length) {
        return values.length;
    }
}


Response:
    mapping(address => string) private _names;
    mapping(address => bool) private _registered;

    /// @notice Emitted when a new name is registered
    event Registered(address indexed user, string name);

    /// @notice Emitted when a registration is removed
    event Unregistered(address indexed user);

    /// @notice Registers the caller with a specific name
    /// @param _name The name to associate with the sender's address
    function register(string calldata _name) external {
        require(bytes(_name).length > 0, "Name cannot be empty");
        _names[msg.sender] = _name;
        _registered[msg.sender] = true;
        emit Registered(msg.sender, _name);
    }

    /// @notice Returns the name associated with an address
    /// @param _addr The address to query
    /// @return The registered name
    function getName(address _addr) external view returns (string memory) {
        return _names[_addr];
    }

    /// @notice Checks if an address is registered
    /// @param _addr The address to check
    /// @return True if registered, false otherwise
    function isRegistered(address _addr) external view returns (bool) {
        return _registered[_addr];
    }

    /// @notice Removes the registration for the caller
    function unregister() external {
        require(_registered[msg.sender], "Address not registered");
        delete _names[msg.sender];
        delete _registered[msg.sender];
        emit Unregistered(msg.sender);
    }
}


Response:
    mapping(address => string) private _names;
    mapping(address => bool) private _registered;

    /// @notice Emitted when a new name is registered
    event Registered(address indexed user, string name);

    /// @notice Emitted when a registration is removed
    event Unregistered(address indexed user);

    /// @notice Registers the caller with a specific name
    /// @param _name The name to associate with the sender's address
    function register(string calldata _name) external {
        require(bytes(_name).length > 0, "Name cannot be empty");
        _names[msg.sender] = _name;
        _registered[msg.sender] = true;
        emit Registered(msg.sender, _name);
    }

    /// @notice Retrieves the name associated with an address
    /// @param _addr The address to query
    /// @return The registered name or an empty string
    function getName(address _addr) external view returns (string memory) {
        return _names[_addr];
    }

    /// @notice Checks if an address is registered
    /// @param _addr The address to check
    /// @return True if registered, false otherwise
    function isRegistered(address _addr) external view returns (bool) {
        return _registered[_addr];
    }

    /// @notice Removes the registration for the caller
    function unregister() external {
        require(_registered[msg.sender], "Address not registered");
        delete _names[msg.sender];
        delete _registered[msg.sender];
        emit Unregistered(msg.sender);
    }
}


Response:
    mapping(address => string) private _names;
    mapping(address => bool) private _registered;

    event Registered(address indexed user, string name);
    event Unregistered(address indexed user);

    /// @notice Registers the caller with a specific name.
    /// @param _name The name to associate with the caller's address.
    function register(string calldata _name) external {
        require(bytes(_name).length > 0, "Name cannot be empty");
        _names[msg.sender] = _name;
        _registered[msg.sender] = true;
        emit Registered(msg.sender, _name);
    }

    /// @notice Retrieves the name associated with an address.
    /// @param _addr The address to query.
    /// @return The registered name or an empty string.
    function getName(address _addr) external view returns (string memory) {
        return _names[_addr];
    }

    /// @notice Checks if an address is registered.
    /// @param _addr The address to check.
    /// @return True if registered, false otherwise.
    function isRegistered(address _addr) external view returns (bool) {
        return _registered[_addr];
    }

    /// @notice Removes the registration for the caller.
    function unregister() external {
        require(_registered[msg.sender], "Address not registered");
        delete _names[msg.sender];
        delete _registered[msg.sender];
        emit Unregistered(msg.sender);
    }
}


Response:
    string private _name;
    string private _symbol;
    uint8 private _decimals;
    uint256 private _totalSupply;
    address private _owner;
    mapping(address => uint256) private _balances;

    event Transfer(address indexed from, address indexed to, uint256 value);

    modifier onlyOwner() {
        require(msg.sender == _owner, "BasicToken: caller is not the owner");
        _;
    }

    constructor(string memory name_, string memory symbol_, uint8 decimals_) {
        _name = name_;
        _symbol = symbol_;
        _decimals = decimals_;
        _owner = msg.sender;
    }

    function name() public view returns (string memory) {
        return _name;
    }

    function symbol() public view returns (string memory) {
        return _symbol;
    }

    function decimals() public view returns (uint8) {
        return _decimals;
    }

    function totalSupply() public view returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) public view returns (uint256) {
        return _balances[account];
    }

    function mint(address to, uint256 amount) public onlyOwner {
        require(to != address(0), "BasicToken: mint to the zero address");

        _totalSupply += amount;
        _balances[to] += amount;
        emit Transfer(address(0), to, amount);
    }

    function transfer(address to, uint256 amount) public returns (bool) {
        require(to != address(0), "BasicToken: transfer to the zero address");
        require(_balances[msg.sender] >= amount, "BasicToken: insufficient balance");

        _balances[msg.sender] -= amount;
        _balances[to] += amount;

        emit Transfer(msg.sender, to, amount);
        return true;
    }
}


Response:
    string private _name;
    string private _symbol;
    uint8 private _decimals;
    uint256 private _totalSupply;
    address private _owner;

    mapping(address => uint256) private _balances;

    event Transfer(address indexed from, address indexed to, uint256 value);

    modifier onlyOwner() {
        require(msg.sender == _owner, "BasicToken: caller is not the owner");
        _;
    }

    constructor(string memory name_, string memory symbol_, uint8 decimals_) {
        _name = name_;
        _symbol = symbol_;
        _decimals = decimals_;
        _owner = msg.sender;
    }

    function name() external view returns (string memory) {
        return _name;
    }

    function symbol() external view returns (string memory) {
        return _symbol;
    }

    function decimals() external view returns (uint8) {
        return _decimals;
    }

    function totalSupply() external view returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) external view returns (uint256) {
        return _balances[account];
    }

    function mint(address to, uint256 amount) external onlyOwner {
        require(to != address(0), "BasicToken: mint to the zero address");

        _totalSupply += amount;
        _balances[to] += amount;
        emit Transfer(address(0), to, amount);
    }

    function transfer(address to, uint256 amount) external returns (bool) {
        require(to != address(0), "BasicToken: transfer to the zero address");
        require(_balances[msg.sender] >= amount, "BasicToken: insufficient balance");

        _balances[msg.sender] -= amount;
        _balances[to] += amount;

        emit Transfer(msg.sender, to, amount);
        return true;
    }
}


Response:
    string private _name;
    string private _symbol;
    uint8 private _decimals;
    uint256 private _totalSupply;
    address private _owner;
    mapping(address => uint256) private _balances;

    event Transfer(address indexed from, address indexed to, uint256 value);

    modifier onlyOwner() {
        require(msg.sender == _owner, "BasicToken: caller is not the owner");
        _;
    }

    constructor(string memory name_, string memory symbol_, uint8 decimals_) {
        _name = name_;
        _symbol = symbol_;
        _decimals = decimals_;
        _owner = msg.sender;
    }

    function name() external view returns (string memory) {
        return _name;
    }

    function symbol() external view returns (string memory) {
        return _symbol;
    }

    function decimals() external view returns (uint8) {
        return _decimals;
    }

    function totalSupply() external view returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) external view returns (uint256) {
        return _balances[account];
    }

    function mint(address to, uint256 amount) external onlyOwner {
        require(to != address(0), "BasicToken: mint to the zero address");

        _totalSupply += amount;
        _balances[to] += amount;

        emit Transfer(address(0), to, amount);
    }

    function transfer(address to, uint256 amount) external returns (bool) {
        require(to != address(0), "BasicToken: transfer to the zero address");
        require(_balances[msg.sender] >= amount, "BasicToken: insufficient balance");

        _balances[msg.sender] -= amount;
        _balances[to] += amount;

        emit Transfer(msg.sender, to, amount);
        return true;
    }
}


Response:
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    error Unauthorized();
    error InvalidOwner();

    constructor() {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);
    }

    modifier onlyOwner() {
        if (msg.sender != _owner) revert Unauthorized();
        _;
    }

    /// @notice Returns the address of the current owner.
    function owner() public view returns (address) {
        return _owner;
    }

    /// @notice Transfers ownership of the contract to a new account (`newOwner`).
    /// @param newOwner The address to transfer ownership to.
    function transferOwnership(address newOwner) public onlyOwner {
        if (newOwner == address(0)) revert InvalidOwner();
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /// @notice Leaves the contract without owner. It will not be possible to call
    /// `onlyOwner` functions anymore.
    function renounceOwnership() public onlyOwner {
        address oldOwner = _owner;
        _owner = address(0);
        emit OwnershipTransferred(oldOwner, address(0));
    }
}


Response:
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /// @notice Sets the initial owner of the contract as the deployer.
    constructor() {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);
    }

    /// @notice Returns the address of the current owner.
    function owner() public view returns (address) {
        return _owner;
    }

    /// @notice Throws if called by any account other than the owner.
    modifier onlyOwner() {
        require(msg.sender == _owner, "Ownable: caller is not the owner");
        _;
    }

    /// @notice Transfers ownership of the contract to a new account (`newOwner`).
    /// @param newOwner The address to transfer ownership to.
    function transferOwnership(address newOwner) public onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /// @notice Leaves the contract without owner. It will not be possible to call
    /// `onlyOwner` functions anymore.
    function renounceOwnership() public onlyOwner {
        address oldOwner = _owner;
        _owner = address(0);
        emit OwnershipTransferred(oldOwner, address(0));
    }
}


Response:
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /// @notice Sets the initial owner of the contract as the deployer.
    constructor() {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);
    }

    /// @notice Returns the address of the current owner.
    function owner() public view returns (address) {
        return _owner;
    }

    /// @notice Throws if called by any account other than the owner.
    modifier onlyOwner() {
        require(msg.sender == _owner, "Ownable: caller is not the owner");
        _;
    }

    /// @notice Transfers ownership of the contract to a new account (`newOwner`).
    /// @param newOwner The address to transfer ownership to.
    function transferOwnership(address newOwner) public onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /// @notice Leaves the contract without owner. It will not be possible to call
    /// `onlyOwner` functions anymore.
    function renounceOwnership() public onlyOwner {
        address oldOwner = _owner;
        _owner = address(0);
        emit OwnershipTransferred(oldOwner, address(0));
    }
}


Response:
    address public owner;
    uint256 public maxWhitelistedAddresses;
    uint256 public numWhitelistedCount;

    mapping(address => bool) public whitelistedAddresses;

    event AddedToWhitelist(address indexed account);
    event RemovedFromWhitelist(address indexed account);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the contract owner");
        _;
    }

    constructor(uint256 _maxWhitelistedAddresses) {
        require(_maxWhitelistedAddresses > 0, "Max capacity must be greater than 0");
        owner = msg.sender;
        maxWhitelistedAddresses = _maxWhitelistedAddresses;
    }

    /// @notice Adds the caller to the whitelist
    function addToWhitelist() external {
        require(!whitelistedAddresses[msg.sender], "Address is already whitelisted");
        require(numWhitelistedCount < maxWhitelistedAddresses, "Whitelist is full");

        whitelistedAddresses[msg.sender] = true;
        numWhitelistedCount += 1;

        emit AddedToWhitelist(msg.sender);
    }

    /// @notice Removes an address from the whitelist
    /// @param _addr The address to remove
    function removeFromWhitelist(address _addr) external onlyOwner {
        require(whitelistedAddresses[_addr], "Address is not in the whitelist");

        whitelistedAddresses[_addr] = false;
        numWhitelistedCount -= 1;

        emit RemovedFromWhitelist(_addr);
    }

    /// @notice Checks if an address is whitelisted
    /// @param _addr The address to check
    function isWhitelisted(address _addr) external view returns (bool) {
        return whitelistedAddresses[_addr];
    }

    /// @notice Returns the current number of whitelisted addresses
    function getNumWhitelisted() external view returns (uint256) {
        return numWhitelistedCount;
    }

    /// @notice Returns the maximum capacity
    function maxWhitelisted() external view returns (uint256) {
        return maxWhitelistedAddresses;
    }
}


Response:
    address public owner;
    uint256 public maxWhitelistedAddresses;
    uint256 public numWhitelistedCount;

    mapping(address => bool) public whitelistedAddresses;

    event AddedToWhitelist(address indexed account);
    event RemovedFromWhitelist(address indexed account);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the contract owner");
        _;
    }

    constructor(uint256 _maxWhitelistedAddresses) {
        require(_maxWhitelistedAddresses > 0, "Max capacity must be greater than 0");
        owner = msg.sender;
        maxWhitelistedAddresses = _maxWhitelistedAddresses;
    }

    /// @notice Adds the caller to the whitelist
    function addToWhitelist() external {
        require(!whitelistedAddresses[msg.sender], "Address is already whitelisted");
        require(numWhitelistedCount < maxWhitelistedAddresses, "Whitelist capacity reached");

        whitelistedAddresses[msg.sender] = true;
        numWhitelistedCount += 1;

        emit AddedToWhitelist(msg.sender);
    }

    /// @notice Removes an address from the whitelist
    /// @param _addr The address to remove
    function removeFromWhitelist(address _addr) external onlyOwner {
        require(whitelistedAddresses[_addr], "Address is not in the whitelist");

        whitelistedAddresses[_addr] = false;
        numWhitelistedCount -= 1;

        emit RemovedFromWhitelist(_addr);
    }

    /// @notice Checks if an address is whitelisted
    function isWhitelisted(address _addr) external view returns (bool) {
        return whitelistedAddresses[_addr];
    }

    /// @notice Returns the current number of whitelisted addresses
    function getNumWhitelisted() external view returns (uint256) {
        return numWhitelistedCount;
    }

    /// @notice Returns the maximum capacity
    function maxWhitelisted() external view returns (uint256) {
        return maxWhitelistedAddresses;
    }
}


Response:
    address public owner;
    uint256 public maxWhitelistedAddresses;
    uint256 public numWhitelistedCount;

    mapping(address => bool) public whitelistedAddresses;

    event AddedToWhitelist(address indexed account);
    event RemovedFromWhitelist(address indexed account);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the contract owner");
        _;
    }

    constructor(uint256 _maxWhitelistedAddresses) {
        require(_maxWhitelistedAddresses > 0, "Max capacity must be greater than 0");
        owner = msg.sender;
        maxWhitelistedAddresses = _maxWhitelistedAddresses;
    }

    /// @notice Adds the caller to the whitelist
    function addToWhitelist() external {
        require(!whitelistedAddresses[msg.sender], "Address is already whitelisted");
        require(numWhitelistedCount < maxWhitelistedAddresses, "Whitelist is full");

        whitelistedAddresses[msg.sender] = true;
        numWhitelistedCount += 1;

        emit AddedToWhitelist(msg.sender);
    }

    /// @notice Removes an address from the whitelist
    /// @param _addr The address to be removed
    function removeFromWhitelist(address _addr) external onlyOwner {
        require(whitelistedAddresses[_addr], "Address is not in the whitelist");

        whitelistedAddresses[_addr] = false;
        numWhitelistedCount -= 1;

        emit RemovedFromWhitelist(_addr);
    }

    /// @notice Checks if an address is whitelisted
    /// @param _addr The address to check
    function isWhitelisted(address _addr) external view returns (bool) {
        return whitelistedAddresses[_addr];
    }

    /// @notice Returns the current number of whitelisted addresses
    function getNumWhitelisted() external view returns (uint256) {
        return numWhitelistedCount;
    }

    /// @notice Returns the maximum capacity of the whitelist
    function maxWhitelisted() external view returns (uint256) {
        return maxWhitelistedAddresses;
    }
}


Response:
    address private owner;
    bool private locked;

    struct LockInfo {
        uint256 amount;
        uint256 unlockTime;
    }

    mapping(address => LockInfo) private locks;

    event Deposit(address indexed sender, uint256 amount, uint256 unlockTime);
    event Withdrawal(address indexed sender, uint256 amount);

    modifier nonReentrant() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
    }

    /// @notice Locks ETH until the specified unlockTime
    /// @param unlockTime The timestamp when the funds can be withdrawn
    function deposit(uint256 unlockTime) external payable {
        require(msg.value > 0, "Amount must be greater than 0");
        require(unlockTime > block.timestamp, "Unlock time must be in the future");
        require(locks[msg.sender].amount == 0, "Existing lock found, withdraw first");

        locks[msg.sender] = LockInfo({
            amount: msg.value,
            unlockTime: unlockTime
        });

        emit Deposit(msg.sender, msg.value, unlockTime);
    }

    /// @notice Withdraws all locked ETH if the unlock time has passed
    function withdraw() external nonReentrant {
        LockInfo storage userLock = locks[msg.sender];

        require(userLock.amount > 0, "No locked funds");
        require(block.timestamp >= userLock.unlockTime, "Funds are still locked");

        uint256 amountToWithdraw = userLock.amount;

        userLock.amount = 0;
        userLock.unlockTime = 0;

        (bool success, ) = payable(msg.sender).call{value: amountToWithdraw}("");
        require(success, "Transfer failed");

        emit Withdrawal(msg.sender, amountToWithdraw);
    }

    /// @notice Returns the locked balance for a specific address
    /// @param _addr The address to query
    function getBalance(address _addr) external view returns (uint256) {
        return locks[_addr].amount;
    }

    /// @notice Returns the unlock time for a specific address
    /// @param _addr The address to query
    function getUnlockTime(address _addr) external view returns (uint256) {
        return locks[_addr].unlockTime;
    }
}


Response:
    address private owner;
    bool private locked;

    mapping(address => uint256) private balances;
    mapping(address => uint256) private unlockTimes;

    event Deposit(address indexed sender, uint256 amount, uint256 unlockTime);
    event Withdrawal(address indexed sender, uint256 amount);

    modifier nonReentrant() {
        require(!locked, "ReentrancyGuard: reentrant call");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
    }

    /// @notice Locks ETH until the specified unlock time.
    /// @param unlockTime The timestamp when the funds can be withdrawn.
    function deposit(uint256 unlockTime) external payable {
        require(msg.value > 0, "Amount must be greater than 0");
        require(unlockTime > block.timestamp, "Unlock time must be in the future");

        balances[msg.sender] += msg.value;
        unlockTimes[msg.sender] = unlockTime;

        emit Deposit(msg.sender, msg.value, unlockTime);
    }

    /// @notice Withdraws all locked ETH for the sender if the unlock time has passed.
    function withdraw() external nonReentrant {
        uint256 amount = balances[msg.sender];
        uint256 unlockTime = unlockTimes[msg.sender];

        require(amount > 0, "No funds to withdraw");
        require(block.timestamp >= unlockTime, "Funds are still locked");

        balances[msg.sender] = 0;
        unlockTimes[msg.sender] = 0;

        (bool success, ) = payable(msg.sender).call{value: amount}("");
        require(success, "Transfer failed");

        emit Withdrawal(msg.sender, amount);
    }

    /// @notice Returns the locked balance for a specific address.
    /// @param _addr The address to query.
    function getBalance(address _addr) external view returns (uint256) {
        return balances[_addr];
    }

    /// @notice Returns the unlock time for a specific address.
    /// @param _addr The address to query.
    function getUnlockTime(address _addr) external view returns (uint256) {
        return unlockTimes[_addr];
    }
}


Response:
    address private owner;
    bool private locked;

    mapping(address => uint256) private balances;
    mapping(address => uint256) private unlockTimes;

    event Deposit(address indexed sender, uint256 amount, uint256 unlockTime);
    event Withdrawal(address indexed sender, uint256 amount);

    modifier nonReentrant() {
        require(!locked, "ReentrancyGuard: reentrant call");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
    }

    /// @notice Locks ETH until the specified unlockTime
    /// @param unlockTime The timestamp when the funds can be withdrawn
    function deposit(uint256 unlockTime) external payable {
        require(msg.value > 0, "Amount must be greater than 0");
        require(unlockTime > block.timestamp, "Unlock time must be in the future");

        balances[msg.sender] += msg.value;
        unlockTimes[msg.sender] = unlockTime;

        emit Deposit(msg.sender, msg.value, unlockTime);
    }

    /// @notice Withdraws all locked ETH for the sender
    function withdraw() external nonReentrant {
        uint256 amount = balances[msg.sender];
        uint256 unlockTime = unlockTimes[msg.sender];

        require(amount > 0, "No funds to withdraw");
        require(block.timestamp >= unlockTime, "Funds are still locked");

        balances[msg.sender] = 0;
        unlockTimes[msg.sender] = 0;

        (bool success, ) = payable(msg.sender).call{value: amount}("");
        require(success, "Transfer failed");

        emit Withdrawal(msg.sender, amount);
    }

    /// @notice Returns the locked balance for a specific address
    /// @param _addr The address to query
    function getBalance(address _addr) external view returns (uint256) {
        return balances[_addr];
    }

    /// @notice Returns the unlock time for a specific address
    /// @param _addr The address to query
    function getUnlockTime(address _addr) external view returns (uint256) {
        return unlockTimes[_addr];
    }
}


Response:
    address public owner;

    struct Proposal {
        string description;
        uint256 voteCount;
    }

    Proposal[] private proposals;
    mapping(uint256 => mapping(address => bool)) private votes;
    bool private locked;

    event ProposalCreated(uint256 indexed proposalId, string description);
    event Voted(uint256 indexed proposalId, address indexed voter);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the contract owner");
        _;
    }

    modifier nonReentrant() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
    }

    /// @notice Creates a new proposal
    /// @param description The text description of the proposal
    /// @return proposalId The index of the created proposal
    function createProposal(string calldata description) external onlyOwner returns (uint256) {
        uint256 proposalId = proposals.length;
        proposals.push(Proposal({
            description: description,
            voteCount: 0
        }));
        emit ProposalCreated(proposalId, description);
        return proposalId;
    }

    /// @notice Casts a vote for a specific proposal
    /// @param proposalId The ID of the proposal to vote for
    function vote(uint256 proposalId) external nonReentrant {
        require(proposalId < proposals.length, "Invalid proposal ID");
        require(!votes[proposalId][msg.sender], "Already voted on this proposal");

        votes[proposalId][msg.sender] = true;
        proposals[proposalId].voteCount += 1;

        emit Voted(proposalId, msg.sender);
    }

    /// @notice Retrieves proposal details
    /// @param proposalId The ID of the proposal
    /// @return description The proposal description
    /// @return voteCount The current number of votes
    function getProposal(uint256 proposalId) external view returns (string memory, uint256) {
        require(proposalId < proposals.length, "Invalid proposal ID");
        Proposal storage p = proposals[proposalId];
        return (p.description, p.voteCount);
    }

    /// @notice Returns the total number of proposals created
    function getProposalCount() external view returns (uint256) {
        return proposals.length;
    }

    /// @notice Checks if an address has already voted on a proposal
    /// @param proposalId The ID of the proposal
    /// @param voter The address to check
    function hasVoted(uint256 proposalId, address voter) external view returns (bool) {
        require(proposalId < proposals.length, "Invalid proposal ID");
        return votes[proposalId][voter];
    }
}


Response:
    address public owner;

    struct Proposal {
        string description;
        uint256 voteCount;
    }

    Proposal[] private proposals;
    mapping(uint256 => mapping(address => bool)) private votes;
    bool private locked;

    event ProposalCreated(uint256 indexed proposalId, string description);
    event Voted(uint256 indexed proposalId, address indexed voter);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the contract owner");
        _;
    }

    modifier nonReentrant() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
    }

    /// @notice Creates a new proposal
    /// @param description The text description of the proposal
    /// @return proposalId The ID of the newly created proposal
    function createProposal(string calldata description) external onlyOwner returns (uint256) {
        uint256 proposalId = proposals.length;
        proposals.push(Proposal({
            description: description,
            voteCount: 0
        }));
        emit ProposalCreated(proposalId, description);
        return proposalId;
    }

    /// @notice Casts a vote for a specific proposal
    /// @param proposalId The ID of the proposal to vote for
    function vote(uint256 proposalId) external nonReentrant {
        require(proposalId < proposals.length, "Invalid proposal ID");
        require(!votes[proposalId][msg.sender], "Already voted on this proposal");

        votes[proposalId][msg.sender] = true;
        proposals[proposalId].voteCount += 1;

        emit Voted(proposalId, msg.sender);
    }

    /// @notice Retrieves proposal details
    /// @param proposalId The ID of the proposal
    /// @return description The proposal description
    /// @return voteCount The current number of votes
    function getProposal(uint256 proposalId) external view returns (string memory, uint256) {
        require(proposalId < proposals.length, "Invalid proposal ID");
        Proposal storage p = proposals[proposalId];
        return (p.description, p.voteCount);
    }

    /// @notice Returns the total number of proposals
    function getProposalCount() external view returns (uint256) {
        return proposals.length;
    }

    /// @notice Checks if an address has already voted on a proposal
    /// @param proposalId The ID of the proposal
    /// @param voter The address to check
    function hasVoted(uint256 proposalId, address voter) external view returns (bool) {
        require(proposalId < proposals.length, "Invalid proposal ID");
        return votes[proposalId][voter];
    }
}


Response:
    address public owner;

    struct Proposal {
        string description;
        uint256 voteCount;
    }

    Proposal[] private proposals;
    mapping(uint256 => mapping(address => bool)) private votes;
    bool private locked;

    event ProposalCreated(uint256 indexed proposalId, string description);
    event Voted(uint256 indexed proposalId, address indexed voter);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the contract owner");
        _;
    }

    modifier nonReentrant() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
    }

    /// @notice Creates a new proposal
    /// @param description The text description of the proposal
    /// @return proposalId The ID of the newly created proposal
    function createProposal(string calldata description) external onlyOwner returns (uint256) {
        uint256 proposalId = proposals.length;
        proposals.push(Proposal({
            description: description,
            voteCount: 0
        }));
        emit ProposalCreated(proposalId, description);
        return proposalId;
    }

    /// @notice Casts a vote for a specific proposal
    /// @param proposalId The ID of the proposal to vote for
    function vote(uint256 proposalId) external nonReentrant {
        require(proposalId < proposals.length, "Invalid proposal ID");
        require(!votes[proposalId][msg.sender], "Already voted on this proposal");

        votes[proposalId][msg.sender] = true;
        proposals[proposalId].voteCount += 1;

        emit Voted(proposalId, msg.sender);
    }

    /// @notice Retrieves details of a proposal
    /// @param proposalId The ID of the proposal
    /// @return description The proposal description
    /// @return voteCount The current number of votes
    function getProposal(uint256 proposalId) external view returns (string memory, uint256) {
        require(proposalId < proposals.length, "Invalid proposal ID");
        Proposal storage p = proposals[proposalId];
        return (p.description, p.voteCount);
    }

    /// @notice Returns the total number of proposals
    function getProposalCount() external view returns (uint256) {
        return proposals.length;
    }

    /// @notice Checks if an address has voted on a specific proposal
    /// @param proposalId The ID of the proposal
    /// @param voter The address to check
    function hasVoted(uint256 proposalId, address voter) external view returns (bool) {
        require(proposalId < proposals.length, "Invalid proposal ID");
        return votes[proposalId][voter];
    }
}


Response:
    address[] public owners;
    mapping(address => bool) public isOwner;
    uint256 public numConfirmationsRequired;

    struct Transaction {
        address to;
        uint256 value;
        bytes data;
        bool executed;
        uint256 numConfirmations;
    }

    Transaction[] public transactions;
    mapping(uint256 => mapping(address => bool)) public isConfirmed;

    event SubmitTransaction(address indexed owner, uint256 indexed txIndex, address indexed to, uint256 value, bytes data);
    event ConfirmTransaction(address indexed owner, uint256 indexed txIndex);
    event RevokeConfirmation(address indexed owner, uint256 indexed txIndex);
    event ExecuteTransaction(address indexed owner, uint256 indexed txIndex);

    modifier onlyOwner() {
        require(isOwner[msg.sender], "Not an owner");
        _;
    }

    modifier txExists(uint256 _txIndex) {
        require(_txIndex < transactions.length, "Transaction does not exist");
        _;
    }

    modifier notExecuted(uint256 _txIndex) {
        require(!transactions[_txIndex].executed, "Transaction already executed");
        _;
    }

    modifier notConfirmed(uint256 _txIndex) {
        require(!isConfirmed[_txIndex][msg.sender], "Transaction already confirmed");
        _;
    }

    constructor(address[] memory _owners, uint256 _numConfirmationsRequired) {
        require(_owners.length > 0, "Owners required");
        require(_numConfirmationsRequired > 0 && _numConfirmationsRequired <= _owners.length, "Invalid number of required confirmations");

        for (uint256 i = 0; i < _owners.length; i++) {
            address owner = _owners[i];
            require(owner != address(0), "Invalid owner");
            require(!isOwner[owner], "Owner not unique");

            isOwner[owner] = true;
            owners.push(owner);
        }

        numConfirmationsRequired = _numConfirmationsRequired;
    }

    receive() external payable {}

    function submitTransaction(address _to, uint256 _value, bytes calldata _data) external onlyOwner {
        uint256 txIndex = transactions.length;
        transactions.push(Transaction({
            to: _to,
            value: _value,
            data: _data,
            executed: false,
            numConfirmations: 0
        }));
        emit SubmitTransaction(msg.sender, txIndex, _to, _value, _data);
    }

    function confirmTransaction(uint256 _txIndex) external onlyOwner txExists(_txIndex) notExecuted(_txIndex) notConfirmed(_txIndex) {
        Transaction storage transaction = transactions[_txIndex];
        transaction.numConfirmations += 1;
        isConfirmed[_txIndex][msg.sender] = true;
        emit ConfirmTransaction(msg.sender, _txIndex);
    }

    function executeTransaction(uint256 _txIndex) external onlyOwner txExists(_txIndex) notExecuted(_txIndex) {
        Transaction storage transaction = transactions[_txIndex];
        require(transaction.numConfirmations >= numConfirmationsRequired, "Cannot execute: insufficient confirmations");

        transaction.executed = true;
        (bool success, ) = transaction.to.call{value: transaction.value}(transaction.data);
        require(success, "Transaction failed");

        emit ExecuteTransaction(msg.sender, _txIndex);
    }

    function revokeConfirmation(uint256 _txIndex) external onlyOwner txExists(_txIndex) notExecuted(_txIndex) {
        require(isConfirmed[_txIndex][msg.sender], "Transaction not confirmed");
        Transaction storage transaction = transactions[_txIndex];
        transaction.numConfirmations -= 1;
        isConfirmed[_txIndex][msg.sender] = false;
        emit RevokeConfirmation(msg.sender, _txIndex);
    }

    function getTransactionCount() external view returns (uint256) {
        return transactions.length;
    }

    function getTransaction(uint256 _txIndex) external view returns (address to, uint256 value, bytes memory data, bool executed, uint256 numConfirmations) {
        Transaction storage transaction = transactions[_txIndex];
        return (transaction.to, transaction.value, transaction.data, transaction.executed, transaction.numConfirmations);
    }

    function getOwners() external view returns (address[] memory) {
        return owners;
    }
}


Response:
    address[] public owners;
    mapping(address => bool) public isOwner;
    uint256 public numConfirmationsRequired;

    struct Transaction {
        address to;
        uint256 value;
        bytes data;
        bool executed;
        uint256 numConfirmations;
    }

    Transaction[] public transactions;
    mapping(uint256 => mapping(address => bool)) public isConfirmed;

    event SubmitTransaction(address indexed owner, uint256 indexed txIndex, address indexed to, uint256 value, bytes data);
    event ConfirmTransaction(address indexed owner, uint256 indexed txIndex);
    event RevokeConfirmation(address indexed owner, uint256 indexed txIndex);
    event ExecuteTransaction(address indexed owner, uint256 indexed txIndex);

    modifier onlyOwner() {
        require(isOwner[msg.sender], "Not an owner");
        _;
    }

    modifier txExists(uint256 _txIndex) {
        require(_txIndex < transactions.length, "Transaction does not exist");
        _;
    }

    modifier notExecuted(uint256 _txIndex) {
        require(!transactions[_txIndex].executed, "Transaction already executed");
        _;
    }

    modifier notConfirmed(uint256 _txIndex) {
        require(!isConfirmed[_txIndex][msg.sender], "Transaction already confirmed");
        _;
    }

    constructor(address[] memory _owners, uint256 _numConfirmationsRequired) {
        require(_owners.length > 0, "Owners required");
        require(_numConfirmationsRequired > 0 && _numConfirmationsRequired <= _owners.length, "Invalid number of required confirmations");

        for (uint256 i = 0; i < _owners.length; i++) {
            address owner = _owners[i];
            require(owner != address(0), "Invalid owner");
            require(!isOwner[owner], "Owner not unique");

            isOwner[owner] = true;
            owners.push(owner);
        }

        numConfirmationsRequired = _numConfirmationsRequired;
    }

    receive() external payable {}

    function submitTransaction(address _to, uint256 _value, bytes calldata _data) external onlyOwner {
        uint256 txIndex = transactions.length;
        transactions.push(Transaction({
            to: _to,
            value: _value,
            data: _data,
            executed: false,
            numConfirmations: 0
        }));
        emit SubmitTransaction(msg.sender, txIndex, _to, _value, _data);
    }

    function confirmTransaction(uint256 _txIndex) external onlyOwner txExists(_txIndex) notExecuted(_txIndex) notConfirmed(_txIndex) {
        Transaction storage transaction = transactions[_txIndex];
        transaction.numConfirmations += 1;
        isConfirmed[_txIndex][msg.sender] = true;
        emit ConfirmTransaction(msg.sender, _txIndex);
    }

    function executeTransaction(uint256 _txIndex) external onlyOwner txExists(_txIndex) notExecuted(_txIndex) {
        Transaction storage transaction = transactions[_txIndex];
        require(transaction.numConfirmations >= numConfirmationsRequired, "Cannot execute: insufficient confirmations");

        transaction.executed = true;
        (bool success, ) = transaction.to.call{value: transaction.value}(transaction.data);
        require(success, "Transaction failed");

        emit ExecuteTransaction(msg.sender, _txIndex);
    }

    function revokeConfirmation(uint256 _txIndex) external onlyOwner txExists(_txIndex) notExecuted(_txIndex) {
        require(isConfirmed[_txIndex][msg.sender], "Transaction not confirmed");
        Transaction storage transaction = transactions[_txIndex];
        transaction.numConfirmations -= 1;
        isConfirmed[_txIndex][msg.sender] = false;
        emit RevokeConfirmation(msg.sender, _txIndex);
    }

    function getTransactionCount() external view returns (uint256) {
        return transactions.length;
    }

    function getTransaction(uint256 _txIndex) external view returns (address to, uint256 value, bytes memory data, bool executed, uint256 numConfirmations) {
        Transaction storage transaction = transactions[_txIndex];
        return (transaction.to, transaction.value, transaction.data, transaction.executed, transaction.numConfirmations);
    }

    function getOwners() external view returns (address[] memory) {
        return owners;
    }
}


Response:
    address[] public owners;
    mapping(address => bool) public isOwner;
    uint256 public numConfirmationsRequired;

    struct Transaction {
        address to;
        uint256 value;
        bytes data;
        bool executed;
        uint256 numConfirmations;
    }

    Transaction[] public transactions;
    mapping(uint256 => mapping(address => bool)) public isConfirmed;

    event SubmitTransaction(address indexed owner, uint256 indexed txIndex, address indexed to, uint256 value, bytes data);
    event ConfirmTransaction(address indexed owner, uint256 indexed txIndex);
    event RevokeConfirmation(address indexed owner, uint256 indexed txIndex);
    event ExecuteTransaction(address indexed owner, uint256 indexed txIndex);

    modifier onlyOwner() {
        require(isOwner[msg.sender], "Not an owner");
        _;
    }

    modifier txExists(uint256 _txIndex) {
        require(_txIndex < transactions.length, "Transaction does not exist");
        _;
    }

    modifier notExecuted(uint256 _txIndex) {
        require(!transactions[_txIndex].executed, "Transaction already executed");
        _;
    }

    modifier notConfirmed(uint256 _txIndex) {
        require(!isConfirmed[_txIndex][msg.sender], "Transaction already confirmed");
        _;
    }

    constructor(address[] memory _owners, uint256 _numConfirmationsRequired) {
        require(_owners.length > 0, "Owners required");
        require(_numConfirmationsRequired > 0 && _numConfirmationsRequired <= _owners.length, "Invalid number of required confirmations");

        for (uint256 i = 0; i < _owners.length; i++) {
            address owner = _owners[i];
            require(owner != address(0), "Invalid owner");
            require(!isOwner[owner], "Owner not unique");

            isOwner[owner] = true;
            owners.push(owner);
        }

        numConfirmationsRequired = _numConfirmationsRequired;
    }

    receive() external payable {}

    function submitTransaction(address _to, uint256 _value, bytes calldata _data) external onlyOwner {
        uint256 txIndex = transactions.length;
        transactions.push(Transaction({
            to: _to,
            value: _value,
            data: _data,
            executed: false,
            numConfirmations: 0
        }));
        emit SubmitTransaction(msg.sender, txIndex, _to, _value, _data);
    }

    function confirmTransaction(uint256 _txIndex) external onlyOwner txExists(_txIndex) notExecuted(_txIndex) notConfirmed(_txIndex) {
        Transaction storage transaction = transactions[_txIndex];
        transaction.numConfirmations += 1;
        isConfirmed[_txIndex][msg.sender] = true;
        emit ConfirmTransaction(msg.sender, _txIndex);
    }

    function executeTransaction(uint256 _txIndex) external onlyOwner txExists(_txIndex) notExecuted(_txIndex) {
        Transaction storage transaction = transactions[_txIndex];
        require(transaction.numConfirmations >= numConfirmationsRequired, "Cannot execute: insufficient confirmations");

        transaction.executed = true;
        (bool success, ) = transaction.to.call{value: transaction.value}(transaction.data);
        require(success, "Transaction failed");

        emit ExecuteTransaction(msg.sender, _txIndex);
    }

    function revokeConfirmation(uint256 _txIndex) external onlyOwner txExists(_txIndex) notExecuted(_txIndex) {
        require(isConfirmed[_txIndex][msg.sender], "Transaction not confirmed");
        Transaction storage transaction = transactions[_txIndex];
        transaction.numConfirmations -= 1;
        isConfirmed[_txIndex][msg.sender] = false;
        emit RevokeConfirmation(msg.sender, _txIndex);
    }

    function getTransactionCount() external view returns (uint256) {
        return transactions.length;
    }

    function getTransaction(uint256 _txIndex) external view returns (address to, uint256 value, bytes memory data, bool executed, uint256 numConfirmations) {
        Transaction storage transaction = transactions[_txIndex];
        return (transaction.to, transaction.value, transaction.data, transaction.executed, transaction.numConfirmations);
    }

    function getOwners() external view returns (address[] memory) {
        return owners;
    }
}


Response:
    address private immutable _beneficiary;
    uint256 private immutable _start;
    uint256 private immutable _duration;
    uint256 private _released;
    bool private _locked;

    event TokensReleased(uint256 amount);

    modifier onlyBeneficiary() {
        require(msg.sender == _beneficiary, "Not the beneficiary");
        _;
    }

    modifier nonReentrant() {
        require(!_locked, "Reentrancy guard");
        _locked = true;
        _;
        _locked = false;
    }

    constructor(address beneficiary_, uint256 startTime_, uint256 duration_) {
        require(beneficiary_ != address(0), "Beneficiary is zero address");
        require(duration_ > 0, "Duration must be greater than 0");
        _beneficiary = beneficiary_;
        _start = startTime_;
        _duration = duration_;
    }

    receive() external payable {}

    function beneficiary() external view returns (address) {
        return _beneficiary;
    }

    function start() external view returns (uint256) {
        return _start;
    }

    function duration() external view returns (uint256) {
        return _duration;
    }

    function released() external view returns (uint256) {
        return _released;
    }

    function vestedAmount(uint256 timestamp) public view returns (uint256) {
        uint256 totalBalance = address(this).balance + _released;

        if (timestamp < _start) {
            return 0;
        } else if (timestamp >= _start + _duration) {
            return totalBalance;
        } else {
            return (totalBalance * (timestamp - _start)) / _duration;
        }
    }

    function releasable() public view returns (uint256) {
        return vestedAmount(block.timestamp) - _released;
    }

    function release() external onlyBeneficiary nonReentrant {
        uint256 amount = releasable();
        require(amount > 0, "No tokens to release");

        _released += amount;
        emit TokensReleased(amount);

        (bool success, ) = payable(_beneficiary).call{value: amount}("");
        require(success, "Transfer failed");
    }
}


Response:
    address private immutable _beneficiary;
    uint256 private immutable _start;
    uint256 private immutable _duration;
    uint256 private _released;
    bool private _locked;

    event TokensReleased(uint256 amount);

    modifier onlyBeneficiary() {
        require(msg.sender == _beneficiary, "Not authorized");
        _;
    }

    modifier nonReentrant() {
        require(!_locked, "Reentrancy detected");
        _locked = true;
        _;
        _locked = false;
    }

    constructor(address beneficiary_, uint256 startTime_, uint256 duration_) {
        require(beneficiary_ != address(0), "Invalid beneficiary");
        require(duration_ > 0, "Duration must be > 0");
        _beneficiary = beneficiary_;
        _start = startTime_;
        _duration = duration_;
    }

    receive() external payable {}

    function beneficiary() external view returns (address) {
        return _beneficiary;
    }

    function start() external view returns (uint256) {
        return _start;
    }

    function duration() external view returns (uint256) {
        return _duration;
    }

    function released() external view returns (uint256) {
        return _released;
    }

    function releasable() public view returns (uint256) {
        return vestedAmount(block.timestamp) - _released;
    }

    function release() external onlyBeneficiary nonReentrant {
        uint256 amount = releasable();
        require(amount > 0, "Nothing to release");

        _released += amount;
        (bool success, ) = payable(_beneficiary).call{value: amount}("");
        require(success, "Transfer failed");

        emit TokensReleased(amount);
    }

    function vestedAmount(uint256 timestamp) public view returns (uint256) {
        uint256 totalBalance = address(this).balance + _released;

        if (timestamp < _start) {
            return 0;
        } else if (timestamp >= _start + _duration) {
            return totalBalance;
        } else {
            return (totalBalance * (timestamp - _start)) / _duration;
        }
    }
}


Response:
    address private immutable _beneficiary;
    uint256 private immutable _start;
    uint256 private immutable _duration;
    uint256 private _released;

    event TokensReleased(uint256 amount);

    modifier onlyBeneficiary() {
        require(msg.sender == _beneficiary, "Not the beneficiary");
        _;
    }

    constructor(address beneficiary_, uint256 startTime_, uint256 duration_) {
        require(beneficiary_ != address(0), "Beneficiary is zero address");
        require(duration_ > 0, "Duration must be greater than 0");
        _beneficiary = beneficiary_;
        _start = startTime_;
        _duration = duration_;
    }

    receive() external payable {}

    function beneficiary() external view returns (address) {
        return _beneficiary;
    }

    function start() external view returns (uint256) {
        return _start;
    }

    function duration() external view returns (uint256) {
        return _duration;
    }

    function released() external view returns (uint256) {
        return _released;
    }

    function vestedAmount(uint256 timestamp) public view returns (uint256) {
        if (timestamp < _start) {
            return 0;
        } else if (timestamp >= _start + _duration) {
            return address(this).balance + _released;
        } else {
            return ((address(this).balance + _released) * (timestamp - _start)) / _duration;
        }
    }

    function releasable() public view returns (uint256) {
        return vestedAmount(block.timestamp) - _released;
    }

    function release() external onlyBeneficiary {
        uint256 amount = releasable();
        require(amount > 0, "No tokens to release");

        _released += amount;
        emit TokensReleased(amount);

        (bool success, ) = payable(_beneficiary).call{value: amount}("");
        require(success, "Transfer failed");
    }
}


Response:
    address public seller;
    uint256 public endAt;
    bool public ended;

    address public highestBidder;
    uint256 public highestBid;

    mapping(address => uint256) public pendingReturns;

    event BidPlaced(address indexed bidder, uint256 amount);
    event AuctionEnded(address indexed winner, uint256 amount);

    modifier onlyOwner() {
        require(msg.sender == seller, "Not the seller");
        _;
    }

    constructor(uint256 startingBid, uint256 auctionDuration) {
        seller = msg.sender;
        highestBid = startingBid;
        endAt = block.timestamp + auctionDuration;
    }

    /// @notice Place a bid in the auction
    function bid() external payable {
        require(block.timestamp < endAt, "Auction expired");
        require(msg.value > highestBid, "Bid too low");

        if (highestBidder != address(0)) {
            pendingReturns[highestBidder] += highestBid;
        }

        highestBidder = msg.sender;
        highestBid = msg.value;

        emit BidPlaced(msg.sender, msg.value);
    }

    /// @notice Withdraw overbid funds
    function withdraw() external returns (bool) {
        uint256 amount = pendingReturns[msg.sender];
        if (amount > 0) {
            pendingReturns[msg.sender] = 0;
            (bool success, ) = payable(msg.sender).call{value: amount}("");
            require(success, "Transfer failed");
            return true;
        }
        return false;
    }

    /// @notice End the auction and transfer funds to seller
    function end() external onlyOwner {
        require(block.timestamp >= endAt, "Auction not yet ended");
        require(!ended, "Auction already ended");

        ended = true;

        (bool success, ) = payable(seller).call{value: highestBid}("");
        require(success, "Transfer to seller failed");

        emit AuctionEnded(highestBidder, highestBid);
    }

    function getSeller() external view returns (address) { return seller; }
    function getHighestBidder() external view returns (address) { return highestBidder; }
    function getHighestBid() external view returns (uint256) { return highestBid; }
    function getEnded() external view returns (bool) { return ended; }
    function getEndAt() external view returns (uint256) { return endAt; }
}


Response:
    address public seller;
    uint256 public endAt;
    bool public ended;

    address public highestBidder;
    uint256 public highestBid;

    mapping(address => uint256) public pendingReturns;

    event BidPlaced(address indexed bidder, uint256 amount);
    event AuctionEnded(address indexed winner, uint256 amount);

    modifier onlyOwner() {
        require(msg.sender == seller, "Not the seller");
        _;
    }

    constructor(uint256 _startingBid, uint256 _auctionDuration) {
        seller = msg.sender;
        highestBid = _startingBid;
        endAt = block.timestamp + _auctionDuration;
    }

    function bid() external payable {
        require(block.timestamp < endAt, "Auction expired");
        require(msg.value > highestBid, "Bid too low");

        if (highestBidder != address(0)) {
            pendingReturns[highestBidder] += highestBid;
        }

        highestBidder = msg.sender;
        highestBid = msg.value;

        emit BidPlaced(msg.sender, msg.value);
    }

    function withdraw() external returns (bool) {
        uint256 amount = pendingReturns[msg.sender];
        if (amount > 0) {
            pendingReturns[msg.sender] = 0;
            (bool success, ) = payable(msg.sender).call{value: amount}("");
            require(success, "Transfer failed");
        }
        return true;
    }

    function end() external onlyOwner {
        require(block.timestamp >= endAt, "Auction not yet ended");
        require(!ended, "Auction already ended");

        ended = true;
        emit AuctionEnded(highestBidder, highestBid);

        (bool success, ) = payable(seller).call{value: highestBid}("");
        require(success, "Transfer to seller failed");
    }

    function getSeller() external view returns (address) { return seller; }
    function getHighestBidder() external view returns (address) { return highestBidder; }
    function getHighestBid() external view returns (uint256) { return highestBid; }
    function getEnded() external view returns (bool) { return ended; }
    function getEndAt() external view returns (uint256) { return endAt; }
}


Response:
    address public seller;
    uint256 public endAt;
    bool public ended;

    address public highestBidder;
    uint256 public highestBid;

    mapping(address => uint256) public pendingReturns;

    event BidPlaced(address indexed bidder, uint256 amount);
    event AuctionEnded(address indexed winner, uint256 amount);

    modifier onlySeller() {
        require(msg.sender == seller, "Not the seller");
        _;
    }

    constructor(uint256 _startingBid, uint256 _auctionDuration) {
        seller = msg.sender;
        highestBid = _startingBid;
        endAt = block.timestamp + _auctionDuration;
    }

    function bid() external payable {
        require(block.timestamp < endAt, "Auction already ended");
        require(msg.value > highestBid, "Bid too low");

        if (highestBidder != address(0)) {
            pendingReturns[highestBidder] += highestBid;
        }

        highestBidder = msg.sender;
        highestBid = msg.value;

        emit BidPlaced(msg.sender, msg.value);
    }

    function withdraw() external returns (bool) {
        uint256 amount = pendingReturns[msg.sender];
        if (amount > 0) {
            pendingReturns[msg.sender] = 0;
            (bool success, ) = payable(msg.sender).call{value: amount}("");
            require(success, "Transfer failed");
        }
        return true;
    }

    function end() external onlySeller {
        require(block.timestamp >= endAt, "Auction not yet ended");
        require(!ended, "Auction already ended");

        ended = true;
        emit AuctionEnded(highestBidder, highestBid);

        (bool success, ) = payable(seller).call{value: highestBid}("");
        require(success, "Transfer to seller failed");
    }
}


Response:
    address public owner;
    uint256 public rewardPool;
    bool private locked;

    struct StakeInfo {
        uint256 amount;
        uint256 lastUpdateTime;
        uint256 pendingRewards;
    }

    mapping(address => StakeInfo) public stakes;

    event Staked(address indexed user, uint256 amount);
    event Unstaked(address indexed user, uint256 amount);
    event RewardsClaimed(address indexed user, uint256 amount);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the owner");
        _;
    }

    modifier nonReentrant() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
    }

    function _calculateRewards(address _addr) internal view returns (uint256) {
        StakeInfo storage s = stakes[_addr];
        if (s.amount == 0) return 0;
        uint256 timeElapsed = block.timestamp - s.lastUpdateTime;
        return s.pendingRewards + (s.amount * timeElapsed);
    }

    function stake() external payable {
        require(msg.value > 0, "Cannot stake 0");

        _updateRewards(msg.sender);
        stakes[msg.sender].amount += msg.value;

        emit Staked(msg.sender, msg.value);
    }

    function unstake(uint256 amount) external nonReentrant {
        require(amount > 0, "Amount must be > 0");
        require(stakes[msg.sender].amount >= amount, "Insufficient stake");

        _updateRewards(msg.sender);
        stakes[msg.sender].amount -= amount;

        (bool success, ) = payable(msg.sender).call{value: amount}("");
        require(success, "Transfer failed");

        emit Unstaked(msg.sender, amount);
    }

    function claimRewards() external nonReentrant {
        _updateRewards(msg.sender);
        uint256 reward = stakes[msg.sender].pendingRewards;
        require(reward > 0, "No rewards to claim");
        require(rewardPool >= reward, "Insufficient reward pool");

        stakes[msg.sender].pendingRewards = 0;
        rewardPool -= reward;

        (bool success, ) = payable(msg.sender).call{value: reward}("");
        require(success, "Transfer failed");

        emit RewardsClaimed(msg.sender, reward);
    }

    function _updateRewards(address _addr) internal {
        stakes[_addr].pendingRewards = _calculateRewards(_addr);
        stakes[_addr].lastUpdateTime = block.timestamp;
    }

    function fundRewards() external payable onlyOwner {
        rewardPool += msg.value;
    }

    function getStake(address _addr) external view returns (uint256) {
        return stakes[_addr].amount;
    }

    function getRewards(address _addr) external view returns (uint256) {
        return _calculateRewards(_addr);
    }
}


Response:
    address public owner;
    uint256 public rewardPool;
    bool private locked;

    struct User {
        uint256 stakedAmount;
        uint256 lastUpdateTime;
        uint256 pendingRewards;
    }

    mapping(address => User) public users;

    event Staked(address indexed user, uint256 amount);
    event Unstaked(address indexed user, uint256 amount);
    event RewardsClaimed(address indexed user, uint256 amount);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the owner");
        _;
    }

    modifier nonReentrant() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
    }

    function _calculateRewards(address _addr) internal view returns (uint256) {
        User storage user = users[_addr];
        if (user.stakedAmount == 0) return 0;
        uint256 timeElapsed = block.timestamp - user.lastUpdateTime;
        return user.stakedAmount * timeElapsed;
    }

    function _updateRewards(address _addr) internal {
        users[_addr].pendingRewards += _calculateRewards(_addr);
        users[_addr].lastUpdateTime = block.timestamp;
    }

    function stake() external payable {
        require(msg.value > 0, "Cannot stake 0");
        _updateRewards(msg.sender);
        users[msg.sender].stakedAmount += msg.value;
        emit Staked(msg.sender, msg.value);
    }

    function unstake(uint256 amount) external nonReentrant {
        require(amount > 0, "Amount must be > 0");
        require(users[msg.sender].stakedAmount >= amount, "Insufficient stake");

        _updateRewards(msg.sender);
        users[msg.sender].stakedAmount -= amount;

        (bool success, ) = payable(msg.sender).call{value: amount}("");
        require(success, "Transfer failed");

        emit Unstaked(msg.sender, amount);
    }

    function claimRewards() external nonReentrant {
        _updateRewards(msg.sender);
        uint256 reward = users[msg.sender].pendingRewards;
        require(reward > 0, "No rewards to claim");
        require(rewardPool >= reward, "Insufficient reward pool");

        users[msg.sender].pendingRewards = 0;
        rewardPool -= reward;

        (bool success, ) = payable(msg.sender).call{value: reward}("");
        require(success, "Reward transfer failed");

        emit RewardsClaimed(msg.sender, reward);
    }

    function fundRewards() external payable onlyOwner {
        rewardPool += msg.value;
    }

    function getStake(address _addr) external view returns (uint256) {
        return users[_addr].stakedAmount;
    }

    function getRewards(address _addr) external view returns (uint256) {
        return users[_addr].pendingRewards + _calculateRewards(_addr);
    }
}


Response:
    address public owner;
    uint256 public rewardPool;
    bool private locked;

    struct StakeInfo {
        uint256 amount;
        uint256 lastUpdateTime;
        uint256 pendingRewards;
    }

    mapping(address => StakeInfo) public stakes;

    event Staked(address indexed user, uint256 amount);
    event Unstaked(address indexed user, uint256 amount);
    event RewardsClaimed(address indexed user, uint256 amount);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the owner");
        _;
    }

    modifier nonReentrant() {
        require(!locked, "Reentrancy detected");
        locked = true;
        _;
        locked = false;
    }

    constructor() {
        owner = msg.sender;
    }

    function _calculateRewards(address _addr) internal view returns (uint256) {
        StakeInfo storage s = stakes[_addr];
        if (s.amount == 0) return 0;
        uint256 timeElapsed = block.timestamp - s.lastUpdateTime;
        return s.pendingRewards + (s.amount * timeElapsed);
    }

    function stake() external payable {
        require(msg.value > 0, "Cannot stake 0");

        _updateRewards(msg.sender);
        stakes[msg.sender].amount += msg.value;

        emit Staked(msg.sender, msg.value);
    }

    function unstake(uint256 amount) external nonReentrant {
        require(amount > 0, "Amount must be > 0");
        require(stakes[msg.sender].amount >= amount, "Insufficient stake");

        _updateRewards(msg.sender);
        stakes[msg.sender].amount -= amount;

        (bool success, ) = payable(msg.sender).call{value: amount}("");
        require(success, "Transfer failed");

        emit Unstaked(msg.sender, amount);
    }

    function claimRewards() external nonReentrant {
        _updateRewards(msg.sender);
        uint256 reward = stakes[msg.sender].pendingRewards;
        require(reward > 0, "No rewards to claim");
        require(rewardPool >= reward, "Insufficient reward pool");

        stakes[msg.sender].pendingRewards = 0;
        rewardPool -= reward;

        (bool success, ) = payable(msg.sender).call{value: reward}("");
        require(success, "Reward transfer failed");

        emit RewardsClaimed(msg.sender, reward);
    }

    function _updateRewards(address _addr) internal {
        stakes[_addr].pendingRewards = _calculateRewards(_addr);
        stakes[_addr].lastUpdateTime = block.timestamp;
    }

    function fundRewards() external payable onlyOwner {
        rewardPool += msg.value;
    }

    function getStake(address _addr) external view returns (uint256) {
        return stakes[_addr].amount;
    }

    function getRewards(address _addr) external view returns (uint256) {
        return _calculateRewards(_addr);
    }
}


Response:
    address public immutable tokenA;
    address public immutable tokenB;

    uint256 public reserveA;
    uint256 public reserveB;
    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    bool private locked;

    event LiquidityAdded(address indexed provider, uint256 amountA, uint256 amountB, uint256 shares);
    event LiquidityRemoved(address indexed provider, uint256 amountA, uint256 amountB, uint256 shares);
    event Swap(address indexed user, address tokenIn, uint256 amountIn, uint256 amountOut);

    modifier nonReentrant() {
        require(!locked, "ReentrancyGuard: reentrant call");
        locked = true;
        _;
        locked = false;
    }

    constructor(address _tokenA, address _tokenB) {
        require(_tokenA != address(0) && _tokenB != address(0), "Invalid token address");
        require(_tokenA != _tokenB, "Tokens must be different");
        tokenA = _tokenA;
        tokenB = _tokenB;
    }

    function _sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }

    function getReserves() external view returns (uint256, uint256) {
        return (reserveA, reserveB);
    }

    function addLiquidity(uint256 amountA, uint256 amountB) external nonReentrant returns (uint256 shares) {
        IERC20(tokenA).transferFrom(msg.sender, address(this), amountA);
        IERC20(tokenB).transferFrom(msg.sender, address(this), amountB);

        if (totalSupply == 0) {
            shares = _sqrt(amountA * amountB);
        } else {
            uint256 sharesA = (amountA * totalSupply) / reserveA;
            uint256 sharesB = (amountB * totalSupply) / reserveB;
            shares = sharesA < sharesB ? sharesA : sharesB;
            require(shares > 0, "Insufficient liquidity minted");
        }

        balanceOf[msg.sender] += shares;
        totalSupply += shares;
        reserveA += amountA;
        reserveB += amountB;

        emit LiquidityAdded(msg.sender, amountA, amountB, shares);
    }

    function removeLiquidity(uint256 shares) external nonReentrant returns (uint256 amountA, uint256 amountB) {
        require(shares <= balanceOf[msg.sender], "Insufficient shares");

        amountA = (shares * reserveA) / totalSupply;
        amountB = (shares * reserveB) / totalSupply;

        balanceOf[msg.sender] -= shares;
        totalSupply -= shares;
        reserveA -= amountA;
        reserveB -= amountB;

        IERC20(tokenA).transfer(msg.sender, amountA);
        IERC20(tokenB).transfer(msg.sender, amountB);

        emit LiquidityRemoved(msg.sender, amountA, amountB, shares);
    }

    function swap(address tokenIn, uint256 amountIn) external nonReentrant returns (uint256 amountOut) {
        require(tokenIn == tokenA || tokenIn == tokenB, "Invalid token");
        require(amountIn > 0, "Amount must be > 0");

        bool isA = tokenIn == tokenA;
        (uint256 resIn, uint256 resOut) = isA ? (reserveA, reserveB) : (reserveB, reserveA);
        address tokenOut = isA ? tokenB : tokenA;

        IERC20(tokenIn).transferFrom(msg.sender, address(this), amountIn);

        uint256 amountInWithFee = (amountIn * 997) / 1000;
        amountOut = (resOut * amountInWithFee) / (resIn + amountInWithFee);

        if (isA) {
            reserveA += amountIn;
            reserveB -= amountOut;
        } else {
            reserveB += amountIn;
            reserveA -= amountOut;
        }

        IERC20(tokenOut).transfer(msg.sender, amountOut);

        emit Swap(msg.sender, tokenIn, amountIn, amountOut);
    }
}


Response:
    address public immutable tokenA;
    address public immutable tokenB;

    uint256 public reserveA;
    uint256 public reserveB;
    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    bool private locked;

    event LiquidityAdded(address indexed provider, uint256 amountA, uint256 amountB, uint256 shares);
    event LiquidityRemoved(address indexed provider, uint256 amountA, uint256 amountB, uint256 shares);
    event Swap(address indexed user, address tokenIn, uint256 amountIn, uint256 amountOut);

    modifier nonReentrant() {
        require(!locked, "ReentrancyGuard: reentrant call");
        locked = true;
        _;
        locked = false;
    }

    constructor(address _tokenA, address _tokenB) {
        require(_tokenA != address(0) && _tokenB != address(0), "Invalid token addresses");
        require(_tokenA != _tokenB, "Tokens must be different");
        tokenA = _tokenA;
        tokenB = _tokenB;
    }

    function _sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }

    function addLiquidity(uint256 amountA, uint256 amountB) external nonReentrant returns (uint256 shares) {
        IERC20(tokenA).transferFrom(msg.sender, address(this), amountA);
        IERC20(tokenB).transferFrom(msg.sender, address(this), amountB);

        if (totalSupply == 0) {
            shares = _sqrt(amountA * amountB);
        } else {
            uint256 sharesA = (amountA * totalSupply) / reserveA;
            uint256 sharesB = (amountB * totalSupply) / reserveB;
            shares = sharesA < sharesB ? sharesA : sharesB;
            require(shares > 0, "Insufficient liquidity minted");
        }

        balanceOf[msg.sender] += shares;
        totalSupply += shares;
        reserveA += amountA;
        reserveB += amountB;

        emit LiquidityAdded(msg.sender, amountA, amountB, shares);
    }

    function removeLiquidity(uint256 shares) external nonReentrant returns (uint256 amountA, uint256 amountB) {
        require(shares <= balanceOf[msg.sender], "Insufficient shares");

        amountA = (shares * reserveA) / totalSupply;
        amountB = (shares * reserveB) / totalSupply;

        balanceOf[msg.sender] -= shares;
        totalSupply -= shares;
        reserveA -= amountA;
        reserveB -= amountB;

        IERC20(tokenA).transfer(msg.sender, amountA);
        IERC20(tokenB).transfer(msg.sender, amountB);

        emit LiquidityRemoved(msg.sender, amountA, amountB, shares);
    }

    function swap(address tokenIn, uint256 amountIn) external nonReentrant returns (uint256 amountOut) {
        require(tokenIn == tokenA || tokenIn == tokenB, "Invalid token");
        require(amountIn > 0, "Invalid amount");

        bool isTokenA = tokenIn == tokenA;
        (uint256 resIn, uint256 resOut) = isTokenA ? (reserveA, reserveB) : (reserveB, reserveA);
        address tokenOut = isTokenA ? tokenB : tokenA;

        IERC20(tokenIn).transferFrom(msg.sender, address(this), amountIn);

        uint256 amountInWithFee = (amountIn * 997) / 1000;
        amountOut = (resOut * amountInWithFee) / (resIn + amountInWithFee);

        if (isTokenA) {
            reserveA += amountIn;
            reserveB -= amountOut;
        } else {
            reserveB += amountIn;
            reserveA -= amountOut;
        }

        IERC20(tokenOut).transfer(msg.sender, amountOut);
        emit Swap(msg.sender, tokenIn, amountIn, amountOut);
    }

    function getReserves() external view returns (uint256, uint256) {
        return (reserveA, reserveB);
    }

    function totalShares() external view returns (uint256) {
        return totalSupply;
    }
}


Response:
    address public immutable tokenA;
    address public immutable tokenB;

    uint256 public reserveA;
    uint256 public reserveB;
    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    bool private locked;

    event LiquidityAdded(address indexed provider, uint256 amountA, uint256 amountB, uint256 shares);
    event LiquidityRemoved(address indexed provider, uint256 amountA, uint256 amountB, uint256 shares);
    event Swap(address indexed user, address tokenIn, uint256 amountIn, uint256 amountOut);

    modifier nonReentrant() {
        require(!locked, "ReentrancyGuard: reentrant call");
        locked = true;
        _;
        locked = false;
    }

    constructor(address _tokenA, address _tokenB) {
        require(_tokenA != address(0) && _tokenB != address(0), "Invalid token addresses");
        require(_tokenA != _tokenB, "Tokens must be different");
        tokenA = _tokenA;
        tokenB = _tokenB;
    }

    function _sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }

    function getReserves() external view returns (uint256, uint256) {
        return (reserveA, reserveB);
    }

    function addLiquidity(uint256 amountA, uint256 amountB) external nonReentrant returns (uint256 shares) {
        IERC20(tokenA).transferFrom(msg.sender, address(this), amountA);
        IERC20(tokenB).transferFrom(msg.sender, address(this), amountB);

        if (totalSupply == 0) {
            shares = _sqrt(amountA * amountB);
        } else {
            uint256 sharesA = (amountA * totalSupply) / reserveA;
            uint256 sharesB = (amountB * totalSupply) / reserveB;
            shares = sharesA < sharesB ? sharesA : sharesB;
            require(shares > 0, "Insufficient liquidity minted");
        }

        balanceOf[msg.sender] += shares;
        totalSupply += shares;
        reserveA += amountA;
        reserveB += amountB;

        emit LiquidityAdded(msg.sender, amountA, amountB, shares);
    }

    function removeLiquidity(uint256 shares) external nonReentrant returns (uint256 amountA, uint256 amountB) {
        require(shares > 0 && balanceOf[msg.sender] >= shares, "Invalid shares");

        amountA = (shares * reserveA) / totalSupply;
        amountB = (shares * reserveB) / totalSupply;

        balanceOf[msg.sender] -= shares;
        totalSupply -= shares;
        reserveA -= amountA;
        reserveB -= amountB;

        IERC20(tokenA).transfer(msg.sender, amountA);
        IERC20(tokenB).transfer(msg.sender, amountB);

        emit LiquidityRemoved(msg.sender, amountA, amountB, shares);
    }

    function swap(address tokenIn, uint256 amountIn) external nonReentrant returns (uint256 amountOut) {
        require(tokenIn == tokenA || tokenIn == tokenB, "Invalid token");
        require(amountIn > 0, "Invalid amount");

        bool isA = tokenIn == tokenA;
        (uint256 resIn, uint256 resOut) = isA ? (reserveA, reserveB) : (reserveB, reserveA);
        address tokenOut = isA ? tokenB : tokenA;

        IERC20(tokenIn).transferFrom(msg.sender, address(this), amountIn);

        uint256 amountInWithFee = (amountIn * 997) / 1000;
        amountOut = (resOut * amountInWithFee) / (resIn + amountInWithFee);

        if (isA) {
            reserveA += amountIn;
            reserveB -= amountOut;
        } else {
            reserveB += amountIn;
            reserveA -= amountOut;
        }

        IERC20(tokenOut).transfer(msg.sender, amountOut);

        emit Swap(msg.sender, tokenIn, amountIn, amountOut);
    }
}