akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


int main() {

    int h, a;
    scanf("%d %d", &h, &a);

    if (h % a == 0) {
        printf("%d", h / a);
    }
    else {
        printf("%d", h / a + 1);
    }

    return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
import sys


def floor_sum(n, m, a, b):
    ret = 0
    while True:
        if a >= m:
            ret += (a // m) * (n - 1) * n // 2
            a %= m
        if b >= m:
            ret += n * (b // m)
            b %= m
        if a * n + b < m:
            return ret
        y_max = (a * n + b) // m
        x_max = y_max * m - b
        ret += (n - (x_max + a - 1) // a) * y_max
        n, m, a, b = y_max, a, m, -x_max % a


input = sys.stdin.buffer.readline

T = int(input())
for _t in range(T):
    N, M, A, B = map(int, input().split())
    print(floor_sum(N, M, A, B))


Measured memory_bytes: 70152
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>

#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <functional>

#include <sstream>
#include <iostream>

using namespace std;
typedef long long llint;
const llint inf = 1000000000000000000LL;

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

#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<

const int MAXN = 100005;

int N, M; llint K;
llint x[MAXN];
llint y[MAXN];
llint a[MAXN];
llint p[MAXN];

void apply(llint *p, llint *x, int N) {
  static llint tmp[MAXN];
  REP(i, N) tmp[i] = x[p[i]];
  REP(i, N) x[i] = tmp[i];
}

void power(llint *p, int N, llint K) {
  static llint r[MAXN];

  REP(i, N) r[i] = i;

  for (int i = 0; (1LL << i) <= K; ++i) {
    if (((K >> i) & 1) == 1) 
      apply(p, r, N);
    apply(p, p, N);
  }

  REP(i, N) p[i] = r[i];
}

int main(void) 
{
  scanf("%d", &N);
  REP(i, N) scanf("%lld", x + i);
  scanf("%d%lld", &M, &K);
  REP(i, M) { scanf("%lld", a + i); --a[i]; }

  REP(i, N) p[i] = i;
  REP(i, M) swap(p[a[i]], p[a[i] + 1]);
  power(p, N, K);

  for (int i = N - 1; i >= 1; --i)
    x[i] -= x[i - 1];

  apply(p, x, N);

  FOR(i, 1, N) 
    x[i] += x[i - 1];

  REP(i, N) printf("%.1lf\n", (double)(x[i]));

  return 0;
}


Measured memory_bytes: 5376
use proconio::input;

fn main() {
    input! {
        x: i64
    };
    // 5 -> 6 -> 5 -> 6 ...
    // 1 2 3 4 5 6 7 8 9 10 11 12
    let a = x / (5 + 6);
    let b = x % (5 + 6);
    let ans = a * 2
        + if b == 0 {
            0
        } else if b <= 6 {
            1
        } else {
            2
        };
    println!("{}", ans);
}


Measured memory_bytes: 2144
#include<cstdio>
#include<algorithm>
using namespace std;
 long long arr[55];
long long stu[55];
long long ans = 0;
int n;
 long long x;
 void f(int d){
     if(x==arr[d]){//如果吃x层会整好吃完级别为 d 的汉堡
         ans += stu[d];
         return ;
     }else if(x){
         x--;// 吃掉最底层的 b
         if(x>arr[d-1]){// x 落在了上面的 L-1 级的汉堡
             x-=arr[d-1];//吃掉下面的 L-1 级的汉堡
             ans += stu[d-1];// L-1级别的汉堡有stu[l-1]层 p
            x--;// 吃掉中间的 p
             ans++;
             if(x)f(d-1);// 进入上面的 L-1 级的汉堡
             //这里可以不进行if判断直接进入 因为进入后还会判断x非零
         } else f(d-1);// 落点在下面的 L-1 级汉堡
     }
 }
 int main(){
     arr[0] = 1;
     arr[1] = 5;
     arr[2] = 13;
     stu[0] = 1;
     stu[1] = 3;
    stu[2] = 7;
     for(int i=3;i<51;i++){
         //arr[i] = 1+arr[i-1]+1+arr[i-1]+1;
         arr[i] = arr[i-1]*2+3;// 级别为 i 的汉堡的层数 b+p
         stu[i] = stu[i-1]*2+1;// 级别为 i 的汉堡的 p 的数量
     }
     scanf("%d%lld",&n,&x);
     f(n);
     printf("%lld\n",ans);
     return 0;
 }

Measured memory_bytes: 256
using System;

namespace StructuredProgramming
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			var input = Console.ReadLine();
			var num = int.Parse(input);

			for (int i = 1; i <= num; i++)
			{
				var x = i;
				if (x % 3 == 0)
				{
					Console.Write(" {0}", i);
					continue;
				}
				while (x != 0)
				{
					if (x % 10 == 3)
					{
						Console.Write(" {0}", i);
						break;
					}
					x /= 10;
				}
			}
			Console.WriteLine();
		}
	}
}

Measured memory_bytes: 7588
mod = 10**9 + 7
N, A, B, C = map(int, input().split())
inv100 = pow(100, mod-2, mod)
A = A * inv100 % mod
B = B * inv100 % mod
C = C * inv100 % mod

fact = [1] * (2*N+1)
fact_inv = [1] * (2*N+1)
for i in range(1, 2*N+1):
    fact[i] = i * fact[i-1] % mod
fact_inv[-1] = pow(fact[-1], mod-2, mod)
for i in range(1, 2*N+1)[::-1]:
    fact_inv[i-1] = i * fact_inv[i] % mod
comb = lambda n, k: fact[n] * fact_inv[k] * fact_inv[n-k] % mod


def calc(A, B, C):
    ans = 0
    for j in range(N):
        ans += fact[j+N] * fact_inv[N-1] * fact_inv[j] * pow(B, j, mod) * pow(pow(1 - C, mod-2, mod), j + N + 1, mod)
        ans %= mod
    ans = ans * pow(A, N, mod) % mod
    return ans


ans = (calc(A, B, C) + calc(B, A, C)) % mod
print(ans)

Measured memory_bytes: 77468
ls = input().split()
s = list(input())
 
n = int(ls[0])
k = int(ls[1]) - 1
 
if s[k] == 'A':
  s[k] = 'a'
elif s[k] == 'B':
  s[k] = 'b'
elif s[k] == 'C':
  s[k] = 'c'
  
print(''.join(s))

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define debug(x) cerr << #x << "=" << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const ll MOD = 1000000007;

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

//********************************template END****************************************//

void solve(void)
{
	int N, T, A, idx;
	double tmp = INF;
	cin >> N >> T >> A;
	rep(N, i)
	{
		double h;
		cin >> h;
		if (abs((T-0.006*h)-A)<tmp)
		{
			idx = i+1;
			tmp = abs((T-0.006*h)-A);
		}
	}
	cout << idx << endl;
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
#define rep(i, n) for(int i = 0; i < n; i++)
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint P(int n, int r){ if(r < 0 || n < r) return 0; return (fact[n] * inv[n - r] % mod); } lint C(int p, int q){ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }

combination table(1e6);

int main(){
    int N, K;
    cin >> N >> K;
    lint A[N];
    cins(A, A + N);
    sort(A, A + N);
    for(int i = 0; i < N; i++){
        A[i] = (A[i] + mod) % mod;
    }
    lint ans = 0;
    for(int i = 0; i < N; i++){
        ans = (ans + table.C(i, K - 1) * A[i] % mod - table.C(N - i - 1, K - 1) * A[i] % mod + mod) % mod;
    }
    cout << ans << endl;
}



Measured memory_bytes: 16768
/*
    Author - Param Kothari
    Ah shit, here we go again
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair

typedef long long ll;
typedef long double ld;

void solve(){
    int x, y;
    cin >> x >> y;
    if(y & 1){
        cout << "No\n";
        return;
    }
    y = y >> 1;
    int a = y - x;
    int b = x - a;
    if(a < 0 || b < 0){
        cout << "No\n";
        return;
    }
    if(a > 0 || b > 0){
        cout << "Yes\n";
    }
    else
        cout << "No\n";
    return;
}

int main(){
    IOS;
    int t = 1;
    // cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    return 0;
}

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

using namespace std;

int main(){
	int n,cnt=1;
	long sum=0;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
		sum+=arr[i];
	}
	sort(arr,arr+n);
	sum-=arr[n-1];
	for(int i=n-2;i>=0;i--){
		if(sum*2>=(long)arr[i+1]){
			cnt++;
			sum-=arr[i];
		}
		else
			break;
	}
	cout<<cnt;
}

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

#define rep(i,n) for(i=1;i<=n;i++)
#define Rep(i,n) for(i=0;i<n;i++)
#define For(i,a,b) for(i=a;i<=b;i++)

#define pb(x) push_back(x)
#define sz(x) x.size()

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define eps 1e-9

#define si(x) scanf("%d",&x)
#define sii(x,y) scanf("%d %d",&x,&y)
#define siii(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sl(x) scanf("%lld",&x)
#define sll(x,y) scanf("%lld %lld",&x,&y)
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define ss(ch) scanf("%s",ch)
#define pi(x) printf("%d",x)
#define pii(x,y) printf("%d %d",x,y)
#define piii(x,y,z) printf("%d %d %d",x,y,z)
#define pl(x) printf("%lld",x)
#define pll(x,y) printf("%lld %lld",x,y)
#define plll(x,y,z) printf("%lld %lld %lld",x,y,z)
#define ps(ch) printf("%s",ch)
#define Afridi 0
#define NL printf("\n")
#define D(x) cout << #x << " = " << x << endl
#define DD(x,y) cout << #x << " = " << x << " " << #y << " = " << y << endl
#define Max 300005
#define PI 3.141592653589793
#define FI freopen("in.txt","r",stdin)
#define FO freopen("out.txt","w",stdout)
#define mod 1000000007
#define INF (LL)1e18

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

LL bigmod(LL b,LL p)
{
    if(p == 0)return 1;
    LL my = bigmod(b,p/2);
    my*=my;
    my%=mod;
    if(p & 1)my*=b,my%=mod;
    return my;
}
int setb(int n,int pos)
{
    return n=n | (1 << pos);
}
int resb(int n,int pos)
{
    return n=n & ~(1 << pos);
}
bool checkb(int n,int pos)
{
    return (bool)(n & (1 << pos));
}

LL ara[100],n;

LL F()
{
	LL ret = 0;
	while(1)
	{
		sort(ara+1,ara+n+1);
		if(ara[n] < n)break;
		LL need = ara[n] - (n-1);
		LL item = need / n;
		if(need % n)item++;
		ara[n] -= (n * item);
		for(LL i = 1; i < n; i++)ara[i] += item;
		ret += item;
	}
	return ret;
}

int main()
{
	/*FI;
	LL i;
	sl(n);
	rep(i,n)sl(ara[i]);
	LL ret = F();
	pl(ret); NL;*/
	//FI;
	//freopen("out.txt","w",stdout);
	LL k,i;
	sl(k);
	if(k == 0)
	{
		puts("3");
		puts("0 0 0");
	}
	else if(k == 1)
	{
		puts("3");
		puts("0 0 3");
	}
	else if(k <= 50)
	{
		pl(k); NL;
		rep(i,k)
		{
			if(i > 1)printf(" ");
			pl(i);
		}
		NL;
	}
	else
	{
        LL n = 50;
        pl(n); NL;
        rep(i,n)ara[i] = i;
        LL tot = n;
        LL need = k - n;
        LL item = need / n;
        rep(i,n)ara[i] += item;
        LL baki = need - item * n;
        for(LL i = n; i >= 1; i--)
        {
			if(baki <= 0)break;
			ara[i]++;
			baki--;
        }
        rep(i,n)
        {
			if(i > 1)printf(" ");
			pl(ara[i]);
        }
        NL;
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
q = int(input())
dic_a={}
sum_a = sum(a)
for i in a:
    if i not in dic_a:
        dic_a[i]=1
    else:
        dic_a[i]+=1
for i in range(q):
    b, c = (int(x) for x in input().split())
    if b in dic_a:
        sum_a-=(b*dic_a[b])
        sum_a+=(c*dic_a[b])
        if c in dic_a:
            dic_a[c]+=dic_a[b]
        else:
            dic_a[c]=dic_a[b]
        dic_a[b]=0
    print(sum_a)



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

int main() {
	int n;
	cin >> n;
	vector<vector<int>>f(n, vector<int>(10,0));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 10; j++)cin >> f.at(i).at(j);
	}
	vector<vector<int>>p(n, vector<int>(11,0));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 11; j++) {
			int x;
			cin >> x;
			p.at(i).at(j) = x;
		}
	}
	ll ans = -1e18;
	for (int bit = 1; bit < (1 << 10); bit++) {
		vector<int> l(0);
		for (int i = 0; i < 10; i++) if (bit & (1 << i))l.push_back(i);
		ll res = 0;
		vector<int>sy(n,0);
		for (int i = 0; i < l.size(); i++) {
			for (int j = 0; j < f.size(); j++) if (f.at(j).at(l.at(i)) == 1)sy.at(j)++;
		}
		for (int i = 0; i < sy.size(); i++) res += p.at(i).at(sy.at(i));
		ans = max(ans, res);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>


long long int mod(long long int x, long long int m);
long long int mod_inverse(long long int x, long long int m);
long long int mod_inverse_Fermat(long long int x, long long int m);
long long int fast_power(long long int x, long long int n, long long int m);
long long int euclid_extended(long long int a, long long int b, long long int &x, long long int &y);


using ll = long long int;
using namespace std;

ll MOD = 1e9+7;

int main(){

  ll N, K;
  cin >> N >> K;

  // make prime list
  vector<ll> prime(K+1);
  prime[0] = 0;
  prime[1] = 0;
  for(ll i = 2; i <= K; i++){
    prime[i] = 1;
  }
  for(ll i = 2; i <= K; i++){
    if(prime[i] == 1){
      for(ll j = 2; i*j <= K; j++){
        prime[i*j] = 0;
      }
    }
  }
  vector<ll> prime_list;
  for(ll i = 0; i <= K; i++){
    if(prime[i] == 1){
      prime_list.push_back(i);
    }
  }
  ll Nprime = prime_list.size();

  cerr << "prime list is made";

  cerr << "Nprime: " << Nprime << endl;
  /*for(ll i = 0; i < Nprime; i++){
    cerr << prime_list[i] << " ";
  }cerr << endl;*/

  // solve problem
  ll ans = 0;
  vector<ll> tmp_vec(K+1);
  for(ll i = 1; i <= K; i++){
    tmp_vec[i] = i;
  
    for(ll j = 1; j*j <= i; j++){
      if(i%j == 0){
        tmp_vec[i] -= tmp_vec[j];
        if(j*j < i && j != 1){
          tmp_vec[i] -= tmp_vec[i/j];
        }
      }
    }
    tmp_vec[1] = 1;

    //cerr << i << " " << tmp_vec[i] << endl;

    ans += tmp_vec[i] * fast_power(K/i, N, MOD);
    ans = (ans + MOD)%MOD;
  }

  cerr << "Answer:" << endl;
  cout << ans << endl;

  return 0;
  
}



long long int mod(long long int x, long long int m){
  if(x>0){
    return x%m;
  }
  else if(x==0){
    return 0;
  }
  else if((-x)%m == 0){
    return 0;
  }
  else{
    return m - (-x)%m;
  }
}


long long int euclid_extended(long long int a, long long int b, long long int &x, long long int &y){
  long long int d = a;
  if(b != 0){
    d = euclid_extended(b, a%b, y, x);
    y -= (a/b)*x;
  }
  else{
    x = 1;
    y = 0;
  }
  
  return d;
}

long long int mod_inverse(long long int x, long long int m){
  long long int tmp, x_inv, gcd_xm;
  gcd_xm = euclid_extended(x, m, x_inv, tmp);
  // if the inverse is calculate properly
  if(gcd_xm == 1){
    return mod(x_inv, m);
  }
  else{
    //std::cerr << "Error in mod_inverse: there is no inverse of x in mod m" << std::endl;
    return 0;
  }
}

long long int mod_inverse_Fermat(long long int x, long long int m){
  return fast_power(x, m-2, m);
}

long long int fast_power(long long int x, long long int n, long long int m){
  long long int ans = 1;
  
  while(n > 0){
    if(n&1){
      ans = ans * x;
      ans = mod(ans, m);
    }
    x = x*x;
    x = mod(x, m);
    n = n>>1;
  }
  
  return ans;
}



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

int main() {
    int D, G;
    cin >> D >> G;
    G /= 100;
    vector<int> P(D), C(D);
    for(int i = 0; i < D; ++i) {
        cin >> P[i] >> C[i];
        C[i] /= 100;
    }
    int ans = 1e9;
    for(int mask = 0; mask < (1 << D); ++mask) {
        int score = 0;
        int cnt = 0;
        for(int i = 0; i < D; ++i) {
            if(mask & (1 << i)) {
                score += (i + 1) * P[i] + C[i];
                cnt += P[i];
            }
        }
        int i = D - 1;
        while(mask & (1 << i)) --i;
        if(i >= 0) {
            int n = P[i];
            while(n-- && score < G) {
                score +=  i + 1;
                ++cnt;
            }
        }
        if(score >= G) ans = min(ans, cnt);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int N,M;
  cin >> N >> M;
  cout << (int)pow(2,M) * (1900 * M + (N-M) * 100) << endl;
}


Measured memory_bytes: 256
import sys
import math
import fractions
import itertools
from collections import deque
import copy
import bisect
import numpy

MOD = 10 ** 9 + 7
INF = 10 ** 18 + 7
input = lambda: sys.stdin.readline().strip()

N = int(input())
C = sorted(deque(map(int, input().split())))
B = sorted(deque(map(int, input().split())))
A = sorted(list(map(int, input().split())))
BB = []
for i in B:
    BB.append(N - bisect.bisect_right(A, i))
BB_sum = list(numpy.cumsum(BB[::-1])[::-1])
BB_sum.append(0)
ans = 0
for i in C:
    ans += BB_sum[bisect.bisect_right(B, i)]
print(ans)



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

int main(){
  int a,b;
  cin>>a>>b;
  if(a==1)a=14;
  if(b==1)b=14;

  if(a>b)cout<<"Alice"<<endl;
  else if(a<b)cout<<"Bob"<<endl;
  else cout<<"Draw"<<endl;
}


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

int main(){
  int n;
  cin >> n;
  int cnt = 0;
  rep(i,n){
    int a,b;
    cin >> a >> b;
    if(a==b)cnt++;
    else cnt = 0;
    if(cnt >= 3){
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>

namespace IO {
    template <typename _T>
    inline bool read (_T& x) {
        x = 0;
        _T y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return false;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        x *= y;
        return true;
    }

    template <typename _T>
    inline _T input () {
        _T x = 0, y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return 0;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        x *= y;
        return x;
    }
};
using namespace IO;

namespace modular {
    const int MOD = 1000000007;

    inline int add (int x, int y) { return (x += y) >= MOD ? x -= MOD : x; }

    inline void inc (int &x, int y) { (x += y) >= MOD ? x -= MOD : 0; }

    inline int mul (int x, int y) { return 1LL * x * y % MOD; }

    inline int qpow (int x, int y) {
        int ans = 1;
        for (; y; y >>= 1, x = mul(x, x)) if (y & 1) ans = mul(ans, x);
        return ans;
    }
};
using namespace modular;

#define reg register
#define MAX_N 200007
#define FIN(s) freopen(s, "r", stdin)
#define FOUT(s) freopen(s, "w", stdout)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, l, r) for(int i = l; i <= r; ++i)
#define lep(i, l, r) for(int i = l; i < r; ++i)
#define irep(i, r, l) for(int i = r; i >= l; --i)
#define ilep(i, r, l) for(int i = r; i > l; --i)
typedef long long ll;

int N, M, A, B;
int fac[MAX_N], ifac[MAX_N];

inline int C (int x, int y) {
    if (x < y || y < 0) return 0;
    return mul(fac[x], mul(ifac[y], ifac[x - y]));
}

inline void init () {
    int MX = 200000;
    fac[0] = ifac[0] = 1;
    rep (i, 1, MX) fac[i] = mul(fac[i - 1], i);
    ifac[MX] = qpow(fac[MX], MOD - 2);
    irep (i, MX, 2) ifac[i - 1] = mul(ifac[i], i);
}

int main () {
#ifdef LOCAL
    FIN("in");
#endif
    init();
    read(N), read(M), read(A), read(B);
    int res = 0;
    rep (i, 1, B) inc(res, mul(C(N - A - 1 + i - 1, i - 1), C(A - 1 + M - i, M - i)));
    res = add(C(N + M - 2, N - 1), MOD - res);
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

int main(void)
{
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    vector<int> x;
    vector<int> y;
    int tmp;
    for (int i = 0; i < N; i++)
    {
        cin >> tmp;
        x.push_back(tmp);
    }
    for (int i = 0; i < M; i++)
    {
        cin >> tmp;
        y.push_back(tmp);
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
  	bool f = false;
    for (int i = x[N-1]+1; i <= y[0]; i++)
    {
        if (X < i && i <= Y)
        {
          f = true;
          break;
        }
    }
  	if(f==true){
    cout << "No War" <<endl;
    }else{
    cout << "War" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,d,i,t;
	while(scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF)
	  {
	  	if(a<c)  a=c;
	  	if(b>d)  b=d;
	  	if(a>=b)  printf("0\n");
	  	else printf("%d\n",b-a);	
	  }
	return 0;
}

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

int main(void)
{
    int n;
    int order, value;
    list<int> l;
    auto itr = l.end();

    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> order;
        switch(order)
        {
            case 0:
                cin >> value;
                itr = l.insert(itr, value);
            break;
            case 1:
                cin >> value;
                if(value >= 0)
                    for(int i = 0; i < value; i++)
                        itr++;
                else
                    for(int i =  value; i < 0; i++)
                        itr--;
            break;
            case 2:
                itr = l.erase(itr);
            break;
        }
    }
    for(auto ll : l)
    {
        cout << ll << endl;
    }

    return 0;
}


Measured memory_bytes: 18656
#include <stdio.h>

int ReadValue() {
    int n; 
    scanf("%d",&n);
    return n;
}
void ReadArray(int A[],int N) {
    int i; 
    for (i=0; i<N; i++) {
        scanf("%d",&A[i]);
    } 
}
void Display(int A[],int N) {
    int i;
    for (i=0; i<N; i++) {
        if (i>0) {
            printf(" ");
        }
        printf("%d",A[i]);
    }
    printf("\n"); 
}
void InsertionSort(int A[],int N) {
    int i;
    for (int i=0; i<N; i++) {
        int v=A[i];
        int j=i-1;
        while (i>=0&&A[j]>v) {
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
        Display(A,N);
    }
}
int main() {
    int N=ReadValue();
    int A[N]; ReadArray(A,N);
    InsertionSort(A,N);
    return 0;
}



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

const int dx[4] = { 0, 1, 0, -1 };
const int dy[4] = { 1, 0, -1, 0 };
const char dc[4] = { 'U', 'R', 'D', 'L' };
vector<vector<bool>> chk;
vector<vector<pair<int, string>>> path;

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    string s = "";
    for (auto i = sy; i < ty; i++) {
        s.push_back('U');
    }
    for (auto i = sx; i < tx; i++) {
        s.push_back('R');
    }
    for (auto i = sy; i < ty; i++) {
        s.push_back('D');
    }
    for (auto i = sx; i < tx; i++) {
        s.push_back('L');
    }

    s.push_back('L');
    for (auto i = sy; i <= ty; i++) {
        s.push_back('U');
    }
    for (auto i = sx; i <= tx; i++) {
        s.push_back('R');
    }
    s.push_back('D');
    s.push_back('R');
    for (auto i = sy; i <= ty; i++) {
        s.push_back('D');
    }
    for (auto i = sx; i <= tx; i++) {
        s.push_back('L');
    }
    s.push_back('U');

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
N, X = map(int, input().split())
x = list(map(int, input().split()))

xdef = [abs(x[i]-X) for i in range(N)]
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

if N == 1:
  print(xdef[0])
else:
  tmp = gcd(xdef[0], xdef[1])
  for i in range(1,N):
    tmp = gcd(tmp,xdef[i])
  print(tmp)

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

int main(void){
    int n;
    cin >> n;
    
    int ans = 0;
    if(n%10 == 1 || n%10 == 9) ans += 10-n%10;
    else ans += n%10;
    n /= 10;
    if(n%10 == 1 || n%10 == 9) ans += (10-n%10)*10;
    else ans += n%10*10;
    n /= 10;
    if(n%10 == 1 || n%10 == 9) ans += (10-n%10)*100;
    else ans += n%10*100;
    
    cout << ans << endl;
    return 0;
}

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

string s;
int k;
int ans;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> s >> k;
	for(int i=0; i<k; ++i){
		if(s[i] != '1'){
			ans = s[i] - '0';
			break;
		}
		ans = s[i] - '0';
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <chrono>
#include <random>
#include <cstdio>
#define ll long long int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std;
const int N=500001;
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
#define pi 3.14159265358979323846264338
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
ll inf = 100000000000000000;

void solve() 
{
    int n;
    cin>>n;
    
    string s;
    cin>>s;

    int num = 0;
    rep(i, n) if(s[i] == 'W') num++;

    int tmp = 0;

    // cout<<n-num<<endl;
    for(int i = n - num; i < n; i++)
    {
        if(s[i] == 'W') tmp++;
    }

    cout<<num-tmp<<endl;
}



int main()
{
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)

    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }

    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3884
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;
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(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t, u;
	cin >> s >> t >> u;
	cout << "A" << t[0] << "C" << endl;
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
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 Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;

int main(){
    // lower_boundを行う際、条件を満たす要素がない場合は、配列の末尾の
    // イテレーターを返し、予期せぬ結果を返すことがあるので、最大値を設定
    vector<set<int>> indices(26, set<int>({100000000}));

    int N, Q;
    string S;
    cin >> N >> S >> Q;

    rep(i,N) indices[S[i]-'a'].insert(i);
    
    rep(i,Q){
        int type; cin >> type;
        if (type == 1){
            int index; cin >> index;
            index--;
            char letter; cin >> letter;
            indices[S[index]-'a'].erase(index);
            indices[letter-'a'].insert(index);
            S[index] = letter;
        }
        else{
            int left, right;
            cin >> left >> right;
            left--;
            int ans = 0;
            rep(i,26){
                int left_index = *indices[i].lower_bound(left);
                int right_index = *indices[i].lower_bound(right);
                if (right_index > left_index) ans++;
            }

            cout << ans << endl;
        }
    }
}


Measured memory_bytes: 27252
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

string s[2];
ll Q;
ll t1 = 1;

int main()
{
    cin>>s[0]>>Q;
    while(Q--)
    {
        ll t;
        cin>>t;
        if(t == 1)
        {
            t1 = 1 - t1;
        }
        else
        {
            ll t3;
            char t4;
            cin>>t3>>t4;
            t3--;
            s[t3 ^ t1].push_back(t4);
        }
    }
    if(t1 == 1)
    {
        reverse(s[1].begin(), s[1].end());
        cout<<s[1]<<s[0]<<endl;
    }
    else
    {
        reverse(s[0].begin(), s[0].end());
        cout<<s[0]<<s[1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 960
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define f first
#define s second
#define MAXN 101000

vi out;
set<int> occ[MAXN];
int blk[MAXN];
int N;
set<int> S;
stack<int> stk;
int done [MAXN];
int O[MAXN];

int main(){
	cin>>N;
	for (int i=1;i<=N;++i){
		cin>>blk[i];
		O[blk[i]]++;
		S.insert(i);
	}
	for (int i=1;i<=N;++i)occ[O[i]].insert(i);

	out.pb(0);
	while (N - SZ(out) > 3){
		int L = N - SZ(out);
		int t = -1;
		if (SZ(occ[L])){
			t = *occ[L].begin();
		}else{
			while (1){
				t = *(S.begin());S.erase(t);
				if (blk[out.back()] == t){
					stk.push(t);
					continue;
				}
				else break;
			}
		}
		// cout<<"Insert "<<t<<'\n';
		out.pb(t);
		if (S.find(t) != S.end())S.erase(t);
		int nxt = blk[t];
		occ[O[nxt]].erase(nxt);
		--O[nxt];
		occ[O[nxt]].insert(nxt);
		while(SZ(stk))S.insert(stk.top()), stk.pop();
	}
	vi tmp;tmp.clear();
	vi cur;cur.clear();
	for (auto i:S)cur.pb(i);
	// for (int i=1;i<=N;++i)cout<<i<<' '<<blk[i]<<'\n';
	do{
		// for (auto i :cur)cout<<i<<' ';cout<<'\n';
		int ok = 1;
		for (int i=1;i<SZ(cur);++i){
			// cout<<blk[cur[i-1]]<<' '<<cur[i]<<'\n';
			if (blk[cur[i-1]] == cur[i])ok = 0;
		}
		// cout<<blk[out.back()]<<' '<<cur[0]<<'\n';
		if (blk[out.back()] == cur[0])ok = 0;
		if (!ok)continue;
		for (auto i : cur)out.pb(i);
		break;
	}while (next_permutation(ALL(cur)));

	if (SZ(out) != N+1)cout<<-1;
	else{
		for (auto i : out)if(i)cout<<i<<' ';
	}
}

Measured memory_bytes: 15744
// D - Xor Sum 4
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define MOD 1000000007

ll ZO[60][2];

int main(){
	int N; cin>>N;
	while(N--){ ll a; scanf("%lld",&a); rp(j, 0, 60) ZO[j][a>>j&1]++; }
	ll ans = 0;
	rp(i, 0, 60) ans = (ans + (ZO[i][0]*ZO[i][1] % MOD) * ((1LL<<i) % MOD)) % MOD;
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll INF = 1e12;
int main()
{
    int n, W;
    cin >> n >> W;
    vector<int> w(n);
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> w[i] >> v[i];
    int V = 1e5+10;
    vector<vector<ll>> dp(n+1, vector<ll>(V+1, INF));
    dp[0][0] = 0;
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j <= V; j++)
        {
            if(j < v[i])
            {
                dp[i+1][j] = dp[i][j];
            }
            else
            {
                dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]] + w[i]);
            }
        }
    }
    int ans = 0;
    for(int i = 0; i <= V; i++)
    {
        if(dp[n][i] <= W) ans = i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 80256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define rep(i,st,ed) for (register int i=st;i<=ed;++i)

typedef long long LL;
const int N=3005;

LL f[N],s[N][N];
LL fac[N],ny[N];

LL ksm(LL x,LL dep,int MOD) {
	LL res=1;
	for (;dep;dep>>=1) {
		(dep&1)?(res=res*x%MOD):0;
		x=x*x%MOD;
	}
	return res;
}

LL C(int n,int m,int MOD) {
	return fac[n]*ny[m]%MOD*ny[n-m]%MOD;
}

void upd(LL &x,int MOD) {
	(x>=MOD)?(x-=MOD):0;
}

int main(void) {
	int n,MOD; scanf("%d%d",&n,&MOD);
	fac[0]=1; rep(i,1,N-1) fac[i]=fac[i-1]*i%MOD;
	ny[0]=ny[1]=1; rep(i,2,N-1) ny[i]=ny[MOD%i]*(MOD-MOD/i)%MOD;
	rep(i,1,N-1) ny[i]=ny[i-1]*ny[i]%MOD;
	s[0][0]=1;
	rep(i,1,n) {
		s[i][0]=1;
		rep(j,1,i) {
			s[i][j]=s[i-1][j-1]+s[i-1][j]*(j+1)%MOD;
			upd(s[i][j],MOD);
		}
	}
	LL ans=0;
	rep(i,0,n) {
		rep(j,0,i) upd(f[i]+=s[i][j]*ksm(2,1LL*(n-i)*j%(MOD-1),MOD)%MOD,MOD);
		f[i]=f[i]*ksm(2,ksm(2,n-i,MOD-1),MOD)%MOD;
		if (i&1) ans+=MOD-C(n,i,MOD)*f[i]%MOD;
		else ans+=C(n,i,MOD)*f[i]%MOD;
		upd(ans,MOD);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 69120
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int a, b;
	cin >> a >> b;
	cout << a * b << endl;
}

Measured memory_bytes: 3188
#include<stdio.h>
 
int main (void){
     
    int H,W,i,t;
     
    for(;;){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0)break;
    for(i=0;i<H;i++){
        for(t=0;t<W;t++){
            if(t==0||t==W-1){
            printf("#");
            }else if(i==0||i==H-1){
            printf("#");
            }else{
            printf(".");
            }
        }
    printf("\n");
    }
    printf("\n");
    }
     
return 0;
}

Measured memory_bytes: 1716
#include<bits/stdc++.h> 
using namespace std; 
int main() { 
int x;
scanf("%d", &x) ; 
int a1,a2 ; 
a1=x%10;
a2=(x/100) %10 ; 
if (a1==a2) 
printf("Yes") ;
else
printf("No");

return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=103974182;
using namespace std;

int main()
{
//	freopen("input.txt","r",stdin);
	ll n,m;
	cin>>n>>m;
	if(n==1 && m==1)
	{
		cout<<1<<endl;
	}
	else if(n==1)
	{
		cout<<m-2<<endl;
	}
	else if(m==1)
	{
		cout<<n-2<<endl;
	}
	else if(n==2 || m==2)
	{
		cout<<0<<endl;
	}
	else
	{
		cout<<((n-2)*(m-2))<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace B___Guidebook
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var SiPi = new int[N].Select((e, i) => (Console.ReadLine() + " " + i).Split()).ToArray();
            var arr = SiPi.Select(x => new { name = x[0], point = x[1], index = x[2]}).OrderBy(x => x.name).ThenByDescending(x => int.Parse(x.point)).ToArray();

            foreach (var ar in arr)
                Console.WriteLine(int.Parse(ar.index) + 1);
        }
    }
}


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

bool solve(int i, int m, vector<int> &a){
  bool res=0;
  //cout << i << m << endl;
  if(m==0)
    return true;
  if(i>=a.size())
    return false;
  res = solve(i+1, m, a)||solve(i+1, m-a[i], a);
  //cout << res << endl;
  return res;
}

int main(){
  int n;
  int i;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin >> a.at(i);
  int q;
  cin >> q;
  vector<int> m(q);
  for(int i=0;i<q;i++)
    cin >> m.at(i);
  for(int j=0;j<q;j++){
    i=0;
    if(solve(i, m.at(j), a)==true)
      cout << "yes" << endl;
    else
      cout << "no" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3084
s = input()
n = len(s)
judge = 1
for i in range(int(n / 2)):
    if s[i] != s[n - 1 - i]:
        judge = 0
        break

for i in range(int((n - 1) / 4)):
    if s[i] != s[int((n - 1) / 2 - 1 - i)]:
        judge = 0
        break

for i in range(int((n + 3) / 2), n):
    if s[i] != s[n - 1 - i]:
        judge = 0
        break

print("Yes" if judge == 1 else "No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int a;
  cin >> a;
  cout << a+a*a+a*a*a << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

typedef long long ll;
#define rep(i, n) for(long long int (i) = 0; (i) < (int) (n); (i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()

const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const ll LINF = 1e18;

int main(int argc, char const *argv[])
{
    int n;
    vector<int> h;
    cin >> n;
    rep(i, n) {
        int x;
        cin >> x;
        h.push_back(x);
    }
    int count = 0;
    rep(i, h.size()) {
        int a = h[i];
        count += a;
        rep(j, h.size()) {
            if (a == 0) {
                break;
            } else if (a <= h[i + j]) {
                h[i + j] -= a;
            } else {
                a = h[i + j];
                h[i + j] = 0;
            }
        }
    }
    cout << count << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

vector<int> Kmp(const unsigned char* text, size_t text_length,
                const unsigned char* key,  size_t key_length) {
    // kmp_next の事前計算
    vector<int> kmp_next(key_length + 1, 0);    // 照合失敗したときの key の次のチェック開始位置
    int t = kmp_next[0] = -1;
    for(int i = 0; i < key_length; ++i) {
        while(t >= 0 && key[i] != key[t]) { t = kmp_next[t]; }
        t++;
        if(i+1 < key_length && key[i+1] == key[t]) { kmp_next[i+1] = kmp_next[t]; }
        else { kmp_next[i+1] = t; }
    }
    // 検索開始
    vector<int> ret;
    int j = 0;
    for(int i = 0; i < text_length; ++i) {
        while(j >= 0 && key[j] != text[i]) { j = kmp_next[j]; }
        if(j == key_length - 1) { ret.push_back(i - key_length + 1); }
        j++;
    }
    return ret;
}
vector<int> Kmp(string text, string key) {
    return Kmp(reinterpret_cast<const unsigned char*>(text.c_str()), text.length(),
              reinterpret_cast<const unsigned char*>(key.c_str()), key.length());
}

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

    int N;
    string S;
    cin >> N >> S;

    auto ans = Kmp(S, "ABC");
    printf("%zu\n", ans.size());

    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 10007);
}

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


int main(){
  ll n; cin >> n; ll sum = 0;
  
  for(ll i=1; i*i < n; i++){
    if(n % i == 0 and i < n/i -1){
      sum += n/i -1;
    }
  }
  
  cout << sum << endl;
  
  
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
#define printd(x) printf("%.12f\n", ans);
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;


//vector<vector<bool>> tomo(100005, vector<bool>(100005)), block(100005, vector<bool>(100005));


vector<vector<int>> graph1(100005), graph2(100005);

struct UnionFind {
    vector<int> data;
    int sz;
    UnionFind(int sz) : data(sz, -1), sz(sz) { }
    bool unionSet(int x, int y) {
        if ((x = root(x)) == (y = root(y))) return false;
        if (data[x] > data[y]) swap(x, y);
        data[x] += data[y]; data[y] = x;
        sz--;
        return true;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
    int size(int x) { return -data[root(x)]; }
    int size() {return sz;}
};

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

    UnionFind uf(n + 1);
    
    int a[m], b[m], c[k], d[k];
    rep (i, m) {
        cin >> a[i] >> b[i];
        //tomo[a[i]][b[i]] = true;
        //tomo[b[i]][a[i]] = true;
        graph1[a[i]].push_back(b[i]);
        graph1[b[i]].push_back(a[i]);
        uf.unionSet(a[i], b[i]);
    }
    rep (i, k) {
        cin >> c[i] >> d[i];
        //block[c[i]][d[i]] = true;
        //block[d[i]][c[i]] = true;
        graph2[c[i]].push_back(d[i]);
        graph2[d[i]].push_back(c[i]);
    }

    /*
    for (int i = 1; i <= n; i++) {
        cout << i << " " << uf.size(i) << endl;
    }
    */

    for (int i = 1; i <= n; i++) {
        int sz1 = graph1[i].size();
        int sz2 = graph2[i].size();
        int ans = uf.size(i) - 1 - sz1 - sz2;
        rep (j, sz2) {
            if (!uf.findSet(i, graph2[i][j])) ans++;
        }
        cout << ans << endl;
    }

    return 0;
}

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

int main(){
    int x;
    cin >> x;
    if(x == 3 || x == 5 || x == 7){
        cout << "YES" << endl;
        return 0;
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 256