akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
typedef long long ll;
const int mod=1e9+7;
#define lol(i,n) for(int i=0;i<n;i++)

using namespace std;
int n,a[110],s=0;
int main() {
    cin >>n;
    lol(i,n){
        cin >>a[i];
        s+=a[i];
    }
    if(s%2==0)cout << s/2<< endl;
    else{
        sort(a,a+n);
        lol(i,n){
            if(a[i]%2==1){
                s-=a[i];
                cout <<s/2<< endl;
                return 0;
            }
        }
    }
}



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

struct Node {
    int key;
    Node *right, *left, *parent;
};

Node *root, *Nil;

void insert(int key) {
    Node *y = Nil;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = key;
    z->left = Nil;
    z->right = Nil;

    while (x != Nil) {
        y = x;
        x = z->key < x->key ? x->left : x->right;
    }

    z->parent = y;
    if(y == Nil) {
        root = z;
    } else {
        if(z -> key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void preorder(Node *n) {
    if(n == Nil) {
        return;
    }
    printf(" %d", n->key);
    preorder(n->left);
    preorder(n->right);
}

void inorder(Node *n) {
    if(n == Nil) {
        return;
    }
    inorder(n->left);
    printf(" %d", n->key);
    inorder(n->right);
}


int main() {
    int n;
    std::cin >> n;
    for(int i = 0; i < n; i++) {
        std::string str;
        std::cin >> str;
        if(str == "insert") {
            int nn;
            std::cin >> nn;
            insert(nn);
        } else if(str == "print") {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    return 0;;
}



Measured memory_bytes: 26644
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

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

int decode(const string& s) {
	int res = 0;
	int digit = 1;
	rep(i, s.length()) {
		if('0'<=s[i] && s[i]<='9') {
			digit = s[i]-'0';
		} else {
			int base = 0;
			switch(s[i]) {
				case 'm': base=1000; break;
				case 'c': base=100; break;
				case 'x': base=10; break;
				case 'i': base=1; break;
			}
			res += base * digit;
			digit = 1;
		}
	}
	return res;
}

string encode(const int n) {
	string res = "";
	int th=n/1000, hu=(n/100)%10, te=(n/10)%10, on=n%10;
	if(th>1) res += ('0'+th);
	if(th>0) res += 'm';
	if(hu>1) res += ('0'+hu);
	if(hu>0) res += 'c';
	if(te>1) res += ('0'+te);
	if(te>0) res += 'x';
	if(on>1) res += ('0'+on);
	if(on>0) res += 'i';
	return res;
}

int main() {
	int n;
	cin >> n;
	while(n--) {
		string a, b;
		cin >> a >> b;
		int ia = decode(a);
		int ib = decode(b);
		int sum = ia + ib;
		cout << encode(sum) << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

void abc_160a();

void abc_161a();

void abc_162a();

void abc_163a();

void abc_164a();

void abc_165a();

void abc_166a();

void abc_167a();

void abc_168a();

void abc_169();

int main()
{
  //abc_160a();
  //abc_161a();
  //abc_162a();
  //abc_163a();
  //abc_164a();
  //abc_165a();
  //abc_166a();
  //abc_167a();
  //abc_168a();
  abc_169();

}

void abc_160a()
{
  string S;
  cin >> S;

  if (S[2] == S[3] && S[4] == S[5]) cout << "Yes\n";
  else cout << "No\n";
}

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

void abc_161a()
{
  int x, y, z;
  cin >> x >> y >> z;

  swap(x, y);
  swap(x, z);

  cout << x << " " << y << " " << z << "\n";
}

void abc_162a()
{
  string s;
  cin >> s;
  for (char c : s)
  {
    if (c == '7')
    {
      cout << "Yes\n";
      return;
    }
  }

  cout << "No\n";
}

void abc_163a()
{
  int R;
  cin >> R;

  cout << (double)(2 * R * M_PI);
}

void abc_164a()
{
  int s, w;
  cin >> s >> w;

  if (s <= w) cout << "unsafe\n";
  else cout << "safe\n";
}

void abc_165a()
{
  int k, a, b;
  cin >> k >> a >> b;

  for (int i = a; i <= b; ++i)
  {
    if (i % k == 0)
    {
      cout << "OK\n";
      return;
    }
  }

  cout << "NG\n";
}

void abc_166a()
{
  string s;
  cin >> s;

  if (s == "ABC") cout << "ARC\n";
  if (s == "ARC") cout << "ABC\n";

}

void abc_167a()
{
  string s, t;
  cin >> s >> t;

  for (int i = 0; i < s.size(); ++i)
  {
    if (s[i] != t[i])
    {
      cout << "No\n";
      return;
    }
  }

  if ('a' <= t[t.size() - 1] && t[t.size() - 1] <= 'z') cout << "Yes\n";
  else cout << "No\n";

}

void abc_168a()
{
  string s;
  cin >> s;

  if (s[s.size() - 1] == '3') cout << "bon\n";
  else if (s[s.size() - 1] == '0' ||
    s[s.size() - 1] == '1' ||
    s[s.size() - 1] == '6' ||
    s[s.size() - 1] == '8') cout << "pon\n";
  else cout << "hon\n";
}

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


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;

class UnionFind {
public:
    vector <int> par; // 各元の親を表す配列
    vector <int> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(int sz_): par(sz_), siz(sz_, 1) {
        for (int i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(int sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (int i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    int root(int x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(int x, int y) { // 連結判定
        return root(x) == root(y);
    }

    int size(int x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    int N, M;
    cin >> N >> M;
    UnionFind uf1(N);

    pair<int, int> P[M];
    rep(i,M){
      cin >> P[i].first >> P[i].second;
      --P[i].first; --P[i].second;
    }
    reverse(P, P+M);
    int cou1 = N*(N-1)/2;

    UnionFind uf(N);

    int A[M];
    rep(i, M){
      A[M-1-i] = cou1;
      if(uf.root(P[i].first) != uf.root(P[i].second)){
        cou1 -= uf.size(P[i].first) * uf.size(P[i].second);
        uf.unite(P[i].first, P[i].second);
      }
      else{
        uf.unite(P[i].first, P[i].second);
      }
      
    }
    rep(i,M) cout << A[i] << endl;

}

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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long K, std::vector<long long> A){
    for (int i = K; i < N; i++) {
        if (A[i] > A[i - K]) {
            cout << YES << endl;
        } else {
            cout << NO << endl;
        }
    }
}

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


Measured memory_bytes: 4864
/* jai_shree_ram
*@author cuddling
and an absolute beginner
*/
#include<bits/stdc++.h>
using namespace std;
#define inf 1e18
#define ll long long
#define pb push_back
#define mp make_pair
#define nl  "\n"
#define f(k,n) for(auto i =k; i<n; i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie();
typedef pair<ll , ll> ii;
typedef vector<ii> vii;
typedef vector<ll> vi;

int main(){
    ll n,k;
    cin>>n>>k;
    if(n<k){
        ll x = abs(n-k);
        if(x<n)cout<<x<<" ";
        else cout<<n;
    }
    else if(n%k == 0) cout<<"0";
    else{
        ll x = n/k; 
        ll y = n%k; 
        ll z = (x+1)*k;
        ll w = z-n;
        if(w<y)cout<<w;
        else cout<<y;
    }
    return 0 ;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdbool.h>

int main() {
	int x;
	scanf("%d", &x);
	bool prime=true;
	while(1){
		prime=true;
		for (int i = 2; i < pow(x,0.5); i++) {
	    	if( x%i==0 ) {
				prime=false;
        		break;
      		}
    	}
		if(prime){
			printf("%d\n", x);
			break;
		}
		x++;
	}
	return 0;
}


Measured memory_bytes: 128
#include <cstdio>
int main(void){
    // Here your code !
   int h, w;
   while (1){
       scanf("%d %d", &h, &w);
       if (h == 0 && w == 0) break;
       for (int i = 0; i < h; i++){
           for (int j = 0; j < w; j++){
               if ((i + j) % 2 == 0){
                   printf("#");
               }
               else {
                   printf(".");
               }
           }
           printf("\n");
       }
       printf("\n");
   }
    return 0;
}

Measured memory_bytes: 2608
#include <stdio.h>

int comp(const void *a,const void *b){
  return *(int*)a-*(int*)b;
}

int main(){
  int N,K,S=0;
  int d[1002]={};
  scanf("%d %d",&N,&K);
  for(int i=0;i<N;i++)
    scanf("%d",d+i);
  qsort(d,N,sizeof(int),comp);
  for(int i=0;i<K;i++){
    S+=d[i];
  }
  printf("%d\n",S);
  return 0;
}
  

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
signed main(){
  string a;
  cin>>a;
  if(a=="a"||a=="i"||a=="u"||a=="e"||a=="o"){
    cout<<"vowel"<<"\n";
    return(0);
  }
  cout<<"consonant"<<"\n";
  return(0);
}


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

using namespace std;

class Solver {
public:
	static void solve() {
		int n, k;
		cin >> n >> k;
		int now = 1;
		n--;
		int sum = 1;
		while (true) {
			int need = sum / k;
			if (sum % k > 0)need++;

			if (n < need)break;

			now++;
			sum += need;
			n -= need;
		}

		cout << now << endl;
	}
};

int main() {
	Solver::solve();
}


Measured memory_bytes: 3080
#include <iostream>
#include <bitset>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	unordered_map<int, int> um;
	for (int i = 0; i < n - 1; i++) {
		int t;
		cin >> t;
		um[t]++;
	}
	for (int i = 1; i <= n; i++) {
		cout << um[i] << endl;
	}
}


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

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //   cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        string s = "";
        while (n > 0)
        {
            n--;
            int rem = n % 26;
            s += 'a' + rem;
            n /= 26;
        }
        reverse(s.begin(), s.end());
        cout << s;
    }
}

Measured memory_bytes: 3640
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e6+5;
int k,a,b;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>k>>a>>b;
    int change = 0;
    if(a+1<b)change = 1;
    
    int init = a -1;
    int op = (k-init)/2;
    int res = (k-init)%2;
    
    long long ans = 0;
    if(change)
        ans = (long long)a + (long long)(b-a)* op + res;
    else ans = 1+k;
    
    cout<<ans<<endl;
    
    return 0;
}



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

#define FasterIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main(){
    FasterIO;

    int n, m;

    while(cin>>n>>m){
        int cnt[m+1];

        memset(cnt, 0, sizeof cnt);

        for(int i=0; i<n; i++){
            int nn;
            cin>>nn;
            while(nn--){
                int val;
                cin>>val;
                cnt[val]++;
            }
        }

        int ans=0;

        for(int i=0; i<=m; i++)
            if(cnt[i]==n)
                ans++;
        cout<<ans<<endl;
    }

    return 0;
}


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

public class Test
{
	public static void Main()
	{
		while (true)
		{
			int n = int.Parse(Console.ReadLine());
			if (n == 0)
			{
				return;
			}
			int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
			double sum = 0.0;
			var ave = a.Average();
			foreach (int i in a)
			{
				sum += (i - ave) * (i - ave);
			}
			Console.WriteLine(Math.Sqrt(sum / n));
			
		}
	}
}

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

#define mp make_pair
#define pb push_back
#define st first
#define nd second

typedef long long ll;
typedef pair < ll , ll > pp;
const int mod = 1e9 + 7;
const int N   = 2e5 + 5;

int A[N],B[N],n,i;

main(){
    cin >> n;
    for(i=1;i<=n;i++) { cin >> A[i]; B[i] = A[i]; }
    sort(B+1 , B+n+1);

    for(i=1;i<=n;i++){
        if(A[i] < B[n/2+1]) cout << B[n/2+1];
        else cout << B[n/2];
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

struct Edge{
	int src,dst,weight;
	Edge(){}
	Edge(int s,int d,int w):src(s),dst(d),weight(w){}
};

bool operator<(const Edge& lhs,const Edge& rhs)
{
	return lhs.weight<rhs.weight;
}

bool operator>(const Edge& lhs,const Edge& rhs)
{
	return lhs.weight>rhs.weight;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

struct UnionFind{
	vi data;
	UnionFind(int size):data(size,-1){}
	int Find(int n){
		return data[n]<0?n:(data[n]=Find(data[n]));
	}
	void Union(int n1,int n2){
		int d1=Find(n1);
		int d2=Find(n2);
		if(d1!=d2){
			if(-data[d1]<-data[d2])
				swap(d1,d2);
			data[d1]+=data[d2];
			data[d2]=d1;
		}
	}
	int Size(int n){
		return -data[Find(n)];
	}
};

int Kruskal(Graph& g,Edges& e)
{
	e.clear();
	
	UnionFind uf(g.size());
	multiset<Edge> s;
	rep(i,g.size())
		rep(j,g[i].size())
			s.insert(g[i][j]);
	
	int res=0;
	foreach(i,s){
		if(uf.Find(i->src)!=uf.Find(i->dst)){
			uf.Union(i->src,i->dst);
			res+=i->weight;
			e.push_back(*i);
		}
	}
	
	return res;
}

int Prim(Graph& g,Edges& tree,int root=0)
{
	tree.clear();
	
	int size=g.size();
	vector<int> visited(size);
	
	priority_queue<Edge,vector<Edge>,greater<Edge> > pq;
	pq.push(Edge(-1,root,0));
	int res=0;
	while(!pq.empty()){
		Edge e=pq.top();
		pq.pop();
		if(visited[e.dst])
			continue;
		if(e.src!=-1)
			tree.push_back(e);
		visited[e.dst]=1;
		res+=e.weight;
		rep(i,g[e.dst].size()){
			Edge cand=g[e.dst][i];
			if(!visited[cand.dst])
				pq.push(cand);
		}
	}
	return res;
}

int main()
{
	for(int n,m;cin>>n>>m,n;){
		Graph g(n);
		rep(i,m){
			int src,dst,weight;
			scanf("%d,%d,%d",&src,&dst,&weight);
			g[src].push_back(Edge(src,dst,weight/100-1));
			g[dst].push_back(Edge(dst,src,weight/100-1));
		}
		Edges e;
		//int sum=Kruskal(g,e);
		int sum=Prim(g,e);
		cout<<sum<<endl;
	}
	
	return 0;
}

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

namespace B {
    class Program {
        static void Main(string[] args) {
            var zip = Console.ReadLine().Split();
            var A = int.Parse( zip[ 0 ] );
            var B = int.Parse( zip[ 1 ] );
            var S = Console.ReadLine();
            var doesMeet = true;
            if (S.Length != A + B + 1) doesMeet = false;
            else if (S.Where( x => x == '-' ).Count() != 1) doesMeet = false;
            else if (S.Split( '-' )[ 0 ].Length != A) doesMeet = false;
            else if (S.Split( '-' )[ 1 ].Length != B) doesMeet = false;
            Console.WriteLine( doesMeet ? "Yes" : "No" );
        }
    }
}


Measured memory_bytes: 11348
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <vector>

using namespace std;

#define SIDE 3
#define N 9

typedef struct board {
  int state[N];
  int zero_pos;
  vector<int> path;

  bool operator < (const board &t) const {
    for (int i = 0; i < N; i++) {
      if (state[i] == t.state[i]) continue;
      else if (state[i] < t.state[i]) return true;
      else return false;
    }
    return false;
  }
} Board;

int BOARD[N] = { -1 };
int DX[4] = { 0, 1, 0, -1 };
int DY[4] = { 1, 0, -1, 0 };

bool is_goal(Board b) {
  for (int i = 0; i < N-1; i ++)
    if (b.state[i] != i+1) return false;

  return true;
}

void solve(Board b) {
  map<Board, bool> visited;
  queue<Board> q;
  q.push(b);

  while (!q.empty()) {
    Board cur_b = q.front(); q.pop();
    visited[cur_b] = true;

    if (is_goal(cur_b)) {
      cout << cur_b.path.size() << endl;
      return;
    }

    for (int i = 0; i < 4; i ++) {
      Board new_b = cur_b;
      int new_x = (cur_b.zero_pos / SIDE) + DX[i];
      int new_y = (cur_b.zero_pos % SIDE) + DY[i];

      if (new_x < 0 || new_x > 2 || new_y < 0 || new_y > 2) continue;

      new_b.zero_pos = new_x * SIDE + new_y;
      swap(new_b.state[new_b.zero_pos], new_b.state[cur_b.zero_pos]);

      if (visited[new_b]) continue;

      new_b.path.push_back(new_b.zero_pos);
      q.push(new_b);
    }
  }
}

int main() {
  Board b;

  for (int i = 0; i < N; i++) {
    cin >> b.state[i];
    if (b.state[i] == 0) b.zero_pos = i;
  }

  solve(b);
}

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

int main() {
  string s; cin >>s;
  s[6-1]=' ';
  s[14-1]=' ';
  cout <<s <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
typedef long long LL;

int main() {
	std::vector<int> a;

	for (int i = 0; i < 3; ++i) {
		int x;
		std::cin >> x;
		a.push_back(x);
	}

	std::sort(a.begin(),a.end());

	std::cout << (a[2] * 10) + a[1] + a[0] << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int d[7020][7020];
int main()
{
	int num, len;
	scanf("%d%d", &num, &len);
	for (int i = 0; i < num; i++)
	{
		int za, zb;
		char zc;
		scanf("%d%d %c", &za, &zb, &zc);
		za %= len * 2;
		zb %= len * 2;
		za++, zb++;
		for (int j = 0; j < 5; j++)
		{
			for (int k = 0; k < 5; k++)
			{
				if ((((j + k) & 1) != 0) == (zc == 'B'))
				{
					d[za + len*j][zb + len*k]++, d[za + len*(j + 1)][zb + len*k]--, d[za + len*j][zb + len*(k + 1)]--, d[za + len*(j + 1)][zb + len*(k + 1)]++;
				}
			}
		}
	}
	for (int i = 0; i <= len * 6; i++)for (int j = 0; j <= len * 6; j++)d[i + 1][j + 1] += d[i + 1][j] + d[i][j + 1] - d[i][j];
	int maxi = 0;
	for (int i = 0; i <= len * 6; i++)for (int j = 0; j <= len * 6; j++)maxi = max(maxi, d[i][j]);
	printf("%d\n", maxi);
}

Measured memory_bytes: 192128
N = int(input())
H = list(map(int, input().split()))

cnts = 0
cnt = [0] * N
for i in range(1, N):
    if H[i-1] >= H[i]:
        cnts +=1
    else :
        cnts = 0
    cnt[i] = cnts

print(max(cnt))

Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, L;
  cin >> N >> L;

  vector<string> words(N);

  for (int i = 0; i < N; i++) {
    cin >> words.at(i);
  }

  sort(words.begin(),words.end());

  for(s : words){
    cout << s;
  }
  cout << endl;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int,input().split()))
x = 0
lis = []
for i in range(0,len(H)-1) :
    if H[i] - H[i+1] >=0:
        x += 1
    else:
        lis.append(x)
        x =0
lis.append(x)
print(max(lis))

Measured memory_bytes: 14228
#include<cstdio>
#include<algorithm>
using namespace std;

#define ll long long

const int maxn = 1e5 + 500;
ll dp[2][maxn]; //dp[0][i]表示正向走到i点获得的最大能量，dp[1][i]为反向...
ll g[2][maxn];  //g[0][i]表示正向走到i点回到x=0位置所拥有的能量，g[1][i]反之...
ll x[maxn], v[maxn];
ll n, c, sum;

int main()
{
	scanf("%lld %lld", &n, &c);
	for (int i = 1; i <= n; i++)
    {
        scanf("%lld %lld", &x[i], &v[i]);
    }

    //正向遍历
	for (int i = 1; i <= n; i++)
    {
		sum += v[i];
		dp[0][i] = max(dp[0][i - 1], sum - x[i]);
		g[0][i] = sum - 2 * x[i];
	}

	sum = 0;
	//反向遍历
	for (int i = n; i >= 1; i--)
    {
		sum += v[i];
		dp[1][i] = max(dp[1][i + 1], sum - (c - x[i]));
		g[1][i] = sum - 2 * (c - x[i]);
	}

	ll ans = max(dp[0][n], dp[1][1]);

	for (int i = 1; i <= n; i++)
    {
		ans = max(ans, g[0][i] + dp[1][i + 1]);
		ans = max(ans, g[1][i] + dp[0][i - 1]);
	}

	printf("%lld\n", ans);//若ans<0可以选择不走

	return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

using namespace std;
using ll = long long;
typedef pair<int, int> P;

int main(){
    int n, T; cin >> n >> T;
    int ct[n][2];
    int d=1010;
    rep(i, n){
            int c, t;
            cin >> c >>t;

            if(t<=T){
                d = min(d, c);
                }
    }
    if(d==1010) out("TLE")
    else out(d);
}

Measured memory_bytes: 3604
fn main() {
    let (k, x) = {
        let v = read_vec::<i32>();
        (v[0], v[1])
    };

    let iter = (x - (k - 1))..(x + (k - 1) + 1);

    for i in iter {
        println!("{}", i);
    }

}

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

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

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    ll n,k;cin>>n>>k;
    ll x=min(n%k,abs(n%k-k));
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll M=1e9+7;
 
 
int main() {
	
	ll n;cin>>n;
	ll i,j,v[n],dp[n+1]={};
for(i=0;i<n-1;i++)
{
	 ll a;cin>>a;
	 dp[a]++;
}
	for(i=1;i<=n;i++)
		cout<<dp[i]<<endl;
	return 0;
} 

Measured memory_bytes: 5196
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    cout << fixed << setprecision(10);
    
    int H, W, N; cin >> H >> W >> N;
    int b;
    if (H > W) {
        b = H;
    } else {
        b = W;
    }
    cout << (N+b-1)/b << endl;
    return 0;
}

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

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

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

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

inline void read() {}

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

inline void print() { cout << "\n"; }

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

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

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

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

    var(string, s);
    vector<int> cnt(3);
    for (const char c : s) {
        cnt[c - 'a'] += 1;
    }

    vector<int> a(3, s.length() / 3);
    if (s.length() % 3 >= 1) a[1]++;
    if (s.length() % 3 >= 2) a[2]++;

    sort(all(cnt));
    sort(all(a));

    dump(cnt);
    dump(a);

    print((cnt == a) ? "YES" : "NO");
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
#define set(i) setprecision(i)
using namespace std;

signed main(){
    int n,m; cin>>n>>m;
    map<int, int> rem;
    rem[0]++;
    int sum=0;
    rep(i,n){
        int a; cin>>a;
        sum+=a;
        rem[sum%m]++;
    }
    int ans=0;
    for(auto i : rem){
        ans+=i.S*(i.S-1)/2;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4224
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
	int N;
	int T,A,i;
	cin>>N;
	cin>>T>>A;

	double minT=1e9;
	int minI=0;
	int H;
	for (i=0;i<N;i++){
		cin>>H;
		double x=T-H*0.006;
		x-=A;
		if (x<0){
			x=-x;
		}
		if (minT>x){
			minT=x;
			minI=i+1;
		}
	}
	cout<<minI<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define the_num 1000000007
#define ano_num 998244353
#define forn(n) for(int i=0;i<n;i++)
#define For(i,start_i,n) for(int i=start_i;i<n;i++)
#define test int t;cin >> t;while(t--)
#define all(v) v.begin(),v.end()
#define in_arr(arr,n) int arr[n];forn(n) cin >> arr[i];
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define take(data_type,n) data_type n;cin >> n;
#define swap(a,b) a = a+b;b = a-b;a = a-b;
using namespace std;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0;i<s.length();i++){
        if(s[i] == '?'){
            s[i] = 'D';
        }
    }
    cout << s << '\n';
}

Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
int main(){
	vector<int>x={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k; cin>>k;
	cout<<x[k-1]<<endl;
	return 0;
}

Measured memory_bytes: 256
def enumDivisor(n):
    ans = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            ans.append(i)
            if i * i != n:
                ans.append(n // i)
    return ans


n = int(input())

ans = 0

for k in enumDivisor(n):
    if k == 1:
        continue
    tmp = n
    while tmp % k == 0:
        tmp //= k
    tmp %= k
    if tmp == 1:
        ans += 1

ans += len(enumDivisor(n - 1)) - 1

print(ans)


Measured memory_bytes: 3188
#include <stdio.h>

int main()
{
  int n;
  scanf("%d",&n);
  char s[n];
  int x;
  int max;
  x = 0;
  max = 0;
  int i;
  i = 0;
  scanf("%s",&s);
  while (s[i])
  {
    if (s[i] == 'D')
      x--;
    else
      x++;
    if (max < x)
      max = x;
    i++;
  }
  printf("%d",max);
}

Measured memory_bytes: 128
#include <stdio.h>
#include <algorithm>

using namespace std;

typedef struct {
	int h;
	int a, b;
} SIDE_LINE;

bool operator< (const SIDE_LINE& a, const SIDE_LINE& b)
{
	return (a.h > b.h);
}

int main(void)
{
	SIDE_LINE side[1000];
	int n, m, a;
	int amida[100];
	
	while (1){
		scanf("%d%d%d", &n, &m, &a);
		
		if (!n) break;
		
		for (int i = 0; i < m; i++){
			scanf("%d%d%d", &side[i].h, &side[i].a, &side[i].b);
		}
		sort(side, side + m);
		
		for (int i = 0; i < n; i++){
			amida[i] = i + 1;
		}
		
		for (int i = 0; i < m; i++){
			swap(amida[side[i].a - 1], amida[side[i].b - 1]);
		}
		
		int i = 0;
		while (amida[i] != a){
			i++;
		}
		
		printf("%d\n", i + 1);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include<stdio.h>

int main(){
   int i,j,x,A[100],N,count =0,flag = 1; // 逆の隣接要素が存在する
   
   scanf("%d",&N);
   
   for(i = 0 ; i < N ; i++){
       scanf("%d",&A[i]);
   }
   
   while(flag){
     flag = 0;
     for (j=N-1 ; j >= 1 ; j--){
       if(A[j] < A[j-1]){
           x = A[j];
           A[j] = A[j-1];
           A[j-1] = x;
         flag = 1;
         count++;
       }
     }
   }
    for(i = 0 ; i < N ; i++){
       printf("%d",A[i]);
       if(i+1!=N){
           printf(" ");
       }
   }
   printf("\n%d\n",count);
}


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

using namespace std;

#define PI (3.14159265358979323846)
#define MP make_pair
#define n1 first
#define n2 second
#define ALL(x) (x).begin(), (x).end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MS multiset
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define SZ(x) ((int)x.size())

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;

const db eps = 0.00001;
const int INF = 1000000007;
const ll LINF = 1000000000000000555;
const int N = 550555;
const int M = 1125;

int a[N];
void solve() {
    int n, k;
    cin >> n >> k;

    for (int i = 1; i <= n; i++){
        cin >> a[i];
    }

    for (int i = k+1; i <= n; i++){
        if (a[i] > a[i-k]) cout << "Yes\n"; else
            cout << "No\n";
    }

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 4436
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

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

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
	int a;
	string s;
	cin >>a>>s;
	if(a>=3200){
		cout<<s<<endl;
	}
	else{
		cout<<"red"<<endl;
	}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> int_pair;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
const int N=50;
int h,w,def=0,ans,br=0;
char s[N][N];
bool did[N][N];
queue <pair<int,pair<int,int> > > q;
pair<int,pair<int,int> > p;
void pushq(int x,int y,int d){
	if(x+1<h){
		if(s[x+1][y]=='.'&&!did[x+1][y]){
			q.push(make_pair(d,make_pair(x+1,y)));
			did[x+1][y]=true;
		}
	}
	if(x-1>=0){
		if(s[x-1][y]=='.'&&!did[x-1][y]){
			q.push(make_pair(d,make_pair(x-1,y)));
			did[x-1][y]=true;
		}
	}
	if(y+1<w){
		if(s[x][y+1]=='.'&&!did[x][y+1]){
			q.push(make_pair(d,make_pair(x,y+1)));
			did[x][y+1]=true;
		}
	}
	if(y-1>=0){
		if(s[x][y-1]=='.'&&!did[x][y-1]){
			q.push(make_pair(d,make_pair(x,y-1)));
			did[x][y-1]=true;
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	CLR(did);
	cin>>h>>w;
	FOR(i,0,h){
		FOR(j,0,w){
			cin>>s[i][j];
			if(s[i][j]=='#')br++;
		}
	}

	q.push(make_pair(0,make_pair(0,0)));
	did[0][0]=true;
	int x,y;
	while(1){
		p=q.front();
		q.pop();
		x=p.second.first;
		y=p.second.second;
		def=p.first;
		if(x==h-1&&y==w-1)break;
		pushq(x,y,def+1);
		if(q.size()==0){
			ans=-1;
			break;
		}
	}
	if(ans!=-1)ans=w*h-1-def-br;
	cout<<ans<<endl;
	return 0;
}

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

int main() {
   int N;
   string S;
   cin >> N >> S;
   int count=0;
   for (int i=0; i<N-2; i++) {
       if (S.substr(i,3)=="ABC") count++;
   }
   cout << count << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(java.util.Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: java.util.Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val AB = Array(N) { Pair(sc.next().toInt(), sc.next().toInt()) }
            .sortedBy { it.second }
        var t = 0
        for (i in AB.indices) {
            t += AB[i].first
            if (t > AB[i].second) {
                pw.println("No")
                return
            }
        }
        pw.println("Yes")
    }
}


Measured memory_bytes: 127924
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, m;
    cin >> n >> m;
    vector<vector<ll>> g(n);
    REP(i, m) {
        ll a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    queue<ll> que;
    que.push(0);
    vector<ll> dist(n, INF);
    dist[0] = 0;
    while(que.size()) {
        ll x = que.front(); que.pop();
        for(auto to: g[x]) {
            if(dist[to] == INF) {
                dist[to] = dist[x] + 1;
                que.push(to);
            }
        }
    }

    cout << "Yes\n";
    FOR(i, 1, n) {
        ll mi = INF, idx = -1;
        for(auto to: g[i]) {
            if(mi > dist[to]) {
                mi = dist[to];
                idx = to;
            }
        }
        cout << idx+1 << "\n";
    }

    return 0;
}

Measured memory_bytes: 12948
#include <iostream>
using namespace std;
int main(void){
    double r,S,T;
    cin>>r;
    scanf("%lf", &r);
    S=r*r*3.141592653589;
    T=2*r*3.141592653589;
    printf("%f %f\n", S, T);
    cout<<endl;
}



Measured memory_bytes: 3292
#include<stdio.h>
int nonmi(int a) {
  if (a < 0) return 0;
  else return a;
}
int main() {
  int q1, q2, b, c1, c2;
  int lef, righ, mid;
  while (1) {
    scanf("%d", &q1);
    if (!q1) break;
    scanf("%d %d %d %d", &b, &c1, &c2, &q2);
    lef = 1; righ = q2;
    if (b < lef * c1 + (q1 - lef) * c2) {
      printf("NA\n"); continue;
    }
    while (lef < righ) {
      mid = (lef + righ) / 2 + 1;
      if (mid * c1 + nonmi(q1 - mid) * c2 > b) righ = mid - 1;
      else lef = mid;
    }
    righ = (b - lef * c1) / c2;
    printf("%d %d\n", lef, righ);
  }
  return 0;
}

Measured memory_bytes: 612
string = input()
for n in range(len(string)):
    if string[n] in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
        print(string[n].lower(), end="")
    elif string[n] in "abcdefghijkelmnopqrstuvwxyz":
        print(string[n].upper(), end="")
    else:
        print(string[n], end="")
print()

Measured memory_bytes: 7332
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}


// TODO: write
int main() {
  int x,y,a,b,c;cin>>x>>y>>a>>b>>c;
  vector<int> p(a),q(b),r(c);
  rep(i,a)cin>>p[i];
  rep(i,b)cin>>q[i];
  rep(i,c)cin>>r[i];
  sort(all(p),greater<int>());
  sort(all(q),greater<int>());
  sort(all(r),greater<int>());

  vector<int> xy(x+y);
  rep(i,x)xy[i] = p[i];
  rep(i,y)xy[i+x] = q[i];
  sort(all(xy));
  
  rep(i,min(c,x+y)){
    chmax(xy[i],r[i]);
  }
  ll ans = SUM(xy);
  print(ans);
  return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)

void chmax(ll& a, ll b) { a = max(a, b); }
void chmin(ll& a, ll b) { a = min(a, b); }


int main() {
    int n,m,q; cin >> n >> m >> q;
    vector<int> a(q);
    vector<int> b(q);
    vector<int> c(q);
    vector<int> d(q);
    rep(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i];


    ll ans = 0;
    for(int aa=1; aa <= m; aa++) {
        for(int bb=aa; bb <= m; bb++) {
            for(int cc=bb; cc <= m; cc++) {
                for(int dd=cc; dd <= m; dd++) {
                    for(int ee=dd; ee <= m; ee++) {
                        for(int ff=ee; ff <= m; ff++) {
                            for(int gg=ff; gg <= m; gg++) {
                                for(int hh=gg; hh <= m; hh++) {
                                    for(int ii=hh; ii <= m; ii++) {
                                        for(int jj=ii; jj <= m; jj++) {
                                            vector<int> tmp(10, 0);
                                            ll tmpans = 0;
                                            tmp[0] = aa;
                                            tmp[1] = bb;
                                            tmp[2] = cc;
                                            tmp[3] = dd;
                                            tmp[4] = ee;
                                            tmp[5] = ff;
                                            tmp[6] = gg;
                                            tmp[7] = hh;
                                            tmp[8] = ii;
                                            tmp[9] = jj;
                                            rep(i, q) {
                                                if(tmp[b[i]-1] - tmp[a[i]-1] == c[i]) {
                                                    tmpans += d[i];
                                                }
                                            }
                                            ans = max(ans, tmpans);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

class Dice
{
public:
	int f1, f2, f3, f4, f5, f6;
public:
	Dice() 
	{
		f1 = f2 = f3 = f4 = f5 = f6 = 0;
	};
	~Dice() {};
public:
	void roll(char angle)
	{
		int temp;
		if (angle == 'N')
		{
			temp = f1;
			f1 = f2;
			f2 = f6;
			f6 = f5;
			f5 = temp;
		}
		else if (angle == 'S')
		{
			temp = f1;
			f1 = f5;
			f5 = f6;
			f6 = f2;
			f2 = temp;
		}
		else if (angle == 'W')
		{
			temp = f1;
			f1 = f3;
			f3 = f6;
			f6 = f4;
			f4 = temp;
		}
		else
		{
			temp = f1;
			f1 = f4;
			f4 = f6;
			f6 = f3;
			f3 = temp;
		}
	}
};

int main()
{
	Dice dice;
	string angle;

	cin >> dice.f1 >> dice.f2 >> dice.f3 >> dice.f4 >> dice.f5 >> dice.f6;
	cin >> angle;
	for (int i = 0; i < angle.size(); i++)
	{
		dice.roll(angle[i]);
	}
	cout << dice.f1 << endl;
	return 0;
}


Measured memory_bytes: 3204
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#define INF (2000000000)
#define MOD (1000000007)
using namespace std;

typedef vector<int> VI;
typedef vector<int>::iterator VII;
typedef vector<double> VD;
typedef vector<double>::iterator VDI;
typedef pair<int, int> P;


typedef struct
{
	int head[5000];
	VI to;
	VI next;
	VI cost;
} EDGE;

int N, K;
int C[5000], R[5000];
EDGE road;
EDGE taxi;
int d[5000];
int range[5000];

void SearchTaxi(int i, int now, int r)
{
	if (r == 0) return;
	
	for (int e = road.head[now]; e != -1; e = road.next[e]){
		taxi.next.push_back(taxi.head[i]);
		taxi.head[i] = taxi.next.size() - 1;
		taxi.to.push_back(road.to[e]);
		taxi.cost.push_back(C[i]);
		
		//int n = taxi.next.size() - 1;
		//printf("%d %d %d %d\n", n, now, taxi.to[n], taxi.next[n], taxi.cost[n]);
		
		SearchTaxi(i, road.to[e], r - 1);
	}
}

void __SearchTaxi(int i)
{
	memset(range, -1, sizeof(range));
	
	range[i] = R[i];
	
	while (true){
		bool update = false;
		
		for (int i = 0; i < N; i++){
			for (int e = road.head[i]; e != -1; e = road.next[e]){
				if (range[road.to[e]] < range[i] - 1){
					range[road.to[e]] = range[i] - 1;
					update = true;
				}
			}
		}
		
		if (!update) break;
	}
	
	for (int j = 0; j < N; j++){
		if (range[j] != -1){
			taxi.next.push_back(taxi.head[i]);
			taxi.head[i] = taxi.next.size() - 1;
			taxi.to.push_back(j);
			taxi.cost.push_back(C[i]);
			
			//int n = taxi.next.size() - 1;
			//printf("%d %d %d %d\n", n, i, taxi.to[n], taxi.next[n], taxi.cost[n]);
		}
	}
}

void SearchMinCost()
{
	for (int i = 1; i < N; i++){
		d[i] = INF;
	}
	
	while (true){
		bool update = false;
		
		for (int i = 0; i < N; i++){
			for (int e = taxi.head[i]; e != -1; e = taxi.next[e]){
				if (d[i] != INF && d[taxi.to[e]] > d[i] + taxi.cost[e]){
					d[taxi.to[e]] = d[i] + taxi.cost[e];
					update = true;
				}
			}
		}
		
		if (!update) break;
	}
}

int main()
{
	memset(road.head, -1, sizeof(road.head));
	memset(taxi.head, -1, sizeof(taxi.head));
	
	scanf("%d %d", &N, &K);
	
	for (int i = 0; i < N; i++){
		scanf("%d %d", &C[i], &R[i]);
	}
	
	for (int i = 0; i < K; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		a--; b--;
		
		road.next.push_back(road.head[a]);
		road.head[a] = road.next.size() - 1;
		road.to.push_back(b);
		
		road.next.push_back(road.head[b]);
		road.head[b] = road.next.size() - 1;
		road.to.push_back(a);
	}
	
	for (int i = 0; i < N; i++){
		//SearchTaxi(i, i, R[i]);
		__SearchTaxi(i);
	}
	
	SearchMinCost();
	
	printf("%d\n", d[N - 1]);
	
	return 0;
}

Measured memory_bytes: 167872
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
vector <char> v;
vector<int> num;
string s ;
int table[3][3];
int main(){
  s = "Yes";

  for (int i = 0;i < 3;i++){
    for (int j = 0; j < 3;j ++){
      cin >> table[i][j];
    }
  }
  for (int i = 1;i < 3;i ++){
    if(!(((table[i][0]-table[i-1][0])==(table[i][2]-table[i-1][2]))&&((table[i][2]-table[i-1][2])==(table[i][1]-table[i-1][1])))){
      s = "No";
    }

  }


  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <cmath>
#include <vector>
#include <set>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cstring>
#include <map>
using namespace std;


map<string, int> mp;

int main()
{
	int n;
	cin >> n;
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		sort(s.begin(), s.end());
		mp[s]++;
	}
	for (auto it = mp.begin(); it != mp.end(); it++) {
		ans += 1LL * (it->second)*((it->second) - 1) / 2;
	}
	cout << ans;

}

Measured memory_bytes: 11136