akhauriyash/Code-Regression huggingface dataset:
/*Bismillahir Rahmanir Rahim*///{
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace std; using __gnu_cxx::power;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1; const double eps = 1e-6, ldeps = 1e-9;
struct Dbg { static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto dud(C *x)->decltype(os << *x, 0);
template<class C> static char dud(...);
template<class C> typename enable_if<sizeof dud<C>(0)!=1,Dbg&>::type operator<<(const C &x) {os<<x; return *this;}
template<class C> Dbg &dump(C b, C e) {
    for (struct{C i;int j;} i={(*this<<"\n[",b),0}; i.i!=e and i.j<26; i.i++, i.j++) *this<<", "+2*(i.i==b)<<*i.i;
    return *this << ']';
}
template<class C> typename enable_if<sizeof dud<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    return dump(begin(x), end(x));
}
template<class C, size_t X> typename enable_if<!is_same<C, const char>::value, Dbg&>::type operator<<(C (&x)[X]) {
    return dump(begin(x), end(x));
}
template<class B, class C> Dbg &operator<<(const pair<B, C> &x) {return *this<<'{'<<x.first<<", "<<x.second<<'}';}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(#args), args), dbg << endl
#define cbug(a, args...) if (a) bug(args);
#define ASSERT(a, o, b, args...) if (!((a)o(b))) bug(a, b, ##args), assert((a)o(b));
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int T, Q, cn;//}
const int inf = 1000000007, mxn = -1;

inline int floorSqrt(const ll &x) {
    int ret = int(sqrt(x))+1;
    while (ret*ll(ret)>x) ret--;
    return ret;
}

map<ll, int> p;
void factorize(ll x) {
    int sr = floorSqrt(x);
    for (int i = 2; i <= sr; i++) {
        while (!(x%i)) {
            p[i]++;
            x /= i;
        }
    }
    if (x>1) p[x]++;
}

signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout.precision(11), cout.setf(ios::fixed);
    ll n;
    cin >> n;
    factorize(n);
    ll ans = 0;
    for (auto &i : p) {
        int x = i.second, tmp = 0;
        for (int j = 1; j <= x; j++) {
            tmp += j;
            if (tmp > x) break;
            ++ans;
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 3700
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

int c[30];
signed main(void)
{
  string s;
  cin >> s;
  REP(i, s.size()) {
    c[s[i]-'a']++;
  }
  int a = -1, ret = INF;
  REP(i, 26) {
    if(c[i] == s.size()) {
      cout << 0 << endl;
      return 0;
    }
  //cout << i << endl;
    string t = s;
    string tt = "";
    for(int j=t.size()-1; j>=1; --j) {
      for(int k=0; k<j; ++k) {
        //cout << j << " " << k << endl;
        if(t[k] == (char)('a' + i) || t[k+1] == (char)('a'+i)) {
          tt += (char)('a' + i);
        } else {
          tt += 'A';
        }
      }
    //  cout << tt << endl;
      bool flag = true;
      REP(k, j) {
        if(tt[k] != (char)('a' + i)) flag = false;
      }
      if(flag) {
        ret = min(ret, (int)s.size()-j);
        break;
      }
      //cout << t << " " << tt << endl;
      t = tt;
      tt = "";
    }
  //  cout << "ret" << ret << endl;
  }
  cout << ret << endl;
  //cout << s.size() << " " << a << endl;
  //c/out << ((int)s.size() - a)/2 + !!(((int)s.size() - a)%2) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>			//std::cout, std::cin
#include <string>			//std::string,std::to_string(C++11)
#include <vector>			//std::vector
#include <valarray>			//std::valarray
#include <algorithm>		//std::sort
#include <ctime>			//localtime_s
#include <cstdlib>			//abs
#include <cmath>			//abs,std::pow,sqrt,sin,cos,round,floor,ceil
#include <fstream>			//std::ifstream,std::ofstream
#include <iomanip>			//std::setprecision,std::setw,std::setfill
#include <random>			//std::random(C++11)
#include <numeric>			//std::accumulate
#include <functional>		//std::greater
#include <chrono>			//std::chrono(C++11)
#include <bitset>			//std::bitset
#include <queue>			//std::queue

const static double	de_PI	= 3.14159265358979323846;
const static int	de_MOD	= 1000000007;
const static int	de_MAX	= 999999999;

int main(void) {

	//std::ifstream in("123.txt");	std::cin.rdbuf(in.rdbuf());
	//std::ofstream ofs("456.csv");
	//std::chrono::system_clock::time_point t_st = std::chrono::system_clock::now();

	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			std::cout << i << "x" << j << "=" << i*j << std::endl;
		}
	}


	//std::chrono::system_clock::time_point t_ed = std::chrono::system_clock::now();
	//std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(t_ed - t_st).count() << "ms" << std::endl;

}

Measured memory_bytes: 3044
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <limits>
#include <algorithm>
#include <queue>
#include <vector>
#include <numeric>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <tuple>
#include <cassert>

#ifndef IO_H
#define IO_H

#include <cstdio>
#include <limits>

namespace {

class TokenizeReader {
public:
  TokenizeReader() = delete;
  TokenizeReader(FILE* file, int buffer_len);
  ~TokenizeReader();
  void Read(char* s, size_t& len, int max_len = std::numeric_limits<int>::max());
  bool HasNext();
  int NextInt();
private:
  bool EnsureRead();
  bool IsInValidCharacter(int c);

  FILE* file_;
  char* buffer_;
  int buffer_len_, pos_, read_n_;
  bool end_ = false;
};

TokenizeReader::TokenizeReader(FILE* file, int buffer_len)
  : file_(file), buffer_len_(buffer_len), pos_(0), read_n_(0) {
  buffer_ = new char[buffer_len_];
}

TokenizeReader::~TokenizeReader() {
  delete buffer_;
}

void TokenizeReader::Read(char *s, size_t &len, int max_len) {
  len = 0;
  while (EnsureRead() && IsInValidCharacter(buffer_[pos_])) pos_++;
  while ((int) len < max_len && EnsureRead()
      && !IsInValidCharacter(buffer_[pos_])) {
    s[len++] = buffer_[pos_++];
  }
}

bool TokenizeReader::HasNext() {
  static size_t unused;
  Read(nullptr, unused, 0);
  return EnsureRead();
}

int TokenizeReader::NextInt() {
  static char buf[21];
  size_t len;
  int value;
  Read(buf, len, 20);
  if (len == 0) throw -1;
  buf[len] = 0;
  sscanf(buf, "%d", &value);
  return value;
}

bool TokenizeReader::EnsureRead() {
  if (pos_ < read_n_) {
    return true;
  } else if (end_) {
    return false;
  }
  read_n_ = ::fread(buffer_, 1 /* size */, buffer_len_, file_);
  pos_ = 0;
  end_ = read_n_ == 0;
  return !end_;
}

bool TokenizeReader::IsInValidCharacter(int c) {
  return c == ' ' || c == '\t' || c == '\n' || c == EOF;
}

}

#endif  // IO_H

namespace {

#define for_each_test_cases(T, BUFFSIZE)            \
  TokenizeReader reader(::stdin, BUFFSIZE);         \
  int T;                                            \
  scanf("%d", &T);                                  \
  for (int cas = 1; cas <= T; cas++)

}  // namesapce

int sqr(int x) {
  return x * x;
}

int n;

int main() {
  while (scanf("%d", &n) == 1) {
    printf("%d\n", sqr((int) sqrt(n)));
  }
  return 0;
}



Measured memory_bytes: 256
N = int(input())
A = [0] + list(map(int,input().split())) + [0]
s = 0
for i in range(1,N+2):
  s += abs(A[i]-A[i-1])
for i in range(1,N+1):
  print(s- abs(A[i]-A[i-1])- abs(A[i+1]-A[i])+ abs(A[i+1]-A[i-1]))

Measured memory_bytes: 14560
#include <iostream>
using namespace std;
static const int MAX=100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n,M[MAX][MAX];

int prim(){
    int u, minv;
    int d[MAX],p[MAX],color[MAX];

    for(int i=0; i<n; i++){
        d[i] = INFTY;
        p[i]= -1;
        color[i] = WHITE;
    }

    d[0]=0;

    while(1){
        minv = INFTY;
        u =-1;
        for (int i = 0; i < n; ++i) {
            if(minv>d[i] && color[i] !=BLACK){
                u=i;
                minv=d[i];
            }

        }

        if(u==-1) break;
        color[u]=BLACK;
        for (int v = 0; v < n; ++v) {
            if(color[v]!=BLACK && M[u][v]!=INFTY){
                if(d[v]>M[u][v]){
                    d[v]=M[u][v];
                    p[v]=u;
                    color[v]=GRAY;
                }
            }
        }
    }
    int sum=0;
    for (int i = 0; i < n; ++i) {
        if(p[i]!=-1) sum+=M[i][p[i]];
    }

    return sum;
}

int main(){
    cin>>n;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            int e;
            cin>>e;
            M[i][j] = (e==-1) ? INFTY : e;
        }
    }

    cout<<prim()<<endl;
    return 0;
}


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

int main() {
	int N;
	bool answer = true;
	cin >> N;
	vector<long long> vec(N); 
	for (int i = 0; i < N; i++) {
    	cin >> vec.at(i);
	}

	long long b = -1;

	for (int i = 0; i < N-1; i++) {
		long long a = 0;
    	a = vec.at(i+1) - vec.at(i);
    	if(a <= -2) answer = false;
    	if(a == -1) {
    		if(b==-1) b = vec.at(i);
    		else if(b > vec.at(i)){
    			answer = false;
    		}
    		else if(b < vec.at(i)){
    			b = vec.at(i);
    		}
    	}

	}

	if(answer==true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

std::vector<int> MPAlgorithm(const std::string& str)
{
	std::vector<int> ret(str.size() + 1);
	ret[0] = -1;
	for (int i{}; i < (int)str.size(); i++)
	{
		int prev{ret[i]};
		while (prev >= 0 && str[prev] != str[i]) prev = ret[prev];
		ret[i + 1] = prev + 1;
	}
	return std::move(ret);
}

int main()
{
	std::string T, P;
	std::cin >> T >> P;
	auto mp{MPAlgorithm(P)};
	for (int i{}, length{}; i < (int)T.size(); i++)
	{
		while (length >= 0 && T[i] != P[length]) length = mp[length];
		length++;
		if (length != (int)P.size()) continue;
		printf("%d\n", i - length + 1);
		length = mp[length];
	}

	return 0;
}


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

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

  vector<int> v(n);
  rep(i,m) {
    int a,b;
    cin >> a >> b;
    v.at(a-1)++;
    v.at(b-1)++;
  }

  rep(i,n)
    cout << v.at(i) << endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
int main(int argc, char const *argv[]) {
  string s;
  cin >> s;
  int n = s.size() / 2;
  int m = count(s.begin(), s.end(), 'p');
  cout << n - m << endl;
  return 0;
}


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

int main(){
  int N, M;
  while(cin>>N>>M, !(N==0&&M==0)){
    vector<int> h, w;
    h.push_back(0); w.push_back(0);
    int mx=0;
    for(int i=0; i<N; i++){
      int tmp;
      cin>>tmp;
      h.push_back(tmp+mx);
      mx+=tmp;
    }
    mx=0;
    for(int i=0; i<M; i++){
      int tmp;
      cin>>tmp;
      w.push_back(tmp+mx);
      mx+=tmp;
    }
    sort(h.begin(), h.end());
    sort(w.begin(), w.end());
    vector<int> diff_h, diff_w;
    for(int i=0; i<h.size()-1; i++)
      for(int j=i+1; j<h.size(); j++)
	diff_h.push_back(h[j]-h[i]);
    for(int i=0; i<w.size()-1; i++)
      for(int j=i+1; j<w.size(); j++)
	diff_w.push_back(w[j]-w[i]);
    sort(diff_h.begin(), diff_h.end());
    sort(diff_w.begin(), diff_w.end());
    int ans=0;
    for(int i=0; i<diff_h.size(); i++)
      ans+=distance(lower_bound(diff_w.begin(), diff_w.end(), diff_h[i]), upper_bound(diff_w.begin(), diff_w.end(), diff_h[i]));
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 22076
#include<bits/stdc++.h>
#define MOD(x) ((x)>=mod?(x)-mod:(x))
using namespace std;
const int maxn=500010, inf=1e9, mod=1e9+7;
struct poi{int x, v;}q[maxn];
int n;
int l[maxn], r[maxn], f[maxn], pos[maxn];

bool operator < (poi a, poi b){return a.x<b.x;}

inline bool cmp(int a, int b){return q[a].v<q[b].v;}

int main()
{
	scanf("%d", &n);
	for(int i=1;i<=n;i++) scanf("%d%d", &q[i].x, &q[i].v);
	sort(q+1, q+1+n); for(int i=1;i<=n;i++) pos[i]=i;
	sort(pos+1, pos+1+n, cmp);
	for(int i=1;i<=n;i++) l[pos[i]]=r[pos[i]]=i;
	for(int i=2;i<=n;i++) r[i]=max(r[i], r[i-1]);
	for(int i=n-1;i;i--) l[i]=min(l[i], l[i+1]);
	sort(l+1, l+1+n); sort(r+1, r+1+n);
	f[0]=1;
	for(int i=1, j=0, ans=1;i<=n;i++)
	{
		while(j<l[i]-1) ans=MOD(ans-f[j]+mod), j++;
		f[r[i]]=MOD(f[r[i]]+ans);
		ans=MOD(ans+ans);
	}
	printf("%d\n", f[n]);
}

Measured memory_bytes: 9344
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce

from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import statistics
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
def lcm(a, b):
  return a*b//gcd(a, b)

def main():
  N = int(readline())
  A = list(map(int, readline().split()))
  ans = 0
  for j in range(N):
    i = A[j]
    while i%2==0:
      i //= 2
      ans += 1
  print(ans)
  
  
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 15432
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int a, b;
    while(cin >> a >> b)
        cout << (a + b) << endl;
    return 0;
}

Measured memory_bytes: 0
H, W, K = map(int, input().split(" "))
matrix = [list(input()) for _ in range(H)]

# 全探索
ans = 0
for i in range(1 << H):
    for j in range(1 << W):
        black = 0
        for h in range(H):
            for w in range(W):
                if i >> h & 1:
                    continue
                if j >> w & 1:
                    continue
                if matrix[h][w] == "#":
                    black += 1
        if black == K:
            ans += 1
print(ans)

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

using namespace std;

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

typedef long long ll;
typedef long double ld;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int a, b, m;
    cin >> a >> b >> m;
    int res = 0;
    vector<int> f(a), e(b), sf(a), se(b);
    rep (i, a) {
        cin >> f[i];
        sf[i] = f[i];
    }
    rep (i, b) {
        cin >> e[i];
        se[i] = e[i];
    }
    sort(sf.begin(), sf.end());
    sort(se.begin(), se.end());
    res = sf[0] + se[0];
    
    rep (i, m) {
        int x, y, c;
        cin >> x >> y >> c;
        int tmp = f[x - 1] + e[y - 1] - c;
        res = min(res, tmp);
    }
    cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 1792
#include <stdio.h>
 
int main(){
     
    int a, b, c, i, j, k;
    int A[100][100], B[100][100];
    long int C[100][100], hoge = 0;
     
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
     
    for(i = 0; i < a; ++i){
        for(j = 0; j < b; ++j){
             
            scanf("%d",&A[i][j]);
        }
    }
     
    for(i = 0; i < b; ++i){
        for(j = 0; j < c; ++j){
             
            scanf("%d",&B[i][j]);
        }
    }
     
     
    for(i = 0; i < a; ++i){
        for(j = 0; j < c; ++j){
            for(k = 0; k < b; ++k){
                 
                hoge += (A[i][k] * B[k][j]);
            }
            C[i][j] = hoge;
            hoge = 0;
        }
    }
     
    for(i = 0; i < a; ++i){
        for(j = 0; j < c; ++j){
             
            if(j == 0){
                printf("%ld",C[i][j]);
            }
            else{
                printf(" %ld",C[i][j]);
            }
        }
        printf("\n");
    }
     
    return 0;
}



Measured memory_bytes: 2112
// https://atcoder.jp/contests/abc161/tasks/abc161_e

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#if DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

const int N_MAX = 2*1e5;

int N, K, C;
string S;

vector<int> dp_l;
vector<int> dp_r;

int main() {
  cin >> N >> K >> C;
  cin >> S;

  int D = C + 1;
  dp_l = vector<int>(N);
  REP(i, N) {
    dp_l[i] = (i - D >= 0 ? dp_l[i - D] : 0) + (S[i] == 'o');
    if (i > 0) dp_l[i] = max(dp_l[i], dp_l[i - 1]);
  }
  dp_r = vector<int>(N);
  for (int i = N - 1; i >= 0; i--) {
    dp_r[i] = (i + D < N ? dp_r[i + D] : 0) + (S[i] == 'o');
    if (i < N - 1) dp_r[i] = max(dp_r[i], dp_r[i + 1]);
  }

  REP(i, N) {
    int w = 0;
    if (i > 0) w += dp_l[i - 1];
    if (i < N - 1) w += dp_r[i + 1];
    if (w < K) cout << (i + 1) << endl;
  }
}


Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
#define e1 first
#define e2 second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false)
#define eb emplace_back
#define OUT(x) {cout << x; exit(0); }
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define scanf(...) scanf(__VA_ARGS__)?:0
typedef long long int ll;
typedef unsigned long long ull;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair <PLL, int> PLLI;
typedef pair <PLL, PLL> PP;
typedef pair <PII, int> PPI;
typedef pair <ll, int> PLI;
typedef unsigned int ui;
const int mod = 1000000;
const int inf = 1e9+9;
const ll MOD = 1e9+696969;
const long long INF = 1e18+3;
const int maxn = 100010;
int tab[4][maxn], des[4][maxn];
int t[maxn], n;
bool ok[2];
ll ileswaps[2];

ll dr[maxn];

void add(int p, int v) {
	for (; p < maxn; p += p & (-p)) dr[p] += v;
}

ll get(int p) {
	int ret = 0;
	for (; p > 0; p -= p & (-p)) ret += dr[p];
	return ret;
}

ll getInversions(int tp) {
	ll ret = 0;
	for (int i=n; i>0; --i)
		if (i % 2 == tp) {
			ret += get(abs(t[i]));
			add(abs(t[i]), 1);
		}
	
	for (int i=n; i>0; --i)
		if (i % 2 == tp) add(abs(t[i]), -1);
	return ret;
}

int main()
{
	boost;
	cin >> n;
	FOR(j, 1, 3)
		FOR(i, 1, n) cin >> des[j][i];
	
	FOR(i, 1, n)
	{
		if (des[2][i] % 3 != 2) OUT("No");
		t[i] = (des[2][i] + 1)/3;
		if (abs(des[2][i] - des[1][i]) != 1) OUT("No");
		if (abs(des[2][i] - des[3][i]) != 1) OUT("No");
		if (des[1][i] + 1 != des[2][i]) t[i] = -t[i];
	}
	
	//FOR(i, 1, n) cout << t[i] << ' ';
	FOR(i, 1, n)
	{
		int el = abs(t[i]);
		if (i % 2 != el % 2) OUT("No");
	}
	
	FOR(i, 1, n)
	{
		if (t[i] < 0) ok[i % 2] ^= 1;
	}
	
	ileswaps[0] = getInversions(0);
	ileswaps[1] = getInversions(1);
	
	ok[1] ^= (ileswaps[0] % 2);
	ok[0] ^= (ileswaps[1] % 2);
	if (ok[0] || ok[1]) cout << "No\n";
	else cout << "Yes\n";
}


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

using namespace std;

int main(){
    string S;

    cin >> S;

    bool ok =true;
    if(S.size()%2 == 1){
        cout << "No" << endl;
        return 0;
    }
    for(int i = 0; i < S.size()-1; i= i+2){
        if(S.at(i)=='h' && S.at(i+1)=='i'){
            continue;
        }else{
            ok = false;
            break;
        }
    }
    if(ok){

    
    cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))

    L=int(readline())


    print((L/3)**3)


    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
char S[99];
ll i, j, k;
int main(){
    scanf("%s", &S);
    j = 7;
    for (i = 0; S[i];i++){
        if(S[i]=='x'){
            j--;
        }
    }
    if(j<0){
        printf("NO");
    }else{
        printf("YES");
    }

        return 0;
}

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    ll A, B, Q;
    std::cin >> A >> B >> Q;

    vector<ll> S(A + 2), T(B + 2);
    S[0] = -LINF;
    T[0] = -LINF;
    S[A + 1] = LINF;
    T[B + 1] = LINF;
    REP(i, A) {
        std::cin >> S[i + 1];
    }
    REP(i, B) {
        std::cin >> T[i + 1];
    }

    REP(i, Q) {
        ll x;
        std::cin >> x;
        auto s_itr = lower_bound(ALL(S), x);
        auto t_itr = lower_bound(ALL(T), x);

      ll ans = LINF;
        ans = min(ans, x - min(*(s_itr - 1), *(t_itr - 1)));
        ans = min(ans, x - *(s_itr - 1) + *t_itr - *(s_itr - 1));
        ans = min(ans, x - *(t_itr - 1) + *s_itr - *(t_itr - 1));
        ans = min(ans, *s_itr - x + *s_itr - *(t_itr - 1));
        ans = min(ans, *t_itr - x + *t_itr - *(s_itr - 1));
        ans = min(ans, max(*s_itr, *t_itr) - x);
        std::cout << ans << std::endl;
    }

    return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int k,s;
	cin>>k>>s;
	int ans=0;
	rep(x,k+1)rep(y,k+1){
		int z=s-x-y;
		if(0<=z && z<=k){
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using CHY72;

namespace CHY72{
    
    public class PointXY<T>where T:IComparable {
        public T X , Y;
        public bool Flag = false;
        public PointXY(T _X,T _Y) {
            X = _X; Y = _Y;
        }
        public static bool operator ==(PointXY<T> P1, PointXY<T> P2) {
            return (P1.X.CompareTo( P2.X) == 0 && P1.Y.CompareTo (P2.Y) == 0);
        }
        public static bool operator !=(PointXY<T> P1, PointXY<T> P2) {return !(P1 ==P2);}
        public override int GetHashCode() {return X.GetHashCode() ^ Y.GetHashCode();}
        public override bool Equals(object obj) {
            if (obj == null || this.GetType() != obj.GetType()) {return false;}
            return (this == (PointXY<T>)obj);
        }         

    }
    
}    

public class Program {
    static bool ReadLine_1(ref int num1, bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str);
        return (Fin0 && num1 == 0);
    }
    static int  ReadLine_1() {
        return  int.Parse(Console.ReadLine());
    }
    static bool ReadLine_2(ref int num1, ref int num2, char Spliter = ' ', bool Fin0 = true) {
        string str = Console.ReadLine();
        num1 = int.Parse(str.Split(Spliter)[0]);
        num2 = int.Parse(str.Split(Spliter)[1]);
        return (Fin0 && num1 == 0);
    }
    static int[] ReadLine72(char Spliter = ' ') {
        return Console.ReadLine().Split(Spliter).Select(s => int.Parse(s)).ToArray();
    }

    const int DefaultMax = 727272;

    static bool isPrime(int p) {
        if (p!= 2 && p % 2 == 0) return false;
        int SQp = (int)(Math.Sqrt(p));
        for (int i = 3; i <= SQp; i++) {
            if (p % i == 0) return false;
        }
        return true;
    } 

    static void Main(string[] args) {
        while (true) {
            int n = ReadLine_1();
            if (n == 0) return;
            int output =0;
            for (int i = n + 1; i <= 2 * n; i++) {
                if (isPrime(i)) { output++;}
               
            }
            Console.WriteLine(output);
        }

    }
}

Measured memory_bytes: 5692
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)
#define REPIT(i,x) for(auto i{(x).begin()}; i != (x).end(); i++) 

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<char> Vc;
typedef vector<double> Vd;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int>> VVi;
typedef vector<vector<ll>> VVl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }
inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

const int inf = 1 << 30;
const ll linf = 1LL << 60;
const int MOD = 1000000007;

////// Mod int //////
struct mint {
	ll x;
	mint() :x(0) {}
	mint(ll x) :x((x% MOD + MOD) % MOD) {}
	// mint(ll x):x(x){}
	mint& fix() { x = (x % MOD + MOD) % MOD; return *this; }
	mint operator-() const { return mint(0) - *this; }
	mint& operator+=(const mint& a) { if ((x += a.x) >= MOD) x -= MOD; return *this; }
	mint& operator-=(const mint& a) { if ((x += MOD - a.x) >= MOD) x -= MOD; return *this; }
	mint& operator*=(const mint& a) { (x *= a.x) %= MOD; return *this; }
	mint operator+(const mint& a)const { return mint(*this) += a; }
	mint operator-(const mint& a)const { return mint(*this) -= a; }
	mint operator*(const mint& a)const { return mint(*this) *= a; }
	bool operator<(const mint& a)const { return x < a.x; }
	bool operator==(const mint& a)const { return x == a.x; }
};
istream& operator>>(istream& i, mint& a) { i >> a.x; return i; }
ostream& operator<<(ostream& o, const mint& a) { o << a.x; return o; }
typedef vector<mint> Vm;

/////////////////////

string s;
int n;
vector<Vm> dp;

void init()
{
	cin >> s;
	n = SZ(s);

	dp.resize(n + 1, Vm(13));
	dp[0][0] = 1;
}

int main()
{
	init();

	REP(i, n)
	{
		REP(d, 10)
			REP(j, 13)
			if (s[i] == '?' || s[i] - '0' == d)
				dp[i + 1][(10 * j + d) % 13] += dp[i][j];
	}

	cout << dp[n][5] << endl;
}


Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define vsort(v) sort(all(v))
#define mod 1000000007
using data=pair<ll,ll>;
long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}
ll modinv(ll a){ ll b=mod,u=1,v=0,t; while(b){ t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } return (u+mod)%mod; }
ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}
ll modncr(ll n,ll r){ ll i,plus=1; rep(i,r){ plus=(plus*(n-i))%mod; plus=moddevide(plus,i+1); } return plus; }
ll euclidean_gcd(ll a, ll b) { if(a<b) return euclidean_gcd(b, a); ll r; while ((r=a%b)){a=b;b=r;} return b; }
ll countdigits(ll n){ ll ans=0; while(n){n/=10;ans++;} return ans; }
ll sumdigits(ll n){ ll ans=0; while(n){ans+=n%10;n/=10;} return ans; }
void printmap(vector<ll>& a,ll H,ll W){ ll i,j; For(i,0,H+2){ For(j,0,W+2){cout<<a[i*(W+2)+j];} cout<<endl; } } void inputmap(vector<ll>& a,ll H,ll W){ ll i,j; string ss; For(i,1,H+1){ cin>>ss; For(j,1,W+1){ if(ss[j-1]=='#'){ a[i*(W+2)+j]=1; }else{ a[i*(W+2)+j]=0; } } } }
int main(){
  ll i,j,N,K,a;
  string ss;
  cin>>N;
  vec v(27,0),m(27,1000);
  rep(i,N){
    cin>>ss;
    rep(j,(ll)ss.size()){
      v[ss[j]-'a']++;
    }
    rep(j,27){
      m[j]=min(m[j],v[j]);
      v[j]=0;
    }
  }
  rep(i,27){
    if(m[i]){
      ss[0]='a'+i;
      rep(j,m[i]){
        cout<<ss[0];
      }
    }
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int N = 5e5+7;
vector <int> a[N];
int n,m,Pos[N],TP[N],Count = 0;
void nhap()
{
    scanf("%d %d",&n,&m);
    for (int i = 1; i <= n; i++) {
        scanf("%d",&Pos[i]);
    }
    for (int i = 1; i <= m; i++) {
        int u,v;
        scanf("%d %d",&u,&v);
        a[u].push_back(v);
        a[v].push_back(u);
    }
}
void dfs(int u) {
    TP[u] = Count;
    for (int v : a[u]) {
        if (TP[v] == 0) {
            dfs(v);
        }
    }
}
void init() {
    for (int i = 1; i <= n; i++) {
        if (TP[i] == 0) {
            Count++;
            dfs(i);
        }
    }
}
void solve()
{
    int res = 0;
    for (int i = 1; i <= n; i++) {
        if (TP[i] == TP[Pos[i]]) {
            res++;
        }
    }
    cout << res;
}
int main()
{
    nhap();
    init();
    solve();
}


Measured memory_bytes: 19456
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

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

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

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

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
int main() {

  ll x;
  cin >> x;

  ll res = x/11*2;

  if(x%11==0) {
    ;
  }else if(x%11<=6) {
    ++res;
  }else {
    res += 2;
  }

  cout << res << endl;

  return 0;
}



Measured memory_bytes: 256
/*
 * src.cpp
 *
 *  Created on: 2016/09/24
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const int MAX_N=1e5;

int N;
int A[MAX_N];

int main(){
	scanf("%d",&N);
	REP(i,N){
		scanf("%d",&A[i]);
		A[i]--;
	}
	int ans=0;
	REP(i,N){
		if (A[A[i]]==i){
			ans++;
		}
	}
	ans/=2;
	printf("%d\n",ans);
	return 0;
}


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

#define rep(i, N) for(int (i) = 0; (i) < (N); i++)
#define all(v) v.begin(), v.end()
using i64 = long long;

int main(){
    i64 N ,A, B;
    cin >> N >> A >> B;

    i64 a = 1e18 + 1;
    if((B-A) % 2ll == 0) a = B - ((A+B) / 2ll);
    
    i64 b = 1e18 + 1;
    if(B > (A-1)){
        b = A-1 + ((B-(A-1) - 1) / 2ll);
        if(((B-(A-1)) - 1) % 2ll != 0) b = A + (((B-A) - 1) / 2ll);
    } 

    i64 c = 1e18 + 1;
    if((N-B + A) < N){
        c = N-B + ((N - (N-B + A)) / 2ll); 
        if((N - (N-B + A)) % 2ll != 0) c = N-B+1 + ((N - (N-B+A+1)) / 2ll); 
    }

    i64 d = 1e18 + 1;
    if((N - 1) % 2ll == 0) d = max(A-1, N-B) + ((N-1) / 2ll);

    i64 e = N-A;
    i64 f = B-1;

    i64 g = 1e18 + 1;

    //cerr << a << " " << b << " " << c << " " << d << " " << e << " " << f << endl; 

    cout << min({a, b, c, d, e, f}) << endl;
}

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

int main(){
	int n, count, b, m;
	int d[110];
	cin >> n;
	for(int i=0; i<n; i++) cin >> d[i];
	count = 0;
	b = 1000;
	while(true){
		m = 0;
		for(int i=0; i<n; i++){
			if(d[i] < b && m < d[i]) m = d[i];
		}
		if(m == 0)break;
		b = m;
		count++;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
 
public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Map <Integer,Integer> mapD = new TreeMap<Integer,Integer> ();
 
		Scanner sc = new Scanner(System.in);
			// 整数の入力
			int n,result,d,dnum,sum;
			int index,flag,key0;
			
			n = sc.nextInt();
			for(index=0;index<n;index++) {
				d = sc.nextInt();
				if(mapD.containsKey(d)) {
					dnum=mapD.get(d);
					mapD.put(d,dnum+1);
				}
				else {
					mapD.put(d,1);
				}
			}
			sc.close();
			result=0;
			sum=0;
			flag=0;
			key0=0;
			for(Integer key:mapD.keySet()) {
				dnum=mapD.get(key);
				if(flag==1) {
					result=key-key0;
					break;
				}
				sum=sum+dnum;
				if(sum*2==n ) {
					flag=1; 
				}
				if(sum*2>n ) {
					flag=1; 
					result=0;
					break;
				}
				key0=key;
			}

			System.out.println(result);
			
 
			// 出力
 
	}
}

Measured memory_bytes: 62540
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline T read(){
	T f=0,x=0;char c=getchar();
	while(!isdigit(c)) f=c=='-',c=getchar();
	while(isdigit(c)) x=x*10+c-48,c=getchar();
	return f?-x:x;
}
namespace run{
	const int N=17,mod=1e9+7;

	inline int add(int x,int y){return x+y>=mod?x-mod+y:x+y;}
	inline int sub(int x,int y){return x>=y?x-y:x+mod-y;}
	inline int qpow(int x,int y){
		int ret=1;
		while(y){
			if(y&1) ret=1LL*x*ret%mod;
			x=1LL*x*x%mod,y>>=1;
		}
		return ret;
	}

	int n,m,f[N][1<<16],fac[(1<<16)+9],ifac[(1<<16)+9],sum[1<<16],count[1<<16],a[N];
	inline int C(int _n,int _m){
		if(_n<0 || _m<0 || _n<_m) return 0;
		return 1LL*fac[_n]*ifac[_m]%mod*ifac[_n-_m]%mod;
	}
	inline int A(int _n,int _m){
		if(_n<0 || _m<0 || _n<_m) return 0;
		return 1LL*fac[_n]*ifac[_n-_m]%mod;
	}

	int main(){
		n=read<int>(),m=read<int>();
		for(int i=1;i<=m;i++) a[i]=read<int>();
		reverse(a+1,a+m+1);
		fac[0]=ifac[0]=1;
		for(int i=1;i<=(1<<n);i++) fac[i]=1LL*fac[i-1]*i%mod;
		ifac[1<<n]=qpow(fac[1<<n],mod-2);
		for(int i=(1<<n)-1;i>=1;i--) ifac[i]=1LL*ifac[i+1]*(i+1)%mod;
		assert(1LL*fac[3]*ifac[3]%mod==1);

		count[0]=0;
		for(int i=1;i<1<<n;i++) count[i]=count[i&(i-1)]+1;
		for(int i=0;i<1<<n;i++)
			for(int j=0;j<n;j++) if((i>>j)&1) sum[i]+=(1<<j);
		
		f[0][0]=1;
		for(int i=0;i<m;i++)
			for(int s=0;s<(1<<n);s++){
				for(int j=0;j<n;j++)
					if(!((s>>j)&1))
						f[i+1][s|(1<<j)]=add(1LL*f[i][s]*A((1<<n)-a[i+1]-sum[s],(1<<j)-1)%mod*(1<<j)%mod,f[i+1][s|(1<<j)]);
				f[i+1][s]=add(f[i+1][s],f[i][s]);
			}
	//	cout<<f[m][0]<<" "<<f[m][1]<<" "<<f[m][2]<<" "<<f[m][3]<<endl;
		
		int ans=0;
		for(int s=0;s<(1<<n);s++){
			if(count[s]&1) ans=sub(ans,1LL*f[m][s]*fac[(1<<n)-1-sum[s]]%mod);
			else ans=add(ans,1LL*f[m][s]*fac[(1<<n)-1-sum[s]]%mod);
		}
		printf("%lld\n",1LL*ans*(1<<n)%mod);
		return 0;
	}
}
int main(){
#ifdef my
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	return run::main();
}

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

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		long a[] = new long[n*3];

		for(int i = 0; i < n*3; i++){
			a[i] = sc.nextLong();
		}
		Arrays.sort(a);
		long result = 0;

		for(int i = 0; i < n; i++){
			result += a[3*n - 2*i - 2];
		}

		System.out.println(result);
	}
}


Measured memory_bytes: 52008
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

ll gcd(ll a,ll b){
  if (a%b==0){
    return(b);
  }
  else{
    return(gcd(b,a%b));
  }
}

map<ll,int> prime_factor(ll n) {
  map<ll,int> ret;
  for(ll i=2;i*i<=n;i++) {
    while(n%i==0) {
      ret[i]++;
      n/=i;
    }
  }
  if(n!=1) ret[n]=1;
  return ret;
}

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll A,B;
  cin>>A>>B;
  ll d=gcd(A,B);
  map<ll,int> mp=prime_factor(d);
  int ans=1;
  for(auto e:mp){
    ans++;
  }
  cout<<ans<<endl;
}


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

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

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int k;
    cin >> k;
    long long ans = 0;
    for (int i = 1; i <= k; ++i) {
        for (int j = 1; j <= k; ++j) {
            for (int l = 1; l <= k; ++l) {
                ans += __gcd(__gcd(i, j), l);
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 3652
n,k=map(int,input().split())
h=[]
for i in range(n):
  h.append(int(input()))
h.sort()  
res=10**100
for i in range(0,n-k+1):
  tmp=h[i+k-1]-h[i]
  if tmp<res:
    res=tmp
print(res)

Measured memory_bytes: 7384
/*Author - Shubham Gupta (@shubham107)*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define INF	ll(1e18)
#ifdef SHUBHAM107
#include "../code-pieces/trace.h"
#else
#define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD) {
	a %= m; ll res = 1; while (b) {if (b & 1)res = res * a % m; a = a * a % m; b >>= 1;}
	return res;
}
ll bpow(ll a, ll b) {ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a) {return modpow(a, MOD - 2, MOD);}
void graph(vvi &adj, int m) {int x, y; forn(i, m) {cin >> x >> y; adj[x - 1].pb(y - 1); adj[y - 1].pb(x - 1);}}

const int mxN = 2e5 + 5;
void solve() {
	string s;
	cin >> s;
	int n = sz(s);
	vvi dp(n+1, vi(2));
	dp[0][1] = 1; 
	forn(i, n){
		dp[i+1][0] = min(dp[i][0] + s[i]-'0', dp[i][1] + 10 - (s[i] - '0'));
		dp[i+1][1] = min(dp[i][0] + s[i]-'0' + 1, dp[i][1] + 10 - (s[i] - '0' + 1));
	}
	cout << dp[n][0];
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef SHUBHAM107
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}


Measured memory_bytes: 55964
import numpy as np

n = int(input())
xy = np.array([list(map(int,input().split())) for _ in range(n)],int)

x = xy[:,0]
y = xy[:,1]

a = x+y
b = -x+y

ans = max(a.max() - a.min(), b.max()-b.min())
print(ans)

Measured memory_bytes: 66524
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

main = do
  getLine
  ns <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
  print . solve $ ns

solve = fst . foldl step (1,(0, 0, 0))
  where
    step (0, x) _ = (0, x)
    step (n, (a, b, c)) d
      | a == d && a == b && b == c = (3 * n `mod` modulo, (a+1, b, c)) 
      | a == d && a == b           = (2 * n `mod` modulo, (a+1, b, c)) 
      | a == d                     = (n,                  (a+1, b, c)) 
      | b == d && b == c           = (2 * n `mod` modulo, (a, b+1, c)) 
      | b == d                     = (n,                  (a, b+1, c)) 
      | c == d                     = (n,                  (a, b, c+1))
      | otherwise                  = (0,                  (0, 0, 0))
 

modulo = 10^9 +7 :: Int


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

bool dp[51];
vector <int> vals;
int a[51], b[51];
int n;

bool can(int x, int y)
{
    /// from x to get to y
    memset(dp, 0, sizeof dp);
    dp[x] = 1;
    for (auto i : vals) {
        for (int j(1); j <= x; j++)
            if (dp[j])
                dp[j % i] = 1;
    }
    return dp[y];
}

bool posibil()
{
    for (int i(1); i <= n; i++)
        if (!can(a[i], b[i]))
            return false;
    return true;
}

long long get_ans()
{
    long long ans(0);
    vector <int> has_to;
    for (int i(51); i >= 1; i--) {
        vals = has_to;
        for (int j(i - 1); j >= 1; j--)
            vals.push_back(j);
        if (!posibil())
            has_to.push_back(i), ans += (1ll << i);
    }
    return ans;
}

int main()
{
    cin >> n;

    for (int i(1); i <= n; i++)
        cin >> a[i];

    for (int i(1); i <= n; i++)
        cin >> b[i];

    long long ans = get_ans();
    if (ans == (1ll << 52) - 2)
        cout << "-1\n";
    else
        cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
while True:
    m,f,r = map(int,input().split())
    if m == -1 and f == -1 and r == -1:break
    if m == -1 or f ==-1:
        print("F")
    elif m+f >= 80:
        print("A")
    elif m+f >= 65:
        print("B")
    elif m+f >= 50:
        print("C")
    elif m+f >= 30:
        if r>=50:
            print("C")
        else:
            print("D")
    else:
        print("F")


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	string S; cin >> S;
	int cnt = 0;
	int ans = 0;
	REP(i,S.length()) {
		if (S[i] == 'R') {
			++cnt;
		} else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}
	ans = max(ans, cnt);
	cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


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

using namespace std;

map <int, int> mp;

const int MOD = 1e9 + 7;

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

    int n, sol = 0;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if (!mp[x]) {
            ++sol;
        } else if (mp[x] == 2) {
            cout << 0;
            return 0;
        }
        ++mp[x];
    }
    if (n % 2 == 1 && mp[0] != 1) {
        cout << 0;
        return 0;
    }
    sol -= n % 2;

    int ans = 1;
    for(int i = 0; i < sol; ++i) {
        ans = (ans * 2) % MOD;
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
long long n,m,Mod=1e9+7,dp[1001][1001];
char a[1001][1001];
int main()
{
    cin >> n >> m; 
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            cin >> a[i][j];
        }
    }
    dp[1][1] = 1;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            if(i == 1 && j == 1) continue;
            if(a[i][j] == '#') dp[i][j] = 0;
            else dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % Mod;
            //cout << dp[i][j] << " "; 
        }
        //cout << endl;
    }
    cout << dp[n][m];
} 

Measured memory_bytes: 9088
//
// Created by Myabu on 2020/01/23.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;


int main(void){
    int A,B,C,D;

    cin>>A>>B>>C>>D;

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

    return 0;
}

Measured memory_bytes: 256
def lucas(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    return lucas(n - 1) + lucas(n - 2)
    
n = int(input())
lucas = [0 for i in range(87)]
lucas[0] = 2
lucas[1] = 1
for i in range(2, n + 1):
    lucas[i] = lucas[i - 1] + lucas[i - 2]
print(lucas[n])

Measured memory_bytes: 3064