akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x, y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x, y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=1e9+7;
const ll maxn=1e5+10;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
ll random(ll mn, ll mx){
	return (rand() % (mx - mn + 1)) + mn; 
}


void solve(){
	
	
	ll n,x,y;
	cin>>n>>x>>y;
	ll a[n+1];
	ll ans[n+1];
	for (int i=1;i<n;i++) ans[i]=n-i;
	
	
//	for (int i=x;i>=1;i--){
//		ans[dis]--;
//		ans[ind]++;
//		ind++;
//		dis++;
//	}
	
	
	for (int i=1;i<n;i++){
		for (int j=i+1;j<=n;j++){
			if (j>x){
				ll c1=abs(i-x)+abs(j-y)+1;
				ll c2=j-i;
				if (c1<c2){
					ans[c2]--;
					ans[c1]++;
				}	
			}
		}
	}
	
	
	for (int i=1;i<n;i++) cout<<ans[i]<<endl;
	
	return ;
	
}

int main(){ 
    
    #ifndef ONLINE_JUDGE
  	//	freopen("input.txt", "r", stdin);
    #endif
    srand(time(0)); 
    
    ios::sync_with_stdio(0);
    cin.tie(0);

	//T{ solve(); }
	solve();
	
	
	
	return 0;
}

Measured memory_bytes: 256
#C - Next Prime
X=int(input())

import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

q=X
while is_prime(q)==False:
    q=q+1

print(q)

Measured memory_bytes: 2940
#include <stdio.h>
int main(void){
	int i, j, a[5], tmp, max_i;
	for(i = 0;i < 5;i++)
		scanf("%d",&a[i]);
	for(i = 0;i < 4;i++){
		max_i = i;
		for(j = i + 1;j < 5;j++){
			if(a[max_i] < a[j])
				max_i = j;
		}
		if(i != max_i){
			tmp = a[i];
			a[i] = a[max_i];
			a[max_i] = tmp;
		}
	}
	printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
	return 0;
}	

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

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

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

#define INF INT_MAX/3

ll n,m,k;

int main(){
	cin.sync_with_stdio(false);
  cin>>n>>m>>k;
  rep(i,n+1){
    rep(j,m+1){
      //dbg(i*m+j*n-i*j);
      if(i*m+j*(n-i)-i*j==k){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
a = gets.to_i
b = gets.split('')
c = []
e = b.count('E')
wn = w = 0
a.times do |i|
  if b[i] == 'E'
    e -= 1
  else
    wn = w + 1
  end
  c[i] = e + w
  w = wn
end
puts c.min


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

int main() {
  int N;
  cin >> N;
  
  vector<int>vals = vector<int>(N);
  for (int i = 0; i < N; i++) {
    cin >> vals.at(i);
  }
  
  // 次の高さより１段高い限り常に対応可能である。
  bool flag = true;
  int minRow = 0;
  
  rep(i,N-1){
    if (vals.at(i) > vals.at(i+1)) {
      if (vals.at(i) == vals.at(i+1)+1) {
        // cout << minRow << ":" << vals.at(i+1) << endl;
        if (minRow <= vals.at(i+1))
          minRow = vals.at(i+1);
        else {
          flag = false;
          break;
        }
      } else {
        flag = false;
        break;
      }
    }
  }
  if (flag == false) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  
}


Measured memory_bytes: 768
while True:
    x = int(input())
    if x == 0:
        break
    else:
        x=1000-x
        a=x//500
        b=(x-500*a)//100
        c=(x-(500*a+100*b))//50
        d=(x-(500*a+100*b+50*c))//10
        e=(x-(500*a+100*b+50*c+10*d))//5
        f=(x-(500*a+100*b+50*c+10*d+5*e))//1
        print(a+b+c+d+e+f)


Measured memory_bytes: 5584
// #pragma GCC optimize("no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC diagnostic ignored "-W"

#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<sstream>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<vector>
#include<utility>
#include<functional>
#include<complex>
#include<climits>
#include<random>
#include<thread>

#if __cplusplus >= 201103L
#include<unordered_map>
#include<unordered_set>
#include<tuple>
#endif

// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/rope>

using namespace std;
// using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vint vector<int>
#define vpii vector<pair<int,int>>
#define SS stringstream
#define PQ priority_queue
#define MS(x,v) memset((x),(v),sizeof(x))
#define RZUNI(x) sort(x.begin(),x.end()), x.resize(unique(x.begin(),x.end())-x.begin())
#define FLH fflush(stdout)
#define CPPinput ios_base::sync_with_stdio(0); cin.tie(0)
#define FIN(fname) freopen(fname,"r",stdin)
#define FOUT(fname) freopen(fname,"w",stdout)

#define tm Ovuvuevuevue
#define y1 Enyetuenwuevue
#define left Ugbemugbem
#define ws Osas
#define dec tetteterette
#define expl explexplexpl

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

#ifdef WEAK
#include"/home/edison/Coding/cpp/template/debug.cpp"
#define DEB(...) printf(__VA_ARGS__),fflush(stdout)
#define WHR() printf("%s: Line %d",__PRETTY_FUNCTION__,__LINE__),fflush(stdout)
#define LOG(...) printf("%s: Line %d ",__PRETTY_FUNCTION__,__LINE__),printf(__VA_ARGS__),fflush(stdout)
#define DEBUG 1
#define exit(x) cout<<"exit code "<<x<<endl, exit(0)
#else
#define PDE(...) ;
#define DEB(...) ;
#define WHR() ;
#define LOG(...) ;
#define DEBUG 0
#endif

#define lowbit(x) ((x)&(-(x)))

void JIZZ(string output=""){cout<<output; exit(0);}

const ld PI=3.14159265358979323846264338327950288;
const ld eps=1e-10;
const ll mod=1e9+7;

int a[555][555];

int main(){
    CPPinput;
    int n,m; cin>>n>>m;
    for(int i=1;i<=n;++i)for(int j=1;j<=m;++j)cin>>a[i][j];
    vector<pii> vv;
    vector<pair<pii,pii>> v;
    for(int i=1;i<=n;++i){
        if(i&1){
            for(int j=1;j<=m;++j){
                vv.eb(i,j);
            }
        }
        else{
            for(int j=m;j>=1;--j){
                vv.eb(i,j);
            }
        }
    }
    for(int i=1;i<vv.size();++i){
        if(a[vv[i-1].first][vv[i-1].second]%2){
            v.eb(vv[i-1],vv[i]);
            ++a[vv[i].X][vv[i].Y];
        }
    }
    cout<<v.size()<<endl;
    for(auto p:v){
        cout<<p.first.first<<" "<<p.first.second<<" "<<p.Y.X<<" "<<p.Y.Y<<endl;
    }
}


Measured memory_bytes: 7536
import std.stdio;
import std.conv;
import std.string;

void main()
{
    string s;
    int i = 1;
    while( (s=readln.strip) != "0") {
        int n = s.strip.to!int;
        writefln("Case %d: %d", i,n);
        i++;
    }
}

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

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

    long long M = 1000000007;
    vector<long long> T(13);
    T[0] = 1;
    for (char s: S) {
        vector<long long> P(13);
        P.swap(T);
        for (int i=0; i<10; i++)
        if (s=='?' || s=='0'+i)
            for (int p=0; p<13; p++)
            {
                T[(p*10+i)%13] += P[p];
                T[(p*10+i)%13] %= M;
            }
    }
    cout<<T[5]<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define FORD(i,a,b) for(int i=(a);i>=b;i--)
#define FOR(i,a,b) for(int i=(a);(i)<(b);(i)++)
#define ll long long
using namespace std;
int a[200005];
int main() {
	int n;
	cin>>n;
	FOR(i,0,n) {
		cin>>a[i]; 
	}
	sort(a,a+n);
	FOR(i,0,n-1) {
		if(a[i]==a[i+1]) {
			cout<<"NO";
			return 0;
		}
	}
	cout<<"YES";
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
int main(int argc, char const *argv[])
{
  int n, m;
  cin >> n >> m;
  priority_queue<int> pq;
  rep(i, n)
  {
    int a;
    cin >> a;
    pq.push(a);
  }
  rep(i, m)
  {
    int t = pq.top();
    pq.pop();
    pq.push(t / 2);
  }
  ll ans = 0;
  rep(i, n)
  {
    ans += pq.top();
    pq.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 892
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("");
    let iter = buf.split_whitespace();
    let mut v: Vec<T> = Vec::new();
    for i in iter {
        v.push(i.parse().ok().unwrap());
    }
    v
}

fn main() {
    let v:Vec<u64> = procon_read();
    if v[0]%v[1] != 0 {
        println!("{}", v[2]*((v[0]/v[1])+1));
    }else{
        println!("{}", v[2]*(v[0]/v[1]));
    }
}

Measured memory_bytes: 2100
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;

template<typename T> void Show(vector<vector<T>> v) {
	for (int i = 0; i < v.size(); i++) {
		for (int j = 0; j < v[i].size(); j++) {
			cout << v[i][j];
			if (j != v[i].size() - 1) {
				cout << " ";
			} else {
				cout << endl;
			}
		}
	}
}


template<typename T> void Show(vector<T> v) {
	for (int i = 0; i < v.size(); i++) {
		cout << v[i];
		if (i != v.size() - 1) {
			cout << " ";
		} else {
			cout << endl;
		}
	}
}


int main() {
	int N, K;
	cin >> N >> K;
	vector<int> Xs = vector<int>();
	Xs.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> Xs[i];
	}
	int sum = 0;
	for (int i = 0; i < N; i++) {
		sum += min(Xs[i], K - Xs[i]) * 2;
	}
	cout << sum << endl;
}

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

typedef long long int in;

in tree[800005],dp[200005];

void update(in node,in s,in e,in ind,in val)
{
    if(s==e)
    {
        tree[node]=val;
    }
    else
    {
        in m=(s+e)/2;
        
        if(s<=ind&&ind<=m)
        update(2*node,s,m,ind,val);
        else
        update(2*node+1,m+1,e,ind,val);
        
        tree[node]=max(tree[2*node],tree[2*node+1]);
    }
}

in query(in node,in s,in e,in l,in r)
{
    if(r<s||e<l)
    return 0;
    
    if(l<=s&&e<=r) 
    return tree[node];
    
    in m=(s+e)/2;
    
    in max1=query(2*node,s,m,l,r);
    in max2=query(2*node+1,m+1,e,l,r);
    
    in maxi=max(max1,max2);
    
    return maxi;
}

int main()
{
    in n,i,j;
    cin>>n;
    
    in h[n+2],v[n+2];
    
    for(i=1;i<=n;++i)
    cin>>h[i];
    
    for(i=1;i<=n;++i)
    cin>>v[i];
    
    for(i=1;i<=n;++i)
    {
        dp[i]=query(1,1,n,0,h[i]-1)+v[i];
        
        update(1,1,n,h[i],dp[i]);
        
        dp[i]=max(dp[i],dp[i-1]);
    }
    
    cout<<dp[n]<<"\n";
    
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;
using M = map<int, int>;

int main()
{
  int n, m;
  cin >> n >> m;
  int a[n];
  rep(i, n) a[i] = 0;
  int x, y;
  int mi = 0, ma = 100005;
  rep(i, m){
    cin >> x >> y;
    mi = max(mi, x);
    ma = min(ma, y);
  }
  int ans = ma - mi + 1;
  if(ans < 0) ans = 0;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3928
H, W, K=map(int, input().split())
c=[input() for _ in range(H)]

def num2bi(x, k):
  out=format(x, '0'+str(k)+'b')
  return out

ans=0
for x in range(2**H):
  for y in range(2**W):
    p=num2bi(x, H)
    q=num2bi(y, W)
    cnt=0
    for s in range(H):
      for t in range(W):
        if p[s]=='0' and q[t]=='0' and c[s][t]=='#':
          cnt+=1
          
    if cnt==K:
      ans+=1
      
print(ans)

Measured memory_bytes: 9196
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
using namespace std;
int cnt[5010];
int main(){
  int n;
  while(cin>>n&&n){
    set<int> st;
    vector<int> v;
    for(int i=1;i<n;i++){
      st.insert(i*i%n);
    }
    set<int>::iterator it=st.begin();
    while(it!=st.end()){
      v.push_back(*it);
      ++it;
    }
    for(int i=0;i<=(n-1)/2;i++)cnt[i]=0;
    for(int i=0;i<v.size();i++){
      for(int j=i+1;j<v.size();j++){
	int x=v[j]-v[i];
	x=min(x,n-x);
	cnt[x]+=2;
      }
    }
    for(int i=1;i<=(n-1)/2;i++)cout<<cnt[i]<<endl;
  }
  return 0;
}

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

int main(){
  char s[200005];
  scanf("%s", s);
  int start, end;
  for(int i=0; i<strlen(s); i++)
    if(s[i] == 'A'){
      start = i;
      break;
    }
  for(int i=strlen(s)-1; i>=0; i--)
    if(s[i] == 'Z'){
      end = i;
      break;
    }
  printf("%d\n", end-start+1);
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cmath>

using namespace std;
using ll=long long;

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

    ll dif = b - a;
    ll base = 0;
    for(int i = dif; i > 0; i--)base += i;
    cout << base - b;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <queue>
#include <assert.h>
using namespace std;
#define LL long long
#define pii pair < int , int >
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int n,m;
char s[200005];
char t[200005];
int N[200005][27];
int Last[27];

int main(){

	// ios_base::sync_with_stdio(0);
	// cin.tie(0);
	// cout.tie(0);

	scanf("%s",&s);
	scanf("%s",&t);
	n = strlen(s);
	m = strlen(t);

	set < int > Set;
	for ( int i = 0; i < n; i++ ){
		Set.insert(s[i]);
	}
	for ( int i = 0; i < m; i++ ){
		if ( Set.find(t[i]) == Set.end() ){
			cout << -1 << endl;
			return 0;
		}
	}

	memset(Last,-1,sizeof(Last));
	for ( int i = 2 * n - 1; i >= 0; i-- ){
		for ( int j = 0; j < 26; j++ ) N[i][j] = Last[j];	
		Last[s[i%n]-'a'] = i;
	}

	LL ans = Last[t[0]-'a'];
	int pos = Last[t[0]-'a'];
	for ( int i = 1; i < m; i++ ){
		if ( pos >= n ) pos = pos - n;
		ans += N[pos][t[i]-'a'] - pos;
		pos = N[pos][t[i]-'a'];
		if ( pos >= n )  pos = pos - n;
	}
	cout << ans + 1<< endl;
	return 0;
}

Measured memory_bytes: 21504
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

long long  digsum(long long  n) {
    long long  res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

int main() {
    int n,a,b;
    cin >> n >> a >> b;
    ll res = 0;
    for(int i = 1;i<=n;i++){
        int di = digsum(i);
        if(a <= di && di <= b)res += i;
    }
    cout << res << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
using System;

namespace _0077
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string s = Console.ReadLine();
                if (s == null)
                {
                    break;
                }
                for (int i = 0; i < s.Length; i++)
                {
                    if (s[i] == '@')
                    {
                        for (int j = 0; j < (int.Parse(s[i + 1].ToString())); j++)
                        {
                            Console.Write(s[i + 2]);
                        }
                        i += 2;
                    }
                    else
                    {
                        Console.Write(s[i]);
                    }
                }
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 8876
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m,x,a[1000],count1=0,count2=0;
	cin>>n>>m>>x;
	for(int i=0;i<m;i++){
		cin>>a[i];
	}
	for(int j=x;j<=n+1;j++){
		for(int k=0;k<m;k++){
			if(j==a[k]){
				count1++;
			}
		}
	}
	for(int l=x;l>=0;l--){
		for(int o=0;o<m;o++){
			if(l==a[o]){
				count2++;
			}
		}
	}
	if(count1<=count2){
		cout<<count1<<endl;
	}
	else{
		cout<<count2<<endl;
	}
    return 0;
}


Measured memory_bytes: 256
//Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,k,q,x,i,j;
    cin>>n>>k>>q;
    ll a[n],query[n]={0};
    for(i=0; i<q; i++)
    {
        cin>>x;
        query[x-1]++;
    }
    for(i=0; i<n; i++)
    {
        a[i]=k;
    }

    for(i=0; i<n; i++)
    {
        if(a[i]+query[i]-q>0)
           cout<<"Yes"<<endl;
        else
          cout<<"No"<<endl;
       // cout<<a[i]<<" ";

    }



    return 0;
}





Measured memory_bytes: 5156
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
int N;
int ask[200];
int res[200];
void init(){
  scanf("%d", &N);
}
int query(){
  int i;
  char buf[100];
  printf("?");
  for(i=(0);i<(2*N);i++){
    if(ask[i]){
      printf(" %d", i+1);
    }
  }
  puts("");
  fflush(stdout);
  scanf("%s", buf);
  if(buf[0]=='R'){
    return 0;
  }
  return 1;
}
void answer(){
  int i;
  char buf[300];
  for(i=(0);i<(2*N);i++){
    if(res[i]==0){
      buf[i] ='R';
    }
    else{
      buf[i] ='B';
    }
  }
  buf[2*N] = '\0';
  printf("! %s\n", buf);
}
int main(){
  int i;
  int k;
  int f;
  int x;
  int y;
  init();
  for(i=(0);i<(N);i++){
    ask[i] = 1;
  }
  f = query();
  int FmcKpFmN;
  int xr20shxY;
  int WYIGIcGE;
  FmcKpFmN = 0;
  xr20shxY = N;
  while(FmcKpFmN < xr20shxY){
    if((FmcKpFmN + xr20shxY)%2==0){
      WYIGIcGE = (FmcKpFmN + xr20shxY) / 2;
    }
    else{
      WYIGIcGE = (FmcKpFmN + xr20shxY + 1) / 2;
    }
    for(i=(0);i<(2*N);i++){
      ask[i] = 0;
    }
    for(i=(0);i<(N);i++){
      ask[WYIGIcGE+i] = 1;
    }
    if(query() == f){
      FmcKpFmN = WYIGIcGE;
    }
    else{
      xr20shxY = WYIGIcGE - 1;
    }
  }
  k =xr20shxY;
  for(i=(0);i<(2*N);i++){
    ask[i] = 0;
  }
  for(i=(0);i<(N-1);i++){
    ask[k+1+i] = 1;
  }
  for(i=(0);i<(2*N);i++){
    if(ask[i]){
      res[i] = -1;
    }
  }
  for(i=(0);i<(2*N);i++){
    if(!ask[i]){
      ask[i] = 1;
      res[i] = query();
      ask[i] = 0;
    }
  }
  x = y = 0;
  for(i=(0);i<(2*N);i++){
    ask[i] = 0;
    if(res[i]==0 && x < N/2){
      ask[i] = 1;
      x++;
    }
    if(res[i]==1 && y < N/2){
      ask[i] = 1;
      y++;
    }
  }
  for(i=(0);i<(2*N);i++){
    if(res[i]==-1){
      ask[i] = 1;
      res[i] = query();
      ask[i] = 0;
    }
  }
  answer();
  return 0;
}
// cLay varsion 20191123-1

// --- original code ---
// int N;
// int ask[200];
// int res[200];
// 
// void init(){
//   scanf("%d", &N);
// }
// 
// int query(){
//   char buf[100];
//   printf("?");
//   rep(i,2N) if(ask[i]) printf(" %d", i+1);
//   puts("");
//   fflush(stdout);
//   scanf("%s", buf);
//   if(buf[0]=='R') return 0;
//   return 1;
// }
// 
// void answer(){
//   char buf[300];
//   rep(i,2N) buf[i] = if[res[i]==0, 'R', 'B'];
//   buf[2N] = '\0';
//   printf("! %s\n", buf);
// }
// 
// {
//   int k, f, x, y;
// 
//   init();
// 
//   rep(i,N) ask[i] = 1;
//   f = query();
// 
//   k = bsearch_max[int,x,0,N][
//     rep(i,2N) ask[i] = 0;
//     rep(i,N) ask[x+i] = 1;
//   ](query() == f);
// 
//   rep(i,2N) ask[i] = 0;
//   rep(i,N-1) ask[k+1+i] = 1;
// 
//   rep(i,2N) if(ask[i]) res[i] = -1;
//   rep(i,2N) if(!ask[i]){
//     ask[i] = 1;
//     res[i] = query();
//     ask[i] = 0;
//   }
// 
//   x = y = 0;
//   rep(i,2N){
//     ask[i] = 0;
//     if(res[i]==0 && x < N/2) ask[i] = 1, x++;
//     if(res[i]==1 && y < N/2) ask[i] = 1, y++;
//   }
// 
//   rep(i,2N) if(res[i]==-1){
//     ask[i] = 1;
//     res[i] = query();
//     ask[i] = 0;
//   }
// 
//   answer();
// }


Measured memory_bytes: 724
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			String[] str = scan.nextLine().split(",");
			double[] student = new double[str.length];
			for(int i = 0;i < str.length;i++){
				student[i] = Double.parseDouble(str[i]);
			}
			double bmi = student[1] / (student[2]*student[2]);
			if(bmi >= 25){
				System.out.println((int)student[0]);
			}
		}
	}
}

Measured memory_bytes: 17152
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define sz(a) (ll)(a).size()

typedef tree<pair<ll,ll> ,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest
//cout << k << "kth smallest: " << *A.find_by_order(k-1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

ll n, W, w[100005], v[100005], dp[101][100005], NINF = -1e18;

ll rec(ll ind, ll rem)
{
	if(rem < 0) return NINF;
	if(ind == n || rem == 0) return 0;
	if(dp[ind][rem] != - 1) return dp[ind][rem];
	return dp[ind][rem] = max(v[ind] + rec(ind + 1, rem - w[ind]), rec(ind + 1, rem));
}

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

	cin >> n >> W;
	for(int i=0;i<n;i++) cin >> w[i] >> v[i];
	memset(dp, -1, sizeof(dp));
	cout << rec(0, W) << endl; 	   
    return 0;
}

Measured memory_bytes: 80128
#include <iostream>

using namespace std;

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

  bool isacgt = false;
  int max_length = 0;
  int length = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      isacgt = true;
      length += 1;
    } else {
      if (isacgt) {
        if (max_length < length)
          max_length = length;
        length = 0;
      }
      isacgt = false;
    }
  }
  
  if (isacgt) {
    if (max_length < length)
      max_length = length;
  }

  cout << max_length << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1000000007;
const int N = 20010;
ll fact[N], invf[N];

ll add(ll x, ll y){
    return (x+y)%mod;
}

ll mul(ll x, ll y){
    return (x%mod)*(y%mod)%mod;
}

ll powll(ll x, ll y){
    x %= mod;
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll divll(ll x, ll y){
    return (x * powll(y,mod-2)) % mod;
}

ll nPr(ll n, ll r){
    if (n < r || r < 0) return 0;
    return mul(fact[n], invf[n-r]);
}

ll nCr(ll n, ll r){
    if (n < r || r < 0) return 0;
    return mul(mul(fact[n], invf[r]), invf[n-r]);
}

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

    fact[0] = invf[0] = 1;
    FOR(i,1,N-1){
        fact[i] = (fact[i-1] * i) % mod;
        invf[i] = divll(invf[i-1], i);
    }

    FOR(x,1,k){
        ll p1 = nCr(n - k + 1, x);
        ll p2 = nCr(k - 1, k - x);
        ll ans = (p1 * p2) % mod;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 512
while n= gets.to_i
    break if n == 0
    points = gets.split.map(&:to_f)
    sum = 0
    # puts points.join(" ")
     #???sum????¨????
    points.each{|point| sum += point}
    m = sum/(n)
    #puts sum
    #puts average
    var = 0.0
    points.each{|pt| var  +=  (pt - m)**2}
    #puts array.join(" ")
    puts Math.sqrt(var/n)
end

Measured memory_bytes: 8836
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if(a < b && a < c && b < c){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 580
import java.util.*;
import java.lang.*;
class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        long K = scan.nextLong();
        char tmp = '1';
        int index = S.length();
        for(int i = 0; i < S.length(); i++){
            if(S.charAt(i) != '1'){
                tmp = S.charAt(i);
                index = i+1;
                break;
            }
        }
        if(index > K)
            System.out.println(1);
        else
            System.out.println(tmp);
    }
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  string S, T;
  cin >> S >> T;

  string can_s = S + S + S;
  if (can_s.find(T) != string::npos) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long;
using P = pair<int, int>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;
using PPI = pair<P, int>;
ll const mod = 998244353;
const ll MAX = 300000;
using vi = vector<int>;
using vc = vector<char>;
using vd = vector<double>;
using vs = vector<string>;
using vp = vector<P>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvd = vector<vector<double>>;
using vvc = vector<vector<char>>;
using vvp = vector<vector<P>>;
using vvb = vector<vector<bool>>;
template <typename T>
bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; }
template <typename T>
bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; }


//////////////////////////////////////


int main() {
    int n;
    cin >> n;
    vector<PPI> co(2 * n);
    vi alt;
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        co[i].fs.fs = a;
        co[i].fs.sc = b;
        co[i].sc = 1;
        alt.push_back(a);
        alt.push_back(b);
    }
    rep(i, n) {
        int c, d;
        cin >> c >> d;
        co[i + n].fs.fs = c;
        co[i + n].fs.sc = d;
        co[i + n].sc = 0;
        alt.push_back(c);
        alt.push_back(d);
    }
    sort(all(alt));
    alt.erase(unique(all(alt)), alt.end());
    rep(i, n) {
        co[i].fs.fs = lower_bound(all(alt), co[i].fs.fs) - alt.begin();
        co[i].fs.sc = lower_bound(all(alt), co[i].fs.sc) - alt.begin();
        co[i + n].fs.fs = lower_bound(all(alt), co[i+n].fs.fs) - alt.begin();
        co[i + n].fs.sc = lower_bound(all(alt), co[i+n].fs.sc) - alt.begin();

    }
    sort(all(co));
    vi stock(2 * n);
    ll ans = 0;
    rep(i, 2 * n) {
        if (co[i].sc == 1) {
            stock[co[i].fs.sc]++;
        }
        else {
            int tmp = co[i].fs.sc - 1;
            while (tmp >= 0) {
                if (stock[tmp] > 0) {
                    stock[tmp]--;
                    ans++;
                    break;
                }
                tmp--;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int main()
{
  int n;
  cin >> n;
  vecint p(n,0);
  vecint pmin(n,0);
  REP(i,n){
    cin >> p[i];
  }
  pmin[0] = p[0];
  REP(i,n - 1){
    pmin[i + 1] = min(pmin[i],p[i + 1]);
  }
  int ans = 1;
  REP(i,n - 1){
    if(pmin[i] >= p[i + 1]){
      ans ++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
using System;

class Program {
  static void Main() {
    var L = new long[87];
    L[0] = 2;
    L[1] = 1;
    var n = long.Parse(Console.ReadLine());
    for (int i = 2; i <= n; i++) {
      L[i] = L[i - 1] + L[i - 2];
    }
    Console.WriteLine(L[n]);
  }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  srep(i,1,N*2) {
    int a = (i*1.08)/1;
    if(a==N) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}

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

const int maxn = 1e6 + 10;
typedef long long LL;

int p[maxn];
bool l[maxn];

int prime() {
    int cnt = 0;
    for(int i = 2; i < maxn; ++i) {
        if(!l[i]) {
            p[cnt++] = i;
            LL con = i;
            LL j;
            while((j = i * (con++)) < maxn) {
                l[j] = true;
            }
        }
    }
    return cnt;
}

int main() {
    int cnt = prime();
    int n;
    while(scanf("%d", &n) != EOF) {
        int ans = upper_bound(p, p + cnt, n) - p;
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 4404
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ppi pair<int, pii>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const int N = 10, mod = 1e9 + 7;
const ll inf = 1e18;
int n, m, k, tb, sl, sr;
int a[N], b[N];
string s[N];
int ans;
void solve(){
    ll a;
    long double b;
    cout << fixed << setprecision(11);
    cin >> a >> b;
    b = b * 100.0 + 0.9;
    ll c = b;
    a = a * c;
    cout << a/100 << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);//cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll t,p;
    t=1;
    //cin>>t;
    for(p=1;p<=t;p++){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3728
from itertools import product

ABCD=input()
for tf in list(product([False,True],repeat=3)):
  sum_=int(ABCD[0])
  str_=ABCD[0]
  for j in range(3):
    if tf[j]==True:
      str_+="+"
      sum_+=int(ABCD[j+1])
    else:
      str_+="-"
      sum_-=int(ABCD[j+1])
    str_+=ABCD[j+1]
  if sum_==7:
    print(str_+"=7")
    exit()
print("No")


Measured memory_bytes: 9096
import collections
n = int(input())
l = [input() for _ in range(n)]
d = collections.Counter(l)
M=max(d.values())
ans = []
j = list(d.values())
k = list(d.keys())
for i in range(len(j)):
  if j[i] == M:
    ans.append(k[i])
ans.sort()
for i in ans:
  print(i)

Measured memory_bytes: 36456
def main():
    import sys
    input = lambda:sys.stdin.readline().strip()
    
    N = int(input())
    A = list(map(int,input().split()))
    A.sort()

    #累積和ac_Ai<Ai+1/2の場合を除外した数
    from itertools import accumulate
    acc_A = list(accumulate(A))

    ans = 1
    for i in range(N-2,-1,-1):
        if acc_A[i]*2<(acc_A[i+1]-acc_A[i]):
            break
        else:
            ans+=1

    print(ans)

    
if __name__=='__main__':
    main()

Measured memory_bytes: 20604
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

ll n;
const int MAX_V = half_inf;
vector<int> G[MAX_V];
vector<bool> f_seen, s_seen;


queue<int> s_bfs(queue<int> q_v) {
    queue<int> next_v;
    while (!q_v.empty()) {
        int v = q_v.front();
        q_v.pop();
        rep(i, G[v].size()) {
            if (!f_seen[G[v][i]] && !s_seen[G[v][i]]) {
                next_v.push(G[v][i]);
                s_seen[G[v][i]] = true;
            }
        }
    }
    return next_v;
}

queue<int> f_bfs(queue<int> q_v) {
    queue<int> next_v;
    while (!q_v.empty()) {
        int v = q_v.front();
        q_v.pop();
        rep(i, G[v].size()) {
            if (!s_seen[G[v][i]] && !f_seen[G[v][i]]) {
                next_v.push(G[v][i]);
                f_seen[G[v][i]] = true;
            }
        }
    }
    return next_v;
}

void solve() {
    queue<int> q_f, q_s;
    q_f.push(0), q_s.push(n - 1);
    f_seen[0] = true, s_seen[n - 1] = true;
    int f_num = 1, s_num = 1;
    while (true) {
        q_f = f_bfs(q_f);
        f_num += q_f.size();
        q_s = s_bfs(q_s);
        s_num += q_s.size();
        if (q_f.empty() && q_s.empty()) {
            if (f_num > s_num) {
                cout << "Fennec" << endl;
                return;
            } else {
                cout << "Snuke" << endl;
                return;
            }
        }
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n - 1; ++i) {
        int s, t;
        scanf("%d %d", &s, &t);
        s--, t--;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    f_seen.resize(n), s_seen.resize(n);
    fill(f_seen.begin(), f_seen.end(), false), fill(s_seen.begin(), s_seen.end(), false);
    solve();
    return 0;
}

Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,m;
    cin>>n>>m;
    int num[100];
    for(int i=0;i<n;i++)cin>>num[i];
    for(int i=1;i<=m;i++){
    	for(int j=0;j<n-1;j++)if(num[j]%i>num[j+1]%i)swap(num[j],num[j+1]);
    }
    for(int i=0;i<n;i++)cout<<num[i]<<endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define endl "\n" 
#define ll long long
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define umap unordered_map
#define uset unordered_set 
#define mod 1000000007
#define imax INT_MAX
#define imin INT_MIN
#define exp 1e9
#define sz(x) (int((x).size()))
#define int long long

struct item {
    int wt;
    int val;
};

int solve(vector<item> ar, int n, int W) {
    int maxVal = n * 1000;
    int dp[n+1][maxVal + 1];

    for(int val = 0; val <= maxVal; val++) {
        dp[1][val] = imax;
    }

    dp[1][0] = 0;
    dp[1][ar[1].val] = ar[1].wt;

    for(int i = 2; i <= n; i++) {
        for(int v = 0; v <= maxVal; v++) {
            dp[i][v] = dp[i-1][v];
            if(ar[i].val > v) {
                continue;
            }
            dp[i][v] = min(dp[i][v], ar[i].wt + dp[i-1][v - ar[i].val]);
        }
    }
    int ans = 0;
    for(int val = 0; val <= maxVal; val++) {
        if(dp[n][val] <= W) {
            ans = val;
        }
    }
    return ans;

}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, w; cin >> n >> w;
    vector<item> v(n+1);
    for(int i = 1; i <= n; i++) {
        cin >> v[i].wt >> v[i].val;
    }
    cout << solve(v, n, w);

    return 0;
}

Measured memory_bytes: 81760
#include<bits/stdc++.h>
using namespace std;
long inf = 1000000007;

/*int main() {
    int n, k; cin >> n >> k;
    double total = 0;
    
    for (int i = 0; i < n; i++) {
        long a = i; double count = 1.0;
        while (a < k) {
            a *= 2;
            count = count / 2.0;
        }
      if(a/2 >= k){
        count = double(count *2);
      }
        total += count;
    }
    
    cout << total << endl;
}*/
int main(){
int a,b;scanf("%d%d",&a,&b);
double ret=0;
for(int i=1;i<=a;i++){
double tmp=1.0/a;
int now=i;
while(now<b){
now*=2;
tmp/=2;
}
ret+=tmp;
}
printf("%.12f\n",ret);
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;
#define mod 1000000007
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; }

ll lcm(ll a, ll b){
  return a / __gcd(a,b) * b;
}

int main() {
  int N; cin >> N;
  vector<ll> T(N);
  rep(i, 0, N) cin >> T[i];
  ll ans = 1;
  rep(i, 0, N) ans = lcm(ans, T[i]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

bool memo[200010];

int main()
{
	int n,m;
	cin >> n >> m;
	vector<int> v;
	
	REP(i,m)
	{
		int a;cin >> a;
		v.PB(a);
	}
	
	for(int i = v.size()-1;i >= 0;i--)
	{
		if(!memo[v[i]])
		{
			cout << v[i] << endl;
			memo[v[i]] = true;
		}
	}
	
	for(int i = 1;i <= n;i++)
	{
		if(!memo[i])
		{
			cout << i << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3728
#include <iostream>
#include <algorithm>
using namespace std;
 
#define INF 1e8
#define MAX_V 256
#define MAX_R 1024
int dl[MAX_V][MAX_V];	//	d[u][v]表示?e=(u,v)的??，不存在的?候等于无?大或者d[i][i] = 0
int ds[MAX_V][MAX_V];
int z[MAX_R];
int dp[MAX_R][MAX_V];	// dp[i][j] := 已?去了第i个?子后，船停在第j个?子里
int N;					//	?点数
 
///////////////////////////SubMain//////////////////////////////////
int main(int argc, char *argv[])
{
 
	int M;
	while (cin >> N >> M , N || M)
	{
// 		memset(dl, 0x3f, sizeof(dl));
// 		memset(ds, 0x3f, sizeof(ds));
		for (int i = 0; i < N; ++i)
		{
			for (int j = 0; j < N; ++j)
			{
				if (i == j)
				{
					dl[i][j] = ds[i][j] = 0;
				}
				else
				{
					dl[i][j] = ds[i][j] = INF;
				}
			}
		}
 
		for (int i = 0; i < M; ++i)
		{
			int x, y, t;
			char s;
			cin >> x >> y >> t >> s;
			--x; --y;
			if (s == 'L')
			{
				dl[x][y] = min(dl[x][y], t);
				dl[y][x] = dl[x][y];
			}
			else
			{
				ds[x][y] = min(ds[x][y], t);
				ds[y][x] = ds[x][y];
			}
		}
		
		int R;
		cin >> R;
		for (int i = 0; i < R; ++i)
		{
			cin >> z[i];
			--z[i];
		}
 
		// warshall_floyd
		for (int k = 0; k < N; ++k)
		{
			for (int i = 0; i < N; ++i)
			{
				for (int j = 0; j < N; ++j)
				{
					dl[i][j] = min(dl[i][j], dl[i][k] + dl[k][j]);
					ds[i][j] = min(ds[i][j], ds[i][k] + ds[k][j]);
				}
			}
		}
		// end of warshall_floyd
 
		// dp
		// 尼?3个0x3f3f3f3f加起来溢出了
		//memset(dp, 0x3f, sizeof(dp));
		for (int i = 0; i < R; ++i)
		{
			for (int j = 0; j < N; ++j)
			{
				dp[i][j] = INF;
			}
		}
		for (int i = 0; i < N; ++i)
		{
			// 去了首个?子后，船放在第i个?子里
						// 坐船去	 // 坐11路?回来
			dp[0][i] = ds[z[0]][i] + dl[i][z[0]];
		}
		for (int i = 1; i < R; ++i)
		{
			for (int j = 0; j < N; ++j)
			{
				for (int k = 0; k < N; ++k)
				{
					if (j != k)
					{
						//                          i-1站     + 从i-1站走旱路去j+ 从j走水路去k+从k走旱路去i
						dp[i][k] = min(dp[i][k], dp[i - 1][j] + dl[z[i - 1]][j] + ds[j][k] + dl[k][z[i]]);
					}
					else
					{
						// j == k                   i-1站     + 从i-1站走旱路去i
						dp[i][j] = min(dp[i][j], dp[i - 1][j] + dl[z[i - 1]][z[i]]);
					}
				}
			}
		}
 
		cout << *min_element(dp[R - 1], dp[R - 1] + N) << endl;
	}
 
	return 0;
}

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

int main(){
  int A,B;
  cin>>A>>B;
  if(A%3==0||B%3==0||(A+B)%3==0){
    cout<<"Possible"<<endl;
  }
  else{
    cout<<"Impossible"<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>

#define _GLIBCXX_DEBUG
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

bool compare(tuple<string, int, int> left, tuple<string, int,int> right){
    if(get<0>(left) != get<0>(right)){
        return get<0>(left) < get<0>(right);
    }else{
        return get<1>(left) > get<1>(right);
    }
}
int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n;
    cin >> n;
    vector<tuple<string, int, int>> list;
    vector<string> s(n);
    vector<int> p(n);
    for(int i=0; i<n; i++){
        cin >> s.at(i) >> p.at(i);
        list.push_back(make_tuple(s.at(i), p.at(i), i));
    }
    sort(list.begin(), list.end(), compare);
    for(int i=0; i<n; i++){
        cout << get<2>(list.at(i)) + 1 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)

const ll INF = 10010001010;
const int inf = 1000034000;
typedef vector<ll> vecl;
typedef vector<int> veci;
typedef tuple<string, int, int> TUP;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed << setprecision(15);
    string S, T, R;
    cin >> S >> T >> R;
    cout << 'A' << T[0] << 'C' << endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007


int main() {

  int H,W;
  cin >> H >> W;

  vector<vector<char>> A(H,vector<char>(W));
  queue<pair<int,int>> Q;
  queue<int> N;
  int black = 0;
  for(int i = 0;i < H;i++) {
    for(int j = 0;j < W;j++) {
      cin >> A.at(i).at(j);
      if(A.at(i).at(j) == '#') {
        Q.push(make_pair(i,j));
        black++;
        N.push(0);
      }
    }
  }
  
  if(black == H*W) {
    cout << 0 << endl;
    return 0;
  }

  int dx[] = {1,-1,0,0},dy[] = {0,0,1,-1};
  while(1) {
    pair<int,int> q = Q.front();
    Q.pop();
    for(int i = 0;i < 4;i++) {
      int x = q.second + dx[i];
      int y = q.first + dy[i];
      if(x < 0 || x >= W) continue;
      if(y < 0 || y >= H) continue;
      if(A.at(y).at(x) == '.') {
        A.at(y).at(x) = '#';
        black++;
        Q.push(make_pair(y,x));
        N.push(N.front()+1);
      }
    }
    if(black == H*W) {
          cout << N.front()+1 << endl;
          return 0;
    }
    N.pop();
  }


}



Measured memory_bytes: 13584
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main()
{
  string s;
  cin >> s;
  REP(i, s.size()) {
    if (i % 2 == 0) {
      if (s[i] == 'L') {
        cout << "No" << endl;
        return 0;
      }
    } else {
      if (s[i] == 'R') {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <complex>
#include <bitset>
#include <numeric>
using namespace std;

typedef long long LL;
#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define OUT(a) cout<<(a)<<endl;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m,q,a[100010],rank[100010]={},cnt=1,l,dat[100010]={100010};
    vector<int> res;
    cin >> n >> m >> q;
    REP(i,q){
        cin >> a[i];
    }
    for(int i= q-1; i>=0;--i){
        if(rank[a[i]]==0){
            rank[a[i]]=cnt;
            ++cnt;
            res.push_back(a[i]);
        }
    }
    REPN(i,1,m){
        if(rank[i]==0){
            rank[i]=cnt;
            ++cnt;
            res.push_back(i);
        }
    }

    for(int i=m-1;i>0;--i){
        if(res[i]<res[i-1]){
            l=i;
            break;
        }
    }

    for(int i= q-1; i>=0;--i){
        if(dat[rank[a[i]]]<dat[rank[a[i]]-1]){
        ++dat[rank[a[i]]];
        }
    }
    if(l==0)return 0;
    REPN(i,1,l){
        if(dat[l]<n){
            cout << "No" <<endl;
            return 0;
        }
    }
    cout << "Yes" <<endl;
    /*
    OUT(l)
    REP(i,m){
        OUT(res[i])
    }
    REP(i,m+1){
        OUT(dat[i])
    }
    //*/



    return 0;
}


Measured memory_bytes: 2172