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 rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int n;
vector<int> a;
vector<bool> seen;
bool flag;

void is_reach(int s, int k){
    if(k==n+2) {
        flag = true;
        return;
    }
    seen[k] = true;
    FOR(i, 1, s+1){
        if(seen[k+i]) continue;
        if(k+i > n+2) break;
        if(a[k+i]==0){
            is_reach(s, k+i);
        }
    }
}

int main()
{
    cin >> n;
    a.resize(n+3);
    seen.resize(n+3);
    // vector<int> pos;
    rep(i, n){
        cin >> a[i+1];
    }
    a[n+2] = 0;

    FOR(i, 1, n+2){
        flag = false;
        seen.assign(n+3, false);
        is_reach(i, 0);
        if(flag) {
            pr(i);
            return 0;
        }
    }
    return 0;}

C++: // すごろく 2018/12/27

#include <iostream>
using namespace std;

int main() {
    int N, S[100], val;
    bool previous = false; // 1個前が1かどうか
    int length = 0;
    int maxi = 0;

    cin >> N;
    for (int i=0; i<N; i++) {
        cin >> val;
        if (val) { // 1がでた
            length++;
        } else {
            maxi = max(maxi, length);
            length = 0;
        }
    }
    maxi = max(maxi, length); // これを忘れた？

    cout << maxi + 1 << '\n';
    return 0;
}

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

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

	int i = 0;
	int kari = 0;
	int answer = 0;

	while(i<n){
		int A;
		cin >> A;

		if(A == 1){
			kari++;
		}

		else{
			kari = 0;
		}

		if(answer < kari+1){
			answer = kari + 1;
		}
		i++;
	}

	cout << answer << endl;

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    cin >> n;
    int k = 0, ans = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if(x == 1) k++;
        else k = 0;
        ans = max(ans, k+1);
    }
    cout << ans << "\n";
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  int ans = 0, tmp = 0;
  for (int i = 0; i < n; i ++) {
    int t; cin >> t;
    if (t == 0) {
      ans = max(ans, tmp);
      tmp = 0;
    } else {
      tmp ++;
    }
  }
  cout << ans + 1 << endl;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    int cnt = 0;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        if (a == 1) {
            ++cnt;
        } else {
            cnt = 0;
        }
        ans = max(ans, cnt);
    }
    cout << ans + 1 << '\n';
}

C++: #include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int main(void)
{
	int n,i,a,sum=0,sin=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		cin>>a;
		if(a==1){
			sum++;
		}
		else{
			sin=max(sum,sin);
			sum=0;
		}
	}
	sin=max(sum,sin);
	cout<<sin+1<<endl;
	return 0;
}

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; n++)
	{
		cin >> A;
		if (A == 1)
		{
			if (A == _A)
			{
				count[k]++;
				cout << count[k] << endl;
			}
			else
			{
				k++;
				count[k] = 1;
			}
		}
		_A = A;
	}
	sort(count, count + k);
	cout << count[k] <<endl;

	return 0;
}

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

int main() {

	int N;
	std::cin >> N;
	std::unique_ptr<int[]> A(std::make_unique<int[]>(N));
	int max_num_ones = 0;
	int num_ones = 0;
	for (int i = 0; i < N; i++) {
		std::cin >> A[i];
		if (A[i] == 1) { num_ones += 1; }
		if (A[i-1] == 1 && (A[i] == 0 || i == N-1)) 
		{ 
			max_num_ones = (max_num_ones < num_ones) ? num_ones : max_num_ones;
			num_ones = 0; 
		}
	}

	std::cout << max_num_ones + 1 << std::endl;
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> a(n);
	int ans=1;
	int cnt=1;
	for(int i=0;i<n;i++){
		cin >> a[i];
		if(a[i]){
			cnt++;
			ans=max(ans,cnt);
		}
		else{
			cnt=1;
		}
	}
	cout << ans << endl;
}

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;
    n+=2;
    int a[n],dp[n];
    memset(a,0,sizeof(a));
    r(i,n-2)cin>>a[i+1];
    r(i,n){
        r(j,n)if(j){
            r(k,n)dp[k]=1e9;
            dp[0]=0;
            r(k,n){
                if(dp[k]!=1e9)for(int l=1;l<=j;l++){
                    if(k+l<n&&a[k+l]==0)dp[k+l]=min(dp[k+l],dp[k]+1);
                }
            }
            if(dp[n-1]!=1e9){
                cout<<j<<endl;
                return 0;
            }
        }
    }
}

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

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

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


int main(){
  int n,a[1000]={};
  int mx=1,count=1;
  cin>>n;
  for(int i=1;i<=n;i++){cin>>a[i];}

  for(int i=0;i<n+3;i++){
    if(a[i]==1){count++;}
    if(count>0 && a[i]==0){mx=max(mx,count); count=1;}
  }

  cout<<mx<<endl;
  
  return 0;
}

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

using namespace std;

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

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

int main() {
	
	int N, A[100];
	int ans = 0;
	int max = 0;

	cin >> N;

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

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

	}

	cout << max + 1 << endl;
	
	return 0;

}

C++: #include <iostream>
using namespace std;
int N, A, combo = 0, max_combo = 0;
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A;
    if (A == 1) {
      combo++;
    } else {
      combo = 0;
    }
    if (combo > max_combo) {
      max_combo = combo;
    }
  }
  cout << max_combo + 1 << '\n';
  return 0;
}