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>;
#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 <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;
#define HERE cout<<"    "<<"HERE"<<en

int main(){
  int n;
  cin>>n;
  int a[105];
  for(int i=1; i<=n; i++) cin>>a[i];
  
  int maxl=0;
  for(int i=1; i<=n; i++){
    int renzoku=0;
    if(a[i]==0) continue;
    for(int j=i; j<=n; j++){
      if(a[j]) renzoku++;
      else break;
    }
    maxl=max(maxl,renzoku+1);
  }
  
  cout<<maxl<<en
}

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

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,a,i,MAX,cnt;
	scanf("%d",&n);
	MAX=1;
	cnt=1;
	for(i=1;i<=n;i++){
		scanf("%d",&a);
		if(a==1){
			cnt++;
		}
		else{
			cnt=1;
		}
		MAX=max(cnt,MAX);
	}
	printf("%d\n",MAX);
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;
#define HERE cout<<"    "<<"HERE"<<en

int main(){
  int n;
  cin>>n;
  int a[105];
  for(int i=1; i<=n; i++) cin>>a[i];
  
  int maxl=0;
  for(int i=1; i<=n; i++){
    int renzoku=0;
    for(int j=i; j<=n; j++){
      if(a[j]) renzoku++;
      else break;
    }
    maxl=max(maxl,renzoku+1);
  }
  
  cout<<maxl<<en
}

C++: #include<stdio.h>
#include<iostream>
#include<cmath>
using namespace std;

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

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;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<map>
#include<list>
#include<set>
using namespace std;
int main(){
int n;
int a[101];
int los=0,ans=1;
cin >> n;
for(int i=1;i<=n;i++){
cin >> a[i];
}
a[n+1]=0;
for(int i=0;i<=n+1;i++){
if(a[i]==0){
ans=max(ans,i-los);
los=i;
}
}
cout << ans << endl;
return (0);
}

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

#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
  vector<int> v;
  int n, ans, len;
  
  cin >> n;
  v.push_back(0); // furidashi
  for (int i=0; i<n; i++){
    int t; cin >> t;
    v.push_back(t);
  }
  v.push_back(0); // agari
  ans = len = 0;
  for (int i=1; i<=n+1; i++){
    if (v[i]==1) len++;
    else {
      ans = MAX(ans, len+1);
      len=0;
    }
  }
  cout << ans << endl;
  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=-9239;
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;}
}ans=max(ans,conti);
cout<<ans+1<<endl;

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

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

    int out = 0, d = 0;
    for (int i=0; i < n+1; i++) {
        if (A[i] == 1) out++;
        else {
            d = max(out+1, d);
            out = 0;
        }
    }

    cout << d << endl;
}

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

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

    int ans = n + 1;
    for(int tans = 1; tans <= n; ++tans) {
        vector<bool> reach(n + 2);
        function<bool(int)> dfs = [&](int now) {
            reach[now] = true;
            if(now == n + 1) return true;
            bool res = false;
            for(int mv = 1; mv <= tans && now + mv <= n + 1; ++mv) {
                const int nxt = now + mv;
                if(reach[nxt] || a[nxt] == 1) continue;
                res |= dfs(nxt);
            }
            return res;
        };
        if(dfs(0)) {
            ans = tans;
            break;
        }
    }
    cout << ans << endl;
}