akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long int lli;
using namespace std;
// #define int long long int

inline void swap(int &a, int &b) {
    int tmp = a;
    a = b;
    b = tmp;
}

inline int euclid(int a, int b) {
    if (a > b) swap(a, b);
    int r = a % b;
    while (r > 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

class data {
public:
    lli value, a, b, c;
    data(lli _v, lli _a, lli _b, lli _c):
        value(_v), a(_a), b(_b), c(_c)
    {};

    bool operator< (const data &rhs) const {
        return value < rhs.value;
    };
};

inline lli easy_hash(lli x, lli y, lli z) {
    return x + y * 1000 + z * 1000 * 1000;
}

int main() {
    lli X, Y, Z, K;
    cin >> X >> Y >> Z >> K;

    vector<lli> A, B, C;
    for (int i = 0; i < X; i++) {
        lli input;
        cin >> input;
        A.push_back(input);
    }
    sort(A.begin(), A.end(), greater<lli>());
    for (int i = 0; i < Y; i++) {
        lli input;
        cin >> input;
        B.push_back(input);
    }
    sort(B.begin(), B.end(), greater<lli>());
    for (int i = 0; i < Z; i++) {
        lli input;
        cin >> input;
        C.push_back(input);
    }
    sort(C.begin(), C.end(), greater<lli>());

    priority_queue<data> vecs;
    vecs.push(data(A[0] + B[0] + C[0], 0, 0, 0));
    map<lli, int> used;// hashをキーにする
    used[easy_hash(0, 0, 0)];

    for (int i = 0; i < K; i++) {
        data d = vecs.top();
        cout << d.value << endl;
        vecs.pop();
        if (d.a + 1 < X && used.find(easy_hash(d.a + 1, d.b, d.c)) == used.end()) {
            vecs.push(data(A[d.a + 1] + B[d.b] + C[d.c], d.a + 1, d.b, d.c));
            used[easy_hash(d.a + 1, d.b, d.c)];
        }
        if (d.b + 1 < X && used.find(easy_hash(d.a, d.b + 1, d.c)) == used.end()) {
            vecs.push(data(A[d.a] + B[d.b + 1] + C[d.c], d.a, d.b + 1, d.c));
            used[easy_hash(d.a, d.b + 1, d.c)];
        }
        if (d.c + 1 < Z && used.find(easy_hash(d.a, d.b, d.c + 1)) == used.end()) {
            vecs.push(data(A[d.a] + B[d.b] + C[d.c + 1], d.a, d.b, d.c + 1));
            used[easy_hash(d.a, d.b, d.c + 1)];
        }
    }
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
using namespace std;
static const int32_t MOD = 1e9 + 7;
typedef int64_t ll;
typedef vector<bool> vbb;
typedef vector<string> vss;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll N;
        in >> N;
        vector<vbb> memo(2, vbb(N));
        vss S(2);
        in >> S[0];
        in >> S[1];
        ll ans = 0;
        int pos = 0;
        bool tate = true;
        if (S[0][0] == S[1][0]) {
            ans += 3;
            pos += 1;
            tate = true;
        }
        else if (S[0][0] == S[0][1]) {
            ans += 6;
            pos += 2;
            tate = false;
        }
        reu(i, pos, N) {
            if (tate) {
                if (S[0][i] == S[1][i]) {
                    ans = (ans * 2) % MOD;
                    tate = true;
                }
                else if (i + 1 < N && S[0][i] == S[0][i + 1]) {
                    ans = (ans * 2) % MOD;
                    i++;
                    tate = false;
                }
            }
            else {
                if (S[0][i] == S[1][i]) {
                    ans = (ans * 1) % MOD;
                    tate = true;
                }
                else if (i + 1 < N && S[0][i] == S[0][i + 1]) {
                    ans = (ans * 3) % MOD;
                    i++;
                    tate = false;
                }
            }
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


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

int main() {
  int64_t N;
  cin >> N;
  cout << 2*M_PI*N << endl;
}
  
  

Measured memory_bytes: 3788
#include <sstream>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<ctime>
#include<cmath>
#include<map>
#include<stack>
#include<random>
#include<queue>
#include<list>
#include<math.h>
#include<complex>
using namespace std;
#define ll long long int
#define ld long double
#define key pair<ld,ld>
#define ii pair<int,int>
#define si set<int>
#define vii vector<pair<int,int> >
#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define vvi vector<vector<int> >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define nu 100001
#define mul(x,y) ((ll)(x)*(y))%mod
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define forn(i, n) for (int i = 0; i < int(n); i++)
const ll INF=9223372036854775807;
const ll mod=998244353;

ll  MOD(ll  a,ll  b)
{
    if(a>b)
        return a-b;
    else
        return b-a;
}
ll  max3(ll  a,ll  b,ll c)
{
    return max(c,max(a,b));
}
ll min3(ll a,ll  b,ll  c)
{
    return min(a,min(b,c));
}
ll  power(ll  x,ll  y )
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x);//%mod;
        y = y>>1;
        x = (x*x);//%mod;
    }
    return res;//%mod;
}
ll  power1(ll  x,ll  y )
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x)%mod;
        y = y>>1;
        x = (x*x)%mod;
    }
    return res%mod;
}
ll logg(ll  a)
{
    ll  x=0;
    while(a>1)
    {
        x++;
        a/=2;
    }
    return x;
}
ll  gcd(ll  a,ll   b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
ll abso(ll x)
{
    if(x<0)
    {
        return -x;
    }
    return x;
}
ll ceiling (ll  a,ll  b)
{
    if(a%b==0)
    {
        return a/b;
    }
    else
    {
        return a/b+1;
    }
}
ll modinv(ll x)
{
    return power1(x,mod-2);
}
int main()
{
    int n;
    cin>>n;
    vector<vector<ll>> v(n);
    for(int i=0;i<n;i++)
    {
        v[i].resize(3);
        for(int j=0;j<3;j++)
        {
            cin>>v[i][j];
        }
    }
    vector<vector<ll>> dp(n);
    for(int i=0;i<n;i++)
    {
        dp[i].resize(3,0);
    }
    dp[0][0]=v[0][0];
    dp[0][1]=v[0][1];
    dp[0][2]=v[0][2];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<3;k++)
            {
                if(j!=k)
                {
                    dp[i][j]=max(dp[i-1][k]+v[i][j],dp[i][j]);
                }
            }
        }
    }
    cout<<max3(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
}


Measured memory_bytes: 11136
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main() {
  cout << fixed << setprecision(10);
  double n;
  cin >> n;
  if(fmod(n, 2) == 0) {
    cout << 0.5;
  } else {
    int a = n;
    cout << (a / 2 + 1) / n;
  }
}


Measured memory_bytes: 256
#include<stdio.h>

int sum(int a,int b)
{
  int i,j,l;
  int c=0;

if(3*a==b) return 1;

for(i=0;i<=a;i++){
  for(j=0;j<=a;j++){
    l=b-i-j;
  if(l>=0 && l<=a) c++;
  }
}

  return c;
}

int main(void)
{
  int a,b;

  scanf("%d %d",&a,&b);


  printf("%d\n",sum(a,b));

  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main
{

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

        int a = scan.nextInt();//
        int b = scan.nextInt();//
        if (a < b) {
            System.out.println("a < b");
        } else {
            if (a > b) {
                System.out.println("a > b");
            } else{
                System.out.println("a == b");
            }
        }
    }

}



Measured memory_bytes: 26128
#include<bits/stdc++.h>
using namespace std;
int main()
{
  cin.tie(0);
  int n;
  vector<int> v(4,0);
  cin>>n;
  for(int i=0;i<n;i++)
  {
    string s;
    cin>>s;
    if(s=="AC")
		v[0]++;
   	else if(s=="WA")
      v[1]++;
    else if(s=="TLE")
      v[2]++;
    else
      v[3]++;
  }
  cout<<"AC x "<<v[0];
  cout<<"\nWA x "<<v[1];
  cout<<"\nTLE x "<<v[2];
  cout<<"\nRE x "<<v[3];
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>

using namespace std;

#define MOD 1000000007

int main() {
	long long n, k; cin >> n >> k;
	long long ans = 0;
	for (long long i = k; i <= n + 1; ++i) {
		long long a = i * (i - 1) / 2;
		long long b = i * (n - i + 1 + n) / 2;
		(ans += b - a + 1) %= MOD;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3600
// [Tag]
// #

#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <deque>
#include <map>
using namespace std;

#define fi     	first    
#define se     	second  

/** Type Define **/
typedef long long int           ll;
typedef pair<ll, ll>            p_ll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;
typedef unsigned char           uchar;
typedef unsigned int            ui;
typedef unsigned long long int  ull;

constexpr int               inf =   	2123456789;
constexpr long long 		INF = 		9123456789123456789;
constexpr long long         MOD =       1000000007LL;

template<class T>
using MaxHeap = priority_queue<T>;
template<class T>
using MinHeap = priority_queue<T,vector<T>,greater<T> >;


template<class T>
ostream& operator << (ostream &os,const vector<T> &vec){
  for(int i=0;i<vec.size();i++){
    os << vec[i];
    if(i+1<vec.size())os << ' ';
  }
  return os;
}
template<class T>
istream& operator >> (istream &is,vector<T>& vec){
  for(int i=0;i<vec.size();i++)is >> vec[i];
  return is;
}


/*************************************************/
string A,B;
void sol() {

}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(); cout.tie();
    /*INPUT*/
	int a, b;
  	cin >> a >> b;
  	for(int i=0; i<a;i++)
      	A+=(b+'0');
  	for(int i=0; i<b;i++)
      	B+=(a+'0');
  	cout << min(A, B) <<'\n' ;
    /*Get_Answer*/
    //sol();
    return 0;
}


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

#define ll long long
#define PI acos(-1)
#define N 1e10+7
#define mp(a,b) make_pair(a,b)
#define inf 1e10


int main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int a;
    string s;
    cin>>a>>s;
    if(a<3200)

{
            cout<<"red"<<endl;
}
    else
    {
        cout<<s<<endl;
    }


        return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

struct UnionFind {
  vector<int> data;

  UnionFind(int n){
    data.resize(n+1);
    fill(data.begin(), data.end(), -1);
  }

  int root(int x){
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }

  void unite(int x, int y){
    int rx=root(x);
    int ry=root(y);

    if(rx!=ry){
      if(data[ry] < data[rx])swap(rx, ry);

      data[rx]+=data[ry];
      data[ry]=rx;
    }
  }

  bool same(int x, int y){
    return root(x)==root(y);
  }

  int size(int x){
    return -data[root(x)];
  }
};

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

  rep(i,m){
    int x,y,z;cin>>x>>y>>z;
    uf.unite(x,y);
  }

  map<int, int>counter;
  for(int i=1; i<=n; i++){
    counter[uf.root(i)]++;
  }

  cout<<counter.size();

  return 0;
}


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

const ll MOD = 998244353;

ll powmod(ll n, ll k, ll mod) {
	ll res = 1;
	while(k > 0) {
		if(k % 2) res = (res * n) % mod;
		n = (n * n) % mod;
		k /= 2;
	}
	return res;
}

ll invmod(ll n, ll mod) {
	return powmod(n, mod - 2, mod);
}

ll fact[300010], invfact[300010];

ll comb(ll n, ll m) {
	if(m > n) return 0;
	return (fact[n] * invfact[n - m]) % MOD * invfact[m] % MOD;
}

void solve(long long N, long long A, long long B, long long K){
	fact[0] = invfact[0] = 1;
	for(int i = 1; i < 300010; ++i) {
		fact[i] = (fact[i-1] * i) % MOD;
		invfact[i] = invmod(fact[i], MOD);
	}
	ll res = 0;
	for(int nA = 0; nA <= N; ++nA) {
		ll nB = (K - A * nA) / B;
		if(nA * A + nB * B != K || nB < 0) continue;
		res += comb(N, nA) * comb(N, nB) % MOD;
		res %= MOD;
	}
	cout << res << endl;
}

int main(){	
	long long N;
	long long A;
	long long K;
	long long B;
	scanf("%lld",&N);
	scanf("%lld",&A);
	scanf("%lld",&B);
	scanf("%lld",&K);
	solve(N, A, B, K);
	return 0;
}



Measured memory_bytes: 4992
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    if N == 0:
        print(2)
        return 0
    if N == 1:
        print(1)
        return 0

    lucas = [0] * (N+1)
    lucas[0] = 2
    lucas[1] = 1
    for i in range(2, N+1):
        lucas[i] = lucas[i-2] + lucas[i-1]

    print(lucas[N])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ull unsigned long long int
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mx *max_element
#define mn *min_element
#define fo(i,n) for(ll i=0;i<n;i++)
#define of(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define mem(x,p) memset(x,p,sizeof(x))
#define w(t) ll t;cin>>t;while(t--)
#define kk "\n"
const ll mod=1e9+7;
int main()
{
  IOS
  ll n;
  cin>>n;
  ll a[n+1];
  ll x[n+1]={0};
  unordered_map <ll,ll> mp{0};
  for(ll i=1;i<=n;i++)
  {
    cin>>a[i];
    x[i]=i-a[i];
    mp[x[i]]++;
  }
  ll ans=0;
  for(ll i=1;i<=n;i++)
  {
    ll r=i+a[i];
    ans=ans+mp[r];
  }
  cout<<ans;
  
  return 0;
}


Measured memory_bytes: 21668
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;

int main() {
    ll n,a[100010]={0},hoge,mm=-1,piyo;
    cin >> n;
    for(int i=0;i<n;i++){
        cin>>hoge;
        a[hoge]++;
    }
    for(int i = 0;i<=100000;i++){
        piyo = 0;
        for(int j=-1;j<=1;j++){
            if(i+j<0||i+j>100000)continue;
            piyo += a[i+j];
        }
        mm = max(mm,piyo);
    }
    cout << mm << endl;
}

Measured memory_bytes: 1152
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
 
public class Main{
 
    Scanner sc=new Scanner(System.in);;
 
    int INF=1<<28;
    double EPS=1e-9;
 
    int[][] a;
    int w, h;
    boolean[][] visited;
 
    void run(){
        for(;;){
            h=sc.nextInt();
            w=sc.nextInt();
            if((h|w)==0){
                break;
            }
            a=new int[h][w];
            visited=new boolean[h][w];
            for(int j=0; j<h; j++){
                String s=sc.next();
                for(int i=0; i<w; i++){
                    switch(s.charAt(i)){
                    case '@':
                        a[j][i]=0;
                        break;
                    case '#':
                        a[j][i]=1;
                        break;
                    case '*':
                        a[j][i]=2;
                        break;
                    }
                }
            }
            solve();
        }
    }
 
    void solve(){
        int ans=0;
        for(int j=0; j<h; j++){
            for(int i=0; i<w; i++){
                if(!visited[j][i]){
                    ans++;
                    bfs(i, j);
                }
            }
        }
        println(ans+"");
    }
 
    void bfs(int x, int y){
        LinkedList<P> que=new LinkedList<P>();
        que.offer(new P(x, y));
        visited[y][x]=true;
        int[] dx={0, 0, -1, 1};
        int[] dy={-1, 1, 0, 0};
        for(; !que.isEmpty();){
            P p=que.poll();
            for(int i=0; i<4; i++){
                P q=new P(p.x+dx[i], p.y+dy[i]);
                if(q.x>=0&&q.x<w&&q.y>=0&&q.y<h&&!visited[q.y][q.x]
                        &&a[p.y][p.x]==a[q.y][q.x]){
                    que.offer(q);
                    visited[q.y][q.x]=true;
                }
            }
        }
    }
 
    class P{
        int x, y;
 
        P(int x, int y){
            this.x=x;
            this.y=y;
        }
    }
 
    void debug(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
 
    void print(String s){
        System.out.print(s);
    }
 
    void println(String s){
        System.out.println(s);
    }
 
    public static void main(String[] args){
        new Main().run();
    }
}


Measured memory_bytes: 32300
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()
template<class T> inline bool chmax(T &a, T b){if(a<b){a=b; return true;}return false;}
template<class T> inline bool chmin(T &a, T b){if(a>b){a=b; return true;}return false;}

int main(){
  int n,l;
  cin>>n>>l;
  vector<string> s(n);
  rep(i,0,n)cin>>s[i];
  sort(all(s));
  rep(i,0,n){
    cout << s[i];
  }
  
}


Measured memory_bytes: 256
fn main(){
    let mut sc = Scanner::new();
    while sc.ok() {
        let n:usize = sc.next::<usize>()*2 - 1;
        let x:i32 = sc.next();

        if x == 1 || x == n as i32 {
            println!("No");
            continue;
        }
        println!("Yes");
        let mut ans = vec![-1 as i32; n];
        if n == 3 {
            ans = vec![1, 2, 3];
        } else {
            let mut rem = vec![];
            let c = (n / 2) as usize;
            if x != 2 {
                ans[c-1] = x-2;
                ans[c]   = x;
                ans[c+1] = x+1;
                ans[c+2] = x-1;
                for i in 1..x-2 { rem.push(i) }
                for i in x+2..n as i32 + 1 { rem.push(i) }
            } else {
                ans[c-1] = x+2;
                ans[c]   = x;
                ans[c+1] = x-1;
                ans[c+2] = x+1;
                for i in 1..x-1 { rem.push(i) }
                for i in x+3..n as i32 + 1 { rem.push(i) }
            }
            for i in 0..n {
                if ans[i] == -1 {
                    ans[i] = rem.pop().unwrap();
                }
            }
            ans.reverse();
        }
        for i in 0..n as usize {
            println!("{}", ans[i]);
        }
    }
}

#[allow(dead_code)]
struct Scanner {
    buf: std::collections::VecDeque<String>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner { buf: std::collections::VecDeque::new() }
    }

    fn next<T: std::str::FromStr>(&mut self) -> T {
        self.wrapped::<T>().unwrap()
    }

    fn wrapped<T: std::str::FromStr>(&mut self) -> Option<T> {
        self.read();
        self.buf.pop_front().and_then(|s| s.parse::<T>().ok())
    }

    fn ok(&mut self) -> bool {
        self.read() && !self.buf.is_empty()
    }

    fn eof(&mut self) -> bool {
        !self.ok()
    }

    fn read(&mut self) -> bool {
        while self.buf.is_empty() {
            let mut st = String::new();
            while st.trim() == "" {
                match std::io::stdin().read_line(&mut st) {
                    Ok(l) if l > 0 => continue,
                    _ => return false,
                }
            }
            self.buf = st.split_whitespace().map(|x| x.to_string()).collect();
        }
        true
    }
}


Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <bitset>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

typedef long long ll;
//typedef pair<ll, ll> P;

static const ll MOD = 1000000007;
//static const ll INF = 100000000;
//#define PI 3.14159265359


int main() {
    // input
    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    // process
    while (1) {
        C -= B;
        A -= D;
        if (C <= 0) {
            cout << "Yes";
            break;
        }
        if (A <= 0) {
            cout << "No";
            break;
        }
    }


    return 0;
}

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


int main(){
 
 
	string s;
 
	cin >> s;
 
	long long int sum = 0;

	rep(i,s.size()) sum += s[i] - '0';
 
 
	if (sum % 9 == 0)
		cout << "Yes" << endl;
	else cout << "No" << endl;
 
    return 0;
}

Measured memory_bytes: 3660
N,K=map(int,input().split())
H=[int(input()) for i in range(N)]
H.sort()
ans=10**13
for i in range(N-K+1):
    ans=min(H[i+K-1]-H[i],ans)
    #print(H[i+K-1],H[i])
print(ans)

Measured memory_bytes: 50392
import random
import time

def down_score(d, c, last_d, score):
    sum = 0
    for i in range(26):
        sum = sum + c[i]*(d-last_d[i])
        
    return int(score - sum)


def main():
    D = int(input())

    c = list(map(int, input().split()))

    s = [list(map(int, input().split())) for i in range(D)]

    start = time.time()
    
    last_d = [0 for i in range(26)]
    
    ans = []
    
    score1 = 0
    
    for i in range(D):
        max = 0
        idx = 0
        for j in range(26):
            if max < (s[i][j] + c[j] * (i-last_d[j])*(i-last_d[j]+1)/2) and c[j] != 0:
                max = s[i][j] + c[j] * (i-last_d[j])*(i-last_d[j]+1)/2
                idx = j
            elif max == (s[i][j] + c[j] * (i-last_d[j])*(i-last_d[j]+1)/2) and c[j] * (i-last_d[j])*(i-last_d[j]+1)/2 > c[idx]* (i-last_d[idx])*(i-last_d[idx]+1)/2 and c[j] != 0:
                idx = j
            
        last_d[idx] = i+1
        score1 += s[i][j]
        score1 = down_score(i+1,c,last_d,score1)
        
        ans.append(idx)

    random.seed(20)
    while time.time() - start < 1.9:
        d1 = random.randint(0,D-1)
        d2 = random.randint(0,D-1)
        if d1 == d2:
            continue
        tmp_d1 = ans[d1]
        tmp_d2 = ans[d2]
        ans[d1] = tmp_d2
        ans[d2] = tmp_d1
        last_d = [0 for i in range(26)]
        score2 = 0    
        for i in range(D):
            score2 += s[i][ans[i]-1]
            last_d[ans[i]-1] = i+1
            score2 = down_score(i+1, c, last_d, score2)
        
        if score1 > score2:
            ans[d1] = tmp_d1
            ans[d2] = tmp_d2
        else:
            score1 = score2
    
    for i in range(D):
        print(ans[i]+1)  

if __name__ == "__main__":
    main()


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

using namespace std;
#define fi first
#define se second

const int maxn = 123456;

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

ll a[maxn];
map<ll, int>mp;
std::map<ll, int>::iterator it;
int main(){
    // freopen("input.txt", "r", stdin);
    int N, M;
    mp.clear();
    cin>>N>>M;
    for (int i = 0; i < N; ++i)
    {
        cin>>a[i];
    }
    sort(a, a+N);
    ll c;
    int b;
    for (int i = 0; i < M; ++i)
    {
        cin>>b>>c;
        mp[c] += b;  // note: there may be duplicated keywords
    }
    int cur = 0;
    ll res = 0;
    for(; cur < N; ){
        if(!mp.size())break;
        it = mp.end();
        it--;
        if(it->first > a[cur]){
            res += it->first;
            it->second--;
            if(!it->second)mp.erase(it);
            cur ++;
        }
        else break;
    }
    while(cur < N){
        res += a[cur++];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 7296
#include<stdio.h>
 
int main(void)
{
 int a,b,c,d,cnt,n;
 while(scanf("%d",&n)!=EOF)
 {
  cnt = 0;
  for(a = 0; a <= 9; a++)
  {
   for(b = 0; b <= 9; b++)
   {
    for(c = 0; c <= 9; c++)
    {
     for(d = 0; d <= 9; d++)
     {
      if(a+b+c+d == n)
       cnt++;
     }
    }
   }
  }
  printf("%d\n",cnt);
 }
}

Measured memory_bytes: 0
#include <stdio.h>
#include<string.h>
#define len 100005

typedef struct pp{
  char kota[100];
  int t;
}p;
p q[len];
int head,tail,n;

void enqueue(p x){
  q[tail]=x;
  tail=(tail+1)%len;
}

p dequeue(){
  p x=q[head];
  head=(head+1)%len;
  return x;
}
int mini(int a,int b)
{
  return a<b ? a:b;
}

int main()
{
  int g=0,d;
  int i,r;
  p u;
  scanf("%d %d",&n,&r);
  for(i=1;i<=n;i++)
    {
      scanf("%s",q[i].kota);
      scanf("%d",&q[i].t);
    }
  head=1;tail=n+1;
  while(head!=tail)
    {
      u=dequeue();
      d=mini(r,u.t);
         u.t-=d;
      g+=d;
      if(u.t>0)enqueue(u);
      else{
	printf("%s %d\n",u.kota,g);
    }
}
return 0;
}	     
      
  
  

    



Measured memory_bytes: 11892
#include<iostream>
#include<string>
using namespace std;
int main(){
string s1,s2;
cin>>s1>>s2;
if(s1.size()>3||s1.size()<0||s2.size()>3||s2.size()<0)
    return 0;
    int x=0;
for(int i=0;i<s1.size();i++)
{
    if(s1[i]==s2[i])
        x=x+1;
}
cout<<x;
return 0;
}


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

int main() {
	char str[1200];
	cin.getline(str, 1200);
	int i = 0;
	while (str[i] != NULL) {
		if ((int)str[i] >= 65 && (int)str[i] <= 90) {
			str[i] = str[i] + 32;
		}else if ((int)str[i] >= 97 && (int)str[i] <= 122) {
			str[i] = str[i] - 32;
		}
		i++;
	}
	for (int j = 0; str[j]!=NULL; j++) {
		cout << str[j];
	}
        cout << endl;
	return 0;
}

Measured memory_bytes: 1120
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    int b[] = new int[n];
    int c[] = new int[n-1];
    for(int i=0;i<n;i++){
      a[i] = sc.nextInt();
      a[i]--;
    }
    for(int i=0;i<n;i++){
      b[i] = sc.nextInt();
    }
    for(int i=0;i<n-1;i++){
      c[i] = sc.nextInt();
    }
    int ans = 0;
    for(int i=0;i<n;i++){
      ans += b[a[i]];
      if(i<n-1 &&a[i+1]==a[i]+1)ans+=c[a[i]];
    }
    System.out.println(ans);

  }
}


Measured memory_bytes: 21844
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in range(N):
    ans+=min(A[i],B[i])+min(A[i+1],B[i]-min(A[i],B[i]))
    A[i+1]-=min(A[i+1],B[i]-min(A[i],B[i]))
print(ans)

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



int main() {
    int H, A;
    cin >> H >> A;
    
    int At = 0;
    if (H % A == 0){
        cout << H / A << endl;
    }
    else if (H % A != 0){
        cout << (H / A) + 1 << endl;
    }
}



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

import sun.security.krb5.Asn1Exception;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int A = scan.nextInt();

		int amari = N % 500;

		if (A >= amari) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 27048
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>

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

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();

    long long int n, k;
    cin >> n >> k;

    for(int i = 1; i <= k; i++){
        long long int ans;
        ans = COM(k-1, i-1) * COM(n-k+1, i);
        ans %= MOD;
        cout << ans << endl;
    }
}




Measured memory_bytes: 12160
import queue

"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
(N,M,R) = (int(i) for i in input().split(" "))
for i in range(10):
	R = N*R-M
	print(R)

Measured memory_bytes: 4080
// Two Anagrams

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

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

	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

	int minlen = min(s.length(), t.length());

	for (int i = 0; i < minlen; ++i){
		if (s[i] < t[i]){
			cout << "Yes" << endl;
			return 0;
		}
		if (s[i] > t[i]){
			cout << "No" << endl;
			return 0;
		}
	}

	// a1 = b1,...,a_minlen = b_minlen
	if (s.length() < t.length())
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
using namespace std;

ll a,b;

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> a >> b;
    cout << max( a+b , max( a-b , a*b ) );

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;

const double PI = 3.14159265358979;

struct Point{
    double x, y;
};

void koch(int n, Point a, Point b){
    if(n == 0) return;

    Point s, t, u;
    double th = PI * 60.0 / 180.0;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
    
    koch(n - 1, a, s);
    cout << s.x << " " << s.y << endl;
    koch(n - 1, s, u);
    cout << u.x << " " << u.y << endl;
    koch(n - 1, u, t);
    cout << t.x << " " << t.y << endl;
    koch(n - 1, t, b);
}
int main(){
    Point a, b;
    int n;

    cin >> n;

    a.x = a.y = 0.0;
    b.x = 100.0;
    b.y = 0.0;

    cout << fixed << setprecision(8);
    cout << a.x << " " << a.y << endl;
    koch(n, a, b);
    cout << b.x << " " << b.y << endl;
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) (((a%MOD+MOD)%MOD+(b%MOD+MOD)%MOD)%MOD)
#define MUL(a, b) ((((a%MOD+MOD)%MOD)*((b%MOD+MOD)%MOD))%MOD)
#define CHADD(a, b) (a = ADD(a, b))
#define CHMUL(a, b) (a = MUL(a, b))
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b){ if(a<b){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b){ if(a>b){ a=b; return true; } return false; }
template<typename I> int ACC(I f, I l, int i){ return accumulate(f, l, i); }


int A, B;
VI a;


VI divisor(int n){
    VI ret;
    repif(i, 1, i*i <= n){
        if(n%i == 0){
            ret.pb(i);
            if(i*i != n) ret.pb(n/i);
        }
    }
    sort(ALL(ret));
    return ret;
}


bool isPrime(int x){
    if(x <= 1) return false;
    repif(i, 2, i*i <= x)
        if(x%i == 0) return false;
    return true;
}


signed main(){
    cin >> A >> B;

    a = divisor(A);

    int ans = 1;
    for(int x : a)
        if(B%x == 0 && isPrime(x)) ans++;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int,int> P;

bool fanc(int x) {
  int i=1;
  while (i*i<=x) {
    if (i*i==x) return true;
    i++;
  }
  return false;
}

int main() {
  int n,d;
  cin>>n>>d;
  int x[15][15];
  for (int i=0; i<n; i++)
    for (int j=0; j<d; j++)
      cin>>x[i][j];

  int ans=0;
  for (int i=0; i<n-1; i++) {
    for (int j=i+1; j<n; j++) {
      int dist=0;
      for (int k=0; k<d; k++) {
	dist+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      if(fanc(dist)) ans++;
    }
  }
    
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin >> n;
  vl a(n);
  rep(i,n){
    cin >> a[i];
  }
  srep(i,1,n){
    if(a[i-1] < a[i] ) a[i]-=1;
  }
  srep(i,1,n){
    if(a[i-1] > a[i] ){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
//#define int long long


using namespace std;


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




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

long long power_mod(long long x, long long n, long long m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return power_mod(x * x % m, n / 2, m);
	else
		return x * power_mod(x, n - 1, m) % m;
}

long long power(long long a, long long n) {//aのn乗を計算します。
	long long x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}



long long nCr(long long n, long long r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	long long i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}



const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
	ll N = 10000010;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (ll i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (ll j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (ll i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu.pb(i);
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}

ll stoL(string s) {
	ll n = s.length();
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ans += power(10, n - i - 1)*(ll)(s[i] - '0');
	}
	return ans;
}



int main() {
	int D; cin >> D;
	int n = 25 - D;
	cout<<"Christmas";
	REP(i, n) {
		cout << " Eve";
	}
	cout << endl;
}


Measured memory_bytes: 764
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		long fact = 1;
		
		for (int i = 1; i <= n; i++){
			fact *= i;
		}
		System.out.println(fact);
	}
}

Measured memory_bytes: 25964
def solve(n):
    if n == 0:
        return "0"
    p = 2
    s = []
    while n != 0:
        if n % p == 0:
            s.append(0)
        else:
            n -= (p // 2)
            s.append(1)
        p *= -2
    return "".join(map(str, s[::-1]))

assert solve(-9) == "1011"
assert solve(123456789) == "11000101011001101110100010101"
assert solve(0) == "0"
n = int(input())
print(solve(n))


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

#define exist(c, s) (s.find(c) != s.npos)

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

	const string right = "yuiophjklnm";
	for(string input; cin >> input, input != "#";) {
		int ans = 0;
		bool prev_right = exist(input[0], right);
		for(int i = 1; i < (int)input.size(); ++i) {
			bool cur_right = exist(input[i], right);
			if(prev_right != cur_right)
				++ans;

			prev_right = cur_right;
		}

		cout << ans << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1200
import numpy as np
x, y, red_num, green_num, white_num = [int(i) for i in input().split()]
red_list = [int(i) for i in input().split()]
green_list = [int(i) for i in input().split()]
white_list = [int(i) for i in input().split()]
sum = 0

red_list.sort(reverse=True)
green_list.sort(reverse=True)

apple = red_list[:x] + green_list[:y] + white_list
apple.sort(reverse=True)
for i in apple[:(x+y)]:
	sum += i
print(sum)


Measured memory_bytes: 33136
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	string S;
	cin >> S;

	if(S[0] != 'A'){
		cout << "WA" << endl;
		return 0;
	}
	S[0] = 'a';

	int cntC = 0;
	for(int i=2; i<S.size()-1; i++){
		if(S[i] == 'C'){
			cntC++;
			S[i] = 'c';
			break;
		}
	}

	if(cntC != 1){
		cout << "WA" << endl;
		return 0;
	}

	for(int i=0; i<S.size(); i++){
		if(S[i] >= 'A' && S[i] <= 'Z'){
			cout << "WA" << endl;
			return 0;
		}
	}
 
	cout << "AC" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll      long long
#define pb      push_back
#define mp      make_pair
#define orz     1000000007
using namespace std;
string s;
int n,a[555555],sum,ans;
int main(){
	ios::sync_with_stdio(0);
	cin>>s;
	n=s.size();
	for(int i=0;i<n;++i)a[n-i]=(s[i]-48)*9;
	for(int i=1;i<=n;++i)if(a[i]>9)a[i+1]+=a[i]/10,a[i]%=10;
	if(a[n+1])++n;
	for(int i=1;i<=n;++i)sum+=a[i];
	while(sum>0){
		a[1]+=9,++ans;
		for(int i=1;i<=n;++i){
			if(a[i]>9)a[i]-=10,sum-=9,++a[i+1];
			else break;
		}
		if(a[n+1])++n;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2844
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define ll long long
#define vector <ll> vec
#define pair <ll,ll> pa
#define make_pair mp
#define push_back pb
int main()
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	double n,a;
	cin>>n;
	n=n/3;
	a=n;
	n=n*n;
	n=a*n;
	printf("%0.7lf",n);
	return 0;
}

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

#define ll long long
#define ld long double
#define ull unsigned long long
#define endl "\n"
#define MohamedMotaz ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0);
#define f(a, b, c) for(int a = b; a < c; a++)
using namespace std;
const ll mod = 1e9 + 7;



//ll fact[1000001]; ll inv[1000001];
//ll primes[100007];
//ll arr[1000007];
//ll modPower(ll b, ll p) {
//	if (p == 0)
//		return 1;
//
//	ll halfpow = modPower(b, p / 2);
//	ll toReturn = (halfpow * halfpow) % mod;
//	if (p % 2)
//		toReturn = (toReturn * b) % mod;
//
//	return toReturn;
//}
//
//ll fastPower(ll b, ll p) {
//	if (p == 0)
//		return 1;
//	ll ans = fastPower(b, p / 2);
//	ans = (ans * ans);
//	if (p % 2 != 0)
//		ans = (ans * b);
//	return ans;
//}
//ll GcdRecursive(ll a, ll b) {
//	if (b == 0) return a;
//	return GcdRecursive(b, a % b);
//}
//ll modLCM(ll a, ll b) {
//	ll val = GcdRecursive(a, b);
//	ll tmp = ((a % mod) * (b % mod)) % mod;
//	ll finalVal = ((tmp % mod) * (arr[val] % mod)) % mod;
//	return finalVal;
//
//}
//ll LCM(ll a, ll b) {
//	return (a * b) / GcdRecursive(a, b);
//}
//void move1step(ll& a, ll& b, ll q) { // a and b by reference
//	ll c = a - q * b;
//	a = b;
//	b = c;
//}
//ll GcdIterative(ll a, ll b) {
//	while (b) move1step(a, b, a / b);
//	return a;
//}
//
//void pre(ll n) {
//
//	fact[0] = 1;
//	inv[0] = 1;
//
//	for (ll i = 1; i <= n; i++) {
//		fact[i] = (i * fact[i - 1]) % mod;
//		inv[i] = modPower(fact[i], mod - 2);
//		arr[i] = modPower(i, mod - 2);
//	}
//}
//
//ll npr(ll n, ll r) {
//	return ((fact[n] * inv[n - r]) % mod);
//}
//
//ll ncr(ll n, ll r) {
//	return ((((fact[n] * inv[n - r]) % mod) * inv[r]) % mod);
//}
//
//void sieve(ll val) {
//	memset(primes, 1, sizeof primes);
//	primes[0] = primes[1] = false;
//	for (int i = 2; i <= val; i++) {
//		if (primes[i]) {
//			for (int j = i * i; j <= val; j += i) {
//				primes[j] = 0;
//			}
//		}
//	}
//
//}











int main()
{
    MohamedMotaz;
    
    
    ll x, y; cin >> x >> y;
    vector<ll> v;

    f(i, 0, x) {
        ll a; cin >> a; v.push_back(a);
    }
    sort(v.begin(), v.end());

    ll m = v[y - 1] - v[0];
    f(i, 1, x - y + 1) {
        m = min(m, v[i + y - 1] - v[i]);
       // cout << v[i] << " " << v[i + y - 1] << endl;
        //cout << ans << endl;
    }
    cout << m << endl;
}








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

using namespace std;

int main() {
		
	long n,k;
	cin >> n >> k;
	vector<long> h(n + 1);
	for (long  i = 1; i <= n; i++){
		cin >> h[i];
	}

	vector<long> dp(n + 1, 1000000100);

	dp[1] = 0;

	for (long i = 1; i <= n; i++) {

		for (long j = 1; j <= k; j++) {

			if(i-j>0){
				dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
			}
		}

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

}

Measured memory_bytes: 1920
/*
    Author - Param Kothari
    Ah shit, here we go again
*/
 
#include <bits/stdc++.h>
 
using namespace std;
 
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair 
 
typedef long long ll;
typedef long double ld;

void solve(){
    int n = 0, r = 0;
    cin >> n >> r;
    if(n >= 10){
        cout << r << "\n";
    }
    else{
        int res = r + (10 - n) * 100;
        cout << res << "\n";
    }
    return;
}
 
int main(){
    IOS;
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string n;
int main() {
	cin>>n;
	for(int s=2; s<=n.size(); s++) {
		if(n[s]==n[s-1]&&n[s]==n[s-2]) {
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

const int INF = 0x3f3f3f3f;
const int MAXN = 2e5 + 5;

int n;
ll a[MAXN],dp[MAXN];

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d",&n);
	for(int i = 1;i <= n;i++)
		scanf("%lld",&a[i]);
	ll sum = a[1];
	for(int i = 2;i <= n;i++){
		if(i & 1){
			sum += a[i];
			dp[i] = max(dp[i - 1],dp[i - 2] + a[i]);
		}else
			dp[i] = max(sum,dp[i - 2] + a[i]);
	}
	printf("%lld\n",dp[n]);
	return 0;
}



Measured memory_bytes: 6940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		int[] count = new int[4];
		for (int i = 0; i < S.length(); i++) {
			char c = S.charAt(i);
			if (c == 'N') {
				count[0]++;
			} else if (c == 'W') {
				count[1]++;
			} else if (c == 'S') {
				count[2]++;
			} else if (c == 'E') {
				count[3]++;
			}
		}
		String ans = "No";
		if ((count[0] > 0 && count[2] > 0) || (count[0] == 0 && count[2] == 0)) {
			if ((count[1] > 0 && count[3] > 0) || (count[1] == 0 && count[3] == 0)) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
		in.close();
	}
}

Measured memory_bytes: 23764