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<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int n;
    cin >> n;
    vi a(n);
    rep(i,n)cin >> a[i];
    vi b = a;
    rep(i,n-1)if(a[i]){
        b[i+1] += b[i];
    }
    int ma = 0;
    rep(i,n)ma = max(ma,b[i]);
    cout << ma+1 << endl;
}

C++: // Undone
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
signed main() {
  int N; cin >> N;
  int ans = 0, previous = 0, current = 0;
  for (int i = 0; i < N; i++) {
    int j; cin >> j;
    if (j == 1) {
      if (previous == 0) {
        current = 1;
        previous = 1;
      } else {
        current++;
      }
    } else {
      ans = max(ans, current);
      previous = 0;
    }
  }
  ans = max(ans, current);
  cout << ans+1 << endl;
}

C++: #include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
    int n,a,s=0,k=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a;
        
        if(a==0){
            k=0;
        }
        if(a==1){
            k=k+1;
        }
        if(k>s){
            s=k;
        }
        
        
    }
    cout<<s+1<<endl;
   
    return 0;
}

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

const int mod = 1e9 + 7;
const int inf = 999999;

int n, k[105], cou, ans;
int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> k[i];
		if (k[i] == 1)++cou;
	}
	if (cou == 0) { cout << "1" << endl; return 0; }
	if (cou == n) { cout << n + 1 << endl; return 0; }
	cou = 0;
	for (int i = 1; i < n; ++i) {
		if (k[i - 1] && k[i]) {
			++cou;
			ans = max(ans, cou);
		}
		else {
			ans = max(ans, cou);
			cou = 0;
		}
	}
	cout << ans + 2 << endl;
}

C++: #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	int n;

	int maxm = 1;
	int cnt = 1;
	for (cin >> n; n--;)
	{
		int a;
		cin >> a;

		if (a == 1)
		{
			cnt++;
		}
		else
		{
			maxm = max(maxm, cnt);
			cnt = 1;
		}
	}

	maxm = max(maxm, cnt);

	cout << maxm << endl;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b,i,n;
	b=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(a==1){
			b=b+1;
		}
	}
	b=b+1;
	printf("%d\n",b);
	
	
	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, date, kazu,dai;
	cin >> n;
	kazu = 0;
	dai = 0;
	for (int i = 1; i <= n; i++) {
		cin >> date;
		if (date == 0) {
			kazu = 0;
		}
		if (date == 1) {
			kazu = kazu + 1;
		}
		if (kazu > dai) {
			dai = kazu;
		}
	}
	cout << dai + 1 << endl;
}

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

int main(){
	int i, j, N, A[110], s = 0, a = 0;
	cin>>N;
	for(i = 1; i <= N; i++){
		cin>>A[i];
	}
	
	for(i = 1; i <= N; i++){
		if(A[i] == 1){
			s++;
		} else {
			if(s > a)a = s;
			s = 0;
		}
	}
	cout<<a + 1<<endl;
	return 0;
}

C++: #include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
double eps=1e-8;
ll mod=1e9+7;
ll inf=1e9;
priority_queue<P,vector<P>,greater<P> > pq;

template <typename T>
int Count(const vector<T> &v, T l,T r){
  //counting [l,r]
  auto L = lower_bound(v.begin(), v.end() , l );
  auto R = upper_bound(v.begin(), v.end(), r );
  // [l,r) change upper -> lower

  return R-L;
}

int main(){
  int n,a[101];
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  int ans=0,c=a[0];
  a[n]=0;
  for(int i=1;i<=n;i++){
    if(a[i])c++;
    else ans=max(c,ans),c=0;
  }
  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;
        }
    }

    cout<<MAX<<endl;
}

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


int main(){
  int dis = 0;
  int n;

  cin >> n;
  int *a = new int[n+2];
  a[0] = 0;
  a[n+1] = 0;
  for(int i=1;i<n+1;++i) cin >> a[i];
  
  int counter = 0,i=0;
  while(i<n+2){
    if(a[i] == 1){
      ++counter;
    }else{
      if(dis < counter + 1) dis = counter + 1;
      counter = 0;
    }
    ++i;
  }

  cout << dis << endl;

  delete[] a;

  return 0;
}

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

C++: #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
 
int main()
{
	int n;
	cin >> n;
	int a[n];
	REP(i, n) cin >> a[i];
	bool current = 0;
	int sum = 0;
	int max = 0;
	REP(i, n){
		if (a[i] == 1){
			if (current) sum++;
			else sum = 1;
			current = 1;
		}
		else {
			current = 0;
			sum = 0;
		}
		if (max < sum) max = sum;
	}

	cout << max + 1 << endl;

}