akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

// {{{
#define PI pair<int, int>
#define mk make_pair
#define reg register
#define ll long long
#define rep(i, a, b) for(reg int i = a; i <= b; ++i)
#define per(i, a, b) for(reg int i = a; i >= b; --i)
// }}}

using namespace std;

inline int min(reg int a, reg int b) { return a < b ? a : b; }
inline int max(reg int a, reg int b) { return a > b ? a : b; }
inline int read() {
  reg int s = 0; reg char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
  return s;
}

ll n;

#define N 101

class Node {
  public:
    ll x, y;
} a[N];

map<PI, int> mp;

bool cmp(Node a, Node b) {
  if (a.x == b.x) return a.y < b.y;
  return a.x < b.x;
}

int main() {
  n = read();
  rep (i, 1, n) scanf ("%lld%lld", &a[i].x, &a[i].y);
  int ans = 0;
  sort(a + 1, a + n + 1, cmp);
  rep (i, 1, n) {
    rep (j, i + 1, n) {
      PI tmp = mk(a[i].x - a[j].x, a[i].y - a[j].y);
      mp[tmp]++;
      ans = max(ans, mp[tmp]);
    }
  }
  cout << n - ans << endl;
  return 0; 
}


/*******************************************
 _________________________________________
< COWSAY.cpp is created by zrz who is weak >
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
********************************************/

Measured memory_bytes: 384
s = [input() for i in range(5)]
x10 = int(0)
sum = int(0)
a = []

for i in range(5):
  if int(s[i]) % 10 == 0:
    x10 = x10 + 1
  else:
    a.append(int(s[i]) % 10)
  sum = sum + ((int(s[i]) - 1) // 10 + 1) * 10

  
b = [int(s) for s in a]

if x10 == 5:
  print(sum)
else:
  print(sum - 10 + min(b))
  

Measured memory_bytes: 9052
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, K; 
  cin >> N >> K;

  string s;
  cin >> s;
  if(s.back() == '1') s += '0';
  else s += '1';

  int cnt = 1;
  vector<int> v = {0};
  if(s[0] == '0') v.emplace_back(0);
  REP(i, N){
    if(s[i] != s[i+1]){
      v.emplace_back(cnt);
      cnt = 1;
    }else cnt++;
  }

  if(v.size()%2 == 0) v.emplace_back(0);
  N = v.size();

  REP(i, N-1) v[i+1] += v[i];

  int ans = 0;
  for(int i = 1; i < N; i += 2){
    chmax(ans, v[min(N-1, i+2*K)]-v[i-1]);
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 1528
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n;cin>>n;
    string s;
    vector<ll> v(5,0);
    for(int i=0;i<n;i++){
        cin>>s;
        if(s[0]=='M') v[0]++;
        else if(s[0]=='A') v[1]++;
        else if(s[0]=='R') v[2]++;
        else if(s[0]=='C') v[3]++;
        else if(s[0]=='H') v[4]++;
    }
    ll res=0;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            for(int k=j+1;k<5;k++){
                res += v[i]*v[j]*v[k];
            }
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
import java.io.*; 
import java.math.*;
import java.util.*;
public class Main {  //~IQEmperor~ 
	public static void main(String[] args) {
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		long X = I.nextLong();
		long K = I.nextLong();
		long D = I.nextLong();
		long ans = 0;
		if (X==0) {
			if (K%2==1) ans=D;//One move up or down
		}else if (X<0) {
			long dis = Math.abs(X); //Hitting 0
			long mvs = ceil(dis,D);
			long sub = min(mvs,K);
			K-=sub;
			X+=sub*D;
			if (K%2==1) X-=D;
			ans=Math.abs(X);
		}else {
			long dis = Math.abs(X); //Hitting 0
			long mvs = ceil(dis,D);
			long sub = min(mvs,K);
			K-=sub;
			X-=sub*D;
			if (K%2==1) X+=D; //One more move left after back and forth
			ans=Math.abs(X);
		}
		O.pln(ans);
		//O.pln("ZERO");
	}
	public static long min(long a, long b) {return Math.min(a,b);}
	public static long max(long a, long b) {return Math.max(a,b);}
	public static int min(int a, int b) {return Math.min(a,b);}
	public static int max(int a, int b) {return Math.max(a,b);}
	public static long abs(long x, long y) {return Math.abs(x-y);}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
		double nextDouble() {return Double.parseDouble(next());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}


Measured memory_bytes: 25628
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#pragma comment (linker, "/STACK:526000000")

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(10);
}

#define int ll
void solve() {
	while (true) {
		int n, m;
		cin >> n >> m;
		if (n == 0) return;
		vector<pair<int, int>> inputs;
		int ans = 0;
		REP(i, n) {
			int a, b;
			cin >> a >> b;
			ans += a * b;
			inputs.push_back(mp(b, a));
		}
		sort(ALL(inputs));
		reverse(ALL(inputs));
		REP(i, inputs.size()) {
			int now = min(m, inputs[i].second);
			ans -= now * inputs[i].first;
			m -= now;
		}
		cout << ans << endl;
	}
	
}
#undef int

int main() {
	init();
	solve();
}


Measured memory_bytes: 3376
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;


int main(){
    int H,W; cin >> H >> W;
    vector<vector<char>> C(H,vector<char>(W));
    rep(i,H)rep(j,W) cin >> C[i][j];

    rep(i,2*H){
        rep(j,W){
            cout << C[i/2][j];
        }
        cout << endl;
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
	long long n,m;cin>>n;
	if (n%2==1) puts("0");
	else{
		long long ans=0;m=n;
		while (m) ans+=(m/2)/5,m/=5;
		printf ("%lld",ans);
	}
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define SUBL freopen("/home/ajinkya/Desktop/input.txt","r",stdin); freopen("/home/ajinkya/Desktop/output.txt","w",stdout); 
#define ll long long
#define ull unsigned long long
#define FI(i,a,n) for(int i=a; i<=n; i++)
#define RFI(i,n,a) for(int i=n; i>=a; i--)
#define FLL(i,a,n) for(ll i=a; i<=n; i++)
#define RFLL(i,n,a) for(ll i=n; i>=a; i--)
#define vi vector<int>
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll>
#define pi pair<int, int>
#define GCD(a,b) __gcd(a,b)
#define MP make_pair
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define debug(x) cout << x << endl
#define MOD 1000000007
#define INF LLONG_MAX
#define PI 3.14159265359
using namespace std;




int main()
{
    fastio 
    // SUBL
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    cout << ((a[0]==5 && a[1]==5 && a[2]==7)?"YES":"NO");
    return 0;
}         	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

int main(){
    ll h, w;
    cin >> h >> w;
    if(w != 1 && h != 1) {
        cout << (h*w+1)/2 << endl;
    }
    else {
        cout << 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
a,b,c,d=map(int,input().split())
m=998244353
D=[[0]*(d+1)for _ in range(c+1)]
D[a][b]=1
for i in range(a,c+1):
 for j in range(b,d+1):
  x=D[i-1]
  D[i][j]+=(D[i][j-1]*i+x[j]*j-x[j-1]*(i-1)*(j-1))%m
print(D[c][d])

Measured memory_bytes: 133892
#include <bits/stdc++.h>
        using namespace std;
        int main(){
			long long n,k,s;
          cin>>n>>k>>s;
          for(int i=0;i<k;i++){
			cout<<s<<" ";
          }
          for(int i=0;i<n-k;i++){
			  if(s==1000000000)
			cout<<s-1<<" ";
			else{
				cout<<s+1<<endl;
			}
          }
          cout<<endl;
    		return(0);
        }

Measured memory_bytes: 1280
// C++ program to count the Minimum number of 
// increasing subsequences 
#include <bits/stdc++.h> 
using namespace std; 

int MIS(int arr[], int n) 
{ 
    multiset<int> last; 

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

        multiset<int>::iterator it = last.lower_bound(arr[i]); 

        if (it == last.begin()) {

            last.insert(arr[i]); 
        }
        else { 
            it--; 
            last.erase(it);
            last.insert(arr[i]); 
        } 
    } 
    return last.size();
} 

int main() 
{ 
    int n, i;
    cin>>n;
    int a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    cout<<MIS(a, n)<<endl;
    return 0; 
} 


Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#define ll double
int main()
{
    string s,t;
  ll a,b,c,d=0,k=1000000000000,x;
    cin>>x>>a>>d;
    vector<ll>v;
   getchar();
    stringstream ab;
    getline(cin,s);
    ab<<s;int i=0,j;
while(ab>>b)
    {
        c=a-(b*0.006);i++;
        c=abs(d-c);
        //cout<<c<<endl;
        if(c<k){
        k=c;j=i;
    }
        
    }
cout<<j<<endl;

}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  string a;
  cin>>a;
    cout<<a[0]<<a[1]<<a[2];
}


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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, x, y, z; cin >> n >> x >> y >> z;
    int w = x + y + z;
    long long pow10[n+1]; pow10[0] = 1;
    for (int i = 0; i < n; i++) {
        pow10[i+1] = pow10[i] * 10 % mod;
    }
    long long ans = 0;
    long long dp[2][1 << w];
    int mask = (1 << w) - 1;
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;

    int p = 1 << (z-1), q = 1 << (y+z-1), r = 1 << (x+y+z-1);
    auto judge = [&](int u) {
        bool ok = true;
        ok *= u & p;
        ok *= u & q;
        ok *= u & r;
        return ok;
    };
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < (1 << w); j++) {
            dp[i&1][j] %= mod;
            for (int k = 1; k <= 10; k++) {
                int u = (j << k) | (1 << (k-1));
                if (judge(u)) ans += dp[i&1][j] * pow10[n-(i+1)] % mod;
                else dp[(i+1)&1][u&mask] += dp[i&1][j];
            }
            dp[i&1][j] = 0;
        }
        ans %= mod;
    }
    
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 2304
let q = Scanf.scanf " %d" @@ (+) 0
let rmax = ref 0
let lrs = Array.init q @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b ->
  rmax := max !rmax b; a, b
let primes n =
  if n <= 1 then [|false; false|]
  else
    let flags = Array.make (n + 1) true in
    flags.(0) <- false; flags.(1) <- false;
    for i = 2 to n do
      if flags.(i) then
        let j = ref @@ i + i in
        while !j <= n do flags.(!j) <- false; j := !j + i done
    done;
    flags
let sums = Array.make (!rmax + 1) 0
let ps = primes !rmax
let f n = if n mod 2 = 1 && ps.(n) && ps.((n + 1) / 2) then 1 else 0
let _ =
  for i = 0 to !rmax - 1 do sums.(i + 1) <- sums.(i) + f (i + 1) done;
  let g (l, r) = Printf.printf "%d\n" @@ sums.(r) - sums.(l - 1) in
  Array.iter g lrs

Measured memory_bytes: 8960
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const ll LLINF = 1LL << 50;
using namespace std;

int main() {
    int m;
    cin >> m;
    cout << 48 - m << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    N, A, B, C = map(int, input().split())
    ls = [int(input()) for _ in range(N)]

    ans = editorial(N, A, B, C, ls)
    print(ans)


def editorial(N, A, B, C, ls):
    def dfs(cur, a, b, c):
        if cur == N:
            if min([a, b, c]) > 0:
                # 使わなくて足りない/使いすぎて超過している分は差引すればいい
                tmp = abs(a - A) + abs(b - B) + abs(c - C) - 30
            else:
                tmp = float("inf")
            # print(tmp, a, b, c, sep="\t")
            return tmp

        # 使うか使わないか,合成パターンを試す
        d = ls[cur]
        ret0 = dfs(cur + 1, a, b, c)
        ret1 = dfs(cur + 1, a + d, b, c) + 10
        ret2 = dfs(cur + 1, a, b + d, c) + 10
        ret3 = dfs(cur + 1, a, b, c + d) + 10

        return min([ret0, ret1, ret2, ret3])

    ans = dfs(0, 0, 0, 0)
    return ans


if __name__ == '__main__':
    main()


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int N;
int A[100100];

int d(int x){
    if(A[N-1] % 2 == 0){
        return abs(A[x] - A[N - 1] / 2);
    }else{
        return min(abs(A[x] - A[N - 1] / 2), abs(A[x] - (A[N - 1] / 2 + 1)));
    }
}

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

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

    sort(A, A+N);

    int64_t lb = N - 1, ub = -1;

    while(std::abs(ub - lb) > 1){
        int64_t mid = (lb + ub) / 2;

        if(A[mid] >= A[N-1] / 2){
            lb = mid;
        }else{
            ub = mid;
        }
    }

    int x1 = lb, x2 = lb - 1;
    int d1 = x1 < N - 1 ? d(x1) : 100100100, d2 = x2 >= 0 ? d(x2) : 100100100;
    int res = d1 < d2 ? x1 : x2;
    // std::cout << A[x1] << ", " << A[x2] << std::endl;
    std::cout << A[N-1] << " " << A[res] << std::endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <climits> 
//#include <iterator>

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

const int MOD = 1e9+7;

ll numOfWays(vector<vector<char>>& grid, int M, int N) {
    vector<vector<int>> ways(M, vector<int> (N,0)); 
    ways[1][1] = 1;
    
    for (int m = 1; m < M; ++ m) {
        for (int n = 1; n < N; ++ n) {
            if (grid[m][n] == '.') {
                if (m+1<M && grid[m+1][n] == '.') {
                    ways[m+1][n] = (ways[m+1][n]+ways[m][n]) % MOD;
                }
                if (n+1 < N && grid[m][n+1] == '.') {
                    ways[m][n+1] = (ways[m][n+1]+ways[m][n]) % MOD;
                }
            }
        }
    }
    return ways[M-1][N-1];
}

int main() {
    int H,W;
    cin>>H>>W;
    vector<vector<char>> grid(H+1, vector<char> (W+1, ' '));
    for (int h = 1; h < H+1; ++ h) {
        string s;
        cin>>s;
        for (int w = 1; w < W+1; ++ w) {
            grid[h][w] = s[w-1];
        }
    }
    cout<< numOfWays(grid, H+1, W+1)<<endl;
    return 0;
}


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

void sort(int a[]) {
	for(int i = 0; i < 10; i++)
		for (int j = i; j > 0; j--)
			if (a[j-1] < a[j]) {
				int t = a[j-1];
				a[j-1] = a[j];
				a[j] = t;
			}

}

int main(void) {
	int a[10], b[10], asum = 0, bsum = 0;
	for (int i = 0; i < 10; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < 10; i++) {
		cin >> b[i];
	}
	sort(a);
	sort(b);
	
	asum = a[0] + a[1] + a[2];
	bsum = b[0] + b[1] + b[2];
	
	cout << asum << ' ' << bsum << endl;
	
	return 0;
}

Measured memory_bytes: 2988
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main m = new Main();
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.next());
        int k = Integer.parseInt(scanner.next());
        int at = n - k;
        if (at > 0){
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(scanner.next());
            }
            Arrays.sort(a);
            long atc = 0;
            for (int i = 0; i < at; i++) {
                atc = atc + a[i];
            }
            System.out.println(atc);
        }else {
            System.out.println(0);
        }
    }
}

Measured memory_bytes: 48908
using System;

namespace A_Multipleof2andN
{
    public class Multipleof2andN
    {
        static void Main(string[] args)
        {
            Console.WriteLine(DivisionInputNum(int.Parse(Console.ReadLine())));
        }

        public static int DivisionInputNum(int N)
        {
            if (N % 2 == 0)
            {
                return N;
            }
            else
            {
                return N * 2;
            }
        }
    }
}

Measured memory_bytes: 27376
def main():
    S = input()

    A = int(S[:2])
    B = int(S[2:])

    if A != 0 and B <= 12 and B != 0 and A <= 12:
        print("AMBIGUOUS")

    elif (A != 0 and B <= 12) and B != 0:
        print("YYMM")

    elif (B != 0 and A <= 12) and A != 0:
        print("MMYY")

    elif (A == 0 and 1 <= B and B <= 12):
        print("YYMM")

    elif (B == 0 and 1 <= A and A <= 12):
        print("MMYY")

    else:
        print("NA")


if __name__ == "__main__":
    main()


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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

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

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 100500;

int n, p[N], cnt[N];
vector < int > g[N];
map < ll, int > pos;
ll d[N], dp[N], dp1[N];

inline bool cmp(int i, int j) {
	return d[i] < d[j];
}

void dfs(int v, int pr = -1) {
	cnt[v] = 1;
	for (auto to : g[v]) {
		if (to == pr)
			continue;
		dfs(to, v);
		cnt[v] += cnt[to];
		dp[v] += dp[to] + cnt[to];
	}
}

void dfs1(int v, int pr = -1) {
	ll sum = 0;
	for (auto to : g[v])
		if (to != pr)
			sum += dp[to];
	for (auto to : g[v]) {
		if (to == pr)
			continue;
		dp1[to] = dp1[v] + sum - dp[to] + 2 * (cnt[v] - cnt[to] - 1) + n - cnt[v] + 1;
		dfs1(to, v);
	}
}

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;
	
	cin >> n;

	for (int i = 1; i <= n; i++) {
		cin >> d[i];
		p[i] = i;
	}

	sort(p + 1, p + 1 + n, &cmp);

	for (int i = 1; i <= n; i++) {
		pos[d[p[i]]] = i;
		cnt[p[i]] = 1;
	}

	for (int i = n; i > 1; i--) {
		ll val = d[p[i]] + cnt[p[i]] + cnt[p[i]] - n;
		if (!pos.count(val) || val >= d[p[i]]) {
			cout << -1;
			return 0;
		}
		int pr = pos[val];
		cnt[p[pr]] += cnt[p[i]];
		g[p[pr]].pb(p[i]);
		g[p[i]].pb(p[pr]);
	}

	dfs(1);
	dfs1(1);

	for (int i = 1; i <= n; i++) {
		if (dp[i] + dp1[i] != d[i]) {
			cout << -1;
			return 0;
		}
	}

	for (int i = 1; i <= n; i++) {
		for (auto j : g[i])
			if (i < j)
				cout << i << " " << j << "\n";
	}
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 22400
#include<bits/stdc++.h>
using namespace std;
int main(){

    int N; cin >> N;
    int W[N];for(int i=0; i < N; i++) cin >> W[i];

    int sum=0;
    for(int i=0; i < N; i++){
        sum += W[i];
    }

    int half= sum/2;
    int comp[N];
    int acum=0;
    for(int i=0; i < N; i++){
        acum +=W[i];
        int tail=abs(sum-acum);
        comp[i]=abs(acum-tail);

    }
    
  
    sort(comp,comp+N);

    cout << comp[0] << endl;
    
    
}



Measured memory_bytes: 256
#![allow(non_snake_case)]
use proconio::input;

#[rustfmt::skip]
fn main() { std::thread::Builder::new().stack_size(128 * 1024 * 1024).spawn(solve).unwrap().join().unwrap(); }

#[proconio::fastout]
fn solve() {
    input! {
        (D, T, S): (u32, u32, u32),
    };

    println!("{}", if D <= T * S { "Yes" } else { "No" });
}


Measured memory_bytes: 2252
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;

inline bool valid(int x, int n) {
    return 0 <= x && x < n;
}

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

template <typename T>
inline T pop(queue<T>& q) {
    T front = q.front();
    q.pop();
    return front;
}

template <typename T>
inline T gcd(T a, T b) {
    for (; b; a %= b, swap(a, b));
    return a; 
}

template <typename T>
tuple<T, T, T> xgcd(T a, T b) {
    if (b == 0) return {1, 0, a};
    T x, y, g;
    tie(x, y, g) = xgcd(b, a%b);
    return {y, x-(a/b)*y, g};
}

ll mod = 998244353ll;
ll fact[200005] = {};

ll fastpow(ll a, ll b) {
    if (b == 0) return 1;
    ll sub = fastpow(a, b/2);
    ll rst = (sub * sub) % mod;
    if (b % 2) rst = (a * rst) % mod;
    return rst;
}

ll c(ll a, ll b) {
    if (a < b) return 0;
    return (fact[a] * fastpow(fact[b], mod-2) % mod) * fastpow(fact[a-b], mod-2) % mod;
}

int main() {
    fact[0] = 1;
    for (ll i = 1; i < 200005; i++) fact[i] = fact[i-1] * i % mod;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll n, m, k; cin >> n >> m >> k;

    ll rst = 0;
    for (int kk = 0; kk <= k; kk++) {
        ll sub = fastpow(m-1, n-kk-1) * c(n-1, kk) % mod * m % mod;
        rst = (rst + sub) % mod;
    }

    cout << rst % mod;
}


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

#define INF INT_MAX

typedef long long ll;

using namespace std;

int main(void){
	string s;
	cin >> s;
	int ans = 0;
	for(int i = 0;i < s.size()-1;i++){
		if(s[i] == s[i+1]){
			s[i+1] = s[i+1] == '0'? '1' : '0';
			ans++;
		}
	}
	// cout << s << endl;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n];
    int b[n];
    int c[n];
    for(int i=0;i<n;i++)cin >> a[i] >> b[i] >> c[i];
    vector<vector<int> >dp(n,vector<int>(3,-1));
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    
    for(int i=1;i<n;i++){
        dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + b[i];
        dp[i][2] = max(dp[i-1][0],dp[i-1][1]) + c[i];
    }
    
    cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) << endl;
}


Measured memory_bytes: 6912
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    ll N,K; cin>>N>>K;
    vector<ll> p;
    rep(i,N){
        ll x; cin>>x;
        p.pb(x);
    }
    sort(all(p));
    ll ans=0;
    rep(i,K)  ans+=p[i];
    cout<<ans;
}



Measured memory_bytes: 3620
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int w, h;
  while (cin >> w >> h, w) {
    vvi v(h, vi(w));
    rep(i, h) rep(j, w) cin >> v[i][j];
    int c = 0;
    fn<void(int, int, int)> f = [&](int i, int j, int a) {
      if (i < 0 || j < 0 || i >= h || j >= w) return;
      if (v[i][j]) {
        v[i][j] = 0;
        c += a;
        int di[] = {-1, -1, 0, 1, 1, 1, 0, -1}, dj[] = {0, 1, 1, 1, 0, -1, -1, -1};
        rep(k, 8) f(i + di[k], j + dj[k], 0);
      }
    };
    rep(i, h) rep(j, w) f(i, j, 1);
    cout << c << endl;
  }
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define N 10005
using namespace std;
typedef pair<int,int> P;
typedef pair<double,P> P1;
int n,m,x[N],y[N],p,q;
double cost,ans;
vector<P1> e;
int rank[N];
int par[N];

void init(){
  for(int i=0;i<n;i++)par[i]=i,rank[i]=0;
}

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

void unite(int u,int v){
  u=find(u);
  v=find(v);
  if(u==v)return;
  if(rank[u]<rank[v])par[u]=v;
  else{
    par[v]=u;
    if(rank[u]==rank[v])rank[u]++;
  }
}

bool same(int u,int v){
  return find(u)==find(v);
}

double getlen(int a,int b){
  double X=x[a]-x[b],Y=y[a]-y[b];
  return sqrt(X*X+Y*Y);
}

double kruskal(){
  sort(e.begin(),e.end());
  init();
  double res=0;
  for(int i=0;i<(int)e.size();i++){
    int u=e[i].second.first;
    int v=e[i].second.second;
    if(!same(u,v))unite(u,v),res+=e[i].first;
  }
  return -res;
}

int main(){
  cin>>n>>m;
  for(int i=0;i<n;i++)cin>>x[i]>>y[i];
  for(int i=0;i<m;i++){
    cin>>p>>q;
    e.push_back(P1(-getlen(--p,--q),P(p,q)));
    ans+=getlen(p,q);
  }
  ans-=kruskal();
  printf("%.8f\n",ans);
  return 0;
}

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

int main(){
    int N; cin >> N;
    set<string> s;
    for (int i = 0; i < N; i++)
    {
        string t; cin >> t;
        s.insert(t);
    }
    cout << s.size() << endl;

}

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

int main() {
    int a, b, d, r;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    double f = double(a) / b;
    cout << d << ' ' << r << ' ';
    cout << fixed << setprecision(5) << f << endl;
    return 0;
}


Measured memory_bytes: 3244
#include<iostream>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
ll n,k,ans=1;
int main(){
	cin>>n>>k;
	for(ll i=k;i<=n;i++){
		ans += (((n+n-i+1)*i/2) - ((i-1)*i/2) + 1);
		//ans %= mod;
		//cout<<i<<"===="<<ans<<endl;
	}
	cout<<ans%mod<<endl;
}
/*
141421 35623
220280457
*/

Measured memory_bytes: 3536
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    int n, t; cin >> n >> t;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int amin = INF;
    int profit = 0;
    int ans = 1;
    rep(i, n){
        if(profit < a[i] - amin){
            profit = a[i] - amin;
            ans = 1;
        }else if(profit == a[i] - amin){
            ans++;
        }
        amin = min(amin, a[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
s = list(input())
num = 0
n = len(s)
l = []
i = 0
while i < n:
  if s[i] == '<':
    l.append(num)
    num+=1
    i+=1
    if i==n:
      l.append(num)
  else:
    cur = 0
    while i < n and s[i]=='>':
      i+=1
      cur+=1
    if cur <= num:
      l.append(num)
      cur-=1
    l.append((cur*(cur+1))//2)
    num = 0
print(sum(l))

Measured memory_bytes: 27824
N = int(input())
p = list(map(int, input().split()))

def judge(p, x, y):
  if x == 0:
    re = p[y]
  else:
    re = p[0]
  for i in range(N):
    if i == x:
      t = p[y]
    elif i == y:
      t = p[x]
    else:
      t = p[i]
    if re > t:
      return False
    re = t
  return True

for i in range(N):
  for j in range(i, N):
    if judge(p, i, j):
      print("YES")
      exit()
print("NO")


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;

struct tree{
    int key;
    tree *parent, *left, *right;
};

void assignment(tree &a, tree b){
    a.key = b.key;
    a.parent = b.parent;
    a.left = b.left;
    a.right = b.right;
}

tree *root,*NIL;

void insert(int k){
    tree *y = NIL;
    tree *x = root;
    tree *z;
    z = (tree *)malloc(sizeof(tree));
    z->key = k;
    z-> left = NIL;
    z-> right = NIL;
    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }else{
            x = x->right;
        }
    }
    
    z->parent = y;
    if(y == NIL){
        root = z;
    }else if(z->key < y->key){
        y->left = z;
    }else{
        y->right = z;
    }
}

bool find(int target){
    tree *x = root;
    // tree y = *NIL;
    while(x != NIL){
        if(x->key == target){
            return true;
        }else if(x->key > target){
            x = x->left;
        }else{
            x = x->right;
        }
    }
    return false;

}

void preorder(tree *u){
    if (u == NIL) return;
    cout << " " << u->key;
    preorder(u->left);
    preorder(u->right);
}
void inorder(tree *u){
    if (u == NIL) return;
    inorder(u->left);
    cout << " " << u->key;
    inorder(u->right);
}

int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    
    for(int i = 0; i < n;i++){
        string order;
        cin >> order;
        int num;
        if(order == "insert"){
            cin >> num;
            insert(num);
        }else if(order == "print"){
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }else if(order == "find"){
            cin >> num;
            if(find(num)){
                cout << "yes" << endl;
            }else{
                cout << "no" << endl;
            }
        }
    }

    

    return 0;
}


Measured memory_bytes: 21940
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  int n,x;
  cin >> n >> x;
  int count = 0;
  if(x == 1 || x == 2*n-1){
    cout << "No" << endl;
    return 0;
  }else{
    cout << "Yes" << endl;
  }
  if(n == 2){
    cout << 1 << endl;
    cout << 2 << endl;
    cout << 3 << endl;
    return 0;
  }
  if(x == 2){
    for(int i=0;count < 2*n-1;i++){
      if(count == (2*n-1)/2-1){
        cout << x+1 << endl;
        cout << x << endl;
        cout << x-1 << endl;
        cout << x+2 << endl;
        count+=4;
        if(count >= 2*n-1) break;
      }
      if(x-1 <= i+1 && i+1 <= x+2) continue;
      cout << i+1 << endl;
      count++;
    }
  }else{
    for(int i=0;count < 2*n-1;i++){
      if(count == (2*n-1)/2-1){
        cout << x-1 << endl;
        cout << x << endl;
        cout << x+1 << endl;
        cout << x-2 << endl;
        count+=4;
        if(count >= 2*n-1) break;
      }
      if(x-2 <= i+1 && i+1 <= x+1) continue;
      cout << i+1 << endl;
      count++;

    }
  }
  
	return 0;
}


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

int main() {
  int A, B, K;
  cin >> A >> B >> K;

  int i = min(A, B) + 1;
  int cnt = 0;
  while (K != 0) {
    --i;
    if (A % i == 0 && B % i == 0) {
      --K;
    }
  }

  cout << i << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<map>
using namespace std;
#define ll long long
map<ll,ll>c;
int a[200010];
int main()
{
	int n; cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	ll ans = 0;
	for (int i = 0; i < n; i++)
	{
		ans += c[i - a[i]];
		c[i + a[i]]++;
	}cout << ans;
}

Measured memory_bytes: 26992
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

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

    int N;
    cin >> N;
    vector<pair<ll, ll>> v(N);
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        v[i] = {x, y};
    }

    map<pair<ll, ll>, int> ma;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            ll p = v[i].first - v[j].first;
            ll q = v[i].second - v[j].second;
            if (p != 0 || q != 0) {
                ma[{p, q}]++;
                ma[{-p, -q}]++;
            }
        }
    }

    int temp = 0, ans = 0;
    for (auto m : ma) {
        temp = max(temp, m.second);
    }

    ans = N - temp;
    cout << ans << endl;
}

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

#define N 3
#define LIM 32
#define HN 362897

struct dep{
  int depth,key;
};

int ans[N][N]={
  {1,2,3},
  {4,5,6},
  {7,8,0}
};

int mins = LIM;
struct dep h[HN];

int hash1(int k){
    return k%HN;
}
int hash2(int k){
  return 1+k%(HN-1);
}
int hashs(int k, int i){
  return (hash1(k)+i*hash2(k))%HN;
}


void dfs(int X[N][N], int n){
  int i,j,in,jn,a=0,b=1;
  int f=0;
  int tmp[N][N];
  for(i=0;i<N;i++)
  {
    for(j=0;j<N;j++)
    {
      if(ans[i][j]!=X[i][j])f++;
      if(X[i][j]==0){
        in=i;
        jn=j;
      }
      a+=X[i][j]*b;
      b*=10;
    }
  }

  if(f==0){
    if(mins>=n)mins=n;
    return;
  }
  if(n>mins)return;
  i=0;
  while(1){
    b=hashs(a, i);
    if(h[b].key == 0){
      h[b].key=a;
      h[b].depth=n;
      break;
    }else if(h[b].key == a){
      if(h[b].depth>n){
        h[b].depth=n;
        break;
      }else return;
    }
    i++;
  }

  if(in>0 && in<N){
    memcpy(tmp,X,sizeof(int)*N*N);
    swap(tmp[in][jn],tmp[in-1][jn]);
    dfs(tmp, n+1);
  }
  if(jn>0 && jn<N){
    memcpy(tmp,X,sizeof(int)*N*N);
    swap(tmp[in][jn],tmp[in][jn-1]);
    dfs(tmp, n+1);
  }

  if(in>=0 && in<N-1){
    memcpy(tmp,X,sizeof(int)*N*N);
    swap(tmp[in][jn],tmp[in+1][jn]);
    dfs(tmp, n+1);
  }
  if(jn>=0 && jn<N-1){
    memcpy(tmp,X,sizeof(int)*N*N);
    swap(tmp[in][jn],tmp[in][jn+1]);
    dfs(tmp, n+1);
  }

}

int main(){
  int i,j;
  int X[N][N]={};
  for(i=0;i<N;i++)for(j=0;j<N;j++)cin>>X[i][j];
  dfs(X,0);
  cout<<mins<<endl;
  return 0;
}



Measured memory_bytes: 5936
import collections
N = int(input())
a = input().split( )

ret = [0]

odds = []
evens = []
for i in range(N):
    if i % 2 == 0:
        odds.append(int(a[i]))
    else:
        evens.append(int(a[i]))

codds = collections.Counter(odds)
cevens = collections.Counter(evens)

if codds.most_common()[0][0] ==cevens.most_common()[0][0]:
    if codds.most_common()[0][1] > cevens.most_common()[0][1]:
        codds = sorted(list(codds.values()))
        cevens = sorted(list(cevens.values()))
        if len(codds) > 1:
            codds.pop(-1)
        else:
            codds = [0]
        if len(cevens) > 1:
            cevens.pop(-2)
    elif codds.most_common()[0][1] < cevens.most_common()[0][1]:
        codds = sorted(list(codds.values()))
        cevens = sorted(list(cevens.values()))
        if len(codds) > 1:
            codds.pop(-2)
        if len(cevens) > 1:
            cevens.pop(-1)
        else:
            cevens = [0]
    else:
        if len(codds) == 1 and len(cevens) == 1:
            codds = [0]
            cevens = sorted(list(cevens.values()))
        elif codds.most_common()[1][1] > cevens.most_common()[1][1]:
            codds = sorted(list(codds.values()))
            cevens = sorted(list(cevens.values()))
            codds.pop(-2)
            cevens.pop(-1)
        else:
            codds = sorted(list(codds.values()))
            cevens = sorted(list(cevens.values()))
            codds.pop(-1)
            cevens.pop(-2)

else:
    codds = sorted(list(codds.values()))
    cevens = sorted(list(cevens.values()))
    if len(codds) > 1:
        codds.pop(-1)
    else:
        codds= [0]
    if len(cevens) > 1:
        cevens.pop(-1)
    else:
        cevens = [0]

print(sum(codds) + sum(cevens))

Measured memory_bytes: 25904
#include<iostream>
#include <vector>
#define mod 1000000007
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

vector<vector<long long>>dp;

long long dp_func(vector<vector<int>>&v, int i, int m, int n)
{
	if(i==n)
	return 1;
	
	if(dp[m][i]!=-1)
	return dp[m][i];
	
	long long ans=0;
	for(int j=0;j<n;j++)
	{
		
		if(v[i][j]==1 && (m&(1<<j))==0 )
			ans = (ans + dp_func(v, i+1, m|(1<<j), n) ) % mod;
			
	}
	return dp[m][i] = ans;
}

int main()
{
	
	fast_io;
	int n;
  	//bool x;
	cin>>n;
	vector<vector<int>>v(n,vector<int>(n,0));
	dp.assign((1<<(n+1)),vector<long long >(n,-1));
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cin>>v[i][j];
		}
	}
	
	cout<<dp_func(v,0,0,n);
	
}



Measured memory_bytes: 822384
#include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mod 1000000007
// #define mod 998244353
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	ll t[n], a[n];
	ll cur_1, cur_2;
	for (int i = 0; i < n; i++)
	{
		cin >> t[i] >> a[i];
		if (i == 0)
		{
			cur_1 = t[0];
			cur_2 = a[0];
		}
		else
		{
			if (t[i] >= cur_1 && a[i] >= cur_2)
			{
				cur_1 = t[i];
				cur_2 = a[i];
			}
			else if (t[i] >= cur_1)
			{
				ll mult = cur_2 / a[i];
				if (a[i] * mult < cur_2)
				{
					mult++;
				}
				cur_1 = mult * t[i];
				cur_2 = mult * a[i];
			}
			else if (a[i] >= cur_2)
			{
				ll mult = cur_1 / t[i];
				if (t[i] * mult < cur_1)
				{
					mult++;
				}
				cur_1 = mult * t[i];
				cur_2 = mult * a[i];
			}
			else
			{
				ll mult = max(cur_1 / t[i], cur_2 / a[i]);
				if (t[i] * mult < cur_1 || a[i] * mult < cur_2)
				{
					mult++;
				}
				cur_1 = mult * t[i];
				cur_2 = mult * a[i];
			}
		}
	}
	cout << cur_1 + cur_2 << endl;
	return 0;
}

Measured memory_bytes: 3596