akhauriyash/Code-Regression huggingface dataset:
import numpy as np
from itertools import combinations_with_replacement

n, m, q = input().split()

my_list = []
for i in range(int(q)):
    a, b, c, d = input().split()
    my_list.append([int(a), int(b), int(c), int(d)])

result = 0
index = combinations_with_replacement(range(1, int(m) + 1), int(n))
for i in index:
    temp = 0
    for j in range(int(q)):
        if i[my_list[j][1] - 1] - i[my_list[j][0] - 1] == my_list[j][2]:
            temp += my_list[j][3]

    result = max(result, temp)

print(result)

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

auto keta(ll n) {
    ll res;
    for(ll i = 0; i < 100; i++) {
        n = n / 10;

        if(n == 0) {
            res = i + 1;
            break;
        }
    }
    return res;
}


int main() {
    int a,b;
    cin>>a>>b;
    if(a<2*b) cout<<0<<endl;
    else cout<<a-b*2<<endl;
}   

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


int main(){
	int n;
	cin >> n;
	map<int,int> m;
	vector<long> v(n,0);
	vector<long> pkl(n,0);
	for (int i = 0; i < n; i++)
	{
		long k;
		cin >> k;
		v[k-1] += 1; 
		pkl[i] = k;
	}

	long ans = 0;
	for(int i = 0;i<n;i++){
		ans += (v[i] * (v[i] - 1))/2;
	}
	// cout << ans;
	for(int i = 0;i<n;i++){
		// cout << v[pkl[i]];
		cout << ans - (v[pkl[i]-1] - 1) << "\n";
	}
	// cout << "\n";
	return 0;
}

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

using namespace std;

#define INP "solve"
#define OUT "solve"

const int QQ = 3e5 + 10;
const int maxN = 1e6 + 10;
const int maxM = 3e5 + 10;
const long long oo = 1e15;
const int module = 1e9 + 7;
const long double du = 1e-9;

void doc() {
    freopen(INP ".inp","r",stdin);
    freopen(OUT ".out","w",stdout);
}

void solve() {
    int n, K;
    cin >> n >> K;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int F[K + 1], S[K + 1];
    memset(F, 0, sizeof(F));
    F[0] = 1;
    for (int i = 0; i <= K; i++) S[i] = 1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= K; j++) {
            int L = (j - a[i] - 1 < 0 ? 0 : S[j - a[i] - 1]);
            int R = S[j];
            F[j] = (R - L + module) % module;
        }
        S[0] = F[0];
        for (int j = 1; j <= K; j++) S[j] = (S[j - 1] + F[j]) % module;
    }
    cout << F[K];
}
int main(int argc,char *argv[]) {
    //srand(time(nullptr));
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
    ///doc();
    solve();
}


Measured memory_bytes: 1024
"https://codeforces.com/contest/1328/problem/A"
import collections, heapq, itertools, math, functools
groupby = itertools.groupby
rs  = lambda: input()
ri  = lambda: int(input())
rm  = lambda: map(int, input().split())
rai = lambda: [int(x) for x in input().split()]

from functools import reduce

def solve():
    N, M, K = rm()
    A = rai()
    B = rai()
    a , b = [0], [0]
    for i in range(N):
        a.append(a[i] + A[i])
    for i in range(M):
        b.append(b[i] + B[i])
    #print(a,b)

    ans, j = 0, M
    for i in range(N+1):
        if a[i] > K:
            break
        while b[j] > K - a[i]:
            j -= 1
        ans = max(ans, i+j)
    return ans
print(solve())

Measured memory_bytes: 47908
from collections import deque
from copy import deepcopy
from heapq import heappop, heappush, heapify


n, k = map(int, input().split())
v = deque(map(int, input().split()))

mx = -10**9
mn = min(n, k)+1

for i in range(mn):
    for j in range(mn-i):

        heap = []
        u = deepcopy(v)
        heapify(heap)

        if i >= 1:
            for x in range(i):
                heappush(heap, u.pop())

        if j >= 1:
            for x in range(j):
                heappush(heap, u.popleft())

        if k - i - j >= 1:
            for x in range(k-i-j):
                if heap:
                    min = heappop(heap)

                    if min >= 0:
                        heappush(heap, min)
                        break
        mx = max(mx, sum(heap))

print(mx)


Measured memory_bytes: 3444
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
const int maxn = 105;
int a[maxn];
int main(int argc, char const *argv[])
{
	int n,A,B;
	cin>>n>>A>>B;
	int sum1,sum2,sum3;
	sum1 = sum2 = sum3 = 0;
	for(int i = 0;i < n; ++i)
	{
		scanf("%d",&a[i]);
	}
	sort(a,a + n);
	int i = 0;
	for(;a[i] <= A && i < n; ++i)
	{
		sum1++;
	}
	for(;a[i] <= B && i < n; ++i)
	{
		sum2++;
	}
	for(;i < n; ++i)
	{
		sum3++;
	}
	printf("%d\n",min(sum1,min(sum2,sum3)));
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 998244353
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
int dp[3005][3005];
int fun(int i,int j,int k,int a[],int n){
    if(i>j)return 0;
    if(dp[i][j]!=-1)return dp[i][j];
    if(k==1){
        int ans=LLONG_MAX;
        ans=min(ans,fun(i+1,j,(k+1)%2,a,n)-a[i]);
        ans=min(ans,fun(i,j-1,(k+1)%2,a,n)-a[j]);
        return dp[i][j]=ans;
    }
    else{
        int ans=LLONG_MIN;
        ans=max(ans,fun(i+1,j,(k+1)%2,a,n)+a[i]);
        ans=max(ans,fun(i,j-1,(k+1)%2,a,n)+a[j]);
        return dp[i][j]=ans;
    }
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    memset(dp,-1,sizeof(dp));
    cout<<fun(0,n-1,0,a,n);
    return 0;
}

Measured memory_bytes: 71040
import java.util.Scanner;

public class Main { 
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int count = Integer.parseInt(sc.nextLine());
    	double oddCount = 0;
    	for(int i = 1;i<=count;i++) {
    		if(i%2 == 1) {
    			oddCount++;
    		}
    	}
 
    	System.out.println(oddCount/count);
    	
    	
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define BIGINF (int) 4e18 + 7
#define MOD7 1000000007
#define MOD9 1e9 + 9
#define INF  (int)2e9 + 7
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
typedef long long ll;
typedef long double ld;
typedef string str;
typedef double d;
typedef unsigned u;
typedef unsigned long long ull;
 
//int N = 10005;
bool visited[100005];
int dp[100005];
int inDegree[100005];
vector<int> graph[100005];
 
void dfs(int vertex) {
	visited[vertex] = true;
	int size = graph[vertex].size();
	for (int i = 0; i < size; i++) {
		int a = graph[vertex][i];
		dp[a] = max(dp[a], dp[vertex] + 1);
		inDegree[a]--;
		if (inDegree[a] == 0) dfs(a);
	} 
}
 
 
int main () {
    //freopen("inputf.txt", "r", stdin);
    //freopen("outputf.txt", "w", stdout);
    int n,m;
    SCD(n);
    SCD(m);
    int x, y;
    memset(dp, 0, sizeof(dp));
    memset(visited, false, sizeof(visited));
    for (int i = 0; i < m; i++) {
    	SCD(x);
    	SCD(y);
    	graph[x].push_back(y);
    	inDegree[y]++;
    }
 
    for (int i = 1; i <= n; i++) {
    	if (!visited[i] && inDegree[i] == 0) dfs(i);
    }
 
    int ans = 0;
    for (int i = 1; i <= n; i++) {
    	ans = max(ans, dp[i]);
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 11264
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
 
using namespace std;
 
 
const int MAX_N = int(1e6) + 10;
long long int MOD=1e9+7;
const long long int INF=1e18;
 
typedef long long int ll;
typedef unsigned long long int llu;
 
 
 
inline ll mul(ll a,ll b){
 
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll c=a*b;
    c=(c+MOD)%MOD;
    return c;
}
inline ll add(ll a,ll b){
    a=(a+MOD)%MOD;
    b=(b+MOD)%MOD;
    ll ans=(a+b);
    ans=(ans+MOD)%MOD;
    return ans;
}
ll power(ll a,ll b,ll c=0){
    ll ans=1;
    while(b){
        if(b&1){
            ans=mul(ans,a);
        }
        a=mul(a,a);
        b=b/2;
    }
    return ans;
}
 
  
 
 
#define all(x) (x).begin(),(x).end()
 
 
 
 
//s.reserve(32768); //updated !
//s.max_load_factor(0.25);

const int N=1e5+5;




bool ok(ll x,vector<ll> &a,int n,ll K){
    ll cnt=0;
    for(int i=0;i<n;i++){
        if(a[i]<=x)continue;
        else if(a[i]%x==0)cnt+=a[i]/x-1;
        else cnt+=a[i]/x;
    }

    if(cnt<=K)return true;
    else return false;
}


int main(){

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

    ll low=1;
    ll high=1e9;
    ll ans=-1;
    while(low<=high){
        ll mid=(low+high)/2;
        if(ok(mid,a,n,K)){
            ans=mid;
            high=mid-1;
        }else{
            low=mid+1;
        }
    }

    cout<<ans<<endl;


}
 
    
 
 
 
    
 
 
 
    
    
    
 
 
 
 
    
 
 
    
 
    
 
 
 
 
 
 
    
    
 
    
 
    
 
 
 
 
    
 


Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
#define LL long long 
#define ULL unsigned long long 

const int N = 1e5+11;
const int M = 1e6+11;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int inff = 0x3f3f3f3f3f3f3f3f;


/*-----------------------------------------*/

LL a[10];
int main(){
 	for(int i=0;i<3;i++){
 		scanf("%lld",&a[i]);
	 }
	 sort(a,a+3);	
	 if(a[0]+a[1]==a[2]) puts("Yes");
	 else puts("No");
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>

using namespace std;
#define SAY_YES cout<<"YES"<<endl;
#define SAY_Yes cout<<"Yes"<<endl;
#define SAY_NO cout<<"NO"<<endl;
#define SAY_No cout<<"No"<<endl;
#define IFYES(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} 
#define IFYes(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} 
#define IFyes(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"yes"<<endl;}else{cout<<"no"<<endl;} 
#define DEBUG_OUTPUT_ARRAY(XXX,ONE) for(int i=0;i<(ONE);i++){cout<<"DEBUG: i = "<<i<<" -> "<<XXX[i]<<endl;}
#define DEBUG_OUTPUT_ARRAY2(XXX,ONE,TWO) for(int i=0;i<(ONE);i++){cout<<"<<< i = "<<i<<" >>>"<<endl;for(int j=0;j<(TWO);j++){cout<<"DEBUG: j = "<<j<<" -> "<<XXX[i][j]<<endl; } }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX,ONE,TWO) for(int i=0;i<(ONE);i++){cout<<i<<"  ";for(int j=0;j<(TWO);j++){cout<<XXX[i][j]<<" "; } cout<<endl;}

typedef pair<long long int,long long int> pll;


const long long int mod=1000000007;
const long long int INF=99999999999999999;


long long int A,B,C,X,Y;
string str,resstr;
int main() {
	cout << fixed << setprecision(18);
    
    cin>>A>>B>>C>>X>>Y;
    //cout<<min({2*C*max(X,Y),A*X+B*Y,2*C*Y+max(A*(X-Y),0LL),2*C*X+max(B*(Y-X),0LL)})<<endl;
    
    if((2*C<=A&&X>Y)||(X<Y&&2*C<=B)){
        cout<<2*C*max(X,Y)<<endl;
        return 0;
    }
    if(2*C>=A+B){
        cout<<A*X+B*Y<<endl;
        return 0;
    }
    if(2*C<A+B&&(2*C>A||2*C>B)){
        if(X>=Y){
            cout<<2*C*Y+A*(X-Y)<<endl;
            }
        else{
            cout<<2*C*X+B*(Y-X)<<endl;
            }
    }
    
} 


Measured memory_bytes: 256
using System;

namespace D
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			var input1 = Console.ReadLine().Split();
			var n = int.Parse(input1[0]);
			var m = int.Parse(input1[1]);
			var xs = Console.ReadLine().Split();
			var ys = Console.ReadLine().Split();

			var sumDiffX = 0L;
			var coef = -1 * n + 1;
			foreach (var x in xs)
			{
				sumDiffX += coef * long.Parse(x);
				coef += 2;
			}

			var sumDiffY = 0L;
			coef = -1 * m + 1;
			foreach (var y in ys)
			{
				sumDiffY += coef * long.Parse(y);
				coef += 2;
			}

			const long div = 1000000007;
			Console.WriteLine((sumDiffX % div) * (sumDiffY % div) % div);
		}
	}
}

Measured memory_bytes: 31708
using System;

namespace ConsoleApp65
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            int a = 0;
            int w = 0;
            int t = 0;
            int r = 0;
            for ( var i = 0; i < n; i++)
            {
               var  l = Console.ReadLine();
                switch ( l){
                    case "TLE":
                        t++;
                        break;

        case "AC":
                        a++;
                        break;

                    case "WA":
                        w++;
                        break;

                    case "RE":
                        r++;
                        break;

                }
            }
            var ac = "AC x ";
 var wa = "WA x ";
            var tle = "TLE x ";
        var re= "RE x ";

            Console.WriteLine(ac + a.ToString());
            Console.WriteLine(wa + w.ToString());
            Console.WriteLine(tle + t.ToString());
            Console.WriteLine(re + r.ToString());
        }
    }
}


Measured memory_bytes: 30532
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

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

int a[200];

int main(void){
    int n,mini;
    ll c = 0;

    scanf("%d",&n);

    REP(i,n){
        scanf("%d",&a[i]);
    }

    REP(i,n){
        mini = i;
        FOR(j,i,n)
            if(a[j] < a[mini])
                mini = j;
        if(i != mini){
            swap<int>(a[i],a[mini]);
            c++;
        }
    }
    REP(i,n){
        if(i < n - 1)
            printf("%d ",a[i]);
        else
            printf("%d\n",a[i]);
    }
    printf("%lld\n",c);
    return 0;
}

Measured memory_bytes: 3212
import java.util.Scanner;

public class Main{
    
    public static void main (String[] args){
        
        Scanner sc = new Scanner (System.in);
        
        int N = sc.nextInt();
        int[] list = new int [N];
        int[] list2 = new int [N];
        
        for (int index=0; index<N; index++){
            list[index]=sc.nextInt();
        }
        
        for (int index=0; index<N; index++){
            list2[index]=index+1;
        }
        
        int count = 0;
        for (int index=0; index<N; index++){
            if (list[index]!=list2[index]){
                count++;
            }
        }
        
        if (count>2){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
}

Measured memory_bytes: 23120
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(int i = 0; i < (int)n; i++)
using namespace std;

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b>=c){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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

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

    for (int x = 2; x <= n; x++) {
        int nx = x;
        int d = 2;
        while (nx > 1) {
            if (nx % d == 0) {
                nx /= d;
                p[d]++;
            } else {
                d++;
            }
        }
    }

    int ans = 0;
    for (int i = 2; i < 100; i++) {
        if (p[i] >= 74) ans++;
    }
    int s = 0, t = 0;
    for (int i = 2; i < 100; i++) {
        if (p[i] >= 24) s++;
        if (p[i] >= 2) t++;
    }
    ans += s * (t - 1);
    s = 0;
    t = 0;
    for (int i = 2; i < 100; i++) {
        if (p[i] >= 14) s++;
        if (p[i] >= 4) t++;
    }
    ans += s * (t - 1);
    s = 0;
    t = 0;
    for (int i = 0; i < 100; i++) {
        if (p[i] >= 4) s++;
        if (p[i] >= 2) t++;
    }
    ans += (s * (s - 1) / 2) * (t - 2);

    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 rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, m, k, l;

//----------------↓UnionFind↓----------------

int par[222222], rnk[222222];

void init(int n) {
	for (int i=0; i<n; i++) {
		par[i] = i;
		rnk[i] = 0;
	}
}

int find(int x) {
	if (par[x]==x) return x;
	else return par[x] = find(par[x]);
}

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x==y) return;
	
	if (rnk[x]<rnk[y]) par[x] = y;
	else {
		par[y] = x;
		if (rnk[x]==rnk[y]) rnk[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}

//----------------↑UnionFind↑----------------

int main() {
	cin >> n >> m;
	// 0〜n-1が人間、n〜n+m-1が言語
	init(n+m);
	rep(i,n) {
		cin >> k;
		rep(j,k) {
			cin >> l;
			unite(i, n+l-1);
		}
	}
	int r = find(0);
	reps(i,1,n) {
		if (find(i)!=r) {
			cout << "NO" << ln;
			return 0;
		}
	}
	cout << "YES" << ln;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int n;
	scanf("%d", &n);
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		int a;
		scanf("%d", &a);
		ans += i % 2 == 1 && a % 2 == 1;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 3836
N = int(input())
n = len(str(N))
if n == 1:
  print(N)
elif n == 2:
  print(9)
elif n == 3:
  print(N-90)
elif n == 4:
  print(909)
elif n == 5:
  print(N-9090)
else:
  print(90909)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long int ll;

int main() {
  int N;
  cin>>N;
  
  cout<<(N-1)/2<<endl;
}

Measured memory_bytes: 256
w, h, n = list(map(int, input().split(' ')))

points = []
for i in range(n):
    points.append(list(map(int, input().split(' '))))

mx = 0
my = 0
xx = w
xy = h
    
for point in points:
    if point[2] == 1 and mx < point[0]:
        mx = point[0]
    elif point[2] == 2 and xx > point[0]:
        xx = point[0]
    elif point[2] == 3 and my < point[1]:
        my = point[1]
    elif point[2] == 4 and xy > point[1]:
        xy = point[1]
        
a = xx - mx if xx - mx > 0 else 0
b = xy - my if xy - my > 0 else 0
print(a * b)


Measured memory_bytes: 3064
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
#include<set>
using namespace std;
using ll = __int64_t;
using lll = __int128_t;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;
const ll mod=1e9+7;



int main(void){
      int n;
      cin>>n;
      string s;
      cin>>s;
      int ok=0;
      int ng=n/2+1;
      string t;
      while(ng-ok>1){
            int pos=((ok+ng)>>1);
            bool good=false;
            for(int i=pos;i+pos<=n;i++){
                  if(i==pos){
                  t={};
                        for(int j=i;j<i+pos;j++){
                              t.push_back(s[j]);
                        }
                  }
                  else{
                        t.erase(t.begin());
                        t.push_back(s[i+pos-1]);
                  }
                  if(s.find(t)+pos<=i){
                        good=true;
                  }
            }
            if(good) ok=pos;
            else ng=pos;
      }
      cout<<ok<<endl;
      return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>

#include<queue>

using namespace std;


template<typename T> class Queue_FIFO
{
public:
	Queue_FIFO(int size)
	{
		m_Queue.clear();
		m_Queue.resize(size + 1);
		m_max = size + 1;
		
		// それぞれ存在する要素を指す
		m_head = 0;
		m_tail = size;
	}

	T& operator[](int index)
	{
		return m_Queue[index];
	}

	// 要素の追加
	bool Push(T element)
	{
		if (IsMax())
		{
			return false;
		}
		m_Queue[m_tail] = element;
		m_tail = (m_tail + 1) % m_max;
		return true;
	}

	// 要素の取得と削除
	T Pop()
	{
		int index = m_head;
		m_head = (m_head + 1) % m_max;
		return m_Queue[index];
	}

	int Size()
	{
		if (m_head > m_tail)
		{
			return m_head - m_tail;
		}
		return m_head + (m_max - m_tail);
	}

	bool IsEmpty()
	{
		return (m_head == m_tail) ? true : false ;
	}

private:

	bool IsMax()
	{
		return (m_head == (m_tail + 1) % m_max) ? true : false ;
	}

	vector<T> m_Queue;

	// 要素の先頭と最後尾を表すIndex
	int m_head;
	int m_tail;

	int m_max;
};

struct INFO
{
public:
	string name;
	int processTime;
	INFO()
	{
		name = "";
		processTime = 0;
	}
	INFO(string str, int time)
	{
		name = str;
		processTime = time;
	}
};

int main() {

	int n, q;
	cin >> n >> q;


	Queue_FIFO<INFO> vProcess(n);

	for (int i = 0; i < n; i++)
	{
		cin >> vProcess[i].name >> vProcess[i].processTime;
	}

	int totalTime = 0;
	vector<INFO> vResult;
	while (vProcess.IsEmpty() == false)
	{
		INFO tmp = vProcess.Pop();
		if (tmp.processTime <= q)
		{
			totalTime += tmp.processTime;
			// 処理完了
			cout << tmp.name << " " << totalTime << endl;
		}
		else
		{
			// 処理続行
			tmp.processTime -= q;
			totalTime += q;
			vProcess.Push(tmp);
		}
	}

	return 0;
}





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

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

  int sum1 = 0;
  for (int i = x; i <= n; i++)
  {
    sum1+=c[i];
  }

  int sum2 = 0;
  for (int i = x; i >= 0; i--)
  {
    sum2+=c[i];
  }
  cout << min(sum1,sum2) << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		TreeSet<Interval> smallSet1 = new TreeSet<Interval>(new Comparator<Interval>() {
		    public int compare(Interval i1, Interval i2) {
		        if (i1.right == i2.right) {
		            return i1.idx - i2.idx;
		        } else {
		            return i1.right - i2.right;
		        }
		    }
		});
		for (int i = 0; i < n; i++) {
		    smallSet1.add(new Interval(i, sc.nextInt(), sc.nextInt()));
		}
		TreeSet<Interval> largeSet1 = new TreeSet<Interval>(new Comparator<Interval>() {
		    public int compare(Interval i1, Interval i2) {
		        if (i1.left == i2.left) {
		            return i1.idx - i2.idx;
		        } else {
		            return i1.left - i2.left;
		        }
		    }
		});
		largeSet1.addAll(smallSet1);
		TreeSet<Interval> smallSet2 = (TreeSet<Interval>)smallSet1.clone();
		TreeSet<Interval> largeSet2 = (TreeSet<Interval>)largeSet1.clone();
		boolean isSmall = true;
		long total1 = 0;
		int current = 0;
		while (smallSet1.size() > 0) {
		    Interval target;
		    if (isSmall) {
		        target = smallSet1.pollFirst();
		        largeSet1.remove(target);
		    } else {
		        target = largeSet1.pollLast();
		        smallSet1.remove(target);
		    }
	        if (target.right < current) {
	            total1 += current - target.right;
	            current = target.right;
	        } else if (target.left > current) {
	            total1 += target.left - current;
	            current = target.left;
	        }
	        isSmall = !isSmall;
		}
		total1 += Math.abs(current);
		isSmall = false;
		long total2 = 0;
		current = 0;
		while (smallSet2.size() > 0) {
		    Interval target;
		    if (isSmall) {
		        target = smallSet2.pollFirst();
		        largeSet2.remove(target);
		    } else {
		        target = largeSet2.pollLast();
		        smallSet2.remove(target);
		    }
	        if (target.right < current) {
	            total2 += current - target.right;
	            current = target.right;
	        } else if (target.left > current) {
	            total2 += target.left - current;
	            current = target.left;
	        }
	        isSmall = !isSmall;
		}
		total2 += Math.abs(current);
	    System.out.println(Math.max(total1, total2));
	}
	
    static class Interval {
        int idx;
        int left;
        int right;
        
        public Interval(int idx, int left, int right) {
            this.idx = idx;
            this.left = left;
            this.right = right;
        }
        
        public int hashCode() {
            return idx;
        }
        
        public boolean equals(Object o) {
            Interval another = (Interval)o;
            return this.idx == another.idx;
        }
    }
}
	


Measured memory_bytes: 108936
// #define _CRT_SECURE_NO_WARNINGS
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cassert>
#include <unordered_set>
#include <set>

#define prev asasddlsa
#define rank aljds

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 1; i < n; i++){
        if (s[i] != s[i - 1])
            cnt++;
    }
    cout << cnt + 1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int itr=0;
  vector<char> p{1,2,3};
  vector<char> r{1,2,3};
  REP(i,3) cin >> p[i+1];
  REP(i,3) cin >> r[i+1];
  REP(i,3) {
    if(p[i+1]==r[i+1]) ++itr;
  }
  cout << itr << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	int N;
	cin >> N;
	vector<int> V(N);
	for(int i = 0; i < N; i ++)cin >> V[i];
	sort(all(V));
	ll ans1 = 0, ans2 = 0;
	if(N%2 == 0){
		ans1 += V[N / 2 - 1];
		for(int i = 0; i < N / 2; i ++){
			ans1 -= V[i] * 2;
		}
		ans1 -= V[N / 2];
		for(int i = N / 2; i < N; i ++){
			ans1 += V[i] * 2;
		}
	}
	else{
		ans1 += V[N / 2] + V[N / 2 - 1];
		for(int i = 0; i < N / 2 + 1; i ++){
			ans1 -= V[i] * 2;
		}
		for(int i = N / 2 + 1; i < N; i ++){
			ans1 += V[i] * 2;
		}
		for(int i = 0; i < N / 2; i ++){
			ans2 -= V[i] * 2;
		}
		ans2 -= V[N / 2] + V[N / 2 + 1];
		for(int i = N / 2; i < N; i ++){
			ans2 += V[i] * 2;
		}
	}
	cout << max(ans1, ans2) << endl;

	return 0;
}

Measured memory_bytes: 640
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val arr = readLine()!!.split(" ").map { it.toInt() }
    val sum = arr.sum()
    val cost = arrayOf(sum / arr.size, sum / arr.size + 1)
            .map {
                arr.map { x -> val d = x - it; d * d }.sum()
            }
            .min()
    println(cost)
}

Measured memory_bytes: 38136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String num = sc.nextLine();
		char[] work = new char[num.length()];
		int flag = 0;
	    for(int i = 0; i < num.length(); i++){
	    	if(num.charAt(i) == '7') {
	    		flag = 1;
	        }
	    }
	    if(flag == 1) {
	    	System.out.println("Yes");
	    }else {
	    	System.out.println("No");
	    }
	}
}


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

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

    vector<double> v(n);
    rep(i,n) cin>>v[i];
    sort(v.begin(),v.end());

    rep(i,n-1){
        v[i+1]=(v[i]+v[i+1])/2;
    }
    cout<<v[n-1]<<endl;
}

Measured memory_bytes: 256
/*

*/
#include<bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,a,n) for(int i=(a);i<(n);i++)
#define repe(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

int ans[10050];

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;
  cin>>n;
  rep2(i,1,105){
    rep2(j,1,105){
      rep2(k,1,105){
        int v=i*i+j*j+k*k+i*j+j*k+k*i;
        if(v<10050)ans[v]+=1;
      }
    }
  }
  rep(i,n)cout<<ans[i+1]<<endl;
}

Measured memory_bytes: 3604
//   https://atcoder.jp/contests/abc051/tasks/abc051_a


#include<stdio.h>            //AA06( 31/ 07/ 20) If u see my code, Have a Good Day! (^_^)
#define String_Length 19

int main()
{
    char S[String_Length + 1];

    scanf("%s", S);

    for(int i = 0; i < String_Length; ++i) {

        if(S[i] == ',')
            S[i] = ' ';

        printf("%c", S[i]);

    }

    return 0;
}


Measured memory_bytes: 1644
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N;
	scanf("%d",&N);
	puts(N%10==9||N/10==9?"Yes":"No");
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N = int(input())
h = list(map(int, input().split()))
res = 0
mh = max(h)
for i in range(mh * N + 1):
  x = N
  for j in range(N - 1):
    if h[j] > 0 and h[j + 1] > 0:
      x -= 1
  for j in range(N):
    if h[j] == 0:
      x -= 1
      continue
    h[j] -= 1
  #print(h)
  res += x
  if x == 0: break

print(res)


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

int main(void) {
	int A, B;
	string ans;
	scanf("%d %d", &A, &B);
	if (A > 9 || B > 9) {
		printf("%d", -1);
	} else {
		printf("%d", A * B);
	}

	return 0;
}

Measured memory_bytes: 256
#101c
import math

N,K = map(int, input().split()) #K<=100
A_list = list(map(int, input().split()))

if len(A_list) <= K:
    print("1") #十分に短ければ1回で塗れる
elif len(A_list)%(K-1)==1:
    print(math.ceil(len(A_list)/(K-1))-1) #余りなく丁度塗れる場合
elif K==2:
    print(len(A_list)-1)
else:
    print(math.ceil(len(A_list)/(K-1)))

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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
	int n, m;
	cin >> n >> m;

	int ans = 0, a;
	for(int i = 0;i < m;i++){
		cin >> a;
		ans += a;
	}

	cout << ((n-ans) >= 0 ? n-ans : -1) << endl;

	return 0;
}


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

#define get_variable_name(x) #x
#define debug(x) cout << #x << " = " << x << endl

#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())
#define REVERSE(x) reverse( (x).begin(),(x).end())
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define PW(x) (1LL<<(x))

using namespace std;
using ll = int64_t;
using P = pair<int, int>;

template<class T,class U>
ostream& operator<<(ostream &os, const pair<T, U> &p) {
    os << get_variable_name(p) << " = (" << p.first <<", " << p.second << ")";
    return os;
}

template<class T>
ostream& operator <<(ostream& os, const vector<T> &v){
    cout << get_variable_name(v) << " = [";
    for(auto i : v) 
        os << " " << v[i];
    os << " ]";
    return os;
}


const int INF = 1e8;

double G[1010][1010];


struct B {
    double x, y, r;

    B(double _x, double _y, double _r) :
        x(_x), y(_y), r(_r) {}
};

double dist(B a, B b) {
    double x = a.x - b.x;
    double y = a.y - b.y;
    return sqrt(x*x+y*y);
}

double calc(B a, B b) {
    return max(dist(a, b) - (a.r + b.r), 0.0);
}

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

    double sx, sy, gx, gy;
    cin >> sx >> sy >> gx >> gy;

    int N;
    cin >> N;

    vector<B> v;

    v.emplace_back(sx, sy, 0);
    v.emplace_back(gx, gy, 0);

    double x, y, r;
    for(int i = 0; i < N; i++) {
        cin >> x >> y >> r;
        v.emplace_back(B(x, y, r));
    }

    for(int i = 0; i < v.size(); i++) {
        for(int j = 0; j < v.size(); j++) {
            G[i][j] = calc(v[i], v[j]);
        }
    }


    for(int k = 0; k < v.size(); k++) {
        for(int i = 0; i < v.size(); i++) {
            for(int j = 0; j < v.size(); j++) {
                G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
            }
        }
    }

    printf("%.10lf\n", G[0][1]);
}



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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n,k;
	cin>>n>>k;
	vector<int> a(n);
	rep(i,n)cin>>a[i];

	vector<int> dp(k+1, false);

	rep(i,k+1){
		int res=1;
		rep(j,n){
			if(i-a[j]<0)continue;
			res &= dp[i-a[j]];
		}
		if(res!=1)dp[i]=1;
	}


	cout<<(dp[k]>0?"First":"Second")<<endl;
	return 0;
}

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

int gcd(ll x, ll y){
    int tmp;
    if(x < y){
        tmp = x;
        x = y; 
        y = tmp;
    }

    while(true){
        int r = x % y;
        if(r == 0) return y;
        x = y;
        y = r;
    }
}

int main(){
    ll X, Y;
    cin >> X >> Y;
    cout << gcd(X, Y) << endl;
}



Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;


int main(){
    fast_io

    int n;
    cin>>n;
    double ans;

    if(n==1) ans=1.0;
    else if(n%2==0){
        ans=(double)1/2;
    }
    else{
        ans=(double)((n+1)/2)/n;
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
    return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int H = sc.nextInt();
            int N = sc.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextInt();
            }

            for (int i = 0; i < N; i++) {
                H -= A[i];
            }

            if (H <= 0) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }

}


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

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    int64_t sum = 0;
    for(int i = 1; i <= n; i++){
        if(i % 3 != 0 && i % 5 != 0){
            sum += i;
        }
    }
    pr(sum);
    return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

template <class T>
istream& operator>>(istream& input, vector<T>& v) {
    for (T& i : v) cin >> i;
    return input;
}

int main() {
    ll cnt = 0;
    vector<ll> A(3);
    cin >> A;
    if (all_of(A.begin(), A.end(), [A](ll a){ return a == A[0] && !(a & 1); })) cout << -1 << endl;
    else {
        while (all_of(A.begin(), A.end(), [](ll a) { return !(a & 1); })) {
            vector<ll> tmp({(A[1] + A[2]) / 2, (A[0] + A[2]) / 2, (A[0] + A[1]) / 2});
            A.swap(tmp);
            cnt++;
        }
        cout << cnt << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) find(Range(c), x) != c.end()
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, vs, n, m) vector<vector<T>> vs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]

using namespace std;
using ll = long long;

int main(void){
    unordered_map<string, int> a;
    a["clownpiece_is_kawaii"] = 0;
    Cin(int, n);
    For(i, n){
        Cin(string, s);
        a[s] ++;
    }
    Cin(int, m);
    For(i, m){
        Cin(string, s);
        a[s] --;
    }
    vector<int> b(n+m); int i = 0;
    for(auto e : a) b[i ++] = e.second;
    DeSort(b);
    Cout(b[0]);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define FOr(i,x,y)  for(ll i=x;i>=y;--i)
#define For(i,x,y)	for(ll i=x;i<=y;++i)
using namespace std;
namespace SHENZHEBEI{
#ifdef LOCAL
	struct szb{	szb(){	freopen("shenzhebei.in","r",stdin);	}	}shenzhebei;
#endif
#define NEG 1
	const int L=2333333;
	char SZB[L],*S=SZB,*T=SZB;
	inline char gc(){	if (S==T){	T=(S=SZB)+fread(SZB,1,L,stdin);	if (S==T) return '\n';	}	return *S++;	}
#if NEG
	inline ll readint(){	ll x=0,f=1;	char ch=gc();	for (;!isdigit(ch);ch=gc())	if (ch=='-') f=-1;	for (;isdigit(ch);ch=gc())	x=x*10-48+ch;	return x*f;	}
	inline void write(ll x){	if (x<0)	putchar('-'),x=-x;	if (x>=10)	write(x/10);	putchar(x%10+'0');	}
#else
	inline ll readint(){	ll x=0;	char ch=gc();	for (;!isdigit(ch);ch=gc());	for (;isdigit(ch);ch=gc())	x=x*10-48+ch;	return x;	}
	inline void write(ll x){	if (x>=10)	write(x/10);	putchar(x%10+'0');	}
#endif
	inline char readchar(){	char ch=gc();	for(;isspace(ch);ch=gc());	return ch;	}
	inline ll readstr(char *s){	char ch=gc();	int cur=0;	for(;isspace(ch);ch=gc());		for(;!isspace(ch);ch=gc())	s[cur++]=ch;	s[cur]='\0';	return cur;	}
	inline void writeln(ll x){	write(x);	puts("");	}
}using namespace SHENZHEBEI;
const ll N=510;
ll mp[N][N],mp1[N][N],mp2[N][N],ned[N][N],vis[N][N],n,m;
char s[N];
void print(ll mp[N][N]){
	For(i,1,n){
		For(j,1,m)	putchar(mp[i][j]?'#':'.');
		puts("");
	}
}
int main(){
	n=readint();	m=readint();
	For(i,1,n){
		readstr(s+1);
		For(j,1,m)	mp[i][j]=s[j]=='#';
	}
	For(i,1,n)	For(j,1,m){
		if (mp[i][j])	mp1[i][j]=mp2[i][j]=1;
		else	if (i<n&&j<m&&(!(i&1)||(i==1||j==1)))	mp1[i][j]=1;
		else	mp2[i][j]=1;
	}print(mp1);	puts("");	print(mp2);
}

Measured memory_bytes: 11008
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5;
priority_queue<double,vector<double>,greater<double> >q;
int main()
{
    int n;
    scanf("%d",&n);
    double x,y;
    for(int i=1;i<=n;i++)
        scanf("%lf",&x),q.push(x);
    for(int i=1;i<n;i++)
    {
        x=q.top();q.pop();
        y=q.top();q.pop();
        q.push((x+y)/2);
    }
    printf("%f",q.top());
    return 0;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
  input! {
    n: usize,
    a: [u64; n],
  };
  
  let mut count_even = 0;
  let mut count_odd = 0;
  for x in a {
    if x % 2 == 0 {
      count_even += 1
    } else {
      count_odd += 1
    }
  }
  
  println!("{}", if count_odd % 2 == 0 { "YES" } else { "NO" });
  
}

Measured memory_bytes: 3692
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;

const int MAXN = 200000 + 5;

int N, X, Y, answer;
vector<int> rAdj[MAXN], bAdj[MAXN];
int fa[MAXN], dep[MAXN];

class noSolution : std::exception
{

};

void findBlueFa(int cur, int pre) noexcept
{
	fa[cur] = pre;

	for (int to : bAdj[cur])
		if (to != pre)
			dep[to] = dep[cur] + 1, findBlueFa(to, cur);
}

bool isShortPath(int u, int v) noexcept
{
	if (dep[u] < dep[v])
		swap(u, v);

	for (int len = 0; len < 2; len++)
	{
		if (u == v)
			break;

		if (dep[u] < dep[v])
			v = fa[v];
		else
			u = fa[u];
	}
	return (u == v);
}

void DFS(int cur, int pre = -1, int constrain = 0) //throw (solution)
{
	answer = max(answer, dep[cur]);
	if(dep[cur] <= constrain)
		return;

	for(int to : rAdj[cur])
	{
		if(to == pre)
			continue;
		if(!isShortPath(cur, to))
			throw noSolution();
		DFS(to, cur, constrain + 1);
	}
}

int main()
{
	int u, v;
	scanf("%d%d%d", &N, &X, &Y);
	for(int i = 1; i < N; i++)
		scanf("%d%d", &u, &v), rAdj[u].push_back(v), rAdj[v].push_back(u);
	for(int i = 1; i < N; i++)
		scanf("%d%d", &u, &v), bAdj[u].push_back(v), bAdj[v].push_back(u);

	findBlueFa(Y, 0);

	try
	{
		DFS(X);
		printf("%d\n", answer * 2);
	}
	catch (noSolution & x)
	{
		printf("-1\n");
	}

	return 0;
}


Measured memory_bytes: 32252
#include <bits/stdc++.h>
 
#define ll long long
#define pb push_back
//#define f first
//#define s second
//#define mp make_pair
#define gg return 0;
#define pii pair < int, int>
 
using namespace std;
 
const int maxn = 132675;
const int INF = (int)1e9 + 7;
 
ll a,b[maxn],c,d,cnt,e[(int)2e3 + 1][(int)2e3 + 1],cost[maxn],tout[maxn],mn = INF,mx = -INF,l,r;
 
ll x[maxn],y[maxn],x2[maxn],y2[maxn];
 
ll kol;

bool u[maxn], m, f;

set <int> s; 

 /*
void forn( int s, int f, int inter){
	for(int i = s; i <= f; i += inter){
		b[i] = i;
	}
}
*/ 
ll ans;

vector <int> primev; 

/*
void dfs(int v){
	lvlc++;
	lvl[v] = lvlc;
	d[lvl[v]].pb(v);
	u[v] = 1;
	for(int i = 0; i < g[v].size(); ++i){
		int to = g[v][i];
		if(!u[to]){
			dfs(to);
		}
	}
	lvlc--;
}*/

bool prime[45001];

char ch;


void find_divs( int n) {
   	int dlim, m = 1;
  	s.insert(1);
  	int op = n;
   	dlim = sqrt( n );
   	for(int d = 2; d <= dlim; ++d){
      if (n % d == 0){
         s.insert(m * d);
         if( m*d != n/d )
            s.insert(n/d);
         n /= d;
         m *= d;
         dlim = sqrt( n );
      }
   }
}

int main()
{	
    cin >> a >> c >> d;
    for(int i = 1; i <= a; ++i){
    	cin >> b[i];
    }
    for(int i = 1; i < a; ++i){
    	cnt += min((b[i + 1] - b[i]) * c,d);
    }
    cout << cnt;
	gg
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

int dp[100000];
vector<vector<int>> G;

int rec(int n) {
  if (dp[n] != -1) return dp[n];
  int res = 0;
  for (auto nv : G[n]) {
    res = max(res, rec(nv) + 1);
  }
  return dp[n] = res;
}

int main() {
  int N, M;
  cin >> N >> M;
  G.assign(N, vector<int>());
  for (int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    G[x].push_back(y);
  }
  for (int i = 0; i < N; i++) {
    dp[i] = -1;
  }
  int result = 0;
  for (int i = 0; i < N; i++) {
    result = max(result, rec(i));
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 8192
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE RankNTypes #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
-- import Data.List
-- import qualified Data.Vector.Unboxed as VU
-- import qualified Data.Vector.Unboxed.Mutable as VUM
-- import Control.Monad
-- import Control.Monad.ST
-- import Debug.Trace
-- trace _ = id

solve :: Int -> Int -> Int -> Int
solve a b c = min c (b `div` a)


readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> Int
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_a,bs_b,bs_c]:remLines1 = remLines0
      a = readBInt bs_a
      b = readBInt bs_b
      c = readBInt bs_c
  in solve a b c

outAnswer :: Int -> IO ()
outAnswer = putStrLn . show

main :: IO ()
main = outAnswer . tmain =<< B.getContents


-------------------------------------------------------------------------------

inp1 = "2 11 4\n"
inp2 = "3 9 5\n"
inp3 = "100 1 10\n"
tv1 = tmain $ B.pack inp1
tv2 = tmain $ B.pack inp2
tv3 = tmain $ B.pack inp3
test1 = tv1 == 4
test2 = tv2 == 3
test3 = tv3 == 0
alltest = test1 && test2 && test3



Measured memory_bytes: 380