fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int t;
  7. cin>>t;
  8. while(t--)
  9. {
  10. int a,b;
  11. cin>>a>>b;
  12. if((a-b)>a)
  13. cout<<a<<"\n";
  14. else
  15. cout<<(a-b)<<"\n";
  16.  
  17. }
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5524KB
stdin
3
2 1
3 2
3 1
stdout
1
1
2