akhauriyash/Code-Regression huggingface dataset:
/**

     .=     ,        =.
  _  _   /'/    )\,/,/(_   \ \
   `//-.|  (  ,\\)\//\)\/_  ) |
   //___\   `\\\/\\/\/\\///'  /
,-"~`-._ `"--'_   `"""`  _ \`'"~-,_
\       `-.  '_`.      .'_` \ ,-"~`/
 `.__.-'`/   (-\        /-) |-.__,'
   ||   |     \O)  /^\ (O/  | .        <-  BESSIE THE COW / BESITE SOV
   `\\  |         /   `\    /
     \\  \       /      `\ /
      `\\ `-.  /' .---.--.\
        `\\/`~(, '()      ('
         /(O) \\   _,.-.,_)
        //  \\ `\'`      /
       / |  ||   `""""~"`
     /'  |__||
           `o

*/


//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

using ll = long long;

const int N = 1e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


bool DEBUG = 0;
#define debug(x) if (DEBUG) {cerr << #x << " = " << x << "\n";}
#define debug_vec(x) if (DEBUG) {cerr << #x << " = {"; for(auto a : x) cerr << a << ","; cerr << "}" << endl;}

//#define int ll

typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int a, b;
bool us[7];
main() {
    file("sort");
    ios;
    cin >> a >> b, us[a] = us[b] = 1;
    fo(i, 1, 3, 1) if (!us[i]) return !(cout << i);
    cerr << "\nTime elapsed: " << (clock() + 0.0) / CLOCKS_PER_SEC;
    return 0;
}
/**

*/


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define has(c,i) ((c).find(i) != end(c))
#define DBGDO(X) ({ if(1) cerr << "DBGDO: " << (#X) << " = " << (X) << endl; })

const ll N = 100000, MOD = 1e9 + 7;
ll inv[N], fac[N], invfac[N];

ll multinom(ll n, vl ks) {
	if (n < 0) return 0;
	ll res = fac[n];
	for (ll k: ks) {
		if (k < 0 || k > n) return 0;
		res = res * invfac[k] % MOD;
	}
	return res;
}

ll calc(ll a, ll b, ll c) {
	if (b % 2) return 0;
	b /= 2;
	
	ll res = 0;
	if (b == 0) {
		FOR(p,0,a+1) FOR(q,0,(c-p)/3+1) {
			if (p + 3*q == c) res = (res + multinom(a+q+b, {p,q,a-p,b})) % MOD;
		}
	} else {
		FOR(p,0,a+1) FOR(q,0,(c-p)/3+1) {
			res = (res + multinom(a+q+b, {p,q,a-p,b}) * multinom(b+c-p-3*q-1, {b-1, c-p-3*q})) % MOD;
		}
	}
	return res;
}


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	inv[1] = fac[0] = invfac[0] = 1;
	FOR(n,2,N) inv[n] = (MOD/n) * (MOD - inv[MOD%n]) % MOD;
	FOR(n,1,N) {
		fac[n] = n * fac[n-1] % MOD;
		invfac[n] = inv[n] * invfac[n-1] % MOD;
	}

	ll n, a, b, c; cin >> n >> a >> b >> c;
	cout << calc(a,b,c) << endl;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int A,B,C,D;cin >> A >> B >> C >> D;
  if(A+B == C+D) cout << "Balanced" << endl;
  else if(A+B>C+D) cout << "Left" << endl;
  else cout << "Right" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> // Tomasz Nowak
using namespace std;     // XIII LO Szczecin
using L = long long;

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

	int n;
	cin >> n;
	vector<int> a(n);
	for(int &ai : a)
		cin >> ai;

	vector<vector<L>> dp(n, vector<L>(n));
	for(int len = 1; len <= n; ++len)
		for(int l = 0; l <= n - len; ++l) {
			int r = l + len - 1;
			if(l == r)
				dp[l][r] = a[l];
			else
				dp[l][r] = max(a[l] - dp[l + 1][r], a[r] - dp[l][r - 1]);
		}
	cout << dp[0][n - 1] << '\n';
}


Measured memory_bytes: 70784
from heapq import heappush, heappop
N, M = map(int, input().split())

queue = []

for i in range(N):
  a, b = map(int, input().split())
  heappush(queue, (a, b))

count = 0
ans = 0

while count < M:
  a, b = heappop(queue)
  
  if count + b < M:
    count += b
    ans += a * b
  else:
    c = (M - count)
    count += c
    ans += c * a
  
print(ans)

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

def recursive(i,j):
    if i<0 or j<0 or i>=row or j>=col or  grid[i][j]=='#':
        return 0
    if dp[i][j]!=-1:
        return dp[i][j]
    if i==row-1 and j==col-1:
        return 1
    mod=10**9+7
    dp[i][j]=recursive(i+1,j)%mod +recursive(i,j+1)%mod
    return dp[i][j]%mod


row,col=map(int,input().split())
dp=[[-1]*col for _ in range(row)]
grid=[]
for _ in range(row):
    grid.append(input())
print(recursive(0,0))


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

using namespace std;
using ll = long long;

const int maxn=1e5;
int N;
int a[maxn];
int dp[maxn];

int main(){
    cin.tie(0)->sync_with_stdio(0);
    cin >> N;
    for(int i=0;i<N;++i){
        cin >> a[i];
    }
    dp[1] = abs(a[1]-a[0]);
    for(int i=2;i<N;++i){
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout << dp[N-1] << endl;
    return 0;
}


Measured memory_bytes: 4352
# coding:utf-8                                                                  

alls = raw_input()
tarx, tary = map(int, raw_input().split())

ss = alls.split("T")

xs = []
ys = []
posx = set()
posy = set()
posy.add(0)
for i, s in enumerate(ss):
    if i == 0:
        posx.add(len(s))
    elif i % 2 == 0:
        xs.append(len(s))
    else:
        ys.append(len(s))

for x in xs:
    tmpx = set()
    for px in posx:
        tmpx.add(px+x)
        tmpx.add(px-x)
    posx = tmpx

for y in ys:
    tmpy = set()
    for py in posy:
        tmpy.add(py+y)
        tmpy.add(py-y)
    posy = tmpy

if tarx in posx and tary in posy:
    print "Yes"
else:
    print "No"

Measured memory_bytes: 3504
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		double a,b,c,d;

		Scanner sc = new Scanner(System.in);

		a = sc.nextDouble();
		b = sc.nextDouble();
		c = sc.nextDouble();
		d = sc.nextDouble();

		int count = 0;
		double result = a * b /2;

		if (a/2 == c && b/2 == d) {

			count = 1;

		}

		System.out.println(result + " " + count);

	}
}


Measured memory_bytes: 22868
MOD = 10**9 + 7


def main():
    N, M = map(int, input().split())
    S = list(map(int, input().split()))
    T = list(map(int, input().split()))
    dp = [[0] * (M+1) for _ in range(N+1)]
    for i in range(N+1):
        dp[i][0] = 1
    for i in range(M+1):
        dp[0][i] = 1
    ans = 1
    for i in range(N):
        for j in range(M):
            if S[i] == T[j]:
                cur = dp[i][j]
            else:
                cur = 0
            dp[i+1][j+1] = (dp[i+1][j] + dp[i][j+1] +
                            - dp[i][j] + cur) % MOD
#    print(dp)
    print(dp[N][M])


if __name__ == "__main__":
    main()


Measured memory_bytes: 72412
s = input()
 
is_good = "Yes"
for i,string in enumerate(s):
  if i % 2 == 0 and string in ["R", "U", "D"]:
    continue
  elif i % 2 == 1 and string in ["L", "U", "D"]:
    continue
  else:
    is_good = "No"
    break
print(is_good)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = s.nextInt();
		s.close();
		int cnt = 0;
		for(int i=a; i<=b; i++) {
			if(c%i == 0) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

}

Measured memory_bytes: 26324
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    int N;
    cin >> N;
    vector<tuple<int, int, int, int>> A(N);
    REP(i, N){
        int w, s, v;
        cin >> w >> s >> v;
        A[i] = make_tuple(w+s, w, s, v);
    }
    sort(A.begin(), A.end());
    vector<vector<long long>> dp(N+1, vector<long long>(20001));
    REP(i, N) {
        long long ws, w, s, v;
        tie(ws, w, s, v) = A[i];
        dp[i+1] = dp[i];
        REP(j, min(s+1, 20001-w))
            dp[i+1][j+w] = max(dp[i+1][j+w], dp[i][j] + v);
    }
    long long ans = *max_element(dp[N].begin(), dp[N].end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 160640
# -*- coding: utf-8 -*-
from sys import stdin

inp = stdin.readline().rstrip().split()
stack = []

for i in inp:
    if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        stack.append((stack.pop() * -1) + stack.pop())
    elif i == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i))
else:
    print(stack.pop())


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

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define vi vector< int > 
#define pii pair< int, int >
#define mii map< int , int > 
#define F(start,stop) for(int i=start; i<stop; i++)
#define FRev(start,stop) for(int i=start; i>=stop; i--)
#define debugVector(v) for(int i = 0; i < v.size(); i++) cout << v[i] << " "; cout << endl;
#define debugArray(arr, n) for(int i=0; i<n; i++) cout << arr[i] << " "; cout << endl;
#define MOD1 1000000007
#define MOD2 998244353


ll n,m,x;
ll min_cost = LLONG_MAX;
ll data[50][50];
	
void findMin(ll cur, ll cur_know[]){

	// Check if already done!
	bool isTrue = true;
	for(int i=1; i <= m ; i++){
		if(cur_know[i] < x){
			isTrue = false;
			break;
		}
	}
	if(isTrue) min_cost = min (min_cost, cur_know[0]);
	
	if(cur == n)
		return;

	// Call without change
	findMin(cur+1, cur_know);

	// Call with change
	for(int i=0; i<=m; i++)
		cur_know[i] += ::data[cur][i];
	
	findMin(cur+1, cur_know);
	
	for(int i=0; i<=m; i++)
		cur_know[i] -= ::data[cur][i];
}

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	IOS

	cin >> n >> m >> x;
	for(int i=0; i<n; i++){
		for(int j=0; j<=m; j++){
			cin >> ::data[i][j]; 
		}
	}
	ll cur_know[m+1] ={0};

	findMin(0, cur_know);
	if(min_cost == LLONG_MAX){
		cout << -1 << endl;
		return 0;
	}
	cout << min_cost << endl;
}

Measured memory_bytes: 3644
#include<iostream>
#define MAX 100005
using namespace std;

int x[MAX], y[MAX], t[MAX];

int abs(int a, int b) {
	if (a >= b) { return a - b; }
	else {
		return b - a;
	}
}


int main() {
	int n;
	cin >> n;
	t[0] = 0; x[0] = 0; y[0] = 0;
	for (int i = 1; i <= n; i++) {
		cin >> t[i] >> x[i] >> y[i];
	}
	for (int i = 0; i < n; i++) {
		if (abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]) > t[i + 1] - t[i]) {
			cout << "No" << endl; return 0;
		}
		else if ((abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])) % 2 != (t[i + 1] - t[i]) % 2) {
			cout <<  "No" << endl; return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int K;
  cin >> K;
  long long int a;
  vector<long long int> A(9);
  for(int i=0;i<9;i++){
    A.at(i)=i+1;
  }
  for(int i=0;i<50000;i++){
    a = A.at(i)%10;
    if(a!=0){
      A.push_back(A.at(i)*10+a-1);
    }
    A.push_back(A.at(i)*10+a);
    if(a!=9){
      A.push_back(A.at(i)*10+a+1);
    }
  }
  cout << A.at(K-1) << endl;
}

Measured memory_bytes: 1524
#include <bits/stdc++.h>
#include <algorithm>
#include <climits>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <math.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> pbds;
#define vll vector<ll> 
#define nl cout << endl
#define fr(a,b) for(auto i=a;i<b;i++)
#define pll pair<ll,ll>
#define f first
#define s second
#define vpll vector<pll>
#define ump unordered_map
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define IN(a,b) ((a).find(b)!=(a).end())
#define pb push_back
#define mkp make_pair
#define PI M_PI
#define INF 1e18
#define deb(x) if(ON) cout << #x <<" : " << x << endl
#define fast ios_base::sync_with_stdio(false)
#define io cin.tie(NULL),cout.tie(NULL)
#define ON !false
ll dx[]={0,-1,0,1};
ll dy[]={1,0,-1,0};
const ll mod=1e9+7;
ll i,j;
ll add(ll a,ll b){
    return  ((a%mod)+(b%mod)+mod)%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod)+mod)%mod;
}
void pause(ll id){
    cout << "Waiting " << id << endl;
    cin >> id;
}

const int mxn=1e5+10;
ll n,t;


signed main(){
    fast;
    io;
    if(!true){
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    }

    cin >> n;
    ll h[n];
    vll ans(n,0);
    ll i,j;
    for(i=0;i<n;i++){
        cin >> h[i];
    }
    for(i=1;i<n;i++){
        ll mn=abs(h[i]-h[i-1])+ans[i-1];
        if(i>=2){
            mn=min(mn,abs(h[i]-h[i-2])+ans[i-2]);
        }
        ans[i]+=mn;
    }
    cout << ans[n-1] << endl;
   
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <set>
#include <map>
#include <list>
#include <cstdlib>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

#define MOD 1000000007
#define PI 3.1415926535897932
#define rep(i, n) for (int i = 0; i < n; i++)
#define repe(i, j, n) for (int i = j; i < n; i++)
#define repi(i, n) for (int i = 0; i <= n; i++)
#define repie(i, j, n) for (int i = j; i <= n; i++)
#define all(x) x.begin(), x.end()
#define println() cout << endl
#define P pair<int, int>
#define fi first
#define se second

typedef long long ll;

long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}


void solve1() {
    int h, w, h1, w1; cin >> h >> w >> h1 >> w1;

    cout << h * w - h*w1 - w*h1 + h1*w1 << endl;
}

int main()
{
    solve1();
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
#define rep(i,a,b) for(register int i=a;i<=b;++i)
#define rpd(i,a,b) for(register int i=a;i>=b;--i)
#define rep1(i,x) for(register int i=head[x];i;i=nxt[i])
typedef long long ll;
inline int read() {
                                 int x=0, tmp=1;
                               char ch=getchar();
                            //233333333333333333333333
                          while( (ch<'0') || (ch>'9') ){
                         if(ch=='-')tmp=-1; ch=getchar();}
                          while( (ch>='0')&&(ch<='9') ){
                            x=x*10+ch-'0';ch=getchar();
                               }//233333333333333
                                 return (x*tmp);

}
using namespace std;
int main(){
    int n=read(),h=read(),ans=0;
    for(int i=1;i<=n;i++){
        int x=read();
        if(x>=h) ans++;
    }
    cout<<ans;
}

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

int main() {
  long long int n,k;
  cin>>n>>k;

  if(n<=abs(n-k)){cout<<n<<endl;return 0;}
  else{n=n%k;}
  cout<<min(n,abs(n-k))<<endl;
 
  return 0;
}

Measured memory_bytes: 256
package main

import (
        "fmt"
)

func main() {
        var N, Q int
        var S string
        fmt.Scan(&N, &Q, &S)

        t := make([]int, N)
        a := 0
        for i := 0; i < N; i++ {
                if S[i] == 'C' {
                        if i != 0 && S[i-1] == 'A' {
                                a++
                        }
                }
                t[i] = a
        }

        for i := 0; i < Q; i++ {
                var l, r int
                fmt.Scan(&l, &r)
                fmt.Println(t[r-1] - t[l-1])
        }
}


Measured memory_bytes: 6144
import numpy as np
N = int(input())
ans = 0 if N<3 else N-1
num = np.arange(2, max(2, np.sqrt(N)), dtype=int)
num = np.concatenate([num, np.array(N/num[N%num==0], dtype=int)])
mask = N%(num-1) == N//(num-1)
ans += int(np.sum(num[mask])-np.sum(mask))
print(ans)


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

using namespace std;

int solve() {
  int N;
  cin >> N;
  vector<int> L(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }

  sort(L.begin(), L.end());

  int ans = 0;
  for (int i = 0; i < N - 2; i++) {
    for (int j = i + 1; j < N - 1; j++) {
      int a = L[i];
      int b = L[j];

      auto iter = lower_bound(L.begin(), L.end(), a + b);
      int upper = distance(L.begin(), iter);
      if (upper > j) {
        ans += upper - j - 1;
      }
    }
  }
  return ans;
}

int main() {
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long X[] = new long[N];
    long B[] = new long[N];//整列用
    for(int i=0;i<N;i++){
      X[i]=sc.nextLong();
      B[i]=X[i];
    }
    Arrays.sort(B);
    //いったん真ん中を出す
    double med = B[N/2]+B[N/2-1];
    med=med/2;
    for(int i=0;i<N;i++){
      if(X[i]<med){
        System.out.println(B[N/2]);
      }else if(X[i]>med){
        System.out.println(B[N/2-1]);
      }else{
        System.out.println(X[i]);
      }
    }
    
  }
  

  
}

Measured memory_bytes: 96456
lst=[]
for i in range(10):
    n=int(input())
    lst.append(n)
x=sum(sorted(lst,reverse=True)[:3])

lst2=[]
for i in range(10):
    n=int(input())
    lst2.append(n)
y=sum(sorted(lst2,reverse=True)[:3])

print(x,y)


Measured memory_bytes: 5600
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    S.erase(unique(S.begin(), S.end()), S.end());
    int i = 0;
    for (char c = 'a'; c <= 'z'; c++) {
        if (S[i] != c) {
            cout << c << endl;
            break;
        }
        i++;
        if (c == 'z')cout << "None" << endl;
    }
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    ll n,a,b;
    cin >> n >> a >> b;
    ll section = n/(a+b);
    ll ans = 0;
    if (section == 0) {
        ans = min(n,a);
    } else {
        ans = section*a + min(n%(a+b),a);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/


int main(){
int N;
cin>>N;
ll A[N+1];
rep3(i,N){
    cin>>A[i];
}
ll ans[N+1];
ans[N]=A[N];
rep3(i,N-1){
    if(i%2==0){
    ans[N]+=A[i];
    }
    else{
        ans[N]-=A[i];
    }
}
ans[N]/=2;

repr3(i,N-1){
    ans[i]=A[i]-ans[i+1];
}
rep3(i,N){
    if(i!=N){
    cout<<2*ans[i]<<" ";
    }
    else{
        cout<<2*ans[i]<<endl;
    }
}
return 0;
}

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

int main(){

    // omajinai
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    // omajinai

    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0;i < n;i ++){
        cin >> p.at(i);
    }

    int ans = 0;

    vector<int> a(n);

    for(int i = 0;i < n-1;i ++){
        if(p.at(i) == i+1){
            a.at(i) = 1;
            if(p.at(i+1) == i+2){
                i ++;
            }
        }
    }

    if(p.at(n-1) == n && a.at(n-2) == 0){
        a.at(n-1) = 1;
    }

    for(int i = 0;i < n;i ++){
        ans += a.at(i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

int func(int A, int B, int C, int D){
    if(A <= C && D <= B) return D - C;
    else if(C <= B && B <= D) return B - C;
    else return 0;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int ans;
    if(A <= C) ans = func(A, B, C, D);
    else ans = func(C, D, A, B);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using static System.Console;
using static System.Math;
using System.IO;
using System.Collections.Generic;
namespace I_am_the_green_coder{
    class Inonoa{
        // なんか入力用の関数作ったけどまだテストしてないので使う前に確かめて
        static void Main(){
            long[] nab = ILongs();

            Console.WriteLine(Math.Min(nab[2],nab[0]*nab[1]));
        }

        static readonly long MOD = 1000000007;

        ///<summary>a_1, a_2, a_3, ...みたいなの</summary>
        static long[] ILongs(){
            string[] s = ReadLine().Split();
            long[] re = new long[s.Length];
            for(long i=0;i<s.Length;i++){
                re[i] = long.Parse(s[i]);
            }
            return re;
        }

        ///<summary>xooxoxoxxoxo...みたいなの</summary>
        static char[] IChars(){
            return ReadLine().ToCharArray();
        }

        ///<summary>n m とかをちょっとはやくかくだけ</summary>
        static string[] IStrings(){
            return ReadLine().Split();
        }

        ///<summary>n行の入力を取ったり</summary>
        static long[][] ILongLongs(long n){
            long[][] re = new long[n][];
            for(long i=0;i<n;i++){
                string[] s = ReadLine().Split();
                re[i] = new long[s.Length];
                for(long j=0;j<s.Length;j++){
                    re[i][j] = long.Parse(s[j]);
                }
            }
            return re;
        }

        ///<summary>n行の文字列を取ったり</summary>
        static char[][] ICharsChars(long n){
            char[][] re = new char[n][];
            for(long i=0;i<n;i++){
                re[i] = ReadLine().ToCharArray();
            }
            return re;
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    ll n,d;
    cin >> n >> d;
    vll p(n),q(n);
    REP(i,n){
        cin >> p[i] >> q[i];
    }
    ll ans = 0;

    REP(i,n){
        if(p[i]*p[i]+q[i]*q[i] <= d*d){
            ans++;
        }
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 6360
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }

#include <set>
void solve() {
  string a, b;
  cin >> a >> b;
  a += b;
  int n = stoi(a);
  loop(i,1,((int)sqrt(n))+1) {
    if (i*i == n) {
      cout << "Yes"<< endl;
      return;
    }
  }
  cout << "No" << endl;
}


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

int intpow(int a, int b) {
    int tmp = 1;
    REP(i, b) tmp *= a;
    return tmp;
}

int main() {
    int n; cin >> n;
    int even = 0;
    REP(i, n) {
        int tmp; cin >> tmp;
        if (tmp % 2 == 0) ++even;
    }

    cout << intpow(3, n) - intpow(2, even) << endl;

    return 0;
}

Measured memory_bytes: 256
a = STDIN.gets.split.map { |i| i.to_i }
w = a[0]
h = a[1]
x = a[2]
y = a[3]
r = a[4]
puts (x-r) < 0 || (y-r) < 0 || w < (x+r) || h < (y+r) ? 'No' : 'Yes'

Measured memory_bytes: 6092
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <string>
#include <bitset>
#include <math.h>
#include <vector>
#include <set>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL<<60;

using namespace std;

int main(){
    string S;
    string C;

    cin >> S;

    for(int i = 0; i < S.size(); i++){
        if (S[i] == '/');
        else C += S[i];
    }

    int num = atoi(C.c_str());

    (num > 20190430) ? cout << "TBD" : cout << "Heisei";
    return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<double> r(n);
	for (int i = 0; i < n; i++)
	{
		cin >> r[i];
	}
	double max_profit = -1000000000;
	double min_r = r[0];
	for (int i = 1; i < n; i++)
	{
		min_r = min(min_r, r[i - 1]);
		max_profit = max(max_profit, r[i] - min_r);
	}
	cout << setprecision(10) << max_profit << endl;
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int [] a = new int [k];
		int [] b = new int [k];
		int [][] array = new int [6][n+1];
		int answer = 0;
		for(int i = 0; i < k; i++){
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		for(int i = 1; i <= n; i++) {
			int count1 = 0;
			if(i == 1){
				for(int j = 0; j < k; j++) {
					if(a[j] == i){
						if(b[j] == 1){
							array[1][i]++;
							count1++;
						}
						else if(b[j] == 2){
							array[3][i]++;
							count1++;
						}
						else if(b[j] == 3){
							array[5][i]++;
							count1++;
						}
					}
				}
				if(count1 == 0){
					array[1][i]++;
					array[3][i]++;
					array[5][i]++;
				}
			}
		}
		for(int i = 1; i <= n; i++){
			int count = 0;
			int countb1 = 0;
			int countb2 = 0;
			int countb3 = 0;
			if(i != 1){
				for(int j = 0; j < k; j++){ 
					if(a[j] == i){
						count++;
						if(b[j] == 1){
							array[0][i] = array[1][i - 1];
							for(int l = 0; l < 6; l++){
								if(l > 1){
									countb1 = countb1 % 10000 + array[l][i - 1] % 10000;
									array[1][i] = countb1;
								}
							}
						}
						else if(b[j] == 2){
							array[2][i] = array[3][i-1];
							for(int l = 0; l < 6; l++){
								if(2 > l || 3 < l){
									countb2 = countb2 % 10000 + array[l][i - 1] % 10000;
									array[3][i] = countb2;
								}
							}
						}
						else if(b[j] == 3){
							array[4][i] = array[5][i-1];
							for(int l = 0; l < 6; l++){
								if(4 > l){
									countb3 = countb3 % 10000 + array[l][i - 1] % 10000;
									array[5][i] = countb3;
								}
							}
						}
					}
				}
				if(count == 0){
					for(int l = 0; l < 6; l++){
						if(l == 0 || l == 2 || l == 4){
							array[l][i] = array[l+1][i-1];
						}
						else if(l == 1){
							int counter = 0;
							for(int m = 0; m < 6; m++){
								if(1 < m){
									counter = counter % 10000 + array[m][i - 1] % 10000;
								}
							}
							array[l][i] = counter;
						}
						else if(l == 3){
							int counter = 0;
							for(int m = 0; m < 6; m++){
								if(2 > m || m > 3){
									counter = counter % 10000 + array[m][i - 1] % 10000;
								}
							}
							array[l][i] = counter;
						}
						else {
							int counter = 0;
							for(int m = 0; m < 6; m++){
								if(m < 4){
									counter = counter % 10000 + array[m][i - 1] % 10000;
								}
							}
							array[l][i] = counter;
						}
					}
				}				
			}
		}
		for(int l = 0; l < 6; l++){
			answer = answer % 10000 + array[l][n] % 10000;
		}
		System.out.println(answer % 10000);
	}
}

Measured memory_bytes: 19856
N, Q = map(int, input().split())
S = input()
Si = [0]*(N+1)
for i in range(1, N):
    if S[i-1] == 'A' and S[i] == 'C':
        Si[i+1] = Si[i] + 1
    else:
        Si[i+1] = Si[i]
for _ in range(Q):
    l, r = map(int, input().split())
    print(Si[r]-Si[l])

Measured memory_bytes: 51160
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main()
{
	int n, d;
	cin >> n >> d;
	int x[n][d];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> x[i][j];
		}
	}

	int ans = 0;
	double dist2;
	double dist;

	for (int i = 0; i < n-1; i++) {
		for (int j = i+1; j < n; j++) {
			dist2 = 0;
			for (int k = 0; k < d; k++) {
				dist2 += pow(x[i][k] - x[j][k], 2.0);
			}
			dist = sqrt(dist2);
			if (dist - (int)dist < 0.000001) {
				ans++;
			}
		}
	}

	cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            int[] length = new int[input.Length];

            for (int i = 0; i < input.Length; i++)
            {
                length[i] = int.Parse(input[i]);
            }

            if (length.Sum() - length.Max() > length.Max())
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }

    }
}


Measured memory_bytes: 13268
//auto 関数名 = [(&:ラムダ外の引数をとる時))](引数の型1 引数名1, 引数の型2, 引数名2, ...) { 関数の処理 }; //inside main() define function. take care of };
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//   bitset<ビット数> s(tmp);
//   // (ビット列sに対する処理)
// }
// sort(配列変数.begin(), 配列変数.end());
// do {
//   // 順列に対する処理
// } while (next_permutation(配列変数.begin(), 配列変数.end()));
//const double PI = acos(-1); M_PI
// cout << fixed << setprecision(10);
#include <bits/stdc++.h>
#include <regex>
using namespace std;
using ll = int64_t;
using P = pair<int,int>;
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end() //sort(all(vec)); ,reverse(all(vec));etc
int main(){
 int n,l;
 cin>>n>>l;
 vector<string>s(n);
 rep(i,n){
   cin>>s.at(i);
 }
 sort(all(s));
 string ans="";
 rep(i,n){
   ans+=s.at(i);
 }
 cout<<ans<<endl;

}




Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }



void solve(void)
{
  int N,M;
  cin>>N>>M;
  vector<int> vec(N+1,0);
  for (int i = 0; i < M; i++)
  {
    int A,B;
    cin>>A>>B;
    A--;B--;
    vec[A]++;
    vec[B]--;
  }
  for (int i = 0; i < N; i++)
  {
    vec[i+1] += vec[i];
  }
  bool check = 1;
  // DEBUG(vec);
  for (int i = 0; i < N; i++)
  {
    if(vec[i]%2 != 0) check = 0;
  }
  cout<<(check?"YES":"NO")<<endl;
  
  
   
  
  return;
}


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

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

 
  return 0;
}


Measured memory_bytes: 1024
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using E = System.Linq.Enumerable;

class Program
{
    static void Main(string[] args)
    {
        //入力を受け取る
        var N = long.Parse(Console.ReadLine());
       
        var P = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var count = 0;
        for(int i = 0; i < N-1;i++){
          //スワップ
          if(P[i] == i+1){
            var tmp = P[i];
            P[i] = P[i+1];
            P[i+1] = tmp;
            count++;
          }
        }
        if(P[N-1] == N){
          count++;
        }
      Console.WriteLine(count);
    }
}


Measured memory_bytes: 19296
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

int read() {
	char ch;
	for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
	int x=ch-'0';
	for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

const int N=2e5+5;

int n,a[N],ans;
bool used[N];

int main() {
	n=read();
	fo(i,1,n) a[i]=read();
	sort(a+1,a+n+1);
	int ans=0;
	fd(s,30,1) {
		int x=1<<s;
		int j=n;
		fo(i,1,n) 
			if (!used[i]) {
				while (j>i&&a[j]>x-a[i]||used[j]) j--;
				if (i==j) break;
				if (a[j]==x-a[i]) used[i]=used[j]=1,ans++;
			}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1152
# -*- coding: utf-8 -*-
import sys

x, y = map(int, input().split())

a = abs(x)
b = abs(y) 

if x != y and a == b:
    print(1)
    sys.exit()
if y == 0:
    if 0 < x:
        print(a+1)
    else:
        print(a)
elif x == 0 and y < 0:
    print(b + 1)    
elif y < 0:
    if x > 0:
        print(abs(b - a) + 1)
    elif x < 0 and a > b:
        print(a - b)
    else:
        print(b - a + 2)
        
else:
    if x < 0:
        print(abs(b - a) + 1)
    elif b > a:
        print(b - a)
    else:
        print(a - b + 2)

Measured memory_bytes: 3316
#include <iostream>

using namespace std;

int main()
{
    int A,B;
    cin>>A;
    cin>>B;
    if(A>=13)
    cout<<B;
   if(A>=6&&A<=12)
    cout<<B/2;
     if(A<=5)
    cout<<0;
    
       
       
       
       
   

    return 0;
}

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

struct UnionFind
{
    vector<int> parents;
    int n_roots;

    UnionFind(int n) : parents(n), n_roots(n)
    {
        for (int i = 0; i < n; i++)
        {
            parents.at(i) = -1;
        }
    }

    bool is_root(int x)
    {
        return parents.at(x) < 0;
    }

    int size(int x)
    {
        return -parents.at(find(x));
    }

    int find(int x)
    {
        if (is_root(x))
            return x;
        parents.at(x) = find(parents.at(x));
        return parents.at(x);
    }

    void unite(int x, int y)
    {
        x = find(x);
        y = find(y);
        if (x == y)
            return;
        if (size(x) < size(y))
            swap(x, y);
        parents.at(x) -= size(y);
        parents.at(y) = x;
        n_roots--;
    }

    bool same(int x, int y)
    {
        return find(x) == find(y);
    }
};

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

    UnionFind tree(N);
    vector<int> l(M, -1);
    for (int i = 0; i < N; i++)
    {
        int Ki;
        cin >> Ki;
        for (int j = 0; j < Ki; j++)
        {
            int Lij;
            cin >> Lij;
            Lij--;
            if (l.at(Lij) < 0)
            {
                l.at(Lij) = i;
            }
            else
            {
                tree.unite(i, l.at(Lij));
            }
        }
    }
    cout << ((tree.n_roots == 1) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 1024
S=str(input())
A=int(S[0])
B=int(S[1])
C=int(S[2])
D=int(S[3])
PM=['+','-']

for op1 in PM:
  if op1 == '-':
    b = -B
  else:b = B
  for op2 in PM:
    if op2 == '-':
      c = -C
    else:c = C
    for op3 in PM:
      if op3 == '-':
        d = -D
      else:d = D
      if A+b+c+d==7:
        print(S[0]+op1+S[1]+op2+S[2]+op3+S[3]+'=7')
        exit()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 1; 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;


int main(){
      int n,ans=0;
    cin>>n;
   if(n%1000==0)  cout<<0<<endl;
   else{
   for(int i = 1; i <= 10000; i++){
        int s = i*1000;
        if(s>n){
            ans= s-n;
            break;
        }
    }
    cout<<ans<<endl;
   }

}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

ll ipow(ll a, ll b){
    ll res = 1;
    while(b > 0){
        if(b%2 == 1)res*=a;
        b /= 2;
        a *= a;
    }
    return res;
}

ll f(vector<vector<ll>>& dp, vector<vector<int>>& A, int N, int male, int bits){
    if(dp[male][bits] != -1)return dp[male][bits];
    // cout<<male<<" "<<bits<<endl;
    if(male == N){
        dp[male][bits] = 1;
        return dp[male][bits];
    }
    dp[male][bits] = 0;
    for(int i = 0;i < A[male].size();i++){
        int female = A[male][i];
        if((bits>>female) & 1){
            dp[male][bits] = (dp[male][bits] + f(dp,A,N,male+1,bits-(1<<female))) % MOD;
        }
    }
    return dp[male][bits];
}

int main(){
    int N;cin>>N;
    vector<vector<int>> A(N, vector<int>(0));
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            int a;cin>>a;
            if(a == 1)A[i].push_back(j);
        }
    }
    vector<vector<ll>> dp(N+1,vector<ll>(ipow(2,N),-1));
    cout<<f(dp,A,N,0,(1<<N)-1);
}

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

int main() {
  int N;
  int A = 0;
  string C;
  cin >> N;
  
  for (int i=0; i < N; i++) {
    cin >> C;
    if (C == "Y") {
      A = 1;
    }
  }
  if (A == 0){
    cout << "Three";
  }
  else {
    cout << "Four";
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a ,b ,c ,d ,L ,day;
  scanf( "%d" ,&L );
  day = L;
  scanf( "%d" ,&a );
  scanf( "%d" ,&b );
  scanf( "%d" ,&c );
  scanf( "%d" ,&d );

  while( a > 0 || b > 0 ){
    a = a - c;
    b = b - d;
    day--;
  }

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

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

int main(){
    string frag = "Yes";
    int c[3][3];
    for(int i = 0;i<3;i++){
      for(int j = 0;j<3;j++){
        cin >> c[i][j];
      }
    }
    //a1 = 0を仮定すると,b = c
    int a[3];
    int b[3];
    a[0] = 0;
    b[0] = c[0][0];
    b[1] = c[0][1];
    b[2] = c[0][2];
    a[1] = c[1][1] - b[1];
    a[2] = c[2][2] - b[2];
    for(int i = 0;i<3;i++){
      for(int j = 0;j<3;j++){
        if(a[i]+b[j] != c[i][j]){
          frag = "No";
        }
      }
    }
    cout << frag << endl;
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


vector<ll> unionfindInit(ll n){
    vector<ll> list(n);
    rep(i, n)   list[i] = i;
    return list;
}

ll find(vector<ll>& list, ll x){
    if(list[x] == x)    return x;
    return list[x] = find(list, list[x]);
}

void unionNodes(vector<ll>& list, ll x, ll y){
    x = find(list, x);
    y = find(list, y);
    if(x == y)  return;
    if(x < y) list[y] = x;
    else      list[x] = y;
}

bool sameGroup(vector<ll>& list, ll x, ll y){
    return find(list, x) == find(list, y);
}

int main(){
  ll n, m;
  cin >> n >> m;
  vector<ll> x(m);
  vector<ll> y(m);
  vector<ll> z(m);
  rep(i, m) cin >> x[i] >> y[i] >> z[i];

  auto uf = unionfindInit(n);
  rep(i, m) unionNodes(uf, x[i]-1, y[i]-1);
  rep(i, n) uf[i] = find(uf, i);

  set<ll> st;
  rep(i, n) st.insert(uf[i]);
  cout << st.size() << endl;
  
  
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int N4 = N/1000;
  int N3 = (N-N4*1000)/100;
  int N2 = (N-N4*1000-N3*100)/10;
  int N1 = N-N4*1000-N3*100-N2*10;
  
  if (((N4 == N3) && (N3 == N2))
      || ((N3 == N2) && (N2 == N1))) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
#include<atcoder/all>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

Int n;

int main(){
    cin >> n;
    n *= 2;
    Int ans = n;
    vector<Int> div;
    for(Int i = 1;i*i <= n;i++){
        if(n % i)continue;
        div.push_back(i);
        if(n/i != i)div.push_back(n/i);
    }

    for(auto d:div){
        vector<Int> r = {0, n/d - 1};
        vector<Int> m = {d, n/d};
        auto rem_mod = atcoder::crt(r, m);        
        Int k = rem_mod.first;
        if(k == 0)k += rem_mod.second;
        if(k == 0)continue;
        ans = min(ans, k);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3304
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
//typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(double& x, double y) {
	x = min(x, y);
}

void chmax(double& x, double y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

ll N, K;
ll ans;

void solve() {
	cin >> N >> K;
	while(N > 0) {
		ans++;
		N /= K;
	}
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


Measured memory_bytes: 256