akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;


int N;
int x[100002],y[100002],t[100002];


int main(){
    cin>>N;
    t[0]=x[0]=y[0]=0;
    rep(i,N) cin>>t[i]>>x[i]>>y[i];
    int dt,dx,dy;
    bool f=true;
    Rep(i,N){
        dt=t[i+1]-t[i];
        dx=abs(x[i+1]-x[i]);
        dy=abs(y[i+1]-y[i]);
        if(dx+dy>dt || ((dt-dx-dy)%2)==1){
            f=false;
        }
    }
    if(f){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;


    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>

int main() {
	int t;
	std::cin >> t;
	std::vector<int> space;
	space.reserve(100000);

	for (int i = 0; i < t; ++i) {
		int n, k;
		std::cin >> n >> k;
		if (k >= n) {
			//テゥツ?ゥテ・ツスツ禿」ツ?ォテ、ツクツ?・ツ崢榲・ツ?・テ・ツ環崚」ツ?凖」ツつ?
			for (int j = 0; j < n; ++j)
				std::cin >> k;
			std::cout << 0 << std::endl;
			continue;
		}

		space.resize(n - 1);
		int before_pos, road_size, first_pos;
		std::cin >> before_pos;
		first_pos = before_pos;
		for (int j = 1; j < n; ++j) {
			int new_pos;
			std::cin >> new_pos;

			if (j == n - 1)
				road_size = new_pos;

			space[j - 1] = new_pos - before_pos;
			before_pos = new_pos;
		}

		std::sort(space.begin(), space.end(), std::greater<int>());

		std::cout << road_size - first_pos - std::accumulate(space.begin(), space.begin() + k - 1, 0) << std::endl;

		space.clear();
	}
}

Measured memory_bytes: 3056
#include<bits/stdc++.h>
using namespace std;
long long x[1000010],y[1000010];
#define int long long
signed main(){
  
  cin.tie(0);
  ios::sync_with_stdio(false);

  for(int i=0; i<3; i++) cin>>x[i];
  sort(x,x+3);
  if(x[0]+x[1]==x[2]) cout<<"Yes"<<'\n';
  else cout<<"No"<<'\n';
}


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

struct cod {
  int x, y;
};

long long n, u, v, m;
string res[3] = {"USAGI", "NEKO", "DRAW"};
vector<long long> mv;
map<long long, cod> mp[2];
map<long long, long long> row[2], col[2], sum[2], diff[2];

int solve();

int main() {
  cin >> n >> u >> v >> m;
  for(int t = 0; t < 2; ++t)
    for(int i = 0; i < n; ++i)
      for(int j = 0; j < n; ++j) {
        int x;
        cin >> x;
        mp[t][x] = {i, j};
      }
  mv.resize(m);
  for(int i = 0; i < m; ++i) cin >> mv[i];
  cout << res[solve()] << endl;
  return 0;
}

int solve() {
  long long cnt[2] = {0};
  for(int i = 0; i < m; ++i) {
    for(int t = 0; t < 2; ++t)
      if(mp[t].find(mv[i]) != mp[t].end()) {
        cod now = mp[t][mv[i]];
        if(++row[t][now.x] == n) ++cnt[t];
        if(++col[t][now.y] == n) ++cnt[t];
        if(++sum[t][now.x + now.y] == n) ++cnt[t];
        if(++diff[t][now.x - now.y] == n) ++cnt[t];
        if(n == 1) cnt[t] = min(cnt[t], 1LL);
      }
    if(cnt[0] >= u && cnt[1] >= v) return 2;
    if(cnt[0] >= u) return 0;
    if(cnt[1] >= v) return 1;
  }
  return 2;
}


Measured memory_bytes: 21332
def array_integer(a)
	0.upto(a.count) {|x|
		a[x] = a[x].to_i
	}
	return a
end

deck = Hash.new { |h, k| h[k] = []}
["S", "H", "C", "D"].each {|suit|
	1.upto(13) {|num|
		deck[suit][num] = false
	}
}

n = STDIN.gets
n = n.to_i

1.upto(n) {|i|
	suit,num = STDIN.gets.split(" ")
	num = num.to_i
	deck[suit][num] = true
}

["S", "H", "C", "D"].each {|suit|
	1.upto(13) {|num|
		if deck[suit][num] == false then
			print suit, " ", num, "\n"
		end
	}
}



Measured memory_bytes: 6868
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array)
#define inin freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);


int main(){
 IOS
    ll n,k;
    cin>>n>>k;
    auto compare=[](pair<ll,ll> a, pair<ll,ll> b) {
        return a.second > b.second;
    };
    std::vector<pair<ll,ll>> v;
    ll aa,bb;
    fo(i,n){
        cin>>aa>>bb;
        v.pb({aa,bb});

    }
    sort(all(v),compare);
    vector<pair<ll,ll>> v2;
    vector<pair<ll,ll>> v3;
    map<ll,ll> mp;
    ll tmp=0;
    fo(i,k){
        tmp+=v[i].second;
        mp[v[i].first]++;
        v2.pb({v[i].first,v[i].second});

    }
    FOR(i,k,n-1){
         v3.pb({v[i].first,v[i].second});

    }
    tmp+=(sz(mp)*sz(mp));
    auto compare2=[](pair<ll,ll> a, pair<ll,ll> b) {
        return a.second < b.second;
    };
    sort(all(v2),compare2);
    sort(all(v3),compare);
    ll main_p=0;
    ll ans=tmp;
    //dbg(tmp);
    ll sec_p=0;
    while(true){
        if(!(main_p<sz(v2))||!(sec_p<sz(v3))) break;

        while(mp[v2[main_p].first]==1){
            main_p++;
        }

        if(!(main_p<sz(v2))||!(sec_p<sz(v3))) break;

        while((mp.count(v3[sec_p].first))) sec_p++;

        if(!(main_p<sz(v2))||!(sec_p<sz(v3))) break;

        tmp=tmp-v2[main_p].second+v3[sec_p].second;
        //dbg2(v2[main_p].first,v3[sec_p].first);
        tmp-=(sz(mp)*sz(mp));
        mp[v2[main_p].first]--;
        mp[v3[sec_p].first]++;
        main_p++;
        sec_p++;
        tmp+=(sz(mp)*sz(mp));
        ans=max(ans,tmp);



    }
    cout<<ans<<endl;




}

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

void Main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int approve = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] % 2 == 0) {
      if(a[i] % 3 == 0 || a[i] % 5 == 0) continue;
      else {
        approve = 0;
        break;
      }
    }
  }
  if (approve) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
}

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


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }
    int N;
    int[] ar;
    String s;
    HashMap<String, Integer> map = new HashMap<>();

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        N = sc.nextInt();
        s = sc.next();
        ar = new int[N];
        for (int i = 0; i < N; i++) {
            ar[i] = s.charAt(i) - '1';
        }

        long cnt1 = 0;
        long cnt2 = 0;
        boolean exists = false;
        for (int i = 0; i < N; i++) {
            exists |= ar[i] == 1;
            if (ar[i] == 1 && ((N - 1) & i) == i) {
                cnt1++;
            } else if (ar[i] == 2 && ((N - 1) & i) == i)  {
                cnt2++;
            }
        }

        debug(cnt1, cnt2);

        if (cnt1 % 2 == 1) {
            out.println(1);
        } else {
            if (exists) {
                out.println(0);
            } else if (cnt2 % 2 == 1) {
                out.println(2);
            } else {
                out.println(0);
            }
        }


        out.flush();
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}

Measured memory_bytes: 38356
#define NDEBUG
#include <bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof a)
#define mcpy(a,b) memcpy(a,b,sizeof b)
#define xx first
#define yy second
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define pii pair<int,int> 
#define lb(x) ((x)&(-(x)))
#define dalao 1000000007
#define inf 0x3f3f3f3f
#define N 200005
using namespace std;
typedef long long ll;
int n,K,a[N],b[N],mi[N<<2];
ll s,l[N],r[N],x[N],num,f[N],tot,ans=1ll*inf*inf;
inline void modify(int x,int l,int r,int L,int R,int v){
	if(l>r)return;
	if(l==L&&r==R){mi[x]=v;return;}
	int mid=L+R>>1;
	if(r<=mid)modify(x<<1,l,r,L,mid,v);
	else if(l>mid)modify(x<<1|1,l,r,mid+1,R,v);
	else modify(x<<1,l,mid,L,mid,v),modify(x<<1|1,mid+1,r,mid+1,R,v);
}
inline int ask(int x,int p,int l,int r){
	if(l==r)return mi[x];
	int mid=l+r>>1;
	if(p<=mid)return min(ask(x<<1,p,l,mid),mi[x]);
	return min(ask(x<<1|1,p,mid+1,r),mi[x]);
}
int main(){
	scanf("%d%d",&n,&K);
	for(int i=1;i<=n;i++)scanf("%d%d",&a[i],&b[i]),tot+=a[i]<<1;
	for(int i=1;i<=n;i++){
		if(b[i]==1&&a[i]*2>K)return puts("-1"),0;
		if(b[i]==1)l[i]=s,r[i]=((s-2*a[i])%K+K)%K,x[++num]=l[i],x[++num]=r[i];
		else l[i]=0,r[i]=K-1;
		s=(s-2*a[i]%K+K)%K;
//		cout<<l[i]<<" "<<r[i]<<endl;
	}
	sort(x+1,x+1+num),num=unique(x+1,x+1+num)-x-1;
	for(int i=1;i<=n;i++)
		l[i]=lower_bound(x+1,x+1+num,l[i])-x,r[i]=lower_bound(x+1,x+1+num,r[i])-x;
	for(int i=1;i<=(num<<2);i++)mi[i]=n+1;
	for(int i=n;i;i--){
		int t=ask(1,l[i],1,num);
		if(t^n+1)f[i]=f[t]+(x[l[t]]-x[l[i]]+K)%K;
		if(l[i]<=r[i])modify(1,r[i]+1,num,1,num,i),modify(1,1,l[i]-1,1,num,i);
		else modify(1,r[i]+1,l[i]-1,1,num,i);
//		cout<<l[i]<<" "<<r[i]<<" "<<t<<" "<<f[i]<<endl;
	}
	for(int i=1;i<=num;i++){
		int t=ask(1,i,1,num);
		if(t<=n)ans=min(ans,f[t]+((x[l[t]]-x[i])%K+K)%K);
		else ans=0;
	}
	if(ans>=1ll*inf*inf)puts("-1");
	else cout<<ans+tot;
	return 0;
}

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

using namespace std;

int h, w, a, b;

int main() {
  cin >> h >> w >> a >> b;
  for (int i = 0; i < h; i++) {
    for (int k = 0; k < w; k++) {
      if (i < b) {
        if (k < a) cout << 0;
        else cout << 1;
      } else {
        if (k < a) cout << 1;
        else cout << 0;
      }
      // if (k < w - 1) cout << " ";
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,Q;
    cin >> N >> Q;
    vector<vector<int>> g(N);
    vector<ll> ans(N);
    vector<bool> v(N);
    rep(i,N-1){
        int a,b;
        cin >> a >> b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    rep(i,Q){
        int p,x;
        cin >> p >> x;
        p--;
        ans[p]+=x;
    }
    queue<int> q;
    q.push(0);
    v[0] = 1;
    while(!q.empty()){
        int now = q.front();q.pop();
        for(int i=0;i<g[now].size();i++){
            int next = g[now][i];
            if(v[next])continue;
            v[next] = 1;
            q.push(next);
            ans[next] += ans[now];
        }
    }
    for(auto x:ans)cout << x << " ";
}


Measured memory_bytes: 16372
def r(x1, y1, x2, y2, x3, y3):
    return x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2) > 0

while True:
    try:
        line = input()
    except:
        break

    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.strip().split())

    abc = r(x1, y1, x2, y2, x3, y3)
    pab = r(xp, yp, x1, y1, x2, y2)
    pbc = r(xp, yp, x2, y2, x3, y3)
    pca = r(xp, yp, x3, y3, x1, y1)

    print('YES' if abc == pab == pbc == pca else 'NO')

Measured memory_bytes: 7440
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

LL N, K;

int main() {
	cin >> N >> K;
	if (2 * K - 1 > N) {
		cout << -1 << endl;
		return 0;
	}
	vector<pair<int, int>>vec;
	for (int i = 0; i < N / 2; ++i) {
		vec.push_back({ K + N + i,K + N - 1 - (N % 2) - i * 2 });
	}
	for (int j = N / 2; j < N; ++j) {
		int jj = j - N / 2;
		vec.push_back({ K + jj * 2,K + N + N - 1 - jj });
	}
	sort(vec.begin(), vec.end(), [&](const pair<int, int>& p1, const pair<int, int>& p2) {return p1.first + p1.second < p2.first + p2.second; });
	for (int i = 0; i < N; ++i) {
		cout << vec[i].first << " " << vec[i].second << " " << K + N + N + i << endl;
	}
	return 0;
}

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

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new PrintStream(System.out));
        StringTokenizer st=new StringTokenizer(f.readLine());
        int n=Integer.parseInt(st.nextToken());
        long k=Integer.parseInt(st.nextToken());
        long[]arr=new long[n];
        st=new StringTokenizer(f.readLine());
        for(int i=0;i<n;i++){
            arr[i]=Integer.parseInt(st.nextToken());
        }
        long ans=Long.MAX_VALUE;
        long[]min=new long[n];
        Arrays.fill(min,Long.MAX_VALUE);
        for(int j=0;j<n;j++){
            long sum=0;
            for(int i=0;i<n;i++){
                int nexidx=i-j;
                nexidx+=n;
                nexidx%=n;
                min[i]=Math.min(min[i],arr[nexidx]);
                //sum of all i-k
                sum+=min[i];
            }
            ans=Math.min(ans,k*j+sum);

        }
        System.out.print(ans);
        f.close();
        out.close();
    }
}
class pair implements Comparable <pair>{
    int num;
    int idx;

    public int compareTo(pair other){
        return num- other.num;
    }


    pair(int a, int b)
    {
        num=a;
        idx=b;
    }
}


Measured memory_bytes: 23636
from math import sqrt, ceil

n = int(input())
data = list(map(int, input().split()))
balls = []

mid = n//2+1
table = [0] * n
for idx in range(mid-1, n):
    table[idx] = data[idx]
    if data[idx] == 1:
        balls.append(idx+1)
for idx in range(mid-2, -1, -1):
    score = 0
    for idx2 in range(idx, n, idx+1):
        score += table[idx2]
    if score%2 != data[idx]:
        table[idx] = 1
        balls.append(idx+1)

print(len(balls))
if len(balls) > 0:
    print(' '.join(map(str, balls)))

Measured memory_bytes: 27500
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const int N = 1005;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
char lol[4] = {'R', 'L', 'U', 'D'};
int x[N], y[N];
vector<pii> v;
void solve(){
	string s;
	cin >> s;
	s = '0' + s;
	int n = sz(s) - 1;
	fr(i, 1, n - 1){
		if(s[i] != s[n - i]){
			cout << -1;
			return;
		}
	}
	if(s[1] == '0' || s[n] == '1'){
		cout << -1;
		return;
	}
	vector<int> lol;
	fr(i, 1, n){
		if(s[i] == '1'){
			lol.pb(i);
		}
	}
	fr(i, 1, sz(lol)){
		v.pb({i, i + 1});
	}
	for(int i = sz(lol) - 1; i >= 1; i--){
		lol[i] -= lol[i - 1];
	}
	int k = sz(lol) + 1;
	for(int i = 1; i <= sz(lol); i++){
		int x = lol[i - 1];
		x--;
		while(x--){
			v.pb({i, ++k});
		}
	}
	for(pii e : v){
		cout << e.fi << " " << e.se << endl;
	}
	assert(k == n);
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3936
#include<stdio.h>

int max(int,int);
int min(int,int);

int main(void) {
    int i, n;
    int R[200000];
    
    scanf("%d", &n);
    for(i = 0; i < n; i++) scanf("%d", &R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];

    for(int i = 1; i < n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

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

    return 0;
}

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

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



Measured memory_bytes: 2552
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
// #include <unordered_map>
// #include <unordered_set>
#include <utility>
#include <vector>

#define pb push_back
#define mp make_pair

#ifdef ONLINE_JUDGE
#define link relink
#endif

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef long double ld;

inline void EnableFileIO(const string& fileName) {
  if (fileName.empty()) return;
#ifdef ONLINE_JUDGE
  freopen((fileName + ".in").c_str(), "r", stdin);
  freopen((fileName + ".out").c_str(), "w", stdout);
#endif
  return;
}

const int INF = (1 << 30) - 1;
const LL LINF = (1LL << 61) - 1;
const double EPS = 1e-10, PI = acos(-1);
const int N = 2e5 + 100;

int n, c, k;
int t[N];
deque<int> dq;

int main() {
  srand((int)time(0));
  ios::sync_with_stdio(false);
  cin.tie(0);
  // printf("Hello, world!\n");
  EnableFileIO("");

  cin >> n >> c >> k;
  for (int i = 0; i < n; i++) cin >> t[i];
  sort(t, t + n);

  int i = 1, j = 0, ans = 0;
  for (; i < n; i++) {
    if (i - j + 1 > c || t[j] + k < t[i]) {
      // pop once
      j = i;
      ++ans;
       // cout << "ADD" << endl;
    }
    // cout << t[i] << ' ' << i << ' ' << j << endl;
  }

  // if(i!=j) ans++;
  cout << ans + 1 << endl;
  return 0;
}


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

using namespace std;

long long check(long long x)
{
    return x * x * x * x* x;
}

int main()
{
    long long n; cin >> n;
    for(long long b = -1000 ; b <= 1000;b ++)
    {
        for(long long a = b + 1; a <= 1000 ;a ++)
        {
            if(check(a) - check(b) == n)
            {
                printf("%lld %lld\n",a,b);
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3728
//#include "stdafx.h"
#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>
#include "random"
#include "chrono"
#include "cstring"

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target_ans("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;

#define int long long
//#define int unsigned int
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;
typedef vector<vi> vvi;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

vi xx = { 1, 0, -1, 0 };
vi yy = { 0, 1, 0, -1 };
string dir = "LRUD";

const int N = 5e5 + 50, oo = 3e18 + 500;
const int mod = 998244353;
//const int mod = 1e9 + 7;
//const int mod = 1e9 + 9;
const double eps = 1e-12, PI = 2 * acos(0.0);
int n, m, k;
long long cnt = 0;
int lg = 18;
vi g[N];
vi rg[N];
vi visit(N, 0);

int pr[N], sz[N];

void make_set(int v)
{
	pr[v] = v;
	sz[v] = 1;
}

int find_set(int v)
{
	if (v == pr[v])
		return v;

	return pr[v] = find_set(pr[v]);
}

void union_sets(int u, int v, int w, int &ans)
{
	u = find_set(u);
	v = find_set(v);

	if (u == v)
		return;

	ans += w;
	cnt--;

	if (sz[u] < sz[v])
		swap(u, v);

	pr[v] = u;
	sz[u] += sz[v];
}

double logr(int a)
{
	return log(a) / log(10);
}

int mult(int a, int b)
{
	if (a == 0 || b == 0)
		return 0;

	if (a == -1 || b == -1)
		return -1;

	if (logr(a) + logr(b) > 18)
	{
		return -1;
	}

	int res = a*b;
	int x = 1000000000000000000;

	if (res > x)
	{
		res = -1;
	}
	return res;
}

signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	/*freopen("abbreviation.in", "r", stdin);
	freopen("abbreviation.out", "w", stdout);*/
	//ПРОВЕРЯЙ ДЕФАЙНЫ ТУПОЙ!!!

	cin >> n;

	int ans = 0;
	for (int j = 2; j*j <= n; j++)
	{
		if (n % j == 0)
		{
			cnt = 0;
			while (n % j == 0)
			{
				n /= j;
				cnt++;
			}

			for (int i = 1; ; i++)
			{
				ans++;
				if (cnt - i > i)
				{
					cnt -= i;
				}
				else
				{
					break;
				}
			}
		}
	}

	if (n != 1)
	{
		ans++;
	}

	cout << ans << endl;
}



Measured memory_bytes: 30280
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("2");
            WillReturn.Add("1000000000 1000000000");
            //1000000000000000000
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("3");
            WillReturn.Add("101 9901 999999000001");
            //-1
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("31");
            WillReturn.Add("4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0");
            //0
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        decimal[] AArr = InputList[1].Split(' ').Select(X => decimal.Parse(X)).ToArray();

        decimal Base = 1000000000000000000M;

        if (Array.Exists(AArr, pX => pX == 0)) {
            Console.WriteLine(0);
            return;
        }

        decimal Prod = AArr[0];
        for (int I = 1; I <= AArr.GetUpperBound(0); I++) {
            if (Prod > Base / AArr[I]) {
                Console.WriteLine(-1);
                return;
            }
            Prod *= AArr[I];
        }
        if (Prod > Base) {
            Console.WriteLine(1111);
        }
        Console.WriteLine(Prod);
    }
}


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

void solve()
{
	ll n;
	cin>>n;
	ll a[n],b[n];
	for (int i = 0; i < n; ++i)
	{
		/* code */
		cin>>a[i]>>b[i];
	}
	int cnt = 0;
	for (int i = 0; i < n; ++i)
	{
		if(a[i]==b[i])
			cnt++;
		else
			cnt = 0;
		if(cnt>=3)
		{
			cout<<"Yes"<<endl;
			return;
		}
	}
	cout<<"No"<<endl;
}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 3632
s = gets.chomp
n = s.length
s = s.chars
cnt_0 = 0
cnt_1 = 0
for i in 0..(n-1)
    if s[i] == '0'
        cnt_0 += 1
    else
        cnt_1 += 1
    end
end
result = [cnt_0,cnt_1]
puts result.min*2

Measured memory_bytes: 9468
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
D = [X[i+1] - X[i] for i in range(len(X)-1)]
D.sort()
if N>=M: print(0)
else:
  newD = D[:len(D)-(N-1)]
  print(sum(newD))

Measured memory_bytes: 13968
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const bool DEBUG = 0;

ll hidden;

string tos(ll x)
{
	if(x==0) return "0";
	string res;
	while(x)
	{
		res+=char('0'+(x%10));
		x/=10;
	}
	reverse(res.begin(),res.end());
	return res;
}

int query(ll x)
{
	assert(x>0);
	cout<<"? "<<x<<'\n';
	fflush(stdout);
	char res;
	if(DEBUG)
	{
		if(x<=hidden)
		{
			if(tos(x)<=tos(hidden)) res='Y';
			else res='N';
		}
		else
		{
			if(tos(x)>tos(hidden)) res='Y';
			else res='N';
		}
	}
	else cin>>res;
	return (res=='Y'?1:0);
}

void answer(ll x)
{
	cout<<"! "<<x<<'\n';
	fflush(stdout);
}


int main()
{
	if(DEBUG)
	{
		cin>>hidden;
	}
	ll z=query(int(1e9));
	if(z)
	{
		ll cur=1;
		for(int i=0;i<11;i++)
		{
			if(query(cur*2LL))
			{
				answer(cur);
				return 0;
			}
			cur*=10;
		}
	}
	else
	{
		int len = 0;
		ll cur=1;
		for(int i=0;i<10;i++)
		{
			if(query(cur))
			{
				len=cur;
			}
			else break;
			cur*=10;
		}
		ll lo = len; ll hi = len*10 - 1;
		ll ans=lo;
		while(lo<=hi)
		{
			ll mid=(lo+hi)>>1;
			if(query(mid*10))
			{
				ans=mid;
				hi=mid-1;
			}
			else
			{
				lo=mid+1;
			}
		}
		answer(ans);
	}
}


Measured memory_bytes: 596
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int m=scanner.nextInt();
        int d=scanner.nextInt();

        int count=0;

        for (int i = 22; i <= d; i++) {
            if(i%10 >= 2) {
                int mult = (i % 10) * (i / 10);
                if (mult <= m)
                    count++;
            }
        }

        System.out.println(count);
    }
}

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

vector<P>E[200000];
ll d[200000],q[200000];
int par[25][200000];

void dfs(int v,int p,ll d1,ll d2){
	d[v]=d1;q[v]=d2;par[0][v]=p;
	for(P u:E[v]){
		if(u.second!=p)dfs(u.second,v,d1+1,d2+u.first);
	}
}
int lca(int u,int v){
	if(d[u]>d[v])swap(u,v);
	rep(i,22){
		if((d[v]-d[u])>>i&1)v=par[i][v];
	}
	if(u==v)return u;
	for(int i=21;i>=0;i--){
		if(par[i][u]!=par[i][v]){
			u=par[i][u];v=par[i][v];
		}
	}
	return par[0][u];
}
ll dist(int x,int y){
	return q[x]+q[y]-q[lca(x,y)]*2;
}
int main(){
	int n;scanf("%d",&n);
	rep(i,n-1){
		int a,b,c;scanf("%d%d%d",&a,&b,&c);a--;b--;
		E[a].push_back(P(c,b));E[b].push_back(P(c,a));
	}
	dfs(0,-1,0,0);
	for(int i=1;i<22;i++)rep(j,n){
		if(par[i-1][j]==-1)par[i][j]=-1;
		else par[i][j]=par[i-1][par[i-1][j]];
	}
	int q,k;scanf("%d%d",&q,&k);k--;
	rep(i,q){
		int x,y;scanf("%d%d",&x,&y);x--;y--;
		printf("%lld\n",dist(x,k)+dist(k,y));
	}
}

Measured memory_bytes: 37632
#template
def inputlist(): return [int(k) for k in input().split()]
import sys
sys.setrecursionlimit(10**8)
#template
N = int(input())
tree = [[]*(N+1) for _ in range(N+1)]
dic = {}
for i in range(N-1):
    u,v,w = inputlist()
    if u > v:
        u,v = v,u
    tree[u].append(v)
    tree[v].append(u)
    dic[(u,v)] = w
seen = [False]*(N+1)
ans = ['-1']*(N+1)
ans[1] = '0'
def dfs(i):
    seen[i] = True
    for x in tree[i]:
        if seen[x]:
            continue
        k = min(i,x)
        s = max(i,x)
        if dic[(k,s)] % 2 == 0:
            ans[x] = ans[i]
            dfs(x)
        if dic[(k,s)] % 2 == 1:
            if ans[i] == '0':
                ans[x] = '1'
                dfs(x)
            if ans[i] == '1':
                ans[x] = '0'
                dfs(x)
dfs(1)
for i in range(1,N+1):
    print(ans[i])

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n;
  cin>>n;
  vll a(n);
  REP(i,n)cin>>a[i];

  ll s=0;
  REP(i,n)s=s^a[i];
  REP(i,n)cout<<(s^a[i])<<endl;
}



Measured memory_bytes: 4772
n=int(input())
l=list(map(int,input().split()))
dp=[0]*(n)
dp[0]=0
dp[1]=abs(l[0]-l[1])
for i in range(2,n):
    dp[i]=min(abs(l[i]-l[i-2])+dp[i-2],dp[i-1]+abs(l[i]-l[i-1]))
print(dp[-1])


Measured memory_bytes: 52208
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s;
    cin>>s;
    s[5]=' ';
    s[13]=' ';
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace ABC102a
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int Ans;
            if (N % 2 == 1)
                Ans = 2 * N;
            else
                Ans = N;
            Console.WriteLine(Ans);
        }
    }
}


Measured memory_bytes: 13140
#include<cstdio>
#include<cstring>
using namespace std;

char a[100005];
char b[100005];
int len1,len2;

int main()
{
	scanf("%s",a);
	len1 = strlen(a);
	for (int i = 0;i < len1;i++)
		b[i] = a[i];
	len2 = len1 / 2;
	for (int i = 0;i < len2;i++)
	{
		char k;
		k = a[i];
		a[i] = a[len1 - 1 - i];
		a[len1 - 1 - i] = k;
	}
	for (int i = 0;i < len1;i++)
	{
		if (a[i] == 'b') a[i] = 'd';
		else if (a[i] == 'd') a[i] = 'b';
		else if (a[i] == 'p') a[i] = 'q';
		else if (a[i] == 'q') a[i] = 'p';
	}
	for (int i = 0;i < len1;i++)
		if (a[i] != b[i])
		{
			printf("No\n");
			return 0;
		}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 384
from math import sqrt,floor
MODN = int(1e9 +7)
N = int(input())

divnum = {}
if N==1:
  print(1)
  exit(0)
  
for i in range(1,N+1):
  work = i
  div = 2
  while work > 1:
    if work % div == 0:
      work = work // div
      if div in divnum:
        divnum[div] += 1
      else:
        divnum[div] = 1
    else:
      div += 1

ans = 1
for k,v in divnum.items():
  ans = ans * (v+1) % MODN
  
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void)
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a<b && b<c)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

int main(){
    string a;
    cin >> a;
    for (ll i=0;i<a.size()-2;++i){
        if(a[i]==a[i+1] && a[i]==a[i+2]){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int m = sc.nextInt();

        int[] arrA = new int[a];
        int[] arrB = new int[b];

        for (int i=0; i<a; i++) {
            arrA[i] = sc.nextInt();
        }
        for (int i=0; i<b; i++) {
            arrB[i] = sc.nextInt();
        }

        int minA = Integer.MAX_VALUE;
        int minB = Integer.MAX_VALUE;

        for (int i=0; i<a; i++) {
            minA = Math.min(minA, arrA[i]);
        }
        for (int i=0; i<b; i++) {
            minB = Math.min(minB, arrB[i]);
        }

        int ans = minA+minB;

        for (int i=0; i<m; i++) {
            int x = sc.nextInt()-1;
            int y = sc.nextInt()-1;
            int c = sc.nextInt();
            ans = Math.min(ans, arrA[x]+arrB[y]-c);
        }

        System.out.print(ans);
    }

}



Measured memory_bytes: 149716
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define ubo upper_bound
#define lbo lower_bound
#define VI vector<int>
#define VL vector<ll>
#define VP vector<pii >
#define all(x) x.begin(), x.end()
#define M vector<VI >

const int P = 1e9+7;
const int N = 505050;

using namespace std;

int n, m;
ll f[N], inv[N];

ll pwr(ll a, ll b){
	ll ret = 1;
	for(ll c=1; c<=b; c*=2){
		if(b&c) ret = (ret*a)%P;
		a = (a*a)%P;
	}
	return ret;
}

ll nCr(int a, int b){
	ll ret = (f[a]*inv[b])%P;
	ret = (ret*inv[a-b])%P;
	return ret;
}

int main(){

	cin >> n >> m;

	f[0] = 1;
	for(ll i=1; i<=m; i++) f[i] = (f[i-1]*i)%P;
	for(int i=0; i<=m; i++) inv[i] = pwr(f[i], P-2);

	ll acr = (f[m]*inv[m-n])%P;
	
	ll bcr = 0;
	for(int i=0; i<=n; i++){
		ll nCr1 = nCr(n, i);
		ll nCr2 = nCr(m-i, n-i);
		ll tot = (f[n-i]*nCr2)%P;
		tot = (tot*nCr1)%P;
		if(i&1) bcr = (P+bcr-tot)%P;
		else bcr = (bcr+tot)%P;
	}

	ll ans = (acr*bcr)%P;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 11312
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <complex>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) begin(x),end(x)
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl;
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
typedef long long lint;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }


int main()
{
	int X[100002] = {}, Y[100002] = {};
	int n, w, h;
	cin >> n >> w >> h;
	FOR(i, n)
	{
		int x, y, w;
		cin >> x >> y >> w;
		X[max(x - w, 0)]++; X[min(x + w, 100001)]--;
		Y[max(y - w, 0)]++; Y[min(y + w, 100001)]--;
	}
	FORI(i, 1, w)
	{
		X[i] += X[i - 1];
	}
	FORI(i, 1, h)
	{
		Y[i] += Y[i - 1];
	}
	bool ok = true;
	FOR(i, w)
	{
		if (!X[i])ok = false;
	}
	if (ok)cout << "Yes" << endl;
	else
	{
		ok = true;
		FOR(i, h)
		{
			if (!Y[i])ok = false;
		}
		if (ok)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 3868
#include <iostream>

using namespace std;

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

  int l, i=0, t[num];
  for (int i = 0; i < num; i++) {
  	cin >> t[i];
  }

  int drink;
  cin >> drink;
  
  for (int j = 0; j < drink; j++) {
  	int p,x;
  	cin >> p >> x;
  	p--;

  	int temp = t[p];
  	t[p] = x;

  	int sum = 0;
  	for (int indiv : t) {
  		sum += indiv;
  	}
  	cout << sum << endl;

  	t[p] = temp;
  }

  return 0;
}


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

int main(){
    int n, sum = 0, ma = -1;
    cin >> n;

    int tmp;
    while(n-- > 0){
        cin >> tmp;
        sum += tmp;
        ma = max(tmp, ma);
    }
    sum -= ma/2;

    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
n,m,x= map(int, input().split())

c=[]

for i in range(n):
    a = [int(x) for x in input().split()]
    c.append(a)

for i in range(1,m+1):
    kei=0
    for j in range(n):
        kei+=c[j][i]
    if kei<x:
        print(-1)
        exit()

ans=10**16

for j in range(1,2**n):
    b=format(j,"012b")
    b=b[::-1]
    nedan=0
    skill=[0]*m
    for k in range(n):
        if int(b[k])==1:
            nedan+=c[k][0]
            for l in range(0,m):
                skill[l]+=c[k][l+1]
    if all(goukei>=x for goukei in skill):
        ans=min(ans,nedan)

print(ans)

Measured memory_bytes: 9144
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = getScannerFromFile();
        int countBox = Integer.valueOf(sc.nextLine());
        String[] arrBoxCap = sc.nextLine().split(" ");
        int countInstruction = Integer.valueOf(sc.nextLine());

        int[] boxes = new int[countBox];
        for(int i = 0; i < countInstruction; i++) {
            String [] instruction = sc.nextLine().split(" ");

            int iBox = Integer.valueOf(instruction[1]) - 1;
            int apple = Integer.valueOf(instruction[2]);

            // Cho vao
            if(instruction[0].equals("1")) {
                boxes[iBox] += apple;
            }
            // Lay ra
            else {
                boxes[iBox] -= apple;
            }

            if(boxes[iBox] > Integer.valueOf(arrBoxCap[iBox]) || boxes[iBox] < 0) {
                System.out.println(iBox + 1);
                return;
            }
        }

        System.out.println("0");


    }
}


Measured memory_bytes: 548076
N,D = map(int,input().split())
point = list(list(map(int,input().split())) for _ in range(N))

def dist(A,B):
    D = 0
    for i in range(len(A)):
        D += (A[i]-B[i])**2
    return D**(1/2)





count = 0
for i in range(N):
    for j in range(i+1,len(point)):
        count += (dist(point[i],point[j])).is_integer()
        
print(count)


Measured memory_bytes: 38256
#include<bits/stdc++.h>
 
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed fixed<<setprecision(14)
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
bool inLine(int x,int y,int mx,int my){return (x>=0&&y>=0&&x<mx&&y<my);}
const lol inf=(1LL<<62);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
lol n,m,k,r,q;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>n;
  string s;
  map<string,int> ma;
  for(int i=0;i<n;i++){
    cin >>s;
    ma[s]++;
  }
  cout <<"AC x "<<ma["AC"]<<'\n';
  cout <<"WA x "<<ma["WA"]<<'\n';
  cout <<"TLE x "<<ma["TLE"]<<'\n';
  cout <<"RE x "<<ma["RE"]<<'\n';
  return (0);
}

Measured memory_bytes: 3560
h, w = map(int,input().split())
a = []
for i in range(h): #入力の時点で横を取り除く
    x = list(input())
    if x.count(".") == w:
        continue
    else:
        a.append(x)

n = len(a)
a = [list(x) for x in zip(*a)] #転置
x = 0 #popの調整

for i in range(w):
    if a[i-x].count(".") == n:
        a.pop(i-x)
        x += 1

a = [list(x) for x in zip(*a)] #転置して戻す

for i in range(len(a)): #出力
    for s in a[i]:
        print(s, end ="")
    print()

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

#define M 1046527
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char);
long long getKey(char *);
int h1(int);
int h2(int);
int find(char *);
int insert(char *);


int main(){
    int i, n, h;
    char str[L], com[9];
    for(i = 0;i<M;i++) H[i][0] = '\0';

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
        scanf("%s %s", com, str);

        if ( com[0] == 'i' ){
            insert(str);
        } else {
            if (find(str)){
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }

    return 0;
}

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

/* convert a string into an integer value */
long long getKey(char *str){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

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

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

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



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

#define endl '\n'
#define ll long long int
#define let(x, a) __typeof(a) x(a)
#define all(a) (a).begin(), (a).end()
#define present(c, x) ((c).find(x) != (c).end())
#define tr(v, it) for (let(it, v.begin()); it != v.end(); it++)
#define rtr(v, it) for (let(it, v.rbegin()); it != v.rend(); it++)

#define trace1(x)					cerr << #x << ": " << x << endl;
#define trace2(x, y)				cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)				cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)			cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)		cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f)	cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	if(n>=30) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

int main(){
	int m, f,r;

	while(1){
		cin >> m >> f >> r;

		if (m == -1 && f == -1 && r == -1) break;
		if (m == -1 || f == -1) cout << "F" << "\n";
		else if (m + f >= 80) cout << "A" << "\n";
		else if (m + f >= 65) cout << "B" << "\n";
		else if (m + f >= 50) cout << "C" << "\n";
		else if (m + f >= 30){
			if (r >= 50) cout << "C" << "\n";
			else cout << "D" << "\n";
		}
		else cout << "F" << "\n";
	}

	return 0;
}


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

int main() {
    int n,a,b;
    std::cin >> n >> a >> b;
    std::string i_str;
    int res = 0;
    int sum;
    for(int i = 1; i <= n; i++){
        i_str = std::to_string(i);
        if(i_str.size() == 1) if(a <= i && i <= b) {
            res += i;
            continue;
        }
        sum = 0;
        for(int j = 0; j < i_str.size(); j++){
            sum += (i_str[j]-'0');
        }
        if(a <= sum && sum <= b) res += i;
    }
    std::cout << res << std::endl;
}

Measured memory_bytes: 256
x = parse(Int, readline())
function mygcd(a,b,c)
    if(a==b && b==c)
        return a
    end
    max = div(maximum((a,b,c)),2)
    GCD = 0
    for i in [i for i = 1:max]
        if(a%i==0 && b%i==0 && c%i==0)
            GCD = i
        end
    end
    return GCD
end

function sp_comb(a,b,c)
    if(a > b && b > c)
        return 6
    elseif(a > b && b == c)
        return 3
    elseif(a == b && b > c)
        return 3
    else
        return 1
    end
end

function mysum(K)
    S = 0
    for a in [i for i = 1:K]
        for b in [i for i = 1:a]
            for c in [i for i = 1:b]
                S = S + gcd(a,b,c)*sp_comb(a,b,c)
            end
        end
    end
    return S
end

println(mysum(x))


Measured memory_bytes: 177488