#include <iostream>
using namespace std;
void swap(int &a, int &b);
int &max(int &a, int &b);
int main() {
int a = 12;
int b = 99;
cout << a << ' ' << b << endl;
swap(a, b);
cout << a << ' ' << b << endl;
max(a, b) = 100;
cout << a << ' ' << b << endl;
return 0;
}
void swap(int &a, int &b) {
int t = a;
a = b;
b = t;
}
int &max(int &a, int &b) {
if (a > b) {
return a;
} else {
return b;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBzd2FwKGludCAmYSwgaW50ICZiKTsKaW50ICZtYXgoaW50ICZhLCBpbnQgJmIpOwoKaW50IG1haW4oKSB7CglpbnQgYSA9IDEyOwoJaW50IGIgPSA5OTsKCgljb3V0IDw8IGEgPDwgJyAnIDw8IGIgPDwgZW5kbDsJCgkKCXN3YXAoYSwgYik7CgoJY291dCA8PCBhIDw8ICcgJyA8PCBiIDw8IGVuZGw7CQoKCW1heChhLCBiKSA9IDEwMDsKCgljb3V0IDw8IGEgPDwgJyAnIDw8IGIgPDwgZW5kbDsJCgoJcmV0dXJuIDA7Cn0KCnZvaWQgc3dhcChpbnQgJmEsIGludCAmYikgewoJaW50IHQgPSBhOwoJYSA9IGI7CgliID0gdDsKfQoKaW50ICZtYXgoaW50ICZhLCBpbnQgJmIpIHsKCWlmIChhID4gYikgewoJCXJldHVybiBhOwoJfSBlbHNlIHsKCQlyZXR1cm4gYjsKCX0KfQoK