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 int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

int N;
int A[110];
int dp[110];

int solve(int j) {
    REP(i, 110) dp[i] = 1LL << 30;
    dp[1] = 0;
    FOR(i, 1, N + 2) {
        FOR(k, 1, j + 1) {
            int nxt = min(N + 2, i + k);
            if (!A[nxt]) dp[nxt] = min(dp[nxt], dp[i] + 1);
        }
    }
    return dp[N + 2];
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> N;
    REP(i, N) cin >> A[i + 2];
    FOR(j, 1, N + 2) {
        if (solve(j) == 1LL << 30) continue;
        cout << j << endl;
        return 0;
    }
}

C++: #include <iostream>

using namespace std;
int main(){
  int N,A[101];
  std::cin >> N;
  int max=0;
  int count=0;
  bool flag=false;
  for(int i=0;i<N;i++){
    std::cin >> A[i];
    if(A[i]==1){
      count++;
    }else{
      count=0;
    }

    if(count>max)max=count;
  }


  std::cout << max+1 << '\n';
}

C++: #include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint a(n);
  rep(i, n) cin >> a[i];

  int ans = 0;
  int idx = 0;
  while(idx < n) {
    int cnt = 0;
    while(idx < n && a[idx++] == 1) ++cnt;
    chmax(ans, cnt+1);
  }
  cout << ans << endl;

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>

using namespace std;

int main()
{

	int a = 0, b = 0, c = 0, d = 0, e = 0, maxy = 0, max = -1, ans = 1, count = 0, min = 0;

	int yoko = 0, tate = 0;
	std::string output, output2, output3, input = {};
	bool okada = false;
	int array[1000];


	cin >> a ;
	for (int i = 0; i < a; i++) {
		cin >> array[i];
	}
	for (int i = 0; i < a; i++) {
		if (array[i] == 1) {
			count++;
		}
		if (array[i] == 0||i==a-1) {
			max = std::max(count, max);
			count = 0;
		}
	
	}
	cout << max + 1 << endl;
	
}

C++: #include<iostream>
using namespace std;
int main(){

	int n,a,m,l=0,k=0;
	cin>>n;
	for(int i=0;i<n;i++){
	cin>>a;
	if(a==1){
		k=k+1;
		if(l<k){
		l=k;
		}
	}
	else{k=0;}
	}



	cout<<l+1<<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 A_count[100];
	A_count[0] = 1;
	for (int i = 0; i < n; i++)
	{
		cin >> A;
		if (A == 1)
		{
			if (A == _A)
			{
				A_count[k]++;
			}
			else
			{
				k++;
				A_count[k] = 2;
			}
		}
		_A = A;
	}
	sort(A_count, A_count + k + 1);
	cout << A_count[k] << endl;

	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int N;
    int ans=0,cnt=1;

    cin >> N;
    for(int i=0; i<N; ++i) {
        int temp;
        cin >> temp;
        if(temp==1) ++cnt;
        else {
            ans=max(ans,cnt);
            cnt=1;
        }
    }
    cout << max(ans,cnt) << endl;
    return 0;
}

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

int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin>>A[i];

    int ans = 1;
{
    int one = 1;
    for(auto p:A){
        if(p == 1) one++;
        if(ans < one) ans = one;
        if(p == 0) one = 1;
    }
}

    cout<<ans<<endl;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define check if (false_max > final) final = false_max

int main() {
	int n, temp; cin >> n; 
	int false_max = 0; int final = 0;
	rep(i, n) {
		cin >> temp;
		if (temp == 1) false_max++;
		else { check; false_max = 0; }
	}
	check; cout << final + 1 << endl;
	return 0;
}

C++: // 2018/12/17 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int N;
	cin >> N;

	int cnt = 0;
	int cnt_max = -1;

	for(int i=0; i<N; i++){
		int A;
		cin >> A;

		if(A==0){
			cnt = 0;
		}
		else{
			cnt++;
		}

		if(cnt_max<cnt){
			cnt_max = cnt;
		}
	}

	cout << cnt_max+1 << endl;

	return 0;
}

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

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

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int n; cin >> n;
    vector<int> a(n+2);
    REP(i, 1, n+1) cin >> a[i];
    int res = 0, cnt = 0;
    REP(i, 1, n+1) {
        if(a[i] == 1) cnt++;
        if(a[i] == 0) cnt = 0;
        res = max(res, cnt);
    }
    cout << res + 1 << '\n';
    return 0;
}

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

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

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,c,i,n;
	b=0;
	c=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(a==1){
			b=b+1;
		}
		if(a==0){
			c=b;
			b=0;
		}
	}
	if(b>c){
		b=b+1;
		printf("%d\n",b);
	}
	else{
		c=c+1;
		printf("%d\n",c);
	}
	
	
	return 0;
}

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

int main()
{
	int N;
	cin >> N;
	vector<int> A(N + 2, 0);
	for (int i = 0; i < N; i++) {
		cin >> A[i + 1];
	}
	int res = 1, last = -1;
	for (int i = 0; i < N + 2; i++) {
		if (A[i] == 0) {
			res = max(res, i - last);
			last = i;
		}
	}
	cout << res << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[100],count=0,mem=0;
  for(int i=0;i<n;i++){
    while(1){
      
      cin>>a[i];
      if(a[i]==1){
	count++;
	if(mem<count) mem=count;
	break;
      }
      count=0;
      break;
    }
  }
    cout<<mem+1<<endl;
  return 0;
}

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

int main()
{
	int n;
	int a[100 + 1] = { 0 };

	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	int max = 0;
	int temp = 0;
	for (int i = 0; i <= n; i++) {
		if ((a[i] == 0) && (max < temp)) {
			max = temp;
			temp = 0;
		}
		else if (a[i] == 1)
		{
			temp++;
		}
		else if (a[i] == 0)
		{
			temp = 0;
		}
	}

	cout << max + 1 << endl;

	return 0;
}

C++: n = int(input())
a = list(map(int,input().split()))
for i in range(1,n):
    if a[i] > 0:
        a[i] += a[i-1]
print(max(a[i])+1)