akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

struct Info{

	bool operator<(const struct Info &arg) const{
			return flame > arg.flame;
	};
	double flame,x,y;
	int number,country;
};

struct Pass{
	bool operator<(const struct Pass &arg) const{
			if(dist != arg.dist){
				return dist < arg.dist;
			}else{
				return time > arg.time;
			}
	};
	void set(double arg_time,double arg_dist){
		time = arg_time;
		dist = arg_dist;
	}

	double time,dist;
};

int main(){

	double pre_flame,pre_x,pre_y;
	int pre_country,pre_number;

	priority_queue<Info> Q;
	priority_queue<Pass> P_A,P_B;

	int N;
	scanf("%d",&N);

	Info info;
	for(int i = 0; i < N; i++){
		scanf("%lf %d %d %lf %lf",&info.flame,&info.number,&info.country,&info.x,&info.y);
		Q.push(info);
	}

	pre_flame = Q.top().flame;
	pre_number = Q.top().number;
	pre_country = Q.top().country;
	pre_x = Q.top().x;
	pre_y = Q.top().y;

	Q.pop();

	while(!Q.empty()){

		if(pre_country == Q.top().country && pre_number != Q.top().number){
			Pass pass;
			pass.set((Q.top().flame-pre_flame)/60.0,sqrt((pre_x-Q.top().x)*(pre_x-Q.top().x)+(pre_y-Q.top().y)*(pre_y-Q.top().y)));

			if(pre_country == 0){
				P_A.push(pass);
			}else{
				P_B.push(pass);
			}
		}

		pre_flame = Q.top().flame;
		pre_number = Q.top().number;
		pre_country = Q.top().country;
		pre_x = Q.top().x;
		pre_y = Q.top().y;

		Q.pop();

	}

	if(P_A.empty())printf("-1 -1\n");
	else{
		printf("%.10lf %.10lf\n",P_A.top().dist,P_A.top().time);
	}

	if(P_B.empty())printf("-1 -1\n");
	else{
		printf("%.10lf %.10lf\n",P_B.top().dist,P_B.top().time);
	}


	return 0;
}

Measured memory_bytes: 2780
#include <iostream>
#include <vector> //可変長配列
#include <queue> //キュー
#include <unordered_map> //ハッシュ連想配列
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#define ll long long int
#define INFTY (1<<21)

using namespace std;

int main(void){
    cin.sync_with_stdio(false);
    for(;;){
        int n; cin>>n;
        if(n==0) return 0;
        int ans = 0;
        for(int i = 1; i < n; i++){
            int sum = 0;
            for(int j = i; sum < n; j++){
                sum += j;
            }
            if(sum==n) ans++;
        }
        cout<<ans<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3068
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    a = [list(map(lambda x: int(x) - 1, input().rstrip('\n').split())) for _ in range(n)]
    ps = [0] * n
    ql = collections.deque()
    for i in range(n):
        ql.append([0, i])
    for i in range(10 ** 10):
        fq = collections.defaultdict(int)
        while ql:
            d, p = ql.popleft()
            if d == i:
                if ps[p] < n - 1:
                    np = a[p][ps[p]]
                    if ps[np] < n - 1:
                        rp = a[np][ps[np]]
                        if p == rp:
                            if p not in fq and np not in fq:
                                fq[p]
                                fq[np]
                                ps[p] += 1
                                if ps[p] < n - 1:
                                    ql.append([d+1, p])
                                ps[np] += 1
                                if ps[np] < n - 1:
                                    ql.append([d+1, np])
            else:
                ql.appendleft([d, p])
                break
        else:
            print(i + 1 if sum(ps) == n * (n - 1) else -1)
            exit()


if __name__ == '__main__':
    solve()


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

int main() {
  int n; cin>>n;
  int x[100002];
  int sum=0;
  rep(i, 100002) x[i]=0;
  rep(i, n) {
    int a; cin>>a;
    x[a]++;
  }
  rep(i, 100002) if (x[i]) sum++;
  if (sum%2==0) cout<<sum-1<<endl;
  else cout<<sum<<endl;
  return 0;
}


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

int main() {
  int N , K , x , A , B;
  cin >> N >> K;
  int sum = 0;
  int i = 0;
  while(i < N ){
    cin >> x;
    A = x * 2;
    B = (K - x) * 2;
    if(A >= B){
   sum += B;
    }
    else{
      sum += A;
    }
      i++;
  }
    cout << sum << endl;
}


Measured memory_bytes: 256
/* AOJ 0044
 *
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0044
 *
 */

#include <stdio.h>

#define true 1
#define false 0

int table[51000];
/* 51000 must be bigger than the first prime after 50000 */


int isprime(int n){
    int i;
    for(i=2;i*i<=n;i++){
        if(table[i] && !(n%i)){
            return false;
        }
    }
    return true;
}

void build(void){
    int i;
    table[0]=1;
    table[1]=1;
    table[2]=1;
    for(i=2;i<51000;i++){
        table[i]=isprime(i);
    }
}


void find(int* largest, int n, int* smallest){
    int i;
    for(i=n-1; i>1; i--){
        if(table[i]){
            *largest=i;
            break;
        }
    }
    for(i=n+1; i<51000; i++){
        if(table[i]){
            *smallest=i;
            break;
        }
    }

}


int main(){
    int n, largest, smallest;
    build();
    while(scanf("%d", &n) == 1){
        find(&largest, n, &smallest);
        printf("%d %d\n", largest, smallest);
    }

    return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

int main(void)
{
  char arr[15];
  int n, m;
  char s[110][15];
  char t[110][15];
  int count[110]={0};

    fgets(arr , sizeof(arr), stdin);
    sscanf(arr, "%d", &n);
    int x=0;
    bool flag = false;

  for (int i=0; i < n; i++) {
    fgets(arr , sizeof(arr), stdin);
    for (int j=0; j <= x+1; j++) {
    if ( 0 == strcmp(arr, s[j])) {
        count[j]++;
        flag = true;
        break;
      }
    }
    if (flag == false) {
       strcpy(s[x], arr);
       x++;
      } else {
        flag = false;
      }

  }
    fgets(arr , sizeof(arr), stdin);
    sscanf(arr, "%d", &m);

    for (int i=0; i < m; i++) {
      fgets(arr , sizeof(arr), stdin);
        for (int j=0; j < x; j++) {
          if ( 0 == strcmp(arr, s[j])) {
            count[j]--;
            break;
          }
        }
      }

 int max = -100;
      for (int i=0; i < x; i++) {
        if (max < count[i]) {
          max = count[i];
        }
  }
  max++;
    if (max < 0) {
      max = 0;
    }
    printf("%d\n", max);



    return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int[] a = in.ii(3 * N);
        Arrays.sort(a);
        long ans = 0;
        for (int i = 1; i <= N; i++) {
            ans += a[3 * N - 2 * i];
        }
        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


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

#define lpsbd(i, s, b, d) for(size_t i = s; i < b; i+=d)
#define lpsb(i, s, b) for(size_t i = s; i < b; i++)
#define lpn(i, n) for(size_t i = 0; i < n; i++)
#define fa(i, x) for(auto &i: x)
#define vcd(t, n, d) vector<t>(n, d)
#define vc(t, n) vector<t>(n)

using namespace std;
using ull = unsigned long long;

const ull MOD = 1000000007;

int main(void)
{
    int N, D;
    cin >> N >> D;
    cout << (N + 2*D) / (2*D + 1) << endl;
    return 0;
}

Measured memory_bytes: 256
/*
  AOJ 2157
  Title:
  @kankichi573
*/
#include <stdio.h>
#include <string.h>
int n;
int min_;

find_not_zero(char *diff,int start)
{
  int i;
  for(i=start;i<n;i++)
    if(diff[i])
      return(i);
  return(-1);
}

is_zero(char *diff)
{
  int i;

  for(i=0;i<n;i++)
    if(diff[i])
      return(0);
  return(-1);
}


void dump(char *diff)
{
  int i;

  for(i=0;i<n;i++)
    printf("%d|",diff[i]);
  printf("\n");
}

void rotate_count(char *diff,int acc)
{
  int i,cnt=0,pos,offs;
  char diff2[10];

  //dump(diff);
  pos=0;
  pos=find_not_zero(diff,pos);

  if(pos==-1)
    {
      if(min_>acc)
	min_=acc;
      return;
    }
  offs=diff[pos];
  memcpy(diff2,diff,10);
  for(i=pos;i<n;i++)
    {
      diff2[i]=diff2[i]+10-offs;
      diff2[i] %= 10;
      rotate_count(diff2,acc+1);
    }
}

void calc_diff(char *init,char *unlock,char *diff,int n)
{
  int i;
  char d;

  for(i=0;i<n;i++)
    {
      d = unlock[i]-init[i];
      if(d<0)
	d+=10;
      diff[i]=d;
    }
}
main()
{
  int i;

  char d,count,st,nn;
  char init[10],unlock[10],diff[10];

  while(scanf("%d",&n) && n)
    {    
      scanf("%s %s",init,unlock);
      if(0==memcmp(init,unlock,n))
            printf("0\n");
      else
	{
	  min_=99;
	  calc_diff(init,unlock,diff,n);
	  rotate_count(diff,0);
	  printf("%d\n",min_);
	}
    }
  return(0);
}

Measured memory_bytes: 628
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

#define EPS (1e-7)

int main() {
    string S;
    cin >> S;
    string ans = "Good";
    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]){
      ans = "Bad";
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s;
    cin>>s;
    ll n=s.size(),cnt=0,ans=0;
    rep(i,n){
        if(s[i]=='B') cnt++;
        else ans+=cnt;
    }
    cout<<ans;
}

Measured memory_bytes: 3688
N = int(input())
lst = list(map(int,input().split()))
lst.reverse()
lst2 = [0] * N
for idx,i in enumerate(lst):
  if (idx % 2 == 0):
    lst2[idx // 2] = i
  else:
    lst2[N-(idx // 2)-1] = i
print(" ".join(map(str,lst2)))

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;

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

	ll n, k;
	cin >> n >> k;

	vl num(k, 0);
	for (int i = 1; i <= n; i++) {
		num[i % k]++;
	}
	ll res = 0;
	for (int a = 0; a < k; a++) {
		ll b = (k - a) % k;
		ll c = (k - a) % k;
		if ((b + c) % k != 0) continue;
		res += num[a] * num[b] * num[c];
	}

	out(res);

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
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(){
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='o') cnt++;
    }
    if(cnt+15-s.size()>=8) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>

//同じコードでそんなにばらつくんですか

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 130000, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return tmp;
}

int H[100001];
bool NG[100001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint(), M = getint();
	rep1(i, N) H[i] = getint();
	rep(i, M) {
		int a = getint(), b = getint();
		if (H[a] >= H[b]) NG[b] = 1;
		if (H[a] <= H[b]) NG[a] = 1;
	}
	int kotae = N;
	rep1(i, N) kotae -= NG[i];

	printf("%d", kotae);

	Would you please return 0;
}

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

using namespace std;

int digts_sum(int n)
{
    int sum = 0;

    while (n)
    {
        int current = n % 10;
        sum++;
        n /= 10;
    }
    return sum;
}

int main()
{
    int n;
    int ans = 0;
    cin >> n;

    for (int i = 0; i <= n; i++)
    {
        if (i % 2 == 0)
        {
            continue;
        }

        int divid_count = 0;

        for (int j = 1; j <= i; j++)
        {
            if (i % j == 0)
            {
                divid_count++;
            }
        }

        if (divid_count == 8)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main(){
  int A, B, C, price;
  cin >> A >> B;
  C = max( A*15, B*15);
  price = -1;
  rep(i, C){
    if( floor(i * 0.08) == A && floor(i * 0.1) == B){
      price = i;
      break;
    }
  }
  cout << price << endl;
}

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

int main() {
  int A , B , C , D ;
  
  cin >> A >> B >> C >> D ;
  
  if ( A + B > C + D ) {
    cout << "Left" << endl;
  }
  else if ( C + D > A + B ) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}
    


Measured memory_bytes: 256
N=int(input())

def dfs(cur,use,counter):
    if cur>N:
        return 0
    
    counter=int(use==0b111)

    counter+=dfs(cur*10+7,use | 0b001, counter)
    counter+=dfs(cur*10+5,use | 0b010, counter)
    counter+=dfs(cur*10+3,use | 0b100, counter)

    return counter

print(dfs(0,0,0))

Measured memory_bytes: 42728
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader breader = getReader();
		int n = getInt(breader);
		int[] num = getAry(breader);
		int snum = 0;
		for(int i = 0; i < n ; i++ ) {
			for( int j = n-1 ; j > i ; j-- ) {
				if ( num[j] < num[j-1] ) {
					int k = num[j] ;
					num[j] = num[j-1];
					num[j-1] = k;
					snum++;
				}
			}
		}
		putAry(num);
		System.out.println(snum);
	}
	public static BufferedReader getReader() {
		return( new BufferedReader(new InputStreamReader(System.in)));
	}
	public static int getInt(BufferedReader br)throws Exception {
		String line = br.readLine();
		return Integer.valueOf(line);
	}
	public static int[] getAry(BufferedReader br)throws Exception {
		String line = br.readLine();
		String[] nstr = line.split(" ");
		int[] n = new int[nstr.length];
		for( int i=0 ; i < nstr.length ; i++ ) {
			n[i] = Integer.valueOf(nstr[i]);
		}
		return n;
	}
	public static int[] getAryMl(BufferedReader br)throws Exception {
		int n = getInt(br);
		int[] ary = new int[n];
		for( int i=0 ; i < n ; i++ ) {
			ary[i] = getInt(br);
		}
		return ary;
	}
	public static void putAry(int[] ary, int num) {
		for( int i = 0; i < num ; i++ ) {
			System.out.print(ary[i]);
			if ( i < num-1) {
				System.out.print(" ");
			}
		}
		System.out.println("");
	}
	public static void putAry(int[] ary) {
		putAry(ary, ary.length ) ;
	}
	public static boolean isPrime(int n) {
		int r = (int)Math.sqrt((double)n)+1;
		for( int j = 2 ; j < r ; j += 1) {
			if ( n%j == 0 ) {
				return false;
			}
		}
		return true;
	}

}

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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
	long double a, b, c;
	cin >> a >> b >> c;
	long double d = sqrt(a*b)*2;
	if(c > a+b+d) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 3788
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,n) a[i] = in();
    sort(ALL(a));
    reverse(ALL(a));
    a.push_back(0);
    REP(i,n){
        if (i + 1 >= a[i + 1]){
            // cout << i << endl;
            int x = 1;
            if (i + 1 > a[i + 1]) x = (a[i] - i) % 2;
            else if ((a[i] - i) % 2 == 0) x = 0;
            else{
                int j = i + 1;
                while (a[j] == i + 1){
                    j++;
                    x ^= 1;
                }
            }
            cout << (x ? "Second" : "First") << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
#+swank (declaim (optimize (speed 0) (safety 3) (debug 3)))
#-swank (declaim (optimize (speed 3) (safety 0) (debug 0)))

(defconstant +mod+ 1000000007)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1
        (write obj :stream stream)
      (terpri stream))))


(defmethod fast-sort ((sequence list) &key (test #'<))
  (declare (inline sort)
           (inline sb-impl::stable-sort-list))
  (sort sequence (lambda (x y)
                   (funcall test x y))))


(defmethod fast-sort ((sequence array) &key (test #'<))
  (declare (inline sort))
  (sort sequence (lambda (x y)
                   (funcall test x y))))

(defmacro read-numbers-to-list (size)
  `(progn
     (when (not (integerp ,size))
       (error "Size must be integer."))
     (when (< ,size 0)
       (error "Size must be plus or zero."))
     (loop repeat ,size collect (read))))



(defmacro read-numbers-to-array (size)
  `(progn
     (when (not (integerp ,size))
       (error "Size must be integer."))
     (when (< ,size 0)
       (error "Size must be plus or zero."))
     (make-array ,size :initial-contents (read-numbers-to-list ,size))))

(defmacro read-numbers-to-board (row-size column-size)
  (let ((board (gensym))
        (r (gensym))
        (c (gensym)))
    `(let ((,board (make-array '(,row-size ,column-size))))
       (dotimes (,r ,row-size)
         (dotimes (,c ,column-size)
           (setf (aref ,board ,r ,c) (read))))
       ,board)))


(defun princ-for-each-line (list)
  (format t "~{~a~&~}" list))

(defun unwrap (list)
  (format nil "~{~a~^ ~}" list))



(defmacro with-buffered-stdout (&body body)
  (let ((out (gensym)))
    `(let ((,out (make-string-output-stream :element-type 'base-char)))
       (let ((*standard-output* ,out))
         ,@body)
       (write-string (get-output-stream-string ,out)))))




;;; Write code here

(defun solve (n)
  n)


(defun main ()
  (let* ((n (read))
         (m (read))
         (h (read-numbers-to-array n))
         (edges (make-array n :initial-element nil)))
    (loop repeat m do
         (let ((a (1- (read)))
               (b (1- (read))))
           (push a (aref edges b))
           (push b (aref edges a))))
    (let ((res 0))
      (loop for i below n do
           (let ((edges-i (aref edges i))
                 (flag t))
             (loop for edge in edges-i do
                  (when (<= (aref h i)
                            (aref h edge))
                    (setf flag nil))
                finally
                  (when flag
                    (incf res))))
         finally
           (format t "~a~&" res)))))

(main)


Measured memory_bytes: 85568
A = [[1, 1], [1, 1]]
B = [[1], [1], [1], [1]]
C = [[1, 1, 1, 1]]
D = [[0, 1], [1, 1], [1, 0]]
E = [[1, 1, 0], [0, 1, 1]]
F = [[1, 0], [1, 1], [0, 1]]
G = [[0, 1, 1], [1, 1, 0]]


def f(_h, _w, flg):
    for h in range(8-_h+1):
        for w in range(8-_w+1):
            big = f1(h, w, _h, _w)
            if f2(big, flg):
                return True


def f1(s_h, s_w, _h, _w):
    big = []
    for h in range(_h):
        w_line = []
        for w in range(_w):
            w_line.append(maps[s_h+h][s_w+w])
        big.append(w_line)
    return big


def f2(big, flg):
    if flg == 'A':
        return bool(big == A)
    elif flg == 'B':
        return bool(big == B)
    elif flg == 'C':
        return bool(big == C)
    elif flg == 'D':
        return bool(big == D)
    elif flg == 'E':
        return bool(big == E)
    elif flg == 'F':
        return bool(big == F)
    elif flg == 'G':
        return bool(big == G)


def display():
    if f(2, 2, 'A'):
        print('A')
    elif f(4, 1, 'B'):
        print('B')
    elif f(1, 4, 'C'):
        print('C')
    elif f(3, 2, 'D'):
        print('D')
    elif f(2, 3, 'E'):
        print('E')
    elif f(3, 2, 'F'):
        print('F')
    elif f(2, 3, 'G'):
        print('G')

while True:
    try:
        maps = []
        for _ in range(8):
            maps.append(list(map(int, input())))
        display()
        input()
    except EOFError:
        break

Measured memory_bytes: 7892
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt(),b=sc.nextInt();
		if(a < 9 && b < 9) {
			System.out.println("Yay!");
		}else {
			System.out.println(":(");
		}
	}
}


Measured memory_bytes: 21844
# /usr/bin/python
# -*- coding: utf-8 -*-
#
import math


n,h = map(int, input().split())
a = [0 for i in range(n)]
b = [0 for i in range(n)]
for i in range(n):
  a[i],b[i] = map(int, input().split())
a = max(a)
b = sorted(b, key=lambda x:-x)

ans = 0
# Throw
for t in b:
  if h > 0 and a < t:
    ans += 1
    h -= t

# Kill
if h > 0:
  ans += math.ceil(h / a)

print(ans)




Measured memory_bytes: 54064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const ll dx[4] = {1,0,-1,0};
const ll dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
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() {
  cout << fixed << setprecision(10);
  ll n;
  cin >> n;
  map<ll,ll> mp;
  rep(i,n){
    ll a;
    cin >> a;
    mp[a]++;
  }
  ll sum = 0;
  for(auto p:mp){
    sum+=p.first*p.second;
  }
  ll q;
  cin >> q;
  vector<ll> b(q),c(q);
  rep(i,q){
    cin >> b[i] >> c[i];
  }
  rep(i,q){
    mp[c[i]]+=mp[b[i]];
    sum+=(c[i]-b[i])*mp[b[i]];
    mp[b[i]]=0;

    cout << sum << endl;
  }

}


Measured memory_bytes: 10488
#include <algorithm>
#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()
#define ll long long
#define INF 1000000000000000000

void rec(int keta, ll val, vector<ll> &all) {
    all.emplace_back(val);

    if (keta == 10)
        return;

    for (int i = -1; i <= 1; i++) {
        int add = (val % 10) + i;
        if (add >= 0 && add <= 9)
            rec(keta + 1, val * 10 + add, all);
    }
}

int main() {
    vector<ll> all;
    int K;
    cin >> K;
    for (int v = 1; v < 10; v++) {
        rec(1, v, all);
    }

    sort(all.begin(), all.end());
    cout << all[K - 1] << endl;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 58;
const int MOD = 1000000007;
const int MAX_N = 200100;

signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    vi v;
    v.resize(N);
    REP(i, N - 1)
    {
        int t;
        cin >> t;
        v[t - 1]++;
    }
    REP(i, N)
    cout << v[i] << endl;

    return 0;
}

Measured memory_bytes: 4796
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdint>
using namespace std;

const int N_MAX = 1;

int main(){
    int n;

    cin >> n;

    int ans = 0;
    for(int i = 1; i <= n; i += 2) {
        int divisor_cnt = 0;
        for(int j = 1; j <= i; j++) {
            if(i % j == 0) {
                divisor_cnt++;
            }
        }
        ans = (divisor_cnt == 8) ? ans + 1 : ans;
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

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

    int dp[n][3];
    dp[0][0]=a[0], dp[0][1]=b[0], dp[0][2]=c[0];
    for(int i=1; i<n; i++){
        dp[i][0]=a[i]+max(dp[i-1][1], dp[i-1][2]);
        dp[i][1]=b[i]+max(dp[i-1][0], dp[i-1][2]);
        dp[i][2]=c[i]+max(dp[i-1][0], dp[i-1][1]);
    }
    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;

int main(){
  int n, i;
  cin >> n;
  vector<int> A(n+2);
  A[0] = 0;
  A[n+1] = 0;
  for(i=1; i<=n; i++){
    cin >> A[i];
  }
  int sum = 0;
  rep(i, n+1){
    sum += abs(A[i]-A[i+1]);
  }
  for(i=1; i<=n; i++){
    cout << sum - abs(A[i-1]-A[i]) - abs(A[i]-A[i+1]) + abs(A[i-1]-A[i+1]) << endl;
  }
  
}

Measured memory_bytes: 1664
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n,p; cin>>n>>p;
    if(n==1) cout<<p<<endl;
    else{
        vector<int> cnt(1000001,0);
        ll ans=1;
        for(ll i=2;i*i<=p;i++){
            while(p%i==0){
                cnt[i]++;
                p/=i;
            }
        } 
        if(p!=1 && p<1000001) cnt[p]++;
        rep(i,1000001){
            rep(j,cnt[i]/n) ans*=i;
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 4096
#include<iostream>
using namespace std;
#include<vector>
#include<map>
#include<set>

int main(){
  int h,w;
  cin>>h>>w;
  vector<string> a(h);
  for(int i = 0;i<w+2;i++)cout<<"#";
  cout<<endl;
  for(int i = 0;i<h;i++){
    cin>>a[i];
    cout<<"#"<<a[i]<<"#"<<endl;
  }

  for(int i = 0;i<w+2;i++)cout<<"#";
  cout<<endl;
return 0;



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int n;
  cin >> n;
  int k = n % 10;
  if (k == 2 || k == 4 || k == 5 || k == 7 || k == 9){
    cout << "hon";
  } else if (k == 0 || k == 1 || k == 6 || k == 8){
  	cout << "pon";
  } else {
    cout << "bon";
  }
}

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

int main() {
  int A, B, X;
  cin >> A >> B >> X;
  if (0 <= (X - A) && (X - A) <= B) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int K;
int arr[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> K; K--;
	cout << arr[K] << endl;
}







Measured memory_bytes: 256
n = int(input())

count = 0
flag = False
for i in range(n):
  a1, a2 = map(int, input().split())
  if a1 == a2:
    count += 1
    if(count == 3):
      flag = True
  else:
    count = 0

if flag:
  print("Yes")
else:
  print("No")
 

Measured memory_bytes: 62392
function main()
  
  N = parse(Int,readline())
  
  A = div(N,1000)
  B = div(N - (A*1000),100)
  C = div(N - (A*1000) - (B*100),10)
  D = N - (A*1000) - (B*100) - (C*10)
  
  reg = 0
  
  if A+B+C+D == 7 && reg == 0
    reg += 1
    println(string(A)*"+"*string(B)*"+"*string(C)*"+"*string(D)*"=7")
  end
  
  if A+B+C-D == 7 && reg == 0
    reg += 1
    println(string(A)*"+"*string(B)*"+"*string(C)*"-"*string(D)*"=7")
  end
  
  if A+B-C+D == 7 && reg == 0
    reg += 1
    println(string(A)*"+"*string(B)*"-"*string(C)*"+"*string(D)*"=7")
  end
  
  if A+B-C-D == 7 && reg == 0
    reg += 1
    println(string(A)*"+"*string(B)*"-"*string(C)*"-"*string(D)*"=7")
  end
  
  if A-B+C+D == 7 && reg == 0
    reg += 1
    println(string(A)*"-"*string(B)*"+"*string(C)*"+"*string(D)*"=7")
  end
  
  if A-B+C-D == 7 && reg == 0
    reg += 1
    println(string(A)*"-"*string(B)*"+"*string(C)*"-"*string(D)*"=7")
  end
  
  if A-B-C+D == 7 && reg == 0
    reg += 1
    println(string(A)*"-"*string(B)*"-"*string(C)*"+"*string(D)*"=7")
  end
  
  if A-B-C-D == 7 && reg == 0
    reg += 1
    println(string(A)*"-"*string(B)*"-"*string(C)*"-"*string(D)*"=7")
  end
      
end

main()

Measured memory_bytes: 111684
#include <iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<limits.h>
#include<math.h>

using namespace std;
#define MOD 1000000007


static long long int fact[200000] = { 0 };

long long int factrial(long long int num) {
	if (num == 0)return 1;
	if (num == 1)return 1;
	if (fact[num] != 0)return fact[num];

	long long int ans = 1;

	ans = num * factrial(num - 1) % MOD;
	fact[num] = ans;
	return ans;

}

long long int superpow(long long int num, long long int count) {
	if (count == 0)return 1;
	if (count == 1)return num;

	long long int wk = superpow(num, count / 2);

	if (count % 2 == 0)return (wk * wk) % MOD;

	return (((wk * wk) % MOD) * num) % MOD;

}

long long int inv(long long int num) {

	return superpow(num, MOD - 2) % MOD;

}

//nCrのやつ
long long int comb(long long int n, long long int r) {
	if (n == r)return 1;
	if (r == 0)return 1;
	long long int ans = 1;

	ans = factrial(n);

	long long int wk = 1;

	wk = factrial(r);
	
	ans = (ans * inv(wk)) % MOD;

	wk = 1;
	
	wk = factrial(n - r);

	ans = (ans * inv(wk)) % MOD;

	return ans;
}

long long int min(long long int a, long long int b) {
	if (a > b)return b;
	return a;



}


typedef pair<int, long long int> P;

bool pairCompare(const P& firstElof, const P& secondElof) {
	return firstElof.second > secondElof.second;
}


int main()
{
	int h, w;
	char wk;
	cin >> h >> w;

	vector<string> str(h);

	for (int i = 0; i < h; i++) {
		str[i].push_back('#');
		for (int j = 0; j < w; j++) {
			cin >> wk;
			str[i].push_back(wk);
		}

		str[i].push_back('#');
	}

	string shapes = "";

	for (int i = 0; i < w+2; i++) {
		shapes.push_back('#');
	}

	cout << shapes << endl;

	for (int i = 0; i < h; i++) {
		cout << str[i] << endl;
	}

	cout << shapes << endl;

	return 0;



}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int prime[120001],num,cou=0,ans=0;
    for(int i=2;i<=120000;i++)prime[i]=0;
    for(int i=2;i<=(int)sqrt(120000);i++){
        for(int j=2;j*i<=120000;j++)prime[i*j]=1;
    }
    while(cin>>num&&num!=0){
        for(int i=2;cou<num;i++){
            if(prime[i]==0){
                    ans+=i;
                    cou++;
            }
        }
        cout<<ans<<endl;
        ans=0;cou=0;
    }
}

Measured memory_bytes: 2092
import java.util.Scanner;

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

		int w = scan.nextInt();
		int h = scan.nextInt();
		int n = scan.nextInt();

		int x_min = 0;
		int y_min = 0;
		int x_max = w;
		int y_max = h;

		for(int i = 0; i < n; i++){
			int x = scan.nextInt();
			int y = scan.nextInt();
			int a = scan.nextInt();

			if(a == 1){
				if(x_min < x){
					x_min = x;
				}
			}
			else if(a == 2){
				if(x_max > x){
					x_max = x;
				}
			}
			else if(a == 3){
				if(y_min < y){
					y_min = y;
				}
			}
			else if(a == 4){
				if(y_max > y){
					y_max = y;
				}
			}
		}

		int area = 0;
		if(x_max > x_min && y_max > y_min){
			area = (x_max - x_min) * (y_max - y_min);
		}
		System.out.println(area);
	}
}


Measured memory_bytes: 23124
require 'set'

def main
    a,b,n = gets.chomp.split(" ").map(&:to_i)

    if n > (b-1)
        n = n / b * b - 1
    end
    puts a*n/b - a*(n/b)
end

main

## イディオムなど
# until s.empty? do
#
## 配列のインデックス
# s[0,6] # 0番目から6文字
# s[0..6] # 0番目から6番目まで
# s[5..-1] # 5番目から最後まで
#
## 全探索
# [0, 1].repeated_permutation(n) do |combination| # bit全探索
# array.combination(i) do |selected| # array から要素が i 個である部分列を全部抽出
#
## 無向グラフの幅優先探索(BFS)
# to = Array.new(n).map{Array.new()} # ある頂点と繋がる頂点のリスト
# m.times do
#     a,b = gets.chomp.split(" ").map(&:to_i)
#     to[a].push b
#     to[b].push a
# end
# q = Queue.new # BFS は queue
# ds = Array.new(n, -1)
# pre = Array.new(n, -1)
#
## その他
# a1 = Marshal.load(Marshal.dump(a2)) # 深いコピー
# matrix = Array.new(n).map{Array.new()} # 二次元配列の初期化
# 

Measured memory_bytes: 14424
#include<iostream>
#include<cmath>

using namespace std;

int main(int argc, char const *argv[])
{
    long long a,b,c,k;
    cin >> a >> b >> c >> k;
    if (k%2==0){
        cout << a-b;
    }else{
        cout << b-a;
    }
    cout << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<map>
#include<set>
#define int long long int
#define mod 1000000007
int function(string &str1,string &str2,int initial,int final,int memo[][4][4],int status1,int status2)
{
	if(initial>final)
	    return 1;
	if(memo[initial][status1][status2]!=-1)
	    return memo[initial][status1][status2];
	else
	{
		if(str1[initial]==str2[initial])
		{
			int i;
			int answer=0;
			for(i=1;i<4;i++)
			{
				if(i!=status1&&i!=status2)
				{
					answer+=function(str1,str2,initial+1,final,memo,i,i);
					answer=answer%mod;
				}
			}
			memo[initial][status1][status2]=answer;
			return memo[initial][status1][status2];
		}
		else
		{
			int i,j;
			int answer=0;
			for(i=1;i<4;i++)
			{
				for(j=1;j<4;j++)
				{
					if(i!=j&&i!=status1&&j!=status2)
					{
						answer+=function(str1,str2,initial+2,final,memo,i,j);
						answer=answer%mod;
					}
				}
			}
			memo[initial][status1][status2]=answer;
			return memo[initial][status1][status2];
		}
	}
}
int32_t main()
{
     int n;
     cin>>n;
     int j,arr[n+1];
     for(j=1;j<=n;j++)
        cin>>arr[j];
     int answer=0;
     for(j=1;j<n;j++)
     {
		 if(arr[j]==j)
		 {
			 answer++;
			 int temp=arr[j];
			 arr[j]=arr[j+1];
			 arr[j+1]=temp;
		 }
	 }
	 if(arr[n]==n)
	    answer++;
	 cout<<answer<<endl;
}



Measured memory_bytes: 1024
#include <stdio.h>

int gcd(int a, int b)
{
     if(a == 1 || b == 1) return 1;
     
     else{	  
	  int i=2, t=1;
	  
	  while(0<1){
	       if(b%i == 0 && a%i == 0){
		    b = b / i;
		    a = a / i;
		    t = t * i;
	       }
	       else i++;

	       if(i>b) break;
	  }
	  return t;
     }
     
}

int lcm(int a, int b, int t)
{
     int u;

     a = a / t;
     b = b / t;
     u = a * b * t;
     
     return u;
}

int main(void)
{
     int a, b, t;
     
     while(0<1){
	  if(scanf("%d", &a) == -1) break;
	  scanf("%d", &b);

	  if(a<b){
	       t = a;
	       a = b;
	       b = t;
	  }

	  t = gcd(a, b);
	  
	  printf("%d %d\n", t, lcm(a, b, t));
     }

     return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (!(i & 1) && (a[i] & 1)) ans++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3612
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,W;
    cin >> N >> W;
    ll w[110], v[110];
    rep(i,0,N) cin >> w[i] >> v[i];
    ll dp[100010] = {};
    rep(i,0,100001) dp[i] = INF;
    dp[0] = 0;
    rep(i,0,N){
        rrep(j,N*1000,0){
            if(j - v[i] >= 0){
                dp[j] = min(dp[j], dp[j-v[i]] + w[i]);
            }
        }
    }
    rrep(i,N*1000,0){
        if(dp[i] <= W){
            print(i);
            return 0;
        }
    }


    

}

Measured memory_bytes: 1024
//ITP1_5_C:   Print a Chessboard
#include <stdio.h>
int main(){
    while (1){
        int h, w;
        int H, W;
        char c = '#';
        scanf("%d%d", &H, &W);
        if (H==0&&W==0) break;
        for (h=0; ++h<=H;){
            for (w=0; ++w<=W; c=(c=='#')?'.':'#')
                putchar(c);
            putchar('\n');
            c = h%2==0?'#':'.';
        }
        putchar('\n');
    }
}


Measured memory_bytes: 1960
n, m, k = list(map(int, input().split()))

MAX = 2*10**5+1
MOD = 10**9+7
fact = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]
invfact = [0 for i in range(MAX)]

def comb_build(n):
  fact[0] = inv[0] = invfact[0] = 1
  fact[1] = inv[1] = invfact[1] = 1
  for i in range(2, n):
    fact[i] = fact[i-1]*i%MOD
    inv[i] = inv[MOD%i]*(MOD-MOD//i)%MOD
    invfact[i] = invfact[i-1]*inv[i]%MOD

def nCk(n, k):
  if n<k or n<0 or k<0:
    return 0
  return (((fact[n]*invfact[k])%MOD)*invfact[n-k])%MOD

comb_build(MAX)
ans = 0
t = nCk(n*m-2, k-2)
for i in range(1, n+1):
  ans += (((i*(n-i)*m*m)%MOD)*t)%MOD
for i in range(1, m+1):
  ans += (((i*(m-i)*n*n)%MOD)*t)%MOD
print(ans%MOD)

Measured memory_bytes: 26904
#include <iostream>
#include <string>
#include <cstdlib>
#include <climits>
#include <vector>
#include <utility>
using namespace std;

int visited[55];
int hen[2600][2];
vector<int> ren[55];

#define REP(var,start,end) for(int var=start; var<end; var++)

void visit(int num, int invalid) {
	if ( visited[num] == 1 ) { return; }
	visited[num] = 1;
	
	for( int go : ren[num] ) {
		int start = num;
		int end   = go;
		if ( end < start ) { swap(start,end); }
		if ( hen[invalid][0] == start && hen[invalid][1] == end ) { continue; }
		
		visit(go, invalid);
	}
	
}

int main(void) {
	int N, M;
	
	cin >> N >> M;
	REP(o, 0, M) {
		int a,b;
		cin >> a >> b;
		hen[o][0]=a;
		hen[o][1]=b;
		
		ren[a].push_back(b);
		ren[b].push_back(a);
	}
	
	int bridge = 0;
	REP(b, 0, M) {
		REP(i,1,N+1) { visited[i] = 0; }
		visit(1, b);
		
		bool ok = true;
		REP(i,1,N+1) {
			if ( visited[i] == 0 ) {
				ok = false;
				break;
			}
		}
		
		if ( !ok ) { bridge++; }
	}
	
	cout << bridge << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(ll i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

void solve(void){

	int N;
	cin >> N;
	vecll xs(N);
	rep(N, i)
	{
		cin >> xs[i];
	}
	sort(all(xs));
	cout << abs(xs[N-1] - xs[0]) << endl;

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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

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

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

    bool pass1 = true;
    for (int i = 0; i < S.size(); i++) {
        if ((i + 1) & 0x1) {
            // cout << S[i];
            if (S[i] == 'L') {
                pass1 = false;
                break;
            }
        }
    }

    bool pass2 = true;
    for (int i = 0; i < S.size(); i++) {
        if (!((i + 1) & 0x1)) {
            if (S[i] == 'R') {
                // cout << S[i];
                pass2 = false;
                break;
            }
        }
    }

    if (pass1 && pass2) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
    return 0;
}


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

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

Measured memory_bytes: 3584