akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <limits.h>

using namespace std;

int main(){
	int n,tmp,min=INT_MAX,max=INT_MIN;
	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		scanf("%d",&tmp);
		if(max < tmp-min) max = tmp - min;
		if(min > tmp) min = tmp;
	}
	printf("%d\n",max);
	return 0;
}


Measured memory_bytes: 2716
N, M = [int(x) for x in input().split()]
A = [-int(x) for x in input().split()]

import heapq
heapq.heapify(A)

for i in range(M):
    h = heapq.heappop(A)
    h = -((-h)//2)
    heapq.heappush(A,h)

print(-sum(A))

Measured memory_bytes: 14224
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

template<typename T> using maximum_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;
template<typename T> using minimum_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
std::istream& operator>>(std::istream &is, std::vector<T> &v)
{
  for (typename std::vector<T>::size_type i = 0; i < v.size(); ++i) {
    is >> v[i];
  }
  return is;
}

using namespace std;

const uint64_t M = 26;

int main()
{
  uint64_t D;
  cin >> D;

  vector<int64_t> c(M);
  cin >> c;

  vector<vector<int64_t>> s(D, vector<int64_t>(M));
  N_TIMES(d, D) { cin >> s[d]; }

  vector<int64_t> t(D);
  cin >> t;
  N_TIMES(d, D) { --t[d]; }

  vector<set<uint64_t>> last(M);
  N_TIMES(m, M) {
    last[m].insert(0);
    last[m].insert(D + 1);
  }

  vector<int64_t> dissatisfied(M, 0);

  auto calc_dissatisfied = [&](uint64_t m) {
    uint64_t prev = 0;
    dissatisfied[m] = 0;
    for (uint64_t d : last[m]) {
      uint64_t diff_d = d - prev;
      uint64_t diff_d_sum = diff_d * (diff_d - 1) / 2;
      dissatisfied[m] += c[m] * diff_d_sum;
      prev = d;
    }
    return dissatisfied[m];
  };

  auto calc_score = [&](const vector<int64_t> &t) {
    int64_t score = 0;
    N_TIMES(d, D) {
      score += s[d][t[d]];
      last[t[d]].insert(d + 1);
    }

    N_TIMES(m, M) {
      score -= calc_dissatisfied(m);
    }
    return score;
  };

  int64_t S = calc_score(t);

  uint64_t Q;
  cin >> Q;

  auto query = [&](uint64_t d, uint64_t q) {
    int64_t T = 0;

    T -= s[d][t[d]];
    last[t[d]].erase(d + 1);

    T += dissatisfied[t[d]];
    calc_dissatisfied(t[d]);
    T -= dissatisfied[t[d]];

    t[d] = q;

    T += s[d][t[d]];
    last[t[d]].insert(d + 1);
    
    T += dissatisfied[t[d]];
    calc_dissatisfied(t[d]);
    T -= dissatisfied[t[d]];

    S += T;

    return S;
  };

  N_TIMES(i, Q) {
    uint64_t d, q;
    cin >> d >> q;
    --d; --q;

    cout << query(d, q) << endl;
  }

  return 0;
}

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

string s; 

int main()
{
	cin >> s;
	int len = s.size();
	for (int i = 0; i <= len - 1; i++)
	{
		if (s[i] == '1') s[i] = '9';
		else if (s[i] == '9') s[i] = '1';
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 101

int n, time, A[N][N], color[N], d[N], f[N];

void dfs();
void visit(int);

int main(){
  int i, j, u, k, v;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      A[i][j] = 0;
    }
  }

  for(i = 0; i < n; i++){
    scanf("%d%d",&u, &k);
    for(j = 0; j < k; j++){
      scanf("%d",&v);
      A[u-1][v-1] = 1;
    }
  }

  dfs();
  
  return 0;
}

void dfs(){
  int u;
  for(u = 0; u < n; u++) color[u] = 0;
  time = 0;
  for(u = 0; u < n; u++){
    if(color[u] == 0) visit(u);
  }
  for(u = 0; u < n; u++) printf("%d %d %d\n", u+1, d[u], f[u]);
}

void visit(int u){
  int v;
  color[u] = 1;
  d[u] = ++time;
  for(v = 0; v < n; v++){
    if(A[u][v] == 1){
      if(color[v] == 0) visit(v);
    }
  }
  color[u] = 2;
  f[u] = ++time;
}

Measured memory_bytes: 636
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;
ll talk[20][20]={};
ll maxans=0;

void execalc(vll status){
    bool flag=true;
    for( ll speaker = 1 ; speaker <=N ; speaker++ ){
        if(status[speaker]==1){
            for( ll taker = 1 ; taker <=N ; taker++ ){
                ll talked_status = talk[speaker][taker];
                if(talked_status>=0){
                    if(talked_status!=status[taker]){
                        flag = false;
                        break;
                    }
                }
            }
        }
        if(flag==false) break;
    }

    //for(ll ni = 1;ni<=N;ni++) cout << status[ni];
    //cout << endl;
    //cout << flag << endl;

    if(flag){
        ll cnt1=0;
        for( ll ni = 1 ; ni <=N ; ni++ ){
            cnt1+=status[ni];
        }
        if(maxans<cnt1) maxans=cnt1;
    }
    
} 

void calcMaxAns(ll index,vll status){
    if(index==N){
        execalc(status);
    }else{
        index++;
        status.push_back(0);
        calcMaxAns(index,status);
        status[index]=1;
        calcMaxAns(index,status);
    }

}


int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> N;

    rep(ni,20){
        rep(mi,20){
            talk[ni][mi]=-1;
        }
    }

    for( ll ni = 1 ; ni <=N ; ni++ ){
        cin >> A;
        rep(ai,A){
            ll num,status;
            cin >> num >> status;
            talk[ni][num]=status;
        }
    }

    vll status;
    status.push_back(0);
    calcMaxAns(0,status);


    cout << maxans << endl;    

}

Measured memory_bytes: 3692
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;


//ここから

void solve(){
  int x,y;
  cin>>x>>y;
  cout<<x+y/2;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


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

string str;

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

  cin >> str;
  int ans = 1;
  if (str == "MON") {
    ans = 6;
  } else if (str == "TUE") {
    ans = 5;
  } else if (str == "WED") {
    ans = 4;
  } else if (str == "THU") {
    ans = 3;
  } else if (str == "FRI") {
    ans = 2;
  } else if (str == "SAT") {
    ans = 1;
  } else {
    ans = 7;
  }
  cout << ans << "\n";

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, d;
    cin >> n >> d;
    vector< vector<int> > a(n, vector<int>(d));
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < d; ++j)
            cin >> a[i][j];
    int odp = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            int odl = 0;
            for (int k = 0; k < d; ++k)
                odl += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
            int pier = sqrt(odl);
            if (pier * pier == odl)
                ++odp;
        }
    }
    cout << odp;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<long long>H; long long q[110000], a[110000], b[110000], Q, L, S, N, bit[110000];

void add(long long x, long long r) { while (x <= N) { bit[x] += r; x += x&-x; } }
long long sum(long long r) { long long ret = 0; while (r >= 1) { ret += bit[r]; r -= r&-r; }return ret; }
int main() {
	while (true) {
		cin >> Q >> L; H.clear(); if (Q == 0 && L == 0)break; S = 0;
		for (int i = 0; i < 110000; i++)bit[i] = 0;
		for (int i = 0; i < Q; i++) {
			cin >> q[i];
			if (q[i] == 0) { H.push_back(S + L); }
			if (q[i] == 1) { cin >> a[i]; S += a[i]; }
			if (q[i] == 2) { cin >> a[i]; }
			if (q[i] == 3) { cin >> a[i] >> b[i]; }
			if (q[i] == 4) { cin >> a[i]; }
		}
		H.push_back(0); sort(H.begin(), H.end()); S = 0; N = 109500;
		for (int i = 0; i < Q; i++) {
			if (q[i] == 0) {
				int pos1 = lower_bound(H.begin(), H.end(), S + L) - H.begin();
				add(pos1, 1);
			}
			if (q[i] == 1) {
				int pos1 = lower_bound(H.begin(), H.end(), S + 1) - H.begin();
				S += a[i];
				int pos2 = lower_bound(H.begin(), H.end(), S + 1) - H.begin();
				int cnt1 = 0;
				for (int i = pos1; i < pos2; i++) {
					if (sum(i) - sum(i - 1) >= 1) {
						add(i, -1); cnt1++;
					}
				}
				if (cnt1 >= 1)cout << "damage " << cnt1 << endl;
			}
			if (q[i] == 2) {
				int L = 0, R = 109000, M;
				while (true) {
					M = (L + R) / 2;
					int pos1 = sum(M), pos2 = sum(M - 1);
					if (pos1 >= a[i] && pos2 < a[i]) { cout << "hit" << endl; add(M, -1); break; }
					if (pos1 < a[i]) {
						if (M == 108999) { cout << "miss" << endl; break; }
						else { L = M; }
					}
					if (pos2 >= a[i])R = M;
				}
			}
			if (q[i] == 3) {
				int pos1 = lower_bound(H.begin(), H.end(), S + a[i] - b[i]) - H.begin();
				int pos2 = lower_bound(H.begin(), H.end(), S + a[i] + b[i] + 1) - H.begin();
				int J = pos1 - 1; bool OK = true;
				int cnt = 0;
				while (J < pos2) {
					int L = J, R = 109000, M;
					while (true) {
						M = (L + R) / 2;
						int pos3 = sum(M) - sum(J), pos4 = sum(M - 1) - sum(J);
						if (pos3 >= 1 && pos4 < 1) {
							J = M; if (J < pos2) { cnt++; add(J, -1); } break;
						}
						if (pos3 < 1) {
							if (M == 108999) { OK = false; break; }
							else { L = M; }
						}
						if (pos4 >= 1)R = M;
					}
					if (OK == false)break;
				}
				cout << "bomb " << cnt << endl;
			}
			if (q[i] == 4) {
				int L = 0, R = 109000, M;
				while (true) {
					M = (L + R) / 2;
					int pos1 = sum(M), pos2 = sum(M - 1);
					if (pos1 >= a[i] && pos2 < a[i]) { cout << "distance " << H[M] - S << endl; break; }
					if (pos1 < a[i]) {
						if (M == 108999) { cout << "distance -1" << endl; break; }
						else { L = M; }
					}
					if (pos2 >= a[i])R = M;
				}
			}
		}
		cout << "end" << endl;
		//-------------end of the simulate------------
	}
	return 0;
}

Measured memory_bytes: 6496
n = int(input())
ans = 0
f1, f2, f3 = 0, 0, 0
for i in range(n):
    f3 = f2
    f2 = f1
    d1, d2 = map(int, input().split())
    f1 = d1 == d2
    if f1 == f2 == f3 == 1:
        ans = 1
print('Yes' if ans else 'No')

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

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> h( N );
	for( int i = 0; i < N; i++ ) {
		cin >> h[i];
	}

	int ans = 0;
	for( int i = 0; i < N; i++ ) {
		if( h[i] >= K ) ans++;
	}

	cout << ans << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

int main() {

	string s, t;
	cin >> s >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());

	if (s < t) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

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

#define M 100010


int main(){
	IOS;
	ll n;cin>>n;
	vector<pair<string,pii>>v;
	rep(i,0,n){
		string s;
		ll p;
		cin>>s>>p;
		v.pb({s,{-p,i}});
	}
	sort(all(v));
	rep(i,0,n)cout<<v[i].se.se+1<<"\n";
	return 0;
}



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

int main(){
    ll n, m;
    cin >> n >> m;
    ll cnt = 0;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];
    ll sum = accumulate(a.begin(), a.end(), 0LL);
    for(auto e : a) if(e * 4 * m >= sum) cnt++;
    if(cnt >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int n,m;
  cin >> n >> m;
  int ans=0;
  rep(i,n) {
    int x;
    R x;
    ans+=min(x*2,(m-x)*2);
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll a,b,c,k;
int32_t main(){
CODE_START;
cin>>a>>b>>c>>k;
ll ans=0;
if(a>k){
    cout<<k<<endl;
    return 0;
}
ans=a;
k=k-a;
if(b>k){
        cout<<ans<<endl;
return 0;
}
k=k-b;
ans=ans-min(k,c);
cout<<ans<<endl;
}



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

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

int main()
{
    vector<int> dish(5);
    REP(i, 5)   cin >> dish[i];

    vector<int> tmp(5);

    int min_digit_1 = 9;
    bool zero = true;

    REP(i, 5) {
        tmp[i] = dish[i] % 10;
        if (tmp[i] != 0) {
            zero = false;
            dish[i] += 10 - tmp[i];
            min_digit_1 = min(min_digit_1, tmp[i]);
        }
    }

    if (zero)     cout << accumulate(dish.begin(), dish.end(), 0) << endl;
    else        cout << accumulate(dish.begin(), dish.end(), 0) + min_digit_1 - 10 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

// 素数判定(素数なら1, そうでないなら0を返す)
// O(√N)
ll is_prime(ll N){
    if(N==1) return 0;
    
    for(ll i=2; i*i<=N; i++){
        if(N%i==0) return 0;
    }

    return 1;
}

int main()
{
    ll Q, i, j, l[100001], r[100001], isprime[100001], sim2017[100001]={0}, S[100001];

    cin >> Q;

    for(i=1; i<=100000; i++){
        isprime[i] = is_prime(i);
    }

    for(i=1; i<=100000; i++){
        if(i%2==1){
            if(isprime[i]==1 && isprime[(i+1)/2]==1){
                sim2017[i] = 1;
            }
        }
    }

    S[0] = 0;
    for(i=1; i<=100000; i++){
        S[i] = S[i-1]+sim2017[i];
    }

    for(i=1; i<=Q; i++){
        cin >> l[i] >> r[i];
    }

    for(i=1; i<=Q; i++){
        cout << S[r[i]]-S[l[i]-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 4480
/*
 * a.c
 *
 *  Created on: 2017/06/13
 *      Author: AWV060608
 */

#include	<stdio.h>

int		main(void)
{
	int		n, x, y;
	int		i, j;
	int		a, b, c;
	int		rst;

	rst = 0;
	while(1)
	{
		scanf("%d",&n);
		scanf("%d",&x);

		if((n==0)&&(x==0))
			break;

		y = x/3;
		for(i=0, a=1; i<n; i++,a++)
		{
			for(j=0,b=a+1; j<n; j++,b++)
			{
				c = x-a-b;
				//printf("c=%d\n",c);

				if(( c>b )&&( n>=c))
				{
					rst+=1;
					//printf("a=%d b=%d c=%d\n",a,b,c);
				}
			}
		}
		printf("%d\n",rst);
		rst = 0;
	}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<cstdio>
#include<string.h>
using namespace std;



int main()
{

    int n,a[100],key;
    cin>>n;
    for(int i=1;i<=n;i++){cin>>a[i];i==n?cout<<a[i]<<endl:cout<<a[i]<<" ";}
    for(int i=2;i<=n;i++)
       {
           int j;
         key=a[i];
         j=i-1;
         while(j>=1&&a[j]>key)
         {
             a[j+1]=a[j];
             j--;
         }
         a[j+1]=key;
          for(int k=1;k<=n;k++)
    k==n?cout<<a[k]<<endl:cout<<a[k]<<" ";
       }


    return 0;
}



Measured memory_bytes: 3080
#include <stdio.h>
int main(){
    int a,b,p;
    for(p=0;p<2000;p++){
    scanf("%d %c %d",&a,&p,&b);
    if (p == '+')
        printf("%d\n",a+b);
    if (p == '-')
        printf("%d\n",a-b);
    if (p == '*')
        printf("%d\n",a*b);
    if (p == '/')
        printf("%d\n",a/b);
    if (p == '?')
    break;
    }
    return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template <size_t I, class H, class... T> struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template <class H, class... T> struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template <class... T> istream& operator>>(istream&i,tuple<T...>& t) { t = TupleReaderWriter<sizeof...(T), T...>::r(i); return i; }
template <class... T> ostream& operator<<(ostream& o, tuple<T...>& t) { string delim = " "; TupleReaderWriter<sizeof...(T) - 1, T...>::w(o, t, delim); return o; }
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using vector2d = vector<vector<T>>;
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
    int r;
    cin >> r;
    cout << r * r << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;long long n,s,sum,g,i,A,B,C;main(){cin>>n>>s;if(n==s){cout<<n+1<<endl;goto E;}for(i=2;i<=min(n+1,3000000LL);i++){sum=0;g=1;while(g<=1LL<<37){sum+=(n/g)%i;g*=i;}if(sum==s){cout<<i<<endl;goto E;}}for(i=min(s,n/1000000);i>=1;i--){A=i,B=s-i;if((n-B)%A!=0)continue;C=(n-B)/A;if(C<=B||C<=1)continue;cout<<C<<endl;goto E;}cout<<"-1"<<endl;E:;}

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

int n, x, t;

void build() {
	scanf("%d %d %d", &n, &x, &t);
}

void solve() {
	int tako = 0, ans = 0;
	while (true) {
		tako += x, ans += t;
		if (tako >= n) break;
	}
	printf("%d", ans);
}

int main() {
	build();
	solve();
	return 0;
}

Measured memory_bytes: 3820
#!/usr/bin python3
# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))
mn = 1000
st = 0
for i in range(N-1):
    if A[i+1]>A[i]:
        by = mn//A[i]
        st += by
        mn -= by*A[i]
    if A[i+1]<=A[i]:
        mn += st*A[i]
        st = 0

print(st*A[-1]+mn)

Measured memory_bytes: 9192
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

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

    int N;
    cin >> N;
    vector<int> A(N);
    cin >> A;
    vector<int>B;
    int start = N - 1;
    int i;
    for (i = start; i >= 0; i -= 2) {
        B.emplace_back(A[i]);
    }
    start = N % 2 == 0 ? 0 : 1;
    for (i = start; i < N; i += 2) {
        B.emplace_back(A[i]);
    }

    cout << B[0];
    FOR(i, 1, N) {
        cout << " " << B[i];
    }
    return 0;
}

Measured memory_bytes: 3956
/*
 *	Argorithms and Data Structures
 *	Lectuire 1
 *	Prime Numbers
 */

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define true 1;
#define false 0;

int isprime(int);

int main(void){
	int n, x, pm_cnt = 0;

	scanf("%d", &n);

	while( n-- > 0){
		scanf("%d", &x);
		if( isprime(x) ) pm_cnt++;
	}
	
	printf("%d\n", pm_cnt);
	return 0;
}

int isprime( int x){
	int i, x_sq;

	x_sq = (int) sqrt( (double)x);


	if( x == 2) return true;
	if( x%2 == 0) return false;

	for( i=3; i <= x_sq; i+=2)
		if( x%i == 0) return false;

	return true;
}

Measured memory_bytes: 596
#include <stdio.h>

int main (void) {
int a, op, b;
while (1) {
	scanf("%d %c %d", &a, &op, &b);
	if (op == '?')
		break;

	if (op == '+') {
		printf("%d\n", a+b);
	} else if (op == '-') {
		printf("%d\n", a-b);
	} else if (op == '*') {
		printf("%d\n", a*b);
	} else if (op == '/') {
		printf("%d\n", a/b);
	}
}

return 0;
}

Measured memory_bytes: 600
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	//static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	
	//for(int i=0;i<N;i++) {}
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		
		int N=sc.nextInt();
		int M=sc.nextInt()	;
		
		int H[]=new int[N];
		for(int i=0;i<N;i++) {
			H[i]=sc.nextInt();
		}
		
		boolean x[]=new boolean[N];
		
		for(int i=0;i<N;i++) {
			x[i]=true;
		}
		
		
		for(int i=0;i<M;i++) {
			int A=sc.nextInt();
			int B=sc.nextInt();
			
			
			
			
			if(H[A-1]>H[B-1]) {
				
				x[B-1]=false;
				
			}else if(H[A-1]<H[B-1]){
				x[A-1]=false;
			}else {
				x[A-1]=false;
				x[B-1]=false;
			}
			
			
			
			
			
		}int ans=0;
		for(int i=0;i<N;i++) {
			if(x[i]) {ans++;
			//p(i+" a");
			}
		}p(ans);
	}
	

	
	
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 60116
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <typeinfo>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s;
  cin >> s;
  int N = 13;
  int l = s.length();
  int mul = 1;
  int mod = pow(10, 9.0) + 7;
  int dp[l + 1][N] = {};
  dp[0][0] = 1;

  for (int i = l - 1; i >= 0; i--) {
    int index = l - i;

    if (s[i] == '?') {
      F0R(j, N) {
        F0R(k, 10) {
          ll m = ((k * mul) % 13 + j) % 13;
          dp[index][m] += dp[index - 1][j];
          dp[index][m] %= mod;
        }
      }
    } else {
      int k = (int)(s[i] - '0');
      F0R(j, N) {
        ll m = ((k * mul) % 13 + j) % 13;

        dp[index][m] += dp[index - 1][j];
        dp[index][m] %= mod;
      }
    }
    mul *= 10;
    mul %= 13;
  }
  cout << dp[l][5] << "\n";
}

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

Measured memory_bytes: 5584
W, H, x, y = map(int, input().split())
S = W * H
ans = float(S / 2.0)


gx, gy = W / 2.0, H / 2.0

if (gx == x) and (gy == y):
    tar = '1'
else:
    tar = '0'

print(ans, tar)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}
int MOD = pow(10, 9) + 7;

//出力形式を返す関数
string out(vector<int> v){
    string ans="[";
    for(int i=0;i<v.size();i++){
        if(i!=0) ans+=", ";
        ans+=to_string(v[i]);
    }
    ans+="]";
    return ans;
}

signed main() {
	int h,n; cin>>h>>n;
    vector<int> dp(h+1,pow(10,9)); dp[0]=0;
    vector<int> a(n),b(n);
    for(int i=0;i<n;i++) cin>>a[i]>>b[i];

    //各HPについての処理
    for(int hi=0;hi<h;hi++){
        //各魔法についての処理
        for(int ni=0;ni<n;ni++){
            //hを超える場合はhでいい
            int index=hi+a[ni];
            if(index>h) index=h;
            //dpの値を更新する。いけない体力のところは初期値のまま
            dp[index]=min(dp[index],dp[hi]+b[ni]); 
        }
    }

    cout<<dp[h]<<endl;

}

Measured memory_bytes: 3712
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
char A[2][27] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
			      "DEFGHIJKLMNOPQRSTUVWXYZABC" };

int main() {
	char *s = (char*)malloc(1001);
	int i;
	fscanf(stdin, "%[^\n]*s", s), getchar();
	while (*s) {
		for (i = 0; i < 26; i++)
			if (*s == A[1][i]) fprintf(stdout, "%c", A[0][i]);
			s++;
	}
	puts("");
	//free(s);
	return 0;
}

Measured memory_bytes: 560
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var hw = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			int h = hw[0];
			int w = hw[1];
			int n = int.Parse(Console.ReadLine());
			var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

			var ans = new int[h, w];
			int hi = 0;
			int wi = 0;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < a[i]; j++) {
					ans[hi, wi] = i + 1;
					if (hi % 2 == 0) {
						if (wi == w - 1) {
							++hi;
						} else {
							++wi;
						}
					} else {
						if (wi == 0) {
							++hi;
						} else {
							--wi;
						}
					}
				}
			}

			var sb = new StringBuilder();
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					sb.Append($"{ans[i, j]} ");
				}

				sb.AppendLine("");
			}

			Console.Write(sb.ToString());
		}
	}
}

Measured memory_bytes: 13400
#include"bits/stdc++.h"
    #include<valarray>
    #include<ext/pb_ds/tree_policy.hpp>
    #include<ext/pb_ds/assoc_container.hpp>
    using namespace std;
    using namespace __gnu_pbds;
     
    #define MAX 2002
     
    int n;
     
    char buf[MAX];
    string s;
     
    vector<int> v[MAX];
     
    long long int dp_max[MAX];
    long long int dp_min[MAX];
    long long int child[MAX];
     
     
     
    inline void dfs(int b,int pr=-1){
    	child[b]=0;
    	dp_max[b]=0;
    	dp_min[b]=0;
    	if(s[b]=='1'){
    		child[b]++;
    	}
    	vector<pair<long long int,long long int> > mi;
    	mi.push_back(make_pair(0LL,0LL));
    	for(int go:v[b]){
    		if(go==pr)continue;
    		dfs(go,b);
    		child[b]+=child[go];
    		dp_max[b]+=dp_max[go]+child[go];
    		mi.push_back(make_pair(dp_min[go]+child[go],dp_max[go]+child[go]));
    	}
    	sort(mi.begin(),mi.end());
    	reverse(mi.begin(),mi.end());
    	long long int sz=0;
    	long long int accume=0;
    	long long int ss=0;
    	for(int i=0;i<mi.size();i++){
    		ss+=mi[i].first;
    	}
    	for(int i=1;i<mi.size();i++){
    		sz+=mi[i].first;
    		accume+=((mi[i].second-mi[i].first)/2LL)*2LL;
    	}
    	mi[0].first-=sz;
    	if(mi[0].first>0LL){
    		long long int want=mi[0].first;
    		long long int res=0;
    		if((want&1LL)!=(accume&1LL)){
    			res++;
    			want--;
    		}
    		want-=min(want,accume);
    		res+=want;
    		dp_min[b]=res;
    	}
    	else{
    		dp_min[b]=ss&1LL;
    	}
    }
     
    int main(){
    	cin>>n;
    	scanf("%s",buf);
    	s=buf;
    	for(int i=1;i<n;i++){
    		int a,b;
    		scanf("%d%d",&a,&b);
    		a--;
    		b--;
    		v[a].push_back(b);
    		v[b].push_back(a);
    	}
    	long long int ans=LLONG_MAX;
    	for(int i=0;i<n;i++){
    		dfs(i);
    		if(dp_min[i]==0LL){
    			ans=min(ans,dp_max[i]/2LL);
    		}
    	}
    	if(ans==LLONG_MAX){
    		puts("-1");
    		return 0;
    	}
    	printf("%lld\n",ans);
    	return 0;
    }

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
  int N;
  cin>>N;
  string S;
  cin>>S;
  vector<int> x={0};
  for(int i=0;i<N;i++){
    if(S[i]=='I'){
      x.push_back(*(x.end()-1)+1);
    }
    else {
      x.push_back(*(x.end()-1)-1);
    }
  }
  
  cout<<(*max_element(x.begin(),x.end()));
}

Measured memory_bytes: 256
A = list(map(int, input().split()))
B = list(map(int, input().split()))

N = A[0]
K = A[1]

a = N-1
b = 0
d = 0
for i in B:
  c = B[b]
  if K <= c:
    d = d+1
  b = b+1
print(d)

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

using namespace std;

#define ll long long int
#define ull unsigned long long int
#define REPL(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
static const int MAX = 200010;
static const ll INFTY = 1e12;
static const int NUMMAX = 300;


int main() {

  int N;
  string S;
  string ans = "No";

  cin >> N;
  cin >> S;

  if( N % 2 == 0 ){
    //cout << S.substr(0, N/2)  << S.substr(N/2, N/2) << endl;
    if( S.substr(0, N/2) == S.substr(N/2, N/2) ) ans = "Yes";
  }

  cout << ans << endl;


  return 0;

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<int, int> P;
int main(){
    int L,R,d;
    cin >> L>>R>>d;
    int ans=R/d-(L-1)/d;
    cout<<ans<<endl;
    return 0;
}

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

int main(){
	int x1, y1;
	int x2, y2;
	int x3, y3;
	int x4, y4;
	int height,width;
	cin >> x1 >> y1 >> x2 >> y2;

	height = y2 - y1;
	width = x2 - x1;

	if(0 <= width){
		x3 = x2 - height;
		y3 = y2 + width;
		x4 = x1 - height;
		y4 = y1 + width;
	}else{
		x3 = x2 - height;
		y3 = y2 + width;
		x4 = x1 - height;
		y4 = y1 + width;
	}

	cout << x3 << " " << y3 << " " << x4 << " " << y4;
	return 0;
}

Measured memory_bytes: 256
a,b,k=map(int,input().split())
if b-k+1<=a+k-1:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#define rep(i, n) for(int (i) = 1; (i) <= (n); (i)++)
//#define rep(i, n) for(int (i) = 0, TmP = (n); (i) < (int)TmP ; ++(i))
//#define int long long
#define asort(v, n) sort((v), (v + n)) //Using array
#define vsort(v) sort((v).begin(), (v).end()) // Using vector
#define vint vector<int>

using namespace std;

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

    return gcd(b, a % b);
}

signed main(){
  int n;
  long long sum = 0;
  cin >> n;
  rep(i, n){
    rep(j, n){
      rep(l, n){
        sum += gcd(gcd(i, j), l);
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3636
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

def floyd_warshall(n, dist):
    for i in range(n):
        for j in range(n):
            for k in range(n):
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k])


n, m, l = na()
abc = nan(m)
q = ni()
st = nan(q)

g = [[] for _ in range(n)]
dist = [[inf] * n for _ in range(n)]
for i in range(m):
    a, b, c = abc[i]
    a -= 1
    b -= 1
    dist[a][b] = c
    dist[b][a] = c

floyd_warshall(n, dist)

ans = [[inf] * n for _ in range(n)]
for i in range(n):
    for j in range(n):
        if dist[i][j] <= l:
            ans[i][j] = 1
            ans[j][i] = 1

floyd_warshall(n, ans)

for i in range(q):
    s, t = st[i]
    s -= 1
    t -= 1
    if ans[s][t] >= inf:
        print(-1)
    else:
        print(ans[s][t] - 1)

Measured memory_bytes: 72668
import java.util.Arrays;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		boolean index[]=new boolean[1000000];
		Arrays.fill(index, true);//
		index[0]=false;index[1]=false;
		for(int i=0;i<index.length;i++){
			if(index[i]){
				for(int j=i+i;j<index.length;j+=i){
					index[j]=false;
				}
			}
		}
		while(sc.hasNext()){
			int cnt=0;
			int n=sc.nextInt();
			for(int i=0;i<=n;i++){
				if(index[i])cnt++;
			}
			System.out.println(cnt);
		}
	}
}  

Measured memory_bytes: 22508
1.step do
  h, w = gets.chop.split(' ').map(&:to_i)
  break if h == 0 && w == 0

  1.step h do |hi|
    1.step w do |wi|
      if hi == 1 or wi == 1 or hi == h or wi == w
        putc '#'
      else
        putc '.'
      end
    end
    puts ''
  end
  puts ''
end



Measured memory_bytes: 6876
//noob
#include<bits/stdc++.h>
using namespace std;
#define fori(x) for(int i=0;i<x;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long int 
#define ld long double
#define ull unsigned long long int
#define pi acos(-1)
#define test() int T,t=1;cin>>T;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int(x.size()))
typedef vector<int> vi;
typedef pair<int,int> PI;
const int N = (int)1e6 + 7;

void solve()
{
	int n;
	cin>>n;
	cout<<!n<<endl;
}
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	//freopen("input.txt","r",stdin);
	
solve();
	return 0;
}

Measured memory_bytes: 3596
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        for i in range (h):
            for j in range (w):
                if (i + j) % 2 == 0:
                    print("#", end="")
                else:
                    print(".", end="")
            print()
        print()


Measured memory_bytes: 7000
#include <stdio.h>

int main(void) {                                                                
    int x, y, size, i, j;                                                       
    int paper[100][100] = {};                                                   
    const int S = 50;                                                           
    int nomark = 0, density = 0;                                                
    while (scanf("%d,%d,%d", &x, &y, &size) != EOF) {                           
        switch (size) {                                                         
        case 3:                                                                 
            paper[S+x+2][S+y]++;                                                
            paper[S+x-2][S+y]++;                                                
            paper[S+x][S+y+2]++;                                                
            paper[S+x][S+y-2]++;                                                
        case 2:                                                                 
            paper[S+x+1][S+y+1]++;                                              
            paper[S+x+1][S+y-1]++;                                              
            paper[S+x-1][S+y+1]++;                                              
            paper[S+x-1][S+y-1]++;                                              
        case 1:                                                                 
            paper[S+x][S+y]++;                                                  
            paper[S+x-1][S+y]++;                                                
            paper[S+x+1][S+y]++;                                                
            paper[S+x][S+y+1]++;                                                
            paper[S+x][S+y-1]++;                                                
        }                                                                       
    }                                                                           
    for (i = S; i < S + 10; i++) {                                              
        for (j = S; j < S + 10; j++) {                                          
            if (paper[i][j] == 0)                                               
                nomark++;                                                       
            else                                                                
                density = paper[i][j] > density ? paper[i][j] : density;        
        }                                                                       
    }                                                                           
    printf("%d\n%d\n", nomark, density);                                        
    return 0;                                                                   
}

Measured memory_bytes: 644
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *
from copy import *

N, C = map(int, input().split())
f1 = [list(map(int, input().split())) for i in range(N)]
f2 = deepcopy(f1)[::-1]
for i in range(N-1):
    f1[i+1][1] += f1[i][1]
    f2[i+1][1] += f2[i][1]
f1 = [[0, 0, 0]] + [(v-x, x, i) for i, (x, v) in enumerate(f1, 1)]
f2 = [[0, 0, 0]] + [(v-C+x, C-x, i) for i, (x, v) in enumerate(f2, 1)]
g1 = [0] * (N+1)
g2 = [0] * (N+1)
for i in range(1, N+1):
    g1[i] = max(f1[i][0], g1[i-1])
    g2[i] = max(f2[i][0], g2[i-1])
ans = 0
for i in range(N+1):
    ans = max(ans, f1[i][0]+g2[N-i]-f1[i][1], f2[i][0]+g1[N-i]-f2[i][1])
print(ans)


Measured memory_bytes: 66164
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let item = buf.split_whitespace().filter_map(|x| x.parse::<i64>().ok());
    for (ix, v) in item.enumerate() {
        if v == 0 {
            println!("{}", ix + 1);
        }
    }
}


Measured memory_bytes: 2136
S = input()
result = 0
i = 0
while i < len(S):
    count_L = 0
    while i < len(S) and S[i] == '<':
        count_L += 1
        i += 1
    count_R = 0
    while i < len(S) and S[i] == '>':
        count_R += 1
        i += 1
    result += count_L * (count_L - 1) // 2 + count_R * (count_R - 1) // 2 + max(count_L, count_R)
print(result)

Measured memory_bytes: 4108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
int main()
{
	ll N,K,x,y;
	cin >> N >> K;
	
	x = N%K;
	y = (x - K)*(-1);

	cout << min(x,y);

	cin >> N;
	return 0;
}

Measured memory_bytes: 256