# include <iostream>
# include <algorithm>
using namespace std;
int a[]={1,1,3,4};
int main()
{
int *p2=upper_bound(a,a+4,1);
cout << "upper_bound returned element " << p2-a << '\n' ;
cout<< "which is " << *p2<<endl;
}
IyBpbmNsdWRlIDxpb3N0cmVhbT4KIyBpbmNsdWRlIDxhbGdvcml0aG0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBhW109ezEsMSwzLDR9OwppbnQgbWFpbigpCnsKCWludCAqcDI9dXBwZXJfYm91bmQoYSxhKzQsMSk7CgogICAgY291dCA8PCAidXBwZXJfYm91bmQgcmV0dXJuZWQgZWxlbWVudCAiIDw8IHAyLWEgPDwgJ1xuJyA7CgoJY291dDw8ICJ3aGljaCBpcyAiIDw8ICpwMjw8ZW5kbDsKfQ==