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

	return 0;
}

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


int main(void){
    // 自分の得意な言語で
    // Let's チャレンジ！！

    string str;
    int N;
    int count = 0;
    int ConsecutiveOnes = 0;
    int Max_Ones = 0;
    int ThisNum;
    while(getline(cin, str)){
        stringstream ss;
        ss << str;
        if(count == 0){
            ss >> N;
        }
        else{
            for(int i = 0;i < N;i++){
                ss >> ThisNum;
                if(ThisNum){
                    ConsecutiveOnes++;
                }
                else{
                    ConsecutiveOnes = 0;
                }
                if(ConsecutiveOnes > Max_Ones){
                    Max_Ones = ConsecutiveOnes;
                }
            }
        }
        
        
        count++;
    }
    
    
    
    cout << Max_Ones + 1 << endl;
    return 0;
}

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

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
/*int main(){
    double n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    cout<<min((ceil(n/a)*b),(ceil(n/c)*d))<<endl;
}
*/
int main(){
    int n, ans = 0, temp = 0;
    cin>>n;
    vector<int> v(n);
    for(int i = 0;i < n;i++){
        cin>>v[i];
        if(v[i]==1){
            temp++;
        }else{
            if(ans<temp){
                ans=temp;
            }
            temp = 0;
        }
    }
    if(ans<temp){
        ans=temp;
    }
    cout<<ans+1<<endl;
}

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

using namespace std;

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

	int ans=0,num=0;
	for(int i=0;i<N;++i){
		if(A[i]==1){
			num++;
		}
		else{
			ans=max(ans,num);
			num=0;
		}
	}
	ans=max(ans,num);

	cout<<ans+1<<endl;
	
	
	
	return 0;
}

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

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             


int main(void){
    int n; cin >> n;
    vector<int> a( n );
    REP( i, n ) cin >> a[i];
    
    int cnt = 1, result = 1;
    REP( i, n + 2 ){
        if( a[i] == 1 ) cnt++;
        else{
            result = max( cnt, result );
            cnt = 1;
        }
    }
    
    cout << result << endl;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
	int n,a[100],sum=0,max1=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<n;i++)
	{
		if(a[i]==1)
		{
			sum++;
			max1=max(max1,sum);
		}
		else 
		{
			sum=0;
		}
	}
	cout<<max1+1<<endl;
	return 0;
}

C++: #include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n+1];
    r(i,n)cin>>a[i];
    a[n-1]=0;
    int sum=0;
    r(i,n){
        if(a[i]==1){
            int pre=i;
            while(a[i])i++;
            sum=max(sum,i-pre);
        }
    }
    cout<<sum+1<<endl;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define var auto
#define ll long long
#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++) 
#define inp(a) int a; cin >> a;
#define inps(s) std::string s; cin >> s;
#define out(a) cout<<a<<endl;
#define pb(a) push_back((a))
#define endl "\n"
#define vi vector<int>


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

    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) {
        cin >> A[i];
    }

    int count = 0;
    int maxv = 0;

    rep(i, N) {
        if(A[i] == 1) {
            count++;
            maxv = max(count, maxv);
        } else
            count = 0;
    }

    cout << (maxv + 1) << endl;
	return 0;
}

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

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

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

int main(void) {
    int N;cin>>N;
    int ma1 = 0;
    bool flg = false;
    int cur = 0;
    for (int i = 0; i < N; i++) {
        int A;cin>>A;
        if (!flg) {
            if (A == 1) {
                flg = true;
                cur++;
            }
        } else {
            if (A == 1) {
                cur++;
            } else {
                flg = false;
                if (ma1 < cur) ma1 = cur;
                cur = 0;
            }
        }   
    }
    if (ma1 < cur) ma1 = cur;
    cout << ma1 + 1 << endl;
    return 0;
}

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

using namespace std;

int main (void)
{
	int n,a[100];

	cin >> n;

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

	int MAX = 0,co;

	for (int i = 0; i < n; i++)
	{
		co = 0;
		if (a[i] == 1)
		{
			for (int j = i; j < n + 1; j++)
			{
				if (a[j] == 0)
				{
					break;
				}
				co += 1;
			}
		}

		if (co > MAX)
		{
			MAX = 0;
			MAX = co;
		}
	}

	cout << MAX + 1 << endl;
}

C++: #include <string>
#include <sstream>
#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 tmp = 0, max = 0;

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

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;++i) cin >> a[i];
  int maxi = 0;
  for(int i=0;i<n;++i) {
    if( a[i] == 0 ) continue;
    int score = 0;
    while( i < n && a[i] == 1 ) ++i, ++score;
    maxi = max(maxi,score);
  }
  cout << maxi+1 << endl;
  return 0;
}