fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int t;
  7. cin>>t;
  8. while(t--){
  9. int res=0,A,B;
  10. cin>>A>>B;
  11. while(A>0 && B>0){
  12. if(A-1>=0 && B-2>=0){
  13. res+=3;
  14. A-=1;
  15. B-=2;
  16. }
  17. }
  18. cout<<res<<endl;
  19. }
  20.  
  21. }
  22.  
Success #stdin #stdout 0.01s 5284KB
stdin
45
stdout
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0