akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int count = 0;
  
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < 15; j++) {
      if (4 * i + 7 * j == N) {
        count++;
        break;
      }
    }
  }
  
  if (count == 0) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 500005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int ans[n+5] = {};
    int v[n+5] = {};
    vector<int>a;
    f1(n){
        cin >> v[i];
    }
    for(int i = n ; i >= 1 ; i--){
        ans[i] = v[i];
        for(int j = i * 2 ; j <= n ; j += i){
            ans[i] ^= ans[j];
        }
        if(ans[i]){
            a.pb(i);
        }
    }
    reverse(a.begin(),a.end());
    cout << a.size() << '\n';
    for(auto i:a){
        cout << i <<' ';
    }
    cout << '\n';
}

Measured memory_bytes: 3192
import java.util.Scanner;

class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        double x1 = sc.nextDouble();
        double y1 = sc.nextDouble();
        double x2 = sc.nextDouble();
        double y2 = sc.nextDouble();
        double a;
        double b;

       
       a = x2 - x1 ;
       b = y2 - y1;
        double c = Math.sqrt(a * a + b * b);
        System.out.printf("%.8f",c);
    }

}



Measured memory_bytes: 28328
#!/usr/bin/python3
# -*- coding:utf-8 -*-

from math import log, floor

def main():
  n = int(input())
  min = 10**10
  for i in range(n+1):
    cc = 0
    t = i
    while t > 0:
      cc += (t%6)
      t//=6
    t = n - i
    while t > 0:
      cc += (t%9)
      t//=9
    if min > cc:
      min = cc
  print(min)

if __name__=='__main__':
  main()

  



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

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

    if ( s == string(s.size(), s.at(0))) {
        cout << s.size() * k /2 << endl;
        return 0;
    }

    long long res = 0;
    string check_concat = s + s;
    long long one = 0;
    long long two = 0;

    for (int i = 0; i < s.size() - 1; i++) {
        if (s.at(i) == s.at(i + 1)) {
            s.at(i + 1) = '@';
            one++;
        }
    }
    for (int i = 0; i < check_concat.size() - 1; i++) {
        if (check_concat.at(i) == check_concat.at(i + 1)) {
            check_concat.at(i + 1) = '@';
            two++;
        }
    }
    res = one + (two - one) * (k - 1);
    cout << res << endl;
    return 0;

}

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

int F[45];
int fibonacci(int);

int main(){
  int n;
  int f;

  scanf("%d", &n);
  if(n < 0 || 44 < n)
    exit(0);

  f = fibonacci(n);

  printf("%d\n", f);

  return 0;
}

int fibonacci(int n){
  if(n == 0 || n == 1)
    return F[n] = 1;
  if(F[n] != NULL)
    return F[n];
  return F[n] = fibonacci(n - 2) + fibonacci(n - 1);
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
  int N;
  string S;
  cin >> N >> S;
  vector<int> ans(N+1,0);
  int x=0;
  for(int i=0;i<N;i++){
    if(S.at(i)=='I')  x++;
    else  x--;
    ans.at(i+1)=x;
  }
  sort(ans.begin(),ans.end());
  cout << ans.at(N) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <typeinfo>
#include <algorithm>
using namespace std;
typedef long long ll;
int main(void){
    int n;
    cin >> n;
    ll ans = 0;
    ll ai;
    int x = 0;
    for(int i=0; i<n; i++){
        cin >> ai;
        if(x==0){
            if(ai%2==0){
                ans += ai/2;
            }else{
                ans += ai/2;
                x = 1;
            }
        }else{
            if(ai%2==0){
                ans += ai/2;
            }else{
                ans += ai/2+1;
                x = 0;
            }
        }
        if(ai==0){
            x = 0;
        }
    }
    cout << ans << endl;    
}

Measured memory_bytes: 256
def A_Frog1(a):
    n, h = len(a), a
    dp = [0] * n
    dp[0] = 0
    dp[1] = abs(h[1] - h[0])
    for i in range(1, n-1):
        dp[i+1] = min(
                dp[i-1] + abs(h[i+1] - h[i-1]), 
                dp[i] + abs(h[i+1] - h[i]))
    return dp[-1]
  
n = int(input())
a = list(map(int, input().split()))

print(A_Frog1(a))

Measured memory_bytes: 13980
#include <stdio.h>

long long int count(long long int n){
    long long int a,i,S[2]={},C[2]={};
    for(i=0;i<n;i++){
        scanf("%lld",&a);
        S[0]+=a;
        S[1]+=a;
        if(i%2==0){
            if(S[0]>=0){
                C[0] += S[0] + 1;
                S[0] = -1;
            }
            if(S[1]<=0){
                C[1] += -1*S[1] + 1;
                S[1] = 1;
            }
        }
        else{
            if(S[0]<=0){
                C[0] += -1*S[0] + 1;
                S[0] = 1;
            }
            if(S[1]>=0){
                C[1] += S[1] + 1;
                S[1] = -1;
            }
        }
    }
    if(C[0]<C[1]) return C[0];
    else return C[1];
}

int main()
{
    long long int n;
    scanf("%lld",&n);
    printf("%lld\n",count(n));
    return 0;
}

Measured memory_bytes: 128
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		int nam = in.nextInt();
        int za =  in.nextInt();
      
      if(nam>1){
      for(int i =za-(nam-1);i<za+nam;i++){
        System.out.print(i+" ");
      }
      	}else{System.out.print(za); }

      
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  ll n,P;
  cin>>n>>P;

  ll p=P;
  //map<ll,ll> mp;
  ll ans=1;
  vector<ll> last;
  if(n==1){
    cout<<p<<endl;
    return 0;
  }
  for(int i=2;i*i<=p;i++){
    ll tmp=0;
    if(p%i==0){

      while(p%i==0){
        tmp++;
        p/=i;
      }
      //mp[i]=tmp;
    }
    if(tmp>=n){
      ans*=pow((ll)i,tmp/n);
      //last.push_back(i);
    }
    if(p<pow((ll)i,n)||pow((ll)i,n)<0) break;
  }

  if(p!=1){
    ll tmp=0;
    while(P%p==0){
      P/=p;
      tmp++;
    }
    if(tmp%n==0) ans*=p;
  }

  cout<<ans<<endl;


  return 0;
}


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

int main(void){
    int n,k,c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    vector<int> L = {-n}, R = {n*2};
    rep(i,n){
        if (s[i] == 'o' && L.back() + c < i) {
            L.push_back(i);
        }
    }
    rep(ii,n){
        int i = n-1-ii;
        if (s[i] == 'o' && i < R.back() - c) {
            R.push_back(i);
        }
    }
    rep1(i,k){
        if (L[i] == R[k-i+1]) {
            cout << L[i]+1 << endl;
        }
    }
    return 0;
}


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

int main(){
	int N;
	cin>>N;
	float ans;
	float n=N;
	if(N%2==1){
	 ans = (float)(((n-1)/2+1)/n);
	 }
	else
	ans = (float)((n/2)/n);
	
	cout<<ans;
	
	return 0;
	}

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

using namespace std;
#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)

int main ()
{
  long long nums[100001];
  int N,Q,b;
  long long sum,B,C;
  vector<long long> res;
  

  REPI (100001)
    nums[i] = 0;

  cin >> N;
  sum = 0;

  REPI (N)
  {
    cin >> b;
    nums[b]++;
    sum += b;
  }

  cin >> Q;
  
  REPI (Q)
  {
    cin >> B >> C;

    sum = sum - B * nums[B] + C * nums[B];
    res.push_back (sum);
    nums[C] += nums[B];
    nums[B] = 0;
  }

  REPI (Q)
    cout << res[i] << "\n";

  return 0; 
}

Measured memory_bytes: 5096
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sync ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD  1000000007 
int powm(int base,int exp,int mod=MOD) {int ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
int32_t main()
{
	int n;
	cin>>n;
	double a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	double ans=(a[0]+a[1])/2;
	for(int i=2;i<n;i++)
		ans=(ans+a[i])/2;
	cout<<ans;
}	

Measured memory_bytes: 256
package main

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

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var a, b, c string
	con.Scan(&a, &b, &c)
	con.Printf("%c%c%c\n", a[0]-32, b[0]-32, c[0]-32)
	return nil
}


Measured memory_bytes: 640
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	int n;
	cin >> n;
	vector<int> arr(n);
	for(int i=0 ; i<n ; i++)
		cin >> arr[i];

	sort(arr.begin() , arr.end());

	arr.erase(unique(arr.begin() , arr.end()) , arr.end());


	cout << arr.size();
	return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main(){
    ll x, d, k;
    cin >> x >> k >> d;
    x = abs(x);
    ll q = x/d, r = x%d;
    k -= q;
    if(k<0) cout << x-d*(k+q);
    else if(k%2==0) cout << r << endl;
    else cout << abs(r-d) << endl;
}

Measured memory_bytes: 3572
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        // スペース区切りの整数の入力
        
        
        int[] a = new int[N];
        int[] b = new int[N];
        
        int z;
        z=0;

        for(int i=0;i<N;i++) {
        	a[i]=sc.nextInt();
        	b[i]=sc.nextInt();
        }
        
        for(int j=0;j<N-2;j++) {
        	if(a[j]==b[j] && a[j+1]==b[j+1] && a[j+2]==b[j+2]) {
        		z=z+1;
        	} else {
        		z=z+0;
        	}
        	
        }        
        
        if(z==0) {
        	System.out.println("No");
        } else {
        	System.out.println("Yes");
        }
        
        
    }
}

Measured memory_bytes: 36068
#include "bits/stdc++.h"

using namespace std;


int main() {
	
	int N;
	cin >> N;
	vector<int>A(N); 
	int g[15][15];
	for (int i = 0;i<15;++i) {
		for (int j = 0;j<15;++j) {
			g[i][j] = -1;
		}
	}
	for (int n = 0;n<N;++n) {
		cin >> A[n];
		for (int m = 0;m<A[n];++m) {
			int x, y;
			cin >> x >> y;
			x--;
			g[n][x] = y;
		}
	}
	int ans = 0;
	for (int i = 0;i< (1 << N);++i) {
		int anstmp = 0;
		vector<int>B(N);//正直者リスト
		for (int j = 0;j<N;++j) {
			if (1 & (i >> j)) {
				B[j] = 1;
				anstmp++;
			}
		}
		bool bans = true;
		for (int j = 0; j < N; ++j) {
			if (1 == B[j]) {
				for (int k = 0;k < N;++k) {
					if (-1 == g[j][k]) {
						continue;
					}
					if (B[k] != g[j][k]) {
						bans = false;
					}
				}
			}
		}
		if (bans) {
			ans = max(ans, anstmp);
		}

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


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

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

int N, M, P;

bool check (vector<vector<vector<int> > > v, int sx, int sy, int sz) {
    for (int i = 0; i < 13; i++) {
        int nx = sx;
        int ny = sy;
        int nz = sz;
        int r = 0;
        int l = 0;


        while (0 <= nx && nx < N && 0 <= ny && ny < N && 0 <= nz && nz < P && v[nx][ny][nz] == v[sx][sy][sz]) {
            r++;
            nx += dx[i];
            ny += dy[i];
            nz += dz[i];
        }

        nx = sx;
        ny = sy;
        nz = sz;

        while (0 <= nx && nx < N && 0 <= ny && ny < N && 0 <= nz && nz < P && v[nx][ny][nz] == v[sx][sy][sz]) {
            l++;
            nx -= dx[i];
            ny -= dy[i];
            nz -= dz[i];
        }

        if (l + r - 1 >= M) return true;
    }

    return false;
}

int main ()
{
    while (cin >> N >> M >> P, N || M || P) {
        int flag = -1;
        int win = -1;

        vector<vector<vector<int> > > v(N, vector<vector<int> >(N, vector<int>(P, 0)));

        vector<int> p[N][N];

        int carsor = 1;
        for (int i = 0; i < P; i++) {
            int x, y;
            cin >> x >> y;

            p[x-1][y-1].push_back(carsor);
            v[x-1][y-1][p[x-1][y-1].size()-1] = carsor;

            if (check(v, x-1, y-1, (p[x-1][y-1].size()-1)) && flag == -1) flag = i + 1, win = carsor;

            carsor = carsor == 1 ? 2 : 1;
        }

        if (win > 0) cout << (win == 1 ? "Black " : "White ") << flag << endl;
        else cout << "Draw" << endl;
    }

    return 0;
}

Measured memory_bytes: 1352
#include<iostream>
using namespace std;
int main() {
	
	//C
	string s;
	int i;
	int counter1 = 0, counter2 = 0;
	cin >> s;
	for (i = 0; i < s.size(); i++) {

		if (i % 2 == 0) {
			if (s[i] == '1') {
				counter1++;
				//cout << 'a';
			}
			else {
				counter2++;
				//cout << 'i';
			}
		}
		else {
			if (s[i] == '0') {
				counter1++;
				//cout << 'u';
			}
			else {
				counter2++;
				//cout << 'e';
			}
		}
		
	}

	if (counter1 < counter2) {
		cout << counter1 << endl;
	}
	else {
		cout << counter2 << endl;
	}

	return 0;
	//B
	/*int n;
	cin >> n;
	int i;
	int h[20];
	for (i = 0; i < n; i++) {
		cin >> h[i];
	}
	int maxh = 0;
	int hcounter = 0;
	maxh = h[0];
	hcounter++;
	for (i = 1; i < n; i++) {
		if (h[i] >= maxh) {
			maxh = h[i];
			hcounter++;
		}
	}
	cout << hcounter << endl;
	return 0;*/
	
	
	//A
	/*
	int a,b;
	cin >> a >> b;
	int x = 0;
	for (int i = 0; i < 2; i++) {
		if (a > b) {
			x = x + a;
			a--;
		}
		else {
			x = x + b;
			b--;
		}
	}
	cout << x << endl;
	return 0;
	*/


}

Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
//cout << fixed << setprecision(10) << ans << endl;
//int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(){
    string a;
    cin >> a;
    if(a[2]==a[3]&&a[4]==a[5]){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 2147483647;

inline bool cmp(int a, int b) {
  return a > b;
}

const int maxn = 2e5 + 7;
int Data[maxn], a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &Data[i]);
  memcpy(a + 1, Data + 1, sizeof(int) * n);
  sort(a + 1, a + n + 1, cmp);
  //for (int i = 1; i <= n; i++) cout << a[i] << endl;

  int mid = a[(n + 1) / 2];
  for (int i = 1; i <= n; i++) {
    //cout << mid << ' ' << n / 2 + 1 << ' ' << n / 2 << endl;
    if (Data[i] < mid) printf("%d\n", a[n / 2]);
    else if (Data[i] > mid) printf("%d\n", a[n / 2 + 1]);
    else {
      if (n / 2 == (n + 1) / 2) printf("%d\n", a[(n + 1) / 2 + 1]);
      else printf("%d\n", a[n / 2]);
    }
  }
  puts("");
  return 0;
}

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

int main()
{
    int a,b,c,d,e,f,ans1=0,ans2=0,i,j,k,l,res1,res2,temp1;
    double diff=INT_MIN;
    cin>>a>>b>>c>>d>>e>>f;
    a*=100;
    b*=100;
    for(j=0;j<=f/b;j++)
    {
        for(i=1;i<=f/a;i++)
        {
            res1=a*i+b*j;
            if(res1>f)
                break;
            temp1=(res1*e)/100;
            for(l=0;l<=temp1/d;l++)
            {
                for(k=0;k<=temp1/c;k++)
                {
                    res2=c*k+d*l;
                    if(res1+res2>f || res2>temp1)
                        break;
                    double temp2=((100*res2)/(double)(res1+res2));
                    if(diff<temp2)
                    {
                        diff=temp2;
                        ans1=res1;
                        ans2=res2;
                    }
                }
            }
        }
    }
    cout<<ans1+ans2<<" "<<ans2<<endl;
    return 0;
}

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

#define LL long long 
#define fi first
#define se second
#define mp make_pair
#define pb push_back 

using namespace std;

LL gcd(LL a, LL b) {
	return b ? gcd(b, a % b) : a;
}

LL lcm(LL a, LL b) {
	return a / gcd(a, b) * b;
}

LL powmod(LL a, LL b, LL MOD) {
	LL ans = 1;
	while (b) {
		if (b % 2) {
			ans = ans * a % MOD;
		}
		a = a * a % MOD;
		b /= 2;
	}
	return ans;
}

const int N = 2e5 + 511;
// const LL mod = 1e9 + 511;
const LL mod = 1e9 + 7;

LL fac[N], inv[N];
int n, m, k;

void P() {
	fac[0] = inv[0] = 1;
	for (int i = 1; i <= 2e5; ++i) {
		fac[i] = fac[i - 1] * i % mod;
	}
	inv[200000] = powmod(fac[200000], mod - 2, mod);
	for (int i = 200000 - 1; i >= 1; --i) {
		inv[i] = inv[i + 1] * (i + 1) % mod;
	}
}

LL get(int a, int b) {
	if (b == 0) return 1;
	return fac[a] * inv[b] % mod * inv[a - b] % mod;
}

int main() {
	P();
	cin >> n >> m >> k;
	LL ans = 0;
	for (LL i = 1; i < m; ++i) {
		ans = (ans + (m - i) * i % mod * n % mod * n % mod) % mod;
	}
	// cout << ans << endl;
	for (LL i = 1; i < n; ++i) {
		ans = (ans + (n - i) * i % mod * m % mod * m % mod) % mod;
	}
	// cout << ans << endl;
	ans = ans * get(n * m - 2, k - 2) % mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
//omajinai
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//omajinai

int main(){

    // omajinai
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    // omajinai

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

    sort(a.begin(),a.end());

    int ans = 10000000;

    for(int i = a.at(0);i < a.at(a.size()-1)+1;i ++){
        
        int sum = 0;

        for(int j = 0;j < a.size();j ++){
            sum += (i - a.at(j)) * (i - a.at(j));
        }

        ans = min(ans,sum);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node{
  int key;
  struct node *next;
  struct node *prev;
}Node;

Node *nil;

Node *listSearch(int key){
  Node *cur = nil->next;
  while(cur!= nil && cur->key != key){
    cur = cur->next;
  }
  return cur;
}

void init(){
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void deleteNode(Node *t){
  if(t == nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  deleteNode(nil->next);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void deleteKey(int key){
  deleteNode(listSearch(key));
}

void insert(int key){
  Node *x= (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next  =x;
  x->prev = nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();

  for( i = 0; i<n; i++){
    scanf("%s%d", com, &key);
    if(com[0] == 'i'){
      insert(key);
      np++;
      size++;
    }else if (com[0] == 'd'){
      if(strlen(com)>6){
        if(com[6] == 'F')deleteFirst();
        else if(com[6] == 'L')deleteLast();
      }else{
        deleteKey(key);
        nd ++;
      }
      size--;
    }
  }
Node *cur = nil->next;
int isf = 0;
while(1){
  if(cur == nil) break;
  if(isf++>0)printf(" ");
  printf("%d", cur->key);
  cur=cur->next;
}
printf("\n");
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef long  double lb;
int mod=1e9+7;
const int N=1e5+5;

typedef pair<int,int> P;
vector<vector<P>>G;
vector<int>res;

queue<int>q;
void bfs(int x)
{
    res[x]=1;
    q.push(x);
    while(q.size())
    {
        int k=q.front();
        q.pop();
        for(auto v:G[k])
        {
            if(!res[v.first])
            {
                q.push(v.first);
                if(v.second) {res[v.first]=3-res[k];}
                else {res[v.first]=res[k];}
            }
        }
    }
}
int main()
{
    int n;
    cin>>n;
    G.assign(n+2,vector<P>());
    res.assign(n+2,0);
    for(int i=1; i<=n-1; i++)
    {
        int a,b;
        ll c;
        cin>>a>>b>>c;
        c%=2;
        G[a].emplace_back(b,c);
        G[b].emplace_back(a,c);
    }
    bfs(1);
    for(int i=1; i<=n; i++)
    {
        if(res[i]&1) cout<<1<<endl;
        else cout<<0<<endl;
    }
    return 0;
}
/*
5
2 5 2
2 3 10
1 3 8
3 4 2
*/


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
#define MAX 2000000000
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

P f(int n){
  int cp = n;
  int a,b = n%10;
  while(cp>0){
    if(cp<10)a=cp;
    cp/=10;
  }
  return make_pair(a,b);
}

int main(){
  map<pair<int,int>,int> m;
  int n; cin>>n;
  for(int i = 1; i <= n; i++){
    P tmp = f(i);
    if(m.count(tmp))m[tmp]++;
    else m[tmp]=1;
  }
  ll res = 0;
  for(int i = 1; i <= 9; i++){
    for(int j = 1; j <= 9; j++){
      res += m[make_pair(i,j)]*m[make_pair(j,i)];
    }
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stdio.h>
#include <string>
#define rep(i,n) for(int i = 0; i < n;++i)
using namespace std;

int main(){
	vector<string> v(50);
	int alpha[50][26];
	int alpha1[26];
	int n;
	cin >> n;
	rep(j,50){
		rep(i,26){
			alpha[j][i] = 0;
			alpha1[i] =0;
		}
	}

	rep(i,n){
		cin >> v[i];
		rep(j,v[i].length())
			alpha[i][v[i][j] - 97]++;
	}


	rep(i,26){
		alpha1[i] = 114514810;
	}
	rep(i,n){
		rep(j,26){
			if(alpha1[j] > alpha[i][j])
				alpha1[j] = alpha[i][j];
		}
	}


	rep(i,26)
		rep(j,alpha1[i])
			printf("%c",i+97);

	cout << endl;


	return 0;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,dp[100009],a[100009],mx=1e9+8;
int bt(int x)
{
    if(x==0)return 0;
    if(x==1)return abs(a[x]-a[x-1]);
    if(dp[x]!=-1)return dp[x];
    dp[x]=min(bt(x-1)+abs(a[x]-a[x-1]),bt(x-2)+abs(a[x]-a[x-2]));
    return dp[x];
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)
    {
        dp[i]=-1;
    }
    cout<<bt(n-1);
}


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

class Program {

    const int MAX = 101;
    static int cnt = 0;
    static int[] d = new int[MAX];
    static int[] f = new int[MAX];
    static int[] vst = new int[MAX];

    static List<List<int>> g = new List<List<int>>();
    static List<int> nm = new List<int>();

    static void Main(string[] args) {
        
        int ln = int.Parse(Console.ReadLine());
        int mn = 99;
        for (int i = 0; i < MAX; i++) {
            g.Add(new List<int>());
        }

        for (int i = 0; i < ln; i++) {
            int[] ip = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToArray();
            nm.Add(ip[0]);

            for (int j = 2; j < ip.Length; j++) {
                g[ip[0] - 1].Add(ip[j]);
            }
        }

        foreach (var v in nm) {
            dfs(v);
        }

        for (int i = 0; i < MAX; i++) {
            if (d[i] > 0) {
                Console.WriteLine(i.ToString() + " " + d[i].ToString() + " " + f[i].ToString());
            }
        }

    }


    static void dfs(int v) {

        if (vst[v] > 0) return;
        vst[v] = 1;

        d[v] = ++cnt;

        for (int i = 0; i < g[v - 1].Count; i++) {
            dfs(g[v - 1][i]);
        }
        f[v] = ++cnt;
    }

}



Measured memory_bytes: 18376
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		int c = parseInt(sc.next());
		int k = parseInt(sc.next());
		sc.close();
		int mx = Math.max(a, Math.max(b, c));
		out.println(a+b+c+mx*((int)pow(2, k)-1));
	}
}


Measured memory_bytes: 21716
/* ***********************************************
Author        :taciturnity
Created Time  :2020/2/3 22:02:32
File Name     :main.cpp
************************************************ */
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include<random>
#include<ctime>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define ll long long
#define INF 1e9
#define bug puts("--------------")
const ll N = 2e5 + 10;
const ll mod = 1e9 + 7;
const ll Max_n = 1e6 + 10;
using namespace std;
int main(){
   string s;
   cin >> s;
   int l = s.size();
   for(int i = 1;i <= l;++i) cout << 'x';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
const int N=105;
int a[N];
int main()
{
    ios::sync_with_stdio(false);
    int n,k,d,x,i,j,cnt;
    scanf("%d%d",&n,&k);
    for(i=0;i<k;i++)
    {
    	scanf("%d",&d);
		for(j=0;j<d;j++)
		{
			scanf("%d",&x);
			a[x]++;
		}
	}
	cnt=0;
    for(i=1;i<=n;i++)
    {
    	if(a[i]) cnt++;
	}
	cnt=n-cnt;
    printf("%d\n",cnt);
    return 0; 
}

Measured memory_bytes: 3852
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int temp;
		int[] height = new int[10];
		Scanner cin = new Scanner(System.in);
		for(int i=0;i<10;i++) {
			height[i] = cin.nextInt();
		}
		for(int i=0;i<10;i++) {
			for(int j=i+1;j<10;j++) {
				if(height[i]<height[j]) {
					temp = height[i];
					height[i] = height[j];
					height[j] = temp;
				}
			}
		}
		System.out.println(height[0]);
		System.out.println(height[1]);
		System.out.println(height[2]);
	}
}


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

signed main(){
  vector<int> A(3);
  rep(i,3)cin>>A[i];
  sort(rbegin(A),rend(A));
  int ans=A[0]*10+A[1]+A[2];
  cout<<ans<<endl;
  return 0;
}

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

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			int material = scanner.nextInt();

			// input
			int[] integers = new int[N];
			for (int i = 0; i < N; i++) {
				integers[i] = scanner.nextInt();
			}
			// 最小材料数で何個作成できるか算出する
			int cnt = returnCreatableCount(material - Arrays.stream(integers).sum(), integers);
			System.out.println(N + cnt);
		}
	}

	private static int returnCreatableCount(int nokori, int[] integers) {
		Arrays.sort(integers);
		return nokori / integers[0];
	}
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

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

    int ans = INT_MAX;
    for(int i = 0; i <= s.size() - 3; i++){
        int x = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
        ans = min(ans, abs(753 - x));
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import bisect, heapq
n,m=map(int,input().split())
a=list(map(lambda s: -int(s),input().split()))
heapq.heapify(a)
for i in range(m):
    e=-heapq.heappop(a)
    e=e//2
    heapq.heappush(a,-e)
print(-sum(a))




Measured memory_bytes: 14380
#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
map<string,vector<int> > m;
vector<string> v;
int main(void){
  string s;
  int p;
  while(cin >> s >> p){
    if(m.find(s) == m.end()){
      v.push_back(s);
    }
    m[s].push_back(p);
  }

  sort(v.begin(),v.end());
  for(int i = 0; i < (int)v.size(); i++){
    cout << v[i] << endl;
    sort(m[v[i]].begin(),m[v[i]].end());
    for(int j = 0; j < (int)m[v[i]].size(); j++){
      cout << m[v[i]][j] << ((j+1==(int)m[v[i]].size())?'\n':' ');
    }
  }
}

Measured memory_bytes: 1248
n = int(input())
xlis = list(map(int, input().split()))
l, r = min(xlis), max(xlis)
ans = float('inf')
for i in range(l, r+1):
    p = 0
    for j in range(n):
        p += (xlis[j] - i) ** 2
    ans = min(ans, p)
print(ans)

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

int n,p[100100],d[100100];

int main(){
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> p[i];
    d[i] = 100000000;
  }
  d[0] = 0;
  deque<int> q;
  q.push_back(0);

  while(q.size()){
    int a = q.front(); q.pop_front();
    
    if(p[a]){
      int nxt = a+p[a];
      if(d[nxt] <= d[a])continue;
      else{
	d[nxt] = d[a];
	q.push_front(nxt);
      }
    }else{
      for(int i=1;i<=6;i++){
	int nxt = a+i;
	if(d[nxt] <= d[a]+1)continue;
	else{
	  d[nxt] = d[a]+1;
	  q.push_back(nxt);
	}
      }
    }
  }

  cout << d[n-1] << endl;
}

Measured memory_bytes: 2000
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,n,ans=700;
string s;
int main(){
  cin >> s;
  for(int i=0;i<3;i++){
    if(s[i]=='o'){
      ans+=100;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	int N; int M;
	while(~scanf("%d%d", &N, &M)) {
		vector<vpii> g(N);
		rep(i, M) {
			int a; int b; int c;
			scanf("%d%d%d", &a, &b, &c), -- a, -- b;
			g[a].emplace_back(b, c);
		}
		int ans = -1;
		vector<bool> vis(N);
		priority_queue<pii,vpii,greater<pii>> pq;
		pq.push(make_pair(0, 0));
		while(!pq.empty()) {
			int t = pq.top().first;
			int i = pq.top().second;
			pq.pop();
			if(vis[i]) continue;
			vis[i] = true;
			for(auto e : g[i]) if(t <= e.second) {
				if(e.first == N - 1) {
					amax(ans, e.second);
				} else {
					pq.push(make_pair(e.second, e.first));
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 8972
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cstdio>
using namespace std;
int a[100] = {0};
bool cmp(int a, int b){
	return a < b;
}
int main(){
	int n, i;
	cin >> n;
	for(i = 0; i < n; i++)
		cin >> a[i];
	sort(a,a+n,cmp);
	cout << a[n-1]-a[0] << endl;
	return 0;
} 


Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)

	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)

	aa := make([]int64, n)
	ss := make([]int64, n+1)
	for i := 0; i < n; i++ {
		aa[i] = getNextInt64(scanner)
		ss[i+1] = ss[i] + aa[i]
	}

	var ans, adjust int64
	// i%2 == 0を正
	for i := 1; i < n+1; i++ {
		if i%2 == 0 {
			if ss[i]+adjust <= 0 {
				diff := int64(1) - (ss[i] + adjust)
				ans += diff
				adjust += diff
			}
			continue
		}
		if ss[i]+adjust >= 0 {
			diff := int64(1) + (ss[i] + adjust)
			ans += diff
			adjust -= diff
		}
	}
	ans1 := ans
	ans = 0
	adjust = 0
	// i%2 == 1を正
	for i := 1; i < n+1; i++ {
		if i%2 == 1 {
			if ss[i]+adjust <= 0 {
				diff := int64(1) - (ss[i] + adjust)
				ans += diff
				adjust += diff
			}
			continue
		}
		if ss[i]+adjust >= 0 {
			diff := int64(1) + (ss[i] + adjust)
			ans += diff
			adjust -= diff
		}
	}

	if ans > ans1 {
		ans = ans1
	}

	fmt.Fprintln(writer, ans)

	writer.Flush()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 998244353;

template <int mod>
struct modint {
    lint v;
    modint() : v(0) {}
    modint(signed v) : v(v) {}
    modint(lint t) {
        v = t % mod;
        if (v < 0)
            v += mod;
    }

    modint pow(lint k) {
        modint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static modint add_identity() { return modint(0); }
    static modint mul_identity() { return modint(1); }
    modint inv() { return pow(mod - 2); }

    modint &operator+=(modint a) {
        v += a.v;
        if (v >= mod)
            v -= mod;
        return *this;
    }
    modint &operator-=(modint a) {
        v += mod - a.v;
        if (v >= mod)
            v -= mod;
        return *this;
    }
    modint &operator*=(modint a) {
        v = v * a.v % mod;
        return *this;
    }
    modint &operator/=(modint a) { return (*this) *= a.inv(); }

    modint operator+(modint a) const { return modint(v) += a; };
    modint operator-(modint a) const { return modint(v) -= a; };
    modint operator*(modint a) const { return modint(v) *= a; };
    modint operator/(modint a) const { return modint(v) /= a; };

    modint operator-() const { return v ? modint(mod - v) : modint(v); }

    bool operator==(const modint a) const { return v == a.v; }
    bool operator!=(const modint a) const { return v != a.v; }
    bool operator<(const modint a) const { return v < a.v; }
};
using mint = modint<mod>;
ostream &operator<<(ostream &os, mint m) { return os << m.v; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n, vector<int>(m));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> a[i][j];
        }
    }
    vector<bool> used(n, false);
    int rank = 0;
    for (int i = 0; i < m; ++i) {
        int idx = -1;
        for (int j = 0; j < n; ++j) {
            if (!used[j] && a[j][i] == 1) {
                idx     = j;
                used[j] = true;
                break;
            }
        }
        if (idx == -1)
            continue;
        for (int j = 0; j < n; ++j) {
            if (j != idx && a[j][i] == 1) {
                for (int k = i; k < m; ++k) {
                    a[j][k] ^= a[idx][k];
                }
            }
        }
        rank++;
    }
    mint ret = mint(2).pow(n + m - rank - 1) * (mint(2).pow(rank) - 1);
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
 #define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        3e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}




void solve()
{
  int n;
  cin >> n;
  int a[n+1],cn=0;

  forf(i,1,n+1) cin >> a[i];

  forf(i,1,n+1)
  {
    if(i%2!=0 && a[i]%2!=0) cn++;
  }

  cout<<cn;
}


int32_t main()
{
  pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

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

public class Main {

	static int[] deg;
	
	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		int k=fs.nextInt(), n=fs.nextInt();
		int[] a=fs.readArray(n);
		int max=0;
		Arrays.sort(a);
		for (int i=0; i<n; i++) {
			int i2=(i+1)%n;
			int cur=a[i], next=a[i2];
			if (next<cur) {
				next+=k;
			}
			max=Math.max(max, next-cur);
		}
		System.out.println(k-max);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

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

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

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


Measured memory_bytes: 49748
x = gets.chomp.to_i

if x < 600
    puts 8
elsif x < 800
    puts 7
elsif x < 1000
    puts 6
elsif x < 1200
    puts 5
elsif x < 1400
    puts 4
elsif x < 1600
    puts 3
elsif x < 1800
    puts 2
elsif x < 2000
    puts 1
end

Measured memory_bytes: 14400
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int A, B; cin >> A >> B;
    if(B % A == 0) cout << A + B << endl;
    else cout << B - A << endl;
    return 0;
}


Measured memory_bytes: 256
// https://ei1333.github.io/luzhiled/
// http://beet-aizu.hatenablog.com/entry/2017/01/04/113233
// http://www.prefield.com/algorithm/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vd = vector<ld>;
using vs = vector<string>;
using vb = vector<bool>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<ld>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;
using Graph = vector<vector<ll>>;
const ll INF = 1LL << 60;
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
const ll tl= 1'000'000'007;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REREP(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
#define REFOR(i, n, a) for (ll i = n; i >= a; i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define debug cout << "line : " << __LINE__ << " debug" << endl;
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ind(...) long double __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << endl;} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#define in1(A) REP(i,A.size()) in(A[i]);
#define in2(A,B) REP(i,A.size()) in(A[i],B[i]);
#define in3(s,t,u) REP(i,sz(s)){in(s[i] , t[i] , u[i]);}
#define in4(s,t,u,v) REP(i,sz(s)){in(s[i] , t[i] , u[i] , v[i]);}
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
struct Point{ ld x,y; };
ld dist(Point a, Point b){return sqrt(abs(a.x-b.x)*abs(a.x-b.x)+abs(a.y-b.y)*abs(a.y-b.y));} // ２点間の距離 
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b;} 
ll fact(ll n){ if(n < 2) return 1; return (n * fact(n-1))%tl; } //階乗
inline ll updiv(ll a,ll b){ return (a + b - 1) / b; } //切り上げ
template<typename T,typename U>ll ceil(T a,U b){return (a + b - 1) / b;}
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
//-------------------------------------------------------------------------------------------------
int main(){
    init();
    inl(n);
    if(n==1){out("Hello World");} 
    else{inl(a,b);out(a+b);}
}

Measured memory_bytes: 256
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<map>
#include<vector>
using namespace std;
vector<string> in;
map<string,int> S,T;
int main()
{
	int n_s,n_t;
	scanf("%d",&n_s);
	for(int i=0;i<n_s;i++) {string s;cin>>s;S[s]++;in.push_back(s);}
	scanf("%d",&n_t);
	for(int i=0;i<n_t;i++) {string s;cin>>s;T[s]++;}
	int ans=0;
	for(int i=0;i<in.size();i++)
		if(S[in[i]]-T[in[i]]>0)
			ans=max(ans,S[in[i]]-T[in[i]]);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
//package abc053a;

import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		int a;
		Scanner sc = new Scanner(System.in);
		a= sc.nextInt();		
		if(a < 1200) System.out.println("ABC");
		else System.out.println("ARC");

	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define endl '\n';
typedef long long ll;
const ll INF = 1e17 + 1;
const ll MAX = 2147483647;
const ll MOD = 1000003;

using namespace std;

ll min(ll x, ll y, ll z)
{
    return min(min(x, y), z);
}
ll max(ll x, ll y, ll z)
{
    return max(max(x, y), z);
}

ll min(ll x, ll y, ll z, ll o)
{
    return min(min(x, y, z), o);
}

ll _power(ll b, ll p)
{
    ll res = 1;
    while (p)
    {
        if (p % 2)
            res = (res * b) % MOD;
        b = (b * b) % MOD;
        p /= 2;
    }
    return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, m;
    cin >> n >> m;
    vector<ll> arr(n + 1);
    priority_queue<ll> pq;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        pq.push(arr[i]);
    }
    while (m--)
    {
        ll top = pq.top();
        pq.pop();
        pq.push(top / 2);
    }
    ll sum = 0;
    while (!pq.empty())
    {
        sum += pq.top();
        pq.pop();
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 2168