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<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==0){
			b=0;
		}
		if(a==1){
			b=b+1;
		}
		if(c<b){
			c=b;
		}
	}
	c=c+1;
	printf("%d\n",c);
	
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#define rep(i,rept) for(long long i = 0; i <(long long)rept;i++)
using namespace std;
int main() {
	int a = 0, b = 0, c = 0, d[100000], e[100000], f = 0, g = 0, h = 0, count = 0,x=0,y=0,z=0;
	char rikka, toka[100000];
	string saya, homu, kyok, mami, mado[50];
	bool gg = true;
	int manji, nk[26] = { false };
	cin >> a;
	for (int i = 0; i < a; i++) {
		cin >> d[i];
	}
	for (int j = 0; j < a; j++) {
		if (d[j] == 1) {
			b++;
		}
		else { b = 0; }
		count = max(count, b);
	}
	cout << count + 1 << endl;
	return 0;
}

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

//n+2マス
//0か1が記載、1に止まると失格
//ゴールのマスに止まるか超過するとクリア
//n+1個のサイコロが存在し、j番目のマスは 1<x<j
//ゲームクリアが可能かつ面が最小のサイコロは？

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

	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}

	int no_1 = 0;
		
	for (int i = 0; i < n; i++)
	{
		if (a[i] == 1)
		{
			no_1 ++;
			//cout << no_1 << endl;
	
			if (a[i + 1] == 0)
			{
				max_1 = no_1 > max_1 ? no_1 : max_1;
				no_1 = 0;
			}
		}
	}

	int result = max_1 + 1;
	printf("%d\n", result);
}

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

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

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

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int ans = 0;
  int cnt = 0;
  FOR(i,0,n){
    int a; cin >> a;
    cnt++;
    if(a==0){
      ans = max(ans, cnt);
      cnt = 0;
    }
  }
  cnt++;
  ans = max(ans, cnt);
  cout << ans << endl;
}

C++: //2017
#include<iostream>
using namespace std;
int main(void){
	int i,n,a[100],cnt=0;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	for(i=0;i<n;i++){
		if(a[i]==1){
			if(a[i+1]==1){
				cnt+=2;
				i=i+1;
			}
			else{
				cnt++;
			}
		}
		else if(a[i]==0){
			cnt=0;
		}
	}
	cout<<cnt+1<<endl;
	
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
int N;
cin >> N;
int a[N];
int k=0;
for(int i=0;i<N;i++){
    cin >> a[i];
}

int flag;
int count=0;
for(int i=0;i<N;i++){
    if(a[i]==1 && flag==0){flag=1;count=1;}
    else if(a[i]==1){count++;}
     else if(k<count){flag=0;k=count;count=0;}
     else{flag=0;count=0;}
}
if(count>k)
k=count;
    cout << k+1 << endl;
    
}

C++: #include<iostream>
int main(){
    int n;
    std::cin>>n;
    
    int a[n];
    for(int i=0;i<n;i++){
        std::cin>>a[i];
    }
    int cnt=0,max=0;
    
    for(int i=0;i<n;i++){
        if(a[i]==0){
            cnt=0;
        }else{
            cnt++;
            if(cnt>max){
                max=cnt;
            }
        }
    }
    std::cout<<max+1<<"\n";
    return 0;
}

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

int main(){

  int N,cnt=1,tmp=1;
  
  cin>>N;

  int A[N];
  A[0]=0;
  A[N+1]=0;

  for(int i=1;i<N+1;i++){
    cin>>A[i];
    }

  for(int i=0;i<N+2;i++){
    if(A[i]==1){ 
cnt++;
    }
    if(A[i]==0){
      if(cnt>tmp){ tmp=cnt; }
      cnt=1;

    }
  }
  cout<<tmp<<endl;

  return 0;
}

C++: #include<stdio.h>

int main(){
	int n,a[100],m,l,ans=0,set=1;
	scanf("%d",&n);
	for(m=0;m<n;m++) scanf("%d",&a[m]);
	for(m=0;m<n;m++){
		if(a[m]==1)set++;
		else {
			set=1;
		}
		if(ans<set) ans=set;
	}
	printf("%d\n",ans);
	return 0;
}

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 = min(m,j);
		}
		else{
			j = 1;
		}
	}

	cout << m << endl;

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void)
{
    int N,i,j;
    int counter=0,ans=0;
    int a[N];
    cin>>N;
    for(i=0;i<N;i++)
    {
        cin>>a[i];
    }
    for(j=0;j<N;j++)
    {
        counter++;
        if(a[j]==0)
        {
            if(ans<counter)
            {
                ans=counter;
            }
            counter=0;
        }
        if(j==N-1&&a[j]==1&&ans<counter+1)
        {
            ans=counter+1;
        }
    }
    cout<<ans<<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(c<b){
			c=b;
		}
		if(b==0){
			b=0;
		}
	}
	printf("%d\n",c);
	
	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; 
}

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

using namespace std;

int main()
{
	int n;
	int i;
	int counter=0;
	int max=0;
	
	vector<int> a;
	int b;
	cin>>n;
	
	for(i=0;i<n;i++)
	{
		cin>>b;
		a.push_back(b);
	}	
		
	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<<endl;
}

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

int main() {
	int N, A, ans = 0;
	cin >> N;
	vector<int> a(1);
	for (int i = 1; i <= N; ++i) {
		cin >> A;
		if (0 == A) a.push_back(i);
	}
	a.push_back(1 + N);
	for (int i = 1; i < a.size(); ++i) ans = max(a[i] - a[i - 1], ans);
	cout << ans << endl;
}

C++: #include<stdio.h>

int main(){
  int N,surface,max,i;
  scanf("%d",&N);

  int A[N];
  for(i=0; i<N; i++){
    scanf("%d",&A[i]);
  }

  surface=0;
  max=1;
  for(i=0; i<N; i++){
    if(A[i]==1)
      surface++;
    else if(A[i]==0){
      if(max<surface+1)
	max=surface+1;
      surface=0;
    }
    if(max<surface+1)
      max=surface+1;
  }
  printf("%d\n",max);
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  int ans = 0, tmp = 0;
  for (int i = 0; i < n; i ++) {
    int t; cin >> t;
    if (t == 0) {
      ans = max(ans, tmp);
      tmp = 0;
    } else {
      tmp ++;
    }
  }
  ans = max(ans, tmp);
  cout << ans + 1 << endl;
}