<commit_before>#include<cassert>
#include<iostream>
#include<vector>

using namespace std;

class Deque {
    
private:
    vector<int> data_;
    int size_;
    int head_;
    int tail_;
    int capacity_;
    
public:
    
    Deque(int size) : size_(0), head_(0), tail_(size-1), capacity_(size), data_(size, 0) {}
    
    void push_front(int v) {
        assert(head_ <= tail_);
        data_[head_++] = v;
        size_++;
    }
    
    void push_back(int v) {
        assert(head_ <= tail_);
        data_[tail_--] = v;
        size_++;
    }
    
    void pop_front() {
        assert(head_ > 0);
        head_--;
        size_--;
    }
    
    void pop_back() {
        assert(tail_ < capacity_);
        tail_++;
        size_--;
    }
    
    int front() const { 
        assert(head_ > 0);
        return data_[head_-1];
    }
    
    int back() const {
        assert(tail_ < capacity_-1);
        return data_[tail_+1];
    }
    
    int size() const { return size_; }
    
    int empty() const { return size_ == 0; }
    
    
    ~Deque() {}
};

int main() {
    Deque mydeque(3);
    mydeque.push_front(1);
    mydeque.push_back(3);
    cout << mydeque.front() << " " << mydeque.back() << endl;
    cout << mydeque.size();
}<commit_msg>Update deque.cpp<commit_after>#include<cassert>
#include<iostream>
#include<vector>

using namespace std;

template <class T>
class Deque {
    
private:
    vector<T> data_;
    int size_;
    int head_;
    int tail_;
    int capacity_;
    
public:
    
    Deque(int size) : size_(0), head_(0), tail_(size-1), capacity_(size), data_(size) {}
    
    void push_front(T v) {
        assert(head_ <= tail_);
        data_[head_++] = v;
        size_++;
    }
    
    void push_back(T v) {
        assert(head_ <= tail_);
        data_[tail_--] = v;
        size_++;
    }
    
    void pop_front() {
        assert(head_ > 0);
        head_--;
        size_--;
    }
    
    void pop_back() {
        assert(tail_ < capacity_);
        tail_++;
        size_--;
    }
    
    T front() const { 
        assert(head_ > 0);
        return data_[head_-1];
    }
    
    T back() const {
        assert(tail_ < capacity_-1);
        return data_[tail_+1];
    }
    
    int size() const { return size_; }
    
    int empty() const { return size_ == 0; }
    
    
    ~Deque() {}
};

int main() {
    Deque<int> mydeque(3);
    mydeque.push_front(1);
    mydeque.push_back(3);
    cout << mydeque.front() << " " << mydeque.back() << endl;
    cout << mydeque.size();
}
{'fraction_non_alphanumeric': 0.15177865612648223, 'fraction_numerical': 0.009881422924901186, 'mean_word_length': 1.8028792912513842, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6198179', 'n_tokens_mistral': 903, 'n_tokens_neox': 884, 'n_words': 191}