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++: //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++;
			if(max<cnt){
				max=cnt;
			}
		}
		else if(a[i]==0){///???
			cnt=0;
		}
	}
	cout<<max+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;
	for(i=0;i<n+2;i++){
		if(a[i]==1){
			k++;
		}
	}
	printf("%d\n",k);
	return 0;
}

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

int main()
{
    int n;
    bool a[100];

    cin >> n;

    int max = 0, cnt = 0;
    for( int i = 0; i < n; i++ )
    {
        cin >> a[i];
        if( a[i] )
        {
            cnt++;
            max = max < cnt ? cnt : max;
        }
        if( !a[i] )
            cnt = 0;
    }

    cout << max + 1 << endl;

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int ans = 1, cnt = 1;
    bool flag = false;
    for (int i = 0, a; i < n; i++) {
        cin >> a;
        if (a) {
            if (!flag) flag = true;
            cnt++;
        } else if (flag) {
            cnt = 1;
            flag = false;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

C++: #include<stdio.h>

int main(void){
    int n;
    int a[101];
    
    scanf("%d", &n);
    
    int i;
    for(i = 1; i <=n; i++)
    {
        scanf("%d", &a[i]);
    }
    a[i] = 0;
    
    int c = 0;
    int c_max = 0;
    for(i = 1; i <=n+1;i++){
        if(a[i] == 1)
            c++;
        else if (c>0)
        {
            if(c>c_max) c_max = c;
            c = 0;
        }
    }
    
    printf("%d", c_max+1);
    
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;
#define HERE cout<<"    "<<"HERE"<<en

int main(){
  int n;
  cin>>n;
  int a[105];
  for(int i=1; i<=n; i++) cin>>a[i];
  
  int maxl=0;
  for(int i=1; i<=n; i++){
    int renzoku=0;
    if(a[i]==0) continue;
    for(int j=i; j<=n; j++){
      if(a[j]) renzoku++;
      else break;
    }
    maxl=max(maxl,renzoku+1);
  }
  
  cout<<maxl<<en
}

C++: #include<iostream>
#include<cstdio>
int main(void){
	int N=0,all=1,b=1;
	scanf("%d",&N);
	int A_i[N]={0};
	for(int i=0;i<N;i++){
		scanf("%d",&A_i[i]);
		if(A_i[i]==1){
			b++;
			if(all<b){
				all=b;
			}
		}
		else{
			b=1;
		}
	}
	printf("%d\n",all);
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int n;
int t[100];
bool check(int x){
  int p=-1;
  while(p+x<n){
    int i;
    for(i=1;i<=x;i++){
      if(t[p+i]==0){
        p=p+i;
        break;
      }
    }
    if(i>x)return false;
  }
  return true;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>t[i];
  }
  for(int i=1;i<=n+1;i++){
    if(check(i)){
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define pr1(a) (#a)<<"="<<(a)
#define pr2(a,b) pr1(a)<<", "<<pr1(b)
#define pr3(a,b,c) pr2(a,b)<<", "<<pr1(c)
#define pr4(a,b,c,d) pr3(a,b,c)<<", "<<pr1(d)
#define pr5(a,b,c,d,e) pr4(a,b,c,d)<<", "<<pr1(e)
#define int long long
#define double long double
using namespace std;
const int N = 100010;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


signed main(){
  assert(0);
  int n;
  cin>>n;
  vector<int> A(n);
  cin>>A;

  int mx = 0;
  for(int i=0;i<n;i++){
    int j = i;
    while(j < n && A[j] == 1) j++;
    Max(mx,j - i);
  }

  cout<<mx+1<<endl;

  
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(void){
	int N,A,i=0,ANS=0;
	cin>>N;
	for(int j=0;j<N;j++){
		cin>>A;
		if(A==1){
			i++;
		}
		else{
			i=0;
		}
		if(ANS<i){
				ANS=i;
			}
	}
	cout<<ANS+1<<endl;
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int main(){
  int N;
  int A[100];
  cin>>N;
  FOR(i,0,N){
    cin>>A[i];
  }
  int ans=0;
  FOR(i,0,N){
    int cnt=0;
    while(i<N&&A[i]==1){
      i++;
      cnt++;
    }
    ans=max(ans,cnt);
  }
  cout<<ans+1<<endl;
  return 0;
}

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

int main() {
    int n, t, curr_max, global_max;
    scanf("%d", &n);
    curr_max = global_max = 1;
    bool isPeriod = false;
    for (int i = 0; i < n; i++) {
        scanf("%d", &t);
        if (!isPeriod && t == 0) continue;
        if (isPeriod && t == 1) curr_max++;
        else if (isPeriod && t == 0) {
            global_max = max(global_max, curr_max);
            curr_max = 1; isPeriod = false;
        }
        else if (!isPeriod && t == 1) isPeriod = true, curr_max++;
    }
    if (isPeriod) global_max = max(global_max, curr_max);
    printf("%d\n", global_max);
    return 0;
}

C++: #include"bits/stdc++.h"
using namespace std;
int main(){

	string input, answer;
	
	int N;
	int buf;
	int countOne = 0;
	int maxCountOne = 0;

	cin >> N;

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

		if(buf == 0){
			countOne = 0;
			continue;
		}

		countOne++;
		maxCountOne = max(maxCountOne, countOne);
	}

	cout << maxCountOne +1 << endl;

	return 0;
}