akhauriyash/Code-Regression huggingface dataset:
using System;
    class Program
    {
        static void Main(string[] args)
        {
            //入力
            int xMaxInput = int.Parse(Console.ReadLine());
            string[] xInputStrings = new string[xMaxInput];
            for (int i = 0; i < xMaxInput; ++i)
            {
                xInputStrings[i] = Console.ReadLine();
            }
            //計算
            string output = "";
            output += OutputChars(xInputStrings, 'a');
            output += OutputChars(xInputStrings, 'b');
            output += OutputChars(xInputStrings, 'c');
            output += OutputChars(xInputStrings, 'd');
            output += OutputChars(xInputStrings, 'e');
            output += OutputChars(xInputStrings, 'f');
            output += OutputChars(xInputStrings, 'g');
            output += OutputChars(xInputStrings, 'h');
            output += OutputChars(xInputStrings, 'i');
            output += OutputChars(xInputStrings, 'j');
            output += OutputChars(xInputStrings, 'k');
            output += OutputChars(xInputStrings, 'l');
            output += OutputChars(xInputStrings, 'm');
            output += OutputChars(xInputStrings, 'n');
            output += OutputChars(xInputStrings, 'o');
            output += OutputChars(xInputStrings, 'p');
            output += OutputChars(xInputStrings, 'q');
            output += OutputChars(xInputStrings, 'r');
            output += OutputChars(xInputStrings, 's');
            output += OutputChars(xInputStrings, 't');
            output += OutputChars(xInputStrings, 'u');
            output += OutputChars(xInputStrings, 'v');
            output += OutputChars(xInputStrings, 'w');
            output += OutputChars(xInputStrings, 'x');
            output += OutputChars(xInputStrings, 'y');
            output += OutputChars(xInputStrings, 'z');
            //出力
            Console.WriteLine(output);
        }
        static string OutputChars(string[] inputStrings, char patternString)
        {
            int xMinCount = int.MaxValue;
            foreach (string xStr in inputStrings)
            {
                int xCount = CountChar(xStr, patternString);
                if (xCount < xMinCount)
                {
                    xMinCount = xCount;
                }
                if (xMinCount == 0)
                {
                    return "";
                }
            }
            return new string(patternString, xMinCount);
        }
        static int CountChar(string input, char pattern)
        {
            return input.Length - input.Replace(pattern.ToString(), "").Length;
        }
    }


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

int n;

void dfs(string s, char c){
    if(s.size() == n){
        cout << s << endl;
        return;
    }

    for(char i = 'a'; i <= c + 1; i++){
        string t = s + i;
        dfs(t, max(c, i));
    }
}

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

    cin >> n;
    dfs("", 'a' - 1);

    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

int main()
{
    int n;cin>>n;
    vector<int>a(n);
    REP(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    if(a[n/2]==a[n/2-1])cout<<0<<endl;
    else cout<<a[n/2]-a[n/2-1]<<endl;
}

Measured memory_bytes: 640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

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

class TaskA {
 public:
  void solve(std::istream &in, std::ostream &out) {
    char A, B;
    in >> A >> B;
    int ans = A - B;
    if (ans < 0) {
      out << "<";
    } else if (ans > 0) {
      out << ">";
    } else {
      out << "=";
    }
  }
};


int main() {
  TaskA solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 764
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    X = int(inputs[0])
    if X == 3 or X == 5 or X == 7:
        return "YES"
    return "NO"


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 3316
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll N;
    cin >> N;

    vector<ll > P;
    vector<ll > Q;

    for(ll i = 0; i < N; i++){
        ll t; cin >> t;
        P.push_back(t);
    }

    for(ll i = 0; i < N; i++){
        ll t; cin >> t;
        Q.push_back(t);
    }

    vector<ll > A(N, 0);
    for(ll i = 0; i < N; i++){
        A[i] = i + 1;
    }

    map<vector<ll >, ll > mp;

    ll cn = 1;
    do{
        vector<ll > tmp;
        for(ll i = 0; i < A.size(); i++){
            tmp.push_back(A[i]);
        }
        
        mp[tmp] = cn;

        cn++;

    }while(next_permutation(A.begin(), A.end()));


    cout << abs(mp[P] - mp[Q]) << endl;


}

Measured memory_bytes: 6528
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: usize = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };
    let A: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let mut res = vec![(0..N)
        .map(|i| if i % 2 == 0 { A[i] } else { -A[i] })
        .sum::<i64>()];
    for i in 0..(N - 1) {
        let x = res[i] / 2;
        res.push(2 * (A[i] - x));
    }
    let ans = res
        .iter()
        .map(|&x| x.to_string())
        .collect::<Vec<_>>()
        .join(" ");

    println!("{}", ans);
}


Measured memory_bytes: 14588
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
using namespace std;
#define INF 1000000007
using P = pair<int, int>;
using ll = long long;
int main(){
    int n,d;
    cin>>n>>d;
    int x[10][10];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin>>x[i][j];
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            double dis=0;
            for(int k=0;k<d;k++){
                dis+=pow(x[i][k]-x[j][k],2);
            }
            dis=sqrt(dis);
            if(fmod(dis,1)==0)ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 384
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


SIZE = 6
table = [0]*SIZE
N = int(input())

for _ in range(N):
    tmp = float(input())

    if tmp < 165.0:
        table[0] += 1
    elif tmp < 170.0:
        table[1] += 1
    elif tmp < 175.0:
        table[2] += 1
    elif tmp < 180.0:
        table[3] += 1
    elif tmp < 185.0:
        table[4] += 1
    else:
        table[5] += 1

for i in range(1,7):
    print("%d:"%(i),end="")
    for k in range(table[i-1]):
        print("*",end="")
    print()




Measured memory_bytes: 13744
N = str(input())

if(N[-1] == "2" or N[-1] == "4" or N[-1] == "5" or N[-1] == "7" or N[-1] == "9"):
    print("hon")
elif(N[-1] == "0" or N[-1] == "1" or N[-1] == "6" or N[-1] == "8"):
    print("pon")
elif(N[-1] == "3"):
    print("bon")


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

int main() {
  int N;
  cin>>N;
  vector<int>a(N);
  
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  int Alice=0;
  int Bob=0;
  
  for(int i=0;i<N;i++){
    if(i%2==0){
      Alice+=a[i];
    }
    else{
      Bob+=a[i];
    }
  }
  cout<<Alice-Bob<<endl;
  
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<math.h>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>
// 追加１
#include <fstream>



using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

const double PI = 3.14159265358979323846;

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

    cout << setprecision(10) << 2 * N * PI << endl;

    return 0;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

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

int main(){
	int n; cin >> n;
	vector<ll> v(5);
	string m = "MARCH";
	rep(i,n){
		string s; cin >> s;
		if (m.find(s[0]) != string::npos){
			v[m.find(s[0])]++;
		} 
	}
	ll count = 0;
	rep(i,5){
		for (int j = i+1; j < 5; j++){
			for (int l = j+1; l < 5; l++){
				count += v[i]*v[j]*v[l];
			}
		}
	}
	cout << count << endl;
}


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

def binary(a):
    x = a
    out = ''
    while a>0:
        out = str(a % 2) + out
        a = int(a / 2)
    return out

binaryA = [0]*N
for i in range(N-1):
    binaryA[i] = binary(A[i])

S = 0

for i in A:
    S = S ^ i

ans = []
for i in A:
    ans.append(str(S^i))

print(' '.join(ans))


Measured memory_bytes: 53700
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<ctime>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<bitset>
#define ll long long 
#define ull unsigned long long 
#define mem(a) memset(a,0,sizeof(a))
#define rint register int 
#define rll register long long 
#define rull register unsigned long long 
#define rchar register char
#define rstring register string 
#define rfloat register float
#define rdouble register double 
#define fio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define cFor(i,a,b) for(int i=(a);i>(b);i--)
#define cFOR(i,a,b) for(int i=(a);i>=(b);i--)
#define lFor(i,a,b) for(ll i=(a);i<(b);i++)
#define lFOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define lcFor(i,a,b) for(ll i=(a);i>(b);i--)
#define lcFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define watch(a) cout<<#a<<"="<<a<<endl
#define mkp(a,b) make_pair(a,b)
#define inthis cout<<"--------this\n"
#define pr pair
#define iset(a) set<a>::iterator 
#define imap(a,b) map<a,b>::iterator 
#define vec vector
#define fi first
#define se second
#define _For(i,a,b) for(i=a;i<b;i++)
#define _FOR(i,a,b) for(i=a;i<=b;i++)
#define _cFor(i,a,b) for(i=a;i>b;i--)
#define _cFOR(i,a,b) for(i=a;i>=b;i--)
#define _vec vector<int>
#define __vec vector<vector<int>>
#define pb push_back
#define mp map
#define ins insert
#define era erase
#define fin find
#define EXIT exit(0)
#define all(a) a.begin(),a.end()
using namespace std;
_vec a;
int main(){
	fio;
	int n;
	cin>>n;
	while(n--){
		int x;
		cin>>x;
		if(x%2==0)
			a.pb(x);		
	}
	bool found=false;
	For(i,0,a.size())
		if(a[i]%3!=0&&a[i]%5!=0){
			found=true;
			break;
		}
	if(found)
		cout<<"DENIED\n";
	else
		cout<<"APPROVED\n";		
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

void add(ll& a, ll b){a = (a+b) % MOD;}

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

int gcd(ll x, ll y){
  return y ? gcd(y, x%y) : x;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s.substr(0,4)=="YAKI") cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
n = int(input())
aa = list(map(int, input().split()))
aa = [-1] + aa[:]
ans = []
for i in range(n // 2 + 1, n + 1):
    if aa[i]:
        ans.append(i)
for i in range(n // 2, 0, -1):
    s = 0
    for ii in range(i * 2, n + 1, i):
        s += aa[ii]
    if aa[i] == s % 2:
        aa[i] = 0
    else:
        aa[i] = 1
        ans.append(i)
print(len(ans))
if ans:
    print(*ans, sep="\n")


Measured memory_bytes: 12768
#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#ifdef LOCAL
#define D(x) cout<<"D: "<<#x<<'='<<x<<endl;
#define R(x, l) cout<<"R: Array "<<#x<<endl; rep(i, 0, l) cout<<' '<<i<<':'<<*(x+i)<<endl;
#else
#define D(x)
#define R(X, l)
#endif
#define pb push_back
#define int ll
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
inline int _max(int cnt, ...);
inline int _min(int cnt, ...);
signed main(void)
{
	#ifdef LOCAL
//		freopen("C:\\Users\\Joeon\\Desktop\\IN.txt", "r", stdin);
//		freopen("C:\\Users\\Joeon\\Desktop\\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	string str = next<string>();
	rep(i, 0, str.length()) if (str[i] == '7') { puts("Yes"); return 0; }
	puts("No");
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}
inline int _max(int cnt, ...)
{
	int mx = -1e18;
	va_list l;
	va_start(l, cnt);
	while(cnt--) mx = max(mx, va_arg(l, int));
	va_end(l);
	return mx;
}
inline int _min(int cnt, ...)
{
	int mn = 1e18;
	va_list l;
	va_start(l, cnt);
	while(cnt--) mn = min(mn, va_arg(l, int));
	va_end(l);
	return mn;
}


Measured memory_bytes: 3640
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,x,n) for(int i=(x);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)
using namespace std;
int main(){
	long int n,a[100000],b[100000],max=0,ans;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	for(int i=0;i<n;i++){
		if(a[i]>max){
			max=a[i];
			ans=b[i];
		}
	}
	cout<<max+ans<<endl;
	return 0;
}

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


int main(){

  string str;

  cin>>str;

  long long ans=0;

  long long a=0,b=0;
  
  for(int i=0;i<str.length();i++){
    if(str[i]=='B'){
      ans+=(str.length()-i-b-1);
      b++;
    }else{
      ans+=(i-a);
      a++;
    }
  }

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


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 1000000000

/*方針*/
/*
➀a[i][j]を全探索するが、iはどんどん右へ、jはどんどん下へ移動する。
➁この時、a[i][j]が奇数なら、一個コインを右か下にずらす。
➂上記のようにして偶数マスを増やしていく(余ったコインを右下に追い込む)
*/
int main(){
	int h,w;cin>>h>>w;
	vector<vector<int>> a(h,vector<int>(w,0));
	for(int i=0;i<h;i++){//input
		for(int j=0;j<w;j++){
			cin>>a[i][j];
		}
	}

	vector<pair<int,int>> Pbefore,Pafter;//coinの移動前と後
	int did=0;

	int dx[2]={1,0},dy[2]={0,1};//右or下
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			for(int k=0;k<2;k++){
				if(i+dy[k]<0 || i+dy[k]>=h || j+dx[k]<0 || j+dx[k]>=w) continue;//枠外

				if(a[i][j]%2==1){//a[i][j]が奇数ならcoinを右か下へ
					a[i][j]--;
					a[i+dy[k]][j+dx[k]]++;
					did++;//coin移動回数加算
					Pbefore.push_back(make_pair(i,j));//移動前座標
					Pafter.push_back(make_pair(i+dy[k],j+dx[k]));//移動後座標
				}
			}
		}
	}

	cout<<did<<endl;//coin移動回数
	for(int i=0;i<Pafter.size();i++){//座標を表示
		cout<<Pbefore[i].first+1<<" "<<Pbefore[i].second+1<<" ";
		cout<<Pafter[i].first+1<<" "<<Pafter[i].second+1<<endl;
	}

	return 0;
}

Measured memory_bytes: 5228
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
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 dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
#define endl '\n'
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    double N;
    in >> N;
    ll A=N;
    double ans = ceil(N/2)/N;
    //vector<ll> X(N);
    printf("%.6lf",ans);
}

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

int main(){
	int a, b;
	cin >> a >> b;
	if (a > b){
		cout << "a > b" << endl;
	}
	if (a < b){
		cout << "a < b" << endl;
	}
	if (a == b){
		cout << "a == b" << endl;
	}

	return 0;
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int N;
int ans;

void dfs(int cur,int mask){
    if(cur>N) return;
    if(mask==7) ans++;
    dfs(cur*10+3,mask|1);
    dfs(cur*10+5,mask|2);
    dfs(cur*10+7,mask|4);
}

signed main()
{
    cin>>N;
    dfs(0,0);
    cout<<ans<<endl;
} 

Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<algorithm>
#define N 200500
#define LL long long
#define mem(a,b) memset(a,b,sizeof(a));
using namespace std;
LL sum[N],t[N];
LL tree[N];
int n,k,a,m,nn;
void add(int x)
{
    while(x<=nn)//nn为上限，要大于离散化后的最大的数字，
    {
        tree[x]++;
        x+=x&-x;//向上更新，树状数组核心代码。此处就不解释了，不会的先学树状数组。
    }
}
LL query(int x)
{
    LL num=0;
    while(x)
    {
        num+=tree[x];
        x-=x&-x;//向下求和
    }
    return num;
}
int main()
{
    mem(t,0);
    mem(tree,0);
    mem(sum,0);
    scanf("%d%d",&n,&k);
    nn=n+10;
    for(int i=1; i<=n; i++)
    {
        scanf("%d",&a);
        t[i]=sum[i]=sum[i-1]+a-k;//预处理出sum[i]数组（就是上面讲解的num数组）
    }//t[i]数组为离散化的辅助数组
    sort(t,t+n+1);//排序，排n+1个数字的序（包括了sum[0]）
    m=unique(t,t+n+1)-t;//去重
    for(int i=0; i<=n; i++)
        sum[i]=lower_bound(t,t+m+1,sum[i])-t+1;//离散化
    LL ans=0;
    for(int i=0;i<=n;i++)
    {
        ans+=query(sum[i]);//查询有多少个小于sum[i]的数字
        add(sum[i]);//更新树桩数组。
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 5120
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
   int a, b;
   cin >> a >> b;
   if (a + b >= 24)
   {
      cout << a + b - 24 << endl;
   }
   else
   {
      cout << a + b << endl;
   }
   return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(Type, ...)  Type __VA_ARGS__; input(__VA_ARGS__)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
inline i64  sigma(i64 n)            { return (n * (n + 1) >> 1); }
inline i64  updiv(i64 a, i64 b)     { return (a + b - 1) / b; }
inline i64  sqr(i64 n)              { return n * n; }
inline string to_string(char c)     { return string(1, c); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}
template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void input() {}
template <class Head, class... Tail>
inline void input(Head &head, Tail&... tail) { cin >> head; input(tail...); }

inline void print() { cout << "\n"; }
template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}

template <typename Func>
struct FixPoint : Func {
    inline constexpr FixPoint(Func &&f) noexcept : Func(forward<Func>(f)) {}

    template <typename... Args>
    inline decltype(auto) operator()(Args &&... args) const {
        return Func::operator()(*this, forward<Args>(args)...);
    }
};

template< typename Func >
inline decltype(auto) makeFixPoint(Func &&f) {
    return FixPoint< Func >{forward< Func >(f)};
}
// }}} End Header

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

    var(int, X, Y);

    auto f = [](int n) {
        if (n == 3) return 100000;
        if (n == 2) return 200000;
        if (n == 1) return 300000;
        return 0;
    };

    i64 ans = f(X) + f(Y);

    if (X == Y && X == 1)  ans += 400000;

    print(ans);
    return 0;
}


Measured memory_bytes: 892
#include <stdio.h>

int main(void)
{
	int n, a[1000], i;

	scanf("%d",&n);
	for (i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	for (i = n - 1;i >= 0;i--)
	{
		printf("%d", a[i]);
		if (i != 0)
		{
			printf(" ");
		}
		else
		{
			printf("\n");
		}
	}

	return 0;
}


Measured memory_bytes: 2044
#include <stdio.h>

int main(void) {
	int h,m,s,i,ss,fh,fm,fs,fss;
	for(i = 1;i <= 3;i++){
		scanf("%d%d%d",&h,&m,&s);
		scanf("%d%d%d",&fh,&fm,&fs);
		ss = h * 3600 + m * 60 + s;
		fss = fh * 3600 + fm * 60 + fs;
		ss = fss - ss;
		h = ss / 3600;
		ss = ss - h * 3600;
		m = ss / 60;
		ss = ss - m * 60;
		s = ss;
		printf("%d %d %d\n", h, m, s);
	}
	return 0;
}

Measured memory_bytes: 1028
#include<stdio.h>
int prime(int x);

int main (){
  int i,n,a[10001],count=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    count+=prime(a[i]);
  }
  printf("%d\n",count);
  return 0;
}

int prime(int x){
  int i;
  if(x==2)return 1;
  else if(x%2==0||x==1)return 0;

  for(i=3;i*i<x+1;i++){
    if(x%i==0)return 0;
  }
  return 1;
}


Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;
main()
{
    int a,b,c,e,d,f,i,j,k;
    string t;
    cin>>t;
    if((t.compare("Sunny"))==0)
        cout<<"Cloudy"<<endl;
        if((t.compare("Cloudy"))==0)
    cout<<"Rainy"<<endl;
    if((t.compare("Rainy"))==0)
        cout<<"Sunny"<<endl;
        return 0;

}



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

int main() {
	int H,N;
    string ans="No";
    cin >> H >> N;
    vector<int> A(N);
    for(int& e:A)cin >> e;
   if(H <= accumulate(A.begin(),A.end(),0)){
     ans = "Yes";
   }
	cout << ans << endl;
	return 0;
}


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

int main() {
  int64_t P,K,Z=0,Q=1000000007;
  cin>>P>>K;
  vector<int64_t> p(K+1);
  for(int64_t j=K;j>=1;j--){
    int64_t i=K/j;
    int64_t N=P; //ここから
       int64_t a=1,b=0,c=1;
       while(N>0){
         a*=2;
         if(N%a!=0){
           N-=a/2;
           int64_t d=i;
           for(int j=0;j<b;j++){
            d=d*d;
             d=d%Q;
          }
           c=c*d;
          c=c%Q;
         }
        b++;
      } //ここまで
    
    for(int64_t k=2*j;k<=K;k+=j){
      c=(c-p.at(k))%Q;
    }
    p.at(j)=c;
    Z=(Z+c*j)%Q;
  }
  if(Z>=0){
  cout<<Z<<endl;
  }
  else{
    cout<<Q+Z<<endl;
  }
}




Measured memory_bytes: 4012
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
#include<complex>
#include<queue>
#include<stdlib.h>
#include<map>
#define ll long long

using namespace std;

int check(int a,vector<int> A){
    int r=0;
    while(a!=0){
        r=a%10;
        for(int i=0;i<A.size();i++){
            if(r==A[i]){
                return 0;
            }
        }
        a=a/10;
    }
    return 1;
}

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> D(K,0);
    for(int i=0;i<K;i++){
        cin >> D[i];
    }
    int j=N;
    while(check(j,D)!=1){
        j++;
    }
    cout << j << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
flag = True
for i in a:
    if i % 2 == 1:
        continue
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    flag = False

if flag:
    print("APPROVED")
else:
    print("DENIED")


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

n = int(input())
xy = [[] for _ in range(n)]

for i in range(n):
    a = int(input())
    for _ in range(a):
        xy[i].append(list(map(int,input().split())))

li = []
ans = 0

def main(li):
    if len(li) == n:
        hantei(li)
    else:
        li.append(0)
        main(li)
        li.pop(-1)
        li.append(1)
        main(li)
        li.pop(-1)

def hantei(li):
    global ans
    flag = True
    for i in range(n):
        if li[i] == 1:
            for x,y in xy[i]:
                if li[x-1] != y:
                    flag = False
    if flag:
        ans = max(ans, sum(li))

if __name__ == '__main__':
    main(li)
    print(ans)


Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
    if(a%2 != 0){
      System.out.println(a*2);
    }else{
      System.out.println(a);
    }
	}
}

Measured memory_bytes: 23252
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
  int p, q;
  string str, buf;
  vector<string> vec;

  while(!cin.eof()){
    p = q = 0;
    buf = "";

    while(getline(cin, str) && str != "END_OF_TEXT") vec.push_back(str);
    while(getline(cin, str) && str != "-"){
      if(str == "a") q = 0;

      if(str == "e") q = vec[p].size();

      if(str == "p"){
	if(p > 0) --p;
	q = 0;
      }

      if(str == "n"){
	if(p < vec.size()-1) ++p;
	q = 0;
      }

      if(str == "f"){
	if(q < vec[p].size()) ++q;
	else if(q == vec[p].size() && p < vec.size()-1){
	  ++p;
	  q = 0;
	}
      }

      if(str == "b"){
	if(q > 0) --q;
	else if(q == 0 && p > 0){
	  --p;
	  q = vec[p].size();
	}
      }

      if(str == "d"){
	if(q == vec[p].size()){
	  if(vec.size()-1 > p){
	    vec[p] += vec[p+1];
	    vec.erase(vec.begin()+(p+1));
	  }
	} else if(q < vec[p].size()){
	  vec[p].erase(vec[p].begin()+q);
	}
      }

      if(str == "k"){
	if(q == vec[p].size()){
	  if(vec.size()-1 > p){
	    vec[p] += vec[p+1];
	    vec.erase(vec.begin()+(p+1));
	    buf = "\n";
	  }
	} else if(q < vec[p].size()){
	  buf = vec[p].substr(q);
	  vec[p] = vec[p].substr(0, q);
	}
      }

      if(str == "y" && buf.size()){
	if(buf == "\n"){
	  string s1 = vec[p].substr(0, q), s2 = vec[p].substr(q);
	  vec[p++] = s1;
	  vec.insert(vec.begin()+(p), s2);
	  q = 0;
	} else {
	  // vec[p] = vec[p].substr(0, q)+buf+vec[p].substr(q);
	  vec[p].insert(q, buf);
	  q += buf.size();
	}
      }
    }

    for(int i = 0; i < vec.size(); ++i)
      cout << vec[i] << endl;
    
    buf.clear();
    vec.clear();
  }
  
  return 0;
}

Measured memory_bytes: 0
import bisect

N = int(input())
X = list(int(x) for x in input().split())
Y = sorted(X)
m1 = Y[N//2-1]
m2 = Y[N//2]

for x in X:
    if bisect.bisect_left(Y, x) > N//2-1:
        print(m1)
    else:
        print(m2)

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

class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var N = input[0];
        var M = input[1];
        var Q = input[2];

        var a = new int[Q];
        var b = new int[Q];
        var c = new int[Q];
        var d = new int[Q];
        for (int i = 0; i < Q; i++)
        {
            var input2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            a[i] = input2[0];
            b[i] = input2[1];
            c[i] = input2[2];
            d[i] = input2[3];
        }

        var A = new int[N + 1];
        var result = 0;

        void Solver(int n, int t)
        {
            if (t == N + 1)
            {
                var sum = 0;
                for (int i = 0; i < Q; i++)
                {
                    if (A[b[i]] - A[a[i]] == c[i])
                    {
                        sum += d[i];
                    }
                }
                if (sum > result)
                {
                    result = sum;
                }
                return;
            }
            A[t] = n;
            while (n <= M)
            {
                Solver(n, t + 1);
                n++;
            }
            return;
        }
        Solver(1, 1);

        Console.WriteLine(result);
    }
}


Measured memory_bytes: 28328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define repd(i, a, b) for (int i = a; i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int main()
{
    int r, g, b;
    cin >> r >> g >> b;
    if ((r * 100 + g * 10 + b) % 4 == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 3592
<?php
error_reporting(0);
$A = explode(" ",trim(fgets(STDIN)));
//list($A,$B,$C) = explode(" ",trim(fgets(STDIN)));
$N = array_count_values($A);
foreach($N as $k => $n) {
  if ($n == 1) {
    printf("%d\n",$k);
  }
}


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

int main() {
    int n, m; cin >> n >> m;
    vector<int> h(n+1);
    vector<int> to[n+1];
    rep(i,n) cin >> h[i+1];
    int ans = 0;
    rep(i,m) {
        int a, b;
        cin >> a >> b;

        to[a].push_back(h[b]);
        to[b].push_back(h[a]);
    }

    rep(i,n) {
        if(to[i+1].size() == 0) {
            ans++;
            continue;
        }
        vector<int>::iterator iter = max_element(to[i+1].begin(), to[i+1].end());
        if(h[i+1] > *iter) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 8780
#include <bits/stdc++.h>
using namespace std;
    #define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
    #define ll long long
    #define int long long 
    #define ull unsigned long long 
    #define ld long double
    #define sb __builtin_popcount
    #define vi vector<int>
    #define vc vector<char>
    #define ii pair<int, int>
    #define pq priority_queue<ii, vector<ii>, greater<ii>>
    #define vii vector<ii>
    #define sz(a) int((a).size())
    #define f(a, b) for (int i = a; i < b; i++)
    #define fr(a, b) for (int i = a - 1; i >= b; i--)
    #define tr(x, m) for (auto x : m)
    #define in(a, b) (b.find(a) != string::npos)
    #define minin(a) *min_element(all(a))
    #define maxin(a) *max_element(all(a))
    #define X first
    #define Y second
    #define fill(a, x) memset(a, x, sizeof(a))
    #define pb push_back
    #define pf push_front
    #define mp make_pair
    #define all(v) v.begin(), v.end()
    #define rall(v) reverse(v.begin(), v.end())
    #define unq(v) v.erase(unique(all(v)), v.end())
    #define el "\n"
    #define mx3(a, b, c) max(max(a, b), c)
    #define mn3(a, b, c) min(min(a, b), c)
    #define S(v) accumulate(all(v), (ll)0)
    #define SP(n) cout.precision(n)
    const ld PI = atan(1.0) * 4.0;
    const ll MOD = 1e9 + 7;
    const ll INF = 1e18;
    const ld EPS = 0.0000001;
    const ll MD = 998244353;


        int32_t main() {
            fio;
            int s,w;
            cin>>s>>w;
            if(w>=s)cout<<"unsafe";
            else cout<<"safe";
            return 0;
        }


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
 
int main(){
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);
  	int n;
  	cin >>n;
  	string s,t;
  	cin >>s>>t;
  	for (int i=0; i<n; i++){
    	cout <<s[i]<<t[i];
    }
  	cout <<"\n";
	return 0;
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
c = Counter(a)

ans = 0
for v in c.values():
    ans += (v * (v - 1)) // 2 if v > 1 else 0

for i in range(n):
    n_i = c[a[i]]
    print(ans - (n_i - 1))

Measured memory_bytes: 88012
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        char[] arr = sc.next().toCharArray();
        int k = sc.nextInt();

        for(int i = 0; i < arr.length; i++) {
        	if(arr[i] == 'a') continue;
        	int diff = 26 - (arr[i] - 'a');
        	if(diff <= k) {
        		k -= diff;
        		arr[i] = 'a';
        	}
        	if(k == 0) break;
        }
        if(k > 0) {
        	k = k % 26;
        	k = (k + (arr[arr.length-1] - 'a')) % 26;
        	arr[arr.length - 1] = (char)(k + 'a');
        }
        System.out.println(new String(arr));
    }
}


Measured memory_bytes: 28272
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define x first
#define y second
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define endl '\n'

int c[2020];
int main()
{
	c[0]=1;
	string s;
	cin>>s;
	reverse(all(s));
	int curr=0;
	long long an=0,m=1;
	for(auto x:s){
		curr=(curr+(x-'0')*m)%2019;
		m=(m*10)%2019;
		// cout<<curr<<endl;
		an+=c[curr];
		c[curr]++;
	}
	cout<<an<<endl;
	return 0;
}

Measured memory_bytes: 3752
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double PI = 3.14159265358979;
const double E = 2.718281828459045;
const double root2 = sqrt(2);
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	int n;
	while (cin >> n) {
		if (n == 0)break;
		int k; int ke[100];
		for (int i = 0; i < n; i++) {
			cin >> k; ke[i] = k;
		}
		string s; cin >> s;
		int len = s.length();
		for (int i = 0; i < len; i++) {
			if ('a'<=s[i]&&s[i]<='z') {
				int t = s[i] - 'a';
				t -= ke[i%n];
				if (-26 <= t && t < 0) {
					char out = t + 26 + 'A';
					cout << out;
				}
				else {
					char out = (t + 52)%52 + 'a';
					cout << out;
				}
			}
			else {
				int t = s[i] - 'A';
				t -= ke[i%n];
				if (-26 <= t && t < 0) {
					char out = t + 26 + 'a';
					cout << out;
				}
				else {
					char out = (t + 52) % 52 + 'A';
					cout << out;
				}
			}
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3112
N, L = list(map(int, input().split()))
dict_N = {}
min_zero = 100 + 200 - 1
min_id = 0
for i in range(1, N + 1):
    dict_N[i] = L + i - 1
    if min_zero > abs(dict_N[i]):
        min_zero = abs(dict_N[i])
        min_id = i

del dict_N[min_id]
print(sum(dict_N.values()))


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;

int main(void){
    int n,a[100000] = {0},ans[100000] = {0};
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
        ans[a[i]] = i;
    }
    for(int i = 1;i <= n;i++){
        cout << ans[i];
        if(i < n)cout << " ";
        else cout << endl;
    }
}

Measured memory_bytes: 1536
import sys
from collections import deque
from collections import  Counter
import statistics
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
aaa = na()
ct = 0
for i in range(n):
    while True:
        if aaa[i] % 2 == 0:
            aaa[i] //= 2
            ct += 1
        else:
            break
print(ct)


Measured memory_bytes: 6284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }

//long longのシフト演算には気をつけよう

int main(){
    string o, e; cin >> o >> e;

    string ans = "";
    for(int i=0; i<e.size(); i++){
        ans += o[i];
        ans += e[i];
    }

    if(o.size() > e.size()) ans += o[o.size()-1];

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>

using namespace std;

int main()
{
    int r, D, x;
    cin >> r >> D >> x;
    int sum = 0;
    vector<int> ans(10);
    int A, B, C, Z, E, F, G, H, I, J;
    A += r*x-D;
    B += r*A-D;
    C += r*B-D;
    Z += r*C-D;
    E += r*Z-D;
    F += r*E-D;
    G += r*F-D;
    H += r*G-D;
    I += r*H-D;
    J += r*I-D;
    cout << A << endl;
    cout << B << endl;
    cout << C << endl;
    cout << Z << endl;
    cout << E << endl;
    cout << F << endl;
    cout << G << endl;
    cout << H << endl;
    cout << I << endl;
    cout << J << endl;
}

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


void solve(int N, std::vector<int> V, std::vector<int> C){
    int temp=0;
    for(int i=0;i<N;i++){
        if(V[i]-C[i]>0){
            temp+=V[i]-C[i];
        }
    }
    printf("%d\n",temp);
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int N;
    scanf("%d",&N);
    std::vector<int> V(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%d",&V[i]);
    }
    std::vector<int> C(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%d",&C[i]);
    }
    solve(N, std::move(V), std::move(C));
    return 0;
}


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

int main() {
  int N = 0;
  int K = 0;
  int cnt = 0;
  
  cin >> N >> K;
  
  vector<int> hight(N);
  for(int i = 0; i < N; i++){
    cin >> hight.at(i);
  }
  
  sort(hight.begin(), hight.end());
  
  for(int i = 0; i < N; i++){
    if(hight.at(i) >= K){
      break;
    }
    cnt++;
  }
  cout << N - cnt << endl;
}

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

public class Main {
	boolean[] have;
	int[] num;

	public static void main(String[] args) {
		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			num = new int[n];
			for (int i = 0; i < n; i++) {
				num[i] = scanner.nextInt();
			}
			Arrays.sort(num);
			have = new boolean[n];
			have[0] = true;
			System.out.println(dfs(1, num[n - 1] - num[0]) ? "YES" : "NO");
		}

	}

	private boolean dfs(int k, int rest) {
		if (rest == 0) {
			boolean[] t = Arrays.copyOf(have, have.length);
			return greedy(t);
		}
		if (num[k] > rest)
			return false;
		have[k] = true;
		if (dfs(k + 1, rest - num[k]))
			return true;
		have[k] = false;
		return dfs(k + 1, rest);
	}

	private boolean greedy(boolean[] t) {
		for (int i = 0; i < have.length - 1; i++) {
			if (!t[i]) {
				if (!choice(i - 1, num[i], t)) {
					return false;
				}
				t[i] = true;
			}
		}
		return true;
	}

	private boolean choice(int k, int rest, boolean[] t) {
		if (rest == 0)
			return true;
		if (k < 0)
			return false;
		if (!t[k])
			return choice(k - 1, rest, t);
		if (num[k] <= rest) {
			t[k] = false;
			if (choice(k - 1, rest - num[k], t))
				return true;
			t[k] = true;
		}
		return choice(k - 1, rest, t);
	}
}

Measured memory_bytes: 27380
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007

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

int main(){
    ll k,n,ans=0;
    cin >> k >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    for(ll i=0;i<n;i++){
        ll x,y;
        x=a[i]-a[((i-1)+n)%n];
        if(i==0) x=a[i]+k-a[((i-1)+n)%n];
        y=a[((i+1)+n)%n]-a[i];
        if(i==n-1) a[((i+1)+n)%n]-a[i]+k;
        x=max(x,y);
        ans=max(ans,x);
    }
    
    cout << k-ans << endl;

    return 0;
}











Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 40005
using namespace std;

int h,n,a[N],b[N],f[N],maxn;

inline int read(){
	int s=0,t=1;
	char c=getchar();
	while((c<'0'||c>'9')&&c!='-')c=getchar();
	if(c=='-')c=getchar(),t=-1;
	while(c>='0'&&c<='9')s=(s<<1)+(s<<3)+(c^48),c=getchar();
	return s*t;
}

int main(void){
	h=read();
	n=read();
	for(int i=1;i<=n;i++){
		a[i]=read();
		b[i]=read();
		b[i]=a[i]-b[i];
		maxn=max(maxn,a[i]+h);
	}
	f[0]=0;
	for(int i=1;i<=maxn;i++)
	f[i]=-0x3f3f3f3f;
	for(int i=1;i<=n;i++){
		for(int j=a[i];j<=maxn;j++)
		if(f[j-a[i]]!=-0x3f3f3f3f)
		f[j]=max(f[j],f[j-a[i]]+b[i]);
	}
//	for(int i=0;i<=maxn;i++)
//	printf("%d %d\n",i,f[i]);
	int ans=0x3f3f3f3f;
	for(int i=h;i<=maxn;i++)
	if(f[i]!=-0x3f3f3f3f)
	ans=min(ans,i-f[i]);
	printf("%d\n",ans);
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
ll fact(int N){
  if(N==1) return 1;
  return fact(N-1)*N%1000000007;
}
int main(){
  ll N,M;
  cin>>N>>M;
  ll ans;
  if(N==M) ans=2*fact(N)*fact(N)%1000000007;
  else if(abs(N-M)==1) ans=fact(max(N,M))*fact(min(N,M))%1000000007;
  else ans=0;
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include<math.h>
#include<string.h>
int main()
{
 long int x,y,z,sum,i=0,k;
 char a[100000]; 
 gets(a);
 printf("%c",a[0]);
 for(i=1;i<strlen(a);i++)
 {
     if(i%2==0)
     {
      printf("%c",a[i]);   
     }
     
 }
 

    return 0;
}


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

typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;

int n;

ll dp[101][4][4][4] = {};

int main() {
    cin >> n;
    const int A = 0, C = 1, G =  2, T = 3;
    for (int k=0;k<4;k++) {
        for (int l=0;l<4;l++) {
            for (int m=0;m<4;m++) {
                if (k==A && l==G && m==C) continue;
                if (k==A && l==C && m==G) continue;
                if (k==G && l==A && m==C) continue;
                dp[3][k][l][m] = 1;
            }
        }
    }

    for (int i=3;i<=n;i++) {

        for (int j=0;j<4;j++) {
            for (int k=0;k<4;k++) {
                for (int l=0;l<4;l++) {
                    for (int m=0;m<4;m++) {
                        if (k==A && l==G && m==C) continue;
                        if (k==A && l==C && m==G) continue;
                        if (k==G && l==A && m==C) continue;
                        if (j==A && l==G && m==C) continue;
                        if (j==A && k==G && m==C) continue;

                        dp[i+1][k][l][m] += dp[i][j][k][l];
                        dp[i+1][k][l][m] %= mod;
                    }
                }
            }
        }
    }

    ll ans = 0;
    for (int j=0;j<4;j++) {
        for (int k=0;k<4;k++) {
            for (int l=0;l<4;l++) {
                ans += dp[n][j][k][l];
                ans %= mod;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define ll long long
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define per(i, b, a) for(int i = (b); i >= (a); i--)
using namespace std;
const int N = 1e5 + 9, P = 1e9 + 7;
int n, l, r;
ll A, B, ans, minn, a[N], dp[N], sum[N];//dp[i]:第一个集合最后一个是i的方案数
int main(){
    scanf("%d%lld%lld", &n, &A, &B);
    rep(i, 1, n) scanf("%lld", &a[i]);
    if(B > A) swap(A, B);
    sort(a + 1, a + n + 1);
    if(n == 2){
        if(a[2] - a[1] >= A) printf("4\n");
        else if(a[2] - a[1] >= B) printf("3\n");
        else printf("2\n");
        return 0;
    }
    rep(i, 1, n - 2) if(a[i + 2] - a[i] < B){
        printf("0");
        return 0;
    }
    dp[1] = sum[1] = 1, minn = a[2] - a[1], dp[2] = a[2] - a[1] >= A ? 2 : 1, sum[2] = dp[2] + 1;
    rep(i, 3, n){
        while(a[i] - a[r + 1] >= A) r++;
        if(a[i - 1] - a[i - 2] < B) l = i - 2;
        if(l == 0) {
            if(r == 0) dp[i] = minn >= B;
            else dp[i] = (sum[r] + 1) % P;
        }
        else dp[i] = l <= r ? (sum[r] - sum[l - 1] + P) % P : 0; 
        sum[i] = (sum[i - 1] + dp[i]) % P, minn = min(minn, a[i] - a[i - 1]);
        //cout << i << " " << l << " " << r << " " << dp[i] << endl;
    }
    per(i, n - 1, 1) {
        ans = (ans + dp[i]) % P;
        if(a[i + 1] - a[i] < B) break;
    }
    bool ok = true;
    rep(i, 2, n) ok = ok && (a[i] - a[i - 1] >= B);
    printf("%lld", (ans + dp[n] + ok) % P);
    return 0;
}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b){
    cout << c << endl;
    return 0;
  }
  else if(a == c){
    cout << b << endl;
    return 0;
  }
  else{
    cout << a << endl;
    return 0;
  }
}

Measured memory_bytes: 256