#include <bits/stdc++.h>
using namespace std;
typedef int T;
class tutorial_t: vector< T >
{
T val; iterator it, iu;
void example( const function< iterator( ) > & bound_function,
const function< bool ( const T& , const T& ) > & bound_operator,
const string& function_name,
const string& operator_name ) const
{
iterator iv = bound_function( ) ; cout << function_name << "( begin(), end(), " << val << " ): " ;
if ( iv ! = iu )
cout << "Found " << * iv << " at position " << ( iv - it ) << endl;
else
cout << "Not found! all items are " << operator_name << ' ' << val << endl;
assert ( iv == iu or not bound_operator( * iv, val ) ) ;
}
public :
tutorial_t( )
{
size_t n; cin >> n >> val, resize( n ) , it = begin( ) , iu = end( ) ;
for ( auto & a: * this )
cin >> a;
sort( it, iu ) , cout << "sorted_vector(" << n << "):" ;
for ( auto a: * this )
cout << ' ' << a;
cout << endl, assert ( is_sorted( it, iu ) ) ;
example( [ & ] ( ) { return lower_bound( it, iu, val ) ; } , less< T > ( ) , "lower_bound" , "<" ) ,
example( [ & ] ( ) { return upper_bound( it, iu, val ) ; } , less_equal< T > ( ) , "upper_bound" , "<=" ) ;
}
} ;
int main( )
{
ios_base:: sync_with_stdio ( false ) , cin .tie ( nullptr ) , cout .tie ( nullptr ) ;
tutorial_t tutorial;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBpbnQgVDsKCmNsYXNzIHR1dG9yaWFsX3Q6IHZlY3RvcjwgVCA+CnsKICAgIFQgdmFsOyBpdGVyYXRvciBpdCwgaXU7CgogICAgdm9pZCBleGFtcGxlKCAgIGNvbnN0IGZ1bmN0aW9uPCBpdGVyYXRvcigpID4mIGJvdW5kX2Z1bmN0aW9uLAogICAgICAgICAgICAgICAgICAgIGNvbnN0IGZ1bmN0aW9uPCBib29sKCBjb25zdCBUJiwgY29uc3QgVCYgKSA+JiBib3VuZF9vcGVyYXRvciwKICAgICAgICAgICAgICAgICAgICBjb25zdCBzdHJpbmcmIGZ1bmN0aW9uX25hbWUsCiAgICAg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