akhauriyash/Code-Regression huggingface dataset:
N,K = map(int,input().split())

MAXK = int((N-1)*(N-2)/2)

if K > MAXK:
    print(-1)
    exit()

edge = []

# スターを作成
for i in range(2,N+1):
    edge.append([1,i])

now = 2
node = now + 1
for _ in range(MAXK - K):
    edge.append([now,node])
    node += 1
    if node > N:
        now += 1
        node = now + 1

M = len(edge)
print(M)
for u,v in edge:
    print(u,v)

Measured memory_bytes: 4120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%mod;
    }
    x=x*x%mod;
    n>>=1;
  }
  return ans;
}

int main() {
  ll n,k;
  cin >> n >> k;
  vec c(k+1);
  ll ans=0;
  for(ll i=k;i;i--) {
    c[i]=mpow(k/i,n);
    for(ll j=2;j*i<=k;j++) {
      c[i]=(c[i]-c[j*i]+mod)%mod;
    }
    (ans+=c[i]*i)%=mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4052
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>

using namespace std;

int main(){
	string a;
	cin>>a;
	int n;
	cin>>n;
	for(int i = 0;i < n;i++){
		if(a[i] == '1'){
			continue;
		}else{
			cout<<a[i];
			return 0;
		}
	}
	cout<<"1";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100005
#define NIL -1

using namespace std;

struct Node_struct{
  int p, s, l, r, d;
  Node_struct(){ s = -1; }
};
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX], H[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ", u, T[u].p, T[u].s, T[u].d, D[u], H[u]);

  if(T[u].p == NIL) printf("root");
  else if(T[u].l == NIL && T[u].r == NIL) printf("leaf");
  else printf("internal node");
  printf("\n");
}

void calcHeight(int u, int p){
  if(T[u].l == NIL && T[u].r == NIL){
    H[u] = p;
    if(T[u].p != NIL)calcHeight(T[u].p, p+1);
    return;
  }else{
    if(H[u] < p) H[u] = p;
    if(T[u].p != NIL)calcHeight(T[u].p, p+1);
  }
}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].l == NIL && T[u].r == NIL)calcHeight(u, 0);
  if(T[u].l != NIL) calcDepth(T[u].l, p+1);
  if(T[u].r != NIL) calcDepth(T[u].r, p+1);
}

int main(){
  int i, j;
  int n;
  int id, left, right, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL, T[i].d = 0;

  for(i=0; i<n; i++){
    scanf("%d %d %d", &id, &left, &right);
    if(left != NIL)T[left].p = id, T[left].s = right,T[id].l = left, T[id].d++;
    if(right != NIL)T[right].p = id, T[right].s = left,T[id].r = right, T[id].d++;
  }
  for(i=0; i<n; i++){
    if(T[i].p == -1) {
      root = i;
      break;
    }
  }
  calcDepth(root, 0);
  for(i=0; i<n; i++) print(i);

  return 0;
}



Measured memory_bytes: 4692
//----------------------Shanu Garg here---------------------
//-------------Search on youtube : Shanu Garg---------------
//-Studying at National Institute of Technology Delhi(NITD)-
//---------------------From Delhi, India--------------------

#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define f(i,n) for(auto i=0;i<n;i++)
#define fr(i,n) for(auto i=n-1;i>=0;i--)
#define fs(i,a,b,c) for(auto i=a;i!=b;i+=c)
#define fl(i,x) for(auto i : x)
#define nl cout<<"\n";
#define chk(x) cout<<#x<<x<<" ", nl
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vvi vector<vi>
#define pr pair<ll, ll>
#define vii vector<pair<int, int>>
#define vll vector<pr>
#define vl vector<ll>
#define m(a,b) map<a, b>
#define mid(a,b) ((a+b)/2)
#define pb push_back
#define LCM(a,b) ((a*b)/__gcd(x,y))
const int INF = 0x3f3f3f3f, mod = 1e9 + 7;

class triplet{
    ll f, s, t;};

vl in(ll n){vl v;ll x;
    f(i,n)
    cin>>x, v.pb(x);
    return v;}

vll in_pr(ll n){
    vll ar;
    ll x,y;
    f(i,n)
    {cin>>x>>y;
    ar[i]={x,y};
    }
    return ar;
}
void out(vl v, char ch='\0'){
    fl(i,v)
    cout<<i<<ch;
}

void solve(){
    ll A,B;
    cin>>A>>B;
    (A>9 || B>9) ? cout<<-1 : cout<<A*B;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
   return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007
ll N;
vec(L);
int bin(int value) {
	int left = 0, right = N;
	int mid = (left + right) / 2;
	while (right-left>1) {
		mid = (left + right) / 2;
		if (value<=L[mid]) {
			right = mid;
		}
		else {
			left = mid;
		}
	}

	return mid;
}

int main()
{

	cin >> N;
	fx(N) {
		vecp(L)
	}

	sorts(L)
		ll ans = 0;
	fx(N) {
		fyg(N,x+1) {
			int place = bin(L[x] + L[y]);

			if (place<=y) {
				continue;
			}

			if (L[place]<L[x]+L[y]&& L[x] < L[place] + L[y]&& L[y] < L[x] + L[place]) {
				ans += max(place - y, 0);
				//doublece(x+1,y+1)
			}
			else if(place-1>y&&L[place-1] < L[x] + L[y] && L[x] < L[place-1] + L[y] && L[y] < L[x] + L[place-1]){
				ans += max(place - y - 1, 0);
			}

			
		}
	}
	ce(ans)
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000009
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define rollcall cout<<"I'm Sucu."<<endl
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define int ll


signed main(void){
    int N;
    cin >> N;
    int sum=0,f=1;
    REP(i,log(N)){
        sum+=(N/f)%10;
        f*=10;
    }
    Yes(N%sum==0);
  return 0;
}


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

using namespace std;

const int N = 100005;

int a[N], b[N];
int main() {
    int n, h;
    cin >> n >> h;
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i];
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    reverse(b + 1, b + n + 1);
    int res = h; long long sum = 0;
    for (int i = 0; i <= n; i++) {
        sum += b[i];
        res = min(res, i + max(0, (int)((h - sum + a[n] - 1) / a[n])));
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
n,a,b = map(int,input().split())
if (b-a)%2 == 0:
  print((b-a)//2)
else:
  if a-1 <= n-b:
    ans = a+(b-a-1)//2
  elif a-1 > n-b:
    ans = n-b+1+(b-a-1)//2
    
  print(ans)

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

namespace edamat {
struct RollingHash {  //ローリングハッシュ法
   private:
    static const int mod1 = 1031326447, mod2 = 993766717;
    static const int base1 = 281, base2 = 383;
    ::std::vector<int_fast64_t> hash1, hash2, pow1, pow2;

   public:
    ::std::string str;
    RollingHash(const ::std::string& s) : str(s) {  //初期化
        int sz = (int)s.size();
        hash1.assign(sz + 1, 0);
        hash2.assign(sz + 1, 0);
        pow1.assign(sz + 1, 1);
        pow2.assign(sz + 1, 1);
        for(int i = 0; i < sz; i++) {
            hash1[i + 1] = (hash1[i] * base1 + s[i]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + s[i]) % mod2;
            pow1[i + 1] = pow1[i] * base1 % mod1;
            pow2[i + 1] = pow2[i] * base2 % mod2;
        }
    }
    ::std::pair<int_fast64_t, int_fast64_t> get(int l, int r) {
        int_fast64_t res1 = (hash1[r] - hash1[l] * pow1[r - l]) % mod1;
        int_fast64_t res2 = (hash2[r] - hash2[l] * pow2[r - l]) % mod2;
        if(res1 < 0) res1 += mod1;
        if(res2 < 0) res2 += mod2;
        return {res1, res2};
    }
    int get_lcp(int x,
                int y) {  // LCP S[x:], S[y:]
        int len = ::std::min((int)size() - x, (int)size() - y) + 1;
        int l = 0, r = len;
        while(r - l > 1) {
            int m = (l + r) >> 1;
            if(get(x, x + m) != get(y, y + m))
                r = m;
            else
                l = m;
        }
        return l;
    }
    void add_str(const ::std::string& s) {  // string型を連結
        int ns = (int)str.size(), ms = (int)s.size();
        str += s;
        hash1.resize(ns + ms + 1);
        hash2.resize(ns + ms + 1);
        pow1.resize(ns + ms + 1);
        pow2.resize(ns + ms + 1);
        for(int i = ns; i < ns + ms; i++) {
            hash1[i + 1] = (hash1[i] * base1 + s[i - ns]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + s[i - ns]) % mod2;
            pow1[i + 1] = pow1[i] * base1 % mod1;
            pow2[i + 1] = pow2[i] * base2 % mod2;
        }
    }
    void add_char(const char& c) {  // char型を連結
        str += c;
        hash1.push_back((hash1.back() * base1 + c) % mod1);
        hash2.push_back((hash2.back() * base2 + c) % mod2);
        pow1.push_back((pow1.back() * base1) % mod1);
        pow2.push_back((pow2.back() * base2) % mod2);
    }
    void add_rh(const RollingHash& rh) {  // rhを連結
        add_str(rh.str);
    }
    size_t size() {  // strのsizeを返す
        return str.size();
    }
};
}  // namespace edamat

int main() {
    int N;
    scanf("%d", &N);

    char s[N];
    scanf("%s", s);
    std::string S{s};
    edamat::RollingHash rh(S);

    int ans = 0;
    for(int i = 0; i < N - ans; i++) {
        for(int j = 0; j < i - ans; j++) {
            if(S[i] != S[j]) continue;
            ans = std::max<int>(ans, std::min<int>(rh.get_lcp(i, j), i - j));
        }
    }
    printf("%d\n", ans);
};

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,x,n) for(ll i=x; i<n; ++i)
#define INF LLONG_MAX
using ll = long long;
using ull = unsigned long long;
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) { a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) { a=b; return true;} return false;}

int main() {
  ll N, K; cin >> N >> K;
  vector<ll> h(N), dp(N, INF);
  rep(i,0,N) cin >> h[i];

  dp[0] = 0;
  rep(i, 0, N) {
    rep(k, 1, K+1) {
      if(i+k < N) chmin(dp[i+k], dp[i] + abs(h[i+k]-h[i]));
    }
  }
  cout << dp[N-1] << endl;
}


Measured memory_bytes: 1792
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/

int ar[15][1005];
int32_t main()
{
	fastio();
	int n,m;
	cin>>n>>m;
	int k;
	cin>>k;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			char x;
			cin>>x;
			ar[i][j]=x-'0';
		}
	}
	int res=1e9;
	for(int mask=0;mask<(1<<n);mask++)
	{
		vector<int> v;
		for(int i=0;i<n;i++)v.push_back((mask>>i)%2);
		int flag=1;
		for(int j=0;j<m;j++)
		{
			int cur=ar[0][j];
			for(int i=1;i<n;i++){
				if(v[i]!=v[i-1])
				{
					cur=0;
				}
				cur+=ar[i][j];
				if(cur>k)flag=0;
			}	
		}	
		vector<int> cnt(n,0);
		if(!flag)
		{
			continue;
		}
		int tmp=0;
		for(int j=0;j<m;j++)
		{			
			for(int i=0;i<n;i++)
			{
				cnt[i]+=ar[i][j];
			}
			int f=1;
			int cc=cnt[0];
			if(cc>k)f=0;
			for(int i=1;i<n;i++)
			{
				if(v[i]!=v[i-1])cc=0;
				cc+=cnt[i];
				if(cc>k)f=0;
			}
			if(!f)
			{
				tmp++;
				j--;
				for(int i=0;i<n;i++)cnt[i]=0;
			}
		}
		int changes=0;
		for(int i=1;i<n;i++)
		{
			if(v[i]!=v[i-1])changes++;
		}
		res=min(res,changes+tmp);
	}
	assert(res!=1e9);
	cout<<res<<endl;
}


Measured memory_bytes: 384
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]
AB.sort(key=lambda x:(x[0],x[1]))
#print(AB)

C =set()
for a,b in AB:
  if a == 1:
    C.add(b)
  elif b == N and a in C:
    print('POSSIBLE')
    exit()
print('IMPOSSIBLE')

Measured memory_bytes: 96472
using System;

namespace ConsoleApp21
{
    class Program
    {
        static void Main(string[] args)
        {
            
            string line = Console.ReadLine();
            string[] array = line.Split(' ');
            //体力
            int h = int.Parse(array[0]);
            //必殺技の種類の数
            int n = int.Parse(array[1]);
          

            string li = Console.ReadLine();
            string[] ar = li.Split(' ');

            int[] arr = new int[n];
            for (int index = 0; index < n; index++)
            {
                int num = int.Parse(ar[index]);
                arr[index] = num;
            }

            int sum = 0;
            for (int i = 0; i < arr.Length; i++)
            {
                sum += arr[i];
            }
            if (sum >= h)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 34672
<?php


fscanf(STDIN, "%d", $N);
$ans = [1,1];
for($i=0;$i<$N;$i++){

    fscanf(STDIN, "%d%d", $left, $right);
    if($left <= $right){
        $mul = intdiv($left + $ans[0] - 1, $left);
        $tmp  = $left * $mul;
        if(intdiv($tmp, $left) * $right < $ans[1]){
            $ans[1] = intdiv($right + $ans[1] - 1, $right) * $right;
            $ans[0] = intdiv($ans[1], $right) * $left;
        }else{
            $ans[0] = $tmp;
            $ans[1] = intdiv($tmp, $left) * $right;
        }
    }elseif($left === $right){
        if($ans[0] < $ans[1]){
            $mul = intdiv($left + $ans[0] - 1, $left);
            $ans[0] = $mul * $left;
            $ans[1] = $ans[0];
        }else{
            $mul = intdiv($right + $ans[1] - 1, $right);
            $ans[1] = $mul * $right;
            $ans[0] = $ans[1];
        }
    }else{
        $mul = intdiv($right + $ans[1] - 1, $right);
        $tmp  = $right * $mul;
        if(intdiv($tmp, $right) * $left < $ans[0]){
            $ans[0] = intdiv($left + $ans[0] - 1, $left) * $left;
            $ans[1] = intdiv($ans[0], $left) * $right;
        }else{
            $ans[1] = $tmp;
            $ans[0] = intdiv($tmp, $right) * $left;
        }
    }

}
echo array_sum($ans);

Measured memory_bytes: 4728
#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;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

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

void solve(long long H, long long N, std::vector<long long> A){
  if(accumulate(A.begin(),A.end(),0LL)>=H){
    cout<<YES<<endl;
  }else{
    cout<<NO<<endl;
  }
}

int main(){
  cout<<setprecision(1000);
  cin.tie(0);
  ios::sync_with_stdio(false);
    long long H;
    scanf("%lld",&H);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(H, N, std::move(A));
    return 0;
}


Measured memory_bytes: 1024
//naveen mall
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto& i: a)
#define fl(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define rfl(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        forloop(n){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";cout<<"\n";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define PB                pop_back
#define endl              "\n"
#define copy(a,b)         copy(all(a),back_inserter(b));
#define section(a,b,w)    set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w)      set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define diff(a,b,w)       set_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define symdiff(a,b,w)    set_symmetric_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));

const long long INF64 = 1e18;





void solve()
 { 
   string s,t;
   cin>>s>>t;
   int n=len(s);
   int m=len(t);
   int dp[n+1][m+1]={0};
   memset(dp,0,sizeof(dp));
   //string ans="";
   for(int i=1;i<=n;i++)
   	  {int f=0;
   	  	for(int j=1;j<=m;j++)
   	  		 {  
   	  		 	if(s[i-1]==t[j-1])
   	  		 		{ dp[i][j]=dp[i-1][j-1]+1; f=1;}
   	  		 		else
   	  		 			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
   	  		 }

   	  }
  int idx=dp[n][m];
  string ans="";
  int i=n,j=m;
  while(i>0 and j>0)
  	  {  if(s[i-1]==t[j-1])
  	  	    {
  	  	    	ans=s[i-1]+ans;
  	  	    	i--;j--;
  	  	    }
  	  	    else if(dp[i-1][j] > dp[i][j-1])
  	  	    	   i--;
  	  	    	else
  	  	    		j--;


//cout<<ans<<endl;
  	  }
  	  cout<<ans;


 }



  








 



signed main()
{fast
	int t;
   //cin>>t;
	t=1;

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












Measured memory_bytes: 70656
s = input().split()

s_1 = s[0]
s_2 = s[1]
s_3 = s[2]

S_1 = s_1[0]
S_2 = s_2[0]
S_3 = s_3[0]

print((S_1 + S_2 + S_3).upper())

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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define Unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

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

  int n, k;
  cin >> n >> k;
  int left = 0, right = 0, mid;
  vector<int> x(n);
  arep(i, x) cin >> i, chmax(right, i);
  sort(all(x));
  ++right;

  auto f = [&](int now) {
    int cnt = 0;
    rep(i, 0, n) cnt += ((x[i] - 1) / now);
    return cnt <= k;
  };

  while (right - left > 1) {
    mid = (left + right) / 2;
    if (f(mid))
      right = mid;
    else
      left = mid;
  }

  cout << right << '\n';
  return 0;
}


Measured memory_bytes: 4732
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char b;
	cin>>b;
	if (b=='A')
		cout<<'T';
	if (b=='T')
		cout<<'A';
	if (b=='C')
		cout<<'G';
	if (b=='G')
		cout<<'C';
	return 0;
}

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

int main(void){

  int m = 0, f = 0, r = 0;

  while(m >= 0 || f >= 0 || r >= 0){
    scanf("%d %d %d", &m, &f, &r);
    if(m == -1 && f == -1 && r == -1){
      break;
    }else if(m == -1 || f == -1){
      printf("F\n");
    }else if(m + f >= 80){
      printf("A\n");
    }else if(m + f >= 65){
      printf("B\n");
    }else if(m + f >= 50){
      printf("C\n");
    }else if(m + f >= 30 && r >= 50){
      printf("C\n");
    }else if(m + f >= 30 && r < 50){
      printf("D\n");
    }else if(m + f < 30){
      printf("F\n");
    }
  }
  
  return 0;
}


Measured memory_bytes: 2060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
int h, w;
ll ans = 1e10;
int main(){
	scanf("%d%d", &h, &w);
	rep(i,2){
		ans = min(ans, ll(h % 3 == 0 ? 0 : h));
		for(ll l = 1, r = h-1; l <= r; l++, r--){
			ll a = l * w, b = r * (w/2), c = r * (w - w/2);
			ll temp = max({a,b,c}) - min({a,b,c});
			ans = min(ans, temp);
		}
		swap(w,h);
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
n, m = list(map(int, input().split()))
ss = []
cs = []
for i in range(m):
    s, c = list(map(int, input().split()))
    ss.append(s)
    cs.append(str(c))

ans = ["_"] * n

for s, c in zip(ss, cs):
    # print(f"ans={ans}: s={s}, c={c}")
    if ans[s-1] == "_" or ans[s-1] == c:
        ans[s-1] = c
    else:
        print("-1")
        exit()

if m == 0:
    if n == 1:
        print("0")
    elif n == 2:
        print("10")
    else:
        print("100")
    exit()

if n == 1 and ans[0] == "0":
    print("0")
    exit()

if ans[0] == "0":
    print("-1")
    exit()

if ans[0] == "_":
    ans[0] = "1"

print("".join(ans).replace("_", "0"))


Measured memory_bytes: 3188
#include<iostream>
#include<math.h>
 
using namespace std;

int main(){
    long long st=100;
    long long n=0,cnt=0;
   
 
    cin>>n;
    while(1){
        st=st+st/100;
        cnt++;
        if(st>=n){
            cout<<cnt<<"\n";
            break;
        }
    }
   
    return 0;
}            

Measured memory_bytes: 3636
import sys
from collections import deque

input = sys.stdin.readline


def main():
    S = input().rstrip()
    Q = int(input())
    query = [None] * Q
    for i in range(Q):
        query[i] = input().split()

    prefix = deque()
    surfix = deque()
    prefix_append = prefix.appendleft
    surfix_append = surfix.append
    is_reversed = False
    for q in query:
        if q[0] == "1":
            is_reversed = not is_reversed
        else:
            F, C = q[1], q[2]
            if F == "1":
                if is_reversed:
                    surfix_append(C)
                else:
                    prefix_append(C)
            else:
                if is_reversed:
                    prefix_append(C)
                else:
                    surfix_append(C)

    ans = "".join(["".join(prefix), S, "".join(surfix)])
    if is_reversed:
        ans = ans[::-1]

    print(ans)


if __name__ == "__main__":
    main()


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

const int MAXN = 3e5+5;
const int INF = 1e9+7;
#define ll long long
#define pb push_back
#define endl '\n'
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

ll MOD(ll a){
    return ((a%INF)+INF)%INF;
}

ll inv(ll a){
    return poww(a,INF-2,INF);
}

int h[MAXN],dp[MAXN];

int main()
{
    fast_io;
    //cout << fixed << setprecision(15);

    int n,k;cin >> n >> k;
    for(int i=1;i<=n;++i) cin >> h[i];
    dp[1] = 0;
    for(int i=2;i<=n;++i){
        dp[i] = INF;
        for(int j=i-1;j>=max(1,i-k);--j)
            dp[i] = min(dp[i],dp[j] + abs(h[i] - h[j]));
    }
    cout << dp[n];
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll X;
    cin >> X;
    ll sum=0;
    ll i=0;
    while(sum<X){
        i++;
        sum+=i;
    }
    cout << i;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Solve{
    public int N;
    public int[] x;
    public Solve(){}
    public static int Main(){
        new Solve().Calc();
        return 0;
    }
    void Calc(){
        getinput();
        long[] dp = new long[5000];//2499が0
        for(int i=0;i<N;i++){
            dp[i]=0;
        }
        dp[2499] = 1;
        for(int i=0;i<N;i++){
            long[] dp2 = new long[5000];
            for(int j=0;j<5000;j++){
                if(j-x[i] < 5000 && j-x[i] >= 0){
                    dp2[j] = dp[j]+dp[j-x[i]];
                }
                else{
                    dp2[j] = dp[j];
                }
            }
            dp = dp2;
        }
        Console.WriteLine(dp[2499]-1);
    }
    void getinput(){
        string[] str = Console.ReadLine().Split(' ');
        N = int.Parse(str[0]);
        int A = int.Parse(str[1]);
        str = Console.ReadLine().Split(' ');
        x = new int[N];
        for(int i=0;i < N;i++){
            x[i] = int.Parse(str[i])-A;
        }
    }    
}

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

int main(){
  string s;
  cin >> s;
  bool color;
  int count=0;
  for(int i=0;i<s.size()-1;i++){
    if(s[i]=='B' && s[i+1]=='W')count++;
    else if(s[i]=='W' && s[i+1]=='B')count++;
  }
  cout << count <<endl;
}

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

using namespace std;

vector<vector<vector<int>>> tree;
vector<long long> dist;
int K;

void dfs(int a){
    for(int i=0; i<tree[a].size(); i++){
        int n=tree[a][i][0];
        int d=tree[a][i][1];
        if (dist[n]==0 && n != K){
            dist[n]=dist[a]+d;
            dfs(n);
        }
    }
}

int main(){
    int N, Q;
    cin >> N;
    
    int a, b, c;
    for(int i=0; i<N; i++){
        tree.push_back(vector<vector<int>>());
        dist.push_back(0);
    }
    for(int i=0; i<N-1; i++){
        cin >> a >> b >> c;
        tree[a-1].push_back({b-1, c});
        tree[b-1].push_back({a-1, c});
    }
    
    cin >> Q >> K;
    K--;
    dfs(K);
    int x,y;

    for(int i=0; i<Q; i++){
        cin >> x >> y;
        cout << dist[x-1] + dist[y-1] << endl;
    }
}

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

using namespace std;

int d, n;

int main(){
	scanf("%d%d", &d, &n);
	
	int cool = 1;
	
	for(int i = 0; i < d; i++)
	cool *= 100;
	
	if(n == 100)
	printf("%d\n", cool * (n + 1));
	else
	printf("%d\n", cool * n);
}


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

#define llint long long int
#define pb push_back

using namespace std;
bool fn(int a, int b){
  int a1 = a%10;
  int b1 = b%10;
  return (a1 < b1);
}

int main(){
  int a[5];
  for(int i = 0; i < 5; i++)cin >> a[i];
  sort(a, a+5, fn);
  int ans = 0;
  for(int i = 0; i < 5; i++){
  	if(a[i]%10 == 0){
      ans+= a[i];
      a[i] = -1;
  	}
    else
      break;
  }
  
  int z = 0;
  for(z = 0; z < 5; z++)
    if(a[z] != -1)
      break;
  
  ans += a[z];
  for(int j = z+1; j < 5; j++){
    ans += (a[j] + 10 - a[j]%10);
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  set<ll> s;
  ll a;
  for (int i = 0; i < N; i++) {
    cin >> a;
    s.insert(a);
  }
  cout << s.size() << endl;
  return 0;
}

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

int main() {
	string s;
	cin>>s;
	for(ll i=1;i<4;i++){
		if(s[i-1]==s[i]){
			cout << "Bad";
			return 0;
		}
	}
	cout << "Good";
	// your code goes here
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

vector<pint> g[100001];
int n,ai,bi;
int ans[100001];
int mx=0;
void dfs(int v,int p,int pc){
    int co=0;
    for(auto it:g[v])if(it.first!=p){
        if(pc==co) ++co;
        ans[it.second]=co;
        mx=max(mx,co);
        dfs(it.first,v,co);
        ++co;
    }
}
int main(){
    cin>>n;
    rep(i,n-1){
        cin>>ai>>bi;
        --ai,--bi;
        g[ai].pb(bi,i);
        g[bi].pb(ai,i);
    }
    dfs(0,-1,-1);
    cout<<mx+1<<endl;
    rep(i,n-1) cout<<ans[i]+1<<endl;
    return 0;
}

Measured memory_bytes: 9344
n,p = map(int,input().split())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


a = prime_factorize(p)

from collections import Counter
c = Counter(a)

ans = 1
for i in c:
    ans *= max(1,i**(c[i]//n))

print(ans)

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

int main() {
  int N,K;
  cin >> N >> K;
  string S;
  cin >> S;
  int ans = 0;
  int term = 0;
  int change = 0;
  for (int i=1; i<N; i++) {
    if (S[i-1] != S[i]) {
      change++;
    }
  }
  vector<int> power(change+1,0);
  int place = 0;
  power[0]++;
  for (int i=1; i<N; i++) {
    if (S[i-1] != S[i]) {
      place++;
    }
    power[place]++;
  }
  
  if (S[0] == '0') {
    if (change+1 <= K*2) {
      cout << N << endl;
      return 0;
    }
    place = K*2;
    for (int i=0; i<place; i++) {
      ans += power[i];
    }
    term = ans;
    int left = -1;
    while (place < change+1) {
      if (left != -1) {
        term -= power[left];
      }
      term -= power[left+1];
      if (place+1 == change+1) {
        term += power[place];
        ans = max (term,ans);
        break;
      }
      term += power[place] + power[place+1];
      ans = max (term,ans);
      left += 2;
      place += 2;
    }
  }
  
  if (S[0] == '1') {
    if (change <= K*2) {
      cout << N << endl;
      return 0;
    }
    place = K*2+1;
    for (int i=0; i<place; i++) {
      ans += power[i];
    }
    term = ans;
    int left = 0;
    while (place < change+1) {
      term -= power[left] + power[left+1];
      if (place+1 == change+1) {
        term += power[place];
        ans = max (term,ans);
        break;
      }
      term += power[place] + power[place+1];
      ans = max(term,ans);
      left += 2;
      place += 2;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;

class _0087 {
    public static void Main() {
        Stack<double> s = new Stack<double>();
        double p1, p2;
        string expr;
        string[] ps;
        while((expr = Console.ReadLine())!= null) {
            ps = expr.Split();
            for(int i = 0; i < ps.Length; i++) {
                switch (ps[i]) {
                    case "+":
                        p1 = s.Pop(); p2 = s.Pop();
                        s.Push(p2 + p1); break;
                    case "-":
                        p1 = s.Pop(); p2 = s.Pop();
                        s.Push(p2 - p1); break;
                    case "*":
                        p1 = s.Pop(); p2 = s.Pop();
                        s.Push(p2 * p1); break;
                    case "/":
                        p1 = s.Pop(); p2 = s.Pop();
                        s.Push(p2 / p1); break;
                    default: s.Push(double.Parse(ps[i])); break;
                }
            }
            Console.WriteLine(s.Pop());
        }
    }
}

Measured memory_bytes: 10240
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, M;
	double ANS = 0.0;
	vector<vector<long long> > V;
	vector<double> X;
	vector<vector<pair<double, long long> > > VP;
	cin >> N >> M;
	V.resize(N);
	X.resize(N);
	VP.resize(N);
	for (int i = 0; i < M; i++) {
		long long S, T;
		cin >> S >> T;
		S--, T--;
		V[S].push_back(T);
	}
	X[N - 1] = 0.0;
	for (int i = N - 2; i >= 0; i--) {
		double COUNT = 0.0;
		for (long long next : V[i]) {
			COUNT += X[next];
			VP[i].push_back({ X[next], next });
		}
		X[i] = 1.0 + COUNT / V[i].size();
	}
	ANS = X[0];
	for (int i = 0; i < N; i++) {
		if (VP[i].size() <= 1) continue;
		sort(VP[i].begin(), VP[i].end(), greater<pair<double, long long> >());
		long long max = VP[i][0].second;
		vector<double> Y;
		Y.assign(N, 0.0);
		for (int j = N - 2; j >= 0; j--) {
			double COUNT = 0.0;
			for (long long next : V[j]) {
				if (j == i && next == max) continue;
				COUNT += Y[next];
			}
			Y[j] = 1.0 + COUNT / (V[j].size() - (i == j));
		}
		ANS = min(ANS, Y[0]);
	}
	printf("%.12lf\n", ANS);
}

Measured memory_bytes: 6272
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
using namespace std;

template <int64_t M>
class mint {
public:
        mint() :v(-1) {}
        mint(int n) : v(n % M) {}

        int64_t get() const { return v; }

        mint &operator+=(const mint &r) {
                v = (v + r.v) % M;
                return *this;
        }
        mint &operator-=(const mint &r) {
                v = (v - r.v + M) % M;
                return *this;
        }
        mint &operator*=(const mint &r) {
                v = (v * r.v) % M;
                return *this;
        }
        mint &operator/=(const mint &r) {
                return (*this) *= r.inv();
        }

        mint pow(int r) const {
                mint k = *this, ret = 1;
                while (r > 0) {
                        if (r % 2 != 0) ret *= k;
                        r /= 2;
                        k *= k;
                }
                return ret;
        }

        mint inv() const {
                return pow(M - 2);
        }

private:
        int64_t v;
};

template <int64_t M>
inline mint<M> operator+(mint<M> l, const mint<M> &r) {
        return l += r;
}

template <int64_t M>
inline mint<M> operator-(mint<M> l, const mint<M> &r) {
        return l -= r;
}

template <int64_t M>
inline mint<M> operator*(mint<M> l, const mint<M> &r) {
        return l *= r;
}

template <int64_t M>
inline mint<M> operator/(mint<M> l, const mint<M> &r) {
        return l /= r;
}

template <int64_t M>
inline ostream &operator<<(ostream &os, const mint<M> &r) {
        return os << r.get();
}

typedef mint<1000000007> MINT;

int n, c;
vector<int> as, bs;

MINT powt[401][401];
MINT pt[401][401];

void calc()
{
    for (int i = 0; i < n; i++) {

        for (int j = 0; j <= c; j++) {
            MINT sum = 0;

            for (int k = as[i]; k <= bs[i]; k++) sum += powt[k][j];

            pt[i][j] = sum;
        }
    }
}

MINT tbl[401][401];
bool flg[401][401];

MINT solve(int cur, int rest)
{
    if (cur == n) return rest == 0 ? 1 : 0;

    MINT &ret = tbl[cur][rest];
    if (flg[cur][rest]) return ret;

    flg[cur][rest] = true;
    ret = MINT(0);

    MINT cc = 1;
    for (int i = 0; i <= rest; i++, cc *= as[cur]) {

        ret += solve(cur + 1, rest - i) * pt[cur][i];
    }

    return ret;
}

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

    as.resize(n);
    bs.resize(n);

    for (auto &a: as) cin >> a;
    for (auto &b: bs) cin >> b;

    for (int i = 0; i <= 400; i++) {
        powt[i][0] = MINT(1);
        for (int j = 1; j <= 400; j++) {
            powt[i][j] = powt[i][j-1] * MINT(i);
        }
    }
    calc();

    memset(&flg, 0, sizeof(flg));
    cout << solve(0, c) << endl;

    return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

#include <set>
#include <unordered_map>
#include <stack>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
void YesNo(bool y) { cout << (y ? "Yes" : "No") << endl; }


#define INF 21474836

int A, B;

int main() {

	cin >> A >> B;

	

	vector<int> ans;

	rep(i, 20000) {
		if ((int)(i*0.08) == A)ans.push_back(i);
	}
	
	int anns = -1;
	for (int x : ans) {
		if ((int)(x*0.1) == B) { anns = x; break; }
	}



	cout << anns << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
int main() {
	string c1,c2,c3;
	cin>>c1>>c2>>c3;
	cout<<c1[0]<<c2[1]<<c3[2]<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int i,j,n,l;

cin>>n;
int arr[202];
for(i=1;i<=(2*n);i++){

    cin>>arr[i];
}
sort(arr+1,arr+(2*n+1));

int sum=0;
for(i=1;i<=(2*n);i=i+2){
sum=sum+arr[i];

}
 printf("%d\n",sum);

return 0;
}


Measured memory_bytes: 3752
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::VecDeque;

fn main() {
	input! {
		n: usize,
		abc: [(usize, usize, usize); n-1],
		q: usize,
		k: usize,
		xy: [(usize, usize); q],
	}

	let inf = 9999999999999999999usize;

	let mut node: Vec<Vec<(usize, usize)>> = vec![vec![]; n];
	for i in 0..n-1 {
		node[abc[i].0-1].push((abc[i].1-1, abc[i].2));
		node[abc[i].1-1].push((abc[i].0-1, abc[i].2));
	}

	let mut m: Vec<usize> = vec![inf; n];
	let mut que = VecDeque::new();

	m[k-1] = 0;
	que.push_back(k-1);
	while que.len() > 0 {
		let tmp = que.pop_front().unwrap();
		for i in 0..node[tmp].len() {
			if m[node[tmp][i].0] != inf {
				continue;
			}
			m[node[tmp][i].0] = m[tmp] + node[tmp][i].1;
			que.push_back(node[tmp][i].0);
		}
	}

	for i in 0..q {
		println!("{}", m[xy[i].0-1] + m[xy[i].1-1]);
	}
}



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

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i<n; i++) cin >> p[i];
    sort(p.begin(), p.end());
    reverse(p.begin(), p.end());
    int ans = 0;
    for(int i =0; i< n; i++){
        if(i == 0) p[i] /= 2;
        ans += p[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 3600
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n\r\t', '', _, String).

get_chars(Xs) :-
    get_string(S),
    string_chars(S, Xs).

get_numbers(0, []).
get_numbers(N, [X|Xs]) :- 
    get_number(X), 
    N2 is N - 1, 
    get_numbers(N2, Xs).

get_numbers_2(0, _, []).
get_numbers_2(N1, N2, [X|Xs]) :- 
    get_numbers(N2, X), 
    N12 is N1 - 1, 
    get_numbers_2(N12, N2, Xs).

put_numbers([]).
put_numbers([X|Xs]) :-
    writeln(X),
    put_numbers(Xs).

get_i_to_x_rbtree0(N, T) :-
    rb_empty(T2),
    get_i_to_x_rbtree(N, 0, T2, T).

get_i_to_x_rbtree1(N, T) :-
    rb_empty(T2),
    get_i_to_x_rbtree(N, 1, T2, T).

get_i_to_x_rbtree(0, _, T, T).
get_i_to_x_rbtree(N, I, T2, T) :-
    get_number(X),
    rb_insert(T2, I, X, T3),    
    N2 is N - 1,
    I2 is I + 1,
    get_i_to_x_rbtree(N2, I2, T3, T).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    length(S, L),
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==

    between(L,U,X): L <= X <= U
    nth0(I, Xs, Y), nth1(I, Xs, Y): (Xs,Y) -> I, (I, Xs) -> Y 

    sort(Key, Order, List, Sorted): Keyは通常0?, Orderは=なしが重複削除，=は重複保持
    \+ P(X) : not P(X)

    sum_list(Xs, Sum)

    orは!忘れに注意(末尾再帰なら直前)

    include(f, Xs, Ys) : filter f
*/

include_cmp_x([], _, _, []).
include_cmp_x([X|Xs], F, Y, Zs) :- call(F, X, Y), !, include_cmp_x(Xs, F, Y, Zs2), Zs = [X|Zs2].
include_cmp_x([_|Xs], F, Y, Zs) :- include_cmp_x(Xs, F, Y, Zs).

f(X, T) :- X =< T.
g(X, T) :- X > T.

min_list_by_f([X|Xs], F, Z) :- min_list_by_f(Xs, F, X, Z).
min_list_by_f([], _, C, C).
min_list_by_f([X|Xs], F, C, Z) :- call(F, X, XV), call(F, C, CV), XV < CV, !, min_list_by_f(Xs, F, X, Z). 
min_list_by_f([_|Xs], F, C, Z) :- min_list_by_f(Xs, F, C, Z). 

h((_,X),X).

take(0, _, []) :- !.
take(N, [X|Xs], [Y|Ys]) :- Y = X, N2 is N - 1, take(N2, Xs, Ys).

main :-
    get_number(N),
    get_numbers(N, Xs),
    sum_list(Xs, S),
    findall((T,U), (
            between(1, N, T),
            take(T, Xs, Ys),
            sum_list(Ys, Ys_S),
            U is abs((S - Ys_S) - Ys_S)
        )
    , Ts),
    % writeln(Ts),
    min_list_by_f(Ts, h, (_,Z)),
    writeln(Z).

    % statistics(inferences, IC), writeln(IC).


Measured memory_bytes: 8216
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
string s;
int aa[120];
signed main(){
	cin>>s;
	rep(i,s.size()){
		int a=s[i];
		aa[a]++;
	}
	rep(i,120){
		if(aa[i]%2==1){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}

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

signed main() {

    int ans = 0;
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    for ( int i = 0; i*r <= n; i++ ) {
        for ( int j = 0; j*g <= n; j++ ) {
            if ( i*r+j*g > n ) continue;
            int N = n-i*r-j*g;
            if ( N % b == 0 ) ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9
	final int _intMin = Integer.MIN_VALUE;
	final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18
	final long _longMin = Long.MIN_VALUE;
	static boolean bElapsed = false;

	void solve() {
		int n = readNum();
		int[][] map = new int[2][n];
		int[] ia1 = readNums();
		for (int i = 0; i < n; i++)
			map[0][i] = ia1[i];
		int[] ia2 = readNums();
		for (int i = 0; i < n; i++)
			map[1][i] = ia2[i];
		int mans = 0;
		for (int i = 0; i < n; i++) {
			int ans = 0;
			for (int j = 0; j <= i; j++) {
				ans += map[0][j];
			}
			for (int j = i; j < n; j++) {
				ans += map[1][j];
			}
			mans = max(mans, ans);
		}
		pln(mans);
	}

	int abs(int a) {
		return (a >= 0) ? a : -a;
	}

	int max(int a, int b) {
		return (a > b) ? a : b;
	}

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

	int pint(String s) {
		return Integer.parseInt(s);
	}

	long plong(String s) {
		return Long.parseLong(s);
	}

	String readLine() {
		try {
			return _in.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int readNum() {
		String line = readLine();
		return pint(line);
	}

	String[] readFlds() {
		String line = readLine();
		return line.split(" ");
	}

	int[] readNums() {
		String[] flds = readFlds();
		int[] nums = new int[flds.length];
		for (int i = 0; i < flds.length; i++) {
			nums[i] = pint(flds[i]);
		}
		return nums;
	}

	void p(char c) {
		_out.print(c);
	}

	void pln(char c) {
		_out.println(c);
	}

	void p(double d) {
		_out.print(d);
	}

	void pln(double d) {
		_out.println(d);
	}

	void p(long l) {
		_out.print(l);
	}

	void pln(long l) {
		_out.println(l);
	}

	void p(String s) {
		_out.print(s);
	}

	void pln(String s) {
		_out.println(s);
	}

	static BufferedReader _in;
	static PrintWriter _out;

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		_in = new BufferedReader(new InputStreamReader(System.in));
		_out = new PrintWriter(System.out);
		new Main().solve();
		_out.flush();
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.err.println((end - start) + "ms");
		}
	}
}


Measured memory_bytes: 21076