Go: package main

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

func main() {

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	ma, _ := strconv.Atoi(sc.Text())

	sc.Scan()
	args := strings.Split(sc.Text(), " ")

	value := []int{}
	for _, v := range args {
		a, _ := strconv.Atoi(v)
		value = append(value, a)

	}
	ans(ma, value)

}

func ans(n int, value []int) {

	max := 0
	cnt := 0

	for i := 0; i < n; i++ {

		if value[i] == 1 {
			cnt++
		} else {
			if cnt > max {
				max = cnt
			}
			cnt = 0
		}
	}

	if cnt > max {
		max = cnt
	}

	fmt.Printf("%d\n", max+1)
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
using ll = long long;
using namespace std;

int a[110];
int main(void)
{
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i)
        cin >> a[i];

    int minV = 0;

    int cnt = 0;
    for (int i = 0; i < N; ++i)
    {
        if (a[i] == 1)
        {
            cnt++;
        }
        else
        {
            if (cnt != 0)
                minV = max(minV, cnt + 1);
            cnt = 0;
        }
    }
    minV = max(minV, cnt + 1);
    cout << minV << endl;
    return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

class UnionFind {
  vector<int> tree, rank, setSize;

public:
  UnionFind(const int &n) : tree(n), rank(n), setSize(n, 1) { iota(all(tree), 0); }

  int root(const int &x) { return tree[x] == x ? x : tree[x] = root(tree[x]); }

  bool same(const int &a, const int &b) { return root(a) == root(b); }

  bool unite(int a, int b) {
    a = root(a), b = root(b);
    if (a == b) return false;
    if (rank[a] < rank[b]) swap(a, b);
    tree[b] = a;
    setSize[a] += setSize[b];
    if (rank[a] == rank[b]) rank[a]++;
    return true;
  }

  int setSizeOf(const int &x) { return setSize[root(x)]; }

  int size() { return tree.size(); }
};

main() {
  int n = in();
  vector<int> a(n);
  cin >> a;
  UnionFind uf(n);
  loop(i, 1, n) if (a[i - 1] && a[i]) uf.unite(i - 1, i);
  int ans = 0;
  rep(i, n) cmax(ans, uf.setSizeOf(i));
  cout << ans + 1 << endl;
}

C++: // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0642



#include<iostream>
 using namespace std; //標準名前空間を使用


    int main(){

    int sugorokunomasu[110] ;
    int N ;
    int saidairenzokusuucount = 0 ; // 1の最大連続数カウント
    int saidairenzokusuucountmax = 0 ; // 1の最大連続数の最大値

    cin >> N ;


            for (int i = 1 ; i <= N ; i = i + 1 ){
             cin >> sugorokunomasu[i] ; //すごろくのマスの読み込み

                    if(sugorokunomasu[i] == 1){ // すごろくのマスに1が出てきた場合

                        saidairenzokusuucount =  saidairenzokusuucount + 1 ; //そうでなければ、1の最大連続数カウントに1を+


                        // 1の最大連続数の最大値を更新されているかの判定
                        if(saidairenzokusuucount > saidairenzokusuucountmax) 
                        { 
                        saidairenzokusuucountmax = saidairenzokusuucount ; //更新されていれば、1の最大連続数の最大値を更新
                        }else{
                        //最大値を更新しない場合は何もしない
                        }
                        


                    }else{ //すごろくのマスに0が出てきた場合

                        // 1の最大連続数の最大値を更新されているかの判定
                        if(saidairenzokusuucount > saidairenzokusuucountmax) 
                        { 
                        saidairenzokusuucountmax = saidairenzokusuucount ; //更新されていれば、1の最大連続数の最大値を更新
                        saidairenzokusuucount = 0 ; //1の最大連続数カウントをフラッシュして0に
                        }else{
                        //最大値を更新しない場合は何もしない
                        saidairenzokusuucount = 0 ; //1の最大連続数カウントをフラッシュして0に
                        }

                    
                    
                    }

                


            }


    cout << saidairenzokusuucountmax + 1 << endl ;

    /* デバッグ用
    cout << sugorokunomasu[1] ;
    cout << sugorokunomasu[2] ;
    cout << sugorokunomasu[3] ;
    cout << sugorokunomasu[4] ;
    cout << sugorokunomasu[5] ;
    */

    }

C++: 
//18-2 すごろく
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<math.h>
#include<time.h>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<set>
#include<stack>
#include<cstdlib>
#include<algorithm>
#include<random>
#include<cassert>
using namespace std;
#define LL long long
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define ROOP() while(true)

int main(){
    int N;
    int A[100];
    cin >> N;
    int ans = 1;
    int tmp = 0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        if(A[i] == 1){
            tmp++;
            ans = max(ans,tmp+1);
        }
        else{
            tmp = 0;
        }
    }
    cout << ans << endl;

    return 0;
}

C++: #include<iostream>;
#include<algorithm>;
using namespace std;

int main()
{
	//2.すごろく	
	int n;
	cin >> n;
	int A, _A = 1;
	int k = 0;
	int count[100];
	count[k] = 1;
	for (int i = 0; i < n; i++)
	{
		cin >> A;
		if (A == 1)
		{
			if (A == _A)
			{
				count[k]++;
			}
			else
			{
				k++;
				count[k] = 2;
			}
		}
		_A = A;
	}
	sort(count, count + k);
	cout << count[k] << endl;

	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1e9 + 7;
const long long INF = 1LL << 60;

int main() 
{
    int n; cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int cnt = 0;
    int k = 0;
    for(int i = 0; i < n; i++){
        if(a[i] == 1){
            cnt++;
            k = max(k,cnt);
        }else{
            cnt = 0;
        }
    }
    cout << k+1 << endl;
}