akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;


int main(int argc, char const *argv[]) {
    int n;cin>>n;
    vector<long long> a(n);
    for(int i=0;i<n;++i)cin>>a[i];
    long long res = 0;
    long long re = 0;
    for(int i=0;i<n;++i){
        // res += a[i]/2;
        // a[i] = a[i]%2;
        res += (a[i]+re)/2;
        re = (a[i]+re)%2;
        if(a[i]==0)re=0;
    }
    // for(int i=0;i<n-1;++i){
    //     if(a[i]==1&&a[i+1]==1){
    //         res++;
    //         a[i]=0;
    //         a[i+1]=0;
    //     }
    // }
    cout<<res<<endl;
    return 0;
}

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

using namespace std;

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

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

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

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;

int main() {
	cin >> n;
	vector<ll> vi;
	rep(i, n) {
		ll num;
		cin >> num;
		vi.push_back(num);
	}
	sort(ALL(vi));
	ll w = 1;
	ll ans = 1;
	ll sum = 0;
	rep(i, n - 1) {
		if (vi[i + 1] <= (sum + vi[i]) * 2)w++;
		else w = 1;
		sum += vi[i];
		ans = w;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

using namespace std;

#define FOR(a,b) for(int a=0;a<b;a++)
#define F0R(a,b,c) for(int a = b; a<=c; a++)
#define f first
#define s second
#define m0(x) memset(x,0,sizeof(x))

typedef pair<int,int> pi;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef long double ld;

struct decm{
    ll num = 0;
    int digits = 0;
    int n2 = 0;
    int n5 = 0;
};

const int add = 102;

ll pre[205][205];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    m0(pre);
    int n; cin >> n;
    vector<decm> nums(n);
    FOR(i,n){
        string given; cin >> given;
        decm cur;
        bool p = 0;
        int waiting = 0;
        for(auto &a: given){
            if(a == '.') p = 1;
            else{
                if(!p){
                    cur.num *= 10LL;
                    cur.num += a-'0';
                }else if(a == '0') waiting++;
                else{
                    cur.digits += waiting + 1;
                    FOR(r,waiting+1) cur.num *= 10LL;
                    waiting = 0;
                    cur.num += a-'0';
                }
            }
        }
        cur.n2 = cur.digits;
        cur.n5 = cur.digits;
        ll a2 = cur.num;
        while((a2&1LL) == 0){
            cur.n2--; a2 /= 2LL;
        }
        while(a2%5LL == 0){
            cur.n5--;
            a2 /= 5LL;
        }
//        cerr << cur.num << " " << cur.n2 << " " << cur.n5 << "\n";
        nums[i] = cur;
        pre[cur.n2+add][cur.n5+add]++;
    }
    F0R(i,1,204) F0R(j,1,204) pre[i][j] += pre[i-1][j]+pre[i][j-1]-pre[i-1][j-1];
    ll ans = 0;
    FOR(i,n){
        ans += pre[-nums[i].n2+add][-nums[i].n5+add];
        if(nums[i].n2 <= 0 && nums[i].n5 <= 0) ans--;
    }
    ans /= 2;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 8196
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;

int main() {
	long long int sum = 0, hi;
	int n, k;
	vector<long long int> h;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> hi;
		h.push_back(hi);
	}
	sort(h.begin(), h.end(),greater<long long int>());
	for (int i = k ; i < n; i++) {
		sum += h[i];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 100000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
   int n;
   cin>>n;
   vector<pair<int,int>>p(n);
   for(int i=0;i<n;i++){
      cin>>p[i].second>>p[i].first;
   }
   sort(p.begin(),p.end());
   ll now=0;
   bool ok=true;
   for(int i=0;i<n;i++){
      now+=p[i].second;
      if(now>p[i].first){
         ok=false;
      }
   }
   if(ok){
      cout<<"Yes"<<endl;
   }else{
      cout<<"No"<<endl;
   }
   return 0;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main() {
	string a;
	int ans = 0;
	cin >> a;
	if (a[0]=='S'&&a[1]=='U'&&a[2]=='N') {
		cout << 7;
	}
	if (a[0] == 'S' && a[1] == 'A'&&a[2]=='T') {
		cout << 1;
	}
	if (a[0] == 'M') {
		cout << 6;
	}
	if (a[0] == 'T' && a[1] == 'U') {
		 cout << 5;
	 }
	if (a[0] == 'W') {
		cout << 4;
	}
	if (a[0] == 'T' && a[1] == 'H') {
		cout << 3;
	}
	if (a[0] == 'F') {
		cout << 2;
	}
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline


n = int(input())
C = list(map(int,input().split()))

# ci = [set() for _ in range(n)]
# for i,c in enumerate(C):
#     ci[c-1].add(i)

path = [set() for _ in range(n)]

for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    path[a].add(b)
    path[b].add(a)

ans = [n*(n+1)//2]*n
cparent = [[] for _ in range(n)]
root_size = [n]*n
# index:color
reached = [False]*n
size = [0]*n
# index:vertex

def dfs(p):
    c = C[p] - 1
    cparent[c].append(p)
    s = 1
    for nxt in path[p]:
        if reached[nxt]:continue
        reached[nxt] = True
        size[p] = 0
        ret = dfs(nxt)
        s += ret
        size[p] += ret
        ans[c] -= size[p] * (size[p] + 1)//2
    cparent[c].pop()
    # size[p] += s
    if cparent[c]:
        size[cparent[c][-1]] -= s
    else:
        root_size[c] -= s
    # ans[c] -= size[p] * (size[p] - 1)//2
    return s

reached = [False]*n
reached[0] = True

dfs(0)
for i in range(n):
    print(ans[i] - root_size[i]*(root_size[i]+1)//2)


Measured memory_bytes: 291536
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<set>
#include<vector>
using namespace std;
#define PI acos(-1.0)
#define EPS 1e-8
#define LL long long
#define ULL unsigned long long     //1844674407370955161
#define INT_INF 0x7f7f7f7f      //2139062143
#define LL_INF 0x7f7f7f7f7f7f7f7f //9187201950435737471
// ios::sync_with_stdio(false);
// 那么cin, 就不能跟C的 scanf，sscanf, getchar, fgets之类的一起使用了。
const int dr[]= {0, 0, -1, 1, -1, -1, 1, 1};
const int dc[]= {-1, 1, 0, 0, -1, 1, -1, 1};
const LL MOD=1e9+7;
int main()
{
    LL n,m;
    cin>>n>>m;
    if(labs(n-m)>1){
        cout<<0<<endl;
        return 0;
    }
    LL sum=1;
    for(LL i=1;i<=n||i<=m;++i)
    {
        if(i<=n)
            sum=sum*i%MOD;
        if(i<=m)
            sum=sum*i%MOD;
    }
    if(n-m==0)
        sum=(sum+sum)%MOD;
    printf("%lld\n",sum);
    return 0;
}


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

using namespace std;

int main()
{
    int N, M, C;
    cin >> N >> M >> C;
    vector<int> B(M);
    int count = 0;
    for(int i = 0; i < M; i++)
    {
        cin >> B[i];
    }
    int A[N][M];
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < M; j++)
        {
            cin >> A[i][j];
        }
    }
    for(int i = 0; i < N; i++)
    {
        int temp = 0;
        for(int j = 0; j < M; j++)
        {
            temp += A[i][j] * B[j];
        }
        if(temp + C > 0)
        {
            count++;
        }
    }
    cout << count;

    return 0;
}


Measured memory_bytes: 256
from sys import stdin
n,m=map(int,input().split())
l = [list(map(int, stdin.readline().split())) for _ in range(m)]
s,e=[],[]
for i in l:
    if i[0]==1:
        s.append(i[1])
    if i[1]==n:
        e.append(i[0])
result = list(set(s) & set(e))
print('POSSIBLE' if result else 'IMPOSSIBLE')

Measured memory_bytes: 54676
#include<iostream>
#include<cstdio>

using namespace std;
#define MAX_M 100
#define MAX_N 100

int dx[4] = {-1,1,0,0};
int dy[4] = {0,0,-1,1};
int N,M;
char field[MAX_N][MAX_M+1];

void dfs(int x,int y){
  field[x][y] = '0' ;

  for(int i = 0 ; i < 4 ; i ++){
    for(int j = 0 ; j < 4 ; j ++){
      int nx = x + dx[i] ; int ny = y + dy[i];
      if(0<=nx && nx < N &&
	 0<=ny && ny < M &&
	 field[nx][ny]=='1')
	dfs(nx,ny);
    }
  }
  return ;  
}

void solve(){
  int res = 0;
  for(int i = 0 ; i < N ; i ++){
    for(int j = 0 ; j < M ; j ++){
      if(field[i][j] == '1'){
	dfs(i,j);
	res ++;
      }
    }
  }
  printf("%d\n",res);
}

int main(void){
  N = 12 ; M = 12;
  while(cin>>field[0][0]){
    for(int i = 1 ; i < M ; i ++)
      cin>>field[0][i];
    for(int i = 1 ; i < N ; i ++){
      for(int j = 0 ; j < M ; j ++){
	cin>>field[i][j];
      }
    }
    solve();
  }
}

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

ll powll(ll a,ll n){
  if(n==0)
  {
    return 1;
  }
  return powll(a,n-1)*a;
}

ll p[500000];
int main() {
   ll i,j,k;
    ll n,ans=0,min=0;
    cin >> n;
    for(i=0; i<n; i++)
    {
      cin>>p[i];
    }

ans=1;
min=p[0];
for(i=1; i<n; i++)
{
  if(p[i]>min)
  {
  
  }else
  {
    ans+=1;
    min=p[i];
  }
}
  cout << ans << endl;
}


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

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

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

int a, b;
int main() {
    cin >> a >> b;
    if (b % a == 0)
        cout << a + b << endl;
    else
        cout << b - a << endl;
    return 0;
}


Measured memory_bytes: 3520
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
const int MOD = 1e9+7;
const int MOOD = 998244353;
#define PI 3.14159265359
typedef long long ll;
using namespace std;

int main(){
	ll n;
	cin >> n;
	string ans;
	ll sum = 0;
	int len;
	for (int i = 1; i <= 12; i++){
		if (sum + pow(26, i) >= n){
			len = i;
			break;
		}
		sum += pow(26, i);
	}
	ll temp = n - sum;
	for (int i = len-1; i >= 0; i--){
		for (int j = 25; j >= 0; j--){
			if (temp > j*pow(26, i)){
				temp -= j*pow(26, i);
				ans += j + 'a';
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 4076
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<map>
#include<math.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    int a;
    cin >> a;
    cout << 3 * a * a << endl;
    return 0;
} /*atcoder*/


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <climits>
#include <math.h>
#include <memory.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, M;
int cnt = 0;
int ans = 0;
int i_index;
int tmp;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};
string board[64];
int main(){
    int A, B;
    int a[200010] = {0};
    int b[200010] = {0};
    map<int, int> mpa, mpb;//D, T
    cin >> A;
    rep(i, A) cin >> a[i];
    cin >> B;
    rep(i, B) cin >> b[i];
    rep(i, A) mpa[a[i]]++;
    rep(i, B) mpb[b[i]]++;
    rep(i, B){
        int x = b[i];
        if(mpb[x] > mpa[x]){//T > D
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 20608
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	args := strings.Split(stdin.Text(), " ")

	N, _ := strconv.Atoi(args[0])
	X, _ := strconv.Atoi(args[1])
	T, _ := strconv.Atoi(args[2])

	count := 1
	for i := 1; ; i++ {
		if N <= X*i {
			break
		} else {
			count += 1
		}
	}

	fmt.Println(count * T)
}


Measured memory_bytes: 1776
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

const int mod = 1000000007;



int main() {

   mp::cpp_int a, b;
    cin >>a>>b;

    cout << a + b << endl;
}




Measured memory_bytes: 3400
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var n = sc.next();
		sc.close();

		var sum = 0;
		for (var i = 0; i < n.length(); i++) {
			sum += Integer.parseInt(n.substring(i, i + 1));
		}

		var result = sum % 9 == 0 ? "Yes" : "No";
		System.out.println(result);
	}
}


Measured memory_bytes: 49860
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	string s;
	cin>>s;
	if(s=="Sunny"){
		cout << "Cloudy";
	}
	else if(s=="Cloudy"){
		cout << "Rainy";
	}
	else{
		cout << "Sunny";
	}
	// your code goes hereSunny)、くもり(Cloudy)、雨(Rainy)、
	return 0;
}

Measured memory_bytes: 256
//list index out of range エラー表示用
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep1(i, n) for (int i = 0; i < (int)(n); i++)


int main(){
  int X,N;
  int p;
  cin >> X >> N;
  vector<int> P(N);
  int find_X(int, vector<int>);
  rep1(i, N){
    cin >> p;
    P[i] = p;
  }
  

  cout << find_X(X, P);

  
}

int find_X(int x, vector<int> P){
  int tem1, tem2;
  bool flag;
  int vector_finder(vector<int>, int);

  rep1(i, 100){
    tem1 = x-i;
    tem2 = x+i;

    flag = vector_finder(P, tem1);

    if (!flag){
      return tem1;
    }
    flag = vector_finder(P, tem2);

    if (!flag){
      return tem2;
    }
  }
}

int vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

Measured memory_bytes: 3676
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>
#include<utility>

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define P pair<int, int>
#define PLI pair<ll, int>

using namespace std;

typedef long long ll;


const int INF = 1e9;

int N, M;
int sum[20][100005] = {};
int main() {
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp; tmp--;
		sum[tmp][i + 1] = 1;
	}

	for (int i = 0; i < M; i++) {
		for (int j = 0; j < N; j++) {
			sum[i][j + 1] += sum[i][j];
		}
	}

	vector<int> dp(1 << M, -INF);
	dp[0] = 0;
	for (int i = 0; i < (1 << M); i++) {
		int l = 0;
		for (int j = 0; j < M; j++) {
			if (i & (1 << j)) l += sum[j][N];
		}
		for (int j = 0; j < M; j++) {
			if (i & (1 << j)) continue;
			int add = sum[j][l + sum[j][N]] - sum[j][l];
			dp[i | (1 << j)] = max(dp[i | (1 << j)], dp[i] + add);
		}
	}

	cout << N - dp[(1 << M) - 1] << endl;

	return 0;
}



Measured memory_bytes: 14704
#include<stdio.h>
int main()
{
    int x1,x2,y1,y2,x,y,i;
    scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
    x=x2-x1;
    y=y2-y1;

    for(i=0;i<y;i++)
    {
        printf("U");
    }
    for(i=0;i<x;i++)
    {
        printf("R");
    }
    for(i=0;i<y;i++)
    {
        printf("D");
    }
    for(i=0;i<=x;i++)
    {
        printf("L");
    }
    for(i=0;i<=y;i++)
    {
        printf("U");
    }
    for(i=0;i<=x;i++)
    {
        printf("R");
    }
    printf("D");printf("R");
    for(i=0;i<=y;i++)
    {
        printf("D");
    }
    for(i=0;i<=x;i++)
    {
        printf("L");
    }
    printf("U");

    return 0;

}


Measured memory_bytes: 128
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------


int n,ai,x,y;
int kind[16][16];

signed main(){
    I(n);
    REP(i,n) REP(j,n) kind[i][j] = -1;
    REP(i,n){
        I(ai);
        REP(j,ai){
            I(x); I(y);
            x--;
            kind[i][x] = y;
        }
    }
    int ret = 0;
    FOR(i,1,1<<n){
        bool flag = true;
        bitset<16> mask(i);
        REP(j,n){
            if(!mask[j]) continue;
            REP(k,n){
                if (kind[j][k] == -1) continue;
                flag &= kind[j][k] == mask[k];
            }
        }
        ret = max(ret, (int)(flag) * __builtin_popcount(i));
    }
    cout << ret << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int h,n,sum;
	cin>>h>>n;
	
	sum=0;
	for(int i=0;i<n;i++)
	{
		int a;
		cin>>a;
		sum+=a;
		if(sum>=h)
		{
			cout<<"Yes"<<endl;
			return 0;
				
		}
	}
	cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    int64_t N, M;
    map<int64_t, int64_t>m;
    map<int64_t, int64_t>goodm;
    cin >> N >> M;
    for (int i =1; i <= N; i++) {
        int64_t H;
        cin >> H;
        m[i] = H;
        goodm[i] = 1;
    }

    for (int j=0; j < M; j++) {
        int64_t A, B;
        cin >> A >> B;
        if (m[A] > m[B]) {
            goodm[B] = 0;
        } else if (m[B] > m[A]) {
            goodm[A] = 0;
        } else if (m[B] == m[A]) {
            goodm[A] = 0;
            goodm[B] = 0;
        }
    }

    int64_t sum = 0;
    for (int i=1; i <= N; i++) {
        sum += goodm[i];
    }

    cout << sum << endl;
    return 0;
}

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

template <typename T,typename E>
struct SegmentTree{
  typedef function<T(T,T)> F;
  typedef function<T(T,E)> G;
  typedef function<T(E,E)> H;
  typedef function<E(E,Int)> P;
  Int n;
  F f;
  G g;
  H h;
  T d1;
  E d0;
  P p;
  vector<T> dat;
  vector<E> laz;
  SegmentTree(){};
  SegmentTree(Int n_,F f,G g,H h,T d1,E d0,
	      vector<T> v=vector<T>(),P p=[](E a,Int b){++b;return a;}):
    f(f),g(g),h(h),d1(d1),d0(d0),p(p){
    init(n_);
    if(n_==(Int)v.size()) build(n_,v);
  }
  void init(Int n_){
    n=1;
    while(n<n_) n*=2;
    dat.clear();
    dat.resize(2*n-1,d1);
    laz.clear();
    laz.resize(2*n-1,d0);
  }
  void build(Int n_, vector<T> v){
    for(Int i=0;i<n_;i++) dat[i+n-1]=v[i];
    for(Int i=n-2;i>=0;i--)
      dat[i]=f(dat[i*2+1],dat[i*2+2]);
  }
  void update(Int a,Int b,E x,Int k,Int l,Int r){
    if(r<=a||b<=l) return;
    if(a<=l&&r<=b){
      laz[k]=h(laz[k],x);
      return;
    }
    update(a,b,x,k*2+1,l,(l+r)/2);
    update(a,b,x,k*2+2,(l+r)/2,r);
    dat[k]=f(g(dat[k*2+1],p(laz[k*2+1],(r-l)>>1)),
	     g(dat[k*2+2],p(laz[k*2+2],(r-l)>>1)));
  }
  void update(Int a,Int b,E x){
    update(a,b,x,0,0,n);
  }
  T query(Int a,Int b,Int k,Int l,Int r){
    if(r<=a||b<=l) return d1;
    if(a<=l&&r<=b) return g(dat[k],p(laz[k],r-l));
    T vl=query(a,b,k*2+1,l,(l+r)/2);
    T vr=query(a,b,k*2+2,(l+r)/2,r);
    return g(f(vl,vr),p(laz[k],min(r,b)-max(l,a)));
  }
  T query(Int a,Int b){
    return query(a,b,0,0,n);
  }
};

//INSERT ABOVE HERE
signed main(){
  Int n,q;
  cin>>n>>q;
  SegmentTree<Int, Int>::F f=[](Int a,Int b){return min(a,b);};
  SegmentTree<Int, Int>::G g=[](Int a,Int b){return a+b;};
  const Int INF = 1e15;
  vector<Int> v(n,0);
  SegmentTree<Int, Int> seg(n,f,g,g,INF,0,v);
  for(Int i=0;i<q;i++){
    Int a,s,t,x;
    cin>>a>>s>>t;
    t++;
    if(a) cout<<seg.query(s,t)<<endl;
    if(!a){
      cin>>x;
      seg.update(s,t,x);
    }
  }
  return 0;
}



Measured memory_bytes: 9216
# 0-indexedで、getは半開区間であることに注意
class SegmentTree

  @@inf = (1 << 60) - 1

  # O(n)
  def initialize(n, form)
    case form
    when "and"
      @identity_element = (1 << 60) - 1
      @func = Proc.new{|x, y| x & y }
    when "gcd"
      @identity_element = 0
      @func = Proc.new{|x, y| x.gcd y }
    when "lcm"
      @identity_element = 1
      @func = Proc.new{|x, y| x.lcm y }
    when "max"
      @identity_element = -@@inf
      @func = Proc.new{|x, y| x > y ? x : y }
    when "min"
      @identity_element =  @@inf
      @func = Proc.new{|x, y| x < y ? x : y }
    when "or"
      @identity_element = 0
      @func = Proc.new{|x, y| x | y}
    when "prod"
      @identity_element = 1
      @func = Proc.new{|x, y| x * y}
    when "sum"
      @identity_element = 1
      @func = Proc.new{|x, y| x + y}
    end

    # @identity_element = identity_element
    @n = 1
    @n *= 2 while @n < n
    # @n: leaf node size(2^k)
    # @n*2-1: tree node size
    @n_1 = @n - 1
    @nodes = Array.new(@n*2-1){ @identity_element }
  end

  def update(i, val)
    # @n-1: inner node size
    i += @n_1
    @nodes[i] = val
    while i > 0
      i = ( i - 1 ) / 2
      @nodes[i] = @func.call(@nodes[2*i+1], @nodes[2*i+2])
    end
    true
  end

  def swap(i, j)
    # @n-1: inner node size
    n_i = @nodes[i + @n_1].dup
    n_j = @nodes[j + @n_1].dup
    update(i, n_j)
    update(j, n_i)
  end

  def get(l, r)
    l += @n_1
    r += @n_1
    lres, rres = @identity_element, @identity_element
    while l < r
      if l[0] == 0
        lres = @func.call(lres, @nodes[l])
        l += 1
      end
      if r[0] == 0
        r -= 1
        rres = @func.call(rres, @nodes[r])
      end
      l /= 2
      r /= 2
    end
    return @func.call(lres, rres)
  end

  def all_update
    @n_1.downto(1){ |i| @nodes[i-1] = @func.call(@nodes[2*i-1], @nodes[2*i]) }
  end

  def [](k)
    @nodes[@n_1 + k]
  end

  def []=(i, val)
    @nodes[@n_1 + i] = val
  end

  def inf=(x)
    @@inf = x
  end

  def inf()
    @@inf
  end

  def inspect

    t = 0
    res = "SegmentTree\n  "
    @nodes.each_with_index do |e,i|

      res << e.to_s << " "
      if t == i && i < @n_1
        res << "\n  "
        t = t * 2 + 2
      end
    end
    res
  end
end

class Array
  def to_st(form)
    st = SegmentTree.new(size, form)
    each_with_index{ |t, i| st[i] = t }
    st.all_update
    st
  end
end

n = gets.to_s.to_i
s = gets.to_s.chomp
q = gets.to_s.to_i

# p "a".ord #=> 97
st = s.bytes.map{|c| 1 << (c-97) }.to_st("or")

q.times do
 
  t, x, y = gets.to_s.split
 
  if t == "1"
    i, c = x.to_i-1, y[0].ord
    st.update(i, 1 << (c-97))
  else
    l, r = x.to_i-1, y.to_i-1
    puts st.get(l, r+1).to_s(2).count('1')
  end
end

Measured memory_bytes: 18988
import sys
import bisect
input = sys.stdin.readline
 
N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        index = bisect.bisect_left(L, L[i] + L[j])
        n = index - j - 1
        ans += n
 
print(ans)

Measured memory_bytes: 42988
#include <bits/stdc++.h>
#define rg register
#define LL long long 

using namespace std;

const int N=1000010;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
char s[N];
int n,a[N],sum;
int main()
{
	scanf("%s",s);
	n=strlen(s);
	for(rg int i=1;i<=n;i++)
		a[i]=(s[n-i]-'0')*9;
	for(rg int i=1;i<=n;i++){
		a[i+1]+=a[i]/10;a[i]%=10;
	}
	if(a[n+1])++n;
	for(rg int i=1;i<=n;i++)
		sum+=a[i];
	for(rg int i=1;i<=10*n;i++){
		sum+=9;a[1]+=9;
		int j=1;
		while(j<=n){
			if(a[j]<10)break;
			a[j]-=10;sum-=10;
			++sum;++a[j+1];++j;
			if(j==n&&a[n+1])++n;
		}
		if(sum<=i*9){
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}

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

from itertools import chain

if __name__ == '__main__':

    H, W = map(int, input().split())
    C = []
    hist = []
    for i in range(H):
        l = input().split()
        C.append([int(x) for x in l])
        hist.append([(int(x) + 1) % 2 for x in l])

    for i in range(1, H):
        for j in range(W):
            if C[i][j] == 0:
                hist[i][j] = hist[i - 1][j] + 1
    
    S = []
    max_area = 0
    for i in range(H):
        for j in range(W):
            rect = [j, hist[i][j]]
            if not S:
                S.append(rect)
            elif S[-1][1] < rect[1]:
                S.append(rect)
            elif S[-1][1] > rect[1]:
                while S and S[-1][1] > rect[1]:
                    post_rect = S.pop()
                    area = post_rect[1] * (j - post_rect[0])
                    max_area = max(max_area, area)
                S.append([post_rect[0], rect[1]])
        while S:
            post_rect = S.pop()
            area = post_rect[1] * (W - post_rect[0])
            max_area = max(max_area, area)

    print(max_area)







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

class Info{
  public:
    Info(int a, int b){
      num = a;
      score = b;
    }

    //コピーコンストラクタ
    Info(const Info &source){
      num = source.num;
      score = source.score;
    }

    //アクセサ
    int getNum(){return this->num;}
    int getScore(){return this->score;}
    int num;
    int score;
};


int main(){
  int N, count;
  cin >> N;
  vector<Info> infos;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    infos.push_back(Info(a, b));
  }

  //num昇順ソート
  sort(infos.begin(), infos.end(), [](const Info &a, const Info &b){
      if(a.num > b.num){
        return false;
      }else{
      return true;
      }
      });

  count = infos[0].num - 1;
  count += infos.back().num - infos[0].num + 1;
  count += infos.back().score;

//  for (int i = 0; i < N; i++) {
//    cout << i << " " << infos[i].getNum() << " " << infos[i].getScore() << endl;
//  }
  cout<< count << endl;
  return 0;
}


Measured memory_bytes: 1400
A, A2, A3 = [list(map(int,input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
A.extend(A2)
A.extend(A3)

for i in B:
    for j in range(len(A)):
        if i == A[j]:
            A[j] = 0
if A[0]+A[1]+A[2] == 0 or A[3]+A[4]+A[5] == 0 or A[6]+A[7]+A[8] == 0 or A[0]+A[3]+A[6] == 0 or A[1]+A[4]+A[7] == 0 or A[2]+A[5]+A[8] == 0 or A[0]+A[4]+A[8] == 0 or A[2]+A[4]+A[6] == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
H, W, N = map(int, input().split())
sh, sw = map(int, input().split())
TS = input()
AS = input()

TS, AS = TS[::-1], AS[::-1]


def calc(length, start, target_chars):
    alive_section = [1, length]

    # [区間のどちらに作用するか, どのように作用するか]
    TX = {'L': [0, 1], 'R': [1, -1], 'U': [0, 1], 'D': [1, -1]}
    AX = {'L': [1, 1], 'R': [0, -1], 'U': [1, 1], 'D': [0, -1]}

    # 最後の青木くんのターンから
    for i in range(N):
        if AS[i] in target_chars:
            j, d = AX[AS[i]]
            alive_section[j] += d

            # 盤外にまで広げることはできない
            alive_section[0] = max(1, alive_section[0])
            alive_section[1] = min(length, alive_section[1])

        if TS[i] in target_chars:
            j, d = TX[TS[i]]
            alive_section[j] += d

        cross_check(alive_section)

    if not (alive_section[0] <= start <= alive_section[1]):
        print('NO')
        exit()


def cross_check(alive_section):
    if alive_section[0] > alive_section[1]:
        print('NO')
        exit()


calc(H, sh, ['U', 'D'])
calc(W, sw, ['L', 'R'])

print('YES')


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

int main() {
  string s;
  cin >> s;
  
  if(s == "Sunny") cout << "Cloudy" << endl;
  else if(s == "Cloudy") cout << "Rainy" << endl;
  else if(s == "Rainy") cout << "Sunny" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include<string>
#include <algorithm>


using namespace std;
int main(void){

    long N;
    cin>>N;
    int i=1;
    
    while(N>=i*i)
    {       
        i++;
    }
    cout<<(i-1)*(i-1)<<endl;
    
    return 0;
}

Measured memory_bytes: 256
n = list(map(int,input().split()))
m = list(map(int,input().split()))
l = [0,0]
for i,j in enumerate(m):
    if i == 0:
        l[0] = i
        l[1] = j-0+n[0]-m[n[1]-1]
    else:
        if l[1] < m[i]-m[i-1]:
            l[0] = i
            l[1] = m[i]-m[i-1]
print(n[0]-l[1])


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

int hi(int i) {
  if (i == 1) return 1;
  return hi(i-1) + i;
}

int main() {
  int a, b; cin >> a >> b;
  p(hi(b-a)-b);
}


Measured memory_bytes: 256
# coding: utf-8

def returnInt(x):
    return int(x[-1])

def bubbleSort(A, N):
    flag = 1
    while flag:
        flag = 0
        for i in range(N - 1, 0, -1):
            if returnInt(A[i]) < returnInt(A[i - 1]):
                A[i], A[i - 1] = A[i - 1], A[i]
                flag = 1
    print(' '.join(A))
    return A

def selectionSort(A, N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if returnInt(A[j]) < returnInt(A[minj]):
                minj = j
        A[i], A[minj] = A[minj], A[i]
    print(' '.join(A))
    return A

if __name__ == "__main__":
    N = int(input())
    A = input().split()
    B = [i for i in A]

    A_bubble = bubbleSort(A, N)
    print('Stable')
    A_selection = selectionSort(B, N)
    if A_bubble == A_selection:
        print('Stable')
    else:
        print('Not stable')


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

//使い方がよくわからない
#include<stack>
#include<queue>
#include<bitset>
#include<sstream>

using namespace std;


int main(int argc, const char *argv[]){
    string s;
    cin >> s;
    bool d = false;
    bool k = false;
    int cnt = 1;
    for(int i=1;i<s.size();i++){
        if(d){
            cnt++;
            d = false;
        }else{
            if(s[i]==s[i-1]){
                if(i==(s.size()-1)) break;
                d = true;
                i++;
                cnt++;
            }else cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define MOD 1000000007

int main() {
	int n; 
	cin >> n;
	vll seq(n);
	for (int i = 0; i < n; ++i) 
		cin >> seq[i];
	vector<vll> dp(n, vll(n, 0));
	for (int i = 0; i < n; ++i) 
		dp[i][i] = seq[i];
	for (int interval = 1; interval < n; ++interval) {
		for (int i = 0; i < n-interval; ++i) {
			int j = i+interval;
			dp[i][j] = max ( seq[i] - dp[i+1][j],
											 seq[j] - dp[i][j-1]);
		}
	}
	cout << dp[0][n-1];
	return 0;
}

Measured memory_bytes: 73744
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
int main(int argc, char *argv[])
{
  int r, g, b;

  cin >> r >> g >> b;

  if((100*r+g*10+b)%4 == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, h, m float64
	fmt.Scan(&a, &b, &h, &m)
	a2 := math.Pow(a, 2)
	b2 := math.Pow(b, 2)
	rad := h*30 - 11*m/2
	c := 2 * a * b * math.Cos(rad*math.Pi/180)
	fmt.Printf("%.10f\n", math.Sqrt(a2+b2-c))
}


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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
using pii = pair<int, int>;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

// Math
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

signed main(){
    int N, M;
    map<string, int> bs, rs;
    cin >> N;
    rep(i, N) {
        string s;
        cin >> s;
        ++bs[s];
    }
    cin >> M;
    rep(i, M) {
        string s;
        cin >> s;
        ++rs[s];
    }
    int ans = 0;
    for(auto& b : bs) {
        ans = max(b.second - rs[b.first], ans);
    }
    cout << ans << nl;
}


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

typedef long long ll;

ll trans(string a)
{
	ll res = 0;
	stringstream ss(a);
	ss >> hex >> res;

	return res;
}

int main()
{
	int N;
	cin >> N;
	while(N--) {

		ll p = 0;
		ll chunks[9];
		for(int i=0; i<9; i++) {
			string a;
			cin >> a;
			chunks[i] = trans(a);
		}

		ll res = 0, sum = 0;
		for(int i=0; i<32; i++) {
			ll k = 0;
			for(int j=0; j<9; j++) {
				k ^= (chunks[j] >> i) & 1;
			}
			
			k ^= (sum >> i) & 1;
			res |= k << i;

			for(int j=0; j<8; j++) {
				sum += (((chunks[j] >> i) & 1) ^ k ) << i;
			}
			
		}

		cout << hex << res << endl;
	}
}

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int turn = 0;
    int A, B, C, D; cin >> A >> B >> C >> D;
    while(true){
        if(turn == 1){
            A -= D;
            if(A <= 0){
                cout << "No" << endl;
                return 0;
            }
        }
        else{
            C -= B;
            if(C <= 0){
                cout << "Yes" << endl;
                return 0;
            }
        }
        turn = !turn;
    }
    return 0;
}

Measured memory_bytes: 3648
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import qualified Data.Map.Strict as MPS
import Control.Monad
import Data.Char
import Data.Tuple

buildGraph :: VU.Vector (Int, Int) -> Int -> MPS.Map Int [Int]
buildGraph edges n = VU.foldl' step MPS.empty $ (VU.map swap edges) VU.++ edges
  where
    step mp (a,b) = MPS.insertWith (++) a [b] mp

toTuple :: B.ByteString -> (Int, Int)
toTuple bs =
    let
      Just (a,bs') = B.readInt bs 
      Just (b,_) = B.readInt $ B.dropWhile isSpace bs'
    in (a,b)

dfs :: MPS.Map Int [Int] -> VUM.IOVector Int -> Int -> Int -> IO ()
dfs graph table v p = 
    case MPS.lookup v graph of
      Nothing -> return ()
      Just ns ->
        VUM.read table v >>= \r -> 
          forM_ ns $ \n -> 
            unless (n==p) $
              VUM.modify table (+r) n >> 
                dfs graph table n v

main = do
  [n,q] <- map read . words <$> getLine :: IO [Int]
  table <- VUM.replicate n 0 :: IO (VUM.IOVector Int)
  graph <- flip buildGraph n <$> (VU.replicateM (n-1) $ B.getLine >>= return . (\(a,b) -> (a-1,b-1)) . toTuple)
  query <- replicateM_ q $ do
    (v,n) <- B.getLine >>= return . (\(a,b) -> (a-1,b)) . toTuple
    VUM.modify table (+n) v
  dfs graph table 0 (-1)
  table' <- VU.unsafeFreeze table
  VU.forM_ table' $ \x -> putStr $ show x ++ " "
  putStrLn ""

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

using namespace std;

#define int long long
#define MP make_pair
#define F first
#define S second
#define pi pair<int,int> 
#define sz(s) ((int)s.size())
#define rep(i,a,b) for (int i = a; i < b; ++i)

const unsigned mod = 1e9 + 7;
const unsigned N = 1e5 + 4;

int A[N], B[N], C[N];

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

  int x, y, a, b, c;

  cin >> x >> y >> a >> b >> c;

  rep(i,0,a) cin >> A[i];
  rep(i,0,b) cin >> B[i];
  rep(i,0,c) cin >> C[i];

  sort(A, A+a, greater<int>());
  sort(B, B+b, greater<int>());
  sort(C, C+c, greater<int>());
  vector<int> ans(C, C+c);
  rep(i,0,x) ans.push_back(A[i]);
  rep(i,0,y) ans.push_back(B[i]);

  int z = 0;

  sort(ans.begin(), ans.end(), greater<int>());
  int now(0);
  rep(i,0,x+y) now += ans[i];

  cout << now << '\n';
  

  return 0;
}

Measured memory_bytes: 6896
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; ++i)
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int ans = 0;
    ans += N*(N-1)/2; //Nから２つ選ぶ組み合わせの数
    ans += M*(M-1)/2; //Mから　〃
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    vi a,b,v;
    rep(i,N){
        int m; cin >> m;
        if(m>0) a.eb(m);
        else b.eb(m); 
    }

    sort(all(a));
    sort(all(b));
    if(a.size()==0){
        a.eb(b[b.size()-1]);
        b.erase(b.end()-1);
    }
    else if(b.size()==0){
        b.eb(a[0]);
        a.erase(a.begin());
    }

    rep(i,a.size()-1){
        v.eb(b[0]);
        v.eb(a[i]);
        b[0]-=a[i];
    }
    rep(i,b.size()){
        v.eb(a[a.size()-1]);
        v.eb(b[i]);
        a[a.size()-1]-=b[i];
    }

    cout << a[a.size()-1] << endl;
    rep(i,v.size()){
        cout << v[i] << endl;
    }
}


Measured memory_bytes: 5104
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
using namespace std;

int main(void){
	int a,b,c;
	cin>>a>>b>>c;
	if((a==b&&a!=c)||(a==c&&b!=c)||(b==c&&a!=c))cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)

def dfs(i: int, t: str):
  if i == n-1: #i = n - 1に到達したら終了
    # + で区切った数字をint型に変換して足し算
    return sum(list(map(int, t.split('+'))))

  # 文字列で次の数字をそのまま連結するパターンと、+で区切るパターン
  return dfs(i+1, t+s[i+1]) + dfs(i+1, t + '+' + s[i+1])

# 初期値でsの一文字目を入れておく
print(dfs(0, s[0]))


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

using namespace std;
const int maxn=100005;
vector<int> vec[maxn];
int n,m,u,v,dp[maxn];
bool vis[maxn];
int topo[maxn],len;

bool dfs(int cur)
{
	vis[cur]=-1;
	for(int i=0;i<vec[cur].size();i++){
		if(vis[vec[cur][i]]==-1) return false;
		if(!vis[vec[cur][i]]&&!dfs(vec[cur][i])) return false;
	}
	vis[cur]=1;
	topo[len--]=cur;
	return true;
} 

bool toposort()
{
	len=n;
	for(int i=1;i<=n;i++) if(!vis[i]) if(!dfs(i)) return false;
	return true;
}

int solve(int cur)
{
	int res=-1;
	if(vis[cur]) return dp[cur];
	vis[cur]=true;
	for(int i=0;i<vec[cur].size();i++){
		res=max(res,solve(vec[cur][i]));
	} 
	return (dp[cur]=res+1);
}

int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d %d",&u,&v);
		vec[u].push_back(v);
	}
	if(!toposort()) return printf("-1\n"),0;
	memset(vis,false,sizeof(vis));int ans=0;
	for(int i=1;i<=n;i++) if(!vis[i]) dp[i]=solve(i);
	for(int i=1;i<=n;i++) ans=max(ans,dp[i]);
	printf("%d\n",ans);
}

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

int main() {
  int N;
  cin >> N;
  long long count = 0;
  for (int A = 1; A < N; A++){
    if(N % A == 0) count += N / A - 1;
    else count += N / A;
  }
  cout << count << endl;
}


Measured memory_bytes: 3636
n,a,b,c,d=map(int,input().split())
s=[0]+list(input())
if c<d:
    for i in range(a,d):
        if s[i]==s[i+1]=="#":
            print("No")
            break
    else:
        print("Yes")
else:
    for j in range(a,c):
        if s[j]==s[j+1]=="#":
            print("No")
            break
    else:
        for k in range(b-1,d):
            if s[k]==s[k+1]==s[k+2]==".":
                    print("Yes")
                    break
        else:
            print("No")

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

int main(){
int N, middle;
  cin >> N;
middle =  N / 2;  
long long x[N];
long long y[N];  
  
  for(int i = 0;i < N;i++){
    cin >> x[i];
    y[i] = x[i];
  }
  
  sort(y, y + N);

  for(int i = 0;i < N;i++){
  if(x[i] < y[middle]) cout << y[middle] << endl;
    else cout << y[middle - 1] << endl; 
  }
    
  return 0;
  
}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}


int main(){
	int X, T;
	cin >> X >> T;
	Cout(max(X - T, 0));
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;int main(){int i,j=0,n[5];string s,l[2]={" ","*"};char x[6];while(cin>>i){if(j)cout<<endl;sprintf(x,"%05d",i);for(j=5;j-->0;)n[j]=x[j]-'0';s="";while(j++<1){for(i=0;i<5;i++)s+=l[j+(n[i]<5)&1];s+="\n";}for(j=5;j-->0;)s+="=";s+="\n";while(j++<4){for(i=0;i<5;i++)s+=l[n[i]%5!=j];s+="\n";}cout<<s;}return 0;}

Measured memory_bytes: 0
#include <stdio.h>
 
int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  int flag = 0;
  if(a > b) if(a > c && c > b) flag = 1;
  if(a < b) if(a < c && c < b) flag = 1;
  if(flag == 0) printf("No\n");
  else printf("Yes\n");
  return 0;
}

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

int main() {
	int N,sum = 0;
  	cin >> N;

  	int l[N],r[N],s[N];  
  	for (int i = 0;i < N;i++){
      cin >> l[i] >> r[i];
      sum += r[i] - l[i] + 1;
    }
  
  	cout << sum << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
 
using namespace std;

#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)

double x[8],y[8];

double d(int a,int b){
    // cout<<(x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b])<<endl;
    return sqrt((x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b]));
}

int main() {
    int n;
    double sum=0.0;
    cin>>n;
    REP(i,n)cin>>x[i]>>y[i];
    REP(i,n){
        REP(j,n){
            sum+=d(i,j);
        }
    }
    double r=1.0;
    REP(i,n)r*=(double)(i+1);

    // cout<<r<<endl;
    printf("%.10f\n",sum/(double)(n));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,x;cin >> n >> x;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	ll ans=1000000000000000000;
	vector<int> mi=a;
	rep(i,n){
		ll sum=(ll)x*i;
		rep(j,n){
			if(j-i<0) mi.at(j)=min(mi.at(j),a.at(j-i+n));
			else mi.at(j)=min(mi.at(j),a.at(j-i));
			sum+=mi.at(j);
		}
		ans=min(ans,sum);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            Console.WriteLine(A[0] + A[1] + A[2] < 22 ? "win" : "bust");
        }
    }
}


Measured memory_bytes: 13140
//OneCardPoker.cpp (A)
#include <iostream>
#include <string>
using namespace std;

int main(){
  int A,B;
  cin >> A >> B;
  if(A == 1) A = 14;
  if(B == 1) B = 14;
  if(A>B) printf("Alice\n");
  else if(A<B) printf("Bob\n");
  else printf("Draw\n");
  return 0;
}


Measured memory_bytes: 256