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 <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

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

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    int counter=1;
    int MAX=1;
    cin>>N;
    int MASU[N+1];
    
    for(int i=0;i<N;i++)
    {
        cin>>MASU[i];
    }

    MASU[N]=0;
    for(int i=0;i<N;i++)
    {
        if(MASU[i]==1&&MASU[i+1]==1)
        {
            counter++;
        }
        else if(MASU[i]==1&&MASU[i+1]==0)
        {
            counter++;
            if(MAX<counter)
            {
                MAX=counter;
            }
            counter=1;
        }
    }
}

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

C++: #include <iostream>

using namespace std;

int main() {
    int N, A, cnt = 0, maxc = 0;
    cin >> N;

    for(int i = 0; i < N; i++) {
        cin >> A;
        if(A == 1) cnt++;
        else {
            maxc = max(maxc, cnt);
            cnt = 0;
        }
    }
    maxc = max(maxc, cnt);

    cout << maxc + 1 << endl;
}

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

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

using namespace std;

int main()
{
	int N;
	int *board;

	cin >> N;
	board = new int[N];
	for(int i = 0; i < N; i++)
		cin >> board[i];

	// 1が最大でいくつ連続しているかを調べる
	// その数を超える目を持つサイコロが答え
	int max = 0;
	for(int i = 0; i < N;){
		int count = 0;
		while(board[i] && i++ < N)
			count++;

		if(!board[i])
			i++;
		if(count)
			max = MAX(count, max);
	}

	cout << max + 1 << endl;

	return 0;
}

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

using namespace std;

template <typename T>
using vec1 = vector<T>;

template <typename T>
T cin2var()
{
    T val;
    cin >> val;
    return val;
}

template <typename T>
vec1<T> cin2vec(size_t size)
{
    vec1<T> vec1(size);
    for (auto& v : vec1) {
        v = cin2var<T>();
    }
    return vec1;
}

void sub()
{
    const auto N(cin2var<size_t>());
    const auto As(cin2vec<char>(N));
    uint64_t c1 = 0;
    uint64_t max_c1 = 0;
    for (const auto& c : As) {
        if (c == '1') {
            ++c1;
            if (max_c1 < c1) max_c1 = c1;
        }
        else {
            c1 = 0;
        }
    }
    cout << max_c1 + 1 << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    sub();
    return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,cnt=0,ans=0;
	cin>>n;
	vl v(n);
	rep(i,n)cin>>v[i];
	rep(i,n){
		if(v[i])cnt++;
		else {
			chmax(ans,cnt);
			cnt=0;
		}
	}
	chmax(ans,cnt);
	cout<<ans+1<<endl;
}

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

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
using namespace std;
 
int main() {
  ll n,count=1;
  cin>>n;
  ll ans=0;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  a.push_back(0);
  rep(i,n+1){
    if(a[i]==1){
      count++;
      if(i==n+1){
        ans=count;
      }
    }
    else {
      ans=max(ans,count);
    
    
    
      count=1;
    }
  }
  cout<<ans<<endl;
}

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

int N;
int A[101];

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

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

	cout << ans + 1 << endl;

	return 0;
}

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

using namespace std;

const int INF = 1000000000;
const int SIZE = 102;

int main(){
  int n, a, counter = 1, ans = 0;

  scanf("%d",&n);

  for(int i=0;i<n;i++){
    scanf("%d",&a);
    
    ans = max(ans, counter);
    if(a == 0) counter = 0;
    counter++;
  }
  ans = max(ans, counter);

  printf("%d\n",ans);

  return 0;
}

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

using namespace std;

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a) for (int i = (int) (a); i < (int) (b); i++)
#define RS resize

int main()
{
	int n;
	cin >> n;
	int res = 0;
	int cnt = 0;
	rep(i, n) {
		int t;
		cin >> t;
		if (t) {
			cnt++;
			res = max(res, cnt);
		} else {
			cnt = 0;
		}
	}
	cout << ++res << endl;
}