akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String topping = "";

		try {
			scanner = new Scanner(System.in);
			topping = scanner.next();

			int res = 700;

			for (int i = 0; i < topping.length(); i++) {
				switch (topping.charAt(i)) {
				case 'o':
					res += 100;
					break;
				case 'x':
					break;

				}
			}

			System.out.println(res);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;
		int numX = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			numX = scanner.nextInt();

			int[] wk = new int[numN];

			int res = 0;
			for (int i = 0; i < numN; i++) {
				wk[i] = scanner.nextInt();
				res++;
				numX -= wk[i];
			}

			Arrays.sort(wk);

			boolean isExit = false;
			while (!isExit) {
				if (numX >= wk[0]) {
					numX -= wk[0];
					res++;
				} else {
					isExit = true;
				}
			}

			System.out.println(res);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 22612
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    int n;
    cin >> n;
    rep(i,n){
        char a;
        cin >> a;
        if(a=='Y'){
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc165/tasks/abc165_d
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}
int main() {
#if LOCAL&01
  std::ifstream in("./test/sample-1.in");
  //std::ifstream in("./input.txt");
  std::cin.rdbuf(in.rdbuf());
#else
  cin.tie(0);
  ios::sync_with_stdio(false);
#endif
  ll A,B,N; cin>>A>>B>>N;

  auto calc =[&](double x)->ll{
    double fi=A*x/(double)B;
    ll a = floor(fi);
    double sc=(x/(double)B);
    ll b=   floor(sc)*A;
    return a-b;
  };

  // FOR(i,0,100){
  //   dump(i,calc(i));
  // }

  ll ans=calc(min(N,B-1));
  cout<<ans<<endl;
  return 0;
}

int main_() {
#if LOCAL&01
  std::ifstream in("./test/sample-1.in");
  //std::ifstream in("./input.txt");
  std::cin.rdbuf(in.rdbuf());
#else
  cin.tie(0);
  ios::sync_with_stdio(false);
#endif
  ll A,B,N; cin>>A>>B>>N;

  auto calc =[&](double x)->ll{
    double fi=A*x/(double)B;
    ll a = floor(fi);
    double sc=(x/(double)B);
    ll b=   floor(sc)*A;
    return a-b;
  };

  // 左側
  double low = 0;
  // 右側
  double high = B+1;

  // 500回繰り返す
  int cnt = 10;
  while (cnt--) {
    double c1 = (low * 2 + high) / 3;
    double c2 = (low + high * 2) / 3;

      // もしf(c2)のほうが良い(小さい)なら、駄目な方lowを更新する
      auto v_c1=calc(c1);
      auto v_c2=calc(c2);
      dump(low,high);
      dump(c1,c2,v_c1,v_c2);
      if (v_c1 < v_c2) low = c1;
      else high = c2;
  }
  dump(low,high);
  cout<<calc(low)<<endl;
  return 0;
}

Measured memory_bytes: 3760
#12716015

n, m = map(int, input().split())
h = list(map(int, input().split()))
ans = [1]*n
for i in range(m):
  a, b= map(int, input().split())
  a -= 1
  b -= 1
  if h[a] > h[b]:
    ans[b] = 0
  elif h[a] < h[b]:
    ans[a] = 0
  if h[a] == h[b]:
    ans[a] = 0
    ans[b] = 0
print(ans.count(1))

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

int main() {
	int n;
	cin >> n;
	int A[n], L[n];
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}

	int length = 1;
	L[0] = A[0];

	for (int i = 1; i < n; i++) {
		if (A[i] > L[length - 1]) {
			L[length++] = A[i];
		} else {
			*lower_bound(L, L + length, A[i]) = A[i];
		}
	}
	cout << length << endl;

	return 0;
}

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

if Y % 1000 != 0:
    print(-1,-1,-1)

n1 = Y // 10000
n2 = Y // 5000

for i in range(n1+1):
    for j in range(n2+1):
        if (N-i-j) < 0: continue
        if i*10000 + j*5000 + (N-i-j)*1000 == Y:
            print(i,j,(N-i-j))
            exit()
        if Y < i*10000 + j*5000 + (N-i-j)*1000: break
print(-1,-1,-1)

Measured memory_bytes: 9148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384626433832795

int n;

void printcomp(complex<double> c) {
	printf("%.8lf %.8lf\n", c.real(), c.imag() );
}


void rec(int level, complex<double> s, complex<double> e) {
	if (level >= n)return;
	complex<double> p1, p2, p3;
	p1 = s + (e - s) / 3.0;
	p3 = s + (e - s) * 2.0 / 3.0;
	p2 = p1 + (p3 - p1)*exp(complex<double>(.0, 60.0 * PI / 180.0));
	rec(level + 1, s, p1);
	printcomp(p1);
	rec(level + 1, p1, p2);
	printcomp(p2);
	rec(level + 1, p2, p3);
	printcomp(p3);
	rec(level + 1, p3, e);
}

int main() {
	cin >> n;
	complex<double> s(.0,.0), e(100.0,.0);
	printcomp(s);
	rec(0,s,e);
	printcomp(e);
}


Measured memory_bytes: 3228
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;


int main()
{
  int n;
  cin >> n;
  double ans = 100.0;
  for(int i = 0; i < n; i++)
  {
    ans *= 1.05;
    ans = ceil(ans);
  }
  cout << (int)(ans * 1000) << endl;
  return 0;
}

Measured memory_bytes: 1164
from collections import Counter
c = Counter()
N = int(input())
for _ in range(N):
    s = input()
    c[s] += 1
M = int(input())
for _ in range(M):
    t = input()
    c[t] -= 1

ans = max(c.most_common()[0][1], 0)
print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int n, m, x, a, c, ans;
  cin >> n >> m >> x;
  vector<int> C;
  vector<vector<int> > A(n, vector<int>(m));
  for(int i=0;i<n;i++){
    cin >> c;
    C.push_back(c);
    for(int j=0;j<m;j++){
      cin >> a;
      A[i][j] = a;
    }
  }
  ans = 10000000;
  int p, ok;
  for(int i=0;i<(1<<n);i++){
    p=0;
    ok = 0;
    vector<int> skill(m);
    for(int j=0;j<n;j++){
      if(i & (1<<j)){
        p += C[j];
        for(int k=0;k<m;k++){
          skill[k] += A[j][k];
        }
      }
    }
    for(int l=0;l<m;l++){
      if(skill[l] < x){
        ok=-1;
        break;
      }
    }
    if(ok == 0){
      if(p < ans){
        ans = p;
      }
    }
  }
  if(ans == 10000000){
    ans = -1;
    cout << ans;
  }else{
    cout << ans;
  }
}

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

bool check(double x,double y,double z,double r){
	return sqrt(x*x+y*y) < r*2;
}

int main(){
	int data[3],r,n;
	while(cin >> data[0] >> data[1] >> data[2],data[0]){
		cin >> n;
		for(int i=0;i<n;i++){
			cin >> r;
			bool ret = false;
			sort(data,data+3);
			do{
				 ret |= check(data[0],data[1],data[2],r);
			}while(next_permutation(data,data+3));
			cout << (ret?"OK":"NA") << endl;
		}
	}
}

Measured memory_bytes: 0
n,t=map(int,input().split())
a=list(map(int,input().split()))
a.append(0)
res=[]
t=1
j=False
tmin=a[0]
tmax=a[0]
for i in range(1,n+1):
    if tmin>a[i]:
        res.append(tmax-tmin)
        tmin=a[i]
        tmax=a[i]
    if tmax<a[i]:
        tmax=a[i]
print(res.count(max(res)))

Measured memory_bytes: 62704
import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()

def main():
  K = int(input())
  A, B = map(int, input().split())

  ans = False
  for i in range(A, B+1):
    if i%K == 0:
      print('OK')
      return
  print('NG')

if __name__ == '__main__':
  main()

Measured memory_bytes: 9148
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<malloc.h>

int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

void InputIntAry(int *a,int nBuf,int N){
    char *buf,*ptr;

    buf=(char*)malloc(nBuf*sizeof(char));
    my_gets(buf,nBuf,stdin);

    ptr=strtok(buf," ");
    while(ptr!=NULL && N-->0){
        *(a++)=atoi(ptr);
        ptr=strtok(NULL," ");
    }
    free(buf);
}

int main(void){
    int N,M;
    int T[100],P[100],A[100];

    scanf("%d%*c",&N);
    InputIntAry(T,1024,N);

    scanf("%d%*c",&M);
    for(int i=0;i<M;i++){
        scanf("%d %d%*c",&(P[i]),&(A[i]));
    }

    for(int i=0;i<M;i++){
        int sum=0;
        for(int j=0;j<N;j++){
            sum+= (j==P[i]-1) ? (A[i]) : (T[j]);
            //printf("%d ",(j==P[i]-1) ? (A[i]) : (T[j]));
        }
        printf("%d\n",sum);
    }

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define debug(name) DEBUG(#name, (name))
template<typename T>
void DEBUG(string label, T value) {
    cerr << "[" << label << " = " << value << "]\n";
}

void solve(){
    ll x;
    cin >> x;
    const int N = 3980;
    vector<ll> table(N + 1);
    for(int i = 0; i <= N; ++i){
        table[i] = 1LL * i * i * i * i * i;
    }
    for(int i = 0; i <= N; ++i){
        for(int j = 0; j <= N; ++j){
            if(table[i] + table[j] == x){
                cout << i << " " << -j << endl;
                return;
            }
            if(table[i] - table[j] == x){
                cout << i << " " << j << endl;
                return;
            }
        }
    }
    assert(0);
}
int main(int argv, char **argc){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    solve();
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

struct Sieve {
  vector<bool> isprime;

  void init(size_t max){
    if(max+1 > isprime.size()){     // resizeで要素数が減らないように
        isprime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    }
    isprime[0] = false; // 0は素数ではない
    isprime[1] = false; // 1は素数ではない

    for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(isprime[i]) // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                isprime[i*j] = false;      // 素数ではない
  }
};


int main () {
  cin.tie(0);
  cout << setprecision(10);

  Sieve s;
  s.init(1500000);

  vi p(100200);
  int i = 0, j = 0;
  while(1) {
    if(j == 100200) break;
    if(s.isprime[i]) {
      p[j] = i;
      j++;
    }
    i++;
  }


  while(1) {
    int n, m; cin >> n >> m;
    if(n == -1 && m == -1) break;
    int i = 0;
    while(n >= p[i]) i++;
    vi l(m * 2);
    REP(j, m * 2) {
      l[j] = p[i+j];
    }
    vi ans;
    REP(i, m * 2) {
      FOR(j, i, m * 2) {
        ans.pb(l[i] + l[j]);
      }
    }
    sort(ALL(ans));
    cout << ans[m-1] << endl;
    
  }
  
}



Measured memory_bytes: 3640
N,K = map(int,input().split())
mod = 10**9+7
fact = [1]*(2001)
for i in range(1,2001):
    fact[i] = i*fact[i-1]%mod

def comb(n,k):
    return fact[n]*pow(fact[n-k],mod-2,mod)*pow(fact[k],mod-2,mod)%mod

for i in range(1,K+1):
    if i <= N-K+1:
        print(comb(N-K+1,i)*comb(K-1,i-1)%mod)
    else:
        print(0)

Measured memory_bytes: 41712
N,M = map(int,input().split())
mod = 1000000007

dp = [0]*(N+1)
dp[0] = 1
A = []
for _ in range(M):
    k = int(input())
    A.append(k)
A = sorted(A,reverse = True)

if len(A)>0:
    a = A.pop()
else: a = -1
        
if a == 1:
    dp[1] = 0
    if len(A)>0:
        a = A.pop()
    if a == 2:
        dp[2] == 0
else:
    dp[1] = 1
    
for i in range(2,N+1):
    if i == a:
        if len(A)>0:
            a = A.pop()
        #continue
    else:
        if dp[i-1] != 0 and dp[i-2] != 0:
            dp[i] = (dp[i-1] + dp[i-2])%mod
        elif dp[i-1] != 0:
            dp[i] = dp[i-1]%mod
        elif dp[i-2] != 0:
            dp[i] = dp[i-2]%mod
        else:
            dp[i] = 0
        
print(dp[-1])

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

using namespace std;
//typedef long long ll;
typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

int main() {


    ll h, w;
    int n;
    cin >> h >> w >> n;

    vector<P> blacks(n);
    rep(i, n) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;

        blacks[i].first = b;
        blacks[i].second = a;
    }

    map<ll, map<ll, bool>> m;
    for (P p : blacks) {
        m[p.first][p.second] = true;
    }

    set<P> q;
    for (P p: blacks) {
        rep(x, 3)rep(y, 3) {
                ll px = p.first - 1 + x;
                ll py = p.second - 1 + y;
                if (px == -1 || px == w) continue;
                if (px == 0 || px == w - 1) continue;
                if (py == -1 || py == h) continue;
                if (py == 0 || py == h - 1) continue;

                P next(px, py);
                q.insert(next);
            }
    }

    map<int, ll> ans;
    for (P p : q) {
        int black = 0;
        rep(x, 3)rep(y, 3) {
                ll px = p.first - 1 + x;
                ll py = p.second - 1 + y;
                if (m.find(px) == m.end()) continue;
                if (m[px].find(py) == m[px].end())continue;
                if (m[px][py]) black++;
            }
        ans[black]++;
    }

    ans[0] = (h - 2) * (w - 2);
    for (auto e : ans) {
        if (e.first == 0) continue;
        ans[0] -= e.second;
    }


    for (int i = 0; i <= 9; i++) {
        cout << ans[i] << endl;
    }

    cout << endl;


}

Measured memory_bytes: 73728
#include<stdio.h>

int main(void) {
	int A[1000], N, i, j,k, v;

	scanf("%d", &N);

	for (i = 0; i <= N-1; i++) {
		scanf("%d", &A[i]);
	}

	for (k = 0; k <= N - 1; k++) {
		if (k <= N - 2)printf("%d ", A[k]);
		else if (k == N - 1) printf("%d\n", A[k]);
	}

	for (i = 1; i <= N-1; i++) {
		
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;

		for (k = 0; k <= N - 1; k++) {
			if(k<=N-2)printf("%d ", A[k]);
			else if(k==N-1) printf("%d\n", A[k]);
		}
	}

	
	return 0;
}


Measured memory_bytes: 2624
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	a, _ := strconv.Atoi(nextLine())
	b, _ := strconv.Atoi(nextLine())
	c, _ := strconv.Atoi(nextLine())
	x, _ := strconv.Atoi(nextLine())

	res := 0

	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				if x == i*500+j*100+k*50 {
					res++
				}
			}
		}
	}

	fmt.Printf("%d\n", res)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
/* テンプレートここまで */

int main() {
  int N; 
  cin >> N;

  //N以下の素数列挙
  vector<bool> p(N+1, true);
  int cur = 2;
  while(cur != N+1){
    if(p[cur]){
      for(int i = 2; i*cur <= N; i++){
        p[i*cur] = false;
      }
    }
    cur++;
  }

  ll ans = 1;

  FOR(i, 2, N+1){
    if(!p[i]) continue;
    int a = i;
    ll tmp = 0;
    while(a <= N){
      tmp += N/a;
      a *= i;
    }
    ans *= (tmp + 1) %MOD;
    ans %= MOD;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
#define M 1000000//??????????????°
#define L 12	  //??????????????????

char H[M][L];

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

int getKey(char str[]){
	int sum = 0, p=1, i;
	for(i=0;i<strlen(str);i++){
		sum += p*( getChar(str[i]) );
		p *= 5;
	}
	return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }
int hashfunc(int key,int i){ return ( h1(key) + i*h2(key) ) % M; }

int find(char str[]){
	int key,i,h;
	key = getKey(str);
	for( i=0 ; ; i++ ){
		h = hashfunc(key,i);
		if(strcmp(H[h],str) == 0) return 1;
		else if( strlen(H[h]) == 0 ) return 0;//??°?????£???????????¨???????????¨?????\??£???????????¨???????????¨???
	}
	return 0;
} 

void insert(char str[]){
	int key,i,h;
	key = getKey(str);
	for( i=0 ; ; i++ ){
		h = hashfunc(key,i);
		if(strcmp(H[h],str) == 0) return;
		else if(strlen(H[h]) == 0){
			strcpy(H[h],str);
			return;
		}
	}
	return;
}

int main(){
	int i,n,h;
	scanf("%d",&n);
	for(i = 0;i<n;i++){
		char command[6];
		char str[12];
		scanf("%s%s",command,str);
		if(command[0] == 'i'){
			insert(str);
		}else{
			if(find(str)){
				printf("yes\n");
			}else{
				printf("no\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 12744
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;

int main(){
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200) cout << s << endl;
    else cout << "red" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define loop(i,x,z) for (int i=x;i<z;i++)
using ll = long long;
const int M = 1000000007;
int n;
int main()
{
	cin >> n;
	n %= 10;
	if (n == 3)
	{
		cout << "bon";
	}
	else if (n == 0 || n == 1 || n == 6 || n == 8)
	{
		cout << "pon";
	}
	else cout << "hon";
}

Measured memory_bytes: 3628
import static java.lang.System.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Main {
	public static void main(String[] args) throws Exception {
		ArrayList<Double> d = new ArrayList<>();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;
		while (true) {
			buf = br.readLine();
			if (buf == null)
				break;
			d.add(Double.parseDouble(buf));
		}
		double max=d.stream().max((a,b)->a.compareTo(b)).get();
		double min=d.stream().min((a,b)->a.compareTo(b)).get();
		out.println(max-min);
	}
}

Measured memory_bytes: 30800
package main

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

func main() {

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	in := sc.Text()
	ins := strings.Split(in, " ")
	// processNum, _ := strconv.Atoi(ins[0])
	quantum, _ := strconv.Atoi(ins[1])

	q := Queue{}
	for {
		sc.Scan()
		in := sc.Text()
		if len(in) == 0 {
			break
		}
		ins := strings.Split(in, " ")
		n := ins[0]
		t, _ := strconv.Atoi(ins[1])
		q.enqueue(Process{n, t})
	}

	now := 0
	for !q.isEmpty() {
		p := q.dequeue()
		if p.t > quantum {
			p.t = p.t - quantum
			q.enqueue(p)
			now = now + quantum
		} else {
			now = now + p.t
			fmt.Println(p.n + " " + strconv.Itoa(now))
		}

	}
}

type Process struct {
	n string
	t int
}

type Queue struct {
	val []Process
}

func (queue *Queue) enqueue(val Process) {
	queue.val = append(queue.val, val)
}

func (queue *Queue) dequeue() Process {
	res := queue.val[0]
	queue.val = queue.val[1:len(queue.val)]
	return res
}

func (queue *Queue) isEmpty() bool {
	return len(queue.val) == 0
}



Measured memory_bytes: 8528
#define CPP17
#include <limits>
#include <initializer_list>
#include <utility>
#include <bitset>
#include <tuple>
#include <type_traits>
#include <functional>
#include <string>
#include <array>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
#include <complex>
#include <random>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <regex>
#include <cassert>
#include <cstddef>
#ifdef CPP17
#include <variant>
#endif

// Yay!!
#define endl codeforces

// macros for iterator
#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)

// alias
using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;

// variadic min/max
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }

// variadic chmin/chmax
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

// multi demension array
template <typename T, std::size_t Head, std::size_t... Tail> struct multi_dim_array { using type = std::array<typename multi_dim_array<T, Tail...>::type, Head>; };
template <typename T, std::size_t Head> struct multi_dim_array<T, Head> { using type = std::array<T, Head>; };
template <typename T, std::size_t... Args> using mdarray = typename multi_dim_array<T, Args...>::type;

#ifdef CPP17
// fill container
template <typename T, typename F, typename... Args> 
void fill_seq(T &t, F f, Args... args) { if constexpr (std::is_invocable<F, Args...>::value) { t = f(args...); } else { for (ssize_t i = 0; i < t.size(); i++) fill_seq(t[i], f, args..., i); } }
#endif

// make multi dimension vector
template <typename T> vec<T> make_v(ssize_t sz) { return vec<T>(sz); }
template <typename T, typename... Tail> auto make_v(ssize_t hs, Tail&&... ts) { auto v = std::move(make_v<T>(std::forward<Tail>(ts)...)); return vec<decltype(v)>(hs, v); }

// init
namespace init__ { 
struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; 
}


int main() {
    ll a, b;
    std::cin >> a >> b;
    std::cout << a * b << "\n";
    return 0;
}


Measured memory_bytes: 3648
import numpy as np
N,M,X = map(int, input().split())
nd_list = np.ones(M)*X

next_list = []
for i in range(0,N):
    next_list.append(list(map(int, input().split())))
next_list = np.array(next_list)
min_tot = 10000000

def dfs(i,ab_list):
    global min_tot
    if i==N and np.all(ab_list[1:]>=nd_list):
        if min_tot > ab_list[0]:
            min_tot = ab_list[0]
        return True
    elif i ==N:
        return True

    dfs(i+1,ab_list)
    dfs(i+1,ab_list+next_list[i,:])


dfs(0,np.zeros(1+M))
if min_tot ==10000000:
    print(-1)
else:
    print(int(min_tot))



Measured memory_bytes: 27228
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        long ans = 0;
        for (int i = 1; i <= n; i++) {
            int cnt = 0;
            int tmp = i;
            while (tmp > 0) {
                cnt += tmp % 10;
                tmp /= 10;
            }
            if (a <= cnt && cnt <= b) {
                ans += i;
            }
        }
        System.out.println(ans);
    }

    public static void main(String[] args) {
        new Main();
    }
}


Measured memory_bytes: 21844
#include <iostream>

int main() {
    unsigned int a, b;
    unsigned int c[4] = { 0, 0, 0, 0 };
    unsigned int d1 = 0, d2 = 0;
    for (int i = 0; i < 3; ++i) {
        std::cin >> a >> b;
        c[a - 1]++;
        c[b - 1]++;
    }
    for (int i = 0; i < 4; i++) {
        if (c[i] == 1) d1++;
        if (c[i] == 2) d2++;
    }
    if (d1 == 2 && d2 == 2)
        std::cout << "YES";
    else
        std::cout << "NO";
    std::cout << std::endl;
}

Measured memory_bytes: 256
from subprocess import*
call(('pypy3','-c',"""
I=lambda:list(map(int,input().split()))
n,W=I()
g=[0]+[I()for _ in range(n)]
dp=[[0]*-~W for _ in range(n+1)]
for i in range(1,n+1):
    t=g[i]
    for j in range(W+1):
        if j-t[0]>=0:
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-t[0]]+t[1])
        else:
            dp[i][j]=dp[i-1][j]
print(max(dp[-1]))
"""))

Measured memory_bytes: 123980
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
lint inf=123456789012345678LL;
lint a[100100],b[100100],da[100100],db[100100];
int main()
{
	int n,m,q;lint x;
	cin>>n>>m>>q;
	a[0]=b[0]=-inf;a[n+1]=b[m+1]=inf;
	rep(i,n) cin>>a[i+1];rep(i,m) cin>>b[i+1];
	rep(i,n){
		int i2=lower_bound(b,b+m+2,a[i+1]+1)-b-1;
		da[i+1]=min(abs(a[i+1]-b[i2]),abs(a[i+1]-b[i2+1]));
		//cout<<i<<' '<<da[i+1]<<endl;
	}
	rep(i,m){
		int i2=lower_bound(a,a+n+2,b[i+1]+1)-a-1;
		db[i+1]=min(abs(b[i+1]-a[i2]),abs(b[i+1]-a[i2+1]));
	}
	rep(i,q){
		lint ret=inf;
		cin>>x;
		lint it=lower_bound(a,a+n+2,x+1)-a-1,i2=lower_bound(b,b+m+2,x+1)-b-1;
		//cout<<x<<' '<<it<<' '<<a[it]<<' '<<da[it]<<endl;
		rep(j,2){
			ret=min(ret,abs(x-a[it+j])+da[it+j]);
		}
		rep(k,2){
			ret=min(ret,abs(x-b[i2+k])+db[i2+k]);
		}
		cout<<ret<<endl;
	}
}


Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
	int grid[4][4];
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			cin>>grid[i][j];
		}
	}
	int m[4];
	m[1] = *min_element(grid[1]+1,grid[1]+4);
	m[2] = *min_element(grid[2]+1,grid[2]+4);
	m[3] = *min_element(grid[3]+1,grid[3]+4);
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			grid[i][j]-=m[i];
		}
	}
	int m2[4];
	m2[1]=min({grid[1][1],grid[2][1],grid[3][1]});
	m2[2]=min({grid[1][2],grid[2][2],grid[3][2]});
	m2[3]=min({grid[1][3],grid[2][3],grid[3][3]});
	int ans=0;
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			grid[i][j]-=m2[j];
			ans+=grid[i][j];
		}
	}
	if(!ans){
		 cout<<"Yes";
	}
	else{
		 cout<<"No";
	}
}


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


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

    float N;
    cin >> N;
    if (fmod(N, 2) == 0){
        cout << 0.5 << endl;
    }
    else{
        cout << ((N+1)/2)/N << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ll Pow(ll a , ll b){
	if(b == 0) return 1 ;
	ll c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c)% mod )) % mod ;
	return (c * c) % mod ;
}
bool f(pll a , pll b){
	return a.y < b.y ;
}

//check modulo
int main(){
	IOS;
	cout.precision(30) ;
    int n ; cin >> n ;
    vll a(n);vll b(n) ;vector<pll> c(n) ;for(int i = 0 ; i < n ; i++){ cin >> a[i] >> b[i] ;c[i] = mp(a[i] , b[i]) ;}
    sort(c.begin() , c.end() , f) ;
    ll sum = 0 ; 
    for(int i = 0 ; i < n ; i++){
		sum += c[i].x ;
		if(sum > c[i].y) return cout << "No" << endl , 0 ;
	}
	cout << "Yes" << endl ;
			
	return 0;
}


Measured memory_bytes: 6528
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
const ll MAX_N=1e5;
ll N,s[MAX_N];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>N;
	REP(i,N){
		cin>>s[i];
	}
	ll ans=0;
	FOR(x,1,N){
		ll sm=0;
		FOR(i,1,(N-1)/x+1){
			if(x>=N-1-i*x||((N-1)%x==0&&i*x>=N-1-i*x)){
				break;
			}
			sm+=s[i*x]+s[N-1-i*x];
			ans=max(ans,sm);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1024
from collections import Counter
n = input()
c = Counter(n)
n9 = c['9']
if n9 == len(n):
    ans = 9*len(n)
elif n9 == len(n)-1 and n[0] != '9':
    ans = int(n[0]) + 9*(len(n)-1)
else:
    ans = int(n[0])-1 + 9*(len(n)-1)
        
print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<climits>
#include<algorithm>
using namespace std;
typedef long long ll;
#define ip(arr, n) for(ll i=0; i<n; i++) cin>>arr[i];
#define op(arr, n) for(ll i=0; i<n; i++) cout<<arr[i]<<" ";
#define fstIO ios_base::sync_with_stdio(false); cin.tie(NULL);

ll findMinMP(ll arr[], ll i, ll n, ll A, ll B, ll C, ll sum_a, ll sum_b, ll sum_c){
    if(i==n){
        // why i add this condtion
        // when we don;t opt arr[i], then in that case it is the situation when we dono chose 
        if(!sum_a || !sum_b || !sum_c) return INT_MAX;
        return abs(A-sum_a)+abs(B-sum_b)+abs(C-sum_c);
    }
    ll opt1 = findMinMP(arr, i+1, n, A, B, C, sum_a, sum_b, sum_c);
    ll opt2 = findMinMP(arr, i+1, n, A, B, C, sum_a+arr[i], sum_b, sum_c)+(sum_a?10:0);
    ll opt3 = findMinMP(arr, i+1, n, A, B, C, sum_a, sum_b+arr[i], sum_c)+(sum_b?10:0);
    ll opt4 = findMinMP(arr, i+1, n, A, B, C, sum_a, sum_b, sum_c+arr[i])+(sum_c?10:0);

    // cout<<i<<" "<<opt1<<" "<<opt2<<" "<<opt3<<" "<<opt4<<endl;
    return min(opt1, min(opt2, min(opt3, opt4)));
}
void solve(){
    ll n,a,b,c;
    cin>>n>>a>>b>>c;
    ll arr[n];
    ip(arr, n);
    ll ans = findMinMP(arr, 0, n, a, b, c, 0, 0, 0);
    cout<<ans<<endl;
}

int main(){
    ll t=1;
    //cin>>t;
     while(t--){
         solve();
    }
    return 0;
}

Measured memory_bytes: 256
use std::fmt::Debug;
use std::str::FromStr;

pub struct TokenReader {
    reader: std::io::Stdin,
    tokens: Vec<String>,
    index: usize,
}

impl TokenReader {
    pub fn new() -> Self {
        Self {
            reader: std::io::stdin(),
            tokens: Vec::new(),
            index: 0,
        }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index += 1;
        self.tokens[self.index - 1].parse().unwrap()
    }

    pub fn vector<T>(&mut self) -> Vec<T>
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index = self.tokens.len();
        self.tokens.iter().map(|tok| tok.parse().unwrap()).collect()
    }

    pub fn load_next_line(&mut self) {
        let mut line = String::new();
        self.reader.read_line(&mut line).unwrap();

        self.tokens = line
            .split_whitespace()
            .map(String::from)
            .collect();
        self.index = 0;
    }
}

fn solve(n: usize, inters: &Vec<(usize, usize)>) -> i64 {
    let mut dp = vec![0; n + 1];
    dp[1] = 1;

    const MOD: i64 = 998244353;
    for i in 2..=n {
        let mut curr = 0;
        for &(a, b) in inters.iter() {
            let l = if b > i { 0 } else { i - b };
            let r = if a > i { 0 } else { i - a };

            curr = (curr + dp[r]) % MOD;
            if l > 0 {
                curr = (curr + MOD - dp[l - 1]) % MOD;
            }
        }
        dp[i] = (curr + dp[i - 1]) % MOD;
    }

    (dp[n] + MOD - dp[n - 1]) % MOD
}

fn main() {
    let mut reader = TokenReader::new();
    let n = reader.next();
    let k = reader.next();
    let inters = (0..k).map(|_| (reader.next(), reader.next())).collect();

    let res = solve(n, &inters);
    println!("{}", res);
}


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

int main(){
  long long int   N;
  cin >> N;	
  vector<string> S(N);
  vector<long long int> C(4,0);
  for(long long int i = 0; i < N; i++) cin >> S[i];
  
  for(long long int i = 0; i < N; i++){
    if(S[i] == "AC") C[0]++;
    if(S[i] == "WA") C[1]++;
    if(S[i] == "TLE") C[2]++;
    if(S[i] == "RE") C[3]++;
  }
  
  cout << "AC x " << C[0] << endl;
  cout << "WA x " << C[1] << endl;
  cout << "TLE x " << C[2] << endl;
  cout << "RE x " << C[3] << endl;
  
}


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

int main() {
    int N, M;
    cin >> N >> M;

    vector<int> k(M);
    vector<vector<int>> s(M, vector<int>());
    for (int i = 0; i < M; i++) {
        cin >> k[i];
        s[i].resize(k[i]);
        for (int j = 0; j < k[i]; j++) {
            cin >> s[i][j];
        }
    }
    vector<int> p(M);
    for (int i = 0; i < M; i++) {
        cin >> p[i];
    }

    //
    //
    int count = 0;
    for (int i = 0; i < (1 << N); i++) {
        bitset<10> bs(i);
        bool ok = true;
        for (int j = 0; j < M; j++) {
            int on = 0;
            for (int l = 0; l < k[j]; l++) {
                if (bs[s[j][l] - 1]) {
                    on++;
                }
            }
            if (on % 2 != p[j]) {
                ok = false;
            }
        }
        if (ok) {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}


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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define R(i,n) for(int i = 0; i < (n); i++)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}

template<class T> ostream &operator<<(ostream& os, set<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}

template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.FI << "," << P.SE << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int MAX = 1000;
int res[MAX][MAX];
int n;
void mal(int a,int kol){
  int x = 0;
  while(a%2 == 0){
    a/=2;
    x++;
  }
  int k = 1 << (x/2);
  if(x&1){
    R(i,n)if((i / k) % 2)R(j,n){
      res[i][j] ^= kol;
    }
  }else{
    R(i,n)R(j,n){
      if(((i / k) + (j/k)) % 2){
        res[i][j] ^= kol;
      }
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int a,b;
  cin >> n >> a >> b;
  n *= 2;
  mal(a,1);
  mal(b,2);
  vector<PII> wyn[4];
  R(i,n){
    R(j,n){
      cerr << res[i][j] << " ";
      wyn[res[i][j]].PB({i,j});
    }
    cerr << "\n";
  }
  R(i,4)if(SZ(wyn[i]) >= n * n / 4){
    R(k,n * n/4){
      cout << wyn[i][k].FI << " " << wyn[i][k].SE << "\n";
    }
    return 0;
  }
}




Measured memory_bytes: 15712
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

int main(void)
{
    //string a,b;
    int a,b,c,d;
    //char a,b,c;
    int i=0,sum=0;
    //char a,b='.';
    cin>>a>>b;
    if(a>8||b>8) cout<<":(";
    else cout<<"Yay!";
    return 0;
}



Measured memory_bytes: 256
// ---------- begin snipet ----------
pub trait MoOperator {
    type Answer;
    fn size(&self) -> usize;
    fn insert(&mut self, x: usize);
    fn delete(&mut self, x: usize);
    fn answer(&self) -> Self::Answer;
}

pub struct MoSolver {
    query: Vec<(usize, usize)>,
}

impl MoSolver {
    fn new() -> Self {
        MoSolver {
            query: vec![],
        }
    }
    fn add(&mut self, l: usize, r: usize) {
        self.query.push((l, r));
    }
    fn solve_with_size<State: MoOperator>(&mut self, state: &mut State, answer: &mut [State::Answer], batch: usize) {
        let size = state.size();
        let mut q = vec![vec![]; size / batch + 1];
        for (k, &(l, r)) in self.query.iter().enumerate() {
            q[l / batch].push((r, l, k));
        }
        let mut x = 0;
        let mut y = 0;
        for (i, mut q) in q.into_iter().enumerate() {
            q.sort_unstable_by_key(|p| p.0);
            if i % 2 == 1 {
                q.reverse();
            }
            for (r, l, k) in q {
                while l < x {
                    x -= 1;
                    state.insert(x);
                }
                while y < r {
                    state.insert(y);
                    y += 1;
                }
                while x < l {
                    state.delete(x);
                    x += 1;
                }
                while r < y {
                    y -= 1;
                    state.delete(y);
                }
                answer[k] = state.answer();
            }
        }
    }
}
// ---------- end Mo algorithm ----------

struct State {
    c: Vec<usize>,
    cnt: Vec<u32>,
    ans: u32,
}

impl MoOperator for State {
    type Answer = u32;
    fn size(&self) -> usize {
        self.c.len()
    }
    fn insert(&mut self, x: usize) {
        let c = &mut self.cnt[self.c[x]];
        if *c == 0 {
            self.ans += 1;
        }
        *c += 1;
    }
    fn delete(&mut self, x: usize) {
        let c = &mut self.cnt[self.c[x]];
        if *c == 1 {
            self.ans -= 1;
        }
        *c -= 1;
    }
    fn answer(&self) -> Self::Answer {
        self.ans
    }
}

fn solve(c: &[usize], ask: &[(usize, usize)]) -> Vec<u32> {
    let mut solver = MoSolver::new();
    for &(l, r) in ask {
        solver.add(l, r);
    }
    let mut state = State {
        c: c.iter().cloned().collect(),
        cnt: vec![0; c.len()],
        ans: 0,
    };
    let mut ans = vec![0; ask.len()];
    solver.solve_with_size(&mut state, &mut ans, 1024);
    ans
}

use proconio::*;
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        q: usize,
        c: [Usize1; n],
        ask: [(Usize1, usize); q],
    }
    let ans = solve(&c, &ask);
    for a in ans {
        println!("{}", a);
    }
}


Measured memory_bytes: 55540
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define pb push_back
#define all(v) v.begin(),v.end()
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

int maxf(int a,int b){
	return (a>b)?a:b;
}

int main(){
	int n,k;
	cin>>n>>k;
	int a;
	map<int,int> mp;
	rep(i,n){
		cin>>a;
		mp[a]++;
	}
	vector<p> vec;
	for(map<int,int>::iterator ite=mp.begin();ite!=mp.end();ite++){
		vec.pb(p(ite->second,ite->first));
	}
	sort(all(vec));
	ll ans=0,to=maxf(vec.size()-k,0);
	rep(i,to){
		ans+=vec[i].first;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 11768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;
 
int main()
{
    string s;
    cin >> s;
    ll ans = 0;
    ll cnt = 0;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == 'B')
            cnt++;
        else
            ans += cnt;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
using System;

namespace KEYPC2019_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var keystr = "keyence";

            var iskey = false;
            if (S.Contains(keystr))
            {
                var newS = S.Replace(keystr, "K");
                if (newS.IndexOf('K') == 0 || newS.IndexOf('K') == newS.Length - 1)
                {
                    iskey = true;
                }
            }

            for (int i = 1; i < keystr.Length; i++)
            {
                var targetleft = keystr.Substring(0, i);
                var targetright = keystr.Substring(i, keystr.Length - i);

                if (!(S.Contains(targetleft) && S.Contains(targetright)))
                {
                    continue;
                }

                if (S.IndexOf(targetleft) != 0)
                {
                    continue;
                }

                var newS = S.Replace(targetright, "R");
                if (newS.LastIndexOf('R') != newS.Length - 1)
                {
                    continue;
                }

                iskey = true;
            }

            Console.WriteLine(iskey ? "YES" : "NO");
        }
    }
}


Measured memory_bytes: 11348
#include <iostream>

using namespace std;

int main(){
 
  int n;
  cin >> n;
  
  int v[n];
  
  for(int i=0;i<n;i++){
  cin >> v[i];
  }
  
  int c[n];
  
  for(int i=0;i<n;i++){
  cin >> c[i];
  }
  
  int ans=0;
  for(int i=0;i<n;i++){
   if(v[i]>c[i])
     ans+=v[i]-c[i];
  }
  
  cout << ans << endl; 
  
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define EPS 1e-9
#define ll long long
#define Pll pair<ll, ll>
#define Pii pair<int, int>
 
using namespace std;
struct edge{int from, to; ll cost;};

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    long double x, y;
    cin >> x >> y;
    cout << (int)(log2(y) - log2(x) + 1) << endl;
}


Measured memory_bytes: 512