akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back      
#define F first
#define S second
#define SS stringstream
#define sqr(x) ((x)*(x))
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define CC(x) cout << (x) << endl
#define pw(x) (1ll<<(x))
#define buli(x) __builtin_popcountll(x)
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define M 1000000007
#define N 211111

#define TASK "1"

using namespace std;

int n, m, q;
vector<int> need[N], ans[N];

int used[N];
int t[N];
int was[N];

vector<int> dop(vector<int> a) {
	for (int i = 1; i <= m; i++) used[i] = 0;
	for (int i = 0; i < a.size(); i++) used[a[i]] = 1;
	for (int i = 1; i <= m; i++) if (!used[i]) a.pb(i);
	return a;
}

int main(){
	#ifdef home
		freopen(TASK".in","r",stdin);	
		freopen(TASK".out","w",stdout);
	#endif		
	ios::sync_with_stdio(false);
	cin >> n >> m >> q;
	for (int i = 0; i < q; i++) {
		cin >> t[i];
	}
	for (int i = 1; i < n; i++) need[0].pb(i);

	for (int i = q - 1; i >= 0; i--) {
		int g = t[i];

		if (was[g] == 0) {
			ans[0].pb(g);
			was[g] = 1;

			for (int h : need[0]) need[g].pb(h);
			need[0].clear();

			continue;
		}
		if (need[g].size() == 0) {
			continue;
		}

		int t = need[g].back();
		need[g].pop_back();

		ans[t].pb(g);

		if (ans[t].size() < m) {
			if (ans[0].size() == ans[t].size()) need[0].pb(t); else need[ans[0][ans[t].size()]].pb(t);
		}
	}
//	for (int i = 0; i < n; i++) {
//		for (int j = 0; j < ans[i].size(); j++) cout << ans[i][j] << " ";
//		cout << endl;
//	}
	int x = -1;
	for (int i = 0; i < n; i++) if (x == -1 || ans[i].size() < ans[x].size()) x = i;
	if (dop(ans[0]) != dop(ans[x])) cout << "No\n"; else cout << "Yes\n" << endl;

	return 0;
}

Measured memory_bytes: 15992
#include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char **argv)
{
	int *a, n, k, t;
	
	while(1){
		cin >> n >> k;
		if(n == 0){
			break;
		}
		
		if(k == 1){
			a = (int *)calloc(2, sizeof(int));
		} else {
			a = (int *)calloc(k, sizeof(int));
		}
		
		for(int i = 0; i < k; i++){
			cin >> t;
			a[i] = t;
		}
		
		for(int i = 0; i < n; i++){
			for(int j = 0; j < k; j++){
				cin >> t;
				a[j] -= t;
			}
		}
		
		t = 0;
		for(int i = 0; i < k; i++){
			if(a[i] < 0){
				t = 1;
				break;
			}
		}
		
		cout << ((t == 0)? "Yes" : "No") << endl;
		
		free(a);
	}
	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>

using namespace std;

int main() {
    int N, A, B;

    cin >> N >> A >> B;

    if ((A * N) > B) {
        cout << B << endl;
    } else if ((A * N) < B) {
        cout << A * N << endl;
    } else if ((A * N) == B) {
        cout << B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        int N, C, K, ans = 1;
        Integer[] T;

        void solve(InputReader in, PrintWriter out) {
            N = in.nextInt();
            C = in.nextInt();
            K = in.nextInt();
            T = new Integer[N];
            for (int i = 0; i < N; ++i) {
                T[i] = in.nextInt();
            }
            Arrays.sort(T);

            int arriveAt = T[0] + K, capacity = C;
            for (int i = 0; i < N; ++i) {
                if (T[i] > arriveAt || capacity <= 0) {
                    ans++;
                    arriveAt = T[i] + K;
                    capacity = C;
                }
                capacity--;
            }

            out.println(ans);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }

        long nextLong() { return Long.parseLong(next()); }

        int[] nextIntArray(int n) {
        	int[] arr = new int[n];
        	for (int i = 0; i < n; ++i) {
        		arr[i] = nextInt();
        	}
        	return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; ++i) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


Measured memory_bytes: 37344
#include <stdio.h>
#include <stdlib.h>

int f(int x, int y, int z)
{
	int r;
	r = x*x + y*y + z*z + x*y + y*z + z*x;
	return (r);
}
int	main(void)
{
	int n;
	scanf("%d",&n);
	int *arr;
	arr = calloc(sizeof(int),n);
	int i = 1;
	int j = 1;
	int k = 1;
	while (i < 99)
	{
		j = 1;
		while (j < 99)
		{
			k = 1;
			while (k < 99)
			{
				int index = f(i,j,k);
				if (i + j + k <= 140)
					arr[index-1]++;
				k++;
			}
			j++;
		}
		i++;
	}
	i = 0;
	while (i < n)
	{
		printf("%d\n",arr[i]);
		i++;
	}
	return (0);
}


Measured memory_bytes: 2164
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { reader: s.lock() };
    let n: i64 = sc.read();
    let a: i64 = sc.read();
    let b: i64 = sc.read();

    let max = cmp::min(a, b);
    let min = cmp::max(a + b - n, 0);
    println!("{} {}", max, min);
}

pub struct Scanner<R> {
    reader: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
	int dis[10], v_0 = 0,v_1 = 0;
	while( scanf("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d",&dis[0],&dis[1],&dis[2],&dis[3],&dis[4],&dis[5],&dis[6],&dis[7],&dis[8],&dis[9],&v_0,&v_1)==12){
		int dsum = 0;
		double acum[10];
		for(int x=0;x<10;++x){
			dsum += dis[x];
			acum[x] = 1.0*dsum;
		}		
		double dd = v_0 * (dsum*1.0/(v_0+v_1));
		//cout<<dd<<endl;
		int index = 0;
		while(index<10 && acum[index]<dd){
			++index;
		}
		--index;
		if(acum[index]==dd)cout<<index+1<<endl;
		else cout<<index+2<<endl;
	}
	return 0;
}

Measured memory_bytes: 1204
n = int(input())
List = [list(map(int,input().split())) for i in range(n)]

dp = [[0, 0, 0] for _ in range(n+1)]
dp[0] = [List[0][0], List[0][1], List[0][2]]

for i in range(1, n):
    for j in range(3):
        for k in range(3):
            if j != k: dp[i][j] = max(dp[i][j], dp[i-1][k]+List[i][j])

print(max(dp[n-1]))

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

int main () {
  string c;
  cin >> c;
  
  if (c == "a" || c == "e" || c == "i" || c == "o" || c == "u"){
    cout << "vowel" << endl;
  }
  
  else  {
  cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rgi register int
#define ll long long
class fastin{
	private: int _ch,_f;
	public: inline fastin& operator>>(char&c) {c=getchar(); return *this;}
		template<typename _Tp> inline fastin& operator>>(_Tp&_x){
		_x=0; while(!isdigit(_ch)) _f|=(_ch==45),_ch=getchar();
		while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),_ch=getchar();
		_f&&(_x=-_x,_f=0); return *this;}
	fastin() {_ch=_f=0;}
}fin;
class fastout{
#define endl '\n'
	private: int _num[32],_head;
	public: inline fastout& operator<<(char c) {putchar(c); return *this;}
		template<typename _Tp> inline fastout& operator<<(_Tp _x){
		_Tp _k; if(_x==0) {putchar('0'); return *this;} if(_x<0) putchar('-'),_x=-_x;
		while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
		while(_head>0) putchar(_num[_head]),--_head; return *this;}
	fastout() {_head=0;}
}fout;
// ----------------------------
// #define int ll
// using namespace std;
const int maxn=200004;
const int mod=998244353,inf=1000000007;

signed main()
{
	int a,b; fin>>a>>b;
	fout<<a*b;
	return 0;
}
// ----------------------------
// by imzzy


Measured memory_bytes: 3652
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int N,K;
    R(N,K);
    VI AA(N);
    REP(i,N){
        R(AA[i]);
    }
    sort(ALL(AA));
    int an=1e9;
    REPP(i,K-1,N){
        an=min(an,AA[i]-AA[i-K+1]);
    }
    W(an);
    return 0;
}


Measured memory_bytes: 640
// AOJ 2001 "Amida, the City of Miracle" (ICPC模擬国内予選 2006 Problem B)
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final int MAX_H = 1000;
        Scanner sc = new Scanner(System.in);
        
        while (true) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int a = sc.nextInt();
            if (n == 0) {
                break;
            }
            
            boolean[][] hline = new boolean[MAX_H+1][n+1];
            for (int i = 0; i < m; i++) {
                int h = sc.nextInt();
                int p = sc.nextInt();
                int q = sc.nextInt();
                hline[h][p] = true;
            }
            
            int xpos = a;
            for (int h = MAX_H; h >= 1; h--) {
                if (hline[h][xpos-1]) {
                    // 左側に横棒がある場合
                    xpos--;
                } else if (hline[h][xpos]) {
                    // 右側に横棒がある場合
                    xpos++;
                }
            }
            System.out.println(xpos);
        }
    }
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll k;cin >>k;
   string s;cin >>s;
   ll n=s.size();
   if(n<=k){
       cout <<s<<endl;
   }
   else {
       cout <<s.substr(0,k)<<"..."<<endl;
   }
   return 0;
}

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

int main(){
  int n;
  cin >> n;
  if(n % 2 != 0) {
   cout << 0;
    return 0;
  }
  vector<int> nums(n);
  for(int i = 0; i < n; i++) cin >> nums[i];
  
  sort(nums.begin(), nums.end());
  
  int half = n / 2;
  
  if(nums[half] == nums[half - 1]){
   cout << 0; 
  }
  else {
   cout << nums[half] - nums[half - 1]; 
  }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define fi first 
#define se second
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
// ミント
const int mod = 1e9+7 ;
 // 998244353;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//昆布
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n,int k){
    return fact[n]*ifact[n-k] ;
  }
}   c(200005);
 
mint modpow(ll a,ll b){
 if(b==0) return 1 ;
 mint c= modpow(a,b/2) ;
 if(b%2==1) return c*c*a ;
 else return c*c ;
}

mint komb(ll n,ll m){
  mint x=1 ;mint y=1 ;
  rep(i,m){
    x*= n-i ;
    y*= i+1 ;
  }
  return x/y ;
}

 
 map<ll,ll> factor(ll n){  //素因数とオーダーをマップで管理
  map <ll,ll> ord ;  
  for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            int res=0;
            while(n%i==0){
                n/=i;
                res++;
            }
            ord[i]=res;
        }
    }
   if(n!=1) ord[n]++;
   return ord ;
 }


int main(){
   ll n ; cin>> n ;
   vector<ll> A(n) ;rep(i,n)  cin>>A[i] ;
   sort(A.begin(),A.end()) ;
   mint ans=0 ; 
   rep(i,n){
     mint k = A[i] ;
     mint pl = 0 ;
     
      pl = k*(modpow(2ll,2*n-1) +modpow(2ll,2*n-2) * (n-1-i) );
     
     ans += pl ;
   }
  
   cout<<ans<<endl ;
    return 0;
  }
   



Measured memory_bytes: 7964
import java.util.*;
import java.lang.*;

class Main{
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int N = Integer.parseInt(sc.next());
      int[] t = new int[N+1];
      int[] x = new int[N+1];
      int[] y = new int[N+1];
      for(int i = 1; i<N+1; i++){
        t[i] = Integer.parseInt(sc.next());
        x[i] = Integer.parseInt(sc.next());
        y[i] = Integer.parseInt(sc.next());
      }
      for(int i = 1; i<N+1; i++){
        int tdiff = t[i] - t[i-1];
        int xd = Math.abs(x[i]-x[i-1]);
        int yd = Math.abs(y[i]-y[i-1]);
        int dd = xd+yd;
        if(tdiff >= dd && ((tdiff-dd)%2)==0) continue;
        else{
          System.out.println("No");
          return;
        }
      }
      System.out.println("Yes");
  }
}

Measured memory_bytes: 63648
n, a, b, c, d = list(map(int, input().split()))
s = input()

jump = 0
if c < d:
    for i in range(a, d-1):
        if s[i-1] == s[i] == "#":
            print("No")
            break
    else:
        print("Yes")            
else:
    for i in range(a, c-1):
        if s[i-1] == s[i] == "#":
            print("No")
            break
    else:
        for i in range(b-1, d):
            if s[i-1] == s[i+1] == s[i] ==".":
                print("Yes")
                break
        else:
            print("No")

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






int main(){
  

  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  

  int answer=0;
  
  if ((a+b)<=2*c){
    answer=a*x+b*y;
  }
  
  else {
    if (x>=y){
      answer=2*c*y+min(a,2*c)*(x-y);
    }
    else {
      answer=2*c*x+min(b,2*c)*(y-x);
    }
  }
  
  cout<<answer<<endl;
  


    
  
  
  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;

int at(int num)
{
	if (!((num%10)==0))
	{
		num += 10 - num % 10;
	}
	return num;
}
int main()
{
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int n[5];
	n[0] = a % 10;
	n[1] = b % 10;
	n[2] = c % 10;
	n[3] = d % 10;
	n[4] = e % 10;
	int m = 10;
	for (size_t i = 0; i < 5; i++)
	{
		if (n[i] < m&&!n[i]==0)
		{
			m = n[i];
		}
	}
	int ans = 0;
	ans += at(a);
	ans += at(b);
	ans += at(c);
	ans += at(d);
	ans += at(e);
	ans -= 10 - m;
	cout << ans << endl;
    return 0;
}

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

using namespace std;

#define MOD ((long long) 1e9+7)
#define MX ((int) 1e5+1)

long long dp[102][123456];
long long rsq[223456];

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

	int sm = 0;

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

	memset(dp, 0, sizeof dp);
	dp[0][k] = 1;

	// dp[i][j] = sum(dp[i-1][j+k]) for k in range(0, a[i])
	//
	// preprocess at every i then
	// dp[i][j] = rsq[j..j+a[i]]

	for(int i = 1; i <= n; i++) {
		rsq[0] = 0;
		for(int j = 1; j <= MX*2+10; j++) rsq[j] = (rsq[j-1]+dp[i-1][j-1])%MOD;
		for(int j = 0; j <= k; j++) {
			dp[i][j] += (rsq[j+a[i-1]+1] - rsq[j] + MOD)%MOD;
			dp[i][j] %= MOD;
		}
	}

	cout << dp[n][0] << endl;
}


Measured memory_bytes: 100224
#include <bits/stdc++.h>
#define rep(I,n) for (int I = 0; I < (n); ++I)
using namespace std;
typedef long long ll;
 
int main() {
    int a;
    int b;
    
    cin >>a>>b;
    
    if(a-2*b>=0){
        cout << a-2*b <<endl;
    }
    
    else{
        
        cout << 0 <<endl;
    }
    
    
    
  
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
//-----------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int num[4][3][10];

  REP(i,4){
    REP(j,3){
      REP(k,10){
        num[i][j][k] = 0;
      }
    }
  }

  int n;
  cin >> n;
  REP(i,n){
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    num[b-1][f-1][r-1] += v;
  }

  for(int i=0;i<4;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<10;k++){
        cout << " " << num[i][j][k];
      }
      cout << endl;
    }
    if(i != 3) cout << "####################"<<endl;
  }

  return 0;
}



Measured memory_bytes: 3236
# ABC112D - Partition
from bisect import bisect_left as bs


def divisors(n: int) -> list:
    """
    Compute divisors of a number.
    
    Args: n (int): an integer to be evaluated.
    Returns: div (set): set of divisors
    """
    div = set()
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            div.add(i)
            div.add(n // i)
    return sorted(div)


def main():
    N, M = tuple(map(int, input().split()))
    if M % N == 0:
        print(M // N)
    else:
        div = divisors(M)
        ans = div[bs(div, M / N) - 1]
        print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	static int[] Shichigo = new int[1100000];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(),H = sc.nextInt(),W = sc.nextInt();
		int[] a = new int[N];
		int[] b = new int[N];
		int cnt = 0;
		for(int i = 0;i < N;i ++) {
			a[i] = sc.nextInt(); b[i] = sc.nextInt();
			if(a[i] >= H && b[i] >= W) cnt++;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 29296
def binarySearch(a, key):
    left = 0
    right = len(a)
    while left < right:
        mid = (left+right)//2
        if a[mid] == key:
            return True
        elif key < a[mid]:
            right = mid
        else:
            left = mid+1
    return False


n = int(input())
s = list(map(int, input().split()))
q = int(input())
# t = list(map(int, input().split()))

sum_ = 0

for num in map(int, input().split()):
    if binarySearch(s, num):
        sum_ += 1

print(sum_)



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

#define sz 100005
#define nl printf("\n");
#define ll long long int

char f,g;
bool flag;
pair < int ,int > pi;
map < int , int > mp;
vector < int > v,va,vb;
int arr[sz],brr[sz],crr[sz];



int main(){

    int n,m, i,j,k, x=0,y=0,z=0, a,b,c;

    cin>>a>>b;
    b/=2;
    cout<<a+b<<endl;


    return 0;

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = a; i <= b; ++i)
#define PER(i, a, b) for (int i = a; i >= b; --i)
#define RVC(i, S) for (int i = 0; i < S.size(); ++i)
#define mp make_pair
#define pb push_back
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> pii;

inline int read(){
	int x = 0, ch = getchar(), f = 1;
	while (!isdigit(ch)){if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return x * f;
}

int main(){
	int n = read();
	int cnt = 0;
	REP(i, 1, n){
		int x = read();
		if (x % 2 == 1) ++cnt;
	}
	if (cnt % 2 == 0) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;
int N;
int x, y;
bool viz[100005];
vector<int> v[100005];
struct frunza{
    long long d0=1,d1=1;
};
frunza DFS(int nod) {
    int rez = 0;
    frunza f;
    viz[nod] = true;
    for (int i : v[nod])
        if (viz[i] == 0) {
            frunza f1=DFS(i);
            f.d0 = (f.d0 * (f1.d1 + f1.d0)% 1000000007) % 1000000007;
            f.d1 = (f.d1 * f1.d0) % 1000000007;
        }
    return f;
}

int main() {
    cin >> N;
    for (int i = 1; i <= N-1; i++) {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    frunza f=DFS(1);
    cout<< (f.d1+f.d0)%1000000007;
}

Measured memory_bytes: 9984
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

class Main {


   public static void main(String args[]) throws IOException{


	   StringBuilder answer = new StringBuilder();
	   HashSet<String> Dictionary = new HashSet<String>();



	   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	   int n = Integer.parseInt( br.readLine() );

       for(int i = 0; i < n; i++  ){

    	   String[] order = br.readLine().split(" ");

    	   if( order[0].equals("insert") ){
    		   Dictionary.add(order[1]);
    	   }
    	   else if( order[0].equals("find") ){

    		   if (Dictionary.contains(order[1])) {
                  answer.append("yes\n");
    			}
    		   else{
    			   answer.append("no\n");
    		   }

    	   }

       }




       System.out.print(answer);

   }

}

Measured memory_bytes: 197724
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int l=0;
  cout<<0<<endl;
  string cl;
  cin>>cl;
  if(cl=="Vacant")
    return 0;
  int r=n-1;
  cout<<n-1<<endl;
  string cr;
  cin>>cr;
  if(cr=="Vacant")
    return 0;
  while(1){
    int h=(l+r)/2;
    cout<<h<<endl;
    string ch;
    cin>>ch;
    if(ch=="Vacant")
      return 0;
    if(((h-l)%2==0)^(cl==ch)){
      r=h;
      cr=ch;
    }else{
      l=h;
      cl=ch;
    }
  }
}

Measured memory_bytes: 3832
# coding: utf-8

a=list(map(int,input().split()))
#読み込み

a1 = a[0]
b1 = a[1]
c1 = a[2]

#AとBを入れ替え
a2 = b1
b2 = a1
c2 = c1

#AとCを入れ替え
a_fin = c2
b_fin = b2
c_fin = a2

print(str(a_fin)+" "+str(b_fin)+" "+str(c_fin))

Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 10**9 + 7
 
n = int(input())
a = [int(item) for item in input().split()]
total = sum(a)

ans = 0
for item in a:
    total -= item
    ans += total * item
    ans %= MOD

print(ans)

Measured memory_bytes: 92076
import java.util.*;

class Watch {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final int s = sc.nextInt();
        System.out.printf("%d:%d:%d\n", s / 3600, s / 60 % 60, s % 60);
    }
}
public class Main {
    public static void main(String... args) {
        Watch.main();
    }
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; scanf("%d",&n);
	vector<int> x(n),y(n);
	rep(i,n) scanf("%d%d",&x[i],&y[i]);

	int ans=n;
	rep(i,n) rep(j,n) if(i!=j) {
		int p=x[j]-x[i],q=y[j]-y[i];
		int cnt=0;
		rep(k,n) rep(l,n) if(k!=l) if(x[k]+p==x[l] && y[k]+q==y[l]) cnt++;
		ans=min(ans,n-cnt);
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int w,n;
	cin>>w>>n;
	int c[31];
	for(int i=1;i<=w;i++)c[i]=i;
	for(int i=1;i<=n;i++){
		int a,b;
		scanf("%d,%d",&a,&b);
		swap(c[a],c[b]);
	}
	for(int i=1;i<=w;i++)cout<<c[i]<<endl;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
map<pair<ll, ll>, ll> mp;
ll f(ll i, ll x) {
  if(x == 0) return 0;
  if(i == 0) return 1;
  if(mp.count({i, x})) return mp[{i, x}];
  ll a = (1LL << (i + 1)) - 3;
  ll res;
  if(x == 1)
    res = 0;
  else if(x < a + 2)
    res = f(i - 1, x - 1);
  else
    res = f(i - 1, a) + f(i - 1, x - a - 2) + 1;
  mp[{i, x}] = res;
  return res;
}
int main() {
  ll n, x;
  cin >> n >> x;
  cout << f(n, x) << endl;
}


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

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

bool kaibun( string s ){
    string t = s ;
    reverse(s.begin(),s.end()) ;
    if( s == t )return true ;
    else return false ;
}
int main(){
    int n ;
    cin >> n ;
    vector<int> A(n) ;
    vector<int> P(n) ;
    vector<int> Q(n) ;
    rep(i,n) A.at(i) = i + 1 ;
    rep(i,n) cin >> P.at(i) ;
    rep(i,n) cin >> Q.at(i) ;
    int count = 0 ;
    int a , b ;
    do{
        int cun = 0 ;
        count++ ;
        rep(i,n) if(A.at(i) == P.at(i)) cun++ ;
        if( cun == n ) a = count ;
    }while(next_permutation(A.begin(),A.end())) ;

    count = 0 ;
    
    do{
        int cun = 0 ;
        count++ ;
        rep(i,n) if(A.at(i) == Q.at(i)) cun++ ;
        if( cun == n ) b = count ;
    }while(next_permutation(A.begin(),A.end())) ;

    cout << abs(a-b) << endl ;    
}

Measured memory_bytes: 3540
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    S = itertools.groupby(iss())
    print(len(list(S)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 16292
#include<stdio.h>

int search(int a[], int n, int key)
{
	int i = 0;
	a[n] = key;
	while(a[i] != key) i++;
	return i != n;
}
int main(void)
{
	int n, q, i, key;
	int c = 0;
	
	scanf("%d", &n);
	
	int a[n];
	
	for(i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}
	
	scanf("%d", &q);
	
	for(i = 0; i < q; i++)
	{
		scanf("%d", &key);
		if(search(a, n, key)) c++;
	}
	
	printf("%d\n", c);
	return 0;
}


Measured memory_bytes: 2036
/*---Bismillahir Rahmanir Rahim---*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define vi vector <int> 
#define pii pair<int, int>
using namespace std; 

int  gcd(int a,int b){
	return  (b==0)?a: gcd(b,a%b);
}

inline void solve() {
	int  n, ans=0 ;
	cin >> n  ; 
	int  p[n+1]; 
	for (int i=1;i<=n;i++) cin>>p[i];
	for (int i=1;i<=n;i++){
		if (p[i]==i){
			if (i==n) swap(p[i],p[i-1]); 
			else swap(p[i],p[i+1]); 
			ans++; 
		}
	}
	cout << ans << endl; 
} 

signed main()
{
	int n = 1;
//	cin >> n;
	while (n--)
		solve();
	return 0;
}
/*
5
1 4 3 5 2

*/


Measured memory_bytes: 4268
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	bool answer = false;
	int A, B, C;
	cin >> A >> B >> C;
	for(int i = 1; i <= B; i++){
		if(i*A%B==C){
			answer = true;
		}
	}
	if(answer==true) cout << "YES" << endl;
	else cout << "NO" << endl;
}

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

typedef long long ll;
const int MAX_N = 100000;

int main() {
  int N, M;
  static ll A[MAX_N];
  static std::pair<ll, int> CB[MAX_N];

  std::cin >> N >> M;
  for(int i = 0; i < N; ++i) {
    std::cin >> A[i];
  }
  for(int i = 0; i < M; ++i) {
    int B;
    ll C;
    std::cin >> B >> C;
    CB[i] = std::make_pair(C, B);
  }
  std::sort(A, A + N);
  std::sort(CB, CB + M, std::greater<std::pair<ll, int>>());

  int i = 0;
  for(int j = 0; j < M; ++j) {
    if(i >= N) break;
    auto p = CB[j];
    int B = p.second;
    ll C = p.first;
    if(A[i] >= C) break;
    while(B > 0 and i < N and A[i] < C) {
      A[i] = C;
      --B;
      ++i;
    }
  }

  ll ans = 0;
  for(int i = 0; i < N; ++i) {
    ans += A[i];
  }
  std::cout << ans << std::endl;
}

Measured memory_bytes: 2560
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX+1];

void maxHeapify(int i) {
    
    int largest = 0;
    
    int l = 2 * i;
    int r = 2 * i + 1;
    
    if (l <= H && A[l] > A[i]) {
        
        largest = l;
        
    } else {
        
        largest = i;
        
    }
    
    if (r <= H && A[r] > A[largest]) {
        
        largest = r;
        
    }
    
    if (largest != i) {
        
        swap(A[i], A[largest]);
        
        maxHeapify(largest);
        
    }
    
}

int extract() {
    
    int maxv;
    if ( H < 1 ) {
        
        return -INFTY;
        
    }
    
    maxv = A[1];
    A[1] = A[H--];
    maxHeapify(1);
    
    return maxv;
    
}

void increasekey(int i, int key) {
    
    if ( key < A[i] ) {
        
        return;
        
    }
    
    A[i] = key;
    
    while ( i > 1 && A[i / 2] < A[i] ) {
        
        swap(A[i], A[i / 2]);
        
        i = i / 2;
        
    }
        
}

void insert(int key) {
    
    H++;
    A[H] = -INFTY;
    
    increasekey(H, key);
    
}

int main() {
    
    int key;
    char com[10];
    
    while ( 1 ) {
        
        scanf("%s", com);
        if ( com[0] == 'e' && com[1] == 'n' ) {
            
            break;
            
        }
        
        if ( com[0] == 'i') {
            
            scanf("%d", &key);
            insert(key);
            
        } else {
            
            printf("%d\n", extract());
            
        }

    }

    return 0;
    
}



Measured memory_bytes: 6492
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#define ll long long
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    ll ans1=1,ans2=1;
    ll a,b;
    for(int i=1;i<=n;i++)
    {
        scanf("%lld%lld",&a,&b);
        ll be=1;
        if(a<ans1)
        {
            if(ans1%a==0) be=ans1/a;
            else be=ans1/a+1;
        }
        if(b<ans2)
        {
            ll be1=1;
            if(ans2%b==0) be1=ans2/b;
            else
                be1=ans2/b+1;
            be=max(be,be1);
        }
        ans1=a*be;
        ans2=b*be;
    }
    printf("%lld\n",ans1+ans2);
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

		int n = sc.nextInt();
		double x[] = new double[n + 1];
		double bt[] = new double[n + 1];
		int ye[] = new int[n + 1];
		String u[] = new String[n + 1];


		Arrays.fill(bt, 0);
		Arrays.fill(ye, 0);
		for (int i = 1; i <= n; i++) {
			x[i] = sc.nextDouble();
			u[i] = sc.next();
			if (u[i].equals("BTC")) {
				bt[i] = x[i] * 380000;
			}else{
				ye[i]=(int)x[i];
			}
		}


		double btsum=sum(bt);
		int yesum=sum(ye);

		int btone=(int)btsum/1;
		btsum=btsum%1;
		yesum+=btone;
		System.out.println(yesum+btsum);
	}
	static int sum(int a[]){
	int n=a.length;
	int ans=0;
	for(int i=1;i<=n-1;i++){
		ans+=a[i];
	}
return ans;
	}

	static double sum(double a[]){
	int n=a.length;
	double ans=0;
	for(int i=1;i<=n-1;i++){
		ans+=a[i];
	}
return ans;
	}
}

Measured memory_bytes: 25300
//Created Time:2020年01月05日 星期日 18时54分37秒
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define N 100005

using namespace std;

int n;
int a[N];

bool cmp(int x, int y){
	return x > y;
}

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
		scanf("%d", a + i);
	sort(a + 1, a + 1 + n, cmp);
	int pos = 1;
	while(a[pos + 1] >= pos + 1) ++pos;
	int p = pos;
	while(a[p + 1] == pos) ++p;
	if((a[pos] - pos) & 1 || (p - pos) & 1) puts("First");
	else puts("Second");
    return 0;
}


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

using namespace std;

int K, N, t, x, lst, Max;

int main() {
	cin >> K >> N;
	for (int i = 1; i <= N; i++) {
		scanf("%d", &x);
		if (i == 1) t = x;
		Max = max(Max, x - lst);
		lst = x;
	}
	Max = max(Max, K - (lst - t));
	cout << K - Max << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main() {
    int N;
    cin >> N;
    int D1, D2, cnt = 0;
    bool is_ok = false;
    for (int i = 0; i < N; i++) {
        cin >> D1 >> D2;
        if (D1 == D2) cnt++;
        else if (D1 != D2 && cnt != 0) cnt = 0;
        if (cnt == 3) {
            is_ok = true;
            break;
        }
    }
    if (is_ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3600
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	A, B := nextInt(), nextInt()

	ans := -100000000000

	ans = max(ans, A+B)
	ans = max(ans, A-B)
	ans = max(ans, A*B)
	fmt.Println(ans)
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}


Measured memory_bytes: 640
h,w = map(int, input().split())
sl = [list(input()) for _ in range(h)]

for hi in range(h):
    for wi in range(w):
        if sl[hi][wi]=="#":
            continue
        c = 0
        for dh in range(-1,2):
            for dw in range(-1,2):
                if h>hi+dh>=0 and w>wi+dw>=0:
                    if sl[hi+dh][wi+dw]=="#":
                        c += 1
        sl[hi][wi] = str(c)

for l in sl:
    print("".join(l))

Measured memory_bytes: 3188
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner scan = new Scanner(System.in);
		
		int N = scan.nextInt();
		
		//input case
		//	N is not match number of input info
		
		int num_of_operation = 0;
		int Array[];
		Array = new int[N];
		
		for(int i = 0;i<N;i++) {
			Array[i]=scan.nextInt();
		}
		
		label:for(;;) {
			for(int j =0;j<Array.length;j++) {
				if(Array[j]%2!=0) {
					break label;
				}
				Array[j] = Array[j] /2;
				
			}
			num_of_operation++;
		}
		
		System.out.println(num_of_operation);
		scan.close();
	}
}


Measured memory_bytes: 21844
#define DEBUG 1
#include <bits/stdc++.h>
using namespace std;
typedef          char      s8;
typedef unsigned char      u8;
typedef          short    s16;
typedef unsigned short    u16;
typedef          int      s32;
typedef unsigned int      u32;
typedef          long int s64;
typedef unsigned long int u64;
typedef float             f32;
typedef double            f64;
#define rep(_i, _n) for (int _i = 0; _i < (int)(_n); _i++)
#if DEBUG
#define PHERE()			{ cerr << "L" << setw(3) << __LINE__ << ": PHERE" << clock() << endl; }
#define PVAL( _var )	{ cerr << "L" << setw(3) << __LINE__ << ":" << #_var "=" << (_var) << endl; }
#else
#define PHERE()
#define PVAL( _var )
#endif


int main()
{
	//////// 入力 ////////
	int N;
	cin >> N;
	
	vector<int> A;
	A.resize( N );
	rep( i, N ) {
		cin >> A[i];
	}
	/////////////////////
	
	int out = 0;
	for( int i = 0; i < N; i+=2 ) {
		if( A[i] & 1 ) {
			++out;
		}
	}
	
	//////// 出力 ////////
	cout << out;
	/////////////////////
	
	return 0;
}
#if 0


#endif


Measured memory_bytes: 3620
using namespace std;
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 1000010
int n,m,k;
char str[N];
int s[N],t[N];
struct Node{
	Node *pre,*suc;
	int s,n;
} *fir,*lst;
Node *ins(Node *p,int s,int n=1){
	Node *nw=new Node;
	*nw={p,p->suc,s,n};
	if (p->suc)
		p->suc->pre=nw;
	else
		lst=nw;
	p->suc=nw;
	return nw;
}
Node *check(Node *p){
	if (p->n==0 || p->pre && p->s==p->pre->s){
		p->pre->n+=p->n;
		p->pre->suc=p->suc;
		if (p->suc)
			p->suc->pre=p->pre;
		else
			lst=p->pre;
		return p->pre;
	}
	return p;
}
int ans[N*2],cnt;
void print(int w){
	bool bz=0;
	for (int i=cnt-1;i>=0;--i){
		bz|=ans[i]>>w&1;
		if (bz)
			putchar('0'+(ans[i]>>w&1));
	}
	if (bz==0)
		putchar('0');
	putchar('\n');
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	scanf("%s",str);
	for (int i=0;i<n;++i)
		s[i]=str[n-1-i]-'0';
	scanf("%s",str);
	for (int i=0;i<m;++i)
		t[i]=str[m-1-i]-'0';
	n=max(n,m);	
	fir=lst=new Node;
	*lst=(Node){NULL,NULL,0,1000000000};
	for (int i=n-1;i>=0;--i)
		if (s[i]==1 && t[i]==1){
			int z=k;
			Node *p=lst;
			while (z){
				while (1){
					Node *q=check(p);
					if (q==p) break;
					p=q;
				}
				if (p->s==0){
					if (p->n<=z){
						z-=p->n;
						p=p->pre;
						if (z==0)
							ins(p,3,1);
					}
					else{
						p->n-=z;
						Node *q=ins(p,0,z);
						ins(p,3,1);
						break;
					}
				}
				else{
					while (1){
						Node *q=check(p->pre);
						if (q==p->pre) break;
						p->pre=q;
					}
					int m=p->s;
					if (p->pre->s==0){
						p->s=0,p->n--;
						Node *q=ins(p,m^3,1),*r=ins(q,0,1);
						p->pre->n--;
						check(p->pre);
						ins(p->pre,m,1);
						check(p);
						break;
					}
					else{
						p->s=0,p->n--;
						Node *q=ins(p,m^3,1),*r=ins(q,0,1);
						p->pre->n--;
						p=p->pre;
						z--;
						check(p->suc);
						if (z==0)
							ins(p,3,1);
						p=check(p);
					}
				}
			}
		}
		else
			lst=ins(lst,s[i]|t[i]<<1,1);
	for (Node *p=lst;p!=fir;p=p->pre)
		for (int i=0;i<p->n;++i)
			ans[cnt++]=p->s;
	print(0),print(1);
	return 0;
}

Measured memory_bytes: 146120
#include <stdio.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	
	if( a == b && a != c ){
		printf("Yes");
	}
	else if( b == c && b !=a ){
		printf("Yes");
	}
	else if( c == a && c != b){
		printf("Yes");
	}
	else{
		printf("No");
}
	return 0;

}

Measured memory_bytes: 1732
#include<iostream>
typedef long long ll;
using namespace std;
ll p[55];
ll a;
ll f(ll n, ll x) {
  // cin >> a;
  //cout << n <<"   "<<x << endl;
  if(x <= 0 || n < -1) return 0;

  ll res = 0;
  
  if(x <= p[n+1] - 2ll) {
    res = f(n-1,x-1ll);
  }
  else {
    res = f(n-1,x-p[n+1]+1) + p[n];
  }
  return res;
}
  
int main() {
  ll n;
  ll x;
  cin >> n >> x;
  p[0] = 1;
  for(int i = 1; i <= n+1; i++) {
    p[i] = p[i-1] * 2;
  }

  cout << f(n,x) << endl;
}
 
  


Measured memory_bytes: 256
class CutAndCount:
    def __init__(self, n, s):
        self.n = n
        self.s = s

    def cut_and_count(self, i):
        chars_contained_both = 0

        x, y = s[0:i], s[i:]
        for c_in_x in set(x):
            for c_in_y in set(y):
                if c_in_x == c_in_y:
                    chars_contained_both += 1

        return chars_contained_both

    def solve(self):
        max_chars = 0

        for i in range(1, self.n):
            max_chars = max(self.cut_and_count(i), max_chars)

        print(max_chars)

n, s = int(input()), input()
cac = CutAndCount(n, s)
cac.solve()

Measured memory_bytes: 3064
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
queries = []
for i in range(Q):
    Bi, Ci = map(int, input().split())
    queries.append((Bi, Ci))

S = sum(A)
c = Counter(A)
for Bi, Ci in queries:
    S += (Ci - Bi) * c[Bi]
    print(S)
    c.update({Bi: -c[Bi], Ci: c[Bi]})


Measured memory_bytes: 35492
#include <iostream>

using namespace std;

bool search(int A[], int n, int key) {
	int i = 0;
	A[n] = key;
	while (A[i] != key) i++;
	return i != n;
}

int main() {
	int S[10001];
	int n; cin >> n;
	for (int i = 0; i < n; ++i) cin >> S[i];
	int q; cin >> q;
	int ans = 0;
	while (q--) {
		int t; cin >> t;
		if (search(S, n, t)) ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3108
#include <iostream>
using namespace std;

int main() {

    int x,i=0,l,a[10000];
    
    while(cin>>l){
        a[i] = l;
        if (a[i]==0) break;
        i++;
    }   

    i=0;

    while ( 1 ) { 
        if (a[i] == 0) break;
        cout << "Case " << i+1 << ": " << a[i] << endl;
        i++;
    }   

    return 0;
}



Measured memory_bytes: 3044
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int l = Integer.parseInt(st.nextToken());
        int r = Integer.parseInt(st.nextToken());
        if(r-l >=2019){
            System.out.println("0\n");
            return;
        }
        int min=Integer.MAX_VALUE;

        for(int i=l+1; i<=r;i++){
            for(int j=l;j<i;j++){
                int temp = Math.floorMod(Math.floorMod(i,2019)*Math.floorMod(j,2019),2019);
                if(temp<min){
                    min=temp;
                }
            }
        }
        System.out.println(min);
        System.out.println("\n");
    }
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("hard1.txt","r",stdin)
#define OUT freopen("hard1.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG printf("Hi\n")
#define i64 long long int
#define eps (1e-9)
#define xx first
#define yy second
#define ln 17
#define off 1000005
#define FastIO  ios_base::sync_with_stdio(false); cin.tie(NULL)

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64,i64> pii ;

#define maxn 1000005
#define mod 998244353LL
#define lim 1000000000
#define INF 1000000000000000000LL

i64 a[maxn] ;
pair<i64,i64> range[maxn] ;

int main()
{
    int n ;

    scanf("%d",&n) ;
    for(int i=1 ; i<=n ; i++) scanf("%lld",&a[i]) ;

    if(a[n]!=2)
    {
        printf("-1\n") ;
        return 0 ;
    }

    range[n] = mp(1,1) ;

    for(int i=n-1 ; i>=1 ; i--)
    {
        i64 L = a[i+1]*range[i+1].xx , R = a[i+1]*range[i+1].yy + a[i+1] - 1 ;

        if( (R/a[i])*a[i] < L )
        {
            printf("-1\n") ;
            return 0 ;
        }
        range[i] = mp( (L-1)/a[i] + 1 , R/a[i] ) ;
    }

    printf("%lld %lld\n" , range[1].xx*a[1] , range[1].yy*a[1] + a[1] - 1 ) ;

    return 0 ;
}


Measured memory_bytes: 5888
#include <stdio.h>
#include <algorithm>
#include <string.h>

using namespace std;

const int maxn = 2100;
const int mod = 998244353;
char z[maxn];
int n;
int prer[maxn*2];
int dp[maxn*2][maxn*2];
void work () {
	int i , j;
	scanf ( "%s" , z + 1 );
	n = strlen ( z + 1 );
	for ( i = 1 ; i <= n ; i++ ) prer[i] = prer[i-1] + (2-z[i]+'0');
	for ( i = n + 1 ; i <= n + n ; i++ ) prer[i] = prer[i-1];
	dp[0][0] = 1;
	for ( i = 0 ; i < n * 2 ; i++ ) {
		for ( j = 0 ; j <= i ; j++ ) {
			if ( j < prer[i+1] ) {
				dp[i+1][j+1] = (dp[i+1][j+1] + dp[i][j]) % mod;
			}
			if ( i - j < i * 2 + 2 - prer[i+1] ) {
				dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % mod;
			}
			//printf ( "%d %d %d\n" , i , j , dp[i][j] );
		}
	}
	printf ( "%d\n" , dp[n*2][prer[n*2]] );
}
int main () {
	work ();
	return 0;
}


Measured memory_bytes: 66304