akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <map>
#include <utility>
#include <set>
#include <climits>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int N;
    scanf("%d", &N);
    vector<pii> pos;
    for (int i = 0; i < N; ++i) {
        int x, y;
        scanf("%d %d", &x, &y);
        pos.push_back(make_pair(x, y));
    }

    if (N == 1) {
        printf("1\n");
        return 0;
    }

    int ans = INT_MAX;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            int p = pos[i].first - pos[j].first;
            int q = pos[i].second - pos[j].second;

            if (p == 0 && q == 0) {
                continue;
            }

            set<pii> all;
            for (int i = 0; i < N; ++i) {
                all.insert(pos[i]);
            }

            int total = 0;
            for (int i = 0; i < N; ++i) {
                if (all.find(pos[i]) == all.end()) {
                    continue;
                }

                ++total;

                int x = pos[i].first, y = pos[i].second;
                pii t = make_pair(x, y);
                while (all.find(t) != all.end()) {
                    all.erase(t);
                    t.first += p; t.second += q;
                }

                t = make_pair(x, y);
                t.first -= p;
                t.second -= q;
                while (all.find(t) != all.end()) {
                    all.erase(t);
                    t.first -= p; t.second -= q;
                }
            }
            ans = min(ans, total);
        }
    }
    printf("%d\n", ans);
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(true){
			int a = sc.nextInt();
			int b = 1000 - a;
			int c = 0;
			if(a == 0) break;
			while(b >= 500){
				b -= 500;
				c++;
			}
			while(b >= 100){
				b -= 100;
				c++;
			}
			while(b >= 50){
				b -= 50;
				c++;
			}
			while(b >= 10){
				b -= 10;
				c++;
			}
			while(b >= 5){
				b -= 5;
				c++;
			}
			while(b >= 1){
				b--;
				c++;
			}
			if(b == 0) System.out.println(c);
		}
	}
}

Measured memory_bytes: 17164
#include <stdio.h>
 
int main() {
  long long  n,a,m,M,c,b,i;
  c = 0;
  m = 100000000;
  M =-100000000;
  scanf("%lld",&n);
 
  for(i=1; i<=n; i++){
    scanf("%lld",&a);
    if(a>M) {
      M = a;
    } 
    if(a < m){
      m = a;
    }
    c = c+a;
  }
    printf("%lld %lld %lld\n",m,M,c);
 
  return 0;
}


Measured memory_bytes: 2112
//file_name:ABC85_C.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n,y;
    scanf("%d%d",&n,&y);

    rep(i,n+1){
        rep(j,n+1-i){
            if(10000*i+5000*j+1000*(n-i-j)==y){
                cout << i << ' ' << j << ' ' << n-i-j << endl;
                return 0;
            }
        }
    }




    cout << -1 << ' ' << -1 <<  ' ' << -1 << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n>>s1;
    if(n%2!=0)
    {
        cout<<"No"<<endl;return 0;
    }
s2=s1.substr(0,n/2);
s3=s1.substr((n/2),n/2);
(s3==s2)?cout<<"Yes":cout<<"No"<<endl;




    }



Measured memory_bytes: 3624
import java.util.*;

public class Main {
    static Knap[] knaps;
    static ArrayList<HashMap<Long, Long>> dp = new ArrayList<>();
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long w = sc.nextLong();
        knaps = new Knap[n];
        for (int i = 0; i < n; i++) {
            dp.add(new HashMap<>());
            knaps[i] = new Knap(sc.nextLong(), sc.nextLong());
        }
        Arrays.sort(knaps);
        knaps[0].sumV = knaps[0].value;
        knaps[0].sumW = knaps[0].weight;
        for (int i = 1; i < n; i++) {
            knaps[i].sumV = knaps[i - 1].sumV + knaps[i].value;
            knaps[i].sumW = knaps[i - 1].sumW + knaps[i].weight;
        }
        System.out.println(dfw(n - 1, w));
    }
    
    static long dfw(int idx, long weight) {
        if (weight < 0) {
            return Long.MIN_VALUE;
        }
        if (idx < 0) {
            return 0;
        }
        if (dp.get(idx).containsKey(weight)) {
            return dp.get(idx).get(weight);
        }
        if (weight >= knaps[idx].sumW) {
            dp.get(idx).put(weight, knaps[idx].sumV);
            return knaps[idx].sumV;
        }
        long max = Math.max(dfw(idx - 1, weight - knaps[idx].weight) + knaps[idx].value, dfw(idx - 1, weight));
        dp.get(idx).put(weight, max);
        return max;
    }
    
    static class Knap implements Comparable<Knap> {
        long value;
        long weight;
        long sumV;
        long sumW;
        
        public Knap(long value, long weight) {
            this.value = value;
            this.weight = weight;
        }
        
        public int compareTo(Knap another) {
            if (weight == another.weight) {
                return 0;
            } else if (weight < another.weight) {
                return -1;
            } else {
                return 1;
            }
        }
    }
}


Measured memory_bytes: 89824
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

int main() {

    int n,k ;
    cin >> n >> k   ;

    int sunuke[n] ;

    for (int i = 0; i < n; i++)
    {
        sunuke[i] = 0 ;
    }
    
    for (int i = 0; i < k; i++)
    {
        int d  ;
        cin >> d ;
        for (int j = 0; j < d; j++)
        {
            int a ;
            cin >> a ;
            sunuke[a-1]++ ;
        }
    }
    
    int ans = 0 ;
    
    for (int i = 0; i < n ; i++)
    {
        if(sunuke[i]==0) ans++ ;
    }

    cout << ans << endl  ;

 return 0 ;
}  


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<iomanip>

using namespace std;

int N, K;
double T, U, V, L;
double pos[200];

int main() {
	cin >> N >> K >> T >> U >> V >> L;
	for (int i = 0; i < N; i++) {
		cin >> pos[i];
	}

	double now = 0;
	double ans = 0;
	//まずは最初のニンジンまで進める。
	ans = pos[0] / U;
	now = pos[0];
	double nokori = T;
	int ninjinstock = 0;
	int ninjinidx = 1;
	//にんじんが二つある前提で、以下の実装を行ってる。
	if (N >= 2) {
		while (1) {
			while (ninjinidx < N && nokori >= (pos[ninjinidx] - now) / V) {
				//最後のニンジンまで到達しておらず、次のニンジンまで行ってもブーストが切れないとき

				if (ninjinstock < K) {
					//ニンジンが貯蔵できる場合は、貯蔵する。
					ninjinstock++;
					nokori -= (pos[ninjinidx] - now) / V;
					ans += (pos[ninjinidx] - now) / V;
					now = pos[ninjinidx];
					ninjinidx++;
				}
				else {
					//ニンジンがもうこれ以上持てない場合は、即使用して残りブースト時間をTに戻す。
					ans += (pos[ninjinidx] - now) / V;
					nokori = T;
					now = pos[ninjinidx];
					ninjinidx++;
				};
			}
			//ニンジンがもう残ってないときは、ゴールまで走るだけ
			if (ninjinidx == N) {
				if ((nokori + T * (double)ninjinstock)>= (L - now) / V) {
					//残りの持ってるすべてのストックを使って、ブースト中にゴールできる場合
					ans += (L - now) / V;
					now = L;;
				}
				else {
					//上の条件で、ゴールできない場合
					ans += ((nokori + T * (double)ninjinstock) + 
						(L - now - (nokori + (double)ninjinstock * T) * V) / U);
					now = L;
				}
				goto end;
			}

			//ここまで残ってるというのは、次のニンジンに到達するにはブースト時間が足りない時なので、そこを処理する。
			ans += nokori;
			now += nokori * V;
			nokori = 0;
			//次のニンジンんまで走らせておく
			//持ってるニンジンがあるのなら、そこで使ってブーストをする
			if (ninjinstock == 0) {
				//一本もニンジンのストックがない場合
				ans += (pos[ninjinidx] - now) / U;
				now = pos[ninjinidx];
				ninjinidx++;
				nokori = T;
				
			}else {
				//ストックがあるときは使う
				nokori = T;
				ninjinstock--;
			}

		}
	end:;
		cout << setprecision(12) << ans << endl;
	}
	else {
		//にんじんが一本しかない。
		if (nokori >= (L - now) / V) {
			//ブースト中にゴールできる場合
			ans += (L - pos[N - 1]) / V;
			now = L;
		}
		else {
			//ブースト中にゴールできない場合
			ans += nokori + ((L - now - nokori * V) / U);
			now = L;
		}
		cout << setprecision(12) << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3284
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		long count = 0;
		Map<Long, Integer> map = new HashMap<>();
		map.put(0L, 1);
		long a = 0;
		for (int i=0;i<n;i++){
			a += sc.nextInt();
			Integer num = map.get(a%m);
			if (num!=null) {
				count+=num;
				map.put(a%m, num+1);
			} else
				map.put(a%m, 1);
		}
		System.out.println(count);
		
	}

}


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

typedef long long ll;
using vi = vector<int>;
using vll = vector<ll>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

//2で何回割れるか
int f(int x) {
    int res = 0;
    while(x % 2 == 0) {
        x /= 2;
        res++;
    }
    return res;
}

//GCD(最大公約数)
ll gcd(ll a, ll b) {
   if(a < b) return gcd(b, a);
   if(b == 0) return a;
   return gcd(b, a % b);
}

//LCM(最小公倍数)
ll lcm(ll a, ll b) {
   return a / gcd(a, b) * b;  //オーバーフローする場合など 必要に応じて
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    //a -> a'
    rep(i, n) {
        if(a[i] % 2 == 1) {
            cout << 0 << endl;
            return 0;
        }
        a[i] /= 2;
    }

    //a' -> a''
    int t = f(a[0]); //2で何回割れるか
    rep(i, n) {
        if(f(a[i]) != t) {
            cout << 0 << endl;
            return 0;
        }
        a[i] >>= t; //a[i] /= 2^t
    }
    m >>= t;

    ll l = 1;
    rep(i, n) {
        l = lcm(l, a[i]);
        if(l > m) {
            cout << 0 << endl;
            return 0;
        }
    }

    m /= l;
    int ans = (m + 1) / 2;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using PP = pair<int, int>;

const int INF = 1e9;
int N;
vector<PP> G[100000];

int dij(int st) {
  priority_queue<PP, vector<PP>, greater<PP>> Q;
  Q.push(PP(1, st));
  
  vector<int> dist(N, INF);
  while (!Q.empty()) {
    PP p = Q.top(); Q.pop();
    int from = p.second;
    int d = p.first;
    if (dist[from] < INF) continue;
    dist[from] = d;
    for (PP e : G[from]) {
      int to = e.first;
      int c = e.second;
      Q.push(PP(c + d, to));
    }
  }
  return dist[0];
}

int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) {
    G[i].push_back(PP((i + 1) % N, 1));
    G[i].push_back(PP(10 * i % N, 0));
  }
  cout << dij(1) << endl;
}

Measured memory_bytes: 7284
#include<bits/stdc++.h>
using namespace std;
/* Author : Ravikumar Navale */
#define fastIo() ios_base :: sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define pb push_back
#define endl  "\n"
typedef long long int ll;
vector<pair<ll,ll> >v1, v2, v3;
const ll MOD = 1e9 + 7;
const double peek = 1e7 ;

int main()
{
    fastIo();
    ll N, K;
    cin>> N >> K;
    ll A[N+1];
    ll DP[N+1];
    
    for(ll  i = 1;  i <=N ; i++)
    {
        cin >>A[i];
        DP[i] = MOD;
    }
    
    
    DP[2] = abs(A[1] - A[2]);
    
    for(ll i= 2; i <= N ; i++)
    {
        for(ll j = max(i-K,1ll); j<i ; j++)
        {
            if(DP[j] == MOD)
                DP[j] = 0;
            DP[i] = min(DP[j] + abs(A[i]-A[j]),DP[i]);
            
        }
    }
    
    cout << DP[N] ;
    
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<map>
#include<algorithm>
typedef std::pair<int,int>P;
typedef std::pair<int,P>PP;
int main()
{
	int N,M,i,a;
	PP p[1000];
	while(scanf("%d%d",&N,&M),N)
	{
		for(i=0;i<N;++i)
		{
			scanf("%d",&a);
			p[i]=PP(M/a*a,P(a,i+1));
		}
		std::sort(p,p+N);
		if(p->first==p[1].first&&p->second.first==p[1].second.first)printf("%d\n",N);
		else printf("%d\n",p->second.second);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vi x(n);
    vi y(n);
    REP(i, n) cin >> x[i] >> y[i];
    int max_z = -INF * 2;
    int min_z = INF * 2;
    int max_w = -INF * 2;
    int min_w = INF * 2;
    REP(i, n) {
        chmax(max_z, x[i] + y[i]);
        chmin(min_z, x[i] + y[i]);
        chmax(max_w, x[i] - y[i]);
        chmin(min_w, x[i] - y[i]);
    }
    cout << max(max_z - min_z, max_w - min_w) << endl;
}

Measured memory_bytes: 4760
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for A - Colorful Transceivers
	var a, b, c, d float64
	fmt.Scanf("%f %f %f %f", &a, &b, &c, &d)

	if math.Abs(a-c) <= d || (math.Abs(a-b) <= d && math.Abs(b-c) <= d) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main(void){
  long long N;
  long long MAX = 100000;
  vector<long long> a(MAX);

  for(long long i = 0; i < MAX; i++){
    a[i] = 0;
  }
  
  cin >> N;

  for(long long i = 0;i < N; i++){
    long long tmp,dec,inc;
    cin >>  tmp;
    dec = tmp - 1;
    inc = tmp + 1;
    if(dec >= 0 && inc < N){
      a[dec]++;
      a[tmp]++;
      a[inc]++;
    }else if(dec < 0){
      a[tmp]++;
      a[inc]++;
    }else if(inc >= N){
      a[tmp]++;
      a[dec]++;
    }
  }
  long long mx = 0;
  for(long long i = 0; i < MAX; i++){
    mx = max(mx,a[i]);
  }
  cout << mx << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

const int INF = 1e9;
const long long LINF = 1e18;
const double PI=3.14159265358979323846;

typedef priority_queue<int, vector<int>, greater<int>> priority_queue_asc;

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

    vector<int> f(N + 1, 1);

    for (int i = 2; i <= N; i++) {
        ++f[i];
        for (int j = i + i; j <= N; j += i) {
            ++f[j];
        }
    }

    /*
    for (int i = 1; i <= N; i++) {
        cout << i << ": " << f[i] << endl;
    }
    */

    ll ans = 0;
    for (int k = 1; k <= N; k++) {
        ans += static_cast<ll>(k) * f[k];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 41944
p=10**9+7
X, Y=map(int, input().split())

if (X+Y)%3>0:
  print(0)
  exit()
  
a=(2*X-Y)//3
b=(2*Y-X)//3

if a*b<0:
  print(0)
  exit()

ab=a+b
ue=[1]*(ab+1)
for i in range(1, ab+1):
  ue[i]=ue[i-1]*i%p
  
out=ue[-1]*pow(ue[a], p-2, p)%p
out=out*pow(ue[b], p-2, p)%p

print(out)

Measured memory_bytes: 29300
def main():
	A, B, C = map(int,input().split())
	K = int(input())
	init_max = max(A,B,C)
	init_sum = A+B+C
	mul = 2**K
	ans = init_max*(mul-1)+init_sum
	print(ans)


if __name__ == '__main__':
	main()

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;

void pre(){

}


int main()
{
  
  IOS
  ll n,m;
  cin>>n>>m;
  priority_queue<ll> pq;
  for(ll i=0;i<n;i++)
  {
    ll x;
    cin>>x;
    pq.push(x);
  }

  for(ll i=0;i<m;i++)
  {
    ll a=pq.top();
    pq.pop();
    a/=2;
    pq.push(a);
  }
  ll ans=0;
  while(!pq.empty())
  {
    ans+=(pq.top());
    pq.pop();
  }
  cout<<ans<<endl;

}
  



Measured memory_bytes: 1400
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline bool read(ll &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
int n,k,a[101010];
int main(){
int i,j;
scanf("%d",&n);
for (i=1;i<=n;++i) scanf("%d",&a[i]);
scanf("%d",&k);
for (i=1;i<=k;++i){
  int p,x;
  scanf("%d%d",&p,&x);
  int t=a[p];
  a[p]=x;
  ll ans=0;
  for (j=1;j<=n;++j) ans+=a[j];
  printf("%lld\n",ans);
  a[p]=t;
  }  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
 
using namespace std;
  
const double eps=1e-10;
 
const int dy[]={-1,-1,0,1,1, 1, 0,-1};
const int dx[]={ 0, 1,1,1,0,-1,-1,-1};
 
int main()
{
 
	vector<long> prime;
	prime.push_back(2);
	prime.push_back(3);
	prime.push_back(5);
 
	for(int i=7;prime.back()<=100000+100*100;i+=2){
		bool ok=true;
		for(int j=0;prime[j]*prime[j]<=i && ok;j++){
			if(i%prime[j]==0) ok=false;
		}
		if(ok) prime.push_back(i);
//	  if(ok) cout<<i<<endl;
	}
 
	long n;
	int p;
	while(cin>>n>>p,n!=-1){
		vector<long> v;

		long pos=lower_bound(prime.begin(),prime.end(),n)-prime.begin();
		if(prime[pos]==n) pos++;

		for(long i=pos;i<pos+p;i++){
			for(long j=i;j<pos+p;j++) v.push_back(prime[i]+prime[j]);
		}

		sort(v.begin(),v.end());
//		for(int i=0;i<v.size();i++) cout<<i<<" "<<v[i]<<endl;
//		cout<<endl;

		cout<<v[p-1]<<endl;
	}
 
 
	return 0;
}

Measured memory_bytes: 1344
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main(){
   int k,a,b;
   cin >>k;
   cin >> a>>b;
   for(int i=a;i<=b;i++){
      if(i%k==0){
         cout << "OK"<<endl;
         return 0;
      }
   }
   cout<<"NG"<<endl;
   return 0;
}

Measured memory_bytes: 3640
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
dp =[0]*(h+max(a for a,b in ab))
for i in range(1, h+1):
    dp[i] = min(dp[i-a]+b for a,b in ab)
print(dp[h])


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

int M = 1000005;

int main(){
  int n; cin >>n;
  vector<int> a(n);
  rep(i,n) cin >>a[i];
  vector<int> cnt(M);
  for(int x : a){
    if(cnt[x]!=0){
      cnt[x] = 2;
      continue;
    }
    for(int i = x; i<M; i+=x) cnt[i]++;
  }
  int ans = 0;
  for(int x : a){
    if(cnt[x]==1) ans++;
  }
  cout << ans << endl;
  return 0; 
}

Measured memory_bytes: 7952
#include <bits/stdc++.h>
#define l(i) (n / 2 - (n - i + 1) / 2)
#define r(i) ((i + 1) / 2)
#define st(i) (i / 2 - 1)
using namespace std;
typedef long long ll;
int n, a[200005];
ll dp[200005][3], ans = -1e16;  // j的范围在i/2-1到(i+1)/2，最多3个
int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++)
        for (int j = 0; j < 3; j++) dp[i][j] = -1e16;
    dp[1][1 - st(1)] = a[1], dp[1][0 - st(1)] = 0;
    for (int i = 2; i <= n; i++) {
        for (int j = l(i); j - st(i) >= 0 && j <= r(i); j++) {
            if (j == 0)
                dp[i][j - st(i)] = 0;
            else {
                for (int k = i - 2; j - 1 - st(k) >= 0 && l(k) <= j - 1 &&
                                    r(k) >= j - 1 && k >= 0;
                     k--)
                    dp[i][j - st(i)] =
                        max(dp[i][j - st(i)], dp[k][j - 1 - st(k)] + a[i]);
            }
        }
    }
    for (int i = n / 2; i <= n; i++)
        for (int j = l(i); j <= r(i); j++)
            if (j == n / 2) ans = max(ans, dp[i][j - st(i)]);
    cout << ans;
    return 0;
}


Measured memory_bytes: 9100
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#define _USE_MATH_DEFINENS
#include <cmath>
using namespace std;

#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    int ans = 0;
    int m = max(max(a, b), c);
    ans = (a + b + c) - m;
    rep(i, k){
        m *= 2;
    }
    ans = ans + m;

    cout << ans << endl;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

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

    int N;
    cin >> N;

    vector<int> V(N), C(N);
    rep (i, N) {
        cin >> V[i];
    }
    rep (i, N) {
        cin >> C[i];
    }

    int ans = -MOD;
    for (int bit = 0; bit < (1<<N); bit++) {
        int X = 0;
        int Y = 0;
        for (int i = 0; i < N; i++) {
            if (bit & (1<<i)) {
                X += V[i];
                Y += C[i];
            }
        }
        ans = max(ans, X-Y);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define arry(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;
const int MAX = 100001;


void solve()
{
        int n;
        cin>>n;
        int k;
        cin>>k;
        int a[n];
        loop(i,0,n)
        {
            cin>>a[i];
        }

        sort(a,a+n);
        int sum=0;
        loop(i,0,k)
        {
            sum+=a[i];
        }   
        cout<<sum<<"\n";


}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #else
    // // online submission
    // #endif


    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


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

int main(){
  long n,k,i,j;
  cin >> n >> k;
  vector<long> h(n+1),ans(n+1);
  for(i=0; i<n; i++){
    cin >> h[i+1];
  }
  if(n<=k-1){
    cout << abs(h[n]-h[1]) << endl; return 0;
  }
  for(i=2; i<k+2; i++){
     ans[i]=abs(h[i]-h[1]);
  }
  for(i=k+2; i<=n; i++){
    ans[i]=ans[i-1]+1000000000;
    for(j=1; j<=k; j++){
      ans[i]=min(ans[i-j]+abs(h[i]-h[i-j]),ans[i]);
    }
  }
  cout << ans[n] << endl;
}
               

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

int main(){
    double r;
    cin >> r;
    cout << r * 2 * M_PI << endl;;

    return 0;
}

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

int main(){
  
  int N; cin >> N;
  vector<int> V(N),C(N);
  for (int i=0;i<N;i++) cin >> V.at(i);
  for (int i=0;i<N;i++) cin >> C.at(i);
  int ans = 0;
  for (int i=0;i<N;i++){
    int merit = V.at(i) - C.at(i);
    if (merit > 0) ans += merit;
  }
  
  cout << ans << endl;
  
}

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

int main()
{
	int A, B, C, D;
	scanf("%d %d %d %d", &A, &B, &C, &D);

	if (A*B >= C*D)
		printf("%d\n", A*B);
	else
		printf("%d\n", C*D);

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int a[3][3];
	for(int i = 0; i < 3; i++) {
		for(int j = 0; j < 3; j++) {
			int x;cin>>x;
			a[i][j] = x;
		}
	}

	int n;cin>>n;
	for(int i = 0; i < n; i++) {
		int x;cin>>x;
		for(int i = 0; i < 3; i++) {
			for(int j = 0; j < 3; j++) {
				if (a[i][j] == x){
					a[i][j] = 0;
				}
			}
		}
	}
	for(int i = 0; i < 3; i++) {
		if (a[i][0] == a[i][1] && a[i][1] == a[i][2] && a[i][0] == 0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	for(int i = 0; i < 3; i++) {
		if (a[0][i] == a[1][i] && a[1][i] == a[2][i] && a[0][i] == 0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	if (a[0][0] == a[1][1] && a[1][1] == a[2][2] && a[0][0] == 0){
		cout << "Yes" << endl;
			return 0;
	}

	if (a[0][2] == a[1][1] && a[1][1] == a[2][0] && a[0][2] == 0){
		cout << "Yes" << endl;
			return 0;
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long

int main(){
	ll N;
	ll A;
	cin >> N;
	ll i,j,k;
	ll x,y;
	vector < vector< pair<ll,ll> > > v(N);
	for(i=0;i<N;i++){
		cin >> A;
		for(j=0;j<A;j++){
			cin >> x >> y;
			v[i].push_back(make_pair(x-1,y));
		}
	}
	ll S[N],flag,ans=0,tmp;
	pair <ll,ll> p;
	for(i=0;i < (1<<N);i++){
		for(j=0; j < N; j++){
			if (i & (1 << j)){
				S[j]=1;
			}else{
				S[j]=0;
			}
		}
		flag=1;
		for(j=0;j<N;j++){
			if(S[j]==1){
				for(auto itr=v[j].begin();itr!=v[j].end();++itr){
					p=*itr;
					if(S[itr->first]!=itr->second)flag=0;
				}
			}
		}
		tmp=0;
			if(flag==1){
				for(k=0;k<N;k++){
						tmp+=S[k];
					}
			}
			ans=max(ans,tmp);
	}
	cout << ans;
    return 0;
}


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

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

  vector<int> v(5);
  int mx = 10,index = 0;
  for(int i = 0; i < 5; i++){
    cin >> v[i];
    if(v[i]%10 < mx && v[i]%10 != 0){
      index = i;
      mx = v[i]%10;
    }
  }

  int sum = 0;
  for(int i = 0; i < 5; i++){
    while(v[i]%10 != 0) v[i]++;
    sum += v[i];
  }
  cout << sum + mx - 10 << endl;

  return 0;
}


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

using namespace std;

using ll = long long;

constexpr int kMaxN = 1e5 + 3;

vector<int> edges[kMaxN];

ll mod;

ll add(ll a, ll b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
  return a;
}

ll mul(ll a, ll b) {
  return a * b % mod;
}

using pll = pair<ll, ll>;

pll merge(pll a, pll b) {
  pll res;

  res.first = mul(a.first, b.first);
  res.second = add(
      mul(a.second, add(b.first, b.second)),
      mul(a.first, b.second)
  );

  return res;
}

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

  ll n;
  cin >> n >> mod;

  for (int i = 1; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    edges[x].emplace_back(y);
    edges[y].emplace_back(x);
  }

  vector<ll> ans(n);
  vector<pll> dp(n);

  function<pll(int, int)> dfs = [&] (int u, int p) {
    // first - white, second - black
    pll cur{1, 0};
    for (int v: edges[u]) {
      if (v != p) {
        auto res = dfs(v, u);
        cur = merge(cur, res);
      }
    }

    dp[u] = {cur.first, add(cur.first, cur.second)};

    return dp[u];
  };

  dfs(0, -1);

  function<void(int, int, pll)> fill_ans = [&] (int u, int p, pll up) {

    vector<pll> subtree;
    pll cur{1, 0};
    for (int v: edges[u]) {
      if (v != p) {
        subtree.emplace_back(dp[v]);
      }
    }

    vector<pll> pref, suf;
    cur = {1, 0};
    for (int i = 0; i < subtree.size(); ++i) {
      cur = merge(cur, subtree[i]);
      pref.emplace_back(cur);
    }

    cur = {1, 0};
    for (int i = subtree.size() - 1; i >= 0; --i) {
      cur = merge(cur, subtree[i]);
      suf.emplace_back(cur);
    }
    reverse(suf.begin(), suf.end());

    pll tmp = {1, 0};
    if (!pref.empty()) {
      tmp = merge(tmp, pref.back());
    }
    if (u) {
      tmp = merge(tmp, up);
    }
    ans[u] = add(tmp.first, tmp.second);

    int i = 0;
    for (int v: edges[u]) {
      if (v != p) {
        tmp = {1, 0};
        if (u) {
          tmp = merge(tmp, up);
        }
        if (i > 0) {
          tmp = merge(tmp, pref[i - 1]);
        }
        if (i + 1 < pref.size()) {
          tmp = merge(tmp, suf[i + 1]);
        }
        tmp.second = add(tmp.first, tmp.second);
        fill_ans(v, u, tmp);
        ++i;
      }
    }
  };

  fill_ans(0, -1, {1LL, 0LL});

  for (ll a: ans) {
    cout << a << '\n';
  }

  return 0;
}


Measured memory_bytes: 33152
import java.io.*;

public class Main {

  static int a, b, c, d;
  
  public static void main(String[] args) throws Exception {
    
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    String[] in = br.readLine().split(" ");
    a = Integer.parseInt(in[0]);
    b = Integer.parseInt(in[1]);
    c = Integer.parseInt(in[2]);
    d = Integer.parseInt(in[3]);

    br.close();

    int cnt = 0;

    while(a > 0 && c > 0){
      if(cnt % 2 == 0){
        c -= b;
      }else{
        a -= d;
      }
      cnt++;
    }

    System.out.println(a <= 0 ? "No" : "Yes");
    
  }
}

Measured memory_bytes: 32572
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
typedef long long ll;


ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

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

  vector<ll> a(n);
  string ans;
  rep(i, n){
      cin >> a[i];
      if (a[i]%2 == 0)
      {
          /* code */
          ans = ((a[i]%3 == 0) ||
                 (a[i]%5 == 0)) ? "APPROVED" : "DENIED";
          if (ans == "DENIED")
          {
              /* code */
              break;
          }
      }
      ans = "APPROVED";
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int n, a, b;
  cin >> n >> a >> b;

  int ans = min(a * n, b);
  cout << ans << endl;
}


Measured memory_bytes: 3576
n=int(input())
s=[]
for _ in range(n):
  s.append(input())
m=int(input())
t=[]
for _ in range(m):
  t.append(input())

arr=[]
cou=[0]*(n+m)
for i in s:
  if not (i in arr):
    arr.append(i)
  cou[arr.index(i)]+=1
for i in t:
  if not (i in arr):
    arr.append(i)
  cou[arr.index(i)]-=1
print(max(cou))

Measured memory_bytes: 9212
#include<iostream>
using namespace std;
int main(){
	int min=1000000, max=-1000000, n, tmp, i;
	long sum=0;
	cin >> n;
	
	for(i = 0; i < n; i++){
		cin >> tmp;
		
		if ( tmp < min){
			min = tmp;
		}
		if ( tmp > max){
			max = tmp;
		}
		sum += tmp;
	}
	cout << min << " "<< max << " "<< sum << endl;
	
	 
	return 0;	
}

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

int main(){
	ll n;
	cin >> n;
	vector<string> s(n);
	rep(i, n) cin >> s.at(i);

	rep(i, n) sort(s.at(i).begin(), s.at(i).end());
	sort(s.begin(), s.end());

	ll cnt = 1;
	ll ans = 0;
	rep(i, n-1){
		if(s.at(i) == s.at(i+1)){
			cnt++;
		}else{
			ans += (cnt*(cnt-1))/2;
			cnt = 1;
		}
	}
	ans += (cnt*(cnt-1))/2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7296
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def cmb(n, k):
    return fact[n] * fact_inv[k] % MOD * fact_inv[n-k] % MOD

def cumprod(arr, MOD):
    L = len(arr); Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]; arr[n] %= MOD
    return arr.ravel()[:L]

def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64); x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv

r1, c1, r2, c2 = lr()
MOD = 10 ** 9 + 7
U = 2 * 10 ** 6 + 10
fact, fact_inv = make_fact(U,MOD)

answer = cmb(r2+c2+2, r2+1) - cmb(r2+1+c1, r2+1) - cmb(r1+c2+1, r1) + cmb(r1+c1, r1)
print(answer % MOD)

# 16

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

using ll = long long;
const int INF = 1e9 + 1;


int main(){

	int N, Y;
	cin >> N >> Y;

	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			int k = N - i - j;
			if (k < 0)
				break;

			if (10000 * i + 5000 * j + 1000 * k == Y) {
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}

	cout << "-1 -1 -1" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
  int i,j;
  int n,t;
  cin>>t;
  rep(i,t){
    cin>>n;
    vi a(n);
    rep(j,n)
      cin>>a[j];
    int diff1=0,diff2=0;
    rep(j,n-1){
      diff1=max(diff1,a[j+1]-a[j]);
      diff2=min(diff2,a[j+1]-a[j]);
    }
    cout<<diff1<<" "<<-diff2<<endl;
  }
}

Measured memory_bytes: 3076
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n,a=0,b=0;
    string x,y;
    cin >> n;
    
    for(int i=0;i<n;i++){
        cin >> x >> y;
        if(x>y) a+=3;
        else if(x<y) b+=3;
        else{
            a++;
            b++;
        }
    }cout << a << " " << b << endl;
    
    
}


Measured memory_bytes: 3144
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H, W;
		while (sc.hasNextLine()) {
			String[] str = sc.nextLine().split(" ");
			H = Integer.parseInt(str[0]);
			W = Integer.parseInt(str[1]);
			if (H == 0 && W == 0)
				break;
			for (int y = 0; y < H; y++) {
				for (int x = 0; x < W; x++) {
					if (y == 0 || y == H - 1 || x == 0 || x == W - 1)
						System.out.print("#");
					else
						System.out.print(".");
				}
				System.out.println();
			}
			System.out.println();
		}
	}

}



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

typedef long long ll;
const int MAXN = 100010;
int n, x[MAXN], a[MAXN], w[MAXN], L, T;
ll cur;

int main()
{
	scanf("%d%d%d", &n, &L, &T);
	for(int i = 0; i < n; ++i)
	{
		scanf("%d%d", &a[i], &w[i]);
		if(w[i] == 1)
		{
			x[i] = (a[i] + T) % L;
			cur += (a[i] + T) / L;
		}
		else
		{
			x[i] = (a[i] - T) % L;
			cur += (a[i] - T) / L;
			if(x[i] < 0)x[i] += L, --cur; 
		}
	}
	cur = (cur % n + n) % n;
	sort(x, x + n);
	for(int i = cur; i < n; ++i)printf("%d\n", x[i]);
	for(int i = 0; i < cur; ++i)printf("%d\n", x[i]);
	return 0;
}

Measured memory_bytes: 2304
x1, y1, x2, y2 = gets.split.map(&:to_i)
x = x2 - x1
y = y2 - y1
x3 = x2 - y
y3 = y2 + x
x4 = x3 - x
y4 = y3 - y
puts [x3, y3, x4, y4].join(" ")


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

int main()
{
  string S;
  long long Sum=0;
  cin >> S;
  vector<int> L(S.size()+1), R(S.size()+1);
  for(int i=1; i<S.size()+1; i++){
    if(S.at(i-1)=='>') L.at(i)=0;
    else L.at(i)=L.at(i-1)+1;
  }
  for(int i=S.size()-1; i>=0; i--){
    if(S.at(i)=='<') R.at(i)=0;
    else R.at(i)=R.at(i+1)+1;
  }
  rep(i, S.size()+1) Sum=Sum+max(L.at(i), R.at(i));
  cout << Sum << endl;
}

Measured memory_bytes: 4740
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 10010010010010;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    int N;cin >> N;
    vector<vector<long long>> open(N,vector<long long>(10));
    vector<vector<long long>> money(N,vector<long long>(11));
    for(int i = 0;i<N;i++){
        for(int j = 0;j<10;j++){
            cin >> open.at(i).at(j);
        }
    }
    for(int i = 0;i<N;i++){
        for(int j = 0;j<11;j++){
            cin >> money.at(i).at(j);
        }
    } 
    long long ans = -INF;
    
    //開店しないのはダメなので0を省く
    for(int i = 1;i<(1 << 10);i++){
        bitset<11> BIT(i);
        long long nowprofit = 0;
        for(int j = 0;j<N;j++){
            int dupli = 0;
            for(int k = 0;k<11;k++){
                if(BIT.test(k) == 1 && open.at(j).at(k) == 1) dupli++;
            }
            nowprofit += money.at(j).at(dupli);
        }
        ans = max(ans,nowprofit);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
typedef pair<LL, LL> Vec2;
LL h, w, n, m, s, t, ans[1000000], b[10000000], num = 1, sum = 0;
pair<LL, LL>a[10000000];
int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i].first;
		a[i].second = i;
		if (b[a[i].first] == 1) {
			cout << "No" << endl;
			return 0;
		}
		b[a[i].first] = 1;
		ans[a[i].first] = i;
	}
	using item = std::pair<LL, LL>;
	std::sort(a+1, a+n+1);
	sum = n*n;
	for (int i = n; i >= 1; i--) {
		int num = 0;
		if (a[i].second == n)continue;
		for (int j = sum; j >= 1; j--) {
			if (ans[j] >= 1) {}
			else if(j>a[i].first){
				ans[j] = a[i].second;
				num++;
			}
			if (num == n - a[i].second) {
				sum = j;
				break;
			}
			if(j==1){
				cout << "No" << endl;
				return 0;
			}

		}
	}
	
	t = 1; sum = 0;
	for (int i = 1; i <= n*n; i++) {
		if (a[t].second == 1) {
			t++;
			if (t == n + 1)break;
		}
		if (ans[i]>=1) {}
		else {
			ans[i] = a[t].second;
			sum++;
		}
		if (sum == a[t].second-1) {
			t++;
			sum = 0;
			if (t == n+1)break;
		}
		if (a[t].first <= i) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	for (int i = 1; i <= n*n; i++) {
		cout << ans[i];
		if (i != n*n)
			cout << " ";
	}
	cout << endl;
	return 0;
}

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

using namespace std;

int a[1000];

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i<= n; i++) {
		scanf("%d", &a[i]);
	}
	int b[1000];
	bool f = true;
	for (int j=2;j<=n;j++) {
		if(a[j-1]>a[j])f = false;
	}
	if(f){
		cout << "YES" << endl;
		return 0;
	}
	int k = 0;
	for (int i = 1; i<= n-1; i++){
		int i1,j1;
		memset(b,0,sizeof(b));
		for (int j = 1;j<=n;j++) {
			b[j] = a[j];
		}
		for (int j = i+1; j<=n;j++) {
			if (b[i]>b[j]) {
				swap(b[i],b[j]);
				j1 = j;
			 f = true;
				for (int j=2;j<=n;j++) {
					if(b[j-1]>b[j])f = false;
				}
				if(f){
					cout << "YES" << endl;
			//		cout << i << ' ' << j1;
					return 0;
				}
				swap(b[i],b[j]);
			}
		}
//		bool f = true;
//		for (int j=2;j<=n;j++) {
//			if(b[j-1]>b[j])f = false;
//		}
//		if(f){
//			cout << "YES" << endl;
//			cout << i << ' ' << j1;
//			return 0;
//		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for ( int i=0;  i<n; i++)
#define REP(i, n) for ( int i=1; i<=n; i++)
#define fi first
#define sc second 
#define pb push_back
#define pf push_front 
#define mod 1000000007
using namespace std;
using f=float; using ll=long long; using ld=long double;
using ull=unsigned long long; using vi=vector<int>; using pii=pair<int, int>;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long double const pi = 3.141592653589793238462643383;

    ld r; cin >> r;
//    cout << M_PI << setprecision(20) << endl;
    cout << setprecision(15) << pi * 2.0 * r<< endl;
    return 0;
} 


Measured memory_bytes: 3808