akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nm = RArInt();
            int[] vs = RArInt();

            Dictionary<int, int> cards = new Dictionary<int, int>();
            for (int i = 0; i < vs.Count(); i++)
            {
                if (!cards.ContainsKey(vs[i])) cards.Add(vs[i],0);
                cards[vs[i]]++;
            }
            for (int i = 0; i < nm[1]; i++)
            {
                vs = RArInt();
                if (!cards.ContainsKey(vs[1])) cards.Add(vs[1], 0);
                cards[vs[1]]+= vs[0];
            }

            long sum = 0;
            int cnt = 0;
            foreach (var card in cards.OrderByDescending(x => x.Key))
            {
                for (int i = 0; i < card.Value; i++)
                {
                    sum += card.Key;
                    cnt++;
                    if (cnt >= nm[0])
                    {
                        Console.WriteLine(sum);
                        return;
                    }
                }
            }

        }
      
        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}


Measured memory_bytes: 34116
import java.util.*;
public class Main{
    
    static final int MOD = (int)1e9+7;
    static final int MAX = (int)1e6+1;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for(int i=0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
        }
        
        int gcd = gcd(a);
        
        int[] osa_k = osa_k(MAX);
        int[] e = new int[MAX];
        Arrays.fill(e, -1);
        boolean pc = true;
        for(int i=0; i<n; i++){
            while(a[i] != 1){
                int p = osa_k[a[i]];
                if( !(e[p] == -1 || e[p] == i) ){
                    pc = false;
                    break;
                }
                e[p] = i;
                a[i] /= p;
            }
            if(!pc) break;
        }
        
        if(pc && gcd==1){
            System.out.println("pairwise coprime");
        }else if(gcd==1){
            System.out.println("setwise coprime");
        }else{
            System.out.println("not coprime");
        }
        
    }
    
    static int gcd(int a, int b){
        if(a < b){
            return gcd(b, a);
        }
        if(b > 0){
            return gcd(b, a%b);
        }
        return a;
    }
    
    static int gcd(int[] a){
        int res = a[0];
        for(int i=1; i<a.length; i++){
            res = gcd(res, a[i]);
        }
        return res;
    }
    
    static public int[] osa_k(int max){
        int[] res = new int[max];
        for(int i=0; i<max; i++){
            res[i] = i;
        }
        for(int i=2; i*i<max; i++){
            if(res[i] < i) continue;
            for(int j=i*i; j<max; j+=i){
                if(res[j] == j){
                    res[j] = i;
                }
            }
        }
        return res;
    }
}


Measured memory_bytes: 62696
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
			        // 文字数
		
		      		int ac = 0;
		      		int wa = 0;
		      		int tle = 0;
		            int re = 0;
		      		for (int i = 0; i < N+1; i++) {
		              String S = sc.nextLine();
					  if(S.equals("AC")) {
		                ac++;
		              }else if(S.equals("WA")) {
		                wa++;
		              }else if(S.equals("TLE")) {
		                tle++;
		              }else if(S.equals("RE")){
		                re++;
		              }
		            }
		              System.out.println("AC x " + ac);
		              System.out.println("WA x " + wa);
		              System.out.println("TLE x " + tle);
		              System.out.println("RE x " + re);
    }
}

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

    #define ll long long
    #define ff first
    #define ss second
    #define pb push_back
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define MOD 1000000007
    #define pll pair<ll,ll>
constexpr ll INF = 1999999999999999997; 
    #define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
    int main() {
        fastio;

        int d,s,t;
        cin>>d>>t>>s;
        if(d<=s*t)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }

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

using namespace std;

int main()
{
    string s,p;
    cin>>s>>p;
    int n=s.length(),m=p.length();
    int dp[n+1][m+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            if(i==0||j==0)
            {
                dp[i][j]=0;
            }
            else if(s[i-1]==p[j-1])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else
            {
                dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
            }
        }
    }
    string res;
    int i=n,j=m;
    while(i>0&&j>0)
    {
        if(s[i-1]==p[j-1])
        {
            res+=s[i-1];
            i--;
            j--;
        }
        else if(dp[i-1][j]>dp[i][j-1])
        {
            i--;
        }
        else
        {
            j--;
        }
    }
    reverse(res.begin(),res.end());
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 38820
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k,ans=0;
    cin>>n>>k;
    if(n>=k)ans=n%k;
    else if(n<k) ans=1;
    if(ans!=1 && ans!=0)ans=ans/ans;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
A_oddList = A[::2]
A_evenList = A[1::2]
A_oddList = A_oddList[::-1]
A_evenList = A_evenList[::-1]

if N % 2 == 1:
    A_evenList = A_evenList[::-1]
    print(*A_oddList , end = " ")
    print(*A_evenList)
else:
    A_oddList = A_oddList[::-1]
    print(*A_evenList , end = " ")
    print(*A_oddList)


Measured memory_bytes: 26360
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
#define pb push_back

using ll = long long;
using namespace std;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
const int INFint = 1e9;
const ll INFll = 1e18;
ll MOD=1e9+7;

ll gcd(ll a, ll b) { return __gcd(a,b); } //最大公約数
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; } //最大公倍数

// aのn乗をMODで割りながら計算する
ll modpow(ll a, ll n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1; // right shift
  }
  return res;
}

// MODを法としたaの逆元を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}
int N;
int main(){
  ll N,K,x[100000];
  cin>>N>>K;
  rep(i,N) cin>>x[i];
  vector<int> dai,syou;
  rep(i,N){
    if (x[i] >= 0) {
      dai.push_back(x[i]);
    }else{
      syou.push_back(x[i]);
    }
  }
  reverse(syou.begin(),syou.end());
  ll ans(1e18);
  for (int i(-1);i<min(ll(dai.size()),K);i++){
    ll dai_size;
    if (i == -1){
      dai_size = 0;
    }else{
      dai_size = dai[i];
    }
    ll syou_size;
    if (K-i-2 < int(syou.size())){ 
      if(i != K-1){
        syou_size = abs(syou[K-i-2]);
      }
    }else{
      continue;
    }
    ans = min(ans,min(dai_size*2+syou_size,dai_size + 2*syou_size));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1788
/*
*/

#include<stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	int a[100],i,j,minj,temp,sum=0;
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<n;i++){
		minj=i;
		for(j=i;j<n;j++){
			if(a[j]<a[minj])minj=j;	
		}
		if(minj!=i){
		
		temp=a[i];
		a[i]=a[minj];
		a[minj]=temp;
		sum++;
		}
	}
	for(i=0;i<n-1;i++){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[i]);
	printf("%d\n",sum);
	}


Measured memory_bytes: 2112
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[100010];
    rep(i, N) cin >> A[i];
    ll ans = 0;
    rep(i, N) {
        
        if(i != 0) {
            if(A[i - 1] > 0 && A[i] > 0) {
                A[i]--; ans++;
            }
        }
        ans += A[i] / 2;
        A[i] %= 2;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < 9; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                int a = int.Parse(input[1]);
                int b = int.Parse(input[2]);

                sb.Append(input[0] + " ");
                sb.Append((a + b).ToString() + " ");
                sb.AppendLine((a * 200 + b * 300).ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
   string s,t;
   cin>>s>>t;
   for(char ch='a';ch<='z';ch++)
   {
       if(s+ch==t)
       {
           cout<<"Yes"<<endl;
           return 0;
       }

   }
     cout<<"No"<<endl;



}







Measured memory_bytes: 3596
class UnionFind(object):
    def __init__(self, N):
        self.parent = [-1] * N #parent[i] は(i+1)番目の要素が含まれる要素数の(-1)倍
    #要素が負-->その数を親とするグループに属する要素の数×(-1)
    #要素が正-->親のindex

    #Aがどのグループに属しているかを調べる
    def root(self, A):
        if self.parent[A-1] < 0: #負の数-->その数は親
            return A
        self.parent[A-1] = self.root(self.parent[A-1]) #負では無い時、親の場所が入っているから、親が属しているグループを、自分自身に入れる(一度確認したところは直接親を見れるようにする)
        return self.parent[A-1] #親の位置を返す

    #Aが含まれているグループに属している数を返す
    def size(self, A):
        return -1 * self.parent[self.root(A)-1]

    #AとBをくっ付ける
    def connect(self, A, B):
        A = self.root(A) #Aを含むグループの親を返す
        B = self.root(B) #Bを含むグループの親を返す
        if A == B: #親が同じならなにもしない
            return False
        
        #大きい方(A)に小さい方(B)をつなぎたい
        if self.size(A) < self.size(B): #大小関係が逆の時は入れ替える
            A, B = B, A
        
        self.parent[A-1] += self.parent[B-1] #大きい方に小さい方を加える　（負の数＋負の数 = 新しいグループに含まれる数×(-1)）
        self.parent[B-1] = A #加えられた親の値を、加えた先の親の位置に書き変える
        return True
    
    def same(self, A, B):
        if self.root(A) == self.root(B):
            return True
        else:
            return False
            
# N, Q = map(int, input().split())
# uni = UnionFind(N)
# for _ in range(Q):
#     P, A, B = map(int, input().split())
#     if P == 1:
#         if uni.root(A) == uni.root(B): #親が同じかどうか
#             print ('Yes')
#         else:
#             print ('No')
#     else:
#         uni.connect(A, B)


import sys
input = sys.stdin.readline

N, M = map(int, input().split())

uni = UnionFind(N + 1)
for _ in range(M):
    A, B = map(int, input().split())
    uni.connect(A, B)

ans = 0
for i in range(1, N + 1):
    ans = max(ans, uni.size(i))

print (ans)

Measured memory_bytes: 14648
#include <stdio.h>
#include <stdlib.h>

int main(){
    int n;
    scanf("%d",&n);
    for(int i=0; i<9; i++){
        if(111*i < n && n <= 111*(i+1)){
            printf("%d\n",(i+1)*111);
            break;
        }
    }
    return 0;
}

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

int need(int current_score, int needed){
    
    int res = 0;
    while(current_score < needed){
        res += 1;
        current_score <<= 1;
    }
    
    return res;
    
}



double solve(int n, int k){
    
    double first_part = (1/(double)n);
    
    double total = 0;
    for(int i = 1; i <= n; i++){
        int heads_needed = need(i, k);
        double second_part = pow(0.5, heads_needed);
        total += second_part;
    }
    
    return first_part*total;
    
}




int main(){
    
    int n, k;
    cin >> n >> k;
    
    cout << setprecision(9) ;
    
    cout << solve(n, k) << endl;
    
    
}


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

int main() {
    int A, B;
    cin >> A >> B;
    cout << A * B - A - B +1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int vis[100100];
int main()
{
    memset(vis,0,sizeof(vis));
    int a,b;
    int ans,sum=0;
    scanf("%d %d",&a,&b);
    if(b<10) ans=1;
    else if(b<100) ans=2;
    else ans=3;
//    cout<<ans<<endl;
    if(ans==1)
    {
        sum=a*10+b;
    }
    else if(ans==2)
    {
        sum=a*100+b;
    }
    else sum=a*1000+b;
    bool flag=false;
//    cout<<sum<<endl;
    for(int i=1;i*i<=sum;i++)
    {
        if(i*i==sum)
        {
            flag=true;
            break;
        }
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 640
// Created by 
// 
//  ████████╗██╗███╗   ███╗ ██████╗ ████████╗██╗  ██╗██╗   ██╗██╗  ██╗
//  ╚══██╔══╝██║████╗ ████║██╔═══██╗╚══██╔══╝██║  ██║╚██╗ ██╔╝╚██╗██╔╝
//     ██║   ██║██╔████╔██║██║   ██║   ██║   ███████║ ╚████╔╝  ╚███╔╝ 
//     ██║   ██║██║╚██╔╝██║██║   ██║   ██║   ██╔══██║  ╚██╔╝   ██╔██╗ 
//     ██║   ██║██║ ╚═╝ ██║╚██████╔╝   ██║   ██║  ██║   ██║   ██╔╝ ██╗
//     ╚═╝   ╚═╝╚═╝     ╚═╝ ╚═════╝    ╚═╝   ╚═╝  ╚═╝   ╚═╝   ╚═╝  ╚═╝
//  

#include<bits/stdc++.h>

using namespace std;

#define fastIO(); ios_base::sync_with_stdio(false); cin.tie(NULL);
#define dbg(x); cout<<"\n"<<#x<<": "<<x;
#define MOD 100000007
#define ret return
#define UC 100007
#define dt long int
#define pf printf
#define sf scanf

typedef vector<long long int> vlli;
typedef vector<long int> vli;
typedef vector<int> vi;
typedef vector<dt> vdti;
typedef vector<unsigned int> vui;
typedef unsigned int ui;    //  0 to e9
typedef long int li;    // e-18 to e18  
typedef long long int lli;  //  e-18 to e18
typedef unsigned long int uli;  // 0 to e19 
typedef unsigned long long int ulli;    //  0 to e19

int main(){
    fastIO();
    dt n,sum(0);
    cin>>n;
    for(dt i=1;i<n+1;i++){
        if(i%15 && i%3 && i%5)  sum+=i;
    }
    cout<<sum;
	ret 0; 
}       


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[][] array = new long[2][200001];
		int[] A = new int[n];
		for(int i=0;i<n;i++) 	A[i]=sc.nextInt();
		for(int i=0;i<n;i++) 	array[0][A[i]]++;
		for(int i=0;i<=200000;i++) {
			if(array[0][i]!=0) array[1][i]=comb(array[0][i]);
		}
		long sum=0;
		for(int i=0;i<=200000;i++) sum+=array[1][i];
		long S=sum;
		for(int i=0;i<n;i++) {
			if(array[0][A[i]]>=1) {
				S-=(array[0][A[i]]-1);
			}
			System.out.println(S);
			S=sum;
		}
	}

	public static long comb(long n) {
		return n*(n-1)/2;
	}
}

Measured memory_bytes: 98128
#include<stdio.h>
#include<string.h>
int main(void)
{
    char s[1001],t[1001];
    int i,j,cnt,mincnt=10000,sl,tl;
    scanf("%s%s",s,t);
    sl=strlen(s);
    tl=strlen(t);
    for(i=0;i<sl;i++){
        if(sl<i+tl) break;
        cnt=0;
        for(j=0;j<tl;j++){
            if(s[i+j]!=t[j]) cnt++;
            //printf("%c %c\n",s[i+j],t[j]);
        }
        //printf("\n");
        if(mincnt>cnt) mincnt=cnt;
        //printf("%d\n",mincnt);
    }
    printf("%d\n",mincnt);
    return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
using namespace std;
template<class S,class T> inline S chmax(S &a,T b)
{
	if(a<b)
	{
		a=b;
	}
	return a;
}
int X;
int Y;
char S[2000][2002];
int dp1[2000][2000];
int dp2[2000][2000];
int dp3[2000][2000];
int dp4[2000][2000];
int main()
{
	int i,j,res;
	cin >> X;
	cin >> Y;
	int ii;
	for(ii=0;ii<X;ii++)
	{
		scanf("%s",&S[ii]);
	}
	for(i=0;i<X;i++)
	{
		for(j=0;j<Y;j++)
		{
			dp1[i][j]=dp2[i][j]=1;
			if(i-1>=0)
			{
				dp1[i][j]+=dp1[i-1][j];
			}
			if(j-1>=0)
			{
				dp2[i][j]+=dp2[i][j-1];
			}
			if(S[i][j]=='#')
			{
				dp1[i][j]=dp2[i][j]=0;
			}
		}
	}
	for(i=X-1;i>=0;i--)
	{
		for(j=Y-1;j>=0;j--)
		{
			dp3[i][j]=dp4[i][j]=1;
			if(i+1<X)
			{
				dp3[i][j]+=dp3[i+1][j];
			}
			if(j+1<Y)
			{
				dp4[i][j]+=dp4[i][j+1];
			}
			if(S[i][j]=='#')
			{
				dp3[i][j]=dp4[i][j]=0;
			}
		}
	}
	res=0;
	for(i=0;i<X;i++)
	{
		for(j=0;j<Y;j++)
		{
			chmax(res,dp1[i][j]+dp2[i][j]+dp3[i][j]+dp4[i][j]-3);
		}
	}
	cout << res;
	return 0;
}

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

const int maxn=55;

int n,m,dfn[maxn],low[maxn],tim,par[maxn],ans;
vector<int> e[maxn];

inline void tarjan(int u,int fa)
{
	par[u]=fa;
	dfn[u]=low[u]=++tim;

	for(int i=0;i<e[u].size();i++)
	{
		int v=e[u][i];

		if(!dfn[v])
		{
			tarjan(v,u);
			low[u]=min(low[u],low[v]);
		}
		else if(v!=fa) low[u]=min(low[u],dfn[v]);
	}
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int u,v;scanf("%d%d",&u,&v);
		e[u].push_back(v);
		e[v].push_back(u);
	}

	tarjan(1,0);

	for(int i=2;i<=n;i++) if(low[i]>dfn[par[i]]) ans++;
	printf("%d",ans);

	return 0;
}

Measured memory_bytes: 3824
H, W = map(int,input().split())
P = [input() for _ in range(H)]
S = ""
for i in range(W+2):
    S = S+"#"
for i in range(H+2):
    if i == 0 or i == H+1:
        print(S)
    else:
        print("#"+P[i-1]+"#")
        

Measured memory_bytes: 3060
import numpy as np

n = int(input())
s = np.array([list(ord(e) - ord("a") for e in input()) for _ in range(n)], np.int8)

ans = 0
for _ in range(n):
    s = np.roll(s, 1, axis=1)
    if (s == s.T).all():
        ans += n

print(ans)


Measured memory_bytes: 15308
using System;

class Program
{
    static void Main(string[] args)
    {
        var ny = Console.ReadLine().Split(' ');
        var n = int.Parse(ny[0]);
        var y = int.Parse(ny[1]) / 1000;

        for (int i = 0; i <= y / 10; i++)
        {
            for (int j = 0; j <= (y - i * 10) / 5; j++)
            {
                var k = y - i * 10 - j * 5;
                if (i + j + k == n)
                {
                    Console.WriteLine($"{i} {j} {k}");
                    return;
                }
            }
        }

        Console.WriteLine("-1 -1 -1");
    }
}


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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    vector<ll> a(n);
    ll sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    sort(all(a));
    if(sum%10!=0){
        cout<<sum<<endl;
        return 0;
    }
    else{
        rep(i,n) if(a[i]%10!=0){
            cout<<sum-a[i]<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<climits>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n; cin >> n;
  bool flag = true;
  for(int i=0;i<n;i++){
    int a; cin >> a;
    if(a%2!=0) continue;
    else{
      if(a%3!=0 && a%5!=0) flag = false;
    }
  }
  if(flag)cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>

//#define int long long

using namespace std;

void Main()
{
	int N;
	cin >> N;
	vector<int> p(N);
	vector<int> p_after(N);
	for (int i = 0; i < N; i++) {
		cin >> p[i];
		p_after[i] = p[i];
	}
	sort(p_after.begin(), p_after.end());
	int diffnum = 0;
	for (int i = 0; i < N; i++) {
		if (p[i] != p_after[i]) {
			diffnum++;
		}
	}

	if (diffnum > 2) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}
}

int32_t main()
{
	Main();
	return 0;
}

/*
void sample()
{
	vector<int> v;
	sort(v.begin(), v.end());
	sort(v.begin(), v.end(), greater<int>());

}
*/



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

int main()
{
    ll x,d,k,need;
    cin>>x>>k>>d;
    need=abs(x)/d;
    if(need>k)
    {
        if(x<0)printf("%lld\n",abs(x+(k*d)));
        else printf("%lld\n",x-(k*d));
    }
    else
    {
        ll baki=abs(x)%d;
        if(baki==0)
        {
            k-=need;
            if(k&1)printf("%lld\n",d);
            else printf("0\n");
        }
        else
        {
            k-=need;
            if(k&1)printf("%lld\n",abs(baki-d));
            else printf("%lld\n",baki);
        }
    }
    return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  vector<vector<pii>> data(n);
  rep(i,n){
    int a;
    cin >> a;
    rep(j,a){
      int x,y;
      cin >> x >> y;
      data.at(i).push_back(pii(x-1,y));
    }
  }
  int ans = 0;
  for(long tmp=0; tmp < (1 << n); tmp++){
    bitset<15> s(tmp);
    bool flag = false;
    rep(i,n){
      if(s.test(i)){
        rep(j,data.at(i).size()){
          pii P = data.at(i).at(j);
          int x = P.first;
          int y = P.second;
          if((s.test(x) && (y == 0)) || (!s.test(x) && (y == 1))){
            flag = true;
            break;
          }
        }
        if(flag) break;
      }
    }
    if(!flag){
      int p = s.count();
      ans = max(ans,p);
    }
  }
  cout << ans << endl;
}


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

int main(){
    int n;
    cin >> n;
    vector <long> a(n);
    vector <long> add(n);
    long min;
    long total;
    cin >> a[0];
    add[0] = a[0];
    for(int i = 1 ; i < n ; i++){
        cin >> a[i];
        add[i] = add[i-1] + a[i];
    }
    min = abs(add[0] - (add[n-1] - add[0]));
    for(int i = 1 ; i < n-1 ; i++){
        total = abs(add[i] - (add[n-1] - add[i]));
        if(min > total){
            min = total;
        }
    }

    cout << min << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <map>
#define REP(i,m,n) for(int i = (int)(m) ; i < (int) (n);i++)
#define rep(i,n) REP(i , 0 ,n)
using namespace std;

int n, d[1000002];
int x;


int main() {
	cin >> n;
	rep(i, n) cin >> d[i];
	sort(d, d + n);
	x = n / 2 - 1;
	cout << d[x + 1] - d[x] << endl;

	return 0;
}

Measured memory_bytes: 640
from sys import stdin

n=int(input())
s=input()
r=0
g=0
b=0
for i in range(n):
    if s[i]=='R':
        r+=1
    if s[i]=='G':
        g+=1
    if s[i]=='B':
        b+=1
ans=r*g*b
for i in range(n):
    for j in range(n):
        now1=i+j
        now2=i+j+j
        if now2>=n:
            continue
        if(s[i]!=s[now1] and s[now1]!=s[now2] and s[now2]!=s[i]):
            ans-=1
print(str(ans)+"\n")


Measured memory_bytes: 68076
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P;
typedef vector<int> Vi;
int const MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { return a = b; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { return a = b; } return false; }
 
int main(){
    cin.tie(0); ios::sync_with_stdio(false);
   
    string s; cin>>s; int n=s.size();
    int gu=0,pa=0,ans=0;
    for (int i = 0; i < n; i++){
        if(s[i]=='g'){
            if(gu>pa){ans++; pa++;}
            else gu++;
        }else{
            if(gu>pa)pa++;
            else {ans--; gu++;}
        }
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,M;
  cin >> N >> M;
  while(N != 0){
    vector<int> A(N);
    int sum_n=0;
    rep(i,N){
      cin >> A[i];
      sum_n += A[i];
    }
    vector<int> B(M);
    int sum_m=0;
    rep(i,M){
      cin >> B[i];
      sum_m += B[i];
    }
    int ans_n=-1,ans_m=-1;
    int mn = inf;
    for(int i=0; i<N; i++){
      for(int j=0; j<M; j++){
        if(sum_n-A[i]+B[j] == sum_m-B[j]+A[i]){
          if(chmin(mn,A[i]+B[j])){
            ans_n = A[i];
            ans_m = B[j];
          }
        }
      }
    }
    // cout << sum_n << endl;
    // rep(i,N){
    //   cout << A[i] << " ";
    // }
    // cout << endl;
    // cout << sum_m << endl;
    // rep(i,M){
    //   cout << B[i] << " ";
    // }
    // cout << endl;
    if(ans_n != -1){
      cout << ans_n << " " << ans_m << endl;
    }else{
      cout << -1 << endl;
    }
    cin >> N >> M;
  }
  return 0;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
 
int gcd(int a, int b)
{
  if (b == 1)
    return (1);
  else if (b == 0)
    return (a);
  else 
    return gcd(b, a % b);
}
 
int main()
{
  int K;
  cin >> K;
  long long ans = 0;
  
  for (int i = 1; i <= K; i++)
  {
    for (int j = 1; j <= K; j ++)
    {
      for (int k = 1; k <= K; k++)
      {
        ans += gcd(gcd(i, j), k);
      }
    }
  }
  cout << ans << endl;

  
}

Measured memory_bytes: 3620
A, B, C, D = list(input())
op = ['+', '-']

for i in range(len(op)):
    for j in range(len(op)):
        for k in range(len(op)):
            op1 = op[i]
            op2 = op[j]
            op3 = op[k]
            state = A + op1 + B + op2 + C + op3 + D
            if eval(state) == 7:
                print(state + '=7')
                exit()


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

    int main (){
        int n,m,c;
        cin >> n >> m >> c;
        vector<int> b(m);
        vector<vector<int>>  a(n,vector<int>(m));
    rep(i,m){
        cin >> b[i];
    }

        rep(i,n){
            rep(j,m){
                cin >> a.at(i).at(j);
            }
        }

        int ans =0;

            rep(i,n){
                int sum=0;
                 rep(j,m){
                      sum += b.at(j)*a.at(i).at(j);
                    
                 } 
                 if(sum+c>0){
                     ans++;
                 }
        }
        cout << ans << endl;
        return 0;
    }

Measured memory_bytes: 3628
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    ll h;
    ll res = 0;
    ll mul = 1;

    cin >> h;
    while (true) {
        if (h == 1) {
            res += mul;
            break;
        }
        h /= 2;
        res += mul;
        mul *= 2;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define PRIME 998244353
#define MAXN 100000
using namespace std;
int main(){
	int N;
	int cnt[MAXN+1] = {1};
	int input;
	long long ans = 1;
	cin >> N;
	cin >> input;
	if(input){
		cout << 0 << endl;
		return 0;
	}
	for(int i=1; i<N; i++){
		cin >> input;
		cnt[input]++;
	}
	for(int i=1; i<N; i++)
		for(int j=0; j<cnt[i]; j++)
			ans = (ans * cnt[i-1]) % PRIME;
	if(cnt[0] != 1)
		cout << 0 << endl;
	else
		cout << ans << endl;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MN 30000
using namespace std;
inline int in(){
    int x=0;bool f=0; char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
int odd[MN+5],evn[3][MN+5],n,tot,cnt;
int main()
{
	n=in();
	if (n==3) {printf("2 5 63");return 0;}
	for (int i=1;i<=MN;++i){
		if (i&1){
			if (!(i%3)) odd[++cnt]=i;
		}else {
			evn[i%3][++evn[i%3][0]]=i;
		}
	}tot=n;
	if (n&1){
		for (int i=2;i<=5000&&tot>3;i+=2){
			tot-=2;printf("%d %d ",odd[i-1],odd[i]);
		}
		for (int i=1;i<=5000&&tot>=2;++i){
			tot-=2;printf("%d %d ",evn[1][i],evn[2][i]);
		}
		for (int i=1;i<=5000&&tot;++i){
			--tot;printf("%d ",evn[0][i]);
		}
	}else{
		for (int i=2;i<=5000&&tot>2;i+=2){
			tot-=2;printf("%d %d ",odd[i-1],odd[i]);
		}
		for (int i=1;i<=5000&&tot>=2;++i){
			tot-=2;printf("%d %d ",evn[1][i],evn[2][i]);
		}
		for (int i=1;i<=5000&&tot;++i){
			--tot;printf("%d ",evn[0][i]);
		}
	}return 0;
}

Measured memory_bytes: 384
N = gets.to_i
ary = gets.split.map(&:to_i).sort

nums = Hash.new(0)
ans = Array.new(ary.last + 1, 0)
result = 0

ary.each do |i|
  nums[i] += 1
  ans[i] = 1
end

ary.each do |k|
  next if ans[k] == 0
  result += 1 if nums[k] == 1
  k.step(ary.last, k) do |l|
    ans[l] = 0
  end
end
puts result

Measured memory_bytes: 46268
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 100000 + 10;
int power(int a, int b){
    int res = 1;
    while(b > 0){
        if(b & 1){
            res = 1LL * res * a % mod;    
        }
        a = 1LL * a * a % mod;
        b >>= 1;
    }
    return res;
}
int main() {
    int n, a[N], b[N], tot = 0;
    vector<int> v;
    long long suma = 0, sumb = 0, req = 0;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
        suma += a[i];
    }
    for(int i = 1; i <= n; i++){
        scanf("%d", &b[i]);
        if(b[i] > a[i]){
            req += b[i] - a[i];
            tot++;
        }
        if(a[i] > b[i]){
            v.push_back(a[i] - b[i]);
        }
        sumb += b[i];
    }
    if(suma < sumb){
        printf("-1\n");
        return 0;
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    for(int i = 0; i < v.size(); i++){
        if(req <= 0) break;
        tot++;
        req -= v[i];
    }
    printf("%d\n", tot);
    return 0;
}

Measured memory_bytes: 1404
n = int(input())
numbers = []
strings = []
order = 0
while True:
  if n //  26**order > 0:
    order = order + 1
  else:
    break
for i in range(order,0,-1):
  number = n //(26**(i-1))
  n = n - number*26**(i-1)
  numbers.append(number)
  
for i in range(order,1,-1):
  if numbers[i-1] <= 0:
    numbers[i-1] = numbers[i-1] + 26
    numbers[i-2] = numbers[i-2] - 1
 
for i in range(0,order):
  if numbers[i] == 0:
    pass
  else:
    strings.append(chr(ord("a")+int(numbers[i]-1)))
 
print(''.join(strings))

Measured memory_bytes: 9140
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  Yes(a+b>=c);

  return 0;
}


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

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


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int N = Integer.parseInt(sc.next());
		node v[] = new node[N];
		edge e[] = new edge[N-1];
		for(int i=0;i<N;i++){
			v[i] = new node(i);
		}

		for(int i=0;i<N-1;i++){
			int a = Integer.parseInt(sc.next());
			int b = Integer.parseInt(sc.next());
			e[i]= new edge(a,b);
			e[i].setNode(v[a-1],v[b-1]);
			v[a-1].connect(e[i]);
			v[b-1].connect(e[i]);
		}

		int K = 0;
		int root = 0;
		for(int i=0;i<N;i++){
			if(K<v[i].edges.size()){
				K = v[i].edges.size();
				root = i;
			}
		}
		v[root].paint();
		out.println(K);
		for(int i=0;i<N-1;i++){
			out.println(e[i].color);
		}
		
		sc.close();
		out.flush();
	}

}
class node{
	int id,dist;
	boolean searched = false;
	ArrayList<edge> edges;
	public node(int id){
		this.id = id;
		this.edges = new ArrayList<edge>();
	}
	public void connect(edge e){
		this.edges.add(e);
	}
	public void paint(){
		int i = 1;
		int used = 0;
		searched = true;
		for(edge e : edges){
			if(e.another(this).searched){
				used = e.color;
			}
		}
		for(edge e : edges){
			if(i != used){
				if(e.color ==0){
					e.setColor(i);
					i ++;
					if(!e.another(this).searched){
						e.another(this).paint();
					}
				}
			}
			else{
				i++;
				if(e.color == 0){
					e.setColor(i);
					i ++;
				}
				if(!e.another(this).searched){
					e.another(this).paint();
				}
			}
		}
	}
}

class edge{
	int id1,id2,cost;
	node v1,v2;
	int color = 0;
	public edge(int id1, int id2){
		this.id1 = id1;
		this.id2 = id2;
	}
	public void setNode(node v1,node v2){
		this.v1 = v1;
		this.v2 = v2;
	}
	public void setColor(int color){
		this.color = color;
	}
	public void setCost(int cost){
		this.cost = cost;
	}
	public node another(node v){
		if(v == v1){
			return v2;
		}
		else{
			return v1;
		}
	}
}

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


using ll = long long;
const int Mod = 1e9+7;


ll powmod(ll a, ll b, ll m) {
    ll c = 1;
    for (; b; b >>= 1, a = (ll)a * a % m) {
        if (b & 1) c = c * a % m;
    }
    return c;
}


void exgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0) {x = 1, y = 0; return;}
    exgcd(b, a % b, y, x);
    y -= a / b * x;
}


ll invmod(ll a, ll m) {
    ll x, y;
    exgcd(a, m, x, y);
    return (x % m + m) % m;
}


ll binomial(int n, int m)
{
    ll ans = 1;
    for (int i = 1; i <= m; i++) {
        ans = ans * (n - i + 1) % Mod * invmod(i, Mod) % Mod;
    }
    return ans;
}


int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    ll ans = (powmod(2, n, Mod) - 1 + Mod) % Mod;
    ans = ((ans - binomial(n, a) - binomial(n, b)) % Mod + Mod) % Mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import math


S = int(input())
x1,y1,x2,y2 = [1,10**9,0,0]
x2 = math.ceil(S/10**9)
y2 = x2*10**9-S
print(0,0,x1,y1,x2,y2)


Measured memory_bytes: 38384
/**
 * @author: Mackenzie
**/
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;

int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    string s;
    cin >> s;
    int blocks = 1;
    for (int i = 1; i < sz(s); i++) {
        if (s[i] != s[i - 1]) blocks++;
    }
    cout << blocks - 1 << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> num(N);
  for(int i=0; i<N; i++)
    cin >> num.at(i);
  int A=0;
  int B=0;
  sort(num.begin(), num.end());
  reverse(num.begin(), num.end());
  for(int j=0; j<N/2+N%2; j++){
    A=A+num.at(j*2);
    if(j*2+1>N-1)
      break;
    else
      B=B+num.at(j*2+1);
  }
  cout << A-B << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <queue>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    string s, t, tmp;
    cin >> s >> t;
    rep(i,0,t.size()) if (t[i]!=' ') tmp+=t[i];
    rep(i,0,s.size()) if (s[i]!=' ') tmp+=s[i];
    cout << tmp << endl;;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    int a,b,sum,cnt;
    while(scanf("%d %d", &a, &b)==2)
    {
        sum=a+b;
        cnt=0;
        while(sum>0)
        {
            sum/=10;
            cnt++;
        }
        printf("%d\n",cnt);
    }
    return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<(b)?(a=b,1):0)
#define chmin(a,b) (a>(b)?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int nxt[100];
int g[101][101];

int main() {
  int n;
  while(cin >> n) {
    string line;
    getline(cin,line);
    map<string,int> mp;
    string t[n];
    REP(i,n) {
      getline(cin,t[i]);
      t[i] = t[i].substr(0,t[i].size()-1);
      if (t[i].substr(0,5) != "goto ") {
        mp[t[i]] = i;
      }
    }
    REP(i,n) {
      if (t[i].substr(0,5) == "goto ") {
        nxt[i] = mp[t[i].substr(5)];
      } else {
        nxt[i] = i+1;
      }
    }
    memset(g,0x3f,sizeof(g));
    REP(i,n) g[i][i+1] = 1;
    REP(i,n) {
      g[i][nxt[i]] = 0;
    }
    REP(k,n+1)REP(i,n+1)REP(j,n+1)chmin(g[i][j],g[i][k]+g[k][j]);
    cout << g[0][n] << endl;
  }
}

Measured memory_bytes: 1276
#include<iostream>
#include<queue>
#include<algorithm>
#include<string.h>
using namespace std;
struct nagase {
		int x;
		int y;
		int c;
		int r;
};
int kani[4]={0,1,-1,0};
int ebi[4]={1,0,0,-1};
long long map[1001][1001]={0};
int s[1001][1001];
int main(){
	queue<nagase>Q;
	nagase kotani;
	nagase yanagi;
	int h,w,n;
	cin>>h>>w>>n;
	char a;
	memset(s,0,sizeof(s));
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>a;
			if(a=='S'){
				kotani.x=i;
				kotani.y=j;
				kotani.c=1;
				kotani.r=0;
				s[i][j]=1;
				Q.push(kotani);
			}
			else if(a=='X'){
				map[i][j]=-1;
			}
			else if(a=='.'){
				map[i][j]=0;
			}
			else{
				map[i][j]=(int)(a-48);
			}
		}
	}
	while(!Q.empty()){
		yanagi=Q.front();
		Q.pop();
		if(yanagi.c==map[yanagi.x][yanagi.y]){
			if(yanagi.c==n){
				cout<<yanagi.r<<endl;
				break;
			}
			while(!Q.empty()){
				Q.pop();
			}
			yanagi.c++;
			memset(s,0,sizeof(s));
			s[yanagi.x][yanagi.y]=1;
			Q.push(yanagi);
		}
		else{
			for(int i=0;i<4;i++){
				if(yanagi.x+kani[i]>=0&&yanagi.x+kani[i]<h&&yanagi.y+ebi[i]>=0&&yanagi.y+ebi[i]<w&&map[yanagi.x+kani[i]][yanagi.y+ebi[i]]!=-1&&s[yanagi.x+kani[i]][yanagi.y+ebi[i]]!=1){
					kotani=yanagi;
					kotani.x=yanagi.x+kani[i];
					kotani.y=yanagi.y+ebi[i];
					kotani.c;
					kotani.r++;
					s[yanagi.x+kani[i]][yanagi.y+ebi[i]]=1;
					Q.push(kotani);
				}
			}
		}
	}
}

		

			
	

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

int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   long long n;
   cin >> n;
   vector<long long> a(n);
   for (int i = 0; i < n; i++) {
      cin >> a[i];
   }
   int b = 1;
   for (int i = 1; i <= n; i++) {
      b = a[b-1];
      if (b == 2) {
         cout << i << '\n';
         return 0;
      }
   }
   cout << -1 << '\n';
   return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll C[30];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    memset(C, 0, sizeof(C));
    REP(i, S.length()) {
        C[S[i] - 'a']++;
    }
    REP(i, 30) {
        if (C[i] % 2 == 1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    string s;
    cin>>s;
    if (s[2]==s[3] && s[4]==s[5])
        cout<<"Yes\n";
    else
        cout<<"No\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ar array
 
int main() {
  ll x,p=100,n=0;
  cin>>x;
  while(p<x){
    p=p*1.01;
    n+=1;
  }
  cout<<n;

  

}

Measured memory_bytes: 3520
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#pragma comment("-Wl,--stack=1024000000")
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#define eprintf(...) 0
#else
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#endif
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){int ret=1;do{if(y&1)ret=(ll)ret*x%md;x=(ll)x*x%md;}while(y>>=1);return ret;}
int n,k,s;
int main(){
	cin>>n>>k>>s;
	if(k==0){
		for(int i=1;i<=n;i++){
			cout<<(s==1e9?(int)1e9-1:s+1)<<" ";
		}
		return 0;
	}
	for(int i=1;i<=k;i++)cout<<s<<" ";
	for(int i=k+1;i<=n;i++)cout<<(int)(s==1e9?1e9-1:1e9)<<" "; 
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int a,b,c,i,j,n,s;
int main()
{
	scanf("%d%d%d%d",&a,&b,&c,&n);
	for (i=0;i<=a;i++)
	 for (j=0;j<=b;j++)
	  if ((n-i*500-j*100>=0)&&(n-i*500-j*100<=c*50)) ++s;
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include "local_debug.h"
using namespace std;
#define endl endl
#define debug(x) cout << #x << " = " << (x) << endl
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)2e5 + 5;
ll n, k;
string s;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while (cin >> n >> k >> s)
	{
		s += '#';
		ll len = 1, sum = 0, cnt = 0;
		for (ll i = 0; i < n; ++i)
		{
			if (s[i] == s[i + 1])
				len++;
			else
				cnt++, sum += len, len = 1;
		}
		cnt = max(1LL, cnt - k * 2);
		cout << sum - cnt << endl;
	}
}
/*
6 1
LRLRRL

13 3
LRRLRLRRLRLLR

10 1
LLLLLRRRRR

9 2
RRRLRLRLL
*/

Measured memory_bytes: 512