storing matrix in vector
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define Code ios_base::sync_with_stdio(false);
#define by cin.tie(NULL);
#define black_heretic cout.tie(NULL);
#define fl(n) for (int i = 0; i < n; i++)
#define rl(m, n) for (int i = n; i >= m; i--)
typedef long long ll;
#define read(x) ll x; cin >> x
using namespace std;
// Remark: NIL.
void solve() {
int i, j, n, m;
cin >> m >> n; // rows and columns resp.
int arr[m][n];
// Original:
// vector<pair<int, int>> myVec (N, std::make_pair(-1, -1));
// The second argument to that constructor is the initial value that the N pairs will take.
vector<pair<int, int>> cordinates;
for(i = 0; i < m; ++i){
for(j = 0; j < n; ++j){
cin >> arr[i][j];
if(arr[i][j] == 1){
cordinates.push_back(make_pair(i, j));
}
}
}
for (auto it = cordinates.begin(); it!=cordinates.end(); ++it) {
cout << it->first << " " << it->second << endl;
}
return;
}
signed main(){
Code by black_heretic
// read(t); while(t--)
solve();
return 0;
}