akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;

#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define vpii vector<pair<ll,ll>>
#define pll  pair<ll,ll>
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1000000000+7;
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
ll factor(ll n){
    vll ans;
	if(n==2)ans.pb(2);
	else
    {for(ll i=2;i*i<=n;i++){if(n%i==0 && n%i!=i){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}ans.pb(n);}
    return ans.sz+1;
}
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i; 
    return res; } 
  
ll nCr(ll n, ll r){ return fact(n) / (fact(r) * fact(n - r)); } 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 

ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}

void solve()
{
	ll n;
	cin>>n;
	vll a(n);
	for(ll i=0;i<n;i++)
		cin>>a[i];
	ll i=n-1;
	for(;i>=0;i-=2)
		cout<<a[i]<<" ";
	if(n%2==0)
		i=0;
	else
		i=1;
	for(;i<n-1;i+=2)
		cout<<a[i]<<" ";
}            
int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}


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

int main(){
    long n;
    cin >> n;
    vector<long> T;
    vector<long> X;
    vector<long> Y;
    long x,y,t;

    T.push_back(0);
    X.push_back(0);
    Y.push_back(0);
    rep(i,n){
        cin >> t >> x >> y ;
        T.push_back(t);
        X.push_back(x);
        Y.push_back(y);
    }

    rep(i,n){
        x=0,y=0;
        long td = T.at(i+1) - T.at(i);
        long xd = X.at(i+1) - X.at(i);
        long yd = Y.at(i+1) - Y.at(i);

        while(td>0){
            if(x<xd){
                x++;
            }else if(x>xd){
                x--;
            }else if(y<yd){
                y++;
            }else if(y>yd){
                y--;
            }else{
                x++;
            }
            td--;
            if(td==0 && (x!=xd || y!=yd)){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout <<"Yes"<<endl;
    return 0;
    
}

Measured memory_bytes: 2912
import kotlin.math.floor

fun main() {
    val (a,b,n) = next3Long()
    val x = if (n < b) {
        n
    } else {
        b-1
    }
    println((floor(a.toDouble() * x / b) - a * floor(x.toDouble() / b)).toLong())
}

val scanner = java.util.Scanner(System.`in`)
fun next(): String = scanner.next()
fun nextInt() = scanner.nextInt()
fun next2Int() = Pair(scanner.nextInt(), scanner.nextInt())
fun next3Long() = Triple(scanner.nextLong(), scanner.nextLong(), scanner.nextLong())
fun nextLong() = scanner.nextLong()
fun nextLine(): String = scanner.nextLine()
fun nextList() = nextLine().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextIntArray(size: Int) = IntArray(size) { nextInt() }
fun nextLongList() = nextList().map(String::toLong)
fun printYesNo(isYes: Boolean) = println(if (isYes) "Yes" else "No")

Measured memory_bytes: 36448
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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

const int dm = 1 << 19;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[4];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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


	int N = getint(), M = getint(), L = getint();
	int C[300][300];
	rep(j, N) rep(i, j) C[i][j] = 1e9 + 1;
	rep(i, M) {
		int a = getint(), b = getint(), c = getint();
		C[--a][--b] = c;
		C[b][a] = c;
	}

	rep(k, N) {
		rep(j, k) {
			rep(i, j) {
				chmin(C[i][j], C[i][k] + C[j][k]);
			}
		}
		for (int j = k + 1; j < N; j++) {
			rep(i, k) {
				chmin(C[i][j], C[i][k] + C[k][j]);
			}
			for (int i = k + 1; i < j; i++) {
				chmin(C[i][j], C[k][i] + C[k][j]);
			}
		}
	}
	rep(k, N) {
		auto Ck = C[k];
		rep(i, k) {
			auto Ci = C[i];
			auto Cik = Ci[k];
			for (int j = i + 1; j < k; j++) {
				chmin(Ci[j], Cik + C[j][k]);
			}
			for (int j = k + 1; j < N; j++) {
				chmin(Ci[j], Cik + Ck[j]);
			}
		}
		for (int i = k + 1; i < N; i++) {
			auto Ci = C[i];
			auto Cki = Ck[i];
			for (int j = i + 1; j < N; j++) {
				chmin(Ci[j], Cki + Ck[j]);
			}
		}
	}

	rep(j, N) rep(i, j) {
		C[i][j] = (C[i][j] <= L) ? 1 : 1e9;
	}

	rep(k, N) {
		auto Ck = C[k];
		rep(i, k) {
			auto Ci = C[i];
			auto Cik = Ci[k];
			for (int j = i + 1; j < k; j++) {
				chmin(Ci[j], Cik + C[j][k]);
			}
			for (int j = k + 1; j < N; j++) {
				chmin(Ci[j], Cik + Ck[j]);
			}
		}
		for (int i = k + 1; i < N; i++) {
			auto Ci = C[i];
			auto Cki = Ck[i];
			for (int j = i + 1; j < N; j++) {
				chmin(Ci[j], Cki + Ck[j]);
			}
		}
	}

	int Q = getint();
	rep(i, Q) {
		int s = getint(), t = getint();
		if (--s > --t) swap(s, t);
		if (C[s][t] == 1) {
			*di++ = '0';
			*di++ = '\n';
		}
		else if (C[s][t] < 1e9) putint(C[s][t] - 1);
		else {
			*di++ = '-';
			*di++ = '1';
			*di++ = '\n';
		}
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> p(n,0);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    sort(p.begin(),p.end());
    if(n == 0 || n % 2 != 0) {
        cout << "0" << "\n";
    }else{
        cout << p[n/2] - p[n/2-1] << "\n";
    }
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int T = sc.nextInt();

        int res = T/A*B;

        System.out.println(res);


    }
}


Measured memory_bytes: 21972
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int n, m, ans;
vector<int> s[10];
bool p[10];
queue<string> q;

int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int k;
    cin >> k;
    while (k--) {
      int idx;
      cin >> idx;
      idx--;
      s[i].push_back(idx);
    }
  }
  for (int i = 0; i < m; i++) {
    cin >> p[i];
  }
  
  q.push("0");
  q.push("1");
  while (q.size()) {
    string str = q.front();
    q.pop();
    
    if (str.length() < n) {
      q.push(str + "0");
      q.push(str + "1");
      continue;
    }
    
    bool flag = true;
    for (int i = 0; i < m; i++) {
      int cnt = 0;
      for (int idx: s[i]) {
        if (str[idx] == '1') {
          cnt++;
        }
      } 
      if (cnt % 2 != p[i]) flag = false;
    }
    if (flag) {
      ans++;
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

const int L=1e5+2;
LL A[L];
LL B[L];
LL C[L];
int main() {
	int N,Q;
	cin >> N >> Q;
	for(int i=1;i<=N;i++){
		cin >> A[i];
	}
	B[1]=C[1]=A[1];
	for(int i=2;i<=N;i++){
		B[i]+=A[i]+B[i-2];
		C[i]+=A[i]+C[i-1];
	}
	for(int i=0;i<Q;i++){
		int X;
		cin >> X;
		if(abs(X-A[N-1])>abs(X-A[N])){
			//cerr << "a" << endl;
			cout << B[N] << endl;
			continue;
		}
		LL low=0,hi=(N+1)/2+1;
		LL m;
		while(low+1<hi){
			m=(low+hi)/2;
			//cerr << m << endl;
			if(A[N-m+1]<=X){
				hi=m;
				continue;
			}
			if(abs(X-A[N-m+1])<abs(X-A[N-2*m+2])){
				hi=m;
				continue;
			}
			low=m;
		}
		m=low;
		LL r=C[N]-C[N-m];
		if(N-2*m>0){
			r+=B[N-2*m];
		}
		cout << r << endl;
#if 0
		if(X==N||X==N-1){
			cerr << "a" << endl;
			cout << B[N] << endl;
		}
		else if(X<=N/4)
		{
			cerr << "b" << endl;
			cout << C[N]-C[N/2] << endl;
		}
		else{
			int low=0,hi=N+1;
			while(low+1<hi){
				int m=((LL)low+hi)/2;
				if(X+(m-1)/2<N-m+1){
					low=m;
				}
				else{
					hi=m;
				}
			}
			LL r=0;
			if(X+(low-1)/2+1<N-low+1){
				r+=C[N]-C[X+(low-1)/2];
				if(low/2-2>0){
					r+=B[low/2-2];
				}
				cerr << "c" << endl;
			}
			else{
				r+=C[N]-C[X+(low-1)/2];
				if(low/2-1>0){
					r+=B[low/2-1];
				}
				cerr << "d" << endl;
			}
			cout << r << endl;
		}
#endif
	}

	return 0;
}



Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if(abs(x - a) < abs(x - b)){
		cout << "A" << endl;
	}
	else{
		cout << "B" << endl;
	}
	return 0;
}

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

int main(){
    int N, Q;
    cin >> N >> Q;
    vector<pair<int, pair<int, int>>> event;
    for (int i = 0; i < N; i++) {
        int s, t, x;
        scanf("%d", &s);
        scanf("%d", &t);
        scanf("%d", &x);
        event.push_back({s-x, {1, x}});
        event.push_back({t-x, {-1, x}});
    }
    sort(event.begin(), event.end());
    set<int> stop;
    auto it = event.begin();
    for (int i = 0; i < Q; i++) {
        int d;
        scanf("%d", &d);
        while (it != event.end() && (*it).first <= d) {
            int p = (*it).second.first;
            int q = (*it).second.second;
            if (p == 1) stop.insert(q);
            else stop.erase(q);
            it++;
        }
        if (!stop.empty()) printf("%d\n", *stop.begin());
        else printf("-1\n");
    }
    return 0;
}


Measured memory_bytes: 15340
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;	
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin >> n;
	string s;
	cin >> s;
	if (s.size() & 1){
		cout << "No" << endl;
	}
	else {
		string a,b;
		for (int z=0;z<n/2;z++){
			a += s[z];
		}
		for (int z=n/2;z<n;z++){
			b += s[z];
		}
		if (a == b) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 256
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
if n<=min(a,b,c,d,e):
  print(5)
elif n%min(a,b,c,d,e)==0:
  print(4+int(n/min(a,b,c,d,e)))
else:
  print(5+int(n/min(a,b,c,d,e)))
  

Measured memory_bytes: 3064
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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

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


	int N = getint();
	int D = getint();
	ll kotae = (N - 1) * (ll)D;
	int A[200001];
	int C[200001];
	C[0] = 1e9;
	rep1(i, N) {
		A[i] = getint();
		kotae += A[i];
		C[i] = min(C[i - 1] + D, A[i]);
	}
	int mae = 1e9;
	for (int i = N - 1; i > 1; i--) {
		mae = min(mae + D, A[i + 1]);
		kotae += min(A[i], min(mae, C[i - 1]) + D);
	}
	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 1792
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
s = input()
t = input()
n = len(s)
if s == t[:n]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 10296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef vector<int> vei;
typedef vector<vector<int>> ve_vei;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

    int N, M, C; cin >> N >> M >> C;
    vei B(M); rep(i,M) cin >> B[i];
    ve_vei A(N, vei(M)); rep(i,N) rep(j,M) cin >> A[i][j];

    int cnt = 0;
    int sum = 0;
    rep(i,N) {
        sum = 0;
        rep(j,M) sum += A[i][j] * B[j];
        sum += C;
        if (sum > 0) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
int main()
{
    long long n,a,b;
    cin>>n>>a>>b;
    if((b-a)%2==0)
    {
        cout<<(b-a)/2<<endl;
    }
    else
    {
        ll a1=(a+b-1)/2,a2=n-((a+b-1)/2);
        cout<<min(a1,a2)<<endl;
    }
    return 0;

}


Measured memory_bytes: 768
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;

deque<pair<int, int> > deq;

const int MAX = 1000;
/* 配列 a の [left, right) をソートします */
void MergeSort(int a[], int left, int right) {
    if (right - left == 1) return;
    int mid = left + (right - left) / 2;

    // 左半分 [left, mid) をソート
    MergeSort(a, left, mid);

    // 右半分 [mid, right) をソート
    MergeSort(a, mid, right);

    //一旦「左」と「右」のソート結果をコピーしておく (右側は左右反転)
    int buf[1000];
    int index_buf = 0;
    for (int i = left; i < mid; ++i) {
        buf[index_buf++] = a[i];
    }
    for (int i = right-1; i >= mid; --i) {
        buf[index_buf++] = a[i];
    }
    int last_index_buf = --index_buf;

    // マージする
    int iterator_left = 0;                    // 左側のイテレータ
    //int iterator_right = (int)buf.size() - 1; // 右側のイテレータ
    int iterator_right = last_index_buf;
    for (int i = left; i < right; ++i) {
        // 左側採用
        if (buf[iterator_left] <= buf[iterator_right]) {
            a[i] = buf[iterator_left++];
        }
        // 右側採用
        else {
            a[i] = buf[iterator_right--];
        }
    }
}

#include <queue>
#include <stack>

void breadthFirstSearch(Graph& G,const int n,int initVertex,vector<int>& dist){
    //BFS用のデータ構造
    dist.assign(n,-1);//頂点の深さ記録
    queue<int> que;//次の訪問先を記録

    //初期値
    dist[initVertex] = 0;
    que.push(initVertex);

    while(!que.empty()){
        int v = que.front();
        que.pop();

        for(auto next_v:G[v]){
            if(dist[next_v] != -1) continue;
            dist[next_v] = dist[v] + 1;
            que.push(next_v);
        }

    }

}

vector<bool> seen;
vector<int> first_order;
vector<int> last_order;
void dfs(Graph& G,int v,int& first,int& last){
    first_order.push_back(first++);
    seen[v] = true;
    for(auto next_v:G[v]){
        if(seen[next_v]) continue;
        dfs(G,next_v,first,last);
    }

    last_order.push_back(last++);




}



int main() {
    
    
    int n;
    cin >> n;
    vector<int> num(n);

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

    bool flag = false;
    int index=-1;
    sort(num.begin(),num.end());
    for(int i=0;i < n-1;i++){
        int val = num[i];
        for(int j = i + 1;j < n;j++){
            if(val == num[j]) flag =true;
            break;
               
        }
        if(flag) break;
    }

    if(!flag) cout << "YES" << endl;
    else cout << "NO" << endl;


    return 0;
}

Measured memory_bytes: 1024
/*Remember: The Struggle is Important*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

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

#define     int          long long int
#define     fast()       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     __gcd((a),(b))
#define     lcm(a,b)     ((a)*(b))/gcd((a),(b))
#define     pb           push_back
#define     ins          insert
#define     F            first
#define     S            second

const int inf=1e18,MOD=1e9+7;

void solve()
{
 int n,k;
 string s;

 cin>>n>>k;
 cin>>s;

 if(s[k]>='a' && s[k]<='z')
 s[k-1]-=32;
 else
 s[k-1]+=32;

 cout<<s;
}

int32_t main()
{
 fast();

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

 return 0;
}



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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  vector<int> d(n);
  rep(i, n) cin >> d[i];
  sort(all(d));
  out(d[n / 2] - d[n / 2 - 1]);
}


Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
int main(){
	int n,d,ans=0;
	cin>>n>>d;
	int a[n+1][d+1];
	for(int i=1;i<=n;i++)
		for(int j=1;j<=d;j++)
			cin>>a[i][j];
	double x=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			x=0;
			for(int k=1;k<=d;k++)
				x+=abs(a[i][k]-a[j][k])*1.0*abs(a[i][k]-a[j][k])*1.0;
			if(sqrt(x)==(int)(sqrt(x)))
				ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N,most=0;
  string S;
  map<string,int> mp;
  cin>>N;
  for(int i=0;i<N;i++){cin>>S;mp[S]++;most=max(mp[S],most);}
  for(auto p:mp){if(p.second==most)cout<<p.first<<endl;}
}

Measured memory_bytes: 25216
#include<stdio.h>
 #include<string.h>
 int main(){   
  char r[6],a[6];    
 int hit,blow,i,j;   
  while(scanf("%s%s",r,a)!=EOF){   
      if(strcmp(r,"0")==0 && strcmp(a,"0")==0)break; 
        hit=blow=0;        
 for(i=0;i<4;i++){ 
            if(r[i]==a[i])hit++; 
            for(j=0;j<4;j++){    

             if(j!=i && r[i]==a[j])

blow++;     
        }  
       }     
    printf("%d %d\n",hit,blow); 
    }  
   return 0; 
}

Measured memory_bytes: 540
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

A, B = map(int, raw_input().split())
if A > B:
    print A * 2 - 1
elif A == B:
    print A + B
else:
    print B * 2 - 1

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

#define int long long
#define double long double
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())
#define fr first
#define sc second
typedef long long ll;
typedef pair<int,int> pii;



void solve() {
    int n, k;
    cin >> n >> k;
    if (n == 0) {
        cout << 0 << endl;
        return;
    }
    if (n == k) {
        cout << 0 << endl;
        return;
    }
    n %= k;
    cout << min(k - n, k - (k - n)) << endl;
}


int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef DK
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    while (cin.peek() != EOF) {
        solve();
        cout << endl << endl;
        string s("#");
        do getline(cin, s);
        while (!cin.eof() && !s.empty());
        while (isspace(cin.peek())) cin.get();
    }
#else
    solve();
#endif
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define N 5010
using namespace std;
int n,k,dp[20][N],num[N],ans;
void sol(int l,int r,int now){
    if(l==r){
        int i;
        for(i=max(0,k-num[l]);i<k;i++)if(dp[now][i])break;
        if(i<k)ans++;
        return;
    }
    int i,j,mid=((l+r)>>1);
    for(i=0;i<k;i++)dp[now+1][i]=dp[now][i];
    for(j=l;j<=mid;j++){
        for(i=k-1; i>=num[j]; i--)dp[now+1][i]|=dp[now+1][i-num[j]];
    }
    sol(mid+1,r,now+1);
    for(i=0;i<k;i++) dp[now+1][i]=dp[now][i];
    for(j=mid+1;j<=r;j++){
        for(i=k-1;i>=num[j];i--){
            dp[now+1][i]|=dp[now+1][i-num[j]];
        }
    }
    sol(l,mid,now+1);
}
int main(){
    int i,j;
    cin>>n>>k;
    for(i=1;i<=n;i++)cin>>num[i];
    dp[0][0]=1;
    sol(1,n,0);
    cout<<n-ans;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

const int M = 1005, N = 1005;

int m, n, in[M][N], c[M][N], ans[M][N];
bool vis[M][N];

int solve(int a, int b)
{
    if (vis[a][b])
        return ans[a][b];
    vis[a][b] = true;
    if (b == n + 1)
        return ans[a][b] = 0;
    else
    {
        if ((a + b) % 2 == 0)        // first player
        {
            if (a == m + 1)
                return ans[a][b] = c[m][b] - solve(a, b + 1);
            else
                return ans[a][b] = max(2 * c[a - 1][b] - c[m][b] - solve(a, b + 1), -solve(a + 1, b));
        }
        else                    // second player
        {
            if (a == m + 1)
                return ans[a][b] = -c[m][b] - solve(a, b + 1);
            else
                return ans[a][b] = max(c[m][b] - 2 * c[a - 1][b] - solve(a, b + 1), -solve(a + 1, b));
        }
    }
}

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; i++)
        for (int j = 1; j <= n; j++)
        {
            scanf("%d", &in[i][j]);
            c[i][j] = c[i - 1][j] + in[i][j];
        }
    printf("%d\n", abs(solve(1, 1)));
}



Measured memory_bytes: 16048
#include<bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int a,int b)
{
  if(a==0) return b;
  else return gcd(b%a,a);
}
int32_t main()
{
  int t,n,i,j,k,l,l1;
  cin>>n;
  int a[n+1];
  for(i=1;i<=n;i++) cin>>a[i];
  j=1;
  for(i=1;i<=n;i++)
  {
    if(a[i]==j)
    {
      j++;
    }
  }
  if(j==1) cout<<"-1";
  else 
  cout<<n-(j-1);
}

Measured memory_bytes: 5188
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  const long long INF = LLONG_MAX / 10;
  int N, K;
  cin >> N >> K;
  long long H[N + 1];
  H[0] = 0;
  for (int i = 1; i <= N; i++) cin >> H[i];
  vector<int> vec(H, H + N + 1);
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  auto id = [&](int x) {
    return lower_bound(vec.begin(), vec.end(), x) - vec.begin();
  };
  for (int i = 0; i <= N; i++) H[i] = id(H[i]);
  debugArray(H, N + 1);
  long long dp[N + 1][N + 1][K + 1];
  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= N; j++) fill(dp[i][j], dp[i][j] + K + 1, INF);
  fill(dp[0][0], dp[0][0] + K + 1, 0);
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= N; j++) {
      for (int k = 0; k <= K; k++) {
        dp[i][H[i]][k]
            = min(dp[i][H[i]][k], dp[i - 1][j][k] + max(0, vec[H[i]] - vec[j]));
        if (k < K) dp[i][j][k + 1] = min(dp[i][j][k + 1], dp[i - 1][j][k]);
      }
    }
  }
  long long ans = INF;
  for (int j = 0; j <= N; j++)
    for (int k = 0; k <= K; k++) ans = min(ans, dp[N][j][k]);
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 216720
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int ll;
typedef vector<int > vecint;
typedef vector<string > vecstr;
int main()
{
  int w, a, b;
  cin >> w >> a >> b;
  int c = max(a, b);
  int d = min(a, b);
  cout << max(0, c - w - d) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>

using namespace std;
using ll=int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi=vector<int>;
using vii=vector<vi>;
using vl=vector<ll>;
using vll=vector<vl>;
using tpi=tuple<int, int, int>;

int main() {
    using vp=vector<pii>;
    int N, K;
    string S;
    cin >> N >> K >> S;

    vi d;
    int prev = S[0];
    for (auto i = 1; i < N; i++) {
        if (prev != S[i]) {
            d.emplace_back(i);
            prev = S[i];
        }
    }

    int n_del = max(static_cast<int>(d.size() - 2 * K), 0);
    cout << N - 1 - n_del << endl;
    return 0;
}



Measured memory_bytes: 956
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
	
#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	const int n = 1001;
	int f[n + 1];
	f[0] = 1, f[1] = 2;
	for (int i = 2; i <= n; ++i)
		f[i] = (f[i - 1] + f[i - 2]) % n;

	int v, d;
	while (~scanf("%d%d", &v, &d))
	{
		vector<int> s;
		for (int i = 1; i <= v; ++i)
			s.push_back(f[i]);
		sort(all(s));

		int res = 1;
		for (int i = 1; i < s.size(); ++i)
			if (s[i] - s[i - 1] >= d)
				++res;
		printf("%d\n", res);
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
	ll hituyou=0;
	ll N,K;
	double kakuritu1,kakuritu_sum=0;
	cin>>N>>K;
	for(ll i=1;i<=N;i++){
		while(i*(int)pow(2.0,hituyou*1.0)<K)hituyou++;
		//cout<<hituyou<<endl;
		kakuritu_sum+=(1.0/(double)N)*pow((1.0/2.0),hituyou*1.0);
		hituyou=0;
	}
	printf("%.12f\n",kakuritu_sum);
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxn 500010
using namespace std;
int n;
char s[maxn];
int a[maxn*2],t[maxn*2];
bool check(int x)
{
    int len=n;
    memcpy(t,a,sizeof(a));
    for(int i=1;i<=len;i++)  t[i]*=9;
    for(int i=1;i<=len;i++)
    {
        t[i+1]+=t[i]/10;
        t[i]%=10;
    }
    while(t[len+1])
    {
        len++;
        t[len+1]=t[len]/10;
        t[len]%=10;
    }
    t[1]+=9*x;
    for(int i=1;i<=len;i++)
    {
        t[i+1]+=t[i]/10;
        t[i]%=10;
    }
    while(t[len+1])
    {
        len++;
        t[len+1]=t[len]/10;
        t[len]%=10;
    }
    int sum=0;
    for(int i=1;i<=len;i++)  sum+=t[i];
    return (sum%9==0&&sum<=9*x);
}
int ans;
int main()
{
    scanf("%s",s+1);
    n=strlen(s+1);
    for(int i=1;i<=n;i++)  a[i]=s[i]-'0';
    reverse(a+1,a+n+1);
    int l=1,r=n;
    while(l<=r)
    {
        int mid=(l+r)/2;
        if(check(mid))
        {
            ans=mid;
            r=mid-1;
        }
        else l=mid+1;
    }
    printf("%d\n",ans);
    return 0;
}

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

#define MAX_N (100000)

int main(int argc, char *argv[]) {
  // read inputs
  int N, ps[MAX_N];
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &ps[i]);
    ps[i]--;  // NOTE : modified input
  }

  // solve
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (i == ps[i]) {
      ans++;
      if (i + 1 < N && i + 1 == ps[i + 1]) {
        i++;  // move by 2
      }
    }
  }
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int h,w;
//verified ATC002-A,WUPC2012-C
#define GRID_Y 50
#define GRID_X 50
#define WALL '#'
vector<string> data;
void grid_bfs(int sy,int sx,int d[GRID_Y][GRID_X]){
    bool used[GRID_Y][GRID_X];
    rep(i,GRID_Y)rep(j,GRID_X)used[i][j]=false;
    
    rep(i,GRID_Y)rep(j,GRID_X)d[i][j]=INF;
    d[sy][sx]=0;
    
    queue<pii> que;
    que.push(pii(sy,sx));
    while(que.size()){
        int y=que.front().first, x=que.front().second;
        que.pop();
        if(used[y][x])continue;
        used[y][x]=true;
        
        int dy[]={1,0,-1,0},dx[]={0,1,0,-1};
        rep(i,4){
            int ddy = y+dy[i],ddx=x+dx[i];
            if( ddx<0 || ddy<0 || ddx>=w || ddy>=h || used[ddy][ddx] || data[ddy][ddx]==WALL )continue;
            d[ddy][ddx] = d[y][x]+1;
            que.push(pii(ddy,ddx));
        }
    }
}


int main(){
    cin>>h>>w;
    
    data.resize(h);
    rep(i,h)cin>>data[i];
    
    int sum = 0;
    rep(i,h){
        rep(j,w){
            if(data[i][j]=='.')sum++;
        }
    }
    int d[GRID_Y][GRID_X];
    grid_bfs(0,0,d);
    
    if(d[h-1][w-1]==INF){
        cout<<-1<<endl;
        return 0;
    }else{
        cout<<sum - d[h-1][w-1]-1<<endl;
    }
}


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

using namespace std;

#define DEBUG 0
#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
int main(){

	vector<lli> a,b;
	string str;
	cin >> str;
	lli data[30]={0};
	REP(i,str.size()){
		data[str.at(i)-'a']++;
	}
	REP(i,26){
		a.push_back(data[i]);
		data[i]=0;
	}
	cin >> str;
	REP(i,str.size()){
		data[str.at(i)-'a']++;
	}
	REP(i,26){
		b.push_back(data[i]);
		data[i]=0;
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	lli flag=0;
	REP(i,26){
		if(a.at(i) != b.at(i)){
			flag=1;
		}
	}
	if(flag){
		cout<<"No"<<endl;
	}
	else{
		cout<<"Yes"<<endl;
	}
	return 0;
}



Measured memory_bytes: 640
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    if (A == 1 && B == 2) {
      System.out.println(3);
    } else if (A == 1 && B == 3) {
      System.out.println(2);
    } else if (A == 2 && B == 1) {
      System.out.println(3);
    } else if (A == 2 && B == 3) {
      System.out.println(1);
    } else if (A == 3 && B == 1) {
      System.out.println(2);
    } else if (A == 3 && B == 2) {
      System.out.println(1);
    }
  }
}

Measured memory_bytes: 22484
#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]
#![allow(clippy::suspicious_arithmetic_impl)]

// using Rust(1.42.0)
// My Library Repo is at "https://github.com/Loptall/prcn_lib"
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"

/*
    AtCoder Language Update 2020204 お疲れ様でした! 有難いです
*/

// Dep crates are...
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque};
use std::mem::swap;
use std::ops::*;
use std::{i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize};

use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_integer::{binomial, gcd, lcm, Integer};
use permutohedron::Heap;
use proconio::{fastout, input, is_stdin_empty, marker::*};
use rand::random;

// code...
fn main() {
    input! {
        n: usize,
        s: [Chars; n],
    }

    let mut set = HashSet::new();
    let mut ans = 0usize;
    for e in s {
        if !set.contains(&e) {
            set.insert(e);
            ans += 1;
        }
    }

    println!("{}", set.len());
}


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

int main() {
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  int count=0;
  for(int i=0; i<=A; i++)
    for(int j=0; j<=B; j++)
      for(int k=0; k<=C; k++)
        if(500*i+100*j+50*k==X) count++;

  cout << count << endl;
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = l[0], k = l[1];
            var D = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var use = new List<int>();
            foreach (var i in Enumerable.Range(0, 10))
            {
                if (!D.Contains(i))
                    use.Add(i);
            }

            var ans = 0;
            for (var i = n; i <= 10 * n; i++)
            {
                var tmp = i;
                var flag = true;
                while (tmp > 0)
                {
                    if (!use.Contains(tmp % 10))
                    {
                        flag = false;
                        break;
                    }

                    tmp /= 10;
                }

                if (flag)
                {
                    ans = i;
                    break;
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
#!/usr/bin/env python3
from collections import defaultdict
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

n = int(input())
a = [int(item) for item in input().split()]

ans = 10**10 
for i in range(-100, 101):
    ret = 0
    for item in a:
        ret += (item - i) * (item - i)
    ans = min(ans, ret)

print(ans)

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

string S;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  
  cin >> S;
  
  ll ans = 0;
  for (ll i = 1; i < S.length(); i++) {
    if (S[i] != S[i-1]) {
      ans++; 
    }
  }
  
  cout << ans << "\n";
  
  return 0;
}

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

#define x first
#define y second
#define all(x) begin(x), end(x)

typedef long long ll;
typedef long double ld;

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

template<typename T>
using normal_queue = priority_queue<T, vector<T>, greater<T>>;

const int MAX_N = 1e5 + 10;

int a[MAX_N];

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	int l = -1, r = 1e9 + 1; //l <= ans, r > ans
	while (r - l > 1) {
		int mid = (l + r) / 2;
		ordered_set<pair<int, int>> pref_sums;
		pref_sums.insert({0, 0});
		int balance = 0;
		ll ans = 0;
		for (int i = 0; i < n; ++i) {
			if (a[i] >= mid)
				++balance;
			else
				--balance;
			ans += pref_sums.order_of_key({balance, n + 10});
			// cout << "for " << balance << " " << ans << "\n";
			pref_sums.insert({balance, i + 1});
		}
		// ll myans = 0;
		// for (int i = 0; i < n; ++i) {
		// 	ll summ = 0;
		// 	for (int j = i; j < n; ++j) {
		// 		if (a[j] >= mid)
		// 			++summ;
		// 		else
		// 			--summ;
		// 		if (summ >= 0)
		// 			++myans;
		// 	}
		// }
		// cout << mid << " -> " << ans << " " << myans << endl;
		// assert(myans == ans);
		// cout << mid << " -> " << ans << "\n";
		if (ans >= (ll(n) * (n + 1) / 2 + 1) / 2)
			l = mid;
		else
			r = mid;
	}
	cout << l << "\n";
	return 0;
}

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

int main(){
  int r, g, b;
  cin >> r >> g >> b;
  int sum = 100*r + 10*g + b;
  if (sum % 4 == 0){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
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 blank = " ";
        String data[] = br.readLine().split(blank);
        int a = Integer.parseInt(data[0]);
        int b = Integer.parseInt(data[1]);
        int c = Integer.parseInt(data[2]);
        
        int i = 0;
        for (int l = 0; a + l <= b; l++){
            if(c % (a + l) == 0){
                i++;
            }
        }
        System.out.println(i);
    }
}


Measured memory_bytes: 24360
object Main extends App {

  val Array(n, x) = scala.io.StdIn.readLine().split(" ").map(_.toInt)
  val lArr = scala.io.StdIn.readLine().split(" ").map(_.toInt)


  def solve() = {
    val dArr = Array.fill(n+1)(0)
    for(i <- 1 to n) {
      dArr(i) = dArr(i-1) + lArr(i-1)
    }
    dArr.count(_ <= x)
  }

  println(solve)

}


Measured memory_bytes: 27340
def output(A, b): 
    BW = [0,0,0]
    for i in range(len(A)):
        for j in range(len(b)):
            if(A[i] == b[j]):
                BW[i] = 1
                break
            else:
                continue
    return BW

A0 = list(map(int, input().split()))
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
N = int(input())
b = [0]*N
for i in range(N):
    b[i] = int(input())

x = output(A0, b)
y = output(A1, b)
z = output(A2, b)

ans = 0
if(sum(x)==3 or sum(y)==3 or sum(z)==3):
    ans = 1
for i in range(3):
    if(x[i]==1 and y[i]==1 and z[i]==1):
        ans = 1
        break
if(x[0]==1 and y[1]==1 and z[2]==1):
    ans = 1
elif(x[2]==1 and y[1]==1 and z[0]==1):
    ans = 1

if(ans==1):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
import numpy as np
N, M = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b =  map(int, input().split())
    A.append(a)
    B.append(b)
i = 0
num = 0
ans = 0
A_argsort= np.argsort(A)
while num < M:
    ans += A[A_argsort[i]] * B[A_argsort[i]]
    num += B[A_argsort[i]]
    i += 1
ans -= (num - M) * A[A_argsort[i - 1]]
print(ans)

Measured memory_bytes: 21608
#include <stdio.h>
void bubblesort(int a[],int n){
    int i,v,cnt=0;
    int flag=1;
    while(flag){
        flag=0;
        for(i=n-1;i>0;i--){
            if(a[i]<a[i-1]){
                v=a[i];
                a[i]=a[i-1];
                a[i-1]=v;
                cnt++;
                flag=1;
            }
            
        }
    }
    for(i=0;i<n;i++){
        if(i>0)
            printf(" ");
        printf("%d",a[i]);
    }
    
    printf("\n%d\n",cnt);
}

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



Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    ll N;
    cin >> N;
    vll A(N);
    map<ll, ll> cnt;
    rep(i, N)
    {
        cin >> A[i];
        cnt[A[i]]++;
    }
    ll s = 0;
    for (auto i : cnt)
    {
        ll num = i.second;
        s += num * (num - 1) / 2;
    }
    rep(k, N)
    {
        cout << s - (cnt[A[k]] - 1) << "\n";
    }
    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int ans=0;
    int m,d;
    cin >>m>>d;
    for(int i=2;i<=m;++i)
        for(int j=20;j<=d;++j){
            int c=j/10;
            int f=j%10;
            if(i==c*f&&f>=2){ans++;}
            
        }
        cout<<ans<<endl;
}


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

const long long MOD = 1000000007LL;

int main(){

    int h, w, k; cin >> h >> w >> k;
    k--;
    vector<vector<long long> > dp(h + 1, vector<long long> (w, 0LL));
    dp[0][0] = 1LL;

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            for(int bit = 0; bit < (1 << (w - 1)); bit++){
                //cout << bitset<8>(bit) << endl;

                //cout << i << " " << j << " " << bit << endl;
                //bitが隣り合うとダメ
                bool exist = false;
                for(int k = 0; k < w - 2; k++){
                    if(bit & (1 << k) && bit & (1 << k + 1)){
                        exist = true;
                        break;
                    }
                }

                if(exist) continue;

                if(j != 0 && bit & (1 << j - 1)){

                    dp[i + 1][j - 1] += dp[i][j];
                    dp[i + 1][j - 1] %= MOD;
                    //cout << "dp[" << i + 1 << "][" << j - 1 << "] = " << dp[i + 1][j - 1] << endl;                    

                }else if(j != w - 1 && bit & (1 << j)){


                    //cout << "ok" << endl;
                    dp[i + 1][j + 1] += dp[i][j];
                    dp[i + 1][j + 1] %= MOD;
                    //cout << "ok2" << endl;
                    //cout << "dp[" << i + 1 << "][" << j + 1 << "] = " << dp[i + 1][j + 1] << endl;                    
                    

                }else{
                    dp[i + 1][j] += dp[i][j];
                    dp[i + 1][j] %= MOD;
                    //cout << "dp[" << i + 1 << "][" << j << "] = " << dp[i + 1][j] << endl;                    
                }
            }
        }
    }

    cout << dp[h][k] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1009;
int a[maxn];
int b[maxn];
int c[maxn];
int ln,lm,flag;
int t;
bool erjinzhi()
{
    for(int i=0;i<1024;i++)
    {
        memset(b,0,sizeof(b));
        memset(c,0,sizeof(c));
        ln=0;
        lm=0;
        flag=1;
        for(int j=i,cnt=0;cnt<10;cnt++,j>>=1)
        {
            if(j&1)
            b[ln++]=a[cnt];
            else
            c[lm++]=a[cnt];
        }
        for(int k=1;k<ln;k++)
        {
            if(b[k-1]>b[k])
            {
                flag=0;
                break;
            }
        }
        if(flag)
        for(int k=1;k<lm;k++)
        {
            if(c[k-1]>c[k])
            {
                flag=0;
                break;
            }
        }
        if(flag)return true;
    }
    return false;
}
int main()
{
    scanf("%d",&t);
    while(t--)
    {

     for(int i=0;i<10;i++)
     scanf("%d",&a[i]);
     bool fl=erjinzhi();
     if(fl)
     printf("YES\n");
     else
     printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 1020
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    
    ans = sum(b)
    for i in range(n-1):
        if a[i] + 1 == a[i+1]:
            ans += c[a[i] - 1]
    print(ans)

main()


Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var N, M int
	fmt.Scanf("%d %d", &N, &M)
	A := make([]int, N)
	sum := 0
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
		sum += A[i]
	}

	m := 0
	for i := 0; i < N; i++ {
		if A[i]*4*M >= sum {
			m++
		}
	}
	if m >= M {
		fmt.Println("Yes")
		return
	}

	fmt.Println("No")
}


Measured memory_bytes: 1824
using System;
using System.Collections.Generic;
using System.Text;

namespace AtCoder
{
  class Program
  {
    static void Main(string[] args)
    {
      string ss = Console.ReadLine();
      int i = 0;
      while(true)
      {
        if(ss.Length >= 7)
        {
          string s = ss.Substring(ss.Length - 7, 7);
          if(s == "dreamer")
          {
            ss = ss.Substring(0, ss.Length - 7);
            continue;
          }
        }
        if(ss.Length >= 6)
        {
          string s = ss.Substring(ss.Length - 6, 6);
          if(s == "eraser")
          {
            ss = ss.Substring(0, ss.Length - 6);
            continue;
          }
        }
        if(ss.Length >= 5)
        {
          string s = ss.Substring(ss.Length - 5, 5);
          if(s == "dream" || s == "erase")
          {
            ss = ss.Substring(0, ss.Length - 5);
            continue;
          }
        }
        break;
      }

      if(ss.Length == 0)
        Console.WriteLine("YES");
      else
        Console.WriteLine("NO");
      Console.ReadLine();
    }

  }
}

Measured memory_bytes: 48136