akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>

#pragma warning( disable: 4996 )

using namespace std;

typedef long long ll;

#define INF 100000000
#define EPS 1e-9

#define MAX_N 1000000

vector<int> ans_list;

int main(){

	while (true){
		
		int e;
		cin >> e;
		if (e == 0)
			break;

		int min_ans = MAX_N;

		for (int i = 0; i <= 100; i++){
			if (i*i*i > e)
				break;
			for (int j = 0; j <= 1000; j++){
				if (i*i*i + j*j > e)
					break;

				if (i*i*i + j*j <= e)
					min_ans = min(min_ans, i + j + e - i*i*i - j*j);
			}
		}

		ans_list.push_back(min_ans);

	}

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

	return 0;

}

Measured memory_bytes: 1248
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
string f(int a){
	string s="";
	while(a){
		s=(char)('0'+a%2)+s;
		a/=2;
	}
	if(s=="")s="0";
	return s;
}
int F(string s){
	int a=0;
	rep(i,s.size()){
		a*=2;
		a+=s[i]-'0';
	}
	return a;
}
signed main(){
	int a,b;
	cin>>a>>b;
	if(a==b){
		cout<<1<<endl;
		return 0;
	}
	string s=f(a),t=f(b);
	while(s.size()!=t.size())s="0"+s;
	int w=0;
	rep(i,s.size())if(s[i]!=t[i]){
		w=i;
		break;
	}
	s=s.substr(w);
	t=t.substr(w);
	bool h=false;
	loop(i,1,t.size()){
		if(t[i]=='1'){
			h=true;
		}
		if(h)t[i]='1';
	}
	
	int out=F(t)-F(s)+1;
	string q=string(s.size(),'1');
	s[0]='1';
	out+=F(q)-max(F(s),F(t)+1)+1;
	cout<<out<<endl;
}

















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

typedef long long ll;
typedef long double ld;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN

#define fi first
#define se second
#define pb push_back



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


////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m;
	cin>>n>>m;
	vector<int> a(m);
	ll sum=0;
	for(int i = 0; i < m; i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	if(n>=sum)
	cout<<n-sum<<endl;
	else cout<<-1<<endl;

}

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

int p[100000], par[100000], t[100000];
int find(int x) {
	if (x == par[x])return x;
	return par[x] = find(par[x]);
}
void unite(int x, int y) {
	par[find(x)] = find(y);
}
char s[100000][2];
int m[100000];
int main() {
	int n, q;
	while (scanf("%d%d", &n, &q), n) {
		rep(i, n)par[i] = i;
		rep(i, n - 1)scanf("%d", &p[i + 1]), p[i + 1]--;
		memset(m, -1, sizeof(m)); m[0] = 0;
		rep(i, q) {
			scanf("%s%d", s[i], &t[i]); t[i]--;
			if (s[i][0] == 'M') {
				if (m[t[i]] == -1)m[t[i]] = i;
			}
		}
		rep(i, n) {
			if (m[i] == -1)unite(i, p[i]);
		}
		ll ans = 0;
		for (int i = q - 1; i >= 0; i--) {
			if (m[t[i]] == i)unite(t[i], p[t[i]]);
			if (s[i][0] == 'Q')ans += find(t[i]) + 1;
		}
		printf("%lld\n", ans);
	}
}

Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N; cin >> N;
  vector<ll> h(N), DP(N, 0);
  for(int i = 0; i < N; i++) cin >> h.at(i);
  DP.at(0) = 0; DP.at(1) = DP.at(0) + abs(h.at(1) - h.at(0));
  for(int i = 2; i < N; i++) {
    DP.at(i) = min(DP.at(i - 1) + abs(h.at(i) - h.at(i - 1)), DP.at(i - 2) + abs(h.at(i) - h.at(i - 2)));
  }
  cout << DP.at(N - 1) << endl;
}

Measured memory_bytes: 1792
//
// Created by yamunaku on 2020/03/08.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    int a, b, m;
    cin >> a >> b >> m;
    vi x(a), y(b);
    int mix = IINF, miy = IINF;
    rep(i, a){
        cin >> x[i];
        mix = min(mix, x[i]);
    }
    rep(j, b){
        cin >> y[j];
        miy = min(miy, y[j]);
    }
    int ans = mix + miy;
    int u, v, c;
    rep(i, m){
        cin >> u >> v >> c;
        ans = min(ans, x[u - 1] + y[v - 1] - c);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    int n;
    cin >> n;

    vector<int> a;
    for (int i=0; i < n; i++)
    {
        int val;
        cin >> val;
        a.push_back(val);
    }
    
    auto a_ = a;
    sort(a_.begin(), a_.end(), greater<int>());
    int max1 = a_[0], max2 = a_[1];

    for (auto e: a)
    {
        if (e == max1)
        {
            cout << max2 << endl;
        }
        else
        {
            cout << max1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod  = 1e9 + 7;
const ll N = 1e6 + 5;

ll qpow(ll a,ll b){
    ll res=1;
    a=a%mod;
    while(b>0){
        if(b&1) res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;cin>>n;
    ll sum=qpow(10,n);
    ll x=qpow(9,n);
    ll y=qpow(8,n);
    x=(x+x)%mod;
    cout<<(sum+y-x+mod)%mod<<'\n';
    return 0;
}

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

int main()
{
	string str;
	long long n;
	long long res;
	cin >> str >> n;
	if(str.size() == 1){
		cout << n / 2 << endl;
		return 0;
	}else {
		int r = 0;
		int xx = str.size();
		for(int i = xx - 1; i > 0; i--){
			if(str[i] != str[i - 1]) {
				r = i;
				break;
			}
		}
		if(r == 0) cout << n * str.size() / 2 << endl;
		else{
			str = str + str;
			int lll = 1;
			int cnt = 0;
			for(int i = r; i < r + str.size() / 2 ; i++){
				if(str[i] == str[i + 1]) lll++;
				else{
					cnt = cnt + lll / 2;
					lll = 1;
				}
			}
			res = cnt * (n - 1);	
			lll = 1;
			cnt = 0;
			for(int i = 0; i < r ; i++){
				if(str[i] == str[i + 1]) lll++;
				else{
					cnt = cnt + lll / 2;
					lll = 1;
				}
			}
			res += cnt;
			res = res + (str.size() / 2 - r) / 2;
			cout << res << endl;
		}	
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,d,x,s=0;cin>>n>>d>>x;
  for(int i=1;i<=n;i++){
    int a;cin>>a;
    s+=(d-1)/a+1;
  }
  cout<<s+x<<endl;
}

Measured memory_bytes: 256
s = int(input())
x0 = 0 
y0 = 0
x1 = 10 ** 9
y1 = 1
y2 = ( s - 1 ) // x1 + 1
x2 = x1 * y2 - s
print(x0, y0, x1, y1, x2, y2)

Measured memory_bytes: 3060
n, m = list(map(int, input().split()))
lisA = [int(i) for i in input().split()]
#print(n, m)
#print(lisA)

lisA.sort(reverse=True)
half0 = lisA[0] // 2
count = 0
for i in range(m):
	if (count > n - 1):
		count = 0
	if (lisA[count] < half0):
		lisA.sort(reverse=True)
		half0 = lisA[0] // 2
		count = 0
	lisA[count] //= 2
	count += 1
print(sum(lisA))

Measured memory_bytes: 14224
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<queue>

using namespace std;

#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef string S;
typedef queue<int> qi;
typedef pair<int,int> P;

const int x[4] = {1,0,-1,0};
const int y[4] = {0,1,0,-1};

int main(){
    int h,w;
    cin >> h >> w;
    char a[1002][1002];
    int dist[1002][1002];
    queue<P> que;
    for(int i = 0;i<h;i++){
        for(int j = 0;j<w;j++){
            dist[i][j] = -1;
            cin >> a[i][j];
            if(a[i][j]=='#'){
                dist[i][j] = 0;
                que.push(P(i, j));
            }
        }
    }
    int ans = 0;
    while(que.size()> 0){
        P now = que.front();
        que.pop();
        for(int i = 0;i < 4;i++){
            P next = P(now.first+x[i], now.second+y[i]);
            if (0<=next.first<h && 0<=next.second<w && dist[next.first][next.second] == -1){
                que.push(next);
                dist[next.first][next.second] = dist[now.first][now.second] + 1;
                ans = dist[next.first][next.second];

            }
        }
    }
    cout << ans << endl;
}

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

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

    int ans = 1, ss = s.size();
    string a, b;
    a = s[0];
    for (int i = 1; i < ss; i++) {
        b = s[i];
        if (a == b && i == ss-1)
            break;
        else if (a == b) {
            i++;
            b += s[i];
        }
        ans++;
        a = b;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define rep(i,a,b) for(i=a;i<=b;i++)
#define rev(i,a,b) for(i=b;i>=a;i--)
#define gcd(a,b) __gcd(a,b)
#define MOD 1000000007
#define scll(t) scanf("%lld",&t)
#define sclf(t) scanf("%lf", &t)
#define scst(t) scanf("%s", &t)
#define max(a,b) (a>=b?a:b)
#define min(a,b) (a<b?a:b)
#define MEM(a,b) memset(a, (b), sizeof(a))
#define all(v) v.begin(), v.end()
const double pi=acos(-1.0);
typedef pair<ll, ll> PII;
typedef vector<ll> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<ll,ll> MPII;
typedef set<ll> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

template <typename T> inline void write(T x)
{
	ll i = 20;
	char buf[21];
	// buf[10] = 0;
	buf[20] = '\n';

	do
	{
		buf[--i] = x % 10 + '0';
		x/= 10;
	}while(x);
	do
	{
		putchar(buf[i]);
	} while (buf[i++] != '\n');
}

void read(ll &x)
{
    bool neg=false;
    register ll c;
    x =0;
    c=getchar();
    if(c=='-')
    {
        neg = true;
        c=getchar();
    }
    for(;(c>47 && c<58);c=getchar())
        x = (x<<1) + (x<<3) +c -48;
    if(neg)
        x *=-1;
}



int main()
{
	ll a,b;
	cin>>a>>b;
	if(a+b==15 and a*b!=15)cout<<"+\n";
	else if(a+b!=15 and a*b==15)cout<<"*\n";
	else cout<<"x\n";
	
	
	return 0;
}


















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

const int N = 2e6+1;
int n,k;

bool cmp(pair<int,int> a, pair<int,int> b) {
    return a.second < b.second;
}

void solve() {
    cin>>n>>k;
    unordered_map<int,int> mp;
    for(int i=0;i<n;i++) {
        int x;cin>>x;
        mp[x]++;
    }
    vector<pair<int,int>> ar(mp.begin(), mp.end());
    sort(ar.begin(), ar.end(), cmp);
    int res=0;
    for(int i=0;ar.size()>=k && i<ar.size()-k;i++) {
        res += ar[i].second;
    }
    cout<<res<<endl;
}
 
int main() {
    solve();
    return 0;
}


Measured memory_bytes: 10056
//AtCoder Beginner Contest 177
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 2e5 + 5;
const ll INF = 1e9 + 5;
const ll mxN = 1000000007;
const double E = 1e-9;

//------------------------------------------------------------------------------
double d, t, s;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	/*ifstream cin("input.txt");
	ofstream cout("output.txt");*/
	cin >> d >> t >> s;
	double time = d / s;
	cout << (time <= t ? "Yes" : "No") << "\n";
	return 0;
}
//29-08-2020 17:32:12
//------------------------------------------------------------------------------

Measured memory_bytes: 3732
// https://beta.atcoder.jp/contests/abc115

#define SUBMIT

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; ++i) cin >> p[i];

    int ans = 0;
    int max_value = 0;
    for (int i = 0; i < n; ++i) {
        ans += p[i];
        max_value = max(max_value, p[i]);
    }
    ans -= max_value / 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# Binary indexed tree
class BIT():
    def __init__(self,n):
        self.array = [0] * n
        self.N = n

    # 1番目からi番目までの累積和を求める
    def sum(self,i):
        s = 0
        while i > 0:
            s += self.array[i-1]
            i -= i&(-i)
        return s

    # sum(i,j)
    def sum2(self,i,j):
        return self.sum(j) - self.sum(i-1)

    # i番目にxを追加
    def add(self,i,x):
        while i <= self.N:
            self.array[i-1] += x
            i += i&(-i)

N, Q = map(int, input().split())
bit = BIT(N)

for i in range(Q):
    com, x, y = map(int, input().split())
    if com:
        res = bit.sum2(x,y)
        print(res)
    else:
        bit.add(x,y)


Measured memory_bytes: 7928
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
#P = tuple(P)
#Q = tuple(Q)
#P = _P.replace(' ', '')
#Q = _Q.replace(' ', '')

p_index = 0
q_index = 0

#print(P)
#print(Q)
for i, s in enumerate(itertools.permutations(range(1,N+1))):
    #print(s)
    if P == s:
        p_index = i
    if Q == s:
        q_index = i

print(abs(p_index-q_index))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define X first
#define Y second
#define sz(v) (int)v.size()

void solve();

main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
#ifdef ONPC
	freopen("in.txt", "r", stdin);
#endif
	int t = 1;
	//cin >> t;
	while (t--) solve();
	return 0;
}



void solve() {
	ll n;
	cin >> n;
	cout << n / 2 - (1 - n % 2);	
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
const int N = 1e5;  // limit for array size
ll n;  // array size

int main(){
   int n,m;cin>>n>>m;
   ll h[n+1]={};
   
   for(int i=1;i<=n;i++){
   	cin>>h[i];
   }
   
   vector<int>g[n+10];
   int a,b;
   for(int i=0;i<m;i++){
   	   cin>>a>>b;
   	   g[a].pb(b);
   	   g[b].pb(a);
   }
   
   int ans=0,temp=0;
   
   for(int i=1;i<=n;i++){
   	   temp=1;
   	   for(int j=0;j<g[i].size();j++){
   	   	   if(h[g[i][j]]>=h[i]){
   	   	   	temp=0;break;
			}  
		}
		if(temp){
			ans++;
		}
   }
   
   cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 9532
#141_D
import heapq
n,m=map(int,input().split())
a=list(map(lambda x:-1*int(x),input().split()))
heapq.heapify(a)
for _ in range(m):
    x=heapq.heappop(a)
    heapq.heappush(a,-(-x//2))
print(-sum(a))

Measured memory_bytes: 14180
#include <stdio.h>
#include <stdlib.h>

int sum_digit(int x) {
  int s = 0;

  do {
    s += x % 10;
    x /= 10;
  } while (x > 0);
  return s;
}

int main( int argc, char *argv[] ) {
  int i, n;
  scanf("%d", &n);
  int min = n;
  //printf("%d %d\n", n, sum_digit(n));

  for (i=1; i<=n/2; i++) {
    int ss = sum_digit(i) + sum_digit(n-i);
    if (min > ss) min = ss;
  }
  printf("%d\n", min);
  return 0;
}


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

using namespace std;

#define INF 1000000007
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
signed main()
{
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i < (N / 2) + N % 2; i++)
    {
        int a = N - i;
        if (a != i)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
while 1:
    n,a,b=map(int,input().split())
    if n==0:
        break
    h_pos=[a]
    all=2**n
    for i in range(n):
        if 1<=h_pos[-1]<=all//4:
            h_pos.append(all//4+all//4-h_pos[-1]+1)
        elif all//4+1<=h_pos[-1]<=all//2:
            h_pos.append(all//2-h_pos[-1]+1)
        elif all//2+1<=h_pos[-1]<=3*all//4:
            h_pos.append(h_pos[-1]-all//2)
        else:
            h_pos.append(h_pos[-1]-3*all//4+all//4)
        all//=2
    h_pos=h_pos[::-1]
    all=2**n
    s=''
    for i in range(n):
        if 1<=b<=all//2:
            if h_pos[i+1]<=2**(i+1)//2:
                b=all//2-b+1
                s+='L'
            else:
                s+='R'
        else:
            if h_pos[i+1]<=2**(i+1)//2:
                b=all-b+1
                s+='R'
            else:
                b=b-all//2
                s+='L'
        all//=2
    print(s)


Measured memory_bytes: 5608
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;


int main(int argc, const char * argv[]) {
    int a;
    cin >> a;
    if(a < 1200){
        cout << "ABC" << endl;
    }else{
        cout << "ARC" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>

using namespace std;

/* constant */

const int INF = 1 << 30;
const int mod = 1000000007;
const double pi = 3.141592653589;

/* typedef */

typedef long long ll;

/* global variables */

/* function */

/* main */
int main() {

    ll r, c, l;
    cin >> r >> c >> l;

    vector< vector<ll> > mat1(r, vector<ll>(c));
    for (ll i = 0 ; i < r; i++)
        for (ll j = 0; j < c; j++)
            cin >> mat1[i][j];

    vector< vector<ll> > mat2(c, vector<ll>(l));
    for (ll i = 0 ; i < c; i++)
        for (ll j = 0; j < l; j++)
            cin >> mat2[i][j];

    vector< vector<ll> > mat3(r, vector<ll>(l, 0));
    for (ll i = 0; i < r; i++) {
        for (ll j = 0; j < l; j++) {
            for (ll k = 0; k < c; k++) {
                mat3[i][j] += mat1[i][k] * mat2[k][j];
            }
        }
    }

    for (ll i = 0; i < r; i++) {
        for (ll j = 0; j < l; j++) {
            cout << mat3[i][j];

            if (j != l-1) cout << ' ';
            else cout << '\n';

        }
    }

}



Measured memory_bytes: 3268
#include <stdio.h>
int binarysearch(int ,int ,int *);
int main(){
  int i,ans=0,j,k,stuff1[100000],kazu1,kazu2,stuff2;
  scanf("%d",&kazu1);
  for(i=0;i<kazu1;i++){
    scanf("%d",&stuff1[i]);
  }
  scanf("%d",&kazu2);
  for(j=0;j<kazu2;j++){
    scanf("%d",&stuff2);
    ans+=binarysearch(stuff2,kazu1,stuff1);
  }
  printf("%d\n",ans);
  return 0;
}


int binarysearch(int key,int kazu1,int *stuff1){
  int left=0,right=kazu1,mid;
  while(left<right){
    mid=(left+right)/2;
    if(stuff1[mid]==key){
      return 1;
    }
    else if(key<stuff1[mid]){
      right=mid;
    }
    else {
      left=mid+1;
    }
  }
  return 0;
}

  



Measured memory_bytes: 2100
#include<iostream>
int main()
{
    char input;
    int n,cur=0,max=0;
    std::cin>>n;
    getchar();
    for(int i=0;i<n;i++){
        input=getchar();
        if(input=='D')cur--;
        else cur++;
        if(cur>max) max=cur;
    }
    std::cout<<max;
    return 0;
}

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

int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  int fare;
  if (n <= k) {
    fare = n * x;
  } else {
    fare = k * x + (n - k) * y;
  }

  cout << fare << endl;

  return 0;
}


Measured memory_bytes: 256
//第 4 問: ABC 087 B - Coinsi (200 点)
/*
 * dreamererasereraserdream
erasereraserdream
reraserdream
NO
 */

import java.util.Scanner;


public class Main{

	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int K = scan.nextInt();
		scan.nextLine();

		int count =0;

		//List<Integer> list = new ArrayList<Integer>();

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

		   int hi =	scan.nextInt();

		   if (hi >= K) {
			   ++count;
		   }
		}

		System.out.println(count);

	}
}



Measured memory_bytes: 47884
use std::io::*;
use std::str::FromStr;

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

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let n = read::<String>();
  let mut n_char: Vec<char> = n.chars().collect();
  n_char.reverse();
  let mut rev = String::from("");
  for c in n_char {
    rev.push_str(&c.to_string());
  }
  // let s: String = n_char.iter().collect();

  if rev == n {
    println!("Yes");
  } else {
    println!("No");
  }

}



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

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

using namespace std;

int main() {
  int n,m;
  int x[100], y[100];
  int X,Y;
  cin >> n >> m >> X >> Y;
  REP(i,n) {
    cin >> x[i];
  }
  REP(i,m) {
    cin >> y[i];
  }

  int z = -101;
  FOR(i,-100, 101) {
    if(i <= X || Y < i) {
      continue;
    }
    bool ng = false;
    REP(j,n) {
      if(x[j] >= i) {
        ng = true;
        break;
      }
    }
    REP(j,m) {
      if(y[j] < i) {
        ng = true;
        break;
      }
    }
    if(ng) {
      continue;
    }

    z = i;
  }

  if(z == -101) {
    cout << "War" << endl;
  } else {
    cout << "No War" << endl;
  }
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int p, q, a, n;
int dfs(int lp, int lq, int idx, int pr, int prev){
  if(idx > n || pr > a) return 0;
  if(lp == 0 && pr <= a) return 1;
  int cnt = 0;
  for(int i=prev;i*pr<=a;++i){
	if(i*lp - lq >= 0)
	  cnt += dfs(i*lp-lq, i*lq, idx+1, pr*i, i);
  }
  return cnt;
}

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

  while(true){
	cin >> p >> q >> a >> n;
	if(p==0&&q==0&&a==0&&n==0) break;
	cout << dfs(p, q, 0, 1, 1) << endl;
  }
  
  return 0;
}

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

const int N=1e7;

int d()
{
    int ret;
    scanf("%d", &ret);
    return ret;
}
long long lld()
{
    long long ret;
    scanf("%lld", &ret);
    return ret;
}
ll mod(ll a,ll b)
{
    return ((a%b +b)%b);
}

ll floor(ll a, ll b)
{
    return (a-mod(a, b))/b;
}

vector<ll> getDivisorsN(ll n)        //O(n)
{
    vector<ll> ret;
    for(ll i = 1 ; i <= n ; ++i)
        if(n%i == 0)    ret.push_back(i);
    return ret;
}
ll f[N];
vector<long long>vp;
void getDivisors(ll n)        //O(sqrt(n))
{

    ll i;
    for(i = 1 ; i < n/i ; ++i)
    {
        if(n%i == 0)
        {
            f[i]++;
            f[n/i]++;
            if(f[i]>=2) vp.push_back(i);
            if(f[n/i]>=2) vp.push_back(n/i);

        }
    }
    if(i == n/i && n%i==0)
    {   f[n/i]++;
        if(f[n/i]>=2)
        vp.push_back(n/i);

    }


}
//////////////////////////////////////////////////
vector<ll> getMultiples(ll x, ll n)
{
    vector<ll> ret;
    for(ll m = x ; m <= n ; m += x)
        ret.push_back(m);
    return ret;
}

// bool is_prime[N];
/*
vector<ll>v;

bitset<N> is_prime;
void sieve()        //O(N*log(log(n))) ~= O(N)
{
    v.push_back(1);
    // fill(is_prime, is_prime+N, 1);       //with arrays
    is_prime.set();     //fills with 1
    is_prime[0] = is_prime[1] = 0;
    for(ll p = 2 ; p <= N ; ++p)
        if(is_prime[p])
        {
            v.push_back(p);
            for(ll m = p*p ; m < N ; m += p)
                is_prime[m] = 0;

        }
}
vector<pair<ll, ll>> factorize(ll n)
{
    vector<pair<ll, ll> > ret;
    for(ll p = 2 ; p <= n/p ; ++p)
    {
        int e = 0;
        while(n%p == 0)
        {
            n /= p;
            ++e;
        }
        if(e)   ret.push_back({p, e});
    }
    if(n > 1)   ret.push_back({n, 1});
    return ret;
}
*/
int main()
{
    int w=d();
    int a=d(),b=d();
    int e_a=a+w;
    int e_b=b+w;
    if(abs(a-b)<=w)
    printf("0\n");
    else{
        printf("%d\n",abs(min(e_a,e_b)-max(a,b)));
    }
}


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

int n, w, cnt[15];

int main() {
	while (cin >> n >> w, n>0) {
		memset(cnt, 0, sizeof(cnt));
		
		for (int i=0; i<n; ++i) {
			int v;
			cin >> v;
			++cnt[v/w];
		}
		
		int t = 14;
		while (cnt[t] == 0) --t;
		
		int max_v = 0;
		for (int i=0; i<=t; ++i) max_v = max(max_v, cnt[i]);
				
		double ans = 0;
		for (int i=0; i<=t; ++i) {
			double a = (double)(t - i) / t;
			double b = (double)cnt[i] / max_v;
			ans += a * b;
		}
		printf("%.9lf\n", ans + 0.01);
	}
}


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

int main(){
  ll n,k,x;
  cin >> n >> k;

  n = n%k;

  bool flag = true;
  while(flag){
    x = max(n,k) - min(n,k);
    x < n ? n = x : flag = false;    
  }
  
  cout << n;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES // M_PIなどの定義を使用するのに必要
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>
#include <limits>

using namespace std;

int main()
{
  int64_t N;
  int64_t M;
  vector<int64_t> A;

  cin >> N >> M;

  A.resize(M);
  for (int i = 0; i < M; i++) {
    cin >> A[i];
  }

  int64_t days_of_homework = accumulate(A.begin(), A.end(), 0LL);

  int64_t days_of_playing = N - days_of_homework;

  if (days_of_playing < 0) {
    days_of_playing = -1;
  }

  cout << days_of_playing;

  return 0;
}


Measured memory_bytes: 3712
N = int(input())
XL = [tuple(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0]+x[1])
right = -float('inf')
ans = 0
for x,l in XL:
    s,t = x-l, x+l
    if s >= right:
        right = t
        ans += 1
print(ans)


Measured memory_bytes: 21392
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define ppp pair<ll,pp >
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t=1, tt;
void solve(){
	ll a, b;
	cin>>a>>b;
	cout<<a*b;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   	//cin>>t;
   	tt=t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


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

int64_t eight(int64_t n){
 int64_t mod8=1;
 for(int i=0;i<n;i++){
   mod8=(mod8*8)%1000000007;
 }
  return mod8%1000000007;
}

int64_t nine(int64_t n){
 int64_t mod9=1;
 for(int i=0;i<n;i++){
   mod9=(mod9*9)%1000000007;
 }
  return mod9%1000000007;
}

int64_t ten(int64_t n){
 int64_t mod10=1;
 for(int i=0;i<n;i++){
   mod10=(mod10*10)%1000000007;
 }
  return mod10%1000000007;
}

int main(){
  int N;
  cin>>N;
  int64_t ans;
  ans=1000000007*2+ten(N)%1000000007-2*nine(N)%1000000007+eight(N)%1000000007;
  cout<<ans%1000000007<<endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin>> n;
    int x, val = 1;
    int ans = 0;
    for(int i = 0; i < n; ++i){
        cin>> x;
        if(x == val){
            val++;
        }else{
            ans++;
        }
    }
    if( ans == n){
        ans = -1;
    }
    cout << ans << "\n";

}

Measured memory_bytes: 384
edges = []
n, m = map(int, input().split())
d = [[1000] * n for _ in range(n)]
for i in range(n):
    d[i][i] = 0

for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c
    edges.append((a, b, c))

for k in range(n):
    for i in range(n):
        for j in range(i + 1, n):
            d[j][i] = d[i][j] = min(d[i][j], d[i][k] + d[j][k])

count = 0
for i, j, val in edges:
    isIncluded = False
    for s in range(n):
        if d[s][i] + val == d[s][j] or d[s][j] + val == d[s][i]:
            isIncluded = True
            break

    if not isIncluded:
        count += 1

print(count)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 1 << 30
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll fact(ll a){ll b=1;FOR(i,1,a)b*=i;return b;}
ll power(ll x,ll n){ll a=1;REP(i,n)a*=x;return a;}

int main()
{
  ll a[3];
  REP(i,3)cin>>a[i];
  sort(a,a+3);
  cout<<((a[2]%2)*(a[0]*a[1]))<<endl;
  return 0;
}


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

int main(){
	int n;
	cin >> n;
	int odd = 0;
	if(n <= 9){
		odd = n;
	}else if(n < 99){
		odd = 9;
	}else if(n < 999){
		odd = 9 + (n-99);
	}else if(n < 9999){
		odd = 909;
	}else if(n < 99999){
		odd = 909 + (n - 9999);
	}
	else if(n >= 99999){
		odd = 90909;
	}
	cout << odd << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
    cin>>a>>b;
    if(a>0) cout<<"Positive"<<endl;
    else if(b>=0) cout<<"Zero"<<endl;
    else if((a&1)^(b&1)) cout<<"Positive"<<endl;
    else cout<<"Negative"<<endl;
    return 0;
}

Measured memory_bytes: 256
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
    ]

count = int(input())
for c in range(count):
    card = input()
    data.remove(card)

for c in data:
    print(c)

Measured memory_bytes: 7716
// https://qiita.com/e869120/items/eb50fdaece12be418faa

#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

static const int MAX = 200;
static const int n = 10;
ll d[MAX][MAX];

void floyd() {
    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < n; ++i) {
            if (d[i][k] == LINF) continue;
            for (int j = 0; j < n; ++j) {
                if (d[k][j] == LINF) continue;
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main()
{
    int h, w;
    cin >> h >> w;

    rep(i, n) {
        rep(j, n) {
            int c;
            cin >> c;
            d[i][j] = c;
        }
    }

    floyd();

    ll res = 0;
    rep(i, h) {
        rep(i, w) {
            int a;
            cin >> a;
            if (a == -1) continue;
            res += d[a][1];
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;
 
int main(){
  using namespace std;
  int n, m;
  cin>>n>>m;
  vector<int> a(n);
  int s = 0;
  REP(i, n){
    cin>>a[i];
    s += a[i];
  }
  sort(ALL(a), greater<int>());
  int l;
  if(s % (4 * m) == 0){
    l = s / (4 * m);
  }else{
    l = s / (4 * m) + 1;
  }
  int cnt = 0;
  REP(i, n){
    if(a[i] < l) break;
    cnt++;
  }
  if(cnt >= m){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}



Measured memory_bytes: 256
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := make(map[int]bool)

	for i := 0; i < n; i++ {
		a := nextInt()
		_, exist := m[a]
		if exist {
			fmt.Println("NO")
			return
		}
		m[a] = true
	}
	fmt.Println("YES")
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N;
	string s;
	cin >> N >> s;
	vector<set<int64>> vset(26);
	REP(i, s.size()) {
	  vset[s[i]-'a'].insert(i);
	}
	int64 Q;
	cin >> Q;
	REP(i, Q) {
	  int64 t, a;
	  cin >> t >> a;
	  if (t == 1) {
	    char b;
	    cin >> b;
	    a--;
	    if (s[a] != b) {
	      vset[s[a]-'a'].erase(a);
	      vset[b-'a'].insert(a);
	      s[a] = b;
	    }
	  } else {
	    int64 b;
	    cin >> b;
	    a--;
	    int64 cnt = 0;
	    REP(j, 26) {
	      if (vset[j].lower_bound(a) == vset[j].end()) continue;
	      if (*(vset[j].lower_bound(a)) < b) {
	        cnt++;
	      }
	    }
	    cout << cnt << endl;
	  }
	}
}


Measured memory_bytes: 26268
# from fractions import gcd
# mod = 10 ** 9 + 7
# N = int(input())
# a = list(map(int,input().split()))
# a,b,c = map(int,input().split())
# ans = [0] * N
# math.ceilで切り上げ
# dp = [[0] * 4 for i in range(3)] #2次元配列初期化
# dp = [[[0] * 2 for i in range(3)] for j in range(5)]
# (ord('A'))でASCII出力 Aは65
import math
import statistics
import string


def intinput():
    return int(input())
def listintinput():
    return list(map(int, input().split()))
def splitintinput():
    return map(int, input().split())
def factorialsurplus(x, y, z):  # xからyまでの階乗をzで割ったあまりを求める
    ret = 1
    for i in range(x, y + 1):
        ret = (ret * i) % z
    return (ret)
def isprime(x):
    if x == 1:
        return False
    if x == 2:
        return True
    sq = int(math.sqrt(x))
    for i in range(2,sq+1):
        if x % i == 0:
            return False
    return True
def hcfnaive(a,b):#最大公約数 math.gcdが使えない時の手段として入れとく。pythonが更新されたらいらなくなるはず
    if(b==0):
        return a
    else:
        return hcfnaive(b,a%b)

N, M = splitintinput()
restriction = {}
flag = 1
ans = ''
for i in range(M):
    s,c = splitintinput()
    if s in restriction:
        if restriction[s] != str(c):
            flag = 0
            break
    else:
        restriction[s] = str(c)


if flag == 0:
    print(-1)
else:
    for i in range(N):
        if i+1 in restriction:
            ans += restriction[i+1]
        else:
            if i == 0 and N != 1:
                ans += "1"
            else:
                ans += "0"
    if N != 1 and ans[0] == "0":
        print(-1)
    else:
        print(ans)


Measured memory_bytes: 5532
#include <bits/stdc++.h>
#define nmax 1000000
using namespace std;
bool isok[30];
char str[nmax];

int main()
{
    scanf("%s",str);
    int len = strlen(str);
    for(int i = 0;i<len;++i){
        isok[str[i] - 'a'] = true;
    }
    bool ok = false;
    for(int i = 0;i<26;++i){
        if(isok[i] == false){
            printf("%c\n",i+'a');
            ok = true;
            break;
        }
    }
    if(!ok) printf("None\n");
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll m,n,t = 0,a,b;
    double x;
    cin>>n>>m;
    for(int i = 0;i< n;i++)
    {
        cin>>a>>b;
        x = sqrt(a*a + b*b);
        //cout<<x<<endl;
        if(x <= m)
        {
            t++;
        }
    }
    cout<<t<<endl;
}


Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
int n=10005;
int main()
{
	int p[n],j,a,b,s,e,t=0,sum=0,x=0;
	cin>>e>>a>>b;
	for(int i=1;i<=e;i++)
	{
		j=i;
		t=0;
		
		//while每一个数字i和为t 
		while(j!=0)  
		{
		    s=j%10;    //1234
		    t+=s;      
		    j/=10;     //123	 
	    }
	    
	    //if语句判断数字和是否满足要求？ 
		if(t>=a&&t<=b)  
		{
	    sum+=t;
	    x+=i;
	    }
	}
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 256
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_C&lang=jp
# Combinatorial - Knapsack Problem

n = gets.to_i
a = []
n.times do
  a << gets.to_i
end

def lower_bound(arr, s, t, x)
  m = (s + t) / 2
  return s if s >= t - 1
  return lower_bound(arr, m, t, x) if (x >= arr[m])
  lower_bound(arr, s, m, x)
end

inf = 2 ** 30
dp = Array.new(n, inf)
n.times do |i|
  idx = dp.bsearch_index { |x| x >= a[i] }
  dp[idx] = a[i] if idx
end

res = dp.bsearch_index { |x| x >= inf }
if res
  puts res
else
  puts n
end



Measured memory_bytes: 8564
"""
TODO
"""


def talkable(a, b, c, d):
    if abs(a - c) <= d:
        return True

    if abs(a - b) <= d:
        if abs(b - c) <= d:
            return True

    return False


if __name__ == "__main__":
    a, b, c, d = map(int, input().rstrip().split(' '))
    if talkable(a, b, c, d):
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 3060
#include <iostream>
#include <vector>

using namespace std;

int main(void){
  int n;string sign;
  cin>>n;
  cin>>sign;
  vector<string> oldsign(n);
  for(int i=0;i<n;++i) cin>>oldsign[i];
  int sum=0;
  for(int i=0;i<n;++i){//i<=100
    bool f=false;
    for(int j=0;j<oldsign[i].length();++j){//j<=100
      for(int k=1;k<oldsign[i].length();++k){//k<=100/3
        int cnt=0;
        for(int l=0;l<sign.length();++l){//l<=25
          if(j+k*l>=oldsign[i].length()) break;
          if(oldsign[i][j+k*l]==sign[l]) ++cnt;
        }
        if(cnt==sign.size()){
        	f=true;
        	break;
        }
      }
      if(f) break;
    }
    if(f) ++sum;
  }
  cout<<sum<<endl;
}

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

int main() {
    int N;
    int result = 0;
    string S, test1, test2, test3, check;
    cin >> N >> S;
    for (int i = 0; i < N - 2; i++) {
        test1 = S.at(0 + i);
        test2 = S.at(1 + i);
        test3 = S.at(2 + i);
        check = test1 + test2 + test3;
        if (check == "ABC") {
            result = result + 1;
        }
    }
    cout << result << endl;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define F first
#define S second

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio
    lli num1 , num2 ;
    cin >> num1 >> num2 ;
    cout << (num1 % 3 == 0 || num2 % 3 == 0 || (num1 + num2) % 3 == 0 ? "Possible" : "Impossible" ) ;


    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<cstring>
#include<string>
using namespace std;
const int maxn = 1000007;
int a[maxn];
int n,m,k;
int main()
{
    cin>>n>>m>>k;
    int now = n-m;
    cout<<now%k<<endl;
}


Measured memory_bytes: 764