akhauriyash/Code-Regression huggingface dataset:
using System;

namespace ConsoleApp37
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, x,t;
            string[] str = Console.ReadLine().Split(' ');
            n = int.Parse(str[0]);  
            x = int.Parse(str[1]);
            t = int.Parse(str[2]);

            if (n % x == 0)
            {
                Console.WriteLine((n / x)*t);
            }
            else
            {
                Console.WriteLine(((n / x) + 1)*t);
            }
        }
    }
}


Measured memory_bytes: 27372
#include <iostream>
#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
#include <math.h>
#include <vector>
//#include <string>
//typedef long long LL;
using namespace std;

int main(){
    int n;
    vector<double> x;
    vector<double> y;
    double tmp_x;
    double tmp_y;
    double ans=0;

    cin >> n;
    vector<vector<double>> distance(n, vector<double>(n));
    for(int i=0; i<n; i++){
        cin >> tmp_x >> tmp_y;
        x.push_back(tmp_x);
        y.push_back(tmp_y);
    }

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(i!=j){
                ans += sqrtl(powl(x[i]-x[j], 2.0)+pow(y[i]-y[j], 2.0));
            }
        }
    }
    ans = ans / double(n);
    cout << setprecision(16) << ans << endl;
}

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

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void){
    int N,M,*X,i,sum=0,*dis;
    scanf("%d %d",&N,&M);
    X = (int*)malloc(sizeof(int)*M);
    dis = (int*)malloc(sizeof(int)*(M-1));
    for(i=0;i<M;i++){
        scanf("%d",&X[i]);
    }
    qsort(X,M,sizeof(int),compare_int);
    for(i=1;i<M;i++){
        dis[i-1] = X[i] - X[i-1];
    }
    qsort(dis,M-1,sizeof(int),compare_int);
    for(i=0;i<M-N;i++){
        sum+=dis[i];
    }
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 1396
#include <stdio.h>
int main(void){
    int i, j;
    int h, w;
    while((scanf("%d %d", &h, &w))&&((h != 0)||(w != 0))){
        for(i = 0; i < h; i++){
            for(j = 0; j < w; j++)
                putchar('#');
            putchar('\n');
        }
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 572
package main

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

var sc *bufio.Scanner

const bufferSize = 1024

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

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

func reachable(g [][]int, start int) ([]bool, []int) {
	n := len(g)
	ok := make([]bool, n)
	nums := []int{}
	var dfs func(int)
	dfs = func(v int) {
		ok[v] = true
		nums = append(nums, v)
		for _, u := range g[v] {
			if !ok[u] {
				dfs(u)
			}
		}
	}
	dfs(start)
	return ok, nums
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, bufferSize)
	sc.Buffer(buf, 1e+7)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	k := nextInt()
	f := make([][]int, n) // follow
	b := make([][]int, n) // block
	ans := make([]int, n)
	for i := range ans {
		ans[i] = -1
		f[i] = []int{}
		b[i] = []int{}
	}
	for i := 0; i < m; i++ {
		er := nextInt() - 1
		ee := nextInt() - 1
		f[er] = append(f[er], ee)
		f[ee] = append(f[ee], er)
	}

	for i := 0; i < k; i++ {
		er := nextInt() - 1
		ee := nextInt() - 1
		b[er] = append(b[er], ee)
		b[ee] = append(b[ee], er)
	}

	for i := 0; i < n; i++ {
		if ans[i] >= 0 {
			continue
		}
		//nums := make([]int, 0, n)
		//ok, nums := reachable(f, i)

		//ok := make([]bool, n)
		ok := map[int]bool{}
		nums := []int{}
		//nums := make([]int, 0, n)
		var dfs func(int)
		dfs = func(v int) {
			ok[v] = true
			nums = append(nums, v)
			for _, u := range f[v] {
				if !ok[u] {
					dfs(u)
				}
			}
		}
		dfs(i)

		//debugf("i:%d\nok:%v\nnums:%d\n", i, ok, nums)
		for j := range nums {
			ans[nums[j]] = len(nums) - 1
			//debugf("b[%d]:%v\n", nums[j], b[nums[j]])
			for k := range b[nums[j]] {
				if ok[b[nums[j]][k]] {
					ans[nums[j]]--
				}
			}
			ans[nums[j]] -= len(f[nums[j]])
		}
	}

	for i := range ans {
		_, _ = fmt.Fprintf(writer, "%d", ans[i])
		if i != len(ans)-1 {
			_, _ = fmt.Fprint(writer, " ")
		}
	}
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 29440
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;

const ll MOD = 1e9 + 7;


int main(int argc, char* argv[]) {
	
	int n;
	cin >> n;

	map<int, int> m;
	for (int i = 0; i < n - 1; i++) {
		int a;
		cin >> a;
		m[a]++;
	}

	for (int i = 1; i <= n; i++) {
		cout << m[i] << endl;
	}


}

Measured memory_bytes: 12972
use std::process;
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        n: u64, 
        v: [f64; n],
    }   
    
    let mut ans: f64 = 0.0;
    for i in v {
        ans += 1 as f64 /i;
    }

    println!("{}", 1 as f64 /ans  );
}


Measured memory_bytes: 4352
# include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
 cin>>a>>b;
  if(a>0){
  cout<<"Positive"<<endl; 
  }
   
  else if ( b<0){
  int k=0,i;
  k=-1*(a+b);
  if (k%2==0){cout<<"Negative"<<endl;}
    else{cout<<"Positive"<<endl;}
  }
  else {cout<<"Zero"<<endl;}
 
  
  
return 0;}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    s = LI()
    s = list(set(s))
    print(len(s))
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 39408
N,Y = map(int,input().split())
for i in range(N+1):
    for j in range(N+1):
        x = i
        y = j
        z = N-(x+y)

        if z < 0:
            break
        if (10000*x + 5000*y + 1000*z) == Y:
            print (x,y,z)
            exit ()
print (-1,-1,-1)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
    for (T &x : vec)
        is >> x;
    return is;
}

ll gcd(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    while (m != n)
    {
        if (m > n)
            m = m - n;
        else
            n = n - m;
    }
    return m;
}

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

int main(){
    ll x;
    cin >> x;

    ll cnt=0;

    if(x%11!=0){
        ll res = x/11 + 1;
        cnt += res * 2;
        if(res * 11 - 5 >= x){
            cnt--;
        }
    }else{
        cnt = x/11*2;
    }

    cout << cnt << endl;

    return 0;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long q = sc.nextLong();
		long h = sc.nextLong();
		long s = sc.nextLong();
		long d = sc.nextLong();
		long[] price = { q * 4, h * 2, s, d / 2 };
		Arrays.sort(price);
		long n = sc.nextLong();
		long ans = 0;
		for (int i = 0; i < 4&&n!=0; i++) {
			if(price[i]==q*4) {
				ans += q*n*4;
				n -= n;
			}
			else if(price[i]==h*2) {
				ans += h*n*2;
				n -= n;
			}
			else if(price[i]==s) {
				ans += s*n;
				n -= n;
			}
			else if(price[i]==d/2) {
				ans += d*(n/2);
				n-=n/2*2;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
          int a = Input.ScanInt();
          Console.WriteLine(a==3||a==5||a==7 ? "YES":"NO");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


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

using namespace std;

int main () {

  int N, T;
  cin >> N >> T;
  priority_queue<int> pq; 

  while (N--) {
    int a, b;
    cin >> a >> b;
    if (b <= T) {
      pq.push(-a);
    }
  }


  if (pq.size() == 0) {
    cout << "TLE" << endl;
  } else {
    int top = -pq.top();
    cout << top << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define i64 long long
#define maxn (int)(1e5)
#define pii pair<int,int>
#define L first 
#define R second
#define all(x) x.begin(),x.end()
using namespace std;
bool sameDigit(string n){
	return (n[0]==n[1] and n[1] ==n[2]);
}
int main(){
	int n,T;
	cin>>n>>T;
	int c[n+2], t[n+2];
	int min_c = INT_MAX;
	for(int i=0;i<n;i++){
		cin>>c[i]>>t[i];
		if(t[i]<=T) min_c = min(min_c,c[i]);
	}
	if(min_c==INT_MAX) printf("TLE\n");
	else printf("%d\n",min_c);
	return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )
import Data.List ( sortBy )
import qualified Data.Vector.Unboxed as U


getParm :: IO [Int]
getParm = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  n <- readLn :: IO Int
  ass <- getParm
  print $ f n ass

sort' :: [Int] -> [Int]
sort' = sortBy (flip compare)

f :: Int -> [Int] -> Int
f n ass = h (sort' ass) n 0

h :: [Int] -> Int -> Int -> Int
h _        0 acc = acc
h (_:b:bs) n acc = h bs (n-1) (b+acc)

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

map<string,vector<string> > go;

vector<int> seq;
string table = "ATGC";
int dp[51][51][51][51];
int A,T,G,C;
int dfs(int x,int y,int z,int w){
	if( x > A || y > T || z > G || w > C ) return 0;
	if( dp[x][y][z][w] != -1 ) return dp[x][y][z][w];
	int l = x + y + z + w;
	if( l == seq.size() ) return A == x && y == T && z == G && w == C;
	int ans = 0;
	if(seq[l]&1) ans += dfs(x+1,y,z,w);
	ans %= 1000000007;
	if(seq[l]&2) ans += dfs(x,y+1,z,w);
	ans %= 1000000007;
	if(seq[l]&4) ans += dfs(x,y,z+1,w);
	ans %= 1000000007;
	if(seq[l]&8) ans += dfs(x,y,z,w+1);
	ans %= 1000000007;
	return dp[x][y][z][w] = ans;
}

int dfs(string pos){
	if( seq.size() > 200 ){
		cout << 0 << endl;
		exit(0);
		return 0;
	}
	for( auto s : go[pos] ){
		if( s[0] == '[' ){
			int r = 0;
			for(int i = 1 ; i < s.size()-1 ; i++){
				r |= 1<<table.find(s[i]);
			}
			seq.push_back(r);
		}else{
			dfs(s);
		}
	}
}
int main(){
	memset(dp,-1,sizeof(dp));
	cin >> A >> T >> G >> C;
	int m;
	cin >> m;
	string str;
	getline(cin,str);
	string fst;
	for(int i = 0 ; i < m ; i++){
		getline(cin,str);
		stringstream ss(str);
		string a,b;
		ss >> a;
		a = a.substr(0,a.size()-1);
		if( fst == "" ) fst = a;
		while( ss >> b ) go[a].push_back(b);
	}
	dfs(fst);
	cout << dfs(0,0,0,0) << endl;
}

Measured memory_bytes: 27732
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    stack<int> hoge;
    
    while(true){
        string s;
        cin>>s;
        if(s=="") break;
        
        if(s!="+" && s!="-" && s!="*"){
            int n=stoi(s);
            hoge.push(n);
        }else{
            if(s=="+"){
                int fuga=hoge.top();
                hoge.pop();
                fuga+=hoge.top();
                hoge.pop();
                hoge.push(fuga);
            }else if(s=="-"){
                int fuga=hoge.top();
                hoge.pop();
                fuga=hoge.top()-fuga;
                hoge.pop();
                hoge.push(fuga);
            }else if(s=="*"){
                int fuga=hoge.top();
                hoge.pop();
                fuga*=hoge.top();
                hoge.pop();
                hoge.push(fuga);
            }
        }
    }
    
    cout<<hoge.top()<<endl;
    
    return 0;
}


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

#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define out(x) cout << x << endl;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
template <typename T>
vector<T> vec1d_init(int len){
    vector<T> vec(vector<T>(len, 0));
    return vec;
}
vector<string> vec1d_init(int len){
    vector<string> vec(vector<string>(len, ""));
    return vec;
}
template <typename T>
T vec1d_sum(vector<T> vec){
    T ret = 0;
    for(int i = 0; i < vec.size(); i++) ret += vec[i];
    return ret;
}
template <typename T>
vector<T> vec1d_sort(vector<T> vec, bool min_to_max=true){
    sort(vec.begin(), vec.end(), [min_to_max](const T a, const T b){return (min_to_max == true) ? (a < b) : (b < a);});
    return vec;
}
template <typename T>
void vec1d_show(vector<T> vec){
    for(int i = 0; i < vec.size(); i++){
        cout << vec[i] << " ";
    }
    cout << endl;
}
int main(){
    int N, M;
    cin >> N >> M;

    auto vecinput = vec1d_init<int>(M);
    rep(i, M){
        cin >> vecinput[i];
    }
    if(N >= M){
        cout << 0 << endl;
        return 0;
    }
    vecinput = vec1d_sort(vecinput);
    auto vecdist = vec1d_init<int>(M-1);
    rep(i, M-1){
        vecdist[i] = vecinput[i+1] - vecinput[i];
    }
    vecdist = vec1d_sort(vecdist, false);
    int ans = vec1d_sum(vecdist);
    FOR(i, 0, N-1){
        ans -= vecdist[i];
    }
    out(ans);
    return 0;
}

Measured memory_bytes: 1400
a,b,c= map(int,input().split()) 
if a<c<b :
    a,b,c = a,c,b
elif b<a<c:
    a,b,c = b,a,c
elif b<c<a:
    a,b,c = b,c,a
elif c<b<a:
    a,b,c = c,b,a
elif c<a<b:
    a,b,c = c,a,b
elif a==b:
    if c<a:
        a,b,c = c,a,b
elif b==c:
    if b<a:
        a,b,c = b,c,a
elif c==a:
    if a<b:
        a,b,c = a,c,b
    elif b<a:
        a,b,c = b,a,c
print(a,b,c)


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


int main() {
    int n, r, maxp = numeric_limits<int>::min(), minr;

    cin >> n;
    cin >> r;
    minr = r;
    while (--n) {
        cin >> r;
        if (r - minr > maxp) {
            maxp = r - minr;
        }
        if (r < minr) {
            minr = r;
        }
    }
    cout << maxp << endl;

    return 0;
}

Measured memory_bytes: 1164
from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    N, K, S = map(int, input().split())
    # al + ... ar = SがちょうどK個
    # S S S S S 1 1 1 1 1 1みたいな感じでいい?
    if S == 10 ** 9:
        ans = [S] * K + [1] * (N - K)
    else:
        ans = [S] * K + [S + 1] * (N - K)
    print(*ans)

if __name__ == '__main__':
    main()


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

#define Bye return 0
#define ll long long
const ll M = 1e9+7;
const ll SIZE = 2e5+1;
vector<ll> ps(SIZE, 0); 
int e, n, i;
ll res = 0;

int scan(){
    scanf("%d", &e);
    return e;
}

void solve(){
    cin>>n;
    for (i=1; i<=n; i++){
        ps[i] = (ps[i-1] + scan()*1ll)%M;
        res = (res + (e*ps[i-1])%M)%M;
    }
    cout<<res<<endl;
}

int main(){
    solve();
    Bye;
}

Measured memory_bytes: 4636
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<int,int>;
const int INF=1001001;
const int NMAX=8;


int main()
{
	int n,k;
	cin>>n>>k;
vector<int> v(n);
int ans=0;
rep(i,n)cin>>v[i];
rep(i,min(k,n)+1)rep(j,min(k-i,n-i)+1){
  int cnt=0;
  vector<int> V;
  if (i>0){
    rep(i1,i)V.emplace_back(v[i1]);
  }
  if (j>0){
    rep(j1,j)V.emplace_back(v[n-j1-1]);
  }
  sort(V.begin(),V.end());
  reverse(V.begin(),V.end());
  int w=0;
  while (w<k-i-j and V.size()>0){
    if (V.back()>=0) break;

    V.pop_back();
    w++;
  }
for(auto t:V)cnt+=t;
ans=max(ans,cnt);

}
cout<<ans;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define endl '\n'
#define loop(i, m, n) for (lli i = m; i < n; i++)
#define loope(i, m, n) for (lli i = m; i <= n; i++)
#define epool(i, m, n) for (lli i = m; i >= n; i--)
#define pool(i,m,n) for(lli i=m; i>n; i++)
#define maxe *max_element
#define mine *min_element
#define plli pair<lli, lli>
#define mod 1000000007
#define mod2 998244353
#define vt vector<lli>
#define fi first
#define se second
#define pb push_back
#define umap unordered_map
#define mmap multimap
#define mp make_pair
#define inp1(a) cin >> a
#define inp2(a, b) cin >> a >> b
#define inp3(a, b, c) cin >> a >> b >> c
#define inp4(a, b, c, d) cin >> a >> b >> c >> d
#define inp5(a, b, c, d, e) cin >> a >> b >> c >> d >> e
#define inp6(a, b, c, d, e, f) cin >> a >> b >> c >> d >> e >> f
#define pr0() cout << " "
#define pr1(a) cout << a << " "
#define pr2(a, b) cout << a << " " << b << " "
#define pr3(a, b, c) cout << a << " " << b << " " << c << " "
#define pr4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << " "
#define emp emplace //used to push a pair etc..
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x, 0;
#define all(v) v.begin(),v.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
//especially for deque both sides dynamic
#define pf push_front
//list doubly linked lists can insert at mid. splice fn can be used
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;
 
lli gcd(lli a, lli b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
 
lli lcm(lli a, lli b){
    return (a * b) / gcd(a, b);
}
 
lli modi(lli n,lli m=mod){ 
    if(n==0) return 0;
    n%=m;
    n+=m;
    n%=m;
    return n;
}
 
lli mpow(lli base, lli exp){
    base %= mod;
    lli result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((lli)result * base) % mod;
        base = ((lli)base * base) % mod;
        exp >>= 1;
    }
    return result;
}
const lli INF=1e18;
const lli N=2e5+5;
lli a[N]={0},b[N]={0};

int32_t main(){
    fast_io
    lli i = 0,j=0;
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    
    lli n;
    cin >> n;

    lli ans=0;
    ans+=((n)/500)*1000;
    n=n%500;
    ans+=(n/5)*5;
    cout << ans << endl;
    

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <vector>
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define in insert
#define er erase
#define fi first
#define se second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int) x.size()
using namespace std;
typedef vector <int> vi;
typedef vector <vector<int>> vii;
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
typedef long double ld;

const long double PI=3.141592653589793238462643383279502884;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main(){
    fast;
    ll i;
    string s0;
    cin>>s0;
    ll s=0,k=0,s1=0,m1=-1,m2=0;
    i=0;
    char c=s0[0];
    k=1;
    int sost=1;
    if (s0[0]=='<'){
        sost=0;
    }
    while (i<s0.length()){
        i++;
        while (s0[i]==c&&i<s0.length()){
            k++;
            i++;
        }
        s+=k*(k-1)/2;
        m2=k;
        if (sost==1){
            s1+=max(m1,m2);
        }
        m1=m2;
        k=1;
        c=s0[i];
        sost=1-sost;
      
    }
    if (sost==1){
        s1+=m1;
    }
    cout<<s+s1;
    return 0;
}





Measured memory_bytes: 1172
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N;
	in >> N;
	std::vector<LL>A(N);
	rep(i, N) in >> A[i];

	std::map<LL, LL>cnt;
	rep(i, N) ++cnt[A[i]];

	LL ans = 0;
	for (LL b = 31; b >= 0; --b)
	{
		LL num = (1LL << b);
		for (auto& p : cnt)
		{
			if (p.first > 0)
			{
				if (cnt.count(num - p.first) > 0)
				{
					if (num == p.first * 2)
					{
						ans += p.second / 2;
						p.second = 0;
					}
					else
					{
						LL res = std::min(p.second, cnt[num - p.first]);
						ans += res;
						p.second -= res; cnt[num - p.first] -= res;
					}
				}
			}
		}
	}

	out << ans << std::endl;
	return 0;
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
int INF = 1000;
int main(){
  int w, h, n;
  cin >> w >> h >> n;
  
  int x, y, a, max_x=0, min_x=INF, max_y=0, min_y=INF;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> a;
    if (a == 1) max_x = max(max_x, x);
    if (a == 2) min_x = min(min_x, x);
    if (a == 3) max_y = max(max_y, y);
    if (a == 4) min_y = min(min_y, y);
  }
  max_x = max(max_x, 0);
  min_x = min(min_x, w);
  max_y = max(max_y, 0);
  min_y = min(min_y, h);
  
  cout << max(0, min_x - max_x) * max(0, min_y - max_y) << endl;
}

Measured memory_bytes: 256
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void solve(){
	int a,b,c;cin>>a>>b>>c;
	if(c>=a){
		cout<<0<<" ";
		c=c-a;
		b=b-c;
		if(b>0){
			cout<<b;
		}
		else
			cout<<0;
	}
	else{
		a=a-c;
		cout<<a<<" "<<b;
	}
}

int32_t main()
{

	fast;int t=1;
	//cin>>t;
	while(t--){
		solve();
	}

}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N, x; cin >> N >> x;
    if(N == 2){
        if(x == 2){
            cout << "Yes" << endl;
            FOR(i, 1, 4) cout << i << endl;
        }
        else cout << "No" << endl;
        return 0;
    }
    else{
        if(N == 3){
            if(x == 2) cout << "Yes\n5\n4\n1\n2\n3\n";
            else if(x == 3) cout << "Yes\n5\n4\n3\n2\n1\n";
            else if(x == 4) cout << "Yes\n3\n1\n4\n5\n2\n";
            else cout << "No" << endl;
        }
        else if(x == 1 || x == 2*N-1){
            cout << "No" << endl;
        }
        else{
            cout << "Yes" << endl;
            vb used(2*N, false); used[0]=true;
            vl ans;
            ans.pb(1); ans.pb(x); ans.pb(2*N-1);
            used[1]=true;used[2*N-1]=true;used[x]=true;
            
            FOR(v, 1, 2*N){
                if(used[v]) continue;
                ans.pb(v); used[v] = true;
            }
            ll offset = N-2;
            REP(i, 2*N-1){
                cout << ans[(offset+i+3)%(2*N-1)] << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
	long long int N; cin >> N;
	long long int m = pow(10,12) + 1;
	for (int i = 1; i <= sqrt(N); i++) {
		if(N % i == 0 && i + N / i - 2 < m){
			m
				= i + N / i - 2;
		}
	}

	cout << m << endl;
}

Measured memory_bytes: 256
// ABC161 B

#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main(){

    int n, m;
    cin >> n >> m;
    vector<int> a (n, 0);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
    }
    int count = 0;
    int sum = accumulate(a.begin(), a.end(), 0);
    for(vector<int>::iterator itr =  a.begin(); itr != a.end(); itr++){
        if(*itr >= double(sum)/(4*m) ) count++;
    }
    if(m <= count) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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


int main(){
    int H,W;
    cin>>H>>W;
    char S[W][H];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++)cin>>S[j][i];
    }
    char ans[W][H];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            ans[j][i]='0';
            if(i-1>=0&&j-1>=0)if(S[j-1][i-1]=='#')ans[j][i]++;
            if(i-1>=0)if(S[j][i-1]=='#')ans[j][i]++;
            if(i-1>=0&&j+1<W)if(S[j+1][i-1]=='#')ans[j][i]++;
            if(j-1>=0)if(S[j-1][i]=='#')ans[j][i]++;
            if(j+1<W)if(S[j+1][i]=='#')ans[j][i]++;
            if(i+1<H&&j-1>=0)if(S[j-1][i+1]=='#')ans[j][i]++;
            if(i+1<H)if(S[j][i+1]=='#')ans[j][i]++;
            if(i+1<H&&j+1<W)if(S[j+1][i+1]=='#')ans[j][i]++;
            if(S[j][i]=='#')ans[j][i]='#';
        }
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++)cout<<ans[j][i];
        cout<<endl;
    }
}

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

#define IS_DEBUG true

#define DEBUG_OUTPUT(X) if (IS_DEBUG) cout << X << endl
#define RESULT_OUTPUT(X) cout << X << endl

int main()
{
	int a, b;
	cin >> a >> b;
	if ((a*b) % 2 == 0)
		RESULT_OUTPUT("Even");
	else
		RESULT_OUTPUT("Odd");


	if (IS_DEBUG)
	{
		int end;
		cin >> end;
	}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())

#define pb emplace_back
#define fi first
#define se second
using ll = long long;
using P = pair<ll ,ll>;
using Tu = tuple<ll, ll, ll>;
const ll INFLL = 1LL<<60LL;
const ll INF = 1LL<<60LL;
const ll MOD = 1e9+7;



using ld = long double;

template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> void UNIQUE(vector<T> &a){ a.erase(unique(a.begin(), a.end()), a.end()); }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll in(){long long int x; assert(scanf("%lld", &x) == 1); return x;}
ld fin(){double x; assert(scanf("%lf", &x) == 1); return x;}
char yuyushiki[1000010]; string stin(){assert(scanf("%s", yuyushiki) == 1); return yuyushiki;}

int main(){
  ll a,b,c,d,e,f,g;
  cin >> a >> b >> c >> d >> e >> f >> g;
  ll ans = a / 2 * 4 + b * 2 + d / 2 * 4 + e / 2 * 4;
  ll amari = a % 2 + d % 2 + e % 2;
  ll to = 3 - amari;
  //cout << amari << " " << to << endl;
  if((amari - to) > 0 && a > 0 && d > 0 && e > 0)
    ans += (amari - to) * 2;
  cout << ans / 2 << endl;
}


Measured memory_bytes: 256
#import numpy as np
#T= str(input())
#K = int(input())
#N,M= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
S= str(input())

c=10**9

for i in range(len(S)-2):
    C=abs(int(S[i:i+3])-753)
    if C<c:
        c=C

print(c)


Measured memory_bytes: 2940
if __name__ == '__main__':
    N=int(input())
    sheet=[]
    for i in range(N):
        temp=int(input())
        sheet.append(temp)
    sheet.sort()
    count=0
    i=0
    while i<N:
        s=sheet[i]
        j=i
        while i<N and sheet[i]==s:
            i+=1
        d=i-j
        if d%2==1:
            count+=1

    print(count)

Measured memory_bytes: 7388
#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
	int b[6][2]={{1,2},{-1,3},{1,-1},{4,5},{5,2},{2,1}};
int main(){
	int i,j,a[1000],f=0;
	char s[10000];
	while(1){
		scanf("%s\0",s);
		f=0;
		if(s[0]=='#')break;
		int ans=0;
		for(i=0;i<strlen(s);i++){
			if(s[i]=='0'){
				ans=b[ans][0];
				if(ans==-1){
					//cout<<"tpo"<<endl;
					f=1;
					break;
				}
			}
			else{
				ans=b[ans][1];
				if(ans==-1){
					//cout<<"tpo1"<<endl;
					f=1;
					break;
				}
			}
		}
		if(f==0&&ans==5){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
template<typename T>
void print(T x) {
    cout << x << endl;
}
int main(void) {
    int n; cin >> n;
    vector<int> v(n);
    vector<int> c(n);
    rep(i,n) cin >> v[i];
    rep(i,n) cin >> c[i];
    int ma = 0;
    rep(i,n) {
        int tmp = max(0, v[i]-c[i]);
        ma += tmp;
    }
    cout << ma;
}


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

using ll = long long;

constexpr ll base = 211;
constexpr ll M = 1000000000000037LL;

ll dfs(int v, vector<vector<int>>& g, vector<bool>& visited, vector<ll>& hs) {
    visited[v] = true;
    ll res = 1;
    for(auto to : g[v]) {
        if(!visited[to]) {
            (res += dfs(to, g, visited, hs) * base) %= M;
        }
    }
    return hs[v] = res;
}

int main() {
    int N;
    cin >> N;
    vector<vector<int>> g(N);
    for(int i=0; i<N-1; ++i) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<bool> visited(N);
    vector<ll> hs(N);
    dfs(0, g, visited, hs);
    ll res = 0;
    sort(hs.begin(), hs.end());
    for(int i=0; i<N; ++i) {
        auto p = equal_range(hs.begin(), hs.end(), hs[i]);
        res += p.second - p.first - 1;
    }
    res /= 2;
    cout << res << endl;
} 


Measured memory_bytes: 16800
#include<cstdio>
#include<cmath>
int main(){
	long long int n;
	scanf("%lld",&n);
	long long int b;
	for(long long int i=1;i*i<=n;i++){
		if(n%i==0){
			b = n/i;
		}
	}
	int keta_b = log10((double)b);

	printf("%d\n",keta_b+1);
	return 0;
}


Measured memory_bytes: 128
N, Y = [int(item) for item in input().split(" ")]
found = False
for i in range(N+1):
    for j in range(N+1-i):
        if found:
            break
        if 10000*i+5000*j+1000*(N-i-j)==Y:
            print("{} {} {}".format(i,j,N-i-j))
            found = True
    if found:
        break
else:
    print("-1 -1 -1")

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<tuple>
#include<string>
typedef unsigned long long ll;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define F first
#define S second
using namespace std;
const ll INF = 1e12;

int main() {
  int a,p;
  cin>>a>>p;
  cout<<int((a*3+p)/2)<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
   int  a,b,c;
   scanf("%d %d", &a, &b);
   c = a - b;
   printf("%d\n",c);
   scanf("%d %d", &a, &b);
   c = a - b;
   printf("%d\n",c);
   scanf("%d %d", &a, &b);
   c = a - b;
   printf("%d\n",c);
   scanf("%d %d", &a, &b);
   c = a - b;
   printf("%d\n",c);
   scanf("%d %d", &a, &b);
   c = a - b;
   printf("%d\n",c);
   scanf("%d %d", &a, &b);
   c = a - b;
   printf("%d\n",c);
   scanf("%d %d", &a, &b);
   c = a - b;
   printf("%d\n",c);
    
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 998244353;
LL f[300005], rf[300005];
LL inv(LL a, LL b){
	LL res = 1;
	while(b){
		if(b%2) res = (res*a)%mod;
		a = (a*a)%mod;
		b/=2;
	}
	return res;
}
LL ncr(LL a, LL b){
	return f[a]*rf[b]%mod*rf[a-b]%mod;
}
int main(){
	LL n, a, b, k;
	scanf("%lld%lld%lld%lld", &n, &a, &b, &k);
	f[0] = 1;
	for(int i=1;i<=n;i++) f[i] = (f[i-1]*i)%mod;
	for(int i=0;i<=n;i++) rf[i] = inv(f[i], mod-2);
	if(k == 0){
		printf("1\n");
		return 0;
	}
	LL ans = 0;
	for(int i=0;i<=n;i++){
		LL ca = i;
		LL cb = (k-ca*a);
		if(cb < 0 || cb%b != 0) continue;
		cb /= b;
		if(max(ca, cb) > n) continue;
		ans = (ans + ncr(n, ca)*ncr(n, cb))%mod;
	}
	printf("%lld\n", ans);
}

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

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  set< int > s;
  for(int i = 0; i < 4; i++){
    int v;
    cin >> v;
    s.insert(v);
  }

  if(s.find(1) != s.end() &&
      s.find(9) != s.end() && 
      s.find(7) != s.end() && 
      s.find(4) != s.end()){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }

  return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  int n;
  cin >> n;
  vector<int> v(n+1);
  rep(i,n)cin >> v[i+1];
  ll res = 0;
  for(int i = 1;i <= n;i++){
    if((i & 1) && (v[i] & 1))res++;
  }
  cout <<res << endl;
  

  return 0;
}


Measured memory_bytes: 3592
#pragma GCC optimize("Ofast")
#include<stdio.h>
int main(void)
{
    long n = 0;
    char c=getchar_unlocked();
    while(c<='9'&&c>='0') {n=(n<<1)+(n<<3)+c-'0'; c=getchar_unlocked();}
    long ans = n * (n + 1) / 2 * (n + 2) / 3;
    int u, v, i = n;
    ++n;
    while(--i)
    {
        u = v = 0;
        c=getchar_unlocked();
        while(c<='9'&&c>='0') {u=(u<<1)+(u<<3)+c-'0'; c=getchar_unlocked();}
        c=getchar_unlocked();
        while(c<='9'&&c>='0') {v=(v<<1)+(v<<3)+c-'0'; c=getchar_unlocked();}
        switch(u > v)
        {
            case 1: ans -= v * (n - u); break;
            default: ans -= u * (n - v);
        }
    }
    printf("%ld", ans);
    return 0;
}


Measured memory_bytes: 1596
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  tmp = input[1].split(" ");
  var max =0;
  h=new Array(N);
  for(var i=0;i<N;i++){
    h[i]=parseInt(tmp[i]);
    max=Math.max(max,h[i]);
  }
  var ans =0;
  var flag=0;
  for(var i=1;i<=max;i++){
    for(var j=0;j<N;j++){
      if(h[j]>=i&&flag==0){
        ans++;
        flag=1;
      }else if(h[j]<i){
        flag=0;
      }
    }
    flag=0;
  }

  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 21064
def main():
    h,w=[int(i) for i in input().split()]
    c=[]
    for i in range(10):
        c.append([int(i) for i in input().split()])
    for i in range(10):
        for j in range(10):
            for k in range(10):
                c[j][k]=min(c[j][k],c[j][i]+c[i][k])
    ans=0
    for i in range(h):
        for j in [int(k) for k in input().split()]:
            if j!=1 and j!=-1:
                ans+=int(c[j][1])
    print(ans)

if __name__=='__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
int n, k;
signed main() {
	cin >> n >> k;
	rep(i, (1 << n)) {
		bitset<18>b(i);
		if (b.count() == k) {
			if (i == 0)puts("0:");
			else {
				vector<int>v;
				cout << i << ":";
				rep(j, n)if ((i >> j) & 1)v.push_back(j);
				for (auto x : v)cout << " " << x;
				cout << endl;
			}
		}
	}
	return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 2e5+23;

int p[N];

void solve() {
  string s, q; cin >> q;
  for (bool change = true; change && q.size();) {
    change = false;
    s = q;
    debug(s);
    int ts = 0, ss = 0;
    for (int i = 0; i < s.size(); ++i) {
      if (s[i] == 'S') {
	if (ts) {
	  int a = min(ts, ss);
	  p[i-ts-a] = i-ts+a;
	  change = true;
	  ts = 0;
	  ss = 0;
	}
	++ss;
      } else {
	if (!ss) continue;
	++ts;
      }
    }
    if (ts) {
      int a = min(ts, ss);
      p[s.size()-ts-a] = s.size()-ts+a;
      change = true;
    }
    if (!change) break;
    q = "";
    for (int i = 0; i < s.size(); ++i) {
      while (p[i]) {
	int &prev = p[i];
	i = p[i];
	prev = 0;
      }
      if (i >= s.size()) break;
      q += s[i];
    }
  }
  cout << q.size();
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 1556
h,w = map(int,input().split())
grid = [[c=="."for c in input()]for _ in range(h)]
L,R,U,D = eval("[[0]*(w+2) for _ in range(h+2)],"*4)
for y in range(h):
	for x in range(w):
		if grid[y][x]:
			L[y+1][x+1] = L[y+1][x]+1
		if grid[y][w-x-1]:
			R[y+1][w-x] = R[y+1][w-x+1]+1
for x in range(w):
	for y in range(h):
		if grid[y][x]:
			U[y+1][x+1] = U[y][x+1]+1
		if grid[h-y-1][x]:
			D[h-y][x+1] = D[h-y+1][x+1]+1
a = 0
for y in range(1,h+1):
	for x in range(1,w+1):
		a = max(a, L[y][x] + R[y][x] + U[y][x] + D[y][x] -3)
print(a)

Measured memory_bytes: 197384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
const ll inf = 1LL << 50;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
///////////////////////////////////////

int main() {
	//stack ver
	ll n, q;
	cin >> n >> q;
	vector<vector<ll>>graph(n);
	for (ll i = 0; i < n - 1; ++i) {
		ll a, b;
		cin >> a >> b;
		a--, b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	vector<ll>cost(n, 0);
	for (ll i = 0; i < q; ++i) {
		ll p, x;
		cin >> p >> x;
		p--;
		cost[p] += x;
	}
	vector<bool>seen(n, false);
	vector<ll>d(n, 0);
	stack<ll>st;
	st.push(0);
	d[0] = cost[0];
	while (!st.empty()) {
		ll now = st.top();
		seen[now] = true;
		st.pop();
		for (auto v : graph[now]) {
			if (!seen[v]) {
				st.push(v);
				d[v] += d[now] + cost[v];
			}
		}
	}
	for (auto ans : d) {
		cout << ans << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 19440
#include<iostream>

using namespace std;

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

    for(int i=0;i<(1<<n);i++)
    {
        if(__builtin_popcount(i)!=k) continue;
        cout<<i<<":";
        for(int j=0;j<n;j++)
        {
            if((i>>j)&1) cout<<" "<<j;
        }
        cout<<endl;
    }


    return 0;
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ld a, b, h, m;

int main() {
	fastio; cin >> a >> b >> h >> m;
	ld ha = (h*60+m)/2, ma = 6*m;
	ld an = abs(ha - ma); an = min(an, 360 - an);
	ld p = 3.1415926535; p /= 180; p *= an;
	cout << fixed << setprecision(9) << sqrtl(a*a + b*b - 2*a*b*cos(p));
}


Measured memory_bytes: 4184
#include <stdio.h>

int main(void) {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	for (int i = a; i < a*b; i += a){
		if (i % b == c){
			printf("YES\n");
			return 0;
		}
	}
	printf("NO\n");
	return 0;
}


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

#define ll long long

ll n, q, a[100001], s;

int main()
{
	cin >> n;

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

	cin >> q;

	for (int i = 0; i < q; i++)
	{
		int b, c;
		cin >> b >> c;

		s -= b * a[b];
		s += c * a[b];
		a[c] += a[b];
		a[b] = 0;
		
		cout << s << endl;
	}
}

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

bool ch(int a)
{
  if(a>0&&a<10)
    return true;
  return false;
}

int main()
{
  int a,b;
  cin>>a>>b;
  if(ch(a)&&ch(b))
    cout<<a*b;
  else
    cout<<"-1";
  
  return 0;
}


Measured memory_bytes: 3604