akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    for (int i = 0; i < s.length(); i++) {
        s[i] += n;
        if (s[i] > 'Z') s[i] -= 26;
        cout << s[i];
    }
}


Measured memory_bytes: 3668
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    multiset<int> se;
    rep(i, N) {
        auto it = se.lower_bound(A[i]);
        if(it == se.begin()) {
            se.insert(A[i]);
        } else {
            it--;
            se.erase(se.find(*it));
            se.insert(A[i]);
        }
    }
    cout << se.size() << endl;
    return 0;
}

Measured memory_bytes: 5376
#!/usr/bin/env python3
#ABC121 D

A,B = map(int,input().split())

if A % 2 == 0 and B % 2 == 0:
    s = 1
elif A % 2 == 0 and B % 2 == 1:
    s = 2
elif A % 2 == 1 and B % 2 == 0:
    s = 3
elif A % 2 == 1 and B % 2 == 1:
    s = 4
if s == 1:
    if ((B - A)/2) % 2 == 1:
        print(1^B)
    else:
        print(0^B)
elif s == 2:
    if ((B - A+1)/2) % 2 == 1:
        print(1)
    else:
        print(0)
elif s == 3:
    if ((B - A-1)/2) % 2 == 1:
        print(A^1^B)
    else:
        print(A^B)
else:
    if ((B - A)/2) % 2 == 1:
        print(A^1)
    else:
        print(A^0)


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

using namespace std;

#define pb push_back
#define sz(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define mem(a) memset(a,0,sizeof(a))
#define all(x) x.begin(),x.end()
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, int> pli;

const int mn = 3005;
const int mod = 1e9 + 7;
#define P mod

int n,m;

const string ss="snuke";

int main() {
    //cin.sync_with_stdio(0);
#ifdef trote
    freopen("../1.txt", "r", stdin);
    freopen("../out.txt", "w", stdout);
#endif
    cin>>n>>m;
    string s;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>s;
            if (s==ss) printf("%c%d",'A'+j-1,i);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <cmath>
#include <algorithm>
#include <map>
#include <list>
#include <cstdlib>

using namespace std;

typedef pair<pair<int, int>, int> P;
#define T_MAX 64
#define P_MAX 16

map<vector<int>, int> cost;

class C_Team{
private :
	int penalty;
	int correct;
	int wrong[P_MAX];
public :
	C_Team();
	void Submit(int time, int pID, bool result);
	int GetCorrect() { return correct; }
	int GetPenalty() { return penalty; }
};

int main()
{
	while(1) {
		// <<正答数, ペナルティ>, ID>
		pair<pair<int, int>, int> info[T_MAX];
		C_Team team[T_MAX];
		int t, p, r;
		cin >> t >> p >> r;
		if(!t && !p && !r) break;
		for(int i = 0; i < r; i++) {
			int tid, pid, time;
			string message;
			cin >> tid >> pid >> time >> message;
			team[tid].Submit(time, pid, message == "CORRECT");
		}
	
		for(int i = 1; i <= t; i++) {
			info[i].first.first = -team[i].GetCorrect(); // sortは昇順なのでマイナス
			info[i].first.second = team[i].GetPenalty();
			info[i].second = i;
		}

		sort(info+1, info+t+1);
		for(int i = 1; i <= t; i++) {
			cout << info[i].second << " " << -info[i].first.first << " " << info[i].first.second << endl;
		}
	}
	return 0;
}

C_Team::C_Team() {
	correct = 0;
	penalty = 0;
	for(int i = 0; i < P_MAX; i++) {
		wrong[i] = 0;
	}
}

void C_Team::Submit(int time, int pID, bool result) {
	if(result) {
		correct++;
		penalty += wrong[pID] * 1200 + time;
	} else {
		wrong[pID]++;
	}
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl '\n'
#define pb push_back
#define PI 3.14159265
int M = 1000000007;
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  cout << (1000 - n % 1000) % 1000;
}


Measured memory_bytes: 3660
#include <stdio.h>
int main(){
int now,temp;
char c[10];
scanf("%d",&now);
while(true){
scanf("%s",c);
if(c[0]=='=')break;
scanf("%d",&temp);
if(c[0]=='+')now+=temp;
else if(c[0]=='-')now-=temp;
else if(c[0]=='*')now*=temp;
else now/=temp;
}
printf("%d\n",now);
}


Measured memory_bytes: 2700
# coding:utf-8

def inpl(): return list(map(int, input().split()))

h, w = inpl()
A = []
for i in range(h):
    a = list(input())
    A.append(a)

rows = [False for _ in range(h)]
for i in range(h):
    if A[i] != ['.' for _ in range(w)]:
        rows[i] = True

B = list(map(list, zip(*A)))[:]  # map(list, zip(* A))としておかないとタプル型になってしまう
cols = [False for _ in range(w)]
for i in range(w):
    if B[i] != ['.' for _ in range(h)]:
        cols[i] = True

ans = []
for i in range(h):
    if rows[i]:
        tmp = []
        for j in range(w):
            if cols[j]:
                tmp.append(A[i][j])
        if tmp:
            ans.append(tmp)

for i in range(len(ans)):
    print(''.join(ans[i]))

Measured memory_bytes: 3316
from itertools import product
h,w,k=map(int,input().split())
M=[input() for i in range(h)]
ans=0
for m in M:
    ans+=m.count('#')
H=[]
W=[]
for i in range(h):
    H.append(M[i].count('#'))
for i in range(w):
    cnt=0
    for j in range(h):
        if M[j][i]=='#':
            cnt+=1
    W.append(cnt)

a=0
for A in product([0,1],repeat=h):
    for B in product([0,1],repeat=w):
        ANS=ans
        for i in range(h):
            if A[i]==1:
                ANS-=H[i]
        for j in range(w):
            if B[j]==1:
                ANS-=W[j]

        for i in range(h):
            for j in range(w):
                if M[i][j]=='#' and A[i]==1 and B[j]==1:
                    ANS+=1

        if ANS==k:
            a+=1

print(a)

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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const ll INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n, m; cin >> n >> m;
    vi K(n), P(m);
    vvi S(m, vi(n+1));
    rep(i,m){
        cin >> K[i];
        rep(j,K[i]) cin >> S[i][j];
    }
    rep(i,m) cin >> P[i];

    ll ans = 0;
    rep(i,1<<n){
        int light = 0;
        rep(j,m){
            int cnt = 0;
            rep(k,K[j]){
                int s = S[j][k] - 1;
                if(i>>s & 1) cnt++;
            }
            if(cnt % 2 == P[j]) light++;
        }
        if(light == m) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for(ll i=0;i<n;i++)
#define revf(i,n) for(ll i=n-1;i>=0;i++)
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep1(i,b) for(ll i=1;i<=b;i++)
#define inp(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define outp(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" "
#define outp1(a,n) for(ll i=1;i<n;i++)cout<<a[i]<<" "
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (((a)*(b))/gcd((a),(b)))
#define pb push_back
#define mp make_pair
#define mem(x,n) memset(x,n,sizeof(x))
#define BINSC binary_search
#define BITOUT __builtin_popcount
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define test ll t; cin>>t; while(t--)
#define cn cout<<"\n";
int main()
{
     fast;
     ll n;
     cin>>n;
     char ar[n];
     ll r=0,w=0;
     forr(i,n)
     {
          cin>>ar[i];
          if(ar[i]=='R')
          r++;
          else
          w++;
     }
     if(w==0)
     cout<<0;
     else
     {
          ll k=0;
          ll w1=w,i=n-1;
          while(w1--)
          {
               if(ar[i]=='R')
               k++;
               i--;
          }
          cout<<min(k,w);
     }
     cn
}

Measured memory_bytes: 3860
import math
N, M = map(int, input().split())

if abs(N - M) >= 2:
    ans = 0

elif N == M:
    ans = 2 * math.factorial(N) * math.factorial(M)

elif abs(N - M) == 1:
    ans = math.factorial(N) * math.factorial(M)

print(ans % (10**9 + 7))

Measured memory_bytes: 5100
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;

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

		while(true){
			final int n = sc.nextInt();
			
			if(n == 0){
				break;
			}
			
			HashMap<String, HashSet<String>> groups = new HashMap<String, HashSet<String>>();
			
			String first_key = null;
			
			for(int i = 0; i < n; i++){
				String[] in = sc.next().split(":");
				String[] press = in[1].split("[,.]");
				
				if(i == 0){
					first_key = in[0];
				}
				
				HashSet<String> set = new HashSet<String>();
				for(String str : press){
					if("".equals(str)){
						continue;
					}
					set.add(str);
				}
				
				groups.put(in[0], set);
			}
			
			HashSet<String> counting = new HashSet<String>(groups.get(first_key));
			
			LinkedList<String> put = new LinkedList<String>();
			while(true){
				boolean mod = false;
				put.clear();
				
				for(Iterator<String> iter = counting.iterator(); iter.hasNext(); ){
					String in = iter.next();
					
					if(groups.containsKey(in)){
						mod = true;
						iter.remove();
						for(String str : groups.get(in)){
							put.add(str);
						}
					}
				}
				
				if(!mod){
					break;
				}else{
					counting.addAll(put);
				}
			}
			
			System.out.println(counting.size());
		}
		
	}

}

Measured memory_bytes: 52064
A = int(input())
B = int(input())
C = int(input())
X = int(input())
answer = 0
for i in range(A+1):
	for j in range(B+1):
		for k in range(C+1):
			if X == 500*i + 100*j + 50*k:
				answer+=1
print(answer)


Measured memory_bytes: 3060
#include<stdio.h>
#include<iostream>
#include<fstream>
#include<string>
#include<stdlib.h>
#include<math.h>
using namespace std;

//int main() {
//	int x = 0;
//
//	std:: cin >> x;
//
//	if (x < 1 || x > 9) {
//		std::cout << "error" << std::endl;
//	}
//	else if (x == 3 || x == 5 || x == 7) {
//		std::cout << "YES" << std::endl;
//	}
//	else {
//		std::cout << "NO" << std::endl;
//	}
//
//}

int main() {
	int x = 0;
	int x2 = 0;
	int count = 0;
	int X = 753;
	int ans = 0;
	int ans2 = 0;
	char *s = new char[10];

	cin >> s;

	for (int i = 0; i < 10; i++) {
		if (s[i] == NULL) {
			break;
		}
		else{
			count++;
		}
	}

	if (count < 4) {
		cout << "error" << endl;
		return 0;
	}

	for (int i = 0; i < count - 2; i++) {
		x = (s[i] - '0') * 100;
		x += (s[i + 1] - '0') * 10;
		x += (s[i + 2] - '0');
		ans = X - x;
		if (ans < 0) {
			ans = -ans;
		}
		else {
		
		}
		if (i == 0) {
			ans2 = ans;
		}
		else {
			if (ans2 > ans) {
				ans2 = ans;
			}
		}
	//	cout << x2 << endl;
	}

	cout << ans2 << endl;

}


Measured memory_bytes: 256
def main():
    """http://drken1215.hatenablog.com/entry/2019/03/03/224600
    """
    N, M=map(int, input().split())
    A, B =[],[]
    for i in  range(M):
        a,b=map(int, input().split())
        A.append(a-1)
        B.append(b-1)
        
    uf=UnionFind(N)
    cur = N * (N-1) // 2
    res =[]
    for a,b in zip(A[::-1],B[::-1]):
        res.append(cur)

        if uf.issame(a, b):
            continue
        
        sa, sb = uf.size(a),  uf.size(b)
        cur -= sa * sb
        uf.merge(a, b)

    print(*res[::-1], sep="\n")


class UnionFind:
    def __init__(self, n):
        self.par = [-1] * n
    # void init(int n) { par.assign(n, -1); }

    def root(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]
    
    def issame(self, x, y):
        return self.root(x) == self.root(y)
    
    def merge(self, x, y):
        x, y = self.root(x), self.root(y)
        if x == y: return False
        if self.par[x] > self.par[y]:
            x, y = y, x # merge technique
        self.par[x] += self.par[y]
        self.par[y] = x
        return True
    
    def size(self, x):
        return -self.par[self.root(x)]

if __name__ == "__main__":
    main()


Measured memory_bytes: 19128
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
	long long N, K;
	cin >> N >> K;
	vector<long long>A(N);
	for (long long i = 0; i < N; i++) {
		cin >> A.at(i);
	}
	long long ans = 9000000007;
	for (long long i = 0; i < N - K + 1; i++) {
		long long dis = min(abs(0 - A.at(i + K - 1)), abs(0 - A.at(i)));
		dis += abs(A.at(i + K - 1) - A.at(i));
		if (ans > dis)ans = dis;
	}
	cout << ans << endl;

}

Measured memory_bytes: 1024
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

struct SegmentTree {
private:
    int n;
    vi node;

public:
    SegmentTree(vi v) {
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, INT_MAX);
        REP(i,sz) node[i+n-1] = v[i];
        REPN(i,n-2) node[i] = min(node[2*i+1], node[2*i+2]);
    }
    void update(int k, int x){
        k += n-1;
        node[k] = x;
        while(k){
            k = (k-1)/2;
            node[k] = (node[2*k+1] + node[2*k+2]);
        }
    }
    int getsum(int a, int b, int k=0, int l=0, int r=-1){
        if(r<0) r=n;
        if(r<=a || b<=l) return 0;
        if(a<=l && r<=b) return node[k];
        return ( getsum(a,b,2*k+1,l,(l+r)/2) + getsum(a,b,2*k+2,(l+r)/2,r) );
    }
    int get(int k){
        return node[k+n-1];
    }

    void clear(){
        node = vi(2*n-1);
    }
};

int N;
vi a,b;
const int ofs = 100001;
SegmentTree st(vi(200010,0));


bool med(int cand){
    vi c(N+1);
    st.clear();

    FOR(i,1,N+1)
        c[i] = c[i-1] + (a[i-1] < cand ? -1 : 1); 

    int nat = 0;
    st.update(c[0]+ofs, st.get(c[0]+ofs)+1);
    FOR(i,1,N+1){
        nat += st.getsum(0,c[i]+ofs+1);
        st.update(c[i]+ofs, st.get(c[i]+ofs)+1);
    }
    cerr << nat << " " << (N*(N+1)/2)/2 <<  endl;
    return nat >= (N*(N+1)/2)/2;
}

signed main(){
    I(N);
    a.resize(N);
    REP(i,N) I(a[i]);

    b = a;
    sort(all(b));
    uniq(b);

    int lo = 0;
    int hi = sz(b);

    while(lo+1 < hi)
        if( med(b[(lo+hi)/2]) ){
            lo = (lo+hi)/2;
        } else {
            hi = (lo+hi)/2;
        }

    cout << b[lo] << endl;
}

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




int main(){

	int n,x,y;
	cin>>n>>x>>y;
	x -= 1;
	y -= 1;
	vector<vector<int> > graph(n);
	for(int i=0;i<n-1;i++){
		graph[i].push_back(i+1);
		graph[i+1].push_back(i);
	}
	graph[x].push_back(y);
	graph[y].push_back(x);
	vector<int> ans(n);
	vector<int> dist(n);
	vector<int> visited(n);
	queue<pair<int,int> > que;
	
	for(int j=0;j<n;j++){
		for(int i=0;i<n;i++)
			visited[i] = 0;
		for(int i=0;i<n;i++)
			dist[i] = n+10;
		dist[j] = 0;
		que.push(make_pair(j,0));
		//dist[x] = 0;
		while(!que.empty()){
			pair<int,int> a = que.front();
			que.pop();
			if(visited[a.first])
				continue;
			visited[a.first] = 1;
			//que.pop();
			//cout<<"============================="<<endl;
			dist[a.first] = min(dist[a.first],a.second + 1);
			for(int i=0;i<graph[a.first].size();i++){
				que.push(make_pair(graph[a.first][i],dist[a.first]));
			}
		}
		for(int i=0;i<n;i++){
			int b = dist[i];
			ans[b] += 1;
		}
	}
	for(int i=1;i<=n-1;i++){
		cout<<ans[i]/2<<endl;
	}
	
	
	
	return 0;
  
}

Measured memory_bytes: 384
#include<bits/stdc++.h> 
using namespace std;
 
int main(){
 
  long long n,d;
  cin >> n>> d;
  long double x[n][d];
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++)cin >> x[i][j];
  }
 
  long long s=0;
 
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      long double t=0;
      for(int k=0;k<d;k++)t+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      t=sqrt(t);
      if(abs(t-floor(t))<0.00001)s++;
    }
  }
  cout << s << endl;
 
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
    cin>>a>>b;
    if(a>0)
        cout<<"Positive";
    else if(a==0||(a<0&&b>0))
        cout<<"Zero";
    else if((abs(b)-abs(a))%2!=0)
        cout<<"Positive";
    else
        cout<<"Negative";
    return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline

def main():
    S = input().strip()
    mi = len(S)
    for c in set(S):
        s = list(S)
        n = 0
        while len(set(s)) > 1:
            for i in range(len(s)-1):
                if s[i+1] == c:
                    s[i] = c
            s.pop()
            n += 1
        mi = min(mi, n)
    print(mi)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
/*Template by hemnath_d(Enlightened by chamow)*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec vector<ll>
#define pll pair<ll,ll>
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fx first
#define sx second
#define inf 100000000000000
#define minf -100000000000000
#define maxi 100005

int main()
{
    fastread;
    int n;
    cin>>n;
    int ans = 0;
    for(int i = 0; i < n; i++) {
    	int x;
    	cin>>x;
    	if(i % 2 == 0 && x % 2 == 1) {
    		ans++;
    	}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
namespace Contest
{
    class Program
    {

        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            List<int> q = new List<int>();
            for (int i = 0; i < n; i++)
            {
                q.Add(int.Parse(input[i]));
            }
            int result = 0;
            int res = 0;
            for(int i = 0; i < n - 1; i++)
            {
                if(q[i] >= q[i + 1])
                {
                    res++;
                }
                else
                {
                    if(res > 0 && result < res)
                    {
                        result = res;
                    }
                    res = 0;
                }
            }
            if (res > 0 && result < res)
            {
                result = res;
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 27612
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,i,k=0,m;
    cin>>a>>b>>c;
    for(i=1;i<=a;i++)
    {
        cin>>m;
        if(m<b||m>=c)
            k++;
    }
    cout<<k<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
void bubbleSort(int[],int);
int main()
{
    int N;
    int arr[101];
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&arr[i]);
    }
    bubbleSort(arr,N);
    return 0;
}
void bubbleSort(int arr[],int N)
{   
    int count=0;
    bool flag = 1;
    while(flag){
        flag = 0;
        for(int i=N-1;i>0;i--){
            if(arr[i]<arr[i-1]){
                int hoge;
                hoge=arr[i];
                arr[i]=arr[i-1];
                arr[i-1]=hoge;
                flag = 1;
                count++;
            }
        }
    }
    for(int j=0;j<N;j++){
        if(j>0) printf(" ");
        printf("%d",arr[j]);
    }
    printf("\n%d\n",count);
    return;
}


Measured memory_bytes: 2740
extern crate core;

use std::io::{self, Read};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = run(input.trim().to_string());
    println!("{}", output);
}

fn run(input: String) -> String {
    let list = input
        .split_whitespace()
        .map(|x| x.parse::<i64>().unwrap())
        .collect::<Vec<_>>();
    let x = list[0];
    let y = list[1];
    if x % y == 0 {
        return "-1".to_string();
    }
    let mut i = 1;
    loop {
        let n = x * i;
        if n > 1000000000000000000 {
            return "-1".to_string();
        }
        if n % y != 0 {
            return n.to_string();
        }
        i += 1;
    }
}

#[test]
fn test() {
    let tests = vec![("8 6", "8"), ("3 3", "-1"), ("6 3", "-1"), ("3 6", "3")];
    for (i, (input, output)) in tests.into_iter().enumerate() {
        println!("test:{}", i);
        assert_eq!(run(input.to_string()), output.to_string());
    }
}


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

int X, Y, Z;
int V[10];
int e_flag[55], e_value[55];
double dp[55][5500];

int main() {
    while (true) {
        cin >> X >> Y >> Z;
    
        if (X==0 && Y==0 && Z==0) {
            break;
        }
    
        for (int i=0; i<X; i++) {
            cin >> V[i];
        }
    
        for (int i=0; i<=Y; i++) {
            e_flag[i] = -1;
        }
    
        for (int i=0; i<Z; i++) {
            int Ni, Ei, Ai; cin >> Ni >> Ei >> Ai;
            e_flag[Ni] = Ei;
            e_value[Ni] = Ai;
        }
    
        for (int i=0; i<55; i++) {
            for (int j=0; j<5500; j++) {
                dp[i][j] = 0;
            }
        }
    
        dp[0][0] = 1;
    
        for (int i=0; i<Y; i++) {
            for (int j=0; j<5500; j++) {
                for (int k=0; k<X; k++) {
                    int to = i+V[k];
                    
                    if (to>Y) {
                        to = Y;
                    }
                    
                    if (e_flag[to]==-1) {
                        dp[to][j] += dp[i][j]/X;
                    }
                    else if (e_flag[to]==1) {
                        to += e_value[to];
                        
                        if (to>Y) {
                            to = Y;
                        }
                        
                        dp[to][j] += dp[i][j]/X;
                    }
                    else if (e_flag[to]==2 && j+e_value[to]<5500) {
                        dp[to][j+e_value[to]] += dp[i][j]/X;
                    }
                    else if (e_flag[to]==3) {
                        dp[to][max(0, j-e_value[to])] += dp[i][j]/X;
                    }
                }
            }
        }
    
        double ans = 0;
    
        for (int i=0; i<5500; i++) {
            ans += dp[Y][i]*i;
        }
        
        cout << (int)ans << endl;
    }
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int A, B; cin >> A >> B;
  Yes((A*B)&1);

    return 0;
}


Measured memory_bytes: 256
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include "boost/multi_array.hpp"
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) begin(x),end(x)
using namespace std;
template<class T=int> using P  = pair<T, T>;
template<class T=int> using V  = vector<T>;
template<class T=int> using PQ = priority_queue<T>;
template<class T=int> using PQG = priority_queue<T, V<T>, greater<T>>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) int __VA_ARGS__; in(__VA_ARGS__)
//オーバーフロー対策
#define INL(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
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 (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define next asdnext
#define prev asdprev
#pragma endregion RegionDefs

void solve()
{
    string s; cin >> s;
    V<tuple<bool,ll>> v;
    char c = s[0];
    ll count = 1L;
    reps(i, 1, s.size())
    {
        if (c == s[i]) count++;
        else
        {
            v.emplace_back(c == '<', count);
            count = 1L;
            c = s[i];
        }
    }
    v.emplace_back(c == '<', count);
    ll sum = 0;
    int i = 0;
    if (!get<0>(v[0]))
    {
        i++;
        ll a = get<1>(v[0]);
        sum += a * (a + 1) / 2;
    }
    for (; i+1 < v.size(); i += 2)
    {
        ll a = get<1>(v[i]);
        ll b = get<1>(v[i+1]);
        sum += max(a, b) * (max(a, b) + 1) / 2 + min(a, b) * (min(a, b) - 1) / 2;
    }
    if (s.size() > 1 && (get<0>(v[0]) && v.size() % 2 == 1) || (!get<0>(v[0]) && v.size() % 2 == 0))
    {
        ll a = get<1>(v.back());
        sum += a * (a + 1) / 2;
    }
    cout << sum << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 7316
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

int32_t main()
{
	IO_OP;
	
	int n, k, ans = 0;
	cin >> n >> k;
	while(n--) {
		int t;
		cin >> t;
		if(t >= k) ans++;
	}
	cout << ans << endl;
	
}





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

using namespace std;

const double PI  = 3.141592653589793238463;

int main()
{
    double a, b, x;
    cin>>a>>b>>x;
    x = x/a;

    // bottom of triangle when the water split
    double dui, lin, ans;

    if(x <= (a * b / 2))
    {
        dui = x * 2 / b;
        lin = b;

        ans = atan(dui/lin) * 180 / PI;

    }
    else
    {
        dui = a;
        lin = 2*(a * b - x)/a;

        ans = atan(dui/lin) * 180 / PI;
    }

    cout<<setprecision(10)<<90 - ans;

    return 0;
}


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

int main()
{
  int maney;
  cin >> maney;
  int happy = 0;
  happy += int(maney/500)*1000;
  maney = maney % 500;
  happy += int(maney/5)*5;
  cout << happy << endl;
  return 0;
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N - 1; i >= 0; i--)
const ll INF = 1000000000;
//const ll MOD = 1000000007;
const ld PI = (acos(-1));
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
typedef pair<int, int> P;
double rad(double a) {return a * 180 / PI;}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//dpTable
int dp[100050];

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    rep (i,N) cin >> S.at(i);
    vector<vector<int>> cnt(N,vector<int>(26,0));
    rep (i,N) {
        rep (j,S.at(i).size()) {
            cnt.at(i).at(S.at(i).at(j) - 'a')++;
        }
    }
    vector<int> ans(26,100000000);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 26; j++) {
            ans.at(j) = min(ans.at(j),cnt.at(i).at(j));
        }
    }
    for (int i = 0; i < 26; i++) {
        for (int j = 0; j < ans.at(i); j++) {
            cout << (char)(i + 'a');
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using P = pair<int,int>;
using ll = long long;
const int MOD = 1000000007;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> an(n);
  for(int i=0; i<n; ++i) cin >> an[i];
  if(n == k){
    ll ans = 1;
    for(int i=0; i<n; ++i){
      ans *= an[i];
      ans %= MOD;
    }
    if(ans<0) ans += MOD;
    cout << ans << endl;
    return 0;
  }
  sort(an.begin(),an.end());
  reverse(an.begin(),an.end());
  if(k == 1){
    cout << an[0] << endl;
    return 0;
  }
  if(an[0] <0 && k%2){
    ll ans =1;
    for(int i=0; i<k; ++i){
      ans *= an[i];
      ans %= MOD;
    }
    if(ans <0)ans += MOD;
    cout << ans << endl;
    return 0;
  }
  
  vector<P> minus(0);
  int r = an.size() -1;
  while(r > 0 && an[r] < 0 && an[r-1] < 0){
    minus.push_back(make_pair(an[r],an[r-1]));
    r -= 2;
  }
  
  ll ans = 1;
  int l = 0;
  r = 0;
  for(int i=0; i<k; ++i){
    ll h1, h2;
    if(l<n-1 && an[l] >0 && an[l+1] >0) h1 = (ll)an[l] *an[l+1];
    else h1 = 0;
    if(r < (int)minus.size()) h2 = (ll)minus[r].first * minus[r].second;
    else h2 = 0;
    //cout << h1 << "&" << h2 << endl;
    
    if(i == k-1 || (h1 == 0 && h2 == 0)){
      ans *= an[l];
      ans %= MOD;
      ++l;
    }
    else if(h1 > h2){
      ans *= an[l];
      ans %= MOD;
      ans *= an[l+1];
      ans %= MOD;
      l += 2;
      ++i;
    }
    else{
      ans *= minus[r].first;
      ans %= MOD;
      ans *= minus[r].second;
      ans %= MOD;
      ++r;
      ++i;
    }
    //cout << ans << endl;
  }
  if(ans <0) ans += MOD;
  cout << ans << endl;
}

Measured memory_bytes: 5032
import sys

input = sys.stdin.readline
alp = [chr(i) for i in range(97, 97+26)]

N = int(input().rstrip())
output = ""
x = 0

while N > 26:
    output = alp[N%26 - 1] +output
    if N%26 ==0:
      N = N//26 -1
    else:
      N = N//26
output = alp[N- 1] + output
print(output)

Measured memory_bytes: 9192
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

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

int main(){

  int n,i,k;
  scanf("%d",&n);
  long int a[n],b[n],suma,sumb,dif[n];
  long int mi,pu;
  
  mi=0;
  pu=0;

  suma=0;
  sumb=0;
  
  for(i=0;i<n;i++){
    scanf("%ld",&a[i]);
  }
  
    for(i=0;i<n;i++){
    scanf("%ld",&b[i]);
  }
  
    for(i=0;i<n;i++){
    suma=suma+a[i];
    sumb=sumb+b[i];
    dif[i]=a[i]-b[i];
  }
  
  if(sumb>suma)
    printf("-1");
  
  else {
    qsort(dif, n, sizeof(long int), compare_int);
         
    for(i=0;i<n;i++){
      if(dif[n-1-i]<0){
        mi=mi+dif[n-1-i];
        k=k+1;
      }
      else 
        break;
    }
    
    for(i=0;i<n;i++){
      if(mi!=0){
      pu=pu+dif[i];
      k=k+1;
     if(pu>=-mi)
        break;
      }
      if(mi==0)
        break;

 
     
      

    }
    printf("%d",k);
  }

    

}


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

int main(){

    while(1){
        int n; cin >> n;
        if(!n) break;
        double pw; cin >> pw;
        vector<double> vw(n);
        vector<double> pf(n);
        vector<double> vf(n);
        vector<double> th(n);
        for(int i = 0; i < n; i++){
            cin >> vw[i] >> pf[i] >> vf[i] >> th[i];
        }

        double ans;
        double l = 0.0, r = 1000.0;

        while(r - l >= 0.00000000001){

            double p1 = (r + 2*l) / 3;
            double p2 = (2*r + l) / 3;

            //cout << l << " " << r << " " << p1 << " " << p2 << endl;            

            double cost1 = (double)(p1 * pw);
            double cost2 = (double)(p2 * pw);
            
            for(int i = 0; i < n; i++){
                double F1 = (double)((th[i] - p1 * vw[i]) / vf[i]);
                double F2 = (double)((th[i] - p2 * vw[i]) / vf[i]);
                F1 = max(F1, 0.0);
                F2 = max(F2, 0.0);
                
                
                cost1 += (double)(F1 * pf[i]);
                cost2 += (double)(F2 * pf[i]);                                                
            }


            if(cost1 < cost2) r = p2;
            else l = p1;

            ans = cost1;
        }

        printf("%.4f\n", ans);
    }

    return 0;
}


Measured memory_bytes: 6052
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

int dp[100009];

int func(int arr[] , int n , int curr , int k){

	if(curr >= n){

		return 0;
	}

	if(curr == n-1)
		return 0;

	if(dp[curr] !=-1)  return dp[curr];

	int ans = INT_MAX;

	for(int i=1; i<=k; i++) {

		if(curr + i <n){

		int temp = func(arr , n , curr+i , k);
		if(temp!=-1)
			ans = min(ans , abs(arr[curr] - arr[curr+i])  + temp);
		}
	}

	

	if(ans == INT_MAX)
		ans = -1;

	dp[curr] = ans;
	return ans;

}

void solve(){

    int n,k,b,c, ans=0, count=0, sum=0;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++){
      cin>>arr[i];
    }
    fill(dp , -1);
    ans = func(arr , n , 0 , k);
    cout<<ans<<endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  
  int * h = new int[N];
  int * m = new int[N];
  for(int i=0;i<N;i++){
    cin >> h[i];
  }
  m[0] = 0;
  
  for(int i=1;i<N;i++){
    for(int j=1;j<=K;j++){
      if( i - j < 0 ) continue;
      if( j == 1 ){
        m[i] = m[i-j] + abs(h[i-j]-h[i]);
      } else {
        m[i] = min(m[i],m[i-j]+abs(h[i-j]-h[i]));
      }
    }
  }
  
  cout << m[N-1] << endl;
  return 0;
}


Measured memory_bytes: 1024
H,W,N = map(int,input().split())
sr,sc = map(int,input().split())
S = input()[::-1]
T = input()[::-1]

l = 1
r = W
u = 1
d = H

for i in range(N):
    if T[i] == 'L':
        r = min(W,r+1)
    elif T[i] == 'R':
        l = max(1,l-1)
    elif T[i] == 'U':
        d = min(H,d+1)
    else:
        u = max(1,u-1)
    if S[i] == 'L':
        l = l+1
    elif S[i] == 'R':
        r = r-1
    elif S[i] == 'U':
        u = u+1
    else:
        d = d-1
    if r < l or d < u:
        print('NO')
        break
else:
    if l <= sc <= r and u <= sr <= d:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 3888
void main() {
	auto N = readAs!ulong;
	int[] C;
	long res;
	foreach(i; 0..N) {
		auto ip = readAs!(int[]), A = ip[0], B = ip[1];
		res -= B;
		C ~= A + B;	
	}
	C.sort!"a > b"();
	foreach(i; iota(0, N, 2)) {
		res += C[i];
	}
	res.writeln;
}


// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 3452
n,m=map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(n)]+[[100000000,0]]
for i in range(m):ab.append([i+1,0])
ab.sort()
from heapq import heappop,heappush
h=[]
j=0
ans=0
for i in range(1,m+1):
  while ab[j][0]<=i:
    heappush(h,-ab[j][1])
    j+=1
  ans-=heappop(h)
print(ans)

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

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

using ll = long long;

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

int main() {
  ll H, W,x,y;
  cin >> W >> H>>x>>y;
  double ans = ((double)H/2)*W;
  cout<<fixed<<setprecision(5);
  cout<<ans<<" ";
  if(x*2==W&&y*2==H)cout<<1<<endl;
  else cout<<0<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vdo=vector<double>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vvdo=vector<vector<double>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using pqin=priority_queue<int>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
int main()
{
    int n,m;
    cin>>n>>m;
    vin k(m);
    vvin s(m,vin(n));
    vin p(m);
    rep(i,m){
        cin>>k[i];
        rep(j,k[i])cin>>s[i][j];
    }
    rep(i,m)cin>>p[i];
    int ans=0;
    rep(i,1<<n){
        bitset<11> tmp(i);
        bool can=true;
        rep(j,m){
            int sum=0;
            rep(l,k[j]){
                if(tmp.test(s[j][l]-1))sum++;
            }
            if(sum%2!=p[j]){
                can=false;
                break;
            }
        }
        if(can)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define S 2010
using namespace std;
using ll = int64_t;
ll imos[510][510];
int main(){
    ll N, M, Q;
    cin >> N >> M >> Q;
    for(ll i = 0; i < M; i++){
        ll l, r;
        cin >> l >> r;
        imos[0][r]++;
        imos[l + 1][r]--;
    }
    for(ll i = 1; i < 510; i++) for(ll j = 0; j < 510; j++) imos[i][j] += imos[i - 1][j];
    for(ll i = 0; i < 510; i++) for(ll j = 1; j < 510; j++) imos[i][j] += imos[i][j - 1];
    for(ll i = 0; i < Q; i++){
        ll p, q;
        cin >> p >> q;
        cout << imos[p][q] << endl;
    }
    return 0;
}


Measured memory_bytes: 2944
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String colorNumber = "Three";
    int a = 0;
    for(int i = 0; i < N; i++){
      String str = sc.next();
      if(str.equals("Y")) a = 1;
      if(a == 1){
        colorNumber = "Four";
        break;
      }
    }
    System.out.println(colorNumber);
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
using namespace std;

typedef long long ll;

string s;
int cnt[3], t[3];

int main() {
	cin >> s;
	for (int i = 0; i < (int)s.length(); ++i) ++cnt[s[i] - 'a'];
	int mi = cnt[0], ma = cnt[0];
	for (int i = 0; i < 3; ++i) {
		mi = min(mi, cnt[i]);
		ma = max(ma, cnt[i]);
	}
	if (ma - mi <= 1) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).begin(),(x).rend()

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;

int main(){
	int n,q;
	cin>>n>>q;
	string s;
	cin>>s;

	vi a(n+1,0);
	for (int i = 0; i < n; ++i){
		if(i+1<n&&s[i]=='A'&&s[i+1]=='C')
			a[i+1]=a[i]+1;
		else
			a[i+1]=a[i];
	}

	for (int i = 0; i < q; ++i){
		int l,r;
		cin>>l>>r;
		cout<<a[r-1]-a[l-1]<<endl;
	}

	return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<map>
#include<limits>
#include<cmath>
#include<tuple>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cerr << v[a][b] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

vector<pair<ll ,ll> > v;

int main()
{
	int n,k;
	unsigned long long ans = numeric_limits<unsigned long long>::max();
	//cout << ans << endl;
	cin >> n >> k;
	
	REP(i,n)
	{
		ll a,b;
		cin >> a >> b;
		v.PB(MP(a,b));
	}
	
	for(int i = 0;i < n;i++)
	{
		for(int j = 0;j < n;j++)
		{
			for(int ii = 0;ii < n;ii++)
			{
				for(int jj = 0;jj < n;jj++)
				{


					if(i == j && j == ii && ii == jj)continue;
			
					ll x1 = min(v[jj].FI,min(v[ii].FI,min(v[i].FI,v[j].FI)));
					ll x2 = max(v[jj].FI,max(v[ii].FI,max(v[i].FI,v[j].FI)));
					ll y1 = min(v[jj].SE,min(v[ii].SE,min(v[i].SE,v[j].SE)));
					ll y2 = max(v[jj].SE,max(v[ii].SE,max(v[i].SE,v[j].SE)));
			
					int tmp = 0;
			
					REP(q,n)
					{
						ll xx = v[q].FI;
						ll yy = v[q].SE;
						if(xx < x1 || xx > x2 || yy < y1 || yy > y2)continue;
						tmp++;
					}
			
					if(tmp >= k)
					{
						unsigned long long xxx = x2 - x1;
						unsigned long long yyy = y2 - y1;
						unsigned long long hika = xxx * yyy;
					//	cout << hika << endl;
						ans = min(ans,hika);
					}
				}
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256