SHARE
TWEET

codeforce - Lunch Rush

jakaria_hossain Mar 29th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
  4. int main()
  5. {
  6.     int m,n,res,x,y;
  7.     cin>>m>>n;
  8.     for(int i=0;i<m;i++)
  9.     {
  10.         cin>>x>>y;
  11.         if(i==0)
  12.         {
  13.             if(y>n)res=x+n-y;
  14.             else res=x;
  15.         }
  16.         else
  17.         {
  18.             if(y>n)res=max(res,x+n-y);
  19.             else res=max(res,x);
  20.         }
  21.     }
  22.     cout<<res<<endl;
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top