#include <iostream>
#include <functional>
typedef int (*FPtr)(int);
int add(std::function<int (int)> f, int x, int y) {
return f(x) + f(y);
}
int func3(int a, int x) {
return a*x;
}
int main()
{
std::cout << add(std::bind(func3, std::placeholders::_1, 4), 2, 3) << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnVuY3Rpb25hbD4KCnR5cGVkZWYgaW50ICgqRlB0cikoaW50KTsKCmludCBhZGQoc3RkOjpmdW5jdGlvbjxpbnQgKGludCk+IGYsIGludCB4LCBpbnQgeSkgewogIHJldHVybiBmKHgpICsgZih5KTsKfQoKaW50IGZ1bmMzKGludCBhLCBpbnQgeCkgewogIHJldHVybiBhKng7Cn0KCmludCBtYWluKCkKewogIHN0ZDo6Y291dCA8PCBhZGQoc3RkOjpiaW5kKGZ1bmMzLCBzdGQ6OnBsYWNlaG9sZGVyczo6XzEsIDQpLCAyLCAzKSA8PCBzdGQ6OmVuZGw7Cn0gCg==