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 <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

int main() {
    int n;
    cin >> n;
    int a, ans = 1, cnt = 0;
    bool renzoku = false;
    rep (i, n) {
        int a;
        cin >> a;
        if (a) {
            if (renzoku) cnt++;
            else cnt = 2, renzoku = true;
        }
        else {
            if (renzoku) ans = max(ans, cnt), renzoku = false, cnt = 0;
        }
        if (i == n - 1) ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
int n,a,cnt=0,ans=0;
cin >> n;
for(int i=0;i<n;i++){
cin >> a;
if(a==1){
cnt++;
ans=max(ans,cnt);
}
else if(a==0){
cnt=0;
}
}
cout << ans+1 << endl;
return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int N,A[10000],count=0,save=0;
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>A[i];
    if(A[i]==1){
      count++;
      if(i==N-1){
        if(save<count){
          save=count;
          count=0;
        }
      }
      
    }
    else if(A[i]==0){
      if(save<count){
        save=count;
        count=0;
      }else
        count=0;
    }
  }
  cout<<save+1<<endl; 
}