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>
using namespace std;
int main(void)
{
    int N,i,j;
    int counter=0,ans=0;
    int a[N];
    cin>>N;
    for(i=0;i<N;i++)
    {
        cin>>a[i];
    }
    for(j=0;j<N;j++)
    {
        counter++;
        if(a[j]==0)
        {
            if(ans<counter)
            {
                ans=counter;
            }
            counter=0;
        }
        if(j==N-1&&a[j]==1&&ans<counter+1)
        {
            ans=counter+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(void){
  int N;
  cin>>N;
  int cnt=0;
  int max=0;
  int A;
  for(int i=0;i<N;i++){
    cin>>A;
    if(A==1){
      cnt+=1;
    }
    else{
      if(cnt>max){
        max=cnt;
      }
      cnt=0;
    }
  }
  if(cnt>max){
    max=cnt;
  }
  cout<<max+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;
  cin >> N;
  int num, ss;
  ss = 0;
  num = 0;
  for(int i = 0; i < N; i++){
    int a;
    cin >> a;
    if(a == 1) num++;
    else num = 0;
    if(ss < num) ss = num;
  }
  cout << ss + 1 << endl;
}

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

int main(){
  int n;
  cin >> n;
  int board[n];

  for(int i=0;i < n;i++)
    {
      cin >> board[i];
    }
  int cnt=1;
  int mark = 1;
  
  for(int i=0;i< n;i++)
    {
      if(board[i] == 1){
	cnt++;
	mark = max(mark,cnt);
      }
      else{
	cnt = 1;
      }
    }
  cout << mark << endl;
  return 0;
}

C++: #include <iostream>
#include <algorithm>
int main(){

int n = 0,a[100];
int count = 0,answer = 0;

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

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

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

C++: //https://onlinejudge.u-aizu.ac.jp/challenges/sources/JOI/Prelim/0642?year=2018

#include <bits/stdc++.h>

using namespace std;

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

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

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

    cout << ans << endl;
    return 0;
}

/*
 * 1が最高何回連続するか数える。サンプル3なら
 * 0 0 1 0 1 1 0
 * より2回なので答えは2+1=3
 */

C++: #include<stdio.h>
int main(void)
{
	int n,x,a[100],i,k,flg;
	scanf("%d",&n);
	for(i=0;i<n;i++)	scanf("%d",&a[i]);
//for(i=0;i<n;i++)	printf("%d\n",a[i]);
	for(k=1;k<=6;k++){
		flg=0;
		for(i=0;i<n;i=i+k){
			if(a[i]==1){
				flg=1;
				break;
			}
		}
		if(flg==0) break;
	}
	printf("%d\n",k);
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m=1,ko=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;
			}
		}
		if(ko<m){
			ko=m;
		}
	}
	cout << ko << endl;
}

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 ans=1;
  int cnt=0;
  for(int i=0;i<n; i++){
    int a;
    cin>>a;
    if(a) cnt++;
    else{
      ans=max(ans,cnt+1);
      cnt=0;
    }
  }
  ans=max(ans,cnt+1);
  
  cout<<ans<<en
}

C++: #include<iostream>
using namespace std;
int main(){
  int count = 0;
  int ans = 0;
  int n;
  cin >> n;
  int a;
  for(int i=0;i<n;i++){
    cin >> a;
    if(a==0){
      ans = max(ans,count);
      count = 0;
    }
    else if(a==1){
      count++;
    }
    if(i==n-1){
      ans = max(ans,count);
    }
  }
  cout << ans+1 << endl;
}

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

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int max_num = -INF;
    int cnt = 0;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        if(x == 1) cnt++;
        else cnt = 0;
        max_num = max(cnt, max_num);
    }
    cout << max_num + 1 << endl;
    return 0;
}

C++: #include <iostream>

int main() {
  int n;
  std::cin >> n;
  int s = 0, result = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    std::cin >> a;
    if (a)
      ++s;
    else {
      result = std::max(result, s);
      s = 0;
    }
  }
  result = std::max(result, s);

  std::cout << result + 1 << std::endl;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 998244353;

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);

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

  return 0;
}

C++: #include <stdio.h>

int main(void) {
  int i, j, k, n, ans = 1, now = 1, a;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    scanf("%d", &a);
    if(a) ++now;
    else {
      if(ans < now) ans = now;
      now = 1;
    }
  }
  if(now > ans) ans = now;
  printf("%d\n", ans);
  return 0;
}

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;
}