akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
int divr[maxn];
/*ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}*/
void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
 
 
 
 
 



















int main()
{
     int n;
     cin>>n;
     string s;
     cin>>s;
     int opn=0,clo=0;
     deque<char> dq;
     for(int i=0;i<n;i++)
     {
          if(s[i]==')'&&opn==0)
          {
               clo++;
          }
          else if(s[i]=='('&&clo!=0)
          {
               for(int l=0;l<clo;l++)dq.push_front('(');
               for(int l=0;l<clo;l++)dq.push_back(')');
               clo=0;
               dq.push_back('(');opn++;
          }
          else if(s[i]=='('&&clo==0)
          {
               dq.push_back('(');
               opn++;
          }
          else if(s[i]==')'&&opn!=0){dq.push_back(')');opn--;}
          
     }
     while(opn!=0)
     {
          dq.push_back(')');opn--;
     }
     while(clo!=0)
     {
         dq.push_front('(');
         dq.push_back(')');clo--;
     }
     for(int i=0;i<dq.sz;i++)cout<<dq[i];
     
     


}




 
 
 
 
 

















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

int main() {
  int n;
  cin >> n;
  map<pair<int, int>, int> mp;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    long double a;
    int tmp2 = 0;
    int tmp5 = 0;
    cin >> a;
    long long b = a * 1e9 + 0.5;
    while (b % 2 == 0) {
      tmp2++;
      b /= 2;
    }
    while (b % 5 == 0) {
      tmp5++;
      b /= 5;
    }

    for (const auto& [key, value] : mp) {
      if (key.first + tmp2 >= 18 && key.second + tmp5 >= 18) ans += value;
    }
    mp[{tmp2, tmp5}]++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3748
n = int(input())
ns = int(n**0.5)
ans = []

for a in range(1, ns+1):
    if n%a == 0:
        b = n//a
        a_s = str(a)
        b_s = str(b)
        ans.append(max(len(a_s),len(b_s)))

print(min(ans))

Measured memory_bytes: 3060
/// Bismillahirrahmanirrahim
#include <iostream>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, temp = 1;
    cin >> n;
    int arr[n+1];
    for(int i=0; i<n; i++)
        cin >> arr[i];

    for(int i=0; i<n; i++)
    {
        if(arr[i]==temp)
            temp++;
    }
    if(temp == 1)
        puts("-1");
    else cout << n - (temp-1) << "\n";
}


Measured memory_bytes: 1024
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int ans, c;
    String n;
    char[] num;

    void run(){
	while(true){
	    n = sc.next();
	    ans = Integer.parseInt(n);
	    c = 0;
	    num = n.toCharArray();
	    if(num[0]==num[1] && num[1]==num[2] && num[2]==num[3])
		if(num[0]=='0') break;
		else{
		    System.out.println("NA");
		    continue;
		}
	
	    int[] L = new int[4];
	    for(int i=0; i<L.length; i++){
		L[i] = num[i]-48;
		//System.out.println(L[i]);
	    }
	    
	    while(ans!=6174){
		//System.out.println(ans);
		Arrays.sort(L);
		int big=0, small=0;
		int a = 1000;
		for(int i=0; i<4; i++){
		    big += L[i]*a;
		    small += L[3-i]*a;
		    a /= 10;
		}
		//System.out.println(big+" "+small);
		ans = Math.abs(big-small);
		//System.out.println(ans);
		int tmp = ans;
		c++;
		a = 1000;
		for(int i=0; i<4; i++){
		    L[i] = tmp/a;
		    tmp %= a;
		    a /= 10;
		}
	    }
	    System.out.println(c);
	}
    }
}

Measured memory_bytes: 30728
//kunal_goyal
#include<bits/stdc++.h>
//#include"debug.h"

using namespace std;
#define int1(a) scanf("%d",&a)
#define int2(a,b) scanf("%d %d",&a,&b)
#define int3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define int4(a,b,c,d) scanf("%d %d %d %d",&a,&b,&c,&d)
#define lint1(a) scanf("%lld",&a)
#define lint2(a,b) scanf("%lld %lld",&a,&b)
#define lint3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define lint4(a,b,c,d) scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define lli long long int
#define pint(x) printf("%d",x)
#define all(x) x.begin(),x.end()
#define ps printf(" "); 
#define plint(x) printf("%lld",x)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define bg begin()
#define ed end()
#define Set(a, s) memset(a, s, sizeof (a))
#define mod 1000000007
#define tmod(k) if ((k) >= mod) k %= mod;
#define endl '\n'
#define nl printf("\n");
#define fore(i,n) for(int i=n; i>=0; i--)
#define fors(i,a,n) for(int i=a; i<n; i++)
#define fora(i,ele) for(auto i: ele)
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
typedef pair<int,int> pii;
typedef vector<lli> vli;
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
float roundoff(float val, float p){ return floor(val*pow(10.0,p)+0.5)/pow(10.0,p);}
const int INF = 0x3f3f3f3f;
#define pi 3.14159265

//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};
//int dx[]={1,-1,0,0}; int dy[]={0,0,1,-1};

int main(void) {
    ios_base::sync_with_stdio(true);
    cin.tie(NULL);
    cout.tie(NULL);
	/*
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	*/
    // cout<<"Execution time : "<<tick()<<"\n";
	
	lli n,k;
	lint2(n,k);
	lli ans = 0;
	fors(b,k+1,n+1){
		ans += floor((double)n/(double)b)*(b-k);
		//trace2(b,floor((double)n/(double)b)*(b-k));
		if((n%b)-k<0 ) continue;
		else{
			ans+=(n%b)-k+1;
			//trace2(b,(n%b)-k+1);
		}
	}
	if(k==0) ans-=n;
	cout<<ans;
	
    return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string.h>
#include <cstring>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <set>
#include <vector>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <cassert>

using namespace std;
using ll = long long;

#define nl "\n"
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define trav(x) for(auto& i: x)

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

	int d;
	cin >> d;
	for(int i = 25; i >= d; i--) {
		if(i == 25) {
			cout << "Christmas" << ' ';
		} else {
			cout << "Eve" << ' ';
		}
	}
}

Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn dijkstra(graph: &Vec<Vec<(usize, usize)>>, s: usize) -> Vec<usize> {
    let mut distance = vec![INF; graph.len()];
    distance[s] = 0;
    let mut queue = BinaryHeap::new();
    queue.push(Reverse((0, s)));
    while !queue.is_empty() {
        let Reverse((d, u)) = queue.pop().unwrap();
        if distance[u] < d {
            continue;
        }
        for &(v, c) in &graph[u] {
            if distance[u] + c < distance[v] {
                distance[v] = distance[u] + c;
                queue.push(Reverse((distance[v], v)));
            }
        }
    }
    distance
}

fn main() {
    input! {
        h: usize,
        w: usize,
        ch: Usize1,
        cw: Usize1,
        dh: Usize1,
        dw: Usize1,
        s: [Chars; h],
    }
    let index = |i, j| i * w + j;
    let mut graph = vec![vec![]; h * w];
    for i in 0..h {
        for j in 0..w {
            if s[i][j] == '#' {
                continue;
            }
            let u = index(i, j);
            if 1 <= i && s[i - 1][j] != '#' {
                let v = index(i - 1, j);
                graph[u].push((v, 0));
                graph[v].push((u, 0));
            }
            if i + 1 < h && s[i + 1][j] != '#' {
                let v = index(i + 1, j);
                graph[u].push((v, 0));
                graph[v].push((u, 0));
            }
            if 1 <= j && s[i][j - 1] != '#' {
                let v = index(i, j - 1);
                graph[u].push((v, 0));
                graph[v].push((u, 0));
            }
            if j + 1 < w && s[i][j + 1] != '#' {
                let v = index(i, j + 1);
                graph[u].push((v, 0));
                graph[v].push((u, 0));
            }
            for di in 0..5 {
                for dj in 0..5 {
                    if di == 2 && dj == 2 {
                        continue;
                    }
                    if 2 <= i + di
                        && i + di < h + 2
                        && 2 <= j + dj
                        && j + dj < w + 2
                        && s[i + di - 2][j + dj - 2] != '#'
                    {
                        let v = index(i + di - 2, j + dj - 2);
                        graph[u].push((v, 1));
                        graph[v].push((u, 1));
                    }
                }
            }
        }
    }
    // eprintln!("{:?}", graph);
    let distance = dijkstra(&graph, index(ch, cw));
    // eprintln!("{:?}", distance);
    let result = distance[index(dh, dw)];
    if result == INF {
        println!("-1");
    } else {
        println!("{}", distance[index(dh, dw)]);
    }
}


Measured memory_bytes: 342244
#include<iostream>
using namespace std;
int main(){
    int x,a;
    cin>>x;
    a=x-9;
    if(a==-8||a==-1||a==6||a==13||a==20){
      cout<<"fri"<<endl;
    }
    else if(a==-2||a==5||a==12||a==19){
           cout<<"thu"<<endl;
    }
    else if(a==-3||a==4||a==11||a==18){
           cout<<"wed"<<endl;
    }
    else if(a==-4||a==3||a==10||a==17){
           cout<<"tue"<<endl;
    }
    else if(a==-5||a==2||a==9||a==16){
           cout<<"mon"<<endl;
    }
    else if(a==-6||a==1||a==8||a==15){
           cout<<"sun"<<endl;
    }
    else{
        cout<<"sat"<<endl;
    }
}


Measured memory_bytes: 3104
#include <algorithm>
#include <cctype>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <queue>
#include <regex>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

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

    bool possible = true;
    bool dream_flag = false;
    bool erase_flag = false;
    size_t i = 0;
    while (i < s.length()) {
        if (s.substr(i, 5) == "dream") {
            i += 5;
            dream_flag = true;
            erase_flag = false;
        } else if (s.substr(i, 5) == "erase") {
            i += 5;
            dream_flag = false;
            erase_flag = true;
        } else if (dream_flag && s.substr(i, 2) == "er") {
            i += 2;
            dream_flag = false;
            erase_flag = false;
        } else if (erase_flag && s.substr(i, 1) == "r") {
            i += 1;
            dream_flag = false;
            erase_flag = false;
        } else {
            possible = false;
            break;
        }
    }

    cout << (possible ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,k;cin>>a>>b>>c>>k;
	for(int i=1;i<=k;i++){
		if(a==max(a,max(b,c)))a*=2;
		else if(b==max(a,max(b,c)))b*=2;
		else c*=2;
	}
	cout<<a+b+c<<endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        Console.WriteLine(a.OrderBy(f => f).Where((f, g) => n <= g && g % 2 == n % 2).Sum());
    }
}

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

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

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

int main() {
  int n; cin >> n;
  if(n < 1000) {
    cout << "ABC" << endl;
  } else {
    cout << "ABD" << endl;
  }

  return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define MMP(a, b, c) make_pair(make_pair(a, b), c)
#define MAX 1000000000
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
    ios::sync_with_stdio(false);

    START:

    int n;
    cin >> n;
    if(n == 0) return 0;
    int state[7] = {0,1,2,3,4,5,6};
    int ans = 1;
    for(int i=0; i<n; i++){
        string S;
        cin >> S;
        int tmp;
        map<string,int> l;
        l["North"] = 0;
        l["East"] = 1;
        l["West"] = 2;
        l["South"] = 3;
        l["Right"] = 4;
        l["Left"] = 5;
        switch(l[S]){
            case 0:
                tmp = state[1];
                state[1] = state[2];
                state[2] = state[6];
                state[6] = state[5];
                state[5] = tmp;
                break;
            case 1:
                tmp = state[1];
                state[1] = state[4];
                state[4] = state[6];
                state[6] = state[3];
                state[3] = tmp;
                break;
            case 2:
                tmp = state[1];
                state[1] = state[3];
                state[3] = state[6];
                state[6] = state[4];
                state[4] = tmp;
                break;
            case 3:
                tmp = state[1];
                state[1] = state[5];
                state[5] = state[6];
                state[6] = state[2];
                state[2] = tmp;
                break;
            case 4:
                tmp = state[2];
                state[2] = state[3];
                state[3] = state[5];
                state[5] = state[4];
                state[4] = tmp;
                break;
            case 5:
                tmp = state[2];
                state[2] = state[4];
                state[4] = state[5];
                state[5] = state[3];
                state[3] = tmp;
                break;
        }
        ans += state[1];
    }
    cout << ans << endl;

    goto START;

    return 0;
}


Measured memory_bytes: 3120
// 2014/09/22 Tazoe

#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;

const int INF = 1000000000;

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

		if(n==0)
			break;

		int W[100][100];
		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				W[i][j] = INF;
			}
		}

		int m;
		cin >> m;

		for(int i=0; i<m; i++){
			string s;
			cin >> s;

			for(int j=0; j<s.size(); j++){
				if(s[j]==','){
					s[j] = ' ';
				}
			}

			istringstream is(s);
			int a, b, d;
			is >> a >> b >> d;

			W[a][b] = W[b][a] = d;
		}
/*
		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				if(W[i][j]==INF){
					cout << "INF" << ' ';
				}
				else{
					cout << W[i][j] << ' ';
				}
			}
			cout << endl;
		}
*/

		int mincost[100];
		bool used[100];

		for(int i=0; i<n; i++){
			mincost[i] = INF;
			used[i] = false;
		}

		mincost[0] = 0;
		int res = 0;

		while(true){
			int v = -1;
			for(int u=0; u<n; u++){
				if(!used[u] && (v==-1 || mincost[u]<mincost[v])){
					v = u;
				}
			}

			if(v==-1)
				break;

			used[v] = true;
			if(v!=0){
				res += (mincost[v]/100-1);
			}

			for(int u=0; u<n; u++){
				mincost[u] = min(mincost[u], W[v][u]);
			}
		}

		cout << res << endl;
	}

	return 0;
}

Measured memory_bytes: 1256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

int main(void){
    string S, T;
    cin>>S>>T;
    ll Minim=S.size();
    rep(i, S.size()-T.size()+1){
        ll count=0;
        rep(j, T.size()){
            if(T[j]!=S[i+j]) count++;
        }
        Minim=min(Minim, count);
    }
    cout<<Minim<<endl;
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

#define P 1000000007

struct segtree{
  ll M=1, INIT;
  vector<ll> dat;
  segtree(ll N, ll num){
    INIT = num;
    while(M<N) M*=2;
    for(int i=0;i<M*2-1;i++)  dat.push_back(num);
  }
  void add(ll x, ll k, ll l=0, int r=-1){
    if(r==-1) r = M;
    k+=M-1;
    dat[k] = (dat[k] + x)%P;
    while(k>0) k = (k-1)/2, dat[k] = (dat[k*2+1] + dat[k*2+2])%P;
  }
  void update(ll x, ll k, ll l=0, int r=-1){
    if(r==-1) r = M;
    k+=M-1;
    dat[k] = x;
    while(k>0) k = (k-1)/2, dat[k] = (dat[k*2+1] + dat[k*2+2])%P;
  }

  ll query(ll a, ll b=-1, ll k=0, ll l=0, ll r=-1){
    if(r==-1) r = M;
    if(b==-1) b = M;
    if(r<=a || b<=l) return INIT;
    if(a<=l && r<=b) return dat[k];
    ll A = query(a, b, k*2+1, l, (l+r)/2);
    ll B = query(a, b, k*2+2, (l+r)/2, r);
    return (A + B)%P;
  }
};

int main(int argc, char const *argv[]) {
  vll t(5001, 1);
  for(int i=1;i<=5000;i++) t[i] = (t[i-1]*2)%P;
  ll n, a, b;std::cin >> n >> a >> b;
  if(a<b) swap(a, b);
  ll ans = 0;

  vvl dp = VV(n+1, n+1, 0, ll);
  dp[0][0] = 1;
  vvl accum = VV(n+1, n+1, 0, ll);
  accum[0][0] = 1;
  segtree seg(n+1, 0);
  vll ad(n+1, 0);
  seg.add(1, 0);
  // dp[i][j] = dp[i-b][j-b] + dp[i-b-1][j-b-1] .....
  for(int i=1;i<=n;i++){
    for(int j=0;j<=i;j++){
      // 11111111...0 (ok)
      if(j>b) dp[i][j] = accum[i-b-1][j-b-1];
      if(i==n && j>=b) dp[i][j] = (dp[i][j] + accum[i-b][j-b])%P;

      // 11..0 (error)
      ll m = max((ll)0, i-b);
      if(j==1){
        ll q = seg.query(m, i-1);
        dp[i][j] = (dp[i][j] + q)%P;
      }
      //0
      if(j>0) dp[i][j] = (dp[i][j] + dp[i-1][j-1])%P;
    }
    // okなものは答えに参入して削除
    for(int j=a;j<=n;j++) {
      ans = (ans + (t[n-i]*dp[i][j])%P)%P;
      dp[i][j] = 0;
    }

    for(int j=0;j<=n;j++) seg.add(ad[j], j), ad[j] = 0;
    for(int j=0;j<=i;j++) ad[i] = (ad[i] + dp[i][j])%P;

    //accum
    for(int j=0;j<=n;j++){
      accum[i][j] = ((j==0?0:accum[i-1][j-1]) + dp[i][j])%P;
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 394368
#include <stdio.h>
#define MAX 500000
#define INFTY 2000000000
int L[MAX/2+2],R[MAX/2+2];
int cnt = 0;

void merge(int A[],int left,int mid,int right){
  int i,j,k,n1,n2;
  n1 = mid - left;
  n2 = right - mid;
  for(i = 0;i < n1;i++){
    L[i] = A[left + i];
  }
  for(j = 0; j < n2;j++){
    R[j] = A[mid + j];
  }
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for(k = left;k <= right-1;k++){
    if (L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
      cnt++;
    }
    else {
      A[k] = R[j];
      j = j + 1;
      cnt++;
    }
  }
}

void mergeSort(int A[],int left,int right){
  int i,mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}
int main(){
  int A[MAX],n,i;
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d",&A[i]);
  }

  mergeSort(A,0,n);

  for(i = 0;i < n;i++){
    printf("%d",A[i]);
    if(i < n-1)
      printf(" ");
  }
  printf("\n");
  printf("%d\n",cnt);
  return 0;
}
  
  



Measured memory_bytes: 5636
#include <iostream>

using namespace std;

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

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

  if (sum >= h) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: u32 = read();
    let b: u32 = read();
    let result = (a*b)%2;   
    match result {
        0 => println!("Even"),
        _ => println!("Odd")
    }
}


Measured memory_bytes: 4352
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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; }


int main() {
   int n, k, x, y; cin >> n >> k >> x >> y;
   if(n<=k) cout << x*n << ln;
   else cout << x*k+y*(n-k) << ln;
}


Measured memory_bytes: 3584
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
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 (b<a) { a=b; return 1; } return 0; }
using namespace std;


int main(){
  ll N,K,R,S,P,ans=0;
  string T;
  cin>>N>>K>>R>>S>>P>>T;
  
  ll CAN=1;
  
  for(int i=0; i<K; ++i){
    CAN=1;
    for(int j=0; j<=N/K+1; ++j){
      if(i+j*K<N){
        if(j>0 && T.at(i+(j-1)*K)==T.at(i+j*K)) CAN*=-1;
        if(j>0 && T.at(i+(j-1)*K)!=T.at(i+j*K)) CAN=1;
        if(T.at(i+j*K)=='r' && CAN>0) ans+=P;
        if(T.at(i+j*K)=='s' && CAN>0) ans+=R;
        if(T.at(i+j*K)=='p' && CAN>0) ans+=S;
      }
    }
  }
  
  co(ans);
  return 0;
}

Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
	int D, G;
	cin >> D >> G;
    vector<int> p(D), c(D);
    rep(i, D) cin >> p[i] >> c[i];

    int ans = INF;
    for (int s = 0; s < (1<<D); s++) {
        int solve = 0, score = 0;
        int partial = -1;
        rep(i, D) {
            if (s & (1<<i)) {
                solve += p[i];
                score += 100*(i+1)*p[i] + c[i];
            } else {
                partial = i;
            }
        }
        int less = G - score;
        if (less > 0) {
            int prob_score = 100*(partial+1);    // コンプリートしていない問の最高点の1問の点数
            if (less > prob_score*p[partial]) continue;
            solve += min(p[partial], (less+(prob_score - 1))/prob_score);
        }
        ans = min(ans, solve);
    }
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define piii pair<int,pair<int,int> >
#define pii pair<int,int>
#define ll long long
int a[3];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    cout<<a[2]-a[0];
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.end()

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 (b < a) { a = b; return 1; } return 0; }

using ll = long long;
using ull = unsigned long long;
using namespace std;
using namespace atcoder;
// cout << fixed << setprecision(10）<<  << endl;

int main(){
    int n; cin >> n;
    vector<int> x(n), y(n);
    rep(i,n) {
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
    }
    
    vector<int> xx(n);
    rep(i,n) xx[x[i]] = i;
    vector<pair<int,int>> pp(n);
    rep(i,n) pp[i] = make_pair(x[i], y[i]);
    sort(all(pp));
  rep(i,n) {
    x[i] = pp[i].first;
    y[i] = pp[i].second;
  }

    set<pair<int,int>> st1, st2;
    dsu data(n);
    rep(i,n) {
        if (st1.empty()) {
            st1.insert(make_pair(y[i], i));
            continue;
        }
        if (st1.begin()->first < y[i]) data.merge(i, st1.begin()->second);
        auto iter = st1.lower_bound(make_pair(y[i], i));
        if (iter == st1.begin()) {
            st1.insert(make_pair(y[i], i));
            continue;
        }
        iter = prev(iter);
        data.merge(i, iter->second);
        st1.insert(make_pair(y[i], i));
    }
    rrep(i,n) {
        if (st2.empty()) {
            st2.insert(make_pair(y[i], i));
            continue;
        }
        if (st2.rbegin()->first > y[i]) data.merge(i, st2.rbegin()->second);
        auto iter = st2.lower_bound(make_pair(y[i], i));
        if (iter == st2.end()) {
            st2.insert(make_pair(y[i], i));
            continue;
        }
        data.merge(i, iter->second);
        st2.insert(make_pair(y[i], i));
    }
    vector<int> ans(n);
    rep(i,n) ans[xx[i]] = data.size(i);
    rep(i,n) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 27508
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
int main()
{
    int N;
    std::cin>>N;
    std::vector<double> v(N);
    for(int i=0; i<N; i++)std::cin>>v[i];

    std::sort(v.begin(),v.end());
    for(int i=0; i<N-1; i++){
        double tmp = (v[i]+v[i+1])/2;
        v[i+1]=tmp;
    }
    std::cout<<std::setprecision(10)<<v[N-1]<<std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll H, W,h,w;
    cin >> H >> W>>h>>w;


    cout << H * W - h*W-H*w + w * h << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,r)for(int i=(l);i<(r);i++)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    ll n,k;
    cin >> n >> k;
    double res = 0;
    rep(i,1,n+1){
        double t = 1.0/n;
        int now = i;
        while(now < k){
            now *= 2;
            t /= 2;
        }
        res += t;
    }
    cout << fixed << setprecision(15) << res << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            string input1, input2;

            while (!string.IsNullOrEmpty(input1 = Console.ReadLine()))
            {
                input2 = Console.ReadLine();

                int[] A = Array.ConvertAll(input1.Trim().Split(' '), int.Parse);
                int[] B = Array.ConvertAll(input2.Trim().Split(' '), int.Parse);

                bool[] memo = new bool[10];
                for (int i = 0; i < 4; i++) memo[A[i]] = true;

                int hit = 0, blow = 0;

                for (int i = 0; i < 4; i++)
                {
                    if (A[i] == B[i]) hit++;
                    else if (memo[B[i]] == true) blow++;
                }
                sb.AppendLine(hit + " " + blow);
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 8984
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    ans_list = [0] * n

    for i in range(n):
        ans_list[a_list[i] - 1] = i + 1

    for ans in ans_list:
        print(ans, end=" ")


if __name__ == "__main__":
    main()


Measured memory_bytes: 86112
#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long ll;

#define INT_MAX std::numeric_limits<int>().max()
#define INT_MIN std::numeric_limits<int>().min()
#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())

//#define _DEBUG_ 5

void run() {
	ll N, T;
	ll pt, nt;
	ll ans = 0;
	cin >> N >> T >> pt;
	REP(i, N-1) {
		cin >> nt;
		ans += (nt - pt > T ? T : nt - pt);
		pt = nt;
	}
	ans += T;
	cout << ans << endl;

}

int main() {
#ifdef _DEBUG_
	using std::chrono::system_clock;
	using std::chrono::duration_cast;
	system_clock::time_point  start, end;
	std::ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
	for (int i = 0; i < _DEBUG_; i++) {
		cout << "-------------------------- (cnt:" << i << ")" << endl;
		start = system_clock::now();
		run();
		end = system_clock::now();
		int elapsed = duration_cast<std::chrono::milliseconds>(end - start).count();
		cout << "-------------------------- (time:" << elapsed << "ms)" << endl << endl;
	}
#else
	run();
#endif
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  int c[3][3];
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> c[i][j];
    }
  }

  bool exist = false;
  for(int a1 = -100; a1 <= 100; a1++){
    int b1 = c[0][0] - a1;
    int b2 = c[0][1] - a1;
    int b3 = c[0][2] - a1;
    int a2 = c[1][0] - b1;
    int a3 = c[2][0] - b1;
    if(c[1][1] == a2 + b2 && 
      c[2][1] == a3 + b2 &&
      c[1][2] == a2 + b3 &&
      c[2][2] == a3 + b3){
      exist = true;
      break;
    }
  }

  if(exist) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 380
# F - LCS
def lcs(S: str, T: str) -> str:
    # dp[i][j] := the maximum length of LCS of S[:i+1] and T[:j+1]
    dp = [[0] * (len(T) + 1) for _ in range(len(S) + 1)]
    for i, s in enumerate(S):
        for j, t in enumerate(T):
            if s == t:
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1)
            else:
                dp[i][j] = max(dp[i][j], dp[i - 1][j], dp[i][j - 1])

    res = ""
    i, j = len(S) - 1, len(T) - 1
    while i >= 0 and j >= 0:
        if dp[i][j] == dp[i - 1][j]:
            i -= 1
        elif dp[i][j] == dp[i][j - 1]:
            j -= 1
        elif dp[i][j] == dp[i - 1][j - 1] + 1:
            res += S[i]
            i -= 1
            j -= 1
    return res[::-1]  # dp[-1][-1]


def main():
    S, T = open(0).read().split()
    print(lcs(S, T))


if __name__ == "__main__":
    main()


Measured memory_bytes: 112988
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

const int maxn = 200200;
int p[maxn], rp[maxn];

int main() {
    #ifdef LOCAL
    assert(freopen("b.in", "r", stdin));
    #else
    #endif
    int n;
    cin >> n;
    set<int> del;
    del.insert(-1);
    del.insert(n);
    forn (i, n) {
        cin >> p[i];
        --p[i];
        rp[p[i]] = i;
    }
    ll res = 0;
    forn (i, n) {
        int pos = rp[i];
        auto it = del.lower_bound(rp[i]);
        int r = *it;
        int l = *prev(it);
        res += ll(r - pos) * ll(pos - l) * ll(i + 1);
        del.insert(pos);
    }
    cout << res << '\n';
}

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

int main() {
  string s;
  cin >> s;
  string ans="Yes";
  rep(i,s.size()){
     if(i%2==0&&s[i]=='L')
     ans="No";
     else if(i%2==1&&s[i]=='R')
     ans="No";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head &&head, Tail &&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

int main() {
  vector<int> n(4);
  for (auto &e : n) cin >> e;

  set<int> st;
  for (auto &e : n) st.insert(e);

  puts(st.count(1) && st.count(9) && st.count(7) && st.count(4) ? "YES" : "NO");

  return 0;
}

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

#define F first 
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

int n, m = -2;
string res;

int main()
{
	cin >> n;
	if (!n) puts("0");
	else
	{
		for (int i = n; i; i /= m)
		{
			if (i % abs(m))
			{
				res += "1";
				if (m < 0) i -- ;
			}
			else res += "0";
		}
		reverse(res.begin(), res.end());
	}
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 3608
from collections import OrderedDict
n, m = map(int,input().split())

aclist = [0]*n
walist = [0]*n
ac = 0
wa = 0
for i in range(m):
  pp, s = input().split()
  p = int(pp) - 1
  if s == 'AC' and not aclist[p]:
    aclist[p] = 1
    ac += 1
    wa += walist[p]
  else:
    walist[p] += 1
  

print(ac, wa)


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

int main(void){
  int N;
  string S;
  cin>>N;
  int count=N;
  S.reserve(N);
  cin>>S;
  int sum[N];
  if(S[0]=='W')
  {
    sum[0]=1;
  }
  for(int i=1;i<N;i++)
  {
    if(S[i]=='W')
    {
      sum[i]=sum[i-1]+1;
    }
    else sum[i]=sum[i-1];
  }

  count=(N-1)-(sum[N-1]-sum[0]);
  for(int k=1;k<N;k++)
  {
    if(count>sum[k-1]+(N-k-1)-(sum[N-1]-sum[k]))
    {
      count=sum[k-1]+(N-k-1)-(sum[N-1]-sum[k]);
    }
  }
  cout<<count;

}


Measured memory_bytes: 1664
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;

int main()
{
	int X,Y,Z;
	scanf("%d %d %d",&X,&Y,&Z);
	printf("%d\n",(X-Z)/(Y+Z));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int ,int >
#define pl pair<ll ,ll >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define vp vector <pi>
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1n(x,n) for(int x = 1; x <= n ;++ x)
#define forn1(x,n) for(int x = 1; x < n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#pragma GCC optimize ("Ofast")
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F &f, R&... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

int main(){
	IOS

	int r;
	cin>>r;
	cout<<r*r;
 
	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int lcm(int a, int b)
{
    return a / __gcd(a, b) * b;
}
int logn(int n, int r)
{
    return log(n) / log(r);
}
 
void solve()
{
     
        int n, ans = 0;
        cin >> n;
        int a;
        for (int i = 1; i <= n;i++){
            cin >> a;
            if(a%2&&i%2){
                ans++;
            }
        }
        cout << ans << endl;
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    tc = 1;
    //cin >> tc;
    while (tc--)
    {
        solve();
    }

    return 0;
}

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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define umax(m, x) (m = max(m, x));
#define umin(m, x) (m = min(m, x));

#define rng(v) v.begin(), v.end()
#define rrng(v) v.rbegin(), v.rend()

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

using ll = long long int;

using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;

using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;

const int INF = 1e9;
const ll LINF = 1e18;

inline void yn(bool f) { cout << (f ? "Yes" : "No") << endl; }


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

    int cnt = 0;

    rep(i, 1, n + 1) {
        if (i % 2 == 0) continue;
        int c = 0;
        rep(j, 1, i + 1) {
            if (i % j == 0) c++;
        }
        if (c == 8) cnt++;
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		boolean[][] adj = new boolean[N][N];
		for (int i = 0; i < N; i++) {
			char[] tmp = sc.next().toCharArray();
			for (int j = 0; j < N; j++) {
				adj[i][j] = tmp[j] == '1';
			}
		}
		int ans = -1;
		for (int i = 0; i < N; i++) {
			int[] dist = new int[N];
			Arrays.fill(dist, -1);
			Deque<Integer> queue = new ArrayDeque<>();
			dist[i] = 0;
			queue.addLast(i);
			int max = 0;
			while (!queue.isEmpty() && max >= 0) {
				int cur = queue.pollFirst();
				for (int j = 0; j < N; j++) {
					if (adj[cur][j]){
						if (dist[j] == -1) {
							max = dist[j] = dist[cur] + 1;
							queue.addLast(j);
						} else if (dist[j] == dist[cur]) {
							max = -2;
							break;
						}
					}
				}
			}
			ans = Math.max(ans, max + 1);
		}
		out.println(ans);
		
		out.flush();
	}
	
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 26372
N = int(input())
S = list(input())

# 暗証番号は 000-999 の最大1000種類

ans = 0
for i in range(1000):
    v = str(i).zfill(3)
    # print(v)
    n = 0
    f = [False] * N
    for j in range(len(S)):
        if v[n] == S[j]:
            n += 1
        if n >= 3:
            # print(v)
            ans += 1
            break

print(ans)


Measured memory_bytes: 133000
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {

	/* several useful subroutines */
	private static final BigDecimal BD1000000007 = new BigDecimal(1000000007);
	private static BufferedReader brStdin = new BufferedReader(new InputStreamReader(System.in));
	private static String[] readBuf = null;
	private static int readPtr = 0;
	private static String getString() throws IOException {
		while ( readBuf == null || readPtr >= readBuf.length ) {
			readBuf = brStdin.readLine().split(" ");
			readPtr = 0;
		}
		return readBuf[readPtr++];
	}
	private static int getInt() throws IOException {
		return Integer.parseInt(getString());
	}
	private static long getLong() throws IOException {
		return Long.parseLong(getString());
	}
	private static BigDecimal getBD() throws IOException {
		return new BigDecimal(getString());
	}
	@SuppressWarnings("unused")
	private static String[] getStringArray(int size) throws IOException {
		String stringArray[] = new String[size];
		for (int i = 0; i < stringArray.length; i++) {
			stringArray[i] = getString();
		}
		return stringArray;
	}
	@SuppressWarnings("unused")
	private static int[] getIntArray(int size) throws IOException {
		int intArray[] = new int[size];
		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = getInt();
		}
		return intArray;
	}
	@SuppressWarnings("unused")
	private static long[] getLongArray(int size) throws IOException {
		long longArray[] = new long[size];
		for (int i = 0; i < longArray.length; i++) {
			longArray[i] = getLong();
		}
		return longArray;
	}
	@SuppressWarnings("unused")
	private static BigDecimal[] getBDArray(int size) throws IOException {
		BigDecimal bdArray[] = new BigDecimal[size];
		for (int i = 0; i < bdArray.length; i++) {
			bdArray[i] = getBD();
		}
		return bdArray;
	}
	private static BigDecimal mod1000000007(BigDecimal bd) {
		return bd.subtract(BD1000000007.multiply(bd.divide(BD1000000007, BigDecimal.ROUND_DOWN))) ;
	}
	@SuppressWarnings("unused")
	private static BigDecimal mod1000000007(int i) {
		return mod1000000007(new BigDecimal(i)) ;
	}
	@SuppressWarnings("unused")
	private static BigDecimal mod1000000007(long l) {
		return mod1000000007(new BigDecimal(l)) ;
	}

	
	/* main routine */
	public static void main(String args[]) throws IOException {
		int n = getInt();
		int p[] = getIntArray(n);
		int cnt = 0;
		for ( int i = 0 ; i < n ; i++ ) {
			if ( p[i] != i+1 ) {
				cnt++;
			}
		}
		System.out.println( ( cnt==0 || cnt == 2 ) ? "YES" : "NO" );
	}
}


Measured memory_bytes: 22740