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;
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<iostream>
#include<algorithm>
#define rep(i,rept) for (int i = 0; i < rept; i++)

int main() {
	int n = 0, a[100] = {};
	int count = 0, ans = 0;
	std::cin >> n;
	rep(i, n) {
		std::cin >> a[i];
	}
	rep(i, n) {
		if (a[i] == 1) {
			count++;
		}
		else {
			count = 0;
		}
		ans = std::max(ans, count);
	}
		std::cout << ans + 1 << std::endl;
}

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

int main(void){
	int a[101];
  	int n;
  	cin >> n;
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  int max=-1,hoge=0;
  for(int i=0;i<n;i++){
    if(a[i]==1)hoge++;
    else{
      if(max<hoge)max=hoge;
      hoge=0;
    }
  }
  if(max<hoge)max=hoge;
  max++;
  cout << max << endl;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)

using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n];
    rep(i,n) cin >> a[i];
    vector<int> b;
    int cnt = 0;
    rep(i,n) {
        if(a[i] == 1 && i < n-1) cnt++;
        else {
            if(a[i] == 1) cnt++;
            b.push_back(cnt);
            cnt = 0;
        }
    }
    if((int)b.size() == 0) b.push_back(n);
    sort(b.rbegin(),b.rend());
    int ans = b.at(0) + 1;
    cout << ans << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<long long,long long>;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int n;
  cin >> n;
  vector<int>vec(n+1);
  rep(i,n) cin >> vec[i+1];
  int M=0;
  bool ok=false;
  int res=1;
  rep(i,n){
    if(vec[i+1]==1)ok=true;
    if(vec[i]==1 && vec[i+1]==1)res++;
    else{
      M=max(M,res);
      res=1;
    }
  }
  M=max(M,res);
  if(ok)cout << M+1 << endl;
  else cout << 1 << endl;
}

C++: #include<stdio.h>
int main()
{
	int n,c=1,b=0;
	int a,i,r=1;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(b==0&&a==0){
			b=0;
		}else if(b==0&&a==1){
			b=1;
			c++;
		}else if(b==1&&a==0){
			if(r<c){
				r=c;
			}
			c=1;
			b=0;
		}else{
			b=1;
			c++;
		}
	}
	if(b==1){
		if(r<c){
			r=c;
		}
	}
	printf("%d\n",r);
	return 0;
}

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

int main()
{
  int N;
  cin >> N;
  int A;
  int a = 0;
  int max = 0;
  for(int i = 0; i < N; i++){
      cin >> A;
      if(A == 0) a = 0;
      if(A == 1){
          a += 1;
          if(a > max) max = a;
      }
  }
  cout << max + 1 << endl;
      
}

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=-9239;
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<stdio.h>
int main()
{
	int n,c=1,b=0;
	int a,i,r=1;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(b==0&&a==0){
			b=0;
		}else if(b==0&&a==1){
			b=1;
			c++;
		}else if(b==1&&a==0){
			if(r<c){
				r=c;
			}
			c=1;
			b=0;
		}else{
			b=1;
			c++;
		}
	}
	if(b==1){
		if(r<c){
			r=c;
		}
	}
	printf("%d",r);
	return 0;
}

C++: #include <iostream>

int main(){
    int N;
    std::cin>>N;
    int tmp=0,max=0,A;
    for(int i=0;i<N;i++){
        std::cin>>A;
        if(A==1) tmp++;
        else tmp=0;
        if(tmp>max) max=tmp;
    }

    std::cout<<max+1<<"\n";

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,-1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    int mx=0;
    int cnt = 0;
    for(int i=0; i<N; i++){
        if(A[i] == 1){
            cnt++;
        }else{
            chmax(mx,cnt);
            cnt = 0;
        }
    }
    chmax(mx,cnt);
    cout << mx+1 << enld;
    return 0;
}

C++: #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 1e-8;

long long int N, M, K, H, W, L, R;

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

	cin >> N;
	vector<int>v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	int ans = 0;
	for (int i = 1; i < N; i++) {
		v[i] = v[i] * v[i - 1] + v[i];
		ans = max(ans, v[i]);
	}
	cout << ans + 1 << endl;
	return 0;
}

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

using namespace std;

int n, a[105];
bool dp[105][105];

int main(){
	scanf("%d", &n);
	
	for(int i = 1; i <= n; i++)
	scanf("%d", &a[i]);
	
	for(int i = 1; i <= n + 1; i++)
	dp[0][i] = 1;
	
	for(int i = 1; i <= n + 1; i++){
		if(a[i] && i != n + 1) continue;
		for(int j = 1; j <= n + 1; j++){
			for(int k = 1; k <= j; k++){
				if(i - k < 0) break;
				dp[i][j] |= dp[i - k][j];
			}
		}
	}
	
	for(int i = 1; i <= n + 1; i++){
		if(dp[n + 1][i])
		return 0 * printf("%d\n", i);
	}
}

C++: #include <iostream>
using namespace std;
int main(void)
{
	int n,x,i,cnt,max1;
	
	cin>>n;
	
	max1=0,cnt=0;
	for(i=0;i<n;i++){
			cin>>x;
			if(x==1) cnt++;
			else cnt=0;
			max1=max(max1,cnt);
	}
	cout<<max1+1<<endl;
}