akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long int
#define ii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
#define output(x) for (auto a:x) cout<<a<<" ";cout<<endl;
#define output2(x) for (auto a:x) cout<<a.fi<<" "<<a.se<<endl;
#define PI 3.14159265
#define rall(x) x.rbegin(),x.rend()
#define all(x) x.begin(),x.end()
#define sz(x) (int) x.size()
// DEBUG TEMPLATE
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
  *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
  
// DEBUG TEMPLATE ENDS

#define MOD 1000000007
int power(int x,int y,int mod = MOD) 
{ 
  int ret = 1;
  x = x % mod;
  while (y){
    if(y&1) ret = (ret*x)%mod;
    y = y>>1;
    x = (x*x)%mod;
    } 
    return ret%mod; 
}

void solve()
{ 
  string s;
  cin>>s;
  int ans = 0;
  for (int i=0 ; i < 3 ; i++){
    if (s[i] == 'S') continue;
    ans = max(ans,1ll);
    for (int j = i+1 ; j < 3 ; j++){
      if (s[j] == 'S') break;
      ans = max(ans,j-i+1);
    }
  }
  cout<<ans<<endl;  
}


/*
  
*/
signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  // cin>>t;
  while (t--)
  solve();
}
// Check MOD values plox :(


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vz;
typedef vector<vz> vvz;
typedef pair<ll, ll> pll;
#define sz(x) int((x).size())
#define fo(i,n) for(ll i=0; i<(n); i++)
#define FO(i,a,b) for(ll i=(a); i!=(b); i+=(b)>(a)?1:-1)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(c) c.begin(), c.end()
#define F first
#define S second
#define os(x) cout<<x<<' '
#define on(x) cout<<x<<"\n"
#define nl cout<<"\n"
#define maxe(x) max_element(all(x))-(x).begin()
#define mine(x) min_element(all(x))-(x).begin()
const ll P=1e9+7;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("C:\\Users\\ASISH\\Desktop\\coding\\input1.txt", "r", stdin);
	freopen("C:\\Users\\ASISH\\Desktop\\coding\\output1.txt", "w", stdout);
#endif

	int tc=1;
	fo(q, tc)
	{
		ll n, ans=0;
		cin>>n;
		vll a(n), psum(n);
		fo(i, n) cin>>a[i];
		FO(i, 1, n){
			psum[i]=(psum[i-1]+a[i-1])%P;
			ans=(ans + (psum[i]*a[i])%P)%P;
		}
		on(ans);
	}
	cerr << "Time : " << ((double)clock()) / (double)CLOCKS_PER_SEC << "s\n";
	return 0;
}

Measured memory_bytes: 6352
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int N=2e5+10;
const ll P=1e9+7;
vector<int>g[N];
struct node{ll z0,z1,z2;};
vector<node>dp[N];
int num[N],cnt;
node add(node u,node v){
	node w;
	w.z0=u.z0*v.z0%P;
	w.z1=(u.z0*v.z1%P+u.z1*v.z0%P)%P;
	w.z2=(u.z0*v.z2%P+u.z1*v.z1%P+u.z1*v.z2%P+u.z2*v.z0%P+u.z2*v.z1%P+u.z2*v.z2%P)%P;
	return w;
}
inline void merge(int &x,int y){
	if(dp[x].size()<dp[y].size())swap(x,y);
	for(int i=0;i<dp[y].size();i++)
		dp[x][dp[x].size()-i-1]=add(dp[x][dp[x].size()-i-1],dp[y][dp[y].size()-i-1]);
}
int main(){
	int i,j,k,n;
	scanf("%d",&n);
	n++;
	for(i=2;i<=n;i++){
		scanf("%d",&k);
		k++;
		g[k].pb(i);
	}
	for(i=n;i;i--){
		if(g[i].empty())
			num[i]=++cnt;
		else{
			num[i]=num[g[i][0]];
			int mx=0;
			for(j=1;j<g[i].size();j++){
				mx=max(mx,(int)min(dp[num[i]].size(),dp[num[g[i][j]]].size()));//找次大值
				merge(num[i],num[g[i][j]]);
			}
			for(j=dp[num[i]].size()-mx;j<dp[num[i]].size();j++){
				dp[num[i]][j].z0=(dp[num[i]][j].z0+dp[num[i]][j].z2)%P;
				dp[num[i]][j].z2=0;
			}
		}
		dp[num[i]].pb((node){(P+1)/2,(P+1)/2,0});
	}
	ll ans=0,pwr=1;
	for(i=1;i<=n;i++)
		pwr=pwr*2%P;
	for(i=0;i<dp[num[1]].size();i++)
		ans=(ans+dp[num[1]][i].z1*pwr%P)%P;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 24816
#include <iostream>
using namespace std;
int main(void){
  int A,B;
  cin>>A>>B;
  int max=A+B;
  int P[2]={A-B,A*B};
  for(int i=0;i<2;i++){
      if(max<=P[i]){
          max=P[i];
      }
  }
  cout<<max<<endl;
}


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

#define show(x) cerr << #x << " = " << x << endl ;
#define input_from_file freopen("input.txt","r",stdin)
#define output_to_file freopen("output.txt" , "w",stdout)
#define fastio ios_base::sync_with_stdio(0)
#define endl '\n'

const int N = 2e3+1;
int arr[N];

int main()
{
	 #ifdef LOCAL
        input_from_file;
        output_to_file;
    #endif
	fastio;cin.tie(0);cout.tie(0);
	int n ; cin >> n ;
	for(int i = 1; i <= n ; ++i)
		cin >> arr[i];
	sort(arr +1 , arr + n + 1);
	int ans = 0 , x;
	for(int i = 1 ; i < n ; ++i)
	{
		for(int j = i + 1 ; j <= n ; ++j)
		{
			x = lower_bound(arr+1, arr+n+1 , arr[i]+arr[j]) - arr;
			if(x - 1 > j )ans += x - j - 1;
		}

	}
	cout << ans;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
#define ld long double
int main(){
    int n,x;
    cin>>n>>x;
    vector<int> l(n);
    rep(i,n)cin>>l[i];
    int d=0;
    int ans=1;
    rep(i,n){
        d += l[i];
        if(d<=x) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
using ll=long long;
const ll MOD=100000007;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=b-1;i>=a;i--)
#define range(i) (i).begin(),(i).end()
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}
inline long double median(vector<ll> v){
    ll size=v.size();
    sort(v.begin(),v.end());
    if (size % 2 == 1) return v[(size - 1) / 2];
    else return (v[(size / 2) - 1] + v[size / 2]) / 2;
}


int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> l(m),r(m);
    rep(i,0,m) cin>>l[i]>>r[i];
    ll p=-*max_element(range(l))+*min_element(range(r))+1;
    if(p<0) p=0;
    cout<<min(p,n);
}


Measured memory_bytes: 1920
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(ll)>
using namespace std;
#define All(v) (v).begin(),(v).end()
typedef long long ll;
const ll mod = 1000000007;
const ll inf = mod*mod;
const ll d5 = 114514;
const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1.0);
int main(){
    ll n;
    cin>>n;
    ll x=1,y=1;
    for(ll i=0;i<n;i++){
        ll t,a;
        cin>>t>>a;
        ll b = max((x+t-1)/t,(y+a-1)/a);
        x=b*t;
        y=b*a;
    }
    cout<<x+y<<endl;
}

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

#define   ipr         	pair<int, int>
#define   pb            push_back
#define   ff            first
#define   ss            second
#define   fr(i, j, k)   for (int i = j; i < k; i++)
#define   rf(i, j, k)   for (int i = j; i >= k;i--)
#define   int           long long
#define   ll 			unsigned long long
#define   ld            long double
#define   all(x)        x.begin(), x.end()
#define   rall(x)       x.rbegin(),x.rend()
#define   mp            make_pair
#define   inf           INT_MAX
#define   read_file();	freopen("input.txt", "r", stdin);	freopen("output.txt", "w", stdout);
#define   IOS           std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int Maxn  =  2019;
const ld  pi   =  acos(-1);
const int mod =  1000000007;

template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x<<" ";return out;}
template<class T> ostream& operator <<(ostream &out,set<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}


int32_t main(){ IOS
    int n,k;    cin>>n>>k;
    vector<int>A(n);
    fr(i,0,n){
        cin>>A[i];
    }
    sort(rall(A));
    int ans = 0;
    int indx = min(k,n);
    for(;indx<n;indx++)
        ans += A[indx];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
	var N = nextInt();
	var list = nextIntArray();
	var oddCount = 0;
	var evenCount = 0;
	var oddSum = new Array(N);//1, -1, 1, -1
	var evenSum = new Array(N);//-1, 1 ,-1 ,1
	if(list[0] == 0){
		oddSum[0] = 1;
		evenSum[0] = -1;
		oddCount++;
		evenCount++;
	}else{
		if(list[0] < 0){
			oddCount += Math.abs(list[0]) + 1;
			oddSum[0] = 1;
			evenSum[0] = list[0];
		}else{
			evenCount += Math.abs(list[0]) + 1;
			evenSum[0] = -1;
			oddSum[0] = list[0];
		}
	}
	for(var i = 1; i < N; i++){
		oddSum[i] = oddSum[i - 1] + list[i];
		evenSum[i] = evenSum[i - 1] + list[i];
		if((oddSum[i - 1] < 0 && oddSum[i] > 0) || (oddSum[i - 1] > 0 && oddSum[i] < 0)){
			
		}else{
			if((oddSum[i - 1] > 0)){
				oddCount += oddSum[i] + 1;
				oddSum[i] = -1;
			}else{
				oddCount += Math.abs(oddSum[i]) + 1;
				oddSum[i] = 1;
			}
		}
		if((evenSum[i - 1] < 0 && evenSum[i] > 0) || (evenSum[i - 1] > 0 && evenSum[i] < 0)){
			
		}else{
			if((evenSum[i - 1] > 0)){
				evenCount += evenSum[i] + 1;
				evenSum[i] = -1;
			}else{
				evenCount += Math.abs(evenSum[i]) + 1;
				evenSum[i] = 1;
			}
		}
	}
	myout(Math.min(evenCount, oddCount));
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
typedef complex<ld> Point;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 1e5 + 5;
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

int main() {
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    bool ok = true;
    rep(i, n) {
        if (a[i] % 2 == 0) {
            if (a[i] % 3 != 0 && a[i] % 5 != 0)
                ok = false;
        }
    }
    if (ok)
        cout << "APPROVED" << endl;
    else
        cout << "DENIED" << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

int F[200001];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

int fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i < 200000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}

int C(int n, int r) {
	if (n < r) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}

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

	fact();

	int n; cin >> n;
	n++;
	int a[n];
	int num[n + 1] = {};
	rep(i, n) cin >> a[i];
	rep(i, n) num[a[i]]++;
	int secN = -1;
	rep(i, n) {
		if (num[i + 1] == 2) secN = i + 1;
	}
	int left = -1, right = -1;
	rep(i, n) {
		if (a[i] == secN) {
			if (left == -1) left = i;
			else right = i;
		}
	}
	rep(i, n) {
		//cout << C(n, i + 1) << " " << C(n - right - 1, i) << " ";
		cout << (C(n, i + 1) - C(n - (right - left + 1), i) + mod) % mod << endl;
	}


    return 0;
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main()
{
  int N, M, A, n, m;
  cin >> N >> M;
  
  n = N - 1;
  m = M - 1;
  A = N*n/2 + M*m/2;
    
  cout << A << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N = int(input().strip())
A_list = list(map(int, input().rstrip().split()))
#-----

temp_A=[]
for i in range(len(A_list)):
    temp_A.append( A_list[i] - (i+1) )

temp_A.sort()
median = (temp_A[(N-1)//2] + temp_A[N//2]) // 2

b = median
sum=0
for i,a in enumerate(A_list):
    sum += abs( a - (b+(i+1)) )

print(sum)


Measured memory_bytes: 26708
#include <vector>
        #include <cstdint>
        #include <iostream>
        #include <queue>

        using std::vector;
        using std::cout;
        using std::cin;

        using ll = long long;
        using ull = unsigned long long;



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

    ull n,m,a,b;
    std::cin >> n >> m;

    vector<ull> from(n);
    vector<vector<ull>> edge(n);
    for(ull i=0; i<m; i++){
        cin >> a >> b;
        edge[a-1].push_back(b-1);
        edge[b-1].push_back(a-1);
    }

    // bfs
    std::queue<ull> q;
    vector<bool> done(n,false);
    q.push(0);
    done[0] = true;
    while(!q.empty()){
        ull node = q.front();q.pop();
        for(ull next_node: edge[node]){
            if(!done[next_node]){
                q.push(next_node);
                from[next_node] = node;
                done[next_node] = true;
            }
        }
    }

    cout << "Yes\n";
    for(ull i=1; i<n; i++){
        cout << from[i]+1 << "\n";    
    }
    
    return 0;
}

Measured memory_bytes: 13076
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <iomanip>
#include <stack>
#include <queue>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define mkp make_pair
#define F first
#define S second
#define show(a) cerr << #a <<" -> "<< a <<"\n"

const int N = 3001;

string s, t;
int dp[N][N];
pii p[N][N];
bool u[N][N];

int main () {
	ios_base::sync_with_stdio(0);
	cin >> s >> t;
	s = '#' + s;
	t = '#' + t;
	for(int i = 1; i < sz(s); ++i) {
		for(int j = 1; j < sz(t); ++j) {
			if(s[i] == t[j]) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
				p[i][j] = mkp(i - 1, j - 1);
				u[i][j] = 1;
			}
			else {
				if(dp[i][j - 1] > dp[i - 1][j]) {
					dp[i][j] = dp[i][j - 1];
					p[i][j] = mkp(i, j - 1);
				} else {
					dp[i][j] = dp[i - 1][j];
					p[i][j] = mkp(i - 1, j);
				}
			}
			//ans = max(ans, dp[i][j]);
		}
	}
	
//	cout << dp[sz(s) - 1][sz(t) - 1];
//	cout << str[sz(s) - 1][sz(t) - 1];
	string ans = "";
	int x = sz(s) - 1, y = sz(t) - 1;
	while(x > 0 && y > 0) {
		if(u[x][y]) ans.pb(s[x]);
		int xx = x;
		x = p[xx][y].F;
		y = p[xx][y].S;
	}
	reverse(all(ans));
	cout << ans;
	return 0;
}


















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

int n;
int a[100005];
long long ans;
bool t;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i]==0)t=0;
        ans+=(a[i]+t)/2;
        t=(a[i]+t)%2;
        //cout<<ans<<' '<<t<<endl;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<cstring>

#define M 100000/* your task*/
#define L 14

char H[M][L]; /* Hash Table */
bool flag[244140625]={};

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

//int h1(int key){ return /* your task */; }
//int h2(int key){ return /* your task */; }

int find(char str[]){
    if(flag[getKey(str)] == true){
        return true;
    }else{
        return false;
    }
}

int insert(char str[]){
    
    flag[getKey(str)] = true;
    

}

int main(){
    int i, n, h;
    char str[L], com[9];
    bool flag[244140625]={};
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	    scanf("%s %s", com, str);
	
	    if ( com[0] == 'i' ){
	        insert(str);
	    } else {
	        if (find(str)){
	    	printf("yes\n");
	        } else {
	    	    printf("no\n");
	        }
	    }
    }

    return 0;
}




Measured memory_bytes: 9212
#include<stdio.h>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<bitset>
#include<vector>
#include<math.h>
#include<stack>
#include<map>
#include<queue>
#include<set>
#define eps 1e-9
#define ls(x) (x<<1)
#define rs(x) ((x<<1)|1)
using namespace std;
int n;
char s[100005];
int stk[100005],cnt;
vector<int>g[100005];
int main()
{
    scanf("%s",s+1);
    n=strlen(s+1);
    if(s[n]=='1' || s[1]=='0')
    {
        printf("-1");
        return 0;
    }
    for(int i=1;i<n;i++)
    {
        if(s[i]!=s[n-i])
        {
            printf("-1");
            return 0;
        }
    }
    for(int i=1;i<=n;i++)
    {
        if(s[i]=='1')stk[++cnt]=i;
    }
    for(int i=1;i<cnt;i++)
    {
        g[i].push_back(i+1);
    }
    int m=cnt,sum=0;
    for(int i=1;i<=m;i++)
    {
        sum++;
        for(int k=1;k<=stk[i]-sum;k++)
        {
            g[i].push_back(++cnt);
        }
        sum=stk[i];
    }
    for(int i=1;i<=m;i++)
    {
        for(int j=0;j<g[i].size();j++)
        {
            printf("%d %d\n",i,g[i][j]);
        }
    }
    printf("%d %d",m,cnt+1);
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define UNWORDS(vec, str) for(int i = 0; i < (vec).size(); ++i) cout << (i ? str : "") << (vec)[i]
#define UNLINES(vec) for(int i = 0; i < (vec).size(); ++i) cout << (vec)[i] << endl
#define RS resize
#define CLR clear
#define PB push_back
#define ALL(x) (x).begin, (x).end()
using namespace std;

int main(){
	int n, r, t;
	
	cin >> n;
	
	REP(i, n){
		cin >> r >> t;
		if(r % 100 == 0)
			if(t % 30 == 0) cout << (t / 30) * 5 + (r / 100) << endl;
			else cout << (t / 30) * 5 + (r / 100) << " " << (t / 30 + 1) * 5 + (r / 100) << endl;
		else
			if(t % 30 == 0) cout << (t / 30) * 5 + (r / 100) << " " << (t / 30) * 5 + (r / 100 + 1) << endl;
			else cout << (t / 30) * 5 + (r / 100) << " " << (t / 30) * 5 + (r / 100 + 1) << " " << (t / 30 + 1) * 5 + (r / 100) << " " << (t / 30 + 1) * 5 + (r / 100 + 1) << endl;
	}
	
	return 0;
}

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

int main(void){
	double d,m,g,x,y,n,t;
	int A,B;
d=3.1415926535/2;x=0;y=0;
	while(1){
		
		scanf("%lf,%lf",&n,&m);
			if((n==0)&&(m==0)){
				break;
			}
			x+=n*cos(d);
			y+=n*sin(d);
			g=-m*3.1415926535/180;
			d+=g;

	
	}
A=x;B=y;

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

Measured memory_bytes: 628
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		int strN = 1; // 文字列を何行受け取るか
		for (int i = 0; i < strN; i++) {
			line += br.readLine() + " ";
		}
		String[] param = line.split(" ");

		Power(param);
	}

	static void Power(String[] param){
		
		int n = Integer.parseInt(param[0]);
		long a = 1;
		long b = (long) Math.pow(10, 9) + 7;
		
		for(int i = 1; i <= n; i++){
			a = i * a % b;
		}
		System.out.println(a);
	}

}

Measured memory_bytes: 21332
a,b=map(int, input().split())
s=list(input())

if s[a]!="-":
  print("No")
  exit()
  
for i in range(a):
  if s[i]=="-":
    print("No")
    exit()

for i in range(b):
  if s[a+1+i]=="-":
    print("No")
    exit()

print("Yes")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
using in = int64_t;

int main(){
  int n,m,l;
  cin>>n>>m>>l;
  if(n==l) cout<<0;
  else cout<<1;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

LL gcd(LL a, LL b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}
int n;
int a[10000000];

int binary(int n,int k){
    int left=0,right=n;
    int center=(left+right)/2;
    while(left<right){
            center=(left+right)/2;
            if(a[center]==k){
                return 1;
            }
            else if(k<a[center]){
                right=center;
            }
            else{
                left=center+1;
            }
        }
        return 0;
}

int main(){
    cin >> n;
    for(int i=0;i<n;++i){
        cin >> a[i];
    }
    int sum=0;
    long long k=0;
    long long q;
    cin >> q;
    for(int i=0;i<q;++i){
        cin >> k;
        if(binary(n,k)){
            sum++;
    }
}
cout << sum << endl;
}


Measured memory_bytes: 3380
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    string a;
    cin >> a;
    if (a[0] == '9' || a[1] == '9') {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
(defun solve (l r d &optional (pt l) (cnt 0))
  (cond
    ((> pt r) cnt)
    (t
     (when (zerop (mod pt d))
       (incf cnt))
     (solve l r d (1+ pt) cnt))))

(defun main ()
  (let ((l (read))
        (r (read))
        (d (read)))
    (princ (solve l r d))
    (fresh-line)))

(main)


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 5e1 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

const ll LOG = 130;

ll dp[LOG][MAXN][MAXN];
ll G[MAXN][MAXN];

vector<ll> bt;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, k;
	cin >> n >> k;
	for(int i = 0; i < n; i++) for(int j = 0; j < n; j++){
		cin >> dp[0][i][j];
		G[i][j] = dp[0][i][j];
	}
	while(k > 0){
		bt.pb(k % 2ll);
		k /= 2ll;
	}
	bt.pop_back();
	ll lg = 0;
	while(bt.size()){
		lg++;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				for(int mid = 0; mid < n; mid ++){
					dp[lg][i][j] += (dp[lg - 1][i][mid] * dp[lg - 1][mid][j]);
					dp[lg][i][j] %= MOD;
				}
			}
		}
		if(bt.back() == 1){
			lg++;
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					for(int mid = 0; mid < n; mid ++){
						dp[lg][i][j] += (dp[lg - 1][i][mid] * G[mid][j]);
						dp[lg][i][j] %= MOD;
					}
				}
			}
		}
		bt.pop_back();
	}
	ll ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			ans += dp[lg][i][j];
			ans %= MOD;
		}
	}
	cout << ans;
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 3456
import java.util.*;

public class Main {

    public static void main(String[] args) {
        int [][][] A = new int [3][3][2];
        Scanner stdIn = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                A[i][j][0] = stdIn.nextInt();
                A[i][j][1] = 0;
            }
        }
        int N = stdIn.nextInt();
        int [] b = new int [N];
        for (int k = 0; k < N; k++) {
            b[k] = stdIn.nextInt();
        }
        stdIn.close();

        for (int k = 0; k < N; k++) {
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    if (b[k] == A[i][j][0]) {
                        A[i][j][1]++;
                    }
                }
            }
        }

        int bingo = 0;
        for (int i = 0; i < 3; i++) {
            if (A[i][0][1] == 1 && A[i][1][1] == 1 && A[i][2][1] == 1) {
                bingo++;
            }
        }
        for (int j = 0; j < 3; j++) {
            if (A[0][j][1] == 1 && A[1][j][1] == 1 && A[2][j][1] == 1) {
                bingo++;
            }
        }
        if ((A[0][0][1] == 1 && A[1][1][1] == 1 && A[2][2][1] == 1) || (A[0][2][1] == 1 && A[1][1][1] == 1 && A[2][0][1] == 1)){
            bingo++;
        } 

        if (bingo > 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 22740
import unittest


class TestB(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(10, [4, 5, 6]), 'Yes')

    def test_2(self):
        self.assertEqual(think(20, [4, 5, 6]), 'No')

    def test_3(self):
        self.assertEqual(think(210, [31, 41, 59, 26, 53]), 'Yes')

    def test_4(self):
        self.assertEqual(think(211, [31, 41, 59, 26, 53]), 'No')


def solve():
    h, a = read()
    result = think(h, a)
    write(result)


def read():
    h, n = read_int(2)
    return h, read_int(n)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(h, a):
    return 'Yes' if sum(a) >= h else 'No'


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Measured memory_bytes: 64704
#include<bits/stdc++.h>
using namespace std;
char d[105];
int main(){
	int a,ans=0,cnt=0;
	cin>>a;
	for(int i=0;i<a;i++){
		cin>>d[i];
		if(d[i]=='D')
			ans--;
		else
			ans++;
		cnt=max(ans,cnt);
	}
	cout<<cnt;
	return 0;
}

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

int main()
{
  int countArray[101], number, mx_number = 0;
  memset(countArray, 0, sizeof countArray);

  while(scanf("%d", &number)!=EOF){
    ++countArray[number];
  }

  for(number = 100; number > 0; --number)
    if(countArray[number] > countArray[mx_number])
      mx_number = number;

  for(number = 1; number <= mx_number; ++number)
    if(countArray[number] == countArray[mx_number])
      printf("%d\n", number);

  return 0;
}

Measured memory_bytes: 596
S = list(input())
N = len(S)

info = []
rcnt, lcnt = 0, 0
key = 'R'
for i in range(N):
    if key == 'R':
        if S[i] == 'R':
            rcnt += 1
        else:
            key = 'L'
            lcnt = 1
            idx = i - 1
    else:
        if S[i] == 'R':
            info.append([idx, rcnt, lcnt])
            key = 'R'
            rcnt = 1
            lcnt = 0
        else:
            lcnt += 1
    if i == N - 1:
        info.append([idx, rcnt, lcnt])

A = [0] * N
for inf in info:
    a, b, c, = inf
    if (b + c) % 2 == 0:
        A[a], A[a + 1] = int((b + c) / 2), int((b + c) / 2)
    else:
        v = int((b + c) // 2)
        d = (max(b, c) - 1)
        if b > c:
            b, c = v + 1, v
        else:
            b, c = v, v + 1
        if d % 2 == 0:
            A[a], A[a + 1] = b, c
        else:
            A[a], A[a + 1] = c, b

A = list(map(str, A))
print(' '.join(A))


Measured memory_bytes: 57100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007;
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
const long long INF = 1LL<<60;
int gcd(int a,int b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}
int main() {
    int x,y;
    cin >> x >> y;
    int a[12] = {0,3,0,1,0,1,0,0,1,0,1,0};
    if(a[x-1] == a[y-1])cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<cstdio>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXW = 52, MAXH = 52, RIKU = 1, UMI = 0;

int tile[MAXH][MAXW];
int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int w, h;

int solve(int x, int y)
{
    if(tile[x][y] == RIKU)
    {
        tile[x][y] = UMI;
        
        REP(8)if( x+dx[i]>=0 && x+dx[i] < w && y+dy[i] >= 0 && y+dy[i] < h)
            solve(x+dx[i], y+dy[i]);

        return 1;
    }
    return 0;
}

int main()
{
    while(cin >> w >> h && (w || h))
    {
        memset(tile, 0, sizeof(tile));
        rep(j,h)rep(i,w) cin >> tile[i][j];

        int ans = 0;
        rep(j,h)rep(i,w) ans += solve(i,j);

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

Measured memory_bytes: 1244
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
main(){
    string S;
    cin >> S;
    int N = S.length(),d = 0,cnt = 0;
    for(char c:S){
        if(c == 'S'){
            d++;
        }else{
            d--;
        }
        if(d < 0){
            cnt++;
            d = 0;
        }
    }
    cout << cnt+d << endl;
}   

Measured memory_bytes: 640
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

typedef multiset<int> si;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    si s;
    for (int i = 0; i < 1 << n; i++) {
        int a;
        cin >> a;
        s.insert(a);
    }

    vi a;
    a.push_back(*s.rbegin());
    s.erase(prev(s.end()));
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 1 << i - 1; j++) {
            auto it = s.lower_bound(a[j]);
            if (it == s.begin()) {
                cout << "No" << endl;
                return 0;
            } else {
                a.push_back(*--it);
                s.erase(it);
            }
        }

        sort(a.begin(), a.end());
        reverse(a.begin(), a.end());
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 13688
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fs first
#define se second
 
struct trap{
	ll l=-1,r=-1,d=-1;
};
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll a,b,c;
	cin>>a>>b>>c;
	if(a+b+c>=22)
		cout<<"bust";
	else
		cout<<"win";
	cout<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

template <typename T>
class Bit {
 public:
  Bit(int size) : size_(size) {
    data_.resize(size + 1);
  }

  // 0-indexed
  void add(int index, T value) {
    if (index < 0 || index >= size_) return;
    ++index;
    while (index <= size_) {
      data_[index] += value;
      index += index & -index;
    }
  }

  // [0, index]
  T sum(int index) {
    if (index < 0 || index >= size_) return 0;
    ++index;
    T ret = 0;
    while (index > 0) {
      ret += data_[index];
      index -= index & -index;
    }
    return ret;
  }

 private:
  std::vector<T> data_;
  int size_;
};

void compress(vll const& vec, map<ll, int>& zip, vll& unzip){
    unzip = vec;

    sort(_all(unzip));
    unzip.erase(unique(_all(unzip)), unzip.end());
    unzip.emplace_back(inf);

    rep(i, unzip.size()) zip[unzip[i]] = i;
}

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

    int n; ll K; cin >> n >> K;
    vll a(n); for(auto& e : a) cin >> e;
    a.emplace_back(0);
    n++;
    ll sum = 0;
    rep(i, n){
        ll cur = a[i];
        a[i] = sum - i * K;
        sum += cur;
    }

    map<ll, int> zip; vll unzip;
    compress(a, zip, unzip);
    rep(i, n) a[i] = zip[a[i]];

    Bit<int> bt(n);
    ll res = 0;
    rep(i, n){
        res += bt.sum(a[i]);
        bt.add(a[i], 1);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 18788
// https://atcoder.jp/contests/abc147/tasks/abc147_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)
const int mod = 1e9 + 7;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> v(N);
    for (auto &x : v) {
        cin >> x;
    }

    int res = 0;
    REP(d, 60) {
        int n0 = 0, n1 = 0;
        for (auto &x : v) {
            if (x >> d & 1) {
                n1++;
            } else {
                n0++;
            }
        }
        int tmp = (1UL << d) % mod;
        int n = n0 * n1 % mod;
        tmp = tmp * n % mod;
        res = (res + tmp) % mod;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 2560
/*siddharth goyal*/
#include<bits/stdc++.h>
using namespace std;
#define   pb              push_back
#define   REP(i,n)        for(i=1;i<=n;i++)
#define   FOR(i,a,b)      for(i=a;i<=b;i++)
#define   all(v)          v.begin(),v.end()
#define   F               first
#define   S               second
#define   vl              vector<LL>
#define   itr             ::iterator it
#define   lb              lower_bound
#define   ub              upper_bound
#define   LL              long long
#define   ULL             unsigned long long
LL n,i,j,ans = (LL)1E18;
LL a[1000000] ;
int main()
{   // Read the constraints,highlights,Time Limit,Test Cases
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    LL k ;
    cin>>n>>k ;
    REP(i,n) cin>>a[i] ;
    j = k ;
    REP(i,n)
    {  if(j>n)  break ;
       if(a[j]<0) ans = min(ans,abs(a[i]));
       else if(a[i]>0) ans = min(ans,a[j]) ;
       else
       {  LL l = 0 - a[i] ;
          LL r = a[j] ;
          ans = min(ans,2*min(l,r)+max(l,r)) ;
       }
       j++ ;
       
    }
    cout<<ans;
}
// Check for 1,0, and other corner cases.


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a == b) {
    cout << c << endl;
  }else if(b == c) {
    cout << a << endl;
  }else {
    cout << b << endl;
  }
}

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

struct Edge{
  long long to, cost;
  Edge(long long to, long long cost) : to(to), cost(cost) {}
};

typedef vector<vector<Edge> > AdjList;
AdjList graph;
const long long INF = 1<<30;

long long V, E, r;

vector<long long> dist;

bool bellman_ford(long long n, long long s) {
  dist = vector<long long> (n, INF);
  dist[s] = 0;
  for (long long i = 0; i < n; i++) {
    for (long long v = 0; v < n; v++) {
      for (long long k = 0; k < graph[v].size(); k++) {
        Edge e = graph[v][k];
        if (dist[v] != INF && dist[e.to] > dist[v] + e.cost) {
          dist[e.to] = dist[v] + e.cost;
          if (i==n-1) return true;
        }
      }
    }
  }
  return false;
}


int main(int argc, char const *argv[]) {
  cin >> V >> E >> r;

  graph = AdjList(V);

  for (long long i = 0; i < E; i++) {
    long long from, to, cost;
    cin >> from >> to >> cost;
    graph[from].push_back(Edge(to, cost));
  }

  if (bellman_ford(V,r)) cout << "NEGATIVE CYCLE" << endl;
  else {
    for (long long i = 0; i < V; i++) {
      if (dist[i] != INF) {
        cout << dist[i] << endl;
      }
      else cout << "INF" << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; 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 (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<vector<int>> e(n);
    vector<vector<int>> d(n,vector<int>(n,inf));
    rep(i,n){
        rep(j,n){
            char t;cin >> t;
            if(t-'0'){
                e[i].push_back(j);
                e[j].push_back(i);
                d[i][j]=d[j][i]=1;
            }
        }
    }
    vector<int> b(n,-1);
    b[0]=0;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int p=q.front();
        q.pop();
        for(int x:e[p]){
            if(b[x]==-1){
                b[x]=!b[p];
                q.push(x);
            }
            else{
                if(b[x]==b[p]){
                    cout << -1 << endl;
                    return 0;
                }
            }
        }
    }
    rep(i,n){
        d[i][i]=0;
    }
    rep(i,n) rep(j,n) rep(k,n) chmin(d[j][k],d[j][i]+d[i][k]);
    int ans=0;
    rep(i,n) rep(j,n) chmax(ans,d[i][j]);
    cout << ans+1 << endl;
}

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

#define ll long long

int main() {
	ll tower[1000];
	for (int i = 0; i < 999; i++) {
		tower[i] = (1 + (i + 1)) * (i + 1) / 2;
	}
	ll a, b, d, ans;
	cin >> a >> b;
	d = b - a;
	ans = tower[d - 1] - b;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
using namespace std;

void solve() {
	ll n,d,x,y,ans=0; cin >> n >> d;
	map<pair<int,int>, int> mp;
	rep(i,0,n) {
		cin >> x >> y;
		// if (mp[make_pair(x,y)]) continue;
		// mp[make_pair(x,y)]=1;
		if (x*x+y*y <= d*d) ans++;
	}
	cout << ans << '\n';
}

int main(int argc, char * argv[]) 
{
	ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef DEBUG
	freopen("C:/Users/Fish_Brother/Desktop/in", "r", stdin);
	//freopen("C:/Users/Fish_Brother/Desktop/out", "w", stdout);
#endif

	//int t; cin >> t; while(t--)
	solve();

    return 0;
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int ia = int.Parse(sS[0]);
            int ib = int.Parse(sS[1]);
            int ic = int.Parse(sS[2]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "NO";
            if (ib - ia == ic - ib) { sOut = "YES"; }

            //出力
            Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 100010
using namespace std;
int n,a[maxn],b[maxn];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]<=n) b[a[i]]++;
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		if(b[i]!=0)
		{
			if(b[i]<i) continue;
			else ans+=i; 
		}
	printf("%d",n-ans);
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int k;
    int a, b;
    cin >> k;
    cin >> a >> b;

    string ok = "NG";
    int n = a;
    while (n <= b)
    {
        if (n % k == 0)
        {
            ok = "OK";
            break;
        }
        n++;
    }
    cout << ok << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  ll a,b,c=0,ans=0,n;
  cin>>n>>a>>b;
  c=a*(n/(a+b));
  if(n%(a+b)>a) c+=a;
  else c+=n%(a+b);
  co(c);
  
  return 0;
}

Measured memory_bytes: 256