Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func maxValue(p []int) int {
	highest := 0
	for i := 0; i < len(p); i++ {
		if p[i] > highest {
			highest = p[i]
		}
	}
	return highest
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		n := nextInt()
		m := nextInt()
		if n == 0 && m == 0 {
			break
		}

		pSum := make([]int, n)
		for i := 0; i < m; i++ {
			for j := 0; j < n; j++ {
				pSum[j] += nextInt()
			}
		}
		fmt.Println(maxValue(pSum))
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
const double PI = acos(-1);

ll A[1050][100]; // i人目 j科目

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll N, M;

    // N 人数
    // M 科目数

    while(cin>>N>>M){
      if(N==0&&M==0) return 0;

      // i科目目
      rep(i, M){
        // 
        rep(j, N){
          cin >> A[j][i];
        }
      }
      // i人目のスコア
      ll ma = 0;
      rep(i, N){
        ll score = 0;
        rep(j, M){
          score += A[i][j];
        }
        chmax(ma, score);
      }
      p(ma);
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	for( ;; ) {
		int n, m;
		cin >> n >> m;

		if( n == 0 && m == 0 ) {
			break;
		}

		vector<int> p( n );
		for( int i = 0; i < m; ++i ) {
			for( int j = 0; j < n; ++j ) {
				int x;
				cin >> x;

				p.at( j ) += x;
			}
		}

		int result = 0;
		for( auto v: p ) {
			result = max( result, v );
		}

		cout << result << endl;
	}
}

C++: #include <bits/stdc++.h>
#include <type_traits>
using namespace std;

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

void solve(int n, int m) {
  vi vec(n);
  rep(i, m) rep(j, n) {
    int a; std::cin >> a;
    vec[j] += a;
  }
  int ans = *max_element(rng(vec));
  std::cout << ans << "\n";
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  while (1) {
    int n, m; std::cin >> n >> m;
    if (n == 0 && m == 0) break;
    solve(n, m);
  }
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	lint N, M;
	while (cin >> N >> M) {
		if (N == 0 && M == 0) {
			return 0;
		}
		vector<vector<lint>>A(M, vector<lint>(N));
		rep(i, M) {
			rep(j, N) {
				cin >> A[i][j];
			}
		}
		lint ans = -1;
		lint sum = 0;
		rep(i, N) {
			rep(j, M) {
				sum += A[j][i];
			}
			ans = max(ans, sum);
			sum = 0;
		}
		cout << ans << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 100100100100100;
const ll mod = 1000000007;
int main(){
    int n,m;
   while(cin>>n>>m){
    if(n==0||m==0) return 0;
    ll ans=0;
    vector<vector<int>> a(m,vector<int>(n,0));
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            cin>>a.at(i).at(j);
        }
    }
    for(int i=0;i<n;i++){
        ll tmp=0;
        for(int j=0;j<m;j++){
            tmp+=a.at(j).at(i);
        }
        ans=max(ans,tmp);
    }
    cout<<ans<<endl;
   }
}