akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
//const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================



int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================

	ll N;
	cin >> N;

	vll A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	sort(A.begin(), A.end());
	for (int i = 0; i < N - 1; i++) {
		if (A[i] == A[i + 1]) {
			cout << "NO";
			return 0;
		}
	}

	cout << "YES";

}


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

const int32_t MAX_N = 100;
const int32_t MAX_M = 100;
const int32_t INF = 1e9;

bool calced[MAX_N + 5][MAX_M + 5][2];
char board[MAX_N + 5][MAX_M + 5];
int32_t n, m, dp[MAX_N + 5][MAX_M + 5][2];

int32_t calc_dp(int32_t r, int32_t c, int32_t last) {
    if(r == n - 1 && c == m - 1) {
        if(last == 1 || board[r][c] == '.') {
            return 0;
        }
        else {
            return 1;
        }
    }
    else if(calced[r][c][last]) {
        return dp[r][c][last];
    }

    int32_t curr = (board[r][c] == '#' ? 1 : 0);

    dp[r][c][last] = INF;
    if(r != n - 1) {
        dp[r][c][last] = std::min(
            dp[r][c][last], 
            calc_dp(r + 1, c, curr) + (last == 0 && curr == 1)
        );
    }
    if(c != m - 1) {
        dp[r][c][last] = std::min(
            dp[r][c][last], 
            calc_dp(r, c + 1, curr) + (last == 0 && curr == 1)
        );
    }

    calced[r][c][last] = true;
    return dp[r][c][last];
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    std::cin >> n >> m;

    for(int32_t i = 0; i < n; i++) {
        for(int32_t j = 0; j < m; j++) {
            std::cin >> board[i][j];
        }
    }

    std::cout << calc_dp(0, 0, 0) << '\n';
}

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

signed main () {
	int n, x;
	cin >> n;
	multiset < int > heads;
	for (int i = 0; i < n; ++i) {
		cin >> x;
		auto it = heads.lower_bound(x);
		if (it == heads.begin() || heads.empty()) 
			heads.insert(x);
		else {
			heads.erase(prev(it));
			heads.insert(x);
		}
	}
	cout << heads.size() << '\n';
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)(n); ++i)

int x[100001];

inline void no() { printf("NO\n"), exit(0); }

int main(){
	int n;
	scanf("%d", &n);
	ll s = 0;
	f(i, 0, n)scanf("%d", x + i), s += x[i];
	x[n] = x[0];
	ll d = (ll)n * (n + 1) >> 1;
	if (s % d)no();
	ll z = s / d, k = 0;
	f(i, 0, n){
		ll t = x[i + 1] - x[i];
		t = z - t;
		if (t % n || t < 0)no();
		k += t / n;
	}
	if (k != z)no();
	printf("YES\n");
}


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

int main()
{
  int n, k;
  cin >> n >> k;
  unordered_set<int> s;
  for(int i = 0; i < k; i++) {
    int d;
    cin >> d;
    s.insert(d);
  }
  while(true) {
    int temp = n;
    bool ok = true;
    while(temp) {
      int digit = temp % 10;
      if(s.count(digit)) {
        ok = false;
        break;
      }
      temp /= 10;
    }
    if(ok) break;
    n++;
  }
  cout << n;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main(){
  int n;
  std::cin >> n;
  int ans = 0;
  for(int i=1; i<=n; i+=2){
    int count = 0;
    for(int j=1; j<=i; j++){
      if( i%j == 0 ){
        count++;
      }
    }
    if( count == 8 ){
      ans += 1;
    }
  }

  std::cout << ans << '\n';
  return 0;
}


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

bool func(vector<int> &a, vector<int> &b) {
    int s = 0;
    for (int i = 0, n = a.size(); i < n; i++) {
        int d = a.at(i) - b.at(i);
        s += d * d;
    }

    double r = sqrt(s);
    return r == floor(r);
}

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

    vector<vector<int>> x(n, vector<int>(d));
    for (int i = 0; i < n; i++)
        for (int j = 0; j < d; j++)
            cin >> x.at(i).at(j);

    int cnt = 0;
    for (int i = 0; i < n - 1; i++)
        for (int j = i + 1; j < n; j++)
            if (func(x.at(i), x.at(j)))
                cnt++;

    cout << cnt << endl;
}

Measured memory_bytes: 3700
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = list(input())
    
    tmp = [chr(i) for i in range(97, 97+26)]
    
    for i in tmp:
        if i in S:
            continue
        else:
            print(i)
            sys.exit()
            
    print("None")
    
    
if __name__ == "__main__":
	main()


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

int main()
{
	int n, m, a;
	while(cin >> n >> m >> a, n|m|a)
	{
		map<int, map<int, int> > amida;
		for(int i=0; i<m; i++)
		{
			int h, p, q;
			cin >> h >> p >> q;
			amida[h][p] = q;
			amida[h][q] = p;
		}
		int pos = a;
		for(map<int, map<int, int> >::reverse_iterator i=amida.rbegin(); i!=amida.rend(); i++)
		{
			map<int, int>::iterator j = i->second.find(pos);
			if(j!=i->second.end())
			{
				pos = j->second;
			}
		}
		cout << pos << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3220
#include <stdio.h>
int main(){
	int i,x,y;
	for(i=1;;i++){
		scanf("%d %d",&x,&y);
		if(x==0 && y==0){
			break;
		}
		else if(x<=y){
			printf("%d %d\n",x,y);
		}
		else{
			printf("%d %d\n",y,x);
		}
	}
	
	return 0 ;
}

Measured memory_bytes: 2596
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;
	while (isspace(c)) {c = gcu();}
	if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int n; (n = in());) {
		vector<int> v(n);
		for (int &t: v)
			t = in();
		sort(v.begin(), v.end());
		long w = 0, a = 0;;
		for (int t: v)
			w += a, a += t;
		outl(w);
	}
}


Measured memory_bytes: 2444
N = int(input())
A = list(map(int,input().split()))

all_sym_pattern = 3**N
all_not_sym_pattern = 1

for i in range(N):
    if A[i] % 2 == 0:
        all_not_sym_pattern = all_not_sym_pattern * 2
    else:
        all_not_sym_pattern = all_not_sym_pattern * 1
        
print(all_sym_pattern - all_not_sym_pattern)

Measured memory_bytes: 2940
#include<iostream>
#include<queue>
#include<vector>
#include<map>
using namespace std;

typedef pair<int,int> P;
const int maxN=100100;
const int maxM=2*100000+100;
int dist[maxN];
int pre[maxN];
vector<int> G[maxN];
#define INF 1000000000
int N,M;

void add_edge(int from, int to){
    G[from].push_back(to);
    G[to].push_back(from);
}

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P>> q;
    q.push(make_pair(0,s));
    fill(dist,dist+N,INF);
    fill(pre,pre+N,-1);
    dist[s]=0;
    while(!q.empty()){
        P p=q.top();q.pop();
        int u=p.second;
        if(p.first>dist[u]) continue;
        for(int i=0;i<G[u].size();i++){
            int v=G[u][i];
            if(dist[v]>p.first+1){
                dist[v]=p.first+1;
                pre[v]=u;
                q.push(P(dist[v], v));
            }
        }
    }
}

int main(){
    cin >> N >> M;
    for(int i=0;i<M;i++){
        int from,to;
        cin >> from >> to;
        add_edge(from-1,to-1);
    }
    dijkstra(0);
    bool c=true;
    map<int,int> res;
    for(int i=1;i<N;i++){
        if(pre[i]<0) c=false;
        res[i]=pre[i];
    }
    if(!c) cout << "No" << endl;
    else{
        cout << "Yes" << endl;
        for(int i=1;i<N;i++){

            cout << res[i]+1 << endl;
        }
    }
    return 0;

}

Measured memory_bytes: 14904
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int n, k;
    cin >> n >> k;
    int ans = 0;
    if (n%k) ans = 1;
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

int main()
{
    int n, k;
    std::string s;
    std::cin >> n >> s >> k;
    char r = s[k-1];
    char ans[n];

    for (int ii=0; ii < n; ++ii)
    {
        if (s[ii] == r)
        {
            ans[ii] = s[ii];
        }
        else
        {
            ans[ii] = '*';
        }
    }
    for(int ii = 0; ii < n; ++ii)
    {
        std::cout << ans[ii];
    }
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		long n = scn.nextLong();
		long ans=0;
		long i=1;
		while(n>0) {
			n/=2;
			ans+=i;
			i*=2;
		}System.out.println(ans);
	}
}

Measured memory_bytes: 26844
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,a[55][30]={},cnt=0,x[30]={};
  string s;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> s;
    for(int j=0; j<s.size(); j++) {
      a[i][s[j]-'a']++;
    }
  }
  for(int i=0; i<30; i++) {
    cnt=inf;
    for(int j=0; j<n; j++) {
      cnt=min(cnt,a[j][i]);
    }
    x[i]=cnt;
  }
  for(int i=0; i<26; i++) {
    for(int j=0; j<x[i]; j++) {
      cout << char('a'+i);
    }
  }
  cout << endl;
}

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

#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vll vector<ll>
#define vvll vector<vll>
#define pb push_back
template<typename T, typename U>
static inline void amin(T &x, U y){
    if(x>y)
        x = y;
}
template<typename T, typename U>
static inline void amax(T &x, U y){
    if(x<y)
        x = y;
}
#define rep(i,n) for(int i = 0; i < n; ++i)
#define irep(i,k,n) for(int i = k; i <= n; ++i)
#define irepr(i,k,n) for(int i = k; i >= n; --i)

const ll mod = 1e9+7;

int main(){
    int k, x;
    cin>> k>> x;
    if(k*500 >= x){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
    return 0;
}


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

int main(){
  int n,k,s[101],b[101][101],want[101];
  while(cin>>n>>k){
    if(n==0&&k==0)break;
    int flg=1;
    rep(i,101)want[i]=0;
    rep(i,k){
      cin>>s[i];
    }
    rep(i,n)rep(j,k){
      cin>>b[i][j];
      want[j]+=b[i][j];//point
    }
    rep(i,k){
      if((s[i]-want[i])<0)flg=0;
    }
    if(!flg)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	cout<<(H-h)*(W-w)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
void maxHeapify(int);
int H,*A;

int main(){
  int i;

  scanf("%d",&H);

  A=malloc(sizeof(int)*H);

  for(i=1; i<=H; i++)
    scanf("%d",&A[i]);

  for(i=H/2; i>0; i--)
    maxHeapify(i);

  for(i=1; i<=H; i++)
    printf(" %d",A[i]);
  printf("\n");

  return 0;
}

void maxHeapify(int i){
  int l,r,largest,tmp;

  l = i*2;
  r = i*2+1;

  if(l<=H && A[l]>A[i])
    largest = l;
  else
    largest = i;
 
  if(r<=H && A[r]>A[largest])
    largest = r;

  if(largest != i){
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(largest);
  }

}

Measured memory_bytes: 2552
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0

N, K = map(int, input().split())
ans = 0

F = Factorial(K + N + 2, MOD).comb

for i in range(1, K + 1):
    tmp = F(K - 1, i - 1)
    # print (i, tmp, end = ' ')
    tmp *= F(N - K + 1, i)
    print (tmp % MOD)





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

int main(){
  int N;
  int sumb = 0;
  cin >> N;
  vector<int>A(N);
  vector<int>B(N,0);
  for(int i=0;i<N;i++){
    cin >> A[i];
    if(i%2==1){
      sumb += A[i];
    }
  }
  int sum = accumulate(A.begin(),A.end(),0);
  B[0] = sum - sumb*2;
  for(int k=1;k<N;k++){
    B[k] = A[k-1]*2 - B[k-1];
  }
  for(int l=0;l<N;l++){
    cout << B[l];
    if(l<N-1){
      cout << " ";
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 2048
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

int ans[30];
int k = 0;
int m = 1000000;

void solve(int * A, int cur)
{
	if(cur == 5)
	{
		int cnt = 0, i = 0, t;
		for(t = 0; ; t++)
		{
			if(t%10 == 0)
			{
				while(t%10 == 0)
				{
					t += A[ans[i++]]; cnt++;
					if(cnt == 5) break;
				} 
			}
			if(cnt == 5) break;
		}
		if(t < m) m = t;
	}
	else for(int i = 0; i < 5; i++)
			{
				int ok = 1;
				for(int j = 0; j < cur; j++)
					if(i == ans[j]) { ok = 0; break; } 
				if(ok)
				{
					ans[cur] = i;
					solve(A, cur+1);
				}
			}
}

int main()
{
	int menu[10];
	for(int i = 0; i < 5; i++) scanf("%d", &menu[i]);
	solve(menu, 0);
	cout << m << endl;
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    vector<string> a = {"dream", "dreamer", "erase", "eraser"};

    for (int i = 0; i < 4; i++) {
        reverse(a.at(i).begin(), a.at(i).end());
    }
    bool can = true;
    for (int i = 0; i < s.size();) {
        bool can2 = false;
        for (int j = 0; j < 4; j++) {
            string d = a.at(j);
            if (s.substr(i, d.size()) == d) {
                i += d.size();
                can2 = true;
            }
        }
        if (!can2) {
            can = false;
            break;
        }
    }
    if (can) {
        cout << "YES" << endl;
    }

    else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
//#include <graphics.h>
using namespace std;
#ifdef __attribute__
#define fast __attribute__((optimize(3), target("no-ieee-fp,arch=corei7")))
#else
#define fast
#endif
#define inline fast inline
namespace io
{
#define USE_FREAD_IO
#ifdef USE_FREAD_IO
#define BUF_SIZE 5000010
	char buf[BUF_SIZE]; int cur = BUF_SIZE; FILE *in = stdin;
	inline char gnc()
	{
		if (cur == BUF_SIZE) { fread(buf, BUF_SIZE, 1, in); cur = 0; }
		return buf[cur++];
	}
#else
#define gnc getchar
#endif
	template<typename T>
	inline void gi(T &dx)
	{
		dx = 0;
		int yc = gnc();
		bool nega = false;
		while (yc < '0' || yc > '9') { nega = (yc == '-' ? true : nega); yc = gnc(); }
		while (yc >= '0' && yc <= '9') { dx = (T)(dx * 10 + yc - '0'); yc = gnc(); }
		if (nega) { dx = -dx; }
	}
	void gss(char *c)
	{
		*c = gnc();
		while (!isgraph(*c)) *c = gnc();
		while (isgraph(*c)) *++c = gnc();
		*c = 0;
	}
#if __cplusplus >= 201103l || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103l)
	template<typename T, typename ...Args> inline void gi(T &a, Args &...args)
	{ gi(a); gi(args...); }
#else
	template<typename t1, typename t2> inline void gi(t1 &a, t2 &b) { gi(a); gi(b); }
	template<typename t1, typename t2, typename t3> inline void gi(t1 &a, t2 &b, t3 &c) { gi(a); gi(b); gi(c); }
	template<typename t1, typename t2, typename t3, typename t4> inline void gi(t1 &a, t2 &b, t3 &c, t4 &d) { gi(a); gi(b); gi(c); gi(d); }
	template<typename t1, typename t2, typename t3, typename t4, typename t5> inline void gi(t1 &a, t2 &b, t3 &c, t4 &d, t5 &e) { gi(a); gi(b); gi(c); gi(d); gi(e); }
#endif
}
using namespace io;

long long n, a, b, c, d;
int main()
{
	gi(n, a, b, c, d);
	for (long long i = 0; i <= n; ++i) {
		long long sub = -d * i + c * (n - 1 - i);
		long long add = -c * i + d * (n - 1 - i);
		if (b >= a + sub && b <= a + add) {
			goto ok;
		}
	}
	puts("NO");
	return 0;
ok:
	puts("YES");
	return 0;
}




Measured memory_bytes: 256
# coding: utf-8
# Your code here!
S=list(input())
T=list(input())

dict1={}
dict2={}

for i in range(len(S)):
    if S[i] in dict1:
        if dict1[S[i]]==T[i]:
            pass
        else:
            print("No")
            exit()
    else:
        dict1[S[i]]=T[i]
    
    if T[i] in dict2:
        if dict2[T[i]]==S[i]:
            pass
        else:
            print("No")
            exit()
    else:
        dict2[T[i]]=S[i]
        
print("Yes")
#てきとー

Measured memory_bytes: 6704
n = int(input())
s = list(map(int, input().split()))
s.sort(reverse=True)

used = [s[0]]
unused = s[1:]
for i in range(n):
    nxt_used = []
    nxt_unused = []
    left = 0
    #print(used, unused)
    for j in used:
        while left < len(unused) and unused[left] >= j:
            nxt_unused.append(unused[left])
            left += 1
        if left == len(unused):
            print("No")
            exit()
        nxt_used.append(j)
        nxt_used.append(unused[left])
        left += 1
    nxt_unused += unused[left:]
    nxt_unused.sort(reverse=True)
    nxt_used.sort(reverse=True)
    used = nxt_used
    unused = nxt_unused
print("Yes")

Measured memory_bytes: 119880
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>
#include <tuple>
#include <complex>


#define FOR(i, a, b)		for(int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b)		for(int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n)			FOR(i, 0, n)
#define REPE(i, n)			FORE(i, 0, n)
#define ALL(x)				(x).begin(),(x).end()
#define DEBUG_DC(x)			cout << #x << ": " << x << endl
#define VEC_TYPE			int
#define INF					1e5+1

using namespace std;
typedef long long ll;
typedef vector<VEC_TYPE> vdef;
typedef vector<vdef> vvdef;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmaxE(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; }
template<class T> inline bool chminE(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
template<typename T> inline T mygcd(T a, T b) { return b ? mygcd(b, a%b) : a; }
template<typename T> inline T mylcm(T a, T b) { return a * b / mygcd(a, b); }

struct Work
{
	int a;
	int b;
};

bool cmp(const Work &w1, const Work &w2)
{
	return w1.b < w2.b;
}

int main()
{
	int n;
	cin >> n;
	vector<Work> v(n);
	for (int i = 0; i < n; ++i)
	{
		int a, b;
		cin >> a >> b;
		v[i].a = a;
		v[i].b = b;
	}

	sort(ALL(v), cmp);

	int time = 0;
	for (int i = 0; i < n; ++i)
	{
		time += v[i].a;
		if (time > v[i].b)
		{
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#define ull long long

int main() {
    ull a, b, c;
    std::cin >> a >> b >> c;
    if (c - a - b > 0 && 4 * a * b < (c - a - b) * (c - a - b)) {
        std::cout << "Yes" << std::endl;
    } else{
        std::cout << "No" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0060
"""
import sys



def calc_possibility(open_cards):
    cards = [x for x in range(1, 11)]
    c1, c2, c3 = open_cards
    my_total = c1 + c2
    cards.remove(c1)
    cards.remove(c2)
    cards.remove(c3)

    combinations = 0
    hit = 0
    for c in cards:
        combinations += 1
        if my_total + c <= 20:
            hit += 1
    # print('{}/{}'.format(hit, combinations))
    return (hit / combinations >= 0.5)


def main(args):
    for line in sys.stdin:
        open_cards = [int(x) for x in line.strip().split(' ')]
        if calc_possibility(open_cards):
            print('YES')
        else:
            print('NO')



if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 7588
import sys
input = sys.stdin.readline
N, Q = map(int, input().split())

S = [None] * N
T = [None] * N
X = [None] * N
for i in range(N):
    S[i], T[i], X[i] = map(int, input().split())

D = [None] * Q
for i in range(Q):
    D[i] = int(input())
    
# X S T
roadworks = [(x, s, t) for x, s, t in zip(X, S, T)]
roadworks = sorted(roadworks, key=lambda x: x[0])
#print(roadworks)

# Dは入力時点でソート済み
walkers = D[:]
ans = [-1] * Q
skip = [-1] * Q

import bisect
for x, s, t in roadworks:
    left = bisect.bisect_left(walkers, s - x)
    right = bisect.bisect_left(walkers, t - x)
    
    i = left
    while i < right:
        if skip[i] == -1:
            ans[i] = x
            skip[i] = right
            i += 1
        else:
            i = skip[i]

    
#print(walkers)
for a in ans:
    print(a)
    




    
    


Measured memory_bytes: 102492
n,m=map(int,raw_input().split())
A=[]
b=[]
for i in range(n):
    A.append(map(int,raw_input().split()))
for i in range(m):
    b.append(input())
for i in range(n):
    sum=0
    for j in range(m):
        sum+=A[i][j]*b[j]
    print('%d'%sum)

Measured memory_bytes: 6528
using System;
using System.Collections.Generic;
using System.Text;

namespace TaskD
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ConsoleReader.Read<long>();
            var powers = new Dictionary<long, int>();
            var div = 2;
            while (Math.Sqrt(n) >= div)
            {
                if (n % div == 0)
                {
                    if (powers.ContainsKey(div))
                        powers[div] = powers[div] + 1;
                    else
                        powers[div] = 1;
                    n /= div;
                } else
                {
                    div++;
                }
            }

            if (n > 1)
            {
                if (powers.ContainsKey(n))
                    powers[n] = powers[n] + 1;
                else
                    powers[n] = 1;
            }

            var res = 0;
            foreach(var power in powers)
            {
                var exp = power.Value;
                var step = 1;
                while (exp >= step)
                {
                    res++;
                    exp -= step;
                    step++;
                }
            }

            Console.WriteLine(res);
        }
    }
}

public static class ConsoleReader
{
    public static T Read<T>()
    {
        var inputBuffer = new StringBuilder();
        int currChar;

        while ((currChar = Console.Read()) != -1)
        {
            if (!char.IsWhiteSpace((char)currChar))
            {
                inputBuffer.Append((char)currChar);
            }
            else if (inputBuffer.Length != 0)
            {
                break;
            }
        }

        return (T)Convert.ChangeType(inputBuffer.ToString(), typeof(T));
    }

    public static T[] ReadArray<T>(int count)
    {
        if (count < 0)
        {
            throw new ArgumentOutOfRangeException(nameof(count), $"'{nameof(count)}' must be >= 0");
        }

        var result = new T[count];

        for (var i = 0; i < count; i++)
        {
            result[i] = Read<T>();
        }

        return result;
    }
}

Measured memory_bytes: 27896
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 1e9 + 7;
const ll SQ = 330;

ll a[N];
int main () {
	ios::sync_with_stdio(0), cin.tie(0);
	ll n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
	} 
	for (int i = k + 1; i <= n; i ++) {
		if (a[i] > a[i - k]) cout << "Yes\n";
		else cout << "No\n";
	}
}

Measured memory_bytes: 5176
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int main(){
  string s,t;
  cin >> s >> t;
  if(s[2]==t[0] && s[1]==t[1] && s[0]==t[2]) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define ort ((bas+son+1ll)/2ll)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;
 
typedef long long ll;
typedef pair < int , int > ii;
 
int n;
string f,s;

int main() {
	
	cin >> n;
	cin >> f >> s;
	for(int i = 0; i < n; i++)
	cout << f[i]<<s[i];
	 
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
#define ld long double
int inf=100000000;
ll INF=4000000000000000000;
ll MOD=1000000007;


int main() {
  int n,k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) cin >> a.at(i);
  ll b=0,s=0,ans=0;
  rep(i,k) b+=a.at(i);
  for (int i=k;i<n;i++){
      if (a.at(i)>0) s+=a.at(i);
  } 
  for (int i=0;i+k<n;i++){
      ans=max(ans,s+max(b,0LL));
      if (a.at(i)>0) s+=a.at(i);
      if (a.at(i+k)>0) s-=a.at(i+k);
      b+=a.at(i+k);
      b-=a.at(i);
  }
  ans=max(ans,s+max(b,0LL));
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << 0; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

const int N = 1e5 + 7;

int wa[N];
bool ac[N];

void solve() {
    int n, m;
    cin >> n >> m;
    loop(i, m) {
        int x; cin >> x;
        string s; cin >> s;
        if (s == "AC")
            ac[x] = 1;
        else if (!ac[x])
            ++wa[x];
    }
    int ans1 = 0, ans2 = 0;
    loop(i, N) {
        ans1 += ac[i];
        ans2 += (ac[i] ? wa[i] : 0);
    }
    cout << ans1 << " " << ans2;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 4452
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
template<class V> struct BIT {
    BIT() {}  // [L, R)
    int NV;vector<V> bit;
    BIT(int n){ init(n); }
    void init(int n) { NV = 1; while (NV < n)NV *= 2; bit.resize(NV); clear(); }
    V operator[](int e) { V s = 0; e++; while (e) s += bit[e - 1], e -= e&-e; return s; }
    void add(int e, V v) { e++; while (e <= NV) bit[e - 1] += v, e += e&-e; }
    int lower_bound(V val) { 
        V tv = 0; int i, ent = 0; for (i = NV - 1; i >= 0; i--)
        if(tv+bit[ent+(1<<i)-1]<=val)tv+=bit[ent+(1<<i)-1],ent += (1 << i);return ent;
    }
    V get(int L, int R) {
        assert(0 <= L); assert(R <= NV); assert(L <= R);
        V res = 0; if(R) res += operator[](R - 1); if (L) res -= operator[](L - 1);return res;
    }
    void clear() { rep(i, 0, NV) bit[i] = 0; }
};
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int N, A[101010];
deque<int> que[101010];
BIT<int> bit(101010);
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, N) que[A[i]].push_back(i);
    rep(i, 0, N) bit.add(i, 1);
    
    ll ans = 0;
    rep(i, 1, 101010) {
        while (!que[i].empty()) {
            int top = que[i].front();
            int top_cst = min(bit.get(0, top), bit.get(top + 1, 101010));
            int btm = que[i].back();
            int btm_cst = min(bit.get(0, btm), bit.get(btm + 1, 101010));

            if (top_cst < btm_cst) {
                que[i].pop_front();
                ans += top_cst;
                bit.add(top, -1);
            } else {
                que[i].pop_back();
                ans += btm_cst;
                bit.add(btm, -1);
            }
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 72188
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
#include <vector>
using namespace std;

int n;

void f(int s,int m,vector<int> v){
	if(s==0){
		int f=0;
		for(int i=0;i<v.size();i++){
			if(f)cout<<" ";
			cout<<v[i];
			f=1;
		}
		cout<<endl;
		return;
	}
	for(int i=min(s,m);i>0;i--){
		v.push_back(i);
		f(s-i,i,v);
		v.pop_back();
	}
}

int main(){
	while(cin>>n){
		if(n==0)return 0;
		vector<int> v;
		f(n,n,v);
	}
}

Measured memory_bytes: 912
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n);
    repeat (i, n) cin >> a[i];
    
    auto cnt = [](int a) -> int {
        int ans = 0;
        while (true) {
            if (a % 2 == 1) break;
            a /= 2;
            ++ans;
        }
        return ans;
    };
    
    int ans = 0;
    repeat (i, n) {
        ans += cnt(a[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, d int
	fmt.Scan(&n, &d)
	ar := make([][]int, n)
	for i := range ar {
		ar[i] = make([]int, d)
		for j := 0; j < d; j++ {
			fmt.Scan(&ar[i][j])
		}
	}
	ans := 0
	for i := 0; i < n-1; i++ {
		for j := i + 1; j < n; j++ {
			sum := 0
			for k := 0; k < d; k++ {
				sum += (ar[i][k] - ar[j][k]) * (ar[i][k] - ar[j][k])
			}
			for k := 1; k*k <= sum; k++ {
				if k*k == sum {
					ans++
					break
				}
			}
		}
	}
	fmt.Println(ans)
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL N;
    cin >> N;
    cout << N * (N - 1) / 2 << endl;
    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>					
using namespace std;	
int main()	
{		int n;
		cin>>n;
		int student[1000001],a_s[1000001];
		for(int i = 1;i<=n;i++){
			cin>>student[i];
		}
		for(int i = 1;i<=n;i++){
			a_s[student[i]] = i;
		}
		for(int i = 1;i<=n;i++){
			cout<<a_s[i]<<" ";
		}														
	return 0; 									
 } 

Measured memory_bytes: 5248
# -*- coding: utf-8 -*-
"""
Binary Search - Lower Bound
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_6_C&lang=jp

"""
from bisect import bisect_left

n = int(input())
A = [int(a) for a in input().split()]
for _ in range(int(input())):
    i = bisect_left(A, int(input()))
    print(n if i == n else i)



Measured memory_bytes: 17208
#include <bits/stdc++.h>
using namespace std;
int n, d; string s;
int main() {
	cin >> n;
	bool ok = true;
	while (n--) {
		cin >> s;
		if (s == "A") d++;
		else d--;
		if (d < 0) ok = false;
	}
	if (d != 0) ok = false;
	cout << (ok ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 3124
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#define ll long long
#define For(i, j, k) for(int i = j; i <= (int)k; ++ i)
#define Forr(i, j, k) for(int i = j; i >= (int)k; -- i)
#define INF 0x3f3f3f3f
using namespace std;

const int maxn = 100 + 5;

int n, Ans;
int a[maxn << 1];

inline void file(){
	freopen("agc001_A.in", "r", stdin);
	freopen("agc001_A.out", "w", stdout);
}

inline int Read(){
	int x = 0;	char c = getchar();
	for(; !isdigit(c); c = getchar());
	for(; isdigit(c); c = getchar())	x = (x << 3) + (x << 1) + (c ^ 48);
	return x;
}

int main(){
	n = Read() << 1;
	For(i, 1, n)	a[i] = Read();
	
	sort(a + 1, a + 1 + n);
	for(int i = 1; i <= n; i += 2)
		Ans += a[i];
	
	printf("%d", Ans);
	return 0;
}

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

int gcd( int a, int b) {
	if (b > a) swap(a, b);
	while (b >0) {
		int r = a % b;
		a = b;
		b = r;
	}
	return a;
}

int main() {
	int a, b, s;
	cin >> a;
	cin >> b;

	s = gcd(a,b);

	cout << s << endl;
	return 0;
}

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

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

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, M;
    vector<vector<ll>> path;
    vector<ll> prev;
    queue<ll> Q;
    cin >> N >> M;
    path.resize(N);
    rep(i, M) {
        ll A, B;
        cin >> A >> B;
        A--; B--;
        path[A].push_back(B);
        path[B].push_back(A);
    }
    prev.resize(N, -1);
    prev[0] = 0;
    Q.push(0);
    while(!Q.empty()) {
        ll current = Q.front();
        Q.pop();
        iter(i, path[current]) {
            if(prev[i] == -1) {
                prev[i] = current;
                Q.push(i);
            }
        }
    }
    cout << "Yes" << endl;
    rep2(i, 1, N) cout << prev[i] + 1 << endl;
    return 0;
}


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

int main()
{
	double n;
	double mi = 1e18, ma = 0.0;
	while (cin >> n)
	{
		ma = max(ma, n);
		mi = min(mi, n);
	}
	cout << (ma - mi) << endl;
	return 0;
}

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

void Main() {
  long long int h;
  cin >> h;

  long long attack = 1;
  long long ans = 0;
  while (h) {
    h /= 2;
    ans += attack;
    attack *= 2;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
signed main() {
    long long n, k;
    scanf ("%lld %lld", &n, &k);
    long long p = 1;
    for (int i = 1; ; ++i) {
        if (n < p) return printf ("%d\n", i - 1), 0; p *= k;
    } return 0;
}


Measured memory_bytes: 256
hi,hy=map(int,input().split())
ki,ky=map(int,input().split())
a,b,c,d=map(int,input().split())
ha=int(hi/10)
hb=int(hy/20)
ka=int(ki/10)
kb=int(ky/20)
H=hi*a+hy*b+ha*c+hb*d
K=ki*a+ky*b+ka*c+kb*d
if H>K:
    print("hiroshi")
elif H==K:
    print("even")
else:
    print("kenjiro")


Measured memory_bytes: 5596
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>
#include<string.h> // memcpy

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

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

const int N_MAX = 100010;
bool visited[N_MAX];

void reset_visited(){
    FOR(i, 0, N_MAX){
        visited[i] = false;
    }
}


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

    // input
    int N;
    cin >> N;

    vector<vector<int> > graph(N+1);
    FOR(i, 0, N){
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    // fennecからの距離
    reset_visited();
    int d[N+1];
    queue<int> que;
    d[1] = 0;
    que.push(1);
    while(!que.empty()){
        int front = que.front();
        que.pop();

        auto list = graph[front];
        FOR(i, 0, list.size()){
            int dest = list[i];
            if(!visited[dest]){
                visited[dest] = true;
                que.push(dest);
                d[dest] = d[front] + 1;
            }
        }
    }
    int d0[N+1];
    memcpy(d0, d, sizeof(d)); 

    // snukeからの距離
    reset_visited();
    d[N] = 0;
    que.push(N);
    while(!que.empty()){
        int front = que.front();
        que.pop();

        auto list = graph[front];
        FOR(i, 0, list.size()){
            int dest = list[i];
            if(!visited[dest]){
                visited[dest] = true;
                que.push(dest);
                d[dest] = d[front] + 1;
            }
        }
    }

    int d1[N+1];
    memcpy(d1, d, sizeof(d));

    int black = 0;
    int white = 0;
    FOR(i, 2, N){
        if(d0[i] <= d1[i]){
            black++;
        }else{
            white++;
        }
    }

    if(black==white){
        p("Snuke");
    }
    else if(black > white){
        p("Fennec");
    }
    else{
        p("Snuke");
    }

    

    
    return 0;
}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int N = 1e4+5;
const int maxn = 1e9+5;
const dd eps = 1e-6;
const ll mod = 1e9+7;

struct edge{
  int to,id;
  edge(int to,int id): to(to),id(id){}  
};

vector<edge> p[55];
vector<ll> s;

bool dfs(int u,int v,int fa){
  if(u == v) return true;
  for(auto e:p[u]){
    if(e.to == fa) continue;
    if(dfs(e.to,v,u)){
      s.push_back(e.id);
      return true;
    }
  }
  return false;
}

int n,m,u,v;
ll check[55];

int main(){
  // freopen("input.txt","r",stdin);
  ios::sync_with_stdio(false);
  cin>>n;
  for(int i = 1;i < n;i++){
    cin>>u>>v;
    p[u].emplace_back(v,i);
    p[v].emplace_back(u,i);
  }
  cin>>m;
  for(int i = 1;i <= m;i++){
    cin>>u>>v;
    ll mask = 0;
    s.clear();
    dfs(u,v,-1);
    for(auto now:s){
      check[i] |= 1ll<<(now-1);
    }
  }
  // ll ans = (1<<(n-1));
  ll ans = 0;
  for(int i = 0;i < (1<<m);i++){
    ll mask = 0,cnt = 0;
    for(int j = 1;j <= m;j++){
      if(i&(1<<(j-1))) mask |= check[j],cnt++;
    }
    ll white = __builtin_popcountll(mask);
    ll now = 1ll<<(n-1-white);
    if(cnt&1) ans -= now;
    else ans += now;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> a[100000];
int main()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> p(m), y(m);

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

    for(int i = 1; i <= n; ++i)
    {
        sort(a[i].begin(), a[i].end());
    }
 

    for(int i = 0; i < m; ++i)
    {
        printf("%012ld\n",  (ll)1000000*p[i] + (lower_bound(a[p[i]].begin(), a[p[i]].end() , y[i]) - a[p[i]].begin() + 1));
    }
}

Measured memory_bytes: 8576
#include<iostream>
using namespace std;
int main(){
  long long  a,b,c,A,B;
  while(cin>>a>>b){
    A=a;
    B=b;
    while(b!=0){
      c=a%b;
      a=b;
      b=c;
    }
    cout<<a<<' '<<A/a*B<<endl;
  }
  
}


Measured memory_bytes: 3100
#include <iostream>
using namespace std;
int fa[100005];
int find(int a){
	if(fa[a]==a) return a;
	return fa[a]=find(fa[a]);
} 
void merge(int a,int b){
	a=find(a);
	b=find(b);
	if(a!=b) fa[b]=a;
}

int main(){
	int n,m,p[100005];
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>p[i];
		fa[i]=i;
	}
	int a,b;
	for(int i=0;i<m;i++){
		cin>>a>>b;
		merge(a,b);
	} 
	int cnt=0;
	for(int i=1;i<=n;i++){
		if(find(p[i])==find(i)) cnt++;
	}
	cout<<cnt;
	return 0;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  LL n;
  vector<LL> v(5);

  cin >> n;
  LL min_value = pow(10, 16);
  for (int i = 0; i < 5; i++) {
    cin >> v[i];
    min_value = min(v[i], min_value);
  }

  LL res = (n / min_value) + (n % min_value > 0);

  cout << res + 4 << endl;
}


Measured memory_bytes: 256