akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(){
    long n[8];
    n[7]=1;
    n[6]=0;
    for(int i=0;i<6;i++){
        cin>>n[i];
    }
   for(int j=2;j<6;j++){
       if(n[1]>n[j]){
           n[7]=j;
           n[6]=n[1];
           n[1]=n[j];
           n[j]=n[6];
       }
       else{
       }
   }
    long a;
    if(n[0]%n[1]==0){
        a=n[0]/n[1];
    }
    else{
        a=n[0]/n[1]+1;
    }
    cout<<(n[7]-1)+a+(5-n[7])<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define  pb push_back
#define sort1(v) sort(v.begin(),v.end())
#include <sstream>
//cout<<fixed<<setprecision(n)<<number - for n digits after decimal
int max(int a,int b)
{
    if(a>b)
        return a;
    else
        return b;
}
void print(vector<int>arr)
{
    for(int i=0;i<(int)arr.size();i++)
        cout<<arr[i]<<" ";
    cout<<"\n";
}
void upd(int a[],int l,int r,int num)
{
    for(int i=l;i<=r;i++)
        a[i]+=num;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x;
    cin>>x;
    cout<<!x<<"\n";
}








Measured memory_bytes: 3644
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    X, Y = LI()

    if X % Y > 0:
        print(X)
    else:
        print(-1)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10112
N, C, K = map(int, input().split())
t_li = []
for _ in range(N):
    t_li.append(int(input()))
t_li.sort()
# 最初にバスに乗る乗客の到着時間
first = t_li[0]
# バス1台に乗ってる乗客。最初の一人を載せておく
passengers = 1
# バスの台数。N >= 2なので少なくとも1台は必要
busses = 1
# 二人目から数えていく
for i in range(1, N):
    if passengers < C and t_li[i] - first <= K:
        # 搭乗員数と時間に余裕があるなら、同じバスに乗せていく
        passengers += 1
    else:
        # 次のバスを用意する
        busses += 1
        passengers = 1
        first = t_li[i]
print(busses)


Measured memory_bytes: 76144
// Winners don't quit and quitters don't win 
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 998244353
#define MAX 100005
#define M 32
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int k,n,i,j,x;
    cin>>n>>k;
    vector <int> v;
    for(i=0;i<n;++i)
    {
    	cin>>x;
    	v.pb(x);
	}
	vector <bool> dp(k+1);
	for(i=0;i<=k;++i)
	{
		for(j=0;j<n;++j)
		{
			if(v[j]<=i && !dp[i-v[j]])
			 dp[i]=true;
		}
	}
	if(dp[k])
	 cout<<"First";
	else
	 cout<<"Second";
}

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

const int MAXN = 5e5 + 10;
const int MAX_NODE_CNT = MAXN << 6;

int n, m, lst[MAXN];

struct Persistent_Segment_Tree {
    #define mid ((l + r) >> 1)
    #define ls(_) t[_].ls
    #define rs(_) t[_].rs
    #define lq(_) t[_].ls, l, mid
    #define rq(_) t[_].rs, mid + 1, r
    int node_cnt, rt[MAXN];
    int& operator [](const int& x) { return rt[x]; }
    struct node { int ls, rs, data; } t[MAX_NODE_CNT]; 
    int build(int l, int r) {
        int cur = ++node_cnt;
        if (l == r) return cur;
        ls(cur) = build(l, mid), rs(cur) = build(mid + 1, r);
        return cur;
    }
    int modify(int pre, int l, int r, int pos, int val) {
        int cur = ++node_cnt; t[cur] = t[pre], t[cur].data += val;
        if (l == r) { return cur; }
        if (pos <= mid) ls(cur) = modify(ls(pre), l, mid, pos, val);
        else rs(cur) = modify(rs(pre), mid + 1, r, pos, val);
        return cur;
    }
    int query(int cur, int l, int r, int ql, int qr) {
        if (ql <= l && r <= qr) return t[cur].data;
        int ret = 0;
        if (ql <= mid) ret += query(lq(cur), ql, qr);
        if (qr > mid) ret += query(rq(cur), ql, qr);
        return ret; 
    } 
} t;

int main() {
    scanf("%d %d", &n, &m);
    t[0] = t.build(1, n);
    for (int i = 1, x; i <= n; ++i) {
        scanf("%d", &x); t[i] = t.modify(t[i - 1], 1, n, i, 1);
        if (lst[x]) t[i] = t.modify(t[i], 1, n, lst[x], -1);
        lst[x] = i;
    }
    int pre_ans = 0;
    for (int i = 1, u, v; i <= m; ++i) {
        scanf("%d %d", &u, &v);
        printf("%d\n", (t.query(t[v], 1, n, u, v)));
    }
    return 0;
}

Measured memory_bytes: 250932
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int d[1000];
int main()
{
	string s;
	cin >> s;
	set<char>se;
	for (int i = 0; i < s.size(); i++)se.insert(s[i]);
	printf((se.size() == s.size()) ? "yes\n" : "no\n");
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long int lld;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define MOD 1000000007
string s;
int d;
lld DP[1000000][100][2];
lld computeDP(int a, int b,int c){
	//cout<<a<<" "<<b<<" "<<c<<endl;
	if(DP[a][b][c]!=-1)return DP[a][b][c];
	DP[a][b][c]=0;
	if(c==1){
		int D=s[a]-'0';
		rep(digit,0,D+1){
			
			if(digit==D){
				DP[a][b][c]+=computeDP(a+1,(b+digit)%d,1);
			}else{
				DP[a][b][c]+=computeDP(a+1,(b+digit)%d,0);
			}
		}
		DP[a][b][c]%=MOD;
		return DP[a][b][c];
	}
	rep(digit,0,10){
		
		DP[a][b][c]+=computeDP(a+1,(b+digit)%d,0);
	}
	DP[a][b][c]%=MOD;
	return DP[a][b][c];
}
int main(){
	// your code goes here
	cin>>s;
	cin>>d;
	
	rep(i,0,s.size()+1){
		rep(j,0,d){
			DP[i][j][0]=-1;
			DP[i][j][1]=-1;
		}
	}
	rep(j,0,d){
		DP[s.size()][j][0]=0;
		DP[s.size()][j][1]=0;
	}
	DP[s.size()][0][0]=1;
	DP[s.size()][0][1]=1;
	lld ans=computeDP(0,0,1);
	/*rep(i,0,s.size()+1){
		rep(j,0,d){
			cout<<DP[i][j][0]<<";"<<DP[i][j][1]<<" ";
		}cout<<endl;
	}*/
	cout<<(ans+MOD-1)%MOD<<endl;
	return 0;
}

Measured memory_bytes: 17408
#include<stdio.h>

int main(void)
{
  int x,y;
  int d,r;
  double f;
    scanf("%d %d",&x,&y);

    d = x/y;
    r = x%y;
    f = 1.0*x/y;
  
    printf("%d %d %f\n",d,r,f);
  return 0;
}

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

int main(){
    int n,l;
    cin >> n >> l ;
    vector<string> s(n) ;
    for (size_t i = 0; i < n; i++)
    {
        cin >> s.at(i) ;
    }
    sort(s.begin() ,s.end()) ;
    for (size_t i = 0; i < n; i++)
    {
        cout << s.at(i) ;
    }
    cout << endl ;
    
    
}

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

using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define all(v) v.begin(),v.end()
#define ve vector
#define vi vector<int>
#define vi2 vector<vi>
#define vl vector<long long>
#define vl2 vector<vl>

template <class T> T maxAny(T a, T b){
    if(a > b) return a;
    else return b;
}

template <class T> T minAny(T a, T b){
    if(a > b) return b;
    else return a;
}

int main(){
    int x;
    cin >> x;
    if(x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    long long dp[n][n], a[n], pfx[n + 1];
    pfx[0] = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        pfx[i + 1] = pfx[i] + a[i];
    }
    for (int len = 1; len <= n; len++) {
        for (int i = 0; i < n - len + 1; i++) {
            int r = i + len - 1;
            if (len == 1) {
                dp[i][r] = a[i];
                continue;
            }
            dp[i][r] = pfx[r + 1] - pfx[i] - min(dp[i + 1][r], dp[i][r - 1]);
        }
    }
    if (n == 1) cout << dp[0][n - 1];
    else cout << dp[0][n - 1] - min(dp[1][n - 1], dp[0][n - 2]);
    return 0;
}


Measured memory_bytes: 70656
#include<stdio.h>
#include<iostream>
using namespace std;
int binarySearch(int A[],int n,int key){
	int left=0,right=n-1;
	int mid;
	while(left<=right){
		mid=(left+right)/2;
		if(A[mid]==key){
			return mid;
		}else if(A[mid]<key){
			left=mid+1;
		}else{
			right=mid-1;
		}
	}
	return -1;
} 
int A[1000000];
int main(){
	int n,q,key,sum=0;
	cin>>n;
	for(int i=0;i<n;i++)scanf("%d",&A[i]);
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d",&key);
		if(binarySearch(A,n,key)>-1)sum++;
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3532
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,K; cin >> N >> K;
    cout << N-K+1 << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;


public class Main{
    public static void main(String[] args) throws IOException
    {
        Scanner scanner = new Scanner(System.in);
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
 
        do{
            String line1 = scanner.next();
            String line2 = scanner.next();
            int h = Integer.parseInt(line1);
            int w = Integer.parseInt(line2);
            if(h == 0 && w == 0){
                break;
            }
            for(int i =0;i < h; i++){
                for(int j = 0; j < w; j++){
                    System.out.print("#");
                }
                System.out.print("\n");
            }

            System.out.print("\n");
 
        }while(true);
       
    }

}




Measured memory_bytes: 37776
#include <iostream>
#include <string>
#include <vector>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
using namespace std;

const long MOD = long(1e9) + 7;

// n! % MOD
long fact(int n) {
  long p = 1;
  REP(i,2,n+1) {
    p *= i;
    p %= MOD;
  }
  return p;
}

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

  long ans;
  if (N == M)
    ans = fact(N) * fact(M) * 2;
  else if (N == M + 1 || M == N + 1)
    ans = fact(N) * fact(M);
  else ans = 0;

  ans %= MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
if N == 0:
    print(N)
elif int(K / N) > 1:
    print(N)
else:
    amari = N % K
    mainasu_noatai = abs(amari - K)
    if (amari > mainasu_noatai):
    	print(mainasu_noatai);
    else:
        print(amari)


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

int main(){
  long long int a,b;
  cin >> a >> b;
  long long int c;
  if((a+b)%2 == 1){
    cout << "IMPOSSIBLE" << endl;
  }else{
    c = (a+b)/2;
    cout << c << endl;
  }
}


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

vector<int> g[212345];

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n, m; cin>>n>>m;
  string s;
  cin >> s;
  for(int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b; a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> ok(n, 1);
  // vector<int> used(n);
  // int col = 1;
  function<void(int)> check = [&](int i) {
    if(!ok[i]) return;
    int f[2] = {};
    for(int j : g[i]) {
      if(ok[j]) f[s[j] == 'A']++;
    }
    if(!(f[0] && f[1])) ok[i] = 0;
    if(!ok[i]) {
      auto newg = g[i];
      for(int j : g[i]) {
        if(!ok[j]) continue;
        check(j);
        if(ok[j]) newg.push_back(j);
      }
      g[i] = newg;
    }
  };
  for(int i = 0; i < n; i++) check(i);
  cout << (find((ok).begin(), (ok).end(), 1) != ok.end() ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 31824
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstring>

using namespace std;

const int N = 100000 + 5;

int n;
vector<pair<int, int>> adj[N];
int size[N];
int mv[N];
long long ans;

void dfs(int u, int f)
{
    size[u] = 1;
    mv[u] = 0;
    for(auto e: adj[u]) {
        if (e.first == f) continue;
        dfs(e.first, u);
        ans += (long long)size[e.first] * 2 * e.second;
        mv[u] = max(mv[u], size[e.first]);
        size[u] += size[e.first];
    }
    mv[u] = max(mv[u], n - size[u]);
}

void solve()
{
    cin >> n;
    for(int i = 0; i < n - 1; ++ i) {
        int u, v, w;
        scanf("%d%d%d", &u, &v, &w);
        --u, --v;
        adj[u].push_back(make_pair(v, w));
        adj[v].push_back(make_pair(u, w));
    }
    dfs(0, -1);
    pair<int, int> c(mv[0], 0);
    for(int i = 1; i < n; ++ i) {
        c = min(c, make_pair(mv[i], i));
    }
    int root = c.second;
    ans = 0;
    dfs(root, -1);
    if (mv[root] * 2 == n) {
        for(auto e: adj[root]) {
            if (mv[e.first] * 2 == n) {
                ans -= e.second;
            }
        }
    } else {
        long long tmp = ans;
        for(auto e: adj[root])
            tmp = min(tmp, (long long)e.second);
        ans -= tmp;
    }
    cout << ans << endl;

}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 13184
#include<iostream> 
#include<bits/stdc++.h> 
using namespace std;
int main(){ 
	ios::sync_with_stdio(false); 
	cin.tie(0); 
	int N;
	cin>>N; 
	vector<double> p(N);
	for(int i=0;i<N;i++){ 
		cin>>p[i];
	}
	vector<vector<double>> dp(N+1,vector<double>(N+1,0));
	dp[0][0]=1;
	for(int i=1;i<=N;i++){
		dp[i][0]=dp[i-1][0]*(1-p[i-1]);
		for(int k=1;k<=N;k++){ 
			dp[i][k]=dp[i-1][k]*(1-p[i-1])+dp[i-1][k-1]*p[i-1]; 
		} 
	} 
	double prob=0;
	for(int i=N/2+1;i<=N;i++){ 
		prob+=dp[N][i];
	} 
	cout<<setprecision(15)<<prob;

			
	
	return 0;
} 



Measured memory_bytes: 70784
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

class LCA{
private:
    int n,h;
    struct edge { int to, cost;};
    vector< vector<edge> > g;
    vector<vector<int> > par;
    vector<int> dist,dep;

    void dfs(int now, int p, int d, int cost){
        par[0][now] = p;
        dep[now] = d;
        dist[now] = cost;
        for(int i = 0; i < g[now].size(); i++){
            int ne = g[now][i].to;
            if(ne != p) dfs(ne, now, d + 1, cost + g[now][i].cost);
        }
    }

public:

    LCA(){}

    LCA(int size){
        n = size;
        g.resize(n);
        dist.resize(n,0);
        dep.resize(n,0);
        h = 1;
        while((1<<h) <= n)h++;
        par.assign(h,vector<int>(n,-1));
    }

    void add(int a, int b, int c){//無向辺
        edge e1 = {b, c}, e2 = {a, c};
        g[a].push_back(e1);
        g[b].push_back(e2);//有向辺の場合はここをコメントアウトする
    }

    void build(int root = 0){
        dfs(root,-1,0,0);
        for(int k = 0; k+1 < h; k++){
            for(int v = 0; v < n; v++){
                if(par[k][v] < 0) par[k+1][v] = -1;
                else par[k+1][v] = par[k][par[k][v]];
            }
        }
    }

    int lca(int a, int b){//頂点ABのLCAのindex
        if(dep[a] > dep[b]) swap(a,b);
        for(int k = 0; k < h; k++){
            if((dep[b] - dep[a]) >> k & 1){
                b = par[k][b];
            }
        }
        if(a == b) return a;
        for(int k = h-1; k >= 0; k--){
            if(par[k][a] != par[k][b]){
                a = par[k][a];
                b = par[k][b];
            }
        }
        return par[0][a];
    }

    int distance(int a, int b){//頂点ABのパスの長さ
        return dist[a] + dist[b] - dist[lca(a,b)]*2;
    }

};


void GRL5C(){
    int n;
    cin >> n;
    LCA lca(n);
    rep(i,n){
        int k;
        cin >> k;
        rep(j,k){
            int to;
            cin >> to;
            lca.add(i,to,1);
        }
    }
    lca.build();
    int q;
    cin >> q;
    while(q--){
        int a,b;
        cin >> a >> b;
        cout << lca.lca(a,b) << endl;
    }
}

signed main(void) {

    GRL5C();
    
}



Measured memory_bytes: 29012
#include"iostream"
using namespace std;
struct card
{
	char abc;
	int data;
};
void merge(card a[], int left, int mid, int right);
int partition(card a[],int p,int r)
{
	card t;
	int x = a[r].data;
	int i = p - 1;
	for(int j=p;j<r;++j)
		if (a[j].data <= x)
		{
			++i;
			t = a[j];
			a[j] = a[i];
			a[i] = t;
		}
	t = a[i + 1];
	a[i + 1] = a[r];
	a[r] = t;
	return i + 1;
}
void quicksort(card a[],int p,int r)
{
	if (p >= r)return;
	int q = partition(a, p, r);
	quicksort(a, p, q - 1);
	quicksort(a, q+1, r);
}
void mergesort(card a[], int left, int right)
{
	if (left == right)return;
	int mid = (left + right) / 2;
	mergesort(a, left, mid);
	mergesort(a, mid + 1, right);
	merge(a, left, mid + 1, right);
}
void merge(card a[], int left, int mid, int right)
{
	card* tmp = new card[right - left + 1];
	int i = left, j = mid, k = 0;
	while (i < mid && j <= right)
	{
		if (a[i].data <= a[j].data)tmp[k++] = a[i++];
		else tmp[k++] = a[j++];

	}
	while (i < mid)
	{
		tmp[k++] = a[i++];
	}
	while (j <= right)
	{
		tmp[k++] = a[j++];
	}
	for (i = 0, k = left; k <= right;)a[k++] = tmp[i++];
	delete[]tmp;
}
int main()
{
	int n;
	cin >> n;
	cin.get();
	card* a = new card[n];
	int i;
	for (i = 0; i < n; ++i)
		cin >> a[i].abc >> a[i].data;
	card* num1 = new card[n];
	for (i = 0; i < n; ++i)
	{
		num1[i] = a[i];
	}
	mergesort(a,0, n-1);
	quicksort(num1, 0,n-1);
	int flag = 1;
	for (i = 0; i < n; ++i)
		if (a[i].abc != num1[i].abc) {
			flag = 0; break;
		}
	if (flag == 0)cout << "Not stable" << endl;
	else cout << "Stable" << endl;
	for (i = 0; i < n; ++i)
		cout << num1[i].abc<<' '<<num1[i].data<<endl;
	return 0;
}



Measured memory_bytes: 5484
b = list(input())
res = []
for i in range(len(b)):
    if b[i] == 'A':
        res.append("T")
    elif b[i] == 'T':
        res.append('A')
    elif b[i] == 'C':
        res.append('G')
    elif b[i] == 'G':
        res.append('C')

print(''.join(res))

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

n = int(input())

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

for i in range(3):
    for j in range(3):
        for m in range(n):
            if b[m] == a[i][j] :
                a[i][j]=0

if a[0][0]==a[0][1]==a[0][2]:
    print("Yes")
elif a[1][0]==a[1][1]==a[1][2]:
    print("Yes")
elif a[2][0]==a[2][1]==a[2][2]:
    print("Yes")
elif a[0][0]==a[1][0]==a[2][0]:
    print("Yes")
elif a[0][1]==a[1][1]==a[2][1]:
    print("Yes")
elif a[0][2]==a[1][2]==a[2][2]:
    print("Yes")
elif a[0][0]==a[1][1]==a[2][2]:
    print("Yes")
elif a[0][2]==a[1][1]==a[2][0]:
    print("Yes")
else :
    print("No")

Measured memory_bytes: 3064
// Hovalhagh
// Ya Aziz & Hakim
// AliReza Kaboli
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
const int N = 1e5 + 100;
 
ll dp[N];
 
int main() {
	int n, w, ans;
	cin >> n >> w;
	memset(dp, 62, sizeof dp);
	dp[0] = 0;
	for (int i = 1; i <= n; ++i) {
		int w, v;
		cin >> w >> v;
		for (int j = N - 1; j >= 0; --j)
			if (j - v >= 0)
				dp[j] = min(dp[j], dp[j - v] + w);
	}
	for (int i = 0; i < N; ++i)
		if (dp[i] <= w)
			ans = i;
	cout << ans << '\n';
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
vi d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  string s;
  cin >> s;
  int ans = 700;
  for (int i = 0; i < 3; i++)
    if (s.at(i) == 'o') ans += 100;
  cout << ans << endl;
}

Measured memory_bytes: 256
def f(a, b, c):
    from itertools import product
    return sum(i + j in a for i, j in product(b, c))


def solve(string):
    n, s = string.lower().split()
    r, g, b, r2, g2, b2 = [], [], [], set([]), set([]), set([])
    for i, _s in enumerate(s):
        eval(f"{_s}.append(i)")
        eval(f"{_s}2.add(2 * i)")
    return str(len(r) * len(g) * len(b) - f(r2, g, b) - f(g2, b, r) - f(b2, r, g))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 9668
'use strict'

const mod = 1e9 + 7

function solve(N, K, A) {
  if (K === 0) {
    return 1
  }
  var dp = new Array(K+1).fill(0)
  var prefix = new Array(N).fill(0).map(e => new Array(K+1).fill(0))

  for (var i = 0; i < N; i++) {
    for (var j = 0; j <= K; j++) {
      if (i === 0) {
        dp[j] = j <= A[i] ? 1 : 0
        prefix[i][j] = j > 0 ? ((prefix[i][j-1] + dp[j]) % mod) : dp[j]
      } else {
        dp[j] = (j-1 - A[i]) >= 0 ? (prefix[i-1][j] - prefix[i-1][j - A[i] - 1] + mod) % mod : prefix[i-1][j]
        prefix[i][j] = j > 0 ? ((prefix[i][j-1] + dp[j]) % mod) : dp[j]
      }
    }
  }
  return dp[K]
}

function main(input) {
  var lines = input.split("\n")
  var NK = lines[0].split(' ').map(l => parseInt(l))
  var N = NK[0]
  var K = NK[1]
  var A = lines[1].split(' ').map(l => parseInt(l))
  var ans = solve(N, K, A)
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

int main() {
  int s;
  cin >> s;
  
  vector<long> dp(s+1, 0);
  dp[0] = 1;
  for (long i = 3; i <= s; i++) {
    for (long j = 0; j <= i-3; j++) { 
      dp[i] += dp[j];
      dp[i] %= mod;
    }
  }
  
  cout << dp[s];
  
  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <memory.h>
#include <stdlib.h>

int eval(int N, int* p, long *a, long* b){
	int i;
	for(i=0;i<N-1;i++){
			if(a[i]>=a[i+1])return 0;
			if(b[i]<=b[i+1])return 0;
			if(a[p[i]-1]+b[p[i]-1]>=a[p[i+1]-1]+b[p[i+1]-1])return 0;
			if(a[i]>=1000000000||a[i]<1)return 0;
			if(b[i]>=1000000000||b[i]<1)return 0;
	}
	return 1;
}

int makeseq(int N, int* p, long *a, long* b){
	int i;
	for(i=0;i<N;i++){
		a[i]=i*N+1;
		b[i]=(N-i-1)*N+1;
	}
	for(i=0;i<N;i++){
		a[p[i]-1]+=i;
		b[p[i]-1]+=i;
	}
	return 1;
}

int main(){
	int N, i;
	int* p;
	long* a, *b;
	scanf("%d", &N);
	p=malloc(sizeof(int)*N);
	a=malloc(sizeof(long)*N);
	b=malloc(sizeof(long)*N);
	for(i=0;i<N;i++){
		scanf("%d", &p[i]);
	}
	makeseq(N,p,a,b);
	for(i=0;i<N;i++){
		printf("%ld ", a[i]);
	}
	printf("\n");
	for(i=0;i<N;i++){
		printf("%ld ", b[i]);
	}
	printf("\n");
	//printf("%s\n", (eval(N,p,a,b)?"true":"false"));
	free(p);
	free(a);
	free(b);
	return 0;
}


Measured memory_bytes: 896
input = $stdin.read.split("\n")
n = input.shift.to_i
as = input.map(&:to_i)

stepcount = as.shift-1
minvalue  = 2

as.each do |currency|

  if currency == minvalue
    minvalue = minvalue + 1
  else currency > minvalue
    stepcount = stepcount + ((currency-1) / minvalue)
  end
  # puts "#{currency}: #{stepcount} > #{minvalue}"
end

puts stepcount

Measured memory_bytes: 8828
n,a,b,c,d=map(int,input().split())
s=input()
if c<d and b<c:
  s=s[a-1:d]
elif c>d and b<c:
  t=s[b-2:d+1]
  s_=s[a-1:c]
elif a<c<b<d:
  s_=s[a-1:c]
  s=s[b-1:d]
  f=0
  f_=0
  for i in range(len(s_)):
    if s_[i]=='.':
      f=0
    elif s_[i]=='#' and f==0:
      f=1
    elif s_[i]=='#' and f==1:
      print('No')
      exit()
  for j in range(len(s)):
    if s[i]=='.':
      f_=0
    elif s[i]=='#' and f_==0:
      f_=1
    elif s[i]=='#' and f_==1:
      print('No')
      exit()
  print('Yes')
  exit()
if c<d:
  f=0
  for i in range(len(s)):
    if s[i]=='.':
      f=0
    elif s[i]=='#' and f==0:
      f=1
    elif s[i]=='#' and f==1:
      print('No')
      exit()
  print('Yes')
else:
  f=0
  g=0
  h='No'
  for i in range(len(s_)):
    if s_[i]=='.':
      f=0
    elif s_[i]=='#' and f==0:
      f=1
    elif s_[i]=='#' and f==1:
      print('No')
      exit()
  for j in range(len(t)):
    if t[j]=='.':
      g+=1
      if g==3:
        h='Yes'
    else:
      g=0
  print(h)    


Measured memory_bytes: 66496
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <boost/range/algorithm.hpp>
#include <boost/integer/common_factor_rt.hpp>

using namespace std;

int P, Q, R;

int main() {

    while (cin >> P >> Q >> R) {
        cout << (P + Q + R - max(max(P, Q), R)) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P;
typedef vector<int> Vi;
int const MOD = 1000000007;
double const PI = acos(-1);
template<class T> inline bool chmin(T& a, T b) { if (a > b) { return a = b; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { return a = b; } return false; }

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
   
    string s; cin>>s; int n=s.size();
    int gu=0,pa=0,ans=0;
    for (int i = 0; i < n; i++){
        if(s[i]=='g'){
            if(gu>pa){ans++; pa++;}
            else gu++;
        }else{
            if(gu>pa)pa++;
            else {ans--; gu++;}
        }
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 512
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var S = cin.Read;
            for(var i =0; i<S.Length; i++)
            {
                var c = S[i];
                // 奇数文字
                if(i%2==0)
                {
                    if(c == 'L')
                    {
                        WriteLine("No");
                        return;
                    }
                }
                else
                {
                    if (c == 'R')
                    {
                        WriteLine("No");
                        return;
                    }
                }
            }
            WriteLine("Yes");
        }

        static long GcdArray(long[] array)
        {
            var ans = array[0];
            for(var i=1; i<array.Length; i++)
            {
                ans = Gcd(ans, array[i]);
            }
            return ans;
        }

        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }

        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
typedef long long ll;
const int maxn = 2e5 + 10;
const int INF = 1e9;
using namespace std;

typedef pair<int, int> P;
int n, m, l, r, d;
int vis[maxn], dis[maxn];
vector<P> G[maxn];

bool bfs(int x) {
    queue<int> que;
    que.push(x); dis[x] = 0;
    vis[x] = 1;
    int ansmin = 0, ansmax = 0;
    while(!que.empty()) {
        int u = que.front(); que.pop();
        if(dis[u] > INF) return false;
        ansmin = min(ansmin, dis[u]);
        ansmax = max(ansmax, dis[u]);
        for(int i = 0; i < G[u].size(); i++) {
            P e = G[u][i];
            int to = e.first, w = e.second;
            if(vis[to] && dis[to] != dis[u] + w) return false;
            if(vis[to]) continue;
            vis[to] = 1; que.push(to); dis[to] = dis[u] + w;
        }
    }
    if(ansmax - ansmin > 1e9) return false;
    return true;
}

int main() {
    while(scanf("%d %d", &n, &m) != EOF) {
        memset(vis, 0, sizeof vis);
        for(int i = 0; i < maxn; i++) G[i].clear();
        for(int i = 1; i <= m; i++) {
            scanf("%d %d %d", &l, &r, &d);
            int sl = G[l].size();
            int sr = G[r].size();
            G[l].push_back(P(r, d));
            G[r].push_back(P(l, -d));
        }
        int flag = 1;
        for(int i = 1; i <= n; i++) if(!vis[i]) {
            flag = bfs(i);
            if(!flag) break;
        }
        if(flag) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}
/**
3 3
1 2 1
2 3 1
1 3 2

3 3
1 2 1
2 3 1
1 3 5

4 3
2 1 1
2 3 5
3 4 2

10 3
8 7 100
7 9 100
9 8 100

100 0
*/


Measured memory_bytes: 12928
n = gets.to_i
s = gets.chomp
r = Array.new(n, 0)
g = Array.new(n, 0)
b = Array.new(n, 0)
rc = gc = bc = 0
n.times do |i|
  case s[i]
  when "R"
    rc += 1
  when "G"
    gc += 1
  when "B"
    bc += 1
  end
  r[i] = rc
  g[i] = gc
  b[i] = bc
end
count = rc * gc * bc
for i in 0...(n - 2) do
  step = 1
  while true do
    j = i + step
    k = j + step
    break if k >= n
    if s[i] != s[j] && s[j] != s[k] && s[k] != s[i]
      count -= 1
    end
    step += 1
  end
end
puts count


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

int par[111111];
int rnk[111111];
int W[111111];

int root(int x){
  if(par[x]==x) return x;
  root(par[x]);
  W[x]+=W[par[x]];
  return par[x]=root(par[x]);
}

int weight(int x){
  root(x);
  return W[x];
}

void unite(int x,int y,int w){
  w+=weight(x);
  w-=weight(y);
  x=root(x);
  y=root(y);
  if(x==y) return;
  if(rnk[x]<rnk[y]) swap(x,y), w=-w;
  rnk[x]+=rnk[y];
  par[y]=x;
  W[y]=w;
}

signed main(){
  for(int i=0;i<111111;i++)par[i]=i;
  int n,m;
  cin>>n>>m;
  while(m--){
    int a,b,c,d;
    cin>>a>>b>>c;
    if(a==1){
      if(root(b)==root(c)){
        cout<< weight(c) - weight(b) <<endl;
      }
      else cout<<"?"<<endl;
    }
    else{
      cin>>d;
      unite(b,c,d);
    }
  }

}


Measured memory_bytes: 4320
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main()
{
    string S, T;
    cin >> S;
    cin >> T;

    int N = S.size();

    unordered_map<char, char> m;
    unordered_map<char, char> mm;

    for (int i = 0; i < N; ++i) {
        auto it = m.find(S[i]);
        auto it2 = mm.find(T[i]);

        if (it == end(m)) {
            m.emplace(S[i], T[i]);
        } else if (it->second != T[i]) {
            cout << "No" << endl;
            return 0;
        }

        if (it2 == end(mm)) {
            mm.emplace(T[i], S[i]);
        } else if (it2->second != S[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


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

#define dbg(x) cerr << #x"=" << x << endl;

typedef long long LL;
int N;
const int MAX_N = 1e5+100;
LL A[MAX_N];

int main() {
	//freopen("in.txt", "r", stdin);
	ios::sync_with_stdio(0); cin.tie(0);
    cin >> N;
    vector<int> c;
    for(int i = 0; i < N; ++i){
        cin >> A[i];
    }
    LL x;
    LL sum = 0;
    int ans = 0;
    for(int i = 0; i < N; ++i){
        cin >> x;
        x = A[i] - x;
        if(x == 0) continue;
        if(x < 0) {
            sum += x;
            ++ans;
        } else c.push_back(x);
    }
    sort(c.begin(), c.end());
    int sz = c.size();
    for(int i = sz-1; i >= 0; --i){
        if(sum >= 0){
            break;
        }
        sum += c[i];
        ++ans;
    }
    if(sum < 0) cout << -1 << endl;
    else cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n,k,a[100010];
signed main(){
    cin>>n>>k;
    rep(i,n)cin>>a[i];
    sort(a,a+n);
    init_fact();
    int masum=0,misum=0;
    for(int i=k-1;i<n;i++){
        masum+=comb(i,k-1)*a[i];
        masum+=MOD*1000000000ll;
        masum%=MOD;
    }
    reverse(a,a+n);
    for(int i=k-1;i<n;i++){
        misum+=comb(i,k-1)*a[i];
        misum+=MOD*1000000000ll;
        misum%=MOD;
    }
    cout<<(masum-misum+MOD)%MOD<<endl;
    return 0;
}

Measured memory_bytes: 16640
N, M = list(map(int, input().split()))

def solution():
    if M-N < M//N:
        for n in range(N, M+1):
            if M%n==0:
                return M//n
    else:
        for m in range(M//N, 0, -1):
            if M%m==0:
                return m

print(solution())
            

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define li long
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pii pair<int,int>
#define pli pair<li,li>
#define pll pair<ll,ll>
#define pb push_back
#define fori(i,k,n) for(int i = k;i<n; i++)
#define rfori(i,k,n) for(int i = k; i>=n; i--)
#define tc int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define inf INT_MAX
#define ninf INT_MIN
#define W(x) cout<<x<<endl
#define WW(x,y) cout<<x<<' '<<y<<endl;
#define in(x) cin>>x
#define int long long
const ll mod1 = 99844353;
const ll mod2 = 1e9+7;
template <class T>
using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
} 
template<class T>
T power(T a,T b){
    T res = (T)1;
    while(b>0){
        if(b&1)res = res*a;
        b>>=1;
        a*=a;
    }
    return res;
}
struct Node{
    int first;int second;
    Node(int x,int y){
        this->first = x;
        this->second = y;
    }
};
struct comparator{
    bool operator()(const Node &a,const Node &b){
        int lena = a.second-a.first+1;
        int lenb = b.second-b.first+1;
        if(lena == lenb)return a.first<b.first;
        else return lena>lenb;
    }
};


signed main(){
   int a,b;
   cin>>a>>b;
   cout<<a*b<<"\n";
}


Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const double pi = acos(-1.0);

//true -> T   false -> F
char ret(char a, char b) {
	return (a == 'T' && b == 'F') ? 'F' : 'T';
}

int main() {
	int n; cin >> n;
	vector<char> p(n);
	rep(i, n)cin >> p[i];

	char ans = ret(p[0], p[1]);
	FOR(i, 2, n)ans = ret(ans, p[i]);
	printf("%c\n", ans);
}


Measured memory_bytes: 3324
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A,B,C,X,Y,ans=INF;
  cin>>A>>B>>C>>X>>Y;
  for(int i=0;i<=2*max(X,Y);i+=2){
    ans=min(ans,max(0,X-i/2)*A + max(0,Y-i/2)*B + i*C);
  }
  cout<<ans<<endl;
}


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

int main() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  int X = x1 - x2;
  int Y = y1 - y2;

  int x3 = x2 + Y;
  int y3 = y2 - X;
  int x4 = x3 + X;
  int y4 = y3 + Y;
  cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << endl;
}

Measured memory_bytes: 256
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)

ans = p[:x] + q[:y] + r
ans.sort(reverse = True)

print(sum(ans[:x + y]))

Measured memory_bytes: 29664
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    a: i32,
    b: i32,
  }

  puts!("{}\n", cmp::max(0, a - b * 2));
}


Measured memory_bytes: 4352
#include <iostream>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string n;
    cin >> n;
    if (n[0] == n[1] && n[1] == n[2]) cout << n << '\n';
    else {
        string tmp;
        REP(i, 3)
            tmp.push_back(n[0]);
        if (tmp > n) cout << tmp << '\n';
        else {
            string ans;
            REP(i, 3)
                ans.push_back(n[0] + 1);
            cout << ans << '\n';
        }
    }
    return 0;
}


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

from scipy.sparse.csgraph import dijkstra

H,W = map(int,input().split())

# start = 0
# rows = 1,2,...,H
# cols = H+1,...,H+W
# goal = H+W+1

INF = 10 ** 9
start = 0
goal = H+W+1
V = H+W+2
graph = [[0] * V for _ in range(V)]
edges = [] # 隣接リスト
for i in range(H):
    row = input()
    for j,cell in enumerate(row):
        if cell == 'o':
            graph[1+i][1+H+j] = 1
            graph[1+H+j][1+i] = 1
    s = row.find('S')
    t = row.find('T')
    if s != -1:
        graph[start][1+i] = INF
        graph[start][1+H+s] = INF
    if t != -1:
        graph[1+i][goal] = INF
        graph[1+H+t][goal] = INF

# あとは max flow を求めればよい

def max_flow(graph):
    f = 0
    while True:
        if f > 200:
            return -1
        dist,pred = dijkstra(graph, indices = start, unweighted = True, return_predecessors = True)
        if dist[goal] > INF:
            return f
        f += 1
        after = goal
        while after != start:
            before = pred[after]
            graph[before][after] -= 1
            graph[after][before] += 1
            after = before

answer = max_flow(graph)
print(answer)

Measured memory_bytes: 17580
#include<stdio.h>

int main(void)
{
  long int n = 0,ans = 1;
  scanf("%d",&n);
  for(int i = 1;i <= n;i++)
  {
    ans *= i;
    if(ans >= 1000000007)
    {
      ans = ans % 1000000007;
    }
  }
  printf("%d",ans);
  return 0;
}


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

int main()
{
	int n;	cin >> n;
	if(n <= 111)	cout << 111 << endl;
	else if(n <= 222)	cout << 222 << endl;
	else if(n <= 333)	cout << 333 << endl;
	else if(n <= 444)	cout << 444 << endl;
	else if(n <= 555)	cout << 555 << endl;
	else if(n <= 666)	cout << 666 << endl;
	else if(n <= 777)	cout << 777 << endl;
	else if(n <= 888)	cout << 888 << endl;
	else if(n <= 999)	cout << 999 << endl;
}

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

#define int long long

#define rep(i,s,n) for(int i = (s);i<(n);i++)
#define repe(i,s,n) for(int i = (s);i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
const ll MOD=1000000007,INF=1e18;

int n=0,w=0,s=0,e=0;
int l[200010];
string S;
bool can1,can2;

signed main(){
    cin>>S;
    rep(i,0,S.size()){
        if(S[i]=='N')n++;
        else if(S[i]=='W')w++;
        else if(S[i]=='S')s++;
        else e++;
    }
    if(n&&s)can1=true;
    else if(!n&&!s)can1=true;
    if(w&&e)can2=true;
    else if(!w&&!e)can2=true;
    (can1&&can2)?puts("Yes"):puts("No");
    return 0;
    return 0;
    
    
}

Measured memory_bytes: 256
//Author- VMAX


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_multiset tree<long long , null_type,less_equal<long long >, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_set tree<long long , null_type,less<long long >, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define ll long long int
#define YES cout<<"YES"<<"\n";
#define NO cout<<"NO"<<"\n";
#define ld     long double 
#define yes cout<<"yes"<<"\n";
#define no cout<<"no"<<"\n";
#define No cout<<"No"<<"\n";
#define Yes cout<<"Yes"<<"\n";
#define f(i,a) for(i=0;i<a;i++)
#define fo(i,a) for(i=1;i<=a;i++)
#define fa(i,a) for(auto i:a)
#define r(i,a) for(auto i=a.rbegin();i!=a.rend();i++)
#define en cout<<"\n";
#define ull unsigned long long int
#define o(x) cout<<x<<"\n";
#define o1(x) cout<<x<<" ";
#define pb push_back
#define F first
#define in insert
#define mp make_pair
#define S second
#define pre(n) cout<<fixed<<setprecision(n);
#define      gcd(a,b)    __gcd(a,b)
#define bs            binary_search
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test ll t;cin>>t;while(t-->0)
const ll Mod = 998244353;
#define mod 1000000007
#define pi 3.14159265358979323846
#define all(x) x.begin(),x.end()
#define re return 0;
// *#######################################################################################*
/*
ll prf(ll n)
{
    ll c=0,i;
    while(n%2==0)
    {
        n=n/2;
        c++;
    }
    for(i=3;i*i<=n;i++)
    {
        while(n%i==0)
    }
    
    
    
}
*/
//vector<ll>a(26);
int main()
{
     
      
       ll x,y;
       cin>>x>>y;
       
       ll z,z1;
       
       z=x*4;
       z1=x*2;
       
       if(y>=z1&&y<=z&&y%2==0)
       {
           Yes
       }
      else
      {
          No
      }















      
  
     re
}

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

int main(){
  int n;
  cin >> n;
  vector<int> vec(n);
  for(int i=0; i<n; i++){
    int x;
    cin >> x;
    vec[i]=x;
  }
  int64_t ans=0;
  sort(vec.begin(),vec.end());
  for(int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
      for(int k=j+1; k<n; k++){
        if(vec[i]+vec[j]>vec[k]) ans++;
      }
    }
  }
  cout << ans << endl;
}

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

int main() {
    int x;
    cin >> x;
    for (int64_t i = 1; i < 1000000000000000000; i++) {
      for (int64_t j = i-1; j > -1000000000000000000; j--) {
        if (i*i*i*i*i - j*j*j*j*j == x) {
          cout << i << " " << j << endl;
          return 0;
        }
        if (i*i*i*i*i - j*j*j*j*j > 1000000000)
        break;
      }
    }
}




Measured memory_bytes: 3516