akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let x: usize = read();
    let y: usize = read();

    for i in 0..x + 1 {
        if y == i * 2 + (x - i) * 4 {
            println!("Yes");
            return;
        }
    }
    println!("No");
}


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

int main(){
  int N;
  cin>>N;
  vector<long long> a(N),sum(N+1,0);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
    sum.at(i+1)+=a.at(i)+sum.at(i);
  }
  long long ans=sum.at(N)-2*sum.at(1);
  if(ans<0){
    ans=-ans;
  }
  for(int i=1;i<N;i++){
    long long x=sum.at(N)-2*sum.at(i);
    if(x<0){
      x=-x;
    }
    ans=min(ans,x);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3328
#include<stdio.h>

/*構造体の定義*/
typedef struct {
	char suit;
	int value;
} Card ;


void BubbleSort(Card A[], int N) {
	int i, j;
	Card temp;

	for (i = 0; i < N; i++) {
		for (j = N - 1; j >= i + 1; j--) {
			if (A[j].value < A[j - 1].value) {
				temp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = temp;
			}
		}
	}
}


void SelectionSort(Card A[], int N) {
	int i, j;
	int minj;
	Card temp;

	for (i = 0; i < N; i++) {
		minj = i;
		for (j = i; j < N; j++) {
			if (A[j].value < A[minj].value) {
				minj = j;
			}
		}
		temp = A[i];
		A[i] = A[minj];
		A[minj] = temp;
	}
}



int main()
{
	int N;
	int i,j;
	
	scanf("%d\n", &N);

	Card BC[36];
	Card SC[36];

    
	for (i = 0; i < N; i++) {
		Card c;
		scanf("%c", &c.suit);
		scanf("%d ", &c.value);
		BC[i] = c;
		SC[i] = c;
	}
	
	/*
	for (i = 0; i < N; i++) {
		scanf("%c", &BC[i].suit);
		scanf("%d", &BC[i].value);
	}

	for (i = 0; i < N; i++) {
		SC[i] = BC[i];
	}
	*/
    
    BubbleSort(BC,N);
    SelectionSort(SC,N);
	
	/* Output */
	for (i = 0; i < N - 1; i++) {
		printf("%c%d ", BC[i].suit, BC[i].value);
	}
	printf("%c%d\n", BC[N - 1].suit, BC[N - 1].value);
	puts("Stable");

	for (i = 0; i < N - 1; i++) {
		printf("%c%d ", SC[i].suit, SC[i].value);
	}
	printf("%c%d\n", SC[N - 1].suit, SC[N - 1].value);

	for (i = 0; i < N; i++) {
		if (BC[i].suit != SC[i].suit) {
			puts("Not stable");
			return 0;
		}
	}
	puts("Stable");

	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

typedef unsigned int uint;
int in() {
    int x = 0, c;
    for (; (uint)((c = getchar()) - '0') >= 10; ) { if (c == '-') return -in(); if (!~c) throw ~0; }
    do { x = (x << 3) + (x << 1) + (c - '0'); } while ((uint)((c = getchar()) - '0') < 10);
    return x;
}


struct P{
	int x,y;
	P(int x,int y) : x(x) , y(y) {}
	P(){}
};
vector<int> v[20010] = {};
vector<P> p;
int ind[20010] = {};
int cmp(const P &a,const P &b){
	return a.y < b.y;
}
long long closestPair() {
	long long dist = 10e10;
	for(int i = 0 ; i < 20010 ; i++){
		v[i].push_back(-1000000);
		v[i].push_back(1000000);
		sort(v[i].begin(),v[i].end());
	}
	sort(p.begin(),p.end(),cmp);
	for(int i = 0 ; i < 20010 ; i++) ind[i] = 1;
	
	for(int i = 0 ; i < p.size() ; i++){
		int x = p[i].x, y = p[i].y;
		for(int X = x ; X <= 20000 ; X++){
			if( (long long)(x-X)*(x-X) > dist ){
				break;
			}
			while(v[X][ind[X]]<y)ind[X]++;
			int idx = ind[X];
			long long d1 = (long long)(v[X][idx]-y)*(v[X][idx]-y)+(long long)(x-X)*(x-X);
			long long d2 = (long long)(v[X][idx-1]-y)*(v[X][idx-1]-y)+(long long)(x-X)*(x-X);
			if(d1)dist = min(dist,d1);
			if(d2)dist = min(dist,d2);
		}
	}
	return dist;
}


int main(){
	int n = in();
	for(int i = 0 ; i < n ; i++){
		int X = in();
		int Y = in();
		v[X+10000].push_back(Y+10000);
		p.push_back(P(X+10000,Y+10000));
	}
	printf("%lld\n",closestPair());
}

Measured memory_bytes: 9544
<?php
fscanf(STDIN, "%d", $n);

$string = array();
for($i = 0; $i < $n; $i++) {
    $l = trim(fgets(STDIN));
    $string[$i] = $l;
}

$ans;

for($char = 'a'; $char <= 'z'; $char++) {
    $small = 10000;
    for($i = 0; $i < $n; $i++) {
        $count = 0;
        for($j = 0; $j < strlen($string[$i]); $j++) {
            if($string[$i][$j] == $char) {
                $count++;
            }
        }
        $small = min($small, $count);
    }
    for($i = 0; $i < $small; $i++) {
        $ans .= $char;
    }
}

echo $ans . "\n";


Measured memory_bytes: 3828
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;

int n,m,ans;
int f[310][310][310];

struct node{
	int l,x;
};
vector<node>e[310];

void read(int &x)
{
    x=0;int f=1;char s=getchar();
    while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();}
    while(s>='0'&&s<='9') {x=x*10+s-'0';s=getchar();}
    x*=f;
}

bool check(int i,int j,int k)
{
	int r=max(i,max(j,k)),l,x,cnt=0;
	for(int u=0;u<e[r].size();u++)
	{
		l=e[r][u].l;
		x=e[r][u].x;
		cnt=(i>=l)+(j>=l)+(k>=l);
		if(cnt!=x) return 0;
	}
	return 1;
}

int main()
{
    read(n);read(m);
    int l,r,x;
    for(int i=1;i<=m;i++)
    {
    	read(l);read(r);read(x);
    	e[r].push_back((node){l,x});
    }
    f[0][0][0]=1;
    for(int i=0;i<=n;++i)
    	for(int j=0;j<=n;++j)
    		for(int k=0;k<=n;++k)
    		if(f[i][j][k])
    		{
    			if((i&&j&&i==j)||(i&&k&&i==k)||(j&&k&&j==k)) continue;
    			if(!check(i,j,k)) continue;
    			r=max(i,max(j,k));
    			f[r+1][j][k]=(f[r+1][j][k]+f[i][j][k])%MOD;
    			f[i][r+1][k]=(f[i][r+1][k]+f[i][j][k])%MOD;
    			f[i][j][r+1]=(f[i][j][r+1]+f[i][j][k])%MOD;
    			if(r==n) ans=(ans+f[i][j][k])%MOD;
    		}
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 114944
#include<iostream>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
string a,b,e,f;
long long c,d;
double g,h;
int main()
{
  cin>>a>>b;
  e=a+b;f=b+a;
  for(int i=0;i<e.size();i++)c=c*10+(e[i]-48);
  for(int i=0;i<f.size();i++)d=d*10+(f[i]-48);
  for(int i=1;i<=c;i++)if(i*i==c){cout<<"Yes";return 0;}
  for(int i=1;i<=d;i++)if(i*i==d){cout<<"Yes";return 0;}
  cout<<"No";
  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<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX/2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ 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); }




void update(vector<int> & Segtree, int k, int a,int N)
{
  k += N -1;
  Segtree[k] = a;
  while(k > 0)
  {
    k = (k-1)/2;
    Segtree[k] = min(Segtree[2*k+1],Segtree[2*k + 2]);
  }
}

int query(vector<int> & Segtree,int a, int b, int k, int l,int r)
{
  // DEBUG(k);
  if(r <= a || b <= l) return 2147483647;
  if(a <= l && r <= b) return Segtree[k];
  else
  {
    int vl = query(Segtree,a,b,k*2+1,l,(r+l)/2);
    int vr = query(Segtree,a,b,k*2+2,(l+r)/2,r);
    return min (vr,vl);
  }

  

}

void solve(void)
{
  string str;
  cin>>str;
  int index_A , index_Z;
  for (int i = 0; i < str.size(); i++)
  {
    if(str[i] == 'A')
    {
      index_A = i;
      break;
    }
  }
  for (int i = str.size() - 1; i >= 0; i--)
  {
    if(str[i] == 'Z')
    {
      index_Z = i;
      break;    }
  }
  // DEBUG(index_Z);
  cout<<index_Z - index_A + 1<<endl;
  
  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: 720
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

int main() {
  uint32_t N;
  int32_t K, Q;
  cin >> N >> K >> Q;
  vector<uint32_t> A(Q);
  ArrayInput(A);
  vector<int32_t> B(N);
  for (uint32_t i = 0; i < N; ++i) B[i] = 0;
  for (uint32_t i = 0; i < Q; ++i) ++B[A[i] - 1];
  vector<string> res(N);

  for (uint32_t i = 0; i < N; ++i) {
    if (K - (Q - B[i]) > 0)
      res[i] = "Yes";
    else
      res[i] = "No";
  }
  for (uint32_t i = 0; i < N; ++i) {
    cout << res[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 6912
package main

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

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

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

func main() {
	S := getString()
	N := len(S)

	for i := 0; i < N/2; i++ {
		if S[i] != S[N - i - 1] {
			fmt.Println("No")
			return
		}
	}

	S2 := S[0:(N-1)/2]

	for i := 0; i < len(S2)/2; i++ {
		if S2[i] != S2[len(S2) - i - 1] {
			fmt.Println("No")
			return
		}
	}

	S3 := S[(N+3)/2-1:N]

	for i := 0; i < len(S3)/2; i++ {
		if S3[i] != S3[len(S3) - i - 1] {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}

type Graph struct {
	n     int
	edges [][]int
}

func NewGraph(n int) *Graph {
	g := &Graph{
		n:     n,
		edges: make([][]int, n),
	}
	return g
}

func (g *Graph) AddEdge(u, v int) {
	g.edges[v] = append(g.edges[v], u)
	g.edges[u] = append(g.edges[u], v)
}

func dfs(c int, edges [][]int, visited map[int]struct{}) {
	visited[c] = struct{}{}

	for _, v := range edges[c] {
		_, flag := visited[v]
		if flag {
			continue
		}
		dfs(v, edges, visited)
	}
}

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

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

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

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

func powMod(n, p int) int {
	if p == 0 {
		return 1
	} else if p%2 == 0 {
		t := powMod(n, p/2)
		return calcMod(t * t)
	} else {
		return n * powMod(n, p-1)
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray)-1])
}

func calcMod(x int) int {
	return x % mod
}

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


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
	int n;
	cin >> n ;

	cout <<"ABC"<<n<< endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int n,m;
  scanf("%d %d",&n,&m);
  int a[m];
  for(int i=0;i<m;i++){
    scanf("%d",&a[i]);
    n=n-a[i];
  }
  if(n<0)
    n=-1;
  printf("%d",n);
  return 0;
}

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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	int n,k;
	cin>>n>>k;
	double ans=0.0;
	for(int i=1;i<=n;i++){
		double p=(double)1/n;
		int sum=i;
		while(sum<k){
			sum*=2;
			p=p*(0.500);
			//cout<<p<<endl;
		}
		//cout<<ans<<' '<<p<<endl;	
		ans+=p;
	}
	cout<<ps(ans,20)<<endl;

	return 0;
}

Measured memory_bytes: 3728
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
//vector<vector<ll>> piyo(tate,vector<ll> (yoko));

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 100000001
#define ll long long
#define ln cout<<endl;
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int dp[120][1050];
bool my_compare(pair<ll, string> a, pair<ll , string> b) {
    // 基本はfirstで比較
    if(a.first != b.first){
         //return a.first < b.first; // 昇順
        return a.first > b.first; // 降順
    }

    // それ以外はsecondで比較
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        // どちらも同じ
        return true;
    }
}

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    //double mini=INF;
    int maxi=0,f=0,sum=0,mini=INF;
    string str,str1,str2;
    int i;
    int n;
    int a,b,d,c;
    int e,weight;
    vector<pair<ll,string>> p;
    cin>>n;
    vector<string> stra(n);
    rep(i,n){
        cin>>stra[i];
    }
    ll cnt=0;
    ll j=0;
    sort(stra.begin(),stra.end());
    rep(i,n-1){
        if(stra[i]==stra[i+1]){
            cnt++;
        }else{
            p.emplace_back(cnt,stra[i]);
            j++;
            cnt=0;
        }
    }
    p.emplace_back(cnt,stra[n-1]);
    sort(p.begin(),p.end(),my_compare);
    ll num=p[0].first;
    rep(i,n){
        if(num==p[i].first) cout<<p[i].second<<endl;
        else return 0;
    }
    return 0;
}


Measured memory_bytes: 17520
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <ctime>

#define inf 0x3f3f3f3f
#define Inf 0x3FFFFFFFFFFFFFFFLL
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, n) for (int i = 1; i <= (n); ++i)
#define clr(x, a) memset(x, (a), sizeof x)
using namespace std;
typedef long long ll;
int const N = 100100;
int a[N];
vector<pair<int, int> > v;
int main() {
  int n; scanf("%d", &n);
  rep(i, n) scanf("%d", &a[i]); 
  sort(a, a + n);
  if (n == 2) {
    if (a[0] - a[1] > a[1] - a[0]) {
      printf("%d\n%d %d\n", a[0] - a[1], a[0], a[1]);
    } else {
      printf("%d\n%d %d\n", a[1] - a[0], a[1], a[0]);
    }
  } else {
    int s = 0;
    if (a[1] >= 0) {
      s = a[0] - a[n - 1];
      v.push_back(make_pair(a[0], a[n - 1]));
    } else {
      s = a[n - 1] - a[0];
      v.push_back(make_pair(a[n - 1], a[0]));
    }
    for (int i = 1; i < n - 2; ++i) {
      if (a[i + 1] < 0) {
        if (s - a[i] >= 0) {
          v.push_back(make_pair(s, a[i]));
          s -= a[i];
        } else {
          v.push_back(make_pair(a[i], s));
          s = a[i] - s;
        }
      } else {
        if (s - a[i] < 0) {
          v.push_back(make_pair(s, a[i]));
          s -= a[i];
        } else {
          v.push_back(make_pair(a[i], s));
          s = a[i] - s;
        }
      }
    }
    if (a[n - 2] < 0) {
      v.push_back(make_pair(s, a[n - 2]));
      s -= a[n - 2];
    } else {
      v.push_back(make_pair(a[n - 2], s));
      s = a[n - 2] - s;
    }
    printf("%d\n", s);
    rep(i, v.size()) printf("%d %d\n", v[i].first, v[i].second);
  }
  return 0;
}



Measured memory_bytes: 3188
def gcd(a, b):
    while b != 0 :
        t = a % b
        a = b
        b = t
    return a
        
sum = 0
N=int(input(""))
for a in range(1, N + 1):
    for b in range(1, N + 1):
        x = gcd(a, b)
        if x == 1:
            sum = sum + N
        elif x == 2:
            sum = sum + (N + 1) // 2 + N // 2 * 2
        elif x == 3:
            sum = sum + N // 3 * 3 + (N - N // 3)
        else:
            for c in range(1, N + 1):
                sum = sum + gcd(x, c)
print(sum)

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

using namespace std;

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

    int n;
    cin >> n;

    int ans[101010] = {};
    for (int i = 0; i < 101010; i++) ans[i] = 1e9;
    for (int i = 1; i < n; i++) {
        int a;
        cin >> a;
        ans[i - 1] = min(ans[i - 1], a);
        ans[i] = min(ans[i], a);
    }
    int ret = 0;
    for (int i = 0; i < n; i++) ret += ans[i];
    cout << ret << endl;
}

Measured memory_bytes: 640
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	long long x,y;
	cin>>x>>y;
	if(x>=y){
		if(x%y){
			cout<<x<<endl;
		}else{
			cout<<-1<<endl;
		}
	}else{
		cout<<x<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }

const ll MAXn=6e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int n, zkw[MAXn*2],k;
void modify(int pos, int value) {
    pos+=MAXn;
	for (zkw[pos]=max(zkw[pos],value); pos>1; pos>>=1) {
		zkw[pos>>1] = max(zkw[pos],zkw[pos^1]);
	}
}
int query(int l, int r) {
	int ret = 0;
	for (l+=MAXn, r+=MAXn; l<r; l>>=1, r>>=1) {
		if (l&1) ret = max(ret,zkw[l++]);
		if (r&1) ret = max(ret,zkw[--r]);
	}
	return ret;
}
int main(){
    IOS();
    cin >> n >> k;
    int ans = 1;
    for (int i=1;i<=n;++i) {
        int x;
        cin >> x;
        int l = max(0,x-k), r = x+k;
        int tmp = query(l,r+1);
        debug(tmp);
        ans = max(ans,tmp+1);
        modify(x,tmp+1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 6044
# coding: utf-8
# Here your code !
 
def func():
    result=""
    while(True):
        try:
            line = input().rstrip()
            numbers = line.split(" ")
            for i,item in enumerate(numbers):
                numbers[i]=int(item)
        except:
            print("input error")
            return -1
         
        if( (numbers[0] > 0) and (numbers[1] > 0) ):
            for i in range(numbers[0]):
                result += "#"*numbers[1]+"\n"
            result += "\n"
        elif( (numbers[0] == 0) and (numbers[1] == 0) ):
            break
        else:
            print("input error")
            return -1
             
    print(result[:-1])
 
func()

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

int main() {
  char a;
    cin >> a;
    if(a == 'a' ||a == 'b' ||a == 'c' ||a == 'd' ||a == 'e' ||a == 'f' ||a == 'g' ||a == 'h' ||a == 'i' ||a == 'j' ||a == 'k' ||a == 'l' ||a == 'm' ||a == 'n' ||a == 'o' ||a == 'p' ||a == 'q' ||a == 'r' ||a == 's' ||a == 't' ||a == 'u' ||a == 'v' ||a == 'w' ||a == 'x' ||a == 'y' ||a == 'z'){
     cout << 'a';
    }
    else {
    cout << 'A';
    }
    
    
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()
 
 
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if(A + B >= C) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

int main() {
	std::string str1;
	std::string str2;
	int operations = 0;
	std::cin >> str1 >> str2;
	for (int i = 0; i < str1.size(); i++) {
		if (str1.at(i) != str2.at(i)) {
			operations++;
		}
	}
	std::cout << operations;
}

Measured memory_bytes: 3920
using System;
using System.Text;
using static ConsoleReader;

class Program
{
    static void Main(string[] args)
    {
        var n = Read<int>();
        var d = Read<long>();
        var d2 = d * d;
        var res = 0;

        n.Times(_ =>
        {
            var x = Read<long>();
            var y = Read<long>();
            if (x * x + y * y <= d2) res++;
        });


        Console.WriteLine(res);
    }
}

public static class IntExtentions
{
    public static void Times(this int n, Action<int> action)
    {
        for (var i = 0; i < n; i++)
        {
            action(i);
        }
    }

    public static void Times(this (int n, int m) dimensions, Action<int, int> action)
    {
        var (n, m) = dimensions;
        n.Times(i => m.Times(j => action(i, j)));
    }
}

public static class ConsoleReader
{
    public static T Read<T>()
        where T : IConvertible
    {
        var inputBuffer = new StringBuilder();
        int currChar;

        while ((currChar = Console.Read()) != -1)
        {
            if (!char.IsWhiteSpace((char)currChar))
            {
                inputBuffer.Append((char)currChar);
            }
            else if (inputBuffer.Length != 0)
            {
                break;
            }
        }

        return (T)Convert.ChangeType(inputBuffer.ToString(), typeof(T));
    }

    public static T[] ReadArray<T>(int count)
        where T : IConvertible
    {
        if (count < 0)
        {
            throw new ArgumentOutOfRangeException(nameof(count), $"'{nameof(count)}' must be >= 0");
        }

        var result = new T[count];

        for (var i = 0; i < count; i++)
        {
            result[i] = Read<T>();
        }

        return result;
    }
}

Measured memory_bytes: 40660
import sys
sys.setrecursionlimit(10 ** 7)

debug = True
#debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)


# n = int(input())
# a, b = map(int, input().split())
# int_list = list(map(int, input().split()))
# l = list(input().split())

def solve():
    x, a = map(int, input().split())\

    if x < a:
        print("0")
    else:
        print("10")

solve()

Measured memory_bytes: 2940
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>

//定数
#define MOD 1000000007
const double PI=3.14159265358979323846;
//マクロ
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

#define vsort(v) sort((v).begin, (v).end);


typedef unsigned long long int ull;
typedef long long lint;

using namespace std;


int main(){
    double a, b, x;
    double calc, high;
    
    //入力
    cin >> a >> b >> x;

    if(x>a*a*b/2){
        calc = a*a*b - x;
        high = calc*2/(a*a);
        cout << setprecision(9) << atan(high/a) * 180 / PI << endl;
    } else {
        calc = x;
        high = calc*2/(a*b);
        cout << setprecision(9) << atan(b/high) * 180 / PI << endl;
    }

    return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){

  while(x->left!=NIL){
    x=x->left;
  }

  return x;
  
}

Node treeMaximum(Node x){

  while(x->right!=NIL){
    x=x->right;
  }

  return x;
 
}

Node treeSearch(Node u, int k){

  while(u!=NIL && k!=u->key){

    if(k < u->key){
      u=u->left;
    }else{
      u=u->right;
    }
    
  }

  return u;
  
}

Node treeSuccessor(Node x){

  Node y;

  if(x->right!=NIL) return treeMinimum(x->right);

  y=x->parent;

  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
		      
  return y;
  
}

void transplant(Node u,Node v){

  if(u->parent==NIL) root=v;
  else if(u==u->parent->left) u->parent->left=v;
  else u->parent->right=v;

  if(v!=NIL) v->parent=u->parent;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left==NIL){
    transplant(z,z->right);
  }else if(z->right==NIL){
    transplant(z,z->left);
  }else{
    y=treeMinimum(z->right);
    if(y->parent!=z){
      transplant(y,y->right);
      y->right=z->left;
      y->left->parent=y;
    }
  }

}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x; // 親を設定

    if (z->key < x->key){
      x = x->left; // 左の子へ移動
    }else{ 
      x = x->right; // 右の子へ移動
    }
    
  }//while
  
  z->parent = y;

  if(y == NIL){ // T が空の場合
    root = z;
  }else if (z->key < y->key){
    y->left = z; // z を y の左の子にする
  } else {
    y->right = z; // z を y の右の子にする
  }

}

void inorder(Node u){
  
  if(u!=NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
  
}

void preorder(Node u){

  if(u!=NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
  
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20488
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt(); //人数
		int a = stdIn.nextInt(); //電車を使うときの一人当たりの値段
		int b = stdIn.nextInt(); //タクシーを使ったときの値段
		int min = (a*n) < b ? a*n : b;
		System.out.println(min);
	}

}


Measured memory_bytes: 23252
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//



int main() {

    int N; cin >> N;
    int ac = 0; int wa = 0; int tle = 0; int re = 0;
    rep(i,N) {
        string s; cin >> s;
        if (s == "AC") ++ac;
        if (s == "WA") ++wa;
        if (s == "TLE") ++tle;
        if (s == "RE") ++re;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;





    return 0;
}









Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
using namespace std;

int main()
{
	int T, P, R;
	while (cin >> T >> P >> R, T || P || R) {
		vector< vector<int> > pena(T + 1, vector<int>(P + 1, 0));
		vector< tuple<int, int, int> > team(T + 1);
		for (int i = 1; i <= T; i++)
			get<2>(team[i]) = i;
		int tID, pID, time;
		string message;
		for (int i = 0; i < R; i++) {
			cin >> tID >> pID >> time >> message;
			if (message == "CORRECT") {
				get<1>(team[tID]) += time + pena[tID][pID] * 1200;
				get<0>(team[tID])--;
			}
			else
				pena[tID][pID]++;
		}
		sort(team.begin() + 1, team.end());
		for (int i = 1; i <= T; i++) {
			cout << get<2>(team[i]) << " " << -get<0>(team[i]) << " " << get<1>(team[i]) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3228
#include <stdio.h>

int main(void){
  int n,i,ans,cnt,tmp;
  scanf("%d",&n);
  ans = n;
  
  for(i=0;i<=n;i++){
    cnt=0;
    tmp=i;
    while(tmp){
      cnt+=tmp%6;
      tmp/=6;
    }
    tmp=n-i;
    while(tmp){
      cnt+=tmp%9;
      tmp/=9;
    }
    if(ans>cnt) ans=cnt;
  }

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


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

import numpy as np
import scipy

C = [[0 for i in range(3)] for j in range(3)]
for i in range(3):
    C[i] = list(map(int, input().split()))
#print(C)

for i in range(3):
    for j in range(3):
        if C[0][0] - C[0][j] != C[i][0] - C[i][j]:
            print("No")
            exit()
        if C[0][0] - C[i][0] != C[0][j] - C[i][j]:
            print("No")
            exit()
print("Yes")


Measured memory_bytes: 12500
#include<bits/stdc++.h>
using namespace std;
long long h,w,n,a[100005],b[100005],ans[10],cnt,l,r,dx[]={1,1,1,0,0,0,-1,-1,-1},dy[]={1,0,-1,1,0,-1,1,0,-1};
map<pair<long long,long long>,long long> mp;
set<pair<long long,long long> > s;
set<pair<long long,long long> > :: iterator it;
int main()
{
	scanf("%lld%lld%lld",&h,&w,&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&a[i],&b[i]);
		mp[make_pair(a[i],b[i])]=1;
		for(int j=0;j<9;j++)
		{
			if(a[i]+dx[j]>1&&a[i]+dx[j]<h&&b[i]+dy[j]>1&&b[i]+dy[j]<w)
			{
				s.insert(make_pair(a[i]+dx[j],b[i]+dy[j]));
			}
		}
	}
	for(it=s.begin();it!=s.end();it++)
	{
		l=(*it).first;
		r=(*it).second;
		cnt=0;
		for(int j=0;j<9;j++)
		{
			if(mp[make_pair(l+dx[j],r+dy[j])]==1)
			{
				++cnt;
			}
		}
		++ans[cnt];
	}
	ans[0]=(h-2)*(w-2)-s.size();
	for(int i=0;i<=9;i++)
	{
		printf("%lld\n",ans[i]);
	}
}

Measured memory_bytes: 217872
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
nums = []
for i in range(N):
    t, d = map(int, input().split())
    nums.append((d, t))
nums.sort(reverse=True)
se = set()
a1 = []
a2 = []
rest = []
for i, n in enumerate(nums):
    if i < K:
        if not n[1] in se:
            se.add(n[1])
            a1.append(n)
        else:
            a2.append(n)
    else:
        rest.append(n)
points = 0
for (d, t) in a1: points += d
for (d, t) in a2: points += d
ans = points + pow(len(se), 2)
a2.sort()
idx2 = 0
for i, (d, t) in enumerate(rest):
    if t in se: continue
    if len(a2) <= idx2: break
    points -= a2[idx2][0]
    idx2 += 1
    points += d
    se.add(t)
    ans = max(ans, points+pow(len(se), 2))
print(ans)


Measured memory_bytes: 19748
// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
    int n;
   // int kazu[1005];
    int ans = 0;
    cin >> n;
   // int ruiseki[1005];
  //  vector<int>a;
    //for (int i = 0; i < n; i++) {
    //    int l;
    //    cin >> l;
    //    a.push_back(l);
    //    
    //}
   // sort(a.begin(), a.end());

    //for (int i = 0; i < a.size() - 2; i++) {
    //    for (int j = i+1; j < a.size() - 1; j++) {
    //        for (int k = j+1; k < a.size(); k++) {
    //            if (a[i] + a[j] > a[k]) {
    //                ans++;
    //            }
    //            else {
    //                break;
    //            }
    //        }
    //    }
    //}
   
    vector<int>L(n);
    for (int i = 0; i < n; i++)cin >> L[i];
    sort(L.begin(), L.end());
    for (int b = 0; b < n; b++) {
        for (int a = 0; a < b; a++) {
            int ab = L[a] + L[b];
            int r = lower_bound(L.begin(), L.end(), ab) - L.begin();
            int l = b + 1;
            ans += max(0, r - l);
        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(10**9)


def rec(edges, nodes, cp, cdistance, visited):
    if not visited[cp]:
        visited[cp] = True
        nodes[cp] = (cdistance % 2 == 0)
        if edges[cp]:
            for v, w in edges[cp]:
                rec(edges, nodes, v, cdistance + w, visited)


def main():
    N = int(input())
    nodes = [False] * N
    visited = [False] * N
    edges = [[] for _ in range(N)]

    for _ in range(N - 1):
        u, v, w = map(int, input().split())
        edges[u - 1].append((v - 1, w))
        edges[v - 1].append((u - 1, w))

    rec(edges, nodes, 0, 0, visited)

    for n in nodes:
        print(0 if n else 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 168864
n = int(input())
s = input()
q = int(input())

#seg_tree
def init(n, s):
    num = len(str(bin(n-1))) -2
    seg = [0] * (2**(num+1))
    seg_num = 2**num

    for i in range(n):
        tmp = ord(s[i]) - 97
        seg[i + seg_num] = 1 << tmp

    for i in range(seg_num-1, 0, -1):
        seg[i] = seg[i*2] | seg[i*2+1]

    return seg, seg_num

def calc_sum(head, tail):
    head += seg_num
    tail += seg_num
    l = []
    while(head <= tail):
        if(head == tail):
            l.append(head)
            break

        if(head % 2 == 1):
            l.append(head)
            head += 1
        head = head //2

        if(tail % 2 == 0):
            l.append(tail)
            tail -= 1
        tail = tail //2

    ans = 0
    for i in l:
        ans = ans | seg[i]
    ans = str(bin(ans)).count('1')
    return(ans)

def update(i,s):
    i += seg_num
    tmp = ord(s) - 97
    seg[i] = 1 << tmp
    while(i > 1):
        i = i//2
        seg[i] = seg[2*i] | seg[2*i+1]

seg,seg_num = init(n,s)

for i in range(q):
    q1,q2,q3 = input().split()
    if(q1 =='1'):
        update(int(q2)-1, q3)
    else:
        q2,q3 = int(q2),int(q3)
        print(calc_sum(q2-1, q3-1))

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

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
ll tmp[100001];
void pakuri_sort(int N, int A[]) {
	const int b = 8;
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		for (int i = (1 << b) - 2; i >= 0; i--) kazu[i] += kazu[i + 1];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		for (int i = (1 << b) - 2; i >= 0; i--) kazu2[i] += kazu2[i + 1];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N = getint(), M = getint(), V = getint(), P = getint();
	int A[100001];
	rep(i, N) A[i] = getint();
	pakuri_sort(N, A);
	tmp[P - 1] = 0;
	for (int i = P - 1; i < N; i++) tmp[i + 1] = tmp[i] + A[i];

	int L = P - 1, R = N;
	while (L + 1 < R) {
		int m = (L + R) / 2;
		int a = A[m] + M;
		if (P > V) {
			if (a >= A[P - 1]) L = m;
			else R = m;
		}
		else if (a < A[P - 1]) R = m;
		else {
			ll kari = ll(N - m - 1 - V + P) * M;
			kari -= tmp[m];
			kari += ll(m - P + 1) * a;

			if (0 <= kari) L = m;
			else R = m;
		}
	}

	printf("%d", R);


	Would you please return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>

int main()

{
	int a, b, c;

	scanf("%d %d %d", &a, &b, &c);
	
	if (a < b)

	{
		if (b < c)
		{
			printf("Yes\n");
		
		}
		else
		{
			printf("No\n");
		}

	}
	else
	{
		printf("No\n");

	}

	return(0);


}

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

const long long INF = 20000000001;

void Main() {
  int a, b, q;
  cin >> a >> b >> q;
  vector<long long> s, t;
  for (int i = 0; i < a; i++) {
    long long tmp;
    cin >> tmp;
    s.push_back(tmp);
  }
  for (int i = 0; i < b; i++) {
    long long tmp;
    cin >> tmp;
    t.push_back(tmp);
  }
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());

  for (int i = 0; i < q; i++) {
    long long x;
    cin >> x;
    int sl = -1, sr = s.size();
    while (sr - sl > 1) {
      int c = (sl + sr) / 2;
      if (x <= s[c]) sr = c;
      else sl = c;
    }

    int tl = -1, tr = t.size();
    while (tr - tl > 1) {
      int c = (tl + tr) / 2;
      if (x <= t[c]) tr = c;
      else tl = c;
    }

    long long ans = INF;
    if (sr < s.size() && tr < t.size()) {
      ans = min(ans, abs(s[sr] - x) + abs(t[tr] - s[sr]));
    }
    if (sr < s.size() && tr > 0) {
      ans = min(ans, abs(s[sr] - x) + abs(t[tr - 1] - s[sr]));
    }
    if (sr > 0 && tr < t.size()) {
      ans = min(ans, abs(s[sr - 1] - x) + abs(t[tr] - s[sr - 1]));
    }
    if (sr > 0 && tr > 0) {
      ans = min(ans, abs(s[sr - 1] - x) + abs(t[tr - 1] - s[sr - 1]));
    }
    if (sr < s.size() && tr < t.size()) {
      ans = min(ans, abs(t[tr] - x) + abs(s[sr] - t[tr]));
    }
    if (tr < t.size() && sr > 0) {
      ans = min(ans, abs(t[tr] - x) + abs(s[sr - 1] - t[tr]));
    }
    if (tr > 0 && sr < s.size()) {
      ans = min(ans, abs(t[tr - 1] - x) + abs(s[sr] - t[tr - 1]));
    }
    if (tr > 0 && sr > 0) {
      ans = min(ans, abs(t[tr - 1] - x) + abs(s[sr - 1] - t[tr - 1]));
    }
    cout << ans << endl;
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


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

int main(){
    int r;
    cin >> r;
    if(r<1200){
        cout << "ABC";
    }else if(1200<=r&&r<2800){
        cout << "ARC";
    }else{
        cout << "AGC";
    }
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=(int)l;i<=(int)r;++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 3.14159265358979323846

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> oset;

// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

const int mod1 = 998244353; 
const int mod2 = 1e9 + 7;
const int inf = 9e18;
const int N = 1005;

int n;
set<string> st;

void solve(){
    cin>>n;
    while(n--){
        string s;
        cin>>s;
        st.insert(s);
    }
    cout<<sz(st);
}

signed main(){
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}

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

int main(){
  string moji;
  int k;
  cin >> k >> moji;
  
  if (moji.size() <= k) {
    cout << moji << endl;
  }
  else {
    for (int i = 0; i < k ; i++) {
      cout << moji.at(i);
    }
    cout << "..." << endl;
  }
  
  
}

Measured memory_bytes: 3632
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


int main() {

	int n, k;
	cin >> n >> k;

	VI v(n);
	REP(i, n) {
		cin >> v[i];
	}
	SORT(v);
	int m = pow(10, 9);
	int tmp;
	FOR(i, 0, n - k) {
		tmp = v[i + k - 1] - v[i];
		m = min(m, tmp);
	}
	ANS(m);
	return 0;
}


Measured memory_bytes: 640
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------        
    a,b,c = map(int,input().split())
    print("bust" if a+b+c >= 22 else "win")
if __name__ == "__main__":
    main() #endline===============================================
    

Measured memory_bytes: 5688
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main() {

	int N, M, C;
	cin >> N >> M >> C;

	int b[20] = { 0 };
	int ans = 0;

	rep(i, 0, M) {
		cin >> b[i];
	}

	rep(i, 0, N) {
		int sum = 0;
		rep(j, 0, M) {
			int a;
			cin >> a;
			sum += a * b[j];
		}
		if (sum + C > 0)ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	var i int
	var ret int
	var aSeq int
	for i < len(s)-2 {
		if s[i:i+3] == "ABC" {
			ret += aSeq + 1
			s = "A" + s[i+3:]
			i = 0
		} else {
			if s[i] == 'A' {
				aSeq++
			} else {
				aSeq = 0
			}
			i++
		}
	}
	fmt.Println(ret)
}


Measured memory_bytes: 9728
mod=10**9+7
n,m=list(map(int,input().split()))
a=[int(input()) for _ in range(m)]
fib=[1,1]
c=0
if m>0 and a[0]==1:
    fib[1]=0
    c+=1
for i in range(2,n+1):
    if c<m and a[c]==i:
        fib.append(0)
        c+=1
    else:
        fib.append((fib[i-2]+fib[i-1])%mod)

print(fib[n])

Measured memory_bytes: 55640
mod = 10**9 + 7
n, a, b = map(int, input().split())

total = pow(2, n, mod)-1

def mod_comb(n,k,p):
    if n<0 or k<0 or n<k:
        return 0
    if n==0 or k==0:
        return 1
    a = 1
    b = 1
    for i in range(k):
        a = (a*((n-i)%p))%p
        b = (b*((i+1)%p))%p
    return (a*pow(b,p-2,p))%p

x = mod_comb(n, a, mod)
y = mod_comb(n, b, mod)
total = (total-x-y)%mod

print(total)

Measured memory_bytes: 3064