akhauriyash/Code-Regression huggingface dataset:
def examA():
    A, op, B = LS()
    if op=="+":
        ans = int(A) + int(B)
    elif op=="-":
        ans = int(A) - int(B)
    print(ans)



import sys
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Measured memory_bytes: 3316
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <memory>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define DEB(variable) cout << #variable << '=' << variable << endl

#define FOR(LoopVariable, numberOFbegin, numberOFend) for(long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable, numberOFbegin, numberOFend) for(long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable, numberOFend) for(long long int LoopVariable = 0; (LoopVariable) < (numberOFend); LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max() - 5;
constexpr long long int inf = numeric_limits<int>::max() - 5;
constexpr long long int mod = 1000000007;

class Graph {
   public:
    ////////////グラフサイズを渡して作成する
    ////////////infの値は必要に応じて調整すること
    Graph(long long int n) : g_size(n), edges(n, vector<long long int>()), black(n, 0ll), white(n, 0ll) {
      
    }

    //////////// 枝のvector<>をわたして作成
    //////////// infの値は必要に応じて調整すること
    Graph(long long int n, vector<pair<long long int, long long int>> v) : g_size(n), edges(n, vector<long long int>(n, inf)) {
        REP(i, g_size) {
            edges[i][i] = 0;
        }
        REP(i, v.size()) {
            add_edge(v[i].first, v[i].second);
        }
    }

    ///////////初期状態では有向
    ///////////無向にするときは
    /*  edges[b][a] = cost;  */
    //を追加
    void add_edge(long long int a, long long int b, long long int cost = 1) {
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    llint solve() {
        search(0, -1);
        return ( black[0] + white[0]+ mod) % mod;
    }

   void search(llint now, llint parent) {
        black[now] = 1;
        white[now] = 1;
        for(auto x : edges[now]) {
            if(x==parent){
                continue;
            }
            search(x, now);
            black[now] = (white[x] * black[now]) % mod;
            white[now] = ((white[x]+black[x]) * white[now]) % mod;
        }
        if(now == 0){
            return ;
        }else{
            return ;
        }
    }

   private:
    long long int g_size;
    vector<vector<long long int>> edges;
    vector<llint> black, white;
};

int main() {
    llint n;
    cin >> n;
    Graph graph(n);
    llint tmpa, tmpb;

    REP(i, n - 1) {
        cin >> tmpa >> tmpb;
        graph.add_edge(tmpa - 1, tmpb - 1);
    }
    cout << graph.solve() << endl;
    return 0;
}


Measured memory_bytes: 12800
n = int(input())
a = list(map(int,input().split()))
a.sort()
arr= []
count = 0
for i in range(len(a)):
    if a[i] == a[i-1]:
        arr.append(a[i])
        count += 1
if n-count-(count%2) <= 0:
    print(1)
else:
    print(n-count-(count%2))

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
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;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
// include  long long func(long long)
// V a;
/*
ll func(ll terget) {
    ll res = 0LL;
    repi(itr, a) { res += ((*itr) + terget - 1) / terget - 1; }
    return res;
}
*/
// binarlyscearch
// return ->[0]-, [1]+
//評価関数が小さい者が最初、大きくなるのは最後
vector<pair<long long, long long>> BScearch(
    long long start, long long stop, long long terget,
    function<long long(long long)> det) {
	vector<pair<long long, long long>> tmp = {make_pair(start, 0LL),
	                                          make_pair(stop, INFLL)};
	pair<long long, long long> mid;
	while (abs(tmp[0].first - tmp[1].first) > 1) {
		mid.first  = tmp[0].first + (tmp[1].first - tmp[0].first) / 2;
		mid.second = det(mid.first);
		if (mid.second > terget) {
			tmp[1] = mid;
		} else {
			tmp[0] = mid;
		}
	}
	return tmp;
}
int main() {
	int n;
	ll k;

	cin >> n >> k;
	// a.assign(n, 0LL);
	V a(n);
	ll up = 0LL;
	rep(i, n) {
		cin >> a[i];
		chmax(up, a[i]);
	}
	function<ll(ll)> func = [=](ll ter) {
		ll res = 0LL;
		repi(itr, a) { res += ((*itr) + ter - 1) / ter - 1; }
		return res;
	};

	VP ans = BScearch(up, 0LL, k, func);
	clog << ans[0].F << " " << ans[0].S << endl;
	clog << ans[1].F << " " << ans[1].S << endl;
	cout << ans[0].F << endl;
}

Measured memory_bytes: 8016
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n; cin >> n;
	int a[100000];
	int cnt = 0;
	rep(i, n) {
		cin >> a[i];
	}
	ll res = 1;
	rep(i, n) {
		if (a[i]<2*(i-cnt)+1) {
			res = res * (ll)(i + 1 - cnt) % MOD;
			cnt++;
		}
	}
	for (ll i = 2; i <= (ll)(n - cnt); i++) {
		res = res * i%MOD;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const int mod = 1e9+7;

int main(){
  deque<char> de;
  string s;
  cin >> s;
  rep(i,s.size()){
    if(s[i] == '0' || s[i] == '1') de.push_back(s[i]);
    else if(!de.empty()) de.pop_back();
  }
  while(!de.empty()){
    cout << de.front();
    de.pop_front();
  }
  cout << endl;

}



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

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}


vector<int>a,c;
int n,k;
bool chk(int lim)
{
    int baki=k;
    f(i,0,n-1)
    {
        int val=c[i]*a[i];
        if(val<=lim)continue;
        int p=(a[i]*c[i]-lim+c[i]-1)/c[i];
        if(p<=baki)
        {
            baki-=p;
        }
        else
        {
            return false;
        }

    }
    return true;
}
 main()

{
    fast
    cin>>n>>k;
    a.resize(n);
    c.resize(n);
    f(i,0,n-1)
    {
        cin>>a[i];
    }
    f(i,0,n-1)
    {
        cin>>c[i];
    }
    sort(a.begin(),a.end());
    sort(c.begin(),c.end());
    reverse(c.begin(),c.end());
    int lo=0,hi=a[n-1]*c[0];
    int ans=hi;
    while(hi-lo>=2)
    {
        int mid=(lo+hi)>>1LL;
        if(chk(mid))
        {
            hi=mid;
        }
        else
        {
            lo=mid+1;
        }
    }
    f(i,lo,hi)
    {
        if(chk(i))
        {
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(void){
    int A, B, max;
    
    scanf("%d %d", &A, &B);
    
    if(A-B< A+B) max = A+B;
    else max = A - B;
    
    if(max < A*B) max = A * B;
    
    printf("%d \n", max);
    
    return 0;
}


Measured memory_bytes: 128
import sys
from collections import Counter
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
A_counters = Counter(A)
A.sort()
A_set = set(A)
ans = 0
for a in A:
    if a in A_set:
        if A_counters[a] == 1:
            ans += 1
        for i in range(1, A[-1] // a + 1):
            if a * i in A_set:
                A_set.remove(a * i)
print(ans)

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

int main(){
    long long N;
    cin >> N;
    long long val[100001];
    long long i,j;
    for(i=1; i<=100000; i++){
        val[i]=0;
    }
    long long A;
    long long S=0;
    for(i=1; i<=N; i++){
        cin >> A;
        val[A]++;
        S+=A;
    }
    
    long long Q;
    cin >> Q;
    long long B,C;
    for(i=1; i<=Q; i++){
        cin >> B >> C;
        S+=C*val[B];
        S-=B*val[B];
        val[C]+=val[B];
        val[B]=0;
        cout << S << endl;
    }
    system("pause");
    return 0;
}

Measured memory_bytes: 4472
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
int ans=0;
struct UnionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
    for(int i=0;i<n;i++) par[i] = i;
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // 既に同じ木に属しているならマージしない
    if (x == y) return;

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
  }

  // 2つのデータx, yが属する木が同じならtrueを返す
  bool same(int x, int y) {
    return find(x) == find(y);
  }

  // データxが含まれる木の大きさを返す
  int size(int x) {
    return sizes[find(x)];
  }
};
void Main(){
    int n, m;
    cin >> n >> m;
    UnionFind Tree(n);
    For(i,0,m){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        Tree.unite(a, b);
    }
    For(i,0,n){
        ans = max(ans, Tree.size(i));
    }
    cout << ans << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
#define D(x) cout<<#x<<" = "<<x<<endl;
#define mx 100000

int n, a, b, c, d;
int arr[mx+2];

void solve()
{
    int x = 0, total=0;
    while(1){
        x++;
        total+=n;
        total%=360;
        if(!total) break;
    }
    cout<<x<<endl;

}


int main(){
    cin>>n;
    solve();
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}

map<ll,ll> dp;

ll saiki(ll x){
  if(x==1) return 1;
  if(dp[x] != 0) return dp[x]; 
  return dp[x] = 1 + saiki(x/2) * 2;
}

int main(){
  ll H;
  cin >> H;
  ll ans = 0;
  ans = saiki(H);

  cout << ans << endl;


}

Measured memory_bytes: 256
//コンパイラ最適化用
#pragma GCC optimize("O3")
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

signed main(){
  double d, t, s, ans;
  cin >> d >> t >> s;
  ans = d / s;
  if(ans <= t)
    cout << "Yes";
  else
    cout << "No";
}



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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef long double ld ;

const ll MOD = 998244353, INF = 2E18 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

int dp[3005][3005] ;
string s, t ;

int check(int posN, int posM)
{
    if (posN == 0 or posM == 0)   return 0 ;
    if (dp[posN][posM] != -1)   return dp[posN][posM] ;
    if (s[posN - 1] == t[posM - 1]) {
        dp[posN][posM] = 1 + check(posN - 1, posM - 1) ;
    }
    else {
        dp[posN][posM] = max(check(posN - 1, posM), check(posN, posM - 1)) ;
    }
    return dp[posN][posM] ;
}

void print(int posN, int posM, int lcs)
{
    if (posN == 0 or posM == 0) return ;
    if (s[posN - 1] == t[posM - 1] and dp[posN][posM] == lcs) {
        print(posN - 1, posM - 1, lcs - 1) ;
        cout << s[posN - 1] ;
    }
    else {
        if (dp[posN - 1][posM] > dp[posN][posM - 1])  print(posN - 1, posM, lcs) ;
        else    print(posN, posM - 1, lcs) ;
    }
    return ;
}

int main()
{
    memset(dp, -1, sizeof dp) ;
    cin >> s >> t ;
    int n = s.size(), m = t.size(), x ;
    x = check(n, m) ;
    print(n, m, x) ;

    return 0 ;
}


Measured memory_bytes: 36096
#include <stdio.h>
#include <iostream>

using namespace std;

int main(){
  while(1){
    int height,weight;
    scanf("%d %d",&height,&weight);
    if(height==0&&weight==0) break;
  for(int i=1;i<=height;i++){
    for(int j=1;j<=weight;j++){
      if((i+j)%2==0){
        cout << '#';
      }else{
        cout << '.';
      }
    }
    cout << '\n';
  }
  cout << '\n';
 }
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

ll N, M;

void solve() {
	cin >> N >> M;
	if(N > M) swap(N, M);
	if(N == 1) {
		if(M == 1) cout << "1\n";
		else if(M == 2) cout << "0\n";
		else cout << M - 2 << "\n";
	}
	else if(N == 2) {
		cout << "0\n";
	}
	else cout << (N - 2) * (M - 2) << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  long long int cou[4000]={0},b[4000],c[4000];
  int date,to,i,j,a[4000]={0};
  while(1){
    scanf("%d",&date);
    if(date == 0) break;
    for(i=0;i<date;i++){
      scanf("%d %lld %lld",&a[i],&b[i],&c[i]);
      cou[i] = b[i]*c[i];
      for(j=0;j<i;j++){
	if(a[i] == a[j]){
	  cou[j] = cou[i] + cou[j];
	  cou[i] = 0;
	}
      }
    }
    to = 0;
    for(i=0;i<date;i++){ 
      if(cou[i]>=1000000){
	printf("%d\n",a[i]);
	to++;
      }
    }
    if(to == 0){
      printf("NA\n");
    }
  } 
  return 0;
}

Measured memory_bytes: 688
function main(_stdin) {
    const stdin = _stdin.trim().split('\n');
    const n = Number(stdin.shift());
    const A = stdin.shift().split(' ').map(Number);
    let cnt = [0];

    mergeSort(A, 0, n, cnt);

    console.log(cnt[0]);
}

function mergeSort(array, left, right, cnt){
    if( left + 1 < right) {
        const mid = Math.ceil((left + right) / 2);
        mergeSort(array, left, mid, cnt);
        mergeSort(array, mid, right, cnt);
        merge(array, left, mid, right, cnt);
    }
}

function merge(array, left, mid, right, cnt) {
    const lefts = array.slice(left, mid);
    const rights = array.slice(mid, right);

    lefts.push(Infinity);
    rights.push(Infinity);
    let leftIdx = 0;
    let rightIdx = 0;

    for (let i = left, l = right; i < l; i++) {
        if (lefts[leftIdx] <= rights[rightIdx]) {
            array[i] = lefts[leftIdx];
            leftIdx++;
        } else {
            array[i] = rights[rightIdx];
            rightIdx++;

            cnt[0] += mid - left - leftIdx;
        }
    }
}




main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 46268
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    string s; cin >> s;
    ll k; cin >> k;
    ll sl = s.size();

    char ans = '1';
    REP(i,min(k,sl)) if (s[i] != ans) {
        ans = s[i];
        break;
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#define _DEBUG 1
#define _GLIBCXX_DEBUG

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

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                         \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll R) { cout << 2.000 * M_PI * R << endl; }

int main() {
  ll R;
  scanf("%lld", &R);
  solve(R);
  return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i] >> B[i];
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    if (N % 2) {
        int Min = A[(N + 1) / 2 - 1];
        int Max = B[(N + 1) / 2 - 1];
        cout << Max - Min + 1 << endl;
    } else {
        int Min = (A[N / 2 - 1] + A[N / 2]);
        int Max = (B[N / 2 - 1] + B[N / 2]);
        cout << Max - Min + 1 << endl;
    }
    return 0;
}

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

using namespace std;

//int N,M,K,L,R,H,W;
long long int N,M,K,L,R,H,W;

constexpr long long int MOD=1000000007;
//constexpr  int MOD=1000000007;
//constexpr int MOD=998244353;
//constexpr long long int MOD=998244353;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N;
	vector<vector<int>>edge(N);
	vector<int>ans(N-1);
	map<pair<int,int>,int>mp;
	for(int i=1;i<N;i++){
		cin>>L>>R;
		L--,R--;
		mp[{L,R}]=i-1;
		mp[{R,L}]=i-1;
		edge[L].push_back(R);
		edge[R].push_back(L);
	}
	vector<vector<int>>used(N);
	vector<int>cnt(N);
	vector<int>vis(N);
	for(int i=0;i<N;i++)used[i].resize((int)edge[i].size());
	queue<int>Q;
	Q.push(0);
	vis[0]=1;
	while(!Q.empty()){
		int cn=Q.front();
		//cout<<cn<<endl;
		Q.pop();
		for(auto i:edge[cn]){
			if(vis[i])continue;
			while(used[cn][cnt[cn]]){
				cnt[cn]++;
			}
			used[cn][cnt[cn]]++;
			if(used[i].size()>cnt[cn])used[i][cnt[cn]]++;
			ans[mp[{cn,i}]]=cnt[cn]+1;
			vis[i]=1;
			Q.push(i);
		}
	}
	int a=0;
	for(int i=0;i<N;i++){
		a=max(a,(int)edge[i].size());
	}
	cout<<a<<endl;
	for(auto i:ans)cout<<i<<endl;
}

Measured memory_bytes: 25216
def daikirai n,d
  
  d.each do |i|
    return true if n.to_s.include?(i)
  end
  
  return false
end

N, K = gets.split.map(&:to_i)
D = gets.split.map(&:to_s)

ans = N

while daikirai ans,D do
  ans += 1
end

puts ans


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define rep(n) for(int i = 0;i<n;i++)
#define all(v) v.begin(),v.end()
#define print(v) for(auto n:v){cout << n << "\t";}
#define quick                    \
    ios::sync_with_stdio(false); \
    cin.tie(0);
using namespace std;
void solve(){
	int n;
	cin >> n;
	vll v(n);
	ll allxor = 0;
	for(auto &i:v){
		cin >> i;
		allxor = allxor ^i;
	}
	rep(n){
		ll t = allxor^v[i];
		cout <<  t << " ";
	}
	cout << endl;
	


	

}


int main(){
	solve();
	// int t;
	// cin >> t;
	// while(t--){
	// 	solve();
	// }

	return 0;
}

Measured memory_bytes: 4716
#include <iostream>
#include <vector>
typedef long long int ll;
using namespace std;

int main(){
  ll s;std::cin >> s;
  vector<ll> dp(s+5, 0);
  dp[3] = 1;
  for(int i=0;i<s;i++){
    dp[i+1] = (dp[i+1] + dp[i])%1000000007;
    dp[i+3] = (dp[i+3] + dp[i])%1000000007;
  }
  std::cout << dp[s] << '\n';
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; 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;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll H,N;
    cin >> H >> N;
    vector<ll> A(N),mp(N);
    ll dai = 0;
    rep(i,N){
        cin >> A[i] >> mp[i];
        chmax(dai,A[i]);
    }
    vector<ll> memo(100000,INF);//h減らすための最小mp
    memo[0] = 0;
    rep(i,N){
        rep(j,H){
            if(memo[j] != INF){
                ll n = j + A[i];
                chmin(memo[n],memo[j] + mp[i]);
            }
        }
    }
    ll ans = INF;
    for(ll i = H + dai;i >= H;i--){
        chmin(ans,memo[i]);
    }
    cout << ans << endl;
    //rep(i,H + 4)cout << i << ":" << memo[i] << "\n";
}

Measured memory_bytes: 4000
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define printA(arr) for(int i = 0; i < SZ(arr); i++){cout << arr[i];if (i==SZ(arr)-1){cout<<endl;}else{cout << " ";}}
typedef long long ll;

int main()
{
  int N;
  cin >> N;
  vector<int> a;

  REP(i,N){
    int num;
    cin >> num;
    a.push_back(num);
  }
  printA(a);
  

  // 1番目から始めるのがキモ!
  // 0番目から始めても，

  // i番目を取り出してvとする．そうするとi番目が1つ空く．
  // 空いたスペースに詰めていって，vより大きいのがあるとそこで挿入してしまう
  for(int i=1;i<N;i++){
    int v = a[i];
    int j = i-1;
    while(j>=0 && a[j] > v){
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = v;
    printA(a);
  }

  return 0;
}



Measured memory_bytes: 3136
// practice with kaiboy
import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] tt = new int[n];
		int[] dd = new int[n];
		Integer[] ii = new Integer[n];
		for (int i = 0; i < n; i++) {
			tt[i] = sc.nextInt();
			dd[i] = sc.nextInt();
			ii[i] = i;
		}
		Arrays.sort(ii, (i, j) -> tt[i] != tt[j] ? tt[i] - tt[j] : dd[j] - dd[i]);
		Integer[] jj = new Integer[n];
		int n_ = 0, m = 0;
		for (int i = 0; i < n; i++)
			if (i == 0 || tt[ii[i - 1]] != tt[ii[i]])
				jj[m++] = ii[i];
			else
				ii[n_++] = ii[i];
		n = n_;
		Arrays.sort(ii, 0, n, (i, j) -> dd[j] - dd[i]);
		Arrays.sort(jj, 0, m, (i, j) -> dd[j] - dd[i]);
		long[] pp = new long[n + 1];
		long[] qq = new long[m + 1];
		for (int i = 0; i < n; i++)
			pp[i + 1] = pp[i] + dd[ii[i]];
		for (int j = 0; j < m; j++)
			qq[j + 1] = qq[j] + dd[jj[j]];
		long ans = 0;
		for (int x = Math.max(1, k - n); x <= k && x <= m; x++)
			ans = Math.max(ans, qq[x] + pp[k - x] + (long) x * x);
		println(ans);
	}
}


Measured memory_bytes: 63356
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	ini(n);
	multiset<int>a;
	FOR(i,0,n){
		ini(x);
		auto x1 = a.lower_bound(x);
		if(x1 == a.begin())a.insert(x);
		else{
			x1--;
			a.erase(x1);
			a.insert(x);
		}
	}
	out(a.size());
	return 0;
}

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


int main(){
                                                                     

    long long n, m, d;

    double a;


    cin >> n >> m >> d;


    if( d == 0 ) a = (double) ( m - 1 ) / n;

    else a = (double) ( m - 1 ) * 2 * ( n - d ) / ( n * n );


    cout << fixed << setprecision(17) << a << endl;
    

    return 0;

    }

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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

ll a[100005];

int main() {
	ll n, m;
	scanf("%lld%lld", &n, &m);
	ll l = 1;
	//bool ok = 0;
	int cnt = -1;
	bool drek = false;
	for (int i=0 ; i<n ; i++) {
		scanf("%lld", a+i);
		if (l > m) continue;
		a[i] /= 2;
	//	if (a[i] % 2) ok = true;
		l = l*a[i]/__gcd(l, a[i]);
		int br = 0;
		while (a[i]%2 == 0) {
			br++;
			a[i] /= 2;
		}
		if (cnt == -1) cnt = br;
		else if (br != cnt) drek = true;
	}
	if (drek) {
		printf("0\n");
		return 0;
	}
	//if (ok) printf("%lld\n", m/l);
	/*else*/ printf("%lld\n", (m/l+1)/2);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

    string s[h+2];
    rep(i,h+2){
        if(i == 0 || i == h + 1){
            rep(j,w+2)s[i] += '#';
        }else{
            string ss;
            cin >> ss;
            s[i] = '#' + ss + '#';
        }
    }

    int ans = 0;

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

    srep(i,1,h+1){
        srep(j,1,w+1){
            if(s[i][j] == '#')continue;
            int a[h+2][w+2];
            int f[h+2][w+2];
            rep(k,h+2){
                rep(l,w+2){
                    if(s[k][l] == '.'){
                        a[k][l] = 0;
                        f[k][l] = 0;
                    }else{
                        a[k][l] = 0;
                        f[k][l] = 1;
                    }
                }
            }
            queue<P> que;
            que.push(P(i, j));
            f[i][j] = 1;
            while(que.size() > 0){
                int x = que.front().first;
                int y = que.front().second;
                que.pop();
                rep(k,4){
                    if(f[x+dx[k]][y+dy[k]] == 0){
                        a[x+dx[k]][y+dy[k]] = a[x][y] + 1;
                        f[x+dx[k]][y+dy[k]] = 1;
                        que.push(P(x+dx[k], y+dy[k]));
                    }
                }
            }
            rep(k,h+2){
                rep(l,w+2){
                    ans = max(ans, a[k][l]);
                }
            }
        }
    }

    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
def main():
    n = int(input())
    p = list(map(int, input().split()))

    min_value = float('inf')

    counter = 0
    for i in p:
        min_value = min(min_value, i)
        if i == min_value:
            counter += 1
    print(counter)


if __name__ == '__main__':
    main()

Measured memory_bytes: 75472
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int X,K,D;


signed main(){
	cin>>X>>K>>D;
	X=abs(X);
	int cnt=X/D;
	if(K<=cnt){
		cout<<X-D*K<<endl;
	}
	else{
		int ans2=X%D;
		int ans3=ans2-D;
		K-=X/D;
		if(K%2==0){
			cout<<ans2<<endl;
		}
		else{
			cout<<-ans3<<endl;
		}
	}
	return 0;
}


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

int memo[201010];

signed main(void){
  
  string s; cin >> s;
  reverse(s.begin(),s.end());
  int N = (int)(s.size());
  
  int res = 0; int p10 = 1;
  int ans = 0;
  
  memo[0]++;
  
  for(int i = 0; i < N; i++){
    res = ( res + p10*(int)(s[i]-'0') ) % 2019;
    ans += memo[res];
    memo[res]++;
    //当該桁までの部分列%2019
    p10 *= 10;
    p10 %= 2019;
  }
  
  cout << ans << endl;
  
  return 0;
}
  

Measured memory_bytes: 3776
N=int(input())
alist=list(map(int,input().split()))

alist.sort(reverse=True)

n=alist[0]
min_func=10**9
r=0
for i in range(1,N):
  if abs(n-2*alist[i])<min_func:
    min_func=abs(n-2*alist[i])
    r=alist[i]

print(n,r)

Measured memory_bytes: 14052
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acosl(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define MAXN 205
//#define N 262144
#define ULL unsigned long long
#define ll long long
int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        int n;
        scanf("%d",&n);
        LL a[205];
        for(int i  = 0;i<n;i++)scanf("%lld",&a[i]);
        char c[205];
        scanf("%s",c);
        reverse(c,c+n);
        reverse(a,a+n);
        vector<bitset<205> > v;
        for(int i = 0;i<60;i++){
            bitset<205> b;
            for(int j=0;j<n;j++){
                if(a[j]&(1ll<<i)){
                    b[j]=1;
                }
                else{
                    b[j]=0;
                }
            }
            for(auto& it:v){
                if(b._Find_first()==it._Find_first()){
                    b^=it;
                }
                else if(b._Find_first()<it._Find_first()){
                    swap(b,it);
                }
            }
            if(b.count())v.pb(b);
        }
        int ans=0;
        for(auto it:v){
            if(c[it._Find_first()]=='1')ans=1;
        }
        printf("%d\n",ans);

    }
}
/*
1000000000000000000
1000000000000000000 1 1 1 1000000000
*/

Measured memory_bytes: 3692
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

using namespace std;

#ifdef LDEBUG
#define debug(x) cout << #x << ":" << x << endl
#else
#define debug(...)
#endif

#define bzero(m)  memset(m,0,sizeof(m))
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

typedef unsigned long long u64;
typedef long long i64;

u64 p[100];
u64 b[100];

void pre(int k){
        if (b[k] > 0) return;

        b[k] = 2*b[k-1] + 3;
        p[k] = 2*p[k-1] + 1;
}

u64 eat(int level, u64 k){
        if (k > b[level]) k--;

        if (level == 0) return 1;
        if (k == 1)  return 0;

        if (k == 2 + b[level-1])
                return p[level-1] + 1;

        if (k > 2 + b[level-1]){
                return p[level-1] + 1 + eat(level-1, k-2-b[level-1]);
        }

        return eat(level-1, k-1);
}

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

        int n;
        u64 x;
        cin >> n >> x;

        p[0] = 1;
        b[0] = 1;

        REP(i,51)
                pre(i);

        cout << eat(n, x);

        return 0;
}


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

#define ll long long
ll V[10000000] = {}, G[10000000] = {};
string S,Sa,Sb,Sc;
ll A = 0,B = 0,N = 0, K = 0,M = 0, sum = 0;
int main(){
cin >> N >> A >> B;
for(int i = 1;i <= N;i++){
if(i / 10000 + (i % 10000 / 1000) + (i % 1000 / 100)+ (i % 100 / 10)+ i % 10 >= A && i / 10000 + (i % 10000 / 1000) + (i % 1000 / 100)+ (i % 100 / 10)+ i % 10 <= B)sum += i;
}

cout << sum << endl;
return 0; 
}


Measured memory_bytes: 256
h,w=map(int,input().split())
s=[]
for i in range(h):
  s.append(list(input()))
for i in range(0,h):
  for j in range(0,w):
    if s[i][j]==".":
      count=0
      try:
        if s[i-1][j-1]=="#" and i-1!=-1 and j-1!=-1:
          count+=1
      except IndexError:
        pass
      try:
        if s[i-1][j]=="#" and i-1!=-1 and j!=-1:
          count+=1
      except IndexError:
        pass
      try:
        if s[i-1][j+1]=="#" and i-1!=-1 and j+1!=-1:
          count+=1
      except IndexError:
        pass
      try:
        if s[i][j-1]=="#" and i!=-1 and j-1!=-1:
          count+=1
      except IndexError:
        pass
      try:
        if s[i][j+1]=="#" and i!=-1 and j+1!=-1:
          count+=1
      except IndexError:
        pass
      try:
        if s[i+1][j-1]=="#" and i+1!=-1 and j-1!=-1:
          count+=1
      except IndexError:
        pass
      try:
        if s[i+1][j]=="#"and i+1!=-1 and j!=-1:
          count+=1
      except IndexError:
        pass
      try:
        if s[i+1][j+1]=="#"and i+1!=-1 and j+1!=-1:
          count+=1
      except IndexError:
        pass
      s[i][j]=count

for x in range(0,len(s)):
  for y in range(0,len(s[0])):
    if y!=len(s[0])-1:
      print(s[x][y],end="")
    else:
      print(s[x][y])      


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

using namespace std;

int main()
{
  long long int x;
  long long int k;
  cin >> x >> k;
  if(x * 500 >= k)
  {
    cout << "Yes";
  }
  else 
  {
    cout << "No";
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <vector>
#include <algorithm>
#include <cmath>
#include <climits>

using namespace std;

const double PI = 3.14159265358979;


int partition(int a[], int left, int right) {

	int i = left - 1;

	for (int j = left; j < right - left - 1; j++) {

		if (a[j] <= a[right - 1]) {
			i++;
			swap(a[i], a[j]);
		}
	}
	swap(a[++i], a[right - 1]);
	return i;
}

int main() {

	int n; cin >> n;
	int* a = new int[n];

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

	int pos = partition(a, 0, n);
	for (int i = 0; i < n; i++)	{
		if (i != 0) printf(" ");
		if (i == pos) 
			printf("[%d]", a[i]);
		else
			printf("%d", a[i]);
	}
	printf("\n");
	return 0;
}



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

string decode(string s)
{
  string ans;
  string map[]=
    {
      "00000",
      "00001",
      "00010",
      "00011",
      "00100",
      "00101",
      "00110",
      "00111",
      "01000",      
      "01001",
      "01010",
      "01011",
      "01100",
      "01101",
      "01110",
      "01111",

      "10000",
      "10001",
      "10010",
      "10011",
      "10100",
      "10101",
      "10110",
      "10111",
      "11000",      
      "11001",
      "11010",
      "11011",
      "11100",
      "11101",
      "11110",
      "11111"     
    };
  for(int i=0;i<s.size();i++)
    {
      if(s[i]>='A'&&s[i]<='Z')
	ans+=map[s[i]-'A'];
      else if(s[i]==' ')
	ans+="11010";
      else if(s[i]=='.')
	ans+="11011";
      else if(s[i]==',')
	ans+="11100";
      else if(s[i]=='-')
	ans+="11101";
      else if(s[i]=='\'')
	ans+="11110";
      else if(s[i]=='?')
	ans+="11111";
    }

  return ans;
}

string encode(string s)
{
  string ans;
  string code[]={
    "101",
    "000000",
    "000011",
    "10010001",
    "010001",
    "000001",
    "100101",
    "10011010",
    "0101",
    "0001",
    "110",
    "01001",
    "10011011",
    "010000",
    "0111",
    "10011000",
    "0110",
    "00100",
    "10011001",
    "10011110",
    "00101",
    "111",
    "10011111",
    "1000",
    "00110",
    "00111",
    "10011100",
    "10011101",
    "000010",
    "10010010",
    "10010011",
    "10010000"
};
  string charset=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  
  for(int i=0;i<32;i++)
    {
      if(s.find(code[i])==0)
	{
	  ans+=charset[i];
	  s=s.substr(code[i].size());
	  i=-1;
	}
    }
  //  cout<<s<<endl;
  return ans;
}

int main()
{
  string s;

  for(;getline(cin, s);)
    cout<<encode(decode(s))<<endl;
  
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
  int no_of_input;
  vector<int> vect1,vect2;
  int input;
  cin >> no_of_input;
  for(int i=0;i<no_of_input;i++){
    cin >> input;
    vect1.push_back(input);
  }
  for(int i=0;i<no_of_input;i++){
    cin >> input;
    vect2.push_back(input);
  }
  vector<vector<int> > temp;
  vector<int> idk;
  for(int i=1;i<=no_of_input;i++){
    idk.push_back(i);
  }
  do{
    temp.push_back(idk);
  }while(next_permutation(idk.begin(),idk.end()));
  sort(temp.begin(),temp.end());
  int pos1 = lower_bound(temp.begin(),temp.end(),vect1)-temp.begin();
  int pos2 = lower_bound(temp.begin(),temp.end(),vect2)-temp.begin();
  cout << abs(pos1-pos2);

}

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    cout << n / 3 << endl;
    return 0;
}


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

int N, x;
bool taken[200000];
vector<int> v;
int head = 1;

void take(int n) {
  int ctr = 0;
  while (ctr < n) {
    if (taken[head++]) continue;
    v.push_back(head-1);
    ctr++;
  }
}

int main() {
  cin >> N >> x;
  if (x > 1 && x < 2*N-1) {
    cout << "Yes\n";
    taken[x-1] = true;
    taken[x] = true;
    taken[x+1] = true;
    // .. ? (x-1) (x) (x+1) ? ..
    if (x > 2) {
      // ? (x-1) (x) (x+1) (x-2)...
      taken[x-2] = true;
    }
    else if (x < 2*N-2) {
      // (x+2) (x-1) (x) (x+1) ? ...
      taken[x+2] = true;
    }

    if (N > 2) {
      take(N-3);
      if (x <= 2 && x < 2*N-2) v.push_back(x+2);
      else take(1);
    }
    v.push_back(x-1);
    v.push_back(x);
    v.push_back(x+1);
    if (N > 2) {
      if (x > 2) v.push_back(x-2);
      else take(1);
      take(N-3);
    }

    for (auto e : v) {
      cout << e << "\n";
    }
  }
  else {
    cout << "No\n";
  }
  return 0;
}



Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string s,ss,str;
map<string,ll>mp;
vector<string>v;
int main()
{
    ll n,i,f=0,r=0,j,c=0,res=0;
    cin>>n;
    ss="";
    r=n;
    while(n--){
        cin>>s;
        sort(s.begin(),s.end());
        mp[s]++;
        if(mp[s]>1)continue;
        v.push_back(s);
       // cout<<v[0]<<endl;
    }
    //cout<<v.size();
    for(i=0;i<v.size();i++){
      if(mp[v[i]]==1)continue;
       f=f+mp[v[i]];
       f--;
       res=res+(f*(f+1))/2;
       f=0;
    }
    f--;
    cout<<res<<endl;
}


Measured memory_bytes: 16756
#include<bits/stdc++.h>
using namespace std;
#define int            int64_t
#define double         long double
#define nitro          ios_base::sync_with_stdio(false);cin.tie(0);
#define vi             vector<int64_t>
#define pub            push_back
#define puf            push_front
#define pob            pop_back
#define pof            pop_front
#define PI             3.1415926535897932384626433832795
#define read(a)        for(auto& x : a) cin>> x
#define endl           '\n'
#define gap            ' '
#define min3(a,b,c)    min(a, min(b, c))
#define max3(a,b,c)    max(a, max(b, c))
#define MOD            1000000007
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int32_t main()
{
    nitro
    int n,m;cin>>n>>m;
    vi adj[n];
    while(m--)
    {
    	int a,b;cin>>a>>b;
    	a--,b--;
    	adj[a].pub(b);
    	adj[b].pub(a);
    }
    for(int i=0;i<n;++i)
    {
    	cout<<adj[i].size()<<endl;
    }
    return 0;
}
    

Measured memory_bytes: 256