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. for(int i=1;i<=n;i++){
  12. for(int j=1;j<=m;j++){
  13. cout<<i<<" "<<j<<endl;
  14. }
  15. }
  16. }
  17.  
  18. int32_t main(){
  19. fast_io;
  20. int t=1;
  21.  
  22. while(t--) solve();
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 5320KB
stdin
2 2
stdout
3
1 1
1 2
2 1
2 2