akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

int main()
{
	int n, u, k, v;
	bool filled[100][100]{};

	std::cin >> n;
	for (int i = 0; i < n; ++i)
	{
		std::cin >> u >> k;
		u--;
		for (int j = 0; j < k; ++j)
		{
			std::cin >> v;
			filled[u][--v] = true;
		}
	}
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			if (j)
				std::cout << " ";
			std::cout << static_cast<int>(filled[i][j]);
		}
		std::cout << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3116
#include <iostream>

using namespace std;

int main()
{
    string a, b, c;
    cin >> a >> b >> c;
    string ans = "NO";
    if (a[a.size()-1] == b[0])
        if (b[b.size()-1] == c[0]) ans = "YES";

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] strs = line.Split(' ');
            int A = int.Parse(strs[0]);
            int B = int.Parse(strs[1]);
            int C = int.Parse(strs[2]);
            int K = int.Parse(strs[3]);
            if (A >= K)
            {
                Console.WriteLine(K);
            }
            else if (A+B>=K)
            {
                Console.WriteLine(A);
            }
            else
            {
                var score = A;
                score -= (K - A - B);
                Console.WriteLine(score);
            }


        }
    }
}


Measured memory_bytes: 27524
#include <stdio.h>
#define MAX 100005
#define OUT -1
struct Node{
  int p;
  int l;
  int r;
};

void depth(int,int);
void print(int);
//using namespace std;

struct Node T[MAX];
int n, A[MAX];

int main(){
  int i,j,d,v,c,l,r;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    T[i].r = OUT;
    T[i].l = T[i].r;
    T[i].p = T[i].l;
  }
  for(i = 0; i < n; i++){
    scanf("%d",&v);
    scanf("%d",&d);
    for(j = 0; j < d; j++){
      scanf("%d",&c);
    if(j == 0){
      T[v].l = c;
    }
    else{
      T[l].r = c;
    }
    l = c;
    T[c].p = v;
    }
  }
  for(i = 0; i < n; i++){
    if(T[i].p == OUT){
      r = i;
    }
  }
  depth(r,0);
  for(i = 0; i < n; i++){
    print(i);
  }
  return 0;
}// end of main func

void depth(int u, int p){
  A[u] = p;
  if(T[u].r != OUT){
    depth(T[u].r,p);
  }
  if(T[u].l != OUT){
    depth(T[u].l , p+1);
  }
}//end of depth func

void print(int u){
int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",A[u]);
  if(T[u].p == OUT){
    printf("root, ");
  }
  else if(T[u].l == OUT){
    printf("leaf, ");
  }
  else{
    printf("internal node, ");
  }
  printf("[");
  for(i = 0, c = T[u].l; c != OUT; i++, c = T[c].r){
    if(0 < i){
      printf(", ");
    }
    printf("%d",c);
  }
  printf("]\n");
}//end of print func

Measured memory_bytes: 7268
#include <cstdio>
#include <stdint.h>
#include <algorithm>

const int64_t INF=1e18+7;

int64_t as[405];

int64_t dp[405][405];

int main(){
  int N;
  scanf("%d",&N);
  for(int i=1;i<=N;i++){
    scanf("%ld",&as[i]);
    as[i]+=as[i-1];
  }
  for(int l=0;l<=N;l++){
    for(int r=0;r<=N;r++){
      dp[l][r]=INF;
    }
  }
  for(int l=0;l<N;l++){
    dp[l][l+1]=0;
  }
  for(int l=N-1;l>=0;l--){
    for(int r=l+1;r<=N;r++){
      for(int m=l+1;m<r;m++){
	dp[l][r]=std::min(dp[l][r],dp[l][m]+dp[m][r]+as[r]-as[l]);
      }
    }
  }
  printf("%ld\n",dp[0][N]);
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#define mop 1000000007
using namespace std;

long long p[11], c[11];

int main() {
   

    int d;
    long long g;
    cin >> d >> g;
    for (int i=0;i<d;i++){
        cin >> p[i+1] >> c[i+1];
    }
    long long ans = mop;
    for (int b=0;b<1024;b++){
        long long sum = 0;
        long long cnt = 0;
        int res = 0;
        for (int j=0;j<10;j++){
            if((b>>j & 1) == 1){
                sum += p[j+1] * 100 * (j+1) + c[j+1];
                cnt += p[j+1];
            }else{
                if(res < j+1){
                    res = j+1;
                }
            }
        }
        if(sum < g){
            if((g-sum) % (res*100) == 0){
                if((g-sum)/(res*100) < p[res]){
                    cnt += (g-sum)/(res*100);
                }else{
                    continue;
                }
            }else{
                if((g-sum)/(res*100) + 1 < p[res]){
                    cnt += (g-sum)/(res*100) + 1;
                }else{
                    continue;
                }
            }
        }
        if (ans > cnt){
            ans = cnt;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;
const bool debug = 0;
//---------------------------------//

string s;

int main() {
	cin >> s;
	
	if (s[0] == s[2]) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    ll a, b;
    cin >> a >> b;
    cout << lcm(a, b) << endl;
}


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

int main(){
    string s;
    cin >> s;
    bool flag = false;
    if (s[0] == s[1] && s[1] == s[2] && s[2] == s[0]){
        flag = true;
    }else if(s[1] == s[2] && s[2] == s[3] && s[3] == s[1]){
        flag = true;
    }
    cout << (flag ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
def main():
    mod=998244353
    n=int(input())
    d = list(map(int,input().split())) 
    if d[0]!=0:
        print(0)
        return
    cnt=[0 for _ in range(n-1)]
    for i in range(n-1):
        cnt[d[i+1]-1]+=1
    for i in range(len(cnt)):
        if cnt[len(cnt)-1-i]!=0:
            maxd=len(cnt)-i
            break
    ans=1
    for i in range(maxd-1):
        x=cnt[i]
        for _ in range(cnt[i+1]-1):
            x=(x*cnt[i])%mod
        ans=(ans*x)%mod

    print(ans)    

if __name__ == "__main__":
    main()



Measured memory_bytes: 57772
<?php
fscanf(STDIN, "%d", $n);

for($i=1;$i<=$n;$i++){
    $start = substr($i,0, 1);
    $end = substr($i, -1);
    if($end == 0){
        continue;
    }
    @$map[$start][$end] += 1;
}

$ans = 0;
foreach($map as $key => $value){
    foreach($value as $key2 => $value2){
        if($key == $key2){
            $ans += $value2 * $value2;
        }else{
            if(isset($map[$key2][$key])){
                $ans += $value2 * $map[$key2][$key];
            }
        }
    }
}

echo $ans;

Measured memory_bytes: 4728
# 半径 a の円に内接する正十二角形の面積は 3a^2 であることが知られています。
# 整数 r が与えられるので、半径 r の円に内接する正十二角形の面積を求めて下さい。

r = gets.to_i
puts 3 * (r ** 2)

Measured memory_bytes: 1788
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	vector<int> prime;
	int range, ans;
	bool primeList[200001];

	memset(primeList, true, sizeof(primeList));

	for(int i = 2; i < 5000; i++)
	{
		if(primeList[i] == false)
			continue;

		for(int j = i*2; j < 200000; j += i)
		{
			primeList[j] = false;
		}
	}

	for(int i = 2; i < 200000; i++)
	{
		if(primeList[i] == true)
		{
			prime.push_back(i);
		}
	}

	while(cin >> range)
	{
		if(range == 0)
			break;

		ans = 0;

		for(int i = 0; i < range; i++)
		{
			ans += prime[i];
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 1540
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
 
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        int sum = 0;
        for(int i = 0; i < 3; i++) {
            if(s.charAt(i) == 'o') sum+=100;
        }
        System.out.println(700+sum);
    }
}

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

#define int long long
using ll = long long;
using ull = unsigned long long;
#define repi(n) for (long long i = 0; i < (n); ++i)
#define repj(n) for (long long j = 0; j < (n); ++j)
#define repk(n) for (long long k = 0; k < (n); ++k)
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = std::max(t, (v)))
#define updatemin(t, v) (t = std::min(t, (v)))

signed main() {
  string s;
  cin >> s;
  map<string, int> m;
  m["SSS"] = 0;
  m["SSR"] = m["SRS"] = m["RSS"] = m["RSR"] = 1;
  m["SRR"] = m["RRS"] = 2;
  m["RRR"] = 3;
  cout << m[s] << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;
#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 


int main() 
{ 
    IOS
    ll n,m,k;
    cin>>n>>m>>k;
    vll a(n);
    ll idx=0,now=0;
    bool flag=false;
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]+now<=k and !flag)
        {
            now+=a[i];
            idx++;
        }
        else
        {
            flag=true;
        }
    }
    ll ans=idx;
    ll ct=idx;

    for(ll i=0;i<m;i++)
    {
        ll x;
        cin>>x;
        now+=x;
        if(now<=k) ct++;

        if(now>k)
        {
            while(now>k and idx>0)
            {
                now-=a[idx-1];
                idx--;
                ct--;
            }
            if(now<=k) ct++;
        }
        ans=max(ans,ct);

    }
    cout<<ans<<endl;


    return 0; 
} 
/*
3 4 730
60 90 120
80 150 80 150
*/

Measured memory_bytes: 4740
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n;
    string s;
    in>>s;
    n=s.length()+1;
    vector<int> a(n);
    fr(i,n-1) if(s[i]=='<') a[i+1]=max(a[i+1],a[i]+1);
    ifr(i,n-1) if(s[i]=='>') a[i]=max(a[i],a[i+1]+1);
    ll ans=0;
    fr(i,n) ans+=a[i];
    cout<<ans<<endl;
}

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

int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  cout << n/(a+b)*a+min(n%(a+b),a);
  
  return 0;
}

Measured memory_bytes: 3604
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(0, A+1):
    for b in range(0, B+1):
        for c in range(0, C+1):
            if X == a*500+b*100+50*c:
                count+=1
print(count)

Measured memory_bytes: 39536
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

class SegTree
    attr_accessor:node,:n,:monoid
    def initialize(n,monoid)
        @monoid=monoid
        @n=1
        @n*=2 while @n<n
        @node=array(2*@n,@monoid)
    end

    def add(i,x)
      i+=@n
      @node[i]+=x
      while i>1
          i/=2
          @node[i]=@node[i*2]+@node[i*2+1]
      end
    end

    def get_sum(l,r)
        l+=@n
        r+=@n
        sum=@monoid
        while l<r
            if l.odd?
              sum=sum+@node[l] 
              l+=1
            end
            if r.odd?
                r-=1
                sum=sum+@node[r]
            end
            l/=2
            r/=2
        end
        return sum
    end
end

N,Q=get_i
st=SegTree.new(N,0)
Q.times do
    c,x,y=get_i
    if c.zero?
        x-=1
        st.add(x,y)
    else
        x-=1
        y-=1
        puts st.get_sum(x,y+1)
    end
end


Measured memory_bytes: 8944
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 10000000000000000
#define endl '\n'
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; }
using namespace std;

int n;
char s[600][600];
bool b[600][600];

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

    cin>>n;
    rep(i,n)rep(j,n){
        char c; cin>>c;
        s[i][j]=s[i+n][j]=s[i][j+n]=s[i+n][j+n]=c;
    }

    rep(i,n)rep(j,n){
        bool same=true;
        rep(k,n){
            if(s[i+k][j]!=s[i][j+k]){
                same=false; break;
            }
        }
        b[i][j]=b[i+n][j]=b[i][j+n]=b[i+n][j+n]=same;
    }

    int cnt=0;
    rep(i,n)rep(j,n){
        bool ok=true;
        rep(k,n){
            if(!b[i+k][j+k]){
                ok=false; break;
            }
        }
        if(ok)cnt++;
    }
    cout<<cnt<<endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define u +2000
#define mod 1000000007
#define int ll
using namespace std;
typedef long long ll;
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int n,a[300010],b[300010];
int val[4100][4100],ans;
int fac[9010],inv[9010];
void add(int &x,int y)
{
	x+=y; if(x>=mod) x-=mod;
	while(x<0) x+=mod;
}
inline ll qpow(ll bas,ll pw)
{
	ll ans=1; for(;pw;pw>>=1,(bas*=bas)%=mod)
		if(pw&1) (ans*=bas)%=mod;
	return ans;
}
void init()
{
	fac[0]=1; for(int i=1;i<=9000;i++) fac[i]=1ll*fac[i-1]*i%mod;
	for(int i=0;i<=9000;i++) inv[i]=1ll*qpow(fac[i],mod-2)%mod;
}
inline int C(int m,int n)
{
	return 1ll*fac[m]%mod*inv[m-n]%mod*inv[n]%mod;
}
signed main()
{
	init(); n=read();
	for(int i=1;i<=n;i++)
		a[i]=read(),b[i]=read();
	for(int i=1;i<=n;i++)
		val[-a[i] u][-b[i] u]++;
	for(int i=1;i<=4000;i++) add(val[0][i],val[0][i-1]);
	for(int i=1;i<=4000;i++) add(val[i][0],val[i-1][0]);
	for(int i=1;i<=4000;i++)
		for(int j=1;j<=4000;j++)
			add(val[i][j],val[i][j-1]),
			add(val[i][j],val[i-1][j]);
	for(int i=1;i<=n;i++)
		add(ans,val[a[i] u][b[i] u]);
	for(int i=1;i<=n;i++)
		add(ans,-C(a[i]+b[i]+a[i]+b[i],a[i]+a[i]));
	cout<<((ans*inv[2])%mod+mod)%mod<<endl;
	return 0;
}

Measured memory_bytes: 133632
K, N = map(int, input().split())
P = 998244353
fa = [1]
for i in range(1, 10000):
    fa.append(fa[-1] * i % P)
fainv = [pow(fa[-1], P-2, P)]
for i in range(1, 10000)[::-1]:
    fainv.append(fainv[-1] * i % P)
fainv = fainv[::-1]
def C(a, b):
    if not (a >= 0 and 0 <= b <= a): return 0
    return fa[a] * fainv[a-b] * fainv[b] % P

A = []
for i in range(1, (K+1)//2+1):
    s = 0
    for j in range(i+1):
        s += C(N+K-1-2*j, K-1) * C(i, j) * (-1) ** j
        s %= P
    A.append(s)
for i in range(2*K-1):
    print(A[min(i//2, (2*K-i-2)//2)])

Measured memory_bytes: 49756
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
#include <string>
#define int long long
#define P pair<int,int>
#define vec vector<int>
#define rep(i,n) for(int i=0;i<n;i++)
#define vsort(vec) sort(vec.begin(),vec.end())
using namespace std;
signed main() {
	int n, cnt = 0, ioicnt = 0;
	bool b[8] = { false,false,false,false,false,false,false,false };
	cin >> n;
	rep(i, n) {
		int a;
		cin >> a;
		if (!(b[0]) && a < 400) {
			cnt++;
			b[0] = true;
		}
		else if (!(b[1]) && 400 <= a && a < 800) {
			cnt++;
			b[1] = true;
		}
		else if (!(b[2]) && 800 <= a && a < 1200) {
			cnt++;
			b[2] = true;
		}
		else if (!(b[3]) && 1200 <= a && a < 1600) {
			cnt++;
			b[3] = true;
		}
		else if (!(b[4]) && 1600 <= a && a < 2000) {
			cnt++;
			b[4] = true;
		}
		else if (!(b[5]) && 2000 <= a && a < 2400) {
			cnt++;
			b[5] = true;
		}
		else if (!(b[6]) && 2400 <= a && a < 2800) {
			cnt++;
			b[6] = true;
		}
		else if (!(b[7]) && 2800<=a && a < 3200) {
			cnt++;
			b[7] = true;
		}
		else if (a >= 3200)ioicnt++;
	}
	cout << max(1ll, cnt) << " " << cnt + ioicnt << endl;
	system("PAUSE");
	return 0;
}


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

int main() {
  int64_t N;
  cin >> N;
  int64_t answerX, answerY;
  for (int i=floor(sqrt(N)); i>0; i--) {
    if (N%i == 0) {
      answerX = i;
      answerY = N/i;
      break;
    }
  }
  int64_t answer = answerX+answerY-2;
  cout << answer << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String sd = max(sc.next(), false);
		String td = max(sc.next(), true);
		if (td.compareTo(sd) > 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
	
	public static String max(String s, boolean flag) {
		char[] arr = s.toCharArray();
		Arrays.sort(arr);
		StringBuilder sb = new StringBuilder(new String(arr));
		if (flag) {
			sb.reverse();
		}
		return sb.toString();
	}
}


Measured memory_bytes: 21204
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = Integer.parseInt(scan.nextLine());
    String str = scan.nextLine();
    String[] strs = str.split(" ");
    int[] nums = new int[n];
    for (int i = 0; i < n; i++) {
      nums[i] = Integer.parseInt(strs[i]);
    }
    int count = 0;

    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if(nums[i] == nums[j]) continue;
        for (int k = j + 1; k < n; k++) {
          if (nums[i] == nums[k] || nums[j] == nums[k]) continue;
          if(nums[i] + nums[j] <= nums[k] || nums[j] + nums[k] <= nums[i] || nums[i] + nums[k] <= nums[j]) continue;
//          System.out.println("(i,j,k) = (" + (i+1) + "," + (j+1) + "," + (k+1) + ")");
          count++;
        }
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 36408
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
    int n;
    cin>>n;
    int a[n+8];
    Rep(i,1,n+1){
        cin>>a[i];
    }
    ll b[n+8];
  
  rep(i,n+1) b[i]=0;
  
  Rep(i,1,n+1){
    int j=n+1-i;
    int c=1;
    int now=0;
    while(j*c<=n){
      now+=b[j*c];
      c++;
    }
    now=now%2;
    if(now!=a[j]) b[j]=1;
    //cout<<j<<' '<<n<<endl;
  }
  
  int m=0;
  Rep(i,1,n+1){
    m+=b[i];
  }
  cout<<m<<endl;
  Rep(i,1,n+1){
    if(b[i]==1){
      cout<<i<<endl;
    }
  }
  //cout<<a[1]<<endl;
    
}



Measured memory_bytes: 3200
#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 INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int H,W;
  cin >> H >> W;
  vector<string> A(H);
  map<char,int> mp;
  REP(i, H) cin >> A[i];
  REP(i,H){
    REP(j,W){
      mp[A.at(i).at(j)]++;
    }
  }
  
  int Four = (H/2)*(W/2);
  int Two=0,One=0;
  if(H%2==1&&W%2==0){
    Two = W/2;
  }
  if(H%2==0&&W%2==1){
    Two = H/2;
  }
  if(H%2==1&&W%2==1){
    Two = H/2+W/2;
    One = 1;
  }

  int p=0,q=0,r=0;
  for(auto x:mp){
    if(x.second%4==0){
      p+=x.second/4;
    }else if(x.second%2==0){
      q+=(x.second%4)/2;
      p+=x.second/4;
    }else{
      r++;
      int y = x.second-1;
      if(y%4==0){
        p+=y/4;
      }else if(y%2==0){
        q+=(y%4)/2;
        p+=y/4;
      }
    }
  }

  int flag = 0;
  if(r!=One){
    flag = 1;
  }else if(Two<q){
    flag=1;
  }else{
    Two-=q;
    if(Two%2!=0||Two/2>p){
      flag = 1;
    }else{
      p-=Two/2;
      if(p!=Four){
        flag=1;
      }
    }
  }

  if(flag==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main()
{
	int a;
	cin>>a;
	vector<bool>v(100000);
	v[a]=true;
	for(int i=2;true;i++)
	{
		if(a%2==0)a/=2;
		else a=a*3+1;
		if(v[a]){cout<<i<<endl;break;}
		v[a]=true;
	}
	return 0;
}

Measured memory_bytes: 256
n=int(input())

def factorize(n):
    fct=[]
    b,e=2,0
    while b*b<=n:
        while n%b==0:
            n=n//b
            e=e+1
        if e>0:
            fct.append((b,e))
        b,e=b+1,0
    if n>1:
        fct.append((n,1))
    return fct

def d(n):
    l=factorize(n)
    r=1
    for i,j in l:
        r*=int(j)+1
    return r
ans=0

import math
ans=d(math.factorial(n))%1000000007

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;

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

    multiset<long long int> a, b;
    for(int i=0; i<n; i++){
        long long int num;
        cin >> num;

        if(num >= 0) a.insert(num);
        if(num <  0) b.insert(-num);
    }
    int negative = b.size();

    long long int ans = 1;
    if(n == k){
        for(auto aa : a){ ans *= aa; ans %= MOD; }
        for(auto bb : b){ ans *= bb; ans %= MOD; }
        if(b.size() % 2 == 1){
            ans *= -1;
            ans = (ans % MOD + MOD) % MOD;
        }
    }
    else if(k % 2 == 1 && negative == n){
        for(int i=0; i<k; i++){
            ans *= *b.begin();
            ans %= MOD;
            b.erase(b.begin());
        }
        ans *= -1;
        ans = (ans % MOD + MOD) % MOD;
    }
    else{
        int count = 0;
        while(count < k){
            if(count == k-1 || b.size() <= 1){
                ans *= *prev(a.end());
                ans %= MOD;
                a.erase(prev(a.end()));

                count += 1;
            }
            else if(a.size() <= 1){
                ans *= *prev(b.end());
                ans %= MOD;
                b.erase(prev(b.end()));

                ans *= *prev(b.end());
                ans %= MOD;
                b.erase(prev(b.end()));

                count += 2;
            }
            else{
                auto a1 = prev(a.end());
                auto a2 = prev(a1);
                auto b1 = prev(b.end());
                auto b2 = prev(b1);

                if(*a1 * *a2 > *b1 * *b2){
                    ans *= *prev(a.end());
                    ans %= MOD;
                    a.erase(prev(a.end()));

                    count += 1;
                }
                else{
                    ans *= *prev(b.end());
                    ans %= MOD;
                    b.erase(prev(b.end()));

                    ans *= *prev(b.end());
                    ans %= MOD;
                    b.erase(prev(b.end()));

                    count += 2;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12920
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;



int main()
{
   
   
    int n, d;
    cin >> n >> d;
    int ans = 0;
    while (n--) {
        double a, b;
        cin >> a >> b;
        if ((double)d * d >= a * a + b * b)ans++;
    }
    cout << ans << endl;
    
    return 0;

}

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

using ll = long long;
#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 INF 1e9
// constexpr ll INF = 1LL << 60;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  REP(i, N){
    cin >> A[i];
  }
  ll cnt = 0;
  int pre = 0;
  bool isOk = true;
  REPR(i, N-1){
    if(A[i] < pre-1){
      isOk = false;
      break;
    }
    if(pre-1 == A[i]){
      pre = A[i];
    }
    else if(A[i] > i){
      isOk = false;
      break;
    }
    else{
      cnt += A[i];
      pre = A[i];
    }
  }
  if(isOk){
    cout << cnt << endl;
  }
  else{
    cout << -1 << endl;
  }
  return 0;
}



Measured memory_bytes: 1024
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

template<typename T> T mo(T x, T y) { x %= y; return x <= 0 ? x + y : x; }

const int MX = 107;

bool g[MX][MX];

int main() {
#ifdef FASTIO
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
    int n;
    cin >> n;
    bool ev = (n % 2 == 1);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            if (i != j) {
                g[i][j] = true;
            }
        }
    }
    for (int l = 1, r = (ev ? n - 1 : n); l < r; l++, r--) {
        g[l][r] = g[r][l] = false;
    }
    int sm = 0;
    for (int i = 1; i <= n; i++) {
        if (g[1][i]) {
            sm += i;
        }
    }
    vector<pair<int, int> > ans;
    for (int i = 1; i <= n; i++) {
        int csm = 0;
        for (int j = 1; j <= n; j++) {
            if (g[i][j]) {
                if (i < j) {
                    ans.emplace_back(i, j);
                }
                csm += j;
            }
        }
        assert(csm == sm);
    }

    cout << ans.size() << "\n";
    for (const auto& e : ans) {
        cout << e.first << " " << e.second << "\n";
    }
    return 0;
}



Measured memory_bytes: 384
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int main(){
    //~ freopen("file.in", "r", stdin);
    int n,k;
    ll ans=0;
    scanf("%d%d",&n,&k);
    if(!k){
		printf("%lld\n",n*1LL*n);
		return 0;
	}
	for(int i=k+1;i<=n;i++){//second number
		for(int j=0;j<=n;j+=i){//first number
			int a=j+k,b=min(n,j+i-1);
			ans+=max(0,b-a+1);
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define unique(a)  (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define mod 1000000007
typedef long long LL;
#define int long long
typedef long double LD;
typedef vector<int> VI;
inline LL add(LL x, LL y) { x += y; if (x >= mod) x -= mod; return x; }
inline LL moduloMultiplication(LL x, LL y) {
	return (x%mod * 1LL * y%mod) %

		mod;
}
inline LL power(LL a, LL b) {
	LL x = 1 % mod;
	while (b) {
		if (b & 1) x = moduloMultiplication(x, a);
		a = moduloMultiplication(a, a);
		b >>= 1;
	}
	return x % mod;
}

inline LL inv(LL a) { return power(a, mod - 2) % mod; }
LL gcd(LL a, LL b)
{
	if (!a)
		return b % mod;
	return gcd(b%a, a) % mod;
}

signed main()
{
	fastio;
	int arr[3][3];
	rep(i, 3) {
		rep(j, 3)cin >> arr[i][j];
	}
	int n;
	cin >> n;
	while (n--) {
		int a;
		cin >> a;
		rep(i, 3) {
			rep(j, 3) {
				if (arr[i][j] == a)arr[i][j] = 0;
			}
		}
	}
	bool pos = false;
	rep(i, 3) {
		if (!(arr[i][0] || arr[i][1] || arr[i][2])) {
			pos=true;
		}
		if (!(arr[0][i] || arr[1][i] || arr[2][i])) {
			pos = true;
		}
	}

	if (!(arr[0][0] || arr[1][1] || arr[2][2]))pos = true;
	if (!(arr[0][2] || arr[1][1] || arr[2][0]))pos = true;

	if (pos)cout << "Yes";
	else cout << "No";

}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);

#define debug(x) (#x " : " + to_string(x))
#define debug_cout(x) (cout << #x << " : " << to_string(x) << endl)
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair((a), (b));
using namespace std;
using ll = long long;
//#define int long long
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
constexpr int INF = (int)2e9;

/*****/

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

	sort(all(d));

	int res = d[N / 2] - d[N / 2 - 1];

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
int main(){
    int N,K,Q; cin >> N >> K >> Q;
    vector<int> A(Q+1);
    for(int i=1;i<=Q;i++) cin >> A[i];
    vector<int> num(100005);
    for(int i=1;i<=Q;i++) num[A[i]]++;
    for(int i=1;i<=N;i++) printf("%s%c",(K-Q+num[i])>0? "Yes":"No",'\n');
    
}

Measured memory_bytes: 1408
#include <iostream>
#include <stdlib.h>
#include <algorithm>

using namespace std;

int main(int argc, char **argv)
{
	int *a, *a2, m, n, t1, t2;
	
	while(1){
		cin >> n >> m;
		if(n == 0 && m == 0){
			break;
		}
		
		a = (int *)calloc(n-m+1, sizeof(int));
		a2 = (int *)calloc(n, sizeof(int));
		
		for(int i = 0; i < n; i++){
			cin >> t1;
			a2[i] = t1;
		}
		
		for(int i = 0; i < m; i++){
			a[0] += a2[i];
		}
		
		for(int i = 0; i < n-m; i++){
			a[i+1] += (a2[m+i] + a[i] - a2[i]);
		}
		
		sort(a, a+(n-m+1));
		
		cout << a[n-m] << endl;
		
		free(a2);
		free(a);
	}
	
	return 0;
}

Measured memory_bytes: 1268
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

    int l=0, r=N;
    for(int i=0; i<M; i++) {
        int Li, Ri;
        cin >> Li >> Ri;
        l = max(l, Li);
        r = min(r, Ri);
    }

    cout << max(0, r - l + 1) << endl;

    return 0;
}

Measured memory_bytes: 256
a, b, c = list(map(int, input().split()))
count = 0
l = sorted([a, b, c])
dif = l[2]-l[1]
l[0] += dif
l[1] += dif
count += dif
if (l[2]-l[0]) % 2 == 0:
    count += (l[2]-l[0])//2
else:
    count += (l[2]-l[0])//2 + 2

print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int a,b;
    cin>>a>>b;
    long int x=(a+b)/2;
    if(abs(a-x)==abs(b-x))
    {
        cout<<x<<endl;
    }
    else
    {
        cout<<"IMPOSSIBLE\n";
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(n * a, b) << endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>

using namespace std;

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

void solve() {
	int a,b,c,d,e,k;
	cin >> a >> b >> c >> d >> e >> k;
	if(e-a > k) cout << ":(";
	else cout << "Yay!";
	cout << endl;
}

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


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

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

Measured memory_bytes: 512
using System;
namespace ITP1 {
	class Program {
		public static void Main() {
			string[] input = Console.ReadLine().Split(' ');
			int a = int.Parse(input[0]);
			int b = int.Parse(input[1]);

			Console.WriteLine(a * b + " " + 2 * (a + b));
		}
	}
}



Measured memory_bytes: 9100
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

int nl[10];
int swp;
int n,k,s,t,p;

bool pd(int x){
    while(x){
        swp = x % 10;
//        cout << swp << endl;
        if(nl[swp] == 1){
            return false;
        }
        x /= 10;
    }
    return true;
}

int main()
{
    cin >> n >> k;
    for(int i = 0; i < k; i++){
        cin >> p;
		nl[p] = 1;
    }
    for(int i = n; i<999999; i++){
//    cout << nl[3] << endl;
//	cout << pd(i) << endl;
        if(pd(i)){
            cout << i << endl;
            return 0;
        }
        else continue;
    }
    return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

#define MAX_NUM 1000000000000000000

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  READ(N);

  bool is_zero_included = false;

  std::vector<ll> A(N, 0);
  for (size_t i = 0; i < N; i++) {
    READ(A[i]);
    if (A[i] == 0) {
      is_zero_included = true;
    }
  }

  // main procedure
  ll prod = 1;

  if (is_zero_included) {
    prod = 0;
  } else {
    for (size_t i = 0; i < N; i++) {
      ll allowed_max = MAX_NUM / prod;
      if (A[i] > allowed_max) {
        prod = -1;
        break;
      } else {
        prod *= A[i];
      }
    }
  }

  // output
  WRITE_N(prod);

  return 0;
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s, t;
	cin >> s >> t;
	cout << t << s;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		int n = arr.length;
		int nextL = 0;
		int nextR = 0;
		int[] org = new int[n];
		for (int i = 0; i < n; i++) {
			if (arr[i] == 'R') {
				if (nextL < i) {
					nextL = i;
				}
				while (arr[nextL] == 'R') {
					nextL++;
				}
				if ((nextL - i) % 2 == 0) {
					org[nextL]++;
				} else {
					org[nextL - 1]++;
				}
				nextR = i;
			} else {
				if ((i - nextR) % 2 == 0) {
					org[nextR]++;
				} else {
					org[nextR + 1]++;
				}
			}
		} 
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			if (i != 0) {
				sb.append(" ");
			}
			sb.append(org[i]);
		}
		System.out.println(sb);
	}
}


Measured memory_bytes: 27864
//PseudoName

    #pragma GCC optimize("O3")
    #include <bits/stdc++.h>
/*
	#include <ext/pb_ds/assoc_container.hpp>
	#include <ext/pb_ds/tree_policy.hpp>
	using namespace __gnu_pbds;
	template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/
    #define FOR(i,n) for(i=0;i<n;i++)
    #define FOR1(i,n) for(i=1;i<=n;i++)
    #define FOR2(I, A, B) for (int I = (A); I <= (B); ++I)
    #define pb push_back
    #define unique_sort(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
    #define print(v) for(auto it:v)cout<<it<<" ";cout<<endl
    #define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define endl "\n"
    #define min3(a,b,c) min(a,min(b,c))
    #define forr(n) for(int i=0;i<n;i++)
    #define frr(n) for(int i=1;i<=n;i++)
    #define MAX 200005
    #define inf 200008

    using namespace std;

    typedef long long ll;
    typedef long li;
    typedef vector<int> vi;
    typedef vector<ll> vli;
    typedef vector<vi> vvi;
    typedef vector<vli> vvli;
    typedef pair<int,int> pi;
    typedef pair<ll,ll> pli;
    typedef vector<pi> vpi;
    typedef vector<pli> vpli;


    int ab(int n)
    {
        if(n<0)return -n;
        else
            return n;
    }

    int main() {
        fast();
        int n,k;
        cin>>n>>k;
        int a[n];
        int dp[n+1]={0};
        forr(n)
        {
            cin>>a[i];
        }

        dp[0]=0;
       // dp[1]=abs(a[1]-a[0]);

        int mx;
        if(n==2){cout<<ab(a[1]-a[0])<<endl;exit(0);}
        for(int i=1;i<n;i++)
        {
            mx=INT_MAX;
            for(int j=min(k,i);j>0;j--)
            {
                mx=min(mx,dp[i-j]+abs(a[i]-a[i-j]));
            }
            dp[i]=mx;

        }
      //  forr(n)cout<<dp[i]<<" ";
        //cout<<endl;
        cout<<dp[n-1]<<endl;


    }


Measured memory_bytes: 1024
n = gets.to_i
a = gets.split.map &:to_i

n.times do |i|
  v = a[i]
  j = i - 1
  while j >= 0 && a[j] > v
    a[j+1] = a[j]
    j -= 1
  end
  a[j+1] = v
  puts a.join(" ")
end



Measured memory_bytes: 6880
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

const double EPS = 1e-9;

bool equal(double a) {
    return abs(a) < EPS*100;
}

int main() {
    double xa,ya,xb,yb,xc,yc,xd,yd;
    while(cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd) {
        double AB, CD;
        AB = (xa-xb)/(ya-yb+EPS);
        CD = (xc-xd)/(yc-yd+EPS);
        if (equal(AB*CD+1) || (equal(AB) && !equal(CD)) || (equal(CD) && !equal(AB))) {
            cout << "YES" << endl;
        }else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

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

  double ans = 0;
  for (int i = 1; i <= N; i++) {
    // 現在の得点が既にK以上の場合、勝つ確率を計算し加える
    if (i >= K) {
      ans += (double)(1.0 / (double)N);
      continue;
    }

    int num_coin_wins = 0;
    for (int j = i; j <= K - 1; j *= 2) {
      num_coin_wins++;
    }
    // コインの振る回数を考慮し、勝つ確率を計算し加える
   ans += ((double)(1.0 / (double)N)) *
           ((double)(1.0 / (double)pow(2, num_coin_wins)));
  }

  printf("%.12f", ans);
  return 0;
}

Measured memory_bytes: 256
//Program.cpp
//Problem Statement - 

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

//Author: Varun Goyal (@govarun)

#define f(i, n) for(int i=0;i<(n);++i)
#define fa(i, a, n) for(int i=(a);i<=(n);++i)
#define fd(i, a, n) for(int i=(a);i>=(n);--i)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define popb pop_back
#define ull unsigned long long
#define debug if(GOVARUN) cerr
#define d0(x) debug <<#x<<" = "<<x<<' '
#define d1(x) debug <<"> "<<#x<<" = "<<x<<'\n'
#define d2(x, y) debug <<"> "<<#x<<" = "<<x<<' '<<#y<<" = "<<y<<'\n'
#define d3(x, y, z) debug <<"> "<<#x<<" = "<<x<<' '<<#y<<" = "<<y<<' '<<#z<<" = "<<z<<'\n'
#define endl '\n'
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector< pair<int, int> > vpii;
inline bool EQ(double a, double b) { 
return fabs(a-b) < 1e-9; }
inline int two(int n) { return 1 << n; }

const ll mod = 1e9 + 7;
const int maxn = 1e5 + 5;

void pre(){

    
}


void solve();

int main(){
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    #ifdef GOVARUN
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #else 
    #define GOVARUN 0
    #endif
    int TC = 1;
    // cin >> TC;
    while(TC--){    
        solve();
    }

    return 0;
}

void solve(){
    int n; cin >> n;
    int points[3][n];
    f (i, n) {
        cin >> points[0][i];
        cin >> points[1][i];
        cin >> points[2][i];
    }
    int happ[3][n];
    happ[0][0] = points[0][0];
    happ[1][0] = points[1][0];
    happ[2][0] = points[2][0];

    fa (i, 1, n - 1) {
        happ[0][i] = points[0][i] + max(happ[1][i - 1], happ[2][i - 1]); 
        happ[1][i] = points[1][i] + max(happ[0][i - 1], happ[2][i - 1]); 
        happ[2][i] = points[2][i] + max(happ[0][i - 1], happ[1][i - 1]); 
    }
    cout << max(happ[0][n - 1], max(happ[1][n - 1],happ[2][n - 1]));
}

Measured memory_bytes: 2560
S = input()
N = len(S)
C = set(S)
ans = N-1
for c in C:
    T = list(S)
    tmp = 0
    for i in range(N):
        if len(set(T))==1 : 
            ans = min(ans,tmp)
            break
        tmp += 1
        T = [c if a == c else b for a,b in zip(T[:-1],T[1:])]
print(ans)

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;


int main() {
	int N;
	while(scanf("%d", &N), N) {
		int ans = 0;
		while(N) ans += N /= 5;
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3108