akhauriyash/Code-Regression huggingface dataset:
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
5 7 9
---+/
/+---test
13 7 2
---+/

void main(string[] args) {
  long A, B, C;
  readf(" %d %d %d ", &A, &B, &C);

  (A+B+C <= 21? "win": "bust").writeln;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			double xa1 = in.nextDouble();
			double ya1 = in.nextDouble();
			double xa2 = in.nextDouble();
			double ya2 = in.nextDouble();
			double xb1 = in.nextDouble();
			double yb1 = in.nextDouble();
			double xb2 = in.nextDouble();
			double yb2 = in.nextDouble();
			String result = "NO";
			if (xa1 <= xb2 && xa2 >= xb1 && ya1 <= yb2 && ya2 >= yb1)
				result = "YES";
			System.out.println(result);
		}
	}
}

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

int main()
{
	int m = 0, k = 0;
	unsigned long long n = 0, l = 1, l1 = 0;

	cin >> m >> n;

	while (n > 10000){
		k = (int)log2(n);
		l1 = m;

		for (int i = 0; i < k; i++)
			l1 = (l1 * l1) % 1000000007;

		n = n - (int)pow(2, k);
		l = (l * l1) % 1000000007;
	}

	for (int j = 0; j < n; j++) {
		l *= m;
		l = l % 1000000007;
	}

	cout << l << endl;

	return 0;
}

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

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

int main() {
    fastio;
    int a, b, flag = 1;
    cin >> a >> b;
    string in;
    cin >> in;
    for (int i = 0; i < a + b + 1; ++i) {
        if ((i < a || i > a) && !isdigit(in[i])) flag = 0;
        if (i == a && in[i] != '-') flag = 0;
    }
    cout << (flag == 1 ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cctype>
#include<cstring>
#include<iostream>
#include<vector>
#include<bitset>
#include<ctime>
#include<cmath>
#include<queue>

using namespace std;

#define bomb exit(1)
#define INF 1061109567
#define LINF 4557430888798830399ll
#define pprint(x) print(x),putchar(' ')
#define fprint(x) print(x),putchar('\n')
#define EE(x); struct edge { int nxt,to,w; }e[M << 1]; int head[N],ecnt = 1;\
	void add(int u,int v,ll w = 0) { e[++ecnt].w = w,e[ecnt].to = v,e[ecnt].nxt = head[u];head[u] = ecnt; }\
	void add_edge(int u,int v,ll w = 0) { add(u,v,w),add(v,u,w * x); }
#define ll long long
const double pi = acos(-1);
int mod = 1000000007;
ll Mod(ll x) { return x >= mod ? x - mod : x; }
#define eps 0.0000000001
#define sqr(x) ((x) * (x))
#define iter iterator
#define fi first
#define se second
//#define getchar() (SS == TT && (TT = (SS = BB) + fread(BB,1,1 << 15,stdin),TT == SS) ? EOF : *SS++)
//char BB[1 << 15],*SS = BB,*TT = BB;
ll read()
{
	ll x = 0;int f = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') f = -1;
	for(;isdigit(ch);ch = getchar()) x = x * 10 + (ch ^ 48);
	return x * f;
}
void print(ll x)
{
	if(x < 0) putchar('-'),x = -x;
	if(x > 9) print(x / 10);putchar(x % 10 + '0');
}

const int N = 110;

struct MAX_FLOW
{
	static const int N = 210,M = N * N;
	EE(0);
	int S,T;
	queue<int> q;int dis[N],cur[N];
	bool BFS()
	{
		memset(dis,-1,sizeof(dis));
		q.push(S),dis[S] = 0;
		while(!q.empty())
		{
			int u = q.front();q.pop();
			for(int i = cur[u] = head[u];i;i = e[i].nxt)
			{
				int v = e[i].to;
				if(!~dis[v] && e[i].w) q.push(v),dis[v] = dis[u] + 1;
			}
		}return ~dis[T];
	}
	int DFS(int u,int exp)
	{
		if(u == T) return exp;
		int flow = 0,f;
		for(int &i = cur[u];i;i = e[i].nxt)
		{
			int v = e[i].to;
			if(e[i].w && dis[v] == dis[u] + 1)
			{
				f = DFS(v,min(exp,e[i].w));
				exp -= f,flow += f;
				e[i].w -= f,e[i ^ 1].w += f;
				if(!exp) break;
			}
		}return flow;
	}
	int Dinic()
	{
		int maxflow = 0,f;
		while(BFS()) while(f = DFS(S,INF)) maxflow += f;
		return maxflow;
	}
}G;

int prime[1000010],tot;
bool vis[10000010];
void init(int n)
{
	vis[0] = vis[1] = 1;
	for(int i = 2;i <= n;i++)
	{
		if(!vis[i]) prime[++tot] = i;
		for(int j = 1;j <= tot && i * prime[j] <= n;j++)
		{
			vis[i * prime[j]] = 1;
			if(i % prime[j] == 0) break;
		}
	}
}

int n,a[N];
int L[N << 1],R[N << 1],cntl,cntr;
void push(int x) { if(x & 1) L[++cntl] = x;else R[++cntr] = x; }
int main()
{
	init(10000000);
	n = read();for(int i = 1;i <= n;i++) a[i] = read();sort(a + 1,a + 1 + n);
	for(int i = 1;i <= n;i++)
	{
		if(a[i - 1] + 1 != a[i] || i == 1) push(a[i]);
		if(a[i + 1] - 1 != a[i]) push(a[i] + 1);
	}
	G.S = 0,G.T = cntl + cntr + 1;
	for(int i = 1;i <= cntl;i++) G.add_edge(G.S,i,1);
	for(int i = 1;i <= cntr;i++) G.add_edge(i + cntl,G.T,1);
	for(int i = 1;i <= cntl;i++) for(int j = 1;j <= cntr;j++)
		if(!vis[abs(L[i] - R[j])]) G.add_edge(i,j + cntl,1);
	int maxflow = G.Dinic();
	int ans = maxflow;
	ans += (cntl - maxflow) / 2 * 2 + (cntr - maxflow) / 2 * 2;
	ans += ((cntl - maxflow) & 1) * 3;
	fprint(ans);
}

Measured memory_bytes: 14592
paper=[[-float('inf')]*14]*2+[[-float('inf')]*2+[0]*10+[-float('inf')]*2 for _ in xrange(10)]+[[-float('inf')]*14]*2
while 1:
    try:
        x,y,size=map(int,raw_input().split(","))
        x+=2
        y+=2
        paper[x][y]+=1
        paper[x+1][y]+=1
        paper[x-1][y]+=1
        paper[x][y+1]+=1
        paper[x][y-1]+=1
        if size>=2:
            paper[x+1][y+1]+=1
            paper[x+1][y-1]+=1
            paper[x-1][y+1]+=1
            paper[x-1][y-1]+=1
            if size==3:
                paper[x+2][y]+=1
                paper[x-2][y]+=1
                paper[x][y+2]+=1
                paper[x][y-2]+=1
    except:
        break
ct0=0
maxpaper=0
for i in xrange(14):
    for j in xrange(14):
        if paper[i][j]==0:
            ct0+=1
        if maxpaper<paper[i][j]:
            maxpaper=paper[i][j]
print(ct0)
print(maxpaper)

Measured memory_bytes: 6340
using System;

class Program
{
    static void Main(string[] args)
    {
        int a11 = int.Parse(Console.ReadLine());
        //  int a1 = 0;
        for (int i = 0; i < a11; i++)
        {
            string a = Console.ReadLine();
            Console.WriteLine(a.Replace("Hoshino", "Hoshina"));
        }
    }
}

Measured memory_bytes: 8780
#include<bits/stdc++.h>
#define pii pair<int,int>

using namespace std;

int pr[200005] , pr2[200005];
map<pii,int>mp;

int find(int u)
{
    if(pr[u]==u)return u;
    return pr[u] = find(pr[u]);
}
int find2(int u)
{
    if(pr2[u]==u)return u;
    return pr2[u] = find2(pr2[u]);
}
int main()
{
    int n,m,r;
    cin >> n >> m >> r;
    for(int i=1; i<=n; i++)
    {
        pr[i] = i;
        pr2[i] = i;
    }
    for(int i=0; i<m; i++)
    {
        int u,v;
        cin >> u >> v;
        int a,b;
        a = find(u);
        b = find(v);
        if(a > b)
            swap(a,b);
        pr[a] = b;
    }
    for(int i=0; i<r; i++)
    {
        int u,v;
        cin >> u >> v;
        int a,b;
        a = find2(u);
        b = find2(v);
        if(a > b)
            swap(a,b);
        pr2[a] = b;
    }
    for(int i=1;i<=n;i++)
        mp[{find(i),find2(i)}]++;

    for(int i=1; i<=n; i++)cout << mp[{pr[i],pr2[i]}] << " ";
    cout << endl;
}



Measured memory_bytes: 13568
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int a, b;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> a >> b;
    if (a == b) cout << "Yes" << E;
    else cout << "No" << E;
    //system("pause");
    return 0;
}

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

int main(){
	int n;
	string s;
	cin >> n >> s;

	for(int i=0; i<s.size(); ++i){
		if(s[i]+n > 'Z') s[i] += n-26;
		else s[i] += n;
	}
	cout << s << endl;
}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2];
long double pi = 3.14159265;
#define ld long double
void solve()
{
	ld pi = 6.28318530717958623200;
	pi /= 2;
	ld r; cin >> r;
	cout << setprecision(12) << fixed << pi * 2 * r << endl;

}

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


	cout << setprecision(9) << fixed;
	clock_t z = clock();

	// cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);
	int test = 1;
	// cin >> test;
	while (test--)solve();


}





Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  vector<int> vec(n);
  int ans = 0;
  rep(i, n) {
    cin >> vec[i];
    if ((i+1) % 2 == 1 && vec[i] % 2 == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main(){
  int N, M;cin>>N>>M;
  vll X, Y, Z;
  vi sign={-1,1};

  for (int i=0;i<N;++i){
    ll x,y,z;cin>>x>>y>>z;
    X.push_back(x);
    Y.push_back(y);
    Z.push_back(z);
  }

  ll ans=0;
  ll sx=0;
  ll sy=0;
  ll sz=0;

  for (int s=0;s<2;++s){
    for (int t=0;t<2;++t){
      for (int u=0;u<2;++u){
        vll W;
        for (int i=0;i<N;++i){
          ll w=sign[s]*X[i]+sign[t]*Y[i]+sign[u]*Z[i];
          W.push_back(w);
        }
        sort(W.begin(), W.end(), greater<ll>());
        ll tmp_ans=0;
        for (int i=0;i<M;i++){
          tmp_ans+=W[i];
        }
        if(ans<tmp_ans){ans=tmp_ans;}
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	int N;
	lint C;
	cin >> N >> C;

	vector<lint> x(N), v(N);
	for (int i = 0; i < N; i++) cin >> x[i] >> v[i];

	vector<lint> R(N), L(N), cul_R(N + 1), cul_L(N + 1);
	lint sum = 0;
	for (int i = 0; i < N; i++) {
		sum += v[i];
		R[i] = sum - x[i];
		cul_R[i + 1] = max(R[i], cul_R[i]);
	}
	sum = 0;
	for (int i = N; i --> 0;) {
		sum += v[i];
		L[i] = sum - (C - x[i]);
		cul_L[i] = max(cul_L[i + 1], L[i]);
	}

	lint ans = max(cul_R[N], cul_L[0]);
	for (int i = 0; i < N; i++) {
		ans = max(ans, cul_R[i] + L[i] - (C - x[i]));
		ans = max(ans, cul_L[i + 1] + R[i] - x[i]);
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<long long> dum(N), mountain(N);
    for(int i=0;i<N;i++){
        cin >> dum.at(i);
    }

    long long sign=1, sum=0;
    for(int i=0;i<N;i++){
        sum += sign*dum.at(i);
        sign *= -1;
    }

    for(int i=0;i<N;i++){
        if(i) cout << " ";
        if(i == 0) cout << sum;
        else{
            sum = -(sum - dum.at(i-1)) + dum.at(i-1);
            cout << sum;
        }
    }
    cout << endl;
}

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

#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

//プロトタイプ宣言
void faster(void);
ll gcd(auto , auto);
ll get_digent(auto);
ll POW(auto , auto);
ll vec_max(auto & , string);
ll vec_min(auto & , string);

int main(){
  faster();
  ll n,cnt0=0,cnt4=0;
  cin >> n;
  vl a(n),cnt(n,0);
  rep(i,n) cin >> a[i];
  rep(i,n){
    while(!(a[i]%2)){
      a[i] /= 2;
      cnt[i]++;
    }
  }
  rep(i,n){
    if(cnt[i] == 0) cnt0++;
    if(cnt[i] >= 2) cnt4++;
  }
  if(cnt0+cnt4==n){
    if(cnt0 <= 1 && cnt0 <= cnt4){
      cout << "Yes" << endl;
      return 0;
    }
    if(cnt0 - 1 <= cnt4) cout << "Yes" << endl;
    else  cout << "No" << endl;
  }
  else{
    if(cnt0 <= cnt4) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


























//以下、ライブラリ

//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//ユークリッドの互除法
ll gcd(auto a, auto b) {
  return (b ? gcd(b, a%b) : a);
} 

//桁数取得
ll get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//べき乗計算
ll POW(auto x, auto y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 

//配列内の最大要素の添え字取得or要素取得
ll vec_max(auto &v, string s){
  auto itr = max_element(v.begin(),v.end());
  ll element = *itr;
  ll place = itr - v.begin();
  if(s == "element") return element;
  else if(s == "place") return place;
  else return -1;
}

//配列内の最小要素の添え字取得or要素取得
ll vec_min(auto &v, string s){
  auto itr = min_element(v.begin(),v.end());
  ll element = *itr;
  ll place = itr - v.begin();
  if(s == "element") return element;
  else if(s == "place") return place;
  else return -1;
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int cmap[510][510];
int ax1[250010], ax2[250010], ay1[250010], ay2[250010];
int C;

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

	int H, W;

	cin >> H >> W;

	rep(i, 0, H)rep(j, 0, W)
	{
		cin >> cmap[i][j];
	}

	rep(i, 0, H)rep(j, 0, W - 1)
	{
		if (cmap[i][j] % 2 == 1)
		{
			cmap[i][j]--;
			cmap[i][j + 1]++;
			ax1[C] = j + 1, ax2[C] = j + 2, ay1[C] = ay2[C] = i + 1;
			C++;
		}
	}
	rep(i, 0, H - 1)
	{
		if (cmap[i][W - 1] % 2 == 1)
		{
			cmap[i][W - 1]--;
			cmap[i + 1][W - 1]++;
			ax1[C] = ax2[C] = W, ay1[C] = i + 1, ay2[C] = i + 2;
			C++;
		}
	}

	cout << C << endl;
	rep(i, 0, C)
	{
		cout << ay1[i] << " " << ax1[i] << " " << ay2[i] << " " << ax2[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 11008
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include<bitset>
#include <iomanip>

using namespace std;
#define modd 1000000007


typedef pair<long long, long long> pl;



#define ll long long




/*
class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d, e, H, W, L;
long long A[200005] = {};
long long B[5005][5] = {};
long long C[205][205] = {};
long long x[200005] = {};
long long y[200005] = {};
bool f, ff;
string S[2];
set <long long>sll;
pl bufpl;
vector <long long>vl[3];
vector <pl>vpl;
vector <string> vs;
set<ll> llset;

/*struct ST
{
	long long Kati;
	int bangou;

	bool operator<(const ST& another) const
	{
		return Kati < another.Kati;//比較
	};

};



vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/


long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}




int main() {

	cin >> N;


	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
	}

	d = 0;
	e = 0;

	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			a = x[j] - x[i];
			b = y[j] - y[i];

			for (int p = 0; p < N; p++) {
				for (int q = 0; q < N; q++) {
					if (x[p] - a == x[q] && y[p] - b == y[q]) {
						d++;
					}
				}
			}

			if (d > e) {
				e = d;
			}
			d = 0;

		}
	}

	cout << N - e << endl;

	return 0;

}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a[5],s=0;for(int i=0;i<5;++i) {
	cin>>a[i]  ;
	if(a[i]==0) s=i;	
}
cout<<s+1<<"\n";
    
    return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<set>
#include<queue>
#include<string>
#include<sstream>
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<cstdio>
using namespace std;
int main()
{
	int n;
	int x1, x2;
	cin >> n >> x1 >> x2;
	printf("%d", (n - x1 + 1)*(n - x2 + 1));
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <math.h>
#include <cassert>
#include <unordered_map>
#include <chrono>
#include <random>
#include <ctime>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const ld PI = 3.14159265358979323846;
const ll MOD = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll INF = 1e16;



int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	srand(time(0));
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int k;
	cin >> k;
	vector<bool> used(k);
	int st = 0, cnt = 0;
	while (true) {
		st = (st * 10 + 7) % k;
		cnt++;
		if (!st) {
			cout << cnt;
			return 0;
		}
		if (used[st]) {
			cout << -1;
			return 0;
		}
		used[st] = 1;
	}
}

Measured memory_bytes: 3736
import numpy as np

n = int(input())
A = np.array(list(map(int, input().split())))
mod = 10 ** 9 + 7

ans = 0
for i in range(64):
    tmp = (A >> i) & 1
    x = np.count_nonzero(tmp)
    x *= n - x
    ans += pow(2, i, mod) * x % mod

print(ans % mod)


Measured memory_bytes: 48808
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1000000007
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define INF 1e18
#define N 100100
typedef pair<ll,ll> pll;
ll power(ll a,ll b)
{
    if(b==1)return a;
    if(b==0)return 1;
    ll temp=power(a,b/2);
    ll ans=temp*temp;
    if(b&1)
        ans*=a;
    return ans;
}
ll power(ll a,ll b,ll p)
{
    a=a%p;
    if(b==1)return a;
    if(b==0)return 1;

    ll temp=power(a,b/2,p);
    ll ans=(temp*temp)%p;
    if(b&1)
        ans=(a*ans)%p;
    return ans%p;
}
ll inv(ll a,ll m)
{
    return power(a,m-2,m);
}
//code begins
map<ll,list<ll>> adj;
ll height[100001];
ll vis[100001];
ll deg[100001];
ll dis[100001];
map<pll,bool> vispair;
void bfs(ll source)
{
    vis[source]=1;
    queue<ll> q;
    q.push(source);
    while(q.size()!=0)
    {
        ll top=q.front();q.pop();
        for(auto it:adj[top])
        {

            ll a=top,b=it;
            if(a>b)swap(a,b);
            if(vispair.count({a,b})==0)
            {
                if(height[a]>height[b])dis[a]++;
                else if(height[a]<height[b])dis[b]++;
                vispair[{a,b}]=1;
            }
            if(vis[it]==0)
            {
                vis[it]=1;
                q.push(it);
            }
        }
    }
}
void print()
{
    for(auto it:adj)
    {
        cout<<it.first<<" : ";
        for(auto ij:it.second)
            cout<<ij<<" ";
        cout<<endl;
    }
}
void solve()
{
    ll n,m;cin>>n>>m;
    set<pll> s;
    for(ll i=1;i<=n;i++)
        cin>>height[i];
    for(ll i=1;i<=m;i++)
    {
        ll a,b;cin>>a>>b;
        if(a>b)swap(a,b);
        s.insert({a,b});
    }
    for(auto it:s)
    {
        adj[it.first].pb(it.second);
        adj[it.second].pb(it.first);
        deg[it.first]++;deg[it.second]++;
    }
//    print();
    for(ll i=1;i<=n;i++)
        if(vis[i]==0)
            bfs(i);
    ll ans=0;
    for(ll i=1;i<=n;i++)
        if(dis[i]==deg[i])
            ans++;
    cout<<ans<<endl;
}
signed main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 33268
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))

def is_ok(x,a,k):
    b = 0
    for ai in a:
        b += math.ceil(ai/x)
        b -= 1
    if b <= k:
        return True

def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid,a,k):
            ok = mid
        else:
            ng = mid
    return ok


print(meguru_bisect(0,max(a)))

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

#print(N, K, A)
A2 = [0] * N
for i in range(len(A)):
    A2[A[i]-1] += 1

A2.sort(reverse = True)
#print(A2)
count = 0
for i in range(K):
    count += A2[i]
print(N - count)

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int h,w,x,y;
  cin >> h >> w >> x >> y;
  if(h*w%2==1&&(x+y)%2==1){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
   using namespace std;
   using pii = pair<int, int>;
   using ll = long long;
   #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
   const ll MOD = 1000000007;
   const ll INFL = (1LL << 60);
   const int INFI = (1 << 30);

   vector<pair<ll, ll>> pf(ll n) {
      vector<pair<ll, ll>> res;
      for (ll p = 2; p * p <= n; p++) {
          if (n % p != 0) continue;
          int num = 0;
          while (n % p == 0) {
             n /= p;
             num++;
          }
          res.push_back(make_pair(p, num));
      }
      if (n != 1) res.push_back(make_pair(n, 1));
      return res;
  }

   int main() {
     ll N; cin >> N;
     ll ans = 0;

     vector<pair<ll, ll>> pf_n;
     pf_n = pf(N);

     for (pair<ll, ll> p: pf_n) {
       ll tmp = 0;
       while(1) {
         if (tmp * (tmp + 1) / 2 <= p.second) {
           tmp++;
         }
         else {
           ans += tmp - 1;
           break;
         }
       }
     }

     cout << ans << endl;
   }


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int n,a,b,p;
    vector<int> count(3,0);
    cin >> n >> a >> b;
    rep(i, n){
        cin >> p;
        if (p <= a) {
            ++count[0];
        }else if(p <= b){
            ++count[1];
        }else{
            ++count[2];
        }
    }
    cout << min({count[0],count[1],count[2]}) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

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

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >>c;
  REP(i, 1e7)
  {
    if (a % 2 || b % 2 || c % 2)
    {
      cout << i << endl;
      return 0;
    }
    int aa, bb, cc;
    aa = b/2 + c/2;
    bb = a/2 + c/2;
    cc = a/2 + b/2;
    a = aa; b = bb; c = cc;
  }
  cout << -1 << endl;

  return 0;
}

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

// @@ !! LIM(f:nnDivCeil)
// --> f:nnDivCeil
// ---- inserted function nnDivCeil from util.cc
// Natural Number Division and Ceiling
ll nnDivCeil(ll x, ll y) {
  return (x + (y - 1)) / y;
}
// ---- end nnDivCeil
// @@ !! LIM  -- end mark --

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll A, B; cin >> A >> B;

  ll x = max(10*B, nnDivCeil(100*A, 8));
  if (x < 10 * B + 10 && 8 * x < 100 * (A + 1)) {
    cout << x << endl;
  }else {
    cout << -1 << endl;
  }

  return 0;
}



Measured memory_bytes: 256
a,b,m=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
XYC=[]
for _ in range(m):
    x,y,c=map(int,input().split())
    XYC.append((x-1,y-1,c))
ans=min(A)+min(B)
for x,y,c in XYC:
    ans=min(ans,A[x]+B[y]-c)
print(ans)

Measured memory_bytes: 83052
/* 
Mohit Dhattarwal
*/
#include <bits/stdc++.h>
 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foreach(it, v) for(auto it=(v).begin(); it != (v).end(); ++it)
#define gcd(a,b) __gcd(a,b)
 
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define filewr() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
 
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,ll> psl;
typedef pair<ll,string> pls;
 
template<typename S, typename T> 
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.fi<<", "<<p.se<<')';return out;}
 
template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}
 
template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
 
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
 
const ld PI = 3.1415926535897932384626433832795;
 
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> indexed_set;

void solve()
{
	ll n;
	cin>>n;
	string ans = "";
	while(n>0)
	{
		ll num = n%26;
		n/=26;
		if(num==0)
		{
			ans+="z";
			n--;
		}
		else
		{
			ans+=(num-1)+'a';
		}
	}
	reverse(ans.begin(), ans.end());
	cout<<ans<<'\n';
}

int main(){
	fastio();
	ll t;
	t=1;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3604
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException{
		Scanner stdIn = null;
		char now = 'A';
		
		try{
			stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
			while( stdIn.hasNext() ){
				String str = stdIn.next();
				if( str.charAt(0) == now ){
					now = str.charAt(2);
				} else if( str.charAt(2) == now ){
					now = str.charAt(0);
				}
			}
			System.out.println(now);
		} finally {
			if( stdIn != null ){
				stdIn.close();
			}
		}
	}
}

Measured memory_bytes: 12000
n = int(input())
card = [input().split() for _ in range(n)]
t = 0
h = 0
for i in range(n):
    if card[i][0] == card[i][1]:
        t += 1
        h += 1
    elif card[i][0] < card[i][1]:
        h += 3
    elif card[i][0] > card[i][1]:
        t += 3
print(f'{t} {h}')


Measured memory_bytes: 5728
import itertools

N,M,R = map(int, input().split())
r = map(int, input().split())
l = [[1e9 for i in range(N+1)] for i in range(N+1)]

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

for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            t = l[i][k] + l[k][j]
            if l[i][j] > t: l[i][j] = t

ans = 1e9
for a in itertools.permutations(r):
    s = 0
    for i,j in zip(a[:-1],a[1:]):
        s += l[i][j]
    if ans > s: ans = s

print(ans)


Measured memory_bytes: 54872
#include <stdio.h>
int main(void)
{
    char s[110000],t[55000];
    scanf("%s", s);
    int ind=0;
    for(int i=0;s[i]!='\0';i+=2){
        t[ind]=s[i];
        ind++;
    }
    printf("%s\n",t);
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    double a,b,c,ans;
    cin>>a>>b>>c;
    ans=(b-1)/a;
    if(c!=0){ans=((a-c)*2*(b-1))/(a*a);}
  cout<<setprecision(20)<<ans<<endl;
}

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

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define INF 1000000000
#define PI 3.14159265358979323846

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

// N, E, S, W
const int dx[4] = { -1, 0,  1,  0 };
const int dy[4] = { 0, 1,  0, -1 };

typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<LL> vll;

struct node { int p, l, r; };

node N[30];
vi A(30);
//==============================================

int preorderTreeWalk(int u) {
	if (u == -1) return 0;

	cout << " " << u;
	preorderTreeWalk(N[u].l);
	preorderTreeWalk(N[u].r);
}

int inorderTreeWalk(int u) {
	if (u == -1) return 0;

	inorderTreeWalk(N[u].l);
	cout << " " << u;
	inorderTreeWalk(N[u].r);
}

int postorderTreeWalk(int u) {
	if (u == -1) return 0;

	postorderTreeWalk(N[u].l);
	postorderTreeWalk(N[u].r);
	cout << " " << u;
}

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

	int n;
	cin >> n;

	REP(i, n) {
		N[i].p = N[i].l = N[i].r = -1;
	}

	int id, inputLeft, inputRight;
	REP(i, n) {
		cin >> id >> inputLeft >> inputRight;

		N[id].l = inputLeft;
		N[id].r = inputRight;

		if (inputLeft != -1) N[inputLeft].p = id;
		if (inputRight != -1) N[inputRight].p = id;
	}

	int root;
	REP(i, n) if (N[i].p == -1) root = i;

	cout << "Preorder" << "\n";
	preorderTreeWalk(root); cout << "\n";

	cout << "Inorder" << "\n";
	inorderTreeWalk(root); cout << "\n";

	cout << "Postorder" << "\n";
	postorderTreeWalk(root); cout << "\n";
	return 0;
}

Measured memory_bytes: 3232
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}
 
 
int main(void){
	int n,m,i,j,k;
	int a,b,c;
	int ans = 99999;
	cin >> n>>a>>b>>c;
	int l[10];
	rep(i,n){
		cin>>l[i];
	}
	int g[10];
	for(i=0;i<256*256;i++){
		k = i;
		for(j=0;j<8;j++){
			g[j] = k%4;
			k = k/4;
		}
		int sa,sb,sc;
		sa=0;
		sb=0;
		sc=0;
		int memo = -30;
		rep(j,8){
			if(g[j] == 0){
				sa+=l[j];
				memo += 10;
			}
		}
		rep(j,8){
			if(g[j] == 1){
				sb+=l[j];
				memo += 10;
			}
		}
		rep(j,8){
			if(g[j] == 2){
				sc+=l[j];
				memo += 10;
			}
		}
		if(sa==0 || sb==0 || sc==0){
			continue;
		}
		memo += abs(a-sa) + abs(b-sb) + abs(c-sc);
		ans = min(ans,memo);
	}
 	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

int main()
{
  int N;
  cin >> N;
  double ans = 0;
  for (int i = 0; i < N; i++)
  {
    double x;
    string v;
    cin >> x >> v;
    if (v == "JPY")
      ans += x;
    else
      ans += x * 380000;
  }
  cout << fixed << setprecision(8) << ans << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
 
static class MainClass {
 
  public static void Main (string[] args) {
    var N = Console.ReadLine();
    var temp2 = Console.ReadLine().Split(' ').Select(long.Parse);
    var T = temp2.ElementAt(0);
    var A = temp2.ElementAt(1);
    var list = Console.ReadLine().Split(' ').Select(long.Parse);
  
    var l = list.Select(x => Math.Abs(A - (T - x * 0.006))).ToList();
    
    var ans = l.IndexOf(l.Min()) + 1;

    Console.WriteLine(ans);
 
  }
  
}

Measured memory_bytes: 13408
N = int(input())
A = list(map(int, input().split()))
ans =[]

for _ in range(N):
  ans.append(-1)

for i in range(N,0,-1):
  C = i*2
  BALL = A[i-1]
  while C <= N:
    BALL = BALL ^ ans[C-1]
    C += i
  ans[i-1] = BALL 

print(ans.count(1))
ans2 = []
for i in range(N):
  if ans[i] == 1:
    ans2.append(i+1)

L=[str(a) for a in ans2]
L=" ".join(L)
print(L)

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

using namespace std;
int main()
{
  int K, S;
  cin >> K >> S;
  int count = 0;

  for (int x = 0; x <= K; x++) {
    for (int y = 0; y <= K; y++) {
      if(S >= x + y && K >= S - x - y) ++count;
    }
  }

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
//go:generate echo "https://atcoder.jp/contests/abc099/tasks/abc099_c"
package main

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

type scanner struct{ *bufio.Scanner }

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *scanner) IntSlice(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func (s *scanner) IntSlice2(l, n int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := 0; i < n; i++ {
		sl[i] = s.Int()
	}
	return sl
}

func ipow(x, n int) int {
	if n == 0 {
		return 1
	}
	a := ipow(x, n>>1)
	a *= a
	if n&1 != 0 {
		a *= x
	}
	return a
}

func solve(n int) int {
	t := make([]int, n+1, n+1)
	for i := range t {
		t[i] = math.MaxInt64
	}
	t[0] = 0
	for i := 0; i < n; i++ {
		if v := t[i] + 1; v < t[i+1] {
			t[i+1] = v
		}
		for _, k := range []int{6, 9} {
			j := 1
			p := i + ipow(k, j)
			for p <= n {
				if v := t[i] + 1; v < t[p] {
					t[p] = v
				}
				j++
				p = i + ipow(k, j)
			}
		}
	}
	return t[n]
}

func main() {
	scan := newScanner(os.Stdin)
	n := scan.Int()
	fmt.Println(solve(n))
}


Measured memory_bytes: 2604
n,m=map(int,input().split())
li=[]
if n==1:
    score="0"
else:
    score="1"+"0"*(n-1)
for i in range(m):
    s,c=map(int,input().split())
    if n!=1 and s==1 and c==0:
        print("-1")
        quit()
    li.append([s,c])
    for j in range(len(li)):
        if li[j][0]==s and li[j][1]!=c:
            print("-1")
            quit()
    score=score[:s-1]+str(c)+score[s:]
print(int(score))

Measured memory_bytes: 9224
from collections import deque
import bisect

N = int(input())
A = [int(input()) for _ in range(N)]

colors = deque([A[0]])
for a in A[1:]:
    i = bisect.bisect_left(colors, a)
    if i != 0:
        colors[i - 1] = a
    else:
        colors.appendleft(a)

print(len(colors))


Measured memory_bytes: 8828
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

print(4-2*input().count('-'))


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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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

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

    vector<int> a(N);
    rep(i,N) cin >> a[i];
    set<int> used;
    
    used.insert(1);
    int next = a[0];
    int ans = 1;
    while( next != 2 )
    {
        if( used.find(next) != used.end() )
        {
            cout << -1 << endl;
            return 0;
        }
        used.insert(next);
        next = a[next-1];
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5376
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = 0
for i in b:
    ans += i
for i in range(len(a)-1):
    if a[i+1]-a[i] == 1:
        ans += c[a[i]-1]
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int n;
int main(){
    cin>>n;
    vector<int> a(n+1,0),b(n+1,0),c(n+1,0);
    rep(i,n) cin>>a[i+1]>>b[i+1]>>c[i+1];
    //cout<<"ccc"<<endl;
    int dp[100010][3];
    dp[0][1]=a[0];
    dp[1][1]=b[0];
    dp[2][1]=c[0];
    for(int j=1;j<n+1;j++){
        for(int i=0;i<3;i++){
            for(int k=0;k<3;k++){
                if(i==k) continue;
                if(k==0) dp[k][j+1]=max(dp[k][j+1],dp[i][j]+a[j]);
                if(k==1) dp[k][j+1]=max(dp[k][j+1],dp[i][j]+b[j]);
                if(k==2) dp[k][j+1]=max(dp[k][j+1],dp[i][j]+c[j]);
            }
        }
    }
    int ans=0;
    for(int i=0;i<3;i++){
        if(dp[i][n+1]>ans) ans=dp[i][n+1];
    }
    //cout<<"aaa"<<endl;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
def examA():
    N = I()
    ans = (10000 - N)%1000
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

int main(){
	int n, m, k;
	cin >> n >> m >> k;
	vector<int> a(n);
	vector<int> b(m);

	rep(i, n) cin >> a.at(i);
	rep(i, m) cin >> b.at(i);

	int j = m;
	int ans = 0;
	ll m_total = 0;
	rep(i, m) m_total += b.at(i);

	rep(i, n+1){
		while(0 < j && k < m_total){
			j--;
			m_total -= b.at(j);
		}
		if(k < m_total) break;
		ans = max(ans, i+j);
		if(i == n) break;
		m_total += a.at(i);
	}

	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 4844
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t A,B,n,m,k,j,ans=0;
  cin >> n >> m >> k;
  int64_t a[n+1],b[m+1];
  a[0]=0,b[0]=0;
  for(int64_t i=1;i<=n;i++){
    cin >> a[i];
    a[i]+=a[i-1];
  }
  for(int64_t i=1;i<=m;i++){
    cin >> b[i];
    b[i]+=b[i-1];
  }
  j=m;
  for(int i=0;i<=n;i++){
    if(k>=a[i]){
      int64_t Left=0,Right=m+1;
      while(Right-Left>1){
        int64_t middle=(Left+Right)/2;
        if(b[middle]>k-a[i])Right=middle;
        else Left=middle;
      }
      ans=max(ans,i + Left);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 6744
#include<bits/stdc++.h>
using namespace std;
int n,m;
bool bz[13],ispair[13][13];
string List1[13],row[13],a[13];
bool check(){
    for (int i=1;i<=m;i++)List1[i].clear();
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
            List1[j]+=row[i][j-1];
    bool bz=(m&1);
    for (int i=1;i<=m;i++)
        if (List1[i].size()){
            string s=List1[i];
            reverse(List1[i].begin(),List1[i].end());
            for (int j=i+1;j<=m;j++)
                if (List1[j].size()){
                    if (List1[i]==List1[j]){
                        List1[j].clear();
                        List1[i].clear();
                        break;
                    }
                }
            if (List1[i].size()){
                if (!bz)return 0;
                if (List1[i]!=s)return 0;
                bz=0;
                List1[i].clear();
            }
        }
    return 1;
}
bool dfs(int x,int sum){
    if (x>(n+1)/2){
        return check();
    }
    if (sum==1){
        for (int i=1;i<=n;i++)
            if (!bz[i]){
                row[x]=a[i];
                bz[i]=1;
                if (dfs(x+1,sum-1))return 1;
                bz[i]=0;
            }
    }else{
        for (int i=1;i<=n;i++)
            if (!bz[i])
                for (int j=i+1;j<=n;j++)
                    if (ispair[i][j]&&!bz[j]){
                        bz[i]=bz[j]=1;
                        row[x]=a[i];
                        row[n-x+1]=a[j];
                        if (dfs(x+1,sum-2))return 1;
                        bz[i]=bz[j]=0;
                    }
    }
    return 0;
}
bool check(string a,string b){
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    return a==b;
}
int main(){
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    for (int i=1;i<n;i++)
        for (int j=i+1;j<=n;j++)
            if (check(a[i],a[j]))ispair[i][j]=ispair[j][i]=1;
    dfs(1,n)?cout<<"YES":cout<<"NO";
    return 0;
}

Measured memory_bytes: 256