Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()
	max, cnt := 0, 0
	for i := 0; i < N; i++ {
		cnt++
		if nextInt() == 0 {
			cnt = 0
		}
		if cnt > max {
			max = cnt
		}
	}
	fmt.Println(max + 1)
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint a(n);
  rep(i, n) cin >> a[i];

  int ans = 0;
  int idx = 0;
  while(idx < n) {
    int cnt = 0;
    while(idx < n && a[idx++] == 1) ++cnt;
    chmax(ans, cnt+1);
  }
  cout << ans << endl;

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>

using namespace std;

int main()
{

	int a = 0, b = 0, c = 0, d = 0, e = 0, maxy = 0, max = -1, ans = 1, count = 0, min = 0;

	int yoko = 0, tate = 0;
	std::string output, output2, output3, input = {};
	bool okada = false;
	int array[1000];


	cin >> a ;
	for (int i = 0; i < a; i++) {
		cin >> array[i];
	}
	for (int i = 0; i < a; i++) {
		if (array[i] == 1) {
			count++;
		}
		if (array[i] == 0||i==a-1) {
			max = std::max(count, max);
			count = 0;
		}
	
	}
	cout << max + 1 << endl;
	
}

C++: #include<iostream>
using namespace std;
int main(){

	int n,a,m,l=0,k=0;
	cin>>n;
	for(int i=0;i<n;i++){
	cin>>a;
	if(a==1){
		k=k+1;
		if(l<k){
		l=k;
		}
	}
	else{k=0;}
	}



	cout<<l+1<<endl;

	return 0;
}

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>

using namespace std;

int main()
{
    int N;
    int ans=0,cnt=1;

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

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

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

    int ans = 1;
{
    int one = 1;
    for(auto p:A){
        if(p == 1) one++;
        if(ans < one) ans = one;
        if(p == 0) one = 1;
    }
}

    cout<<ans<<endl;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define check if (false_max > final) final = false_max

int main() {
	int n, temp; cin >> n; 
	int false_max = 0; int final = 0;
	rep(i, n) {
		cin >> temp;
		if (temp == 1) false_max++;
		else { check; false_max = 0; }
	}
	check; cout << final + 1 << endl;
	return 0;
}

C++: // 2018/12/17 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int N;
	cin >> N;

	int cnt = 0;
	int cnt_max = -1;

	for(int i=0; i<N; i++){
		int A;
		cin >> A;

		if(A==0){
			cnt = 0;
		}
		else{
			cnt++;
		}

		if(cnt_max<cnt){
			cnt_max = cnt;
		}
	}

	cout << cnt_max+1 << endl;

	return 0;
}

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

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

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int n; cin >> n;
    vector<int> a(n+2);
    REP(i, 1, n+1) cin >> a[i];
    int res = 0, cnt = 0;
    REP(i, 1, n+1) {
        if(a[i] == 1) cnt++;
        if(a[i] == 0) cnt = 0;
        res = max(res, cnt);
    }
    cout << res + 1 << '\n';
    return 0;
}

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

int main()
{
	//2.すごろく	
	int n;
	cin >> n;
	int A, _A = 0;
	int k = -1;
	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<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(a==0){
			c=b;
			b=0;
		}
	}
	if(b>c){
		b=b+1;
		printf("%d\n",b);
	}
	else{
		c=c+1;
		printf("%d\n",c);
	}
	
	
	return 0;
}

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

int main()
{
	int N;
	cin >> N;
	vector<int> A(N + 2, 0);
	for (int i = 0; i < N; i++) {
		cin >> A[i + 1];
	}
	int res = 1, last = -1;
	for (int i = 0; i < N + 2; i++) {
		if (A[i] == 0) {
			res = max(res, i - last);
			last = i;
		}
	}
	cout << res << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[100],count=0,mem=0;
  for(int i=0;i<n;i++){
    while(1){
      
      cin>>a[i];
      if(a[i]==1){
	count++;
	if(mem<count) mem=count;
	break;
      }
      count=0;
      break;
    }
  }
    cout<<mem+1<<endl;
  return 0;
}

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

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

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

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

	cout << max + 1 << endl;

	return 0;
}

C++: n = int(input())
a = list(map(int,input().split()))
for i in range(1,n):
    if a[i] > 0:
        a[i] += a[i-1]
print(max(a[i])+1)