akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

template <typename T>
void print(vector<T> vec)
{
    int n = vec.size();
    for (int i = 0; i < n; i++)
    {
        cout << vec[i] << (i == n - 1 ? "\n" : " ");
    }
}

int main()
{
    int n;
    while (cin >> n)
    {
        if (n == 0)
            return 0;
        vector<int> taro(n);
        for (int i = 0; i < n; i++)
            cin >> taro[i];

        vector<bool> card(2 * n);
        for (int i = 0; i < n; i++)
            card[taro[i] - 1] = true;

        vector<int> hanako(n);
        int h = 0;
        for (int i = 0; i < 2 * n; i++)
            if (!card[i])
                hanako[h] = i + 1, h++;
        sort(taro.begin(), taro.end());

        int t_card = n, h_card = n, turn = 1, f_card = 0;
        while (t_card > 0 && h_card > 0)
        {
            bool flag = false;
            if (turn % 2 == 1)
            {
                for (int i = 0; i < n; i++)
                {
                    if (taro[i] > f_card)
                    {
                        flag = true, f_card = taro[i], taro[i] = 0, t_card--;
                        break;
                    }
                }
            }
            else if (turn % 2 == 0)
            {
                for (int i = 0; i < n; i++)
                {
                    if (hanako[i] > f_card)
                    {
                        flag = true, f_card = hanako[i], hanako[i] = 0, h_card--;
                        break;
                    }
                }
            }

            if (flag == false)
                f_card = 0;
            turn++;
        }

        cout << h_card << endl;
        cout << t_card << endl;
    }
}


Measured memory_bytes: 3016
N = int(input())
a = [0]
a += map(int, input().split())

for i in range(N, 0, -1):
    x = 0
    for j in range(i, N+1, i):
        x ^= a[j]

    a[i] = x

ans = []
for i, ai in enumerate(a):
    if ai == 1:
        ans.append(i)

print(len(ans))
print(" ".join(map(str, ans)))



Measured memory_bytes: 18488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for(int i = (a); i<(b); ++i)
#define rep(i, n) for (int i=0; i<(n); ++i)
#define out(x) cout << x << endl

int main() {
    ll N, K, Q;
    cin >> N >> K >> Q;
    vector<ll> A(Q);
    rep(i, Q) cin >> A.at(i);
    ll th = Q-K;
    map<ll, ll> c;
    rep(i, Q) c[A.at(i)]++;
    rep(i, N) {
        if (c[i+1] > th) out("Yes");
        else out("No");
    }
}

Measured memory_bytes: 7680
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;
const int m=1000000000;

int main(){
	int n;
	cin>>n;
	vector<LL> l(n),r(n);
	int idx=0,lmx=0;
	int idx2=0,rmn=mod;
	int idx3=0,rmx=0;
	FOR(i,0,n){
		cin>>l[i]>>r[i];
		if(lmx<l[i]){
			lmx=l[i];
			idx=i;
		}
		if(rmx<r[i]){
			rmx=r[i];
			idx3=i;
		}
	}
	if(n==2){
		LL ans1=0;
		FOR(i,0,n){
			ans1+=r[i]-l[i]+1;
		}
		cout<<ans1<<endl;
		return 0;
	}
	cerr<<"t"<<endl;
	FOR(i,0,n){
		if(rmn>r[i]){
			rmn=r[i];
			idx2=i;
		}
	}
	LL ans=0;
	if(1){
		FOR(i,0,n){
			if(i==idx||i==idx2)continue;
			ans=max(ans,r[i]-l[i]+1+max(0,rmn-lmx+1));
		}
	}
	vector<pair<pii,int>> t;
	cerr<<"*** "<<ans<<endl;
	FOR(i,0,n){
		if(i==idx2)continue;
		t.PB(MP(MP(r[i],l[i]),i));
	}
	sort(t.begin(),t.end());
	int m=t.size(),mn=r[idx2],mx=l[idx2];
	cerr<<"tt"<<endl;
	FOR(i,0,m){
		int ll=t[i].ST.ND;
		int rr=t[i].ST.ST;
		int ii=t[i].ND;
		ans=max(ans,1LL*(max(0,rr-lmx+1)+max(0,mn-mx+1)));
		mn=min(mn,rr);
		mx=max(mx,ll);
	}
	cout<<ans<<endl;




}


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

int n;
int a[100][100];
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
    int u,k;
    cin>>u>>k;
    
    u--;
    for(int i=0;i<k;i++){
        int v;
        cin>>v;
        v--;
        a[u][v]=1;
    }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j)cout<<" ";
            cout<<a[i][j];
        }
        cout<<endl;
    }
    return 0;

}


Measured memory_bytes: 3096
/*
AIZU ONLINE A0110
Title:Alphametic
caution 0+X=0 > X=0
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define max(x,y) (((x)>(y))?(x):(y))

extern void replaceXn(char *,int);
static char toi[1024]={0};
char mondai[1024];
int comp123(char *s1,char *s2,char *s3)
{
  int c1,c2,c3;

  int i,l1,l2,l3,len;
  int carry;

  l1=strlen(s1);l2=strlen(s2);l3=strlen(s3);
  len=max(max(l1,l2),l3);
	
  carry=0;
  for(i=0;i<len;i++)
      {
	if(i>=l1)
	  c1=0;
	else
	  c1=s1[l1-i-1]-'0';
	if(i>=l2)
	  c2=0;
	else
	  c2=s2[l2-i-1]-'0';
	if(i>=l3)
	  c3=0;
	else
	  c3=s3[l3-i-1]-'0';
	//printf("a:%d %d %d %d\n",c1,c2,c3,carry);
	if((carry + c1+c2 - c3)% 10)
	  return(0);
	carry = (carry+c1+c2>=10)?1:0;
      }
  return(-1);
}
main()
{       
	char *tp1,*tp2,*tp3;
        int i;
        int flag;


        while(EOF != scanf("%s",&(toi[0])))
       	{ flag = 0;
          for(i=0;i<10;i++)
		{
		  memset(mondai,'\0',sizeof(toi)/sizeof(char)); 
                  strcpy(mondai , toi);
                  replaceXn(mondai,i);

                  tp1=strtok(mondai, "+" );
                  if(tp1)
                    { tp2=strtok(NULL,"=");
                      tp3=strtok(NULL,"\0");
                    }
		  
		  if((tp1[0]=='0' && strlen(tp1)>1) 
		     ||(tp2[0]=='0' && strlen(tp2)>1) 
		     ||(tp3[0]=='0' && strlen(tp3)>1))
                    {
                      continue;
                    }
		  
		  //printf("c: %s %s %s\n",tp1,tp2,tp3);
		   if(comp123(tp1,tp2,tp3))
                    { 
                      flag=1;
                      printf("%d\n",i);
                      break;
                    }
		}
          if(flag == 0)
            printf("NA\n");
        }
	return(0);
}

void replaceXn(char * str,int c)
{
int i;
for(i=0;i<strlen(str);i++)
	if(str[i]=='X')
		str[i]=('0' + c);
}

Measured memory_bytes: 564
#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 dp[100005][15];
ll m[15];

int main()
{
    memset(dp, 0, sizeof(dp));
    string S;
    cin >> S;
    ll N = S.length();
    REP(i, 10)
    {
        m[i] = i;
    }
    dp[0][0] = 1;
    REP(i, N)
    {
        ll n = S[N - 1 - i] - '0';
        REP(j, 10)
        {
            if (S[N - 1 - i] == '?' || n == j)
            {
                REP(k, 13)
                {
                    dp[i + 1][k] += dp[i][(13 + k - m[j]) % 13];
                    dp[i + 1][k] %= MOD;
                }
            }
            m[j] = (m[j] * 10) % 13;
        }
    }

    cout << dp[N][5] << endl;
    return 0;
}

Measured memory_bytes: 12160
a = []
while True:
    x = map(str, raw_input().split())
    if x[1] == '?':
        break
    if x[1] == '+':
        a.append(int(x[0]) + int(x[2]))
    if x[1] == '-':
        a.append(int(x[0]) - int(x[2]))
    if x[1] == '*':
        a.append(int(x[0]) * int(x[2]))
    if x[1] == '/':
        a.append(int(x[0]) / int(x[2]))
for i in range(len(a)):
    print a[i]

Measured memory_bytes: 6444
using System;
using System.Linq;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] In = Console.ReadLine().Split(' ');
            int[] H = new int[n];
            for(int i=0; i < n; i++)
            {
                H[i] = int.Parse(In[i]);
            }
            var SH=H.Reverse().ToArray();
            bool flag = true;
            for(int i=0; i < n-1; i++)
            {
                if (SH[i] >= SH[i + 1]) continue;
                else if(SH[i] == SH[i + 1] - 1)
                {
                    SH[i + 1]--;
                    continue;
                }
                else
                {
                    flag = false;
                    break;
                }
            }
            if (flag) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 39372
// AOJ 2015 Square Route
// ??????2??????????£?10???
// ????????¨?¨?????????????O(N^2)??§????????????????????¨????????§????????¨?°???\???????????§?????????????§£??????
// O(N^2logN)
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
int N,M;
int x[100100];
int y[100100];
int solve(){
    scanf("%d %d",&N,&M);
    if(N==0&&M==0)return 1;
    for(int i=1;i<=N;i++)scanf("%d",&x[i]);
    for(int i=1;i<=M;i++)scanf("%d",&y[i]);
    for(int i=1;i<=N;i++)x[i]+=x[i-1];
    for(int i=1;i<=M;i++)y[i]+=y[i-1];
    vector<int> vx,vy;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<=N;j++){
            vx.pb(x[j]-x[i]);
        }
    }
    for(int i=0;i<M;i++){
        for(int j=i+1;j<=M;j++){
            vy.pb(y[j]-y[i]);
        }
    }
    sort(all(vx));
    int ans = 0;
    for(int i=0;i<vy.size();i++){
        ans += upper_bound(all(vx),vy[i])-lower_bound(all(vx),vy[i]);
    }
    printf("%d\n",ans);
    return 0;
}
int main(){
    while(1){
        if(solve())return 0;
    }
    return 0;
}

Measured memory_bytes: 19820
import java.io.*;
import java.util.*;

public class Main {

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null; }
        String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try { tokenizer = new StringTokenizer(reader.readLine()); } 
                catch (IOException e) { throw new RuntimeException(e);} }
            return tokenizer.nextToken(); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        
        long n = r.nextLong();

        pw.println(n * (n-1) / 2);

        pw.close();
    }
}

/**
                _        _                 _                                                
               | |      | |               | |                                               
   ___ ___   __| | ___  | |__  _   _    __| | __ _ _ __ _ __ ___ _ __     _   _  __ _  ___  
  / __/ _ \ / _` |/ _ \ | '_ \| | | |  / _` |/ _` | '__| '__/ _ \ '_ \   | | | |/ _` |/ _ \ 
 | (_| (_) | (_| |  __/ | |_) | |_| | | (_| | (_| | |  | | |  __/ | | |  | |_| | (_| | (_) |
  \___\___/ \__,_|\___| |_.__/ \__, |  \__,_|\__,_|_|  |_|  \___|_| |_|   \__, |\__,_|\___/ 
                                __/ |                               ______ __/ |            
                               |___/                               |______|___/             
 */

Measured memory_bytes: 21332
def hantei(m, d):
    d1 = d//10
    d2 = d % 10

    if d1 > 1 and d2 >1:
        if d1*d2 == m:
            return 1
        else:
            return 0
    else:
        return 0



M, D = map(int, input().split(' '))
cnt = 0
if D > 20:
    for m in range(1, M + 1):
        for d in range(21, D + 1):
            if hantei(m, d) == 1:
                cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include <iostream>

int main() {
    std::string S, T;
    std::cin >> S;
    std::cin >> T;

    if ((S + S).find(T) != std::string::npos) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}


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

/*int rec(int arr[], int mem[], int id, int n, int k)
{
  if(id>=n)
    return INT_MAX;
  if(id==n-1)
    return 0;
  if(mem[id]!=-1)
    return mem[id];
  int ans=INT_MAX;
  for(int i=1;i<=k;i++)
  {
    int a=rec(arr,mem,id+i,n,k);
    if(a!=INT_MAX)
    	ans=min(ans,a+abs(arr[id+i]-arr[id]));
  }
  mem[id]=ans;
  return mem[id];
}*/

int main(){
  int n,k;
  cin>>n>>k;
  int arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  /*int mem[n];
  for(int i=0;i<n;i++)
	mem[i]=-1;
  cout<<rec(arr,mem,0,n,k)<<endl;*/
  
  
  int dp[n]={0};
  for(int i=0;i<n;i++)
    dp[i]=INT_MAX;
  dp[0]=0;
  for(int i=1;i<n;i++)
  {
    for(int j=i-1;j>=i-k&&j>=0;j--)
      dp[i]=min(dp[i],dp[j]+abs(arr[i]-arr[j]));
  }    
  cout<<dp[n-1]<<endl;
  
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		//取得
		Scanner sc = new Scanner(System.in);

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

		//比較した結果で分岐
		if(a > b) {
			for(int i =0; i < a;i++) {
				System.out.print(b);
			}
		}else {
			for(int i =0; i < b; i++) {
				System.out.print(a);
			}
		}
	}
}



Measured memory_bytes: 21588
#include<stdio.h>
#include<tuple>
#include<string>
#include<algorithm>
#include<iostream>
#include<map>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef tuple<int,int,int> t3;

const int MX = 200005;
const int MM = 924844033;

int main()
{
	int N;
	scanf("%d", &N);
	string A, B;
	cin >> A >> B;

	for(int i = N; i >= 1; i--){
		if( A.substr(N-i, i) == B.substr(0, i)) return !printf("%d\n", 2*N - i);
	}
	printf("%d\n", 2*N);
}


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

int main(void){
	int h,w;
	cin>>h>>w;
	char s[h][w];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>s[i][j];
		}
	}
	int hsum[h][w],wsum[h][w];
	memset(hsum,0,sizeof(hsum));
	memset(wsum,0,sizeof(wsum));
	int cnt=0;
	for(int i=0;i<w;i++){
		for(int j=0;j<h;j++){
			if(s[j][i]=='#'){
				hsum[j][i]=0;
			}else{
				if(j!=0)hsum[j][i]=hsum[j-1][i]+1;
				else hsum[j][i]=1;
			}
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(s[i][j]=='#'){
				wsum[i][j]=0;
			}else{
				if(j!=0)wsum[i][j]=wsum[i][j-1]+1;
				else wsum[i][j]=1;
			}
		}
	}
	for(int i=0;i<w;i++){
		int tmp=hsum[h-1][i];
		for(int j=h-1;j>=0;j--){
			if(s[j][i]=='#'){
				tmp = hsum[j-1][i];
			}else{
				hsum[j][i]=tmp;
			}
		}
	}
	for(int i=0;i<h;i++){
		int tmp=wsum[i][w-1];
		for(int j=w-1;j>=0;j--){
			if(s[i][j]=='#'){
				tmp = wsum[i][j-1];
			}else{
				wsum[i][j]=tmp;
			}
		}
	}
	int res =0;
	/*for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout<<hsum[i][j];
		}
		cout<<endl;
	}
	cout<<endl;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout<<wsum[i][j];
		}
		cout<<endl;
	}*/
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			res = max(res,hsum[i][j]+wsum[i][j]);
		}
	}
	cout<<res-1<<endl;
}


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

int main() {
	string s;
	cin >> s;
	vector<char> v;
	for (size_t i = 0; i < s.size(); ++i) {
		if( s[i] == 'B') {
			if (v.size() > 0) v.pop_back();
		} else {
			v.push_back(s[i]);
		}
	}
	string out;
	for (size_t j = 0; j < v.size(); ++j ) out += v[j];
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int n;
    cin >> n;
    ll l0=2;
    ll l1=1;
    ll ans;
    if(n==1) cout << 1 << endl;
    else{
    rep(i,n-1){
        ans=l0+l1;
        l0=l1;
        l1=ans;
    }
    cout << ans << endl;}
}

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

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

  for (int i = -K + 1; i < K; i++) {
    printf("%d ", X + i);
  }

  return 0;
}

Measured memory_bytes: 256
n=gets.chomp.to_i
n.times do
	a,b,c=gets.split.map(&:to_i)
	if a*a + b*b == c*c || b*b + c*c == a*a || c*c + a*a == b*b
		puts "YES"
	else
		puts "NO"
	end
end

Measured memory_bytes: 6108
#!/usr/bin/env python3

from copy import deepcopy

def dfs(x, adj, visited):
    for y, flag in enumerate(adj[x]):
        if flag and y not in visited:
            visited.add(y)
            dfs(y, adj, visited)

def is_simply_connected(adj):
    n = len(adj)
    visited = {0}  # O(log n). Use list instead.
    dfs(0, adj, visited)
    return len(visited) == n

def main():
    n, m = map(int, input().split())
    adj = [[(i == j) for i in range(n)] for j in range(n)]
    edges = set()
    for i in range(m):
        a1, b1 = map(int, input().split())
        a = a1 - 1
        b = b1 - 1
        edges.add((a, b))
        adj[a][b] = True
        adj[b][a] = True

    res = 0
    for a, b in edges:
        adj[a][b] = adj[b][a] = False
        if not is_simply_connected(adj):
            res += 1
        adj[a][b] = adj[b][a] = True
    print(res)

main()


Measured memory_bytes: 3572
#include <iostream>

using namespace std;
#define N 33000

int ans;

void solve(int n,int k,int s,int before,int cnt,int sum,int *data){	

	if(sum>s){
		return;
	}

	if(cnt==k){
		/*
		for(int i=0;i<cnt;i++){
			cout<<data[i]<<" ";
		}
		cout<<endl;
		*/
		if(sum==s){
			ans++;
		}
		return;
	}
	for(int i=before+1;i<=n;i++){
		data[cnt] = i;
		solve(n,k,s,i,cnt+1,sum+i,data);
	}
}

int main(){

	int n,k,s;
	int *data;
	data = new int[30];

	while(cin>>n>>k>>s){
		if(n==0 && k==0 && s==0)break;
	
		ans=0;

		solve(n,k,s,0,0,0,data);

		cout<<ans<<endl;
	}

	return 0;
}
		

Measured memory_bytes: 1188
import sys
input = sys.stdin.readline

class Node:
    def __init__(self):
        self.nxt = [-1] * 26
        self.is_end = False

nodes = [Node()]
N = int(input())
S = [input().rstrip()[::-1] for _ in range(N)]
S.sort(key=lambda s: len(s))
ans = 0
for i, s in enumerate(S):
    path = []
    node = 0
    for c in s:
        c = ord(c) - ord('a')
        path.append(node)
        if nodes[node].nxt[c] == -1:
            nodes[node].nxt[c] = len(nodes)
            nodes.append(Node())
        node = nodes[node].nxt[c]
    nodes[node].is_end = True

    suffix = set()
    for j in range(len(s) - 1, -1, -1):
        suffix.add(ord(s[j]) - ord('a'))
        node = path[j]
        for c in suffix:
            if nodes[node].nxt[c] != -1:
                ans += nodes[nodes[node].nxt[c]].is_end
print(ans - N)

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

int main() {
  int n,k,r,s,p;
  cin >> n >> k >> r >> s >> p;
  string t;
  cin >> t;
  string a(n, '0');
  for (int i = 0;i < n;i++){
    if (t[i] == 'r'){
      a[i] = 'p';
      }
    if (t[i] == 's'){
      a[i] = 'r';
      }
    if (t[i] == 'p'){
      a[i] = 's';
    }
  }
  string b(n, '0');
  int ans = 0;
  
  for (int i = 0;i < n;i++){
    if (i < k){
      if (t[i] == 'r'){
        ans += p;
        b[i] = 'p';
      }
      if (t[i] == 's'){
        ans += r;
        b[i] = 'r';
      }
      if (t[i] == 'p'){
        ans += s;
        b[i] = 's';
      }
    }
    else{
      if (t[i] == 'r' && b[i-k] != 'p'){
        ans += p;
        b[i] = 'p';
      }
      if (t[i] == 's' && b[i-k] != 'r'){
        ans += r;
        b[i] = 'r';
      }
      if (t[i] == 'p' && b[i-k] != 's'){
        ans += s;
        b[i] = 's';
      }
    }
  }
    
  cout << ans << endl;
}

Measured memory_bytes: 3836
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
typedef long long ll;
inline void Fail(){printf("0");exit(0);}
inline void debug(int x){cerr<<"debug: "<<x<<"\n";}
inline void debug(int n,int x[]){cerr<<"debug "<<"\n";rep(i,n)cerr<<x[i]<<" ";cerr<<"\n";}
inline void debug(string x){cerr<<"debug: "<<x<<"\n";}

const int maxn=45;
const int maxm=20;
const int mod=1e9+7;
inline void Add(int &a,int b){a+=b;if(a>=mod)a-=mod;}
inline void Minus(int &a,int b){a-=b;if(a<0)a+=mod;}
int n,x,y,z,ans=1,sum;
int dp[maxn][1<<maxm];

int main(){
	scanf("%d%d%d%d",&n,&x,&y,&z);
	sum=x+y+z;
	const int all=1<<sum+1;
	rep(i,n)ans=10LL*ans%mod;
	REP(i,10)dp[0][(1|(1<<i))&(all-1)]++;
	rep(i,n)rep(j,all){
		int cur=dp[i][j];
		if(!cur)continue;
		if(j&(1<<z)&&j&(1<<(y+z))&&j&(1<<(x+y+z)))continue;
		if(i==n-1)Minus(ans,cur);
		REP(k,10){
			int mask=(all-1)&((j<<k)|(1<<k));
//			cout<<j<<" "<<k<<" => "<<(mask|1)<<endl;
			Add(dp[i+1][mask|1],cur); 
		}
	}
	printf("%d",ans);
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 82176
eval"N,A,*X="+`dd`.split*?,;d=[i=0]*2e4;d[N*=A]=1;
X.map{|x|(0..2*N).map{|j|
		#d[5e3-i+j]=d[i+j]+d[j<x-A ? 0: i+j-x+A]
		d[5e3-i+j]=d[i+j]+d[[0,i+j-x+A].max]
	};i=5e3-i
}
p d[i+N]-1

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

struct Edge {
    int from, to, id;
    Edge(int _to, int _id) : from(-1), to(_to), id(_id) {}
};

void solve() {
    int N; cin >> N;
    vector<int> deg(N);
    vector<vector<Edge>> G(N);
    for(int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        ++deg[--a], ++deg[--b];
        G[a].emplace_back(b, i);
        G[b].emplace_back(a, i);
    }
    int mx = *max_element(deg.begin(), deg.end());
    vector<int> ans(N - 1);
    auto dfs = [&](auto &&dfs, int cur, int pre, int col) -> void {
        for(auto &e : G[cur]) {
            if(e.to == pre) continue;
            if(++col > mx) col = 1;
            ans[e.id] = col;
            dfs(dfs, e.to, cur, col);
        }
    };
    dfs(dfs, 0, 0, 0);
    cout << mx << '\n';
    for(auto &a : ans) {
        cout << a << '\n';
    }
}

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


Measured memory_bytes: 7936
#include<stdio.h>
int main(void)
{
	int n,a,b,c,d,x,y,z,g;
	scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
	if(n%a==0){
			x=n/a;
			y=x*b;
	}
	else if(n%a!=0){
			x=n/a;
			x++;
			y=x*b;
	}
	if(n%c==0){
			z=n/c;
			g=z*d;
	}
	else if(n%c!=0){
			z=n/c;
			z++;
			g=z*d;
	}
	if(y<g){
			printf("%d\n",y);
	}
	else printf("%d\n",g);
	return 0;
}


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

int main(){
 int N,K;
 cin >> N >> K;
  
 vector<int> vec(N);
  int answer = 0;
  
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
    
      if(vec.at(i) < K - vec.at(i)){
    answer += 2 * vec.at(i);
  }else{
        answer += 2 * (K - vec.at(i));
      }
    
  }
 cout << answer << endl;
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for(int i = 0;i < N;i++)
    cin >> vec.at(i);
  sort(vec.begin(),vec.end());

  int count = 0;

  for(int i = 0;i < N;i++){
    for(int j = 0;j < i;j++){
      for(int k = 0;k < j;k++){
	if(vec.at(k) != vec.at(j) && vec.at(j) != vec.at(i) && vec.at(k)+vec.at(j) > vec.at(i)){
	  count++;
	}
      }
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

int main() {
    ll X;
    cin >> X;
    vector<ll> fac(121);
    for(ll i = 0;i <= 120;i++) {
        fac.at(i) = i * i * i * i * i;
    }
    bool ret = false;
    for(int i = 0;i < 120;i++) {
        for(int j = 0;j < 120;j++) {
            if(fac.at(i) + fac.at(j) == X) {
                cout << i << " " << -j << endl;
                return 0;
            }
        }
    }
    for(int i = 0;i < 120;i++) {
        for(int j = 0;j <= i;j++) {
            if(fac.at(i) - fac.at(j) == X) {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  rep(i,9){
    char c;
    cin>>c;
    if(i==0 || i==4 || i==8)
      cout<<c;
  }
  cout<<endl;
}

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

#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll MOD = 1000000007;
const long long INF = 1LL << 60;
//cout<<fixed<<setprecision(10);

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;}

signed main()
{   
    gearup;
    int n; cin >> n;
    bool res = false;
    rep1(i,n+1){
        if(n%i ==0){
            if(n/i <= 9 && i <= 9)res = true;
        }
    }
    if(res)yes;
    else no;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
5 4
0 1
1 2
2 3
3 4

output:
0 1
1 2
2 3
3 4
"""

import sys
sys.setrecursionlimit(int(3e6))


def generate_adj_table(_v_info):
    for v_detail in _v_info:
        v_from, v_to = map(int, v_detail)
        init_adj_table[v_from].append(v_to)
        # undirected graph
        init_adj_table[v_to].append(v_from)
    return init_adj_table


def graph_dfs(u, visited, parent, low, disc):
    global Time
    # Count of children in current node
    children = 0

    # Mark the current node as visited and print it
    visited[u] = True

    # Initialize discovery time and low value
    disc[u] = Time
    low[u] = Time
    Time += 1

    # Recur for all the vertices adjacent to this vertex
    for v in adj_table[u]:
        # If v is not visited yet, then make it a child of u
        # in DFS tree and recur for it
        if not visited[v]:
            parent[v] = u
            children += 1
            graph_dfs(v, visited, parent, low, disc)

            # Check if the subtree rooted with v has a connection to
            # one of the ancestors of u
            low[u] = min(low[u], low[v])

            ''' If the lowest vertex reachable from subtree
            under v is below u in DFS tree, then u-v is
            a bridge'''
            if low[v] > disc[u]:
                ans.append(sorted([u, v]))
        elif v != parent[u]:  # Update low value of u for parent function calls.
            low[u] = min(low[u], disc[v])

    return None


def bridge():
    visited = [False] * vertices
    disc = [float("Inf")] * vertices
    low = [float("Inf")] * vertices
    parent = [-1] * vertices

    for v in range(vertices):
        if not visited[v]:
            graph_dfs(v, visited, parent, low, disc)

    return ans


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices, edges = map(int, _input[0].split())
    v_info = map(lambda x: x.split(), _input[1:])
    Time = 0
    ans = []

    init_adj_table = tuple([] for _ in range(vertices))
    adj_table = generate_adj_table(v_info)
    res = bridge()
    res.sort()
    for ele in res:
        print(*ele)

Measured memory_bytes: 23908
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = Math.min(n * a, b);
        System.out.println(ans);
    }
}

Measured memory_bytes: 25428
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    reverse(all(S));
    int s=S.size();
    vector<vector<ll>> dp(s+2,vector<ll>(3,IINF));
    dp[0][0]=0;
    rep(i,s+1) rep(j,3){
        if (i==s){
            chmin(dp[i+1][0],dp[i][j]+j);
            continue;
        }
        ll x=S[i]-'0',p=0;
        x+=j;
        if (x>10){++p; x-=10;}
        chmin(dp[i+1][p],dp[i][j]+x);
        chmin(dp[i+1][p+1],dp[i][j]+x+1);
        chmin(dp[i+1][p+1],dp[i][j]+10-x);
    }
    ll ans=min(dp[s][0],dp[s+1][0]);
    cout << ans << endl;
}

Measured memory_bytes: 55964
import java.io.*;

class Main
{
	public static void main ( String[] args ) throws IOException{
		BufferedReader br = 
		new BufferedReader(new InputStreamReader(System.in));
		String str =   br.readLine();  
		

		int x = Integer.parseInt(str);
		
		System.out.println(x * x * x);
	}
}

Measured memory_bytes: 24056
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  
  bool flag = false;
  for(int i = 0; i < 15; i ++){
    for(int j = 0; j < 26; j ++){
      if(7 * i + 4 * j == N){
        flag = true;
      }
      if(flag) break;
    }
    if(flag) break;
  }
  
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}
      

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = [0] * n
b[-1]= a[-1]
total = 0
mod = 10**9 + 7
for i in range(n-2, 0, -1):
    b[i] = a[i] + b[i + 1]
for i in range(n-1):
    total = (total + (a[i] * b[i + 1]) % mod) % mod
print(total)


Measured memory_bytes: 31556
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int n;

#include <vector>
template <typename T>
void print(vector<T> vec)
{
    int n = vec.size();
    for (int i = 0; i < n; i++)
    {
        cout << vec[i] << (i == n - 1 ? "\n" : " ");
    }
}

template <typename T>
void BubbleSort(vector<T> &C, int &cnt)
{
    int n = C.size();
    cnt = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = n - 2; j >= i; j--)
        {
            if (C[j] > C[j + 1])
            {
                swap(C[j], C[j + 1]);
                cnt++;
            }
        }
    }
    print(C);
}

//stabは安定ソートされたvector
template <typename T>
bool is_stable(vector<T> stab, vector<T> v)
{
    if (stab == v)
        return true;
    else
        return false;
}

int main()
{
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    int c;
    BubbleSort(v, c);
    cout << c << endl;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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



// 入れ子のコンテナの表示関数.
void print_list(const vector<vector<llong> >& v_list)
{
    for (vector<vector<llong> >::const_iterator p = v_list.begin(); p != v_list.end(); ++p) {
        for (vector<llong>::const_iterator q = p->begin(); q != p->end(); ++q)
            cout << *q << " ";
        cout << endl;
    }
}

// 和の比較関数.
template<class T>
bool less_summation(const vector<T>& a, const vector<T>& b)
{
    return a[0] < b[0];
}
llong xo(llong a){
    llong temp;
    int dg = log2(a);
    
    llong rt = 0;
    for(int i = dg+1;i>=1;i--){
        llong temppow = pow(2, i);
        temp = ((llong)(a/temppow)*(llong)(temppow/2)%2+
            max((llong)0,((llong)a%temppow-(llong)(temppow/2)+1)%2)+2)%2;
        
        rt += temppow * temp/2;
    }

    return rt;

}

vector<char> anstwo;
int main()
{
    
    llong a, b;
    
    

    
    scanf("%lld %lld", &a, &b);

    
    
    
    cout<< (llong)(xo(b) ^ xo(a-1))<<endl;
    
    
    
        
  
    
}







Measured memory_bytes: 256
n,q = map(int,input().split())
S = input()
a = [0 for i in range(n)]
count = 0
for i in range(1,n):
    if S[i] == 'C' and S[i-1] == 'A':
        count += 1
    a[i] = count
for i in range(q):
    l,r = map(int,input().split())
    print(a[r-1]-a[l-1])

Measured memory_bytes: 6104
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  char a = c + 1;
  cout << a << endl;


  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n+1];
        int[] b = new int[n];
        for(int i=0; i<=n; i++) {
            a[i] = in.nextInt();
        }
        for(int i=0; i<n; i++) {
            b[i] = in.nextInt();
        }
        long c = 0;
        for(int i=0; i<n; i++) {
            long d = Math.min(a[i], b[i]);
            if(b[i] > d) {
                long d2 = Math.min(a[i+1], b[i]-d);
                a[i+1] -= d2;
                d += d2;
            }
            c += d;
        }
        System.out.println(c);
    }
}


Measured memory_bytes: 86896
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
ll gcd(ll a, ll b){
  if(b == 0){
    return a;
  }
  else{
    return gcd(b,(a%b));
  }
}
ll lcm(ll a,ll b){
  return a/gcd(a,b)*b;
}
ll mpower(ll a,ll b,ll c){
    int z;
    if(b==0){
        z=1;
        z%=c;
        return z;
    }
    if(b==1){
        z=a;
        z%=c;
        return z;
    }
    else{
        return (((mpower(a,b/2,c))*(mpower(a,b/2,c))%c)*mpower(a,b%2,c)%c);
    }
}
 
int main(){
  char s;
  cin>>s;
  cout<<char(s+1)<<endl;
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll ntotal = 1000000000000001;

int main() {
	vector<char> alpha(13,'a');
	ll n;
	cin >> n;
	ll base = 1;
	int k;
	ll rest = n-1;
	rep(i, 12){
		base *= 26;
		rest -= base;
		k = i+1;
		if (rest < 0)
			break;
	}
	rest += base;
	k;
	rest;
	rep(i, k) {
		alpha[k - i -1] = 'a' + rest % 26;
		rest /= 26;
	}
	rep (i, k)
		cout << alpha[i];
	cout << endl;
	
	return 0;
}


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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;





int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	int X, Y;

	cin >> X >> Y;

	if (Y % 2 == 0 && Y >= 2 * X && Y <= 4 * X)
		cout << "Yes\n";
	else
		cout << "No\n";



	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
	return 0;
}


Measured memory_bytes: 3600
s = list(input())
N = len(s)
if N == 1:
    print (0)
    exit()

ans = 99
for i in range(1, N): #残す文字数
    tmp = 0 #残す文字以外の最大連続数
    count = 0 #残す文字以外が何文字続いているかをカウント
    for j in range(i):
        if s[j] == s[i]:
            tmp = max(tmp, count)
            count = 0
        else:
            count += 1
    tmp = max(tmp, count)
    ans = min(ans, max(tmp, N - i - 1))

print (ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;

u64 mabs(l64 a)
{
  if (a>0) return a;
  return -a;
}

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  u64 n;
  cin >> n;
  l64 a[n];
  l64 sum = 0;
  for (u64 i = 0; i < n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  u64 snuke = a[0];
  u64 diff = mabs(sum-snuke*2);
  for (u64 i = 1; i < n-1; ++i) {
    snuke += a[i];
    diff = min(diff, mabs(sum-snuke*2));
  }
  cout << diff << endl;
  return 0;
}


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

using namespace std;


int main()
{
    map<int,int> m;
    string s;
    cin>>s;
    int mod = 2019;
    long long res = 0;
    int current = 0;
    m[0]=1;
    //reverse(s.begin(),s.end());
    long long p10=1;
    for(int c=s.size()-1;c>=0;c--) {
        current += (s[c]-'0')*p10;
        current %= mod;
        res += m[(current)%mod];
        m[current]++;
        p10*=10;
        p10%=mod;
    }
    cout<<res;
}


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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(0)





void solve() {

	string a, b;
	cin >> a >> b;
	cout << b << a << "\n";
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	fix;
	solve();

	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int tri(ll a,ll b,ll c){
    if(a!=b&&b!=c&&c!=a&&a<b+c){
        return 1;
    }else{
        return 0;
    }
}
int main(void){
    int N;
    cin >> N;
    vector<ll> L(N);
    for(int i=0;i<N;i++){
        cin >> L.at(i);
    }
    sort(L.begin(),L.end());
    reverse(L.begin(),L.end());
    int ans=0;
    for(int i=0;i<N-2;i++){
        for(int j=i+1;j<N-1;j++){
            for(int k=j+1;k<N;k++){
                ans+=tri(L[i],L[j],L[k]);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 


int char_to_int(char c){
  switch(c){
    case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
  }
}


int main(){
  char A, B, C, D;
  cin >> A >> B >> C >> D;
  
  vector<int> input(4);
  input.at(0) = char_to_int(A); input.at(1) = char_to_int(B);
  input.at(2) = char_to_int(C); input.at(3) = char_to_int(D);
  
  vector <int> op(3, 1);  // +なら1, -なら-1
   vector <int> op_res(3, 1);  // +なら1, -なら-1
  int sum = 0;
  rep(i, 4) sum += input.at(i);
 
  rep(i, 2){
    op.at(0) = -2*i+1;
    rep(j, 2){
      op.at(1) = -2*j+1;
      rep(k, 2){
        op.at(2) =-2*k+1;
        sum = input.at(0);
        rep (l, 3) sum += input.at(l+1)*op.at(l);
          
        if(sum == 7) {
          op_res.at(0) = -2*i+1;
          op_res.at(1) = -2*j+1;
          op_res.at(2) = -2*k+1;
        }
      }
    }
  }

  cout << A;
  rep(i, 3){
    if(op_res.at(i) == 1){
      cout << '+';
    }else{
      cout << '-';
    }
    cout << input.at(i+1);
  }
  cout << "=7";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;++i)
#define For(i,a,b) for(int i=(a),i##_end=(b);i<i##_end;++i)
#define per(i,a,b) for(int i=(b),i##_st=(a);i>=i##_st;--i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define dbg(x) cerr<<#x" = "<<x<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define Es(x,i) for(Edge *i=G[x];i;i=i->nxt)
typedef long long ll;
typedef pair<int,int> pii;
const int inf=~0u>>1,MOD=1e9+7;
inline int rd() {
    int x,c,f=1;while(!isdigit(c=getchar()))f=c!='-';x=c-'0';
    while(isdigit(c=getchar()))x=x*10+c-'0';return f?x:-x;
}
const int N=511,dr[]={0,0,1,-1},dc[]={1,-1,0,0};
int n,m;
char A[N][N],B[N][N],C[N][N];
int f[N];
queue<pii>q;
void bfs(){
	rep(i,1,m){
		q.push(mp(1,i));
		C[1][i]='#';
	}
	while(!q.empty()){
		pii x=q.front();q.pop();
		For(i,0,4){
			int u=x.fi+dr[i],v=x.se+dc[i];
			if(u&&u<=n&&v&&v<=m&&!C[u][v]&&(A[u][v]=='#'||B[u][v]!='#')){
				C[u][v]='#';
				q.push(mp(u,v));
			}
		}
	}
}
int main(){
#ifdef flukehn
	freopen("test.txt","r",stdin);
#endif
	n=rd(),m=rd();
	rep(i,1,n)scanf("%s",A[i]+1);
	rep(i,1,n){
		rep(j,1,m){
			f[i]|=A[i][j]=='#';
		}
	}
	rep(i,2,n-1){
		B[i][1]='#';
		if(f[i]){
			if(!f[i-1])rep(j,2,m-1)B[i][j]='#';
			else f[i]=0;
		}
	}
	rep(i,1,n)rep(j,1,m)if(A[i][j]=='#')B[i][j]='#';
	bfs();
	rep(i,1,n)rep(j,1,m)if(B[i][j]!='#')B[i][j]='.';
	rep(i,1,n)rep(j,1,m)if(C[i][j]!='#')C[i][j]='.';
	rep(i,1,n)puts(B[i]+1);
	putchar('\n');
	rep(i,1,n)puts(C[i]+1);
}

Measured memory_bytes: 1536
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;

ll powMod(ll x, ll n) {
  if (n == 0) return 1;
  ll r = powMod(x, n / 2);
  if (n % 2 == 0) return (r * r) % MOD;
  return (r * r % MOD) * x % MOD;
}

bool ijv(int i, int j, int h, int w) {
  if (0 <= i && i < h && 0 <= j && j < w) return true;
  return false;
}

char a[2010][2010];
ll s[2010][2010];

int main(void) {

  int a, b;
  cin >> a >> b;
  if (a > b) {
    int t = a;
    a = b;
    b = t;
  }
  rep(i, b) cout << a;
  cout << endl;
}


Measured memory_bytes: 384
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pending/disjoint_sets.hpp>
// #include <atcoder/all>

#define REPI(i, S, N) for(int i=int(S); i<int(N); i++)
#define REP(i, N) REPI(i, 0, N)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
// using mint = atcoder::modint1000000007;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> a, b, c, d;
  


  return max({b*d, a*c, a*d, b*c});
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}



Measured memory_bytes: 3636