#include"stdio.h" long f(long a,long b) { return a/2+b/2; } int main() { int T; scanf("%d",&T); while(T--) { long c,b; scanf("%ld%ld",&c,&b); if(b>=c) printf("%ld\n",f(c,b)); else printf("%ld\n",f(b,c)); } return 0; }