akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>

using namespace std;

#define MAX 10000
#define INFNY (1 << 29)

class DisjointSet{
    public:
    vector<int> rank, p;

    DisjointSet(){}
    DisjointSet(int size){
        rank.resize(size, 0);
        p.resize(size, 0);
        for(int i = 0; i < size; i++) makeSet(i);
    }

    void makeSet(int x);
    bool same(int x, int y);
    void unite(int x, int y);
    void link(int x, int y);
    int findSet(int x);
};

void DisjointSet::makeSet(int x){
    p[x] = x;
    rank[x] = 0;
}

bool DisjointSet::same(int x, int y){
    return findSet(x) == findSet(y);
}

void DisjointSet::unite(int x, int y){
    link(findSet(x), findSet(y));
}

void DisjointSet::link(int x, int y){
    if(rank[x] > rank[y]){
        p[y] = x;
    }
    else{
        p[x] = y;
        if(rank[x] == rank[y]) rank[y]++;
    }
}

int DisjointSet::findSet(int x){
    if(x != p[x]) p[x] = findSet(p[x]);
    return p[x];
}

class Edge{
    public:
    int source, target, cost;

    Edge(int source = 0, int target = 0, int cost = 0):
    source(source), target(target), cost(cost){}
    bool operator < (const Edge &e) const{
        return cost < e.cost;
    }
};

int kruskal(int N, vector<Edge> edges){
    int totalCost = 0;
    sort(edges.begin(), edges.end());
    DisjointSet dset = DisjointSet(N);

    int source, target;
    for(int i = 0; i < edges.size(); i++){
        Edge e = edges[i];
        if(!dset.same(e.source, e.target)){
            totalCost += e.cost;
            dset.unite(e.source, e.target);
        }
    }

    return totalCost;
}

int main(int argc, char const *argv[])
{
    int N, M, cost;
    int source, target;

    scanf("%d%d", &N, &M);

    vector<Edge> edges;
    for(int i = 0; i < M; i++){
        scanf("%d%d%d", &source, &target, &cost);
        edges.push_back(Edge(source, target, cost));
    }

    cout << kruskal(N, edges) << endl;

    return 0;
}



Measured memory_bytes: 5548
#include <stdio.h>

long long a[100005];

int main() {
    int n; scanf("%d", &n);
    long long mx = 1e18, ans = 1;
    for (int i = 0; i < n; i++) {
        scanf("%lld", a + i);
        if (a[i] == 0) ans = 0;
    }
    if (ans) {
        for (int i = 0; i < n; i++) {
            if (a[i] > mx) {
                ans = -1;
                break;
            }
            ans *= a[i], mx /= a[i];
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 2484
import numpy as np
n = int(input())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


soi = factorization(n)

ans = 0

for fac in soi:
    if fac[0] == 1:
        break
    num = 1
    rem = fac[1]
    while 1:
        if rem >= num:
            ans += 1
            rem -= num
            num += 1
        else:
            break

print(ans)


Measured memory_bytes: 27140
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	int n = s.l_ength();
	if( s[n-1] == 's' ){
		cout << s << "es" << endl;
	} else {
		cout << s << "s" << endl;
	}
}

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

signed main(){
    int n;cin>>n;
    int a[n][2];
    rep(i,2)rep(j,n)cin>>a[j][i];
    int ans=0;
    rep(i,n){
        int sum=0;
        rep(j,n){
            if(i>j)sum+=a[j][0];
            if(i==j)sum+=a[j][0]+a[j][1];
            if(i<j)sum+=a[j][1];
        }
        ans=max(ans,sum);
    }
    cout<<ans<<endl;
}

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

using namespace std;

void makeMatrix(int row,int line,vector<vector<long int>>& matrix)
{
  int value;
  for(int i=0;i<row;i++)
  {
    for(int j=0;j<line;j++)
    {
      cin >> value;
      matrix[i].push_back(value);
    }
  }
}

void calcMatrix(vector<vector<long int>>& a,vector<vector<long int>>& b,vector<vector<long int>>& c)
{
  long int value;
  for(int i=0;i<a.size();i++)
  {
    for(int j=0;j<b[0].size();j++)
    {
      value=0;
      for(int k=0;k<b.size();k++)
      {
        value+=a[i][k]*b[k][j];
      }
      c[i].push_back(value);
    }
  }
}

int main(int argc, char* argv[])
{
  int n,m,l;
  cin >> n >> m >> l;
  vector<vector<long int>> matrix1(n);
  vector<vector<long int>> matrix2(m);
  vector<vector<long int>> matrix3(n);
  makeMatrix(n,m,matrix1);
  makeMatrix(m,l,matrix2);
  calcMatrix(matrix1,matrix2,matrix3);
  for (int i=0;i<matrix3.size();i++)
  {
    for(int j=0;j<matrix3[i].size();j++)
    {
      cout << matrix3[i][j];
      if(j!=matrix3[i].size()-1)cout << " ";
    }
    cout << endl;
  }
}

Measured memory_bytes: 3288
S=input()
N=len(S)
ls=S
flag=1
for i in range(N):
  if ls[i]!=ls[N-1-i]:
    flag=0
M=(N-1)//2
for i in range(M):
  if ls[i]!=ls[M-1-i]:
    flag=0
if flag==0:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 3064
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
#define enl "\n"
using namespace std;
using ll=long long;
using ld=long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using vlll = vector<vector<vector<ll>>>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
ll mod = ll(1e9)+7;
ll inf = ll(1e18);
void bl(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void bl2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) {
            for (auto vvv : vv) cout << vvv << " ";
            cout << endl;
        }
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

using dbg::Debug;
Debug debug;

class ARangeProduct {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll a, b;
	    in >> a >> b;

	    if(a > 0){
            out << "Positive" << enl;
	    }else if(a <= 0 && b >= 0){
	        out << "Zero" << enl;
	    }else {
	        if((b-a)%2 == 0) out << "Negative" << enl;
	        else out << "Positive" << enl;
	    }
	}
};


int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	ARangeProduct solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main()
{
  int animal;
  int foot;
  cin >> animal >> foot;

  int max = animal * 4;
  int min = animal * 2;
  if (max < foot)
  {
  	cout << "No" <<endl;
  }else if(min > foot)
  {
    cout << "No" << endl;
  }
  else
  {
    int sa = max - foot;
	if (sa % 2 == 0)
    {
      cout <<"Yes" << endl;
    }
    else
    {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string t;
  for(int i= 0;i<19;i++){
    char s;
    cin >> s;
    if( s == ','){
      t.push_back(' ');
    }
    else{
      t.push_back(s);
    }
  }
  cout << t;
      
}

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

int main()
{
	int n,m,ans=0,a;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>a;
		ans+=a;
	}
	if(ans>n) cout<<-1<<endl;
	else cout<<n-ans<<endl;
}

Measured memory_bytes: 3644
//(UNCOMMENT WHEN SUBMITTING)
//#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
// #pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)
// #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

// clang-format off
#define range(i) for (int _ = 0; _ < i; _++)
#define vprnt(v) for (auto vi : v) cout << vi << " "; cout << endl;
#define fastio() ios::sync_with_stdio(false); cin.tie(0)
#define ll long long
#define all(x) (x).begin(), (x).end()
using namespace ::std;
int nxt() {int x;cin >> x;return x;}
ll nxtll() {ll x;cin >> x;return x;}
// clang-format on

int main() {
    fastio();
    int N = nxt();

    vector<int> A(N);
    generate(all(A), nxt);

    int last = 0;
    ll result = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] < last) {
            result += last - A[i];
            A[i] = last;
        }
        last = A[i];
    }
    cout << result << endl;

    return 0;
}


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

signed main() {
    int n;
    string s;
    cin >> n >> s;
    
    int cntR = 0, cntB = 0;
    for(int i = 0 ; i < n; i++){
        if(s[i] == 'R') cntR++;
        if(s[i] == 'B') cntB++;
    }
    if(cntR > cntB) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main()  {
	var age, cost int

	fmt.Scan(&age, &cost)

	if 5 >= age {
		fmt.Println("0")
	} else if 12 >= age {
		fmt.Println(cost / 2)
	} else {
		fmt.Println(cost)
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

int n,m,a,b,c,d[100005] = {};
string s,t;

int main(){
    cin >> n >> m;
    vector<int> s[100];

    rep(i,0,m){
        cin >> a >> b;
        s[a].pb(b);
        s[b].pb(a);
    }
    rep(i,1,n+1)P(sz(s[i]));
	
	return  0;
}

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


int main() {
  long long A, B, C; cin >> A >> B >> C;
  
  long long a = (A%2)*B*C, b = A*(B%2)*C, c =  A*B*(C%2);
  
  if(a<b) {
    if(c<a) {
      cout << c << endl;
    } else {
      cout << a << endl;
    }
  } else {
    if(c<b) {
      cout << c << endl;
    } else {
      cout << b << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define lld long double
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli n;
	cin>>n;

	vector<lli> l(n);
	REP(i,0,n)cin>>l[i];

	sort(l.begin(),l.end());
	lli sum=0;
	REP(i,0,n-1)sum+=l[i];

	if(sum>l[n-1])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;


	return 0;
}

Measured memory_bytes: 256
antena = []
for i in range(5):
	n = int(input())
	antena.append(n)
k = int(input())

bad_flag = False
for i,ant in enumerate(antena):
	for bnt in antena[i:] :
		if abs(ant - bnt) > k :
			bad_flag = True 
	if bad_flag :
		break

if bad_flag :
	print(":(")
else :
	print("Yay!")
	
	

Measured memory_bytes: 2940
#include<iostream>
#include<stack>
#include<cstring>
#include<vector>

using namespace std;

int main()
{
    stack<int> s1;

    stack<pair<int,int> > s2;

    char ch[20001];

    cin>>ch;

    int len=strlen(ch);
    int sum=0;

    for(int i=0;i<len;i++)
    {
        if(ch[i]=='\\')
        {
            s1.push(i);
        }else if(ch[i]=='/'&&!s1.empty())
        {
            int area=i-s1.top();
            sum+=area;
            while(!s2.empty()&&s2.top().first>=s1.top())
            {
                area+=s2.top().second;
                s2.pop();
            }
            s2.push(make_pair(s1.top(),area));
            s1.pop();
        }
    }

    cout<<sum<<endl;

    stack<int> ans;
    int cnt=0;

    while(!s2.empty())
    {
        ans.push(s2.top().second);
        cnt++;
        s2.pop();
    }

    cout<<cnt;

    while(!ans.empty())
    {
        cout<<" "<<ans.top();
        ans.pop();
    }

    cout<<endl;


    return 0;
}



Measured memory_bytes: 3256
#include<stdio.h>
#include<math.h>

int isprime(int x)
{
	if(x == 2)return 1;
	if(x < 2 || x % 2 == 0)return 0;

	int i = 3;
	while(i <= sqrt(x)){
		if(x % i == 0)return 0;
		i = i + 2;
	}
        return 1;
}

int main(void)
{
	int i,n,X;
	int count = 0;
	
	scanf("%d",&n);
	for(i = 0;i < n;i++){
		scanf("%d",&X);
		if(isprime(X) == 1)count++;
	}
        printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 596
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class Main {
    public static void main(final String[] args) {
        final FastScanner scanner = new FastScanner(System.in);
        final int t = scanner.nextInt();
        for (int i = 0; i < t; i++) {
            final Map<Integer, List<Pair>> lCamels = new HashMap<>();
            final Map<Integer, List<Pair>> rCamels = new HashMap<>();
            final int n = scanner.nextInt();
            long sum = 0;
            for (int j = 0; j < n; j++) {
                final int k = scanner.nextInt();
                final int l = scanner.nextInt();
                final int r = scanner.nextInt();
                sum += Math.min(l, r);
                if (l >= r) {
                    lCamels.computeIfAbsent(k, v -> new ArrayList<>()).add(new Pair(l, r));
                } else {
                    final int tmp = n - k;
                    rCamels.computeIfAbsent(tmp, v -> new ArrayList<>()).add(new Pair(l, r));
                }
            }

            final PriorityQueue<Pair> lQueue = new PriorityQueue<>(Comparator.comparingLong(pair -> pair.l - pair.r));
            final PriorityQueue<Pair> rQueue = new PriorityQueue<>(Comparator.comparingLong(pair -> pair.r - pair.l));
            for (int j = 1; j <= n; j++) {
                if (lCamels.containsKey(j)) {
                    lQueue.addAll(lCamels.get(j));
                    while (lQueue.size() > j) {
                        lQueue.poll();
                    }
                }

                if (rCamels.containsKey(j)) {
                    rQueue.addAll(rCamels.get(j));
                    while (rQueue.size() > j) {
                        rQueue.poll();
                    }
                }
            }

            sum += lQueue.stream().mapToLong(pair -> pair.l - pair.r).sum()
                + rQueue.stream().mapToLong(pair -> pair.r - pair.l).sum();
            System.out.println(sum);
        }
    }

    private static class Pair {
        final long l;
        final long r;

        Pair(final long l, final long r) {
            this.l = l;
            this.r = r;
        }
    }

    private static class FastScanner {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(final InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
    }
}


Measured memory_bytes: 86260
/**akshaykumar99**/
 
#include<bits/stdc++.h>
using namespace std;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define pu push_back           
#define pp pop_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const int MOD=1e9+7 ;
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=1e5+2;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> ivc;
typedef pair<ll,ll> ipr;

int main()
{
    IOS();
    int n,i;
    cin>>n;
    ld a[n],sum=0;
    f(i,0,n)
    {
      cin>>a[i];
      sum+=1.0/a[i];
    }
    cout<<fixed<<setprecision(10)<<1.0/sum;



  return 0;
}

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

using namespace std;


void Solution()
{
    // this problem can be solved by the way which can list up all situations case by case
    // all can be done like this way
    const string poker[] =
    { "null", "one pair", "two pair", "three card", "straight", "full house", "four card"};
    
    int a[5];
    char comma;
    
    while(cin>>a[0]>>comma>>a[1]>>comma>>a[2]>>comma>>a[3]>>comma>>a[4])
    {
        sort(a, a + 5);
        
        // Algorithm
        int pair[5] = {0};
        int count = 0;
        
        for (int i = 0; i < 5; i++)
        {
            if (a[i] == a[i + 1])
            {
                count++;
            }
            else
            {
                pair[count]++;
                count = 0;
            }
        }
        
        if (pair[3] == 1)
        {
            cout << poker[6] << endl;
        }
        else if (pair[1] == 1 && pair[2] == 1)
        {
            cout << poker[5] << endl;
        }
        else if (pair[2] == 1)
        {
            cout << poker[3] << endl;
        }
        else if (pair[1] == 2)
        {
            cout << poker[2] << endl;
        }
        else if (pair[1] == 1)
        {
            cout << poker[1] << endl;
        }
        else if (pair[0] == 5)
        {
//            int i;
//            for (i = 1; i < 4; i++)
//                if (input[i + 1] != input[1] + i)
//                    break;
//            if (i == 4 && ((input[0] == input[1] - 1) || (input[0] == 1)))
//                cout << poker[4] << endl;
//            else
//                cout << poker[0] << endl;
            if((a[0] + 1 == a[1] && a[1] + 1 == a[2] && a[2] + 1 == a[3] && a[3] + 1 == a[4]) ||
               (a[0] == 1 && a[1] == 10 && a[2] == 11 && a[3] == 12 && a[4] == 13))
            {
                cout<<poker[4]<<endl;
            }
            else
            {
                cout<<poker[0]<<endl;
            }
        }
        
    }
}

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

Measured memory_bytes: 1212
#include <iostream>
#include <vector>
using namespace std;
typedef long long int ll; 
int main(){
  ll k;
  cin >> k;
  if(k==0){
  cout << 2 << endl;
  cout << "1 1" << endl;
    return 0;
  }
  vector<ll>  v(50);
  for(int i=0;i<50;i++) v[i] = (k/50)+50;
  int res = k % 50;
  res = 50 - res;
  for(int i=0;i<res;i++){
  	int ind=-1; ll m = 0;
    for(int j=0;j<50;j++){
    	if(v[j]>m){ m = v[j]; ind = j;}
    }
    for(int j=0;j<50;j++){
    	if(ind==j) v[j] -= 50;
      	else v[j]++;
    }
  }
  cout << 50 << endl;
  for(int j=0;j<50;j++) cout << v[j] << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>


using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long  int N,a[56789],dp=0,res=0;
int main()
{
    cout << fixed << setprecision(18);
    cin>>N;
    while(N!=0){
        dp=-INF;
        res=-INF;
        for(long long int i = 1; i <= N; i++){
            cin>>a[i];
            dp=max(a[i],dp+a[i]);
            res=max(dp,res);
        }
        cout<<res<<endl;
        cin>>N;
    }
    
}    



Measured memory_bytes: 3080
n,m,q = map(int, input().split())

from collections import namedtuple
Val = namedtuple('val', ('a', 'b', 'c', 'd'))
vals = []
for _ in range(q):
    a,b,c,d = map(int, input().split())
    vals.append(Val(a, b, c, d))

import itertools

l = range(1, m+1)
combis = list(itertools.combinations_with_replacement(l, n))

totals = [(0, 0)]
for combi in list(combis):

    total = 0
    combi1 = sorted(combi)
    for val in vals:
        cDiff = combi1[val.b - 1] - combi1[val.a - 1]
        if cDiff == val.c:
            total += val.d

    totals.append((total, combi1))

maxT = max(totals, key= lambda x: x[0])

print(maxT[0])

Measured memory_bytes: 100372
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
100 100 100
)");
#define cin input
#endif

int main()
{
	int a1, a2, a3;
	cin >> a1 >> a2 >> a3;

	cout << max({a1, a2, a3}) - min({a1, a2, a3}) << endl;

	return 0;
}


Measured memory_bytes: 256
N = int(input())
D = list(map(int, input().split()))

M = int(input())
T = list(map(int, input().split()))

if N < M:
    print('NO')
    exit()

d_dict = {}
for d in D:
    if d not in d_dict:
        d_dict[d] = 1
    else:
        d_dict[d] += 1

for t in T:
    if t in d_dict:
        d_dict[t] -= 1
        if d_dict[t] < 0:
            print('NO')
            exit()
    else:
        print('NO')
        exit()

print('YES')

Measured memory_bytes: 41316
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    for(int a=1; a<=9; ++a){
        for(int b=1; b<=9; ++b){
            if(a * b == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

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


Measured memory_bytes: 256
gets
ary = []
ARGF.each do |line|
  a = line.split.map(&:to_i)
  b = a.inject(:+)

  puts "#{a.join("\s")} #{b}"
  ary << a.push(b)
end
puts ary.transpose.collect{|row| row.inject(:+)}.join("\s")

Measured memory_bytes: 9024
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;
int n,m;
int ar[105];

void fail(){
  puts("Impossible");
  exit(0);
}

int main(){
  cin>>n>>m;
  REP(i,m) cin>>ar[i];

  vector<int> res;
  if(n&1){
    int odd=-1;
    REP(i,m) if(ar[i]&1){
      if(~odd) fail();
      odd=i;
    }
    swap(ar[odd],ar[0]);
    REP(i,ar[0]/2) res.pb(2);
    REPN(i,m,1) res.pb(ar[i]);
    res.pb(1);
  }else{
    int odd1=-1,odd2=-1;
    REP(i,m) if(ar[i]&1){
      if(~odd1){
        if(~odd2) fail();
        odd2=i;
      }else{
        odd1=i;
      }
    }
    if(odd1==-1){
      res.pb(ar[0]-1);
      REPN(i,m,1) res.pb(ar[i]);
      res.pb(1);
    }else{
      swap(ar[odd1],ar[0]);
      swap(ar[odd2],ar[m-1]);
      REP(i,ar[0]/2) res.pb(2);

      REPN(i,m-1,1) res.pb(ar[i]);

      res.pb(2);

      REP(i,ar[m-1]/2) res.pb(2);
    }
  }
  REP(i,m) printf("%d%c",ar[i],i==m-1?'\n':' ');
  cout<<res.size()<<endl;;
  REP(i,res.size()) cout<<res[i]<<endl;

  return 0;
}




Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k;
int main(){
	cin>>n>>k;
	ll ans=0;
	for(int i=k+1;i<=n;i++)
	{
		ll v=i-k;
		ans+=v*(n/i);
		v=n%i;
		if(v>=k) ans+=v-k+1;
		if(k==0) ans--;
		//cout<<i<<" "<<ans<<endl;
	}
	cout<<ans;
	return 0;
}
/*
2
1 2
1 0
*/

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#define vll vector<long long>
#define mll map<long long,long long>
#define pb push_back
typedef  long long ll;
typedef long double ld;
long double pi=3.14159265358979323846;

vll al[500005];
ll vis[500005],color[500005],I[101][101];

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

bool isPrime(int n)
{
    if (n<=1) return false; 
    if (n<=3) return true; 
    if (n%2==0||n%3==0) return false; 
    for (int i=5;i*i<=n;i=i+6) if (n%i==0||n%(i+2)==0) return false; 
    return true; 
}

ll bpow(ll n, ll po)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res*=n;
			po--;
		}
		else
		{
			n*=n;
			po/=2;
		}
	}
	return res;
}

ll binpow(ll n, ll po, ll mod)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res=(res*n)%mod;
			po--;
		}
		else
		{
			n=(n*n)%mod;
			po/=2;
		}
	}
	return res;
}

ll swap(ll a, ll b)
{
	a=a+b;
	b=a-b;
	a=a-b;
}

ll fact(ll n) { 
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}

ll C(ll n, ll r) {
    if(r > n - r) r = n - r; 
    ll ans = 1;
    ll i;

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

    return ans;
}

//bool bipartite_dfs(ll node, ll flag)
//{
//	vis[node]=1;
//	ll cflag=flag;
//	color[node]=cflag;
//	for(ll child : al[node])
//	{
//		if(!vis[child])
//		{
//			bool n=bipartite_dfs(child,1-cflag);
//			if(n==false) return false;
//		}
//		else if(color[child]==color[node]) return false;
//	}
//	return true;
//}

void mmul(ll A[][101], ll B[][101], ll dim)
{
	ll res[dim][dim];
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		res[i][j]=0;
		for(ll k=0;k<dim;k++) res[i][j]=(res[i][j]+A[i][k]*B[k][j])%1000000007;
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=res[i][j];
}

void mpow(ll A[][101],ll dim, ll po)
{
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		if(i==j) I[i][j]=1;
		else I[i][j]=0;
	}
	while(po>0)
	{
		if(po%2==1)
		{
			mmul(I,A,dim);
			po--;
		}
		else
		{
			mmul(A,A,dim);
			po/=2;
		}
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=I[i][j];
}



int main()
{
	ll n,m,x=0,a;
	cin>>n>>m;
	for(ll i=0;i<m;i++)
	{
		cin>>a;
		x+=a;
	}
	n-=x;
	if(n<0) cout<<-1;
	else cout<<n;
}


Measured memory_bytes: 15316
using System;

namespace abc093_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            Console.WriteLine(s[0] != s[1] && s[0] != s[2] && s[1] != s[2] ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 11092
def search(p,q):
  count = 0
  for i in range(n):
    for j in range(n):
      if a[i][0]-a[j][0] == p and a[i][1]-a[j][1] == q:
        count += 1
  return count
n = int(input())
a = []
for i in range(n):
  a.append(tuple(map(int,input().split())))
cc = 0
for i in range(n):
  for j in range(n):
    if i == j:
      continue
    else:
      p = a[i][0]-a[j][0]
      q = a[i][1]-a[j][1]
      cc = max(cc,search(p,q))
print(n-cc)

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

using namespace std;
typedef long long ll;

int main () {
    int A, B, K;
    cin >> A >> B >> K;

    vector<int> c;
    for (int i = 100; i > 0; i--) {
        if (A % i == 0 && B % i == 0) {
            c.push_back(i);
        }
    }

    cout << c[K-1] << endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <bitset>
using namespace std;

typedef long long ll;
const ll MOD_P = 1000000000 + 7;
const int MAX_N = 100 + 2;
const int MAX_K = 100000 + 2;
ll dp[MAX_N][MAX_K];
ll a[MAX_N];

int main() {

  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> a[i];

  memset(dp, 0, sizeof(dp));

  ll maxval = 0;
  for (int j = 0; j <= K; j++) {
    if (j == 0) {
      dp[0][j] = 1;
      maxval = max(maxval, dp[0][j]);
    }
    else if (0 < j && j <= a[0]) {
      dp[0][j] = dp[0][j-1] + 1;
      maxval = max(maxval, dp[0][j]);
    }
    else dp[0][j] = maxval;

    dp[0][j] %= MOD_P;
  }
  
  for (int i = 1; i < N; i++) {
    for (int j = 0; j <= K; j++) {
      if(j == 0) {
	dp[i][j] = 1;
      }
      else {
	ll lb = j - a[i] - 1;
	ll add = dp[i-1][j];
	if (lb >= 0) add -= dp[i-1][lb];
	dp[i][j] = add + dp[i][j-1];
      }
      dp[i][j] %= MOD_P;
    }
  }

  ll ans;
  if (K > 0) {
    ans = dp[N-1][K] - dp[N-1][K-1];
    if (ans < 0) ans += MOD_P;
  }
  else ans = dp[N-1][K];
  
  cout << ans << endl;
    
  return 0;
}


Measured memory_bytes: 82836
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N, A, B;
	cin >> N >> A;
    B = N % 500;
  
    if (B <= A) {
      cout << "Yes" << endl;
    }
  
    else {
      cout << "No" << endl;     
    }
    
}

Measured memory_bytes: 3612
#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>;

int main()
{
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
    return 0;
}

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

int n,x,y,z;
double a[307],dp[300][300][300];

double dfs(int x,int y,int z){
	if(x==0&&y==0&&z==0)return 0;
	if(dp[x][y][z]!=0)return dp[x][y][z];
	double ans=n/(double)(x+y+z);
	if(x>0)ans+=(double)x/(double)(x+y+z)*dfs(x-1,y,z);
	if(y>0)ans+=(double)y/(double)(x+y+z)*dfs(x+1,y-1,z);
	if(z>0)ans+=(double)z/(double)(x+y+z)*dfs(x,y+1,z-1);
	return dp[x][y][z]=ans;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lf",&a[i]);
		if(a[i]==1){
			x++;
		}
		else if(a[i]==2){
			y++;
		}
		else{
			z++;
		}
	}
	printf("%.15f\n",dfs(x,y,z));
}

Measured memory_bytes: 110840
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d",&x);
#define scs(x) scanf("%s",x);
#define scl(x) scanf("%lld",&x);
#define rep(i,s,e) for(int i=s; i<=e; ++i)
#define dep(i,s,e) for(int i=s; i>=e; --i)
typedef long long ll;
using namespace std;
const ll mod=1e9+7; 
double a[105];
ll n,k;
void solve(){
	scl(n);scl(k);
	ll u=n%k;
	pf("%lld\n",min(u,k-u));
}
int main(){
  	solve();
}

Measured memory_bytes: 256
#include <cstdio>



int main(){

    int ans=0;

    int N;
    scanf("%d",&N);
    for(int i=1;i<N;i++){
        if (N%i) ans+=N/i;
        else ans+=(N/i-1);

    }

    printf("%d\n",ans);

    return 0;
}

Measured memory_bytes: 1732
// Author: Shusuke Ueda
// AtCoder Beginner Contest 134 - Problem D

#include <iostream>
#include <vector>

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

    std::vector<int> num(n + 1);
    for (int i = n; i >= 1; i--) {
        if (num[i] % 2 != a[i]) {
            a[i] = 1;
            for (int j = 1; j * j <= i; j++) {
                if (i % j == 0) {
                    num[j]++;
                    if (j != i / j) {
                        num[i / j]++;
                    }
                }
            }
        } else {
            a[i] = 0;
        }
    }

    std::vector<int> ans;
    for (int i = 1; i <= n; i++) {
        if (a[i] == 1) {
            ans.push_back(i);
        }
    }

    std::cout << ans.size() << std::endl;
    for (int i = 0; i < ans.size(); i++) {
        if (i > 0) {
            std::cout << " ";
        }
        std::cout << ans[i];
    }
    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define LLINF (1LL<<60)
#define INF (1<<30)
#define F first
#define S second
#define i1(a) cin>>a;
#define i2(a,b) cin>>a>>b;
#define i3(a,b,c) cin>>a>>b>>c;
#define i4(a,b,c,d) cin>>a>>b>>c>>d;
#define i5(a,b,c,d,e) cin>>a>>b>>c>>d>>e;
#define ol(a) cout<<a<<endl;
#define os(a) cout<<a<<" ";
#define o(a) cout<<a;
#define ol(a) cout<<a<<endl;
#define ol2(a,b) cout<<a<<" "<<b<<endl;
#define ol3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl;
using namespace std;
main(){
  long long n,a,b,c,d;
  i3(a,b,c);
  if(a==5){
    n++;
  }
  if(a==7){
    d++;
  }
  if(b==5){
    n++;
  }
  if(b==7){
    d++;
  }
  if(c==5){
    n++;
  }
  if(c==7){
    d++;
  }
  if(n==2&&d==1){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}


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

int main()
{
	int n;cin>>n;
	for(;n>=4;n-=11)
	{
		if(n%7==0||n%4==0||n%11==0)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	lint N,M;
	pair<lint,lint> p[100010];
	
	cin >> N >> M;
	for(int i=0;i<N;i++)
		cin >> p[i].first >> p[i].second;
	
	sort(p,p+N);
	
	lint ans=0;
	lint cnt=0;
	for(int i=0;i<N;i++)
	{
		lint tmp=min(p[i].second,M-cnt);
		if(cnt<M)
		{
			ans+=p[i].first*tmp;
			cnt+=tmp;
		}
		if(cnt>=M)
			break;
	}
	
	cout << ans << endl;
	return 0;
}



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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (int)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

vll binary_convert(ll n){
    vll s;
    ll size = 0;

    while(n / (ll)(pow(2,size)) > 0)size++;
    rep(i,size + 1){
        s.pb(n / (ll)(pow(2,i)));
        n %= (ll)(pow(2,i));
    }

    return s;
}

ll fib(ll n){
    vll a(n+1);
    a[0] = 1;
    a[1]  = 1;

    REP(i,2,n+1){
        a[i] = a[i-1] + a[i-2];
        a[i] %= mod;
    }

    return a[n-1];
}

int main()
{
    ll n;
    cin >> n;
    
    vector<P> p(n);
    rep(i,n){
        ll a,b;
        cin >> a >> b;
        p[i] = make_pair(b,a);
    }

    sort(all(p));

    ll t = 0;
    
    rep(i,n){
        t += p[i].second;
        if(t > p[i].first){
            cout << "No" << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 3456
<?php
	fscanf(STDIN,"%d",$n);
	$v=explode(' ',trim(fgets(STDIN)));
	$c=explode(' ',trim(fgets(STDIN)));
 
	$ans = 0;
	for($i = 0; $i < $n; $i++) {
      if ($v[$i] > $c[$i]) {
       	$ans+=($v[$i]-$c[$i]);
      }
    }
	echo $ans;

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

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

ll gcd(ll a, ll b) { for (; b; a %= b, swap(a, b)); return a; }

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

	string s; cin >> s;
	
	if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') cout << 3;
	else if (s[0] == 'R' && s[1] == 'R' || s[1] == 'R' && s[2] == 'R') cout << 2;
	else if (s[0] == 'R' || s[1] == 'R' || s[2] == 'R') cout << 1;
	else cout << 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
using namespace std;
using P = pair<int, string>;

int N;
string S[200010];
map<string, int> Scount;

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}
	for (int i = 0; i < N; i++) {
		Scount[S[i]]++;
	}
	priority_queue<P> que;
	for (auto itr = Scount.begin(); itr != Scount.end(); ++itr) {
		que.push(P(itr->second,itr->first));
	}

	vector<string> ans;
	P p1 = que.top();
	que.pop();
	ans.push_back(p1.second);
	while (!que.empty()) {
		P p2 = que.top();
		que.pop();
		if (p2.first == p1.first) {
			ans.push_back(p2.second);
		}
	}
	sort(ans.begin(),ans.end());
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i] << endl;
	}
}

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

int main() {
  int N, X, T;
  cin >> N;
  cin >> X;
  cin >> T;
  int a;
  a = N / X;
  if(N % X == 0){
    cout << a * T << endl;
  }
  else{
    cout << (a + 1) * T << endl;
  }
  
}


Measured memory_bytes: 3644
#include<stdio.h> 
#include<string.h>
int main()
{
    int i,ans=0;
    char srx[21],sry[21]={"CODEFESTIVAL2016"};
    gets(srx);
    for(i=0;i<strlen(srx);i++)
    if(srx[i]!=sry[i])
    ans++;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
using namespace std;
bool cmp(int a, int b)
{
	return a<b;
}
int main()
{
	int a[3];
	for(int i=0; i<3; i++)
	    scanf("%d",&a[i]);
	sort(a,a+3,cmp);
	if(a[0]+a[1]==a[2])
	    printf("Yes\n");
	else
	    printf("No\n");
	return 0;
}

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

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

int H, W;
vector<string> field;

int main()
{
    cin >> H >> W;

    field.resize(H);
    for(int h = 0; h < H; h++){
        cin >> field[h];
    }

    // for bfs
    vector<vector<int>> dist(H, vector<int>(W, -1)); // all node has not been visited
    using pint = pair<int, int>;
    queue<pint> que;

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(field[i][j] == '#'){
                dist[i][j] = 0;
                que.push(pint(i,j));
            }
        }
    }

    while(!que.empty()){
        auto cur = que.front();
        que.pop();

        for(int i = 0; i < 4; i++){
            int nx = cur.first + dx[i];
            int ny = cur.second + dy[i];

            if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
            if(dist[nx][ny] == -1){
                dist[nx][ny] = dist[cur.first][cur.second] + 1;
                que.push(pint(nx, ny));
            }
        }
    }

    int res = 0;

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            res = max(res, dist[i][j]);
        }
    }

    cout << res << endl;

}

Measured memory_bytes: 17128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
#define co(x) cout << x << endl;
#define cins(n,v) rep(i,n){cin >> v.at(i);}
#define couts(v) rep(i,v.size()){cout << v.at(i) << endl;}
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int main() {
  ll n,sum=0;
  cin >> n;
  vector<int> v(3*n);
  cins(3*n,v);
  big_sort(v);
  rep(i,n){
    sum += v[2*i+1];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1408