Solidity: { version: '0.8.0', settings: { optimizer: { runs: 200, enabled: true } } },

where is this code to be placed in smart contract

Hello sir. That is hardhat configuration. Belongs in your hardhat.config.js file, not in the smart contract.

You can find references in hardhat documentation

Regards!
Manu