fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin>>t;
  7. while(t--){
  8. int a,b;
  9. cin>>a>>b;
  10. int d=a%b;
  11. if (d==0) cout<<0<<endl;
  12. else cout<< b-d<<endl;
  13. }
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5284KB
stdin
5
10 4
13 9
100 13
123 456
92 46
stdout
2
5
4
333
0