template <typename T>
class MyVector {
private:
    T* data;
    int capacity;
    int size;

    void resize() {
        capacity *= 2;
        T* newData = new T[capacity];
        for (int i = 0; i < size; ++i)
            newData[i] = data[i];
        delete[] data;
        data = newData;
    }

public:
    MyVector() : capacity(4), size(0) {
        data = new T[capacity];
    }

    void push_back(T value) {
        if (size == capacity)
            resize();
        data[size++] = value;
    }

    void pop_back() {
        if (size > 0)
            --size;
    }

    void push_front(T value) {
        if (size == capacity)
            resize();
        for (int i = size; i > 0; --i)
            data[i] = data[i - 1];
        data[0] = value;
        ++size;
    }

    void pop_front() {
        if (size == 0) return;
        for (int i = 0; i < size - 1; ++i)
            data[i] = data[i + 1];
        --size;
    }

    T operator[](int index) const {
        return data[index];
    }

    int getSize() const {
        return size;
    }
};
