Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
- int main()
- {
- int m,n,res,x,y;
- cin>>m>>n;
- for(int i=0;i<m;i++)
- {
- cin>>x>>y;
- if(i==0)
- {
- if(y>n)res=x+n-y;
- else res=x;
- }
- else
- {
- if(y>n)res=max(res,x+n-y);
- else res=max(res,x);
- }
- }
- cout<<res<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement