// vector standard header
#ifndef _VECTOR_
#define _VECTOR_

#pragma info(none)
#ifndef __CHKHDR__
#  pragma report(level, E)
#endif
#pragma info(restore)

#if __IBMCPP__ < 400
#error This file to be used only with IBM VisualAge C++ v4 and later compilers.
#endif /* __IBMCPP__ */

#pragma namemangling(ansi)

   /********************************************************************/
   /*  <vector> header file                                            */
   /*                                                                  */
   /*  VisualAge C++, Version 4.0                                      */
   /*    Licensed Material - Property of IBM                           */
   /*                                                                  */
   /*  5801-AAR and Other Materials                                    */
   /*                                                                  */
   /*  (c) Copyright IBM Corp 1991, 1998. All rights reserved.         */
   /*                                                                  */
   /*                                                                  */
   /*  Licensed Materials.                                             */
   /*                                                                  */
   /*  Dinkum C++ Library                                              */
   /*  Copyright (c) 1998.  Licensed to IBM Corp. and its suppliers.   */
   /*                                                                  */
   /********************************************************************/

#include <iterator>
#include <memory>
#include <stdexcept>
_STD_BEGIN

		// TEMPLATE CLASS _Vector_val
template<class _Ty, class _A>
	class _Vector_val {
protected:
	_Vector_val(_A _Al = _A())
		: _Alval(_Al) {}
	typedef typename _A::template
		rebind<_Ty>::other _Alty;
	_Alty _Alval;
	};

		// TEMPLATE CLASS vector
template<class _Ty, class _Ax _TDEF(allocator<_Ty>) >
	class vector : public _Vector_val<_Ty, _Ax> {
public:
	typedef vector<_Ty, _Ax> _Myt;
	typedef _Vector_val<_Ty, _Ax> _Mybase;
	typedef typename _Mybase::_Alty _A;
	typedef _A allocator_type;
	typedef typename _A::size_type size_type;
	typedef typename _A::difference_type difference_type;
	typedef typename _A::pointer _Tptr;
	typedef typename _A::const_pointer _Ctptr;
	typedef _Tptr pointer;
	typedef _Ctptr const_pointer;
	typedef typename _A::reference reference;
	typedef typename _A::const_reference const_reference;
	typedef typename _A::value_type value_type;
	typedef _Ptrit<value_type, difference_type, _Tptr,
		reference, _Tptr, reference> iterator;
	typedef _Ptrit<value_type, difference_type, _Ctptr,
		const_reference, _Tptr, reference> const_iterator;
	typedef typename std::reverse_iterator<iterator>
		reverse_iterator;
	typedef typename std::reverse_iterator<const_iterator>
		const_reverse_iterator;
	vector()
		: _Mybase()
		{_Buy(0); }
	explicit vector(const _A& _Al)
		: _Mybase(_Al)
		{_Buy(0); }
	explicit vector(size_type _N)
		: _Mybase()
		{if (_Buy(_N))
			_Last = _Ufill(_First, _N, _Ty()); }
	vector(size_type _N, const _Ty& _V)
		: _Mybase()
		{if (_Buy(_N))
			_Last = _Ufill(_First, _N, _V); }
	vector(size_type _N, const _Ty& _V, const _A& _Al)
		: _Mybase(_Al)
		{if (_Buy(_N))
			_Last = _Ufill(_First, _N, _V); }
	vector(const _Myt& _X)
		: _Mybase(_X._Alval)
		{if (_Buy(_X.size()))
			_Last = _Ucopy(_X.begin(), _X.end(), _First); }
	template<class _It>
		vector(_It _F, _It _L)
		: _Mybase()
		{_Construct(_F, _L, _Iter_cat(_F)); }
	template<class _It>
		vector(_It _F, _It _L, const _A& _Al)
		: _Mybase(_Al)
		{_Construct(_F, _L, _Iter_cat(_F)); }
	template<class _It>
		void _Construct(_It _F, _It _L, _Int_iterator_tag)
		{size_type _N = (size_type)_F;
		if (_Buy(_N))
			_Last = _Ufill(_First, _N, (_Ty)_L); }
	template<class _It>
		void _Construct(_It _F, _It _L, input_iterator_tag)
		{_Buy(0);
		insert(begin(), _F, _L); }
	~vector()
		{_Clear(); }
	_Myt& operator=(const _Myt& _X)
		{if (this == &_X)
			;
		else if (_X.size() == 0)
			{_Clear(); }
		else if (_X.size() <= size())
			{pointer _Q = copy(_X.begin(), _X.end(), _First);
			_Destroy(_Q, _Last);
			_Last = _First + _X.size(); }
		else if (_X.size() <= capacity())
			{const_iterator _S = _X.begin() + size();
			copy(_X.begin(), _S, _First);
			_Last = _Ucopy(_S, _X.end(), _Last); }
		else
			{_Destroy(_First, _Last);
			_Mybase::_Alval.deallocate(_First,
				_End - _First);
			if (_Buy(_X.size()))
				_Last = _Ucopy(_X.begin(), _X.end(), _First); }
		return (*this); }
	void reserve(size_type _N)
		{if (max_size() < _N)
			_Xlen();
		else if (capacity() < _N)
			{pointer _Q = _Mybase::_Alval.allocate(_N,
				(void *)0);
			_TRY_BEGIN
			_Ucopy(begin(), end(), _Q);
			_CATCH_ALL
			_Mybase::_Alval.deallocate(_Q, _N);
			_RERAISE;
			_CATCH_END
			if (_First != 0)
				{_Destroy(_First, _Last);
				_Mybase::_Alval.deallocate(_First,
					_End - _First); }
			_End = _Q + _N;
			_Last = _Q + size();
			_First = _Q; }}
	size_type capacity() const
		{return (_First == 0 ? 0 : _End - _First); }
	iterator begin()
		{return (iterator(_First)); }
	const_iterator begin() const
		{return (const_iterator(_First)); }
	iterator end()
		{return (iterator(_Last)); }
	const_iterator end() const
		{return (const_iterator(_Last)); }
	reverse_iterator rbegin()
		{return (reverse_iterator(end())); }
	const_reverse_iterator rbegin() const
		{return (const_reverse_iterator(end())); }
	reverse_iterator rend()
		{return (reverse_iterator(begin())); }
	const_reverse_iterator rend() const
		{return (const_reverse_iterator(begin())); }
	void resize(size_type _N)
		{resize(_N, _Ty()); }
	void resize(size_type _N, _Ty _X)
		{if (size() < _N)
			insert(end(), _N - size(), _X);
		else if (_N < size())
			erase(begin() + _N, end()); }
	size_type size() const
		{return (_First == 0 ? 0 : _Last - _First); }
	size_type max_size() const
		{return (_Mybase::_Alval.max_size()); }
	bool empty() const
		{return (size() == 0); }
	_A get_allocator() const
		{return (_Mybase::_Alval); }
	const_reference at(size_type _P) const
		{if (size() <= _P)
			_Xran();
		return (*(begin() + _P)); }
	reference at(size_type _P)
		{if (size() <= _P)
			_Xran();
		return (*(begin() + _P)); }
	const_reference operator[](size_type _P) const
		{return (*(begin() + _P)); }
	reference operator[](size_type _P)
		{return (*(begin() + _P)); }
	reference front()
		{return (*begin()); }
	const_reference front() const
		{return (*begin()); }
	reference back()
		{return (*(end() - 1)); }
	const_reference back() const
		{return (*(end() - 1)); }
	void push_back(const _Ty& _X)
		{insert(end(), _X); }
	void pop_back()
		{erase(end() - 1); }
	template<class _It>
		void assign(_It _F, _It _L)
		{_Assign(_F, _L, _Iter_cat(_F)); }
	template<class _It>
		void _Assign(_It _F, _It _L, _Int_iterator_tag)
		{assign((size_type)_F, (_Ty)_L); }
	template<class _It>
		void _Assign(_It _F, _It _L, input_iterator_tag)
		{erase(begin(), end());
		insert(begin(), _F, _L); }
	void assign(size_type _N, const _Ty& _X)
		{_Ty _Tx = _X;
		erase(begin(), end());
		insert(begin(), _N, _Tx); }
	iterator insert(iterator _P, const _Ty& _X)
		{size_type _Off = size() == 0 ? 0 : _P - begin();
		insert(_P, (size_type)1, _X);
		return (begin() + _Off); }
	void insert(iterator _P, size_type _M, const _Ty& _X)
		{_Ty _Tx = _X;
		size_type _N = capacity();
		if (_M == 0)
			;
		else if (max_size() - size() < _M)
			_Xlen();
		else if (_N < size() + _M)
			{_N = max_size() - _N < _N ? 0 : _N + _N;
			if (_N < size() + _M)
				_N = size() + _M;
			pointer _S = _Mybase::_Alval.allocate(_N,
				(void *)0);
			pointer _Q;
			_TRY_BEGIN
			_Q = _Ucopy(begin(), _P, _S);
			_Q = _Ufill(_Q, _M, _Tx);
			_Ucopy(_P, end(), _Q);
			_CATCH_ALL
			_Destroy(_S, _Q);
			_Mybase::_Alval.deallocate(_S, _N);
			_RERAISE;
			_CATCH_END
			if (_First != 0)
				{_Destroy(_First, _Last);
				_Mybase::_Alval.deallocate(_First,
					_End - _First); }
			_End = _S + _N;
			_Last = _S + size() + _M;
			_First = _S; }
		else if (end() - _P < _M)
			{_Ucopy(_P, end(), &*_P + _M);
			_TRY_BEGIN
			_Ufill(_Last, _M - (end() - _P), _Tx);
			_CATCH_ALL
			_Destroy(&*_P + _M, _Last + _M);
			_RERAISE;
			_CATCH_END
			_Last += _M;
			fill(_P, end() - _M, _Tx); }
		else
			{iterator _Oend = end();
			_Last = _Ucopy(_Oend - _M, _Oend, _Last);
			copy_backward(_P, _Oend - _M, _Oend);
			fill(_P, _P + _M, _Tx); }}
	template<class _It>
		void insert(iterator _P, _It _F, _It _L)
		{_Insert(_P, _F, _L, _Iter_cat(_F)); }
	template<class _It>
		void _Insert(iterator _P, _It _F, _It _L,
			_Int_iterator_tag)
		{insert(_P, (size_type)_F, (_Ty)_L); }
	template<class _It>
		void _Insert(iterator _P, _It _F, _It _L,
			input_iterator_tag)
		{for (; _F != _L; ++_F, ++_P)
			_P = insert(_P, *_F); }
	template<class _It>
		void _Insert(iterator _P, _It _F, _It _L,
			forward_iterator_tag)
		{size_type _M = 0;
		_Distance(_F, _L, _M);
		size_type _N = capacity();
		if (_M == 0)
			;
		else if (max_size() - size() < _M)
			_Xlen();
		else if (_N < size() + _M)
			{_N = max_size() - _N < _N ? 0 : _N + _N;
			if (_N < size() + _M)
				_N = size() + _M;
			pointer _S = _Mybase::_Alval.allocate(_N,
				(void *)0);
			pointer _Q;
			_TRY_BEGIN
			_Q = _Ucopy(begin(), _P, _S);
			_Q = _Ucopy(_F, _L, _Q);
			_Ucopy(_P, end(), _Q);
			_CATCH_ALL
			_Destroy(_S, _Q);
			_Mybase::_Alval.deallocate(_S, _N);
			_RERAISE;
			_CATCH_END
			if (_First != 0)
				{_Destroy(_First, _Last);
				_Mybase::_Alval.deallocate(_First,
					_End - _First); }
			_End = _S + _N;
			_Last = _S + size() + _M;
			_First = _S; }
		else if (end() - _P < _M)
			{_Ucopy(_P, end(), &*_P + _M);
			_It _Mid = _F;
			advance(_Mid, end() - _P);
			_TRY_BEGIN
			_Ucopy(_Mid, _L, _Last);
			_CATCH_ALL
			_Destroy(&*_P + _M, _Last + _M);
			_RERAISE;
			_CATCH_END
			_Last += _M;
			copy(_F, _Mid, _P); }
		else if (0 < _M)
			{iterator _Oend = end();
			_Last = _Ucopy(_Oend - _M, _Oend, _Last);
			copy_backward(_P, _Oend - _M, _Oend);
			copy(_F, _L, _P); }}
	iterator erase(iterator _P)
		{copy(_P + 1, end(), _P);
		_Destroy(_Last - 1, _Last);
		--_Last;
		return (_P); }
	iterator erase(iterator _F, iterator _L)
		{if (_F != _L)
			{pointer _S = copy(_L, end(), &*_F);
			_Destroy(_S, _Last);
			_Last = _S; }
		return (_F); }
	void clear()
		{erase(begin(), end()); }
	bool _Eq(const _Myt& _X) const
		{return (size() == _X.size()
			&& equal(begin(), end(), _X.begin())); }
	bool _Lt(const _Myt& _X) const
		{return (lexicographical_compare(begin(), end(),
			_X.begin(), _X.end())); }
	void swap(_Myt& _X)
		{if (_Mybase::_Alval == _X._Alval)
			{std::swap(_First, _X._First);
			std::swap(_Last, _X._Last);
			std::swap(_End, _X._End); }
		else
			{_Myt _Ts = *this; *this = _X, _X = _Ts; }}
protected:
	bool _Buy(size_type _N)
		{_First = 0, _Last = 0, _End = 0;
		if (_N == 0)
			return (false);
		else
			{_First = _Mybase::_Alval.allocate(_N,
				(void *)0);
			_Last = _First;
			_End = _First + _N;
			return (true); }}
	void _Clear()
		{if (_First != 0)
			{_Destroy(_First, _Last);
			_Mybase::_Alval.deallocate(_First,
				_End - _First); }
		_First = 0, _Last = 0, _End = 0; }
	void _Destroy(pointer _F, pointer _L)
		{for (; _F != _L; ++_F)
			_Mybase::_Alval.destroy(_F); }
	template<class _It>
	pointer _Ucopy(_It _F, _It _L, pointer _Q)
		{pointer _Qs = _Q;
		_TRY_BEGIN
		for (; _F != _L; ++_Q, ++_F)
			_Mybase::_Alval.construct(_Q, *_F);
		_CATCH_ALL
		_Destroy(_Qs, _Q);
		_RERAISE;
		_CATCH_END
		return (_Q); }
	pointer _Ufill(pointer _Q, size_type _N, const _Ty &_X)
		{pointer _Qs = _Q;
		_TRY_BEGIN
		for (; 0 < _N; --_N, ++_Q)
			_Mybase::_Alval.construct(_Q, _X);
		_CATCH_ALL
		_Destroy(_Qs, _Q);
		_RERAISE;
		_CATCH_END
		return (_Q); }
	void _Xlen() const
		{_THROW(length_error, ""); }
	void _Xran() const
		{_THROW(out_of_range, ""); }
	pointer _First, _Last, _End;
	};
		// vector TEMPLATE FUNCTIONS
template<class _Ty, class _A> inline
	bool operator==(const vector<_Ty, _A>& _X,
		const vector<_Ty, _A>& _Y)
	{return (_X._Eq(_Y)); }
template<class _Ty, class _A> inline
	bool operator!=(const vector<_Ty, _A>& _X,
		const vector<_Ty, _A>& _Y)
	{return (!(_X == _Y)); }
template<class _Ty, class _A> inline
	bool operator<(const vector<_Ty, _A>& _X,
		const vector<_Ty, _A>& _Y)
	{return (_X._Lt(_Y)); }
template<class _Ty, class _A> inline
	bool operator>(const vector<_Ty, _A>& _X,
		const vector<_Ty, _A>& _Y)
	{return (_Y < _X); }
template<class _Ty, class _A> inline
	bool operator<=(const vector<_Ty, _A>& _X,
		const vector<_Ty, _A>& _Y)
	{return (!(_Y < _X)); }
template<class _Ty, class _A> inline
	bool operator>=(const vector<_Ty, _A>& _X,
		const vector<_Ty, _A>& _Y)
	{return (!(_X < _Y)); }
template<class _Ty, class _A> inline
	void swap(vector<_Ty, _A>& _X, vector<_Ty, _A>& _Y)
	{_X.swap(_Y); }

		// CLASS vector<_Bool, allocator>
typedef unsigned int _Vbase;
const int _VBITS = 8 * sizeof (_Vbase);	// min CHAR_BITS
template<class _A>
	class vector<_Bool, _A> {
public:
	typedef typename _A::size_type size_type;
	typedef typename _A::difference_type _Dift;
	typedef typename std::vector<_Vbase,
		typename _A::template rebind<_Vbase>::other>
			_Vbtype;
	typedef typename std::vector<_Bool, _A> _Myt;
	typedef _Dift difference_type;
	typedef _Bool _Ty;
	typedef _A allocator_type;
		// CLASS reference
	class reference {
	public:
		reference()
			: _Mask(0), _Ptr(0) {}
		reference(size_t _Off, _Vbase *_P)
			: _Mask((_Vbase)1 << _Off), _Ptr(_P) {}
		reference& operator=(const reference& _X)
			{return (*this = bool(_X)); }
		reference& operator=(bool _V)
			{if (_V)
				*_Ptr |= _Mask;
			else
				*_Ptr &= ~_Mask;
			return (*this); }
		void flip()
			{*_Ptr ^= _Mask; }
		bool operator~() const
			{return (!bool(*this)); }
		operator bool() const
			{return ((*_Ptr & _Mask) != 0); }
	protected:
		_Vbase _Mask, *_Ptr;
		};
	typedef reference _Reft;
	typedef bool const_reference;
	typedef bool value_type;
		// CLASS iterator
	class const_iterator;
	class iterator
		: public _Ranit<_Bool, _Dift, _Reft *, _Reft> {
	public:
		typedef _Ranit<_Bool, _Dift, _Reft *, _Reft> _Mybase;
		typedef typename _Mybase::iterator_category
			iterator_category;
		typedef typename _Mybase::value_type value_type;
		typedef typename _Mybase::difference_type
			difference_type;
		typedef typename _Mybase::pointer pointer;
		typedef typename _Mybase::reference reference;
		friend class const_iterator;
		iterator()
			: _Off(0), _Ptr(0) {}
		iterator(size_t _O, typename _Vbtype::iterator _P)
			: _Off(_O), _Ptr(_P.base()) {}
		reference operator*() const
			{return (_Reft(_Off, _Ptr)); }
		iterator& operator++()
			{_Inc();
			return (*this); }
		iterator operator++(int)
			{iterator _Tmp = *this;
			_Inc();
			return (_Tmp); }
		iterator& operator--()
			{_Dec();
			return (*this); }
		iterator operator--(int)
			{iterator _Tmp = *this;
			_Dec();
			return (_Tmp); }
		iterator& operator+=(difference_type _N)
			{_Off += _N;
			_Ptr += _Off / _VBITS;
			_Off %= _VBITS;
			return (*this); }
		iterator& operator-=(difference_type _N)
			{return (*this += -_N); }
		iterator operator+(difference_type _N) const
			{iterator _Tmp = *this;
			return (_Tmp += _N); }
		iterator operator-(difference_type _N) const
			{iterator _Tmp = *this;
			return (_Tmp -= _N); }
		difference_type operator-(const iterator _X) const
			{return (_VBITS * (_Ptr - _X._Ptr)
				+ (difference_type)_Off
				- (difference_type)_X._Off); }
		reference operator[](difference_type _N) const
			{return (*(*this + _N)); }
		bool operator==(const iterator& _X) const
			{return (_Ptr == _X._Ptr && _Off == _X._Off); }
		bool operator!=(const iterator& _X) const
			{return (!(*this == _X)); }
		bool operator<(const iterator& _X) const
			{return (_Ptr < _X._Ptr
				|| _Ptr == _X._Ptr && _Off < _X._Off); }
		bool operator>(const iterator& _X) const
			{return (_X < *this); }
		bool operator<=(const iterator& _X) const
			{return (!(_X < *this)); }
		bool operator>=(const iterator& _X) const
			{return (!(*this < _X)); }
	protected:
		void _Dec()
			{if (_Off != 0)
				--_Off;
			else
				_Off = _VBITS - 1, --_Ptr; }
		void _Inc()
			{if (_Off < _VBITS - 1)
				++_Off;
			else
				_Off = 0, ++_Ptr; }
		size_t _Off;
		_Vbase *_Ptr;
		};
	typedef iterator _Myit;
		// CLASS const_iterator
	class const_iterator : public _Ranit<_Bool, _Dift,
		const_reference *, const_reference> {
	public:
		typedef _Ranit<_Bool, _Dift,
			const_reference *, const_reference> _Mybase;
		typedef typename _Mybase::iterator_category
			iterator_category;
		typedef typename _Mybase::value_type value_type;
		typedef typename _Mybase::difference_type
			difference_type;
		typedef typename _Mybase::pointer pointer;
		typedef typename _Mybase::reference reference;
		const_iterator()
			: _Off(0), _Ptr(0) {}
		const_iterator(size_t _O,
			typename _Vbtype::const_iterator _P)
			: _Off(_O), _Ptr(_P.base()) {}
		const_iterator(const _Myit& _X)
			: _Off(_X._Off), _Ptr(_X._Ptr) {}
		const_reference operator*() const
			{return (_Reft(_Off, (_Vbase *)_Ptr)); }
		const_iterator& operator++()
			{_Inc();
			return (*this); }
		const_iterator operator++(int)
			{const_iterator _Tmp = *this;
			_Inc();
			return (_Tmp); }
		const_iterator& operator--()
			{_Dec();
			return (*this); }
		const_iterator operator--(int)
			{const_iterator _Tmp = *this;
			_Dec();
			return (_Tmp); }
		const_iterator& operator+=(difference_type _N)
			{_Off += _N;
			_Ptr += _Off / _VBITS;
			_Off %= _VBITS;
			return (*this); }
		const_iterator& operator-=(difference_type _N)
			{return (*this += -_N); }
		const_iterator operator+(difference_type _N) const
			{const_iterator _Tmp = *this;
			return (_Tmp += _N); }
		const_iterator operator-(difference_type _N) const
			{const_iterator _Tmp = *this;
			return (_Tmp -= _N); }
		difference_type operator-(const const_iterator _X) const
			{return (_VBITS * (_Ptr - _X._Ptr)
				+ (difference_type)_Off
				- (difference_type)_X._Off); }
		const_reference operator[](difference_type _N) const
			{return (*(*this + _N)); }
		bool operator==(const const_iterator& _X) const
			{return (_Ptr == _X._Ptr && _Off == _X._Off); }
		bool operator!=(const const_iterator& _X) const
			{return (!(*this == _X)); }
		bool operator<(const const_iterator& _X) const
			{return (_Ptr < _X._Ptr
				|| _Ptr == _X._Ptr && _Off < _X._Off); }
		bool operator>(const const_iterator& _X) const
			{return (_X < *this); }
		bool operator<=(const const_iterator& _X) const
			{return (!(_X < *this)); }
		bool operator>=(const const_iterator& _X) const
			{return (!(*this < _X)); }
	protected:
		void _Dec()
			{if (_Off != 0)
				--_Off;
			else
				_Off = _VBITS - 1, --_Ptr; }
		void _Inc()
			{if (_Off < _VBITS - 1)
				++_Off;
			else
				_Off = 0, ++_Ptr; }
		size_t _Off;
		const _Vbase *_Ptr;
		};
	typedef iterator pointer;
	typedef const_iterator const_pointer;
	typedef typename std::reverse_iterator<iterator>
		reverse_iterator;
	typedef typename std::reverse_iterator<const_iterator>
		const_reverse_iterator;
	vector()
		: _Size(0), _Vec() {}
	explicit vector(const _A& _Al)
		: _Size(0), _Vec(_Al) {}
	explicit vector(size_type _N, const bool _V = false)
		: _Size(0), _Vec(_Nw(_N), _V ? -1 : 0)
		{_Trim(_N); }
	vector(size_type _N, const bool _V, const _A& _Al)
		: _Size(0), _Vec(_Nw(_N), _V ? -1 : 0, _Al)
		{_Trim(_N); }
	template<class _It>
		vector(_It _F, _It _L)
		: _Size(0), _Vec()
		{_BConstruct(_F, _L, _Iter_cat(_F)); }
	template<class _It>
		vector(_It _F, _It _L, const _A& _Al)
		: _Size(0), _Vec(_Al)
		{_BConstruct(_F, _L, _Iter_cat(_F)); }
	template<class _It>
		void _BConstruct(_It _F, _It _L, _Int_iterator_tag)
		{size_type _N = (size_type)_F;
		_Vec.assign(_N, (_Ty)_L ? -1 : 0);
		_Trim(_N); }
	template<class _It>
		void _BConstruct(_It _F, _It _L, input_iterator_tag)
		{insert(begin(), _F, _L); }
	~vector()
		{_Size = 0; }
	void reserve(size_type _N)
		{_Vec.reserve(_Nw(_N)); }
	size_type capacity() const
		{return (_Vec.capacity() * _VBITS); }
	iterator begin()
		{return (iterator(0, _Vec.begin())); }
	const_iterator begin() const
		{return (const_iterator(0, _Vec.begin())); }
	iterator end()
		{iterator _Tmp = begin();
		if (0 < _Size)
			_Tmp += _Size;
		return (_Tmp); }
	const_iterator end() const
		{const_iterator _Tmp = begin();
		if (0 < _Size)
			_Tmp += _Size;
		return (_Tmp); }
	reverse_iterator rbegin()
		{return (reverse_iterator(end())); }
	const_reverse_iterator rbegin() const
		{return (const_reverse_iterator(end())); }
	reverse_iterator rend()
		{return (reverse_iterator(begin())); }
	const_reverse_iterator rend() const
		{return (const_reverse_iterator(begin())); }
	void resize(size_type _N, bool _X = false)
		{if (size() < _N)
			insert(end(), _N - size(), _X);
		else if (_N < size())
			erase(begin() + _N, end()); }
	size_type size() const
		{return (_Size); }
	size_type max_size() const
		{return (_Vec.max_size() * _VBITS); }
	bool empty() const
		{return (size() == 0); }
	_A get_allocator() const
		{return (_Vec.get_allocator()); }
	const_reference at(size_type _P) const
		{if (size() <= _P)
			_Xran();
		return (*(begin() + _P)); }
	reference at(size_type _P)
		{if (size() <= _P)
			_Xran();
		return (*(begin() + _P)); }
	const_reference operator[](size_type _P) const
		{return (*(begin() + _P)); }
	reference operator[](size_type _P)
		{return (*(begin() + _P)); }
	reference front()
		{return (*begin()); }
	const_reference front() const
		{return (*begin()); }
	reference back()
		{return (*(end() - 1)); }
	const_reference back() const
		{return (*(end() - 1)); }
	void push_back(const bool _X)
		{insert(end(), _X); }
	void pop_back()
		{erase(end() - 1); }
	template<class _It>
		void assign(_It _F, _It _L)
		{_Assign(_F, _L, _Iter_cat(_F)); }
	template<class _It>
		void _Assign(_It _F, _It _L, _Int_iterator_tag)
		{assign((size_type)_F, (_Ty)_L); }
	template<class _It>
		void _Assign(_It _F, _It _L, input_iterator_tag)
		{erase(begin(), end());
		insert(begin(), _F, _L); }
	void assign(size_type _N, const _Ty& _X)
		{_Ty _Tx = _X;
		erase(begin(), end());
		insert(begin(), _N, _Tx); }
	iterator insert(iterator _P, const bool _X)
		{size_type _Off = _P - begin();
		insert(_P, (size_type)1, _X);
		return (begin() + _Off); }
	void insert(iterator _P, size_type _M, const bool _X)
		{if (_M == 0)
			;
		else if (max_size() - size() < _M)
			_Xlen();
		else
			{if (size() == 0)
				{_Vec.resize(_Nw(size() + _M), 0);
				_P = begin(); }
			else
				{size_type _Off = _P - begin();
				_Vec.resize(_Nw(size() + _M), 0);
				_P = begin() + _Off;
				copy_backward(_P, end(), end() + _M); }
			fill(_P, _P + _M, _X);
			_Size += _M; }}
	template<class _It>
		void insert(iterator _P, _It _F, _It _L)
		{_Insert(_P, _F, _L, _Iter_cat(_F)); }
	template<class _It>
		void _Insert(iterator _P, _It _F, _It _L,
			_Int_iterator_tag)
		{insert(_P, (size_type)_F, (_Ty)_L); }
	template<class _It>
		void _Insert(iterator _P, _It _F, _It _L,
			input_iterator_tag)
		{size_type _Off = _P - begin();
		for (; _F != _L; ++_F, ++_Off)
			insert(begin() + _Off, *_F); }
	template<class _It>
		void _Insert(iterator _P, _It _F, _It _L,
			forward_iterator_tag)
		{size_type _M = 0;
		_Distance(_F, _L, _M);
		if (_M == 0)
			;
		else if (max_size() - size() < _M)
			_Xlen();
		else
			{if (size() == 0)
				{_Vec.resize(_Nw(size() + _M), 0);
				_P = begin(); }
			else
				{size_type _Off = _P - begin();
				_Vec.resize(_Nw(size() + _M), 0);
				_P = begin() + _Off; 
				copy_backward(_P, end(), end() + _M); }
			copy(_F, _L, _P);
			_Size += _M; }}
	iterator erase(iterator _P)
		{copy(_P + 1, end(), _P);
		_Trim(_Size - 1);
		return (_P); }
	iterator erase(iterator _F, iterator _L)
		{iterator _S = copy(_L, end(), _F);
		_Trim(_S - begin());
		return (_F); }
	void clear()
		{erase(begin(), end()); }
	void flip()
		{for (typename _Vbtype::iterator _S = _Vec.begin();
			_S != _Vec.end(); ++_S)
			*_S = ~*_S;
		_Trim(_Size); }
	bool _Eq(const _Myt& _X) const
		{return (_Size == _X._Size && _Vec == _X._Vec); }
	bool _Lt(const _Myt& _X) const
		{return (lexicographical_compare(begin(), end(),
			_X.begin(), _X.end())); }
	void swap(_Myt& _X)
		{std::swap(_Size, _X._Size);
		_Vec.swap(_X._Vec); }
	static void swap(reference _X, reference _Y)
		{bool _V = _X;
		_X = _Y;
		_Y = _V; }
protected:
	static size_type _Nw(size_type _N)
		{return ((_N + _VBITS - 1) / _VBITS); }
	void _Trim(size_type _N)
		{if (size() < _N && max_size() <= _N)
			_Xlen();
		size_type _M = _Nw(_N);
		if (_M < _Vec.size())
			_Vec.erase(_Vec.begin() + _M, _Vec.end());
		_Size = _N;
		_N %= _VBITS;
		if (0 < _N)
			_Vec[_M - 1] &= ((_Vbase)1 << _N) - 1; }
	void _Xlen() const
		{_THROW(out_of_range, ""); }
	void _Xran() const
		{_THROW(out_of_range, ""); }
	size_type _Size;
	_Vbtype _Vec;
	};
typedef vector<bool, allocator<bool> > _Bvector;
_STD_END

#pragma namemangling()

#pragma info(none)
#ifndef __CHKHDR__
#  pragma report(pop)
#endif
#pragma info(restore)

#endif /* _VECTOR_ */

/*
 * Copyright (c) 1995 by P.J. Plauger.  ALL RIGHTS RESERVED.
 * Consult your license regarding permissions and restrictions.
 */

/*
 * This file is derived from software bearing the following
 * restrictions:
 *
 * Copyright (c) 1994
 * Hewlett-Packard Company
 *
 * Permission to use, copy, modify, distribute and sell this
 * software and its documentation for any purpose is hereby
 * granted without fee, provided that the above copyright notice
 * appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation.
 * Hewlett-Packard Company makes no representations about the
 * suitability of this software for any purpose. It is provided
 * "as is" without express or implied warranty.
V2.2:0081 */
