akhauriyash/Code-Regression huggingface dataset:
alphabet = {}
[*"a".."z"].each do |s|
    alphabet[s] = 0
end

while input = gets
    input.chomp.downcase.split("").each do |s|
        if alphabet[s] != nil
            alphabet[s] += 1
        end
    end
end

alphabet.each do |key, value|
    puts "#{key} : #{value}"
end


Measured memory_bytes: 6872
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, K, S = mi()
A = [0]*N

if N == 1:
    print(S)
    exit()
if K==N:
    for i in range(N):
        print(S, end="")
        if i != N-1:
            print(' ', end="")
    exit()
if S == 1:
    for i in range(K):
        print(1, end="")
        if i != N-1:
            print(' ', end="")
    for i in range(K, N):
        print(2, end="")
        if i != N-1:
            print(' ', end="")
    exit()

mod = 10**9
if not S % 2:
    for i in range(K+1):
        A[i] = S//2
    for i in range(K+1, N):
            A[i] = (S + 1) % mod + 1
else:
    for i in range(K+1):
        if i % 2:
            A[i] = S//2
        else:
            A[i] = S//2 + 1
    for i in range(K+1, N):
        A[i] = (S + 1) % mod + 1

for i, num in enumerate(A):
    print(num, end="")
    if i != N-1:
        print(' ', end="")

Measured memory_bytes: 8308
"use strict"

function Main(input) {
  input = input.trim();
  if(input === 'Sunny') console.log('Cloudy');
  if(input === 'Rainy') console.log('Sunny');
  if(input === 'Cloudy') console.log('Rainy');
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define sz size
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
#define FORRN(i,a,b) for (int i = (a); i >= (b); i--)
#define FORR(i,a,b) for (int i = (a); i > (b); i--)
typedef unsigned long long ull;
typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);

    ll n,m;
    cin >> n >> m;

    if(m==2){
    	if(n>=1){
    		cout << 1 << endl;
    		return 0;
    	}else{
    		cout << 0 << endl;
    		return 0;
    	}
    }
    
    /*if(m/2<=n){
    	cout << m/2 << endl;
    	return 0;
    }*/

    ll res=min(n,m/2);
    n-=res;
    m-=2*res;

    res+=m/4;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define REP(i,n) for(int i=0;i<n;++i)
using namespace std;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  cout << (b % a == 0 ? a + b : b - a) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a != b && b == c) {
    cout << "Yes" << endl;
  }
  
  else if (a == b && b != c) {
    cout << "Yes" << endl;
  }
  
  else if (b != c && a == c) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
    

}


Measured memory_bytes: 256
#ifndef _STD
#define _STD
#include<bits/stdc++.h>
#endif

#define int long long int
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repm(a,b,c) for(int a=(b-1);a>=c;a--)
#define pb push_back
#define str string
#define sf(a) scanfs("%d",&a)
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define clean(used) memset(used,false,sizeof(used))

using namespace std;

static const double EPS = 1e-10;
static const int INF = (const int) (1e18 + 9);
static const int Mod = (const int) (1e9 + 7);
inline int replac(str s){double ans=0;rep(i,0,s.length()){ans+=(s[i]-'0')*pow(10,s.length()-i-1);}return (int)ans;}
inline string numstr(int m){str s="";while(m>0){char c;int a=m/10;if(a>0)a=m%(a*10);else a=m;c=(char)('0'+a);s+=c;m/=10;}str st="";for(int i=s.size()-1;i>=0;i--){st+=s[i];}return st;}
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<pair<int,pii>> ipii;

struct block{

    bool used[52] = {false};

    bool in(int x, int y, int n, int m){
        if(x < 0 || y < 0 || x >= n || y >= m)return false;
        return true;
    }
};


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int frag[2][53];
    int n;
    str t,y;
    cin >> n;
    cin >> t >> y;
    int ans = 1;
    bool mae_t = false;
    rep(i,0,n){
        if(t[i] != y[i]){
            //横並び
            if(i == 0){
                ans *= 6;
            }else if(mae_t){
                ans *= 2;
            }else{
                ans *= 3;
            }
            i++;
            ans %= Mod;
            mae_t = false;
        }else{
            //縦並び
            if(i == 0){
                ans *= 3;
            }else if(mae_t){
                ans *= 2;
            }
            ans %= Mod;
            mae_t = true;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int a[22][22];
long d[1 << 16];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			cin >> a[i][j];
	for (int i = 1; i < 1 << n; i++) {
		int j = 0;
		while (!(i & 1 << j)) j++;
		d[i] = d[i ^ 1 << j];
		for (int k = j; ++k < n;)
			if (i & 1 << k) d[i] += a[j][k];
	}
	for (int i = 1; i < 1 << n; i++) {
		int k = i & i - 1;
		for (int j = k; j; j = k & j - 1)
			d[i] = max(d[i], d[j] + d[i^j]);
	}
	cout << d[(1 << n) - 1] << endl;
	return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int a, b, c;
  cin >> a >> b >> c;
  int ans = c - (a - b);
  if(ans >= 0) {
    cout << ans << endl;
  }else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <map>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;


int main() {

    string S,T;
    cin >> S;
    cin >> T;
    for(int i=0;i<S.size();i++){
        if(S[i]!=T[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3624
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(int i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define fi first
#define se second
#define endl '\n'
#define trav(x,A) for(auto &x:A)
#define veci vector<int>
#define vecl vector<long long>
#define FORI(a,b,c) for(int a=b;a<c;a++)
#define FORD(a,b,c) for(int a=b;a>c;a--)
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

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

	READV(N);
	READAR(A,N);
	ll ans=0;
	FORI(i,1,N-1)
	{
		vecl X;
		X.push_back(A[i-1]);
		X.push_back(A[i]);
		X.push_back(A[i+1]);
		sort(X.begin(), X.end());
		if (A[i]==X[1])
		{
			ans++;
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=998244353, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;


long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll a, b, c, d;
ll dp[3001][3001];

ll solve(ll h, ll w){
	if(dp[h][w] != -1LL) return dp[h][w];
	if(h == a && w == b){
		return 1LL;
	}
	if(h == a){
		return dp[h][w] = modpow(h, w - b);
	}
	if(w == b){
		return dp[h][w] = modpow(w, h - a);
	}
	return dp[h][w] = (( (solve(h, w - 1) * h) % mod + (solve(h - 1, w) * w) % mod ) % mod  -((solve(h-1, w-1) * (h-1)) % mod * (w-1))) % mod;
}

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    memset(dp, -1, sizeof(dp));
    cin >>a >> b >> c >> d;
    dp[a][b] = 1;
    cout << (solve(c, d) + mod) % mod << endl;
    return 0;
}


Measured memory_bytes: 74224
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define bs binary_search
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ipr pair<ll,ll>
#define ps push_back
#define fs first
#define sc second
#define mkp make_pair
#define mod 1000000007
int main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  
  ll a,i,j,k,l,n,b;
  cin>>a>>b;
  a--;
  if(a%4==0) k=a;
  else if(a%4==1) k=1;
  else if(a%4==2) k=a+1;
  else if(a%4==3) k=0;
  
  if(b%4==0) l=b;
  else if(b%4==1) l=1;
  else if(b%4==2) l=b+1;
  else if(b%4==3) l=0;
  
  cout<<(k^l);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const char ASCII_L_OFFSET = 0x61;
using namespace std;

int main() {
    const int MAX_LEN = 1e5;
    int ans = -1;
    string s;
    cin >> s;
    if(s.size() == 2) {
        if(s[0] == s[1]) {
            cout << 1 << " " << 2 << endl;
        } else {
            cout << -1 << " " << -1 << endl;
        }
        return 0;
    }
    for(int i = 0; i < s.size() - 2; i++) {
        for(int j = 0; j < 3; j++) {
            if ((s[i + j] == s[i + (j + 1) % 3]) &&
                (s[i + (j + 1) % 3] != s[i + (j + 2) % 3]) &&
                (s[i + j] != s[i + (j + 2) % 3])) {
                cout << i + 1 << " " << i + 3 << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
using std::cout;
using std::cin;
using std::endl;

int main(){
	int tmp,S=0,T=0;
	for(int i; i<4; i++){
		cin >> tmp;
		S+=tmp;
	}
	for(int i; i<4; i++){
		cin >> tmp;
		T+=tmp;
	}
	if(S>T)
		cout << S << endl;
	else
		cout << T << endl;
	return 0;
}

Measured memory_bytes: 0
from math import sqrt, fabs


class Circle:
    def __init__(self, x, y, r):
        self.x = x
        self.y = y
        self.r = r
        self.eps = 1e-8

    def contain(self, x, y):
        d2 = (self.x - x) ** 2 + (self.y - y) ** 2
        return d2 <= self.r ** 2 + self.eps

    def intersect(self, other):
        eps = self.eps

        if self.r > other.r:
            x1, y1, R = self.x, self.y, self.r
            x2, y2, r = other.x, other.y, other.r
        else:
            x1, y1, R = other.x, other.y, other.r
            x2, y2, r = self.x, self.y, self.r
        d = sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

        # d = 0 and R = r
        if fabs(d) < eps and fabs(R - r) < eps:
            return '相同', None

        # d == R - r
        if fabs(d - (R - r)) < eps:
            x3 = (R * x2 - r * x1) / (R - r)
            y3 = (R * y2 - r * y1) / (R - r)
            return '內切', [(x3, y3)]

        # d == R + r
        if fabs(d - (R + r)) < eps:
            x3 = (R * x1 + r * x2) / (R + r)
            y3 = (R * y1 + r * y2) / (R + r)
            return '外切', [(x3, y3)]

        # d < R - r
        if d < R - r + eps:
            return '內離', None

        # d > R + R
        if d > R + r + eps:
            return '外離', None

        # R - r < d < R + r
        a = (R ** 2 - r ** 2 + d ** 2) / (2 * d)
        h = sqrt(R ** 2 - a ** 2)
        cx = x1 + a * (x2 - x1) / d
        cy = y1 + a * (y2 - y1) / d
        x3 = cx + h * (y2 - y1) / d
        y3 = cy - h * (x2 - x1) / d
        x4 = cx - h * (y2 - y1) / d
        y4 = cy + h * (x2 - x1) / d
        return '相交', [(x3, y3), (x4, y4)]


N, K = map(int, input().split())
X, Y, C = [], [], []
for _ in range(N):
    x, y, c = map(int, input().split())
    X.append(x)
    Y.append(y)
    C.append(c)


def check(t):
    circles = [Circle(x, y, t / c) for x, y, c in zip(X, Y, C)]

    cands = []
    for i in range(N):
        cands.append((X[i], Y[i]))
        for j in range(i + 1, N):
            kind, points = circles[i].intersect(circles[j])
            if kind in ['相交', '內切', '外切']:
                cands.extend(points)

    for (x, y) in cands:
        cnt = sum(1 for circle in circles if circle.contain(x, y))
        if cnt >= K:
            return True

    return False


# 0 0 0 1 1 1
lb, ub = 0, 1e9
for _ in range(100):
    mid = (lb + ub) / 2
    if check(mid):
        ub = mid
    else:
        lb = mid
print(ub)


Measured memory_bytes: 81048
#include<iostream>
using namespace std;
int main()
{
  int n,k,i;
  cin>>n>>k;
  int arr[n];
  for(i=0;i<n;i++)	cin>>arr[i];
  int count=0;
  for(i=0;i<n;i++)	if(arr[i]>=k)	count++;
  cout<<count<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;
// const int INF=1010101010;
using Graph = vector<vector<int>>;

int main() {
  double a, b, c, d;
  cin >> a >> b >> c >> d;
  while (true) {
    c = c - b;
    if (c <= 0) {
      cout << "Yes" << endl;
      break;
    }
    a = a - d;
    if (a <= 0) {
      cout << "No" << endl;
      break;
    }
  }
}


Measured memory_bytes: 3672
#include <iostream>

using namespace std;

int main()
{
	int h1, h2, m1, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int hk = k / 60;
	int mk = k % 60;
	h2 -= hk;
	if (mk > m2) {
		h2--;
		m2 = m2 + 60 - mk;
	} else {
		m2 -= mk;
	}
	cout << (h2 - h1) * 60 + (m2 - m1) << endl;
		 
	return 0;
}

Measured memory_bytes: 3624
N = int(input())
B = list(map(int, input().split()))
def check_pos(L):
    num_L = len(L)
    ans = True
    for idx_L in range(num_L):
        if L[idx_L] > idx_L + 1:
            ans = False
            break
    return ans

if check_pos(B) == False:
    print(-1)
else:
    ans = []
    num_L = len(B)
    for i in range(num_L):
        idx = 0
        for j in range(len(B)):
            if B[j] == j + 1:
                idx = j
        ans.append(idx + 1)
        B.pop(idx)
    ans.reverse()
    for x in ans:
        print(x)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  ll a[n];
  rep(i,n) R a[i];
  int ans=0,c=0;
  rrep(i,n-1) {
    if(a[i]>=a[i+1]) c++;
    else c=0;
    ans=max(ans,c);
  }
  pr(ans);
}

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


Measured memory_bytes: 1024
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}
ll gcd(ll a,ll b){
if(a==0||b==0)return max(a,b);
if(b>a)swap(a,b);
 while(1){
        if(a%b!=0){
            ll tmp=b;b=a%b;
            a=tmp;
        }else{
            return b;
        }
    }
}
int main(){

    ll n,m;
    cin>>n>>m;
    vector<ll> v;

    rep(i,n){

        ll a;
        cin>>a;
        v.push_back(a);

    }

    bool f=false;
    ll count=0;
    rep(i,n){
        ll cc=0;
       while(v[i]/2>=1&&v[i]%2==0){
           v[i]/=2;
           cc++;
       }

       if(!f){
           count=cc;
           f=true;
       }else{
           if(count!=cc){
               cout<<0<<endl;
               return 0;
           }
       }
    }

    ll k=v[0]*(1<<(count));

    k/=2;
    rep(i,n-1){
        v[i+1]=v[i+1]*(1<<(count));
        v[i+1]/=2;
        k=k*v[i+1]/gcd(k,v[i+1]);
    }
    ll ans = m/k;

    ans=(ans+1)/2;


    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
char ans[233][233];

int main()
{
	int x,y,n=100;
	scanf("%d%d",&x,&y);
	for(int i=0;i<50;i++)
	{
		for(int j=0;j<n;j++)
		{
			ans[i][j]='.';
		}
	}
	for(int i=50;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			ans[i][j]='#';
		}
	}
	for(int i=1,a=0,b=0;i<y;i++)
	{
		ans[a][b]='#';
		b+=2;
		if(b==n)a+=2,b=0;
	}
	for(int i=1,a=99,b=0;i<x;i++)
	{
		ans[a][b]='.';
		b+=2;
		if(b==n)a-=2,b=0;
	}
	printf("%d %d\n",n,n);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			putchar(ans[i][j]);
		}
		puts("");
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
int d,c[26],s[365][26],t[365],v[365],lst[26];

void calc_satisfaction(){
  int stsf=0;
  REP(i,d){
    stsf+=s[i][t[i]-1];
    lst[t[i]-1]=i+1;
    REP(j,26) stsf-=c[j]*(i+1-lst[j]);
    v[i]=stsf;
  }
}

int main(){
  cin>>d;
  REP(i,26) cin>>c[i];
  REP(i,d)REP(j,26) cin>>s[i][j];
  REP(i,d) cin>>t[i];

  calc_satisfaction();
  
  REP(i,d) cout<<v[i]<<endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>
#include <sstream>

using namespace std;

int main(){
  int X, Y, Z, ans;

  cin >> X >> Y >> Z;

  ans = (X - Z) / (Y + Z); 
  cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

string s, t;

int main() {
    cin >> s >> t;

    cout << t << s << endl;

    return 0;
}


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

main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    ios_base::sync_with_stdio(false);cin.tie(NULL);

    int n,m;cin>>n>>m;
    vector<int>edges[n+1];
    for(int i=0;i<m;i++){
        int u,v;cin>>u>>v;
        edges[u].push_back(v);
    }
    int dp[n+1]={0};
    memset(dp,-1,sizeof(dp));
    function<void(int)> dfs=[&](int s){
        dp[s]=0;
        for(auto x:edges[s]){
            if(dp[x]==-1)   dfs(x);
            dp[s]=max(dp[s],1+dp[x]);
        }
    };

    for(int i=1;i<=n;i++){
        if(dp[i]==-1)   dfs(i);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        ans=max(ans,dp[i]);
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 12920
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

int main() {
	int m, n;
	while (cin >> n >> m&&n) {
		vector<int> v;
		for (int i = 1; i <= n; i++) {
			v.emplace_back(i);
		}
		int pos = 0;
		while (v.size() != 1) {
			pos += m-1;
			if (pos >= v.size())pos %= v.size();
			v.erase(v.begin() + pos);
		}
		cout << v[0] << endl;
	}
}

Measured memory_bytes: 3120
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long h = sc.nextLong();
		long count = 1;
		long index = 1;
		while(h>1) {
			h = h/2;
			count = count+index*2;
			index = index*2;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 23636
#include <iostream>
#include <bits/stdc++.h>
using namespace std; 
 
 int main(){ 
 	ios::sync_with_stdio(false);
    cin.tie(0); 
	int N,K; 
	cin>>N>>K;
	string A; 
	getline(cin,A);   
	if(K==N){ 
		cout<<1; 
		return 0;
	} 
	int val=1; 
	val=val+(N-K)/(K-1); 
	if ((N-K)%(K-1)!=0){ 
		val++; 
	}  

	cout<<val; 
    
    return 0; 
}


Measured memory_bytes: 256
//it was hard to write
//so it should be hard to read
#include <bits/stdc++.h>
#define sz size
#define pb push_back
#define ll long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define last(x) (x).size() - 1
#define mp make_pair

using namespace std;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef double ld;

const int MAXN = 1e5 + 5;
const ll INF = 1e18 + 7;
const int inf = 1e9 + 7;
const double EPS = 1e-9;

string s;
int ct[35];


int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    cin >> s;
    for (int i = 0; i < s.sz(); i++) {
        ct[s[i] - 'a']++;
    }
    for (int i = 0; i <= 30; i++) {
        if (ct[i] & 1) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
S = input()

#print(len(S))
flag= 0
for i in range(len(S)):
	#print(i,S[i])
	if i % 2 == 0:
		if S[i] == "L" :
			#print(i,S[i])
			flag = 1
	elif i % 2 !=0:
		if S[i] == "R" :
			#print(i,S[i])
			flag = 1

if flag == 0:
	print("Yes")
else:
	print("No")

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

#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<30)
#define INFLL (1LL<<62LL)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

ll F[100002];
ll F_inv[100002];
ll mod;

ll mod_pow(ll b, ll e) {
  if (e == 0)
    return 1LL;

  if (e == 1)
    return b;

  ll res = mod_pow((b * b) % mod, e / 2);

  if (e % 2 != 0)
    return (res * b) % mod;

  return res;
}

ll C(ll n, ll r) {
  if (n < 0 || r < 0 || r > n)
    return 0;

  return F[n] * F_inv[n-r] % mod * F_inv[r] % mod;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<int> A(n+1, 0);

  ll l, r;
  rep(i, n+1) {
    int a; cin >> a;
    if (A[a] != 0) {
      l = A[a];
      r = i + 1;
    }
    A[a] = i + 1;
  }

  mod = 1e9+7;
  F[0] = 1;
  F_inv[0] = 1;
  
  REP(i, 1, n+2) F[i] = i * F[i-1] % mod;
  REP(i, 1, n+2) F_inv[i] = mod_pow(F[i], mod-2) % mod;
  
  REP(k, 1, n+2) {
    ll a = C(n+1, k);
    ll b = C(l-1+n+1-r, k-1);
    cout << (a - b + mod) % mod << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3200
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
int main(){
    int H,W;
    while(true){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0) break;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2696
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll s[2005000];
int main()
{
	int k,n;
	scanf("%d %d",&k,&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&s[i]);
	}
	ll min1=s[n]-s[1];
	//cout<<min1<<endl;
	for(int i=2;i<=n;i++)
	{
		ll	sum=s[i-1]+k-s[i];
		min1=min(min1,sum);
	}
	printf("%lld\n",min1);
	return 0;
} 

Measured memory_bytes: 1792
import heapq
spq = []
bpq = []
#que_small=queue.PriorityQueue()
small_sum=0
que_s_size=0
que_b_size=0
#que_big=queue.PriorityQueue()
big_sum=0

Q=int(input())
ans = []
b_sum=0
for i in range(Q):
    q=input().split()    
    if len(q)>1:
        a=int(q[1])
        if que_s_size==0:
            heapq.heappush(spq,-a)
            small_sum+=a
            que_s_size+=1
        elif que_s_size>que_b_size:
            c=-heapq.heappop(spq)
            small_sum-=c
            if c>a:
                #que_big.put(c)
                heapq.heappush(bpq,c)
                big_sum+=c
                heapq.heappush(spq,-a)
                #que_small.put(-a)
                small_sum+=a
            else:
                #que_big.put(a)
                heapq.heappush(bpq,a)
                big_sum+=a
                #que_small.put(-c)
                heapq.heappush(spq,-c)
                small_sum+=c
            que_b_size+=1
        else:
            c=-heapq.heappop(spq)
            small_sum-=c
            d=heapq.heappop(bpq)
            big_sum-=d
            if a>d:
                #que_big.put(a)
                heapq.heappush(bpq,a)
                big_sum+=a
                #que_small.put(-c)
                #que_small.put(-d)
                heapq.heappush(spq,-c)
                heapq.heappush(spq,-d)
                small_sum+=c+d
            else:
                #que_big.put(d)
                heapq.heappush(bpq,d)
                big_sum+=d
                #que_small.put(-a)
                #que_small.put(-c)               
                heapq.heappush(spq,-a)
                heapq.heappush(spq,-c)
                small_sum+=a+c
            que_s_size+=1

        b_sum+=int(q[2])
    else:
        if que_s_size>que_b_size:
            c=-heapq.heappop(spq)
            S = b_sum+big_sum-small_sum+c
            ans.append(str(c)+" "+str(S))
            #que_small.put(-c)
            heapq.heappush(spq,-c)
        else:
            c=-heapq.heappop(spq)
            S = b_sum+big_sum-small_sum
            ans.append(str(c)+" "+str(S))
            #que_small.put(-c)
            heapq.heappush(spq,-c)
            

for a in ans:
    print(a)
    

Measured memory_bytes: 113240
import math
import itertools
n,m = map(int,input().split())
ite = n+m

c = 0

li = []
for i in range(n):
    li.append(2)
for i in range(m):
    li.append(1)


for i in itertools.combinations(li, 2):
    sum = i[0]+i[1]

    if(sum %2 == 0):
        c += 1
    

print(c)








Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

ll gcd(ll a,ll b){
  if(a%b==0){
    return b;
  }
  else
    return gcd(b,a%b);
}

int main() {
  ll a,b;
  cin >> a >> b;
  cout << a*b/gcd(a,b) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}



int main(void){
  fast_io
  cout<<fixed<<setprecision(15);
  int n,k;
  cin >> n >> k;
  vector<ll> as(n);
  rep(i,n){
	  cin >> as[i];
  }

  rep(i, n-k){
	  if(as[i+k] > as[i]){
		  cout << "Yes" << endl;
	  }else{
		  cout << "No" << endl;
	  }
  }

  return 0;
}


Measured memory_bytes: 4724
#include <iostream>
#include <algorithm>
#include <unordered_map>

#define Nmax int(1e5 + 5)
using namespace std;

typedef long long ll;
int N;
long long nr;
string s[Nmax];
unordered_map <string,ll> m;

int main()
{
    cin >> N;
    for(int i = 1; i <= N; ++i)
    {
        cin >> s[i];
        sort(s[i].begin(),s[i].end());
        m[s[i]]++;
    }
    for(unordered_map < string,ll>::iterator it = m.begin(); it != m.end(); ++it)
        nr += (it -> second)  * (it -> second - 1) / 2;
    cout << nr;
    return 0;
}


Measured memory_bytes: 17572
for line in open(0).readlines():
    s = line.strip()
    a, s = s.split("+")
    b, c = s.split("=")
    f = lambda x: len(x) > 1 and x[0] == 'X'
    g = lambda s, x: int(s.replace("X", str(x)))
    for x in range(f(a) or f(b) or f(c), 10):
        if g(a, x) + g(b, x) == g(c, x):
            print(x)
            break
    else:
        print("NA")



Measured memory_bytes: 5612
import java.util.Scanner;

public class Main {   
    public static void main(String[] args) {    	    	
        long N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt(); M = sc.nextInt();

		if (N>=2 && M>=2) System.out.println((N-2)*(M-2));
		else if (N==1 && M==1) System.out.println(1);
		else System.out.println(N>M ? N-2 : M-2);			
		sc.close();
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define repx(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)
int a[10];

int main(){

    // 1. 入力情報.
    char c[22];
    scanf("%s", c);
    
    // 2. 'o' を カウント.
    int o = 0;
    int l = strlen(c);
    rep(i, 15){
        if(i < l && c[i] == 'o') o++;
        if(i >= l)               o++;
    }
    
    // 3. 出力.
    printf("%s\n", (o >= 8) ? "YES" : "NO");
    return 0;
    
}

Measured memory_bytes: 256
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 08/08/2017 12:10:03
	flamers will **** you
*/
#include<bits/stdc++.h>
//#include<flamers.h>
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define POB pop_back
#define dist(a, b) sqrt(a*a + b*b)
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vipi;
bool compare(pi p1, pi p2){
	 if(1) return true;
	 return false;
}

int main(){
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie();
	int n, k;
	cin>>n>>k;
	vi vect(n);
	for(int i = 0; i < n; i++){
		cin>>vect[i];
	}
	int sum = 0;
	sort(vect.begin(), vect.end());
	for(int i = n-1; i >= n-k; i--){
		sum += vect[i];
	}
	cout<<sum<<endl;
	return 0;
}


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

#define SENTINEL (1000000001)
#define putChar(c) ; *p = (c); ++p;

int c = 0;
int S[500000];
int L[250001];
int R[250001];
char str[5500010];
char *p = str;

static void Merge(int A[], int left, int mid, int right);
static void MergeSort(int A[], int left, int right);

inline int getNum(void) {
	int n = 0;
	while ((*p >= '0') && (*p <= '9')) {
		n = n * 10 + (int)(*p - '0');
		++p;
	} 
	++p;
	return n;
}

inline void putNum(int n) {
	int d;
	if (n < 10) {
		putChar( '0' + (char)n );
		return;
	}
	d = n / 10;
	if (d) putNum(d);
	putChar( '0' + (char)(n % 10) );
}


int main(void) {
	register int i;
	int n;
	
	fread(str, sizeof(char), 5500000, stdin);
	n = getNum();
	for (i = 0; i < n; ++i) {
		S[i] = getNum();
	}
	
	MergeSort(S, 0, n);
	
	--n;
	p = str;
	for (i = 0; i < n; ++i) {
		putNum(S[i]);
		putChar( ' ' );
	}
	putNum(S[i]);
	putChar( '\n' );
	
	putNum(c);
	putChar( '\0' );
	
	puts(str);

	return 0;
}



void Merge(int A[], int left, int mid, int right) {
	int i = 0, j = 0, k = left;
	int n1 = mid - left;
	int n2 = right - mid;
	memcpy(L, A + left, n1 * sizeof(int));
	memcpy(R, A + mid, n2 * sizeof(int));
	L[n1] = R[n2] = SENTINEL;
	for (; k < right; ++k) {
		if (L[i] <= R[j]) {
			A[k] = L[i];
			++i;
		} else {
			A[k] = R[j];
			++j;
		}
	}
}

void MergeSort(int A[], int left, int right) {
	int mid;
	if (left + 1 >= right) {
		return;
	}
	mid = (left + right) >> 1;
	MergeSort(A, left, mid);
	MergeSort(A, mid, right);
	Merge(A, left, mid, right);
	c += right - left;
}

Measured memory_bytes: 9216
S=input()
if S=="SUN":
    print(7)
elif S=="MON":
    print(6)
elif S=="TUE":
    print(5)
elif S=="WED":
    print(4)
elif S=="THU":
    print(3)
elif S=="FRI":
    print(2)
elif S=="SAT":
    print(1)

Measured memory_bytes: 2940
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<ll, ll> ii;

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void File()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
	/*freopen("output.txt", "w", stdout);
	freopen("commandos.in", "r", stdin);*/
#endif
}
void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
	//File();
}
const double pi = acos(-1.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 1e5 + 15;
int dx[8] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[8] = { 0, 1, 0, -1, 1, -1, -1, 1 };

int dp[nn];
int main()
{
	fast();
	int n;
	cin >> n;
	vector<int> arr(n + 1, oo);
	fill(dp, dp + nn, oo);
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	dp[n - 1] = 0;
	dp[n] = 0;
	for (int i = n - 2; i >= 0; i--)
	{
		dp[i] = min({ dp[i], dp[i + 1] + abs(arr[i + 1] - arr[i]), dp[i + 2] + abs(arr[i + 2] - arr[i]) });
	}
	cout << dp[0] << endl;
	return 0;
}

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

using namespace std;

int n,m;

vector<int> G[100001];
bool used[100001];
vector<int> ans;

void dfs(int v) {
  
  if(!used[v])ans.push_back(v);
  used[v] = true;
  for(int i = 0; i < G[v].size(); i++) {
    int u = G[v][i];
    if(!used[u]) {
      dfs(u);
      return;
    }
  }

  return;
}

int main() {

  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int a,b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  dfs(1);
  reverse(ans.begin(),ans.end());

  dfs(1);

  cout << ans.size() << endl;

  for(int i = 0; i < ans.size(); i++) {
    cout << ans[i] <<" ";
  }

  cout << endl;
}

  
  


Measured memory_bytes: 9720
// input! macro is published in the following URLs.
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// https://github.com/tanakh/competitive-rs.git
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        s: chars,
    }
    let mut max_count = 0;
    for i in 0..n {
        let (left, right) = s.split_at(i);
        let l = left.iter().collect::<std::collections::HashSet<_>>();
        let r = right.iter().collect::<std::collections::HashSet<_>>();
        let count = l.iter().filter(|x| r.get(*x).is_some()).count();
        max_count = std::cmp::max(max_count, count);
    }
    println!("{}", max_count);
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define re register
#define ll long long
inline int gi()
{
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
int main()
{
	int n=gi(),mx=0,ans=0;
	for(int i=1;i<=n;i++)
	{
		int x=gi();
		if(x>=mx)ans++;
		mx=max(mx,x);
	}
	printf("%d\n",ans);
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  string s;
  cin>>s;
  cout<<s.substr(0,4)<<" "<<s.substr(4)<<endl;
  return 0;
}


Measured memory_bytes: 764
import math

A, B, H, M = map(int, input().split())

a = H * 30 + M / 2
b = M * 6
c = abs(a-b)

if c > 180:
    c = 360 - c

ans = A**2 + B**2 - 2*A*B*math.cos(math.pi*c/180)
print(math.sqrt(ans))

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

int main(){
    int a[]={0,0,2,0,1,0,1,0,0,1,0,1,0};
    int x,y; cin >> x >> y;
    cout << (a[x] == a[y] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
A,B = map(int,input().split())
s1 = [['#']*100 for _ in range(50)]
s2 = [['.']*100 for _ in range(50)]

A -= 1
B -= 1
for i in range(50):
    for j in range(100):
        if A == 0:
            break
        if i%2==0 and j%2==0:
            s1[i][j] = '.'
            A -= 1
for i in range(50):
    for j in range(100):
        if B == 0:
            break
        if i%2==1 and j%2==1:
            s2[i][j] = '#'
            B -= 1

S = [''.join(s) for s in s1]+[''.join(s) for s in s2]
print('100 100')
for s in S:
    print(s)

Measured memory_bytes: 3188
n = int(input())
lst = list(map(int, input().split()))

ans = []
if n%2==0:
    for i in range(n//2):
        ans.append(lst[n-i*2-1])
    for i in range(n//2):
        ans.append(lst[i*2])
else:
    for i in range((n+1)//2):
        ans.append(lst[n-i*2-1])
    for i in range((n-1)//2):
        ans.append(lst[1+i*2])

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


Measured memory_bytes: 29764
#include <iostream>

using namespace std;
int x;
int demsolan(int a,int b,int c)
{
    int dem=0;
    while(b<=a) {b=b*2;dem++;}
    while(c<=b) {c=c*2;dem++;}
    if (dem<=x) {cout<<"Yes";} else {cout<<"No";}
    return 0;
}
int main()
{
    int a,b,c;
    cin>>a>>b>>c>>x;
    demsolan(a,b,c);
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
vector<int> a[3];
int b[3][3][4000];
bool c[3][4000];
int main () {
    int N;
    string S;
    cin >> N >> S;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') {
            a[0].push_back(i);
            c[0][i] = 1;
        }
        else
        if (S[i] == 'G') {
            a[1].push_back(i);
            c[1][i] = 1;
        }   
        else
        if (S[i] == 'B') {
            a[2].push_back(i);
            c[2][i] = 1;
        }
    }
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (i == j) continue;
            for (int x = 0; x < a[i].size(); x++) {
                b[i][j][x] = lower_bound(a[j].begin(), a[j].end(), a[i][x]) - a[j].begin();
            }
        }
    }
    long long ans = 0;
    vector<int> v;
    v.push_back(0);
    v.push_back(1);
    v.push_back(2);
    do {
        int p = v[0], q = v[1], r = v[2];
        for (int i = 0; i < a[p].size(); i++) {
            for (int j = b[p][q][i]; j < a[q].size(); j++) {
                ans += a[r].size() - b[q][r][j];
                int x = a[p][i], y = a[q][j];
                int z = y + (y-x);
                if (z < N && c[r][z]) ans--;
            }
        }
    } while (next_permutation(v.begin(), v.end()));
    cout << ans << endl;
}

Measured memory_bytes: 3724
N = int(input())
H = [int(i) for i in input().split()]

H.reverse()

for i in range(N - 1):
    if H[i + 1] - H[i] >= 2:
        print("No")
        quit()
    elif H[i + 1] - H[i] == 1:
        H[i + 1] -= 1
print("Yes")


Measured memory_bytes: 14396
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(v) (v).begin(),(v).end()
#define endl '\n'

using namespace std;

const int N = 100005;
const int LG = 19;
const int MOD = 1e9 + 7;
const int INF = 2000000000;
const ll INFLL = 1LL * INF * INF;

int a[N];
ll dp[N][2];
int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    dp[1][0] = a[1];
    dp[1][1] = -INFLL;
    for (int i = 2; i <= n; i++) {
        dp[i][0] = max(dp[i - 2][0], dp[i - 2][1]) + a[i - 1] + a[i];
        dp[i][1] = max(dp[i - 2][0], dp[i - 2][1]) - a[i - 1] - a[i];
        dp[i][0] = max(dp[i][0], max(dp[i - 1][0], dp[i - 1][1]) + a[i]);
        dp[i][1] = max(dp[i][1], max(dp[i - 1][0] - 2 * a[i - 1] - a[i], dp[i - 1][1] + 2 * a[i - 1] - a[i]));
    }
    cout << max(dp[n][0], dp[n][1]) << endl;
    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  map<int,int>data;
  vector<pair<int,int>>data2;
  for(int i=0;i<N;i++){
    int s;
    cin >> s;
    if(data.count(s)) data.at(s)++;
    else data[s]=1;
  }
  for(auto p:data){
    data2.push_back(make_pair(p.second,p.first));
  }
  int a = data2.size();
  sort(data2.begin(),data2.end());
  int count=0;
  int i=0;
  while(a>K){
    count += data2.at(i).first;
    a--;
    i++;
  }
  cout << count << endl;
}


Measured memory_bytes: 11768