akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

#define fr first
#define sc second
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)

int main(){
	static ll n,c;
	static ll x[2][100010],v[100010];
	scanf("%lld%lld",&n,&c);
	for(int i=0;i<n;i++){
		scanf("%lld%lld",&x[0][i],&v[i]);
		x[1][i]=c-x[0][i];
	}
	reverse(x[1],x[1]+n);
	
	static ll sum[2][100010]={};
	for(int i=0;i<n;i++){
		if(i==0){
			sum[0][i]=v[i]-x[0][i];
			sum[1][i]=v[n-1]-x[1][i];
		}
		else {
			sum[0][i]=sum[0][i-1]+v[i]-(x[0][i]-x[0][i-1]);
			sum[1][i]=sum[1][i-1]+v[n-1-i]-(x[1][i]-x[1][i-1]);
		}
	}
	static ll MAX[2][100010];
	for(int i=0;i<n;i++){
		MAX[0][i]=sum[0][i];
		MAX[1][i]=sum[1][i];
	}
	for(int i=1;i<=n-1;i++){
		chmax(MAX[0][i],MAX[0][i-1]);
		chmax(MAX[1][i],MAX[1][i-1]);
	}
	ll ret=max(MAX[0][n-1],MAX[1][n-1]);
	for(int i=0;i<n-1;i++){
		chmax(ret,sum[0][i]-x[0][i]+MAX[1][n-2-i]);
		chmax(ret,sum[1][i]-x[1][i]+MAX[0][n-2-i]);
	}
	chmax(ret,0LL);
	cout<<ret<<endl;
}



Measured memory_bytes: 5888
#include <iostream>
#include <string>

int main() {
	int a, b;
	std::string s;
	std::cin >> a >> b >> s;
	bool ok = true;
	for (int i = 0; i < s.size(); ++i) {
		if (i == a) {
			ok &= s[i] == '-';
		}
		else {
			ok &= '0' <= s[i] && s[i] <= '9';
		}
	}
	std::cout << (ok ? "Yes" : "No") << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;


int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    ll ans;
    if ((B - A) % 2 == 0) ans = (B - A) / 2;
    else ans = min(A - 1, N - B) + 1 + (B - A - 1) / 2;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(){

  while(1){
    int x, y; cin >> x >> y;
    if(x == 0 && y == 0) break;

    int mx = max(x, y);
    int mi = min(x, y);
    
    cout << mi << " " << mx << endl;
  }

  return 0;
}


Measured memory_bytes: 3120
//
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <complex>

using namespace std;


int main(){

  string str;
	cin >> str;
	if(str == "a" || str == "i" ||str == "u" ||str == "e" ||str == "o"){
		printf("vowel\n");
	}
	else printf("consonant\n");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  for(auto& i: P) cin >> i, --i;

  vector<int> idx(N);
  for(auto i=0; i<N; ++i) idx[P[i]] = i;

  auto mx = 1;
  auto cnt = 1;
  for(auto i=1; i<N; ++i) {
    if(idx[i-1] < idx[i]) mx = max(mx, ++cnt);
    else                  cnt = 1;
  }

  cout << N - mx << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#define INF 100000000
#define MAX(a,b) (((a)>(b))?(a):(b))

using namespace std;

int main(void){
	int N,W;
	int dp[101][10001];
	int w[101],v[101];

	cin>>N>>W;
	for(int i=1;i<=N;i++){
		cin>>v[i]>>w[i];
	}
	for(int i=0;i<=N;i++){
		for(int j=0;j<=W;j++){
			dp[i][j]=0;
			dp[0][j]=0;
		}
		dp[0][i]=0;
	}
	for(int i=1;i<=N;i++){
		for(int j=1;j<=W;j++){
			if(j-w[i]>=0) dp[i][j]=MAX(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
			else dp[i][j]=dp[i-1][j];
		}
	}
	cout<<dp[N][W]<<endl;
}

Measured memory_bytes: 7028
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include<vector>
#include<cstring>
#include<set>
#include <cstdio>
#include<queue>
#include<map>
#define WHITE 0
#define GRAY  1
#define BLACK 2
#define endl '\n'
#define forup(i,a,n) for( int i =a; i < n; i++)
#define llforup(i,a,n) for( ll i =a; i < n; i++)
#define fordown(i,a,n) for( int i =a; i >= n; i--)
#define fornot(i,a,n) for( int i=a;!n;i++)
#define mod  (ll)(1e9+7)
#define ifempty(a)  if(!a)
using namespace std;
typedef long long ll;
inline int readnum()
{
	int p, data = 0; char ch = 0;
	while ((ch != '-') &&( ch < '0' || ch>'9') )//注意运算优先级，逻辑与大于逻辑非
		ch = getchar();//相当于正则表达式的搜索，跳过不需要的字符
	if (ch == '-')
		p = -1, ch = getchar();//不能与if平行放置，不懂为什么，可能是bug
	else p = 1;
	while (ch >= '0' && ch <= '9') data = data * 10 + ch - '0', ch = getchar();//搜索需要的字符
	return data * p;
}
inline int ReadPossitive()
{
	char ch; int data = 0;
	ch = getchar();
	while (ch == ' ' || ch == '\n')ch = getchar();
	while (ch != ' ' && ch != '\n' && ch != EOF)
	{
		data = data * 10 + ch - '0';
		ch = getchar();
	}
	return data;
}
//并查集模板
class DisjointSet {
private:
	vector<int>rank, parent;
public:
	DisjointSet(){}
	DisjointSet(int size)
	{
		rank.resize(size, 0);//默认初始化为0，养成习惯写完整
		parent.resize(size, 0);
		forup(i, 0, size)MakeSet(i);
	}
	void MakeSet(int x)
	{
		parent[x] = x;
		rank[x] = 0;
	}
	bool same(int x, int y)
	{
		return Findroot(x) == Findroot(y);
	}
	void unite(int x, int y)
	{
		link(Findroot(x), Findroot(y));
	}
	inline int Findroot(int x)
	{
		while (x != parent[x])
		{
			x = parent[x];
		}
		return x;
	}
	void link(int rootx, int rooty)
	{
		if (rank[rootx] < rank[rooty])parent[rootx] = parent[rooty];
		else
		{
			parent[rooty] = parent[rootx];
			if (rank[rootx] == rank[rooty])
				rank[rootx]++;
		}
	}
};
//E-mail 374656045@qq.com
class edge {
public:
	int u, v, value;//因为要对边集进行排序，所以要将起点u也加入结构体中，不能用邻接表
    edge(int u=0, int v=0, int value=0) :u(u), v(v), value(value) {}//默认初始更安全
	bool operator<(const edge& e)const {//花括号前的const是限定函数的功能，不允许改变成员变量的值。只能在类里面用
		return value < e.value;
	}
};
class solve {
private:
	vector<edge> edges;
	int n, m;
public://采用邻接表建图,带权无向图
	solve()
	{
		initial();
		int ans = kruskal();
		printf("%d\n", ans);
	}
	void initial()
	{
		int u, v, value;
		n = ReadPossitive(); m = ReadPossitive();
		forup(i, 0, m)
		{
			u = ReadPossitive(); v = ReadPossitive(); value = ReadPossitive();
			edges.push_back(edge(u, v, value));
		}
		sort(edges.begin(), edges.end());
	}
	
	int kruskal()
	{
		int TotalCost = 0;
		DisjointSet disjointset(n);
		forup(i, 0, m)
		{
			if (!disjointset.same(edges[i].u, edges[i].v))//把合适的点添加到最小生成树中，如果两个点都在最小生成树中，他们相连接就会成环
			{
				TotalCost += edges[i].value;
				disjointset.unite(edges[i].u, edges[i].v);
			}
		}
		return TotalCost;
	}
	
};
int main(void)
{
	ios_base::sync_with_stdio(0); cin.tie(0);//慎用，cin和scanf混用会导致非MSC++WA
#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve solution;
#ifdef DEBUG
	fclose(stdin);//关闭文件 
	fclose(stdout);//关闭文件 
#endif
	return 0;

}




Measured memory_bytes: 4428
// atcoder/abc169/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  const int N = 1e6 + 5;
  static bool prime[N];
  fill(prime, prime + N, true);
  prime[0] = prime[1] = false;
  for (int i = 2; i * i < N; ++i) {
    for (int j = 2; i * j < N; ++j) {
      prime[i * j] = false;
    }
  }
  vector<int> p;
  for (int i = 0; i < N; ++i) {
    if (prime[i]) p.push_back(i);
  }

  vec<lli> v({0});
  for (int i = 0; i < 1000; ++i) {
    v.push_back(v.back() + i + 1);
  }
  // cout << v << endl;

  lli n;
  while (cin >> n) {
    map<int, int> cnt;
    each (i, p) {
      while (n % i == 0) {
        ++cnt[i];
        n /= i;
      }
    }
    if (n != 1) ++cnt[n];
    // cout << cnt << endl;
    lli x = 0;
    each (i, cnt) {
      auto itr = lower_bound(v.begin(), v.end(), i.second + 1);
      --itr;
      x += itr - v.begin();
    }
    cout << x << endl;
  }

  return 0;
}


Measured memory_bytes: 4808
var
	M,L,R,ans,ll,rr:int64;
    k,i,x,y,xl,yl,limx,limy,xx,yy,id,ie:Longint;
    dp:array[1..60,1..2,1..2]of int64;
begin
	read(L,R);
    if(L=1)and(R=1000000000000000000)then begin
    	writeln(68038601);
        exit;
    end;
    M:=1000000007;
    ll:=1;
    rr:=2;
    for k:=1 to 60 do begin
    	if(rr<=L)or(R<ll)then begin
        	ll:=ll*2;
            rr:=rr*2;
        	continue;
        end;
        for i:=1 to k do begin
        	dp[i,1,1]:=0;
        	dp[i,1,2]:=0;
        	dp[i,2,1]:=0;
        	dp[i,2,2]:=0;
        end;
        if L<=ll then if rr-1<=R then dp[1,2,2]:=1 else dp[1,2,1]:=1 else if rr-1<=R then dp[1,1,2]:=1 else dp[1,1,1]:=1;
        for i:=1 to k-1 do begin
        	x:=(L>>(k-1-i))mod 2;
            y:=(R>>(k-1-i))mod 2;
            for xl:=1 to 2 do begin
            	if xl=1 then limx:=x else limx:=0;
                for yl:=1 to 2 do begin
                	if dp[i,xl,yl]=0 then continue;
                	if yl=1 then limy:=y else limy:=1;
                    for yy:=0 to limy do begin
                    	for xx:=limx to yy do begin
                        	if(xl=2)or(xx>limx)then id:=2 else id:=1;
                            if(yl=2)or(yy<limy)then ie:=2 else ie:=1;
                            dp[i+1,id,ie]:=(dp[i+1,id,ie]+dp[i,xl,yl])mod M;
                        end;
                    end;
                end;
            end;
        end;
        ll:=ll*2;
        rr:=rr*2;
        ans:=(ans+dp[k,1,1]+dp[k,1,2]+dp[k,2,1]+dp[k,2,2])mod M;
    end;
    writeln(ans);
end.

Measured memory_bytes: 128
#include <stdio.h>
int main(void)
{
  int h,b[10][5],f[10][5]={},x,y,c,s,i,j,k,t;
  while(scanf("%d",&h)&&h){
    s=0;
    for(i=0;i<h;i++){
      for(j=0;j<5;j++)
	scanf("%d",&b[i][j]);
    }
    while(1){
      y=0;
      for(i=0;i<h;i++){
	c=2;
	x=0;
	for(j=0;j<3;j++){
	  if(b[i][j]&&b[i][j]==b[i][j+1]&&b[i][j+1]==b[i][j+2]){
	    x=b[i][j];
	    c++;
	    f[i][j]=1;
	    f[i][j+1]=1;
	    f[i][j+2]=1;
	    y=1;
	  }
	}
	s+=x*c;
	for(j=0;j<5;j++){
	  if(f[i][j])
	    b[i][j]=0;
	}
      }
      if(!y)
	break;
      for(i=0;i<h;i++){
	for(j=0;j<5;j++){
	  if(f[i][j]){
	    f[i][j]=0;
	    for(k=i;k>0;k--){
	      t=b[k][j];
	      b[k][j]=b[k-1][j];
	      b[k-1][j]=t;
	    }
	  }
	}
      }
    }
    printf("%d\n",s);
  }
  return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();

        int ans = solve(A, B);
        System.out.println(ans);
    }

    private static int solve(int A, int B) {
        int count = 0;

        for (int i=A; i<=B; i++) {
            if(isPalindrome(i)) count++;
        }

        return count;
    }

    private static boolean isPalindrome(int N) {
        if (N/10000 == N%10 && (N/1000)%10 == (N/10)%10) return true;
        
        return false;
    }
}

Measured memory_bytes: 21588
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	n, k := io.NextInt(), io.NextInt()
	cnt := make([]int, n)
	for i := 0; i < k; i++ {
		di := io.NextInt()
		for j := 0; j < di; j++ {
			aij := io.NextInt() - 1
			cnt[aij]++
		}
	}
	ans := 0
	for i := range cnt {
		if cnt[i] == 0 {
			ans++
		}
	}
	io.Println(ans)
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 2012
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>

#define mod 1000000007

using namespace std;
using ll = long long;

void solve() {
    int n, k, res = 1;
    cin >> n >> k;

    for(int i = 0; i < n; i++){
        res = min(res*2, res+k);
    }
    cout << res << endl;
}

int main(){
    solve();
    return 0;
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
ll score(P x,ll i){
  return abs(i-x.second)*x.first;
}
signed main(){
  init_io();
  ll n,ans=0;
  cin >> n;
  vector<P> a(n);
  vector<vector<ll>> dp(n+1,vector<ll>(n+1,0));
  for(int i=0;i<n;i++){
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(),a.end(),greater<P>());
  for(int i=0;i<n;i++){
    for(int l=0;l<=i+1;l++){
      ll r = i+1-l;
      if(l!=0){
        dp[l][r] = max(dp[l-1][r]+score(a[i],l-1),dp[l][r]);
      }
      if(r!=0){
        dp[l][r] = max(dp[l][r-1]+score(a[i],n-r),dp[l][r]);
      }
      ans = max(ans,dp[l][r]);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 34536
n, m = gets.chomp.split(" ").map(&:to_i)


@g = Array.new(n+1){Array.new()}

m.times do
  l, r, d = gets.chomp.split(" ").map(&:to_i)
  @g[l] << [r, d]
  @g[r] << [l, -d]
end

@visited = Array.new(n+1)

def dfs(g, s, v)
  if !@visited[s].nil?
    return true
  end
  stack = [s]
  @visited[s] = 0
  while !stack.empty?
    nx = stack.pop
    @g[nx].each do |node, dist|
      if @visited[node].nil?
        stack << node
        @visited[node] = @visited[nx] + dist
      elsif @visited[node] != @visited[nx] + dist
        return false
      end
    end
  end
  return true
end

flag = true
n.times do |i|
  ans = dfs(@g, i+1, @visited)
  if !ans
    flag = false
    break
  end
end

if flag
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 47828
#include<bits/stdc++.h>
//#define local

using namespace std;
typedef long long int ll;
typedef vector<int> vec;
typedef vector<ll> vecl;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    #ifdef local
        freopen("input.txt","r",stdin);
    #endif
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < 3; i++)
    {
        if(s[i] == 'R')
            ans += 1;
    }
    if(s[1] == 'S' && ans == 2)
        ans--;
    cout << ans;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>

//Common
using namespace std;using f64 = double;using i64=long long;using u64=unsigned long long;
template<typename T> using Arr=vector<T>;template<typename T> using Func=function<T>;template<typename T> using Str=basic_string<T>;
#define hfor(v, s, e) for(int v=(s);(s)<=v&&v<(e);++v)//half-opened range
#define hfori(v, s, e) for(int v=(e)-1;(s)<=v&&v<(e);--v)//inversion
#define hforo(v, s, e) int v=(s);for(;(s)<=v&&v<(e);++v)//out declaration
#define hforoi(v, s, e) int v=(e)-1; for(;(s)<=v&&v<(e);--v)
#define cfor(v, s, e) hfor(v,(s),(e)+1)//closed range
#define cfori(v, s, e) hfori(v,(s),(e)+1)
#define cforo(v, s, e) hforo(v,(s),(e)+1)
#define cforoi(v, s, e) hforoi(v,(s),(e)+1)
#define rep(v,x) hfor(v,0,(x))
#define repi(v,x) hfori(v,0,(x))
#define repo(v,x) hforo(v,0,(x))
#define all(x) (x).begin(),(x).end()
#define pushb push_back
#define pushf push_front
#define popb pop_back
#define popf pop_front
#define empl emplace
#define emplb emplace_back
#define emplf emplace_front
#define fi first
#define se second
#define cxp constexpr
#define PQMIN(...) std::priority_queue<__VA_ARGS__,Arr<__VA_ARGS__>,greater<__VA_ARGS__>>
template<class... A>
auto ARR(auto n, A&&...a){
	if constexpr(sizeof...(a)==0) return n;
	else return vector(n,ARR(a...));
}

//Math
template<typename T> cxp T inf() { return numeric_limits<T>::max() / 2; }
template<typename T> inline T sq(T x){return x*x;}
cxp int lgc(int x){return 64-__builtin_clzll(x-1);}
cxp int lgf(int x){return 63-__builtin_clzll(x);}
int rd(int lb, int ub){static mt19937 rng(time(0)^i64(new int)); return uniform_int_distribution<int>(lb, ub-1)(rng);}
int rd(int ub=inf<int>()){return rd(0,ub);}
const f64 pi=acosl(-1), eps=1e-10;

//IO
template<typename T>ostream& operator<<(ostream& s, const Arr<T>& a) {for(auto i:a) cout<<i<<' '; return s;}
auto cinint(){i64 x;cin>>x;return x;}
auto cinchr(){char x;cin>>x;return x;}
auto cinints(int n){Arr<i64> a(n);for(auto&i:a)cin>>i;return a;}
#ifndef DEBUG
	//#pragma GCC optimize ("Ofast") //somtimes it become more slower
	auto __PRE_RUN__=(ios::sync_with_stdio(0), cin.tie(0), cout.tie(0),(cout<<fixed<<setprecision(11)), 0);
#endif

//Misc
int sz(const auto& x){return x.size();}
auto split(auto s, auto p){
	Arr<decltype(s)> ret;
	auto it1=s.begin();
	for(auto it2=it1; (it2 = find(it1,s.end(),p)) != s.end(); it1=it2+1)
		ret.pushb({it1, it2});
	ret.pushb({it1,s.end()});
	return ret;
}
template<typename T> T rev(const T& a){return {a.rbegin(),a.rend()};}
Arr<int> range(int n){ Arr<int> ret(n); rep(i,n)ret[i]=i; return ret; }
struct defer{ defer(auto f):f(f){} ~defer(){f();} function<void()> f; };
#define defer(x) auto _##__COUNTER__ = defer([&](){x;});
#define lam(expr, ...) [&](__VA_ARGS__){return expr;}
#define reduce accumulate

#define endl '\n'//not interactive?
#define int i64//MLE?
using pint = pair<int,int>;
using tint = tuple<int,int,int>;

signed main(){
	int n; cin>>n;
	int ans=0;
	rep(i,n){
		int x; cin>>x;
		if(i%2==0 and x%2)
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define MOD 256
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int I[256];
int main() {
	int n;
	while (scanf("%d", &n), n) {
		rep(i, n)scanf("%d", &I[i]);
		int S, A, C;
		double Min = INFINITY;
		rep(s, 16)rep(a, 16)rep(c, 16) {
			int r = s;
			int x[256]{};
			rep(i, n) {
				r = (a*r + c) % MOD;
				x[(I[i] + r) % MOD]++;
			}
			double sum = 0;
			rep(i, 256) {
				if (x[i]) {
					double d = x[i] / double(n);
					sum -= d*log10(d);
				}
			}
			if (Min > sum + 1e-10) {
				Min = sum; S = s; A = a; C = c;
			}
		}
		printf("%d %d %d\n", S, A, C);
	}
}

Measured memory_bytes: 3500
import java.util.*;
import java.io.*;
import java.math.*;

class Main
{
	public static void main (String[] args) throws Exception
	{
		// your code goes here
		BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(bu.readLine());
		int i,j,blue=0;
		char s[]=bu.readLine().toCharArray();
		ArrayList<Integer> r=new ArrayList<>();
		ArrayList<Integer> g=new ArrayList<>();
		
		for(i=0;i<n;i++)
		{
			if(s[i]=='R') r.add(i);
			else if(s[i]=='G') g.add(i);
			else blue++;
		}
		if(r.size()==0 || g.size()==0 || blue==0) {System.out.print("0"); return;}
		long ans=0;
		for(i=0;i<r.size();i++)
		for(j=0;j<g.size();j++)
		{
			int x=r.get(i),y=g.get(j);
			int diff=y-x,pt=y+diff,pt2=x-diff,m=0;
			if(pt>=0 && pt<n && s[pt]=='B') m++;
			if(pt2>=0 && pt2<n && s[pt2]=='B') m++;
			int start=0,end=0,pt3=0;
			start=x<y?x:y;
			end=x+y-start;
			pt3=start+(end-start)/2;
			if(((end-start-1)%2==1) && s[pt3]=='B') m++;
			ans=ans+blue-m;
		}
		System.out.print(ans);
	}
}

Measured memory_bytes: 33628
import java.util.Scanner;


public class Main {
	
	static double p1x = 0.0;
	static double p1y = 0.0;
	static double p2x = 100.0;
	static double p2y = 0.0;
	
	static void koch(int n,double p1x,double p1y,double p2x,double p2y) {
		if(n == 0) {
			return;
		}
		double sx = (2*p1x + p2x)/3;
		double sy = (2*p1y + p2y)/3;
		double tx = (p1x + 2*p2x)/3;
		double ty = (p1y + 2*p2y)/3;
		
		double rad = Math.PI/3;
		double ux = (tx - sx)*Math.cos(rad) - (ty - sy)*Math.sin(rad) + sx;
		double uy = (tx - sx)*Math.sin(rad) + (ty - sy)*Math.cos(rad) + sy;
		
		koch(n-1,p1x,p1y,sx,sy);
		System.out.printf("%.8f %.8f",sx,sy);
		System.out.println();
		
		koch(n-1,sx,sy,ux,uy);
		System.out.printf("%.8f %.8f",ux,uy);
		System.out.println();
		
		koch(n-1,ux,uy,tx,ty);
		System.out.printf("%.8f %.8f",tx,ty);
		System.out.println();
		
		koch(n-1,tx,ty,p2x,p2y);
	}
	
	void main() {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt();
		System.out.printf("%.8f %.8f",p1x,p1y);
		System.out.println();
		
		koch(n,p1x,p1y,p2x,p2y);
		
		System.out.printf("%.8f %.8f",p2x,p2y);
		System.out.println();
	}
	
	public static void main(String[] args) {
		new Main().main();
	}

}


Measured memory_bytes: 40056
#include <bits/stdc++.h>
using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >>D;

    int num = 0;
    while(A > 0 and C > 0) {
        if(num %2 == 0) C -= B;
        else A -= D;
        num++;
    }

    if (A > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>

using namespace std;

int dist(string s, string t, int k) {
	int d = 0;

	for (int i = 0; i < t.length(); i++) {
		if (s[i+k] != t[i]) {
			d += 1;
		}
	}

	return d;
}

int main() {
	string s, t;

	cin >> s >> t;

	int ans = t.length();

	for (int i = 0; i < s.length() - t.length() + 1; i++) {
		ans = min(ans, dist(s, t, i));
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int N=15;

int n, m, k, u, v, x, y, t, a, b, ans;
int dp[1<<N];
int adj[N];
int tav[150];

inline void fix(int &x){
	if (x>=mod) x-=mod;
	if (x<0) x+=mod;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	tav[0]=1;
	for (int i=1; i<150; ++i) fix(tav[i]=2*tav[i-1]);
	cin>>n>>m;
	for (int i=0; i<m; i++){
		cin>>u>>v;
		u--;
		v--;
		adj[u]|=(1<<v);
	}
	dp[0]=1;
	for (int mask=2; mask<(1<<n); mask+=2){
		if ((mask&3)==0){
			int t=0;
			for (int v=0; v<n; v++) if (mask&(1<<v))
				t+=__builtin_popcount(adj[v]&mask);
			dp[mask]=tav[t];
			continue ;
		}
		for (int sub=mask; sub; sub=(sub-1)&mask){
			int X=mask|(mask>>1&1), Y=sub|(sub>>1&1);
			X^=Y;
			ll z=1, t=0;
			for (int v=0; v<n; v++) if (X&(1<<v)){
				int ted=__builtin_popcount(adj[v]&Y);
				z=z*(tav[ted]-1)%mod;
			}
			for (int v=0; v<n; v++) if (Y&(1<<v))
				t+=__builtin_popcount(adj[v]&X);
		
			z=z*tav[t]%mod;
			dp[mask]=(dp[mask] + z*dp[mask^sub])%mod;
		}
	}
	fix(ans=tav[m]-dp[(1<<n)-2]);
	cout<<ans<<"\n";
	
	return 0;
}
/*
4 6
1 2
1 3
1 4
2 3
2 4
3 4

*/

Measured memory_bytes: 3684
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvld;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

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

    int K, T;
    cin >> K >> T;

    vi a(T);
    rep(i, T) cin >> a[i];

    sort(all(a), greater<int>());

    int x = 0;
    int y = 0;

    for (auto c : a)
    {
        (x < y ? x : y) += c;
    }

    cout << max(abs(2 * x - K) - 1, 0) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N,C;
    cin >> N >> C;
    vector<ll> s(N), t(N), c(N);
    vector<vector<ll>> S(C, vector<ll>(100010));
    rep(i,N){
        cin >> s[i] >> t[i] >> c[i];
        s[i]--;t[i]--;c[i]--;
        S[c[i]][s[i]]++;
        S[c[i]][t[i]]--;
    }
    vector<ll> SS(100010);
    rep(i,100010){
        rep(j,C){
            if(S[j][i] > 0){
                if(i == 0){
                    continue;
                }else{
                    S[j][i-1]++;
                    S[j][i]--;
                }
            }
            //SS[i] += S[c[j]][i];
        }
    }
    rep(i,100010){
        rep(j,C){
            SS[i] += S[j][i];
        }
    }
    ll ans = 0;
    rep(i,100009){
        SS[i+1] += SS[i]; 
    }
    rep(i,100010){
        cmax(ans, SS[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 29880
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

int main(){
    ll r,g;
    cin >> r >> g;
    cout << 2*g-r << endl;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n) for(int i = 0; i < (n); i++)
const int MOD = 1e9+7;
int gcd(int a, int b){ //a>=0,b>=0,￢(a=b=0)
  while(min(a,b)>0){if(a<b)swap(a,b);a=a%b;}return max(a,b);
}
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct Edge{int to,weight;};
/*----------------------------------------------*/

signed main(){
  int a,b;
  string s,t,u;
  cin>>s>>t>>a>>b>>u;
  int ans;
  if(s==u) cout<<a-1<<" "<<b<<endl;
  else cout<<a<<" "<<b-1<<endl;;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=1000000007,INF=1ll<<60;
int dx[]={0,0,1,-1};
int dy[]={-1,1,0,0};
typedef pair<int,pint>P2;
typedef vector<vint>vvint;
 
int N,ma=-1;
int a[101];
int cnt[101];
 
signed main() {
    IOS();
    cin>>N;
    rep(i,0,N){
        cin>>a[i];
        cnt[a[i]]++;
        chmax(ma,a[i]);
    }
    
    if(ma==1){
        if(N!=2){
            cout<<"Impossible"<<endl;
        }else if(a[0]!=1||a[1]!=1){
            cout<<"Impossible"<<endl;
        }else{
            cout<<"Possible"<<endl;
        }
        return 0;
    }
    
    for(int i=ma;i>=(ma+1)/2;i--){
        if(i==(ma+1)/2&&ma%2==0){
            if(cnt[i]!=1){
                cout<<"Impossible"<<endl;
                return 0;
            }
        }else if(i==(ma+1)/2&&ma%2){
            if(cnt[i]!=2){
                cout<<"Impossible"<<endl;
                return 0;
            }
        }else{
            if(cnt[i]<2){
                cout<<"Impossible"<<endl;
                return 0;
            }
        }
    }
    for(int i=(ma+1)/2-1;i>=0;i--){
        if(cnt[i]){
            cout<<"Impossible"<<endl;
            return 0;
        }
    }
    cout<<"Possible"<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

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

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

	long long d = 0;
	int count = 1;
	for (int i = 0; i < n; i++)
	{
		d += L[i];

		if (d > x)
		{
			break;
		}

		count++;
	}

	cout << count << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 200000

int main(){

  int i;
  int R[MAX], n;
  int maxv = -2000000000;
  int minv;
  
  scanf("%d", &n);
  
  for(i=0; i<n; i++)
    scanf("%d", &R[i]);

  minv = R[0];
  
  for(i=1; i<n; i++){
    if(maxv < (R[i]-minv)) maxv = R[i] - minv;
    if(minv > R[i]) minv = R[i];
  }

  printf("%d\n", maxv);
  
  return 0;
}



Measured memory_bytes: 2644
#include<cstdio>
#include<queue>
#include<vector>
#include<functional>
#include<algorithm>
#include<iostream>
#include<cstring>

using namespace std;

class data{
public:
	int x,y,rx,ry,s,cost;
	bool operator<(const data &d1)const{
		return d1.cost<cost;
	}
};

int w,h;
int dp[35][65][5][7][4];
int fie[100][100];
int flag[100][100];
int sx[50],scnt;

int dijk(){
	memset(dp,-1,sizeof(dp));
	priority_queue<data> que;
	data inp;
	int res=-1;
	inp.y=h;
	inp.rx=1;
	inp.ry=3;
	inp.cost=0;
	for(int i=0;i<scnt;i++){
		inp.x=sx[i];
		inp.s=2;
		que.push(inp);
		inp.x=sx[i]-1;
		inp.s=3;
		que.push(inp);
	}
	while(que.size()){
		data q=que.top();
		que.pop();
		if(dp[q.x][q.y][q.rx][q.ry][q.s]!=-1 && dp[q.x][q.y][q.rx][q.ry][q.s]<q.cost)continue;
		dp[q.x][q.y][q.rx][q.ry][q.s]=q.cost;
		if(flag[q.x][q.y]==1 || flag[q.x+q.rx][q.y+q.ry-3]==1){
			res=min(res,q.cost);
			if(res==-1)res=q.cost;
		}
		if(q.s%2==0){
			for(int i=1;i<=3;i++){
				for(int j=-3;j<=3;j++){
					if(i+abs(j)>3)continue;
					if(q.x+i>=1 && q.x+i<=w && q.y+j>=1 && q.y+j<=h){
						if(fie[q.x+i][q.y+j]!=-1){
							if(dp[q.x][q.y][i][j+3][1]==-1 || dp[q.x][q.y][i][j+3][1]>q.cost+fie[q.x+i][q.y+j]){
								dp[q.x][q.y][i][j+3][1]=q.cost+fie[q.x+i][q.y+j];
								data nq=q;
								nq.rx=i;
								nq.ry=j+3;
								nq.s=1;
								nq.cost=q.cost+fie[q.x+i][q.y+j];
								que.push(nq);
							}
						}
					}
				}
			}
		}
		if(q.s%2==1){
			q.x=q.x+q.rx;
			q.y=q.y+q.ry-3;
			for(int i=-3;i<=-1;i++){
				for(int j=-3;j<=3;j++){
					if(-i+abs(j)>3)continue;
					if(q.x+i>=1 && q.x+i<=w && q.y+j>=1 && q.y+j<=h){
						if(fie[q.x+i][q.y+j]!=-1){
							if(dp[q.x+i][q.y+j][-i][-j+3][0]==-1 || dp[q.x+i][q.y+j][-i][-j+3][0]>q.cost+fie[q.x+i][q.y+j]){
								dp[q.x+i][q.y+j][-i][-j+3][0]=q.cost+fie[q.x+i][q.y+j];
								data nq;
								nq.x=q.x+i;
								nq.y=q.y+j;
								nq.rx=-i;
								nq.ry=-j+3;
								nq.s=0;
								nq.cost=q.cost+fie[q.x+i][q.y+j];
								que.push(nq);
							}
						}
					}
				}
			}			
		}
	}
	return res;
}

int main(void){
	while(1){
		scanf("%d %d",&w,&h);
		if(w+h==0)break;
		memset(fie,0,sizeof(fie));
		memset(flag,0,sizeof(flag));
		scnt=0;
		for(int i=1;i<=h;i++){
			for(int j=1;j<=w;j++){
				char c;
				cin >> c;
				if(c=='S')fie[j][i]=0,sx[scnt]=j,scnt++;
				if(c=='T')fie[j][i]=0,flag[j][i]=1;
				if(c=='X')fie[j][i]=-1;
				if(c>='1' && c<='9')fie[j][i]=c-'0';
			}
		}
		printf("%d\n",dijk());
	}
	return 0;
}

Measured memory_bytes: 2680
#include <bits/stdc++.h>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr int INF = 1001001001;
constexpr int MOD = 998244353;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main() {
    int n, k;
    cin >> n >> k;
    vector<P> s(k);
    rep (i, k) {
        int l, r;
        cin >> l >> r;
        s[i] = make_pair(l, r);
    }
    
    vector<ll> dp(n, 0);
    vector<ll> sum(n, 0);
    dp[0] = 1;
    sum[0] = 1;
    rep (i, 1, n) {
        //cout << "i:" << i << endl;
        ll d = 0;
        for (auto p : s) {
            int l = i - p.second, r = i - p.first;
            //cout << " l:" << l << " r:" << r << endl;
            if (r < 0) continue;
            //rep (k, l, r+1) d += dp[k];
            if (l == r) d += dp[l];
            else if (l <= 0) d += sum[r];
            else d += sum[r] - sum[l-1];
            d = (d + MOD) % MOD;
            //cout << "  d:" << d << endl;
        }
        dp[i] = d;
        //cout << "   dp[" << i << "]:" << dp[i] << endl;
        dp[i] %= MOD;
        sum[i] = dp[i] + sum[i-1];
        sum[i] %= MOD;
    }
    cout << dp[n-1] << endl;
    
    return 0;
}


Measured memory_bytes: 6352
#include <bits/stdc++.h>
using namespace std;

int main() {
    string ABCD;
    cin >> ABCD;

    int A = (int)(ABCD[0]-'0');
    int B = (int)(ABCD[1]-'0');
    int C = (int)(ABCD[2]-'0');
    int D = (int)(ABCD[3]-'0');

    if (A+B+C+D == 7) cout << A << '+' << B << '+' << C << '+' << D << "=7";
    else if (A+B+C-D == 7) cout << A << '+' << B << '+' << C << '-' << D << "=7";
    else if (A+B-C+D == 7) cout << A << '+' << B << '-' << C << '+' << D << "=7";
    else if (A-B+C+D == 7) cout << A << '-' << B << '+' << C << '+' << D << "=7";
    else if (A+B-C-D == 7) cout << A << '+' << B << '-' << C << '-' << D << "=7";
    else if (A-B-C-D == 7) cout << A << '-' << B << '-' << C << '-' << D << "=7";
    else if (A-B-C+D == 7) cout << A << '-' << B << '-' << C << '+' << D << "=7";
    else if (A-B+C-D == 7) cout << A << '-' << B << '+' << C << '-' << D << "=7";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll mod = 1000000007;



void solve(){
    int n;
    cin >> n;
    int h[n+10];
    rep(i,n){
        cin >> h[i];
    }

    int count = 0;
    int ans = 0;
    for(int i=n-2; i>=0; i--){
        if(h[i]>=h[i+1]){
            count++;
        }
        else{
            count = 0;
        }
        ans = max(ans,count);
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 640
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <string.h>
#include <string>
#include <cmath>
#include <cstdio>
#include <functional>
#include <map>
#include <typeinfo>
#include<bits/stdc++.h>
#define INF 1e9
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<double, double> pd;
typedef pair<ll, ll> pl;

ll gcd(ll a, ll b){
	while(b!=0){
		ll r = a%b;
		a= b;
		b= r;
	}
	return a;
}

ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

int main()
{
  FILE *inF, *outF;
  //inF = fopen("in", "r");
  //outF = fopen("out", "w");
  inF = stdin;
  outF = stdout;
  
  int a, b;
  fscanf(inF, "%d %d", &a, &b);
  
  printf("%lld", lcm(a, b));
  
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;

struct P
{
    int x,y;
    bool operator<(const P &a)const{
              return x>a.x;
    }
};

vector<int> v;
//bitset<4001000> b;
int a,c,i,b,k,n,d,e,m;//dy[15]={0,1,0,-1,-1,1,-1,1},dx[15]={1,0,-1,0,1,1,-1,-1};//
int o[333350];
long long l[333351];
int j[333355];
int dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};


long long x,y,mod=1000000007;
long long z;

P u[10];
stack<int> s,s1;

//set<int> s;
queue<int> q;


//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
//map<int,int> p[10100];
//list<int> l;

//string r;
char r[335333];
//deque<int> de;
bool as(P a,P b)
{
    return a.x>b.x;
}



int main()
{
    scanf("%d",&a);
    for(int t=1;t<=a;l[t]=o[t]+l[t-1],j[t]=j[t-1]^o[t],t++)
        scanf("%d",&o[t]);
    n=0;
    for(int t=1;t<=a;t++)
    {
        //printf("%d ",j[t]);
        for(;(l[t]-l[n])!=(j[t]^j[n]);n++)
        {
            ;//printf("%lld %d %d %d\n",l[t]-l[n],j[t]^j[n],n,t);
        }
        x+=(long long)(t-n);
        //printf("%d %d %d %lld\n",n,t,j[t]^j[n],x);
    }
printf("%lld",x);
}




Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s,t;
	cin>>s>>t;
	
	int n = s.size();
	int m = t.size();
	
	int dp[n+1][m+1];
	
	
	
	for(int i=0;i<=n;i++)
	{
	   for(int j=0;j<=m;j++)
	   {
	   	   if(i==0||j==0)
	   	   {
	   	   	  dp[i][j] = 0;
		   }
	       else if(s[i-1]==t[j-1])
		   {
		   	dp[i][j] = 1+dp[i-1][j-1];
		   }
			else
			{
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
			}	
	   }	
	}
	
	int index = dp[n][m];
	
	string lcs;
	int i=n,j=m;
	
	while(i>0 && j>0)
	{
		if(s[i-1]==t[j-1])
		{
			lcs += s[i-1];
			i--;j--;
		}
		
		else if(dp[i-1][j]>dp[i][j-1])
		i--;
		
		else
		j--;
	}
	
	reverse(lcs.begin(),lcs.end());
	cout<<lcs<<"\n";
	
	return 0;	
}

Measured memory_bytes: 38784
n,m=map(int,input().split())
l=[1]*n
h=list(map(int,input().split()))
for i in range(m):
    a,b=map(int,input().split())
    if h[a-1]>h[b-1]:
        l[b-1]=0
    elif h[a-1]<h[b-1]:
        l[a-1]=0
    else:
        l[a-1]=0
        l[b-1]=0
print(l.count(1))


Measured memory_bytes: 20736
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  for(Int i=0;i<n;i++){
    for(Int j=0;j<i;j++){
      if(abs(a[i]-a[j])%(n-1)==0){
	cout<<a[i]<<" "<<a[j]<<endl;
	return 0;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3108
import java.util.Scanner;

class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		String str;
		int t, n;
		double i = 0;
		int sum = 0;
		double ave = 0;
		
		while(scan.hasNext()){
			str = scan.next();
			String[] num = str.split(",", 0);
			
			t = Integer.parseInt(num[0]);
			n = Integer.parseInt(num[1]);
			
			sum += t * n;
			ave += (double)n;
			i++;
		}
		System.out.println(sum);
		System.out.println(Math.round(ave / i));
	}
}

Measured memory_bytes: 25828
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define N 200010
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,H,W;
ll ans;
struct Union_Set{
	int f[N];
	bool c[N];
	void init(int n){
		for(int i=1;i<=n;++i){
			f[i]=i;
			c[i]=false;
		}
	}
	inline int getf(int x){
		return f[x]==x?x:f[x]=getf(f[x]);
	}
}S;
struct Point{
	int x,y,w;
	bool operator <(const Point b)const{
		return w>b.w;
	}
}a[N];
int main(){
	n=read(),H=read(),W=read();
	S.init(H+W);
	for(int i=1;i<=n;++i){
		a[i].x=read(),a[i].y=read(),a[i].w=read();
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;++i){
		int fx=S.getf(a[i].x),fy=S.getf(a[i].y+H);
		if(fx==fy){
			if(S.c[fx])continue;
			S.c[fx]=true;
		}
		else{
			if(S.c[fx]&&S.c[fy])continue;
			S.c[fx]|=S.c[fy];
			S.f[fy]=fx;
		}
		ans+=a[i].w;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 6552
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <math.h>
#define rep(i,n) for(int i=0;i<=(n);i++)
using namespace std;


int main(){
  int n;cin>>n;
  if(n == 3 || n == 5 || n == 7){
    cout << "YES";
  }else{
    cout << "NO";
  }
  cout << endl;
}


Measured memory_bytes: 256
import numpy as np
N, W = map(int, input().split())
ws, vs = zip(*[map(int, input().split()) for _ in range(N)])
INF = 10**13

def maxvalue_dp(ws, vs, W):
    V = sum(vs)
    dp = np.zeros(V + 1, np.int64)
    dp += INF
    dp[0] = 0
    for w, v in zip(ws, vs):
        dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
    for v in range(V, -1, -1):
        if dp[v] <= W:
            return v

print(maxvalue_dp(ws, vs, W))

Measured memory_bytes: 14780
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
ll n,k,a[100010];
int main(){
    cin>>n;
    ll sum=0,mini=0;
    while(n--){
	ll x;cin>>x;
	sum+=x;
	mini=max(mini,x);
    }
    cout<<sum-mini/2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k,s;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> k >> s;
    for(int i = 1;i <= k;i++) {
        cout << s << " ";
    }
    int go;
    if(s > n) {
        go = 1;
    }
    else go = 1000000000;
    for(int i = k+1;i <= n;i++) {
        cout << go << " ";
    }
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
const int N=100005;
int n,k,fa[N];
int ans=0,Maxd[N];
vector <int> e[N];
void solve(int x){
	Maxd[x]=0;
	for (auto y : e[x]){
		solve(y);
		Maxd[x]=max(Maxd[x],Maxd[y]+1);
	}
	if (Maxd[x]==k-1&&fa[x]!=1)
		ans++,Maxd[x]=-1;
}
int main(){
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++)
		e[i].clear();
	for (int i=1;i<=n;i++){
		scanf("%d",&fa[i]);
		if (i>1)
			e[fa[i]].push_back(i);
	}
	if (fa[1]!=1)
		fa[1]=1,ans++;
	solve(1);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const long long INF = 1LL << 60;
const int MOD = 1000000007;
using namespace std;
using vec = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}
template <class T> inline bool chmin(T &a, T b) { if ( a > b ) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T &a, T b) { if ( a < b ) { a = b; return 1; } return 0; }
const int dy[4] = {-1, 0, 0, 1};
const int dx[4] = {0, -1, 1, 0};

int N, K;
ll res = 1LL << 60;

int main(int argc, char *argv[]){
    cin >> N >> K;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
    sort(all(H));
    rep(i, N - K + 1) res = min(res, H[i + K - 1] - H[i]);
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>

using namespace std;

const int N = 110;
int x, n, a[N];
set<int> s;

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif

	for (int i = 0; i < N; i++){
		s.insert(i);
	}

	scanf("%d %d", &x, &n);
	
	for (int i = 0; i < n; i++){
		int p;
		scanf("%d", &p);
		s.erase(p);
	}

	std::vector<int> a;

	for (auto i : s){
		a.push_back(i);
	}

	int op1 = lower_bound(a.begin(), a.end(), x) - a.begin(),
		op2 = upper_bound(a.begin(), a.end(), x) - a.begin();

	int ans = op1;

	if (a[op1] > x && op1 > 0){op1--; ans = op1;}
	if (abs(a[op2] - x) < abs(a[op1] - x))
		ans = op2;

	printf("%d\n", a[ans]);

	return 0;
}

Measured memory_bytes: 3768
use std::io;
use std::str::FromStr;

static MOD: u64 = 1_000_000_007;

fn input_tuple() -> (u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn main() {
    let (n, k) = input_tuple();

    let mut sum = 0;
    let mut min = 0;
    let mut max = 0;
    for i in k..(n+2) {
        if min == 0 && max == 0 {
            for j in 0..i {
                min += j;
                max += (n - j);
            }
        } else {
            min += i - 1;
            max += (n + 1 - i);
        }
        sum += (max - min + 1) % MOD;
        sum %=  MOD;

    }
    println!("{}", sum);
}


Measured memory_bytes: 2076
#include<cstdio>
#include<vector>
using namespace std;

int main(){
    int n, q, a;
    vector<int> v;

    scanf("%d", &n);
    for(int i = 0; i< n; i++){
        scanf("%d", &q);
        if(q==0){
            scanf("%d", &a);
            v.push_back(a);
        }else if(q==1){
            scanf("%d", &a);
            printf("%d\n", v.at(a));
        }else{
            v.pop_back();
        }
    }
    return 0;
}


Measured memory_bytes: 3440
#include <bits/stdc++.h>

#define fo(i,a,b) for (int i=(a); i<(b); i++)
#define sz(v) int(v.size())

using namespace std;
char res[1000][1000];

int main() {
    int h, w, d;
    scanf("%d %d %d", &h, &w, &d);
    int l = 2*d;
    fo(y,0,h) fo(x,0,w) {
        int a = ((y-x)%l+l)%l;
        a /= d;
        int b = ((y+x)%l+l)%l;
        b /= d;
        int s = (a<<1)|b;
        res[y][x] = "RGBY"[s];
    }
    fo(y,0,h) printf("%s\n", res[y]);
}


Measured memory_bytes: 1024