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++: // clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

class UnionFind {
  vector<int> tree, rank, setSize;

public:
  UnionFind(const int &n) : tree(n), rank(n), setSize(n, 1) { iota(all(tree), 0); }

  int root(const int &x) { return tree[x] == x ? x : tree[x] = root(tree[x]); }

  bool same(const int &a, const int &b) { return root(a) == root(b); }

  bool unite(int a, int b) {
    a = root(a), b = root(b);
    if (a == b) return false;
    if (rank[a] < rank[b]) swap(a, b);
    tree[b] = a;
    setSize[a] += setSize[b];
    if (rank[a] == rank[b]) rank[a]++;
    return true;
  }

  int setSizeOf(const int &x) { return setSize[root(x)]; }

  int size() { return tree.size(); }
};

main() {
  int n = in();
  vector<int> a(n);
  cin >> a;
  UnionFind uf(n);
  loop(i, 1, n) if (a[i - 1] && a[i]) uf.unite(i - 1, i);
  int ans = 0;
  rep(i, n) if (a[i]) cmax(ans, uf.setSizeOf(i));
  cout << ans + 1 << endl;
}

C++: #include <iostream>
#include <algorithm>
int main() {
	int n, a[100],c[50],co=0;
	for (int i = 0; i < 50; ++i) {
		c[i] = 0;
	}
	std::cin >> n;
	for (int i = 0; i < n; ++i) {
		std::cin >> a[i];
		if (a[i] == 1) {
			c[co] += 1;
		}
		else {
			co += 1;
		}
	}
	std::cout << *std::max_element(c, c + 50)+1 << std::endl;
}

C++: //JOI2017 Sugoroku
//20181204
//F_Naru
#include<iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  int max=0;
  int a;
  int cnt=1;
  for(int i=0; i<N; i++){
    cin >> a;
    if(a==1) cnt++;
    else{
      if(cnt>max) max=cnt;
      cnt=1;
    }
  }
  if(cnt>max) max=cnt;  
  cout << max << endl;
}

C++: #include<iostream>
using namespace std;
int main(){

	int a,N,sum=0,b=0;

	cin>>N;

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

		if(a==1){
			sum=sum+1;
			if(sum>b){
				b=sum;
			}
		}
		else{
			sum=0;
		}
	}
	cout<<b+1<<endl;

	return 0;
}

C++: 
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	int cnt = 0;
	int ans = -1;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;

		if (x == 1) {
			cnt++;
			ans = max(ans, cnt);
		}
		else {
			cnt = 0;
		}
	}

	if (ans != -1) {
		cout << ans+1 << endl;
	}
	else {
		cout << 1 << endl;
	}
	

	return 0;
}

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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};



int main(){
	int n, in;
	int ans = -inf;
	vector<int> a;
	a.pb(0);
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> in;
		if(!in) a.pb(i);
		if(a.size() > 1){
			ans = max(ans, a[a.size()-1] - a[a.size()-2]);
		}
	}
	ans = max(ans, n+1 - a[a.size()-1]);

	cout << ans << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main() {
  int n;
  cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];
  int len = 1, ans = 0;
  rep(i, n) {
    if(a[i]) {
      if(i && a[i - 1]) {
        len++;
        ans = max(len, ans);
      } else {
        len = 1;
        ans = max(len, ans);
      }
    }
  }
  cout << ans + 1 << endl;
  return 0;
}