akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_poizcy.hpp>
typedef long long  ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<double, double>  iidb;
typedef pair<ii, ll>  iii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e18+7;
const double PI = acos(-1);
#define initseg ll new_nodo=(nodo*2),mid=(iz+der)/2;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define tam 210000
#define offset 200
#define ptr nodo*


using namespace std;
const int mod=1e6+3;
int main()
{
	int n;
	cin>>n;
	int valor,c=0;
	forr(i,1,n+1)
	{
		cin>>valor;
		if (i%2==1 && valor%2==1)
			c++;
	}
	cout<<c<<endl;
}

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

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

template <class T> struct range_add {
  static constexpr T inf = numeric_limits<T>::max() / 2;
  struct node { T delta = 0, min = inf, max = -inf, len = 0, sum = 0; };
  static node op(const node& l, const node& r) {
    return {
      l.delta + r.delta,
      std::min(l.min, l.delta + r.min), std::max(l.max, l.delta + r.max),
      l.len + r.len, l.sum + l.delta * r.len + r.sum
    };
  }
  static node make_node(T a) { return {a, a, a, 1, a}; }
  const int n;
  vector<node> t;
  range_add(const vector<T>& v) : n(v.size() + 1), t(2 * n) {
    for (int i = n - 1; i--; ) t[n + i] = make_node(v[i] - (i ? v[i - 1] : 0));
    for (int i = n; i-- > 1; ) t[i] = op(t[2 * i], t[2 * i + 1]);
  }
  node fold(int l, int r) const {
    node a, b;
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) a = op(a, t[l++]);
      if (r & 1) b = op(t[--r], b);
    }
    return op(a, b);
  }
  T get(int i) const { return fold(0, i + 1).delta; }
  T min(int l, int r) const { return get(l - 1) + fold(l, r).min; }
  T max(int l, int r) const { return get(l - 1) + fold(l, r).max; }
  T sum(int l, int r) const { return get(l - 1) * (r - l) + fold(l, r).sum; }
  void set(int i, const node& a) {
    t[i += n] = a;
    while (i >>= 1) t[i] = op(t[2 * i], t[2 * i + 1]);
  }
  void add(int l, int r, T a) {
    set(l, make_node(t[n + l].delta + a));
    set(r, make_node(t[n + r].delta - a));
  }
};

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = size(s);
  vector<int> h(n + 1);
  for (int i = 0; i < n; ++i) {
    if (s[i] == '1') {
      h[i + 1] = h[i] - 1;
    } else {
      h[i + 1] = h[i] + 1;
    }
  }
  int res = n;
  for (int t : {0, 1}) {
    range_add<int> ra(h);
    int mn = ra.min(0, n + 1);
    for (int i = 0; i < n; ++i) {
      if (s[i] != '?') continue;
      if (ra.min(i + 1, n + 1) - 2 >= mn - t) {
        ra.add(i + 1, n + 1, -2);
      }
    }
    int mx = ra.max(0, n + 1);
    res = min(res, mx - (mn - t));
  }
  cout << res << '\n';
}


Measured memory_bytes: 47288
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>

#define MAX(a,b) ((a)>(b) ? (a) : (b))
#define MIN(a,b) ((a)<(b) ? (a) : (b))


using namespace std;




int main(){
	long A,B,C,D;
	cin>>A>>B>>C>>D;
	long ans1,ans2,ans;
	
	ans1=A*B;
	ans2=C*D;
	ans=MAX(ans1, ans2);

	cout<<ans<<endl;
}

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

signed main() {
                                                                  
	int n;
	string s;
	cin >> n >> s;

	int cnt = 0;
	for (int i = 0; i < n - 2; i++) {
	 	if (s[i] == 'A' && s[i+1] == 'B' && s[i + 2] == 'C') cnt++;
	}
	cout << cnt << '\n';

}

Measured memory_bytes: 256
#!/usr/bin/env

import sys

weights = map(lambda n: 2 ** n, range(0, 10))
weights.reverse()
while True:
    try:
        m = int(raw_input())
    except EOFError:
        break
    s = []
    for w in weights:
        if w <= m:
            s.append(w)
            m -= w
    s.reverse()
    print ' '.join(map(str, s))

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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> ate(n, k-q);
    rep(i,q) {
        int a;
        cin >> a;
        a--;
        ate[a]++;
    }
    rep(i,n) {
        if (ate[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3752
# AOJ 0226: Hit and Blow
# Python3 2018.6.23 bal4u

while 1:
	r, a = input().split()
	if r == '0': break
	h, sr, sa = 0, set(), set()
	for i in range(4):
		if r[i] == a[i]: h += 1
		else:
			sr.add(r[i])
			sa.add(a[i])
	print(h, len(sr & sa))


Measured memory_bytes: 5580
'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineerin College

'''
import sys
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]



def solve():
    
    
    
    # for _ in range(ii()):
    
    
    
    s = si()
    t = si()
    n = len(t)
    
    def f(s1):
        cnt = 0
        for i in range(n):
            if t[i]!=s1[i]:
                cnt+=1
        return cnt
        
    ans = inf
    for i in range(len(s)-n+1):
        s1 = s[i:(i+n)]
        # print(s[i])
        ans = min(ans,f(s1))
    print(ans)
    
    
    
    
        
    
    
if __name__ =="__main__":
    # read()
    solve()
    

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair


int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  string s;
  vector<char> out;
  cin >> s;
  stack<char> st;
  for (auto a : s){
    if(a == 'B'){
      if(!st.empty()) 
        st.pop();
    }
    else st.push(a);
  }
  while (!st.empty()) { char c = st.top(); out.push_back(c); st.pop(); }
  
  reverse(out.begin(), out.end());
  
  for (auto pp : out) { cout << pp; }
  cout << "\n";
  return 0;

}


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

using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
 
#define ll long long int
#define fast ios_base::sync_with_stdio(false)
#define fast_input cin.tie(NULL)
#define fast_output cout.tie(NULL)
#define vi vector<long long int> 
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(a,b) for(int a=0;a<b;a++)
#define fe(d,e) for(auto d:e)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
#define ordered_set tree<pa, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
// ll mul(ll a,ll b)
// {
// 	return (a%mod*b%mod)%mod;
// }
// ll add(ll a,ll b)
// {
// 	ll res=a+b;
// 	if(res>=mod)
// 	{
//       res-=mod;
// 	}
// 	return res;
// }
// ll sub(ll a,ll b)
// {
// 	ll res=a-b;
// 	if(res<0)
// 	 res+=mod;
// 	return res;
// }
ll powmod(ll a, ll b)
{
    ll res = 1;
    while (b) {
        if (b&1) {
            res =res*a;
			res%=mod;
        }
        b >>= 1;
		a=a*a;
        a%=mod;
    }
 
    return res;
}
 
ll modinv(ll a)
{
    return powmod(a, mod - 2);
}
//  unordered_map<ll,ll>facti;
//  ll fact(ll n)
//  {
// 	if(n==0)return 1;
// 	if(n<=1)return 1;
// 	if(facti[n]!=0)return facti[n];
// 	return facti[n]=mul(n,fact(n-1));
//  }
//   ll ncr(ll n,ll r)
//   {
//         ll h=fact(n);
// 	ll v=fact(r);
// 	ll j=fact(n-r);
// 	v=mul(v,j);
// 	v=powmod(v,mod-2);
// 	return mul(h,v);
//  }
// int fastread(){
//     int x=0;
//     int c = getchar_unlocked();
//     while(c<48)
//         c = getchar_unlocked();
//     while(c>=48){
//         x = x*10 + (c - 48);
//         c = getchar_unlocked();
//     }
//     return x;
// }
// priority_queue<pa,vector<pa>,greater<pa>>q; used fo min heap


// dsu


// ll par[1000001];
// ll siz[1000001];
// ll find(ll i)
// {
//     if(par[i]!=i)
//     {
//         return par[i]=find(par[i]);
//     }
//     return i;
// }
// void dounion(ll i,ll j)
// {
//     ll p1=find(i);
//     ll p2=find(j);
//     if(siz[p1]>=siz[p2])
//     {
//         par[p2]=p1;
//     }
//     else
//     {
//         par[p1]=p2;
//     }
//     if(siz[p1]==siz[p2])
//     {
//         siz[p2]++;//siz is rank of a parent
//     }
// }



///ends here////
void solve()
{
    ll n,w;
	cin>>n>>w;
    vi item(n+1),weight(n+1);
	for(int i=1;i<=n;i++)
	{
		cin>>weight[i]>>item[i];
	}
	ll ans[n+1][w+1];
	f(i,n+1)
	 ans[i][0]=0;
	f(i,w+1)
	 ans[0][i]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=w;j++)
		{
		    if(weight[i]<=j)
            ans[i][j]=max(ans[i-1][j],ans[i-1][j-weight[i]]+item[i]);
			else
			{
				ans[i][j]=ans[i-1][j];
			}
			// cout<<ans[i][j]<<" ";
		}
		// cout<<endl;
	}
	cout<<ans[n][w];
}
int main() {
	fast;
	fast_input;
	fast_output;
	// ll t;
	// cin>>t;
	// f(i,t)
	// {
    //   cout<<"Case #"<<i+1<<":"<<" ";
	     solve();
	// }
	return 0;
}

Measured memory_bytes: 79232
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順
#include <map>

using namespace std;
using ll = long long int;

int main(){
    int N;cin>>N;
    vector<pair<int,int>> A(N);
    for(int i=0;i<N;i++){
        int a,b;cin>>a>>b;
        A[i] = {b,a};
    }
    sort(A.begin(),A.end());
    int time = 0;
    for(int i=0;i<N;i++){
        time += A[i].second;
        if(time > A[i].first){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 4792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		if (s.contains("a") && s.contains("b") && s.contains("c")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

ll fac[MAX], finv[MAX], inv[MAX];

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

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

int main() {
    ll n, k; cin >> n >> k;
    ll ans = 0;
    Rep(i, k, n+2) {
        ll ma = (2*n - i + 1) * i / 2;
        ll mi = i * (i-1) / 2;
        //cout << ma << ' ' << mi << endl;
        ans += ma - mi + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3600
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x[100][100],y[1000],a,b,c;
    cin>>a>>b;
    for(int i=0;i<a;i++){
        for(int o=0;o<b;o++){
            cin>>x[i][o];
        }
    }
    for(int o=0;o<b;o++){
        cin>>y[o];
    }
    for(int i=0;i<a;i++){
        c=0;
        for(int o=0;o<b;o++){
            c=c+(x[i][o]*y[o]);
        }
        cout<<c<<endl;
    }
}



Measured memory_bytes: 3124
N = int(input())
A = [0] * (N + 2)
for i, v in enumerate(input().split()):
    A[i+1] = int(v)
num = sum([abs(A[i] - A[i+1]) for i in range(N+1)])
for i in range(1,N+1):
    ret = num + abs(A[i-1] - A[i+1]) - (abs(A[i-1] - A[i]) + abs(A[i] - A[i+1]))
    print(ret)

Measured memory_bytes: 14000
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

#define SIZE 2000000

int A[SIZE];
int H;

void insert(int x)
{
  int tmp;
  A[H] = x;
  H++;
  int i=H-1;
  int parent = (i-1)/2;
  if (H<1) return;
  while (A[parent]<A[i]) {
    tmp = A[parent];
    A[parent] = A[i];
    A[i] = tmp;
    if (i==0) break;
    tmp = i;
    i = parent;
    parent = (i-1)/2;
  }
}

void maxHeapify(int i) {
  int largest, tmp;
  int l = (i+1)*2-1;
  int r = (i+1)*2;

  if (l<H && A[l]>A[i])      largest = l;
  else                       largest = i;
  if (r<H && A[r]>A[largest])  largest = r;

  if (largest != i) {
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(largest);
  }
}
int extract()
{
  if (H<0) return -1;
  int val = A[0];
  A[0]=A[H-1];
  maxHeapify(0);
  H--;
  return val;
}


void print()
{
  int i, n=1;
  printf("[ ");
  while (1) {
    for (i=n-1; i<=(n-1)*2; i++) {
      if (i>=H) goto END;
      printf("%d ",A[i]);
    }
    printf("\n");
    n*=2;
  }
 END:
  printf("] H==%d\n", H);
}

int main() {
  int key;
  char com[20];
  while (1) {
    scanf("%s", com);
    if (com[2] == 'd')   break;
    if (com[0] == 'i') {
      scanf("%u", &key);
      insert(key);
    } else { // extract
      int e = extract();
      if (e<0) break;
      printf("%d\n", e);
    }
  }
  return 0;
}


Measured memory_bytes: 5716
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main (){
    int N,temp;
    int anc =0;
    int p[10];
    scanf("%d",&N);
    for(int i =0; i<N; i++) scanf("%d",&p[i]);

    for(int i= 0; i<N; i++){
        for(int j= N-1; j>i; j--){
            if(p[j] < p[j-1]){
                temp =p[j];
                p[j] =p[j-1];
                p[j-1]= temp;
            }
        }
    } 
  
    anc = p[N-1] / 2;
    for(int i=0; i<N-1; i++)    anc += p[i];
    printf("%d", anc);


    
    

    
   
}
 //chcp 65001 cd contest

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a,b;
  	cin >> a >> b;
  string s;
  cin >> s;
  
  int count =0;
  for(int i=0; i<a+b+1; i++){
  	if(s[i]=='-') count++;
  }
  if(s[a]=='-' && count==1) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
s = [0 for i in range(n)]
for i in range(k):
  d = int(input())
  a = list(map(int, input().split()))
  for j in range(d):
    if s[a[j]-1] == 0:
      s[a[j]-1] = s[a[j]-1] + 1
sum = 0
for i in range(n):
  if s[i] == 0:
    sum = sum + 1
    
print(sum)

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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 2e6 + 5;
const int   mod = 998244353;

void add(int &a,int b)  {
    a += b;
    if (a >= mod)
        a -= mod;
}
void sub(int &a,int b)  {
    a -= b;
    if (a <  0)
        a += mod;
}
int mul(int a,int b)    {
    return  1ll * a * b % mod;
}
int Pow(int a,int b)    {
    int ans = 1;
    while (b)   {
        if(b & 1)   ans = mul(ans,a);
        a = mul(a,a);   b >>= 1;
    }
    return  ans;
}
int inv(int a,int p)    {
    return  a == 1 ? 1 : p - 1ll * p * inv(p % a,a) / a;
}
int Fac[N];
int Inv[N];

int Ckn(int n,int k)    {
    if (n < k)  return  0;
    if (k < 0)  return  0;

    return  mul(Fac[n],mul(Inv[k],Inv[n - k]));
}
typedef pair<int,int>   ii;

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    Fac[0] = Inv[0] = 1;

    for(int i = 1 ; i < N ; ++i)    Fac[i] = mul(Fac[i - 1],i);     Inv[N - 1] = inv(Fac[N - 1],mod);
    for(int i = N - 2 ; i ; --i)    Inv[i] = mul(Inv[i + 1],i + 1);

    int n;  cin >> n;
    int m;  cin >> m;

    int ans = 0;

    for(int i = 0 ; i <= m ; ++i)   if (m % 2 == i % 2) {
        int cur = 1;

        cur = mul(cur,Ckn(n,i));
        cur = mul(cur,Ckn((3 * m - i) / 2 + n - 1,n - 1));

        add(ans,cur);
    }
    for(int i = 0 ; i <= m ; ++i)   if (m % 2 == i % 2) {
        int cur = 0;

        add(cur,mul(Ckn(n,i),Ckn((m - i) / 2 + n - 1,n - 1)));  --n;
        sub(cur,mul(Ckn(n,i),Ckn((m - i) / 2 + n - 1,n - 1)));  ++n;

        sub(ans,mul(cur,n));
    }
    cout << ans << endl;
}


Measured memory_bytes: 15872
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

int main() {
    int a, b;
    cin >> a >> b;
    if(a < b) {
        cout << "a < b" << endl;
    } else if(a > b) {
        cout << "a > b" << endl;
    } else {
        cout << "a == b" << endl;
    }
}


Measured memory_bytes: 3056
//广度优先搜索,BFS
#include<iostream>
#include<cmath>
#include<stdio.h>
typedef long long ll;
using namespace std;
int main()
{
	ll n;
	scanf("%lld",&n);
	int tag=0,x,s=0;
	for(ll i=sqrt(n);i>=1;i--)
	{
		if(n%i==0)
		{
			x=n/i;
			break;
		}
	}
	while(x>0)
	{
		x/=10;
		s++;
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
def main():
    n=int(input())
    color=list(map(int,input().split()))
    nodes=[[]for i in range(n)]
    cut=[[0]for i in range(n+1)]
    ans=[0]*(n+1)
    for i in range(n-1):
        a,b=map(int,input().split())
        nodes[a-1].append(b-1)
        nodes[b-1].append(a-1)
    def num(p,parent):
        s=0
        for child in nodes[p]:
            if child==parent:
                continue
            cut[color[p]].append(0)
            nc=num(child,p)
            group=nc-cut[color[p]].pop()
            ans[color[p]]+=group*(group+1)//2
            s+=nc
        s+=1
        cut[color[p]][-1]+=s
        return s
    num(0,-1)
    for a,c in zip(ans[1:],cut[1:]):
        group=n-c[0]
        c=group*(group+1)//2
        print(n*(n+1)//2-c-a)
main()

Measured memory_bytes: 346496
n = int(input())
lines = [i for i in range(24, n+1) if i % 2 != 0]

ans = 0
for i in lines:
    cnt = 0
    for j in range(1, i+1):
        if i % j == 0:
            cnt += 1
        if cnt == 8:
            ans += 1
print(ans)


Measured memory_bytes: 2940
#include <cstdio>
#include <algorithm>
int N, a[100001], Max, Min, CMax, CMin;
int main()
{
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
		scanf("%d", a + i);
	Max = *std::max_element(a + 1, a + N + 1);
	Min = *std::min_element(a + 1, a + N + 1);
	CMax = std::count(a + 1, a + N + 1, Max);
	CMin = std::count(a + 1, a + N + 1, Min);
	if (Max == Min)
		puts(Max <= N >> 1 || Max == N - 1 ? "Yes" : "No");
	else if (Max == Min + 1)
		puts(CMin + 1 <= Max && Max <= CMin + (CMax >> 1) ? "Yes" : "No");
	else
		puts("No");
	return 0;
}


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

int main() {

    int n; cin >> n;
    
    if (n == 1) {
        cout << 1 << endl;
        return 0;
    }
    else if (n == 2) {
        int a, b; cin >> a >> b;
        if (1 < abs(a - b)) cout << 1 << endl;
        else cout << 2 << endl;
        return 0;
    }

    const int p = 100010;
    vector<int> num(p, 0);
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        num[a]++;
    }
    
    int ans = 0;
    for (int i = 0; i < n - 2; i++) {
        int tmp = 0;
        for (int j = i; j < i + 3; j++) {
            tmp += num[j];
        }
        ans = max(ans, tmp);
    }

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

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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;
ll calc(int type, ll x, ll y, ll z){
	if(type == 0){return x + y + z;}
	if(type == 1){return x + y - z;}
	if(type == 2){return x - y + z;}
	if(type == 3){return x - y - z;}
	if(type == 4){return -x + y + z;}
	if(type == 5){return -x + y - z;}
	if(type == 6){return -x - y + z;}
	if(type == 7){return -x - y - z;}
}
int main(){
    int n, m; cin >>n >> m;
    vector<ll> x(n), y(n), z(n);
    for(int i = 0; i < n; ++i){
    	  cin >> x[i] >> y[i] >> z[i];
    }
    ll ans = -1*INF32;
  for(int t = 0; t<8; ++t){
    vector<ll> vec(n);
    for(int i = 0; i < n; ++i){
    	vec[i] = calc(t, x[i], y[i], z[i]);
    }
    sort(vec.begin(), vec.end(), greater<ll>());
    ll tmp = 0;
    for(int i = 0; i < m; ++i){tmp += vec[i];}
    ans=max(ans, tmp);
  }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int x[8] = { 0,1,2,3,5,7,8,9 };
int n, ok, k;
int main() {
	while (true) {
		ok = 0;
		cin >> n;
		if (!n) { break; }
		for (int i = 10; i >= 0; i--) {
			k = (n / (int)pow(8, i)) % 8;
			if (k > 0) { ok = 1; }
			if (ok == 1) { cout << x[k]; }
		}
		cout << endl;
	}
}

Measured memory_bytes: 1200
#define  ll         long long
#define  pb         push_back
#define  ff         first
#define  ss         second
#define  srt(v)     sort(v.begin(),v.end())

#define  inp(a)     scanf("%d",&a)
#define  lnp(a)     scanf("%lld",&a)
#define  inpp(a,b)  scanf("%d %d",&a,&b)
#define  lnpp(a,b)  scanf("%lld %lld",&a,&b)

#define  pnt(a)     printf("%d",a)
#define  pntl(a)    printf("%lld",a)
#define  mxn        3333
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

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

ll dp[mxn][mxn];
int main()
{

    string s,t;cin >> s >> t;
    ll n = s.size(); s = "0" + s;
    ll m = t.size(); t = "0" + t;

    for(ll i = 1;i <= n;i++){
        for(ll j = 1;j <= m;j++){
            if(s[i] == t[j]){
                dp[i][j] = dp[i-1][j-1] + 1;
            }
            else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    }
    string ans = "";
    ll i = n,j = m;
    while(i >= 1 && j >= 1){
         if(s[i] == t[j]){
            ans += s[i];
            i--;j--;
         }
         else if(dp[i-1][j] > dp[i][j-1]) i--;
         else j--;
    }
    reverse(ans.begin(),ans.end());
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 80128
a = gets.split.map(&:to_i)
d = []
while a[0] != 0 && a[1] != 0
	b = []
	a[0].times do |i|
		b.push(i)
	end
	b = b.reverse
	#p b
	a[1].times do 
		c = gets.split.map(&:to_i)
		if c[1] == a[0]
			next
		else
			c[1].times do 
				i = 0
				b.unshift(b[c[0]-1-i])if c[1] == 1
				if c[1] != 1
					i = i + 1
					b.unshift(b[c[0]+c[1]-1-i])
				end
				b = b.uniq
			end
		end
		#p b
	end
	a = gets.split.map(&:to_i)
	d.push(b.shift + 1)
end
puts d

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

#define all(v) begin(v), end(v)
#define endl '\n';
#define int long long
#define pii pair<int, int>

int32_t main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(0);

    int n; cin >> n;
    vector<int> a(n);
    int xx = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        xx ^= a[i];
    }
    for (int i = 0; i < n; i++) {
        cout << (xx ^ a[i]) << ' ';
    }
    cout << endl;

}

Measured memory_bytes: 4792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{   
    int n;
    cin >> n;
    int x = n * 800;
    int cnt = n/15;
    int y = cnt*200;
    cout << x - y << endl;
    return 0;
}

Measured memory_bytes: 3684
#include <iostream>
using namespace std;
int main(){
  string b;
  cin >> b;
  if(b == "A"){
    cout << "T" << endl;
  }else if(b == "T"){
    cout << "A" << endl;
  }else if(b == "G"){
    cout << "C" << endl;
  }else{
    cout << "G" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  string s;
  cin >> s;

  int result;
  for (int i = 1; i < s.size(); i++) {
    if (s.at(i-1) == s.at(i)) {
      result++;
      if (s.at(i) == '0') {
        s.at(i) = '1';
      } else {
        s.at(i) = '0';
      }
    }
  }

  cout << result;
  return 0;
}


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N int

func main() {
	sc.Split(bufio.ScanWords)

	N = nextInt()
	color := make([]int, 8)
	unassigned := 0

	for i := 0; i < N; i++ {
		a := nextInt()
		switch {
		case a >= 3200:
			unassigned++
		case a >= 2800 && a <= 3199:
			color[0]++
		case a >= 2400 && a <= 2799:
			color[1]++
		case a >= 2000 && a <= 2399:
			color[2]++
		case a >= 1600 && a <= 1999:
			color[3]++
		case a >= 1200 && a <= 1599:
			color[4]++
		case a >= 800 && a <= 1199:
			color[5]++
		case a >= 400 && a <= 799:
			color[6]++
		case a >= 1 && a <= 399:
			color[7]++
		}
	}

	ans := 0
	for _, v := range color {
		if v > 0 {
			ans++
		}
	}

	if ans == 0 {
		fmt.Println(1, unassigned)
		return
	}
	fmt.Println(ans, ans+unassigned)
}


Measured memory_bytes: 1768
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		
		if(a.equals("AAA") || a.equals("BBB")) {
			System.out.println("No");
			
		}else {
			System.out.println("Yes");
			
		}
		
	}
	
}



Measured memory_bytes: 22996
n = int(input())
a = map(int, input().split())
a = list(sorted(a))
big = a[n-1]
mark = [0]*(big+1)
for x in a:
    mark[x] += 1
    if mark[x] > 1:
        continue
    for j in range(x*2, big+1, x):
        mark[j] += 1

ans = 0
for x in a:
    if mark[x] == 1:
        ans += 1

print(ans)


Measured memory_bytes: 32336
#include <bits/stdc++.h>
#define eps 1e-9
#define nmax 200
#define f(c,a,b) for(int c=a; c<=b; c++)
#define pi acos(-1)

using namespace std;
typedef double db;
struct P{
    db x, y;
    P(){}
    P(db x, db y) : x(x) , y(y) {}
    P operator - (P a){ return P(x-a.x, y-a.y); }
    db dot(P a){ return a.x*x + a.y*y; }
    P operator * (db a) { return P(a*x, a*y); }
    P operator + (P a){ return P(x+a.x, y+a.y); }
    db times(P a){ return x*a.y-y*a.x; }
    db clen() { return sqrt( x*x+y*y ); }
    db l2() { return x*x+y*y; }
    P rot90(){
        db tx = x, ty = y;
        x = -ty;
        y = tx;
        return P(x,y);   
    }
    void swap(P& a){
        db tx = x, ty = y;
        x = a.x;  y = a.y;
        a.x = tx; a.y = ty;
    }
    bool operator < (const P a) const { return (x==a.x)?(y<a.y):(x<a.x); }
}po[nmax];

int sign(db x) { return (x<-eps) ? -1 : x>eps; }

void tanCP(P c1, db r1, P p){   
    db x = (c1-p).l2();
    db d = x - r1*r1;
    P tp = p + (c1-p)*(d/x);
    P lp = (c1-p).rot90()*( r1*sqrt(d)/x );
    P a1 = tp-lp, a2 = tp+lp;
    if(a2 < a1) a1.swap(a2);
    printf("%.10lf %.10lf\n%.10lf %.10lf\n", a1.x, a1.y, a2.x, a2.y );
}

int main(){
    //freopen("owo.in","r",stdin);
    P c1, p;
    db r1;
    cin >> p.x >> p.y;
    cin >> c1.x >> c1.y >> r1;
    tanCP(c1, r1, p);
    return 0;
}


Measured memory_bytes: 3284
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
const int maxn = 333;
const int lg = 22;
int mat[maxn][maxn];
int cant[maxn], ptr[maxn], sum[maxn];
int M(){
    int n, m;
    if(!~scanf("%d %d", &n, &m)) return 0;
    for(int e = 0; e < n; e++)
        for(int f = 0; f < m; f++)
            scanf("%d", &mat[e][f]);
    int ans = n;
    for(int f = 0; true; f++){
        for(int e = 0; e < n; e++){
            while(ptr[e] < n && cant[mat[e][ptr[e]]]) ptr[e]++;
            if(ptr[e] == n) goto down;
        }
        memset(sum, 0, sizeof(sum));
        for(int e = 0; e < n; e++)
            sum[mat[e][ptr[e]]]++;
        int best = 0;
        for(int e = 0; e < maxn; e++)
            best = max(best, sum[e]);
        ans = min(ans, best);
        for(int e = 0; e < maxn; e++)
            if(sum[e] >= ans)
                cant[e] = 1;
    }
    down:;
    printf("%d\n", ans);
    return 1;
}
int main(){
    while(M());
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
using ll = long long;
template <class T> inline bool chmin(T& a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}
ll INF = 1e12;

int main() {
  ll A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  ll abcount = max(X, Y) * 2;
  ll ans = INF;
  for(ll i = 0; i <= abcount; i += 2) {
    auto cost = i * C;
    cost += max(0LL, (X - i / 2) * A);
    cost += max(0LL, (Y - i / 2) * B);
    chmin(ans, cost);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

S = input()
print('Good' if all(i != j for i, j in zip(S, S[1:])) else 'Bad')





Measured memory_bytes: 38384
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  ll s;
  cin >> s;
  ll y = (s + 1000000000 - 1) / 1000000000;
  ll x = 1000000000 * y - s;
  cout << "0 0 1000000000 1 " << x << " " << y << endl;
  return 0;
}

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

#define BUF_SIZE 10
int main(void) {
  FILE *fp = stdin;
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, fp)) return 0;
  int num, kinds;
  sscanf(line, "%d %d", &num, &kinds);
  long res = kinds;
  int i;
  for(i = 1; i < num; i++) {
    res *= (kinds-1);
  }
  printf("%ld\n", res);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <set>
#include <algorithm>
#include <cstdlib>
#define MAX_N 100005
using namespace std;
typedef pair<int,int> P;
int dxx[3]={-2,-1,0};
int dyy[3]={-2,-1,0};

P blacks[MAX_N];
set<P> s;

set<P> squares;

long long cnts[10];
long long h,w,n;
int x,y;
int xx,yy;
long long cnt;
bool inBound(int a,int b){
    if(a>h || a<=0 || b<=0 || b>w)return false;
    return true;
}

void solve()
{
    long long tmp = 0;
    for(int i = 0;i<n;i++){
        x = blacks[i].first;
        y = blacks[i].second;
        for(int k = 0;k<3;k++)
            for(int l = 0;l<3;l++){
                xx = x + dxx[k];
                yy = y + dyy[l];
                if(inBound(xx,yy) && inBound(xx+2,yy+2) && squares.find(P(xx,yy))==squares.end()){
                    cnt = 0;
                    for(int j = 0;j<3;j++)
                        for(int p = 0;p<3;p++)
                            if(s.find(P(xx+j,yy+p))!=s.end())
                                cnt+=1;
                    cnts[cnt] += 1;
                    squares.insert(P(xx,yy));             
                }
            }
    }
    for(int i = 0;i<10;i++)tmp+=cnts[i];
    
    cnts[0] = (h-2)*(w-2)-tmp;
}

int main()
{
    cin>>h>>w>>n;
    for(int i = 0;i<n;i++){
        cin>>xx>>yy;
        blacks[i] = P(xx,yy);
        s.insert(P(xx,yy));
    }
    solve();
    for(int i = 0;i<10;i++)
        cout<<cnts[i]<<endl;
    return 0;
}


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

int n = 4;

string int2str(int a){
    stringstream ss;
    ss << a;
    return ss.str();
}

int main(void){
  int s;
  int cnt = 1;
  int num;
  cin >> num;
  while(num--){
    cin >> s;
    cout << "Case " << cnt  << ":" << endl;
    cnt++;
    for(int q=0; q < 10; q++){
      int u = s * s;
      string t(int2str(u));
      t.insert(0, 2*n - t.length(), '0');
      t = t.substr(n/2, n);
      s = atoi(t.c_str());
      cout << s << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1236
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>
 
// #include <unordered_set>
// #include <unordered_map>
 
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
 
#define pb push_back
#define mp make_pair
 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
 
typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;
 
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
 
using namespace std;

#define int long long
#define N 1000000
int arr[N];
int a[N];
 
signed main(){
    

    int n;
    cin>>n;

    int a[50]={0};
    int tmp[50]={0};

    for(int i=0;i<40;i++){
        a[i]=pow(2,i);
    }

    // for(int i=0;i<40;i++){
    //     cout<<a[i]<<" ";
    // }

    tmp[0]=1;
    for(int i=1;i<40;i++){
        tmp[i]=tmp[i-1]+a[i];
    }

    // for(int i=0;i<40;i++){
    //     cout<<tmp[i]<<" ";
    // }
    // cout<<endl;

    for(int i=1;i<40;i++){
        if(tmp[i-1]<=n&n<tmp[i]){
            cout<<i<<endl;
            return 0;
        }
    }

}


Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char S[3],ch;
    int i;
    for(i=0;i<3;i++){
        scanf("%c",&S[i]);
    }
    scanf("%c",&ch);
    if(S[1]=='B')
       printf("ARC\n");
    else
        printf("ABC\n");
    return 0;
}


Measured memory_bytes: 3640
// https://atcoder.jp/contests/

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

ll N, ai, a[200001], sum, m;

int main()
{
  sum = 0;

  cin >> N;
  REP(i, N)
  {
    cin >> ai;
    sum += ai;
    a[i] = sum;
  }

  m = abs(sum - 2 * a[0]);
  FOR(i, 1, N - 1)
  {
    m = min(m, abs(sum - 2 * a[i]));
  }

  cout << m << '\n';

  return 0;
}


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

struct node_t {
	int key;
	struct node_t *next;
};
typedef struct node_t Node;

Node *enqueue(Node *node, int key) {
	Node *p, *q;

	if (node == NULL) {
		node = malloc(sizeof(Node));
		node->key = key;
		node->next = NULL;
		return node;
	}

	for (p = node; p != NULL; p = p->next) {
		q = p;
	}
	q->next = malloc(sizeof(Node));
	q->next->key = key;
	q->next->next = NULL;
	return node;
}

Node *dequeue(Node *node, int *key) {
	Node *p;

	if (node != NULL) {
		*key = node->key;
		p = node->next;
		free(node);
		return p;
	}
	return NULL;
}

int main(void) {
	int num, i, j, k, u;
	int wayto[101][101] = {{0}};
	int d[101];
	Node *q = NULL;

	scanf("%d", &num);
	for (i = 0; i < num; i++) {
		scanf("%d %d", &u, &k);
		for (j = 0; j < k; j++) {
			scanf("%d", &wayto[u-1][j]);
		}
	}

	d[0] = 0;
	for (i = 1; i < num; i++) {
		d[i] = -1;
	}
	q = enqueue(q, 0);

	while (q != NULL) {
		q = dequeue(q, &u);
		for (i = 0; i < num; i++) {
			k = wayto[u][i] - 1;
			if (d[k] < 0) {
				d[k] = d[u] + 1;
				q = enqueue(q, k);
			}
		}
	}

	for (i = 0; i < num; i++) {
		printf("%d %d\n", i+1, d[i]);
	}
	return 0;
}

Measured memory_bytes: 648
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    vector<long long> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    cout << v[n/2] - v[n/2-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int binarySearch(int,int [],int);

int A[1000001],n;

int main(){
  int i,q,key;
  int count = 0;

  scanf("%d",&n);
  for(i = 0;i < n;i++)
    scanf("%d",&A[i]);
  
  scanf("%d",&q);
  for(i = 0;i < q;i++){
    scanf("%d",&key);
    if(binarySearch(n,A,key) != 0)
      count++;
  }
  printf("%d\n",count);

  return 0;
}

int binarySearch(int n,int A[],int key){
  int right = n;
  int left = 0;
  int mid;

  while(left < right){
    mid = (right + left) / 2;
    if(key == A[mid])
      return 1;
    if(key > A[mid])
      left = mid + 1;
    else if(key < A[mid])
      right = mid;
  }
  return 0;
}



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

int main(){
	int N; cin >> N;
	int D, X; cin >> D >> X;
	vector<int> A(N); for(int i = 0; i < N; ++i) cin >> A[i];

	int sum = 0;
	for(int i = 0; i < N; ++i){
		for(int j = 0; j < D; ++j){
			if(j * A[i] + 1 <= D) sum++;
			else break;
		}
	}

	cout << sum + X << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n, k, q;
vector<i64> cnt;
int main() {
  cin >> n >> k >> q;
  init_n(cnt, n + 1);
  for (i64 i = 0; i < q; ++i) {
    i64 x;
    cin >> x;
    cnt[x]++;
  }
  for (i64 i = 1; i <= n; ++i) {
    bool ok = false;
    if (k - q + cnt[i] > 0) ok = true;
    cout << (ok ? "Yes" : "No") << '\n';
  }
  return 0;
}


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

using namespace std;

#define SIZE 500

#define SIZE2 (200000 / SIZE + 10)

#define SIKI (SIZE * 4)

class point
{
public:
	int n;
	int d[SIKI + 1];
	int minw;
};

point m[SIZE2];

int p[200000];

int N;

void atu()
{
	int now = 0;
	for(int i = 0; i < SIZE2; i++)
	{
		for(int ii = 0; ii < m[i].n; ii++)
		{
			p[now] = m[i].d[ii];
			now++;
		}
	}
}

int getm(int x,int a,int b)
{
	int w = 2000000000;
	for(int i = a; i <= b; i++)
	{
		w = min(w,m[x].d[i]);
	}
	return w;
}

void bun()
{
	for(int i = 0; i < SIZE2; i++)
	{
		m[i].n = 0;
	}
	int now = 0;
	for(int i = 0; i < SIZE2; i++)
	{
		for(int ii = 0; ii < SIZE; ii++)
		{
			if(now >= N)
			{
				m[i].n = ii;
				goto aa;
			}
			m[i].d[ii] = p[now];
			now++;
			m[i].n++;
		}
	}
aa:
	for(int i = 0; i < SIZE2; i++)
	{
		m[i].minw = getm(i,0,m[i].n - 1);
	}
}

pair<int,int> findw(int a)
{
	int now = 0;
	for(int i = 0; i < SIZE2; i++)
	{
		if(now + m[i].n > a)
		{
			return make_pair(i,a - now);
		}
		now += m[i].n;
	}
}

void insert(int a,int x)
{
	pair<int,int> w = findw(a);
	for(int i = m[w.first].n; i > w.second; i--)
	{
		m[w.first].d[i] = m[w.first].d[i - 1];
	}
	m[w.first].d[w.second] = x;
	m[w.first].n++;
	if(m[w.first].n > SIKI + 1)
	{
		atu();
		bun();
	}
	else
	{
		m[w.first].minw = getm(w.first,0,m[w.first].n - 1);
	}
}

int erase(int a)
{
	pair<int,int> ww = findw(a);
	int w = m[ww.first].d[ww.second];
	for(int i = ww.second; i < m[ww.first].n - 1; i++)
	{
		m[ww.first].d[i] = m[ww.first].d[i + 1];
	}
	m[ww.first].n--;
	m[ww.first].minw = getm(ww.first,0,m[ww.first].n - 1);
	return w;
}

void shift(int a,int b)
{
	int w = erase(b);
	insert(a,w);
}

int minw(int a,int b)
{
	pair<int,int> aw = findw(a);
	pair<int,int> bw = findw(b);
	int w;
	if(aw.first == bw.first)
	{
		w = getm(aw.first,aw.second,bw.second);
	}
	else
	{
		w = min(getm(aw.first,aw.second,m[aw.first].n - 1),getm(bw.first,0,bw.second));
		for(int i = aw.first + 1; i < bw.first; i++)
		{
			w = min(w,m[i].minw);
		}
	}
	return w;
}

void oki(int a,int x)
{
	pair<int,int> w = findw(a);
	m[w.first].d[w.second] = x;
	m[w.first].minw = getm(w.first,0,m[w.first].n - 1);
}

int main()
{
	int q;
	scanf("%d%d",&N,&q);
	for(int i = 0; i < N; i++)
	{
		int w;
		scanf("%d",&w);
		p[i] = w;
	}
	bun();
	for(int i = 0; i < q; i++)
	{
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		if(a == 0)
		{
			shift(b,c);
		}
		else if(a == 1)
		{
			printf("%d\n",minw(b,c));
		}
		else
		{
			oki(b,c);
		}
	}
	return 0;
}

Measured memory_bytes: 4520
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int[] dsh = new int[5];
 		dsh[0] = sc.nextInt();
 		
		dsh[1] = sc.nextInt();
		
		dsh[2] = sc.nextInt();
		
		dsh[3] = sc.nextInt();
		
		dsh[4] = sc.nextInt();
		
		int[] ndsh = new int[5];
		int[] dif = new int[5];
		
		for(int l = 0; l < dsh.length; l++) {
			ndsh[l] = dsh[l];
			dif[l] = 0;
			while((ndsh[l] % 10) != 0) {
				ndsh[l] = ndsh[l] + 1;
				dif[l] = dif[l] + 1;
			}

		}
		
		int max_dif = 0;
		for(int n = 0; n < dif.length; n++) {
			if(max_dif < dif[n]) {
				max_dif = dif[n];
			}
		}
		int sum = ndsh[0] + ndsh[1] + ndsh[2] + ndsh[3] + ndsh[4];
		System.out.println((sum - max_dif));
	}
}

Measured memory_bytes: 23508
import Foundation
func readInt() -> Int {
    return Int(readLine()!)!
}
 
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
 
func readTwoInts() -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: " ").map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

enum NumError: Error {
    case invalid(String)
}

extension NumError: LocalizedError {
    var errorDescription: String? {
        switch self {
        case .invalid(let errorMessage):
            return errorMessage
        }
    }
}

func caddi2018b_aa() throws -> Int {
    let N = readInt()
    
    if N < 999 {
        throw NumError.invalid("1000から9999の値を入れてください")
    }
    
    if N >= 10000 {
        throw NumError.invalid("1000から9999の値を入れてください")
    }
    
    return String(N).map {$0}.filter {$0 == "2"}.count
}

func caddi2018b_a() -> Result<Int, NumError> {
    let N = readInt()
    
    if N < 999 {
        return .failure(.invalid("1000から9999の値を入れてください"))
    }
    
    if N >= 10000 {
        return .failure(.invalid("1000から9999の値を入れてください"))
    }
    
    return .success(String(N).map {$0}.filter {$0 == "2"}.count)
}

let ans = caddi2018b_a()
switch ans {
case .failure(let error):
    print(error.localizedDescription)
case .success(let ans):
    print(ans)
}

//do {
//    try print(caddi2018b_a())
//} catch NumError.invalid(let errorMessage) {
//    print(errorMessage)
//}


Measured memory_bytes: 13192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Console;
using static System.Math;

class Program
{
    static List<Edge>[] g;
    static void Main()
    {
        var s = new Dictionary<string, int> { ["SUN"] = 7, ["MON"] = 6, ["TUE"] = 5, ["WED"] = 4, ["THU"] = 3, ["FRI"] = 2, ["SAT"] = 1 };
        var N = ReadLine();
        WriteLine(s[N]);
    }
    static int[] ans;
    void DFS(int v, int p, int c)
    {
        var k = 0;
        foreach (var u in g[v])
        {
            if (k == c) k++;
            if (u.to != p)
            {

                ans[u.id] = k;
                DFS(u.to, v, k);
            }
            k++;
        }
    }
}

public struct Edge
{
    public int to;
    public int clr;
    public int id;

    public Edge(int t, int c, int i)
    {
        to = t;
        clr = c;
        id = i;
    }
}


Measured memory_bytes: 13152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

int N;
vector<int> A(200010);

int main(){
    cin >> N;
    rep(i,N) cin >> A[i];

    int l = 0, r = 0; Int ans = 0;
    bitset<22> bit(A[0]);

    while(l < N){
        while(true){
            if(r == N-1) break;

            int nr = r+1;
            bitset<22> cur_bit(A[nr]);
            if((bit | cur_bit) == (bit ^ cur_bit)){
                bit |= cur_bit;
            } else {
                break;
            }
            r++;
        }

        ans += r-l+1;

        bitset<22> bit_l(A[l]);
        bit ^= bit_l;

        l++;
    }   

    cout << ans << endl;
}

Measured memory_bytes: 1024