#include using namespace std; typedef long long ll; #define REP(i, x, y) for (auto i = (x); i < (y); i++) #define RREP(i, x, y) for (auto i = (y) - 1; (x) <= i; i--) #define ALL(x) (x).begin(), (x).end() #pragma GCC optimize("O3") int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--){ int N, M; cin >> N >> M; cout << max((N+1)/2, (N+M+3)/4) << "\n"; } return 0; } /* File : ~/yukicoder/midoriika_3rd/C.cpp Date : 2024/10/12 Time : 14:33:27 */