fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. #define int long long
  5. #define yes cout << "YES\n";
  6. #define no cout << "NO\n";
  7.  
  8.  
  9. void FastIO(){
  10. ios_base::sync_with_stdio(false);
  11. cin.tie(nullptr);
  12. cout.tie(nullptr);
  13. }
  14.  
  15. void solve(){
  16. int n,x;
  17. cin >> x >> n;
  18.  
  19. if(n%2 == 0){
  20. cout << 0 << '\n';
  21. }
  22. else{
  23. cout << x << "\n";
  24. }
  25. }
  26.  
  27. signed main(){
  28. FastIO();
  29.  
  30. int t;
  31. cin >> t;
  32.  
  33. while(t--){
  34. solve();
  35. }
  36. return 0;
  37. }
Success #stdin #stdout 0s 5316KB
stdin
4
1 4
2 5
3 6
4 7
stdout
0
2
0
4