[C++] Using bitset
Define f[i] = 1 as it is possible to make a dish at cost i\nf[baseCost[i]] = 1 // as we can eat no toppings\nf[toppingCosts[i]] = f[toppingCosts[i] * 2] = 1 // 
Define `f[i] = 1` as it is possible to make a dish at cost i\n`f[baseCost[i]] = 1` // as we can eat no toppings\n`f[toppingCosts[i]] = f[toppingCosts[i] * 2] = 1` // bc we can eat at most 2 toppings for each type\nFor convienience, represent `f` as bits\n```\nint closestCost(vector<int>& baseCosts, vector<int>& toppingCosts, int target) {\n        bitset<30004> f;\n        for(int x: baseCosts){\n            f[x] = 1;\n        }\n        for(int x: toppingCosts){\n            f |= (f << x | f << (x * 2));\n        }\n        int ans = INT_MAX;\n        for(int i = 0; i <= 30004; i++){\n            if(f[i] && abs(i - target) < abs(ans - target)){\n                ans = i;\n            }\n        }\n        return ans;\n    }\n```\nLet me know if there are any mistakes or confusions.
[]