akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
int main(){
	int N;
	cin >> N;
	
	int A[N];
	REP(i,N){
		cin >> A[i];
	}
	
	
	int ans = 0;
	int tmp;
	
	while(true){
		bool flag = false;
		
		REP(i,N){
			if(A[i] %2 ==1){
				flag = true;
				break;
			}else{
				A[i] = A[i]/2;
			}
		}
		if(flag) break;
		++ans;
	}
	
	
	cout <<ans<<endl;
	return 0;
} 

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

using namespace std;

const int MOD = 1e9 + 21;

void solve()
{

}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);

    int n, k;
    cin >> n >> k;

    n -= n / 2;
    if(n >= k)
        cout << "YES\n";
    else
        cout << "NO\n";

    return 0;
}


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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  int n, m;
  cin >> n >> m;
  vector<ii> a(n);
  set<int> r, c;
  for (auto &i : a) {
    cin >> i.fi >> i.sc;
    r.insert(i.fi);
    c.insert(i.sc);
  }
  int ans = LLONG_MAX;
  for (auto &x1 : r)
  for (auto &y1 : c) 
  for (auto &x2 : r)
  for (auto &y2 : c) {
    if (x2 < x1 || y2 < y1) continue;
    int cnt = 0;
    for (auto &i : a) {
      if (x1 <= i.fi && i.fi <= x2 && y1 <= i.sc && i.sc <= y2) {
        cnt++;
      }
    }
    if (cnt >= m) {
      ans = min(ans, (x2 - x1) * (y2 - y1));
    }
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3664
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }



int main() {

	string s, t;
	cin >> s >> t;
	reverse(all(t));
	if (s == t) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
use std::cmp::{min, Ordering};
use std::collections::VecDeque;
use std::io::{stdin, Read};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let m = read::<usize>();
    let acc = (0..m)
        .map(|_| {
            let a = read::<usize>();
            let b = read::<usize>();
            let cc = (0..b).map(|_| read::<usize>()).collect::<Vec<_>>();
            let mut bit = 0;

            for &c in cc.iter() {
                bit |= 1 << (c - 1)
            }
            (a, bit)
        })
        .collect::<Vec<_>>();

    let len = 1 << n;
    let u_max = usize::max_value();
    let mut dp = vec![vec![u_max; len]; m + 1];
    dp[0][0] = 0;

    for i in 0..m {
        let (a, cc) = acc[i];
        for j in 0..len {
            if dp[i][j] == u_max {
                continue;
            }
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j]);
            let temp = min(dp[i][j | cc], dp[i][j] + a);
            dp[i + 1][j | cc] = min(temp, dp[i + 1][j | cc]);
        }
    }

    let ans = dp[m][len - 1];
    if ans == u_max {
        println!("-1")
    } else {
        println!("{}", ans)
    }
}


Measured memory_bytes: 41212
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

set<int> paths[55][55];

unsigned long long getCycle() {
	unsigned int low, high;
	__asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
	return ((unsigned long long)low) | ((unsigned long long)high << 32);
}

long long beginCycle;
double getTime() {
	return (double)(getCycle() - beginCycle) / 2500000000;
}


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

	vector<int> a, b;
	inputVector(a, N);
	inputVector(b, N);

	rep(i, 51) {
		paths[i][i].insert(0);
	}

	REP(i, 1, 50) { // from
		rep(j, i) { // target
			REP(k, 1, i) { // mod
				int cost = 1LL << k;
				set<int> prepath = paths[i % k][j];
				itrep(it, prepath) {
					paths[i][j].insert(*it + cost);
				}
			}
		}
	}

	bool ans = true;
	int ret = 0;
	for (int i = 50; i >= 1; i--) {
		int cost = ret;
		rep(j, i) {
			cost |= 1LL << j;
		}

		bool ok = true;
		rep(i, N) {
			bool flag = false;
			itrep(it, paths[a[i]][b[i]]) {
				if ((*it & cost) == *it) {
					flag = true;
					break;
				}
			}
			if (!flag) {
				ok = false;
				break;
			}
		}
		if (!ok) {
			if (i == 50) {
				ans = false;
				break;
			}
			ret |= 1LL << i;
		}
	}

	if (!ans) {
		cout << -1 << endl;
	} else {
		cout << ret << endl;
	}

    return 0;
}


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

const int maxn=100010;
using namespace std;
vector<int>G[maxn];
int n,m;
int sg[maxn];

void calc(int cur,int pre)
{
    for(int i=0;i<G[cur].size();i++){
        if(G[cur][i]==pre)
            continue;
        calc(G[cur][i],cur);
        sg[cur]^=(sg[G[cur][i]]+1);
    }
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n-1;i++){
        int from, to;
        scanf("%d %d",&from,&to);
        G[from].push_back(to);
        G[to].push_back(from);
    }
    calc(1,0);
    printf("%s",sg[1]?"Alice":"Bob");
    return 0;
}


Measured memory_bytes: 12416
#include<stdio.h>
#define NUM 100000

typedef struct Node{
  int parent,left,right;
    }Node;
  
Node T[NUM];
int n,D[NUM];

void print(int a){
  int i,b;

  printf("node %d: parent = %d, depth = %d, ", a, T[a].parent, D[a]);

  if(T[a].parent == -1)
    printf("root, [");

  else if(T[a].left == -1)
    printf("leaf, [");

  else
    printf("internal node, [");

  b = T[a].left;

  for(i = 0; b != -1; i++, b = T[b].right){
    if(i)
      printf(", ");

    printf("%d", b);
  }

  printf("]\n");
}

int depth(int a, int b){
  D[a] = b;
 
  if(T[a].right != -1)
    depth(T[a].right, b);

  if(T[a].left != -1)
    depth(T[a].left, b+1);
}

int main(){
  int a,b,c,left,right,i,j;

  scanf("%d", &n);

  for(i = 0; i < n; i++)
    T[i].parent = T[i].left = T[i].right = -1;
  
  for(i = 0; i < n; i++){
    scanf("%d%d", &a, &b);
    
    for(j = 0; j < b; j++){
      scanf("%d", &c);
      
      if(j == 0)
	T[a].left = c;
      
      else
	T[left].right = c;
      
      left = c;
	T[c].parent = a;
    }
  }
  
  for(i = 0; i < n; i++){
    if(T[i].parent == -1)
      right = i;
  }
  
  depth(right, 0);

  for(i = 0; i < n; i++)
    print(i);
  
  return 0;
}

Measured memory_bytes: 5292
s = input()
kita = s.count("N")
mina = s.count("S")
nisi = s.count("W")
higa = s.count("E")

if kita + mina != 0 and kita*mina == 0:
    print("No")
    exit()
if nisi + higa != 0 and nisi*higa == 0:
    print("No")
    exit()

print("Yes")

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

using namespace std;

int main()
{
    //freopen("IN.txt","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int s, w;
    cin>>s>>w;
    if(w>=s)cout<<"unsafe";
    else cout<<"safe";
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <queue>

using namespace std;

int main(){
	int n, u, k, v;
	int D[100];
	bool adj[100][100] = {};
	int pushed[100] = {};
	cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> u >> k;
		for (int j = 1; j <= k; j++){
			cin >> v;
			adj[u][v] = true;
		}
	}
	for (int i = 1; i <= n; i++){
		D[i] = -1;
	}
	queue<int> Q;
	Q.push(1);
	D[1] = 0;
	pushed[1] = 1;
	while(!Q.empty()){
		int m = Q.front();
		Q.pop();
		for (int i = 1; i <= n; i++){
			if (adj[m][i] == true && pushed[i] == 0){
				D[i] = D[m]+1;
				Q.push(i);
				pushed[i] = 1;
			}
		}
	}
	
	for (int i = 1; i < n+1; i++){
		cout << i << ' ' << D[i] << endl;
	}
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0)
    {
        if(b&1)
            res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)
        return true;
    while(d!=n-1)
    {
        x=(x*x)%n;
        d*=2;
        if(x==1)
            return false;
        if(x==n-1)
            return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)
        return false;
    if(n<=3)
        return true;
    ll d=n-1;
    while(d%2==0)
        d/=2;
    for(int i=0; i<k; i++)
    {
        if(!miller_rabin(d,n))
            return false;
    }
    return true;
}
int n;
string s;
ll ans = 0;

void solve(ll x,ll y){
    if(x==n+1){
        ans += y;
        return;
    }
    ll cur = 0;
    for(ll i=x;i<=n;i++){
        cur = (10*cur) + (s[i]-'0');
        solve(i+1,y+cur);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll ans=1;
    for(ll i=1;i<=n;i++){
        if(ans*2<ans+k)ans*=2;
        else ans+=k;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3572
#include <iostream>      
//#include <string>      
#include <algorithm>      
//#include <bits/stdc++.h>      
using namespace std;      
      
int main() {      
    ios::sync_with_stdio(0);      
    string s;
    cin>>s;
    sort(s.begin(), s.end());
    int arr[26]={};
    for (int i=0; i<s.length(); i++){
    	arr[int(s[i]-'a')]++;
    }
    for (int i=0; i<26;i++){
    	if (arr[i]==0){
    		cout << char(i+'a')<< endl;
    		return 0;
    	}
    }
    cout << "None"<< endl;
}

Measured memory_bytes: 3752
//Practice more and more
//learn for better
#define bn begin()
#define en end()
#define mx 5000010
#define pb push_back
#define PI (2.0*acos(0.0))
#define al(a) a.begin(),a.end()
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rep(a,b) for(int a=0;a<b;++a)
#define fastio ios::sync_with_stdio(false)
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int>  vi;
typedef vector<ll>   vll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
	int a,b,c,n,i,t,tmp,d,e,f;
	vi v;
	cin>>t;
	while(t--)
	{
	cin>>a;
	v.pb(a);
	}
	ll sum=0;
	for(i=0;i<v.size()-1;i++)
	{
		if(v[i]>v[i+1])
		{
			sum+=v[i]-v[i+1];
			v[i+1]=v[i];
		}
	}
	cout<<sum<<endl;

	return 0;
}

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

int main(){
	int n;
	scanf("%d", &n);
	int a;
	scanf("%d", &a);
	vector<int> t(a);
	for(int i = 0; i < a; i++)
		scanf("%d", &t[i]);
	for(int i = 0; i < (1 << n); i++) {
		bool flag = false;
		for(auto x: t) {
			if(!(i & (1 << x))) {
				flag = true;
				break;
			}
		}
		if(flag) continue;
		printf("%d:", i);
		for(int j = 0; j < n; j++) {
			if(i & (1 << j))
				printf(" %d", j);
		}
		printf("\n");
	}
}



Measured memory_bytes: 3208
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()



int main() {

	ll N, M;
	cin >> N >> M;
	vll P(M), Y(M);
	rep(i, M) cin >> P[i] >> Y[i];
	
	map<ll, vll> pref;
	rep(i, M) pref[P[i]].push_back(Y[i]);
	for (auto &p : pref) sort(all(p.second));

	rep(i, M) {
		cout << setw(6) << setfill('0') << P[i];
		cout << setw(6) << setfill('0') << lower_bound(all(pref[P[i]]), Y[i]) - pref[P[i]].begin() + 1 << endl;
	}
}

Measured memory_bytes: 13952
#include <bits/stdc++.h>
using namespace std;
 int main(){
   int a,one,two,three,four;
   cin >> a;
   
   one = a%10;
   two = a/10%10;
   three = a/100%10;
   four = a/1000%10;
   
   if(one == two && two == three)
     cout << "Yes" << endl;
   else if(two == three && three == four)
     cout << "Yes" << endl;
   else
     cout << "No" << endl;
 }

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

int main() {
    int N, M;  cin >> N >> M;
    dsu d(N);
    for (int i = 0; i < M; ++i) {
        int a, b;  cin >> a >> b;
        --a;  --b;
        d.merge(a, b);
    }
    cout << d.groups().size() - 1 << endl;
}


Measured memory_bytes: 8924
def submit():
    n, m = map(int, input().split())
    xlist = list(map(int, input().split()))

    if n >= m:
        print(0)
    else:
        xlist.sort()
        dlist = [xlist[i + 1] - xlist[i] for i in range(m - 1)]
        dlist.sort()

        if n == 1:
            print(sum(dlist))
        else:
            print(sum(dlist[:1 - n]))


if __name__ == "__main__":
    submit()

Measured memory_bytes: 13968
#include <stdio.h>
int main(void)
{
    int n,k;
    char s[n];
    scanf("%d", &n);
    scanf("%d", &k);
    scanf("%s", s);
    if(s[k - 1] == 'A'){
        s[k - 1] = 'a';
    }
    else if(s[k - 1] == 'B'){
        s[k - 1] = 'b';
    }
    else if(s[k - 1] == 'C'){
        s[k - 1] = 'c';
    }
    printf("%s", s);
    
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <string>
#include <cctype>
#include <deque>
using namespace std;
typedef long long ll;
//__builtin_popcount(n);
#define IOS ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define RI register int
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int SZ = 2e5 + 10;
int n;

int main()
{
	/*
	int T;
	scanf("%d",&T);
	while(T --)
	{
		
	}
	*/
	int a,b;
	scanf("%d%d",&a,&b);
	printf("%d\n",a * b);
	return 0;
} 

Measured memory_bytes: 3228
// Problem : D - Knapsack 1
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("O3")  
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define pii pair<int,int>
#define S second
#define endl "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define mem(z,i) memset(z,i,sizeof(z))
#define eps 1e-7
#define I (int)
#define mod 1000000007
#define pb push_back
const long long INF = 1000000000000000000LL;
//const int WASTE=∞
const int N=1e2+5;
#define int long long
int n,W,w[N],v[N],dp[N][100001];
int f(int i,int cw=0){
	// if(i==n-1){
		// if(W-cw-w[i]>=0) return cv+v[i];
		// else return cv;
	// }
	// if(dp[i][cw]!=-1) return dp[i][cw];
	// if(W-cw-w[i]>=0) dp[i][cw]=f(i+1,cw+w[i],cv+v[i]);
	// dp[i][cw]=max(dp[i][cw],f(i+1,cw,cv));
	// return dp[i][cw];
	if(i==n) return 0;
	if(dp[i][cw]!=-1) return dp[i][cw];
	if(cw+w[i]<=W) dp[i][cw]=v[i]+f(i+1,cw+w[i]);
	dp[i][cw]=max(dp[i][cw],f(i+1,cw));
	return dp[i][cw];
}
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
  	// cout<<fixed;
  	// cout.precision(10);
   	cin>>n>>W;
   	for(int x=0;x<n;x++) cin>>w[x]>>v[x];
   	mem(dp,-1);
   	cout<<f(0);
   	
   	
   	
   	
   	
   	
   	
   	
   	
   	
   	
  	return 0;
}



Measured memory_bytes: 82304
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
//typedef std::pair<std::string,double> P;


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

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9+7;
vector<pair<int, int> > vp;
 
struct Less {
    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {
        return x.first > y.first;
    }
};

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


//グラフの隣接リスト
VI g[200010];
//頂点の入次数を管理
int h[100010];

vector<int> v;

int main(void) {
    int N, A, B; cin >> N >> A >> B;
    int cnt=0;
    REP(i, N){
        int a; cin >> a;
        if(a<A||a>=B) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

// typedef long double Double;
typedef double Double;

Double solve(int n,int m,int d){
    Double r;
    if (d == 0) {
        r = (Double)1.0 / n;
    } else {
        r = (Double)2.0 * (n - d) / n / n;
    }
    return r * (m - 1);
}

int main() {
    int n,m,d; cin >>n>>m>>d;
    Double ans = solve(n,m,d);
    printf("%.10f\n", (double)ans);
    return 0;
}


Measured memory_bytes: 256
"use strict";

const main = arg => {
    const input = arg.trim().split("\n");

    let s = input[0]
    let t = ""
    const QN = parseInt(input[1]);
    for(let i = 2; i<2+QN; i++){
        let q = input[i].split(" ")
        if(q[0] == 1){
            const tmp = s
            s = t
            t = tmp
        } else {
            if(q[1] == 1){
                t += q[2]
            } else {
                s += q[2]
            }
        }
    }
    t = t.split("").reverse().join("")
    t += s
    console.log(t)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 54708
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <limits.h>
using namespace std;

int a[101][101];
int main(){
	int n; scanf("%d",&n);
	for (int i = 1; i <= n; ++i){
		int u, k; scanf("%d %d",&u,&k);
		int tmp;
		while(k--){
			scanf("%d",&tmp);
			a[u][tmp] = 1;
		}
	}
	for (int i = 1; i <= n; ++i){
		for (int j = 1; j <= n; ++j){
			if (j != 1) cout << ' ';
			cout << a[i][j];
		}
		cout << '\n';
	}
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  string s;
  cin >> s;
  if (s == "zyxwvutsrqponmlkjihgfedcba") {
    cout << - 1 << endl;
    return 0;
  }
  if (s.size() < 26) {
    string t = s;
    sort(t.begin(), t.end());
    rep(i,26) {
      if (t[i] != 'a'+i) {s += char('a'+i); break;}
    }
    cout << s << endl;
  } else {
    string t = s;
    next_permutation(t.begin(), t.end());
    rep(i,26) {
      if (s[i] != t[i]) {cout << t[i] << endl; break;}
      cout << t[i];
    }
  }
   
  
  return 0;
}

Measured memory_bytes: 3588
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
//#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int32_t main(){
	boost;
	//freopen(".in","r",stdin);
	string p;
	cin>>p;
	if(sz(p)<6){
		cout<<"No\n";
		return 0;
	}
	if((p[2]==p[3])&&(p[4]==p[5])){
		cout<<"Yes\n";
	}
	else{
		cout<<"No\n";
	}
	return 0;
}
//long long
//array bounds
//special cases
//binary search

Measured memory_bytes: 256
#pragma GCC optimize("trapv")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<ll, ll>;
const int maxn = 3555;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, u, v;
vector<vi> g;
vi d, h, pr;
void dfs(int v, int p = -1) {
	d[v] = 0;
	pr[v] = p;
//	cout << v << " " << p << "\n";
	for(auto i : g[v]) {
		if(i==p) continue;
		h[i] = h[v]+1;
		dfs(i, v);
		d[v] = max(d[v], d[i]+1);
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> u >> v;
	g.resize(n+1);
	d.resize(n+1);
	h.resize(n+1);
	pr.resize(n+1);
	for(int f, t, i = 1; i < n; i++) {
		cin >> f >> t;
		g[f].pb(t);
		g[t].pb(f);
	}
	dfs(v);
	ll ans = 0;
	for(int i = 0; i < h[u]; i++) {
		ans = max(h[u]+d[u], ans);
		u = pr[u];
	}
	cout << ans-1;
}


Measured memory_bytes: 14720
#include <iostream>
#include <fstream>
#include <algorithm>
#include <chrono>
#include <random>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define sq(x) ((x) * (x))
#define err(x) cerr << "["#x"]  " << (x) << "\n";
#define errp(x) cerr << "["#x"]  {" << ((x).first) << ", " << ((x).second) << "}\n";
#define errv(x) {cerr << "["#x"]  [";for(const auto& ___ : (x)) cerr << ___ << ", "; cerr << "]\n";}
#define errvn(x, n) {cerr << "["#x"]  [";for(auto ___ = 0; ___ < (n); ++___) cerr << (x)[___] << ", "; cerr << "]\n";}
#define errf() cerr << "\n\n";

//#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast, unroll-loops", "omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2")

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getrnd(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}

ll getrndll(ll l, ll r) {
    return uniform_int_distribution<ll>(l, r)(rng);
}

template <typename T1, typename T2>
inline bool relax(T1& a, const T2& b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

template <typename T1, typename T2>
inline bool strain(T1& a, const T2& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}

// :::::::::::::::::::::::::::::::

const int MOD = 998244353;

int add(int a, int b) {
    a += b;
    if (a >= MOD) a -= MOD;
    if (a < 0) a += MOD;
    return a;
}

int mul(int a, int b) {
    return 1LL * a * b % MOD;
}

int binpow(int a, ll n) {
    if (n < 0)
        a = binpow(a, MOD - 2), n *= -1;
    
    int res = 1;
    while (n) {
        if (n & 1)
            res = mul(res, a);
        a = mul(a, a);
        n /= 2;
    }
    return res;
}

int inv(int x) {
    return binpow(x, MOD - 2);
}

const int N = 2e5 + 3;

int fact[N];

int C(int n, int k) {
    if (k > n) return 0;
    return mul(fact[n], inv(mul(fact[k], fact[n - k])));
}

void solve() {
    fact[0] = 1;
    for (int i = 1; i < N; ++i)
        fact[i] = mul(i, fact[i - 1]);
    
    int n, m, k;
    cin >> n >> m >> k;
    
    int ans = 0;
    for (int i = 0; i <= k; ++i) {
        int free = n - i;
        int res = mul(C(n - 1, i), mul(m, binpow(m - 1, free - 1)));
//        err(res);
        ans = add(ans, res);
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    srand(time(0));
    
    int t = 1;
//    cin >> t;
    while (t--)
        solve();
    
    return 0;
}



Measured memory_bytes: 4424
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void)
{
	int A=0,B=0,ans=0;
	scanf("%d %d", &A, &B);

	if(1<=A && A<=100){
		if(1<=B && B<=100){
			ans = A*B;
			printf("%d",ans);
		}
	}

	return 0;
}


Measured memory_bytes: 2140
mod = 10**9 + 7

def main():
    N = iip(listed=False)
    A = iip(True)
    #print(X, Y)

    num = [0 for i in range(N+1)]
    for i in A:
        num[i] += 1

    defres = 0
    for i in num:
        if i <= 1:
            continue
        defres += i*(i-1)//2

    result = []
    for k in A:
        nk = num[k]
        if nk <= 1:
            result.append(defres)
            continue
        diff = nk*(nk-1)//2 - (nk-1)*(nk-2)//2
        result.append(defres - diff)

    print("\n".join([str(i) for i in result]))


#####################################################ライブラリ集ここから

def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        #print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

def power(n, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p//2) ** 2) % mod
    if p % 2 == 1:
        return (n * power(n, p-1)) % mod


if __name__ == "__main__":
    main()

Measured memory_bytes: 113520
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
	using namespace std;
	typedef long long ll;
	ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
	ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


	int main() {
		int n;
		cin >> n;
		for (int i = n;i <= 999;++i) {
			if (i % 111 != 0)continue;
			else {
				cout << i << endl;
				break;
			}
		}
	}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N;

int dp[100010][3];
int activities[100010][3];

int main()
{
	cin >> N;
	for (int i = 1; i <= N; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> activities[i][j];
		}
	}

	dp[0][0] = dp[0][1] = dp[0][2] = 0;

	for (int i = 1; i <= N; ++i) {
		dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + activities[i][0];
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + activities[i][1];
		dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + activities[i][2];
	}

	int ans = 0;
	for (int i = 0; i < 3; ++i) ans = max(ans, dp[N][i]);

	cout << ans << endl;
}


Measured memory_bytes: 2560
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int l = scanner.nextInt();
        String[] s = new String[n];
        Arrays.setAll(s, i -> scanner.next());
        Arrays.sort(s);
        System.out.println(String.join("", s));
    }
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    string s;
    int64_t k;
    cin >> s >> k;
    rep(i,0,s.size()){
        if(i==s.size()-1){
            s[i]=(int64_t(s[i])-int64_t('a')+k)%int64_t(26)+'a';
            continue;
        }
        print(int(s[i]));
        print(k);
        print(int64_t(s[i])+k);
        print(int('z'));
        if(s[i]=='a') continue;
        if(int64_t(s[i])+k>int64_t('z')){
            k-=int64_t('z')-int64_t(s[i])+1;
            assert(k>=0);
            s[i]='a';
        }
    }
    rep(i,0,s.size()) assert('a'<=s[i] and s[i]<='z');
    cout << s << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
int main() {
  int k, n; cin >> k >> n;
  vector<int> a(n);
  for(int &c : a) {
    cin >> c;
  }
  vector<int> dist(n);
  int longest = 0;
  for(int i = 0; i < n-1; i++) {
    dist.at(i) = a.at(i+1)-a.at(i);
    if(dist.at(i) > longest) {
      longest = dist.at(i);
    }
  }
  dist.at(n-1) = a.at(0) + k - a.at(n-1);
  if(dist.at(n-1) > longest) {
    longest = dist.at(n-1);
  }
  cout << k - longest << endl;
}

Measured memory_bytes: 4820
#include<stdio.h>
int main(){
  int a,b,ans = 1;
  scanf("%d %d",&a,&b);
  if(b > 99){
    b++;
  }
  for(int i = 0;i < a;i++){
    ans *= 100;
  }
  printf("%d\n",ans * b);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    double l;
    cin>>l;
    double div=l/3;
    double ans=div*div*(l-2*div);
    printf("%.10lf",ans);
    return 0;
}




Measured memory_bytes: 256
import sys

s = sys.stdin.readline()

ss = s.rstrip()

sss =str(ss)
if ss == '000':
    print(0)
if ss == '001':
    print(1)
if ss == '010':
    print(1)
if ss == '011':
    print(2)
if ss == '100':
    print(1)
if ss == '101':
    print(2)
if ss == '110':
    print(2)
if ss == '111':
    print(3)



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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int a[n],b[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	for (int i = 0; i < n; ++i)
	{
		cin>>b[i];
	}
	int ans=0;
	for (int i = 0; i < 30; ++i)
	{
		vector<int> x(n),y(n);
		for (int j = 0; j < n; ++j)
		{
			x[j]=a[j]%(1<<(i+1));
			y[j]=b[j]%(1<<(i+1));
		}
		sort(y.begin(), y.end());
		long long cnt=0LL;
		for (int j = 0; j < n; ++j)
		{
			if ((1<<i)-x[j]>=0)
			{
				cnt+=(long long)(lower_bound(y.begin(), y.end(),(1<<(i+1))-x[j])-lower_bound(y.begin(), y.end(),(1<<i)-x[j]));
			}
			else
			{
				cnt+=(long long)(lower_bound(y.begin(), y.end(),(1<<(i+1))-x[j])-y.begin());
				cnt+=(long long)(lower_bound(y.begin(), y.end(),(1<<(i+1)))-lower_bound(y.begin(), y.end(),(3<<i)-x[j]));
			}
		}
		if (cnt&1LL)
		{
			ans+=(1<<i);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3520
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

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

const int INF = 1001001001;
const int MAX = 1000000;

int main()
{
	bool isprime[MAX + 1];
	fill(isprime, isprime+MAX+1, true);
	isprime[0] = isprime[1] = false;
	reps(i, 2, MAX){
		if(isprime[i]){
			for(int j=i*2; j<=MAX; j+=i)
				isprime[j] = false;
		}
	}

	int n;
	while(scanf("%d", &n), n){
		int x;
		scanf("%d", &x);

		int p[30];
		rep(i, n)
			scanf("%d", &p[i]);

		int ans = -1;
		bool dp[1000001];
		dp[0] = true;
		reps(i, 1, x+1){
			dp[i] = false;
			rep(j, n){
				dp[i] |= i>=p[j] && dp[i-p[j]];
				if(dp[i]){
					if(isprime[i])
						ans = i;
					break;
				}
			}
		}

		if(ans == -1)
			puts("NA");
		else
			printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 2992
import java.util.*;

public class Main
{
  static int n;
  static int[][] abc;
  static Integer[][] memo;
  public static void main(String[] args)
  {
	Scanner in = new Scanner(System.in);
    n = in.nextInt();
    abc = new int[3][n];
    for (int i = 0; i < n; i++)
      for (int j = 0; j < 3; j++)
        abc[j][i] = in.nextInt();
    
    memo = new Integer[3][n];
    System.out.println(go());
    in.close();
  }
  
  public static int go()
  {
    int ans = 0;
    for (int i = 0; i < 3; i++)
      ans = Math.max(ans, abc[i][0]+dp(i, 1));
    return ans;
  }
  
  public static int dp(int bad, int at)
  {
	if (at == n)
      return 0;
    if (memo[bad][at] != null)
      return memo[bad][at];
    
    int ans = 0;
    int to1 = 3-bad;
    int to2 = 0;
    if (to1 == 3)
    {
      to1 = 1;
      to2 = 2;
    }
    ans = Math.max(ans, abc[to1][at]+dp(to1, at+1));
    ans = Math.max(ans, abc[to2][at]+dp(to2, at+1));
    return memo[bad][at] = ans;
  }
}


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

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define sizeOf(A) (sizeof(A))/(sizeof(A[0]))
#define odd(x) ((x) % (2))
#define fastio ios_base::sync_with_stdio(false), cin.tie(0);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
const ll MOD = 1e9 + 7;

int main() {
    fastio;

    int n, a;
    cin >> n >> a;
    cout << (n*n)-a << "\n";    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
ll mod=1000000007;
#define vl vector<ll>
#define pl pair<ll,ll>
#define rep(i,b) for(ll i=0;i<b;i++)
#define rsort(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;

ll n,m,l;
ll c[100][100],a[100][100],b[100][100];
int main(){
    cin>>n>>m>>l;
    rep(i,n)rep(j,m)cin>>a[i][j];
    rep(i,m)rep(j,l)cin>>b[i][j];
    rep(i,n)rep(j,l)rep(k,m)c[i][j]+=a[i][k]*b[k][j];
    rep(i,n){
        rep(j,l){
        cout<<c[i][j];
        if( j<l-1)cout<<" ";
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3316
function Main(input) {
	input = input.split("\n");
	tmp = input[0].split(" ");
	
	var a = parseInt(tmp[0], 10);
	var b = parseInt(tmp[1], 10);
	var c = parseInt(tmp[2], 10);
	var k = input[1];
	
	for (var i = 0; i < k; i++) {
	if  (a >= b) {
	b = b * 2;
	
	} else if (b >= c) {
	c = c * 2;
	
	} else {
	}
	}

	
	if  (a < b && b < c) {
	var result = 'Yes';
	
	} else {
	var result = 'No';
	}
	
	
	console.log(result);
	}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29640
#include <bits/stdc++.h>
#define MAX 100010
#define pb push_back
#define ll long long
using namespace std;

ll val[1000003];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    val[0]=0;
    val[1]=1;
    for(int i=2;i<=1000000;i++)
    {
        val[i]=val[i-1]+i;
    }
    while(t--)
    {

        ll n;
        cin>>n;
        ll cnt=0;
        ll temp=n;
        while(n%2==0)
        {
            cnt++;
            n/=2;
        }
        //cout<<cnt<<endl;
        ll idx=lower_bound(val+1,val+1000000,cnt)-(val);
        //cout<<idx<<endl;
        while(val[idx]>cnt)
        {
            idx--;
        }
        ll res=0;
        res+=idx;
        for (int i = 3; i <= sqrt(n); i = i + 2)  
        {  
            int cnt=0;
            while (n % i == 0)  
            {  
                cnt++;  
                n = n/i;  
            }  
            ll idx=lower_bound(val+1,val+1000000,cnt)-(val);
            //cout<<idx<<endl;
            while(val[idx]>cnt)
            {
                idx--;
            }
            res+=idx;
        }
        if(n>2)
        {
            res++;
        }
        cout<<res<<endl;  

        

    }


    return 0;
}

Measured memory_bytes: 11508
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long l,r,n,ou = 2018,tp = 0;
	cin >> l >> r;
	n = r-l+1;
	if(n>3000){
		cout << 0 <<endl;	
		return 0;
	}
	for (long long i = l; i < r; i++){
		for (long long j = i+1; j < r+1; j++){
			tp = (i*j)%2019;
			if (tp < ou) ou = tp;
		}
	}
 
	cout << ou <<endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.Closeable;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HBonsai
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BTwoAnagrams solver = new BTwoAnagrams();
        solver.solve(1, in, out);
        out.close();
    }

    static class BTwoAnagrams {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            char[] s = in.next().toCharArray();
            char[] t = in.next().toCharArray();
            Arrays.sort(s);
            Arrays.sort(t);
            String T = new StringBuilder(String.valueOf(t)).reverse().toString();
            if (String.valueOf(s).compareTo(T) < 0) {
                out.println("Yes");
            } else out.println("No");
        }

    }

    static class FastScanner implements Closeable {
        private final InputStream in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public void close() {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}



Measured memory_bytes: 21460
#include <iostream>

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

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

void solve(ll N) {
  while (N%111) ++N;
  cout << N << endl;
}

int main() {
  ll N;
  cin >> N;
  solve(N);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <set>
#include <cstdio>
#include <bitset>
#include <functional>
#include <tuple>
#include <list>
#include <deque>
using namespace std;
typedef pair<int, int> P;

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

typedef long long ll;
typedef vector<int> VI;

int a[100010];
int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    int n; cin >> n;
    REP(i, n) cin >> a[i];
    
    int q; cin >> q;
    sort(a, a+n);
    REP(i, q){
        int k; cin >> k;
        bool f= false;
        int l=0, r=n;
        for(int i=0; i<100; ++i){
            int mid = l+(r-l)/2;
            if(k==a[mid]) f=true;
            else if(k>a[mid]){
                l = mid+1;
            }else{
                r = mid-1;
            }
        }
        if(f) cout << 1 << endl;
        else cout << 0 << endl;
    }
    
    
    
	return 0;
}


Measured memory_bytes: 3568
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		sc.close();

		long ans = 1;
		long INF = 1000000007;

		//犬パターン
		for(long i = 1 ; i <= N ; i++){
			ans = ((ans*i)%INF);
			//System.out.println(i + " " + ans%INF);
		}

		if(M<N-1){
			System.out.println("0");
		}
		else if(M-(N-1)>2){
			System.out.println("0");
		}
		else{
			for(long i = M ; i > M-N+1 ; i--){
				ans = ((ans*i)%INF);
			}
			if(M-(N-1)==0){
				System.out.println(ans%INF);
			}
			if(M-(N-1)==1 ||M-(N-1)==2){
				System.out.println((2*ans)%INF);
			}
		}

	}
}


Measured memory_bytes: 21844
# coding:utf-8

INF = float('inf')


def inpl(): return list(map(int, input().split()))


N = int(input())
A = inpl()

mod2 = 0
mod4 = 0
for a in A:
    if a % 2 == 0:
        mod2 += 1
    if a % 4 == 0:
        mod4 += 1

if mod4 >= N // 2:
    print('Yes')
elif mod2 - mod4 >= 2 and N - mod2 <= mod4:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 14252
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  i64 h, w, k;
  cin >> h >> w >> k;

  for (i64 rowCnt = 0; rowCnt <= h; ++rowCnt) {
    for (i64 colCnt = 0; colCnt <= w; ++colCnt) {
      i64 a = (w * rowCnt) + (h * colCnt) - 2*(rowCnt * colCnt);
      if (a == k) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;

  return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author:   bebebe
# Created:  2019-10-27
#


N = int(input().strip())

result = 'No'
for a in range(1, 10):
    if N % a == 0:
        b = N / a
        if b > 0 and b < 10:
            result = 'Yes'
            break

print(result)


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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;

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

    if (K == 1) {
        cout << "Hello World" << endl;
    }
    else {
        int A, B;
        cin >> A >> B;
        cout << A + B << endl;
    }
    return 0;
}

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

using namespace std;

#define endl "\n"
#define lln long long int
#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
	IOS;

	int n;
	cin >> n;
	cout << 1 - n;
	return 0;    
}

Measured memory_bytes: 3644