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