akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    char op;
     while(true){
       cin >> a >> op >> b;
       if ( op == '?' ){
           break;}
    else if (op == '+'){
        cout << (a+b) << endl; 
    }
    else if (op == '-'){
        cout << (a-b) << endl; 
    }
    else if (op == '*'){
        cout << (a*b) << endl; 
    }
    else if (op == '/'){
        cout << (a/b) << endl; 
    }
}
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vb vector<bool>
#define vd vector<double>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vs vector<string>
#define pull pair<ull, ull>
#define F first
#define S second
#define m_p make_pair
#define debug(x) cout << #x << " " << x << endl
#define printArr(a, start, end)for(int i=start ; i<end ; ++i)cout << a[i] << " ";cout << '\n';
#define readArr(a, start, end)for(int i=start ; i<end ; ++i)cin >> a[i];
#define read2D(mat, n, m)for(int i=0 ; i<n ; ++i)for(int j=0 ; j<m ; ++j)cin >> mat[i][j];

const long double PI = 3.141592653589793238462643383279502884197169399;

// Find Set LSB = (x&(-x)), isPowerOfTwo = (x & (x-1))

void solve(){
	int a, b, c;
	cin >> a >> b >> c;
	
	int k;
	cin >> k;
	
	int cnt=0;
	while(b <= a){
		b *= 2;
		cnt++;
	}
	while(c <= b){
		c *= 2;
		cnt++;
	}
	
	cout << (cnt <= k ? "Yes" : "No");
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int tt=1;
	//cin >> tt;
	
	while(tt--){
		solve();
	}
}


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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int x,y;
cin>>x>>y;
string ans="No";
rep(a,100){
    rep(b,100){
        if(2*a+4*b==y&&a+b==x){
            ans="Yes";
            cout<<ans<<endl;
            return 0;
        }
    }
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <iostream>
using namespace std;
int main() {
	int n,i;
	scanf("%d",&n);
	int p[n];
	for(i=0;i<n;i++){
		//printf("i=>%d\n",i);
		scanf("%d",&p[i]);
		//printf("i=>%d\n",i);
	}
	int max=-10;
	int max_index;
	for(i=0;i<n;i++){
		if(max<p[i]){
			max=p[i];
			max_index=i;
		}
	}
	int sum=0;
	for(i=0;i<n;i++){
		sum+=p[i];
	}
	sum-=max/2;
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
inline char nc() {
	return getchar();
	static char buf[100000], *l = buf, *r = buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x) {
	x = 0; int f = 1, ch = nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x *= f;
}
const int maxH = 2e5 + 5;
int H, W, N;
int mn[maxH];
int solve() {
	int mx = 0;
	for(int i = 1; i <= H; ++i) {
		if(mn[i] != mx + 1) ++mx;
		if(mx >= mn[i]) return i - 1;
	}
	return H;
}
int main() {
	read(H), read(W), read(N);
	for(int i = 1; i <= H; ++i) mn[i] = W + 1;
	for(int i = 1; i <= N; ++i) {
		int x, y; read(x), read(y);
		mn[x] = min(mn[x], y);
	}
	printf("%d\n", solve());
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MOD ((int)(1e9+7))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double

int ans=0;


int32_t main()
{
	IOS
	int r,c;cin>>r>>c;
	vector<string>A(r);
	for(int i=0;i<r;i++)cin>>A[i];
	vector<vector<int>>dp(r,vector<int>(c));
	
	dp[0][0]=1;
	for(int i=1;i<r;i++)
	{
		if(A[i][0]!='#')
		{
			dp[i][0]=dp[i-1][0];
		}
	}
	for(int j=1;j<c;j++)
	{
		if(A[0][j]!='#')
		{
			dp[0][j]=dp[0][j-1];
		}
	}
	for(int i=1;i<r;i++)
	for(int j=1;j<c;j++)
	{
		if(A[i][j]!='#')
		{
			dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
		}
	}
	cout<<dp[r-1][c-1]<<endl;
}
			
	
	
	
	
	

	

	

	
		


Measured memory_bytes: 9216
#pragma once
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  ll L,R;
  ll min = 999999999999999;
  cin >> L >> R;
  if (R > L + 2019) {
    R=L+2019;
  }
  for (ll i = L; i < R; i++) {
    for (ll j = i+1; j < R+1; j++) {
      dout << i << "-" << j << endl;
      if ((i * j) % 2019 < min) {
        dout << i << "/" << j <<endl;
        min = (i * j) % 2019;
      }
    }
  }
  cout << min;
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
  cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> vec;
vec.at(i)
vector<vector<int>> vec(10, vector<int>(10));
sort(all(vec));
sort(all(vec), greater<int>());
    //配列の内容表示
dout << "====vecの内容====\n";
for (int i = 0; i < N; i++) dout << vec[i] << endl;
dout << "====ここまで====\n";
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    int n;
    cin>>n;
    vector<int> a(n);
    int ans=0;
    for(int i=0;i<n;i++) cin>>a.at(i);
    for(int i=0;i<n;){
        if(a.at(i)%2==1) ans++;
        i+=2;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s; cin >> s;
  int a = s[0] - '0';
  int b = s[1] - '0';
  int c = s[2] - '0';
  int d = s[3] - '0';
  if (a+b+c+d==7) {cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;return 0;}
  if (a+b+c-d==7) {cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;return 0;}
  if (a+b-c+d==7) {cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;return 0;}
  if (a+b-c-d==7) {cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;return 0;}
  if (a-b+c+d==7) {cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7"<<endl;return 0;}
  if (a-b+c-d==7) {cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7"<<endl;return 0;}
  if (a-b-c+d==7) {cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7"<<endl;return 0;}
  if (a-b-c-d==7) {cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7"<<endl;return 0;}
  return 0;
}
  
  
  

  

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

int main(){
  int n;
  cin >> n;
  pair<int,int> a[n];
  int t;
  int ans=0;
  rep(i,n){
    cin >> t;
    a[i]=mp(t,i);
  }
  sort(a,a+n);
  rep(i,n) {
    if(a[i].second%2!=i%2) ans++;
  }
  
  cout << ans/2 << endl;
  
  return 0;

}


Measured memory_bytes: 1024
days = int(input())
price = list(map(int,input().split()))
money = 1000
stock = 0

for i in range(days - 1):
  if price[i] < price[i + 1]:
    new = (money // price[i])
    stock += new
    money -= (new * price[i])
    
  else:
    money += stock * price[i]
    stock = 0

print(money + stock * price[-1])

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

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var N = input[0];
            var R = input[1];

            Console.WriteLine(N >= 10 ? R : R + 100 * (10 - N));
            Console.ReadKey();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;
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 main() {
    int n;
    cin >> n;
    vector<ll>h(n);
    
    rep(i,n) cin >> h[i];
    ll cnt = 0;
    ll ans = 0;
    rep(i,n) {
        if(h[i]<h[i+1]) {
            cnt = 0;
        }    
        if(h[i]>=h[i+1]) cnt++;
        if(i==n-1) cnt--;
        ans = max(ans,cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>

int main(void){
  int n;
  int judge=0;
  int count=0;
  scanf("%d", &n);

  int a[n];
  for(int i=0;i<n;i++){
    scanf("%d", &a[i]);
  }

  for(int i=0; i<n; i++){
    judge=0;
    if(a[i]==2){
      count++;
    }
    else if(a[i]%2==0){

    }
    else{


      for(int j=3; j<=sqrt(a[i]); j+=2){
        if(a[i]%j==0){
          judge++;
        }
        if(judge==1){
          break;
        }
      }

      if(judge==0){
        count++;
      }
  }

  }
  printf("%d\n", count);
  return 0;

}



Measured memory_bytes: 2092
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  string S;
  cin >> S;
  int x = 0;
  int judge = 0;
  x = S.size();
  for(int i = 0;i < x;i++){
    //cout << i << S.at(i) << endl;
    if((i + 1)% 2 == 0){
      if(S.at(i) == 'R'){
        judge = 1;
        break;
      }
    }else{
      if(S.at(i) == 'L'){
        judge = 1;
        break;
      }
    }
  }

  if(judge == 1){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;

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

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

inline int gcd(int a, int b) { return (a%b == 0) ? b : gcd(b, a%b); }
inline int fac(int n) { return (n==0) ? 1 : n * fac(n - 1); }

int main() {
    int c[3][3];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }

    int b[3];
    int a[3];
    for (int i = 0; i < 3; i++) {
        b[i] = c[0][i];
    }

    a[1] = c[1][0] - c[0][0];
    a[2] = c[2][0] - c[0][0];
    for (int i = 1; i < 3; i++)
    {
        if (a[1] != c[1][i] - c[0][i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    for (int i = 1; i < 3; i++)
    {
        if (a[2] != c[2][i] - c[0][i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 3620
def tobit(n, ln)
  a = Array.new(ln)
  for i in 0..(ln-1)
    a[ln-1-i] = n / (2**(ln-1-i))
    n -= a[ln-1-i]*(2**(ln-1-i))
  end
  return a
end

INF = 999999999
n,m,x = gets.split.map(&:to_i)
a = Array.new(n).map{Array.new(m+1)}
for i in 0..(n-1)
  a[i] = gets.split.map(&:to_i)
end

ans = INF
for bit in 0..(2**n-1)
  b = tobit(bit, n)
  cnt = Array.new(m,0)
  cost = 0
  for i in 0..(n-1)
    if b[i] == 1
      for j in 1..m
        cnt[j-1] += a[i][j]
      end
      cost += a[i][0]
    end
  end
  flag = 1
  for i in 0..(m-1)
    if cnt[i] < x
      flag = 0
      break
    end
  end
  ans = [ans,cost].min if flag == 1
end
(ans < INF) ? (puts ans):(puts -1)

Measured memory_bytes: 14368
use std::io::Read;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let k: usize = iterator.next().unwrap().parse().unwrap();
    let mut a: Vec<usize> = Vec::new();
    let mut sum: usize = 0;
    for _ in 0..n {
        let ai: usize = iterator.next().unwrap().parse().unwrap();
        a.push(ai);
        sum += ai;
    }

    let mut kl = k;
    let mut logs: BinaryHeap<(usize, usize, usize)> = BinaryHeap::new();
    for i in 0..n {
        let ai = a[i];
        let l = ai * k / sum;
        logs.push(((ai + l) / (l + 1), ai, l + 1));
        kl -= l;
    }

    for _ in 0..kl {
        let mut log = logs.pop().unwrap();
        log.2 += 1;
        log.0 = (log.1 + log.2 - 1) / log.2;
        logs.push(log);
    }

    let ans = logs.pop().unwrap().0;
    ans.to_string()
}


Measured memory_bytes: 10292
N = int(input())
div4 = int(N/4) + 1
div7 = int(N/7) + 1

flg = False
for i in range(div4):
  sum = i * 4
  for t in range(div7):
    sum += t * 7
    if(N == sum):
      flg = True
      
      
if(flg):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
    ll int jhogeo = 1;
    rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
    return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}

int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int N; cin>>N;
  int a,b;
  b=N%100;
  a=(N-b)/100;
  int count5=0;
  int count4=0;
  int count3=0;
  int count2=0;
  int count1=0;
  while(1){
    count5=b/5;
    if(b==count5*5) break;
    b=b%5;
    
    count4=b/4;
    if(b==count4*4+count5*5) break;
       b=b%4;
    
        count3=b/3;

    if(b==count5*5+count4*4+count3*3) break;
        b=b%3;
        count2=b/2;
   
    if(b==count5*5+count4*4+count3*3+count2*2) break;
     b=b%2;
        count1=b/1;
    b=b%1;
     break;
  }
  if(a>=count5+count4+count3+count2+count1) cout<<1;
  else cout<<0<<endl;
  //cout<<a<<" "<<b<<" "<<count5;
    
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>

using namespace std;
const int INF = 1001001001;
#define rep(i,n) for(int i=0;i<n;i++)
int W,H;
int mod=100000;
int map[102][102][4];

int main(){
	while(1){
	scanf("%d %d",&W,&H);
	if(W==0&&H==0)break;
	fill(&map[0][0][0],&map[101][101][3],0);
	rep(i,W){
		rep(j,H){
			rep(k,4){
				if(i==0 || j==0){
					if(k==0&&i==0)map[i][j][k]=1;
					else if(k==2&&j==0)map[i][j][k]=1;
					else map[i][j][k]=0;
				}
					if(k==0){
						if(j!=H-1)map[i][j+1][0]+=map[i][j][k]%mod;
						if(i!=W-1)map[i+1][j][3]+=map[i][j][k]%mod;
					}else if(k==1){
						if(j!=H-1)map[i][j+1][0]+=map[i][j][k]%mod;
					}else if(k==2){
						if(i!=W-1)map[i+1][j][2]+=map[i][j][k]%mod;
						if(j!=H-1)map[i][j+1][1]+=map[i][j][k]%mod;
					}else if(k==3){
						if(i!=W-1)map[i+1][j][2]+=map[i][j][k]%mod;
					}
			}
		}
	}
	int ans=0;
	rep(i,4){ans+=map[W-1][H-1][i]%mod;}
	printf("%d\n",ans%mod);
	}
}

Measured memory_bytes: 1188
while true
  q = gets.chomp.to_f
  break if q < 0

  delta = 0.00001 * q
  x = q / 2

  while (d = x ** 3 - q).abs >= delta
    x = x - d / (3 * x * x)
  end

  printf("%.6f\n", x)
end

Measured memory_bytes: 6204
N, Y = map(int, input().split())

ans = [-1] * 3
for i in range(N+1): # 10000円
    for j in range(N+1 - i): # 5000円
        if i * 10000 + j * 5000 + ( N - i - j) * 1000 == Y:
            ans[0] = i
            ans[1] = j
            ans[2] = N - i - j
print(" ".join(map(str, ans)))

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

int ct[26];
int n, m;

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < m; ++j) {
			char x;
			cin >> x;
			ct[x-'a']++;
		}

	int a4 = 0, a2 = 0, a1 = 0;
	a4 = (n/2)*(m/2);
	a2 = (n%2)*(m/2) + (m%2)*(n/2);
	a1 = (n%2)*(m%2);

	if (a1 == 1) {
		for (int i = 0; i < 26; ++i) {
			if (ct[i]%2 == 1) {
				ct[i]--;
				break;
			}
		}
	}

	for (int i = 0; i < 26; ++i) {
		if (ct[i]%2 == 1) {
			cout << "No\n";
			return 0;
		}
	}

	int k = 0;
	for (int i = 0; i < 26; ++i)
		k += ((ct[i]%4) == 2);

	if (k <= a2)
		cout << "Yes\n";
	else
		cout << "No\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

int main()
{
	int n, m;
	cin >> n >> m;
	vector<vector<int> > mem(m);
	int a, b;
	rep(i, n)
	{
		cin >> a >> b;
		if(a > m) continue;
		mem[m-a].push_back(b);
	}

	priority_queue<int> que;
	ll sum = 0;
	for(int i = m-1; i >= 0; i--)
	{
		for(int u : mem[i]) que.push(u);
		if(!que.empty())
		{
			sum += que.top();
			que.pop();
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

signed main()
{
    int n;
    cin >> n;
    vector<double> v(n);
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    double sum = (v[0] + v[1]) / 2;
    for (int i = 2; i < n; i++)
    {
        sum = (sum + v[i]) / 2;
    }
    cout << sum << "\n";
}

Measured memory_bytes: 256
#n = int(input())
#a = int(input())
#ls = list(input().split(" "))
#ls = list(map(int,input().split(" ")))
a,b,c,d = list(map(int,input().split(" ")))
#a,b,c = list(input().split())
#string = input()

if a * b >= c * d:
  print(a * b)
else:
  print(c * d)

Measured memory_bytes: 2940
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-12;


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

	int N;
	cin >> N;
	int x = 0;
	while (N--) {
		int a, b;
		cin >> a >> b;
		while (a%b&&a>b) {
			int amari = a % b;
			int by = max(1, amari / (a / b + 1));
			a -= (a / b + 1)*by;
		}
		x ^= a / b;
	}
	if (x == 0) {
		cout << "Aoki\n";
	}
	else {
		cout << "Takahashi\n";
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int vis[111],G[111][111],cn,n,d[111];
int  bfs(int i){
  	queue<int>q;
  	q.push(i);
  	vis[i]=1;
	while(!q.empty()){
		int temp=q.front();
		vis[temp]=1;
		q.pop();
		for(int j=1;j<=n;j++){
			if(vis[j]==0&&G[temp][j]!=0){
				d[j]=d[temp]+1;
				vis[j]=1;
				q.push(j);
			}
		}
	}  
}

int main(){
    scanf("%d",&n);
	for(int i=1;i<=n;i++){	
	int v2,v1,k;
		scanf("%d%d",&v1,&k);
		for(int j=0;j<k;j++){
			scanf("%d",&v2);
			G[v1][v2]=1;
		}
}
    bfs(1);
    for(int i=1;i<=n;i++) {
    	if(i==1)
    	printf("%d %d\n",i,d[i]);
    	else if(d[i]==0){
    			printf("%d %d\n",i,-1);
		} 
		else printf("%d %d\n",i,d[i]);
	}
	 
	 return 0;
}
 


Measured memory_bytes: 3264
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

#define ll long long int
#define pb push_back
#define RONALDO            \
  ios::sync_with_stdio(0); \
  cin.tie(0);              \
  cout.tie(0);
#define endl "\n"
#define pii pair<ll, ll>
#define ff first
#define ss second
#define mod 1000000007
#define vi vector<ll>
#define mi map<ll, ll>
#define Max(x, y, z) max(x, max(y, z))
#define Min(x, y, z) min(x, min(y, z))
const int N = 1e5 + 5;
//LOVE U MESSI && CRistiano !!

//INSPIRATIONAL MICHAEL PHELPS && USAIN BOLT !!

int main()
{
  RONALDO;
  // ll t;
  // cin >> t;
  // while (t--)
  // {
  ll n, p=1,q=1,r=1;
  cin >> n;
  ll ans;
  for (ll j = 0; j < n; j++)
  {
    p = ((p%mod) * 10)%mod;
    q = ((q%mod) * 9)%mod;
    r = ((r%mod) * 8)%mod;
  }
  ans= (p%mod - (2*q)%mod + r%mod)%mod;
  if(ans<0)
    cout << ans%mod + mod << endl;
  else
    cout << ans%mod<< endl;
  }

Measured memory_bytes: 3668
#include <iostream>
#include <algorithm>
using namespace std;
 
long long num[200010];
int main()
{
    ios::sync_with_stdio(false);
    int n;
    long long x;
    cin>>n;
    
    for(int i=0;i<n;i++)
    {
        cin>>x;
        num[i]=x-(i+1);
    }
    sort(num,num+n);
    int p=n/2;
    long long ans=0;
    long long t=num[p];
    for(int i=0;i<n;i++)
    {
        ans+=abs(num[i]-t);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

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

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;

fn main() {
    let n:i32 = read();

    let mut ans:i32 = 0;
    for i in 1..n+1 {
        if i%2==0 {continue;}
        let mut cnt:i32 = 0;
        for j in 1..i+1 {
            if i%j==0 {cnt+=1;}
        }
        //debug!(i,cnt);
        if cnt==8 {ans+=1;}
    }

    println!("{}", ans);

}


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

int main()
{
  long n, d, x, y, sum = 0;
  cin >> n >> d;
  for(int i = 0; i < n; i++)
  {
    cin >> x >> y;
    if(sqrt(x*x + y*y) <= d)
      sum++;
  }
  
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <unordered_map>
#include <utility>
#include <map>
#include <set>
using namespace std;

int main(){
    long long int n, m;
    long long int a, b;
    cin >> n >> m;
    long long int i, j;
    long long int count = 0;
    map<long long int, long long int> s;
    b = 0;
    s[0] = 1;
    
    j = 0;
    for(i = 0; i < n; i++){
        cin >> a;
        b += a;
        b %= m;
        count += s[b]++;
    }
    
    cout << count << endl;
}

Measured memory_bytes: 4224
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <iomanip>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;


int main(){
    ll m,n;
    cin >> m >> n;

    ll ans = 1;
    while(n > 0){
        if(n&1) ans = ans*m %MOD;
        m = m*m%MOD;
        n >>= 1;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

#define INF 1e9
#define LLINF 1e18
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;


int main() {
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> l(q);
    vector<int> r(q);
    rep(i, q) {
        cin >> l.at(i) >> r.at(i);
    }
    vector<int> sum(n + 1);
    rep(i, n - 1) {
        sum.at(i + 1) = sum.at(i);
        if (s.at(i) == 'A' && s.at(i + 1) == 'C') {
            sum.at(i + 1)++;
        }
    }
    vector<int> ans(q);
    rep(i, q) {
        ans.at(i) = sum.at(r.at(i) - 1) - sum.at(l.at(i) - 1);
        cout << ans.at(i) << endl;
    }
}

Measured memory_bytes: 2688
//math.hをインクルード
#include <stdio.h>
#include <math.h>

int main(void)
{
	//rは半径、areaは面積、circuitは円周
	double r, area, circuit;

	scanf("%lf", &r);

	//M_PIは定数π
	area = M_PI * (r * r);
	circuit = 2 * M_PI * r;

	printf("%f %f", area, circuit);

	return 0;
}


Measured memory_bytes: 2104
#include<stdio.h>
#define max 100000
#define sen 2000000000

struct Card{
  char s;
  int v;
};

struct Card L[max/2+2], R[max/2+2];

void merge(struct Card A[], int n, int left, int mid, int right){
  int i, j, k;
  int n1=mid-left;
  int n2=right-mid;
  for(i=0 ; i<n1 ; i++)L[i]=A[left+i];
  for(i=0 ; i<n2 ; i++)R[i]=A[mid+i];
  L[n1].v=R[n2].v=sen;
  i=j=0;
  for(k=left ; k<right ; k++){
    if(L[i].v<=R[j].v){
      A[k]=L[i++];
    }else{
      A[k]=R[j++];
    }
  }
}

void mergeSort(struct Card A[], int n, int left, int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int partition(struct Card A[], int n, int p, int r){
  int i, j;
  struct Card t, x;
  x=A[r];
  i=p-1;
  for(j=p ; j<r ; j++){
    if(A[j].v<=x.v){
      i++;
      t=A[i];
      A[i]=A[j];
      A[j]=t;
    }
  }
  t=A[i+1];
  A[i+1]=A[r];
  A[r]=t;
  return i+1;
}

void quickSort(struct Card A[], int n, int p, int r){
  int q;
  if(p<r){
    q=partition(A, n, p, r);
    quickSort(A, n, p, q-1);
    quickSort(A, n, q+1, r);
  }
}

int main(){
  int n, i, v;
  struct Card A[max], B[max];
  char S[10];
  int sta=1;
  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    scanf("%s%d",S, &v);
    A[i].s=B[i].s=S[0];
    A[i].v=B[i].v=v;
  }
  mergeSort(A, n, 0, n);
  quickSort(B, n, 0, n-1);
  for(i=0 ; i<n ; i++){
    if(A[i].s!=B[i].s)sta=0;
  }
  if(sta==1)printf("Stable\n");
  else printf("Not stable\n");
  for(i=0 ; i<n ; i++){
    printf("%c %d\n",B[i].s, B[i].v);
  }
  return 0;
}




Measured memory_bytes: 4008
#include <bits/stdc++.h>
#pragma GCC optimize("O999")
//示例：#define ll long long
//unsigned long long ;
const int INF=0x3f3f3f3f;
const int maxn=50000005;
using namespace std;

int main(){
	//freopen(".in", "r",stdin );
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(0);
	int k, a, b, x;
	cin >> k >> a >> b;
	x=k;
	while(k<=b){
		if(k>=a && k<=b){
			cout<<"OK"<<endl;
			return 0;
		}
		k+=x;
	}
	cout<<"NG"<<endl;
	return 0;
}

Measured memory_bytes: 3692
import numpy as np
from numpy.fft import rfft, irfft
import sys
input=sys.stdin.readline

N, M = map(int, input().split())
fft_len = 1<<18
MAX = 2*10**5
A = np.zeros(fft_len)
for a in [int(x) for x in input().split()]:
    A[a] += 1
F = rfft(A, fft_len)
f = np.rint(irfft(F*F))
n, ans = 0, 0
for i, c in enumerate(f[:MAX+1][::-1]):
    if M < n+c:
        ans += (M-n)*(MAX-i)
        break
    ans += c*(MAX-i)
    n += c
print(int(ans))


Measured memory_bytes: 30080
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
int main()
{
    string s;
    int a,b,c,d;
    cin>>s;
    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';
    if(a+b+c+d==7){
        printf("%d+%d+%d+%d=7\n",a,b,c,d);
        return 0;
    }
    if((a+b+c+d)==7){
        printf("%d+%d+%d+%d=7\n",a,b,c,d);
        return 0;
    }
    if((a+b+c-d)==7){
        printf("%d+%d+%d-%d=7\n",a,b,c,d);
        return 0;
    }if((a+b-c+d)==7){
        printf("%d+%d-%d+%d=7\n",a,b,c,d);
        return 0;
    }if((a+b-c-d)==7){
        printf("%d+%d-%d-%d=7\n",a,b,c,d);
        return 0;
    }if((a-b+c+d)==7){
        printf("%d-%d+%d+%d=7\n",a,b,c,d);
        return 0;
    }if((a-b+c-d)==7){
        printf("%d-%d+%d-%d=7\n",a,b,c,d);
        return 0;
    }if((a-b-c+d)==7){
        printf("%d-%d-%d+%d=7\n",a,b,c,d);
        return 0;
    }
    if((a-b-c-d)==7){
        printf("%d-%d-%d-%d=7\n",a,b,c,d);
        return 0;
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int a[510][510];

int main(){
    int n,m,Q;
    cin>>n>>m>>Q;
    vector<vector<int>> a(n,vector<int>(n));
    rep(i,m){
        int l,r;
        cin>>l>>r;
        l--,r--;
        a[l][r]++;
    }

    vector<vector<int>> s(n+1,vector<int>(n+1,0));

    rep(i,n){
        rep(j,n){
            s[i+1][j+1]=s[i][j+1]+s[i+1][j]-s[i][j]+a[i][j];
        }
    }
    
    while(Q--){
        int p,q;
        cin>>p>>q;
        p--;
        cout<<s[q][q]-s[p][q]-s[q][p]+s[p][p]<<endl;
    }
}


Measured memory_bytes: 2944
import Foundation

let n = Int(readLine()!)!
var ac = 0
var wa = 0
var tle = 0
var re = 0
for i in 1...n{
  let a = readLine()!
  if(a == "AC"){
    ac += 1
  }else if(a == "WA"){
    wa += 1
  }else if(a == "TLE"){
    tle += 1
  }else{
    re += 1
  }
}
print("AC x \(ac)")
print("WA x \(wa)")
print("TLE x \(tle)")
print("RE x \(re)")

Measured memory_bytes: 13272
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};


int main(){
    int N;
    cin >> N;
    set<char> st;
    rep(i,N) {
	char s;
	cin >> s;
	st.insert(s);
    }
    int sz = st.size();
    if(sz == 4) cout << "Four" << endl;
    else cout << "Three" << endl;
    return 0;
}



Measured memory_bytes: 3624
import numpy as np
n = int(input())
a=list(map(int,input().split()))
a_np = np.asarray(a)
cnt=0
frag = True
while frag:
    if np.all(a_np%2 == 0):
        a_np = a_np / 2
        cnt +=  1
    else:
        frag = False
print(cnt)

Measured memory_bytes: 12508
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-9)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;
const long long inf = 1e12;



int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
	int r;
	cin >> r;
	cout << r * r;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM + 7
#define MAX 10100000
#define INF 1e15
#define MAP 110
#define initial_value -1
#define LINF 1LL << 60
#define Pair pair<int, int>
#define chmax(a, b) (a < b ? a = b : 0)
#define chmin(a, b) (a > b ? a = b : 0)
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
ll A[100100], B[100100];
vector<pa> PP;
int main()
{
    ll N, M;
    cin >> N >> M;
    for (ll i = 0; i < N; i++)
    {
        cin >> A[i] >> B[i];
        PP.push_back(make_pair(A[i], B[i]));
    }
    sort(PP.begin(), PP.end());
    ll m = M;
    ll ans = 0;
    for (ll i = 0; i < N; i++)
    {
        if (PP[i].second < m)
        {
            m -= PP[i].second;
            ans += PP[i].first * PP[i].second;
        }
        else {
            ans += m * PP[i].first;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	constexpr int INF = 1e9 + 10;
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; ++i) { cin >> a[i]; }
	vector<vector<int>> g(N);
	for (int i = 0; i < N - 1; ++i) {
		int u, v;
		cin >> u >> v;
		--u; --v;
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}

	vector<int> ans(N, 0);
	vector<int> dp(N, INF);
	dp[0] = a[0];
	auto dfs = [&](auto&& dfs, int u, int par) -> void {
		ans[u] = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();
		for (auto v : g[u]) {
			if (v == par) { continue; }
			int idx = lower_bound(dp.begin(), dp.end(), a[v]) - dp.begin();
			int tmp = dp[idx];
			dp[idx] = a[v];
			dfs(dfs, v, u);
			dp[idx] = tmp;
		}
		return;
	};

	dfs(dfs, 0, -1);
	for (auto v : ans) { cout << v << endl; }

	return 0;
}


Measured memory_bytes: 30856
open System
open System.IO

let readInt () = int (Console.ReadLine())
let readInts () = (Console.ReadLine().Split(' ')) |> (Array.map int)

let read2Ints () = 
    let t = readInts()
    (t.[0], t.[1]) 
let read3Ints () = 
    let t = readInts()
    (t.[0], t.[1], t.[2]) 

let inf = 1000000000

let manhattan (x, y) (z, w) = abs(x-z) + abs(y-w)
  


[<EntryPoint>]
let main args = 
    let n,m = read2Ints()
    let s = [|for i in 1..n -> read2Ints() |]
    let p = [|for i in 1..m -> read2Ints() |]

    for i=1 to n do
        let mutable a=inf
        let mutable b=0
        for j=1 to m do
            let t = manhattan s.[i-1] p.[j-1]
            if a > t then
                a <- t
                b <- j
        done
        printfn "%d" b
    done
    0



Measured memory_bytes: 12240
# Contest No.: ABC171
# Problem No.: D
# Solver:      JEMINI
# Date:        20200621

import sys
import heapq

def main():
    n = int(input())
    nums = list(map(int, sys.stdin.readline().split()))
    cntList = [0] * (10 ** 5 + 1)
    for i in range(n):
        cntList[nums[i]] += 1
    sumVal = sum(nums)
    q = int(input())
    for _ in range(q):
        b, c = map(int, sys.stdin.readline().split())
        sumVal -= cntList[b] * b
        sumVal += cntList[b] * c
        cntList[c] += cntList[b]
        cntList[b] = 0
        print(sumVal)

    return

if __name__ == "__main__":
    main()

Measured memory_bytes: 84332
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Iterator;
import java.util.Collections;
import java.util.Comparator;

class Numbers{
        private int N;
        ArrayList<Integer> X = new ArrayList<Integer>();
        ArrayList<Integer> Y = new ArrayList<Integer>();
        Numbers(int n){ this.N = n; }

        //Scanner scan = new Scanner(System.in);

        public void setX(int x){
                this.X.add(x);
                this.Y.add(x);
        }
        public void sortY(){
                Collections.sort(this.Y);
        }

        public void checkY(){
                System.out.println("--- check Y ---");
                for(int i=0;i<this.getN();i++){
                        System.out.println(this.Y.get(i));
                }
                System.out.println("---------------");
        }

        public void Bi(){
                for(int i=0; i<this.getN(); i++){
                        if(this.X.get(i) > this.Y.get(this.getN() / 2 - 1)){
                                System.out.println(this.Y.get(this.getN() / 2 - 1));
                        }else{
                                System.out.println(this.Y.get(this.getN() / 2));
                        }
                }
        }
        public int getN(){ return this.N; }
}

class Main{
        public static void main(String args[]){
                Scanner scan = new Scanner(System.in);
                int N = scan.nextInt();
                Numbers numbers = new Numbers(N);
                for(int i=0;i<N;i++){
                        numbers.setX(scan.nextInt());
                }
                numbers.sortY();
                //numbers.checkY();
                numbers.Bi();
        }
}


Measured memory_bytes: 98660
#include <bits/stdc++.h>
using std::cout;
using std::endl;
using std::cin;

int main(){
	int n; cin >> n; std::set<int> st;
	for(int i = 0; i < n; i++){
		int a; cin >> a;
		
		if(st.count(a)) st.erase(a);
		else st.insert(a);
	}	
	
	cout << st.size() << endl;
	return 0;
}


Measured memory_bytes: 4864
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,a,b,c,d,k,DATA[101][101];
  for(int i=0;i<101;i++){
    for(int j=0;j<101;j++){
      DATA[i][j]=1000000;
    }
  }

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a >> k;
    for(int j=0;j<k;j++){
      cin >> b;
      DATA[a][b]=1;
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      for(k=1;k<=n;k++){
	if(DATA[j][k]>DATA[j][i]+DATA[i][k]){
	  DATA[j][k] = DATA[j][i]+DATA[i][k];
	}
      }
    }
  }
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a >> b >> c;
    if(DATA[a][b]>=c) cout << "NA" << endl;
    else cout << DATA[a][b]+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1204
#include<iostream>

using namespace std;

int main()
{
  long long n,a,b,c;
  cin>>n;
  int num[n];

  for(int i=0;i<n;i++)
  cin>>num[i];

  a=num[0];b=num[0];c=0;

  for(int i=0;i<n;i++){
    if(a>num[i])
      a=num[i];}

   for(int i=0;i<n;i++){
    if(b<num[i])
      b=num[i];}

  for(int i=0;i<n;i++)
    c+=num[i];

  cout<<a<<" "<<b<<" "<<c<<endl;
  return 0;
}

  


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

int main() {
	int n;
	cin >> n;
	vector<int> w(n);
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> w.at(i);
		sum += w.at(i);
	}

	int ans = 1000000000;
	for (int i = 1; i < n; i++) {
		int a = 0;
		for (int j = 0; j < i; j++) {
			a += w.at(j);
		}
		ans = min(ans, abs((sum - a) - a));
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 1000000007
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}


ll fu(ll x)
{
	ll q=__builtin_popcount(x);
	return q;
}

int main()
{
	
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// cout<"hello";
	IOS;
	ll ans[200001];
	ll temp[200001];
	rep(i,0,200001)
	temp[i]=fu(i);
	for(int i=1;i<=200000;i++)
	{
		ll p=i;
		ll c=0;
		while(p!=0)
		{
			c++;
			p=p%temp[p];
		}
		ans[i]=c;	
	}
	int n;
	cin>>n;
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	int co=0;
	rep(i,0,s.size())if(s[i]=='1')co++;
	ll pp1=0,pp2=0;
	rep(i,0,(int)s.size())
	{
		if(s[i]=='1')
        {
    
          ll tt1=power(2,i,co+1),tt2;
          if(co-1)
           tt2=power(2,i,co-1);
          else
          tt2=0;
          pp1=(pp1+tt1)%(co+1);
          if(co-1)
          pp2=(pp2+tt2)%(co-1);
        }
      
	}
	for(int i=s.size()-1;i>=0;i--)
	{
		ll qq;
		if(s[i]=='0')
		{
          	qq=pp1;
			qq=(qq+power(2,i,co+1))%(co+1);
			cout<<ans[qq]+1<<endl;
		}
		else
		{
          	if(co-1==0)
              cout<<0<<endl;
            else
            {
              qq=pp2;
              ll tt=power(2,i,co-1);
              qq=(qq-tt+co-1)%(co-1);
            //   cout<<qq<<" ";
              cout<<ans[qq]+1<<endl;
            }
		}
	
    }
}


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

int main(void){

    string S; cin>>S;
    int cnt=0;
    for (int i = 0; i < 3; ++i) {
        if(S[i]=='1') {
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

struct node {
  int c, l, r;
};

struct node t[10000];

void pre(int r) {
  if (r == -1)  return;
  printf(" %d", r);
  pre(t[r].l);
  pre(t[r].r);
}

void in(int r) {
  if (r == -1)  return;
  in(t[r].l);
  printf(" %d", r);
  in(t[r].r);
}

void post(int r) {
  if (r == -1)  return;
  post(t[r].l);
  post(t[r].r);
  printf(" %d", r);
}

int main() {
  int n, c, r, l, i, root;
  scanf("%d", &n);
  for (i = 0; i < n; i++) t[i].c = -1;
  for (i = 0; i < n; i++) {
    scanf("%d %d %d", &c, &l, &r);
    t[c].l = l;
    t[c].r = r;
    if (l != -1) t[l].c = c;
    if (r != -1) t[r].c = c;
   }

   for (i = 0; i < n; i++) {
     if (t[i].c == -1)  root = i;
   }

   printf("Preorder\n");
   pre(root);
   putchar('\n');
   printf("Inorder\n");
   in(root);
   putchar('\n');
   printf("Postorder\n");
   post(root);
   putchar('\n');

   return 0;
}



Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int MAX=510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        //???
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}


//n!
ll fact_mod(ll n) {
    ll ret=1; 
    for(ll i=2;i<=n;i++) ret=ret*(i%mod)%mod;
    return ret;
}
 
// 繰り返し二乗法 
ll pow_mod(ll x, ll n){
    if(n==0) return 1;
    ll ret=pow_mod((x*x) % mod, n/2);
    if(n&1) ret=(ret*x)%mod;
    return ret;
}
 
//nCr O(r) nがでかくても安心
ll combination_mod(ll n, ll r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    ll a=1;
    //a=n!/(n-r)!=n~n-r+1までの総積->O(r)
    for(ll i=0;i<r;i++) a=a*((n-i)%mod)%mod;
    //b=inv(r!)
    ll b=pow_mod(fact_mod(r), mod-2);
    return (a%mod)*(b%mod)%mod;
}
 
ll inv_mod(ll n){
    // フェルマーの小定理
    return pow_mod(n,mod-2);
}

map<ll,ll> PrimeFactor(ll n){
    map<ll,ll> ret;
    for(ll i=2;i*i<=n;i++){
        while(n%i==0){
            ret[i]++;
            n/=i;
        }
    }
    if(n!=1) ret[n]=1;
    return ret;
}

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

    //COMinit();


    ll n;cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    map<ll,ll> ps;

    rep(i,n){
        auto mp=PrimeFactor(a[i]);
        for(auto x:mp){
            if(ps.count(x.first)){
                if(ps[x.first]<x.second)ps[x.first]=x.second;
            }
            else{
                ps[x.first]=x.second;
            }
        }
    }
    ll l=1;
    for(auto x:ps){
        l=l*pow_mod(x.first,x.second)%mod;
    }
    ll ans=0;
    rep(i,n){
        ll b=l*inv_mod(a[i])%mod;
        ans+=b;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<set>
using namespace std;
int main() {
  int a,b,k; cin >> a >> b >> k;
  set<int>st;
  for(int i=a;i<=a+k-1;i++){
    if(i<=b) st.insert(i);
  }
  for(int i=b;i>=b-k+1;i--){
    if(i>=a) st.insert(i);
  }
  for(auto it=st.begin();it!=st.end();++it) cout << *it << endl;
  return 0;
}

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

int main() {
    string s;
    cin >> s;
    bool istrue = false;
    for(int i = 0; i < s.size() - 1; i++) {
        if(s[i] == s[i + 1]) {
            istrue = true;
            break;
        }
    }
    if(istrue) {
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }
}


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

namespace ABC166
{
    class E
    {
        static void Main(string[] args)
        {
            var N = long.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(long.Parse).ToArray();

            var ans = 0L;
            Dictionary<long, long> dictL = new Dictionary<long, long>();
            //Dictionary<long, long> dictR = new Dictionary<long, long>();

            for (long i = 0; i < N - 1; i++)
            {
                if (!dictL.ContainsKey(i + A[i])) dictL.Add(i + A[i], 1);
                else dictL[i + A[i]]++;
            }

            for (long i = 1; i < N; i++)
            {
                if (dictL.ContainsKey(i - A[i])) ans += dictL[i - A[i]];
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 57636