#include using namespace std; #define FOR(i,a,b) for(int i=a ; i> N; FOR(i,1,N+1) cin >> T[i] >> P[i]; FOR(i,1,N+2) FOR(j,1,i) if(T[i-j] - j