akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
const int N=1e5+2;
int n,dp[N],fir[N];
/*
dp state:
3:leaf
2:the subtree must be filled step by step from one player to another
1:all the subtree is 2
didn't set an unbreakable state?
*/
/*
dp state.v2:
1: leaf/all the subtree is 2;
2:the subtree must be filled step by step from one player to another
*/
struct edge{
	int to,nx;
}eg[N<<1];

inline void add(int a,int b){
	static int cnt;
	eg[++cnt]=(edge){b,fir[a]};
	fir[a]=cnt;
	eg[++cnt]=(edge){a,fir[b]};
	fir[b]=cnt;
}

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

bool dfs(int x,int fa){
/*	if(!fir[x]){
		dp[x]=3;
		return;
	}
	int cnt[4]={0};
	for(int i=fir[x];i;i=eg[i].nx){
		int y=eg[i].to;
		if(y!=fa){
			if(dfs(y,x)) return 1;
			++cnt[dp[y]];
			if(cnt[3]>1) return 1;
		}
	}
	if(cnt[1]+cnt[3]>1) return 1;
	if(!cnt[1]&&!cnt[3]){
		if(!fa) return 1;
		dp[x]=1;
	}
	else dp[x]=2;
	return 0;*/
	if(!fir[x]){
		dp[x]=1;
		return 0;
	}
	int cnt=0;
	for(int i=fir[x];i;i=eg[i].nx){
		int y=eg[i].to;
		if(y!=fa){
			if(dfs(y,x)) return 1;
			if(dp[y]==1){
				if(++cnt==2) return 1;
			}
		}
	}
	if(cnt) dp[x]=2;
	else{
		if(!fa) return 1;
		dp[x]=1;
	}
	return 0;
}

int main(){
#ifndef ONLINE_JUDGE
//	freopen("a.in","r",stdin);
#endif
	n=nxi();
	for(int i=1;i<n;++i){
		add(nxi(),nxi());
	}
	puts(dfs(1,0)?"First":"Second");
	return 0;
}

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
int main() {
    int W,H,x,y,r;
    cin>> W >> H >> x >> y >> r;
    if (0<=x-r && x+r<=W && 0<=y-r && y+r<=H){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
     }
     return 0;  
}


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

using namespace std;

#define int long long
#define ar array
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()

#define F_OR(i, a, b, s) for (int i=(a); (s)>0?i<(b):i>(b); i+=(s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define EACH(x, a) for (auto& x: a)

template<class T>
bool umin(T &a, const T &b) {
    return b < a ? a = b, 1 : 0;
}

template<class T>
bool umax(T &a, const T &b) {
    return a < b ? a = b, 1 : 0;
}

template<class A>
void read(vt<A> &v);

template<class A, size_t S>
void read(ar<A, S> &a);

template<class T>
void read(T &x) {
    cin >> x;
}

void read(double &d) {
    string t;
    read(t);
    d = stod(t);
}

void read(long double &d) {
    string t;
    read(t);
    d = stold(t);
}

template<class H, class... T>
void read(H &h, T &... t) {
    read(h);
    read(t...);
}

template<class A>
void read(vt<A> &x) {
    EACH(a, x)read(a);
}

template<class A, size_t S>
void read(array<A, S> &x) {
    EACH(a, x)read(a);
}

string to_string(char c) {
    return string(1, c);
}

string to_string(bool b) {
    return b ? "true" : "false";
}

string to_string(const char *s) {
    return string(s);
}

string to_string(string s) {
    return s;
}

string to_string(vt<bool> v) {
    string res;
    FOR(sz(v))res += char('0' + v[i]);
    return res;
}

template<size_t S>
string to_string(bitset<S> b) {
    string res;
    FOR(S)res += char('0' + b[i]);
    return res;
}

template<class T>
string to_string(T v) {
    bool f = 1;
    string res;
    EACH(x, v) {
        if (!f)
            res += ' ';
        f = 0;
        res += to_string(x);
    }
    return res;
}

template<class A>
void write(A x) {
    cout << to_string(x);
}

template<class H, class... T>
void write(const H &h, const T &... t) {
    write(h);
    write(t...);
}

void print() {
    write("\n");
}

template<class H, class... T>
void print(const H &h, const T &... t) {
    write(h);
    if (sizeof...(t))
        write(' ');
    print(t...);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n) {
    v = vt<T>(n, x);
}

template<class T, class U>
void vti(vt<T> &v, U x, size_t n, size_t m...) {
    v = vt<T>(n);
    EACH(a, v)vti(a, x, m);
}

int cmp(int a, int b) {
    if (a == b) {
        return 0;
    }
    return a < b ? -1 : 1;
}

const int mxN = 100;
char a[mxN][mxN];

void solve() {
    int n, m;
    read(n, m);
    FOR(n) {
        FOR(j, m) {
            read(a[i][j]);
        }
    }
    
    FOR(n) {
        FOR(j, m) {
            cout << a[i][j];
        }
        print();
        FOR(j, m) {
            cout << a[i][j];
        }
        print();
    }
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int tt = 1;
//    read(tt);
    FOR(tt) {
//        write("Case #", i + 1, ": ");
        solve();
    }
    
}



Measured memory_bytes: 3680
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int A[]=new int[N+1];
		int B[]=new int[N];
		int z=0;
		long ans=0;
		while(z<N+1){
			A[z]=stdIn.nextInt();
			z++;
		}z=0;
		while(z<N){
			B[z]=stdIn.nextInt();
			if(A[z]>=B[z])
				ans+=B[z];
			else{
				ans+=A[z];
				B[z]-=A[z];
				if(A[z+1]>=B[z]){
					A[z+1]-=B[z];
					ans+=B[z];
				}
				else{
					ans+=A[z+1];
					A[z+1]=0;
				}
			}
			z++;
		}z=0;
		System.out.println(ans);
	}
}

Measured memory_bytes: 64824
package main

import (
	"fmt"
	"log"
)

func main() {

	var A, B, C int //

		_, err := fmt.Scan(&A, &B, &C)
		if err != nil {
			log.Fatal(err)
		}

		if A < B{
			if A < C && C < B {
				fmt.Println("Yes")
			} else {
				fmt.Println("No")
			}
		}else{
			if B < C && C < A {
				fmt.Println("Yes")
			} else {
				fmt.Println("No")
			}
		}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main() {
  int k; cin >> k;
  int a = 7;
  for (int i = 0; i < k; i ++) {
    if (a % k == 0) {cout << i + 1 << endl; return 0;}
    a = (10 * a + 7) % k;
  }
  cout << -1 << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (n > k * 2) {

	}
	return fac[n] / (fac[k] * fac[n - k]);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll h, w;
char a[1010][1010];
bool dp[101010];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, k + 1) {
		rep(j, n) {
			if (i >= a[j]) {
				if (dp[i - a[j]] == false)dp[i] = true;
			}
		}
	}
	if (dp[k])puts("First");
	else {
		puts("Second");
	}
	return 0;
}


Measured memory_bytes: 3696
#!/usr/local/bin/python3
# https://atcoder.jp/contests/agc014/tasks/agc014_a

A, B, C = map(int, input().split())

if A == B == C and A % 2 == 0:
    print(-1)
    exit()

def check(A, B, C):
    return A%2 == 1 or B%2 == 1 or C%2 == 1

ans = 0
while check(A, B, C) == False:
    nA = (B + C) / 2
    nB = (A + C) / 2
    nC = (A + B) / 2
    A, B, C = nA, nB, nC
    ans += 1

print(ans)


Measured memory_bytes: 9256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;
bool isPrime[1000000];
vector<int>primes;

vector<long long> divisors(long long N){
   vector<long long> R;
   R.emplace_back(1);
   for(int i = 0 ; i < (int)primes.size(); i++){
      long long prime = primes[i];
      if(N%prime==0){
         int size = R.size();
         long long coef = prime;
         while(N%prime==0){
            for(int j = 0 ; j < size; j++){
               R.emplace_back(R[j]*coef);
            }
            N/=prime;
            coef*=prime;
         }
      }
      if(prime*prime>N) break;
   }
   if(N!=1){
      int size = R.size();
      for(int j = 0 ; j < size; j++){
         R.emplace_back(R[j]*N);
      }
   }
   return R;
}

int calc(long long N, long long d){
   while(N%d==0) N/=d;
   return N%d;
}

int main(){
   long long N;
   memset(isPrime,true,sizeof(isPrime));
   for(int i = 2 ; i < 1000000; i++){
      if(isPrime[i]){
         primes.emplace_back(i);
         for(int j = i+i; j < 1000000; j+=i) isPrime[j]=false;
      }
   }
   cin >> N;
   vector<long long> v = divisors(N-1);
   vector<long long> v2 = divisors(N);
   int ans = v.size()-1;
   for(int i = 0 ; i < (int)v2.size(); i++){
      if(v2[i]==1) continue;
      if(calc(N,v2[i])==1){
         ans++;
      }
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 1916
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = 18;
const int MAXM = 1000000;
int S[MAXM + 5];
bool vis[MAXM + 5];
int main() {
	int N, M; scanf("%d", &N), M = (1<<N);
	for(int i=1;i<=M;i++)
		scanf("%d", &S[i]);
	sort(S + 1, S + M + 1);
	int cnt = 1; vis[M] = true;
	for(int i=1;i<=N;i++) {
		int tot = 0;
		for(int j=M;j>=1;) {
			int p = j, del = 0;
			while( S[j] == S[p] ) p--;
			for(int k=p+1;k<=j;k++) {
				if( vis[k] ) del++;
				else {
					if( tot ) {
						cnt++, tot--;
						vis[k] = true;
					}
				}
			}
			tot += del, j = p;
		}
	}
	if( cnt == M ) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
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;}

int main(){
	int a,b;
	cin >> a >> b;
	cout << a*b << " " << 2*(a+b) << endl;
}

Measured memory_bytes: 1164
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
// bool operator<(const pair<int, int> &a, const pair<int, int> &b)
// {
//     if (a.first == b.first)
//         return a.second < b.second;
//     return a.first < b.first;
// };

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

/*bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}*/

int dp[3010][3010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s, t;
    cin >> s >> t;

    int n = s.size(), m = t.size();
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            if (s[i] == t[j])
            {
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
            }
            else
            {
                dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
            }
        }
    }
    string ans = "";
    while (dp[n][m])
    {
        if (s[n - 1] == t[m - 1])
        {
            ans += s[n - 1];
            n--;
            m--;
        }
        else if (dp[n][m - 1] > dp[n - 1][m])
            m--;
        else
            n--;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35584
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int Q(int n) {
    if (1 <= n && n <= 6)
        return n + 1;
    else
        return n - 5;
}
bool ok(string s) {
    int sum = 0;
    rep(i, s.size() - 1) { sum += Q(s.size() - i - 1) * (s[i] - '0'); }
    sum %= 11;
    if (sum <= 1)
        sum = 0;
    else
        sum = 11 - sum;
    return s.back() == (sum + '0');
}
string s;
int main() {
    cin >> s;

    int pos = 0;
    rep(i, s.size()) if (s[i] == '?') pos = i;
    vector<char> ans;
    rep(i, 10) {
        auto t = s;
        t[pos] = i + '0';
        if (ok(t)) ans.push_back(i + '0');
    }
    if (ans.size() == 1)
        cout << ans[0] << endl;
    else
        cout << "MULTIPLE" << endl;

    return 0;
}

Measured memory_bytes: 3200
/*..............................................*\
Author:Kishor Kumar Paroi
Dept:CSE-1703053
email.kishor.josephite@gmail.com
RUET,BANGLADESH
\*---------------------------*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include<bits/stdc++.h>
#include<iostream>
#include<iterator>

#define max(a,b) ((a>b)?a:b)                        //finding max
#define min(a,b) ((a<b)?a:b)                        //finding min
#define Max(a,b,c) max(a,max(b,c))                  //finding max between 3 numbers
#define Min(a,b,c) min(a,min(b,c))                  //finding min between 3 numbers
#define Pi acos(-1.0)                               //defining Pi for mathematical uses
#define Clear(a) memset(a,0,sizeof(a))              //clearing memory of an array
#define setfalse(a) memset(a,false,sizeof(a))       //setting the array into false
#define settrue(a) memset(a,true,sizeof(a))         //setting the array into true
#define clrstr(a) memset(a,'\0',sizeof(a))          //setting string array to null
#define open freopen("input.txt","r",stdin)         //opening input file
#define close freopen ("output.txt","w",stdout)     //opening output file
#define Case(a) printf("Case %d: ",a)               //printing case number
#define caseh(a) printf("Case #%d: ",a)             //printing case number having '#'
#define getcase(a) scanf("%d",&a)                   //scanning case number
#define caseloop(a,b) for(a=1;a<=b;a++)             //making case loop
#define EPS 1e-9                                    //small value for avoiding preccesion error
#define LL long long                                //long long short form
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define vi vector<int>v
#define si vector<int>s

/*for(vector<int>iterator it=v.begin();it!=v.end();it++)
{
    cout<<*it<< " ";
}
cout<< endl;
*/

#define CIN1(a) long long a;cin >> a;
#define CIN2(a,b) long long a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)
//const int N=100*1000;
//const int mod=1e9+7;

//# define int min3(int a,int b,int c){return min(a,min(b,c));}
//#define int max3(int a,int b,int c){return max(a,max(b,c));}
//#define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
//#define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    LL n,i,j,ans=1;
    cin>>n;
    for(i=2; i<=sqrt(n); i++)
    {
        j=1;
        while(pow(i,j)<=n)
            j++;
        ans=max((LL)pow(i,j-1),ans);
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){
  int i=0,N;
  cin >> N;
  while(i<N){
    string hina;
    cin >> hina;
    if(hina == "Y")
      break;
    i++;
  }
  if(i==N)
    cout << "Three" << endl;
  else
    cout << "Four" << endl;
}
	


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

using namespace std;

#define ll long long
#define ull unsigned long long
#define pl pair<ll, ll>
#define vll vector<ll>
#define pll vector<pair<ll, ll>>
#define f(i,a, b) for (ll i = a; i < b; i++)
#define ft int t; cin>>t; while(t--)
#define mp make_pair
#define pb push_back
#define ld float
#define fd(i,a, b) for (ll i = a; i >= b; i--)
#define nl "\n"
 /*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
     typedef tree<ll ,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;*/

 ull powm(ull a,ull b){

   ull res=1;

   while(b){
     if(b%2)res=(res*a);
     a=(a*a);
     b/=2;
   }

 return res;
 }


int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
 ll n,m;
  cin>>n;
  ll aa[n+1]={0};  ll bo;
  f(i,0,n-1){
     cin>>bo;
     aa[bo]++;
  }
  f(i,1,n+1)cout<<aa[i]<<endl;
}


Measured memory_bytes: 5208
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

        char charString[] = s.toCharArray();
        Set<Character> hashSet=new HashSet<Character>();
        for (int i = 0; i < 4; i++) {
            hashSet.add(charString[i]);
        }

        if(hashSet.size()==2)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

Measured memory_bytes: 21332
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a <= 5){
            System.out.println(0);
        } else if (a <= 12){
            System.out.println(b/2);
        } else {
            System.out.println(b);
        }
    }
}


Measured memory_bytes: 21972
fun main(args: Array<String>) {

    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val lights = (1..m).map { readLine()!!.split(" ").drop(1).map { it.toInt() }.toTypedArray() }.toTypedArray()
    val p = readLine()!!.split(" ").map { it.toInt() }

    val onoff = Array(n) { 0 }

    fun dfs(i: Int, onoff: Array<Int>): Int {

        if (i < 0) {
            var c = 0
            for (j in 0 until lights.size) if (lights[j].filter { onoff[it - 1] == 1 }.size % 2 == p[j]) c++
            return if (c == lights.size) 1 else 0
        }

        val on = onoff.copyOf()
        on[i] = 1
        return dfs(i - 1, onoff) + dfs(i - 1, on)
    }

    println(dfs(n - 1, onoff))
}

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


using namespace std;


typedef long long LL;
typedef pair<LL,LL> pp;

LL gcd(LL a, LL b) { return b == 0 ? a : gcd(b, a%b); }

int main()
{
	int N;
	cin >> N;
	LL p = 1;
	for (int i = 0; i < N; i++) {
		LL x;
		cin >> x;
		p = p/gcd(p, x)*x;
	}
	cout << p << endl;
	exit(0);
}



Measured memory_bytes: 256
def main():
    from collections import defaultdict,deque
    N,M = map(int,input().split())
    AB = []
    for _ in range(M):
        a,b = map(int,input().split())
        AB.append((a-1,b-1))
    ans = M
    for i in range(M):
        s,g = AB[i]

        edge = defaultdict(list)
        for j in range(M):
            if i == j:
                continue
            a,b = AB[j]
            edge[a].append(b)
            edge[b].append(a)

        visited = [False]*N
        targets = deque([s])
        while targets:
            t = targets.popleft()
            visited[t] = True
            for dest in edge[t]:
                if visited[dest]:
                    continue
                if dest == g:
                    ans -= 1
                    break
                targets.append(dest)
            else:
                continue
            break
    print(ans)
        
        







main()

Measured memory_bytes: 74204
fun main(args: Array<String>) {
    var N = readLine()!!.toInt()
    println(minCount(N))
}

val memo = hashMapOf<Int, Int>()
fun minCount(N: Int) : Int {
    if (N == 0) {
        return 0
    }
    val countDividableBy9 = dividableTimes(N, 9)
    val countDividableBy6 = dividableTimes(N, 6)
    val maxNinePowed = Math.pow(9.toDouble(), countDividableBy9.toDouble()).toInt()
    val maxSixPowed = Math.pow(6.toDouble(), countDividableBy6.toDouble()).toInt()

    if (memo.contains(N)) {
        return memo.get(N)!!
    }

    val result = Math.min( 1 + minCount(N - maxNinePowed), 1 + minCount(N - maxSixPowed))
    memo.set(N, result)
    return result
}

fun dividableTimes(x: Int, divider: Int) : Int {
    var tmp = x
    var count = 0
    while (tmp / divider >= 1) {
        tmp /= divider
        count++
    }

    return count
}

Measured memory_bytes: 33820
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int Q = Integer.parseInt(sc.next());
		String S = sc.next();
		int l[] = new int[Q];
		int r[] = new int[Q];
		for(int i = 0; i < Q; i++) {
			l[i] = Integer.parseInt(sc.next());
			r[i] = Integer.parseInt(sc.next());
		}
		
		int cnt[] = new int[S.length()];
		for(int i = 0; i < S.length() - 1; i++) {
			if(S.substring(i, i + 2).equals("AC")) {
				cnt[i + 1] = cnt[i] + 1;
			} else {
				cnt[i + 1] = cnt[i];
			}
		}
		
		for(int i = 0; i < Q; i++) {
			System.out.println(cnt[r[i] - 1] - cnt[l[i] - 1]);
		}
	}
}


Measured memory_bytes: 58996
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		System.out.println((a+b+1)/2);
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
	
}


Measured memory_bytes: 21844
import std.stdio,std.string,std.conv;
void main() {
  const tmp = readln.split.to!(long[]);
  const W = tmp[0];
  const H = tmp[1];
  const x = tmp[2];
  const y = tmp[3];
  
  writefln("%f %d", W * H * 0.5, x*2==W && y*2==H?1:0);
}


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

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

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

int main()
{
    int x, y, a, b, c;

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

    std::vector<ll> p(a), q(b), r(c);

    rep(i, a)
    {
        std::cin >> p[i];
    }
    rep(i, b)
    {
        std::cin >> q[i];
    }
    std::sort(std::begin(p), std::end(p), std::greater<>());
    std::sort(std::begin(q), std::end(q), std::greater<>());

    std::vector<ll> pq;

    rep(i, x)
    {
        pq.push_back(p[i]);
    }
    rep(i, y)
    {
        pq.push_back(q[i]);
    }
    std::sort(std::begin(pq), std::end(pq), std::greater<>());
    for (int i = 1; i < pq.size(); ++i)
        pq[i] += pq[i - 1];
    rep(i, c)
    {
        std::cin >> r[i];
    }
    std::sort(std::begin(r), std::end(r), std::greater<>());

    for (int i = 1; i < r.size(); ++i)
        r[i] += r[i - 1];

    ll ans = pq[x + y - 1];

    for (int i = 0; i < x + y - 1 && i < c; ++i)
    {
        ans = std::max(ans, pq[x + y - i - 2] + r[i]);
    }

    if (x + y <= c)
        ans = std::max(ans, r[x + y - 1]);

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 7684
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int maxn = 100000 + 100;
int N, K; ll ans = 0ll;

void Solve()
{
	scanf("%d%d", &N, &K);
	if(K == 0) { printf("%lld\n", 1ll*N*N); return; }
	for(int i = K+1; i <= N; ++i)
	{
		int a = (i-K) * (N/i), b = N-N/i*i-K+1;
		ans += 1ll * (i-K) * (N/i) + max(0, N-N/i*i-K+1);
	}
	printf("%lld\n", ans);
}

int main()
{
	Solve();
}

Measured memory_bytes: 256
package main
import "fmt"
const MOD int64 = 1000000007
func main() {
  var n,x,y,z int
  fmt.Scan(&n,&x,&y,&z)
  w := x+y+z
  u := 1<<uint(w)
  ok := (1<<uint(x+y+z-1))|(1<<uint(y+z-1))|(1<<uint(z-1))
  mem := make([][]int,u)
  for i:=0;i<u;i++ {
    mem[i] = make([]int,10)
    for j:=0;j<10;j++ {
      nxt := (i<<uint(j+1))|(1<<uint(j))
      nxt &= u-1
      if ok&nxt == ok {
        mem[i][j] = -1
      } else {
        mem[i][j] = nxt
      }
    }
  }
  dp := make([]int64,u)
  dp[0] = 1
  for i:=0;i<n;i++ {
    nxt := make([]int64,u)
    for j:=0;j<u;j++ {
      if dp[j] == 0 { continue }
      for k:=0;k<10;k++ {
        m := mem[j][k]
        if m != -1 {
          nxt[m] = (nxt[m]+dp[j])%MOD
        }
      }
    }
    dp = nxt
  }
  sum := dp[0]
  for i:=1;i<u;i++ { sum = (sum+dp[i])%MOD }
  fmt.Println((pow(10,n)+MOD-sum)%MOD)
}
func pow(b int64,n int) int64 {
  if n == 0 { return 1 }
  if n%2 == 0 {
    h := pow(b,n/2)
    return (h*h)%MOD
  }
  return (b*pow(b,n-1))%MOD
}

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

 
int32_t main() {
  ios_base::sync_with_stdio(false);
  int k;string s,s1;
 cin >> k;
 cin >> s;
 if(s.length()>k)
 {
	 s1=s.substr(0,k);
	 cout <<s1<<"...";
	 return 0;
}
cout << s <<"\n";
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
using namespace std;
int main(){
	int x,y;
	while(1){
		cin>>x>>y;
		if(x==0&&y==0)break;
		if(x<=y){
			cout<<x<<" "<<y<<endl;
		}
		else{
			cout<<y<<" "<<x<<endl;
		}
	}
}



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

int main() {
  int N;
  string S;
  bool check = true;
  cin >> N;
  cin >> S;
  if (N % 2 == 1) {
    check = false;
  }
  else {
  	for (int i = 0; i < N / 2; i++) {
    	if (S[i] != S[i + N / 2]) {
          check = false;
        }
     }
  }
  if (check) {
    cout << "Yes";
  }
  else {
    cout << "No";
  }
}

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

int main() {

  string S; cin >> S;
  int price = 700;
  if (S.at(0) == 'o') price += 100;
  if (S.at(1) == 'o') price += 100;
  if (S.at(2) == 'o') price += 100;
  cout << price << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, m;
  cin >> a >> b >> m;
  vector<int> x(a), y(b);
  vector<int> u(m), v(m), c(m);
  for(auto&& t:x)cin >> t;
  for(auto&& t:y)cin >> t;
  for(int i=0;i<m;i++){
    cin >> u[i] >> v[i] >> c[i];
    u[i]--;v[i]--;
  }
  int ans = 100000000;
  for(int i=0;i<m;i++){
    ans = min(x[u[i]] + y[v[i]] - c[i], ans);
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  cout << min(ans, x[0] + y[0]) << endl;
}


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

int main() {
  long long int  n,a,b;
  cin>>n>>a>>b;
  long long int m= n %(a+b);
  long long int ans=a*(n/(a+b));
  
    if(m<=a)ans+=m;
  else{ans+=a;}
  
  cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int X,answer=0;
  cin >> X;
  if (X < 4) {
    cout << 1;
    return 0;
  }
  for (int b = 2; b < X; b++) {
    for (int Y = b*b; Y <= X; Y *= b) {
      answer=max(answer,Y);
    }
  }
  cout << answer;
}

Measured memory_bytes: 3520
N, K, *A = `dd`.split
# = gets.chomp.split.map(&:to_i)
# A = gets.chomp.split.map(&:to_i)
posi = []
nega = []
zeros = 0
# p N
# p K.class
N, K = N.to_i, K.to_i

A.each do |a|
  a = a.to_i
  if a < 0
    nega << a
  elsif a > 0
    posi << a
  else
    zeros += 1
  end
end

posi.sort!
nega.sort!.reverse!

posi_size = posi.size
nega_size = nega.size

zero_pairs = zeros * (zeros - 1) / 2 + zeros * (N - zeros)

ng = -(10**18 + 1)
ok = 10**18 + 1

while ok - ng > 1
  mid = (ok + ng) / 2
  cnt = 0
  
  cnt += zero_pairs if mid >= 0

  if mid > 0
    cnt += nega_size * posi_size
    [posi, nega].each do |a|
      l = 0
      r = a.size - 1
      while l < r
        r -= 1 while l < r && a[l] * a[r] > mid
        cnt += r - l
        l += 1
      end
    end
  else
    r = nega_size - 1
    posi.size.times do |l|
      r -= 1 while(r >= 0 && posi[l] * nega[r] <= mid)
      cnt += nega_size - r - 1
    end
  end

  cnt >= K ? (ok = mid) : (ng = mid)
end

puts ok

Measured memory_bytes: 20724
n, m = map(int, input().split())
rec = []
for i in range(n):
    a, b, c = map(int, input().split())
    rec.append((a, b, c))

R = [-1, 1]
num = 0
for x in R:
    for y in R:
        for z in R:
            tmp = []
            for a, b, c in rec:
                tmp.append(x * a + y * b + z * c)
            tmp = sorted(tmp, reverse=True)
            q = sum(tmp[:m])
            num = max(num, q)

print(num)

Measured memory_bytes: 3268
def is_prime(n):
  for i in range(2, int(n**0.5+1)):
    if n % i == 0:
      return False
  return n != 1

def get_smallest_prime(x):
  while True:
    if(is_prime(x)):
      return x
    x+=1

if __name__ == '__main__':
  x=int(input())
  print(str(get_smallest_prime(x)))
  
  


Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <bits/stdc++.h>
#include <complex.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
using namespace std;

int main()
{
  int a=0;
  string s;
  string t;cin >>s>>t;
  for(int i=0; i<s.size(); i++){
    if(s.at(i)!=t.at(i))
        a++;
  }
  cout<<a<<endl;

}


Measured memory_bytes: 3900
#!/usr/bin/env python3
import sys
import heapq

def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
    l = [(A[i],B[i]) for i in range(N)]
    heapq.heapify(l)
    cost = 0
    while True:
        next = heapq.heappop(l)
        buyCount = min(M,next[1])
        cost += buyCount * next[0]
        M-= buyCount
        if M == 0:
            break
    print(cost)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int()] * (N)  # type: "List[int]" 
    B = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 18248
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;



int main()
{
	/*
		ABC92B問題

	*/
	int a, b, k;
	cin >> a >> b >> k;
	if (2 * k < b - a + 1) {
		for (int i = a; i < a + k; i++) {
			cout << i << endl;
		}

		for (int i = b - k + 1; i < b + 1; i++) {
			cout << i << endl;
		}
	}
	else {
		for (int i = a; i <= b; i++) {
			cout << i << endl;
		}
	}
}

Measured memory_bytes: 256
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Sun Feb  2 10:56:11 2020
//
package main

import "fmt"

var a, b int

func main() {
	fmt.Scan(&a, &b)
	if a < b {
		for i := 0; i < b; i++ {
			fmt.Print(a)
		}
		fmt.Println()
	} else {
		for i := 0; i < a; i++ {
			fmt.Print(b)
		}
		fmt.Println()
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<(int64_t)N;i++)
typedef int64_t LL;
int main()
{
  LL N,K,x,y,z;
  queue<LL> q;
  rep(i,9)q.push(i+1);
  cin>>K;
  rep(i,K)
  {
    x=q.front(),q.pop(),y=x%10,z=10*x+y;
    if(y!=0)q.push(z-1);
    q.push(z);
    if(y!=9)q.push(z+1);
  }
  return cout<<x<<endl,0;
}

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

int main() {
    int N,K;
    cin>>N>>K;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    int ans=0;
    for(int i=0;i<N;i++){
        if(A[i]>=K){
            ans++;
        }
    }
    cout<<ans<<endl;
}


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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int main(){
  ll N,X,M;
  cin>>N>>X>>M;
  ll sumtmp(0),nowtmp(X);
  for(int i(0);i<M;i++){
    sumtmp += nowtmp;
    nowtmp = nowtmp*nowtmp%M;
    if(nowtmp==0) {
      cout << sumtmp << endl;
      return 0;
    }
  }

  int used[100001] = {0};
  ll now = X;
  while(used[now] != 1){
    used[now] = 1;
    now = now*now%M;
  }
  ll cnt(0);
  ll sum(0);
  ll start = now;
  do{
    cnt++;
    now = now*now%M;
    sum += now;
  }while(now != start);
  //cout << now << " " << sum << " " << cnt << endl;
  ll hazime(0),owari(0),hazime_cnt(0);
  now = X;
  while(now != start){
    hazime_cnt++;
    hazime += now%M;
    now = now*now%M;
  }
  now = start;
  for(int i(0);i<(N-hazime_cnt)%cnt;i++){
    owari += now; 
    now = now*now%M;
  }
  ll ans = hazime + sum * ((N-hazime_cnt)/cnt) + owari;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 4000
n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = n - r - g
c = 0
for i in range(n-2):
  for j in range(1,int((n-1-i)/2)+1):
    if s[i] != s[i+j] and s[i] != s[i+j+j] and s[i+j] != s[i+j+j]:
      c += 1
print(r*g*b-c)

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

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

int main() {
    int n;
    std::string s;
    std::cin >> n >> s;
    REP(i, s.size()) {
        char a = s[i] - 'A' + n;
        std::cout << (char) ((a % 26) + 'A');
    }
    std::cout << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int N = sc.nextInt();
        int right = W;
        int left = 0;
        int up = H;
        int down = 0;
        for(int i=0;i<N;i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            int a = sc.nextInt();
            if(a==1) left=Math.max(left,x);
            if(a==2) right=Math.min(right,x);
            if(a==3) down=Math.max(down,y);
            if(a==4) up=Math.min(up,y);
        }
        int ans=Math.max(0,right-left)*Math.max(0,up-down);
        System.out.println(ans);
    }
}


Measured memory_bytes: 23124
n, m = map(int, input().split())
fa = {i: i for i in range(1, n + 1)}
cnt = n

def getfa(x):
	if fa[x] == x:
		return x
	fa[x] = getfa(fa[x])
	return fa[x]

for i in range(m):
	x, y, z = map(int, input().split())
	fx = getfa(x)
	fy = getfa(y)
	if fx != fy:
		cnt -= 1
	fa[fy] = fx

print(cnt)

Measured memory_bytes: 15084
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>

using namespace std;

int maxx=0,minx=100025,c1=0,c2=0,n,x,a[100010];

int max(int a,int b)
{
    if (a>b) return a;
}
int min(int a,int b)
{
    if (a<b) return a;
}

int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++) 
    {
        scanf("%d",&x);
        a[i]=x;
        if (maxx==x) {c1++;continue;} 
        if (minx==x) {c2++;continue;} 
        maxx=max(x,maxx);minx=min(x,minx);
        if (maxx==x) c1=1; 
        if (minx==x) c2=1;
    }
    if (maxx-minx>1) {cout<<"No";return 0;}
    if (maxx==minx) 
    {
        if (minx==n-1) {cout<<"Yes";return 0;}
        if (2*minx<=n){cout<<"Yes";return 0;}
        else {cout<<"No";return 0;}
    }
    else
    {	
        int cnt=0;
        for (int i=1;i<=n;i++) cnt+=(a[i]==minx);
        if (minx<cnt) {cout<<"No";return 0;}
        if (n-cnt<2*(maxx-cnt)) {cout<<"No";return 0;}
        else  {cout<<"Yes";return 0;}
    }
    return 0;
}

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

int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> A(N);
  
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  vector<int64_t> dp(N);
  dp.at(0) = A.at(0);
  int64_t result = 0;
  for (int i = 1; i < N; i++) {
    if (dp.at(i - 1) > A.at(i)) {
      result += dp.at(i - 1) - A.at(i);
      dp.at(i) = dp.at(i - 1);
    }
    else {
      dp.at(i) = A.at(i);
    }
  }
  cout << result << endl;
  return 0;
}

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

map<string, int> ms;

vector<pair<string, int> > v;

bool cmp(pair<string, int> &A, pair<string, int> &B) {
  if(A.second != B.second) return A.second > B.second;
  return A.first < B.first;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin>>n;
  for(int i = 0;i < n;i++) {
    string s;
    cin>>s;
    ms[s]++;
  }
  for(auto x: ms) v.push_back({x.first, x.second});
  sort(v.begin(), v.end(), cmp);
  int val = v[0].second;
  for(auto x: v) {
    if(x.second != val) break;
    cout<<x.first<<'\n';
  }
}

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

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


using namespace std;


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




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

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

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

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

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

	return ans;
}


const int MOD = 1000000007;

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

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


vector<ll> v;
int main() {
	ll ans = 0;
	int N;
	cin >> N;
	REP(i, 3*N) {
		ll a; cin >> a;
		v.pb(a);
	}
	VSORT(v);
	for (int i = 0; i < N; i++) {
		ans += v[3*N - 2 - 2 * i];
	}
	p(ans);
}

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

typedef long long ll;
#define fi first
#define se second


using namespace std;

int main(){
  
  double X;
  
  double num;
  int ans;
  
  cin>>X;
  
  X *= 8.0;
  
  X += 1.0;
  
  //cout<<sqrt( X )<<endl;
  
  
  num = ( (sqrt( X ) - 1)/2.0 );
  ans = num;
  
  
  
  if( (double)ans != num ) ans += 1.0;
  
  cout<<ans<<endl;
  
  return 0;
}

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

using namespace std;

#define ll long long


int main() {
    cin.tie();
    ios_base::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    
    int a, b;
    cin >> a >> b;
    
    string c;
    cin >> c;
    
    if (c == s) a--; else b--;
    
    cout << a << " " << b;
    return 0;
}

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

int parent(int i) {
    return i / 2;
}

int left(int i) {
    return 2 * i;
}

int right(int i) {
    return 2 * i + 1;
}

int main() {
    int H;
    cin >> H;
    vector<int> A(H + 1);
    for (int i = 0; i < H; i++)
        cin >> A[i + 1];

    for (int i = 1; i <= H; i++) {
        cout << "node " << i << ": key = " << A[i] << ", ";
        if (parent(i) >= 1)
            cout << "parent key = " << A[parent(i)] << ", ";
        if (left(i) <= H)
            cout << "left key = " << A[left(i)] << ", ";
        if (right(i) <= H)
            cout << "right key = " << A[right(i)] << ", ";
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3092
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
typedef long long ll;

ll prime[100000] = {0}, cnt = 0;

ll prime_factorization(ll a)
{
    ll i, sq;

    if (a % 2 == 0)
    {
        prime[cnt++] = 2;
        return prime_factorization(a / 2);
    }

    sq = sqrt(a);
    for (i = 3; i <= sq; i += 2)
        if (a % i == 0)
        {
            prime[cnt++] = i;
            return prime_factorization(a / i);
        }

    if (a != 1)
        prime[cnt++] = a;
    return 0;
}

int main(void)
{
    ll n;
    int ans = 0;
    scanf("%lld", &n);
    prime_factorization(n);

    int num = -1, numCnt = 0, ansCnt = 0;
    rep(i, cnt)
    {
        if (num != prime[i])
        {
            ans++;
            ansCnt = 1;
            ;
            num = prime[i];
            numCnt = 0;
        }
        else
        {
            numCnt++;
            if (numCnt > ansCnt)
            {
                ans++;
                ansCnt++;
                numCnt = 0;
            }
        }
    }

    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 2156
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(nullptr)
#define digit(N) cout << fixed << setprecision((N))
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

ll N, ans;

int main()
{
	fast();
	cin >> N;
	for (ll i = 2, M = N, z = 2; i * i <= M && N != 1; z = ++i)
	{
		while (N % z == 0)
			ans++, N /= z, z *= i;
		while (N % i == 0)
			N /= i;
	}

	cout << ans + (N != 1) << "\n";
}


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

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class abc141_f {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    void Gauss(vector<long long> &A) {
        int rank = 0;
        for (int d = 60; d >= 0; --d) {
            int pivot = -1;
            for (int i = rank; i < (int)A.size(); ++i) {
                if (A[i] & (1LL<<d)) {
                    pivot = i;
                    break;
                }
            }
            if (pivot == -1) continue;
            swap(A[rank], A[pivot]);
            for (int j = 0; j < (int)A.size(); ++j) {
                if (j == rank) continue;
                if (!(A[j] & (1LL<<d))) continue;
                A[j] ^= A[rank];
            }
            ++rank;
        }
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int n;
        cin >> n;
        vector<int> a(n);
        REP(i, n) cin >> a[i];

        int s1 = 0;
        REP(i, n) {
            s1 ^= a[i];
        }

        REV(j, 60, 0) {
            int ok = 0;
            REP(i, n) {
                if (a[i] >> j & 1) {
                    ok ^= 1;
                }
            }
            if (ok) {
                REP(i, n) {
                    if (a[i] >> j & 1) {
                        a[i] ^= (1LL << j);
                    }
                }
            }
        }

        Gauss(a);

        int s2 = 0;
        REP(i, n) s2 ^= a[i];
        cout << s1 + 2 * s2 << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    abc141_f solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 1152
N,Y = map(int, input().split())


a = -1
b = -1
c = -1

flag = 0

for i in range(N + 1):
    if flag == 1:
        break
    if  Y - 10000 * i  ==0 and i==N:
        a = i
        b = 0
        c = 0
        flag = 1

    if Y - 10000 * i > 0:
        for j  in range(N+1- i):
                k = N - i -j
                if Y - 10000 * i - 5000 * j - 1000 * k == 0:
                    a = i
                    b = j
                    c   = k
                    flag = 1
                    break


print(str(a) +' '+ str(b) +' '+ str(c))


Measured memory_bytes: 3064
N, M = map(int, input().split())
question = {}
wa = {}
ac_count = 0
wa_count = 0
for i in range(M):
    q, s = input().split()
    question.setdefault(q, '')
    wa.setdefault(q, 0)
    if s == 'AC':
        if question[q] == 'AC':
            continue
        else:
            question[q] = 'AC'
            ac_count += 1
            wa_count += wa[q]
    else:
        wa[q] += 1
print(ac_count, wa_count)


Measured memory_bytes: 23564
import java.io.PrintWriter;
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();

        int ans = 0;
        if (k >= a) {
            ans += a;
            k -= a;
        } else {
            System.out.println(k);
            return;
        }

        if (k >= b) {
            k -= b;
        } else {
            System.out.println(ans);
            return;
        }


        ans -= Math.min(k, c);
        System.out.println(ans);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 35980