#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); long long N,M; cin >> N >> M; vector T(N); for(auto &t : T) cin >> t; vector> A(N,vector(N)); for(auto &h : A) for(auto &w : h) cin >> w; int n = 1500; vector> day(n+1,vector(N)),OK = day; day.at(0) = T; priority_queue,vector>,greater<>> Q; for(int i=0; i d){ OK.at(let).at(pos)--; Q.push({day.at(let-1).at(pos),let,pos}); continue; } day.at(let).at(pos) = d; for(int to=0; to n){ long long d1 = day.at(n).at(i),d2 = day.at(n-1).at(i); long long more = M-n,d = d1-d2; cout << more*d+d1 << " "; } else cout << day.at(M).at(i) << " "; } cout << endl; }