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>
using namespace std;

int main(){
	int n,a,c,s;
	s=1;
	c=1;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		if(a==0){
			c=1;
			continue;
		}
		else{
			c++;
			if(s<c) s=c;
		}
	}
	cout<<s<<endl;
	return 0;
}

C++: #include<iostream>
#include<vector>

using namespace std;

int main()
{
	int n;
	int i;
	int counter=0;
	int max=0;
	
	int a[101];
	cin>>n;
	
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}	
		
	for(i=0;i<n;i++)
	{
		if(a[i]==1)
			counter++;
		else
		{
			if(max<counter)
				max=counter;
			counter=0;
		}
	}
	if(max<counter)
		max=counter;
		
		cout<<max+1;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,ans=0,m=0;
	cin>>n;
	for(int p=0;p<n;p++){
		cin>>k;
		if(k==1){
			m++;
		}else{
			m=0;
		}
		ans=max(m,ans);
	}
	cout<<ans+1<<endl;
}

C++: #include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
using namespace std;

int main() {
  int n; cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  int cnt = 0, tmp = 0;
  for (int i = 0; i < n; i++) {
    if (v.at(i) == 1) {
      cnt++;
    } else {
      cnt = 0;
    }
    tmp = max(cnt, tmp);
  }
  cout << tmp + 1 << endl;
}

C++: #include <iostream>

int main(){
    int N;
    std::cin >> N;
    
    int count=1;
    int max_count=1;
    int buf;
    for(int i=0;i<N;i++){
        std::cin >> buf;
        if(buf==1){
            count++;
        }else{
            count=1;
        }
        if(max_count<count){
            max_count=count;
        }
    }
    
    std::cout << max_count << std::endl;
    
    return 0;
}

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

int main()
{
	int n, m = 0, k = 0;
	bool f = 0;

	cin >> n;

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

		if (a)
			k++;
		else {
			if (k > m)
				m = k;
			k = 0;
		}
	}

	if (k > m)
		m = k;

	cout << m + 1 << endl;

	return 0;
}

C++: #include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    int n,memo = 0,ans = 0;
    cin >> n;
    int a[n];
    
    rep(i,0,n){
        cin >> a[i];
        memo++;
        if(a[i] == 0){
            ans = max(ans,memo);
            memo = 0;
        }
    }
    memo++;
    ans = max(ans,memo);
    
    cout << ans << endl;
    return 0;
}

C++: #include <iostream>

void solve() {
    int n;
    std::cin >> n;

    int ans = 0, cont = 0;
    while (n--) {
        int a;
        std::cin >> a;

        if (a == 0) {
            cont = 0;
        } else {
            ++cont;
        }

        ans = std::max(ans, cont);
    }

    std::cout << ans + 1 << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}

C++: #include <iostream>
using namespace std;
#define rep(i,q) for(int i = 0; q > i; i++)
int main(){
  int N;
  cin >> N;
  int saityo = 0;
  int nagasa = 0;
  rep(i,N){
    int tmp;
    cin >> tmp;
    if(tmp == 1) nagasa++;
    else {
      if(saityo < nagasa) saityo = nagasa;
      nagasa = 0;
    }
  }
  if(saityo < nagasa) saityo = nagasa;
  cout << saityo + 1 << endl;
}

C++: #include "iostream"
#include "string"
#include "algorithm"
using namespace std;
/*
struct dice {
	int s[6];
	void roll(char c) {
		int b;
		if (c == 'E') {
			b = s[0];
			s[0] = s[3];
			s[3] = s[5];
			s[5] = s[2];
			s[2] = b;
		}
		if (c == 'N') {
			b = s[0];
			s[0] = s[1];
			s[1] = s[5];
			s[5] = s[4];
			s[4] = b;
		}
		if (c == 'S') {
			b = s[0];
			s[0] = s[4];
			s[4] = s[5];
			s[5] = s[1];
			s[1] = b;
		}
		if (c == 'W') {
			b = s[0];
			s[0] = s[2];
			s[2] = s[5];
			s[5] = s[3];
			s[3] = b;
		}
		if (c == 'R') {
			b = s[1];
			s[1] = s[3];
			s[3] = s[4];
			s[4] = s[2];
			s[2] = b;
		}
	}
	int top() {
		return s[0];
	}
	int right() {
		return s[2];
	}
	int left() {
		return s[3];
	}
	int front() {
		return s[1];
	}

};

int main() {
	dice d;
	for (int i = 0; i < 6; i++) {
		cin >> d.s[i];
	}
	int order;
	cin >> order;
	while(order--) {
		int top, front;
		cin >> top >> front;
		if (d.left() == top) {
			d.roll('E');
		}
		if (d.right() == top) {
			d.roll('W');
		}
		while (d.top() != top) {
			d.roll('N');
		}
		while (d.front() != front) {
			d.roll('R');
		}
		cout << d.right() << endl;
	}
}
*/

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

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

	int n;
	cin >> n;
	int j = 1;
	int m = 1;

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

		if( a == 1 ){
			j++;
			m = max(m,j);
		}
		else{
			j = 1;
		}
	}

	cout << m << 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>
#include <algorithm>

using namespace std;

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

    int a, one_continue_count = 0;
    
    int sol = 0;
    for ( int i=0; i<n; ++i ) {
	cin >> a;
	if ( a == 0 ) {
	    sol = max( sol, one_continue_count );
	    one_continue_count = 0;
	}
	else {
	    ++one_continue_count;
	}
    }
    sol = max( sol, one_continue_count );
    cout << sol+1 << endl;
}

C++: #include<iostream>
int main()
{
	int N;
	int A[100];
	int ans = 1;
	int anss = 1;
	int a = 0;
	std::cin >> N;
	for (int i = 0; i < N; i++) {
		std::cin >> A[i];
		if (A[i] == 1) {
			a += 1;
		}
	}
	for (int i = 1; i < N; i++) {
		if (A[i] == 1 && A[i - 1] == 1) {
			ans += 1;
			if (ans > anss) {
				anss = ans;
			}
		}
		else {
			ans = 1;
		}
	}
	if (a == 0) {
		anss = 1;
	}
	else {
		anss += 1;
	}
	std::cout << anss << std::endl;
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int N, i, a, b, c, d, x=1, y=0;
    int bm, dm, as;

    cin >> N;
    for (i = 0;i < N; i++) {
        cin >> a;
        if (a == 0) x = 0;
        x++;
        if (x > y) y = x;
    }

    cout << y << endl;
    return 0;
}

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

C++: #include<iostream>
#include<stdio.h>

using namespace std;

int main(){
	int n;
	int max = 1;
	int a[101];
	cin >> n;
	a[n + 1] = { 0 };
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for (int j = 1; j <= n; j++){
		if (a[j] == 1){
			for (int k = 1; k <= n+1; k++){
				if (a[j+k] == 0){
					if (max < k+1){
						max = k+1;
					}
					break;
				}
			}
		}
		
	}
	cout << max << endl;
	return 0;
}