akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*///map < string, ll> s;

/*i++ずつずらす
a[0] a[1] a[2]//a[1] a[2] a[3]
a[0] a[2] a[4]//a[1] a[3] a[5]
/*if (N % 2 != 0)a = N / 2;
else a = N / 2 - 1;
for (int i = 1;i <= a;i++) {
	for (int j = 0;j < N - (i * 2);j++) {
		if (S[j] != S[j + i] && S[j + i * 2] != S[j] && S[j + i] != S[j + i * 2]) sum--;
		if (sum == 0)break;
	}
}*/

//mapの使い方
/*map<int, int> mp;
for (int i = 0; i < N; i++)
	mp[a[i]]++;

int ans = 0;
for (auto p : mp) {
	int x = p.first;
	int n = p.second;
	if (n < x) ans += n;
	else ans += n - x;
}*/

int main() {
	ll N;cin >> N;
	string S;
	string s;
	vector<ll>A(5);
	for (int i = 0;i < N;i++) {
		cin >> S;
		s = S[0];
		if (s == "M")A[0]++;
		if (s == "A")A[1]++;
		if (s == "R")A[2]++;
		if (s == "C")A[3]++;
		if (s == "H")A[4]++;
	}
	ll ans = 0;
	for (int i = 0;i < 3;i++) {
		for (int j = i + 1;j < 4;j++) {
			for (int k = j + 1;k < 5;k++) {
				ans += A[i] * A[j] * A[k];
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))

# ===CODE===

eps = 10 ** (-9)


def main():
    n = ni()

    ans = [0 for _ in range(n)]

    lim = int(n ** (1 / 2) + 1)
    for x in range(1, lim):
        for y in range(1, lim):
            for z in range(1, lim):
                tmp = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if 0 < tmp <= n:
                    ans[tmp - 1] += 1

    for ai in ans:
        print(ai)


if __name__ == '__main__':
    main()


Measured memory_bytes: 11048
def read():
    N, K = map(int, input().split(' '))
    As = list(map(int, input().split(' ')))
    return N, K, As


def fun(N, K, As):
    for i in range(N - K):
        prev = As[i]
        current = As[i+K]
        if current > prev:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    N, K, As = read()
    fun(N, K, As)

Measured memory_bytes: 93364
#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

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H; cin >> H;
    int times = 1;
    int ans = 0;
    while(H > 0) {
        ans += times;
        H /= 2;
        times *= 2;
    }
    cout << ans << endl;


    return 0;
}


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

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

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

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

void solve() {
    int n;
    cin >> n;
    vector<double> p(n+1);
    for (int i=1; i<n+1; i++) {
        cin >> p.at(i);
    }

    vector<vector<double>> dp(n+1, vector<double>(n+1, 0.0));
    dp.at(0).at(0) = 1.0;
    for (int i=1; i<n+1; i++) {
        dp.at(i).at(0) = dp.at(i-1).at(0) * (1.0 - p.at(i));
        for (int j=1; j<=i; j++) {
            dp.at(i).at(j) = dp.at(i-1).at(j-1) * p.at(i) + dp.at(i-1).at(j) * (1.0 - p.at(i));
        }
    }

    double res = 0.0;
    for (int i=n/2+1; i<=n; i++) {
        res += dp.at(n).at(i);
    }

    cout << res << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 70784
n = int(input())
a = [0 for i in range(n)]
for i in range(n):
  a[i] = int(input())
count = 0
lighting = 0
for i in range(n):
  count = count + 1
  lighting = a[lighting]-1
  if lighting == 1:
    print(count)
    exit()
print(-1)

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

using namespace std;

int main() {
    int N;
    cin >> N;
    string str;
    cin >> str;
    vector<int> R, G, B;
    for(int n=0; n<N; n++) {
        if(str[n]=='R') {
            R.push_back(n);
        } else if(str[n]=='G') {
            G.push_back(n);
        } else {
            B.push_back(n);
        }
    }

    long long int ans=0;
    for(int n=0; n<N; n++) {
        if(str[n]=='R') {
            int gi=lower_bound(G.begin(), G.end(), n)-G.begin();
            int bi=lower_bound(B.begin(), B.end(), n)-B.begin();
            while(gi<G.size() && bi<B.size()) {
                if(G[gi]>B[bi]) {
                    int rid=B[bi]+B[bi]-n;
                    ans += G.size()-gi;
                    if(rid>=str.size()) {
                        ;
                    } else if(str[rid]=='G') {
                        ans--;
                    }
                    bi++;
                } else {
                    int rid=G[gi]+G[gi]-n;
                    ans += B.size()-bi;
                    if(rid>=str.size()) {
                        ;
                    } else if(str[rid]=='B') {
                        ans--;
                    }
                    gi++;
                }
            }
        } else if(str[n]=='G') {
            int ri=lower_bound(R.begin(), R.end(), n)-R.begin();
            int bi=lower_bound(B.begin(), B.end(), n)-B.begin();
            while(ri<R.size() && bi<B.size()) {
                if(R[ri]>B[bi]) {
                    int rid=B[bi]+B[bi]-n;
                    ans += R.size()-ri;
                    if(rid>=str.size()) {
                        ;
                    } else if(str[rid]=='R') {
                        ans--;
                    }
                    bi++;
                } else {
                    int rid=R[ri]+R[ri]-n;
                    ans += B.size()-bi;
                    if(rid>=str.size()) {
                        ;
                    } else if(str[rid]=='B') {
                        ans--;
                    }
                    ri++;
                }
            }
        } else {
            int gi=lower_bound(G.begin(), G.end(), n)-G.begin();
            int ri=lower_bound(R.begin(), R.end(), n)-R.begin();
            while(gi<G.size() && ri<R.size()) {
                if(G[gi]>R[ri]) {
                    int rid=R[ri]+R[ri]-n;
                    ans += G.size()-gi;
                    if(rid>=str.size()) {
                        ;
                    } else if(str[rid]=='G') {
                        ans--;
                    }
                    ri++;
                } else {
                    int rid=G[gi]+G[gi]-n;
                    ans += R.size()-ri;
                    if(rid>=str.size()) {
                        ;
                    } else if(str[rid]=='R') {
                        ans--;
                    }
                    gi++;
                }
            }
        }
        // cout << "No." << n+1 << ". " << str[n] << " " << ans << endl;
    }
    cout << ans << endl;

    
    return 0;
    
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

int main(){
    char C;
    cin >> C;

    cout << (char)(C + 1) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.logging.Logger;


public class Main {
	public static void main(String[] args){
		PrintWriter out = new PrintWriter(System.out);
		InputReader sc=new InputReader(System.in);
		long N=sc.nextLong();
		long K=sc.nextLong();
		long min=Long.MAX_VALUE;
		for (long i = -100; i < 100; i++) {
			min=Math.min(min, Math.abs(N-K*(i+(N/K))));
		}
		System.out.println(min);
	}
	static class InputReader { 
		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;
		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}
 
		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}
 
		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}
 
		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}
 
		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}
 
		public boolean hasNext() {
			skip();
			return hasNextByte();
		}
 
		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
 
		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}
 
		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}
 
		public double nextDouble() {
			return Double.parseDouble(next());
		}
 
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
 
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
 
		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif

using namespace std;

const int MOD=1e9+7;
int N, A[21][21], D[21][1<<21];

int solve(int c, int bit)
{
	if(c==N) return 1;
	if(D[c][bit]!=-1) return D[c][bit];
	D[c][bit]=0;
	for(int i=0;i<N;i++) {
		if((bit&(1<<i))==0 && A[c][i]) {
			D[c][bit]=(D[c][bit]+solve(c+1,bit|(1<<i)))%MOD;
		}
	}
	return D[c][bit];
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	cin>>N;
	for(int i=0;i<N;i++) {
		for(int j=0;j<N;j++) {
			cin>>A[i][j];
		}
	}
	memset(D,-1,sizeof(D));
	cout<<solve(0,0)<<'\n';
	return 0;
}

Measured memory_bytes: 172288
n, m = map(int, input().split())
root_map = dict()
root_map[1] = set()
root_map[n] = set()

for i in range(m):
    a, b = map(int, input().split())
    if a not in root_map:
        root_map[a] = set()
        root_map[a].add(b)
    else:
        root_map[a].add(b)
    if b not in root_map:
        root_map[b] = set()
        root_map[b].add(a)
    else:
        root_map[b].add(a)

for i in root_map[1]:
    if i in root_map[n]:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 81284
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define  MAX 100000

typedef struct {
    char name[100];
    int time;
} Proce;

int head, tail;
Proce data[MAX];

void initialize(void);
int isEmpty(void);
int isFull(void);
void enqueue(Proce x);
Proce dequeue(void);
int min(int a, int b);

int main(void)
{
    int n, q, i, sum = 0;

    initialize();

    scanf("%d %d", &n, &q);

    for (i = 1; i <= n; i++) {
        scanf("%s %d", data[i].name, &data[i].time);
    }

    head = 1;
    tail = n + 1;

    while (head != tail) {
        Proce x;

        x = dequeue();

        int value;
        value = min(x.time, q);

        x.time -= value;
        sum += value;

        if (x.time > 0) {
            enqueue(x);
        } else {
            printf("%s %d\n", x.name, sum);
        }
    }
    return 0;
}

void initialize(void)
{
    head = tail = 0;
}

int isEmpty(void)
{
    if (head == tail) {
        return 1;
    } else {
        return 0;
    }
}

int isFull(void)
{
    if (head == (tail + 1) % MAX) {
        return 1;
    } else {
        return 0;
    }
}

void enqueue(Proce x)
{
    if (isFull()) {
        printf("エラー（オーバーフロー）\n");
    }

    data[tail] = x;
    tail = (tail + 1) % MAX;
}

Proce dequeue(void)
{
    Proce x;

    if (isEmpty()) {
        printf("エラー（アンダーフロー）\n");
    }

    x = data[head];

    head = (head + 1) % MAX;

    return x;
}

int min(int a, int b)
{
    return (a < b) ? a : b;
}



Measured memory_bytes: 11892
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;



int main () {
	SpeedForce;
	cin >> s;
	if (s == "ABC") cout << "ARC";
	else cout << "ABC";

	return Accepted;
}

// B...a

Measured memory_bytes: 17732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define f(i, l, r) for (int i = l; i <= r; i++)
#define rf(i, r, l) for (int i = r; i >= l; i--)
#define all(x) (x).begin(), (x).end()
#define sf(a) scanf("%d",&a)
#define llsf(a) scanf("%lld", &a)
#define l l
#define r r
#define lch (o << 1)
#define rch (o << 1 | 1)
#define mid ((l + r) >> 1)
#define mem(x, y) memset(x, y, sizeof(x))

const int inf = 2e9 + 7;
const ll INF = INT64_MAX;
double eps = 1e-6;
int mod = 1e9 + 7;
const int N = 1e6 + 10;
const double pi = acos(-1.0);

int main() {
#ifdef local
	freopen("in.txt", "r", stdin);
#endif
	int n; sf(n); int a; sf(a);
	cout << n - a + 1;
}

Measured memory_bytes: 256
ar = list(input())
g = 0
p = 0
count = 0
for a in ar:
    if a == "g":
        if g == p:
            g += 1
        else:
            p += 1
            count += 1
    else:
        if g == p:
            g += 1
            count -= 1
        else:
            p += 1
print(count)

Measured memory_bytes: 3956
object Main extends App {

  import scala.io.StdIn._
  import scala.math._
  val n = readLine.trim.toInt
  val state = Array.tabulate(n){_ ⇒
    readLine.trim.split(' ') match {
      case Array("(", x) ⇒ x.toInt
      case Array(")", x) ⇒ -x.toInt
      case _ ⇒ ???
    }
  }
  println(
    state.foldLeft(Some(0):Option[Int]){
      case (Some(x), n) if x + n < 0 ⇒ None
      case (o, n) ⇒ o.map(_ + n)
    } match {
      case Some(0) ⇒ "YES"
      case _ ⇒ "NO"
    }
  )
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}


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

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (b < a) a = b; }

using ll = long long;
using ld = long double;
using namespace std;

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

  int a, b; cin >> a >> b;

  if (b >= a) cout << a << endl;
  else cout << a-1 << endl;
  
  return (0);
}

Measured memory_bytes: 3620
using System;

public class Program
{
    private int H, W, N;
    public void Solve()
    {
        var sc = new Scanner();
        H = sc.NextInt();
        W = sc.NextInt();
        N = sc.NextInt();
        int max = Math.Max(H, W);
        Console.WriteLine((N+max-1)/max);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

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

int main(int argc, char *argv[])
{
	int ret;
	int r, g;
	cin >> r >> g;

	ret = 2 * g - r;
	cout << ret << endl;
	
	return 0;
}


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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

template<typename A, size_t N, typename T>
void static_fill(A (&arr)[N], const T &val){
    fill((T*)arr, (T*)(arr+N), val);
}

const int INF = 10000;
const int dy[4] = {1, -1, 0, 0};
const int dx[4] = {0, 0, 1, -1};

int H, W;
char bd[22][22];
int d[22][22][22][22];

void wf() {
    static_fill(d, 10000);
    for (int i=1; i<=H; ++i) {
        for (int j=1; j<=W; ++j) {
            if (bd[i][j] == '#') continue;
            d[i][j][i][j] = 0;
            for (int k=0; k<4; ++k) {
                if (bd[i+dy[k]][j+dx[k]] == '#') continue;
                d[i][j][i+dy[k]][j+dx[k]] = 1;
                d[i+dy[k]][j+dx[k]][i][j] = 1;
            }
        }
    }
    for (int i=1; i<=H; ++i) {
        for (int j=1; j<=W; ++j) {
            if (bd[i][j] == '#') continue;
            for (int k=1; k<=H; ++k) {
                for (int l=1; l<=W; ++l) {
                    if (bd[k][l] == '#') continue;
                    for (int m=1; m<=H; ++m) {
                        for (int n=1; n<=W; ++n) {
                            if (bd[m][n] == '#') continue;
                            d[k][l][m][n] = min(d[k][l][m][n], d[k][l][i][j] + d[i][j][m][n]);
                        }
                    }
                }
            }
        }
    }
}

int main() {
    static_fill(bd, '#');
    cin >> H >> W;
    for (int i=1; i<=H; ++i) {
        for (int j=1; j<=W; ++j) {
            cin >> bd[i][j];
        }
    }
    wf();

    int mx = 0;
    for (int i=1; i<=H; ++i) {
        for (int j=1; j<=W; ++j) {
            for (int k=1; k<=H; ++k) {
                for (int l=1; l<=W; ++l) {
                    if (d[i][j][k][l] == INF) continue;
                    mx = max(mx, d[i][j][k][l]);
                }
            }
        }
    }
    cout << mx << endl;
    return 0;
}

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

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

    int N;
    cin >> N;
    vector<int> A(1 << N);
    for (int i = 0; i < 1 << N; i++) cin >> A[i];
    vector<int> first(1 << N), second(1 << N);
    for (int i = 0; i < 1 << N; i++) {
        for (int S = ~i & ((1 << N) - 1); S > 0; S = (S - 1) & ~i) {
            if (first[S | i] < A[i]) {
                second[S | i] = first[S | i];
                first[S | i] = A[i];
            } else if (second[S | i] < A[i]) {
                second[S | i] = A[i];
            }
        }
        if (first[i] < A[i]) {
            second[i] = first[i];
            first[i] = A[i];
        } else if (second[i] < A[i]) {
            second[i] = A[i];
        }
    }
    int ans = 0;
    for (int K = 1; K < 1 << N; K++) {
        ans = max(ans, first[K] + second[K]);
        cout << ans << '\n';
    }
}

Measured memory_bytes: 6372
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    
    vector<int> v(N, -1);

    int s, c;
    rep(i, M) {
        cin >> s >>c;
        if(s==1 && c==0 && N != 1) {
            cout << -1 << endl;
            return 0;
        }

        if(v[s-1] != -1 && v[s-1] != c) {
            cout << -1 << endl;
            return 0;
        }
        v[s-1] = c;
    }

    if(N==1 && v[0] == -1) {
        cout << 0 << endl;
        return 0;
    }

    if(v[0] == -1) {
        v[0] = 1;
    }
    rep(i, N) {

    }
    int ret = 0;
    rep(i, N) {
        ret *= 10;
        if (v[i] != -1)
            ret += v[i];
    }
    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

  int second;
  int h, m, s;

  scanf("%d", &second);
  h = second / 3600;
  m = (second % 3600) / 60;
  s = (second % 3600) % 60;
  printf("%d:%d:%d\n", h, m, s);

  return 0;

}


Measured memory_bytes: 2096
//
// Created by munaiyi on 2020/3/18.
//

#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e4 + 5;
int dp[maxn];

int main() {
    memset(dp, 127, sizeof(dp));
    int h, n;
    scanf("%d%d", &h, &n);
    dp[0] = 0;
    for (int i = 1; i <= n; i++) {
        int a, c;
        scanf("%d%d", &a, &c);
        for (int j = 1; j <= h; j++) {
            dp[j] = min(dp[j], dp[max(0, j - a)] + c);
        }
    }
    printf("%d\n", dp[h]);
    return 0;
}

Measured memory_bytes: 256
a,b,c,d,n,*A=`dd`.split.map &:to_i;e=f=1;a>c&&(a,c,e=c,a,-1);b>d&&(b,d,f=d,b,-1);V=A.each_slice(2).select{|x,y|a<=x&&x<=c&&b<=y&&y<=d}.map{|x,y|[x*e,y*f]}.sort;D=[F=1e9]*s=V.size;V.map{|x,y|D[D.bsearch_index{|e|e>y}]=y};N=D.index{|e|e>=F}||s;p 1e2*(c-a+d-b)-20*N+5*(N+(N>[c-a,d-b].min ? 1:0))*Math::PI

Measured memory_bytes: 40980
import math
d,g = map(int,input().split())
prob = []
for i in range(d):
  p,c = map(int,input().split())
  prob.append([p,c,p*(i+1)*100+c])
  
mindays = 10**9
for i in range(2**d):
  point = 0
  days = 0
  one = []
  for j in range(d):
    if ((i>>j)&1)==0:
      point += prob[j][2]
      days += prob[j][0]
    else:
      one.append(j+1)
  if point>=g:
    mindays = min(mindays,days)
  elif point<g:
    for k in range(len(one)):
        day =days
        tmp = math.ceil((g-point)/(one[k]*100))
        if tmp<=prob[one[-1]-1][0]:
          day += tmp
          mindays = min(mindays,day)
print(mindays)
    

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		String c = sc.next();
		char next = 'a';
		while(true) {
			if(next == 'a') {
				if(a.length()==0) {
					System.out.println("A");
					break;
				}
				next = a.charAt(0);
				a = a.substring(1);
			}else if(next == 'b') {
				if(b.length()==0) {
					System.out.println("B");
					break;
				}
				next = b.charAt(0);
				b = b.substring(1);
			}else {
				if(c.length()==0) {
					System.out.println("C");
					break;
				}
				next = c.charAt(0);
				c = c.substring(1);
			}
	//		System.out.println(next);
		}
	}

}

Measured memory_bytes: 25172
#!/usr/bin/env python3

inf = float('inf')

def bellman_ford():
    for i in range(N):
        d[i] = inf
    d[0] = 0
    for i in range(N):
        for j in range(M):
            s, t, c = es[j]
            if d[s] != inf and d[t] > d[s] + c:
                d[t] = d[s] + c
    return -d[N - 1]


N, M = map(int, input().split())

es = []
for i in range(M):
    a, b, c = map(int, input().split())
    es.append((a - 1, b - 1, -c))

d = [0] * N
ans = bellman_ford()
negative = [False] * N
for i in range(N):
    for j in range(M):
        s, t, c = es[j]
        if d[s] != inf and d[t] > d[s] + c or negative[s]:
            negative[t] = True

if negative[N - 1]:
    print(inf)
else:
    print(ans)


Measured memory_bytes: 3308
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader sc = new FastReader();
		int N = sc.nextInt();
		long[] a = new long[N+1], psa = new long[N+1];
		
		for (int i=1; i<=N; i++) {
			a[i] = sc.nextLong(); 
			psa[i] = psa[i-1] + a[i]; 
		}
		long[][] dp = new long[N+10][N+10]; 
		for (int i=0; i<=N+8; i++) {
			Arrays.fill(dp[i], 1L<<60);
		}

		for (int len=1; len<=N; len++) {
			for (int i=1; i<=N-len+1; i++) {
				int j = i + len -1; 
				if (len==1) {
					dp[i][j] = 0; 
				}
				else {
					for (int k=i; k<=j-1; k++) {
						dp[i][j] = Math.min(dp[i][j],dp[i][k]+dp[k+1][j]+psa[j]-psa[i-1]);
					}
					
				}
			}
		}
		System.out.println(dp[1][N]);
//		for (int i=1; i<=N; i++) {
//			for (int j=1; j<=N; j++) {
//				System.out.print(dp[i][j]+" ");
//			}
//			System.out.println();
//		}
//		
	}	

}


Measured memory_bytes: 24404
N,L = map(int,input().split())

lst = list(range(L,N+L))
sumlst = sum(lst)

if lst.count(0) == 1:
    print(sumlst)
else:
    #lstnot = [ s * -1 if 0 > s else s  for s in lst ]
    if ( L > 0 ):
        print( sumlst - min(lst) )
    else:
        print( sumlst - max(lst) )


Measured memory_bytes: 2940
#include <iostream>
 
int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
 
int main()
{
  int K;
  std::cin >> K;
  
  std::cout << a[K-1];
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
typedef long long ll;
typedef int64_t in;
using namespace std;



int main(){
    ll n,k; cin >> n >> k;
    ll ans=0;
    if(k > (n-1)*(n-2)/2) cout << -1 << "\n";
    else{
        ll m = n - 1 + (n-1)*(n-2)/2 - k;
        cout << m << "\n";
        ll node = 1;
        ll leaf = 1;
        rep(i,m){
            if(leaf < n){
                leaf++;
                cout << node << " " << leaf << "\n";
            }else{
                node++;
                leaf = node+1;
                cout << node << " " << leaf << "\n";
            }
        }
    }

    return 0;
}


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

int min(int a, int b){
    if( a < b ){
        return a;
    }
    else {
        return b;
    }
}

int main(){
    string s;
    cin >> s;
    int countA = 0,countB = 0;
    for(int i = 0; i < s.size(); i++){
        if(i % 2 == 0){
            if(s[i] == '1'){
                countA++;
            }
        }
        else{
            if(s[i] == '0'){
                countA++;
            }
        }
    }
    countB = s.size() - countA;
    cout << min(countA, countB) << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=Integer.parseInt(sc.next());
        Set<Integer> S=new HashSet<>();
        for (int i=0;i<N;i++){
            int d=Integer.parseInt(sc.next());
            S.add(d);
        }
        System.out.println(S.size());
    }
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    int N; cin >> N;
    unordered_map<ll, ll> m;
    ll sum = 0;
    rep(i, N){
        ll a; cin >> a;
        sum += a;
        m[a]++;
    }
    int Q; cin >> Q;
    rep(i, Q){
        ll b, c; cin >> b >> c;
        sum += m[b]*(c-b);
        m[c] += m[b];
        m[b] = 0;
        cout << sum << endl;
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 11196
#include<iostream>
using namespace std;
int a[105];




int main()
{
	int n,i,j,v,k;
    cin>>n;
    for(i=0;i<n;i++)
    {
    	cin>>a[i];
	}
   for(i=0;i<n;i++)
   {
   	if(i!=0)
   	cout<<" ";
   	cout<<a[i];
   }
   cout<<endl;
   for(i=1;i<n;i++)
   {
   	v=a[i];
   	j=i-1;
   	while(j>=0 && a[j]>v)
   	{
   		  	   a[j+1]=a[j];  	 
   		j--;
	   }
	   a[j+1]=v;
	   for(k=0;k<n;k++)
	   {
	   	if(k!=0)
	   	cout<<" ";
	   	cout<<a[k];
	   }
	   cout<<endl;
   }
}


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

#define nax 100009
#define FOR(i,n,m) for(int i =(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define pb push_back

typedef vector<int> vi;


int main(){
	int n,k; cin>>n>>k;
	vi a(n);
	REP(i,n) cin>>a[i];
	bool dp[nax];

	REP(i,a[0]) dp[i] = false;
	FOR(i,a[0],k+1){
		dp[i] = false;
		REP(j,n){
			if(i-a[j]<0) break;
			if(!dp[i-a[j]]) dp[i] = true;
		}
	}

	if(dp[k]) cout<<"First";
	else cout<<"Second";

	return 0;
}

Measured memory_bytes: 384
//
// Created on 2020/01/26.
//

//#include <bits/stdc++.h>
#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 <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;
using gragh = vector<vector<int>>;

map<ll,ll>table;

ll solve(ll n){
    if(table[n] != 0) return table[n];
    else{
        return table[n] = solve(n/2) *2+1;
    }
}

int main() {


    ll h;
    cin>>h;
    table[1] = 1;
    solve(h);

    cout<<table[h]<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        long n = scan.nextLong(), d = scan.nextLong(), cnt = 0;
        long x[] = new long[(int)n], y[] = new long[(int)n];
        for(int i = 0; i < x.length; i++) {
            x[i] = scan.nextLong();
            y[i] = scan.nextLong();

            if(x[i] * x[i] + y[i] * y[i] <= d * d) {
                cnt ++;
            }
        }

        System.out.println(cnt);

        scan.close();
        return;
    }
}

Measured memory_bytes: 62716
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;


#define REP(i, n) for(ll i = 0; i < n; i++)






























int main(){
    ll n;
    cin >> n;
    ll t;
    cin >> t;
    ll ans = 0;
    REP(i, n - 1){
        ll a;
        cin >> a;
        ans += max(t - a, 0LL);
        t = max(t, a);
    }
    cout << ans << endl;
}

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

int main(){
  int64_t n,c,k;
  cin >> n >> c >> k;
  vector<int64_t> t(n);
  for(int i=0;i<n;i++){
    cin >> t.at(i);
  }
  sort(t.begin(),t.end());
  /*for(int i=0;i<n;i++){
    cout << t.at(i) << ",";
  }*/
  int64_t buscnt = 1;
  int64_t busbegin = t.at(0);
  int64_t busride = 1;
  for(int i=1;i<n;i++){
    if(t.at(i) > busbegin + k || busride >= c){
      buscnt++;
      busbegin = t.at(i);
      busride = 1;
    }else{
      busride++;
    }
  }
  cout << buscnt << endl;
  
}

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

#ifndef __TOPCYBERFLOWER
#define debug(...) 0
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif

#define TYPEMAX(type)   numeric_limits<type>::max()
#define TYPEMIN(type)   numeric_limits<type>::min()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

int main(void){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n,k,c; cin>>n>>k>>c;
    string s; cin>>s;
    vector<int> day;
    for(int i=0;i<n;i++){
        if(s[i]=='o') day.push_back(i+1); 
    }
    vector<int> asc(k),dsc(k);
    asc[0]=day[0];
    for(int i=1;i<k;i++){
        asc[i]=*lower_bound(day.begin(),day.end(),asc[i-1]+c+1);
    }
    dsc[k-1]=day.back();
    for(int i=k-2;i>=0;i--){
        dsc[i]=*(upper_bound(day.begin(),day.end(),dsc[i+1]-c-1)-1);
    }
    vector<int> ans;
    for(int i=0;i<k;i++){
        if(asc[i]==dsc[i]) ans.push_back(asc[i]);
    }
    for(int xx:ans) cout<<xx<<'\n';
    return 0;
}

Measured memory_bytes: 5004
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;

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

    string t1, t2;
    t1 = "";
    t2 = "";

    rep(i,S.size()){
        t1 += to_string(i%2);
        t2 += to_string((i+1)%2);
    }

    int ans1,ans2;
    ans1 = ans2 = 0;

    rep(i,S.size()){
        if (t1[i] != S[i]){
            ans1++;
        }
        if (t2[i] != S[i]){
            ans2++;
        }
    }

    cout << min(ans1, ans2) << endl;

    
}

Measured memory_bytes: 768
use std::io::*;
use std::str::FromStr;

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 s: Vec<u8> = read::<String>().into_bytes();
    let s: String = read();
    let w: usize = read();
    let t: Vec<char> = s.chars().collect();

    for i in 0..((s.len() - 1) / w + 1) {
        print!("{}", t[i * w]);
    }
    println!("")
}


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

#define int  long long
#define pb emplace_back
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);

int32_t main(){
	fast;
	int n,m;
	cin >> n >> m;
	int gate = m;
	int a[100005]= {0};
	
	while(m--)
	{
		int x,y;
		cin >> x >> y;
		a[x]++;
		a[y+1]--;
	}
	f(i,1,100005)   a[i] += a[i-1];
	int ans = 0;
	f(i,0,100005)   ans += (a[i] == gate);
	
	cout << ans;

}







Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[][] A = new int[2][N];
    for (int i = 0; i < 2 ; i++)
      for (int j = 0; j < N; j++)
        A[i][j] = sc.nextInt();
    int[][] B = new int[2][N];
    B[1][N - 1] = A[1][N - 1];
    B[0][N - 1] = A[0][N - 1] + A[1][N - 1];
    for (int j = N - 2; j > 0 - 1; j--) {
      B[1][j] = A[1][j] + B[1][j + 1];
      B[0][j] = A[0][j] + Math.max(B[0][j + 1], B[1][j]);
    }
    System.out.println(B[0][0]);
  }

}


Measured memory_bytes: 21972
// created by mtnshh
 
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265
 
const ll N = 100005;

ll power(ll a,ll n,ll m=M){
    ll ans=1;
    while(n){
        if(n&1) ans=ans*a;
        a=a*a;
        n=n>>1;
        ans=ans%m;
        a=a%m;
    }
    return ans;
}

ll first(ll k){
	ll ans = ((k*(k-1))%M*power(2,M-2))%M;
	return ans;
}

ll last(ll n, ll k){
	ll a = first(n+1);
	ll b = first(n-k+1);
	return ((a-b)%+M)%M;
}

void solve(){
	ll n,k;
	cin>>n>>k;
	ll ans = 0;
	rep(i,k,n+2){
		ll a = first(i);
		ll b = last(n,i);
		// err3(i,a,b);
		ans += ((b-a+1)%M+M)%M;
	}	
	ans %= M;
	cout<<ans<<endl;
	return;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll no;
	// cin>>no;
	no = 1;
	while(no--){
		solve();
	}
    return 0;
}

Measured memory_bytes: 3584