#include #include using namespace std; using namespace atcoder; typedef long long ll; typedef modint998244353 mint; typedef vector vi; typedef vector vvi; typedef vector vl; typedef vector vvl; typedef vector vm; typedef vector vvm; typedef vector vc; typedef vector vvc; typedef vector vs; typedef vector vvs; typedef vector vb; typedef vector vvb; typedef pair pii; typedef pair ppii; typedef pair pll; typedef pair ppll; #define REP(i,n) for(int i=0, i##_len=(n); ibool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> N; vvl A(N, vl(5)); REP(i, N) REP(j, 5){ cin >> A[i][j]; } vi ls; REP(i, 1 << 5) { vector tmp; REP(j, N) { ll s = 0; REP(k, 5){ if (((i >> k) & 1) == 0){ s += A[j][k]; } else { s -= A[j][k]; } } tmp.emplace_back(s, j); } sort(ALL(tmp)); ls.emplace_back(tmp[0].second); ls.emplace_back(tmp[N - 1].second); } REP(k, N){ ll ans = 0; REP(i, 64){ ll s = 0; REP(j, 5){ s += abs(A[k][j] - A[ls[i]][j]); } ans = max(ans, s); } cout << ans << endl; } return 0; }