akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
using namespace std;

int main() {
	int A, B, C, D, flag = 0;
	cin >> A >> B >> C >> D;

	while (1) {
		C = C - fmin(C, B);
		if (C == 0) {
			flag = 1;
			break;
		}
		A = A - fmin(A, D);
		if (A == 0) {
			break;
		}
	}
	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3676
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

void Main()
{
	int N, M;
  	cin >> N >> M;
	vector<int> food(M,1);
  	rep(i,N) {
      	int k;
      	cin >> k;
      	vector<int> foodtemp(M,0);
      	rep(j,k){
          	int a;
			cin >> a;
          	a--;
          	foodtemp[a] = 1;
        }
      	rep(a,M){
      		food[a] = food[a] & foodtemp[a];
        }
    }  	
  	int ans = 0;
  	rep(a,M) ans += food[a];
  	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

//        long startTime = System.currentTimeMillis();

        Scanner scanner = new Scanner(System.in);

        long A = scanner.nextLong();
        long B = scanner.nextLong();
        long C = scanner.nextLong();
        long X = scanner.nextLong();
        long Y = scanner.nextLong();
        scanner.close();

        long V = 2 * C - (A + B);

        if (V >= 0) {
            long T = A * X + B * Y;
            System.out.println(T);
        } else {
            long x;
            long y;
            if (X < Y) {
                // Xの場合
                x = B * (Y - X) + C * 2 * X;
                // Yの場合
                y = C * 2 * Y;
            } else {
                // X
                x = C * 2 * X;
                // Y
                y = A * (X - Y) + C * 2 * Y;
            }
            System.out.println(Math.min(x, y));
        }
//        System.out.println(System.currentTimeMillis() - startTime);
    }
}

Measured memory_bytes: 23764
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	sc = initScanner(os.Stdin)
	n, m := scanInt(sc), scanInt(sc)
	fmt.Println(resolve(n, m))
}

func resolve(n, m int) int {
	maxl, minr := 0, math.MaxInt64
	for i := 0; i < m; i++ {
		l, r := scanInt(sc), scanInt(sc)

		if maxl < l {
			maxl = l
		}
		if minr > r {
			minr = r
		}
	}

	count := 0
	for i := maxl; i <= minr; i++ {
		count++
	}

	return count
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 2988
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = (int)(1e6) + 5;
vi g[N];
int ans = 0;
int dfs(int node,int prev)
{
    int was[22];
    memset(was,0,sizeof(was));
    for (auto it : g[node])
        if (it != prev)
        {
            int msk = dfs(it,node);
            for (int i = 0;i < 20;++i)
                if ((msk >> i) & 1)
                    ++was[i];
        }
    int lst = -1;
    for (int i = 0;i < 20;++i)
        if (was[i] >= 2)
            lst = i;
    int mask = 0;
    for (int i = lst + 1;i < 20;++i)
        if (!was[i])
        {
            smax(ans,i);
            mask |= (1 << i);
            for (int j = i + 1;j < 20;++j)
                if (was[j])
                    mask |= 1 << j;
            return mask;
        }
}
int main(void)
{
    int n;
    cin>>n;
    for (int i = 1;i < n;++i)
    {
        int a,b;
        cin>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    dfs(1,0);
    cout << ans << '\n';
    return 0;
}


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

using namespace std;
typedef unsigned int uint;
typedef long long int ll;
typedef unsigned long long int ull;

#define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl;
#define debugm(m) printf("L%d %s is..\n",__LINE__,#m);for(auto v:m){for(auto e:v){cout<<e<<" ";}cout<<endl;}
#define debuga(m,w) printf("L%d %s is => ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;
#define debugaa(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[x][y]<<" ";}cout<<endl;}
#define ALL(v) (v).begin(),(v).end()
#define BIGINT 0x7FFFFFFF
#define E107 1000000007
void printbit(int u){if(u==0)cout<<0;else{int s=0,k=0;for(;0<u;u>>=1,k++)s=(s<<1)|(u&1);for(;0<k--;s>>=1)cout<<(s&1);}}

#define TIME chrono::system_clock::now()
#define MILLISEC(t) (chrono::duration_cast<chrono::milliseconds>(t).count())

template<typename T1,typename T2>
ostream& operator <<(ostream &o,const pair<T1,T2> p){o<<"("<<p.first<<":"<<p.second<<")";return o;}

int width,height;
int pd[100005];
int qd[100005];

int main(){
    int i,j,k,l;
    cin >>width>>height;
    
    multimap<int,int> mp;
    
    for (i=0;i<width;i++){
        //scanf("%d",pd+i);
        scanf("%d",&k);
        mp.emplace(k,1);
    }
    for (i=0;i<height;i++){
        //scanf("%d",qd+i);
        scanf("%d",&k);
        mp.emplace(k,2);
    }
    
    int wc=0,hc=0;
    ll result=0;
    for (auto p : mp){
        //cout<<p<<endl;
        if (p.second==1){
            if (height+1>wc)
                result+=(ll)p.first * (height-wc+1);
            hc++;
        }else if (p.second==2){
            if (width+1>hc)
                result+=(ll)p.first * (width-hc+1);
            wc++;
        }
        //cout<<result<<endl;
    }
    
    cout << result << endl;
    

    return 0;
}

Measured memory_bytes: 9728
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	string S=in<string>();
	int N=S.size();
	if(N<26){
		vector<int> C(26,0);
		REP(i,N){
			C[S[i]-'a']++;
		}
		REP(i,26){
			if(!C[i]){
				S.push_back((char)(i+'a'));
				out(S);
				return 0;
			}
		}
	}
	else{
		vector<string> A;
		REP(i,26){
			char q = S[25-i];
			for(int j=25-i-1;j>=0;j--){
				if(S[j]<q){
					string T = S.substr(0,j);
					T.push_back(q);
					A.push_back(T);
				}
			}
		}
		if(A.empty()) out(-1);
		else{
			sort(ALL(A));
			out(A[0]);
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

void solve(){
 ll a,b,c,d,k;
  cin >> a >> b >> c >> d >>k;
  
  if(d<c) {
    d+=60;
    c-=1;
  }

  cout << 60*(c-a)+(d-b)-k << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(ll i= (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    int H, W, K; cin >> H >> W >> K;

    string board[H];
    REP(i, H) cin >> board[i];

    int ans = 0;
    for (int h = 0; h < (1 << H); h++) {
        bitset<6> bit_h(h);
        for (int w = 0; w < (1 << W); w++) {
            bitset<6> bit_w(w);
            int cnt = 0;
            REP(i, H) REP(j, W) {
                if ((!bit_h[i] && !bit_w[j]) && board[i][j] == '#') cnt++;
            }
            if (cnt == K) ans++;
        }
    }
    cout << ans << "\n";

}

Measured memory_bytes: 3572
#define _USE_MATH_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<long>a(N), b(N), c(M), d(M);
    for (int i = 0; i < N; i++)cin >> a[i] >> b[i];
    for (int i = 0; i < M; i++)cin >> c[i] >> d[i];

    for (int i = 0; i < N; i++) {
        long min_d=1e10, min_num=M+1;
        for (int j = 0; j < M; j++) {
            long dis = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (dis<min_d) {
                min_d = dis;
                min_num = j + 1;
            }
            else if (dis == min_d) {
                if (j + 1 < min_num)min_num = j + 1;
            }
        }
        cout << min_num << endl;
    }

    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  input = input.trim().split("\n");
  const total = input[0].split('').reduce((total, curr) => {
    return parseInt(total,10) + parseInt(curr, 10)
  });
  if (total % 9 === 0) {
    console.log('Yes');
  } else {
    console.log('No');
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

int N, S, x[100009];
long long p[100009];

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d", &N, &S);
for (int i=1; i<=N; i++)
    scanf ("%d %lld", &x[i], &p[i]);
int i = 1, j = N, lst = 0;
long long ans = 0;
while (x[i] <= S && x[j] >= S)
{
    if (p[i] >= p[j])
        p[i] += p[j], ans += (x[j --] - x[i]) * (lst != 1), lst = 1;
    else
        p[j] += p[i], ans += (x[j] - x[i ++]) * (lst != 2), lst = 2;
}
if (i <= j)
{
    if (x[i] <= S) ans += S - x[i];
    else ans += x[j] - S;
}
printf ("%lld\n", ans);

return 0;
}


Measured memory_bytes: 1408
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]


N = int(input())
A = [0] + list(map(int, input().split()))


def check(mid, base): # b is max-value
    if mid < base:
        l = imos[mid-1]
        r = imos[base-1] - imos[mid-1]
        return abs(r-l)
    else:
        l = imos[mid] - imos[base-1]
        r = imos[N] - imos[mid]
        return abs(r-l)
        
        

def ternarySearchInt(small, big, i):
    # 初期条件
    if small == big:
        return small
    elif big - small == 1:
        if check(small, i) <= check(big, i):
            return small
        else:
            return big

    def func(small, big):
        midl = (big + small) // 2
        midr = midl + 1
        if big - small == 2:  # 終了条件
            mid = midl
            if check(small, i) <= check(mid, i):
                if check(small, i) <= check(big, i):
                    return small
                else:
                    return big
            else:
                if check(mid, i) <= check(big, i):
                    return mid
                else:
                    return big
        else:
            if check(midl, i) > check(midr, i):
                return func(midl, big)
            else:
                return func(small, midr)
    return func(small, big)



imos = [0]*(N+1)
for i in range(1, N+1):
    imos[i] = imos[i-1] + A[i]

ans = int(1e18)
for i in range(3, N):
    l = ternarySearchInt(1, i-1, i)
    r = ternarySearchInt(i, N, i)
    P = imos[l-1]
    Q = imos[i-1] - P
    R = imos[r] - imos[i-1]
    S = imos[N] - imos[r]
    hoge = [P,Q,R,S]
    ans = min(ans, max(hoge) - min(hoge))


print(ans)



Measured memory_bytes: 101636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public char[,] S;

        public void Run()
        {
            // input
            N = Input.ReadInt();
            S = new char[N, N];
            for (int i = 0; i < N; i++)
            {
                var line = Console.ReadLine();
                for (int j = 0; j < N; j++)
                    S[i, j] = line[j];
            }

            // check
            int[] F = new int[N];
            for (int a = 0; a < N; a++)
            {
                F[a] = Check(a) ? 1 : 0;
            }

            // calc
            int ret = 0;
            for (int y = 0; y < N; y++)
                for (int x = 0; x < N; x++)
                {
                    int a = (y - x + 2 * N) % N;
                    ret += F[a];
                }

            Console.WriteLine(ret);
        }

        public bool Check(int a)
        {
            for (int y = 0; y < N; y++)
                for (int x = 0; x < N; x++)
                {
                    if (SlidedCell(y, x, a) != SlidedCell(x, y, a)) return false;
                }

            return true;
        }

        public char SlidedCell(int y, int x, int a)
        {
            return S[y, (x - a + 2 * N) % N];
        }
    }

    // libs ----------


    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13228
h,w=gets.split(" ").map(&:to_i)
a=[]
h.times{a<<gets}
puts "#"*w
for i in 1..h-2 do
    out=""
    for j in 0...w do
        if j%2==1||a[i][j]=="#" then
            out+="#"
        else
            out+="."
        end
    end
    puts out
end
puts "."*w
puts ""
puts "."*w
for i in 1..h-2 do
    out=""
    for j in 0...w do
        if j%2==0||a[i][j]=="#" then
            out+="#"
        else
            out+="."
        end
    end
    puts out
end
puts "#"*w

Measured memory_bytes: 4988
from math import log, ceil
N = int(input())
A = list(map(int, input().split()))

#print(ceil(log(max(A)+1,2)))
keta = ceil(log(max(A)+1,2))

X = [0] * keta

for a in A:
  work = a
  i = 0
  while work > 0:
    X[i] += work % 2
    i += 1
    work = work // 2

ans = 0
mod = int(1e9+7)
for i in range(len(X)):
  ans += X[i] * (N-X[i]) * 2**i
  ans = ans % mod
  
print(ans)

Measured memory_bytes: 122808
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        if (n > k) {
            long mod = n % k;
            long modb = Math.abs(mod - k);
            System.out.println(Math.min(modb, mod));
        } else if(n < k){
            System.out.println(Math.min(k - n, n));
        } else {
            System.out.println(0);
        }
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
    int A,B,K;
    cin >> A >> B >> K;
    int count=0;
    for(int i=min(A,B);i>0;i--){
        if(A%i==0&&B%i==0)count++;
        if(count==K){
            cout << i << endl;
            break;        
        }
    }
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

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

    map<string, int> mp;
    rep(i, N) {
        string S;
        cin >> S;
        mp[S]++;
    }

    cout << "AC"
         << " x " << mp["AC"] << endl;
    cout << "WA"
         << " x " << mp["WA"] << endl;
    cout << "TLE"
         << " x " << mp["TLE"] << endl;
    cout << "RE"
         << " x " << mp["RE"] << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



signed main() {
	int n;
	string s;
	vector<int>vec1(26),vec2(26,100);
	cin >> n;
	rep(i, n) {
		cin >> s;
		vector<int>vec1(26);
		rep(j, s.size()) {
			vec1[s[j] - 'a']++;
		}
		rep(j, 26) {
			vec2[j] = min(vec2[j], vec1[j]);
		}
	}
	s = "";
	rep(i, 26) {
		rep(j, vec2[i]) {
			s += (char)(i + 'a');
		}
	}
	cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_a_genius = 0; ngtkana_is_a_genius < int(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (int i = int(begin); (i) < int(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) 0;
#endif

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  lint a, b; std::cin >> a >> b;
  lint ans = std::min((2*a + b) / 4, b / 2);
  std::cout << ans << std::endl;
  return 0;
}

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

int main(void){
  int na,nb;
  cin>>na>>nb;
  vector<int> a(na);
  vector<int> b(nb);
  for(int i = 0 ; i < na ; i ++){
    cin>>a[i];
  }
  for(int i = 0 ; i < nb ; i ++){
    cin>>b[i];
  }
  int dp[2][5001]={{}};
  int m = 0;
  
  for(int i = 1 ; i <= nb ; i ++){
    for(int j = 1 ; j <= na ; j ++){
      if(a[j-1]==b[i-1]){
	dp[i&1][j] = max(dp[i&1][j-1],dp[i-1&1][j-1] + (a[j-1]==b[i-1]));
      }else{
	dp[i&1][j] = dp[i&1][j-1];
      }
      m = max(m,dp[i&1][j]);
    }
  }
  cout<<m<<endl;
}

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

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  const int dx = tx - sx, dy = ty - sy;

  // Path 1
  cout << string(dy, 'U') << string(dx, 'R');

  // Path 2
  cout << string(dy, 'D') << string(dx, 'L');

  // Path 3
  cout << 'L' << string(dy + 1, 'U') << string(dx + 1, 'R') << 'D';

  // Path 4
  cout << 'R' << string(dy + 1, 'D') << string(dx + 1, 'L') << 'U';

  // EndLine
  cout << endl;
}


Measured memory_bytes: 256
H,W = map(int,input().split())
pict = [input() for i in range(H)]
for i in range(H):
    for j in range(W):
        if pict[i][j] == '#':
            flag = False
            for x,y in ((i-1,j),(i+1,j),(i,j-1),(i,j+1)):
                if 0<=x<H and 0<=y<W and pict[x][y]=='#':
                    flag = True
                    break
            if flag == False:
                print('No')
                exit(0)
print('Yes')

Measured memory_bytes: 9160
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln =  '\n';

const int mx=100010;
const ll mod=1e9+7;

#define bit(n,k) ((n>>k)&1) //*n no k bit me 1 or 0*/

int main(){
  int n;
  string s;
  cin >> n >> s;
  unordered_map<string,ll> mp;
  rep(i,(1<<n)){
    string a="",b="";
    rep(j,n){
      if(bit(i,j)){
        a.push_back(s[j]);
      } else {
        b.push_back(s[j]);
      }
    }
    reverse(b.begin(),b.end());
    string t = a + ":" + b;
    mp[t]++;
  }

  ll ans = 0;

  rep(i,(1<<n)){
    string a="",b="";
    rep(j,n){
      if(bit(i,j)){
        a.push_back(s[j+n]);
      } else {
        b.push_back(s[j+n]);
      }
    }
    reverse(a.begin(),a.end());
    string t = a + ":" + b;
    ans += mp[t];
  }
  cout << ans << ln;
  return 0;
}

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

typedef long long ll;
typedef long double ld;

#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}

int main(){

    ll AB, BC, CA;

    cin >> AB >> BC >> CA;

    cout << AB * BC / 2 << endl;

    return 0;
}

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

int main() {
  long long n, m;
  cin >> n >> m;
  vector<pair<long long, long long>> a(n);

  for (int i = 0; i < n; i++) {
    cin >> a.at(i).first;
    cin >> a.at(i).second;
  }

  sort(a.begin(), a.end());
  long long ans = 0;
  int num = 0;
  int flag = 0;

  for (int i = 0; i < n; i++) {
    int k = min(m, a.at(i).second);
    ans += a.at(i).first * k;
    m -= k;
    if (m == 0) break;
  }
  cout << ans;
}


Measured memory_bytes: 1792
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    int N, K; cin >> N >> K;
    int res = 1;
    rep(i, 0, N) {
      res = min(res*2, res+K);
    }
  
    cout << res << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import Counter
n = int(input())
dic = {}
for i in range(n):
    s = input()
    c = Counter(s)
    for j in range(26):
        x = chr(ord('a') + j)
        if i == 0:
            dic[x] = c[x] if x in c else 0
        else:
            dic[x] = min(dic[x], c[x]) if x in dic else 0
ans = ''
for k, v in sorted(dic.items()):
    ans += k * v
print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
struct Input{
    int A;
    int B;
    bool operator<(const Input &right) const{
        return B < right.B;
    }
};
string solve(int N, vector<Input> &I){
    sort(I.begin(), I.end());
    int sum = 0;
    for(int i = 0; i < N; ++i){
        sum += I[i].A;
        if(sum > I[i].B) {
            return "No";
        }
    }
    return "Yes";
}
int main(){
    int N;
    cin >> N;
    vector<Input> I(N);
    for(int i = 0; i < N; ++i){
        cin >> I[i].A >> I[i].B;
    }
    cout << solve(N, I);
    return 0;
}

Measured memory_bytes: 1792
N=int(input())
a=list(map(int,input().split()))
ans=[0 for i in range(9)]

for i in range(N):
    temp=a[i]//400
    if temp>8:
        ans[8]+=1
    else:
        ans[temp]+=1
nin=0
for i in range(8):
    if ans[i]!=0:
        nin+=1
if nin==0 and ans[8]!=0:
    nin+=1
    nax=ans[8]
else:
    nax=nin+ans[8]
print(nin,nax)

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

long long my_gcd(long long a, long long b){
    if(a > b) swap(a,b);
    if(b%a==0) return a;
    else return my_gcd(a,b%a);
}

int main(){
    long long k;
    cin >> k;
    long long sum = 0;
    for(long long a=1; a<=k; a++){
        for(long long b=1; b<=k; b++){
            for(long long c=1; c<=k; c++){
                long long d = my_gcd(a,b);
                sum += my_gcd(c,d);
            }
        }
    }
    cout << sum << endl;
    return 0;
}


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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type Definitions:
typedef long long ll;
typedef unsigned long long ull;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);

//================ Main Loop ================
int main() {
    ull h;
    cin >> h;
    ull num = 1, ans = 0;
    while(h > 0) {
        h /= 2;
        ans += num;
        num *= 2;
    }
    cout << ans << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    string s;
    int n;
    int cnt =0;
    cin >> s;
    n = s.length();
    if(n == 1){
        cout << 1 << '\n';
        return 0;
    }
    if(n%2 == 0){
        for(int i = 0; i < n/2; i++){
            if(s[n/2-1 -i] == s[n/2 + i] && s[n/2-1 -i] == s[n/2-1]){
                cnt++;
            }else{
                cnt += n/2;
                break;
            }
            if(i == n/2-1){
                cnt += n/2;
                break;
            }
        }
    }else{
        for(int i = 1; i <= (n-1)/2; i++){
            if(s[(n-1)/2 -i] == s[(n-1)/2 + i] && s[(n-1)/2 + i] == s[(n-1)/2]){
                cnt++;
            }else{
                cnt += (n + 1)/2;
                break;
            }
            if(i == (n-1)/2){
                cnt += (n + 1)/2;
                break;
            }
        }
    }
    cout << cnt << '\n';
}

Measured memory_bytes: 512
/*|In The Name of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e6+5;

int n;
int cnt[N];

int f(int x){
    if(x & 1)
        return 3 * x + 1;
    return x / 2;
}

int main(){
    cin >> n;
    int best = 1e9;
    vector < int > a;
    while(a.size() <= 1e6){
        if(a.empty()){
            a.push_back(n);
            cnt[n]++;
        } else {
            int will = f(a[a.size()-1]);
            a.push_back(will);
            cnt[will]++;
            if(cnt[will] >= 2){
                cout << a.size() << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 2005
#define oo 0x7fffffff
#define ll_inf 0x7fffffffffffffff
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define ren(i,n) for(int i=0;i<(n);i++)
#define abs(x,y) ((x)>(y)?(x)-(y):(y)-(x))
#define fi first
#define se second
#define pb push_back

using namespace std;

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


ll n,m,k,nn;
ll dap;


int main(void){
	ll x=0,y,z;
	//freopen("in.txt","r",stdin);
	scanf("%lld %lld",&n,&m);
	if(n==1 || m==1){
		printf("1");
		return 0;
	}
	dap=((m+1)/2)*((n+1)/2);
	dap +=(m/2)*(n/2);

	printf("%lld",dap);
	


	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int N;

int main() {
    scanf("%d", &N);
    bool flag = false;
    for(int i = 1; i < 10; i++) {
        for(int j = 1; j < 10; j++) {
            if(i * j == N)
                flag = true;
        }
    }
    puts(flag ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>

using namespace std;

int main()
{
    string lit;
    int m;

    while (1){
        cin>>lit;

        if (lit == "-") {
            break;
        }
 
        int n = lit.size();

        cin >> m;

        vector<int> cou;

        for (int i = 0; i < m; i++) {
            int count;
            cin >> count;
            cou.push_back(count);
        }

        for (int i = 0; i < m; i++) {

            string sub1=lit.substr(cou[i], n);
            
            string sub2 = lit.erase(cou[i], n);
            
            lit = sub1 + sub2;
        }

        cout << lit << endl;

}



    return 0;
}


Measured memory_bytes: 3208
#include  <stdio.h>

int main(){
    int a;
    int b;
        scanf ("%d %d",&a,&b);
    
    if (a==1&&b==2||a==2&&b==1){
        printf("3\n");
    }
    else if (a==2&&b==3||a==3&&b==2){
         printf("1\n");
    }
    else if (a==1&&b==3||a==3&&b==1){
         printf("2\n");
    }
    return 0;
}

Measured memory_bytes: 1660
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
cnt = 0
for i in range(N):
  cnt += min(A[i]+A[i+1], B[i])
  if A[i] < B[i]:
    A[i+1] = max(A[i+1]+A[i]-B[i], 0)
print(cnt)

Measured memory_bytes: 19156
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    int n,l;
    cin>>n>>l;
    string str[n];
    for(int i=0;i<n;++i)
        cin>>str[i];
    sort(str,str+n);
    for(int i=0;i<n;++i)
        cout<<str[i];
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
T meguru_search(T ok, T ng, function<bool(T)> check){
    while(max(ok, ng) - min(ok, ng) > T(1)){
        T mid = (ok + ng) / T(2);
        if(check(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    return ok;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    lint t1, t2, a1, a2, b1, b2;
    cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;

    if(t1 * a1 + t2 * a2 == t1 * b1 + t2 * b2){
        cout << "infinity\n" << flush;
        return 0;
    }
    if(a1 > b1 && t1 * a1 + t2 * a2 > t1 * b1 + t2 * b2 || a1 < b1 && t1 * a1 + t2 * a2 < t1 * b1 + t2 * b2){
        cout << "0\n" << flush;
        return 0;
    }

    if(a2 > b2){
        swap(a1, b1);
        swap(a2, b2);
    }

    lint d1 = t1 * (a1 - b1);
    lint d2 = t2 * (a2 - b2);

    lint ans;
    if(d1 % abs(d1 + d2) == 0LL){
        ans = d1 / abs(d1 + d2) * 2LL;
    }else{
        ans = (d1 + abs(d1 + d2) - 1LL) / abs(d1 + d2) * 2LL - 1LL;
    }

    cout << ans << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val m = scanner.nextInt()
    val d = scanner.nextInt()
    var count = 0
    for(i in 4..m){
        for(j in 22..d){
            if((j/10)*(j-(j/10*10)) === i && (j-(j/10*10)) >= 2) count++
        }
    }
    println(count)
}

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

signed main(void)
{
	int a, b, c;
	map<int, int> mp;
	cin >> a >> b >> c;
	mp[a]++;
	mp[b]++;
	mp[c]++;
	bool ok = true;
	for (auto p : mp)
	{
		if (p.first == 5)
		{
			if (p.second != 2)
				ok = false;
		}
		else if (p.first == 7)
		{
			if (p.second != 1)
				ok = false;
		}
		else
			ok = false;
	}
	if (ok)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
using namespace std;
using ll = long long int;
 
int main(){
    int H, W, h, w; cin >> H >> W >> h >> w;
    if(H%h == 0 && W%w == 0){cout << "No" << endl; return 0;}
    else if(H%h != 0){
        cout << "Yes" << endl;
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                if(i%h != h-1){
                    cout << 600 << " ";
                }
                else{
                    cout << -600 * (h - 1) - 1 << " ";
                }
            }
            cout << endl;
        }
    }
    else if(W%w != 0){
        cout << "Yes" << endl;
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                if(j%w != w-1){
                    cout << 600 << " ";
                }
                else{
                    cout << -600 * (w - 1) - 1 << " ";
                }
            }
            cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1280
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e6 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	string str = "MARCH";
	int n;
	cin >> n;
	map<int, int> mc;
	while (n--)
	{
		string s;
		cin >> s;
		if (str.find(s[0]) == str.npos) continue;
		mc[s[0]]++;
	}
	LL ans = 0;
	vector<int> v;
	for (auto& p : mc) v.push_back(p.second);
	for (int i = 0; i < v.size(); i++)
	{
		for (int j = i + 1; j < v.size(); j++)
		{
			for (int k = j + 1; k < v.size(); k++)
			{
				ans += 1LL * v[i] * v[j] * v[k];
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    scanf("%d",&n);
    int s[1000];
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&s[i]);
        if(s[i]!=i)
            ans++;
    }
    if(ans>2)
        printf("NO\n");
    else printf("YES\n");
    return 0;
}


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

int main() {
  int s, s1, s2, s3;
  cin >> s;
    s3 = s%2;
 // cout << s3 << endl;
  	s2 = s/10%2;
 // cout << s2 << endl;
    s1 = s/100%2;
 // cout << s1 << endl;
  cout << s1+s2+s3 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define all(c) (c).begin(), (c).end()

int main() {
    int S; cin >> S;
    while (S--) {
        vector<unsigned> N(9);
        for (auto& e : N) cin >> hex >> e;
        unsigned K = 0;
        rep(m, 32) {
            int i = 1;
            unsigned checksum = accumulate(all(N), 0) - N.back();
            if ((checksum >> m & 1) != (N.back() >> m & 1)) K |= 1 << m;
            for (auto& e : N) e ^= K & 1 << m;
        }
        cout << hex << K << endl;
    }
}

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

bool find(int A[], int n, int x)
{
    for (int i =0; i != n; ++i)
    {
        if (A[i] == x)
        {
            return true;
        }
    }

    return false;
}

int main()
{
    int A[10000];
    int n, q, x, count = 0;

    cin >> n;

    for (int i = 0; i != n; ++i)
    {
        cin >> A[i];
    }

    cin >> q;

    for (int i = 0; i != q; ++i)
    {
        cin >> x;

        if ( find(A, n, x) )
        {
            ++count;
        }
    }

    cout << count << endl;

    return 0;
}


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

#define INF 999999999
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define pub push_back
#define pob pop_back
#ifdef LOCAL
  #define de(e) cout << "L" << __LINE__ << ": " << e << "\n" // debug echo
  #define dr(e) cout << "L" << __LINE__ << ": " << #e << " -> " << e << "\n" // debug repr
#else
  #define de(e)
  #define dr(e)
#endif
#define out(fmt, ...) printf(fmt, __VA_ARGS__); printf("\n")
int gcd(int m, int n) { if((0 == m) || (0 == n)){return 0;} while(m != n){ if(m > n){m -= n;}else{n -= m;} } return m; }
int lcm(int m, int n) { if((0 == m) || (0 == n)){return 0;} return (m / gcd(m, n)) * n; }

//
// Implementation
//

int main() {
  string s, t; cin >> s >> t;
  sort(all(s));
  sort(all(t), greater<char>());

  if (strcmp(s.c_str(), t.c_str()) < 0) {
    out("%s", "Yes");
  } else {
    out("%s", "No");
  }
}


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

int main(int argc, char const* argv[])
{
	int a, b;
	string op;

	while (1) { 
		cin >> a >> op >> b;
		if (op == "+") {
			cout << a + b << endl;
		} else 
		if (op == "-") {
			cout << a - b << endl;
		} else 
		if (op == "*") {
			cout << a * b << endl;
		} else 
		if (op == "/") {
			cout << a / b << endl;
		} else {
			break;
		}
	}

	return 0;
}


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

using namespace std;

int main()
{

    int N;

    cin >> N;

    int r = 0, b = 0;
    for(int i = 0; i < N; i++){
	char c;
	cin >> c;
	if(c == 'R'){
	    r++;
	}else{
	    b++;
	}
    }

    if(r > b){
	cout << "Yes" << endl;
    }else{
	cout << "No" << endl;
    }
    
}


Measured memory_bytes: 256
if __name__ == '__main__':
    N = int(input())
    S = input()

    max_n_kinds = 0
    for i in range(N):
        X, Y = S[:i], S[i:]
        n_kinds = len(set(X) & set(Y))
        max_n_kinds = max(max_n_kinds, n_kinds)
    
    print(max_n_kinds)


Measured memory_bytes: 2940
S = input()

ans = "No"
if S == S[::-1]:
    if S[:(len(S) - 1) // 2] == S[:(len(S) - 1) // 2][::-1]:
        if S[(len(S) + 3) // 2 - 1:] == S[(len(S) + 3) // 2 - 1:][::-1]:
            ans = "Yes"
print(ans)

Measured memory_bytes: 9120
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

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

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

int main(){
    ll n;
    cin >> n;
    ll a[n];
    rep(i, n) cin >> a[i];
    ll sm = 0;
    rep(i, n){
        if(i % 2 == 0) sm += a[i];
        else sm -= a[i];
    }
    ll x[n];
    x[0] = sm / 2;
    rep(i, n - 1){
        x[i+1] = a[i] - x[i];
    }
    rep(i, n){
        cout << x[i] * 2 << " ";
    }cout << endl;
}

Measured memory_bytes: 5088
#include <iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<stack>
#include<queue>
#define ll long long
using namespace std;
int main()
{ 
  ll n;
  scanf("%lld",&n);
  ll ans=0;
  ll k=1;
  while(n)
  {
  	ans+=k;
  	n=n/2;
  	k*=2;
  }
   printf("%lld\n",ans);
   
	return 0;
 } 

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

int main ()
{
	string s;  cin>>s;
	
     if(s[0]!=s[1]&&s[1]!=s[2]&&s[2]!=s[0]){
		cout<<"Yes"<<endl;
	}
	else
	 cout<<"No"<<endl;
	


}



Measured memory_bytes: 3584
#include <iostream>
using namespace std;
#define brk system("pause");

const int N = 1e5 + 1;
int a[101], dp[N];

main()
{
	ios::sync_with_stdio(0);
	
	int n, k;
	cin >> n >> k;
	
	int mn = 1e9;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	
	for(int i = a[1]; i <= k; i++)
	{
		for(int j = 1; j <= n; j++)
		{
			if(i - a[j] >= 0)
			if(!dp[i - a[j]])
			{
				dp[i] = 1;
				break;
			}
		}
	}
	
	if(dp[k]) cout << "First";
	else cout << "Second";
}


Measured memory_bytes: 640
N,X,Y =map(int,input().split())

count = [0] * (N-1)


for i in range(1,N):
    for j in range(i+1,N+1):
        dist = min(j-i, abs(X-i)+1+abs(Y-j))
        count[dist-1] +=1


for i in range(N-1):
    print(count[i])

Measured memory_bytes: 74124
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cins(int, n, a);
    
    unordered_map<int, int> ap, an;
    For(i, n){
        ap[i + a[i]] ++;
        an[i - a[i]] ++;
    }
    
    ll ans = 0;
    for(const auto &[v, np] : ap){
        ll nn = an[v];
        ans += np * nn;
    }
    Cout(ans);
}


Measured memory_bytes: 26904