Hanging Posters

  • [deleted]
    + 0 comments
    /*
    	By: harshvcode | harshvsingh.223@gmail.com
    	Created at: 03:46:09_PM_21-JUNE-2020
    */
    #include <bits/stdc++.h>
    #define LL long long
    #define M 1000000009
    #define NL '\n';
    #define PB push_back
    #define Ai vector<int> arr
    using namespace std;
    int main()
    {
    	ios::sync_with_stdio(0);
      	cin.tie(0);
    	int n,h;
    	cin >> n >> h;
    	int ans=0;
    	Ai(n),len(n);
    	for(int i=0; i<n ;i++) cin >> arr[i];
    	for(int i=0; i<n; i++) cin >> len[i];
    	for(int i=0; i<n; i++){
    		int checker=arr[i] - h;
    		if(checker < 1) continue;
    		ans=max(ans,(checker - (len[i] / 4)));
    	}
    	cout << ans << NL;
    	return 0;
    }