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(void)
{
    int N,i,j;
    int counter=0,ans=1;
    int a[N];
    cin>>N;
    for(i=1;i<=N;i++)
    {
        cin>>a[i];
    }
    a[N+1]=0;
    for(j=1;j<=N+1;j++)
    {
        if(a[j]==0)
        {
            ans=max(ans,j-counter);
            counter=j;
        }
    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+2;
			}
			else{
				cnt++;
			}
		}
		else if(a[i]==0){
			cnt=0;
		}
	}
	cout<<cnt+2<<endl;
	
	return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
main(){
  int N,i,f=1,m=1;
  cin>>N;
  int A[N];
  for(i=0;i<N;i++){
    cin>>A[i];
    if(A[i]==1){f++;if(f>m)m=f;}else{f=1;}
  };
  cout<<m<<endl;
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n,i,a,ans = 0;cin >> n;vector<int> safe{0};
    for(i=1;i<=n;i++){
        cin >> a;
        if(a == 0) safe.push_back(i);
    }
    safe.push_back(n+1);
    for(i=1;i<safe.size();i++){
        ans = max(ans,safe[i]-safe[i-1]);
    }
    cout << ans << endl;
}

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

int main(){
    int N, count, MAXcount;
    count = 1;
    MAXcount  = 1;
    cin >> N;

    for (int i = 0; i < N; i++){
        int tmp;
        cin >> tmp;
        if (tmp == 1){
            count++;
            MAXcount = max(MAXcount, count);
        } else {
            count = 1;
        }
    }

    cout << MAXcount << endl;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
int main(void)
{
	int N, count, max_count = 0;
	cin >> N;
	vector<int> masu(N);
	rep(i, N) cin >> masu[i];
	rep(i, N)
	{
		count = 0;
		while(masu[i+count]==1)
		{
			count++;
		}
		max_count = max(max_count, count);
		i += count;
	}
	cout << max_count+1 << endl;
}

C++: #include<stdio.h>
int main(){
	int N;
	int A[102];
	scanf("%d",&N);
	for(int i = 1 ; i <= N ; i ++){
		scanf("%d",&A[i]);
	}
	A[N+1] = 0;
	
	int ans = 1;
	int loc = 0;
	for(int i = 1 ; i <= N+1 ; i ++){
		if(A[i] == 0){
			if(ans < i-loc)	ans = i-loc;
			loc = i;
		}
	}
	printf("%d\n",ans);
}

C++: #include<iostream>
#include<cstdio>
int main(void)
{
	int N=0,all=1,b=1;
	scanf("%d",&N);
	int A_i[N]={0};
	for(int i=0;i<N;i++)
	{
		scanf("%d",&A_i[i]);
		if(A_i[i]==1)
		{
			b++;
		}
		else
		{
			if(all<b){
				all=b;
			}
			b=1;
		}
	}
	if(all<b){all=b;}
	printf("%d\n",all);
	return 0;
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define roop(a,t) for(int a=0;a<t;a++) 
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
int n;
cin>>n;
int u[100];
int ans=0;
int conti=0;
for(int i=0;i<n;i++){
cin>>u[i];
if(u[i]==1){conti++;}
else{ans=max(ans,conti);conti=0;}
}cout<<ans+1<<endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int n; cin >> n;

	int p = 0,now;
	int cnt = 0;
	int ans = -1;

	for (int i = 0;i < n;i++){
		cin >> now;
		if(now == 1 && p == 1) cnt++;
		else if(now == 1) cnt = 1;
		else{
			ans = max(ans,cnt+1);
			cnt = 0;
		}
		p = now;
	}

	ans = max(ans,cnt+1);

	cout << ans << endl;

	return 0;

}

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

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

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

using namespace std;

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

	vector<int> a(n+3, 0);
	for (int i = 2; i <= n+1; i++) {
		cin >> a[i];
	}

	if (accumulate(a.begin(), a.end(), 0) == 0) { cout << 1 << endl; return 0; }

	int counter = 0;
	int maxcount = 0;
	for (int i = 2; i <= n+1; i++) {
		if (a[i] == 1 && a[i - 1] == 1) { counter++; }
		else { counter = 0; }
		maxcount = max(counter, maxcount);
	}
	cout << maxcount + 2 << endl;

}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
    int n, a[105]{}, ans=1, l=1;
    cin >> n;
    REP(i,n) cin >> a[i+1];
    REP(i,n+1){
        if(a[i+1]==1){
            l++;
        }
        else{
            ans = max(ans, l);
            l=1;
        }
    }
    cout << ans << endl;
    return 0;
}

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

bool sugoroku[120] = {0};

int solve(int n) {
    int maxDice = 0;
    int temp = 0;
    for (int i = 0; i <= n; i++) {
        temp++;
        if (sugoroku[i] == true) {
            continue;
        }
        maxDice = max(maxDice, temp);
        temp = 0;
    }
    return maxDice;
}

int main() {
    int n = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> sugoroku[i];
    }
    printf("%d\n", solve(n));
    return 0;
}

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

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

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){
			cnt++;
		}
		else if(a[i]==0){///???
			cnt=0;
		}
	}
	cout<<cnt+2<<endl;///????
	
	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 = max(m,j);
		}
		else{
			j = 1;
		}
	}

	cout << m << endl;

	return 0;
}

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

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