akhauriyash/Code-Regression huggingface dataset:
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

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

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


#line 2 "tmp.cpp"

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

  double r;
  cin >> r;
  coutd(10) << 2 * r * M_PI << endl;
  return 0;
}


Measured memory_bytes: 3796
#include<iostream>
#define ll long long
#define MOD 1000000007
using namespace std;
int dfs(int& n,int *arr,int k,int *dp)
{
    if(k<0)
        return false;
    if(dp[k]!=-1)
        return dp[k];
   
    bool myjj=false;
    for(int j=0;j<n;j++)
    {
        int temp_stones=k-arr[j];
        if(temp_stones>0)
        myjj=(myjj|(1-dfs(n,arr,temp_stones,dp)));
        else if(temp_stones==0)
            myjj=true;
    }
    dp[k]=myjj;
    return myjj;
}
int main()
{
    int n,k;
    cin>>n>>k;
    int *arr=new int[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];

    int *dp=new int[k+1];
    
        for(int j=0;j<=k;j++)
            dp[j]=-1;
    
    int temp=dfs(n,arr,k,dp);
    if(temp==1)
        cout<<"First"<<endl;
    else
        cout<<"Second"<<endl;
}


Measured memory_bytes: 9632
#include <iostream>
#include <cstring>
#include <cstdio>
#define maxn 105

using namespace std;

char s[maxn][maxn];
int dp[maxn][maxn],n,m;

int main()
{
    scanf("%d%d",&n,&m);
    for (int i=0;i<n;i++) scanf("%s",s[i]);
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
        {
            if (i==1 && j==1)
            {
                if (s[0][0]=='#') dp[1][1]=1;
                continue;
            }
            if (i==1)
            {
                dp[i][j]=dp[i][j-1];
                if (s[i-1][j-1]=='#' && s[i-1][j-2]=='.')  dp[i][j]++;
            }
            else if (j==1)
            {
                dp[i][j]=dp[i-1][j];
                if (s[i-1][j-1]=='#' && s[i-2][j-1]=='.')  dp[i][j]++;
            }
            else
            {
                dp[i][j]=min( (s[i-1][j-1]=='#'&&s[i-2][j-1]=='.')?dp[i-1][j]+1:dp[i-1][j],(s[i-1][j-1]=='#' && s[i-1][j-2]=='.')? dp[i][j-1]+1:dp[i][j-1]);
            }
        }
    printf("%d\n",dp[n][m]);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = int64_t; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }



int main() {
	string s; cin >> s;
	int ans = 0;
	for (auto c : s) ans += (c == '2');
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a, b;
    cin >> a >> b ;
    if (a == 1 || a == 3 || a == 5 || a == 7 || a == 8 || a == 10 || a == 12) {
        if (b == 1 || b == 3 ||b == 5 || b == 7 || b == 8 || b == 10 || b == 12) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    else if (a == 4 || a == 6 || a == 9 || a == 11) {
        if (b == 4 || b == 6 || b == 9 || b == 11) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


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

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

int main() {
    string s;
    vector<int> alpha(26,0);
    while (getline(cin, s)) {
        REP(i, s.size()) {
            if (isalpha(s[i])) {
                alpha[tolower(s[i]) - 'a'] += 1;
            }
        }
    }
    
    char n = 'a';
    REP(i,26) {
        cout << (char)(n + i) << " : " << alpha[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 1184
#include <stdio.h>

#define KI_MAX 212345

int ki[KI_MAX];

void ki_init(void) {
	int i;
	for (i = 0; i < KI_MAX; i++) {
		ki[i] = 1;
	}
}

int ki_root(int x) {
	if (ki[x] > 0) {
		return x;
	} else {
		int root = ki_root(-ki[x]);
		ki[x] = -root;
		return root;
	}
}

int ki_size(int x) {
	return ki[ki_root(x)];
}

void ki_merge(int a, int b) {
	int ar = ki_root(a);
	int br = ki_root(b);
	if (ar != br) {
		int as = ki_size(ar);
		int bs = ki_size(br);
		if (as >= bs) {
			ki[ar] += ki[br];
			ki[br] = -ar;
		} else {
			ki[br] += ki[ar];
			ki[ar] = -br;
		}
	}
}

int main(void) {
	int N, M;
	int i;
	int kotae = 0;
	if (scanf("%d%d", &N, &M) != 2) return 1;
	ki_init();
	for (i = 0; i < M; i++) {
		int A, B;
		if (scanf("%d%d", &A, &B) != 2) return 1;
		ki_merge(A, B);
	}
	for (i = 1; i <= N; i++) {
		int num = ki_size(i);
		if (num > kotae) kotae = num;
	}
	printf("%d\n", kotae);
	return 0;
}


Measured memory_bytes: 2560
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    l=sorted(list(map(int,input().split())))
    k=int(input())
    print(l[2]*2**k+l[0]+l[1])
    
resolve()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A.at(i);
    
    string ans = "YES";
    sort(all(A));
    rep(i,N-1){
        if(A.at(i)==A.at(i+1)){
            ans = "NO";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
/*
 _____ _             _              _           _ 
|_   _| |__   ___   / \   _ __  ___| |__  _   _| |
  | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  | | | | | |  __// ___ \| | | \__ \ | | | |_| | |
  |_| |_| |_|\___/_/   \_\_| |_|___/_| |_|\__,_|_|                                                

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll,ll>
#define msi         map<string,ll>
#define mis         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x) 	for(auto& a : x)
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define max(a,b)	(a>b?a:b)
#define min(a,b)	(a<b?a:b)

/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace __gnu_pbds;
using namespace std;
#define PI 3.141592653589793
#define N  100005

void solve()
{
	string s;
	cin>>s;
	s[1] = (s[1]=='R'?'B':'R');
	cout<<s<<endl;	
	return;
}
int main()
{
	FAST
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	TIME
	return 0;
}

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

int main(void){
  int n;
  scanf("%d",&n);
  char s[n],t[n];
  char ans[2*n];

  scanf("%s%s",s,t);
  int i,j;
for(i=0;i<n;i++){
  ans[2*i]=s[i];
  ans[2*i+1]=t[i];
}
ans[2*n]='\0';
printf("%s",ans);

  return 0;
}


Measured memory_bytes: 128
# by the authority of GOD     author: manhar singh sachdev #

import os,sys
from io import BytesIO, IOBase

def main():
    x,k,d = map(int,input().split())
    if x < 0:
        y = x+k*d
    else:
        y = x-k*d
    if x==0:
        if k%2:
            print(d)
        else:
            print(0)
    elif y*x >= 0:
        print(abs(y))
    else:
        z = abs(x)%d
        z1 = d-abs(x)%d
        if ((abs(x)-z)//d)%2 == k%2:
            print(z)
        else:
            print(z1)

#Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()

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

const int nax= 1e5+5;
vector<int> in_degree(nax), dist(nax,0);
vector<int> edge[nax+1];
std::vector<bool> visited(nax,false);

void dfs(int u)
{
	visited[u]=true;
	for(int v:edge[u])
	{
		dist[v]=max(dist[v],dist[u]+1);
		--in_degree[v];
		if(in_degree[v]==0)
			dfs(v);
	}
}

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

	int u,v;
	for(int i=0;i<m;i++)
	{
		cin>>u>>v;
		edge[u].push_back(v);
		++in_degree[v];
	}
	for(int i=1;i<n+1;i++)
	{
		if(!visited[i] && in_degree[i]==0)
			dfs(i);
	}

	int ans=0;
	for(int i=1;i<n+1;i++)
		ans=max(ans,dist[i]);
	cout<<ans;

	return 0;
}

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

int main()
{
	int n;
	cin >> n;
	int a;
	rep(i, n)
	{
		cin >> a;
		if(a%2==0)
		if(!(a%3==0 || a%5==0))
		{
			cout << "DENIED" << endl;
			return 0;
		}
	}
	cout << "APPROVED" << endl;
	return 0;
}

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

#define pb push_back
#define ll long long int
#define mpi map<int, int>
#define vi vector<int>
#define si set<int>
#define pii pair<int, int>
#define vpi vector<pii>
#define vs vector<string>
#define pri priority_queue<int>
#define mp make_pair
#define ff first
#define ss second
#define mod 10000000007
#define For(i, n) for (int i = 0; i < n; i++)
#define Ford(i, a, b) for (int i = a; i >= b; i--)
#define Rep(i, x, y) for (int i = x; i <= y; i++)
#define mem(a, b) memset(a, b, sizeof(a))
#define fastio                    \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

double tick()
{
    static clock_t oldt, newt = clock();
    double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC;
    oldt = newt;
    return diff;
}
int a[300010], st[100000010];
ll findMod(string num, ll a)
{
    // Initialize result
    ll res = 0;

    // One by one process all digits of 'num'
    for (int i = 0; i < num.length(); i++)
        res = (res * 10 + (int)num[i] - '0') % a;

    return res;
}
int main()
{
    int n;
    ll k, c = 0;
    cin >> n >> k;
    vi a(n);
    For(i, n)
    {
        cin >> a[i];
        a[i]--;
    }
    while (k)
    {
        vi dp(n);
        if (k % 2 == 1)
        {
            c = a[c];
        }
        For(i, n) dp[i] = a[a[i]];
        swap(a, dp);
        k /= 2;
    }

    cout << c + 1 << endl;

    cerr << "execution time is: " << tick() << "\n";
}


Measured memory_bytes: 5284
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
int main(){
  ll mod = 1000000007;
  ll n;
  ll m;
  cin >> n >> m;
  //ll ks=m/(n-1)
  if(n==1){
    cout << (m+1)%mod << endl;
    return 0;
  }
  
  ll sy = m+1;
  ll ma = sy%(n-1);
  ll ks = sy/(n-1);
  //  if(ma)ks++;
  ks++;
  cout << ((((sy+ma)%mod)*(ks%mod))%mod -sy%mod+mod)%mod<< endl;
  //  cout << (m+1)%mod*((m+1)/(n-1))%mod<< endl;
  return 0;
}

  

Measured memory_bytes: 3092
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, k;
  string s;

  cin >> n >> k >> s;

  vector<int> v, a, b;
  char last = s[0];
  int len = 1;
  for(int i = 1; i < s.length(); ++i){
    if(s[i] == last){
      len++;
    }else{
      if(last == '1'){
        v.pb(len);
        a.pb(len);
      }else{
        v.pb(len*-1);
        b.pb(len);
      }
      last = s[i];
      len = 1;
    }
  }
  if(last == '1'){
    v.pb(len);
    a.pb(len);
  }else{
    v.pb(len*-1);
    b.pb(len);
  }


  llong ans = 0;
  if(b.size() <= k){
    REPI(itr,a){
      ans += *itr;
    }
    REPI(itr,b){
      ans += *itr;
    }
    cout << ans << endl;
    return 0;
  }

  int last_idx, idx = 0, cnt = 0;
  llong sum = 0;
  if(v[0] > 0){
    last_idx = 1;
  }else{
    last_idx = 0;
  }
    while(true){
      if(v[idx] > 0){
        sum += v[idx];
      }else{
        sum += v[idx] * -1;
        cnt++;
      }

      idx++;
      if(cnt == k){
        sum += v[idx];
        idx++;
        break;
      }
    }

  ans = max(sum, ans);
  llong tmp = sum;
  while(idx < v.size()){
    tmp -= v[last_idx] * -1;
    //tmp -= v[last_idx+1];
    if(last_idx > 0){
      tmp -= v[last_idx-1];
    }
    last_idx += 2;
    
    tmp += v[idx] * -1;
    idx++;
    //cout << "de" << idx << endl;
    if(idx != v.size()){ 
      tmp += v[idx];
      idx++;
     }
    ans = max(tmp, ans);
    //cout << tmp << endl;
  }

  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1528
#include <iostream>

using namespace std;

int main()
{
    int w,a,b,z;
    cin >> w>> a>> b;
    z=max(a,b)-min(a,b);
    if (z<=w){
        cout << 0;

    }else {
    cout << z-w;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#define int long long
#define il inline 
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
using namespace std;
template <typename T>

inline T read()
{
	T x=0,f=1;char c=getchar();
	while(!isdigit(c))
	{if(c=='-') f=-f;c=getchar();}
	while(isdigit(c))
	{x=(x<<3)+(x<<1)+(c-48);c=getchar();}
	return x*f;
}

#define lint long long int
#define ulint unsigned lint

const int inf=1e9+1e7;
const int MAXN=2e6+1e1;
const int Mod=1e9+7;

lint fac[MAXN];
lint inv[MAXN];

int r1,c1,r2,c2;

lint Ans1,Ans2;

lint qpow(lint A,int B)
{

	lint res=1;

	while(B>0)
	{
		if(B&1) (res*=A)%=Mod;
		(A*=A)%=Mod;
		B>>=1;
	}

	return res;

}

lint C(int A,int B)
{

	return ( A<B ? 0 : (((fac[A]*inv[B])%Mod)*inv[A-B])%Mod );

}

inline int read()
{
	register char cc = getchar(); register int cn(0), flus(1);
	while(cc < '0' || cc > '9') {if(cc == '-') flus = - flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - '0'; cc = getchar();}
	return cn * flus;
}

signed main(void)
{
	r1 = read(), c1 = read(), r2 = read(), c2 = read();
	
	int n=max(c1,c2)+r2+2;

	fac[0]=inv[0]=1;

	for(int i=1;i<=n;i++) fac[i]=(fac[i-1]*i)%Mod;

	inv[n]=qpow(fac[n],Mod-2);

	for(register int i=n;i;i--) inv[i-1]=(inv[i]*i)%Mod;

	rep(i, r1, r2) (Ans1+=C(i+c2+1,i+1))%=Mod;

	rep(i, r1, r2) (Ans2+=C(i+c1,i+1))%=Mod;

	printf("%lld\n",(Ans1-Ans2+Mod)%Mod);

	return 0;

}

Measured memory_bytes: 31488
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		ABC060ASolver solver = new ABC060ASolver();
		solver.main();
	}
}

class ABC060ASolver {
	
	String wordA;
	String wordB;
	String wordC;
	
	public ABC060ASolver() {
		Scanner cin = new Scanner(System.in);
		this.wordA = cin.next();
		this.wordB = cin.next();
		this.wordC = cin.next();
	}
	
	void main() {
		char lastALetter = wordA.charAt(wordA.length() - 1);
		char firstBLetter = wordB.charAt(0);
		char lastBLetter = wordB.charAt(wordB.length() - 1);
		char firstCLetter = wordC.charAt(0);
		
		if (lastALetter == firstBLetter && lastBLetter == firstCLetter) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
	
}

Measured memory_bytes: 21844
#define _FORTIFY_SOURCE 0
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")

#include<bits/stdc++.h>

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define int long long
#define double long double
#define pref pref228
#define left left228
#define right right228
#define x1 x1228
#define y1 y1228
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
mt19937 rnd(time(0));

const int maxn = 3e5 + 7, mod = 1e9 + 7, inf = 1e18;
const double eps = 1e-9, pi = acos(-1);
int n;
int cnt[maxn];           

void solve() {
int x;       
    cin >> n >> x;
    for (int i = 0; i < n; ++i) cin >> cnt[i];
    sort(cnt, cnt + n); 
    int ans = 0;
    for (int i = 0; i < n - 1; ++i) {
        if (x - cnt[i] >= 0) {
            ++ans; 
            x -= cnt[i];
        }
    }
    if (cnt[n - 1] == x) ++ans; 
    cout << ans; 
}                               

signed main() {
//  freopen("", "r", stdin);
//  freopen("", "w", stdout);
#ifdef offline_judge
    freopen("TASK.in", "r", stdin);
    freopen("TASK.out", "w", stdout);
#endif
    srand(time(0));
    cout.precision(10);
    cout << fixed;
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;

vector<int> edges[100001], from[100001];

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

    vector<int> dist(N, 0), par(N, 0), indeg(N, 0);

    REP(i, N - 1 + M){
        int a, b;
        cin >> a >> b;
        a--;b--;
        indeg[b]++;
        edges[a].push_back(b);
        from[b].push_back(a);
    }

    int root = -1;
    REP(i, N) if(indeg[i] == 0) root = i;
    par[root] = -1;
    dist[root] = 0;

    // トポロジカルに処理
    // 入次数が０になったものから処理
    // DAGの最長経路問題
    queue<int> que;
    que.push(root);
    while(que.size()){
        int i = que.front();
        que.pop();
        for(int j : from[i]){
            if(dist[j] + 1 > dist[i]){
                par[i] = j;
                dist[i] = dist[j] + 1;
            }
        }
        // 対象からの辺を削り、入次数が0になったものが次の処理対象
        for(int j : edges[i]){
            indeg[j]--;
            if(indeg[j] == 0) que.push(j);
        }    
    }
    REP(i, N) cout << par[i] + 1 << endl;
    return 0;
}


Measured memory_bytes: 12928
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>




typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)



ll fast_pow(ll x,ll n,ll mod){
    if (n==0) return 1;
    ll res=fast_pow(x*x %mod,n/2,mod);
    if (n&1) res=res*x%mod;
    return res;
}

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;




int main(){
    int n;
    cin>>n;
    vector<tuple<int,int>> v;
    rep(i,n){
        int a;
        cin>>a;
        v.emplace_back(i+1,a);
    }
    sort(v.begin(),v.end(),[](auto x,auto y){
       return get<1>(x) < get<1>(y); 
    });
    rep(i,n){
        cout<<get<0>(v[i])<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 1780
p = Array.new(100020,true)
p[0] = p[1] = false
for i in 2..340
  if p[i]
    for j in 2..100020/i
      p[j*i] = false
    end
  end
end

like_p = Array.new(100020,0)
for i in 1..50000
  like_p[i*2-1] = 1 if p[i*2-1] && p[i]
end

for i in 1..100000
  like_p[i+1] += like_p[i]
end

gets.to_i.times do
  l,r = gets.split.map(&:to_i)
  puts like_p[r]-like_p[l-1]
end

Measured memory_bytes: 3708
import std.stdio;
import std.string;
import std.format;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.concurrency;
import std.traits;
import std.uni;
import std.regex;
import core.bitop : popcnt;
alias Generator = std.concurrency.Generator;

enum long INF = long.max/5;
enum long MOD = 10L^^9+7;

void main() {
  long N;
  scanln(N);
  long[] xs = readln.split.to!(long[]);
  long ans = INF;
  foreach(i; 0..100) {
    long s = 0;
    foreach(x; xs) {
      s += (x - i)*(x - i);
    }
    ans.ch!min(s);
  }
  ans.writeln;
}

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


void times(alias fun)(long n) {
  // n.iota.each!(i => fun());
  foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(long n) {
  // return n.iota.map!(i => fun()).array;
  T[] res = new T[n];
  foreach(ref e; res) e = fun();
  return res;
}

T ceil(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  // `(x+y-1)/y` will only work for positive numbers ...
  T t = x / y;
  if (y > 0 && t * y < x) t++;
  if (y < 0 && t * y > x) t++;
  return t;
}

T floor(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  T t = x / y;
  if (y > 0 && t * y > x) t--;
  if (y < 0 && t * y < x) t--;
  return t;
}

ref T ch(alias fun, T, S...)(ref T lhs, S rhs) {
  return lhs = fun(lhs, rhs);
}
unittest {
  long x = 1000;
  x.ch!min(2000);
  assert(x == 1000);
  x.ch!min(3, 2, 1);
  assert(x == 1);
  x.ch!max(100).ch!min(1000); // clamp
  assert(x == 100);
  x.ch!max(0).ch!min(10); // clamp
  assert(x == 10);
}

mixin template Constructor() {
  import std.traits : FieldNameTuple;
  this(Args...)(Args args) {
    // static foreach(i, v; args) {
    foreach(i, v; args) {
      mixin("this." ~ FieldNameTuple!(typeof(this))[i]) = v;
    }
  }
}

void scanln(Args...)(auto ref Args args) {
  enum sep = " ";
  enum n = Args.length;
  enum fmt = n.rep!(()=>"%s").join(sep);

  string line = readln.chomp;
  static if (__VERSION__ >= 2074) {
    line.formattedRead!fmt(args);
  } else {
    enum argsTemp = n.iota.map!(
      i => "&args[%d]".format(i)
    ).join(", ");
    mixin(
      "line.formattedRead(fmt, " ~ argsTemp ~ ");"
    );
  }
}

// fold was added in D 2.071.0
static if (__VERSION__ < 2071) {
  template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
      static if (S.length < 2) {
        return reduce!fun(seed, r);
      } else {
        return reduce!fun(tuple(seed), r);
      }
    }
  }
}

// popcnt with ulongs was added in D 2.071.0
static if (__VERSION__ < 2071) {
  ulong popcnt(ulong x) {
    x = (x & 0x5555555555555555L) + (x>> 1 & 0x5555555555555555L);
    x = (x & 0x3333333333333333L) + (x>> 2 & 0x3333333333333333L);
    x = (x & 0x0f0f0f0f0f0f0f0fL) + (x>> 4 & 0x0f0f0f0f0f0f0f0fL);
    x = (x & 0x00ff00ff00ff00ffL) + (x>> 8 & 0x00ff00ff00ff00ffL);
    x = (x & 0x0000ffff0000ffffL) + (x>>16 & 0x0000ffff0000ffffL);
    x = (x & 0x00000000ffffffffL) + (x>>32 & 0x00000000ffffffffL);
    return x;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

long long a, b, k;

long long min(long long a, long long b) {
    return (a < b ? a : b);
}

int main() {
    scanf("%lld%lld%lld", &a, &b, &k);
    if (a >= k) a -= k;
    else {
        k -= a;
        a = 0; b -= min(k, b);
    }
    printf("%lld %lld\n", a, b);
}


Measured memory_bytes: 128
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#define MAXN 100005
#define INF 1000000000000000000LL
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> P;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef __gnu_pbds::priority_queue<int,greater<int>,pairing_heap_tag> pq;
ll a,b,c,d,n;
int main()
{
    scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&n);
    ll ans=INF;
    ans=min(ans,c*n);
    ans=min(ans,2*b*n);
    ans=min(ans,4*a*n);
    if(n&1)
    {
        ans=min(ans,n/2*d+min(c,min(2*b,4*a)));
    }
    else ans=min(ans,n/2*d);
    printf("%lld\n",ans);
    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> Asum(N + 1);
    rep(i, N) Asum[i + 1] = Asum[i] + A[i];

    ll ans = LINF;
    rep(i, 1, N) {
        ll left = Asum[i];
        ll right = Asum[N] - left;
        ans = min(ans, abs(left - right));
    }
    write(ans);
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main()
{
    string str;
    cin >> str;
    int n[11];

    for (int i = 0; i < str.size(); i++)
    {
        n[i] = (int)(str[i] - 48);
    }

    int NUM = pow(2, str.size() - 1);
    long long result = 0;
    long long temp = 0;

    for (int i = 0; i < NUM; i++)
    {
        temp = n[0];
        for (int j = 0; j < str.size() - 1; j++)
        {
            if ((i >> j & 0x01) == 1)
            {
                result += temp;
                temp = n[j + 1];
            }
            else
            {
                temp *= 10;
                temp += n[j + 1];
            }
        }
        result += temp;
    }

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
 
#define FOR(i, x, n) for(ll i = x; i < n; i++) 
#define pb push_back
#define pf push_front
#define ll long long
#define hii cout << "hii" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define int ll
#define mpp make_pair
#define endl '\n'
#define ff first 
#define ss second
#define vi vector<int>
#define all(s) s.begin(), s.end()
#define si size()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
 
const int N = 5e5 + 5;
const int mod = 1e9 + 7;
const int INF = 1e15;

int arr[N];
int n, k;
int query = 1;
void print(int ret)
{
    cout << "Case #" << query++ << ": " << ret << endl;
}

bool f(string input)
{
	int s = input.size() - 1;
	int e = 0;
	while(e <= s)
	{
		if(input[s] != input[e]) return 0;
		e++;
		s--;
	}
	return 1;
}

void solve()
{
	string input;
	cin >> input;
	int n = input.size();
	string temp1;
	string temp2;
	for(int i = 0; i < (n - 1) / 2; i++) temp1.push_back(input[i]);
	for(int i = (n - 1 + 4) / 2 - 1; i < n; i++) temp2.push_back(input[i]);
	// trace(temp1, temp2);
	if(f(input) and f(temp1) and f(temp2))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

 
int32_t main()
{	
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	    int t = 1;
	    // cin >> t;
	while(t--)solve();
	return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    cnt = 0
    for _ in range(n):
        d1, d2 = map(int, input().split())
        if d1 == d2:
            cnt += 1
        else:
            cnt = 0
        if cnt == 3:
            print("Yes")
            break
    else:
        print("No")


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9188
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val v = readLine()!!.split(" ").map(String::toInt)

    val oddMap = mutableMapOf<Int, Int>()
    val evenMap = mutableMapOf<Int, Int>()

    v.forEachIndexed { i, e ->
        if (i % 2 == 1) {
            evenMap[e] = evenMap.getOrElse(e, { 0 }) + 1
        } else {
            oddMap[e] = oddMap.getOrElse(e, { 0 }) + 1
        }
    }
    val oddList = oddMap.toList().sortedByDescending { it.second }
    val evenList = evenMap.toList().sortedByDescending { it.second }


    val half = n / 2
    var min = Integer.MAX_VALUE

    val result = if (oddList.first().first != evenList.first().first) {
        oddList.first().second + evenList.first().second
    } else {
        Math.max(
            oddList.first().second + (evenList.getOrNull(1)?.second ?: 0),
            evenList.first().second + (oddList.getOrNull(1)?.second ?: 0)
        )
    }.let { n - it }.let(::println)

}


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())
#define all(a) (a).begin(), (a).end()

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

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;

int main(void){

	int N; cin >> N;

	map<string, int> mp;
	REP(i,N){
		string S; cin >> S;
		mp[S]++;
	}

	printf("AC x %d\n", mp["AC"]);
	printf("WA x %d\n", mp["WA"]);
	printf("TLE x %d\n", mp["TLE"]);
	printf("RE x %d\n", mp["RE"]);


	return 0;

}


Measured memory_bytes: 3676
n, y = list(map(int, input().split(' ')))
for ten_th in range(min(n, int(y / 10000)), -1, -1):
    if y < ten_th * 10000 or n < ten_th:
        continue
    for five_th in range(min(n - ten_th, int((y - ten_th * 10000) / 5000)), -1, -1):
        if y < ten_th * 10000 + five_th * 5000 or n < ten_th + five_th:
            continue
        if (y - ten_th * 10000 - five_th * 5000) % 1000 == 0:
            th = int((y - ten_th * 10000 - five_th * 5000) / 1000)
            if n == ten_th + five_th + th:
                print('{} {} {}'.format(ten_th, five_th, th))
                exit()
print('-1 -1 -1')

Measured memory_bytes: 3064
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi   = vec<int>;
using vvi  = vec<vi>;
using vvvi = vec<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n, k, q;
  cin >> n >> k >> q;
  vi seikai(n,0);
  rep(i,q){
    int ai;
    cin >> ai;
    seikai[ai-1]++;
  }
  rep(i,n){
    if(q-seikai[i]<k) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3724
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

vector<ll> divisor(ll n){
    vector<ll> ret;
    for(int i=1;i<=sqrt(n);i++){
        if(n%i==0){
            ret.pb(i);
            if(i!=n/i)ret.pb(n/i);
        }
    }
    //  sort(all(ret));
    return ret;
}

int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    vector<int> num(100000,0);
    
    rep(i,n)num[v[i]]++;
    
    vector<pii> nums;
    rep(i,100000){
        if(num[i]!=0){
            nums.pb(pii(i,num[i]));
        }
    }
    
    
    
    if(nums.size()==1){
        if(nums[0].first==nums[0].second-1 || nums[0].second%nums[0].first==0)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }else if(nums.size()>=3)cout<<"No"<<endl;
    else{
        pii x = nums[0],y = nums[1];
        vector<ll> a = divisor(x.second);
        vector<ll> b = divisor(y.second);
        
        rep(i,a.size()){
            rep(j,b.size()){
                if( x.first==a[i]+b[j]-(a[i]==x.second) && y.first==a[i]+b[j]-(b[j]==y.second) ){
                   cout<<"Yes"<<endl;
                    return 0;
                }
            }
        }
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 2168
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	int sum=0;
	for(int i=0;i<2;i++){
		if(a>=b){
			sum+=a;
			a--;
		}
		else{
			sum+=b;
			b--;
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)
	x, _ := strconv.Atoi(Scanner())
	y, _ := strconv.Atoi(Scanner())
	z, _ := strconv.Atoi(Scanner())
	k, _ := strconv.Atoi(Scanner())
	a := make([]int, x)
	b := make([]int, y)
	c := make([]int, z)
	for i := 0; i < x; i++ {
		a[i], _ = strconv.Atoi(Scanner())
	}
	for i := 0; i < y; i++ {
		b[i], _ = strconv.Atoi(Scanner())
	}
	for i := 0; i < z; i++ {
		c[i], _ = strconv.Atoi(Scanner())
	}
	t := make([]int, 0)
	for i := 0; i < x; i++ {
		for j := 0; j < y; j++ {
			t = append(t, a[i]+b[j])
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(t)))
	t = t[:smaller(k, len(t))]
	ans := make([]int, 0)
	for i := 0; i < z; i++ {
		for j := 0; j < len(t); j++ {
			ans = append(ans, c[i]+t[j])
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(ans)))
	for i := 0; i < k; i++ {
		fmt.Println(ans[i])
	}
}
func smaller(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}


Measured memory_bytes: 109056
#include<iostream>
#include<queue>
#include<functional>
#include<vector>
#include<algorithm>
using namespace std;

#define WHITE 0LL
#define GRAY 1LL
#define BLACK 2LL
#define MAX_N 500000LL
#define INF 1145141145141919810LL

long long color[MAX_N], X, n, m, h[MAX_N], s, t, u;
vector<pair<long long, long long>>x[MAX_N];
pair<long long, long long>d[MAX_N];

priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, greater<pair<long long, long long>>>Q;

long long dijkstra() {
	for (int i = 0; i < MAX_N; i++) {
		color[i] = WHITE;
		d[i] = make_pair(INF, 0);
	}
	d[1] = { 0,X }; color[1] = GRAY;
	Q.push(make_pair(0LL, 1LL));
	while (!Q.empty()) {
		long long A = Q.top().first;
		long long B = Q.top().second;
		Q.pop();
		color[B] = BLACK;

		if (d[B].first < A*(-1))continue;

		for (int v = 0; v < x[B].size(); v++) {
			long long w = x[B][v].first;

			if (color[w] == BLACK)continue;

			long long S = 0LL;
			long long U = 0LL;
			
			if (d[B].second <= x[B][v].second) {
				U = 0LL;
				S = 2 * x[B][v].second - d[B].second;
			}
			else {
				U = min(d[B].second - x[B][v].second, h[w]);
				S = d[B].second - U;
			}
			
			if (d[w].first > d[B].first + S) {

				d[w].first = d[B].first + S;
				d[w].second = U;
				Q.push(make_pair(d[w].first, w));
				color[w] = GRAY;

			}
		}
	}
	if (d[n].second == 0) {
		return d[n].first + h[n];
	}
	return d[n].first + (h[n] - d[n].second);
}

int main() {
	cin >> n >> m >> X;
	for (int i = 1; i <= n; i++) {
		cin >> h[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> s >> t >> u;
		if (h[s] >= u) {
			x[s].push_back(make_pair(t, u));
		}
		if (h[t] >= u) {
			x[t].push_back(make_pair(s, u));
		}
	}
	long long b = dijkstra();
	if (b < INF) { cout << b << endl; }
	else { cout << "-1" << endl; }
	return 0;
}

Measured memory_bytes: 43384
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <time.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)

void solve()
{
    int n;
    cin >> n;
    cout << n * (n + 1) / 2 << "\n";
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0);
    //freopen(FILE ".in", "r", stdin);freopen(FILE ".out", "w", stdout);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
static const ll LOGN=55;




int main(void) {
  ll N, A, B;
  cin >> N >> A >> B;
  
  ll ans=N/(A+B)*A+min(A, N%(A+B));
  pt(ans);
  
  
  
  
  
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n)   for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(long long i=(a);((a)<(b)?i<=(b):i>=(b));((a)<(b)?++i:--i))
#define SZ(v)      ((int)(v).size())
#define ALL(v)     (v).begin(),(v).end()
#define debug(x)   cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

/*二項係数(mod付き)*/
struct Combination{
	const int mod=1e9+7;
	const int num;				//num:=(要素数). 宣言時に適宜変更する!
	vector<llong> fact,inv,finv;//fact[i]:=(iの階乗),inv[i]:=(iの逆元),finv[i]:=(iの逆元の階乗).
	
	Combination(int num_=51e4):num(num_),fact(num_),inv(num_),finv(num_){
		fact[0]=fact[1]=1LL;
		inv[1]=1LL;
		finv[0]=finv[1]=1LL;
		for(int i=2;i<num;++i){
			fact[i]=fact[i-1]*i%mod;
			inv[i]=mod-inv[mod%i]*(mod/i)%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	
	int nCk(int n,int k){//組み合わせ.
		if(n<k or (n<0 or k<0)) return 0;
		return fact[n]*(finv[k]*finv[n-k]%mod)%mod;
	}
	template<typename Type>
	Type big_nCk(Type n,int k){//nが大きいときに使用.
		if(n<k or (n<0 or k<0)) return 0;
		llong res=1LL;
		REP(i,k) res=res*((n-i)%mod)%mod;
		res=res*finv[k]%mod;
		return (Type)res;
	}
	int nPk(int n,int k){//順列.
		if(n<k) return 0;
		return fact[n]*finv[n-k]%mod;
	}
	int nHk(int n,int k){return nCk(n+k-1,n-1);}//重複組み合わせ.
};

int main(){//組み合わせ.
	int n,k;
	cin>>n>>k;
	
	int kk=n-k;//赤玉の個数.
	
	Combination ob;
	FOR(i,1,k){
		llong red=ob.nCk(kk+1,i);//赤玉と青玉の集合の分け方.
		llong blue=ob.nCk(k-1,i-1);//青玉の分け方.
		int ans=red*blue%MOD;
		
		cout<<ans<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 15112
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextInt();
        long b = in.nextInt();
        long c = in.nextInt();
        long d = in.nextInt();
        long ans = Long.MIN_VALUE;
        ans = Math.max(ans, a*c);
        ans = Math.max(ans, a*d);
        ans = Math.max(ans, b*c);
        ans = Math.max(ans, b*d);
        System.out.println(ans);
    }
}


Measured memory_bytes: 35636
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>
using namespace std;

typedef long long ll;
typedef string S;
typedef pair<int,int> P;
typedef vector<int> vi;
const int mod=1e9+7;


ll numP(ll n){
    if(n==0){
        return 1;
    }else{
        return 2*numP(n-1)+1;
    }
}
ll len(ll n){
    if(n==0){
        return 1;
    }else{
        return 2*len(n-1)+3;
    }
}
ll ans=0;

ll dfs(ll n,ll x){
    if(n==0){
        return 1;
    }
    if(x<=len(n)/2&&x!=1){
        return dfs(n-1,x-1);
    }else if(x==1+len(n)/2){
        return numP(n-1)+1;
    }else if(x>1+len(n)/2&&x!=len(n)){
        return numP(n-1)+1+dfs(n-1,x-len(n)/2-1);
    }else if(x==1){
        return 0;
    }else if(x==len(n)){
        return numP(n-1)*2+1;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,x;
    cin >> n >> x;
    /*
    for(ll i=0;i<=n;i++){
        cout << i << " " << numP(i) << " " << len(i) << endl;
    }
    */
    cout << dfs(n,x) << endl;
    return 0;
}

Measured memory_bytes: 256