akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<set>
using namespace std;
int a,b,c;
char s[155][155];
struct str
{
	int ID;
	bool friend operator < (str a,str b)
	{
		return strcmp(s[a.ID],s[b.ID])<0;
	}
}t1,t2;
multiset<str> m;
multiset<str>::iterator it;
int main()
{
    scanf("%d%d%d",&a,&b,&c);
    int cnt=0;
	while(a--) s[++cnt][0]='a',m.insert((str){cnt});
	while(b--) s[++cnt][0]='b',m.insert((str){cnt});
	while(c--) s[++cnt][0]='c',m.insert((str){cnt});
	while(m.size()>1)
	{
		it=m.begin();t1=*it;m.erase(it);
		it=m.end();it--;t2=*it;m.erase(it);
		strcat(s[t1.ID],s[t2.ID]);
		m.insert((str){t1.ID});
	}
	it=m.begin();
	t1=*it;
	printf("%s\n",s[t1.ID]);
    return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))

A_sort=sorted(A)
ANSMIN=0
ANSMAX=N-1
cums=[None]*(N+1)

def midup(x):
    cums[0]=0
    for i in range(N):
        if A[i]>=x:
            cums[i+1]=cums[i]+1
        else:
            cums[i+1]=cums[i]-1

    MINS=min(cums)
    MAXS=max(cums)

    #print(MINS,MAXS,cums)

    bitlist=[0 for i in range(MAXS-MINS+2)]#出現個数をbit indexed treeの形でもっておく.

    NUM=0#iまでで,s_k<=s_iとなるものの個数

    for i in range(N+1):
        bitobje=cums[i]-MINS+1
        #print(i,bitobje)

        x=bitobje
        while x!=0:
            NUM+=bitlist[x]
            x-=(x&(-x))

        while bitobje<=MAXS-MINS+1:
            bitlist[bitobje]+=1
          
            bitobje+=(bitobje &(-bitobje))

    if NUM>=(N+1)*N//2/2:
        return 1
    else:
        return 0


while True:
    candi=A_sort[(ANSMIN+ANSMAX)//2]

    if midup(candi)==1:#中央値がx以上なら1を返す！
        ANSMIN=(ANSMIN+ANSMAX)//2
    else:
        ANSMAX=(ANSMIN+ANSMAX)//2

    if A_sort[ANSMIN]==A_sort[ANSMAX]:
        print(A_sort[ANSMIN])
        break
    if ANSMIN+1==ANSMAX:
        if midup(A_sort[ANSMAX])==1:
            print(A_sort[ANSMAX])
            break
        else:
            print(A_sort[ANSMIN])
            break

Measured memory_bytes: 92524
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    X = int(input())

    for a in range(-1000, 1000):
        for b in range(-1000, 1000):
            if (a ** 5 - b ** 5) == X:
                print("{} {}".format(a, b))
                exit()

    logging.info("error")
        
            
if __name__ == "__main__":
    main()


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int cnt=0;
    while(a>=b)
    {
        b*=2;
        cnt++;
    }
    while (b>=c)
    {
        c*=2;
        cnt++;
    }
    if(cnt<=k) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3632
package main

import (
	"fmt"
	"math"
)

func main(){
	var a, b, c, d float64
	fmt.Scan(&a, &b, &c, &d)

	if d >= math.Abs(c-a) || (d >= math.Abs(b-a) && d >= math.Abs(c-b)) {
		fmt.Print("Yes")
	}else{
		fmt.Print("No")
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = 1LL<<60;
const int MAX = 510000;
const int MOD = 1000000007;

long long 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;
    }
}

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

ll my_pow(ll m, ll n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return my_pow(m*m, n/2)%MOD; }
    return (my_pow(m, n-1) * m)%MOD;
}
//cout << fixed << setprecision(10);

int main() {
    ll N,K;
    cin >> N >> K;
    COMinit();
    for(int i=1;i<=K;i++){
        ll blue_num=COM(K-1,i-1);
        ll red_num=COM(N-K+1,i);
        cout << (blue_num*red_num)%MOD<< endl;
    }

    return 0;
}

Measured memory_bytes: 12792
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;

int n,q;
vector<int> G[200100];
int cnt[200100] = {};
int used[200100] = {};
int ans[200100] = {};

void dfs(int x,int d){
    ans[x] = d+cnt[x];
    used[x] = 1;
    for(auto y:G[x]){
        if(used[y] == 0){
            dfs(y,ans[x]);
        }
    }
}


/*----------------------------------------------------------------*/
signed main(){

    cin >> n >> q;
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        G[a-1].pb(b-1);
        G[b-1].pb(a-1);
    }
    rep(i,q){
        int p,x;
        cin >> p >> x;
        cnt[p-1] += x;
    }
    dfs(0,0);
    rep(i,n)cout << ans[i] << " ";cout << endl;




  
  
	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc138.contest.atcoder.jp/tasks/abc138_d

Measured memory_bytes: 24320
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define PI 3.14159265
#define seive_len 1000001

bool seive[seive_len];
int primeSeive[seive_len];

typedef long long int lli;

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

lli lcm(lli a, lli b) {
  lli gcd_ = gcd(a, b);
  lli lcm_ = (a*b)/gcd_;
  return lcm_;
}

lli fastPower(lli a, lli b) {
  lli res=1;
  while(b > 0) {
    if(b&1)
      res *= a;
    a *= a;
    b >>= 1;
  }
  return res;
}

lli fastPowerM(lli a, lli b, lli mod) {
  a %= mod;
  lli res = 1;
  while(b) {
    if(b%2 == 1)
      res = (res*a)%mod;
    a = (a*a)%mod;
    b >>= 1;
  }
  return res;
}

void multiply(lli a[][2], lli b[][2], int mod) {
  int res[2][2];
  memset(res, 0, sizeof(res));
  for(int i=0;i<2;i++) {
    for(int j=0;j<2;j++) {
      for(int k=0;k<2;k++) {
        res[i][j] += a[i][k]*b[k][j]%mod;
      }
    }
  }
  for(int i=0;i<2;i++)
    for(int j=0;j<2;j++)
      a[i][j] = res[i][j];
}

void matrixExpo(lli a[][2], lli n, int mod) {
  if(n == 0 || n == 1)
    return;
  lli b[][2] = {{1,1}, {1,0}};
  matrixExpo(a, n/2, mod);
  multiply(a, a, mod);
  if(n%2)
    multiply(a, b, mod);
}

void makeSeive() {
  for(int i=2;i*i<=seive_len;i++) {
    if(seive[i]) {
      for(int j=i*i;j<=seive_len;j+=i)
        seive[j] = false;
    }
  }
}

void makePrimeSeive() {
  for(int i=1;i<seive_len;i++)
    primeSeive[i] = i;
  for(int i=4;i<seive_len;i+=2)
    primeSeive[i] = 2;
  for(int i=3;i*i<seive_len;i++) {
    if(primeSeive[i] == i) {
      for(int j=i*i;j<seive_len;j+=i) {
        if(primeSeive[j] == j)
          primeSeive[j] = i;
      }
    }
  }
}

bool isPrime(lli n) {
  for(int i=2;i<=sqrt(n);i++) {
    if(n%i == 0)
      return false;
  }
  return true;
}

void getInput(vector<lli>& a, int n) {
  lli x;
  for(int i=0;i<n;i++) {
    cin >> x;
    a.push_back(x);
  }
}

void dfs(vector<lli> adj[], bool vis[], lli i, lli* len) {
  vis[i] = true;
  // cout << i << ' ';
  for(auto j=adj[i].begin();j!=adj[i].end();j++) {
    if(vis[*j] == false) {
      dfs(adj, vis, *j, len);
      *len += 1;
    }
  }
}

void testCase() {
    lli i, j;
    string s, t;
    cin >> s >> t;
    lli res = 0, max_ = INT_MAX;
    for(i=0;i<s.size()-t.size()+1;i++) {
      lli x = i;
      res = 0;
      for(j=0;j<t.size();j++) {
        if(s[x] != t[j])
          res++;
        x++;
      }
      max_ = min(max_, res);
    }
    cout << max_;
}

int main() {
	int t=1;
	// cin >> t;
  // FILE* fp;
  // fp = fopen("out.txt", "w");
  // makePrimeSeive();
	for(int i=1;i<=t;i++) {
    // fprintf(fp, "Case #%d: ", i);
		testCase();
    cout << '\n';
	}
	return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
 
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007;

int gcd(int a, int b){
  int tmp = 1;
  while(tmp != 0){
    tmp =  a%b;
    a = b;
    b = tmp;
  }
  return a;
}

int main(){
  int n;cin >> n;
  long long ans; cin >> ans;
  for(int i = 0; i<n-1; i++){
    int ai; cin >> ai;
    ans = (ans*ai)/gcd(ans,ai);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3092
# D - Disjoint Set of Common Divisors

import fractions

A, B = map(int, input().split())
C = fractions.gcd(A, B)

primes = []
i = 2
while i * i <= C:
    while C % i == 0:
        C //= i
        primes.append(i)
    i += 1
if C > 1:
    primes.append(C)

print(len(set(primes)) + 1)


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

inline int po(int n, int k) {
	int re = 1;
	for(int i = 0; i < k; ++i) {
		re *= n;
	}
	return re;
}

int get_n_oper(int n, int m) {
	int n_oper = 0;
	for(int r = 7; r >= 0; --r) {
		int hoge = po(m, r);
		while(n >= hoge) {
			n -= hoge;
			++n_oper;
		}
	}
	return n_oper;
}

int main(int argc, char* argv[]) {
	int N;
	cin >> N;

	int n_6, n_9;
	int n_oper = N;
	for(int n_6 = 0; n_6 <= N; ++n_6) {
		n_9 = N - n_6;
		int n_oper_6 = get_n_oper(n_6, 6);
		int n_oper_9 = get_n_oper(n_9, 9);
		if(n_oper > n_oper_6 + n_oper_9) n_oper = n_oper_6 + n_oper_9;
	}

	cout << n_oper << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT false

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == 1)return;for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(std::vector<T>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}


void solve(void)
{ 
  
  string str;
  cin>>str;
  int A[4] ={0};
  int N = 3;
  for (int i = 0; i < N+1; i++)
  {
    A[i] = str[i] - '0';
    DEBUG("A",A[i]);
  }
  

  for (int i = 0; i < 1<<N; i++)
  {
    
    int NUM = A[0];
    for (int j = 0; j < N; j++)
    {
      if(i & (1<<j))
      {
        NUM += A[j+1];
      }
      else
      {
        NUM -= A[j+1];
      }
    }
    DEBUG(NUM);
    if(NUM == 7)
    {
      for (int j = 0; j < N+1; j++)
      {
        if(j != 0)
        {
          if(i &(1<<(j-1))) cout<<"+";
          else cout<<"-";
        }
        cout<<A[j];

      }
      cout<<"=7"<<endl;
             return; 
    }
  }
  
  
    
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; inline void fileio(const char* in, const char* out) { freopen(in, "r", stdin); freopen(out, "w", stdout); } 
#define TD typedef
#define forx(i,n) for(int i = 0; i < (n); ++i)
#define forxr(i,n) for(int i = (n)-1; i >= 0; --i)
TD long long ll; TD long double ld; TD pair<int,int> pii; TD pair<ll,ll> pll; TD vector<int> VI; TD vector<bool> VB; TD vector<ll> VL;
const char nl = '\n'; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; const ld EPS = 1e-9, PI = acos(-1);
#define ff first
#define ss second
#define all(c) c.begin(),c.end()

const vector<string> tile3 = {
  "aa.",
  "..a",
  "..a"
};

const vector<string> tile4 = {
  "aabc",
  "ddbc",
  "efgg",
  "efhh"
};

const vector<string> tile5 = {
  "aabba",
  "bcc.a",
  "b..cb",
  "a..cb",
  "abbaa"
};

const vector<string> tile6 = {
  "aabc..",
  "ddbc..",
  "..aabc",
  "..ddbc",
  "bc..aa",
  "bc..dd"
};

const vector<string> tile7 = {
  "aabbcc.",
  "dd.dd.a",
  "..d..da",
  "..d..db",
  "dd.dd.b",
  "..d..dc",
  "..d..dc"
};

const int N = 1005;
char ans[N][N];

void apply(const vector<string>& tiling, int i, int j) {
  const int n = tiling.size();
  for (int x = 0; x < n; ++x) {
    for (int y = 0; y < n; ++y) {
      ans[i+x][j+y] = tiling[x][y];
    }
  }
}

int main() {
  atexit([](){ cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl; });
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout << fixed << setprecision(12);
  // Emily <3
  int n; cin >> n;
  if (n < 3) {
    cout << -1 << nl;
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      ans[i][j] = '.';
    }
  }
  if (n == 3) {
    apply(tile3, 0, 0);
  } else {
    int i = 0;
    int left = n;
    while (left >= 8) {
      apply(tile4, i, i);
      i += 4;
      left -= 4;
    }
    switch (left) {
      case 4: apply(tile4, i, i);
              break;
      case 5: apply(tile5, i, i);
              break;
      case 6: apply(tile6, i, i);
              break;
      case 7: apply(tile7, i, i);
              break;
      default: assert(false);
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cout << ans[i][j];
    }
    cout << nl;
  }
  return 0;
}



Measured memory_bytes: 2176
#include <iostream>
#include <vector>
using namespace std;
//okay?
bool tosa(vector<int> v){
	int d = v[1] - v[0];
	for( int i = 1; i < v.size(); i++){
		if(v[i] - v[i-1] != d)	return false;
	}
	return true;
	}
int main(){

	vector<int>A;
	int n;
	while( cin >> n && n){
	A.resize(n+1);
	for( int i = 0; i < n+1; i++) cin >> A[i];
	
	for( int i = 0; i < n+1; i++){
		vector<int> tmp = A;
		tmp.erase(tmp.begin() + i);
		if( tosa(tmp) ){
			cout << A[i] << endl;
			break;
			}
		}
	}
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
#define BS 500
#define MAX 214514
int up[500],fr[500],to[500],ou[500];
int dn[MAX];
void eval(int p){
  if(!up[p]) return;
  for(int j=BS*p;j<BS*(p+1);j++){
    if(dn[j]==fr[p]) dn[j]=to[p];
    else dn[j]=-1;
  }
  up[p]=0;
}
signed main(){
  int n,k,t;
  cin>>n>>k>>t;
  memset(up,0,sizeof(up));
  memset(fr,0,sizeof(fr));
  memset(to,0,sizeof(to));
  memset(ou,0,sizeof(ou));
  memset(dn,0,sizeof(dn));
  int l[t],r[t],x[t];
  for(int i=0;i<t;i++) cin>>l[i]>>r[i]>>x[i];
  for(int i=0;i<t;i++){
    l[i]--;
    int p=0;
    while(BS*p<=l[i]) p++;
    eval(p-1);
    for(int j=l[i];j<min(r[i],BS*p);j++){
      if(ou[j/BS]) break;
      if(dn[j]==x[i]-1) dn[j]=x[i];
      else dn[j]=-1;
    }
    for(;BS*(p+1)<=r[i];p++){
      if(ou[p]) continue;
      if(up[p]){
	if(to[p]==x[i]-1) to[p]=x[i];
	else ou[p]=1;
      }else{
	up[p]=1;
	fr[p]=x[i]-1;
	to[p]=x[i];
      }
    }
    eval(p);
    for(int j=BS*p;j<r[i];j++){
      if(ou[j/BS]) break;
      if(dn[j]==x[i]-1) dn[j]=x[i];
      else dn[j]=-1;
    }
  }
  int p=0;
  while(BS*p<n) eval(p++);
  int ans=0;
  for(int j=0;j<n;j++){
    if(ou[j/BS]) continue;
    ans+=dn[j]==k;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 6232
N, W = map(int, input().split())
wv = []
for _ in range(N):
    wv.append(list(map(int, input().split())))
INF = 10**10
v_max = 10**5
dp = [[INF]*(v_max+1) for _ in range(N+1)]
dp[0][0] = 0
ans = 0
for i in range(N):
    for j in range(v_max+1):
        if j >= wv[i][1]:
            dp[i+1][j] = min(dp[i][j], dp[i][j-wv[i][1]]+wv[i][0])
            #print(i, j, dp[i+1][j], dp[i][j], wv[i][0])
        else:
            dp[i+1][j] = dp[i][j]
        if i+1 == N and dp[i+1][j] <= W:
            ans = j
print(ans)

Measured memory_bytes: 121844
import java.io.*;
import java.util.*;
public class Main {
    private static MyScanner scanner;

    public static void main (String[] args){
        Main instance = new Main();
        scanner = instance.new MyScanner();
        instance.solve();
    }

    private void solve() {
        try {
            int N = scanner.nextInt();
            int x = N * 800;
            int y = N / 15 * 200;
            System.out.println(x-y);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";

        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String line = br.readLine();
            while (line.equals("")) {
                line = br.readLine();
            }
            s = line.split(reg, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }

        public long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 20564
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
    int a,b,sum,k;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        k=a+b;
        sum=0;
        while(k!=0)
        {
            k/=10;
            sum++;
        }
        printf("%d\n",sum);
    }
    return 0;
}

Measured memory_bytes: 1188
#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>inline bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;
#pragma endregion

void solve() {
    int n, K;
    cin >> n >> K;
    vector<pair<ll, ll>> a(n);
    for (int i=0; i<n; i++) {
        cin >> a.at(i).first >> a.at(i).second;
    }
    ll res = 1e20;
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            for (int k=0; k<n; k++) {
                for (int l=0; l<n; l++) {
                    ll xmin = a.at(i).first, xmax = a.at(j).first, ymin = a.at(k).second, ymax = a.at(l).second;
                    int cnt = 0;
                    for (int m=0; m<n; m++) {
                        if (xmin <= a.at(m).first && a.at(m).first <= xmax && ymin <= a.at(m).second && a.at(m).second <= ymax) {
                            cnt++;
                        }
                    }
                    if (cnt >= K) {
                        chmin(res, (xmax - xmin) * (ymax - ymin));
                    }
                }
            }
        }
    }
    cout << res << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    n = ini()
    x = inl()
    y = sorted(x)

    p = y[n // 2 - 1]
    q = y[n // 2]

    for i in range(n):
        if x[i] < q:
            print(q)
        else:
            print(p)


solve()


Measured memory_bytes: 31076
from sys import stdin
import math

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

tmp = 0
ans = 0

for i in range(n-1):
    if (an[i] >= an[i+1]):
        tmp += 1
        ans = max(ans,tmp)
    else:
        tmp = 0

print(ans)


Measured memory_bytes: 63984
n=int(input())
a = list(map(int,input().split()))

# oを選択 xを非選択とする　左から見て
# oxoxoxoxoxo に x を1つか2つ挿入することを考える
# 状態を4つ設定 (最後がxかoか)(挿入ずみのxの数)の形式でやる
#a=[1,2,3,4,5,6,7]
#n=len(a)
x0,x1,x2,o0,o1,o2=a[0],-10**18,0,-10**18,a[1],-10**18
for i in a[2:]:
    x0,x1,x2,o0,o1,o2=o0,max(o1,x0),max(o2,x1),x0+i,x1+i,x2+i
if n%2==0:
    print(max(x0,x1,o1))
else:
    print(max(x1,x2,o2))

Measured memory_bytes: 31284
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

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

  cout << "Three" << endl;

  return 0;
}

Measured memory_bytes: 3588
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
vector<int>pat[101010];
bool flag[101010];
bool isv[101010];
string str;
bool dfs(int node)
{
	flag[node] = true;
	bool r = (str[node] == 'W');
	for (int i = 0; i < pat[node].size(); i++)
	{
		int v = pat[node][i];
		if (flag[v])continue;
		r |= dfs(v);
	}
	return isv[node] = r;
}
int sc[101010];
int maxi = 0;
int calc(int node)
{
	flag[node] = true;
	int m1 = 0, m2 = 0;
	for (int i = 0; i < pat[node].size(); i++)
	{
		int v = pat[node][i];
		if (!isv[v])continue;
		if (flag[v])continue;
		int t = calc(v);
		if (m1 < t)m2 = m1, m1 = t;
		else if (m2 < t)m2 = t;
	}
	//printf("%d %d %d\n", node + 1, m1, m2);
	maxi = max(maxi, m1 + m2 + ((str[node] == 'W') ? 2 : 0));
	return m1 + ((str[node] == 'W') ? 2 : 0);
}
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num - 1; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		za--, zb--;
		pat[za].push_back(zb);
		pat[zb].push_back(za);
	}
	cin >> str;
	int rr = -1;
	for (int i = 0; i < num; i++)if (str[i] == 'W')rr = i;
	if (rr == -1)
	{
		printf("0\n");
		return 0;
	}
	dfs(rr);
	int cnt = 0;
	for (int i = 0; i < num; i++)cnt += isv[i];
	if (cnt == 1)
	{
		printf("1\n");
		return 0;
	}
	for (int i = 0; i < num; i++)
	{
		//if (isv[i])printf("%d\n", i + 1);
		for (int j = 0; j < pat[i].size(); j++)
		{
			if (isv[i] && isv[pat[i][j]])str[i] = 'W' + 'B' - str[i];
		}
	}
	//cout << str << endl;
	fill(flag, flag + num, false);
	calc(rr);
	int ans = cnt * 2 - 2;
	for (int i = 0; i < num; i++)if (isv[i] && str[i] == 'W')ans++;
	printf("%d\n", ans - maxi);
}

Measured memory_bytes: 12416
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> nums(n);
  for(int i=0;i<n;i++)
  {
    int x;
    cin>>x;
    nums[i]=x;
  }
    vector<int> dp(n,0);
    dp[0]=0;
    dp[1]=abs(nums[0]-nums[1]);
    for(int i=2;i<n;i++)
      dp[i]=min(dp[i-2]+abs(nums[i]-nums[i-2]),dp[i-1]+abs(nums[i]-nums[i-1]));
    cout<<dp[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
class Dice {
  private:
    int dev[6],tmp;
  
  public:
    Dice(int array[6]) {
      for (int i = 0; i < 6; i++) dev[i] = array[i];
    }

    void print() {
      printf("%d\n", dev[0]);
    }
    void e() {
      tmp = dev[0];
      dev[0] = dev[3];
      dev[3] = dev[5];
      dev[5] = dev[2];
      dev[2] = tmp;
    }
    void n() {
      tmp = dev[0];
      dev[0] = dev[1];
      dev[1] = dev[5];
      dev[5] = dev[4];
      dev[4] = tmp;
    }
    void s() {
      tmp = dev[0];
      dev[0] = dev[4];
      dev[4] = dev[5];
      dev[5] = dev[1];
      dev[1] = tmp;
    }
    void w() {
      tmp = dev[0];
      dev[0] = dev[2];
      dev[2] = dev[5];
      dev[5] = dev[3];
      dev[3] = tmp;
    }
};
int main() {
  int arr[6];
  char order;
  for (int i = 0; i < 6; i++) scanf("%d", &arr[i]);
  Dice dice(arr);
  scanf("%c", &order);
  while(true) {
    scanf("%c", &order);
    if (order == '\n') break;
    switch (order) {
      case 'E':
        dice.e();
        break;
      case 'N':
        dice.n();
        break;
      case 'S':
        dice.s();
        break;
      case 'W':
        dice.w();
        break;
    }
  }
  dice.print();
  return 0;
}



Measured memory_bytes: 2732
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <iomanip>
#define ll long long
using namespace std;

int main(void){
    ll n;
    cin >> n;
    ll c5 = 0;
    ll a = 10;
    while(a <= n){
        c5+=n/a;
        a*=5;
    }
    if(n%2!=0)
        c5=0;
    cout << c5 << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var ans = 0;
            for (int i = 1; i <= N; i++)
            {
                if (i.ToString().Length % 2 == 1)
                {
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

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

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, n) for (auto i : (n))
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

const int kMax = 2 * 100000;
ll tens[kMax];
ll cnt[10000];

int main() {
  ll N, P;
  cin >> N >> P;
  string S;
  cin >> S;

  int p[] = {2, 5};
  REP(i, 2) if (P == p[i]) {
    ll cnt = 0;
    REP(j, S.size()) if ((S[j] - '0') % p[i] == 0) {
      cnt += j + 1;
    }
    cout << cnt << endl;
    return 0;
  }

  //DBG(N, S, P);

  tens[0] = 1;
  for (int i = 1; i < kMax; ++i) {
    tens[i] = tens[i - 1] * 10 % P;
    // DBG(i, tens[i]);
  }

  ll mod = 0;
  map<ll, ll> cnt;
  reverse(ALL(S));
  REP(i, N) {
    mod = (mod + (S[i] - '0') * tens[i]) % P;
    cnt[mod]++;
    DBG(S[i], mod, cnt[mod]);
  }
  ll ans = 0;
  for (auto it : cnt) {
    ll k, v;
    tie(k, v) = it;
    if (k != 0) --v;
    ans += v * (v + 1) / 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 2564
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define inf    0x3f3f3f3f
#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
typedef vector<int>      vi;
typedef vector<bool>     vb;
#define INF (int)1e15
#define MOD 1000000007

#define access(i) a[i/3][i%3]
//#define random_shuffle(r...)random_shuffle(r,[](int _){return my_rand()%_;})

 int cnt=0,cnt2=0;

bool check(int x, int n){

 set<int>st;

  while(x){
      st.insert(x%10);
      x /= 10;
  }

  if(st.size() == 3) return true;

      return false;
}

 void dfs(long long x,int n){

  // cout<<x<<" ? "<<n<<endl;
   if(n < x) return ;
   //cout<<x<<"  "<<n<<endl;
   if(check(x,n)) cnt++;

   dfs(10*x+3,n);
   dfs(10*x+5,n);
   dfs(10*x+7,n);

 }

 int main(){

 int n; cin>>n;
  dfs(0,n);
  cout<<cnt<<endl;

 return 0;
 }


Measured memory_bytes: 3640
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let s: String = input();

    let s: i32 = s.parse().ok().unwrap();
    let (n, m) = (s / 100, s % 100);

    if 1 <= n && n <= 12 && 1 <= m && m <= 12 {
        println!("AMBIGUOUS");
    } else if 1 <= n && n <= 12 {
        println!("MMYY");
    } else if 1 <= m && m <= 12 {
        println!("YYMM");
    } else {
        println!("NA");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int arr[100005], dp[100005];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; ++i)
		cin >> arr[i];
	fill(dp, dp + n + 1, INT_MAX);
	dp[0] = 0;
	for (int i = 0; i < k; ++i) 
		for (int j = 0; j < i; ++j)
			dp[i] = min(dp[i], dp[j] + abs(arr[i] - arr[j]));
	for (int i = k; i < n; ++i)
		for (int j = i - k; j < i; ++j)
		dp[i] = min(dp[i], dp[j] + abs(arr[i] - arr[j]));
	cout << dp[n - 1] << '\n';
	return 0;
}

Measured memory_bytes: 1024
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,W = map(int, input().split())
    w,v = [], []
    for i in range(n):
        a,b = map(int, input().split())
        if i == 0:
            w.append(a)
        else:
            w.append(a - w[0])
        v.append(b)
    #w1の重さ
    base = w[0]
    w[0] = 0
    w0, w1, w2, w3 = [], [], [], []
    for i in range(n):
        if w[i] == 0:
            w0.append(v[i])
        if w[i] == 1:
            w1.append(v[i])
        if w[i] == 2:
            w2.append(v[i])
        if w[i] == 3:
            w3.append(v[i])
    w0.sort(reverse=1)
    w1.sort(reverse=1)
    w2.sort(reverse=1)
    w3.sort(reverse=1)
    w0 = [0] + w0
    w1 = [0] + w1
    w2 = [0] + w2
    w3 = [0] + w3
    w0 = list(accumulate(w0))
    w1 = list(accumulate(w1))
    w2 = list(accumulate(w2))
    w3 = list(accumulate(w3))

    res = 0
    for i in range(len(w0)):
        for j in range(len(w1)):
            for k in range(len(w2)):
                for l in range(len(w3)):
                    if base*(i+j+k+l) + j + k*2 + l*3 <= W:
                        res = max(res, w0[i]+w1[j]+w2[k]+w3[l])
    print(res)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	n = readline() |> parseInt
	a = readline() |> split |> parseMap
	k = 0
	for i in 1:n
		if a[a[i]] == i
			k += 1
		end
	end
	println(div(k,2))
end
main()


Measured memory_bytes: 117644
#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 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int N, L;
  cin >> N >> L;
  int s = 0;
  REP(i, N) {
    s += L + i;
  }
  pair<int, int> p = make_pair(INF, INF);
  REP(i, N) {
    int tmp = 0;
    REP(j, N) {
      if (i == j) {
        continue;
      }
      tmp += L + j;
    }
    if (abs(s - tmp) < p.first) {
      p.first = abs(s - tmp);
      p.second = tmp;
    }
  }
  cout << p.second << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
using Data = pair<ll, vector<int>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };
typedef tuple<ll, ll, ll>T;
typedef pair<ll,ll>pll;



int main(){
	int a,b;
  	cin >> a >> b;
  	if(a >= 13)cout << b << endl;
  	else if(6 <= a && a <= 12)cout << b/2 << endl;
  	else cout << 0 << endl;

	return 0;
}

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


int main(){
  long n, k;
  cin >> n >> k;
  long long ans = 0;
  long long t1 = 0 , t2 = 0, n2 = 0;
  t1 = n / k;
  ans += t1 * t1 * t1;
  if(k % 2 == 0){
      t2 = k / 2;
      n2 = n - t2;
      if(t2 <= n){
         t2 = n2 / k + 1; 
      }else{
         t2 = n2 / k; 
      }
      ans += t2 * t2 * t2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

using namespace std;
typedef long long int ll;
typedef long double lld;

struct Node {
    // define the data inside this section
    ll sum;
    Node():sum(0){}
    explicit Node(ll val) {
        sum = val;
    }
    Node &operator += (const Node &to) {
        return *this = *this + to;
    }
    // how to combine the two nodes write here
    Node operator + (const Node &to) const {
        Node res;
        res.sum = max(sum, to.sum);
        return res;
    }
};

template <class T>
struct GetSegmentTree {
    static T combineNode(const T &x, const T &y) { return x + y; }
    static void combineNodes(T &x, const T &y) { x += y; }
    static T identityNode() { return T(); }

    vector<T> tree;
    int N;
    GetSegmentTree(int n, const T &val = T()):N(n) {
        tree.resize((N),identityNode());
        tree.resize((N << 1LL),val);
        build();
    }
    GetSegmentTree(const vector<T> &A) {
        N = A.size();
        tree.resize((N),identityNode());
        tree.insert(tree.end(), A.begin(), A.end());
        build();
    }
    void build() {
        for (int i = N - 1; i > 0; --i) tree[i] = tree[i<<1] + tree[i<<1|1];// tree[i] = combineNode(tree[i<<1] , tree[i<<1|1]);
    }
    T get(int i) {
        return tree[i+N];
    }
    T getWhole() {
		return queryRange(0,N);
	}
    T queryRange(int l, int r) {     // [l,r)
        T resl, resr;
        for (l += N, r += N; l < r; l >>= 1, r >>= 1) {
            if (l&1) resl = resl + tree[l++]; //combineNode(resl, tree[l++]);
            if (r&1) resr = tree[--r] + resr;//combineNode(tree[--r], resr);
        }
        return resl + resr;//combineNode(resl, resr);
    }
    void updatePoint(int p, const Node &val) {
        for (tree[p += N] = val; p >>= 1; ) tree[p] = tree[p<<1] + tree[p<<1|1]; // combine(t[p<<1], t[p<<1|1]);
    }
};

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

	int n; cin >> n;
	vector<ll> h(n, 0), a(n, 0);
	for(int i = 0; i < n; i++) cin >> h[i];
	for(int i = 0; i < n; i++) cin >> a[i];


	GetSegmentTree<Node> segt(n + 1);
	
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		auto node = segt.queryRange(0, h[i]);
		segt.updatePoint(h[i], Node(node.sum + a[i]));
		ans = max(ans, node.sum + a[i]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 8064
#include <iostream>

using namespace std;

const int MAXN = 2E5;
int a[MAXN];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    bool poss = a[0] == 0;
    for (int i = 1; i < n; i++)
    {
        if (a[i] - 1 > a[i - 1])
            poss = false;
    }
    if (poss)
    {
        int ptr = 1;
        long long ans = 0;
        while (ptr < n)
        {
            while (ptr + 1 < n && a[ptr + 1] == a[ptr] + 1)
            {
                ptr++;
            }
            ans += a[ptr];
            ptr++;
        }
        cout << ans << endl;
    }
    else
    {
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int sum = 0;
        for(int i=1; i<=n; i++) {
            sum += i;
        }
        System.out.println(sum);
    }   
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin >> N;
    string S[N];
    map<string,int> m;
    rep(i,N) {
        cin >> S[i];
        m[S[i]]++;
    }
    int ans=0;
    for(auto p:m){
        ans++;
    }
    cout << ans << endl;



}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<vector<int>> v(n);
  
  for(int i = 0; i < m; i++){
    int tmp1, tmp2;
    cin >> tmp1 >> tmp2;
    v.at(tmp1-1).push_back(tmp2-1);
    v.at(tmp2-1).push_back(tmp1-1);
  }
  
  for(auto x : v){
    cout << x.size() << endl;
  }
}

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

int main()
{
    int N, K;
    cin >> N >> K;
    if (K > (N - 1) * (N - 2) / 2)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << N - 1 + (N - 1) * (N - 2) / 2 - K << endl;
        for (int i = 2; i <= N; i++)
        {
            cout << 1 << " " << i << endl;
        }

        int counter = (N - 1) * (N - 2) / 2 - K;
        for (int i = 2; counter > 0 && i <= N; i++)
        {
            for (int j = i + 1; counter > 0 && j <= N; j++)
            {
                cout << i << " " << j << endl;
                counter--;
            }
        }
        
        
    }
    // system("pause");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  char a;
  cin >> a;
  if(isupper(a)) cout << 'A' << endl;
  else cout << 'a' << endl;
  
return 0;
}



Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int dp[2200][3200],_prev[2200][3200],n,m,s;
int main(){
	while(true){
		cin>>n>>s>>m;if(n==0)return 0;n*=n;
		for(int i=0;i<2200;i++){fill(dp[i],dp[i]+3180,0);fill(_prev[i],_prev[i]+3180,0);}
		for(int i=0;i<=s;i++)_prev[i][0]=1;
		for(int i=0;i<n;i++){
			for(int j=1;j<=s;j++){
				for(int k=j;k<=m;k++){
					dp[j][k]+=_prev[j-1][k-j];dp[j][k]%=100000;
				}
			}
			for(int j=0;j<=s;j++){
				for(int k=0;k<=m;k++){
					_prev[j][k]=dp[j][k];dp[j][k]=0;
				}
			}
			for(int j=1;j<=s;j++){
				for(int k=1;k<=m;k++){
					_prev[j][k]+=_prev[j-1][k];
				}
			}
		}
		cout<<_prev[s][m]%100000<<endl;
	}
}

Measured memory_bytes: 58052
import collections
import sys
input = sys.stdin.readline
n,k,l=map(int,input().split())

parD,parT=[-1]*n,[-1]*n
def findD(x):
  if parD[x]<0:
    return x
  else:
    parD[x]=findD(parD[x])
    return parD[x]
def uniteD(x,y):
  x=findD(x)
  y=findD(y)
  if x==y:
    return False
  else:
    if parD[x]>parD[y]:
      x,y=y,x
    parD[x]+=parD[y]
    parD[y]=x
    return True
def sameD(x,y):
  return findD(x)==findD(y)
def sizeD(x):
  return -parD[findD(x)]
def findT(x):
  if parT[x]<0:
    return x
  else:
    parT[x]=findT(parT[x])
    return parT[x]
def uniteT(x,y):
  x=findT(x)
  y=findT(y)
  if x==y:
    return False
  else:
    if parT[x]>parT[y]:
      x,y=y,x
    parT[x]+=parT[y]
    parT[y]=x
    return True
def sameT(x,y):
  return findT(x)==findT(y)
def sizeD(x):
  return -parT[findT(x)]


for i in range(k):
  p,q=map(int,input().split())
  uniteD(p-1,q-1)
for i in range(l):
  r,s=map(int,input().split())
  uniteT(r-1,s-1)
for i in range(n):
  findD(i)
  findT(i)
C=[]
for i in range(n):
  if parD[i]<0:
    parD[i]=i
  if parT[i]<0:
    parT[i]=i
Ans=[]
for i in range(n):
  Ans.append((parD[i],parT[i]))
ANS=collections.Counter(Ans)
for i in range(n):
  print(ANS[Ans[i]])

Measured memory_bytes: 93604
N = int(input())

ST = []
for i in range(N):
    X, L = map(int, input().split())
    ST.append((X - L, X + L))

ST.sort(key=lambda x: x[1])

ans = 0
cur = -1e9
for i in range(N):
    S, T = ST[i]
    if cur <= S:
        ans += 1
        cur = T
print(ans)


Measured memory_bytes: 23964
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

int main(void) {
    double L;
    cin >> L;

    double ans = 0;
    for (double a = 0.0001; a <= L; a += 0.0001) {
        double b = (L - a) / 2.0;
        double c = (L - a - b);
        if (c <= 0) continue;
        // if (a + b + c != L) continue;
        if (ans < a * b * c) {
            // printf("a: %.7f, b: %.7f, c: %.7f, cand: %.7f\n", a, b, c, a * b * c);
            ans = a * b * c;
        }
    }

    printf("%.7f\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;



int main(){
    int N;
    cin >> N;
    int r[N];
    REP(i,N)cin >> r[i];
    int ans = -2000000000 ,minv= r[0];
    for(int i=1;i<N;i++){
        ans = max(ans,r[i]-minv);
        minv = min(minv,r[i]);
    }
    cout << ans << endl;
}



Measured memory_bytes: 3860
package main

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

func main() {
	fsc := NewFastScanner()
	N, K := fsc.NextInt(), fsc.NextInt()
	var ans int64
	ans = int64(K)
	for i := 0; i < N-1; i++ {
		ans *= int64(K - 1)
	}
	fmt.Println(ans)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}

func (s *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.Next())
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) NextInt64() int64 {
	val, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

int main(){
	int w, a, b;

	cin >> w >> a >> b;

	if(a > b){
		int k = a;
		a = k;
		a = b;
		b = k;
	}

	if(a + w >= b)
		cout << 0 << endl;
	else 
		cout << b - (a + w) << endl;

	return 0;
}

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

typedef long long ll;
#pragma GCC optimize ("Ofast")
#define rep(i,a,b) for(ll i = (a); i < (b); ++i)
#define iter(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define pb push_back
#define fs first
#define sc second
#define MOD 1000000007
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const int INF = ~(1<<31);
const double pi = acos(-1);
const double EPS = 1e-9;

inline int modulo(int a, int b) {
  const int result = a % b;
  return result >= 0 ? result : result + b;
}

ll n;
vi A;
vi X;
int counter = 0;
/*void bt(int at){
    if(at == n){
        bool f = true;
        rep(i,0,n){
            int cnt = 0;
            for(int x = (i+1); x <= n; x += i+1){
                cnt += X[x-1];
            }
            if(modulo(cnt-A[i], 2) == 1){
                cout << "FAILED " << i+1 << endl;
                f = false;
            }
        }
        if(f){
            rep(i,0,n){
                cout << X[i] << ' ';
            }cout << " YES " << endl;
        }else{
            rep(i,0,n){
                cout << X[i] << ' ';
            }cout << " NO " << endl;
        }
        return;
    }
    rep(i,0,2){
        X[at] = i;
        bt(at+1);
    }
}*/

int main()
{
    cin >> n;
    A = vi(n);
    rep(i,0,n) cin >> A[i];
    X = vi(n,0);
    vi ans;
    for(int i = n-1; i >= 0; i--){
        int cnt = 0;
        for(int x = i+1; x<= n; x += i+1){
            if(X[x-1] == 1) cnt++;
        }
        if(modulo(A[i]-cnt,2) == 1) {
            X[i] = 1;
            ans.pb(i+1);
        }
    }
    cout << ans.size() << endl;
    rep(i,0,ans.size()){
        cout << ans[ans.size()-i-1] << ' ';
    }
    //rep(i,0,n) cout << X[i] << ' ';
}


Measured memory_bytes: 4980
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int number_a, number_b, number_d, number_r;
    double number_f;
    number_a = Integer.parseInt(sc.next());
    number_b = Integer.parseInt(sc.next());
    number_d = number_a / number_b;
    number_r = number_a % number_b;
    number_f = ((double)number_a) / ((double)number_b);
    String output = String.format("%d %d %f", number_d, number_r, number_f);
    System.out.println(output);
  }
}


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

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

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

    ll N; cin >> N;
    ll a[100005];
    ll f1,f0;
    f1 = f0 = false;
    for (int i = 0;i < N;i++){
        cin >> a[i];
        if(a[i] == 0) f0 = true;
        if(a[i] == 1) f1 = true;
    }
    ll w[100005];
    for (int i = 0;i < N;i++){
        cin >> w[i];
    }

    if(!f0 || !f1) cout << 0 << endl;
    else{
        ll s,t;
        s = t = INT_MAX;
        for (int i = 0;i < N;i++){
            if(a[i] == 0) s = min(s,w[i]);
            else t = min(t,w[i]);
        }
        cout << s+t << endl;
    }

    return 0;

}


Measured memory_bytes: 3216