akhauriyash/Code-Regression huggingface dataset:
// #define STOPIT
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

void debug_impl() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
    #define debug(...)\
    do {\
        cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        cerr << std::noboolalpha;\
    } while (false)
#else
    #define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr>
istream& operator>> (istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr >
ostream& operator<< (ostream& os, Container const& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}
int main()
{
    int n;
    cin >> n;

    long long res = 0;
    rep(i,1, n+1)
    {
        if (i%3 == 0) continue;
        if (i%5 == 0) continue;
        res += i;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define lli long long int
#define ulli unsigned long long int
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
long long int adj[1000][1000];
long long int h[100000+10];
map<long long int,long long int>mp;
long long int val;
long long int answe1,res;
vector<lli>vect[400];
//set<lli>s;
/*void primeFactors(int n)
{
    // Print the number of 2s that divide n
    while (n % 2 == 0)
    {
        s.insert(2);
        n = n/2;
    }

    // n must be odd at this point. So we can skip
    // one element (Note i = i +2)
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        // While i divides n, print i and divide n
        while (n % i == 0)
        {
            s.insert(i);
            n = n/i;
        }
    }

    // This condition is to handle the case when n
    // is a prime number greater than 2
    if (n > 2)
        s.insert(n);
}
*/
int main()
{

    fast;


    lli n,k;
    cin>>n>>k;
    lli INF=1e9+5;
    vector<lli>h(n);
    vector<lli>dp(n,INF);
    for(lli i=0;i<n;i++)
    {
        cin>>h[i];
    }
    dp[0]=0;
    for(lli i=0;i<n;i++)
    {
        for(lli j=i+1;j<=k+i;j++)
            {
                if(j<n)
                {
                    dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
                }
            }
    }
    cout<<dp[n-1];
    return 0;

}


Measured memory_bytes: 1792
import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		
		int[] firstLine = Stream.of(stdin.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		int[] elements = Stream.of(stdin.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		int balls = firstLine[0];
		int maxNumsOfType = firstLine[1];
		int[] cntNums = new int[balls+1];
		Arrays.fill(cntNums, 0);
		int answer = 0;
		for(int num: elements) cntNums[num]++;
		Arrays.sort(cntNums);
		for(int i = 0;i < balls + 1 - maxNumsOfType;i++) answer += cntNums[i];
		System.out.println(answer);
	}
}

Measured memory_bytes: 48512
#include <bits/stdc++.h>
 
#define vi vector<int>
#define tests int t; cin>>t; while(t--)
#define ll long long
#define vll vector<long long>
#define srt(v) sort(v.begin(), v.end())
#define srtg(v) sort(v.begin(), v.end(), greater<int> ())
#define FOR(k, n) for(int k=0; k<n; k++)
#define pb push_back
 
 
using namespace std;
using namespace std::chrono;
 
char nums[10] = { '0','1','2','3','4','5','6','7','8','9' };
char alphsl[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
const ll MOD = 1000000007;
char alphs[26] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
 

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

 
 
int main() {
 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
 
        
        solve();
 
 
    return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;





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

    double w,h,x,y;
    cin>>w>>h>>x>>y;

    double res = w*h/2;

    bool flag = (x==w/2 && y==h/2);
    cout<<fixed<<setprecision(15)<<res<<" ";
    cout<<flag<<endl;
	
    
    return 0;
}


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


def main():
    n = int(input())
    s = list()
    t = list()

    for i in range(n):
        si, ti = map(str, input().split())
        s.append(si)
        t.append(int(ti))

    x = input()
    index = s.index(x)
    print(sum(t[index + 1:]))


if __name__ == '__main__':
    main()


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

int main() {
  int n;
  cin >> n;
  long long ans = 0;
  for ( int i = 0; i < n; i++ ) {
    long long a;
    cin >> a;
    while ( a%2 == 0 ) {
      ans++;
      a /= 2;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    ll n;
    cin >> n;
    vector<ll> S(5, 0); // M A R C H;
    rep(i, n) {
        string t;
        cin >> t;
        if(t[0] == 'M') S[0]++; 
        else if(t[0] == 'A') S[1]++;
        else if(t[0] == 'R') S[2]++;
        else if(t[0] == 'C') S[3]++;
        else if(t[0] == 'H') S[4]++;
    }
    ll ans = 0;
    rep(i, 3) {
        forr(j, i + 1, 4) {
            forr(k, j + 1, 5) {
                ans += S[i] * S[j] * S[k];
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
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; }
typedef long long ll;
typedef pair<int,int> P;

int dp[3005][3005];

int main(){
    string s,t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    for(int i = 1;i<=n;i++){
        for(int j=1;j<=m;j++){
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            if(s[i-1]==t[j-1])chmax(dp[i][j],dp[i-1][j-1]+1);
        }
    }
    //cout << dp[n][m] << endl;
    vector<char>ans;
    while(n!=0&&m!=0){
        if(dp[n][m]==dp[n][m-1])m--;
        else if(dp[n][m]==dp[n-1][m])n--;
        else{
            ans.push_back(s[n-1]);
            n--,m--;
        }
    }
    reverse(ans.begin(),ans.end());
    rep(i,ans.size())cout << ans[i];
    cout << endl;
}

Measured memory_bytes: 35456
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = LS2()
T = LS2()
a = len(S)
b = len(T)

ans = 10000
for i in range(a-b+1):
    x = 0
    for j in range(b):
        if S[i+j] != T[j]:
            x += 1
    ans = min(ans,x)
print(ans)


Measured memory_bytes: 65344
# ABC 094: B – Toll Gates
n, m, x = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]

squares = [0] * (n + 1)

for i in range(m):
    squares[a[i]] = 1

print(min(squares[:x].count(1), squares[x + 1:].count(1)))

Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<Integer> ln = new ArrayList<Integer>(n);
        for (int i = 0; i < n; i++) {
            ln.add(sc.nextInt());
        }

        Collections.sort(ln);
        int s = 0;
        for (int i = n-k; i < n; i++) {
            s += ln.get(i);
        }

        System.out.println(s);
    }

}


Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x,t;
	cin>>n>>x>>t;
	int ans=0;
	if(n<=x){
		ans=t;
	}
	else{
		int q = n/x;
		int r = n%x;
		ans = q*t;
		if(r!=0)
			ans += t;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3616
# include "iostream"
# include "cstdio"

using namespace std;

int A,B;

int main(){
	scanf("%d%d",&A,&B);
	if(A<=0 && B>=0){
		printf("Zero");
		return 0;
	}
	if(A>0){
		printf("Positive");
		return 0;
	}
	if((B-A)&1){
		printf("Positive");
	}else{
		printf("Negative");
	}
	return 0;
}

Measured memory_bytes: 256
Scanf.scanf "%d" (fun n ->
    let l = Array.make n 0 in
    let r = Array.make n 0 in
    for i = 0 to n - 1 do
        Scanf.scanf " %d %d" (fun a b -> l.(i) <- a; r.(i) <- b + 1)
    done;

    let rec loop i p q =
        if i = n then p, q else
            let p = if l.(i) > l.(p) then i else p in
            let q = if r.(i) < r.(q) then i else q in
            loop (i + 1) p q
    in
    let p, q = loop 0 0 0 in

    let result1 =
        let rec loop j acc =
            if j = n then acc + max (r.(q) - l.(p)) 0 else
            if j = p || j = q then loop (j + 1) acc else
                loop (j + 1) (max acc (r.(j) - l.(j)))
        in
        loop 0 0
    in
 
    Printf.printf "%d\n" @@ (
        let work = Array.init n (fun i -> max (r.(i) - l.(p)) 0, max (r.(q) - l.(i)) 0) in
        Array.sort (fun (a0, b0) (a1, b1) -> compare (a0, -b0) (a1, -b1)) work;
        let s = Array.make (n + 1) (r.(p) - l.(p)) in
        let t = Array.make (n + 1) (r.(q) - l.(q)) in
        for i = 1     to     n do t.(i) <- min t.(i - 1) (snd work.(i - 1)); done;
        for i = n - 1 downto 0 do s.(i) <- min s.(i + 1) (fst work.(i    )); done;

        let rec loop i acc =
            if i = n + 1 then acc else loop (i + 1) (max acc (s.(i) + t.(i)))
        in
        loop 0 result1
    )
)

Measured memory_bytes: 12936
k = int(input())
ans = 1
n = 1
digits = [1]
ind = 1
while ind<k:
    ii = 0
    for i in range(n-1):
        if digits[i]<9 and abs(digits[i]+1-digits[i+1])<=1:
            ii = i
            break
    else:
        if digits[-1]==9:
            digits = [0]*n
            digits.append(1)
            n += 1
            ind += 1
            continue
        if n>1:
            ii = n-1
    digits[ii] += 1
    for j in range(ii-1, -1, -1):
        digits[j] = max(digits[j+1]-1, 0)
    ind += 1

for i in reversed(digits):
    print(i, end='')
print()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[5],k;
  for(int i = 0; i < 5; ++i){
    cin >> a[i];
  }
  cin >> k;
  
  for(int i = 0; i < 5; ++i){
    for(int j = i + 1; j < 5; ++j){
      if(abs(a[i] - a[j]) > k){
        cout << ":(" << endl;
        return 0;
      }
    }
  }
  
  cout << "Yay!" << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
	unsigned int key;
	struct node *next;
	struct node *prev;
};
typedef struct node * NodePointer;

NodePointer nil;
void init(){
	nil = malloc(sizeof(struct node));
	nil->next = nil;
	nil->prev = nil;
};
void printList(){
	NodePointer cur = nil->next;
	int isf = 1;
	while(1){
		if ( cur == nil ) break;
		if ( isf == 0 ) printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
		isf = 0;
	}
	printf("\n");
};
void deleteNode(NodePointer t){
	NodePointer pre = t->prev, nex = t->next;
	pre->next = nex;
	nex->prev = pre;
	free(t);
};
void deleteFirst(){
	NodePointer t = nil->next;
	if ( t == nil ) return;
	deleteNode(t);
};
void deleteLast(){
	NodePointer tmp = nil->prev;
	nil->prev = tmp->prev;
	deleteNode(tmp);
};
void delete(int key){
	NodePointer cur = nil->next;
	while (1){
		if ( cur == nil ) break;
		if ( cur->key == (unsigned int)key ){
			deleteNode(cur);
			break;
		}
		cur = cur->next;
	}
};
void insert(int key){
	NodePointer x;
	x = malloc(sizeof(struct node));
	x->key = key;
	x->prev = nil;
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	if ( nil->prev == nil ) nil->prev = x;
};

int main(){
	int key, n, i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for ( i = 0; i < n; i++ ){
		scanf("%s%d",com,&key);
		if ( com[0] == 'i' ){
			insert(key);
			np++;
			size++;
		}
		else if ( com[0] == 'd' ){
			if (strlen(com) > 6){
				if ( com[6] == 'F' ) deleteFirst();
				else if ( com[6] == 'L' ) deleteLast();
			} else {
				delete(key); nd++; 
			}
		size--;
		}
	}

  printList();
  return 0;
}


Measured memory_bytes: 32972
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

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

  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(begin(a), end(a));
  reverse(begin(a), end(a));
  lint ans = 0;
  int cur = 1;
  int prod = 1;
  for (int i = 0; i < n; i++) {
    for (int j = cur; j < min(cur + prod, n); j++) {
      ans += a[i];
    }
    cur += prod;
    prod *= 2;
    prod = min(prod, 2);
  }
  cout << ans << "\n";
}


Measured memory_bytes: 3988
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

int main(){
  int N;
  string S;
  map<string, int> cnt;
  
  cin >> N;
  int cnt_max = 0;
  for(int i = 0;i < N;i++){
    cin >> S;
    cnt_max = max(cnt_max, ++cnt[S]);
  }
  
  for(auto [s, c] : cnt) if(c == cnt_max) cout << s << endl;
  
  return 0;
}

Measured memory_bytes: 19228
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  int a,n,c=0;
  cin>>n;
  rep(i,0,n){
    cin>>a;
    c+=a;
  }
  co(c-n);
  
  return 0;
}

Measured memory_bytes: 256
moji = list(str(input()))
lst = []
for i in range(len(moji)):
  if moji[i]=="0":
    lst.append("0")
  elif moji[i]=="1":
    lst.append("1")
  elif moji[i]=="B" and len(lst)>0:
    del lst[-1]
  elif moji[i]=="B" and len(lst)==0:
    continue;
print(''.join(lst))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
    int s;
    cin >> s;
    vector<int> vec;
    vec.push_back(s);
    for(int i=0; i<=1000000; i++) {
        if(vec.at(i) % 2 == 0) {
            vec.push_back(vec.at(i) / 2);
        } else {
            vec.push_back(3*vec.at(i) + 1);
        }
        for(int j=0; j<=i; j++) {
            if(vec.at(j) == vec.at(i+1)) {
                cout << i+2 << endl;
                return 0;
            }
        }
    }
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 1001001001;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

const int mod = 1000000007;

//< ave , a(time), b(manzoku) >
typedef tuple<double, int, int> A;

int main() {
    int a, b, t;
    cin >> a >> b >> t;

    cout << t / a * b << endl;

}



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

for a in A:
  if(a%2 == 0): count_even += 1
  else: count_odd += 1
    
if(count_odd%2 == 0):
  judge = 1

if(judge == 1): print('YES')
else: print('NO')

Measured memory_bytes: 14108
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;
int w[101],v[101];
ll dp[101][100001]={0};

int main(){
  int N,W;
  cin>>N>>W;
  for (int i(1);i<=N;i++) cin>>w[i]>>v[i];
  for (int ni(1);ni<=N;ni++){
    for (int wi(0);wi<=W;wi++){
      if (wi-w[ni]>=0){
        dp[ni][wi]=max(dp[ni-1][wi],dp[ni-1][wi-w[ni]]+v[ni]);
      }else{
        dp[ni][wi]=dp[ni-1][wi];
      }
    }
  }
  cout << dp[N][W] << endl;
}


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

main()
{
  int a,b;
  cin >> a >> b;
  
  int temp = b;
  while ( temp > 0 ) {
    a *= 10;
    temp /= 10;
  }
  
  a += b;

  int i = 1;
  while ( ( a/i != i || a%i !=0 ) && i <= a){
    i++;
  }
  if ( i != a+1 )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return (0);
}

Measured memory_bytes: 256
program main;

var
	n, m, sum, cnt : integer;
	i : integer;
   	a : array[0..105] of integer;

begin
	sum := 0;
    cnt := 0;
	readln(n, m);
    for i := 0 to n do begin
    	read(a[i]);
        sum := sum + a[i];
    end;
    
    for i := 0 to n do begin
    	if a[i] >= sum / (4 * m) then
        	cnt := cnt + 1;
    end;
    
    if cnt >= m then
    	writeln('Yes')
    else
    	writeln('No');
end.

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

int main(){
  int waitingTime;
  int sumTime = 0;
  int maxTemp = 0;
  for(int i=0; i<5; i++){
    cin >> waitingTime;
    sumTime += (waitingTime+9)/10*10;
    if(waitingTime%10 != 0)
      maxTemp = max(maxTemp, 10-waitingTime%10);
  }
  cout << sumTime - maxTemp << endl;
  return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc131/tasks/abc131_d
#include <bits/stdc++.h>
using namespace std;

int main(void){
  int N;
  cin >> N;
  vector<pair<int, int>> vp(N);
  for (int i = 0; i < N; i++){
    int A, B;
    cin >> A >> B;
    vp[i] = make_pair(B, A);
  }
  sort(vp.begin(), vp.end());

  int deadline = 0;
  string ans = "Yes";
  for (int i = 0; i < N; i++){
    deadline += vp[i].second;
    if (deadline > vp[i].first)
      ans = "No";
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <vector>
#include <climits>
#include <queue>
#include <utility>
#include <iomanip>
#include <sstream> 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
template<typename T1, typename T2>
inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2>
inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
const ll MOD = 1000000007;
const ll INF = 1LL << 60;


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


	int ans;
	for (int i = 2; i <= 360; i++) {
		if ((x * i) % 360 == 0) {
			ans = i;
			break;
		}
	}
	cout << ans;

}




Measured memory_bytes: 3672
#include<stdio.h>
#define N 100000

int linearSearch(int S[],int n, int key)
  {
    int i=0;
    S[n]=key;
    while(S[i]!=key)i++;
    return i!=n;
  }



int main()
{
  int n,m,i,S[N],key,count=0;

  scanf("%d",&n);

  for(i=0; i<n; i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&m);

  for(i=0; i<m; i++){
    scanf("%d",&key);
    if(linearSearch(S,n,key))count++;
  }

  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2128
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
#define MOD (ll) (1e9+7)
int main()
{
    ll n,k;
    cin>>n>>k;
    ll ar[n];
    for(ll i=0;i<n;i++)
    {
    	cin>>ar[i];
    }
    for(ll i=k;i<n;i++)
    {
    	if(ar[i]>ar[i-k])
    	{
    		cout<<"Yes\n";
    	}
    	else{
    		cout<<"No\n";
    	}
    }
}

Measured memory_bytes: 5168
import collections
s = list(input())
sset = set(s)
if len(sset) != 26:
    for i in range(97,123):
        if chr(i) in sset:
            continue
        else:
            tmp = chr(i)
            s.append(tmp)
            break

    print(''.join(s))
    exit()
else:
    tmp = []
    flg = False
    for i in range(1,26):
        if s[i-1] < s[i]:
            tmp.append(i-1)
            continue

    if len(tmp) == 0:
        print(-1)
        exit()
    change_i = max(tmp)
    if change_i == 0:
        print(chr(ord(s[0])+1))
        exit()
    ans = s[:change_i]
    for i in range(97,123):
        if chr(i) in ans:
            continue
        else:
            if ord(s[change_i]) < i:
                ans.append(chr(i))
                break
    print(''.join(ans))


Measured memory_bytes: 3316
#include<stdio.h>
int main(){
	
	int n;
	char str[255];
	int hasil =1;
	
	scanf("%d", &n);
	scanf("%s", str);
	
	if(n%2!=0) hasil=-1;
	
	for(int i=0; i<n/2; i++){
     	if (str[i] != (str[(n/2)+i]))	hasil=-1;
        }
        
        if(hasil==1) printf("Yes");
        else if(hasil==-1) printf("No");
}
	

Measured memory_bytes: 1696
/// In The Name Of God
/// I wish, that I could leave it all behind me / Go to my own world where no one can find me
#include<bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define int long long
#define ll long long
#define pii pair <int , int>
#define ld long double
#define for2(a,b,c) for(int (a) = (b); (a) < (c); (a)++)
#define setp cout << fixed << setprecision(15)
#define endl "\n"
#define minit(a,b) a = min(a,b)
#define maxit(a,b) a = max(a,b)
#define PII pair<int,int>
#define Vec vector<int>
#define error(x) cerr << #x << " = " << (x) << endl;
#define all(x) (x).begin() , (x).end()


int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    vector<int> v(n);
    for2(i,0,n){
        cin >> v[i]; v[i] -= i+1;
    }
    sort(all(v));
    int sad = 0;
    for2(i,0,n) sad += abs(v[i]-v[n/2]);
    cout << sad << endl;
    return 0;
}


Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;


public class Main {
	 static class FastReader 
	    { 
	        BufferedReader br; 
	        StringTokenizer st; 
	       
	  
	        public FastReader() 
	        { 
	            br = new BufferedReader(new
	                     InputStreamReader(System.in)); 
	        } 
	  
	        String next() 
	        { 
	            while (st == null || !st.hasMoreTokens()) 
	            { 
	                try
	                { 
	                    st = new StringTokenizer(br.readLine()); 
	                } 
	                catch (IOException  e) 
	                { 
	                    e.printStackTrace(); 
	                } 
	            } 
	            return st.nextToken();
	            
	        } 
	  
	        int nextInt() 
	        { 
	            return Integer.parseInt(next()); 
	        } 
	  
	        long nextLong() 
	        { 
	            return Long.parseLong(next()); 
	        } 
	  
	        double nextDouble() 
	        { 
	            return Double.parseDouble(next()); 
	        } 
	  
	        String nextLine() 
	        { 
	            String str = ""; 
	            try
	            { 
	                str = br.readLine(); 
	            } 
	            catch (IOException e) 
	            { 
	                e.printStackTrace(); 
	            } 
	            return str; 
	        }

			public Character charAt(int i) {
				// TODO Auto-generated method stub
				return null;
			} 
	    }

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

	/**
	 * @param args
	 * @throws IOException
	 */
	 static int m =(int) (1e9+7);
	 static long mod(long x) {
		 
		 return ((x%m+m)%m);
	 }
	 static long add(long x,long y) {
		 return mod((mod(x)+mod(y)));
	 }
	 static long mul(long x,long y) {
		 return mod((mod(x)*mod(y)));
	 }
	 
	public static void main(String[] args)throws IOException  {
		FastReader s=new FastReader();		
		int n = s.nextInt();
		long[] ar = new long[n];
		long[] f = new long[n+1];
		f[n]=0;
		for(int i=0;i<n;i++) {
			ar[i] = s.nextLong();
		}
		long sum=0;
		for(int i=n-1;i>=0;i--) {
			f[i]=f[i+1]+ar[i];
		}
		long ans =0;
		for(int i=0;i<n;i++) {
			ans=add(ans,mul(ar[i],f[i+1]));
		}
		System.out.println(ans);
	}
}
	



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

bool bucket[26];

int main(){
	string s;
	cin >> s;
	for(int i = 0; i < (int)s.size(); i++)
		bucket[s[i]-'a'] = true;
	for(int i = 0; i < 26; i++)
		if(!bucket[i]) {
			printf("%c\n", i + 'a');
			return 0;
		}
	printf("None\n");
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(n) ((int)(n).size())
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

ll MOD=1e9+7, dp[100010][2];
vector<int> g[100010];

ll solve(int pos, int par, int c){
  ll &r =dp[pos][c];
  if(r >= 0) return r;
  r = 1;
  if(c == 1){
    for(auto x : g[pos]) if(x != par) r = r*solve(x,pos,0)%MOD;
  }
  else{
    for(auto x : g[pos]) if(x != par) r = r*((solve(x,pos,1)+solve(x,pos,0))%MOD)%MOD;
  }
  return r;
}

int main(){FIN;
  memset(dp,-1,sizeof(dp));
  int n,x,y; cin >> n;
  fore(i,0,n-1) cin >> x >> y, g[x-1].pb(y-1), g[y-1].pb(x-1);
  cout << (solve(0,-1,0)+solve(0,-1,1))%MOD << "\n";
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N; cin >> N;
  int A, B; cin >> A >> B;
  cout<<min(A*N,B)<<endl;

    return 0;
}


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

using namespace std;
string st;
int ans,len;
int main()
{
	cin>>st;
	len=st.size();
	for(int i=0;i<len;i++)
	{
		if(i==0)cout<<st[i];
		else ans++;
		if(i==len-2)cout<<ans;
		if(i==len-1)cout<<st[i];
	}
return 0;
}


Measured memory_bytes: 256
board = Array.new( 3 ) do
	gets.split.map( &:to_i )
end

delta = Array.new( 4 ) do
	Array.new
end

3.times do |i|
	3.times do |j|
		if i + 1 < 3 then
			delta[i] << board[ i + 1 ][j] - board[i][j]
		end

		if j + 1 < 3 then
			delta[ 2 + j ] << board[i][ j + 1 ] - board[i][j]
		end
	end
end

delta.each do |a|
	if a.uniq.length != 1 then
		puts "No"
		exit 0
	end
end

puts "Yes"


Measured memory_bytes: 3836
n, x = list(map(int, input().split()))
a_list = sorted(sorted(map(int, input().split())))

# a_listの総和が全お菓子の数と同じなら答えはN, そうでないならN-1以下
if sum(a_list) == x:
    print(n)
    exit()

ans = 0

for i, a in enumerate(a_list):
    # 答えはN-1以下
    if i == len(a_list) - 1:
        break

    if x < a:
        break
    x -= a
    ans += 1

print(ans)


Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var s string
	fmt.Scanln(&s)

	fmt.Println(logic(s))
}

func logic(s string) string {
	count := make(map[string]int)

	for _, word := range s {
		count[string(word)]++
	}

	if (count["N"] > 0 && count["S"] <= 0) || (count["N"] <= 0 && count["S"] > 0) {
		return "No"
	}
	if (count["E"] > 0 && count["W"] <= 0) || (count["E"] <= 0 && count["W"] > 0) {
		return "No"
	}

	return "Yes"
}


Measured memory_bytes: 512
n = int(input())
tree = [[] for _ in range(n)]
for i in range(n - 1):
    a, b, c = map(int, input().split())
    a, b, c = a - 1, b - 1, c
    tree[a].append((b, c))
    tree[b].append((a, c))

from heapq import heappush, heappop
INF = 10 ** 18
def dijkstra(s, n): # (始点, ノード数)
    dist = [INF] * n
    hq = [(0, s)] # (distance, node)
    dist[s] = 0
    seen = [False] * n # ノードが確定済みかどうか
    while hq:
        v = heappop(hq)[1] # ノードを pop する
        seen[v] = True
        for to, cost in tree[v]: # ノード v に隣接しているノードに対して
            if seen[to] == False and dist[v] + cost < dist[to]:
                dist[to] = dist[v] + cost
                heappush(hq, (dist[to], to))
    return dist

q, k = map(int, input().split())
k -= 1
dist = dijkstra(k, n)
for i in range(q):
    x, y = map(int, input().split())
    x, y = x - 1, y - 1
    res = dist[x] + dist[y]
    print(res)

Measured memory_bytes: 90272
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[i - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] = j
    return pi


def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)


def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y


for _ in range(int(input()) if not True else 1):
    n = int(input())
    #n, k = map(int, input().split())
    #a, b = map(int, input().split())
    #c, d = map(int, input().split())
    a = list(map(int, input().split()))
    #b = list(map(int, input().split()))
    #s = input()
    dp = [0]*n
    dp[1] = dp[0] + abs(a[1] - a[0])
    for i in range(2, n):
        dp[i] = min(dp[i-1] + abs(a[i] - a[i-1]), dp[i-2] + abs(a[i] - a[i-2]))
    print(dp[-1])

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


int v[1010]={0};
int w[1010]={0};
int dp[1010][10010]={{0}};
int n,W;
int main(){
	cin>>n>>W;
	 for(int i =0;i <n;i++){
		cin>>v[i]>>w[i];
	}
	
	for(int i =0;i < n;i++){
		for(int j =0;j <=W;j++){
			if(j-w[i]>=0){
				dp[i+1][j]=max(dp[i][j], dp[i][j-w[i]]+v[i]);
			}else{
				dp[i+1][j]=dp[i][j];
			}

		}

	}

	cout << dp[n][W]<<endl;
	return 0;
}

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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int H, W, h, w;
  cin >> H >> W >> h >> w;

  cout << H * W - (h * W + w * H - h * w) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;

int main(int argc, const char * argv[]) {
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, p; cin >> a >> p;
    cout << (3 * a + p) / 2 << endl;
    
    return 0;
}


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

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			int M = sc.nextInt();
			int[] C = new int[M];
			for (int i = 0; i < M; ++i) {
				C[i] = sc.nextInt();
			}
			int[] X = new int[N];
			for (int i = 0; i < N; ++i) {
				X[i] = sc.nextInt();
			}
			int[][] dp = new int[2][256];
			Arrays.fill(dp[0], 1 << 30);
			dp[0][128] = 0;
			int t = 0;
			for (int i = 0; i < N; ++i) {
				Arrays.fill(dp[1 - t], 1 << 30);
				for (int j = 0; j < 256; ++j) {
					for (int k = 0; k < M; ++k) {
						int next = j + C[k];
						if (next < 0) next = 0;
						if (next > 255) next = 255;
						dp[1 - t][next] = Math.min(dp[1 - t][next], dp[t][j] + (X[i] - next) * (X[i] - next));
					}
				}
				t = 1 - t;
			}
			int ans = Integer.MAX_VALUE;
			for (int i = 0; i < 256; ++i) {
				ans = Math.min(ans, dp[t][i]);
			}
			System.out.println(ans);
		}
	}
}

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

using namespace std;

#define rep0(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repU(i,bottom,ceiling) for(int (i)=(bottom);(i)<=(ceiling);(i)++)
#define repD(i,ceiling,bottom) for(int (i)=(ceiling);(i)>=(bottom);(i)--)
#define V vector
#define Vi vector<int>
#define VVi vector<vector<int>>
#define Vdb vector<double>
#define VVdb vector<vector<double>>
#define pub push_back
#define pob pop_back
#define pf printf
#define sf scanf
#define ci(a) cin>>a
#define lco(a) cout<<a<<endl
#define co(a) cout<<a
#define Vci(v) for(int i=0;i<v.size();i++) cin>>v[i]
#define Vco(v) for(int i=0;i<v.size();i++){ cout<<v[i]<<' '; } cout<<endl
#define P pair
#define Pii pair<int,int>
#define mP make_pair
#define fir first
#define sec second
#define Re return 

typedef long long ll;
typedef double db;

const string alphabet("abcdefghijklmnopqrstuvwxyz");
const vector<pair<int,int>> dir={{0,0},{1,0},{1,1},{0,1},{-1,1},{0,-1},{-1,-1},{0,-1},{1,-1}};
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const int Inf=(int)2e9+1e8;
const int Mod=(int)1e9+7;

template <typename T,typename U>                                                   
pair<T,U> operator+(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir+r.fir,l.sec+r.sec};                                    
} 

template <typename T,typename U> 
pair<T,U> operator-(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir-r.fir,l.sec-r.sec};                                    
} 

template <typename T,typename U>                                                   
pair<T,U> operator*(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir*r.fir,l.sec*r.sec};                                    
}

template <typename T,typename U>                                                   
pair<T,U> operator/(const pair<T,U> & l,const pair<T,U> & r) {   
    return {l.fir/r.fir,l.sec/r.sec};                                    
}

template <typename T> void Swap(T *x,T *y){ T tem=*x; *x=*y; *y=tem; }

long long int rem(long long int n,long long int m){
	if(!m) return 0;
	return (n<0?(n%m)+m:(n%m));
}
             
/*The main code follows below*/

int main(){
	/*ll a,b;
	
	ci(a>>b);
	lco(max(max(a*b,a+b),a-b));*/
	int ans=0,cnt=0,n,c[26]={};
	ci(n);
	char s[300005];
	rep0(i,n){ ci(s[i]);  c[(s[i]-'a')]++; }
	//rep0(i,n) co(s[i]);
	rep0(i,n-1){
		cnt=0;	
		int flag[26]={};
		rep0(k,26){
			int tem=0;
		
		 rep0(j,i){
			tem+=(s[j]==alphabet[k]);
		 }
		 if(tem<c[k]&&tem) cnt++;
		}
		ans=max(cnt,ans);
	}
	lco(ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		System.out.println(Math.max(Math.max(a + b, a - b), a * b));
	}
}

Measured memory_bytes: 23124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC079C
{
    class Program
    {
        static readonly int answer = 7;

        static string solve(List<int> nums, int index, int current, string op, List<string> ops)
        {
            ops.Add(op);

            //Console.WriteLine($"{index}, {current}, {op}");
            if (index >= nums.Count())
            {
                if (current == answer)
                {
                    var sb = new StringBuilder();
                    foreach (var i in Enumerable.Range(0, nums.Count() - 1))
                    {
                        sb.Append(nums[i]);
                        sb.Append(ops[i + 2]);
                    }
                    sb.Append(nums[nums.Count() - 1]);
                    sb.AppendFormat("={0}", answer);

                    return sb.ToString();
                }
                else
                {
                    return "";
                }
            }

            var s = solve(nums, index + 1, current + nums[index], "+", new List<string>(ops));
            if (string.IsNullOrEmpty(s))
            {
                s = solve(nums, index + 1, current - nums[index], "-", new List<string>(ops));
            }

            return s;
        }

        static void Main(string[] args)
        {
            var nums = Console.ReadLine().Select(x => int.Parse(new string(x, 1))).ToList();

            var expr = solve(nums, 0, 0, "+", new List<string>());
            Console.WriteLine(expr);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9 + 7;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int main() {
	fastio;
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;

	ll p[100001]{}, q[100001]{}, r[100001]{};
	for (int i = 1; i <= a; ++i) cin >> p[i];
	for (int i = 1; i <= b; ++i) cin >> q[i];
	for (int i = 1; i <= c; ++i) cin >> r[i];

	sort(p + 1, p + a + 1);
	sort(q + 1, q + b + 1);
	sort(r + 1, r + c + 1);

	for (int i = 1; i <= a; ++i) p[i] += p[i - 1];
	for (int i = 1; i <= b; ++i) q[i] += q[i - 1];

	ll ans = p[a] - p[a - x] + q[b] - q[b - y];
	int pp = a - x + 1, qq = b - y + 1;

	int t = c;
	while (c && pp <= a && qq <= b) {
		if (p[pp] - p[pp - 1] >= r[t] && q[qq] - q[qq - 1] >= r[t]) break;
		if (p[pp] - p[pp - 1] < q[qq] - q[qq - 1]) ans = ans - (p[pp] - p[pp - 1]) + r[t--], ++pp;
		else ans = ans - (q[qq] - q[qq - 1]) + r[t--], ++qq;
		--c;
	}

	while (c && pp <= a) {
		if (p[pp] - p[pp - 1] >= r[t]) break;
		ans = ans - (p[pp] - p[pp - 1]) + r[t--], ++pp;
		--c;
	}

	while (c && qq <= b) {
		if (q[qq] - q[qq - 1] >= r[t]) break;
		ans = ans - (q[qq] - q[qq - 1]) + r[t--], ++qq;
		--c;
	}

	cout << ans;

	return 0;
}

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

int N, a_tmp, a_min, a_max, abs_min, abs_max, index_min, index_max;
vector<int> a;

void print() {
#ifdef DEBUG
    for (int i = 1; i <= N; ++i) {
        cout << a.at(i);

        if (i != N) {
            cout << ", ";
        }
    }

    cout << endl;
#endif
}

int main() {
    cin >> N;

    for (int i = 1; i <= N; ++i) {
        cin >> a_tmp;

        if (i == 1) {
            a.push_back(a_tmp);  // dummy for index.
        }

        a.push_back(a_tmp);
    }

    auto it = min_element(++a.begin(), a.end());
    index_min = distance(a.begin(), it);
    a_min = *it;
    it = max_element(++a.begin(), a.end());
    index_max = distance(a.begin(), it);
    a_max = *it;
    abs_min = abs(a_min);
    abs_max = abs(a_max);
    cout << N + (N - 1) << endl;

    if (abs_max >= abs_min) {
        for (int i = 1; i <= N; ++i) {  // Makes every element positive or zero.
            a.at(i) += a.at(index_max);
            cout << index_max << " " << i << endl;
        }

        print();

        for (int i = 1; i <= N - 1; ++i) {  // Gets cumulative sum.
            a.at(i + 1) += a.at(i);
            cout << i << " " << i + 1 << endl;
        }

        print();
    } else {
        for (int i = 1; i <= N; ++i) {  // Makes every element negative.
            a.at(i) += a.at(index_min);
            cout << index_min << " " << i << endl;
        }

        print();

        for (int i = N; i >= 2; --i) {  // Gets cumulative sum backwards.
            a.at(i - 1) += a.at(i);
            cout << i << " " << i - 1 << endl;
        }

        print();
    }
}


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


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

    string s;
    cin>>s;
    int n=s.size(), cnt[26]={};
    for(int i=0;i<n;i++){
        cnt[s[i]-'a']++;
    }
    int odd=0;
    for(int i=0;i<26;i++){
        if(cnt[i]%2) odd++;
    }
    int ans=0;
    if(n%2 && odd%2){
        ans = (odd-1)/2;
    }
    else if(odd%2 || n%2){
        ans = 1+(odd-1)/2;
    }
    else {
        ans = odd/2;
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 3192
#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());
  long ans=a[n-1];
  int cnt=2;
  for(int i=2;i<n;i++){
    ans += a[n-cnt];
    // cout << a[n-cnt] << endl;
    if(i%2==1)cnt++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4060
#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.at(i);

	sort(a.begin(), a.end(), greater<int>());

	int alice = 0;
	int bob = 0;
	for(int i = 0; i < n; i++) {
		if(i % 2 == 0) alice += a.at(i);
		else bob += a.at(i);
	}

	cout << alice - bob << endl;

 	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	string s;
	cin >> s;

	int target = 753;
	int ans = INT32_MAX;
	for (int i = 0; i < s.length() - 2; i++)
	{
		int cur = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');

		ans = min(ans, abs(cur - target));
	}

	cout << ans << endl;
}

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

int main() {

    ll N, K;
    cin >> N >> K;
    vl A(N);
    rep(i, N) cin >> A[i];

    ll n = 0;
    while(n < K) {
        vl B(N+1, 0);
        rep(i, N) {
            if (i - A[i] <= 0) B[0]++;
            else B[i - A[i]]++;
            if (i + A[i] + 1 >= N) B[N]--;
            else B[i + A[i] + 1]--;
        }
        vl C(N, 0);
        bool ok = true;
        rep(i, N) {
            if (i > 0) C[i] = C[i-1];
            C[i] += B[i];
            if (C[i] < N) ok = false;
        }
        if (ok) {
            rep(i, N) {
                cout << N << " ";
            }
            cout << endl;
            return 0;
        }
        n++;
        A = C;
    }

    rep(i, N) {
        cout << A[i] << " ";
    }
    cout << endl;

    return 0;
}


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

class Main {
    private static final int MAXN = 100000;
    private static boolean[] isPrime = new boolean[MAXN + 1];

    private static void generatePrimes() {
        Arrays.fill(isPrime, true);
        isPrime[0] = isPrime[1] = false;
        for(int i = 2; i <= MAXN; ++i) {
            if(isPrime[i]) {
                for(int j = 2 * i; j <= MAXN; j += i) {
                    isPrime[j] = false;
                }
            }
        }
    }

    private static Scanner scanner = new Scanner(System.in);
    public static void main(String[] args) {
        generatePrimes();
        int[] cumulativeCount = new int[MAXN + 1];
        for(int i = 1; i <= MAXN; ++i) {
            cumulativeCount[i] = cumulativeCount[i-1];
            if(isPrime[i] && isPrime[(i + 1) / 2]) {
                ++cumulativeCount[i];
            }
        }
        int q = scanner.nextInt();
        StringBuilder ans = new StringBuilder();
        while(q-- > 0) {
            int l = scanner.nextInt();
            int r = scanner.nextInt();
            int cnt = cumulativeCount[r] - cumulativeCount[l - 1];
            ans.append(cnt + "\n");
        }
        scanner.close();
        System.out.println(ans.toString());
    }
}

Measured memory_bytes: 70212
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int a, b;
  cin >> a >> b;
  cout << ceil(float((a + b)) / 2) << endl;
}


Measured memory_bytes: 256