akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, bool> ib;
 
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define RFOR(a, b, c) for(int a = b; a >= c; --a)
#define mp(a, b) make_pair(a, b)
#define all(v) v.begin(), v.end()
 
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define vb vector<bool>
#define fst first
#define snd second
#define MAXN 1000010
#define LOGMAXN 20
#define MAXM 100010
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define EPS 1e-9
#define MOD 1000000007


struct Line {
	mutable ll k, m, p;
	bool operator<(const Line& o) const { return k < o.k; }
	bool operator<(ll x) const { return p < x; }
};
 
struct LineContainer : multiset<Line, less<>> {
	// (for doubles, use inf = 1/.0, div(a,b) = a/b)
	bool maxCHT;
	LineContainer(bool maxCHT) : maxCHT(maxCHT) {}
	const ll inf = LLONG_MAX;
	ll div(ll a, ll b) { // floored division
		return a / b - ((a ^ b) < 0 && a % b); }
	bool isect(iterator x, iterator y) {
		if (y == end()) { x->p = inf; return false; }
		if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
		else x->p = div(y->m - x->m, x->k - y->k);
		return x->p >= y->p;
	}
	void add(ll k, ll m) {
		if(!maxCHT) k = -k, m = -m;
		auto z = insert({k, m, 0}), y = z++, x = y;
		while (isect(y, z)) z = erase(z);
		if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
		while ((y = x) != begin() && (--x)->p >= y->p)
			isect(x, erase(y));
	}
	ll query(ll x) {
		assert(!empty());
		auto l = *lower_bound(x);
		return maxCHT ? l.k * x + l.m : -(l.k * x + l.m);
	}
};

ll n, c;
ll h[MAXN];

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	while(cin >> n >> c)
	{
		LineContainer l(false);
		FOR(i, 0, n) cin >> h[i];
		l.add(-2*h[0], h[0]*h[0]);
		ll ans, dpj;
		FOR(i, 1, n)
		{
			ans = c + h[i]*h[i] + l.query(h[i]);
			l.add(-2*h[i], h[i]*h[i] + ans);
		}
		printf("%lld\n", ans);
	}
	return 0;
}

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

int main() {
	int x[10000];
	for(int i=0; i<10000; i++){
		cin >> x[i];
		if(x[i]==0){break;}
		cout << "Case " << i+1 << ": " << x[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1200
#include "bits/stdc++.h"
using namespace std;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr<<"hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

using ll=long long; 
using ld=long double;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; 

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (600006)
ll n, A[MAXN], p3[15], ofs2, half, mp[729], edge[729], opp[MAXN];
string T;
vector<ll> v[729];
ll flip(ll x){
	if(~opp[x]) return opp[x];
	ll res=0,ox=x;
	DEC(j,n-1,half) if(x>=p3[j]*2) {
		res += p3[j];
		x -= p3[j] * 2;
	} else if(x>=p3[j]) {
		res += p3[j] * 2;
		x -= p3[j];
	}
	return opp[ox]=res;
}
int main(){
	p3[0]=1; FOR(i,1,14) p3[i]=p3[i-1]*3;
	mmst(opp,-1);
	FAST
	cin>>n>>T;half=n/2;
	FOR(i,0,p3[half]-1) mp[i]=i;
	FOR(i,0,p3[half]-1){
		edge[i]=i;
		ll add=0;
		DEC(j,half-1,0)if(edge[i]>=p3[j]*2){
			edge[i] -= p3[j] * 2;
			add += p3[j];
		}else if(edge[i]>=p3[j]) {
			edge[i] -= p3[j];
			add += p3[j] * 2;
		}assert(edge[i]==0);
		edge[i]=add;
	}
	FOR(i,0,p3[n]-1){
		A[i]=i;
		DEC(j,n-1,half) if(A[i]>=p3[j]*2) A[i]-=p3[j]*2; else if(A[i]>=p3[j]) A[i]-=p3[j];
		v[A[i]].eb(i), A[i]=i-A[i];
	}
	FOR(i,0,siz(T)-1){
		if(T[i]=='R'){//+1
			ll act=-1;
			FOR(i,0,p3[half]-1) if(mp[i]==p3[half]-1) assert(act==-1), act=i;
			assert(~act);
			for(auto i:v[act]) {
				if(ofs2) A[i]=flip(A[i]);
				A[i] += p3[half];
				if(A[i] >= p3[n]) A[i] -= p3[n], assert(A[i]==0);
				if(ofs2) A[i]=flip(A[i]);
			}
			FOR(i,0,p3[half]-1) ++ mp[i], mp[i] %= p3[half];
		}else{
			ofs2 ^= 1;
			FOR(i,0,p3[half]-1){
				mp[i]=edge[mp[i]];
			}
		}
	}
	FOR(i,0,p3[n]-1) if(ofs2) A[i]=flip(A[i]);
	FOR(i,0,p3[half]-1) {
		for(auto j:v[i]) A[j] += mp[i];
	}
	FOR(i,0,p3[n]-1) cout<<A[i]<<' '; cout<<'\n';
}


Measured memory_bytes: 18964
chomp (my $n = <STDIN>);
my @a;
for my $i (0..$n-1) {
  my @in = split / /, <STDIN>;
  ($a[$i][0], $a[$i][1]) = @in;
}
@a = sort {$$a[1]<=>$$b[1] || $$b[0]<=>$$a[0]} @a;

my $ans = 0;
for my $i (0..$n-1) {
  $ans += $a[$i][0];
  if ($ans>$a[$i][1]) {
    print "No\n";
    exit;
  }
}
print "Yes\n";

Measured memory_bytes: 66788
def c_Sentou(N, T, t):
    ans = 0
    for i in range(N):
        if i == N - 1:
            ans += T
            continue
        ans += min(T, t[i + 1] - t[i])
    return ans

N,T = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
print(c_Sentou(N, T, t))

Measured memory_bytes: 25196
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>

using namespace std;

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

int main(){

	int* sieve = new int[50001];
	fill((int*)sieve,(int*)sieve+50001,1);
	sieve[0]=0;
	sieve[1]=0;
	for(int i=2; i<= 50000; i++){
		if(sieve[i]==1){
			for(int j=i+i;j<=50000;j+=i){
				sieve[j]=0;
			}
		}
	}

	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;
		int sum=0;
		for(int i=1;i<=n/2;i++){
			if(sieve[n-i] == 1 && sieve[i] == 1){
				//cout << sum << endl;
				sum++;
			}
		}

		cout << sum << endl;
	}
}

Measured memory_bytes: 1112
#include<bits/stdc++.h>
using namespace std;
int main()
{
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //cout<<;
  int a,b;
  cin>>a>>b;
  int count=0;
  for(int i=1;i<=a;i++)
  	{
  		for(int j=11;j<=b;j++)
  		{
  			if(j>99)
  			{
  				break;
  			}
  			int a=j%10;
  			int d=j/10;
  			int c=d%10;
  			if(a>=2 && c>=2)
  			{
  			if(a*c==i)
  			{
  				count++;
  			}
  		}
  			else
  			{
  				continue;
  			}
  		}
  	}
  	cout<<count<<endl;



}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	static int linearsearch(int[] a, int key){
		for(int i=0; i<a.length; i++)
			if(a[i] == key) return i;
		return -1;		
	}
	
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int[] a = new int[4];
		int[] b = new int[4];
		
		while(sc.hasNext()){
			for(int i=0; i<4; i++) a[i] = sc.nextInt();
			for(int i=0; i<4; i++) b[i] = sc.nextInt();
			int hit = 0;
			int blow = 0;
			
			for(int i=0; i<4; i++){
				if(i == linearsearch(a,b[i])) blow++;
				else if(linearsearch(a,b[i]) != -1) hit++;
			}
		
			System.out.print(blow +" "+ hit +"\n");
		}
		

	}

}

Measured memory_bytes: 12000
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]

N = 26
L = [0] * N
for d in range(1, D + 1):
    mx = -10**18
    nx = -1

    for i, (c, l) in enumerate(zip(C, L)):
        r = c * (d - l) * 2 - S[d - 1][i]
        if mx < r:
            mx = r
            nx = i

    L[nx] = d
    print(nx + 1)


Measured memory_bytes: 9420
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(){
	int A,B,C,D;
	scanf("%d%d%d%d",&A,&B,&C,&D);
	if(A*B>C*D){
		printf("%d\n",A*B);
	}else{
		printf("%d\n",C*D);
	}
	
	return 0;
}


Measured memory_bytes: 128
from typing import  Any

class FixedStack:
    class Empty(Exception):
        pass
    class Full(Exception):
        pass
    def __init__(self, capacity:int = 256) -> None:
        self.stk = [None] * capacity
        self.capacity = capacity
        self.ptr = 0

    def __len__(self) -> int:
        return  self.ptr

    def is_empty(self) -> bool:
        return  self.ptr <= 0

    def is_full(self) -> bool:
        return  self.ptr >= self.capacity

    def push(self, value: Any) ->None:
        if self.is_full():
            raise FixedStack.Full
        self.stk[self.ptr] = value
        self.ptr += 1

    def pop(self) -> Any:
        if self.is_empty():
            raise FixedStack.Empty
        self.ptr -= 1
        return self.stk[self.ptr]

    def peek(self) -> Any:
        if self.is_empty():
            raise FixedStack.Empty
        return self.stk[self.ptr - 1]


S = FixedStack(100)

A = list(map(str, input().split()))

for i in range(len(A)):
    ch = A[i]
    if ch in ['+', '-', '*', '/']:
        num2 = S.pop()
        num1 = S.pop()
        num = 0
        if ch == '+':
            num = num1 + num2
        elif ch == '-':
            num = num1 - num2
        elif ch == '*':
            num = num1 * num2
        elif ch == '/':
            num = num1 / num2
        S.push(num)
    else:
        S.push(int(ch))

print(S.peek())


Measured memory_bytes: 7176
import math

def LI():
  return [int(s) for s in input().split()]

def distance(x,y):
  total = 0
  for x_i,y_i in zip(x,y):
    total+=(x_i - y_i)**2    
  return math.sqrt(total)

X = []

N,D = LI()

for i in range(N):
  X.append(LI())
  
count = 0

for i in range(N):
  for j in range(i+1,N):
    d = distance(X[i],X[j])
    if float.is_integer(d):
      count+=1
print(count)

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

int main(){
    int N;
    string S, T;
    cin >> N >> S >> T;

    for(int i = 0; i < N; i++){
        cout << S.at(i) << T.at(i);
    }   

    cout << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    long long a[n+1];
    int z = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a+n);
    if(a[0] == 0)
        cout << "0" << endl;
    else
    {
        long long ans = 1;
        long long z = 1000000000000000000/n;

        int flag = 0;
        for(int i = n - 1; i >= 0; i--)
        {
            if(a[i] > z)
            {
                flag = 1;
                break;
            }
            ans *= a[i];
            z = 1000000000000000000/ans;
        }
        if(flag == 1 || ans > 1000000000000000000)
            cout << "-1" << endl;
        else
            cout << ans << endl;
    }
}


Measured memory_bytes: 4420
iter = gets.chomp.to_i
array = gets.chomp.split.map(&:to_i)

amari = array.reduce(:+) % iter
avr = if amari > iter.to_f / 2
        (array.reduce(:+) / iter) + 1
      else amari <= iter.to_f / 2
        array.reduce(:+) / iter
      end

puts array.map { |n|
  (avr - n) ** 2
}.reduce(:+)

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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;
}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    ll n, k; cin >> n >> k;
    vector<ll> alis(n), flis(n);
    ll ans = 0;
    REP(i, 0, n){cin >> alis[i];}
    REP(i, 0, n){cin >> flis[i];}
    sort(ALL(alis));
    sort(ALL(flis), greater<>());
    ll right = -1, left = 1e14;
    while(left-right > 1){
        ll ck = k;
        ll mid = (right+left) / 2;
        //cout << mid << endl;
        REP(i, 0, n){
            ll cc = mid / flis[i];
            ck -= max(alis[i]-cc, 0LL);
        }
        if(ck >= 0){
            left = mid;
        }else{
            right = mid;
        }
    }
    cout << left << endl;
}


Measured memory_bytes: 6392
s = input()
res = int(s)
length = len(s)
for i in range(1, 2**(length-1)):
    res_i = 0
    b = bin(i)[2:].zfill(length-1)
    s_ = s[0]
    idx = 0
    while idx < length - 1:
        for bi in b:
            if int(bi):
                res_i += int(s_)
                idx += 1
                s_ = s[idx]
            else:
                idx += 1
                s_ += s[idx]
    res_i += int(s_)
    res += res_i
print(res)

Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
	int k;
	int a,b;
	
	scanf("%d", &k);
	
	a = 1+ k/2;
	b = k / 2;
	
	if(k%2 == 1)
		printf("%d\n", a*b);
	else
		printf("%d\n", a*b - k/2);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include<iomanip>

using namespace std;
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define i64 int64_t
#define tos(x) to_string(x)

int main() {
	int n;
	cin >> n;
	cout << "ABC" << n << endl;
	return 0;
}

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

int main(){
  int K;
  cin >> K;
  int r=0;
  for(int i=2;i<=K;i+=2){
    for(int j=1;j<=K;j+=2){
      r++;
    }
  }
  cout << r <<endl;
}

Measured memory_bytes: 256
n, q = map(int, input().split())
s = input()

a = [0]*(n)
for j in range(1, n):
    if s[j-1] == 'A' and s[j] == 'C':
        a[j] += 1
        
csum = [0]*(n+1)
for i in range(n):
    csum[i+1] = csum[i] + a[i]

for i in range(q):
    l, r = map(int, input().split())
    print(csum[r]-csum[l])

Measured memory_bytes: 8516
def Find(x, par):
  if par[x] < 0:
    return x
  else:
    par[x] = Find(par[x], par)
    return par[x]

def Unite(x, y, par, rank):
  x = Find(x, par)
  y = Find(y, par)
  
  if x != y:
    if rank[x] < rank[y]:
      par[x] = y
    else:
      par[y] = x
      if rank[x] == rank[y]:
        rank[x] += 1
    
def Same(x, y, par):
  return Find(x, par) == Find(y, par)
 
n, k, l = map(int, input().split())
rpar = [-1]*n
tpar = [-1]*n
rrank = [0]*n
trank = [0]*n
 
for i in range(k):
  p, q = map(int, input().split())
  p, q =p-1, q-1
  Unite(p,q, rpar, rrank) 

for i_ in range(l):
  p, q = map(int, input().split())
  p, q =p-1, q-1
  Unite(p,q, tpar, trank)

d = {}
IDs = [0]*n
for j in range(n):
  ID = Find(j, rpar)+(Find(j, tpar)+1)*10**8
  IDs[j] = ID
  if ID in d:
    d[ID] += 1
  else:
    d[ID] = 1


ans = ''
for j_ in range(n):
  if j_ != 0:
    ans += ' '
  ans += str(d[IDs[j_]])
print(ans)

Measured memory_bytes: 36204
# -*- coding: utf-8 -*-
#幅優先探索
#TLE
import sys
from collections import deque

N=input()

a=[[] for i in range(N+1)]
#隣接リスト
for i in range(N-1):
	x,y,z=list(map(int,raw_input().split()))
	a[x].append((y,z))
	a[y].append((x,z))

#print a

Q,K=list(map(int,raw_input().split()))


b=[]
for i in range(Q):
	b.append(map(int, raw_input().split()))
#print b



#訪問判別フラグ
F=(N+1)*[0]

#Queue
q=deque()

#距離
dist=[0 for i in range(N+1)]


length=0
#幅優先探索
q.append(K)
while len(q)!=0:
	v=q.popleft()
	F[v]=1
	for u,length in a[v]:
		if F[u]==0:
			q.append(u)
			dist[u]=dist[v]+length


#print dist


for x in range(len(b)):
	print dist[ b[x][0] ]+ dist[ b[x][1] ]




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

int main() {
  string s, t;
  cin >> s >> t;
  
  int ls = s.size(), lt = t.size(), ans = 1000000;
  for(int i = 0; i < ls; i++){
    int cnt = 0;
    bool ok = false;
    for(int j = 0; j < lt; j++){
      if(i+j >= ls){
        ok = true;
        break;
      }
      if(t.at(j) != s.at(i+j)) cnt++;
    }
    if(ok) break;
    ans = min(ans, cnt);
  }
  
  cout << ans << endl;
}

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

int main(void) {
  int n;
  cin >> n;
  vector<int> as(n);
  vector<int> bs(n);
  int t;
  long long sum = 0;
  long long minus = 0;
  int count = 0;
  for (int &a : as) cin >> a;
  for (int i = 0; i < n; ++i) {
    cin >> t;
    bs[i] = as[i] - t;
    sum += bs[i];
    if (bs[i] < 0) {
      minus -= bs[i];
      ++count;
    }
  }

  if (sum < 0) {
    cout << -1 << endl;
    return 0;
  }

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

  int c = n;
  while (minus > 0) {
    --c;
    minus -= bs[c];
    ++count;
  }

  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3972
# -*- coding: utf-8 -*-

def calc(N, K):
    # a=K is N-K set.
    # a>K and a<b is N-K+1...N-K+K
    ans = (N - K + 1) *(N - K)//2
#    print ans
    # a>K and a>b
    # a % b = ik  =>  a = b * x + ik
    # b > ik and 1 <= x <= (N - ik)/ik
    ik = N//2 + 1
    while ik >= K and ik != 0:
        x = (N - ik - 1) // ik
        while x > 0:
            tmp = ((N - ik) // x) - ik
#            print("ik:{} tmp:{} x:{}".format(ik,tmp,x))
#            print("N:{} N-ik*x:{}".format(N,N-ik*x))
            if tmp > 0:
                ans = ans + tmp
            x = x - 1
        ik = ik - 1
    if K == 0:
        i = 2
        while i <= N:
            ans = ans + N // i
            i = i + 1
    return ans


def main():
    N, K = map(int, raw_input().split())
    ans = calc(N,K)
    print(ans)

main()

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int n = in();
  vector<int64_t> x(n), v;
  cin >> x;

  v = x;
  sort(v);

  for (int i = 0; i < n; ++i) {
    if (x[i] < v[n / 2])
      cout << v[n / 2] << endl;
    else
      cout << v[n / 2 - 1] << endl;
  }
}


Measured memory_bytes: 5376
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int M = scan.nextInt();
        System.out.println(24+(24-M));
    }
}


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

typedef long long ll;
#define MOD 1000000007
int main()
{
    ll i,j,k,l,m,n,ans=1;
    string s;
    ll cnt[29]={0};
    cin>>n;
    cin>>s;
    for(i=0; i<n; i++)
    {
       cnt[s[i]-'a']++;
    }
   for(i=0;i<26;i++)
   {
       if(cnt[i])ans=(ans*(cnt[i]+1))%MOD;
   }
    cout<<ans-1<<endl;

}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
using namespace std;
bool isPalindrom(int n) {
	vector <int> s;
	while (n > 0) {
		s.push_back(n % 10);
		n /= 10;
	}
	
	bool flag = true;
	for (int i = 0; i < (int)s.size()/2; i++) {
		if (s[i] != s[(int)s.size()-i-1]) {
			flag = false;
			break;
		}
	}

	return flag;

}
int main (void) {
	
	int a, b; cin >> a >> b;
	int count = 0;

	for (int i = a; i <= b; i++) {
		if (isPalindrom(i))
			count++;
	}	
	cout << count << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int cnt(vi &a, vi &b)
{
	int n = a.size();
	int cnt = 0;
	for (int i = n - 1; i >= 0; i--)
	{
		if (a[i] == b[i]) continue;
		else
		{
			int t;
			for (int j = i - 1; j >= 0; j--)
			{
				if (a[j] == b[i])
				{
					t = j;
					break;
				}
			}
			for (int j = t; j < i; j++)
			{
				swap(a[j], a[j + 1]);
				cnt++;
			}
		}
	}
	return cnt;
}

int main()
{
	int n, m;
	cin >> n >> m;
	vi v(n), w(m);
	REP(i, n) cin >> v[i];
	REP(i, m) cin >> w[i];
	vi a, b;
	int t = 1;
	REP(i, m)
	{
		REP(j, w[i])
		{
			a.push_back(t);
			b.push_back(1 - t);
		}
		t = 1 - t;
	}
	int ans = INF;

	if (count(ALL(v), 1) == count(ALL(a), 1)) chmin(ans, cnt(a, v));
	if (count(ALL(v), 1) == count(ALL(b), 1)) chmin(ans, cnt(b, v));

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

Measured memory_bytes: 3164
use std::io::*;
use std::str::FromStr;
   
fn read<T: FromStr>() -> T {
	let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
     
fn main() {
    let a: u32 = read();
    let b: u32 = read();
	if b*2 <= a {
		println!("{}", a-b*2);
	} else {
		println!("0");
	}
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include<map>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<typeinfo>
#include<queue>
using namespace std;
int main() {
	long long int L, R;
	cin >> L >> R;
	bool flag = false;
	for (int i = 1; 2019 * i < R;i++) {
		if (L <= 2019 * i && R >= 2019 * i) {
			flag = true;
		}
	}
	if (flag) {
		cout << 0;
	}
	else {
		int mod = 2019;
		int L_mod = L % 2019;
		int R_mod = R % 2019;
		for (int i = L_mod; i < R_mod; i++) {
			for (int j = i + 1; j <= R_mod; j++) {
				if (mod > (i * j) % 2019) {
					mod = (i * j) % 2019;
				}
			}
		}
		cout << mod;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int n;

void dfs(string s, char mx){
    if(s.length() == n){
        cout << s << endl;
    }else{
        for(char c='a'; c<=mx; c++){
            if(c==mx){
                dfs(s+c, char(mx+1));
            }else{
                dfs(s+c, mx);
            }
        }
    }
}

int main(){
    cin >> n;
    dfs("", 'a');
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 1536
#エクサウィザーズ 2019 B

num = input("")
RorB = input("")
Rnum = 0

for char in RorB:
    if char == "R":
        Rnum += 1

if int(Rnum) > int(num) - int(Rnum):
    print("Yes")

else:
    print("No")

Measured memory_bytes: 2940
n=int(input())
ps=list(map(int,input().split()))
c=0
for i in range(1,n-1):
    p1=ps[i-1]
    p2=ps[i]
    p3=ps[i+1]
    if p1<p2<p3 or p3<p2<p1:
        c+=1
print(c)


Measured memory_bytes: 2940
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solve(in, out);
        out.close();
    }

    public static void solve(InputReader sc, PrintWriter pw) {
        int i,j=0;
        int t=1;
        // int t=sc.nextInt();
        u:while(t-->0){
            char ch=sc.next().charAt(0);
            pw.println((char)(ch+1));
        }
    }

    static class Pair implements Comparable<Pair>{
        int a;int b;
        Pair(int a,int b){
            this.a=a;
            this.b=b;
            //this.z=z;
        }   
        public int compareTo(Pair p){
            return (a-p.a);
        }
    }

    static boolean isPrime(int n) { 
        if (n <= 1) 
            return false; 
        if (n <= 3) 
            return true; 
        if (n % 2 == 0 || n % 3 == 0) 
            return false; 
        for (int i = 5; i * i <= n; i = i + 6) 
            if (n % i == 0 || n % (i + 2) == 0) 
                return false; 
        return true; 
    } 
    static long gcd(long a, long b) { 
        if (b == 0) 
            return a; 
        return gcd(b, a % b);  
    } 
    static long fast_pow(long base,long n,long M){
        if(n==0)
           return 1;
        if(n==1)
        return base;
        long halfn=fast_pow(base,n/2,M);
        if(n%2==0)
            return ( halfn * halfn ) % M;
        else
            return ( ( ( halfn * halfn ) % M ) * base ) % M;
    }
    static long modInverse(long n,long M){
        return fast_pow(n,M-2,M);
    }
 
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
 
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
 
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}

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

int J, Y;

void parse(int j, int y, string p){
  if ( j == J && y == Y ){
    cout << p << endl; return;
  } else if ( j == 5 && y <= 3 || y == 5 && j <= 3){
    return;
  }
  if ( j > J || y > Y ) return;
  parse(j+1, y, p + "A");
  parse(j, y+1, p + "B");

}

main(){
  cin >> J >> Y;
  parse(0, 0, "");
}




Measured memory_bytes: 3192
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from functools import *
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def Golf():
    *a,=map(int,open(0))
def S_():
    return input()
def IS():
    return input().split()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['YES','NO']

mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()
 
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0

n,m=LI()

g,c=GI(n,m)
def bfs(x):
    v=[0]*n
    q=[x]
    while q:
        c=q.pop()
        v[c]=1
        for nb in g[c]:
            if v[nb]==0:
                q.append(nb)
                v[nb]=1
    return sum(v),v

x,cx=bfs(0)
y,cy=bfs(1)
if x<y:
    cy=[1 if cx[i]==0 else 0 for i in range(n)]
    nx,ny=x,n-x
else:
    cx=[1 if cy[i]==0 else 0 for i in range(n)]
    nx,ny=n-y,y
for i in range(n):
    if cx[i]==1: # i belongs to x
        ans+=nx-1-len(g[i])
    else:
        ans+=ny-1-len(g[i])

print(ans//2)



Measured memory_bytes: 81180
#include <iostream>

using namespace std;

int main()
{
    long long m,n;
    cin>>m>>n;
    if(m==1 && n!=1){
        cout<<n-2;
    }else if(n==1 && m!=1){
        cout<<m-2;
    }
    else if(m==1 && n==1){
        cout<<1;
    }else{
    cout <<m*n-2*(m+n)+4<< endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  cin>>a;
  int64_t n;
  cin>>n;
  int s=a.size();
  if(a==string(s,a[0])){
    cout<<s*n/2<<endl;
  }
  else{
    int64_t kk=0;
    
      int w=1;
   
      a.push_back('<');
      for(int i=0;i<s;i++){
        if(a[i]==a[i+1]){
          w++;
        }
        else if(w!=1){
          kk+=w/2;
          w=1;
        }
      }
      if(a[0]!=a[s-1]){
      cout<<kk*n<<endl;
      }
          
    
    else{

      int d=1;
      int f=1;
      for(int i=0;;i++){
        if(a[i]==a[i+1]){
          d++;
        }
        else{
          break;
        }
      }
      for(int i=s-1;;i--){
        if(a[i]==a[i-1]){
          f++;
        }
        else{
          break;
        }
      }
      if(d%2==1 && f%2==1){
        cout<<kk*n+n-1<<endl;
      }
      else{
        cout<<kk*n<<endl;
      }
    }
  }
}

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

using namespace std;

int main()
{
    int h, n;
    cin >> h >> n;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        h-=a;
    }

    if(h>0) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(5e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n, m, k;
    bool ok = false;
    cin >> n >> m >> k;
    REP(i,n+1){
        REP(j,m+1){
            if(i*j+(n-i)*(m-j)==k){
                ok = true;
                break;
            }
        }
        if(ok)break;
    }
    cout << (ok?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
	int N; cin >> N;
	vector<Pi> ans;
	repr(i,1,N)repr(j,i+1,N+1){
		if(N % 2 == 0){
			if(i+j != N+1) ans.emplace_back(i,j);
		}
		else{
			if(i+j != N) ans.emplace_back(i,j);
		}
	}
	cout << ans.size() << endl;
	rep(i,ans.size()){
		cout << ans[i].first << " " << ans[i].second << endl;
	}

}



Measured memory_bytes: 384
num = [int(s) for s in input().split()]

com = 1
tes = 2
if max(num)%min(num) == 0:
  print(max(num))
else:
  while tes < min(num)/2 +1:
    if min(num)%tes == 0 and max(num)%tes == 0:
      com *= tes
      num = [int(n/tes) for n in num]
    else:
      tes += 1
  print(com*min(num)*max(num))

Measured memory_bytes: 3060
s = input()
dp = [0 for _ in range(0,4)]
dp[3] = 1
dp[0] = 0
dp[1] = 0
dp[2] = 0
abc = "ABC".index
mod = 10**9 + 7
for i in range(len(s)-1,-1,-1):
    if s[i] == "?":
        dp = [
        (dp[0]*3+ dp[1])%mod
        ,(dp[1]*3+ dp[2])%mod
        ,(dp[2]*3 + dp[3])%mod
        ,(dp[3]*3)%mod
        ]
    else:
        num = abc(s[i])
        dp[num] += dp[num+1] % mod
print(dp[0] %mod)


Measured memory_bytes: 3188
#include"stdio.h"
#include"string.h"
main(){
	char S[26];
	int i,j;
	gets(S);
	for(i=0;i<(strlen(S)-1);i++)
	{for(j=i+1;j<strlen(S);j++)
	{if(S[i]==S[j]) break;}
	if(j!=strlen(S)) break;}
	if(i==(strlen(S)-1)) printf("yes\n");
	else printf("no\n");
} 


Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))

MOD = 10**9+7

m = 1
ans = 0
for i in range(60):
    bit = sum(a & m for a in A)
    bit //= m
    zero = N - bit
    now = bit * zero % MOD
    for j in range(i):
        now = (now * 2) % MOD
    ans += now
    ans %= MOD
    m <<= 1

print(ans)


Measured memory_bytes: 122936
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

int main() {

	long long N;
	cin >> N;
	vector<long long> A(N, 0);

	long long b = 1000000007;
	
	for (long long i = 0; i < N; i++) {
		cin >> A[i];
	}

	if (N > 2) {
		vector<long long> v(N, A[N - 1]);
		for (long long i = N - 3; i > 0; i--) {
			v[i] += A[i + 1];
			v[i] %= b;
			v[i - 1] = v[i];
		}
		v[0] += A[1];
		v[0] %= b;

		long long sum = 0;
		for (long long i = 0; i < N - 1; i++) {
			sum += A[i] * v[i];
			sum %= b;
		}

		cout << sum << endl;
	}
	else {
		long long sum = 0;
		sum = A[0] * A[1];
		sum %= b;

		cout << sum << endl;
	}

	return 0;
}

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


int main()
{
	int n;
	double ave = 0;
	cin>> n;
	vector<int> x(n), y(n);
	for(int i=0;i<n;i++){
		cin>> x[i] >> y[i];
	}
	vector<int> order(n);
	for(int i=0;i<n;i++){
		order[i] = i;
	}
	
	do{
		for(int i=1;i<n;i++){
			ave += sqrt((x[order[i]] - x[order[i-1]]) * (x[order[i]] - x[order[i-1]]) + (y[order[i]] - y[order[i-1]]) * (y[order[i]] - y[order[i-1]]));
		}
	}while(next_permutation(order.begin(), order.end()));
	for(int i=n;1<i;i--){
		ave /= i;
	}
	cout<< fixed << setprecision(8) <<ave<<endl;
}


Measured memory_bytes: 384
import sys
import collections

sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline


N = int(input())
A = list(map(int, input().split()))

left = []
right = []

for i, a in enumerate(A, 1):
    left.append(i - a)
    right.append(i + a)

left_counter = collections.Counter(left)
right_counter = collections.Counter(right)

ans = 0
for i, j in right_counter.items():
    if i in left_counter:
        ans += j * left_counter[i]

print(ans)


Measured memory_bytes: 63684
#include<bits/stdc++.h>
using namespace std;
#define debug 1

int main(int argc,char **argv) {
	int n;
	cin>>n;
	double a,ans=0;
	for(int i=0;i<n;i++) {
		cin>>a;
		ans+=(double)1 / a;
	}
	ans=(double)1 /ans;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
input=lambda: sys.stdin.readline().rstrip()
n,q=map(int,input().split())
C=[int(i) for i in input().split()]
LR=[]
for i in range(q):
    l,r=map(int,input().split())
    LR.append((i,l,r))
LR.sort(key=lambda x:x[2])


LST=[0]*(n+1)
Ans=[0]*q

n_max=5*10**5+1
nn=n_max.bit_length()+1
BIT=[0]*(2**nn)
BIT.insert(0,0)

def bitsum(BIT,i):
  s=0
  while i>0:
    s+=BIT[i]
    i-=i&(-i)
  return s

def bitadd(BIT,i,x):
  while i<=2**nn:
    BIT[i]+=x
    i+=i&(-i)
  return BIT
cur=0
for i,l,r in LR:
    while cur<r:
        if LST[C[cur]]!=0:
            bitadd(BIT,LST[C[cur]],-1)
        LST[C[cur]]=cur+1
        bitadd(BIT,LST[C[cur]],1)
        cur+=1
    if l==1:
        Ans[i]=bitsum(BIT,r+1)
    else:
        Ans[i]=bitsum(BIT,r+1)-bitsum(BIT,l-1)
for ans in Ans:
    print(ans)

Measured memory_bytes: 189144
a,op,b = map(str,input().split())
while op != '?':
    a = int(a); b = int(b);
    if op == '+':
        print(a+b)
    elif op == '-':
        print(a-b)
    elif op == '*':
        print(a*b)
    elif op == '/':
        print(a//b)
    a,op,b = map(str,input().split())



Measured memory_bytes: 5596
// vim: foldmethod=marker
#include <iostream> // cout, endl, cin{{{
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
typedef long long ll;/*}}}*/

int main(int argc, char *argv[])
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  char cstr[s.size() + 1];
  strcpy(cstr, s.c_str());
  int istr[s.size() + 1];

  for (int i = 0; i < s.size(); ++i) {
    istr[i] = int(cstr[i]);
  }

  string ans = "";
  for (int i = 0; i < s.size(); ++i) {
    int tmp = istr[i] + n;
    while (tmp > 90) tmp -= 26;
    ans = ans + char(tmp);
  }

  cout << ans << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define ll long long
#define endl '\n'
#define pi 3.14159265
ll p(ll a,ll b)
{
    ll res=1;
    while(b)
    {
        if(b%2!=0)

            res*=a;
        a*=a;
        b/=2;
    }
    return res;
}
int main()
{
    IOS;
    ll n;
    cin>>n;
    string a,b,c;
    cin>>a>>b>>c;
    ll ans=0;
    for(ll i=0;i<n;i++)
    {
        if(a[i]==b[i]&&a[i]==c[i])
            continue;
        if(a[i]==b[i])
            ans++;
        else if(a[i]==c[i])
            ans++;
        else if(b[i]==c[i])
            ans++;
        else
            ans+=2;
        //trace1(ans);
    }
    cout<<ans;
} 

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

using namespace std;

int main(){
  int n;
  cin >> n;
  
  int a[n * 3];
  for (int i =0; i < n * 3; ++i) cin >> a[i];
  
  sort(a, a + n * 3, greater<int>());
  int cnt = 0;
  int cur = 0;
  long long ans = 0;
  while (cnt < n) {
    ans += a[cur * 2 + 1];
    cnt++;
    cur++;
  }
  
  cout << ans << endl;
  return 0;
}


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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

typedef pair<ll, ll> P;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
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; }

int main()
{
    int n;
    cin >> n;
    string alpa = "abcdefghijklmnopqrstuvwxyz";
    
    vector <int> x(26, 1000);

    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int i = 0; i < 26; i++) {
            int cnt = 0;
            for (int j = 0; j < int(s.size()); j++) {
                if (s[j] == alpa[i]) cnt++;
            }
            chmin(x[i], cnt);
        }
    }

    for (int i = 0; i < 26; i++) {
        for (int j = 0; j < x[i]; j++) {
            cout << alpa[i];
        }
    }
    cout << endl;
    return 0;
}



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

int main(){
  int inf = 100000;
  int N,T;
  cin >> N >> T;
  vector<int> C(N);
  int x=0;
  for(int i=0;i<N;i++){
    cin >> C.at(i) >> x;
    if(x>T){
      C.at(i) = inf;
    }
  }
  sort(C.begin(),C.end());
  if(C.at(0) == inf){
    cout << "TLE" << endl;
  }else{
    cout << C.at(0) << endl;
  }
}

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

int T[100000];

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

	int N, C, K;
	cin >> N >> C >> K;
	for(int i = 0; i < N; i++) {
		cin >> T[i];
	}
	sort(T, T + N);
	int ans = 0;
	for(int i = 0; i < N;) {
		int cnt = 0;
		int t = T[i];
		while(cnt < C && i < N && T[i] <= t + K) {
			cnt++;
			i++;
		}
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;

int main(){
    int n, m;
    string s;
    cin >> n;
    cout << 3 * (n * n)<< endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i=0; i<(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
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; }

int main(){
    ll N; cin >> N;
    vector <ll> cnt(N,0);
    rep(i,N-1){
        ll a; cin >> a;
        cnt[a-1]++;
    }
    
    rep(i,N){
        cout << cnt[i] << endl;
    }
    
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int n;
  cin >> n;
  vi L(n);
  rep(i,n) cin >> L[i];

  SORT(L);

  int ans = 0;
  rep(c,n)rep(b,c)rep(a,b) {
    if (L[a] + L[b] > L[c]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
//#include<algorithm>
//#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long int i,j=0,n;
  long long d;
  long long x,y,m;
  cin>>n>>d;
  for(i=0;i<n;i++)
  {
      cin>>x>>y;
      m=x*x+y*y;
      //cout<<pow(m,0.5)<<endl;
      //cout<<k<<endl;
      if(pow(m,0.5)<=d)
        j++;
  }
  cout<<j<<endl;
return 0;
}


Measured memory_bytes: 4184