akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
using namespace std;

//BIT??? 1-indexed ??§??±?????????!!!! [1, N] ??????????????????????????¨????????±?????¨????????¨???.
void add(int x, int val,vector<int>& bit)
{
	int N = bit.size() - 1;
	while (x <= N) {
		bit[x] += val;
		x += x & -x;
	}
}

int sum(int x,vector<int>& bit)
{
	int ret = 0;
	while (x) {
		ret += bit[x];
		x &= (x - 1);
	}

	return (ret);
}

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int n, q; cin >> n >> q;

	// bit   1 - indexed
	vector<int> bit(n + 1);
	for (int i = 0; i < q; i++) {
		int com, x, y; cin >> com >> x >> y;
		if (com == 0) { add(x, y, bit); }
		else { cout << sum(y,bit) - sum(x - 1,bit) << endl; }
	}
}

Measured memory_bytes: 3332
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
  int n, a, b; cin >> n >> a >> b;
  int h[n];
  for (int i = 0; i < n; i++) cin >> h[i];
  
  int maxh = 0;
  for (int i = 0; i < n; i++) maxh = max(maxh, h[i]);

  int l = 1, r = (maxh + b - 1) / b;
  while (l < r) {
    int c = (l + r) / 2;
    ll count = 0;
    for (int i = 0; i < n; i++) {
      int rest = max(0LL, h[i] - b * (ll)c);
      count += (rest + (a - b) - 1) / (a - b);
    }
    if (count > c)
      l = c + 1;
    else
      r = c;
  }
  cout << l << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {
  
  long long X;
  cin >> X;
 

  for(long long i = -6210;i <= 6210;i++) {
    long long x = X+i*i*i*i*i;
    for(long long j = 1;j*j*j*j*j <= x;j++) {
      if(j*j*j*j*j == x) {
        cout << j << " " << i << endl;
        return 0;
      }
    }
  }

}


Measured memory_bytes: 3676
while True:
    a, b, c = map(int, input().split())
    if a >= 1 and a <= 10000:
        if b >= 1 and b <= 10000:
            if c >= 1 and c <= 10000:
                if a <= b:
                    break
                    
i = 0
for num in range(a, b+1):
    if c%num == 0:
        i += 1
print(i)


Measured memory_bytes: 5596
#include <stdio.h>
#include<string.h>
int main(void) {
	// your code goes here
	int n,k,i;
	scanf("%d",&n);
	char str[n];
	scanf("%s",str);
	scanf("%d",&k);
	for(i=0;i<strlen(str);i++)
	{
	    if(str[i]!=str[k-1])
	    str[i]='*';
	}
	printf("%s",str);
	return 0;
}



Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

//諸機能
#pragma region MACRO 
#define putans(x)  cerr << "answer: " ; cout << (x) << endl
#define dputans(x) cerr << "answer: "; cout << setprecision(10) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define substr(s,i,l) string((s), (i), (l))
#define tos(x) (to_string((x)))
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define input ifs >>
#else //いい感じにやる
#define input cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#ifndef _DEBUG
#define dbg1 {}
#define dbg2 {}
#define dbg3 {}
#define dbgArray {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(1e9)
#pragma endregion


int main() {

	int n; input n;
	putans(( n*( n + 1 ) ) / 2);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c,i,con,res;
    char s[11];

  // スペース区切りの整数の入力
    scanf("%s",s);
     res=0;  
      con=0;
	for(a=0;s[a]!='\0';a++){
    switch(s[a]){
      case 'A':
      case 'T':
      case 'C':
      case 'G':
        con++;
        break;
      default:
       if(con>res) res=con; 
       con = 0;
        break;
        }
       if(con>res) res=con;       
    }
      printf("%d\n",res);
  
    return 0;
}


Measured memory_bytes: 128
from copy import deepcopy


def floyd_warshall(dist):
    v = len(dist)
    for k in range(v):
        for i in range(v):
            for j in range(v):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

INF = 10**9
N, M = map(int, input().split())
G = [[INF] * N for _ in range(N)]
for i in range(N):
    G[i][i] = 0
for _ in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    G[a][b] = G[b][a] = c
dist = deepcopy(G)
floyd_warshall(dist)
used = set()
for i in range(N-1):
    checked = set()
    for j in range(i+1, N):
        stack = [j]
        while stack:
            v = stack.pop()
            if v in checked:
                continue
            checked.add(v)
            for k in range(N):
                if v == k:
                    continue
                if G[k][v] == INF:
                    continue
                if dist[i][v] == dist[i][k] + G[k][v]:
                    stack.append(k)
                    used.add((k, v) if k < v else (v, k))
print(M - len(used))


Measured memory_bytes: 45660
#include <bits/stdc++.h>
#define int int64_t
#define rep(i, N) for(int i=0; i<N; i++)
using namespace std;
using pair = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;
// " ", ' '
// std::string str;
// str = std::to_string(int i);

// プロトタイプ宣言
// int myfunc(int, vvec);

// グローバル変数
// int N, M;
// vvec data(N, vec(M));

// 関数：

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int N; cin >> N;
	vec B(N+1, 0);
	rep(i, N-1) cin >> B.at(i);

	int ans = B.at(0)+B.at(N-2);
	for(int i=1; i<N-1; i++) {
		ans += min(B.at(i-1), B.at(i));
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// Author: wlzhouzhuan
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
  
#define ll long long
#define ull unsigned long long
#define rint register int
#define rep(i, l, r) for (rint i = l; i <= r; i++)
#define per(i, l, r) for (rint i = l; i >= r; i--)
#define mset(s, _) memset(s, _, sizeof(s))
#define pb push_back
#define pii pair <int, int>
#define mp(a, b) make_pair(a, b)
  
inline int read() {
  int x = 0, neg = 1; char op = getchar();
  while (!isdigit(op)) { if (op == '-') neg = -1; op = getchar(); }
  while (isdigit(op)) { x = 10 * x + op - '0'; op = getchar(); }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) { putchar('-'); x = -x; }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}

const int N = 4000005;
const int mod = 1e9 + 7;

int fac[N], inv[N];
int qpow(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res = 1ll * res * a % mod;
    a = 1ll * a * a % mod;
    b >>= 1;
  }
  return res;
}
void pre(int n) {
  fac[0] = inv[0] = 1;
  for (rint i = 1; i <= n; i++) {
    fac[i] = 1ll * fac[i - 1] * i % mod; 
  }
  inv[n] = qpow(fac[n], mod - 2);
  for (rint i = n - 1; i >= 1; i--) {
    inv[i] = 1ll * inv[i + 1] * (i + 1) % mod;
  }
}
int C(int n, int m) {
  return 1ll * fac[n] * inv[n - m] % mod * inv[m] % mod; 
}
int f[2002][2002], n, k;
int main() {
  scanf("%d%d", &n, &k);
  if (k == 1) {
    puts("1");
    exit(0);
  }
  pre(n * k);
  for (rint i = 1; i <= n; i++) {
    f[i][0] = 1;
  }
  for (rint i = 1; i <= n; i++) {
    for (rint j = 1; j <= i; j++) {
      f[i][j] = (f[i - 1][j] + 1ll * f[i][j - 1] * (n - j + 1) % mod * C(n * k - i - (j - 1) * (k - 1) - 1, k - 2) % mod) % mod;
    }
  }
  printf("%d\n", f[n][n]);
  return 0; 
}

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

int main(){
  int a, b, x;
  cin >> a >> b >> x;
  if(0.5*a*a*b>x){
    double r=2.0*x/(a*b);
    printf("%.10f\n",90-atan(r/b)*180/M_PI);
    return 0;
  }
  double r=(2*((double)a*a*b-x))/(a*a*a);
  printf("%.10f\n",atan(r)*180/M_PI);
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;



int main()
{
	int a, b, c,d;
	cin >> a >> b >> c >> d;
	cout << min(a, b) + min(c, d) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(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; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    ll N;
    cin >> N;
    map<ll,ll> mp;
    for (ll i = 1;i<N;i++) {
        ll a;
        cin >> a;
        a--;
        mp[a]++;
    }
    for (ll i = 0;i<N;i++) {
        cout << mp[i] << endl;
    }
}

Measured memory_bytes: 16096
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>

using namespace std;

int main(void)
{
	map <char, int> count;
	string s;

	cin >> s;

	for (int i = 0; i < s.length(); i++)
	{
		if (count[s[i]] == 1)
		{
			cout << "no" << endl;
			return 0;
		}
		count[s[i]] = 1;
	}

	cout << "yes" << endl;

	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(M)]
num=[0 for i in range(N)]
for i in range(M):
    num[ab[i][0]-1]+=1
    num[ab[i][1]-1]+=1

for i in range(N):
    print(num[i])


Measured memory_bytes: 9136
// Aizu Vol0 0048: Class
// 2017.7.29

#include <stdio.h>
#include <stdlib.h>

double class[11] = { 48.0, 51.0, 54.0, 57.0, 60.0, 64.0, 69.0, 75.0, 81.0, 91.0, 1000.0 };
char *name[11] = {
	"light fly", "fly", "bantam", "feather", "light", "light welter", "welter",
	"light middle", "middle", "light heavy", "heavy" };

int main()
{
	int i;
	double w;

	while (scanf("%lf", &w) == 1) {
		for (i = 0; w > class[i]; i++);
		puts(name[i]);
	}
	return 0;
}

Measured memory_bytes: 608
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.annotation.tailrec

object Main {
  val p = 1000000000 + 7

  @inline
  def submod(a: Long, b: Long): Long = {
    ((a - b) % p + p) % p
  }

  @inline
  def mulmod(a: Long, b: Long): Long = {
    a * b % p
  }

  @inline
  def invmod(a: Long): Long = {
    (extGCD(a, p)._1 + p) % p
  }

  def extGCD(a: Long, b: Long): (Long, Long, Long) = {
    if (b == 0) {
      (1L, 0L, a)
    } else {
      val (y, x, d) = extGCD(b, a % b)
      (x, y - a / b * x, d)
    }
  }

  def powerMod(a: Int, n: Int): Long = {
    @tailrec
    def power(cur: Long, a: Long, n: Int): Long = {
      if (n == 0) {
        cur
      } else {
        power(mulmod(cur, if (n % 2 == 0) 1 else a), mulmod(a, a), n / 2)
      }
    }

    power(1L, a, n)
  }

  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val Array(n, a, b) = in.readLine().split("\\s+").map(_.toInt)

    val power2n = powerMod(2, n)
    val a_fact = {
      var f = 1L
      for {
        i <- 2 to a
      } {
        f = mulmod(f, i)
      }
      f
    }
    val b_fact = {
      var f = a_fact
      for {
        i <- (a + 1) to b
      } {
        f = mulmod(f, i)
      }
      f
    }
    val na_fact = {
      var f = 1L
      for {
        i <- n to (n - a + 1) by -1
      } {
        f = mulmod(f, i)
      }
      f
    }
    val nb_fact = {
      var f = na_fact
      for {
        i <- (n - a) to (n - b + 1) by -1
      } {
        f = mulmod(f, i)
      }
      f
    }
    val b_fact_inv = invmod(b_fact)
    val a_fact_inv = invmod(a_fact)

    out.println(
      submod(
        submod(
          submod(power2n, 1),
          mulmod(
            na_fact,
            a_fact_inv
          )
        ),
        mulmod(
          nb_fact,
          b_fact_inv
        )
      )
    )

    out.flush()
  }
}


Measured memory_bytes: 25672
//============================================================================
// Name        : f
// Date        : Wed Feb 20 10:59:11 CST 2019
// Author      : landcold7
// Description : Actions speak louder more than words
//============================================================================
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define mst(x, y) memset(x, y, sizeof(x))
#define pvar(x) cout << #x << ": "
#define fora(e, c) for (auto &e : c)
#define fori(i, a, b) for (int i = a; i < b; ++i)
#define ford(i, a, b) for (int i = a; i > b; --i)
#define output(v) cout << (v) << '\n'
#define prt(x, a, n) { cout << x[a]; if (a < n - 1) cout << " "; }
#define pvi(x, v) if(v) pvar(x); fora(a, x) cout << a << " "; cout << "\n"
#define par(x, s, n, v) if(v) pvar(x); fori(y, s, n) prt(x, y, n) cout << "\n"

#ifndef __has_trace
#define trace(...)
#endif
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

template <class T>
void amax(T& a, T b) {
    a = max(a, b);
}

const int inf = (int) 1e9 + 7;
void solve() {
    string ss, tt;
    cin >> ss >> tt;

    int a = sz(ss), b = sz(tt);
    using pip = pair<int, pii>;
    vector<vector<pip>> dp(a + 1, vector<pip>(b + 1, {-inf, {0, 0}}));
    dp[0][0] = {0, {0, 0}};
    fori (i, 0, a) {
        fori (j, 0, b) {
            if (ss[i] == tt[j]) {
                amax(dp[i+1][j+1], {dp[i][j].first + 1, {i, j}});
            }
            amax(dp[i+1][j], {dp[i][j].first, {i, j}});
            amax(dp[i][j+1], {dp[i][j].first, {i, j}});
        }
    }

    pip mx = {0, {0, 0}};
    fori (i, 0, a + 1) {
        fori (j, 0, b + 1) {
            amax(mx, {dp[i][j].first, {i, j}});
        }
    }
    trace(dp, mx);
    pii cur = mx.second;
    string ret;
    while (mx.first && !(cur.first == 0 || cur.second == 0)) {
        int i = cur.first, j = cur.second;
        pii pre = dp[i][j].second;
        if (pre == pii(i - 1, j - 1)) {
            assert(ss[i - 1] == tt[j - 1]);
            ret = ss[i - 1] + ret;
        }
        cur = pre;
    }
    output(ret);
}

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



Measured memory_bytes: 105984
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define rep(i,N) for(int i=0;i<(int)N;++i)

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

ll LCM(ll x, ll y) {
    return x / GCD(x, y) * y;
}

ll wazu = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (wazu - inv(wazu % x) * (wazu / x)) % wazu;
        if (a >= 0) { return a; }
        else { return wazu + a; }
    }
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    string SA, SB, SC;
    cin >> SA >> SB >> SC;

    char x = SA.front();
    SA.erase(SA.begin());

    while (1) {
        if (x == 'a') {
            if (SA.size() == 0) { cout << "A" << endl; break; }
            x = SA.front();
            SA.erase(SA.begin());
        }
        else if (x == 'b') {
            if (SB.size() == 0) { cout << "B" << endl; break; }
            x = SB.front();
            SB.erase(SB.begin());
        }
        else if (x == 'c') {
            if (SC.size() == 0) { cout << "C" << endl; break; }
            x = SC.front();
            SC.erase(SC.begin());
        }
    }

}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		
		int ans = 100000;
		
		for(int i = 0; i < n; i++){
			ans += ans / 20;
			if(ans % 1000 != 0){
				ans = ans / 1000 * 1000 + 1000;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 26088
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let m: i64 = sc.read();
    let a: Vec<i64> = sc.vec(n);

    let mut b = vec![];
    for i in 0..n {
        b.push(a[i] / 2);
    }

    match chinese_remainder_theorem(&b, &a) {
        Some((x, y)) => {
            if x > m {
                println!("0");
            } else {
                let z = m - x;
                if x > 0 {
                    println!("{}", z / y + 1);
                } else {
                    println!("{}", z / y);
                }
            }
        }
        _ => {
            println!("0");
        }
    }
}

pub fn extended_gcd(a: i64, b: i64, p: &mut i64, q: &mut i64) -> i64 {
    if b == 0 {
        *p = 1;
        *q = 0;
        a
    } else {
        let d = extended_gcd(b, a % b, q, p);
        *q -= a / b * *p;
        d
    }
}

pub fn chinese_remainder_theorem(b: &Vec<i64>, modulo: &Vec<i64>) -> Option<(i64, i64)> {
    let (mut r, mut m) = (0, 1);
    for i in 0..b.len() {
        let (mut p, mut q) = (0, 0);
        let d = extended_gcd(m, modulo[i], &mut p, &mut q);
        if (b[i] - r) % d != 0 {
            return None;
        }
        let tmp = ((b[i] - r) / d * p) % (modulo[i] / d);
        r += m * tmp;
        m *= modulo[i] / d;
    }
    Some(((r % m + m) % m, m))
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn 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: 6396
#include<bits/stdc++.h>
using namespace std;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define DQ deque
#define RE rend()
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define SE second
#define DL double
#define G getline
#define IN insert
#define endl "\n"
#define EM empty()
#define RB rbegin()
#define PSB push_back
#define PI acos(-1.00)
#define PPB pop_back()
#define PSF push_front
#define ub upper_bound
#define lb lower_bound
#define MD 1000000007
#define PPF pop_front()
#define LL long long int
#define PQ priority_queue
#define N cout<<"NO"<<endl
#define Y cout<<"YES"<<endl
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define UOSMOY v.C;w.C;ww.C;u.C;uu.C;uo.C;vo.C;vu.C;ab.C;bc.C;cc.C;uuu.C;a.C;b.C;c.C
V<LL>v;
V<LL>w,ab,bc;
set<LL>uo;
map<LL,LL>u,uc;
map<LL,LL>ww,cc;
LL ar[120005];
LL br[500005];
LL cr[500][500];
V<pair<LL,LL> >uu;
map<LL,V<LL> >uuu;
map<pair<LL,LL>,LL> vo;
map<pair<LL,LL>,LL> vu;
int main()
{
//  BRR;
//  file;
    FAST;
    char ch;
    string a,b,c,str;
    DL x,y,d,e,f,g,h;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r=0;
    while(tt--)
    {
//        UOSMOY;
       cin>>ch;
       if(ch>='A' && ch<='Z')
       {
           cout<<'A'<<endl;
       }
       else
       {
           cout<<'a'<<endl;
       }
    }
    return 0;
    //IN
    //AL
}


Measured memory_bytes: 3592
#include <iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int a[100005];
   int N;
   scanf("%d",&N);
  for(int i=0;i<N;i++)
   {
       scanf("%d",&a[i]);
   }
   sort(a,a+N);
   int r=0;
   for(int i=0;i<N;i++)
   {
       if(a[i]==a[i+1])
        a[i]=a[i+1]=0;
   }
        for(int i=0;i<N;i++)
        {
            if(a[i]!=0)
                r++;
        }
   printf("%d\n",r);
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	ll n,a; cin>>n>>a;
	if(n%500<=a)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	
	return 0;
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dbg(x...) do { cout << "\033[32;1m" << #x <<" -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<class T, class... Ts> void err(const T& arg,const Ts&... args) { cout << arg << " "; err(args...); }

typedef long double db;
const db eps = 1e-12;
const db pi = acosl(-1.0);
inline int sgn(db x) {if(fabs(x) < eps) return 0; return x < 0 ? -1 : 1;}
struct Point {
    db x, y;
    Point(){}
    Point(db x, db y):x(x), y(y){}
    void input(){
        cin >> x >> y;
    }
    Point operator + (const Point &b) const {
        return Point(x + b.x, y + b.y);
    }
    Point operator - (const Point &b) const {
        return Point(x - b.x, y - b.y);
    }
    db operator ^ (const Point &b) const {
        return x * b.y - y * b.x;
    }
    db operator * (const Point &b) const {
        return x * b.x + y * b.y;
    }
    Point operator * (const db k){
        return Point(x * k, y * k);
    }
    Point operator / (const db k){
        return Point(x / k, y / k);
    }
    db len2(){
        return x * x + y * y;
    }
    db len(){
        return sqrtl(len2());
    }
};
struct Line{
    Point s, e;
    Line(){}
    Line(Point s, Point e) :s(s), e(e){}
    void input(){s.input(), e.input();}
    Point getPointProgLine(Point p){
        Point a = e - s, b = p - s;
        return s + ((a * (a * b)) / a.len2());
    }
    Point getReflection(Point p) {
        Point q = getPointProgLine(p);
        return Point(q.x * 2 - p.x, q.y * 2 - p.y);
    }
}l;

int main(){
#ifndef ONLINE_JUDGE
// freopen("i.in","r",stdin);
//  freopen("o.out","w",stdout);
#endif
    l.input();
    int q;scanf("%d", &q);
    while(q -- ){
        Point p; p.input();
        p = l.getReflection(p);
        cout << fixed << setprecision(10) << p.x << ' ' << p.y << endl;
    } 

    return 0;
}


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

int main()
{
    int N;
    cin >> N;
    long long dp[N + 1];
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 0; i < N - 1; i++) {
        dp[i + 2] = dp[i + 1] + dp[i];
    }
    printf("%lld\n", dp[N]);
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define MAX 200000
#define MOD 1000000007
#define endl "\n"
lli obs[MAX];
vector <lli> adj[MAX];
bool check(lli s){
    if(adj[s].size() == 0)
        return true;
    bool flag = true;
    lli comp = obs[s];
    for(lli i = 0; i<adj[s].size(); i++){
        if(comp <= obs[adj[s][i]])
            flag = false;
    }
    return flag;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli N,M;
    cin>>N>>M;
    for(lli i = 0; i<N; i++)
        cin>>obs[i];
    for(lli i = 0; i<M; i++){
        lli A,B;
        cin>>A>>B;
        adj[A-1].push_back(B-1);
        adj[B-1].push_back(A-1);
    }
    lli a = 0;
    for(lli i = 0; i<N; i++){
        if(check(i))
            a++;
    }
    cout<<a;


}

Measured memory_bytes: 12600
#include<stdio.h>
#include<math.h>
int main()
{
    long a,b,n,i,j;
	scanf("%ld%ld%ld",&n,&a,&b);
	i=n/(a+b);
	j=n%(a+b);
	if(j>=a)
	printf("%ld",a*i+a);
	else
	printf("%ld",a*i+j);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
 
int main() {
	string a,b;
	cin >> a >> b;
	bool y=1;
	if (a.length()>b.length()) {
		cout << "GREATER\n";
		y=0;
	}
	else if (b.length()>a.length()) {
		cout << "LESS\n";
		y=0;
	}
	else {
		for (int i=0;i<=a.length();i++) {
			if (a[i]-'0'>b[i]-'0') {
				cout << "GREATER\n";
				y=0;
				break;
			} else if (b[i]-'0'>a[i]-'0') {
				cout << "LESS\n";
				y=0;
				break;
			}
		}
	}
	if (y) cout << "EQUAL\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    int ans = 1;
    for(int i = 2; i <= x; i++){
        for(int j = 2; pow(i,j) <= x; j++){
            int cmp = pow(i,j);
            chmax(ans, cmp);
        }
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int g[30][30][4];//top,bottom,left,right

int main(void) {
  int i,j,k;
  int w,h;
  while(cin>>w>>h,h+w){

    rep(i,30)rep(j,30)rep(k,4)g[i][j][k]=0;

    rep(i,h*2-1){
      if(i%2){
          rep(j,w){
            cin >> g[i/2][j][1];
            g[i/2+1][j][0] = g[i/2][j][1];
          }
      }else{
          rep(j,w-1){
            cin >> g[i/2][j][3];
            g[i/2][j+1][2] = g[i/2][j][3];
          }
      }
    }

    int used[30][30]={};

    queue<pii> q;
    q.push(pii(0,0));
    used[0][0] = 1;

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

    while(q.size()){
      int x = q.front().first;
      int y = q.front().second;
      q.pop();



      if(x == h-1 && y == w-1)break;

      rep(i,4)if(g[x][y][i] == 0){
        int nx = x + dx[i];
        int ny = y + dy[i];
        if(0 > nx || nx >= h || 0 > ny || ny >= w)continue;
        if(used[nx][ny] && used[x][y] + 1 >= used[nx][ny])continue;
        used[nx][ny] = used[x][y] + 1;
        q.push(pii(nx,ny));
      }

    }

    cout << used[h-1][w-1] << endl;

  }
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    int k, a, b;
    cin >> k >> a >> b;
    string ans = "NG";
    for (int i = a; i <= b; i++) {
        if (i % k == 0) ans = "OK";
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ll n,a,b;
	cin>>n>>a>>b;if(b<a)swap(a,b);
	ll k=((b-a)%2==0)?((b-a)/2):(n+1);
	cout<<min({k,b-1,n-a,(a+b-1)/2,(n-a+n-b+1)/2});
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int c[100][100];
int a[100 * 100];

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

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

    int x = 0;
    int y = 0;
    int dx = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < a[i]; j++)
        {
            c[x][y] = i;

            bool flip = x + dx < 0 || x + dx >= h;
            x = flip ? x : x + dx;
            y = flip ? y + 1 : y;
            dx *= flip ? -1 : 1;
        }
    }

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cout << c[i][j] + 1 << " ";
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(){
  int i,j,k,l,m,n;
  m=100000;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    m=m*1.05;
    if((l=m%1000)!=0)m=m+1000-l;
  }
  printf("%d\n",m);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  char a = 'a', e = 'e', i = 'i', o = 'o', u = 'u';
  if (c == a || c == e || c == i || c == o || c == u) {
    cout << "vowel" << endl;
  }
  else { cout << "consonant" << endl;}
}

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

void mondai2();

int main()
{
	int stop;
	mondai2();
	cin >> stop;
    return 0;
}
void mondai2() {
	int N, T,min = 1000;
	pair<int, int> ct[1000];
	int p=0,minl[1000];

	cin >> N >> T;

	for (int i = 0; i < N; i++) {
		cin >> ct[i].first >> ct[i].second;
	}

	for (int i = 0; i < N; i++) {
		if (T >= ct[i].second) {
			minl[p] = ct[i].first;
			p++;
		}
	}

	for (int i = 0; i < p ; i++) {
		if (min > minl[i]) {
			min = minl[i];
		}
	}
	if (p == 0) {
		cout << "TLE";
	}
	else {
		cout << min;
	}
}

Measured memory_bytes: 384
import sys
S = int(input())
if S <= 2:
    print(0)
    sys.exit()
elif S <= 5:
    print(1)
    sys.exit()
P = int(1e9+7)
dp=[0] * (S+1)
dp[3] = 1
dp[4] = 1
dp[5] = 1
for i in range(6, S + 1):
    tmp = 0
    for j in range(i - 2):
        dp[i] = (dp[i] + dp[j]) % P
    dp[i] = (dp[i] + 1) % P
print(dp[S])


Measured memory_bytes: 64876
#include <bits/stdc++.h>
using namespace std;
 
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;
 
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;
 
#define _  %  MOD
#define __ %= MOD
 
#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))
 
#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
#define fbo find_by_order
#define ook order_of_key
 
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=(res*x)%INF;y=y>>1;x=(x*x)%INF;}return res%INF;} // modular exponent
ll n;
int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
	cin>>n;
	vector<ll> c(n);
	rep(i,n) cin>>c[i];
	sortA(c);
	reverse(c.begin(),c.end());
	ll ans=0;
	rep(i,n)
	{
		ll val=c[i];
		val*=(i+2ll);
		val%=INF;
		val*=power(2,2*n-2);
		val%=INF;
		ans+=val;
		ans%=INF;
	}	
	cout<<ans<<'\n';
	return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!



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

typedef long long ll;

int main() {
	int n; cin >> n;
	vector<int>a(n); for (auto&& x : a)cin >> x;
	ll x2 = 0;
	for (int i = 0; i < n; i++) {
		if (i % 2) x2 -= a[i];
		else x2 += a[i];
	}
	vector<int>ans(n);
	ans[0] = x2 / 2;

	for (int i = 0; i < n - 1; i++) {
		ans[i + 1] = a[i] - ans[i];
	}
	for (auto&& x : ans)x *= 2;
	for (auto&& x : ans)cout << x << ' ';
	cout << endl;

	return 0;
}

Measured memory_bytes: 2048
n = int(input())
a = list(map(int, input().split()))
bars = {}
for i in a:
    if i in bars:
        bars[i] += 1
    else:
        bars[i] = 1
bars = sorted(bars.items(), key=lambda x: -x[0])

ans1 = 0
ans2 = 0
for i in bars:
    if i[1] >= 4:
        if ans1 == 0:
            ans1 = i[0]
            ans2 = i[0]
        else:
            ans2 = i[0]
        break
    elif i[1] >= 2:
        if ans1 == 0:
            ans1 = i[0]
        else:
            ans2 = i[0]
            break
print(ans1 * ans2)

Measured memory_bytes: 25252
#include <iostream>
#define N 10000
using namespace std;

int d[N];
int p[N];
void mergeSort(int, int);
void merge(int, int, int);
int main(){
  int n, m;
  while(1){
    cin >> n >> m;
    if(n==0 && m==0) break;

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

    mergeSort(0, n);

    for(int i=n-1;i>=0;i--){
      if(m>d[i]){
        m-=d[i];
        d[i]=0;
      }
      else{
        d[i]-=m;
        m=0;
        break;
      }
    }

    int ans=0;
    for(int i=0;i<n;i++){
      ans+=d[i]*p[i];
    }

    cout << ans << endl;
  }
  return 0;
}

void merge(int left, int mid, int right){
  int L[N/2+2], R[N/2+2];
  int l[N/2+2], r[N/2+2];
  int n1=mid-left;
  int n2=right-mid;
  for(int i=0;i<n1;i++){
    L[i]=p[left+i];
    l[i]=d[left+i];
  }
  for(int i=0;i<n2;i++){
    R[i]=p[mid+i];
    r[i]=d[mid+i];
  }

  L[n1]=R[n2]=2147483647;
  l[n1]=r[n2]=2147483647;
  int i, j;
  i=j=0;
  for(int k=left;k<right;k++){
    if(L[i]<=R[j]){
      p[k]=L[i];
      d[k]=l[i++];
    }
    else{
      p[k]=R[j];
      d[k]=r[j++];
    }
  }
}


void mergeSort(int left, int right){
  if(left>=right-1) return;
  int mid=(left+right)/2;
  mergeSort(left, mid);
  mergeSort(mid, right);
  merge(left, mid, right);
}

Measured memory_bytes: 1016
# -*- coding: utf-8 -*-
import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    A=tuple(map(int,input().split()))
    l1=[A[i]+i+1 for i in range(N)]
    l2=[i+1-A[i] for i in range(N)]
    l1.sort()
    l2.sort()
    ans=0
    for x in l1:
        ans+=bisect_right(l2,x)-bisect_left(l2,x)
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 117064
import heapq

N, M, R = map(int, input().split())
r = list(map(int, input().split()))

INF = 1 << 40
G, dist = [[] for i in range(N)], [[INF for k in range(N)] for j in range(N)]


def dijkstra(s):
    check = [0 for i in range(N)]
    dist[s][s], pq = 0, []
    heapq.heappush(pq, (0, s))

    while len(pq) != 0:
        u = heapq.heappop(pq)
        check[u[1]] = 2

        if dist[s][u[1]] < u[0]:
            continue

        for v in G[u[1]]:
            if dist[s][u[1]] + v[1] < dist[s][v[0]]:
                dist[s][v[0]], check[v[0]] = dist[s][u[1]] + v[1], 1
                heapq.heappush(pq, (dist[s][v[0]], v[0]))


check_dfs, cost_lst = [0 for m in range(R)], []


def dfs(s, cnt, cost):
    if cnt == 0:
        cost_lst.append(cost)
        return

    for i in range(R):
        if check_dfs[i] == 0:
            check_dfs[i] = 1
            dfs(r[i]-1, cnt-1, cost+dist[s][r[i]-1])
            check_dfs[i] = 0


def main():
    for i in range(M):
        a, b, c = map(int, input().split())
        G[a-1].append((b-1, c))
        G[b-1].append((a-1, c))

    for i in range(R):
        dijkstra(r[i]-1)

    for i in range(R):
        check_dfs[i] = 1
        dfs(r[i]-1, R-1, 0)
        check_dfs[i] = 0

    print(min(cost_lst))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9164
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
ll INF = (1LL << 50) - 1;
int MOD = 1e9+7;
struct Edge{
    int from,to;
    ll cost;
};
int V,E;
Edge edge[2001];
ll dist[1001];
bool bellman_ford(int s,int t){
    fill(dist,dist+V,-INF);
    dist[s] = 0;
    for(int i = 0;i < V*2;i++){
        for(int j = 0;j < E;j++){
            Edge e = edge[j];
            if(dist[e.from] != -INF && dist[e.to] < dist[e.from] + e.cost){
                dist[e.to] = dist[e.from] + e.cost;
                if(i >= V-1 && e.to == t)return true;
            }
        }
    }
    return false;
}
main(){
    cin >> V >> E;
    rep(i,0,E){
        int a,b,c;
        cin >> a >> b >> c;
        edge[i].from = a-1;
        edge[i].to = b-1;
        edge[i].cost = c;
    }
    if(bellman_ford(0,V-1) ){
        cout << "inf" << endl;
    }else{
        cout << dist[V-1] << endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using lli = long long int;
using i64 = int64_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int main() {
  i64 a, b, c, d;
  cin >> a >> b >> c >> d;
  i64 l = a + b, r = c + d;
  if (l > r) cout << "Left";
  if (l == r) cout << "Balanced";
  if (l < r) cout << "Right";
  cout << '\n';
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define D(x) cout << #x << "=" << x << endl
#define De(...)
using namespace std; 

int _; 

int n,a[105],ans=0;
 
int main()
{
	//for(scanf("%d",&_);_;_--)
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",a+i);
		if(i%2 == 0 && a[i]%2 == 1)
			ans++;
	} 
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3724
#include<iostream>
#include<set>
#include<map>
#include<string>
#include<vector>
#define rep(i, n) for(int i = 0; i < n; i++)
#define foreach(i, c) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++)
#define foreachr(i, c) for(__typeof(c.begin()) i = c.rbegin(); i != c.rend(); i--)
//#define DEBUG
using namespace std;

typedef struct{
	string nm;
	bool buy;
	string com;
	int price;
	int id;
}ORD;
class myless{
public:
	bool operator()(const pair<int, int> &l, const pair<int, int> &r){
		if(l.first != r.first)return l.first > r.first;
		else return l.second < r.second;
	}
};

int n;
ORD ord[1000];
map<string, set<pair<int, int> , myless > > cbuy;
map<string, set<pair<int, int> > > csell;
map<string, int> pbuy, psell;
map<string, int> pdeal;
set<string> person;
map<string, int> csum;
map<string, int> cdeal;
map<string, int> cmn, cmx;
set<string> dc;

void person_deal(int i, int t){
	bool b = ord[i].buy;
	int p = (ord[i].price+ord[t].price)/2;
	if(pdeal[ord[i].nm]){
		pdeal[ord[i].nm]++;
		if(b)pbuy[ord[i].nm]+=p; else psell[ord[i].nm]+=p;
	}else{
		pdeal[ord[i].nm] = 1;
		if(b)pbuy[ord[i].nm]=p; else psell[ord[i].nm]=p;
	}
}

int main(){
	while(cin>>n, n){
		dc.clear(); person.clear();
		cbuy.clear(); csell.clear();
		pbuy.clear(); psell.clear(); pdeal.clear();
		csum.clear(); cdeal.clear();
		cmn.clear(); cmx.clear();
		rep(i, n){
			string tn, tb, tc; int tp;
			cin>>tn>>tb>>tc>>tp;
			ord[i].nm = tn; ord[i].buy = (tb=="BUY"); ord[i].com = tc;
			ord[i].price = tp; ord[i].id = i;
			person.insert(tn);
			bool deal = 0; int target;
			if(ord[i].buy){
				foreach(j, csell[tc]){
					if(j->first <= tp && ord[j->second].nm != tn){
						deal = 1; target = j->second;
						csell[tc].erase(j);
						break;
					}
				}
				if(!deal)cbuy[tc].insert(make_pair(tp, i));
			}else{
				foreach(j, cbuy[tc]){
					if(j->first >= tp && ord[j->second].nm != tn){
						deal = 1; target = j->second;
						cbuy[tc].erase(j);
						break;
					}
				}
				if(!deal)csell[tc].insert(make_pair(tp, i));
			}
			if(deal){
				tp = (ord[i].price+ord[target].price)/2;
				if(cdeal[tc]){
					cdeal[tc]++;
					csum[tc] += tp;
					if(cmn[tc] > tp)cmn[tc] = tp;
					if(cmx[tc] < tp)cmx[tc] = tp;
				}
				else{
					dc.insert(tc);
					csum[tc] = cmn[tc] = cmx[tc] = tp;
					cdeal[tc] = 1;
				}
				person_deal(i, target); person_deal(target, i);
			}
		}
		foreach(i, dc){
			cout<<*i<<" ";
			cout<<cmn[*i]<<" ";
			cout<<csum[*i]/cdeal[*i]<<" ";
			cout<<cmx[*i]<<endl;
		}
		cout<<"--"<<endl;
		foreach(i, person){
			cout<<*i<<" ";
			cout<<pbuy[*i]<<" ";
			cout<<psell[*i]<<endl;
		}
		cout<<"----------"<<endl;
	}
	return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

struct Node {
    vector<pair<int, LL>> edges;

    Node(){}
    Node(vector<pair<int, LL>> edges) {
        this->edges = edges;
    }
};

void dfs(int i, LL dis, vector<Node> &nodes, vector<bool> &visited, vector<LL> &weights) {
    if(visited[i]) {
        return;
    }

    visited[i] = true;
    weights[i] = dis;
    for(auto edge : nodes[i].edges) {
        dfs(edge.first, dis + edge.second, nodes, visited, weights);
    }
}

int main() {
    int N;
    cin >> N;
    vector<Node> nodes(N + 1);
    REP(i, N - 1) {
        int a, b;
        LL c;
        cin >> a >> b >> c;
        nodes[a].edges.push_back(make_pair(b, c));
        nodes[b].edges.push_back(make_pair(a, c));
    }
    vector<LL> weight(N + 1, 0);
    vector<bool> visited(N + 1, false);
    int Q, K;
    cin >> Q >> K;
    dfs(K, 0, nodes, visited, weight);

    vector<LL> res(Q);
    REP(i, Q) {
        int x, y;
        cin >> x >> y;
        res[i] = weight[x] + weight[y];
    }
    REP(i, Q) {
        cout << res[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 16640
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <tuple>
#include <functional>
#include <map>
#include <unordered_map>
#include <queue>
#include <tuple>

using namespace std;

#define endl '\n'

using ull = unsigned long int;
using ll = long long;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  const int precision = 13;
  cout.precision(precision);
  cout.setf(ios_base::fixed);

  int n, m; cin >> n >> m;
  vector<string> b(n);
  for (auto& s : b) cin >> s;

  vector<vector<ll>> dp(n+1, vector<ll>(m+1, 0));

  const ll mod = 1e9 + 7;
  auto inc =
    [](ll& a, ll b) -> void {
      a += b;
      if (a >= mod) a -= mod;
    };

  dp[1][1] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (b[i-1][j-1] == '#') continue;
      inc(dp[i][j], dp[i-1][j]);
      inc(dp[i][j], dp[i][j-1]);
    }
  }

  cout << dp[n][m] << endl;

  return 0;
}


Measured memory_bytes: 9216
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort(reverse=True)
# print(a_list)
ans = a_list[0]
if n % 2 == 1:
    ans += 2 * sum(a_list[1:(n-1)//2]) + a_list[(n-1)//2]
else:
    ans += 2 * sum(a_list[1:n//2])
print(ans)


Measured memory_bytes: 31608
from collections import Counter
n = int(input())
A = list(map(int, input().split()))
R = [A[i] + i for i in range(n)]
L = [-A[i] + i for i in range(n)]
R_c = dict(Counter(R))
L_c = dict(Counter(L))
vals = set(R) & set(L)
ans = 0
for v in vals:
    r = 0 if R_c.get(v) is None else R_c[v]
    l = 0 if L_c.get(v) is None else L_c[v]
    ans += r*l
print(ans)

Measured memory_bytes: 82000
n = int(input())
a = list(map(int, input().split()))
dif  = 0
sum = 0

for i in range(len(a) - 1):
    dif = a[i] - a[i+1]
    if dif > 0:
        sum = sum + dif
        a[i + 1] = a[i + 1] + dif

print(sum)

Measured memory_bytes: 32060
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
int main() {
	int num, num1;
	char str[50];
	scanf("%d %d", &num, &num1);
	
		
	
		scanf("%s", str);
	
	for (int i = 0; i < num; i++) {



		if (num1 -1== i) {
			if ('A'==str[i]) {
				str[i ] = 'a';
			}
			else if ('B'==str[i ]) {
				str[i] = 'b';
			}
			else if ('C'==str[i]) {
				str[i] = 'c';
			}

		}
	}
		
			printf("%s", str);
		
	}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
int n,m,i,j,k,count1=0,count2=0;
using namespace std;
void ABC120(void);
void ABC121(void);
void ABC122(void);
void ABC123(void);
void ABC124(void);
void ABC125(void);
void ABC126(void);
void ABC127(void);
void ABC128(void);
void ABC129(void);

int main(void){
    ABC122();
}

void ABC122(){
    int max=0;
    string s;
    cin>>s;
    cerr<<s<<endl;
    for(i=0;i<s.length();i++){
        cerr<<count1<<" ";
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
            count1++;
            if(count1>max)max=count1;
        }else{
            count1=0;
        }
    }
    cout<<max<<endl;
}

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

int main(){
    int r, g, b;
    cin >> r >> g >> b;
    if((g*10 + b) % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
/// Author: Sarfaraz Alam
# include <bits/stdc++.h>
# define pb push_back
# define ll long long

# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG
typedef unsigned long long int ull;
using namespace std;
#include<string>
#include<cmath>
const int N = 1e5 + 7;
const int mod = 1e9 + 7;

ull foo(ull x)
{
  ull r = 1;
  for(ull i = 2; i<=x; i++)
  {
     r = (r*i)%mod;

  }
  return r;
}
int main()
{
    speed;
    #ifdef DEBUGfd
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif // DEBUG

    //Code begins
    int n, m;
    cin>>n>>m;

    int s = n+m;
    int mul = 1;

    if(n == m)
    mul = 2;

    if(abs(n-m) > 1)
    cout<<"0\n";
    else
    {
      ull r = 0;
      r = foo(n);
      r = (r*foo(m))%mod;
      r = (r*mul)%mod;
      cout<<r<<"\n";
    }







    return 0;
}


Measured memory_bytes: 256