fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  4. #define int long long
  5. #define endl '\n'
  6.  
  7. void solve(){
  8. int n,m;
  9. cin>>n>>m;
  10. cout<<n+m-1<<endl;
  11. int i=1,j=1;
  12. while(i==n &&j==m){
  13. cout<<i<<" "<<j<<endl;
  14. j++;
  15. cout<<i<<" "<<j<<endl;
  16. i++;
  17. }
  18.  
  19. }
  20.  
  21.  
  22. int32_t main(){
  23. fast_io;
  24. int t=1;
  25.  
  26. while(t--) solve();
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0.01s 5316KB
stdin
2 3
stdout
4