akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#include <bitset>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1e9+7
using namespace std;
typedef long long ll;
const double pi=acos(-1);

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

int main(){
    string s;
    cin >> s;
    int ans=0,tmp=0;
    for(int i=0;i<3;i++){
        if(s[i]=='R')tmp++;
        else tmp=0;
        ans=max(ans,tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
char c[5][5];
int main()
{
	for(int i=1;i<=3;i++)
	{
		for(int j=1;j<=3;j++)
			scanf("%c",&c[i][j]);
		char t=getchar();
	}
	for(int i=1;i<=3;i++)
	printf("%c",c[i][i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

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

template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_mset;

#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'


string s, t;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	//ifstream cin("/Users/konwoo/input.txt");
	//ofstream cout("/Users/konwoo/output.txt");

	cin >> s >> t;
	cout << t + s << newl;

















	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

/**
 * @author Pavel Mavrin
 */
public class Main {

    private static final long MOD = (long) (1e9 + 7);

    private void solve() throws IOException {
        long n = Long.parseLong(next()) + 1;
        String s = Long.toBinaryString(n);
        int m = s.length();
        int[] a = new int[m];
        Arrays.fill(a, -1);
        long res = 0;
        for (int i = 0; i < m; i++) if (s.charAt(i) == '1') {
            for (int j = 0; j < i; j++) {
                a[j] = s.charAt(j) - '0';
            }
            a[i] = 0;
            res += calc(a);
            res %= MOD;
        }
        out.println(res);
    }

    private long calc(int[] a) {
        long q = 1, w = 0;
        for (int i = a.length - 1; i >= 0; i--) {
            long qq = 0, ww = 0;            
            if (a[i] != 1) {
                qq += q;
                ww += (q + w);
            }
            if (a[i] != 0) {
                qq += (q + w);
                ww += w;
            }
            q = qq % MOD;
            w = ww % MOD;
        }
        return q;
    }


    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;
    PrintWriter out = new PrintWriter(System.out);

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

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

    private void run() throws IOException {
        solve();
        out.close();
    }

}


Measured memory_bytes: 8272
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(int)(n);++i)
using namespace std;
int main()
{
  int n,p=0,w=0,g=0,y=0;
  string s;
  cin>>n;
  for(int i=0;i<n;++i){
    cin>>s;
    if(s=="P")p=1;
    if(s=="W")w=1;
    if(s=="G")g=1;
    if(s=="Y")y=1;
  }
  if(p+w+g==3){
    if(y==0){
    cout<<"Three"<<endl;
    return 0;
    }
    if(y=1){
      cout<<"Four"<<endl;
      return 0;
    }
    
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
#define PI 3.14159265359
#define MOD 1000000007
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;

int main(){

    int r,c; cin >> r >> c;
    vector<vector<int>> rc(r,vector<int>(c));
    rep(i,r)rep(j,c) cin >> rc.at(i).at(j);
    int sum = 0;
    rep(i,r){
        rep(j,c) cout << rc.at(i).at(j) << " ";
        sum += accumulate(all(rc.at(i)),0);
        cout << accumulate(all(rc.at(i)),0) << endl;
    }
    rep(i,c){
        int sum_min = 0;
        rep(j,r) sum_min += rc.at(j).at(i);
        cout << sum_min << " ";
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3144
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>

#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;

long long cost_max = 0xFFFFFFFF;

int main() {
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> C(N);
    vector<int> master(M);
    vector<vector<int>> A(N);
    rep(i, N) {
        cin >> C[i];
        vector<int> tmp(M);
        rep(j, M) {
            cin >> tmp[j];
        }
        A[i] = tmp;
    }


    long long ret = cost_max;

    for (int bit = 0; bit < (1<<N); ++bit) {
        long long cost = 0;
        vector<int> tmp(N);
//        cout << "pick:";
        for (int i = 0; i < N; ++i) {
            if (bit & (1<<i)) {
//                cout << i << ", ";
                cost += C[i];
                rep(j, M) {
                    tmp[j] += A[i][j];
                }
            }
        }
        //cout << " " << ret << ": cost: " << cost;
        if (cost >= ret) {
            //cout << 111 << endl;
            continue;
        }
        bool is_cand = true;
//        cout << ": master: ";
        rep(i, M) {
//            cout << tmp[i] << ", ";
            if(tmp[i] < X) {
                is_cand = false;
            }
        }
        if(!is_cand) {
//            cout << 222 << endl;
            continue;
        }
        ret = cost;
//        cout << "ret:" << ret << endl;
    }


    if(ret == cost_max) {
        cout << -1 << endl;
    } else {
        cout << ret << endl;
    }

    return 0;
}


Measured memory_bytes: 3592
import java.util.Scanner;

public class Main {

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

		int a  = sc.nextInt();
		int b = sc.nextInt();
		int m = sc.nextInt();
		int[] a_array = new int[a];
		int[] b_array = new int[b];
		int a_min = Integer.MAX_VALUE;
		int b_min = Integer.MAX_VALUE;
		int ans ;
		for(int i = 0; i < a; i++) {
			a_array[i] = sc.nextInt();
			if(a_array[i] < a_min) {
				a_min = a_array[i];
			}
		}
		for(int i = 0; i < b; i++) {
			b_array[i] = sc.nextInt();
			if(b_array[i] < b_min) {
				b_min = b_array[i];
			}
		}
		
		ans = a_min+b_min;

		for(int i = 0; i < m; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int c = sc.nextInt();
			int result = a_array[x-1]+b_array[y-1]-c;
			if(result<ans) {
				ans = result;
			}
		}
		System.out.println(ans);

	}

}

Measured memory_bytes: 134400
//#pragma GCC optimize("Ofast")   	//Comment optimisations for interactive problems (use endl)
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
 
using namespace std;
 
#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back

#define  dline          cout<<"///REACHED///\n";
#define  deb1(x)        cout<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cout<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cout<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;
 
const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  2e+3+500;
const ll   MAXN1  =  1e+6+8;

string P[100];

 
int main()
{		
 	int n, k;
 	cin >> n >> k;
 	int arr[n+1];

 	for(int i = 1; i <= n; i++)
 		cin >> arr[i];
 	int temp = 1;
 	for(int i = k+1; i<=n; i++)
 	{
 		if(arr[i] > arr[temp])
 			cout << "Yes"<<endl;
 		else
 			cout << "No"<<endl;
 		temp++;
 	}


}

Measured memory_bytes: 4376
from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
size=len(Counter(A).most_common())
if K >= size:
    print(0)
else:
    values, counts = zip(*Counter(A).most_common()[::-1])
    ans=0
    for i in range(size-K):
        ans += counts[i]
    print(ans)

Measured memory_bytes: 59564
#include<bits/stdc++.h>
using namespace std;
int delta=10139;
int mark[100003];
int ted[100003];
int main() {
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int t;
        cin>>t;
        mark[t]=1;
    }
    if(mark[1]==0)
    ted[1]=1;
    if(mark[2]==0)
    ted[2]=1+ted[1];
    for(int i=3;i<=n;i++){
        if(mark[i]==0)
        ted[i]=ted[i-1]+ted[i-2];
        ted[i]=ted[i]%1000000007;
    }
    cout<<ted[n];
}


Measured memory_bytes: 1024
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)  for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;
 
class UnionFind
{
    vector<int> data;
    vector<int> scale;
    public:
    UnionFind(int n)
    {
        for(int i=0;i<n;i++)
        {
            data.push_back(i);
            scale.push_back(1);
        }
    }
    int root(int n)
    {
        if(data[n]==n)
            return n;
        else
            return data[n]=root(data[n]);
    }
    void set(int x,int y)
    {
        if(root(x)==root(y))
            return;
        scale[root(y)]+=scale[root(x)];
        scale[root(x)]=0;
        data[root(x)]=data[root(y)];
    }
    int size(int n)
    {
        return scale[root(n)];
    }
};
 
 
int main(void){
    int N;
    vector<int> x,y;
    vector<pair<int,int> > xp,yp;
    cin>>N;
    REP(i,N){
        int xx,yy;cin>>xx>>yy;
        xp.pb(mp(xx,i));
        yp.pb(mp(yy,i));
    }
    sort(ALL(xp));
    sort(ALL(yp));
    vector<tuple<int,int,int> > vt;
    REP(i,N-1){
        vt.pb(mt(xp[i+1].first-xp[i].first,xp[i+1].second,xp[i].second));
        vt.pb(mt(yp[i+1].first-yp[i].first,yp[i+1].second,yp[i].second));
    }
    sort(ALL(vt));
    int ans=0;
    UnionFind U(N);
    REP(i,SZ(vt)){
        int c=get0(vt[i]),a=get1(vt[i]),b=get2(vt[i]);
        if(U.root(a)!=U.root(b)){
            U.set(a,b);
            ans+=c;
        }
    }
    cout<<ans<<endl;
     return 0;
}

Measured memory_bytes: 7144
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    L,R=map(int,input().split())
    d=R-L
    L%=2019
    d=min(d,2019)
    from itertools import product
    ans=INF
    for i,j in product(range(d+1),repeat=2):
        if(i>=j): continue
        ans=min(ans,(L+i)*(L+j)%2019)
    print(ans)
resolve()

Measured memory_bytes: 39408
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  map<int, int> cnt;
  rep(i, n){
    int k;
    cin >> k;
    rep(j, k){
      int a;
      cin >> a;
      cnt[a]++;
    }
  }
  int ans = 0;
  for(auto a : cnt){
    if(a.second == n) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
(defun splitat (c line)
  (labels ((rec (line acc)
				(let ((pos (position-if (lambda(cc) (char= c cc)) line)))
				  (if pos
					  (rec (subseq line (1+ pos)) (cons (subseq line 0 pos) acc))
					(nreverse (cons line acc))))))
	(rec line nil)))

(defun f(a v b w limit i tlimit)
  (if (= a b)
    t
    (if (< a b)
      (let ((aa (+ a (* v tlimit)))
            (bb (+ b (* w tlimit))))
        (>= aa bb))
      (let ((aa (- a (* v tlimit)))
            (bb (- b (* w tlimit))))
        (<= aa bb)))))
(let ((line0 (mapcar #'parse-integer (splitat #\space (read-line nil nil))))
      (line1 (mapcar #'parse-integer (splitat #\space (read-line nil nil))))
      (line (parse-integer (read-line nil nil))))
  (format t "~A~%" (if (f (car line0) (cadr line0) (car line1) (cadr line1) (expt 10 9) 0 line) "YES" "NO")))


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

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


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

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


Measured memory_bytes: 256
H,W = map(int,input().split())
Ch, Cw = map(int,input().split())
Dh, Dw = map(int,input().split())
S = [list(input()) for _ in range(H)]

INF = H * W

dx = [1, 0, -1, 0]
dy = [0, -1, 0, 1]

num_step = [[INF for w in range(W)] for h in range(H)]
num_step[Ch - 1][Cw - 1] = 0

# スタート地点を定義
queue = [(Ch - 1, Cw - 1)]
num_warp = 0

# 幅優先探索
while not queue == []:
    magic_tiles = []
    while not queue == []:
        h = queue.pop() # here 
        if h[0] == Dh - 1 and h[1] == Dw - 1:
            print(num_warp)
            exit()
        for i in range(4):
            if 0 <= h[0]+dy[i] < H and 0 <= h[1]+dx[i] < W and S[h[0]+dy[i]][h[1]+dx[i]] == '.' \
                 and num_step[h[0]+dy[i]][h[1]+dx[i]] > num_warp:
                queue.append((h[0]+dy[i], h[1]+dx[i]))
                num_step[h[0]+dy[i]][h[1]+dx[i]] = num_warp

        # 魔法を使っていける場所を検討
        mx = [-2, -1 , 0, 1, 2]
        my = [-2, -1 , 0, 1, 2]

        for x in mx:
            for y in my:
                 if 0 <= h[0] + y < H and 0 <= h[1] + x < W and S[h[0] + y][h[1] + x] == '.' \
                     and num_step[h[0] + y][h[1] + x] == INF:
                    magic_tiles.append((h[0] + y, h[1] + x))

    num_warp += 1

    # キューの追加
    for magic in magic_tiles:
        if num_step[magic[0]][magic[1]] == INF:
            num_step[magic[0]][magic[1]] = num_warp
            queue.append((magic[0], magic[1]))

print(-1)

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


def solve(S: str):
    return 'ARC' if S == 'ABC' else 'ABC'


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    print(solve(S))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


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

int main() {
  int n,ans = 1;string s;
  cin >> n >> s;
  for(int i = 0;i < n-1;i++){
    if(s.at(i) != s.at(i+1)) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
import sys
n = int(input())
key = False
if n > 81:
    print('No')
else:
    for i in range(1,10):
        if n % i == 0:
            n2 = n //i
            if 1<= n2 <= 9:
                print('Yes')
                key = True
                break
    if key == False:        
        print('No')

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


struct review {
    string city;
    int score;
};


int main(){
    int H,W;
    cin >> H >> W;
    
    char picture[H * W];
    
    char x;
    for (int i = 0; i < H * W; i++) {
        cin >> x;
        picture[i] = x;
    }
    
    int pic_idx = 0;
    for (int i = 0; i < H + 2; i++) {
        for (int j = 0; j < W + 2; j++) {
            if (i == 0 || i == H + 1 || j == 0 || j == W + 1)
                cout << "#";
            else
                cout << picture[pic_idx++];
        }
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
A,B = map(int,input().split())
S = input()
sp = S.split('-')
if len(sp) != 2:
    print('No')
elif not(sp[0].isdigit() and sp[1].isdigit()):
    print('No')
else:
    print('Yes' if len(sp[0])==A and len(sp[1])==B else 'No')

Measured memory_bytes: 3060
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

sorted_items = sorted(
    ab,
    key=lambda x: x[0]
)
cost = 0
bought = 0
for c, stock in sorted_items:
    for s in range(1, stock + 1):
        bought += 1
        cost += c
        if bought == m:
            print(cost)
            exit()


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

int main(void)
{
    vector<int> a(5,0);
    for(int i = 0; i < 5; ++i)
    {
        int tmp;
        cin >> tmp;
        if(tmp == 0)
        {
            cout << i+1 << endl;
            return 0;
        }        
    }

    

    return 0;
}



Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

string s;

int main(){
	cin >> s;
	if(s[0] != s[1] && s[1] != s[2] && s[2] != s[0])cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut a = read_vec::<i64>();
    let mut b = read_vec::<i64>();
    let mut c = read_vec::<i64>();

    a.sort();
    b.sort();
    c.sort();

    let mut b_comb = vec![0; n];

    for i in 0..n {
        let idx = c.upper_bound(&b[i]);
        b_comb[i] = c.len() - idx;
    }

    let mut accum_b_comb = vec![0; n];
    accum_b_comb[n - 1] = b_comb[n - 1];
    for i in (0..n - 1).rev() {
        accum_b_comb[i] = accum_b_comb[i + 1] + b_comb[i];
    }
    debug!(accum_b_comb);

    let mut ans = 0;
    for anum in a {
        let idx = b.upper_bound(&anum);
        if idx == b.len() {
            continue;
        }
        ans += accum_b_comb[idx];
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

use std::cmp::Ordering;

pub trait BinarySearch<T> {
    fn lower_bound(&self, x: &T) -> usize;
    fn upper_bound(&self, x: &T) -> usize;
}

impl<T: Ord> BinarySearch<T> for [T] {
    fn lower_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();

        while low != high {
            let mid = (low + high) / 2;
            match self[mid].cmp(x) {
                Ordering::Less => {
                    low = mid + 1;
                }
                Ordering::Equal | Ordering::Greater => {
                    high = mid;
                }
            }
        }
        low
    }

    fn upper_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();

        while low != high {
            let mid = (low + high) / 2;
            match self[mid].cmp(x) {
                Ordering::Less | Ordering::Equal => {
                    low = mid + 1;
                }
                Ordering::Greater => {
                    high = mid;
                }
            }
        }
        low
    }
}


Measured memory_bytes: 13168
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> P;
 
#define M 1005
#define MOD 1000000007
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	//freopen("input.txt","rt",stdin);
	
	int r;
	cin>>r;
	
	double ans = (double)(2*(3.1415926535)*r);
	cout<<fixed<<setprecision(5)<<ans<<"\n";
}


Measured memory_bytes: 3820
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define rg register
#define LL long long
#define __space putchar(' ')
#define __endl putchar('\n')
template <typename qwq> inline void read(qwq & x)
{
    x = 0;
    rg int f = 1;
    rg char c = getchar();
    while (c < '0' || c > '9')
    {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9')
    {
        x = (x << 1) + (x << 3) + (c ^ 48);
        c = getchar();
    }
    x *= f;
}
template <typename qaq> inline void print(qaq x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    if (x > 9) print(x / 10);
    putchar(x % 10 + '0');
}
int n,c,k,ans,maxt,seat;//maxt:当前汽车出发时间 seat:已经乘坐人数 
int t[233333];
bool first = true;//是否应新增加一辆汽车 
int main()
{
	read(n),read(c),read(k);
	for (rg int i = 1;i <= n;++i) read(t[i]);
	stable_sort(t + 1,t + 1 + n);
	for (rg int i = 1;i <= n;++i)
	{
		if (first)
		{
			++ans,++seat;//当前乘客要占1个空间 
			maxt = t[i] + k;
			first = false;
		}
		else if (t[i] <= maxt) ++seat;//当前乘客要占1个空间
		else if (t[i] > maxt)//超时,不能上车
		{
			first = true,seat = 0;//更新下一辆车
			--i;//准备重新遍历当前乘客 
		}
		if (seat == c)//坐满了要新加一辆车 
		{
			first = true,seat = 0;//更新下一辆车
			//由于当前乘客坐上了这辆车,故不用重新遍历当前乘客 
		}
	}
	print(ans);
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
/* imp functions
ARRAYS AND STRINGS
	sorting arrays - sort(array,array+n);
	finding size of string - str.length();

VECTORS:
	assign() – It assigns new value to the vector elements by replacing old ones
	push_back() – It push the elements into a vector from the back
	pop_back() – It is used to pop or remove elements from a vector from the back.
	insert() – It inserts new elements before the element at the specified position
	erase(v.begin()+i) – It is used to remove elements from a container from the specified position or range.
	swap() – It is used to swap the contents of one vector with another vector of same type. Sizes may differ.
	clear() – It is used to remove all the elements of the vector container
	emplace() – It extends the container by inserting new element at position
	emplace_back() – It is used to insert a new element into the vector container, the new element is added to the end of the vector
	v.reverse(v.begin(),v.end()) - reversing vector
	v.size() - finding size of vector
	v.sort(v.begin(),v.end()) - sorting vectors
	find(v.begin() , v.end() , element) - finding element in given vector in order n
	lower_bound(v.begin() , v.end() , element) - returns pointer pointing to element equal to or greater than the given element
 	upper_bound(v.begin() ,v.end() , element) -returns pointer pointing to element greater than the given element
*/

/* Properties of modulo:Fermat's little theorem
	(a/b)%m ,where m is prime  = (a%m) * (b^(m-2))%m
*/
using namespace std;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define ll long long 
#define pb push_back
#define gcd __gcd
// checking whether a number is prime or not
bool compare(ll x, ll y){
    return x>y;
}
// checking whether a number is prime or not
ll isprime(ll n){
    if(n==1) return 0;
    else if(n==2) return 1;
    else{
        for(ll i=2;i<=sqrt(n);i++){
            if(n%i==0) return 0;
        }
    return 1;   
    }
}
// returning vector containing all prime numbers less than a given number
vector<ll> get_prime_factors_less_than(ll n){
    vector<ll> factor;
    vector<ll> prime(n,1);
    prime[0]=0,prime[1]=0;
    for(ll i = 2 ; i <= n ; i++){
        if(prime[i]==1){
            for(ll j=i*i;j<=n;j=j+i) prime[j]=0; 
            factor.push_back(i);
        }
    }
    return factor;
}
//returning vector containing index refering to elements of normal array after sorting it
vector<ll> retain_index(ll arr[], ll n){ 
    vector<pair<ll, ll> > vp; 
    for (ll i = 0; i < n; ++i) { 
        vp.push_back(make_pair(arr[i], i)); 
    } 
    sort(vp.begin(), vp.end());
    vector<ll> retain;
    for (ll i = 0; i < vp.size(); i++) { 
        ll a = vp[i].second;
        retain.pb(a);
    }
    return retain;
}
//returns x^y in order logn 
ll power(ll x, ll y) 
{ 
    if (y == 0) return 1; 
    ll a = power(x,y/2);
    if (y % 2 == 0) return a * a; 
    else return x * a * a; 
} 
int main(){
    IOS;
    long double n;
    cin>>n;
    long double a = n/3;
    printf("%Lf",a*a*a);
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int group=1;
	int x;
	int n;
	cin>>n;
	if(n<3)
	{
		cout<<0<<endl;
		return 0;
	}
	while(n-3>2)
	{
		n=n-3;
		group++;
	}
	cout<<group<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef pair<int, int> P;
typedef pair<P, int> PP;

template <typename T>
struct BIT
{
    int n;
    vector<T> bit;
    
    BIT(){}
    
    BIT(int n) : n(n){
        bit.resize(n + 1);
    }
    
    T sum(int i){   // sum of [0, i)
        T res = 0;
        while(i){
            res += bit[i];
            i -= (i & -i);
        }
        return res;
    }
    
    void add(int i, T x){
        i++;
        while(i <= n){
            bit[i] += x;
            i += (i & -i);
        }
    }
};

int c[500005];
int b[500005];
int l[500005];
PP p[500005];
int ans[500005];

int main()
{
    int n, q;
    cin >> n >> q;
    for(int i = 0; i < n; i++){
        b[i] = -1;
        l[i] = -1;
    }
    for(int i = 0; i < n; i++){
        cin >> c[i];
        c[i]--;
        if(b[c[i]] != -1){
            l[i] = b[c[i]];
        }
        b[c[i]] = i;
    }
    for(int i = 0; i < q; i++){
        int l, r;
        cin >> l >> r;
        l--;
        p[i] = PP(P(r, l), i);
    }
    sort(p, p + q);
    int j = 0;
    BIT<int> bit(n);
    for(int i = 0; i < q; i++){
        for(; j < p[i].first.first; j++){
            bit.add(j, 1);
            if(l[j] != -1){
                bit.add(l[j], -1);
            }
        }
        ans[p[i].second] = bit.sum(p[i].first.first) - bit.sum(p[i].first.second);
    }
    for(int i = 0; i < q; i++){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 19408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    ll A, B;
    cin >> A >> B;
    ll ans = 0;
    if (A % 2 == 1) {
        ans ^= A;
        A++;
    }
    if (B % 2 == 0) {
        ans ^= B;
        B--;
    }
    if ((B-A+1)/2 % 2 == 1) ans ^= 1;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
long long n,a[201010],sum,ans,p;
long long calc(long long x)
{
	if(x<0)
		return -x;
	return x;
}
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		p+=a[i];
	}
	ans=p+1e9;
	for(int i=1;i<=n;i++)
	{
		sum+=a[i];
		ans=min(ans,calc(2*sum-p));
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1664
package main
import(
  "fmt"
)
func main(){
  var a, b, k, i int
  fmt.Scan(&a, &b, &k)
  for i=a;i<=b;i++{
    if i<a+k{
      fmt.Println(i)
    }else if i>b-k{
      fmt.Println(i)
    }
  }
}


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

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if(abs(x-a) > abs(x-b)) {
        cout << "B" << endl;
    } else {
        cout << "A" << endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
	int dp[101][4][4];
int main() {
	int N, K; cin >> N >> K;
	vector<int>pasta(N);
	for (int i = 0; i < K; ++i) {
		int A, B; cin >> A >> B;
		A--;  pasta[A] = B;
	}
	memset(dp, 0, sizeof(dp));
	dp[0][0][0]= 1;
	for (int d = 0; d < N; ++d) {
		for (int a = 0; a < 4; ++a) {
			for (int b = 0; b < 4; ++b) {
				for (int c = 1; c <= 3; ++c) {
					if (a == b&&b == c)continue;
					if (pasta[d] && pasta[d] != c)continue;
					dp[d + 1][b][c] += dp[d][a][b];
					dp[d + 1][b][c] %= 10000;
				}
			}
		}
	}
	int ans = 0;
	for (int a = 0; a < 4; ++a) {
		for (int b = 0; b < 4; ++b) {
			ans += dp[N][a][b];
		}
	}
	cout << ans % 10000 << endl;
	return 0;
}

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

const long long mod = 1000000007;

int N, M, A[2009], B[2009], cnt[2009], col[2009], cntv[2009], cnts;
long long dp[2009];
bool used[2009], root[2009];
vector<int> E[2009], G[2009], H[2009], I[2009];

void dfs(int pos) {
	if (col[pos] >= 1) return;
	col[pos] = cnts; E[cnts].push_back(pos);
	for (int i = 0; i < H[pos].size(); i++) dfs(H[pos][i]);
}

void dfs2(int pos) {
	for (int i = 0; i < I[pos].size(); i++) dfs2(I[pos][i]);

	dp[pos] = 1;
	for (int i = 0; i < I[pos].size(); i++) {
		dp[pos] *= (dp[I[pos][i]] + 1LL);
		dp[pos] %= mod;
	}
}

int main() {
	cin >> N >> M;
	for (int i = 1; i <= M; i++) {
		cin >> A[i] >> B[i];
		G[A[i]].push_back(B[i]);
		H[A[i]].push_back(B[i]);
		H[B[i]].push_back(A[i]);
	}
	for (int i = 1; i <= N; i++) {
		if (col[i] >= 1) continue;
		cnts++; dfs(i);
	}
	for (int i = 1; i <= N; i++) {
		if (used[col[i]] == true) continue;
		used[col[i]] = true;

		int cx = i;
		while (cntv[cx] <= 1) {
			cntv[cx]++;
			if (G[cx].size() == 0) break;
			cx = G[cx][0];
		}
	}
	for (int i = 1; i <= N; i++) {
		if (cntv[i] >= 2 || G[i].size() == 0) root[i] = true;
	}
	for (int i = 1; i <= M; i++) {
		if (root[A[i]] == true) continue;
		I[B[i]].push_back(A[i]);
	}

	for (int i = 1; i <= N; i++) {
		if (root[i] == false) continue;
		dfs2(i);
	}

	long long ret = 1;
	for (int i = 1; i <= cnts; i++) {
		long long r = 1;
		for (int pos : E[i]) { if (root[pos] == true) { r *= dp[pos]; r %= mod; } }
		r++; r %= mod;
		ret *= r; ret %= mod;
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 3468
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n): fact(n+1), ifact(n+1){
    assert(n < mod);
    fact[0] = 1;
    for (int i=1; i<=n; ++i)fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i=n; i>=1; --i) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k){
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n-k];
  }
};

int main() {
  int n, k;
  cin >> n >> k;
  k = min(k, n-1);
  combination c(n);
  mint ans;
  for (int i=0; i<=k; i++){
    ans += c(n, i) * c((n-i-1)+i, i);
  }
  cout << ans.x << endl;
  return 0;
}


Measured memory_bytes: 6380
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define mod 1000000007
#define ll long long
#define ull unsigned long long
#define mem(a) memset(a,0,sizeof(a))
#define cio ios::sync_with_stdio(false);

int main()
{
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	ll sum = 0;
	if(k!=0){
		if(k>=a){
			sum += a;
			k -= a;
		}else{
			sum += k;
			k = 0;
		}
	}
	if(k!=0){
		if(k>=b){
			k -= b;
		}else{
			k = 0;
		}
	}
	if(k!=0){
		if(k>=c){
			sum -= c;
			k -= c;
		}else{
			sum -= k;
			k = 0;
		}
	}
	cout << sum << endl;
    return 0;
}



Measured memory_bytes: 3636
import scala.io.StdIn.{readLine,readInt}

object Main {
  def getDigit(x:Int) = if (x>=10) (x-10,1) else (x,0)


  def getSum(s:String,t:String):String = {
    if(s.length > 80 || t.length > 80) "overflow"
    else {
      val (x,y) = if(s.length>t.length) (s,t) else (t,s)
      val f = (i:Int,j:Int) => if(j<0) x(i).asDigit else x(i).asDigit + y(j).asDigit
      def loop(i:Int,j:Int,sum:List[Int],carry:Int):List[Int] =  {
        if(i<0) { if(carry > 0) carry::sum else sum }
        else {
          val (d,c) = getDigit(f(i,j)+carry)
          loop(i-1, j-1, d::sum, c)
        }
      }
      val r = loop(x.length-1,y.length-1,Nil,0).mkString
      if(r.length > 80) "overflow" else r
    }
  }

  def main(args:Array[String]) = for(i<-1 to readInt) println(getSum(readLine,readLine))
}

Measured memory_bytes: 43828
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(ll, N);
  ll ans = 1;
  int i = 0;
  while (ans <= N) {
    i++;
    ans = i * i;
  }
  i--;
  print(i * i);
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	static class pair implements Comparable<pair>{
		public final long left;
		public final long right;

		public pair(long left, long right) {
			this.left = left;
			this.right = right;
		}
		
		public int compareTo(pair p) {
			if(left > p.left)return 1;
			else if(left < p.left)return -1;
			else return 0;
		}

	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		pair a[] = new pair[n];
		for (int i = 0; i < n; ++i) {
			a[i] = new pair(sc.nextLong(), sc.nextLong());
		}
		sc.close();
		Arrays.sort(a);
		long ans = 0, count = 0;
		for (int i = 0; i < n; ++i) {
			long tmp = a[i].right;
			if (count + tmp >= m)
				tmp = m - count;
			count += tmp;
			ans += a[i].left * tmp;
			if (count >= m)
				break;
		}
		System.out.println(ans);

	}

}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
ll n;
ll g[3], b[3];
vector<pair<ll, ll>> p, m;

ll f(vector<pair<ll, ll>> p, ll n) {
  ll ans = n;
  if (p.size() == 3) {
    for (ll i = 0; i <= 5000; i++) {
      for (ll j = 0; j <= 5000; j++) {
        if (n < p[0].first * i + p[1].first * j) continue;
        ll m = n - p[0].first * i - p[1].first * j;
        int k = m / p[2].first;
        m -= p[2].first * k;
        ans = max(ans, m + p[0].second * i + p[1].second * j + p[2].second * k);
      }
    }
  } else if (p.size() == 2) {
    for (ll i = 0; i * p[0].first <= n; i++) {
      ll m = n - p[0].first * i;
      ll j = m / p[1].first;
      m -= j * p[1].first;
      ans = max(ans, m + i * p[0].second + j * p[1].second);
    }
  } else if (p.size() == 1) {
    ll i = n / p[0].first;
    n -= p[0].first * i;
    ans = max(ans, n + i * p[0].second);
  }
  return ans;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cin >> n;
  cin >> g[0] >> g[1] >> g[2] >> b[0] >> b[1] >> b[2];
  ll ans = n;

  for (int i = 0; i < 3; i++) {
    if (g[i] < b[i]) p.emplace_back(g[i], b[i]);
    else if (g[i] > b[i]) m.emplace_back(b[i], g[i]);
  }
  ans = f(p, n);
  ans = f(m, ans);

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


Measured memory_bytes: 256
#include<stdio.h>
#define ARRAY_MAX 50
#define COUNT_RESET 0
#define RETURN 0
#define ARRAY_END -1
#define TEST_ABSENT -1
#define BORDER_A 80
#define BORDER_B 65
#define BORDER_C 50
#define BORDER_D 30

struct test_result{
    signed short ssW_D_mid;
    signed short ssW_D_fin;
    signed short ssW_D_re;
    unsigned char ubW_D_eval;
};

unsigned char s_EVALUATE(signed short ssW_D_mid, signed short ssW_D_fin, signed short ssW_D_re);

int main(){
    struct test_result test[50];
    unsigned short usW_C_i;
    unsigned short usW_C_count = 0;

    for(usW_C_i = 0;usW_C_i < 50;usW_C_i++){
        scanf("%d %d %d", &test[usW_C_i].ssW_D_mid, &test[usW_C_i].ssW_D_fin, &test[usW_C_i].ssW_D_re);
        if(test[usW_C_i].ssW_D_mid == -1 && test[usW_C_i].ssW_D_fin == -1 && test[usW_C_i].ssW_D_re == -1){
            break;
        }
        test[usW_C_i].ubW_D_eval = s_EVALUATE(test[usW_C_i].ssW_D_mid, test[usW_C_i].ssW_D_fin, test[usW_C_i].ssW_D_re);
        usW_C_count++;
    }

    for(usW_C_i = 0;usW_C_i < usW_C_count;usW_C_i++){
        printf("%c\n", test[usW_C_i].ubW_D_eval);
    }

    return 0;
}

unsigned char s_EVALUATE(signed short ssW_D_mid, signed short ssW_D_fin, signed short ssW_D_re){
    signed short ssW_D_sum;
    unsigned char ubW_D_result;

    ssW_D_sum = ssW_D_mid + ssW_D_fin;

    if(ssW_D_mid == -1 || ssW_D_fin == -1){
        ubW_D_result = 'F';
    }
    else if(ssW_D_sum >= 80){
        ubW_D_result = 'A';
    }
    else if(ssW_D_sum >= 65){
        ubW_D_result = 'B';
    }
    else if(ssW_D_sum >= 50){
        ubW_D_result = 'C';
    }
    else if(ssW_D_sum >= 30){
        if(ssW_D_re >= 50){
            ubW_D_result = 'C';
        }
        else{
            ubW_D_result = 'D';
        }
    }
    else{
        ubW_D_result = 'F';
    }

    return ubW_D_result;
}


Measured memory_bytes: 2100
import java.util.*;
import java.io.*;

public class Main {

  private static void solve() {
    int n = nextInt();
    int k = nextInt();

    System.out.println(k > (n + 1) / 2 ? "NO" : "YES");
  }

  private static void run() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);

    solve();

    out.close();
  }

  private static StringTokenizer st;
  private static BufferedReader br;
  private static PrintWriter out;

  private static String next() {
    while (st == null || !st.hasMoreElements()) {
      String s;
      try {
        s = br.readLine();
      } catch (IOException e) {
        return null;
      }
      st = new StringTokenizer(s);
    }
    return st.nextToken();
  }

  private static int nextInt() {
    return Integer.parseInt(next());
  }

  private static long nextLong() {
    return Long.parseLong(next());
  }

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

Measured memory_bytes: 22612
/*2019/09/13 */
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){return *(int*)a-*(int*)b;}
int desc(const void *a,const void *b){return *(int*)b-*(int*)a;}
int llasc(const void *a,const void *b){return *(ll*)a-*(ll*)b;}
int lldesc(const void *a,const void *b){return *(ll*)b-*(ll*)a;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
/*
int asc_t(const void *a,const void *b){return ((struct_t*)a)->member - ((struct_t*)b)->member;}
int desc_t(const void *a,const void *b){return ((struct_t*)b)->member - ((struct_t*)a)->member;}
*/

int main(){
    int n,a[200];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    int cost,min=MIN;
    for(int i=-100;i<=100;i++){
        cost=0;
        for(int j=0;j<n;j++){
            cost+=abs(a[j]-i)*abs(a[j]-i);
        }
        if(min>cost){
            min=cost;
        }
    }
    printf("%d\n",min);
    return 0;
}

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

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

int main()
{
    ll i,j;
    ll n,k,l,r;
    cin >> n >> k >> l >> r;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    ll n1 = n/2;
    ll n2 = n - n1;
    ll bit;
    vector<pair<ll,ll>> p1;
    for(bit = 0;bit < (1 << n1);++bit){
        ll tmp = 0;
        ll num = 0;
        for(i = 0;i < n1;++i){
            if(bit & (1ll << i)){
                tmp += a.at(i);
                ++num;
            }
        }
        if(tmp <= r) p1.emplace_back(num,tmp);
    }
    sort(all(p1));

    vector<pair<ll,ll>> p2;
    for(bit = 0;bit < (1 << n2);++bit){
        ll tmp = 0;
        ll num = 0;
        for(i = 0;i < n2;++i){
            if(bit & (1ll << i)){
                tmp += a.at(i + n1);
                ++num;
            }
        }
        if(tmp <= r) p2.emplace_back(num, tmp);
    }
    sort(all(p2));
    ll ans = 0;
    for(i = 0;i < p1.size();++i){
        ll num = p1.at(i).first;
        ll tmp = p1.at(i).second;
        auto x = lower_bound(all(p2), make_pair(k - num, l - tmp));
        auto y = upper_bound(all(p2), make_pair(k - num, r - tmp));
        ll t = y-x;
        ans += t;
    }
    cout << ans << endl;

    return 0;
}


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

#define MAX 100000

int main(){
	int n,m;	cin>>n>>m;
	vector<pair<int,int>> work(n);
	int a,b;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		work[i]=(make_pair(a,b));// 日にち,
	}
	sort(work.begin(), work.end());

	long long ans=0;
	priority_queue<int> pq;
	int d=1, i=0;
	while(d<=m){
		while(i<n && work[i].first==d){
			pq.push(work[i].second);
			i++;
		}

		if(!pq.empty()){
			ans+=pq.top();	pq.pop();
		}
		d++;

	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 1660
#include <iostream>
#include <vector>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define endl "\n"

struct UnionFind {
    // 自身が根: その集合の要素数に-1を掛けたもの
    // 自身が葉: 根のID
    // -> 根であれは負の数、葉であれば正の数
    vector<int> data;

    // 全てを根として初期化
    UnionFind(int size = 0) : data(size, -1) {}

    // 根の検索
    int root(int x) {
        if(data[x] < 0) return x;
        return x = root(data[x]); // 経路圧縮
    }

    // 集合の結合
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if(x == y) return false;

        // 要素数が小さい方を大きい方に結合する
        if(data[x] > data[y]) swap(x, y); // -data[x] > -data[y] となるようにしたい
        data[x] += data[y]; // 要素数の加算
        data[y] = x; // 集合の結合
        return true;
    }

    // 要素xと要素yが同じ集合に属しているか
    bool same(int x, int y) { return root(x) == root(y); }

    // 要素xが属している集合の大きさ(サイズ)
    int size(int x) { return -data[root(x)]; }
};


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

    UnionFind UF(n);

    rep(i, 0, m){
        int a, b; cin >> a >> b;
        a--;b--;
        UF.unite(a, b);
    }

    int ans = 0;
    rep(i, 0, n){
        ans = max(ans, UF.size(i));
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3616