akhauriyash/Code-Regression huggingface dataset:
#[allow(dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

fn main() {
    input!{
        s: chars
    }
    let cnt = s.into_iter().filter(|&c| c == 'x').count();
    let result = if cnt >= 8 {
        "NO"
    } else {
        "YES"
    };
    println!("{}", result);
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  map<ll,ll> m;
  ll sum=0;
  rep(i,n){
    ll a; cin>>a;
    sum+=a;
    m[a]++;
  }
  ll q; cin>>q;
  rep(_,q){
    ll b,c; cin>>b>>c;
    ll tmp=sum-m[b]*b+m[b]*c;
    cout<<tmp<<endl;
    m[c]+=m[b];
    m[b]=0;
    sum=tmp;
  }
  
}
  

Measured memory_bytes: 9368
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

ll chk(vvP& to, ll pat, ll p, ll u, ll v) {
  if (u == v) return pat;
  for (P ue : to[u]) {
    ll unx, enx;
    tie(unx, enx) = ue;
    if (unx == p) continue;
    ll ret = chk(to, pat | (1LL << enx), u, unx, v);
    if (ret > 0) return ret;
  }
  return 0;
}

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n, m;
  cin >> n;

  vvP to(n);
  rep(i, n - 1) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    to[a].emplace_back(b, i);
    to[b].emplace_back(a, i);
  }

  cin >> m;

  vll pats(m, 0);
  rep(i, m) {
    ll u, v;
    cin >> u >> v;
    u--, v--;
    pats[i] = chk(to, 0, -1, u, v);
  }

  ll ans = 0;
  rep(s, 1 << m) {
    if (s == 0) continue;
    ll spat = 0;
    rep(i, m) {
      if ((s >> i) & 1) spat |= pats[i];
    }
    ll tmp = 1LL << (n - 1 - __builtin_popcountll(spat));
    if(__builtin_popcountll(s) & 1){
      ans += tmp;
    } else {
      ans -= tmp;
    }
  }

  ans = (1LL << (n - 1)) - ans;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n,m; cin>>n>>m;
    priority_queue<int,vector<int>,greater<int>> pq;
    rep(i,n){
        int a; cin>>a;
        pq.push(a);
    }
    pair<int,int> cb[m];
    rep(i,m){
        int b,c; cin>>b>>c;
        cb[i]={c,b};
    }
    sort(cb,cb+m);
    reverse(cb,cb+m);
    bool flg=1;
    for(int i=0;i<m;i++){
        int c=cb[i].first,b=cb[i].second;
        cerr<<c<<endl;
        while(b--){
            int a=pq.top(); pq.pop();
            if(c>a){
                cerr<<c<<" "<<a<<endl;
                pq.push(c);
            }else{
                pq.push(a);
                flg=0;
                break;
            }
        }
        if(!flg) break;
    }
    int64_t ans=0;
    while(pq.size()){
        int i=pq.top(); pq.pop();
        cerr<<i<<endl;
        ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}


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

using Graph = vector<int>;
vector<Graph>g;

int main() {
    int n;
    cin >> n;
    g.resize(n);
    vector<int>s(n, -1);
    for (int i=0; i < n; i++) {
        int num, count;
        cin >> num >> count;
        for (int j=0; j < count; j++) {
            int t;
            cin >> t;
            g[num-1].emplace_back(t-1);
        }
    }

    queue<int> que;
    que.push(0);
    s[0] = 0;
    while (!que.empty()) {
        int tyouten = que.front();
        que.pop();
        Graph gu = g[tyouten];
        for (int i=0; i < gu.size(); i++) {
            int num = gu[i];
            if (s[num] == -1) {
                s[num] = s[tyouten] + 1;
                que.push(num);
            }
        }
    }

    for (int i=0; i < n; i++) {
        cout << i + 1 << " " << s[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3160
#include<stdio.h>
#include<string.h>
int main()
{
  char S[256][11],T[256][11];
  int flag=0;
  int N,M;
  int i,j;
  
  for(i=0;i<256;++i);
  
  scanf("%d",&N);
  for(i=0;i<N;++i){
    scanf("%s",S[i]);
  }
  scanf("%d",&M);
  for(i=0;i<M;++i){
    scanf("%s",T[i]);
  }

  for(i=0;i<M;i++){
    for(j=0;j<N;j++){
      if(strcmp(T[i],S[j])==0 && flag==0){
        printf("Opened by %s\n",S[j]);
        flag=1;
        break;
      }
      if(strcmp(T[i],S[j])==0 && flag==1){
        printf("Closed by %s\n",S[j]);
        flag=0;
        break;
      }
    }
    if(j==N)printf("Unknown %s\n",T[i]);
  }
  return 0;
}
        

Measured memory_bytes: 612
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A1 = sc.nextInt();
		int A2 = sc.nextInt();
		int A3 = sc.nextInt();
		sc.close();
		int a = A1 + A2 + A3;
		if (a < 22) {
			System.out.println("win");
		} else {
			System.out.println("bust");
		}
	}
}

Measured memory_bytes: 24148
h,w=map(int,input().split())
s=[input()for _ in range(h)]

ans=0
dx = [1,0,-1,0]
dy = [0,1,0,-1] 
import queue
for si in range(h):
	for sj in range(w):
		if s[si][sj] == "#":
			continue
		dist = [[-1 for a in range(w)]for b in range(h)]
		q = queue.Queue()
		q.put([si,sj])
		dist[si][sj]=0
		while not q.empty():
			nowi,nowj = q.get()
			for ne in range(4):
				nexti,nextj = nowi+dx[ne],nowj+dy[ne]
				if nexti<0 or nexti>=h or nextj<0 or nextj>=w:
					continue
				if dist[nexti][nextj] != -1 or s[nexti][nextj]=="#":
					continue
				dist[nexti][nextj] = dist[nowi][nowj]+1
				q.put([nexti,nextj])
				ans = max(ans,dist[nexti][nextj])
print(ans)

Measured memory_bytes: 61780
n = int(input())
l, r = 0, n**2
while r-l > 1:
  k = (r+l)//2
  if k*(k+1)//2 < n:
    l = k
  else:
    r = k

if n == 1:
  r = 1

key = []
for i in range(r, 0, -1):
  if n-i >= 0:
    key.append(i)
    n -= i
    if not n:
      break

key.reverse()
for value in key:
  print(value)

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

#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define int long long

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

  using P = pair<int, int>;
  vector<P> p;
  int t = n;
  rep(i, 2, t/i+1){
    int c = 0;
    while(t%i == 0){
      t /= i;
      c++;
    }
    if(c) p.emplace_back(i, c);
  }
  if(t != 1) p.emplace_back(t, 1);

  int ans = 0;
  for(auto i : p){
    int j, cnt;
    for(cnt = 0, j = 1; cnt+j <= i.second; cnt += j, j++) ans++;
//    cout << i.first << " " << i.second << " " << cnt << endl;
  }

  cout << ans << endl;

  return 0;
}



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

//都市数に応じたバケット配列を作成し、入力された都市Noを
//該当する配列において要素をインクリメントすると
//ある都市から何本の道が伸びているか求まる

int main(void){
    int N, M = 0;
    cin >> N >> M;
    vector<int> roadbucket(N,0); // N個の要素を作成し0で初期化

    int a, b;
    for(int i=0; i<M; i++){
        cin >> a >> b;
        roadbucket[a-1]++; roadbucket[b-1]++;
    }

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

        cout << roadbucket[i] << endl;
    }


    return 0;
}

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

using namespace std;

int main() {
    long long H, W;

    cin >> H >> W;

    if (H == 1 || W == 1) {
        cout << 1 << endl;
    } else {
        cout << (H * W + 1) / 2 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long m = sc.nextLong();
        long nn = 1l;
        for (int i = 2; i <= n; i++) {
            nn *= i;
            nn %= 1000000007l;
        }
        long mm = 1l;
        for (int i = 2; i <= m; i++) {
            mm *= i;
            mm %= 1000000007l;
        }
        long ans;
        if(Math.abs(n - m) > 1) {
            ans = 0l;
        } else if(n == m){
            ans = nn * mm * 2;
        } else {
            ans = nn * mm;
        }
        System.out.println(ans % 1000000007);
    }
}

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

int main()
{
	int n;
	cin>>n;
	int a[n+1];
	
	int even=0,ok=0;
	for(int i=1; i<=n; i++)	cin>>a[i];
	
	for(int i=1; i<=n; i++)
	{
		if(a[i]%2==0)
		{
			even++;
			if(a[i]%3==0 || a[i]%5==0)
				ok++;
		}
	}
	
	if(ok==even)
		cout<<"APPROVED"<< endl;
	else
		cout<<"DENIED"<< endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <unordered_set>

int main() {
	int n;
	std::cin >> n;

	std::vector<bool> isPrime(1000000 + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (int i = 2; i <= 1000; ++i) {
		if (!isPrime[i])
			continue;

		for (int j = i * 2; j < isPrime.size(); j += i)
			isPrime[j] = false;
	}

	std::vector<int> a(n);
	std::unordered_set<int> set;
	int g = 0;
	for (auto&& e : a) {
		std::cin >> e;
		set.insert(e);

		g = (g == 0 ? e : std::gcd(g, e));
	}

	if (g != 1) {
		std::cout << "not coprime" << std::endl;
		return 0;
	}

	for (int i = 2; i <= 1000; ++i) {
		if (!isPrime[i])
			continue;

		int cnt = 0;
		for (auto&& e : a)
			if (e % i == 0)
				++cnt;

		if (cnt >= 2) {
			std::cout << "setwise coprime" << std::endl;
			return 0;
		}
	}
	for (int i = 1001; i <= 1000000; ++i) {
		if (!isPrime[i])
			continue;

		int cnt = 0;
		for (int j = 1; i * j <= 1000000; ++j)
			if (set.count(i * j) != 0)
				++cnt;

		if (cnt >= 2) {
			std::cout << "setwise coprime" << std::endl;
			return 0;
		}
	}

	std::cout << "pairwise coprime" << std::endl;
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

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

  while(1){
    ll n=6;
    vector<ll> a(n);
    rep(i,n)cin>>a[i];
    {
      bool done=true;
      rep(i,n)if(a[i]>0)done=false;
      if(done)break;
    }

    ll A=a[0]+a[3],B=a[1]+a[4],C=a[2]+a[5];
    ll res=0;
    rep(i,min(3LL,min({A+1,B+1,C+1}))){
      maxch(res,(((A-i)/3)+((B-i)/3)+((C-i)/3))+i);
    }
    cout<<res<<endl;
  }

  return 0;
}



Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
int a[100001];
int f[100001];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
   	{
      		scanf("%d",&a[i]);
   	}
   	for(int i=2;i<=n;i++)
	{
		if(i==2)
			f[i]=f[i-1]+abs(a[i-1]-a[i]);
		else
			f[i]=min(f[i-2]+abs(a[i-2]-a[i]),f[i-1]+abs(a[i-1]-a[i]));
	}
	printf("%d",f[n]);
   	return 0;
}

Measured memory_bytes: 1024
n,m = map(int,input().split())
if n>=3 and m>=3:
    print((n-2)*(m-2))
elif n==2 or m==2:
    print(0)
elif n==1:
    if m==1:
        print(1)
    else:
        print(m-2)
elif m==1:
    print(n-2)
    

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;


int main() {

	int A, B;
	cin >> A >> B;
	
	if (B == 1) {
		cout << 0 << endl;
		return 0;		
	}
	
	int total = 0;	
	int number;
	for(int i = 1; i < 1000000; i++){
		total = A*i - (i - 1);
		if(total >= B){
			number = i;
			break;
		}
		
	}
	
	cout << number << endl;


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<limits>
#include<algorithm>
#include<numeric>
#include<utility>

int main(){
    int N, A, B, C, D;
    std::string S;

    std::cin >> N >> A >> B >> C >> D;
    std::cin >> S;

    if(C<D){
        int re_rock=0;
        for(int i=A-1;i<D;i++){
            if(S[i]=='#') re_rock++;
            else re_rock=0;
            if(re_rock==2){
                std::cout << "No" << std::endl;
                return 0;
            }
        }
    }else{
        int re_rock=0;
        int B_cnt=0;
        int max_B_cnt=0;
        for(int i=A-1;i<C;i++){
            if(S[i]=='#') re_rock++;
            else re_rock=0;
            if(re_rock==2){
                std::cout << "No" << std::endl;
                return 0;
            }
            if(i>=B-2 && i<=D-1){
                if(S[i]=='.') B_cnt++;
                else B_cnt=0;
                if(max_B_cnt < B_cnt) max_B_cnt = B_cnt;
            }
        }

        if(max_B_cnt < 3){
            if(S[D-2]=='#' || S[D]=='#'){
                std::cout << "No" << std::endl;
                return 0;
            }
        }else{
            if(D-B>1){
            }
        }
    }

    std::cout << "Yes" << std::endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const bool debug = true;

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i=1;i<=n;i++){
        ll x = n/i;
        ans += i * x * (x+1) / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

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

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define ALL(obj) (obj).begin(),(obj).end()

#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>

#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>

#define SUMI(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SUMD(obj) accumulate((obj).begin(), (obj).end(), 0.)
#define SUML(obj) accumulate((obj).begin(), (obj).end(), 0LL)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll HMOD = (ll)1e9 + 7;
const ll LMOD = 998244353;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;
const long double EPS = 1e-10;

void YN(bool flag) {
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Yn(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void yn(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}


int main() {
	string S,T; cin >> S >> T;
	VI c1(26, 0), c2(26, 0);
	REP(i, S.size()) c1[S[i] - 'a']++;
	REP(i, T.size()) c2[T[i] - 'a']++;
	sort(ALL(c1));
	sort(ALL(c2));
	bool flg = true;
	REP(i, 26) if (c1[i] != c2[i]) flg = false;
	Yn(flg);
	return 0;
}



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

int main(){
	double a;
	while(cin >> a){
		if(cin.eof()) break;
		if(a<=48)
			puts("light fly");
		else if(a<=51)
			puts("fly");
		else if(a<=54)
			puts("bantam");
		else if(a<=57)
			puts("feather");
		else if(a<=60)
			puts("light");
		else if(a<=64)
			puts("light welter");
		else if(a<=69)
			puts("welter");
		else if(a<=75)
			puts("light middle");
		else if(a<=81)
			puts("middle");
		else if(a<=91)
			puts("light heavy");
		else
			puts("heavy");
	}
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define vl          vector<ll>
#define vi          vector<int>
#define pi          pair<int,int>
#define pl          pair<ll,ll>
#define all(a)      a.begin(),a.end()
#define mem(a,x)    memset(a,x,sizeof(a))
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define trace(x)     cerr<<#x<<":"<<x<<endl;
#define trace2(x,y) cerr<<#x<<":"<<x<<"|"<<#y<<":"<<y<<endl;
#define trace3(x,y,z) cerr<<#x<<":"<<x<<"|"<<#y<<":"<<y<<"|"<<#z<<":"<<z<<endl;
#define fast_io     std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
const int maxn = 2e5+7;
const ll MOD = 1e9+7;
ll fac[maxn], mult[maxn];
ll cnt = 0;
ll bexp(ll a, ll b){
	if(b==0)return 1;cnt++;
	ll r = bexp(a, b/2);
	if(b&1){
		r = (r*r)%MOD;
		r = (r*a)%MOD;
	}
	else{
		r = (r*r)%MOD;
	}
	return r;
}
int main(){
	fast_io;
	ll n,a,b;
	cin>>n>>a>>b;
	mult[0] = n;
	for(int i=1;i<maxn;i++){
		mult[i] = (mult[i-1] * (n-i))%MOD; 
 	}
 	fac[0] = 1;
 	for(int i=1;i<maxn;i++){
 		fac[i] = (fac[i-1] * i)%MOD;
 	}
	ll total = bexp(2,n);
	total = (total-1)%MOD;
	ll Xa = mult[a-1];
	ll Ya = bexp(fac[a], MOD-2);
	ll ansa = (Xa * Ya)%MOD;
	ll Xb = mult[b-1];
	ll Yb = bexp(fac[b], MOD-2);
	ll ansb = (Xb * Yb)%MOD;
	ll ans = (total + 2*MOD - ansa - ansb)%MOD;
	cout<<ans; 
	// trace(cnt)
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <cstring>
#include <vector>
#include <tuple>

using namespace std;

int count[6];

int main() {
	int N, K;
	scanf("%d%d", &N, &K);
	printf("%s\n", K+K<=N+1 ? "YES" : "NO");
	return 0;
}


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

llong n;
llong r[4096];
llong g[4096];
llong b[4096];
string s;

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

    for (int i = 0; i < n; i++) {
        r[i + 1] += r[i];
        g[i + 1] += g[i];
        b[i + 1] += b[i];

        if (s[i] == 'R') r[i + 1]++;
        if (s[i] == 'G') g[i + 1]++;
        if (s[i] == 'B') b[i + 1]++;
    }

    llong sum = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (s[i] == s[j]) continue;

            if (s[i] != 'R' && s[j] != 'R') {
                if (2 * j - i < n && s[2 * j - i] == 'R') {
                    sum += r[n] - r[j] - 1;
                }
                else {
                    sum += r[n] - r[j];
                }
            }
            else if (s[i] != 'G' && s[j] != 'G') {
                if (2 * j - i < n && s[2 * j - i] == 'G') {
                    sum += g[n] - g[j] - 1;
                }
                else {
                    sum += g[n] - g[j];
                }
            }
            else if (s[i] != 'B' && s[j] != 'B') {
                if (2 * j - i < n && s[2 * j - i] == 'B') {
                    sum += b[n] - b[j] - 1;
                }
                else {
                    sum += b[n] - b[j];
                }
            }
        }
    }
    
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3756
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
	int n,m;
	cin >> n >> m;
	cout << (n == m ? "Yes" : "No");

    return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
    
def main():
    n,m=map(int,input().split())
    A=[int(input())for _ in range(m)]
    flag=[True]*(n+2)
    for a in A:
        flag[a]=False
    mod=10**9+7
    dp=[0]*(n+1)
    dp[0]=1
    for i in range(n):
        if flag[i+1]:
            dp[i+1]+=dp[i]%mod
        if flag[i+2] and i<n-1:
            dp[i+2]+=dp[i]%mod
    print(dp[n]%mod)

if __name__=='__main__':
    main()

Measured memory_bytes: 8616
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int MAX=1e6;
int main()
{
	ll n,m,c,ans1=0,ans2=0;
	string s;
	cin>>n>>m;
	vector<pair<ll,string> >v;
	for(ll i=0;i<m;i++)
	{
		cin>>c>>s;
		v.push_back({c,s});
 }
	set<ll> s1;
	vector<ll> v2(n+1,0);
	for(ll i=0;i<m;i++)
	{
		if(v[i].second=="WA" && s1.count(v[i].first)==0)
		v2[v[i].first]++;
		else if(v[i].second=="AC" && s1.count(v[i].first)==0)
		{
			ans1++;
			s1.insert(v[i].first);
			ans2+=v2[v[i].first];
		}
	}
	cout<<ans1<<" "<<ans2<<endl;
	return(0);
}

Measured memory_bytes: 12016
N, M, K = io.read("*n","*n","*n")
A = {}; for i = 1, N do A[i] = io.read("*n") end
B = {}; for i = 1, M do B[i] = io.read("*n") end

a = {}; a[0] = 0
for i = 1, N do a[i] = a[i-1] + A[i] end

b = {}; b[0] = 0
for i = 1, M do b[i] = b[i-1] + B[i] end

ans, j = 0, M
for i = 0, N do
  if a[i] > K then break end
  while b[j] > K - a[i] do j = j - 1 end
  ans = math.max(ans, i + j)
end

print(ans)


Measured memory_bytes: 10880
def main():
    N, M = (int(i) for i in input().split())
    A = [int(i) for i in input().split()]
    ans = 0
    s = [0] * (N + 1)
    for i in range(N):
        s[i+1] = (s[i] + A[i]) % M
    from collections import Counter
    c = Counter(s)
    for v in c.values():
        if v >= 2:
            ans += (v*(v-1))//2
    print(ans)


if __name__ == '__main__':
    main()


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

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

const int lim = 1000000007;

vector<pair<int, int>> factorize(int N){
    vector<pair<int, int>> p;
    for(int i = 2; i <= N; i++){
        if(N % i == 0){
            int cnt = 0;
            while(N % i == 0){
                N /= i;
                cnt++;
            }
            p.emplace_back(i, cnt);
        }
    }
    if(p.empty()) p.emplace_back(N, 1);
    return p;
}

int main(){
    int N;
    cin >> N;
    //素因数をfirst, 素因数の乗数をsecondに入れる
    map<int, int> mp;
    for(int i = 2; i <= N; i++){
        vector<pair<int, int>> f;
        f = factorize(i);
        for(auto fi : f){
            mp[fi.first] += fi.second;
        }
    }
    ll ans = 1;
    for(auto p : mp){
        ans = (ans * (p.second + 1)) % lim;
    }
    cout << ans << endl;
    return 0;
}


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

int nearest(vector<int> &L, vector<int> &R) {
    if (L.empty()) return 1<<25;
    int i = 0, j = 0;
    int ans = 1<<25;
    while (i < L.size() && j < R.size()) {
        while (j < R.size() && L[i] >= R[j]) j++;
        if (j < R.size())
            ans = min(ans, R[j] - L[i]);
        i++;
    }
    return ans;
}


int main() {
    int n; cin >> n;
    int x[n], y[n];
    char u[n];
    map<int, map<char, vector<int> > > xmy, xpy, xx, yy;
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> u[i];
        xmy[x[i] - y[i]][u[i]].push_back(x[i]);
        xpy[x[i] + y[i]][u[i]].push_back(x[i]);
        if (u[i] == 'U' || u[i] == 'D')
            xx[x[i]][u[i]].push_back(y[i]);
        else
            yy[y[i]][u[i]].push_back(x[i]);
    }
    int ans = 1<<30;

    for (auto &[k, ps] : xpy) {
        for (auto &[k1, v] : ps) sort(v.begin(), v.end());
        ans = min(ans, nearest(ps['R'], ps['U']) * 10);
        ans = min(ans, nearest(ps['D'], ps['L']) * 10);
    }

    for (auto &[k, ps] : xmy) {
        for (auto &[k1, v] : ps) sort(v.begin(), v.end());
        ans = min(ans, nearest(ps['R'], ps['D']) * 10);
        ans = min(ans, nearest(ps['U'], ps['L']) * 10);
    }

    for (auto &[k, ps] : yy) {
        for (auto &[k1, v] : ps) sort(v.begin(), v.end());
        ans = min(ans, nearest(ps['R'], ps['L']) * 5);
    }

    for (auto &[k, ps] : xx) {
        for (auto &[k1, v] : ps) sort(v.begin(), v.end());
        ans = min(ans, nearest(ps['U'], ps['D']) * 5);
    }

    if (ans > 1<<25) cout << "SAFE\n";
    else cout << ans << endl;
}


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

int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	//freopen("input.txt","r",stdin);
    int n;
    cin>>n;
    unordered_map<string,int>m;
    while(n--){
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<"AC x "<<m["AC"]<<"\n";
    cout<<"WA x "<<m["WA"]<<"\n";
    cout<<"TLE x "<<m["TLE"]<<"\n";
    cout<<"RE x "<<m["RE"]<<"\n";
	return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		
		if ((a*b)%2 == 0)
			System.out.print("Even");
		else
			System.out.print("Odd");
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000;
vector <int> adj[MAXN];
int maxTaille[MAXN];
int recursion(int noeud)
{
	if (maxTaille[noeud] != 0)
		return maxTaille[noeud];
	for (int i = 0 ; i < adj[noeud].size() ; i++)
	{
		maxTaille[noeud] = max(maxTaille[noeud] , recursion(adj[noeud][i]) + 1);
	}
	return maxTaille[noeud];
}
int main()
{
	int N , M;
	cin >> N >> M;
	for (int i = 0 ; i < M ; i++)
	{
		int a,b;
		cin>>a>>b;
		a--;b--;
		adj[a].push_back(b);
	}
	int maxi = 0;
	for (int i = 0 ; i < N  ; i++)
	{
		maxi = max(maxi , recursion(i));
	}
	cout<<maxi<<endl;
}

Measured memory_bytes: 8192
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
	int w, h, x, y;
	cin >> w >> h >> x >> y;
	double s = double(w) * double(h) / 2;
	bool ans = false;
	cout << s <<' ';
	if (x * 2 == w && y * 2 == h) ans = true;
	cout << ans << endl;
}

Measured memory_bytes: 256
from sys import stdin
a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())
c = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
count=0
for i in range(c+1):
    for j in range(b+1):
        for k in range(a+1):
            if i*50+j*100+k*500 == x:
                count+=1
print(count)

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

int main ( )  {
	static char s [111], t [111] ;
	scanf ( "%s%s", s, t ) ;
	for ( int i = 0 ; t [i] ; ++ i )
		for ( int j = 0 ; s [j] ; ++ j )
			if ( t [i] > s [j] )  {
				return ! puts ( "Yes" ) ;
			}
	
	std :: sort ( s, s + strlen ( s ) ) ;
	std :: sort ( t, t + strlen ( t ) ) ;

	if ( strlen ( t ) <= strlen ( s ) )  return ! puts ( "No" ) ;

	if ( strcmp ( t, s ) > 0 )  return ! puts ( "Yes" ) ;

	return ! puts ( "No" ) ;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    st = string.digits + string.ascii_uppercase

    def decode(s):
        t = s.split('/')
        a = []
        for c in t:
            b = []
            for k in c:
                if k == 'b':
                    b.append(1)
                else:
                    for _ in range(int(k)):
                        b.append(0)
            a.append(b)
        return a

    def encode(a):
        t = []
        for c in a:
            k = ''
            tc = 0
            for b in c:
                if b == 0:
                    tc += 1
                else:
                    if tc > 0:
                        k += str(tc)
                        tc = 0
                    k += 'b'
            if tc > 0:
                k += str(tc)
            t.append(k)
        return '/'.join(t)

    while True:
        s = S()
        if s == '#':
            break

        a,b,c,d = LI()
        t = decode(s)
        t[a-1][b-1] = 0
        t[c-1][d-1] = 1

        rr.append(encode(t))

    return '\n'.join(map(str, rr))


print(main())




Measured memory_bytes: 9040
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- getIntList
    let as' = filter (<= n) as
        m = n - length as'
    print . (m +) . sum . map (\(a,b) -> if b >= a then b-a else b) . zip [1..n] . map (pred . length) . group . sort $ as' ++ [1..n]

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

ll pow(ll a, ll n, ll m) {
	ll ret = 1LL;
	for (; n > 0LL; n >>= 1LL, a = a * a % m) {
		if (n % 2LL == 1LL) {
			ret = ret * a % m;
		}
	}
	return ret;
}

int main() {
  ll H,W,A,B;
  cin>>H>>W>>A>>B;
  ll c = 1LL;
  for(ll i = 0; i < A-1; i++){
    c = (c*(W+A-2-i))%mod;
    c = (c*pow(i+1,mod-2,mod))%mod;
  }
  ll m = 0LL;
  for(ll i = 0; i < B; i++){
    m = (m+c)%mod;
    c=(c*(H-A+i))%mod;
    c=(c*(W-i-1))%mod;
    c = (c*pow(i+1,mod-2,mod))%mod;
    c = (c*pow(W-i+A-2,mod-2,mod))%mod;
  }
  ll ans = 1;
  for(ll i = 0; i < H-1; i++){
    ans = (ans * (H+W-2-i))%mod;
    ans = (ans*pow(i+1,mod-2,mod))%mod;
  }
  ans -= m;
  if(ans<0) ans+=mod;
  cout<<ans<<endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  ll q,h,s,d,n;
  pair <ll,int> a[4];
  cin>>q>>h>>s>>d>>n; 
  n*=4; 
  a[0]={q*8,1};
  a[1]={h*4,2};
  a[2]={s*2,4};
  a[3]={d*1,8};
  //sort(a,a+4,greater<pair<ll,ll>>());
  sort(a,a+4);
  ll ans(0);
  ans+=((n/a[0].second)*(a[0].first/(8/a[0].second)));
  n%=a[0].second;
  ans+=((n/a[1].second)*(a[1].first/(8/a[1].second)));
  n%=a[1].second;
  ans+=((n/a[2].second)*(a[2].first/(8/a[2].second)));
  n%=a[2].second;
  ans+=((n/a[3].second)*(a[3].first/(8/a[3].second)));
  n%=a[3].second;
  cout << ans << endl;
}


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

using namespace std;
using lli = int_fast64_t;
using ulli = unsigned long long;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = copy(x);cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

constexpr lli MOD = (lli)1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;

int main() {
	int A, B;
	cin >> A >> B;
	cout << A * B << endl;
	return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

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

    rep(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end());
    rep(i, 0, m){
        cin >> bc[i].second >> bc[i].first;
    }
    sort(bc.begin(), bc.end(), greater<pair<ll, ll>>());

    ll bptr = 0;
    rep(i, 0, n){
        if(bc[bptr].first < a[i]) break;
        a[i] = bc[bptr].first;
        bc[bptr].second--;
        if(bc[bptr].second < 1) bptr++;
    }

    ll ans = 0;
    rep(i, 0, n){
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--) 
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();

int main(){
 int n,res=0; cin>>n;
 REP(i,n){
     int p; cin>>p;
     if(p!=i+1)res++;
 }
  if(res<=2)
  cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

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

using namespace std;

int main() {
  long long N;
  cin >> N;
  vector<long long> L(N + 1);
  L[0] = 2;
  L[1] = 1;
  for (int i = 2; i <= N; ++i) {
    L[i] = L[i - 2] + L[i - 1];
  }

  cout << L[N] << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    List<Integer> As = new ArrayList<>();
    
    int bit = 0;
    for (int i=0; i<N; i++) {
        bit = bit | sc.nextInt();
    }
    
    System.out.println(Integer.numberOfTrailingZeros(bit));
  }
}


Measured memory_bytes: 24916
H,W = map(int,input().split())
a = [list(input()) for _ in range(H)]
while ["." for _ in range(W)] in a:
    a.remove(["." for _ in range(W)])
c = []
for l in range(len(a[0])):
    s = 0
    for i in range(len(a)):
        if a[i][l] == ".":
            s += 1
    if s == len(a):
        c.append(l)
for i in range(len(a)):
    t = 0
    for l in c:
        del a[i][l-t]
        t += 1
for i in range(len(a)):
    print("".join(a[i]))




Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
set<char>s;
int main(void)
{
    int n;
    cin>>n;
    char ch;
    for(int i=0;i<n;++i)
    {
        cin>>ch;
        s.insert(ch);
    }
    if(s.size()==3)
    {
        cout <<"Three"<<endl;
    }
    else
    {
        cout <<"Four"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
n=int(input())
l=len(str(n))
if l==1:
    print(n)
elif l==2:
    print(9)
elif l==3:
    print(9+(n-99))
elif l==4:
    print(909)
elif l==5:
    print(909+(n-9999))
else:
    print(90909)

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

inline int read(){
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
} 

long long N, K;
long long x;

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    //freopen(".in","r",stdin);
	//freopen(".out","w",stdout); 
	
	cin >> N >> K;
	
	x=N%K;
	if(x>=K-x){
		x=K-x;
	}
	
	cout << x;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int d,N,A,B;
    scanf("%d %d %d",&N,&A,&B);
    d=N*A;
    if(d>B) {
        printf("%d\n",B);
    }
    else if(d<B) {
        printf("%d\n",d);
    }
    else  if(d=B){
        printf("%d\n",B);
    }
    return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static String newS(String [] s){
        String new_s = "";
        for (int i = 0; i < s.length; i++) new_s += s[i];
        return new_s;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String [] s = in.next().split("");
        Arrays.sort(s);
        if (newS(s).equals("abc")){
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }

}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int A, B, C;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> A >> B >> C;
    int ans = A + B + C - max(A, max(B, C));
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

    long long int x;
    cin >> x;

    long long int s[10000];
    long long int t[20001];

    for(int i=0;i<10000;i++){
        s[i]=pow(i+1,5);
    }
    for(int i=0;i<20001;i++){
        t[i]=pow(i-10000,5);
    }

    int m=0;
    int a,b;


    for(int i=0;i<10000;i++){
        for(int j=0;j<20001;j++){
            if(s[i]-t[j]==x){
                a=i+1;
                b=j-10000;
                m++;
                break;
            }
        }
        if(m!=0)break;
    }

    cout << a << " " << b << endl;

}

Measured memory_bytes: 4460
h, w, kk = map(int, input().split())
c = []
for i in range(h):
    c.append(input())

cc = []
for i in range(h):
    cc.append([])
    for j in range(w):
        cc[i].append(c[i][j])

ccc = []
for i in range(h):
    ccc.append([])
    for j in range(w):
        ccc[i].append(c[i][j])

import copy

# ccc = copy.copy(cc)

# print(cc)
cnt2 = 0
for i in range(2**h):
    for j in range(2**w):
        
        cc = copy.deepcopy(ccc)
        ii = bin(i)[2:].zfill(h)
        jj = bin(j)[2:].zfill(w)
        # print(ii)
        # print(jj)
        for k in range(len(ii)):
            if ii[k] == '1':
                for l in range(w):
                    cc[k][l] = '0'
        for k in range(len(jj)):
            if jj[k] == '1':
                for l in range(h):
                    cc[l][k] = '0'
        cnt = 0
        for k in range(h):
            for l in range(w):
                if cc[k][l] == '#':
                    cnt += 1
        if cnt == kk:
            cnt2 += 1
            # print(cc)
        # print(cc)
print(cnt2)

Measured memory_bytes: 9356
N, K = [int(n) for n in input().split()]
A = [int(n) for n in input().split()]

f = {}

def town(k):
    t = 1
    i = 0
    while i < k:
        f[t] = i
        t = A[t-1]
        i += 1

        if t in f:
            j = f[t]
            r = i - j
            k = i + (k - i) % r
    return t

print(town(K))


Measured memory_bytes: 32360
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  map<int64_t,int>D;
  for(int i=0;i<N;i++){
  int64_t d;
    cin>>d;
    if(D.count(d))
      D.at(d)++;
    else
      D[d]=1;
  
  }int M;
  cin>>M;
  map<int64_t,int>T;
  for(int i=0;i<M;i++){
  int64_t t;
    cin>>t;
    if(T.count(t))
      T.at(t)++;
    else
      T[t]=1;
  }string ans="YES";
  for(auto p:T){
  auto k=p.first;
    auto v=p.second;
    if(!D.count(k) || D.at(k)<T.at(k)){
    ans="NO"; break;
    }
  
  }cout<<ans<<endl;

   return 0;
}

Measured memory_bytes: 25216
from itertools import groupby
from operator import itemgetter

line = input()
line = input().split(" ")

a = []
for x in line:
        a.append(int(x))

a.sort()

ret = 0
for k,g in groupby(a):
        g = list(g)
        if len(g)>k:
                ret += len(g)-k
        elif len(g)<k:
                ret += len(g)

print(ret)

Measured memory_bytes: 15048
import math
A,B,H,M = map(int,input().split())

h_deg = H*30 + M*0.5
m_deg = M*6
rad = math.radians(abs(h_deg - m_deg))

# 余弦定理
print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(rad)))

Measured memory_bytes: 62448
#include <stdio.h>
#include <string.h>

void push(int x);
int pop();

int S[100]; 
int top=0;

int main(void)
{
	int a, b;
	char s[100];
	
	while(scanf("%s", s) != EOF){
		if(s[0] == '+'){
			a = pop();
			b = pop();
			push(a+b);
		}
		else if(s[0] == '-'){
			a = pop();
			b = pop();
			push(b - a);
		}
		else if(s[0] == '*'){
			a = pop();
			b = pop();
			push(a*b);
		}
		else{
			push(atoi(s));
		}
	}
	
	printf("%d\n", pop());
	
	return 0;
}

void push(int x)
{
	top++;
	S[top] = x;
}

int pop()
{
	top--;
	return S[top+1];
}


Measured memory_bytes: 2092
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 23 18:34:34 2018
ABC110C
@author: maezawa
"""

s = list(input())
t = list(input())

a = [[] for _ in range(26)]
b = [[] for _ in range(26)]


for i, c in enumerate(s):
    j = ord(c) - 97
    a[j].append(i)

for i, c in enumerate(t):
    j = ord(c) - 97
    b[j].append(i)
    
a.sort()
b.sort()

if a==b:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 23336
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

const int mod=1000000007;
//factorial_mod
int* fact_mod;
inline void init_fact_mod(int x){
    fact_mod = new int[x];
    fact_mod[0]=1;
    rep(i,x-1)fact_mod[i+1]=fact_mod[i]*(i+1)%mod;
}

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

    int n; cin>>n;
    init_fact_mod(n+10);
    cout<<fact_mod[n]<<endl;

}

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

int main()
{
		int m=0;
		int x[10000], y[10000];
		while (1) {
				cin >> x[m] >> y[m];
				if (x[m]==0 && y[m]==0) break;
				else m++;
		}

		for (int i=0; i<m; i++) {
				if (x[i] < y[i]) cout << x[i] << " " << y[i] << "\n";
				else cout << y[i] << " " << x[i] << "\n";
		}
}

Measured memory_bytes: 3064