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

Python: n=int(input())
a=[0]+list(map(int,input().split()))+[0]
# ansは1の連続する長さの最大値+1
ans=[]
ans1=1
for i in a:
    if i==1:
        ans1+=1
    else:
        ans.append(ans1)
        ans1=1
print(max(ans))

Python: N = int(input())
*A, = map(int, input().split())
ans = 0
cur = 0
for a in A:
    if a:
        cur += 1
    else:
        cur = 0
    ans = max(ans, cur)
print(ans+1)

Python: N=int(input())
A=list(map(int,input().split()))
P=0
C=0
for i in range(N):
  if A[i]==1:
    C=C+1
  else:
    P=max(P,C)
    C=0
print(max(P,C)+1)

Python: N = int(input())
A = list(map(int, input().split(' ')))
max_sequence = 0
seq = 0

for a in A:
    seq = seq + 1 if a == 1 else 0
    if max_sequence < seq: max_sequence = seq

print(max_sequence + 1)

Python: # -*- coding: utf-8 -*-
"""
Sugoroku
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0642

"""
import sys
import re


def solve(s):
    return max([len(r.group()) for r in re.finditer(r'1+', s)], default=0) + 1


def main(args):
    _ = input()
    ans = solve(input().replace(' ', ''))
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Python: n, *a = map(int, open(0).read().split())
mx = tmp = 0
for i in a:
    if i: tmp+=1
    else:
        mx=max(mx,tmp)
        tmp=0
mx=max(mx,tmp)
print(mx+1)

Python: n = int(input())
s = input()
w = s.split()
w.append('0')
c = 0
data = []
for i in range(n+1):
    if w[i] == '1':
        c = c+1
    else:
        data.append(c)
        c = 0
print(max(data)+1)

Python: n = int(input())
a = list(map(int, input().split()))
maxn = 1
ncont = 0
for i in a:
    if i == 1:
        ncont += 1
        if ncont+1 > maxn:
            maxn = ncont+1
    else:
        ncont = 0
print(maxn)

Python: n=int(input())
a=list(map(int,input().split()))
cnt=0
ans=0
now=False
for i in range(n):
    if a[i]==1:
        cnt+=1
        now=True
    elif now:
        ans=max(ans,cnt)
        cnt=0
        now=False
ans=max(cnt,ans)
print(ans+1)

Python: n = int(input())
A = list(map(int, input().split()))

ans = 1
tmp = 1
for a in A:
    if a == 1:
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 1
ans = max(ans, tmp)

print(ans)

Python: n, a = int(input()), list(map(int, input().split()))
max, temp = 0, 0
for i in a:
	if i==0:
		temp = 0
	else:
		temp = temp+1
		if temp>max: max = temp
print(max+1)

Python: n = int(input())
alst = list(map(int, input().split()))
acc = 1
ans = 1
for a in alst:
  if a == 1:
    acc += 1
    ans = max(ans, acc)
  else:
    acc = 1
print(ans)

Python: n=int(input())
a=[int(i) for i in input().split()]

tmp=0
ans=0
for i in range(n):
    if a[i]:
        tmp+=1
    else:
        ans=max(ans,tmp)
        tmp=0
ans=max(ans,tmp)
print(ans+1)

Python: n = int(input())
a = list(map(int,input().split()))
for i in range(1,n):
    if a[i] > 0:
        a[i] += a[i-1]
print(max(a)+1)

Python: _ = input()
input_data = input()
str_data = input_data.split(' ')
list_data = [int(i) for i in str_data]
sugoroku_final = 1
sugoroku_temp = 1
for datum in list_data:
    if datum == 1:
       sugoroku_temp += 1
    else:
        sugoroku_final = max(sugoroku_final, sugoroku_temp)
        sugoroku_temp = 1

print(sugoroku_final)

Python: n=int(input())
masu=input().split(" ")
cnt=0
ans=0
for i in masu:
    if i=="1":
        cnt+=1
        ans=max(ans,cnt)
    else:cnt=0
print(ans+1)

Python: N = int(input())
line = input().split(" ")
A = [int(line[i]) for i in range(N)]
#print(A)

maxVal = 0
count = 0
for i in range(N):
    if A[i] == 1:
        count+=1
        if maxVal < count:
            maxVal = count
    else:
        count = 0
print(maxVal+1)

Python: def main():
    square_num = int(input()) + 2
    flag_list = list(map(int, input().split()))

    dice_num = 1

    # ゲームオーバーがなければ即終了
    if 1 not in flag_list:
        print(dice_num)
        return

    index = 0
    wk_index = 0
    gameover_count = 0
    answer = 0
    # ゲームオーバーが連続する最大数を求める
    while index < len(flag_list):
        if flag_list[index] == 1:
            gameover_count += 1

            wk_index = index
            while True:
                if (wk_index + 1 <= len(flag_list) - 1) and (flag_list[wk_index + 1] == 1):
                    wk_index += 1
                    gameover_count += 1
                else:
                    break

            answer = max(answer, gameover_count)
            gameover_count = 0

        index = max(index + 1, wk_index)

    # 最もゲームオーバーが連続する数 + 1を出力
    print(answer + 1)


main()

Python: _ = input()
input_data = input()
str_data = input_data.split(' ')
list_data = [int(i) for i in str_data]
sugoroku_final = 1
sugoroku_temp = 1
for datum in list_data:
    if datum == 1:
       sugoroku_temp += 1
    else:
        sugoroku_final = max(sugoroku_final, sugoroku_temp)
        sugoroku_temp = 1

sugoroku_final = max(sugoroku_final, sugoroku_temp)
print(sugoroku_final)

Python: n = int(input())
ms = 1
p = 1
s = input().split()
for i in range(n):
    if s[i] == "1":
        p += 1
    else:
        ms = max(ms, p)
        p = 1
print(ms)

Python: _ = input()
input_data = input()
str_data = input_data.split(' ')
gen_data = (int(i) for i in str_data)
sugoroku_final = 1
sugoroku_temp = 1
for datum in gen_data:
    if datum == 1:
       sugoroku_temp += 1
    else: 
        sugoroku_final = max(sugoroku_final, sugoroku_temp)
        sugoroku_temp = 1

print(sugoroku_final)

Python: # AOJ 0642
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0642

N = input()
A = list(map(int, input().split()))

A = [1] + A
for i in range(1, len(A)):
    if A[i] == 1:
        c = A[i - 1] + 1
    else:
        c = 1
    pre = A[i]
    A[i] = c

print(max(A))

Python: n = int(input())
alist = list(map(int, input().split()))

ans = 0
cnt = 0
while alist != []:
    a = alist.pop(0)

    if a == 1:
        cnt += 1
    else:
        cnt = 0

    if cnt > ans:
        ans = cnt

print(ans + 1)

Python: n=int(input())
m=input()
mi=m.replace(' ', '')
mi=list(map(str,mi.split("0")))
ans=1
for i in mi:
    ans=max(ans,len(i)+1)
print(ans)

Python: n=int(input())
s=list(map(int,input().split()))
max=1
for i in range(n):
    if s[i]==1:
        count=2
        for j in range(i+1,n):
            if s[j]==1:
                count+=1
                continue
            else:
                break
        if count>max:
            max=count
print(max)

Python: ans = 1;

def one_count(data, i, count):
    global ans
    
    count+=1
    
    if data[i+1] == 1:
        one_count(data, i+1, count)
    elif ans <= count:
        ans = count+1
    
N = int(input())
data = list(map(int, input().split()))
data.append(0)

for i in range(N):
    count = 0;
    if data[i] == 1:
        one_count(data, i, count)

print(ans)

Python: N = int(input())
A = [int(i) for i in input().split()]
seq = 0
max_seq = 0
for v in A:
    if v == 0:
        seq = 0
    else:
        seq += 1
    max_seq = max(seq, max_seq)

print(max_seq + 1)

Python: n = int(input())
a = input().split()

count = 0
mcount = 0
for i in a:
    if i == '1':
        count += 1
    else:
        mcount = max(mcount,count)
        count = 0
    mcount = max(mcount,count)
print(mcount+1)