Leetcode 1603. Design Parking System
Observation
You can simplify this using arrays.
You don't need two numbers for each type (max and current). Simply track the number of open spots (per type) and count down.
if you are not using arrays consider a switch statement.
Code Review:
Prefer &quot;\n&quot; over std::endl.
If your main() does not return anything but 0 at the end.
Then leave out the return. It is auto added by the compiler.
Re-Design
template&lt;std::size_t typeCount = 3&gt;
class ParkingSystem
{
    int openSlots[typeCount];
    
    public:
        template&lt;typename... Args&gt;
        ParkingSystem(Args... args)
            : openSlots{args...}
        {}
    
        bool addCar(int type)
        {
            if (openSlots[type - 1] == 0) {
                return false;
            }
            --openSlots[type - 1];
            return true;
        }
};

int main() 
{
    
    ParkingSystem parking_system(1, 1, 0);
    
    std::cout
        &lt;&lt; &quot;parking_system.addCar(1) &quot; &lt;&lt; parking_system.addCar(1) &lt;&lt; &quot;\n&quot;
        &lt;&lt; &quot;parking_system.addCar(2) &quot; &lt;&lt; parking_system.addCar(2) &lt;&lt; &quot;\n&quot;
        &lt;&lt; &quot;parking_system.addCar(3) &quot; &lt;&lt; parking_system.addCar(3) &lt;&lt; &quot;\n&quot;
        &lt;&lt; &quot;parking_system.addCar(1) &quot; &lt;&lt; parking_system.addCar(1) &lt;&lt; &quot;\n&quot;;
}