akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;


#ifdef zxc

#include <sys/resource.h>
#include "debug.h"
#include "profile.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define profile(X) LOG_DURATION(X)
#else
#define debug(...) 42
#define profile(...) 42
#endif

using ll = int64_t;
using ld = double;
const ld EPS = 1e-9;
//const ll MOD = 924844033;
const ld PI = 3.141592653589793;
const int maxn = 600001;
const int MOD = 1e9 + 7;
using cd = complex<double>;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

int a[301][301];

signed main() {
#ifdef zxc
    struct rlimit rl;
    const rlim_t kStackSize = 512L * 1024L * 1024L;
    assert(!getrlimit(RLIMIT_STACK, &rl));
    rl.rlim_cur = kStackSize;
    assert(!setrlimit(RLIMIT_STACK, &rl));
    freopen("../input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    //    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
    //            freopen("", "r", stdin);
    //        freopen("hack.out", "w", stdout);
#endif
    profile("all");
    mt19937 mt(234793824);
    auto solve = [&mt](int _) {
        int n;
        cin >> n;
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                cin >> a[i][j];
            }
        }
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                if (i == j) {
                    continue;
                }
                for (int e = 1; e <= n; ++e) {
                    if (e == i || e == j) {
                        continue;
                    }
                    if (a[i][e] + a[e][j] < a[i][j]) {
                        cout << -1;
                        return;
                    }
                }
                if (a[i][j] != a[j][i]) {
                    cout << -1;
                    return;
                }
            }
        }
        ll cock = 0;
        for (int i = 1; i <= n; ++i) {
            for (int j = i + 1; j <= n; ++j) {
                if (i == j) {
                    continue;
                }
                bool need = true;
                for (int e = 1; e <= n; ++e) {
                    if (e == i || e == j) {
                        continue;
                    }
                    if (a[i][j] >= a[i][e] + a[e][j]) {
                        need = false;
                    }
                }
                if (need) {
                    cock += a[i][j];
                }
            }
        }
        cout << cock;
    };


    fast_io();

    cout.precision(9);
    cout <<
         fixed;
    for (int i = 1; i <= 1; ++i)
        solve(1);


}


Measured memory_bytes: 3916
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <deque>
#include <bitset>
#include <climits>
#include <cstdio>
#include <list>
#include <iomanip>
using namespace std;

#define ll long long int
#define mp make_pair
#define pb push_back
#define fi first
#define si second
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define AS 200001
#define mod 1000000007
ll n, k;
ll x[1100001];
ll dp[1100001];
int ABS(double x) {return max(-x, x);}
int main() {

	fastIO
	cin >> n >> k;
	F(x, n);
	memset(dp, mod, sizeof dp);
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= k; j++) {
			if (i + j < n)
				dp[i + j] = min(dp[i + j], dp[i] + ABS(x[i] - x[i + j]));
		}
	}
	cout << dp[n - 1] << " ";
}

Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

bool in_graph(int hi, int wi, int h, int w){
  if(hi>=0 && wi>=0 && hi<h && wi<w) return true;
  else return false;

}

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

  int h,w;
  cin >> h >> w;
  string s[h];
  rep(i,h) cin >> s[i];
  queue<tuple<int, int, int> > qu;
  int used[h][w];
  rep(i,h){
    rep(j,w){
      used[i][j]=INT_MAX;
      if(s[i][j]=='#'){
	qu.push(mt(i,j, 0));
	//	used[i][j]=0;
      }
    }
  }
  int dx[4]={1,0,-1,0};
  int dy[4]={0,1,0,-1};
  while(!qu.empty()){
    tuple<int,int, int> p=qu.front();qu.pop();
    int hi=get<0>(p);
    int wi=get<1>(p);
    int	d=get<2>(p);
    if(d>=used[hi][wi]) continue;
    used[hi][wi]=d;
    rep(i,4){
      if(in_graph(hi+dy[i],wi+dx[i], h, w)){
	if(used[hi+dy[i]][wi+dx[i]]>d+1){
	  qu.push(mt(hi+dy[i],wi+dx[i],d+1));	  
	}
      }
    }
  }
  int ans=0;
  rep(i,h) rep(j,w) ans=max(ans,used[i][j]);
  cout << ans << endl;
  return 0;
    

}


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

using namespace std;

int CreateKaibun(int val) 
{
	int digit10 = (val % 100) / 10;
	int digit100 = (val % 1000) / 100;
	return val * 100 + digit10 * 10 + digit100;
}


int main()
{
	int A, B;
	cin >> A >> B;

	int AA = A / 100;
	int BB = B / 100;

	int cnt = 0;
	for (int i = AA; i <= BB; i++) {
		int kaibun = CreateKaibun(i);
		if (A <= kaibun && kaibun <= B)
			cnt++;
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
	string S;
  	cin>>S;
  
  	if(S=="ARC") cout<<"ABC"<<endl;
  	else cout<<"ARC"<<endl;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    int arr[4] = {0};
    for (int i = 0; i < n; i++) {
        string str;
        cin >> str;
        if (str == "AC") {
            arr[0]++;
        } else if (str == "WA") {
            arr[1]++;
        } else if (str == "TLE") {
            arr[2]++;
        } else if (str == "RE") {
            arr[3]++;
        }
    }
    cout << "AC x " << arr[0] << endl;
    cout << "WA x " << arr[1] << endl;
    cout << "TLE x " << arr[2] << endl;
    cout << "RE x " << arr[3] << endl;
    return 0;
}

Measured memory_bytes: 3628
// https://atcoder.jp/contests/abc135/tasks/abc135_a

#include <iostream>

void calHarmonyNumber(int A, int B);

int main(){
    int A,B;
    std::cin >> A >> B;

    calHarmonyNumber(A,B);
    return 0;
}

// ----------------------------------------------------------
// |A-K| = |B-K| となるような整数 K を求める関数
// 整数 K が存在すれば K を、存在しなければ "IMPOSSIBLE" を返す
// param:  (int)A, (int)B
// return: void
// ----------------------------------------------------------
void calHarmonyNumber(int A, int B){
    if((A+B)%2 == 0){
        std::cout << (A+B)/2 << std::endl;
    }else{
        std::cout << "IMPOSSIBLE" << std::endl;
    }
}

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

int chmin(long *x, long y) { if (*x > y) { *x = y; return 1; } return 0; }
const long INF = LONG_MAX >> 5;

int main() {
    const int MAX = 1e5;
    int N, K;
    int h[MAX + 10];
    long dp[MAX + 200];

    scanf("%d%d", &N, &K);
    for (int i = 0; i < N; i++) {
        scanf("%d", &h[i]);
    }
    dp[0] = 0;
    for (int i = 1; i < MAX + 200; i++) dp[i] = INF;

    for (int i = 0; i < N - 1; i++) {
        for (int j = 1; j <= K; j++) {
            chmin(&dp[i + j], dp[i] + labs(h[i] - h[i + j]));
        }
    }
    printf("%ld", dp[N - 1]);
    return 0;
}


Measured memory_bytes: 1280
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
#define endl "\n"
#define pi 3.14159265358979
using namespace std;
using ll = long long;
signed main() {
    int N; cin >> N;
    map<int, int> mp;
    for (int i = 0; i < N; i++) {
        int x; cin >> x;
        mp[x]++;
    }
    bool flag = false;
    if (mp.size() == 1) {
        auto iter = mp.begin();
        if (iter->first == 0) {
            flag = true;
        }
    }
    else if (mp.size() == 2) {
        if (N % 3 == 0) {
            auto iter = mp.begin();
            int num = iter->second;
            if (num == N / 3 && iter->first == 0) {
                flag = true;
            }
        }

    }
    else if (mp.size() == 3) {
        vi vec(3);
        if (N % 3 == 0) {
            auto iter = mp.begin();
            int cnt = 0;
            for (int i = 0; i < 3; i++) {
                int num = iter->second;
                vec[i] = iter->first;
                if (num  == N/3) {
                    cnt++;
                }
                iter++;
            }
            if (cnt == 3) {
                flag = true;
            }
        }
        
        int res = 0;
        res ^= vec[0];
        res ^= vec[1];
        res ^= vec[2];
        if (res != 0) {
            flag = false;
        }
    }

    if (flag) {
        pYes;
    }
    else {
        pNo;
    }
}

Measured memory_bytes: 7232
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
  string S;
  cin >> S;
  S[5] = ' ';
  S[13] = ' ';
  cout << S << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  long long a,b,n,x;
  double i;
  scanf("%lld%lld%lld",&a,&b,&n);
  if(b<=n){
    if(a%b==0)
      x=a-a/b;
    else
      x=a-a/b-1;
  }
  else{
    i=n;
    i=i/b;
    x=a*i;
  }
  printf("%lld\n",x);
  return 0;
}


Measured memory_bytes: 1696
#include <stdio.h>
#include <string.h>

#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];

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

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

int h1(int key) {return key%M;}
int h2(int key) {return 1+(key%(M-1));}

int find(char str[]) {
    long long key, i, h;
    key = getKey(str);
    for(i=0; ; ++i) {
        h = (h1(key)+i*h2(key))%M;
        if(strcmp(H[h], str) == 0) return 1;
        else if(strlen(H[h]) == 0) return 0;
    }
    return 0;
}

int insert(char str[]) {
    long long key, i, h;
    key = getKey(str);
    for(i=0; ; ++i) {
        h = (h1(key)+i*h2(key))%M;
        if(strcmp(H[h], str) == 0) return 1;
        else if(strlen(H[h]) == 0) {
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}

int main()
{
     

    int i, n, h;
    char str[L], com[9];
    for(i=0; i<M; ++i) H[i][0] = '\0';
    scanf("%d", &n);
    
    for(i=0; i<n; ++i) {
        scanf("%s %s", com, str);
        if(com[0] == 'i') insert(str);
        else {
            if(find(str)) printf("yes\n");
            else printf("no\n");
        }
    }

    return 0;
}


Measured memory_bytes: 16084
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(in) in.begin(), in.end()
#define FIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<ll, ll> pll;

ll mod = 1e9 + 7, nCr[2005][2005];

void build(){
    nCr[0][0] = 1;
    for(ll i = 1 ; i < 2005 ; i++){
        nCr[i][0] = 1;
        for(ll j = 1 ; j < i ; j++){
            nCr[i][j] = nCr[i-1][j] + nCr[i-1][j-1];
            nCr[i][j] %= mod;
        }
        nCr[i][i] = 1;
    }
}

int main(){
    FIO;
    ll n, k;
    cin >> n >> k;
    build();
    ll x = n - k;
    for(ll i = 1 ; i <= k ; i++){
        ll ans = nCr[x+1][i] * nCr[k-1][i-1];
        ans %= mod;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 30208
#include<math.h>

int main(void){
  int n;
  scanf("%d",&n);

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

  int ans = 10000000 , k = 0;
  for(int i = 1;i <= max;i ++){
    for(int j = 0;j < n;j ++){
      k += pow(a[j]-i,2);
    }
    if(ans > k){
      ans = k;
    }
    k = 0;
  }

  printf("%d\n",ans);

  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <iomanip>
using namespace std;
 
int main () {
	int n,i;
	double sum1=0.0,sum2=0.0;
	while(cin >> n && n!=0){
		sum1=0; sum2=0;
		int b[n];
		for(i=0;i<n;i++){
			cin >> b[i];
			sum1 += b[i];
		}
		for(i=0;i<n;i++){
		sum2 += (sum1/n-b[i])*(sum1/n-b[i]);
		}
		cout << setprecision(20) << sqrt(sum2/n) << endl;
	}
}
	

Measured memory_bytes: 1236
def counter(n):
  count = 0
  while(n%2 == 0):
    count += 1
    n = int(n/2)
  return count

N = int(input())
max = 0
ans = 1
for i in range(N):
  if(max < counter(i+1)):
    max = counter(i+1)
    ans = i+1
    
print(ans)
  
  


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <stdlib.h>
using namespace std;

#define INF 1e9
#define PI 3.141592653589793238
typedef long long ll;

int main() {
    string s;cin>>s;
    if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes"<<endl;
    else cout << "No"<<endl;




    return 0;
}

Measured memory_bytes: 3632
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Solve()
    {
        var n = sc.Int();

        int prevt = 0, prevx = 0, prevy = 0;

        for (int i = 0; i < n; i++)
        {
            var t = sc.Int();
            var x = sc.Int();
            var y = sc.Int();
            var dt = Math.Abs(t - prevt);
            var dx = Math.Abs(x - prevx);
            var dy = Math.Abs(y - prevy);
            if (dt < dx + dy || dt % 2 != (dx + dy) % 2)
            {
                pr.WriteLine("No");
                return;
            }
            prevt = t;
            prevx = x;
            prevy = y;
        }
        pr.WriteLine("Yes");
    }

    static void Main(string[] args)
    {
        // pr.AutoFlush = true;
        Solve();
        pr.Flush();
    }

    static Scanner sc = new Scanner();
    static Printer pr = new Printer();
}

#region IO
class Scanner
{
    private int _i = 0;
    private string[] line = new string[0];

    private T[] Enumerate<T>(int n, Func<T> f)
    {
        T[] ret = new T[n];
        for (int i = 0; i < n; i++)
            ret[i] = f();
        return ret;
    }

    public string Str()
    {
        if (line.Length <= _i)
        {
            line = Console.ReadLine().Split(' ');
            _i = 0;
        }

        return line[_i++];
    }

    public int Int() => int.Parse(Str());
    public long Long() => long.Parse(Str());
    public double Double() => double.Parse(Str());
    public int[] Int(int n) => Enumerate(n, Int);
    public long[] Long(int n) => Enumerate(n, Long);
    public double[] Double(int n) => Enumerate(n, Double);
    public string[] Str(int n) => Enumerate(n, Str);
}

class Printer : StreamWriter
{
    public Printer() : base(Console.OpenStandardOutput())
    {
        AutoFlush = false;
    }
}
#endregion

Measured memory_bytes: 13244
#include<stdio.h>
#include<math.h>

int num[200009];

int quicksort(int left,int right)
{
	int i,j,mid;
	i=left;j=right;
	mid=num[(left+right)>>1];
	while (i<j) 
	{
		while (num[i]>mid) ++i;
		while (num[j]<mid) --j;
		if (i<=j)
		{
			int tmp;
			tmp=num[i];num[i]=num[j];num[j]=tmp;
			++i;--j;
		}
	}
	if (i<right) quicksort(i,right);
	if (j>left) quicksort(left,j);
}

main()
{
	int n,i,k;
	scanf("%d",&n);
	scanf("%d",&k);
	for (i=1;i<=n;i++) 
		scanf("%d",&num[i]);
	quicksort(1,n);
	long long ans;
	for (i=k+1;i<=n;i++) ans+=num[i];
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
typedef pair<int, int> P;
typedef pair<P, int> PP;
vector<P> G[310];
P d[310][310];
int N, M, L;
void dijkstra(int s) {
    rep(i, N) d[s][i] = {INF, INF2};
    d[s][s] = {0, -L};
    priority_queue<PP, vector<PP>, greater<PP>> que;
    que.push({d[s][s], s});
    while(que.size()) {
        PP p = que.top(); que.pop();
        P cost = p.first;
        int u = p.second;
        if(d[s][u] < cost) continue;
        for(auto& e: G[u]) {
            int to = e.first;
            int add = e.second;
            P cost2 = cost;
            cost2.second += add;
            if(cost2.second > 0) {
                cost2.second = -L + add;
                cost2.first++;
            }
            if(cost2.second > 0) continue;
            if(cost2 < d[s][to]) {
                d[s][to] = cost2;
                que.push({d[s][to], to});
            }
        }
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> N >> M >> L;
    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        G[a].push_back({b, c});
        G[b].push_back({a, c});
    }
    int Q; cin >> Q;
    rep(i, N) dijkstra(i);
    while(Q--) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        if(d[s][t].first >= INF) {
            cout << -1 << endl;
        } else {
            cout << d[s][t].first << endl;
        }
    }


    return 0;
}


Measured memory_bytes: 8784
#define VACANT 0
#define MALE   1
#define FEMALE 2
#include <iostream>

using namespace std;

int query(int seat) {
    cout << seat << "\n" << std::flush;
    string temp;
    cin >> temp;
    if (temp == "Vacant")
        return VACANT;
    if (temp == "Male")
        return MALE;
    return FEMALE;
}

int main()
{
    int n;
    cin >> n;
    int searchBot = 0;
    int searchTop = n - 1;
    // bool gapEven = (searchTop - searchBot) & 1;
    
    int valueTop = query(searchTop);
    if (valueTop == VACANT)
        return 0;
    int valueBot = query(searchBot);
    if (valueBot == VACANT)
        return 0;
    
    for (int arb = 0; arb < 18; arb++) {
        int searchMid = (searchTop + searchBot)/2;
        int valueMid = query(searchMid);
        if (valueMid == VACANT)
            return 0;
        bool tempGapEven = (searchMid - searchBot) & 1;
        if ((valueMid == valueBot) == tempGapEven) {
            //search bottom
            valueTop = valueMid;
            searchTop = searchMid;
        } else {
            //search top
            valueBot = valueMid;
            searchBot = searchMid;
        }
    }
    
    return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define sp cout << " ";
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';        
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;


clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

int main(){
  fastio

  ll n,k,i,j;
  cin >> n >> k;

  if(k > ((n - 1) * (n - 2)) / 2){
    cout << "-1\n";
  }else{
    vpll v;
    forn(2,n + 1,i){
      v.pb({1,i});
    }
    ll mx = ((n - 1) * (n - 2)) / 2;
    ll diff = mx - k;
    forn(2,n,i){
      forn(i + 1,n + 1,j){
        if(diff == 0){
          break;
        }
        v.pb({i,j});
        diff--;
      }
      if(diff == 0)break;
    }
    cout << sz(v) << '\n';
    for(auto p : v){
      cout << p.ff << ' ' << p.ss << '\n';
    }
  }

  ktj();
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}



///////////////////////////


int main() {
	
	ll H, N;
	cin >> H >> N;
	vector<ll> A(N + 1);
	vector<ll> B(N + 1);
	repn(i, N) cin >> A[i] >> B[i];

	vector<ll> dp(H + 1,INF);

	dp[0] = 0;

	repn(i, H) {
		repn(j, N) {
			dp[i] = min(dp[i], dp[max(0, i - A[j])] + B[j]);
		}
	}

	cout << dp[H];
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,a[55],b[55],c[55],d[55],i,j,minn,ans;
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i]>>b[i];
    for(i=1;i<=m;i++)
        cin>>c[i]>>d[i];
    for(i=1;i<=n;i++){
        minn=1<<30;
        for(j=1;j<=m;j++)
            if(abs(c[j]-a[i])+abs(d[j]-b[i])<minn){
                minn=abs(c[j]-a[i])+abs(d[j]-b[i]);
                ans=j;
            }
        cout<<ans<<endl;
    }
    return 0;
} 

Measured memory_bytes: 256
//-----------
var log = console.log;
if(process.stdin){
	var p = process.stdin;
	p.resume();
	p.setEncoding('utf8');
	p.on('data',function(line){
		before(line);
	});
}
function before(line){
	var lines = line.split("\n");
	lines = lines.filter(function(e){return (e !== "");});
	main(lines);
}

//-----------
function main(lines){
	var ls = lines.map(function(e){return Number(e);});
	while(ls.length > 1){
		var tpl = ls.shift();
		var arr = ls.slice(0,tpl);
		ls = ls.slice(tpl);
		var mid = arr.indexOf(Math.min.apply(this,arr));
		arr.splice(mid,1);
		var Mid = arr.indexOf(Math.max.apply(this,arr));
		arr.splice(Mid,1);
		var sum = arr.reduce(function(p,c,i,a){return p+c;});
		log(Math.floor(sum/arr.length));
	}
}

Measured memory_bytes: 16384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
 ll r,d;
 vector<ll> x(11);
 cin>>r>>d>>x[0];
 for(ll i=1;i<11;i++){
  x[i]=r*x[i-1]-d;
  cout<<x[i]<<endl;
 }

 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll   long long int
using namespace std;
#define fr(i,n) for(ll i=0;i<n;i++)
#define pii pair <ll ,ll>
#define ppi pair < pii , int > 
#define x first
#define y second
int main ()
{
    ll max = INT_MAX;
    ll maxN = 100001;
    ll n,W;cin>>n>>W;
    ll w[n],v[n];
    fr(i,n)cin>>w[i]>>v[i];
    ll dp[n+1][maxN];
    fr(i,n+1)fr(j,maxN)dp[i][j]=max;
    fr(i,n+1)
    {
        fr(j,maxN)
        {
            if(j==0){dp[i][j]=0;continue;}
            if(i==0)
            {
                dp[i][j]=max;
                continue;
            }
            else 
            {
                dp[i][j] = dp[i-1][j];
                if(j>=v[i-1])
                dp[i][j] = min(dp[i][j],dp[i-1][j-v[i-1]] + w[i-1]);
            }

        }
    }
    // fr(j,140)cout<<j<<" "<<dp[n][j]<<endl;
    ll ans = 0;
    fr(j,maxN)
    if(dp[n][j]<=W)ans=j;
    cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 79104
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H,A[MAX+1];

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

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

  if(largest != i){
    swap(A[i],A[largest]);
    maxHeapify(largest);
  }
}

int extract(){
  int maxv;
  if(H < 1) return -INFTY;
  maxv = A[1];
  A[1] = A[H--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i, int key){
  if(key < A[i])return;
  A[i] = key;
  while(i > 1 && A[i / 2] < A[i]){
    swap(A[i],A[i/2]);
    i = i / 2;
  }
}

void insert(int key){
  H++;
  A[H] = -INFTY;
  increaseKey(H,key);
}

int main(){
  int key;
  char com[10];

  while(1){
    scanf("%s\n", com);
    if(com[0] == 'e' && com[1] == 'n')break;
    if(com[0] == 'i'){
      scanf("%d\n", &key);
      insert(key);
    }else{
      printf("%d\n", extract());
    }
  }

  return 0;
}



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

int main(){
    int n,l;
    cin>>n>>l;
    vector<string>d(n);
    for(int i=0;i<n;i++){
        cin>>d.at(i);
        }
    sort(d.begin(),d.end());

    for(int i=0;i<n;i++){
        cout<<d.at(i);
        }
    cout<<endl;
    }


Measured memory_bytes: 256
n = int(input())
lst = [int(i) for i in input().split()]

lstb = [0]*n

mid = n//2
if n % 2 == 0:
    for i in range(n):
        if i%2 == 0:
            lstb[mid + i//2] = lst[i]
        else:
            lstb[mid - i//2 - 1] = lst[i]
else:
    for i in range(n):
        if i==0:
            lstb[mid] = lst[i]
        elif i%2 == 0:
            lstb[mid - i//2] = lst[i]
        else:
            lstb[mid + i//2 + 1] = lst[i]

ans = ''
for i in range(n):
    ans += str(lstb[i])+' '
print(ans[:-1])

Measured memory_bytes: 25744
#include<iostream>
using namespace std;
int main()
{
  long long int n,num,s=0,r;
  cin>>n;
  num=n;

      r=n/500;
      s=s+r*1000;
      n=n%500;
      r=n/5;
      s=s+r*5;
      cout<<s;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define pb push_back
using namespace std;
const int N = 2*1e5+10;
const int MOD = 1e9 + 7;
const int INF = 1e18 + 10;
int dp[N];

void printVector(vector<int> s){
    for(int &x:s){
        cout<<x<<" ";
    }
    cout<<endl;
}
vector<int> g[N];


int dfs(int cur){
    if(dp[cur]!=0){
        return dp[cur];
    }
    for(auto x : g[cur]){
        dp[cur] = max(dp[cur] , 1 + dfs(x));

    }
    return dp[cur];
}


void solve(){
    int n;
    int m;
    cin>>n;
    cin>>m;
    for(int i = 0 ; i <m ; i++){
        int n1;
        int n2;
        cin>>n1;
        cin>>n2;
        g[n1].pb(n2);
    }
    int ans = 0;
    for(int i = 1; i <=N ; i++){
        ans = max(ans, dfs(i));
    }
    cout<<ans<<endl;

}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
//    cin>>t;
    t = 1;
    for(int i = 0 ; i < t ; i++){
        solve();
    }
    return 0;
}

Measured memory_bytes: 14168
s=input()
t=input()
if len(s)<len(t):
	print("UNRESTORABLE")
	exit()
d=[]
for i in range(len(s)-len(t)+1):
	cnt=0
	for j in range(len(t)):
		if s[i+j]=="?" or s[i+j]==t[j]:
			cnt+=1
		else:
			break
	if cnt==len(t):
		p=""
		for j in range(i):
			if s[j]=="?":
				p+="a"
			else:
				p+=s[j]
		for j in range(i,len(t)+i):
			p+=t[j-i]
		for j in range(len(t)+i,len(s)):
			if s[j]=="?":
				p+="a"
			else:
				p+=s[j]
		d.append(p)
if len(d)==0:
	print("UNRESTORABLE")
else:
	print(min(d))


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n, m;
    cin >> n >> m;

    vector<int> x(m);
    rep(i, m) cin >> x[i];
    cout << endl;
    sort(ALL(x));

    if (m == 1 || n >= m)
        OP(0);
    else if (n == 1)
        OP(x[m - 1] - x[0]);
    else
    {
        vector<int> l;
        rep(i, m - 1) l.push_back(x[i + 1] - x[i]);
        sort(ALL(l), greater<int>());
        int ans = 0;
        for (int i = n - 1; i < l.size(); i++)
            ans += l[i];
        OP(ans);
    }

    return 0;
}

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

int main()
{
    int w, h, n, minx, maxx, miny, maxy;
    cin >> w >> h >> n;
    maxx = w;
    maxy = h;
    for (int i = 0; i < n; i++)
    {
        int x, y, a;
        cin >> x >> y >> a;
        if (a == 1)
            minx = max(x, minx);
        else if (a == 2)
            maxx = min(x, maxx);
        else if (a == 3)
            miny = max(y, miny);
        else if (a == 4)
            maxy = min(y, maxy);
    }
    
    if (maxx >= minx && maxy >= miny)
    {
        cout << (maxx - minx) * (maxy - miny) << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 10000100
//#define NIL -1

int main() {
    LL n;
    LL a;
    LL b;
    LL ans=0;
    LL num=0;
    cin >> n >> a >> b;
    vector<LL> x(n);

    for(LL i=0; i<n; i++){
        cin >> x[i];
    }

    for(LL i=1; i<n; i++){
        LL tmp=(x[i]-x[i-1])*a;
        if(tmp<b){
            ans+=tmp;
            num++;
        }
    }

    ans+=(n-1-num)*b;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3992
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<climits>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#include<algorithm>
#include<utility>

using namespace std;
typedef long long int lld;

template<typename T>
void input_vector(vector<T>& v, lld n, lld start=0) {
	for(lld i=start; i<n; ++i) 
		cin>>v[i];
}

template<typename T>
void display_vector(vector<T> v, lld start=0, string sep=" ") {
	for(lld i=start; i<v.size(); ++i)
		cout<<v[i]<<sep;
	cout<<"\n";
}

void solve(vector<vector<lld>>& graph) {
	vector<lld> sign(graph.size(), -1);
	queue<lld> q;
	lld node, i;
	
	q.push(1);
	sign[1] = 0;
	
	while(!q.empty()) {
		node = q.front();
		q.pop();
		for(i=0; i<graph[node].size(); ++i) {
			if(sign[graph[node][i]]<0){
				q.push(graph[node][i]);
				sign[graph[node][i]] = node;
			}
		}
	}
	
	bool all=true;
	for(i=2; i<sign.size(); ++i)
		if(sign[i]<=0)
			all=false;
	if(!all)
		cout<<"No\n";
	else {
		cout<<"Yes\n";
		for(i=2; i<sign.size(); ++i)
			cout<<sign[i]<<"\n";
	}
}

int main() {
	lld t;
	t=1;
	
	for (lld cs=1; cs<=t; ++cs) {
		lld n, m, a, b, i;
		cin>>n>>m;
		vector<vector<lld>> graph(n+1, vector<lld>(0));
		for(i=0; i<m; ++i) {
			cin>>a>>b;
			graph[b].push_back(a);
			graph[a].push_back(b);
		}
		
		/* print the graph
		for(a=1; a<graph.size(); ++a) {
			cout<<a<<": ";
			for(b=0; b<graph[a].size(); ++b)
				cout<<graph[a][b]<<" ";
			cout<<"\n";
		}*/
		solve(graph);
	}
	
	return 0;
}

Measured memory_bytes: 12828
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int H = in.nextInt();
        int N = in.nextInt();
        long INF = 1_000_000_000_000_000L;
        int[] A = new int[N];
        int[] B = new int[N];
        long[][] dp = new long[N+1][3*10000+1];
        for (int i=0;i<N+1;i++) {
            for (int j=0;j<3*10000+1;j++) {
                dp[i][j] = INF;
            }
        }
        dp[0][0] = 0;
        for (int i=0;i<N;i++) {
            A[i] = in.nextInt();
            B[i] = in.nextInt();
        }
        for (int i=1;i<N+1;i++) {
            for (int j=0;j<3*10000;j++) {
                if (i-1>=0) {
                    dp[i][j] = Math.min(dp[i][j], dp[i-1][j]);
                }
                if (i-1>=0 && j-A[i-1]>=0) {
                    dp[i][j] = Math.min(dp[i][j], dp[i-1][j-A[i-1]]+B[i-1]);
                }
                if (j-A[i-1]>=0) {
                    dp[i][j] = Math.min(dp[i][j], dp[i][j-A[i-1]]+B[i-1]);
                }
            }
        }

        long ans = INF;
        for (int j=H;j<=H+15000;j++) {
            ans = Math.min(ans, dp[N][j]);
        }
        out.println(ans);

        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}


Measured memory_bytes: 314660
#include<bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
using Graph = vector<vector<int>>;

int main(){
    int A,B;
    char op;
    cin >> A >> op >> B;
    if(op == '+') cout << A+B << endl;
    else cout << A-B << endl;
}

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

int f(int n){
  if(n%2==0)
    return n/2;
  return n*3+1;
}
int main(){
  int n;
  cin >> n;
  map<int,int>deta;
  deta[n]=1;
  bool no=true;
  int ans=1,m=n;
  while(no){
    ans++;
    m=f(m);
    if(deta[m]==1)
      no=false;
    else
      deta[m]=1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3648
import java.awt.Point;
import java.awt.event.FocusAdapter;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;

import javax.naming.InitialContext;
 
public class Main {
     
	static int N, T, L, B;
	static int[] Lose, Back;
	
    static void start()
    {
    	double[][] dp = new double[T+1][N+1];
    	
    	for (int turn = 0; turn <= T; turn++) 
    		for(int index = 0; index <= N;index++)
    			dp[turn][index] = 0;
    	dp[0][0] = 1;
    	
    	for (int turn = 0; turn < T; turn++) 
    		for(int index = 0; index < N;index++)
    			for (int dice = 1; dice <= 6; dice++) 
    			{
					int nextindex = index + dice;
					if(nextindex > N) nextindex = N - (nextindex - N);
					int nextturn = turn + 1;
					
					if (Lose[index] == 1)
					{
						nextturn++;
						if(nextturn > T) break;
					}
					
					if (Back[nextindex] == 1)
					{
						dp[nextturn][0] += dp[turn][index] / 6;
					}
					else
					{
						dp[nextturn][nextindex] += dp[turn][index] / 6;
					}
    			}
    	
    	double ans = 0;
    	for (int turn = 1; turn <= T; turn++) 
    	{
			ans += dp[turn][N];
			//System.out.println(turn + ":" + dp[turn][N]);
		}
    	//System.out.println("------------------------------------------");
    	System.out.printf("%.06f\n", ans);
    	//System.out.println("------------------------------------------");
    	
    	/*System.out.println("-- DP ----------------------------------------");
    	for (int turn = 0; turn <= T; turn++) 
    		for(int index = 0; index <= N;index++)
    			System.out.println(dp[turn][index]);
    	System.out.println("----------------------------------------------");*/
    }
     
    public static void main(String[] args)
    {
        Scanner sca = new Scanner(System.in);
        
        while(true)
        {
        	N = sca.nextInt();
        	T = sca.nextInt();
        	L = sca.nextInt();
        	B = sca.nextInt();
        	if(N == 0) break;
        	
        	Lose = new int[N+1];
        	for (int i = 0; i < N+1; i++) Lose[i] = 0;
        	for (int i = 0; i < L; i++) Lose[sca.nextInt()] = 1;
        	
        	Back = new int[N+1];
        	
        	for (int i = 0; i < N+1; i++) Back[i] = 0;
        	for (int i = 0; i < B; i++) Back[sca.nextInt()] = 1;
            
            start();
        }
        
    }
}

Measured memory_bytes: 24392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int n;
    cin >> n;
    vector<int> p(n), q(n), r(n);
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];
    rep(i, n) r[i] = i + 1;

    int a = 0;
    int b = 0;
    int x = 1;
    do
    {
        bool aok = true, bok = true;
        rep(i, n)
        {
            if (r[i] != p[i])
            {
                aok = false;
            }
            if (r[i] != q[i])
            {
                bok = false;
            }
        }
        if (aok)
        {
            a = x;
        }
        if (bok)
        {
            b = x;
        }
        x++;
    } while (next_permutation(r.begin(), r.end()));

    cout << abs(a - b) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    int n;
    cin >> n;
    ll ma = -1000001, mi = 1000001, su = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        ma = max(ma, a);
        mi = min(mi, a);
        su += a;
    }

    cout << mi << ' ' << ma << ' ' << su << endl;

    return 0;
}


Measured memory_bytes: 3088
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
	int i,j,n,s,t;
	char a[100];
	while(scanf("%s",a)!=EOF)
	{	s=t=0;
		n=strlen(a);
		for(i=0;i<n;i++)
		{
			s+=(a[i]-'0');
			t+=(a[i]-'0')*pow(10,n-i-1);
		}
		if(t%s==0)
			printf("Yes\n");
		else
			printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lc "\n"
#define fast_io ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define int long long
#define c(a,n) for(size_t i = 0; i < n; i++) cin >> a[i];
#define ffor(n) for(size_t i = 0; i < n; i++)
#define asort(a) sort(a.begin(), a.end())
#define rsort(a) sort(a.begin(), a.end(), greater<int>())
 
typedef vector<int> vi;
typedef vector<float> vf;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef map<string,int> msi;
typedef map<int,int> mii;
typedef unordered_map<string,int> umsi;
 
 
int32_t main()
{
    fast_io;
    int d, t, s;
    cin >> d >> t >> s;
    if(float(d)/float(s) <= float(t))
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

Measured memory_bytes: 3648
var
	N:String;
	K,i,j,lim,kk,l,nk,nj:Longint;
	dp:Array[0..103,0..1,0..3]of int64;
begin
	readln(N);
	read(K);
	dp[0,0,0]:=1;
	for i:=0 to length(N)-1 do for j:=0 to 1 do begin
		if j=0 then lim:=ord(N[i+1])-48 else lim:=9;
		for kk:=0 to K do for l:=0 to lim do begin
			nk:=kk;
			if l<>0 then inc(nk);
			if nk<=K then begin
				nj:=j;
				if l<lim then nj:=1;
				inc(dp[i+1,nj,nk],dp[i,j,kk]);
			end;
		end;
	end;
	writeln(dp[length(N),0,K]+dp[length(N),1,K]);
end.


Measured memory_bytes: 128
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define ll long long
#define fir first
#define sz(a) int((a).size())

signed main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
int k;
cin>>k;
for(int i=0;i<k;i++)
	cout<<"ACL";
	return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

using P=pair<int,int>;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
char mp[100][100];
int dis[100][100];
int h,w;

int bfs(){
  queue<P> que;
  REP(i,h)REP(j,w)dis[i][j]=INF;
  que.push(P(0,0));
  dis[0][0]=0;
  while(!que.empty()){
    P p=que.front();
    que.pop();
    if(p.FR==h-1&&p.SC==w-1)break;
    REP(i,4){
      int ny=p.FR+dy[i];
      int nx=p.SC+dx[i];
      if(0<=nx&&nx<w&&0<=ny&&ny<h&&mp[ny][nx]=='.'&&dis[ny][nx]==INF){
        que.push(P(ny,nx));
        dis[ny][nx]=dis[p.FR][p.SC]+1;
      }
    }
  }
  return dis[h-1][w-1];
}


signed main(){

  cin>>h>>w;
  int white=0;
  REP(i,h)REP(j,w){
    cin>>mp[i][j];
    if(mp[i][j]=='.')white++;
  }
  int use=bfs()+1;
  //cout<<white<<' '<<use<<endl;
  cout<<(white-use>=0?white-use:-1)<<endl;




  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <map>

using namespace std;

#define R register

const int MAXN=2e5+10;

int n;
int a[MAXN];

map<int,int> mp;

inline bool chk(int k)
{
	mp.clear();
	for(R int i=2;i<=n;i++)
	{
		if(a[i-1]<a[i]) continue;
		if(k==1) return 0;
		while(!mp.empty()&&mp.rbegin()->first>a[i]) mp.erase(mp.rbegin()->first);
		int j=a[i];
		while(j&&mp[j]+1==k) mp.erase(j--);
		if(j) mp[j]++;
		else return 0;
	}
	return 1;
}

int main()
{
	scanf("%d",&n);
	for(R int i=1;i<=n;i++) scanf("%d",&a[i]);
	int l=1,r=n,mid,res=n;
	while(l<=r)
	{
		int mid=l+r;mid>>=1;
		if(chk(mid)) r=mid-1,res=mid;
		else l=mid+1;
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#define MAX 100000
typedef struct{
  char name[10];
  int time;
}process;
void enqueue(process);
process dequeue(void);
int head=0,tail=0,q;
process p[MAX];

int main()
{
  process x;
  int n,i,t=0;

  scanf("%d%d",&n,&q);
  for(i=0; i<n; i++)  {
    scanf("%s%d",x.name,&x.time);
    enqueue(x);
  }

  while(head!=tail) {
    if(p[head].time > q) {
      p[head].time = p[head].time-q;
      t += q;
      enqueue(dequeue());
    }
    else if(p[head].time <= q) {
      t += p[head].time;
      printf("%s %d\n",p[head].name,t);
      dequeue();
    }
  }
    
  return 0;
}

void enqueue(process x)
{
  p[tail] = x;
  if(tail+1 == MAX-1) tail = 0;
  else tail++;
}

process dequeue()
{
  process x;
  
  x = p[head];
  
  if(head+1 == MAX-1) head = 0;
  else head++;
  return x;
}

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

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

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

    int n;cin>>n;
    vector<ll> a(n);
    ll res=0;
    for(int i=0;i<n;i++) cin>>a[i];
    unordered_map<ll,ll> mp;
    mp[0]++;
    ll sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
        res+=mp[sum];
        mp[sum]++;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 10056
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace debug
{
    class ProgramA
    {
        static void Main(string[] args)
        {

            //入力
            string[] n = Console.ReadLine().Split(' ');
            string s  = Console.ReadLine();

            //
            int num = int.Parse(n[1]) - 1;
            for(int i = 0;i < int.Parse(n[0]);i++)
            {
                int temp = s[i];
                if(i == num)
                {
                    temp += 32;
                    Console.Write((char)temp);
                }
                else
                {
                    Console.Write((char)temp);
                }
            }

        }
    }
}

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

int main(){
    string S;
    cin >> S;
    if((S.at(2) == S.at(3)) && (S.at(4) == S.at(5)) ){
        cout << "Yes" << endl;
    }else{
        cout << "No" <<endl;
    }
}

Measured memory_bytes: 256