akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>

int main(void) {
    char l2[128];
    int N = 0;
    scanf("%d", &N);
    scanf("%c", l2);
    int answer[100001] = {};
    for (int i=1; i<N+1; ++i) {
        int tmp = 0;
        scanf("%d", &tmp);
        answer[tmp] = i;
    }
    for (int i=1; i<N+1; ++i) {
        printf("%d ", answer[i]);
    }
    return 0;
}

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

#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;


int main()
{
    string s;
    cin >> s;
    int ans = 0;

    for (int i = 0; i < int(s.size())/2; i++) {
        if (s[i] != s[int(s.size()) - i - 1]) ans++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
//お勉強中

//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int n = 1 << N;
	int dp1[1 << 18], dp2[1 << 18];
	rep(i, n) {
		dp1[i] = getint();
		dp2[i] = 0;
	}

	rep(k, N) {
		int m = 1 << k;
		int m2 = ~(1 << k);
		for (int j = n - 1 & m2; j >= 0; j = j - 1 & m2) {
			int i = j | m;
			int k = min(dp1[i], dp1[j]);
			dp1[i] = max(dp1[i], dp1[j]);
			dp2[i] = max(dp2[i], k);
			dp2[i] = max(dp2[i], dp2[j]);
		}
	}

	int saidai = 0;
	rep1(i, n - 1) {
		saidai = max(saidai, dp1[i] + dp2[i]);
		printf("%d\n", saidai);
	}

	Would you please return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,ans;
  int map[10][7];
  bool b;
  while(1){
    cin>>h;
  if(h==0) break;
  b=true;
  ans=0;
  for(int i=0;i<10;i++){
    for(int j=0;j<7;j++){
      map[i][j]=0;
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<5;j++){
      cin>>map[i][j];
    }
  }
  while(b){
    /*cout<<endl;*/
    b=false;
  for(int i=0;i<h;i++){
    for(int j=0;j<3;j++){
      if(map[i][j]==0) continue;
      if(map[i][j]==map[i][j+1] && map[i][j]==map[i][j+2]){
	b=true;
	if(map[i][j]==map[i][j+3]){
	  if(map[i][j]==map[i][j+4]){
	    for(int k=j;k<j+5;k++){
	       ans+=map[i][k];
	       map[i][k]=0;
	    }
	  }
	  else for(int k=j;k<j+4;k++){
	      ans+=map[i][k];
	      map[i][k]=0;
	    }
	}
	else for(int k=j;k<j+3;k++){
	    ans+=map[i][k];
	      map[i][k]=0;
	  }
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<5;j++){
      if(map[i][j]==0){
	for(int k=i;k>=0;k--){
	  if(k==0) map[k][j]=0;
	  else map[k][j]=map[k-1][j];
	}
      }
    }
  }
  /*for(int i=0;i<h;i++){
    for(int j=0;j<5;j++){
      cout<<map[i][j]<<" ";
    }
    cout<<endl;
    }
    cout<<ans<<endl;*/
  }
  cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3068
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define mkp(a,b) make_pair(a,b)
#define PI 3.14159265359
#define mset(arr,val) memset(arr,val,sizeof arr)
#define MAXN (ll)2e5+1
#define eb emplace_back
#define mod (long long)(1e9+7)
#define FILE_READ freopen("input.txt","r",stdin)
#define FILE_WRITE freopen("output.txt","w",stdout)
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long ul;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
//    FILE_READ;
//    FILE_WRITE;

    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    vector<pii> a;
    for(int i=0;i<n;++i) {
        if(s[i]=='0') {
            int j=i;
            while(j<n && s[j]=='0') {
                ++j;
            }
            j--;
            a.eb(i,j);
            i=j;
        }
    }
//    for(auto i:a) {
//        cout<<i.first<<" "<<i.second<<endl;
//    }
    if(a.size()<=k) {
        cout<<n;
        return 0;
    }
    int ans=a[k].first;
//    cout<<ans<<endl;
    for(int i=k;i<a.size();++i) {
        if(i+1<a.size()) {
            ans = max(ans, a[i+1].first-1 - (a[i - k].second + 1) + 1);
        } else {
            ans = max(ans, n-1 - (a[i - k].second + 1) + 1);
        }
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 1020
#include<stdio.h>
static const int N = 100;

int main(){
    int M[N][N];
    int n,u,k,v;
    
    scanf("%d",&n);
    
    for(int i = 0;i < n; i++){
        for(int j = 0;j < n;j++) M[i][j] = 0;
    }
    
    for(int i = 0;i < n;i++){
        scanf("%d%d",&u,&k);
        u--;
        for(int j = 0;j < k;j++){
            scanf("%d",&v);
            v--;
            M[u][v] = 1;
        }
    }
    
    for(int i = 0;i < n;i++){
        for(int j = 0;j < n;j++){
            if(j > 0)printf(" ");
            printf("%d",M[i][j]);
        }
        printf("\n");
    }
    return 0;
}


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

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

const int N = 100100;
int x[N];

int solve(const VI& a, const VI& b) {
  if (a.size() < b.size()) {
    return solve(b, a);
  }
  // |a| >= |b|
  int s = b.size();
  int rem = a.size() - s;
  int idpair = 0;
  int cur = -1;
  REP(i, 0, a.size()) {
    if (a[i] == cur) {
      idpair++;
      cur = -1;
    } else {
      cur = a[i];
    }
  }
  return rem <= 2 * idpair ? s + rem / 2 : s + idpair;
}

int main(void){
  int n, m;
  cin >> n >> m;
  REP(i, 0, n) {
    cin >> x[i];
  }
  sort(x, x + n);
  vector<VI> res(m);
  REP(i, 0, n) {
    res[x[i] % m].push_back(x[i]);
  }
  int cnt = res[0].size() / 2;
  if (m % 2 == 0) {
    cnt += res[m / 2].size() / 2;
  }
  REP(i, 1, (m + 1) / 2) {
    cnt += solve(res[i], res[m - i]);
  }
  cout << cnt << endl;
}


Measured memory_bytes: 6144
#include<iostream>
#include<cmath>
#include<string>
#include<string.h>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<deque>
#include<tuple>
#include<iomanip>
using namespace std;
#define int                  int64_t
#define double               long double
#define vi                   vector<int>
#define di                   deque<int>
#define si                   set<int>
#define vpii                 vector<pair<int,int>>
#define pi                   pair<int,int>
#define pub                  push_back
#define puf                  push_front
#define pob                  pop_back
#define pof                  pop_front
#define all(a)               (a).begin(),(a).end()
#define rall(a)              (a).rbegin(),(a).rend()
#define PI                   3.1415926535897932384626433832795
#define read(a)              for(auto& x:a) cin>>x
#define speak(a)             for(auto x:a) cout<<x<<' '
#define rep(i,s,n)           for(int i=s;i<n;++i)
#define repe(i,s,n)          for(int i=s;i<=n;++i)
#define repr(i,n,s)          for(int i=n;i>=s;--i)
#define endl                 '\n'
#define gap                  ' '
#define MAX                  LLONG_MAX
#define MIN                  LLONG_MIN
#define min3(a,b,c)          min(a, min(b, c))
#define max3(a,b,c)          max(a, max(b, c))
#define MOD                  1000000007
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;cin>>n;
    int a[n];read(a);
    int ans=MAX,x=*max_element(a,a+n);
    repe(i,1,x)
    {
        int y=0;
        rep(j,0,n) y+=(a[j]-i)*(a[j]-i);
        ans=min(ans,y);
    }
    cout<<ans;
}


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

int main()
{

  int n,k,i,j,ans,o;
  vector<int> kosuu(1);

  cin>>n;
  cin>>k;
  vector<int> a(n);
  for(i=0;i<n;i++)
  {
    cin>>a[i];
  }

  sort(a.begin(), a.end());
  // cout << "***\n";
  
  j=0;
  kosuu[0]=1;
  for(i=0;i<n-1;i++)
  {

    if(a[i]==a[i+1])kosuu[j]+=1;
    if(a[i]!=a[i+1]) 
    {
      kosuu.push_back(1);
      j++;
    }
  }

  sort(kosuu.begin(),kosuu.end());
  reverse(kosuu.begin(),kosuu.end());

  o   = kosuu.size();
  ans = 0;
  while(o > k)
  {
    // cout << "aaa\n";
    ans += kosuu[o -1];
    kosuu.pop_back();
    o    = kosuu.size();
  }

  cout << ans << endl;
  return 0;

}
  
    

Measured memory_bytes: 2168
#include<bits/stdc++.h>
#include<vector>
using namespace std;
#define ll long long
const long long M = 10e9+7;
int main()
{
	int n;cin>>n;
	string s;cin>>s;
	int cnt = 0;
	for(int i=0;s[i];)
	{
		if(s[i]=='A')
		{
			if(s[i+1]=='B' and s[i+2]=='C')
			{
				i+=2;
				cnt++;
			}
			else i++;
		}
		else
		{
			i++;
		}
	}	
	cout<<cnt<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
#include<numeric>
#include<limits>
#include<type_traits>
using namespace std;

int main(void){
  long long int N;
  vector<long long int> divisor;
  cin >> N;
  //約数リストを小さい方から半分計算
  for(long long int i = 1; i < N; i++){
    if(i * i > N){break;}
    if(N % i == 0){
      divisor.push_back(i);
    }
  }
  //約数リストからQ(m+1)（1 <= Q < m）を満たす個数を数える．
  long long int ans = 0;
  for(int i = 0; i < divisor.size(); i++){
    long long int coup_div = N / divisor[i];
    if(divisor[i] < coup_div - 1) {
      ans = ans + coup_div - 1;
    }
  }
  cout << ans << endl;
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
	int r,g; cin>>r>>g;
	cout<<2*g-r<<endl;	
}


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int N, M;
    cin >> N >> M;
    vector<int> v(N); int sum = 0;
    for (int i = 0; i < N; ++i) {
        cin >> v[i];
        sum += v[i];
    }
    
    int s = 0;
    for (int i = 0; i < N && s < M; ++i) {
        if (v[i] * 4 * M >= sum) s++;
    }
    if (s == M) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#define ll long long int



int main()
{
   int A , B , C;
   scanf("%d %d %d",&A,&B,&C);
   int res = A*B/2;
   printf("%d",res);
    return 0;

}


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

#define ll long long

using namespace std;

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

const int MAXN = 1e6 + 100;


int main() {
#ifdef __APPLE__
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for (int i = 0; i < n; ++i)
        scanf("%d", &a[i]);
    int cur = 0;
    deque<int> q[2];
    for (int i = 0; i < n; ++i) {
        q[cur].push_back(a[i]);
        q[cur ^ 1].push_front(a[i]);
        cur ^= 1;
    }
    for (int i : q[cur])
        printf("%d ", i);

    return 0;
}


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

int main(void){
    vector<int> abc(3);
    for (int i=0;i<3;i++) cin>>abc[i];
    sort(abc.begin(),abc.end());
    if (abc[0]==5&&abc[1]==5&&abc[2]==7) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int N,A,B,C;
int l[10];
int ans=1e18;

int a[10];

void dfs(int pos){
        if(pos==N){
                int lA=0,lB=0,lC=0;
                int cost=0;
                REP(i,N){
                        if(a[i]==0){
                                if(lA>0) cost+=10;
                                lA+=l[i];
                        }
                        if(a[i]==1){
                                if(lB>0) cost+=10;
                                lB+=l[i];
                        }
                        if(a[i]==2){
                                if(lC>0) cost+=10;
                                lC+=l[i];
                        }
                }
                if(lA==0 or lB==0 or lC==0) return;
                cost+=abs(lA-A)+abs(lB-B)+abs(lC-C);

                ans=min(ans,cost);

                return;
        }
        REP(i,4){
                a[pos]=i;
                dfs(pos+1);
        }
}

signed main()
{
        cin>>N>>A>>B>>C;
        REP(i,N) cin>>l[i];

        dfs(0);
        cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

import static java.lang.System.in;

public class Main {
    final static int MOD = (int) 1E9 + 7;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(in);
        HashMap<Integer, ArrayList<Integer>> map = new HashMap<>();
        int n = scanner.nextInt();
        for (int i = 0; i < n-1; i++) {
            int p =scanner.nextInt();
            int c = scanner.nextInt();
            map.putIfAbsent(p,new ArrayList<>());
            map.get(p).add(c);
            map.putIfAbsent(c,new ArrayList<>());
            map.get(c).add(p);
        }
        long[][] dp  = new long[n+1][2];
        ways(map,dp,1,-1);
        System.out.println((dp[1][0] + dp[1][1])% MOD);
    }
    private static void ways(HashMap<Integer,ArrayList<Integer>> map ,long[][] dp,int node,int parent){
        dp[node][0]=1;
        dp[node][1]=1;
        if(!map.containsKey(node)) return;
        for(int i : map.get(node)){
            if(i != parent){
                ways(map,dp,i,node);
                dp[node][0] = (dp[node][0]*dp[i][1])%MOD;
                dp[node][1] = (dp[node][1]*(dp[i][0] + dp[i][1])%MOD)%MOD;
            }
        }
    }
}

Measured memory_bytes: 98568
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var N = consoleReader.Int;
            return 180 * (N - 2);
        }

        public const int mod = 1000000007;
        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader()).Calc()); static string MultiLine<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

#pragma warning disable
    public class ConsoleReader { public class SplitLine { string[] splited; public SplitLine(string line) { splited = line.Split(); } public string[] String => splited.ToArray(); public int[] Int => splited.Select(int.Parse).ToArray(); public long[] Long => splited.Select(long.Parse).ToArray(); public ulong[] ULong => splited.Select(ulong.Parse).ToArray(); public double[] Double => splited.Select(double.Parse).ToArray(); } public class RepeatLine { ConsoleReader reader; int num; public RepeatLine(ConsoleReader reader, int num) { this.reader = reader; this.num = num; } public IEnumerable<string> String { get { for (int i = 0; i < num; i++) yield return reader.String; } } public IEnumerable<int> Int { get { for (int i = 0; i < num; i++) yield return reader.Int; } } public IEnumerable<long> Long { get { for (int i = 0; i < num; i++) yield return reader.Long; } } public IEnumerable<string[]> Split { get { for (int i = 0; i < num; i++) yield return reader.Split.String; } } public IEnumerable<int[]> SplitInt32 { get { for (int i = 0; i < num; i++) yield return reader.Split.Int; } } } public virtual string String => Console.ReadLine(); public int Int => int.Parse(String); public long Long => long.Parse(String); public ulong ULong => ulong.Parse(String); public double Double => double.Parse(String); public SplitLine Split => new SplitLine(String); public RepeatLine Repeat(int count) => new RepeatLine(this, count); }
}

Measured memory_bytes: 11092
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main() {

    int a,b;
    scanf("%d%d", &a,&b);
    
    int maxdata=a+b;
    maxdata=(maxdata < a*b ? a*b : maxdata);
    maxdata = (maxdata < a - b ? a - b : maxdata);
    printf("%d",maxdata);
    
    
    
    
    return 0;

}


Measured memory_bytes: 128
input = readlines()

n = input.shift.chomp.to_i

list = {}
input.each do |l|
  s = l.chomp
  list[s] = 0 if list[s].nil?
  list[s] += 1
end

max = list.values.max

keys = []
list.each do |k, v|
  keys.push(k) if v == max
end

puts keys.sort.join("\n")


Measured memory_bytes: 56884
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define MAXN 100000
#define FR first
#define SE second
pair<int,int> a[MAXN+5];
int n,b[MAXN+5],Pos[MAXN+5];
int ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&b[i]);
		a[i]=make_pair(b[i],i);
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)Pos[a[i].SE]=i;
	for(int i=1;i<=n;i+=2)if(Pos[i]%2==0)ans++;
	printf("%d",ans);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

// 因数分解
inline vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

//階乗
inline ll factorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

inline ll vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
    }
    else { // 発見できなかったとき
        return 0;
    }
}

int main(){
    ll n;
    string s, t;
    cin >> n >> s >> t;
    
    rep(i, n){
        cout << s[i] << t[i];
    }
    
    return 0;
    
}


Measured memory_bytes: 256
N = int(input())
X = tuple(map(int, input().split()))

Y = list(X)
Y.sort()

greater_median = Y[N//2]
smaller_median = Y[N//2-1]
average = (greater_median + smaller_median)/2

for x in X:
    if x <= average:
        print(greater_median)
    else:
        print(smaller_median)

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

using namespace std;

typedef long long ll;

const int MAXN = 2031;
const ll INF = 1e18;

void update(ll& x, ll y)
{
    x = min(x, y);
}
int main()
{
    ll dp[331][331];
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<ll> h(n);
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    h.emplace_back(0);
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= k; j++)
        {
            dp[i][j] = INF;
        }
    }
    dp[0][0] = h[0];
    dp[0][1] = INF;
    int moreZero = (h[0] > 0);
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j <= k; j++)
        {
            if (h[i - 1] >= h[i])
            {
                update(dp[i][j], dp[i - 1][j]);
            } else {
                update(dp[i][j], dp[i - 1][j] + (h[i] - h[i - 1]));
            }
            for (int last = i - 1; last > 0; last--)
            {
                int toChange = i - last - 1;
                if (toChange > j) break;
                if (h[last] >= h[i])
                {
                    update(dp[i][j], dp[last][j - toChange]);
                } else {
                    update(dp[i][j], dp[last][j - toChange] + (h[i] - h[last]));
                }
            }
            if (j >= moreZero) update(dp[i][j], h[i]);
//            cerr << "i=" << i << " j=" << j << " dp=" << dp[i][j] << endl;
        }
        moreZero += (h[i] > 0);
    }
    ll ans = INF;
    for (int j = 0; j <= k ;j++)
    {
        ans = min(ans, dp[n][j]);
    }
    if (moreZero <= k) ans = 0;
    cout << ans;
    return 0;
}


Measured memory_bytes: 1024
n,k=map(int,input().split())
a=list(map(int,input().split()))
l=input()
before=["a"]*k
dic={"r":a[2],"s":a[0],"p":a[1]}
ans=0
for i,s in enumerate(l):
    i=i%k
    if before[i]!=s:
        ans+=dic[s]
        before[i]=s
    else:
        before[i]="a"
print(ans)

Measured memory_bytes: 3956
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;

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

int main()
{
  string str;
  //  string roman[] = {"I", "V", "X", "L", "C", "D", "M"};
  map<char, int> roman;
  roman['I'] = 1;
  roman['V'] = 5;
  roman['X'] = 10;
  roman['L'] = 50;
  roman['C'] = 100;
  roman['D'] = 500;
  roman['M'] = 1000;

  while(cin>>str){
    int nums[str.size()];
    REP(i,str.size())
      nums[i] = roman[str[i]];

    int dec=0;    
    int begin=0;
    int i=0;
    while(i<str.size()-1){
      if(nums[i] < nums[i+1]){
	for(int j=begin; j<=i; j++){
	  dec += nums[j];
	  nums[j] = 0;
	}
	begin = i+2;
      }
      if(nums[i] > nums[i+1]){
	begin = i+1;
      }
      i++;
    }

    int res=0;
    REP(i,str.size()) res += nums[i];

    cout << res-dec << endl;
  }

  return 0;
}

Measured memory_bytes: 1184
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define Max 200005
using namespace std;
typedef long long LL;
int main() {
    int n;
    int a[Max];
    LL sum[Max] = {0};
    scanf("%d",&n);
    for(int i = 1;i <= n;i ++) {
        scanf("%d",&a[i]);
        sum[i] = sum[i - 1] + a[i];
    }
    LL ans = sum[n];
    int l = 1,r = 3;
    for(int i = 2;i <= n - 2;i ++) {
        LL last = sum[n];
        while(l < i) {
            LL d = abs(sum[i] - sum[l] * 2);
            if(d > last) break;
            else last = d;
            l ++;
        }
        l --;
        last = sum[n];
        while(r < n) {
            LL d = abs(sum[n] + sum[i] - sum[r] * 2);
            if(d > last) break;
            else last = d;
            r ++;
        }
        r --;
        LL up = max(max(max(sum[l],sum[i] - sum[l]),sum[r] - sum[i]),sum[n] - sum[r]);
        LL down = min(min(min(sum[l],sum[i] - sum[l]),sum[r] - sum[i]),sum[n] - sum[r]);
        ans = min(ans,up - down);
    }
    printf("%lld",ans);
}


Measured memory_bytes: 2560
from collections import deque
K = [int(i) for i in input().split()][0]

que = deque()
for i in range(1, 10):
  que.append(i)
k = 0
while k < K:
  k += 1
  p = que.popleft()
  i = p % 10
  if len(que) + k < K:
      if i > 0:
        que.append(p*10 + i -1)
      que.append(p*10 + i)
      if i < 9:
        que.append(p*10 + i + 1)
  
print(p)



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

bool isPrime(int x){
    int p = sqrt(x) + 1;
    for (int i = 2; i < p; i++){
        if(x%i==0){
            return true;
        }
    }
    return false;
}
int main(){
    int x;
    cin >> x;
    if(x==1||x==2){
        cout << 2 << endl;
        return 0;
    }
    if(x%2==0){
        x++;
    }
    while(isPrime(x)){
        x += 2;
    }
    cout << x << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mo 1000000007
#define maxn 1000000000000000000LL
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
int n,m,i,j,k,du[100005],book[100005],max1,max2,x,y;
int top,nex[200005],to[200005],fir[100005];
void lj(int u,int v){
	top++;
	nex[top]=fir[u];
	fir[u]=top;
	to[top]=v;
}
void ss(int v,int w){
	if(w!=0)
		book[v]=1;
	for(int top1=fir[v];top1;top1=nex[top1])
		if((top1+1)/2!=w&&to[top1]!=max2&&book[to[top1]]==0)
			ss(to[top1],(top1+1)/2);
}
int main(){
  	//freopen("contest.in","r",stdin);
  	//freopen("contest.out","w",stdout);
	n=read();m=read();
	for(i=1;i<=m;i++){
		x=read();y=read();
		du[x]++;
		du[y]++;
		lj(x,y);
		lj(y,x);
	}
	for(i=1;i<=n;i++)
		if(du[i]&1){
			printf("No\n");
			return 0;
		}
	for(i=1;i<=n;i++)
		max1=max(max1,du[i]);
	if(max1>=6){
		printf("Yes\n");
		return 0;
	}
	if(max1<=2){
		printf("No\n");
		return 0;
	}
	max1=0;
	for(i=1;i<=n;i++)
		if(du[i]==4)
			max1++;
	if(max1>=3){
		printf("Yes\n");
		return 0;
	}
	if(max1<=1){
		printf("No\n");
		return 0;
	}
	max1=0;
	max2=0;
	for(i=1;i<=n;i++)
		if(du[i]==4){
			if(max1==0)
				max1=i;
			else
				max2=i;
		}
	ss(max1,0);
	if(book[max1]==1)
		printf("Yes\n");
	else
		printf("No\n");
    return 0;
}

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

long long getXor(long long x) {
	if (x % 4 == 0)return x;
	else if (x % 4 == 1)return 1;
	else if (x % 4 == 2)return x + 1;
	else return 0;
}

int main() {
	long long a, b; cin >> a >> b;
	cout << (getXor(b) ^ getXor(a-1)) << endl;

	return 0;
}

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

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

	if ((b-a)%2==0) {
	cout << "Alice" << endl;
	}
	else {
	cout << "Borys" << endl;
	}
	return 0;
}



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

#define lld long long
#define pp pair<int,int>
#define pb push_back
#define MOD 1000000007
#define left lleft
#define right rright
#define INF 2000000000
#define Linf 1000000000000000000LL
#define next nnext
#define minus mminus

using namespace std;

int N,W,ans;
map<lld,int> Map,Map2;

int main(){
	scanf("%d %d",&N,&W);
	Map[0] = 0;
	for(int i=1; i<=N; i++){
		int w,v;
		scanf("%d %d",&w,&v);
		for(auto it = Map.rbegin(); it != Map.rend(); it++){
			Map2[it->first] = max(Map2[it->first],it->second);
			Map2[it->first+w] = max(Map2[it->first+w],it->second+v);
		}
		swap(Map,Map2);
		Map2.clear();
	}
	for(auto it = Map.begin(); it != Map.end(); it++) if(it->first <= W) ans = max(ans,it->second);
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {
  int i;
  int n;
  int ans;
  int a;
  int cnt=0;
  int cnt2=-1;


  scanf("%d",&n );

  for ( i = 1; i < n+1; i++) {
    a=i;
 
    for ( cnt = 0; a%2==0; cnt++) {
      a=a/2;
    }
    if (cnt2<cnt) {
      ans=i;
      cnt2=cnt;
    }
  }
  printf("%d",ans );


  return 0;
}

Measured memory_bytes: 128
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, 
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <cstdio>
#include <iostream>
using namespace std;
int main(){
    int n,k,x,y,total;
    cin >>n>>k>>x>>y; 
    if(n>k){
        total=((k*x)+((n-k)*y));
    }
    else{
        total=n*x;
    }
    printf("%d",total);
    
    
}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << "\n"
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      cout << '\n';
  }
  return s;
}

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;
}

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int N, A, B;
  cin >> N >> A >> B;

  if ((B - A) % 2)
    cout << "Borys" << endl;
  else
    cout << "Alice" << endl;
}

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

int main() {
  int n;cin>>n;
  vector<int> vec(n);
  rep(i,n) cin >> vec[i];

  sort(vec.begin() , vec.end());
  //for(auto p : vec) cout << p << endl;

  ll ans = 0;

  for(int i=0; i<n-1; i++){
    for(int j=i+1; j<n; j++){
      for(int k=n-1; k>j; k--){
        if(vec[i]+vec[j] > vec[k]){
          //printf("i=%d j=%d k=%d",i,j,k);
          //printf("   n-k=%d\n",n-k);
          ans += k-j;
          break;
        }
      }
    }
  }
  cout << ans << endl;
}


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

using namespace std;

int main() {
    int a, b;
  
  	cin >> a >> b;
  	
  	if ((a % 2 == 0 && b % 2 == 0) ||
        (a % 2 != 0 && b % 2 != 0)) {
    	cout << (a + b) / 2 << endl;
    } else {
          cout << "IMPOSSIBLE" << endl;
    }
    
    return 0;
}

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

int main() {
  vector<vector<int>> c(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) cin >> c.at(i).at(j);
  }
  bool flag;
  vector<vector<int>> ab(2, vector<int>(3));
  for (int i = 0; i <= c.at(0).at(0); i++) {
    flag = true;
    ab.at(0).at(0) = i;  // a_1
    ab.at(1).at(0) = c.at(0).at(0) - ab.at(0).at(0);  // b_1
    ab.at(1).at(1) = c.at(0).at(1) - ab.at(0).at(0);  // b_2
    ab.at(1).at(2) = c.at(0).at(2) - ab.at(0).at(0);  // b_3
    ab.at(0).at(1) = c.at(1).at(0) - ab.at(1).at(0);  // a_2
    ab.at(0).at(2) = c.at(2).at(0) - ab.at(1).at(0);  // a_3
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        int tmp = ab.at(0).at(i) + ab.at(1).at(j);
        if (tmp != c.at(i).at(j)) flag = false;
      }
    }
    if (flag) break;
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramA
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var a = long.Parse(inputs[0]);
            var b = long.Parse(inputs[1]);
            var x = long.Parse(inputs[2]);
            var result = a <= x && x <= a + b ? "YES" : "NO";
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 27320
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001

#define F first
#define S second

#define Pii pair<SINT32,SINT32>
#define Pll pair<SINT64,SINT64>


using namespace std;

int main() {

	SINT32 H,W;
	cin >> H >> W;
	vector<vector<SINT32>> data(H+2,vector<SINT32>(W+2));
	
	rep(i,1,H+1) {
		string s;
		cin >> s;
		rep(j,1,W+1) {
			if (s[j-1] == '#') {
				data[i][j] = -INF;
			} else {
				data[i][j] = 0;
			}
		}
	}
	rep(i,1,H+1) {
		rep(j,1,W+1) {
			if (data[i][j] < 0) {
				data[i-1][j-1]++;
				data[i-1][j]++;
				data[i-1][j+1]++;
				data[i][j-1]++;
				data[i][j+1]++;
				data[i+1][j-1]++;
				data[i+1][j]++;
				data[i+1][j+1]++;
			}
		}
	}

	rep(i,1,H+1) {
		rep(j,1,W+1) {
			if (data[i][j] < 0) {
				cout << '#';
			} else {
				cout << data[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());	//ソート後に使用

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));	//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();	//key以上を探す
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/
/* 文字列合成
	string N,M;
	cin >> N >> M;
	SINT64 ans = 0;
	ans = stoi(N+M);
*/



/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}

*/

Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto A = RD!string;
	auto B = RD!string;
	
	int ans;
	if (A.length == B.length)
	{
		foreach (i; 0..A.length)
		{
			auto x = A[i].to!int;
			auto y = B[i].to!int;
			if (x == y) continue;

			ans = x < y ? -1 : 1;
			break;
		}
	}
	else
		ans = A.length == B.length ? 0 : A.length < B.length ? -1 : 1;

	writeln(ans == -1 ? "LESS" : ans == 0 ? "EQUAL" : "GREATER");
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
const Int MOD = 1000000007;
int main() {
    int N; cin >> N;
    vector<int> A(N); for (auto &a : A) cin >> a;
    Int ans = 0, sum = 0;
    for (int i = N - 1; i >= 0; i--) {
        ans = (ans + A[i] * sum) % MOD;
        sum = (sum + A[i]) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n;
    cin >> n;
    vector<pair<lint, lint>> p(n);
    for (int i = 0; i < n; ++i) {
        cin >> p[i].first;
        p[i].second = i;
    }
    sort(p.begin(), p.end(), greater<pair<int, int>>());
    multiset<lint> pos;
    pos.insert(-1);
    pos.insert(-1);
    pos.insert(n);
    pos.insert(n);
    pos.insert(p[0].second);

    lint ret = 0;
    for (int i = 1; i < n; ++i) {
        pos.insert(p[i].second);

        auto it     = pos.lower_bound(p[i].second);
        lint left1  = *prev(it);
        lint left2  = *prev(it, 2);
        lint right1 = *next(it);
        lint right2 = *next(it, 2);

        ret += p[i].first * (*it - left1) * (right2 - right1);
        ret += p[i].first * (left1 - left2) * (right1 - *it);
    }
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 6528
#include <stdio.h>

main(){
  int x,y,i,j;
  
  scanf("%d%d",&x,&y);
  if(x>y){
    j=x%y;
    for(i=j;i>0;i--){
      if(y%i == 0 && j%i == 0){
	printf("%d\n",i);
	break;
      }
    }
  }
  
  if(x<y){
    j=y%x;
    for(i=j;i>0;i--){
      if(x%i == 0 && j%i == 0){
	printf("%d\n",i);
	break;
      }
    }
  }
  
  if(x==y)printf("%d\n",x);  
  
  return 0;
}

Measured memory_bytes: 592
N = int(input())

Prime = [2, ]
ans = []
i = 3

while(len(ans) < N):
    Pflag = True
    for p in Prime:
        if(i % p == 0):
            Pflag = False
            break

    if(Pflag is True):
        Prime.append(i)
        if(i % 5 == 1):
            ans.append(i)

    i += 2

S = ""
for p in ans:
    S += " " + str(p)

print(S[1:])

Measured memory_bytes: 3064
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
int N,M;
bool G[8][8];
bool vis[1000][8];
bool rvis[8];
int ans=0;
int k=0;

void dfs(int x){
	k++;
	bool F=true;
	rvis[x]=true;
	REP(i,8)
	vis[k][i]=rvis[i];

	REP(i,N){
		if(G[x][i] && !rvis[i])
			dfs(i);
	}
	REP(i,N){
		if(!vis[k][i])F=false;
		//if(co>1)vis[i]=rvis[i];
	}
	k--;
	REP(i,8)rvis[i]=vis[k][i];
	if(F)ans++;
	return;
}

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

	REP(i,1000){
		REP(j,8)
			vis[i][j]=false;
	}
	REP(i,8)rvis[i]=false;
	cin>>N>>M;
	VI A(M);
	VI B(M);
	REP(i,8){
		REP(j,8)G[i][j]=false;
	}
	REP(i,M){
		cin>>A[i]>>B[i];
		A[i]--;
		B[i]--;
		G[A[i]][B[i]]=true;
		G[B[i]][A[i]]=true;
	}
	dfs(0);
	cout<<ans<<endl;
	return 0;
}


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


const long long INF = 1LL << 30;
int cost[1000000];

int main() {
	int N;

	cin >> N;

	for (int i=0; i<1000000; i++) {
		cost[i] = INF;
	}

	cost[0] = 0;

	vector<int> H(N);
	for (int i=0; i<N; i++) {
		cin >> H.at(i);
	}

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

		int c1;
		int c2;

		if (i+1 < N) {
			c1 = abs(H.at(i) - H.at(i+1)) + cost[i];
			if (c1 < cost[i+1]) {
				cost[i+1] = c1;
			}

		}

		if (i+2 < N) {
			c2 = abs(H.at(i) - H.at(i+2)) + cost[i];
			if (c2 < cost[i+2]) { 
				cost[i+2] = c2;
			}
		}
	}

	cout << cost[N-1];
}


Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
long long n,m,a[100005],dp[100005],x;
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)
    {
        cin>>x;
        a[x]=1;
    }
    dp[0]=1;
    if(a[1]) dp[1]=0;
    else dp[1]=1;
    for(int i=2;i<=n;i++)
    {
        if(a[i]) dp[i]=0;
        else dp[i]=(dp[i-1]+dp[i-2])%1000000007;
    }
    cout<<dp[n]<<endl;

	return 0;
}


Measured memory_bytes: 1792
#create date: 2020-06-27 21:00

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    s = ns()
    t = ns()
    ans = 0
    for i, j in zip(s, t):
        if i != j:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
int main() {
     int x,a,b;
     cin >> x >> a >> b;
     int A = abs(x - a);
     int B = abs(x - b);

     if(A < B) cout << 'A' << endl;
     else cout << 'B' << endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define f first
#define s second
using namespace std;
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}
typedef long long ll;
const int INF = 1e9;
const ll INFl = 1e18;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<ll> vll;
typedef queue<int> qi;
typedef queue<pii> qpii;


void test_case() {
	int n; cin >> n;
	vi jest(1000005, 0);
	vi a(n);
	for (int i = 0; i < n; i ++) {
		cin >> a[i];
		jest[a[i]] ++;
	}
	int ans = 0;
	for (int i = 0; i < n; i ++) {
		int x = a[i];
		bool czy = true;
		for (int j = 1; j * j <= x && czy; j ++) {
			if (x % j == 0) {
				if ((j != x || jest[j] > 1) && jest[j]) czy = false;
				if ((x / j != x || jest[x / j] > 1)&& jest[x / j]) czy = false;
			}
		}
		ans += czy;
	}
	cout << ans << '\n';
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int q = 1; 
	//cin >> q;
	while (q--) {
		test_case();
	}
	return 0;
}


Measured memory_bytes: 7952
def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z
A, B, K = map(int, input().split())
A_B_gcd = gcd(A, B)
yakusuu_arr = []
for i in range(1, A_B_gcd+1):
    if A_B_gcd % i == 0:
        yakusuu_arr.append(i)
yakusuu_arr.sort(reverse=True)
print(yakusuu_arr[K-1])


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  LL x;
  cin >> x;
  LL t = x, s = 0;
  while(t > 0){
	s += t%10;
	t /= 10;
  }
  cout<<(x%s==0?"Yes":"No")<<endl;
  

  return 0;
}


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

#define int long long
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define yn(x) ((x) ? "Yes" : "No")

typedef pair <int, int> ii;
typedef pair <int, ii> iii;

const int siz = 2e5 + 10;
const int SIZ = 1e6 + 10;
const int mod = 1e9 + 7;
const int maxx = 2e9;
const int MAXX = 1e18;
const string file = "3";

int par[siz], len[siz];

void init() {
    for (int u = 0; u < siz; u++) {
        par[u] = u;
        len[u] = 1;
    }
}

int root(int u) {
    if (u == par[u]) {
        return u;
    }
    return (par[u] = root(par[u]));
}

void unite(int u, int v) {
    u = root(u);
    v = root(v);

    if (u == v) {
        return;
    }

    if (len[u] < len[v]) {
        swap(u, v);
    }

    par[v] = u;
    len[u] += len[v];
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

//    freopen ((file + ".inp").c_str(), "r", stdin);
//    freopen ((file + ".out").c_str(), "w", stdout);

    init();

    int n, m;
    cin >> n >> m;

    while (m--) {
        int u, v;
        cin >> u >> v;

        unite(u, v);
    }

    int ans = 0;
    for (int u = 1; u <= n; u++) {
        ans = max(ans, len[root(u)]);
    }

    cout << ans << "\n";

//    cerr << "Time: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

    return 0;
}


Measured memory_bytes: 6744