akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
template <class... T> void printd(T&&...){ }
template <class... T> void printArr(T&&...){ }
#endif

int main(){
    int n; cin >> n;
    vector<int> as(n * 3);
    for(int i = 0; i < n * 3; i++){
        cin >> as[i];
    }
    ll lsum = 0, rsum = 0;
    priority_queue<int, vector<int>, greater<int>> lpq;
    for(int i = 0; i < n; i++){
        lsum += as[i];
        lpq.push(as[i]);
    }
    map<int, int> rs, rl;
    vector<int> as2(as.begin() + n, as.end());
    sort(as2.begin(), as2.end());
    for(int i = 0; i < n; i++){
        rsum += as2[i];
        rs[as2[i]]++;
        rl[as2[i + n]]++;
    }
    ll ans = lsum - rsum;
    for(int i = n; i < n * 2; i++){
        printd(ans, lsum, rsum, rs, rl);
        lpq.push(as[i]);
        int mini = lpq.top(); lpq.pop();
        printd(as[i], mini);
        lsum = lsum + as[i] - mini;
        if(rl.count(as[i]) && rl[as[i]]){
            rl[as[i]]--;
            if(rl[as[i]] == 0){
                rl.erase(as[i]);
            }
        }else{
            rs[as[i]]--;
            int mini = rl.begin()->first;
            rs[mini]++;
            rl[mini]--;
            if(rl[mini] == 0){
                rl.erase(mini);
            }
            rsum = rsum - as[i] + mini;
        }
        ans = max(ans, lsum - rsum);
    }
    cout << ans << '\n';
    return 0;
}


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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

    // 入力
    string s;
    cin >> s;
    string t;
    cin >> t;

    // 処理
    sort(all(s));
    sort(all(t), greater<char>());

    // 出力
    cout << (s < t ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<queue>
#include<stdlib.h>
#include<vector>
#include<stack>
#include<string>
using namespace std;
const int maxn = 100000;
char num[maxn];
char sum[maxn];
int main()
{
    while(scanf("%s", num)!=EOF)
    {
        for(int i=0; i<maxn; i++)
        {
            sum[i]=='A';
        }
        int k=0;
        int count_=0;
        int len=strlen(num);
        for(int i=0; i<len; i++)
        {
           if(num[i]!='A')
           {
               sum[count_++]=num[i];
           }
           if(num[i]=='A')
           {
               if(num[i-1]=='H'||num[i-1]=='B'||num[i-1]=='R'||i==0)
               {
                   k++;
               }
               else
               {
                   k=k+10;
               }
           }
        }
        //printf("%d ", count_);
        if(count_==5&&sum[0]=='K'&&sum[1]=='I'&&sum[2]=='H'&&sum[3]=='B'&&sum[4]=='R')
        {
            if(k<10)
            {
                printf("YES\n");
            }
            else
            {
                printf("NO\n");
            }
        }
        else
        {
            printf("NO\n");
        }
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Dynamic;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int okane = 0;
            while (true)
            {
                if(okane >= N)
                {
                    Console.WriteLine(okane - N);
                    break;
                }
                okane += 1000;
            }
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 27536
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<vector>
#include<algorithm>

#define max 100000
std::vector<int>a;
long long int sum[max];

int main(){
    int n;
    scanf("%d",&n);
    int i;
    for(i=0;i<=n-1;i++){
        int x;
        scanf("%d",&x);
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    sum[0]=a[0];
    for(i=1;i<=n-1;i++){
        sum[i]=sum[i-1]+a[i];
    }
    int ans=n,k=n-2;
    while(ans==n &&k>=0){
        if(sum[k]*2<a[k+1])ans=n-k-1;
        k--;
    }
    printf("%d",ans);
    
    return 0;
}


Measured memory_bytes: 1528
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

int main()
{
    long long X,Y;
    cin >> X >> Y;
    int cnt = 1;
    long long power = Y / X;
    while(powl(2, cnt) <= power){
        cnt++;
    }
    cout << cnt << endl;

    return 0;
}

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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

const double eps = 1e-9;

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

    int n;
    cin >> n;
    vt<pii> a(n);
    for (pii &i : a) cin >> i.fi >> i.se;

    auto findCircle0 = [&](double x, double y) {
        double l = 0, r = 710;
        while (l * (1 + eps) < r) {
            double mi = (l + r) / 2;

            bool ok = true;
            for (int i = 0; i < n; i++) {
                if (hypot(a[i].fi - x, a[i].se - y) > mi * (1 + eps)) {
                    ok = false;
                    break;
                }
            }

            if (ok) r = mi;
            else l = mi;
        }

        return l;
    };

    auto findCircle1 = [&](double x) {
        double yl = 0, yr = 1000;
        while (yl * (1 + eps) < yr) {
            double y1 = (2 * yl + yr) / 3,
                   y2 = (yl + 2 * yr) / 3;

            if (findCircle0(x, y1) < findCircle0(x, y2)) yr = y2;
            else yl = y1;
        }

        return findCircle0(x, yl);
    };

    double xl = 0, xr = 1000;
    while (xl * (1 + eps) < xr) {
        double x1 = (2 * xl + xr) / 3,
               x2 = (xl + 2 * xr) / 3;

        if (findCircle1(x1) < findCircle1(x2)) xr = x2;
        else xl = x1;
    }

    cout << setprecision(7) << fixed << findCircle1(xl);
}


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

int main() {
	//入力
	string S;
	cin >> S;

	//処理
	string ans = "";
	int num = S.size() - 2;
	ans = S.at(0) + to_string(num) + S.at(S.size() - 1);

	cout << ans << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
a = [list(map(int, input().split())) for i in range(N)]
b = [list(map(int, input().split())) for i in range(M)]
for i in range(N):
    minSum = 999999999999999999
    index = 0
    for j in range(M):
        current = abs(a[i][0] - b[j][0]) + abs(a[i][1] - b[j][1])
        if minSum > current:
            minSum = current
            index = j+1
    print(index)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
long long keisan(long long H){
  while(1){
    if(H==1){
      return 1;
    }
    if(H==2){
      return 3;
    }
    else{
      return keisan(H/2)*2+1;
    }
  }
}
int main() {
  long long H,tmp;
  cin>>H;
  cout<<keisan(H);
}

Measured memory_bytes: 256
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,k = list(map(int, input().split()))
a = list(map(int, input().split()))
s = sum(a)
def fs(n):
    s = set()
    for i in range(1,int(n**0.5)+2):
        if n%i==0:
            s.add(i)
            s.add(n//i)
    l = sorted(list(s))
    return l
l = fs(s)
def sub(v):
    val0 = [item%v for item in a if item%v!=0]
    val1 = [(v-item)%v for item in val0]
    val0.sort()
    val1.sort(reverse=True)
#     print(val0,val1)
    i = 0
    j = len(val0)-1
    ans = 0
    while i<j:
        if val0[i]<val1[j]:
            val1[j] -= val0[i]
            ans += val0[i]
            i += 1
        else:
            val0[i] -= val1[j]
            ans += val1[j]
            j -= 1
    return ans
for v in reversed(l):
    if k>=sub(v):
        break
print(v)

Measured memory_bytes: 69004
require "set"
def x(h, w, s)
  x = Set.new
  h.times do |i|
    w.times do |j|
      x << i if s[i].all?{|c| c == ?.}
    end
  end
  x
end
H,W=gets.split.map &:to_i
S=H.times.map{gets.chomp.chars}
T=S.transpose
h=x(H,W,S)
w=x(W,H,S.transpose)
H.times do |i|
  next if h.include?(i)
  W.times do |j|
    next if w.include?(j)
    print S[i][j]
  end
  puts
end


Measured memory_bytes: 2940
n, s = gets.split(" ").map(&:to_i)
alist = gets.split(" ").map(&:to_i)
m = 998244353

dp = Array.new(n+1) { Array.new(s+1, 0)}
dp[0][0] = 1

for i in 0..n-1 do
    for j in 0..s do
        dp[i+1][j] = (dp[i+1][j] + (dp[i][j] << 1)) % m
        if j + alist[i] <= s then 
            dp[i+1][j + alist[i]] = (dp[i+1][j + alist[i]] + dp[i][j]) % m
        end     
    end
end

print dp[n][s]

Measured memory_bytes: 84784
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;
using db = long double;
template<class T> bool umin(T &x,T y) { if (x<y) return 0; x=y; return 1; }
template<class T> bool umax(T &x,T y) { if (x>y) return 0; x=y; return 1; }

int const INF=1e9;

struct dist_func {
	ll l1,r1,l2,r2,m1,m2;

	ll operator()(ll t) const {
		return max({r1+t,r2-t,m2})-min({l1+t,l2-t,m1});
	}
};

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	ll r1,r2,l1,l2,x1,x2,d1,d2,u1,u2,y1,y2;
	r1=l1=x1=d1=u1=y1=INF;
	r2=l2=x2=d2=u2=y2=-INF;
	
	int N;
	cin>>N;
	rep(i,0,N) {
		ll x,y;
		string s;
		cin>>x>>y>>s;
		x*=2;
		y*=2;
		switch (s[0]) {
			case 'R':
				umin(r1,x),umax(r2,x),umin(y1,y),umax(y2,y);
				break;
			case 'L':
				umin(l1,x),umax(l2,x),umin(y1,y),umax(y2,y);
				break;
			case 'U':
				umin(u1,y),umax(u2,y),umin(x1,x),umax(x2,x);
				break;
			case 'D':
				umin(d1,y),umax(d2,y),umin(x1,x),umax(x2,x);
				break;
			default:
				throw;
		}
	}
	
	dist_func dx{r1,r2,l1,l2,x1,x2};
	dist_func dy{u1,u2,d1,d2,y1,y2};
	ll res=dx(0ll)*dy(0ll);
	rep(t,1,int(2e8)) res=min(res,dx(ll(t))*dy(ll(t)));
	cout<<db(res)/4<<"\n";
}


Measured memory_bytes: 384
#include <iostream>
#include<vector>
#include<map>
#include<string>
#include<stdio.h>
#include<math.h>
#include <algorithm>

#define PI		3.14159265358979
#define IMAX	2147483647

using namespace std;

int main(void) {


	int ans = 0;

	int n;
	cin >> n;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		int tmp;
		cin >> tmp;
		v.push_back(tmp);
	}

	for (int i = 1; i < v.size() - 1; i++) {
		vector<int> tmp;
		tmp.push_back(v[i - 1]);
		tmp.push_back(v[i]);
		tmp.push_back(v[i + 1]);
		sort(tmp.begin(), tmp.end());
		if (tmp[1] == v[i]) ans++;

	}




	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if (x-r>=0 && x+r<=W && y-r>=0 && y+r<=H){
	   printf("Yes\n");
	} else{
	   printf("No\n");
	}
    return 0;
}


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

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "

#define llint long long int

#define INF (long long)1e9+1
#define MOD (long long)1e9+7
#define INF64 (long long)1e18+1

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000

int main (void)
{
  llint N,M,L,A,B;
  llint K[MAX_N];
  llint ans;
  vector<char> C;
  bool bool_ans;

  cin >> N;
  rep(i,1,N+1) {
    if ((i<10)
      || ((i>=100)&&(i<1000))
      || (i>=10000)&&(i<100000)) {
      ans++;
    }
  }
  put(ans);

  return 0;
}


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

int main()
{
    int n;
    cin >> n;
        double t,a;
        cin >> t >> a;
        double ans = 0;
        double minn = 0xfffffff;
        double x;
        for(int i = 0;i <n;i++)
        {
            cin >> x;
            if(abs(t-0.006*x - a)< minn)
            {
                minn = abs(t-0.006*x-a);
                ans = i+1;
            }
        }
        cout << ans << endl;
    return 0;
}


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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int main() {

  for(int n;cin>>n,n;) {
    vector<int> a(n);
    for (int m=n;m--;) cin >> a[m];
    sort(all(a));
    int t=0;
    for (int m=n-1;--m;) t+=a[m];
    cout<<t/(n-2)<<endl;
  }

  return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include<vector>
#include<climits>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<functional>
#include <numeric>
#include <map>
#include <tuple>
#include <string>
#define FORi(N) for(int i=0;i<N;++i)
#define FORj(N) for(int j=0;j<N;++j)
#define FORk(N) for(int k=0;k<N;++k)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll gcd(ll m,ll n){
  if(n==0)return abs(m);
  return(gcd(n,m%n));
}
void putYN(bool b){
  if(b){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}
void swap(ll &a,ll &b){
  ll tmp=a;
  a=b;
  b=tmp;
}
int main(){
  ll N;
  cin>>N;
  vector<vector<ll>> XY(N);
  FORi(N){
    ll x,y;
    cin>>x>>y;
    XY[i]=vector<ll>{x,y};
  }
  sort(XY.begin(),XY.end(),[](auto& a,auto& b)->bool{
    if(a[0]!=b[0]){
      return a[0]<b[0];
    }else{
      return a[1]<b[1];
    }
  });
  ll min_=LLONG_MAX;
  if(N==1){
    cout<<1<<endl;
    return 0;
  }
  for(ll l=0;l<N;++l){
  for(ll i=l+1;i<N;++i){
    ll p = XY[i][0]-XY[l][0];//0?
    ll q = XY[i][1]-XY[l][1];//qがマイナスになるかも
    ll num=N;
    vector<bool> flag(N,false);
    for(ll j=0;j<N;++j){
      ll x = XY[j][0];
      ll y = XY[j][1];
      for(ll k=j+1;k<N;++k){
        if(flag[k]==true)continue;
        if(p==0){
          
          if(x==XY[k][0]&&y+abs(q)==XY[k][1]){
            y+=abs(q);
            num--;
            flag[k]=true;
          }
          continue;
        }
        if(x+p==XY[k][0]&&y+q==XY[k][1]){
          x+=p;
          y+=q;
          num--;
          flag[k]=true;
        }
      }
      min_=min(min_,num);
    }
  }
  }
  cout<<min_<<endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
 
def gcd(a,b):
    a,b = max(a,b),min(a,b)
    while a%b!=0:
        a,b = b,a%b
    return b

mod = 10**9 + 7

l = A[0]
for i in range(1,N):
    l = (A[i]//gcd(A[i],l))*l


ans = 0
for i in range(N):
    ans+=l//A[i]
     
print(ans%mod)

Measured memory_bytes: 4084
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef vector<char> vc;
typedef vector<vector<char> > vvc;
typedef vector<double> vd;
typedef vector<vector<double> > vvd;
template<class T> using vv=vector<vector< T > >;
typedef deque<int> di;
typedef deque<deque<int> > ddi;
typedef deque<bool> db;
typedef deque<deque<bool> > ddb;

// cout pair
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
    s << p.first << " " << p.second << "\n"; return s;
}

// cout vector<pair>
template<typename T1, typename T2> ostream& operator<<(ostream& s, const vector<pair<T1, T2> >& vp) {
    int len = vp.size(); s << "\n";
    for (int i = 0; i < len; ++i) { s << vp[i]; }
    s << "\n"; return s;
}

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size(); s << "\n";
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len - 1) s << "\t";
    }
    s << "\n"; return s;
}

// cout deque
template<typename T> ostream& operator<<(ostream& s, const deque<T>& v) {
    int len = v.size(); s << "\n";
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len - 1) s << "\t";
    }
    s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
    int len = vv.size();
    for (int i = 0; i < len; ++i) { s << vv[i]; }
    return s;
}

// cout 2-dimentional deque
template<typename T> ostream& operator<<(ostream& s, const deque< deque<T> >& vv) {
    int len = vv.size();
    for (int i = 0; i < len; ++i) { s << vv[i]; }
    return s;
}

int main() {
    int n;
    cin >> n;
    vi a(n);
    rep (i, n) {
        cin >> a[i];
        --a[i];
    }
    ll ans = 0;
    rep (i, n) {
        if (i == a[a[i]]) {
            ans += 1;
        }
    }
    printf("%lld\n", ans / 2);
    return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()
#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

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

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

// prime factorization (素因数分解)
// key: value of prime factor
// value: number of prime factor
std::map<ll, ll> prime_factorization(ll n) {
  std::map<ll, ll> prime_factors;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      prime_factors[i]++;
      n /= i;
    }
  }
  if (n != 1)
    prime_factors[n] = 1;
  return prime_factors;
}

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

  ll n;
  cin >> n;

  map<ll, ll> pf;
  for (int i = 2; i <= n; i++) {
    auto f = prime_factorization(i);
    FORm(it, f) {
      pf[it->first] += it->second;
    }
  }

  ll ans = 0;
  FORm(a, pf) {
    if (a->second < 4) {
      continue;
    }
    for (auto b = next(a); b != pf.end(); b++) {
      if (b->second < 4) {
        continue;
      }
      FORm(c, pf) {
        if (c->second < 2) {
          continue;
        }
        if (b->first == c->first || c->first == a->first) {
          continue;
        }
        ans++;
      }
    }
  }

  vector<P> p;
  p.push_back(make_pair(25ll, 3ll));
  p.push_back(make_pair(15ll, 5ll));

  FORm(it, p) {
    FORm(a, pf) {
      if (a->second < it->first - 1) {
        continue;
      }
      FORm(b, pf) {
        if (b->second < it->second - 1) {
          continue;
        }
        if (a->first == b->first) {
          continue;
        }
        ans++;
      }
    }
  }

  FORm(a, pf) {
    if (a->second >= 75 - 1) {
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;
using P = pair<int, int>;
constexpr int INF = 1 << 31;

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

    vector<P> ab(N);
    for(int i = 0; i < N; ++i){
        cin >> ab[i].first >> ab[i].second;
    }
    sort(ab.begin(), ab.end());

    vector<P> cd(N);
    for(int i = 0; i < N; ++i){
        cin >> cd[i].first >> cd[i].second;
    }
    sort(cd.begin(), cd.end());

    int ans = 0;
    for(int i = 0; i < N; ++i){
        int j = 0;
        int my = -1;
        int mj = -1;
        while(cd[i].first > ab[j].first && j < N){
            if(cd[i].second > ab[j].second && ab[j].second > my){
                my = ab[j].second;
                mj = j;
            }
            ++j;
        }
        if(mj != -1){
            ++ans;
            ab[mj].second = INF;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
/*  Success may not come to me immediately,
 *  but it will come definitely....
 */
#include<bits/stdc++.h>
//=====================================================================
using namespace std;
//=====================================================================
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//=====================================================================
#define li  int64_t
#define ld  double_t
#define ulli    uint64_t
//=====================================================================
#define rep(i,a,b)  for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define repi(i,v)   for(i=v.begin();i!=v.end();i++)
#define elif        else if
#define mset(a,b)   memset(a,b,sizeof(a))
#define nl      cout<<'\n'
//=====================================================================
typedef vector<li>       vli;
typedef vector<string>   vstr;
typedef pair<li,li>      pli;
typedef pair<li,pli >    ppli;
typedef pair<li,ppli >   pppli;
typedef vector<pli >     vpl;
typedef vector<ppli >    vppli;
typedef vector<pppli >   vpppli;
//=====================================================================
#define pb  push_back
#define pob pop_back
#define pf  push_front
#define pof pop_front
#define all(v)  v.begin(),v.end()
#define itr iterator
#define sz  size()
#define lb  lower_bound
#define ub  upper_bound
#define bs  binary_search
#define mp  make_pair
#define F   first
#define S   second
//=====================================================================
#define mod (li)(1e9+7)
#define inf (li)(1e18)
#define MX1 (li)(1e5+5)
#define MX2 (li)(1e6+5)
#define pi  acos(-1)
//=====================================================================
li power(li a,li b){li ans=1;while(b){if(b&1){ans=(ans*a)%mod;}
a=(a*a)%mod;b>>=1;}return ans;}
//=====================================================================
li mmi(li n){return power(n,mod-2);}
//=====================================================================
li two(li n){return 1<<n;}
//=====================================================================
void onbit(li &n,li x){n|=two(x);}
//=====================================================================
void offbit(li &n,li x){n&=~two(x);}
//=====================================================================
li cntbit(li n){li res=0;while(n and ++res)n-=n&-n;return res;}
//=====================================================================
li dx[]={-1,0,1,0},dy[]={0,-1,0,1};
//=====================================================================
/*------------------------MAIN CODE BEGINS NOW!------------------------*/

void solve(){
    string a="ABC";
    string b;cin>>b;
    a+=b;
    cout<<a;
}

int main(){
    opt
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    li t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main () {
  int i,j,n,v,N;
  
  scanf("%d",&N);

  int A[N];
 

  for(i=0;i<N;i++) {
    scanf("%d",&A[i]);
  }
  for(n=0;n<N;n++) {
    if(n==0) {
      printf("%d",A[n]);
    }
    else{
      printf(" %d",A[n]);
    }
    }
  printf("\n");

  for(i=1;i<N;i++) {
    v = A[i];
    j = i-1;
     
      while(j>=0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
      
      }
      A[j+1] = v;
   for(n=0;n<N;n++) {
     if(n==0) {
       printf("%d",A[n]);
     }
     else{
      printf(" %d",A[n]);
     }
    }
    printf("\n");
  }

  return 0;
}
      

  

  

  
  



Measured memory_bytes: 2128
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

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

int main(void) {
	int num, k;
	long int ans = 0,a[100001] = { 0 };
	char s[100001][11] = {0};
	scanf("%d", &num);
	for (int i = 1; i <= num; i++) {
		scanf("%s", s[i]);
		qsort(s[i], 10, sizeof(char), comp);
	}
	qsort(s[1], num,11, strcmp);
	k = 0;
	a[k] = 1;
	for (int i = 1; i <= num; i++) {
		if (strcmp(s[i - 1], s[i]) == 0)a[k]++;
		else k++,a[k]++;
	}
	for (int i = 0; i <= k; i++) {
		if(a[i] > 1)ans += a[i] * (a[i] - 1) / 2;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3068
require 'pp'
n, w = gets.split.map(&:to_i)
wv = []
n.times do
  wv << gets.split.map(&:to_i)
end
wv.sort_by! { |y| y[1] }
INF = 10 ** 15
dp = Array.new(100001, INF)
dp[0] = 0
wv.each do |tw, tv|
  100000.downto(tv).each do |cv|
    dp[cv] = dp[cv-tv] + tw if dp[cv] > dp[cv-tv] + tw
  end
end
pp dp.map.with_index(0){ |di, idx| [di, idx] }.reject{ |set| set[0] > w }.last[1]

Measured memory_bytes: 8308
/*
ABHIJEET BISWAS
CSE 4th SEM 
MNNIT ALLAHBAD
https://atcoder.jp/contests/dp/tasks/dp_o
*/

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e18
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pli pair<long long,int>
#define pll pair<long long,long long>
#define MAX 1000009
#define pb push_back
#define mp map<int,int>
#define f first
#define s second
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ld pi=2.0*acos(0.0);
int n;
int arr[22][22];
int dp[1<<22];
int solve(int mask)
{
	int num =__builtin_popcount(mask);
	//cout<<num<<" "<<mask<<endl;
	if(num>=n)
	{
		//cout<<"here\n";
		return 1;
	}
	num=num+1;
	if(dp[mask]!=-1)
	return dp[mask];
	int &ans=dp[mask];
	ans=0;
	for(int i=0;i<n;i++)
	{
		if(!((mask>>i)&1) and arr[num][i+1]==1)
		ans=(ans+solve(mask|(1<<i)))%MOD;
	}
	return ans;
}
int main() {
	fastIO
	cin>>n;
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	cin>>arr[i][j];
	for(int i=0;i<=((1<<n));i++)
	dp[i]=-1;

	cout<<solve(0);
	return 0;
}

Measured memory_bytes: 10624
import java.io.*;
import java.math.*;
import java.util.*;
import java.lang.*;

// import java.text.DecimalFormat; 
// import java.text.DecimalFormatSymbols; 
 
public class Main {


    
    public static void main(String args[] ) throws Exception {
        PrintWriter pw=new PrintWriter(System.out);
        FastScanner sc = new FastScanner();
        int n  = sc.nextInt();
        int x  = sc.nextInt();
        int t  = sc.nextInt();
        int ans=0;
        int te=0;
        while(te<n){
            te+=x;
            ans+=t;
        }
        pw.println(ans);
        
        
        
        
       
        
        pw.close();
    }
    
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   public static <T> void deb(T x){
       System.out.println(x);
   }
   
   
   static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		public String next(int k) {
			try {
				return br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return "Not able to read";
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		double nextDouble() {
			return Double.parseDouble(next());
		}
		
	    
	}
   
}

Measured memory_bytes: 32792
#include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = (int)1e5 + 10;

int n;
int a[MAXN];

void work(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=i;j++){
            if(a[j]>a[i]) swap(a[i],a[j]);
        }
        for(int id=1;id<=n;id++){
            printf("%d",a[id]);
            if(id==n) printf("\n");
            else printf(" ");
        }
    }
}

int main(){
    work();
    return 0;
}



Measured memory_bytes: 2744
#include<bits/stdc++.h>
using namespace std;
double findAngle(double hour, double min1)
{
	// find position of hour's hand
	double h = (hour * 360) / 12 + (min1 * 360) / (12 * 60);

	// find position of minute's hand
	double m = (min1 * 360) / (60);

	// calculate the angle difference
	double angle = abs(h - m);

	// consider shorter angle and return it
	if (angle > 180)
		angle = 360 - angle;

	return angle;
}
int main ()
{
 double a,b,h,m;
    cin>>a>>b>>h>>m;
    

    double degrees = findAngle(h,m);

  double  radians =degrees/ (180.0/3.141592653589793238463);
    double cs =cos(radians);
   // cout<<cs<<endl;
   // cs=cs * (180.0/3.141592653589793238463);
    double ans = sqrt(a*a+b*b-2*a*b*cs);

     printf("%.18f\n", ans);
     return 0;
}


Measured memory_bytes: 4220
#include <stdio.h>

void sort(int a[], int n) {
  int i, j, t;
  for (i = 0; i < n; i++)
    for (j = i; j > 0; j--)
      if (a[j] > a[j-1]) {
	t = a[j];
	a[j] = a[j-1];
	a[j-1] = t;
      }
}

int main(void) {
  int n, m, p[1000], i, sum;

  while (1) {
    scanf("%d %d", &n, &m);
    if (n == 0 && m == 0) break;

    for (i = 0; i < n; i++)
      scanf("%d", &p[i]);

    sort(p, n);

    sum = 0;
    for (i = 0; i < n; i++)
      if ((i + 1) % m)
	sum += p[i];

    printf("%d\n", sum);
  }

  return 0;
}

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

#define int long long
const int MOD=998244353;
int dp[4001][4001];
int f(int a,int b){
  if(~dp[a][b])return dp[a][b];
  return dp[a][b]=(f(a-1,b)*b%MOD+f(a,b-1)*a%MOD+MOD-f(a-1,b-1)*(a-1)%MOD*(b-1)%MOD)%MOD;
}

signed main(){
  int a,b,c,d;cin>>a>>b>>c>>d;
  memset(dp,-1,sizeof(dp));
  for(int i=0;i<=4000;i++)for(int j=0;j<=4000;j++)if(i<a||j<b)dp[i][j]=0;
  dp[a][b]=1;
  //for(int i=0;i<10;i++)for(int j=0;j<10;j++)cout<<i<<" "<<j<<" "<<f(i,j)<<endl;
  cout<<f(c,d)<<endl;
}


Measured memory_bytes: 128940
n,k=map(int,input().split())
x=list(map(int,input().split()))
a=10**9
for i in range(n-k+1):
  d=x[i+k-1]-x[i]+min(abs(x[i]),abs(x[i+k-1]))
  a=min(a,d)
print(a)


Measured memory_bytes: 14384
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pb  push_back
#define  F   first
#define  S   second
ll N=1e3+3,M=1e9+7;
vector<ll>v;
ll a[1003],c[1003];
int main()
{
    ft
    ll t,i,j,n,m,l,r;
    for(i=3;i<=(N/i);i++)
    {
        for(j=i*i;j<=N;j+=2*i)
        {
            a[j]=1;
        }
    }
    v.pb(2);
    for(i=3;i<N;i+=2)
    {
        if(a[i]==0)
        {
            v.pb(i);
        }
    }
    ll sz=v.size();
    cin>>n;
    for(i=2;i<=n;i++)
    {
        m=i;
        for(j=0;j<sz && v[j]<=(m/v[j]);j++)
        {
            l=v[j];
            while(m%l==0)
            {
                m/=l;
                c[l]++;
            }
        }
        if(m>1)
        {
            c[m]++;
        }
    }
    r=1;
    for(i=0;i<sz;i++)
    {
        r=(r*(c[v[i]]+1ll))%M;
    }
    cout<<r<<"\n";
    return 0;
}



Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
g=[[]for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)

import sys
sys.setrecursionlimit(10**6)

lastdp=[10**9+1]*n
recode=[[10**9+1]for i in range(n)]
ans=[0]*n
from bisect import bisect_left
def rec(me,parent):
    global lastdp
    a=A[me]
    point=bisect_left(lastdp,a)
    recode[point].append(a)
    lastdp[point]=a
    tmpans=bisect_left(lastdp,10**9+1)
    ans[me]=tmpans

    for child in g[me]:
        if child!=parent:
            rec(child,me)

    recode[point].pop()
    lastdp[point]=recode[point][-1]
    return

rec(0,-1)
print(*ans,sep='\n')


Measured memory_bytes: 377004
def main():
    N,K = map(int,input().split())
    p = [0] * N
    p = list(map(int,input().split()))
    p.sort()
    ANS = 0
    for i in range(K):
        ANS += p[i]
    print(ANS)
    
if __name__ == '__main__':
    main()

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N, M, C; cin >> N >> M >> C;
    vi B(M); REP(i, M) cin >> B[i];
    int ans = 0;
    REP(i, N)
    {
        vi A(M); REP(i, M) cin >> A[i];
        int x = C;
        REP(i, M) x += A[i] * B[i];
        if(x > 0) ans++;
    }
    cout << ans << endl;
} 
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lg long long int
#define loop(i,s,e) for(lg i=s;i<=e;i++)
#define iloop(i,s,e) for(lg i=e;i>=s;i--)
#define pb push_back
#define mp make_pair
using namespace std;

lg min(lg a,lg b)
{return a<b?a:b;}
lg max(lg a,lg b)
{return a>b?a:b;}
lg lcm(lg a ,lg b)
{
    return (a*b)/__gcd(a,b);
}
int main()
{
    lg n;
    cin>>n;
    vector<lg>a(n,0);
    for(lg i=0;i<n;i++)
        cin>>a[i];
    lg ans=0;
    lg maxnow=0;
    for(lg i=0;i<n;i++)
    {
        if(a[i]>=maxnow)
            maxnow=a[i];
        else
        {
            ans+=maxnow-a[i];
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4752
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000

vector<int> get_dis(auto &E){
	vector<int> ret(E.size(),-1);
	queue<int> Q;
	Q.push(0);
	ret[0] = 0;
	
	while(Q.size()!=0){
		int u = Q.front();
		Q.pop();
		for(int i=0;i<E[u].size();i++){
			int v = E[u][i].first;
			if(ret[v]==-1){
				ret[v] = ret[u]^1;
				Q.push(v);
			}
		}
	}
	
	return ret;
}

vector<long long> assign_all(auto &E,long long fir){
	vector<long long> ret(E.size(),Inf);
	queue<int> Q;
	Q.push(0);
	ret[0] = fir;
	while(Q.size()!=0){
		int u = Q.front();
		Q.pop();
		for(int i=0;i<E[u].size();i++){
			int v = E[u][i].first;
			long long s = E[u][i].second;
			if(ret[v]==Inf){
				ret[v] = s - ret[u];
				Q.push(v);
			}
		}
	}
	return ret;
}

long long get_diff(auto &E,vector<long long> v){
	long long ret = 0;
	for(int i=0;i<E.size();i++){
		for(int j=0;j<E[i].size();j++){
			ret = max(ret,abs((v[i]+v[E[i][j].first])-E[i][j].second));
		}
	}
	return ret;
}

int main(){
	
	int n,m;
	cin>>n>>m;
	
	vector<vector<pair<int,long long>>> E(n,vector<pair<int,long long>>());
	
	for(int i=0;i<m;i++){
		int u,v,s;
		cin>>u>>v>>s;
		u--;v--;
		E[u].emplace_back(v,s);
		E[v].emplace_back(u,s);
	}
	
	vector<int> parity = get_dis(E);
	
	bool is_bin = true;
	for(int i=0;i<n;i++){
		for(int j=0;j<E[i].size();j++){
			if(parity[i]==parity[E[i][j].first]){
				is_bin = false;
			}
		}
	}
	
	vector<long long> V = assign_all(E,1);
	
	if(is_bin){
		if(get_diff(E,V)!=0){
			cout<<0<<endl;
			return 0;
		}
		long long L = 0,R = Inf;
		for(int i=0;i<n;i++){
			if(parity[i]==0){
				L = max(L,1-V[i]);
			}
			else{
				R = min(R,V[i]-1);
			}
		}
		if(R<L)cout<<0<<endl;
		else cout<<R-L+1<<endl;
	}
	else{
		long long t = get_diff(E,V);
		///cout<<t<<endl;
		V = assign_all(E,t/2+1LL);
		if(get_diff(E,V)!=0){
			cout<<0<<endl;
			return 0;
		}
		for(int i=0;i<n;i++){
			if(V[i]<=0){
				cout<<0<<endl;
				return 0;
			}
		}
		cout<<1<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)

template<class T> using V = vector<T>;
template<class T> using V2 = V<V<T>>;

void solve(){
  int n, m; cin >> n >> m;
  V<ll> a(n);  V<int> b(n);
  FOR(i,0,n) cin >> a[i];
  while(m>0){
    sort(a.begin(), a.end());
    a[n-1] /= 2;
    --m;
    ll cnt = a[n-1];
    IFOR(i,0,n){
      if(a[i]>cnt && m>0) {a[i] /= 2; --m;}
    }
  }
  ll ans = 0;
  FOR(i,0,n) ans += a[i];
  cout << ans << endl;
}

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

Measured memory_bytes: 1408
import numpy as np

A = input()
B = input()

N,X = map(int,A.split())
L = np.array(list(map(int, B.strip().split())))

L_sum = 0
jump = 1

for i in range(N):
  L_sum += L[i]
  if(L_sum>X):
    jump += 0
  else:
    jump += 1

print(jump)




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

#define speed ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ub(a,x) upper_bound(a.begin(),a.end(),x)-a.begin()
#define lb(a,x) lower_bound(a.begin(),a.end(),x)-a.begin()
#define ll long long
#define endl "\n"
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define PI 3.1415926535897932384626
#define inf 1e18
#define forn(i, n) for (int i = 0; i < int(n); i++)
int main()
{
    speed;
    ll a,b;
    cin>>a>>b;
    ll k;
    if(a==b)
        k=0;
    else if((a+b)%2==0)
        k=(a+b)/2;
    else
        k=-1;
    if(k==-1)
        cout<<"IMPOSSIBLE"<<endl;
    else
        cout<<k<<endl;

    return 0;
}



Measured memory_bytes: 256
use std::io::*;
use std::str::*;

fn main() {
    let n: i32 = read_one();
    let k: i32 = read_one();
    println!("{}", (n % k).signum());
}

fn read_one<T: std::str::FromStr>() -> T {
    let mut s = stdin().bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.trim().parse().ok().unwrap()
}

Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

double dis(ip a, ip b){
	double x = abs(a.first-b.first);
	double y = abs(a.second-b.second);
	return sqrt(x*x + y*y);
}

int main(){
	int N; cin>>N;
	double ans = 0;
	int perm[8] = {0,1,2,3,4,5,6,7};
	vector<ip> town(N);
	rep(i,N)cin>>town[i].first>>town[i].second;
	do{
		rep(i,N-1){
			ans += dis(town[perm[i]], town[perm[i+1]]);
		}
	}while(next_permutation(perm, perm+N));
	int div = 1;
	REP(i,N)div *= i;
	cout<<fixed<<setprecision(10)<<ans/div<<endl;
	return 0;
}

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

int main()
{
	string S;
	cin >> S;

	//解説みないとあがくことすらできないわけだが

	long long d[100001][4];

	d[0][0] = 1;
	d[0][1] = 0;
	d[0][2] = 0;
	d[0][3] = 0;

	repeat(i, S.length()) {
		if (S[i] == '?') {
			d[i + 1][0] = 3 * d[i][0];
			d[i + 1][1] = 3 * d[i][1] + d[i][0];
			d[i + 1][2] = 3 * d[i][2] + d[i][1];
			d[i + 1][3] = 3 * d[i][3] + d[i][2];
		}
		else {
			d[i + 1][0] = d[i][0];
			d[i + 1][1] = d[i][1];
			d[i + 1][2] = d[i][2];
			d[i + 1][3] = d[i][3];
			if (S[i] == 'A') {
				d[i + 1][1] = d[i][1] + d[i][0];
			}
			else if (S[i] == 'B') {
				d[i + 1][2] = d[i][2] + d[i][1];
			}
			else {
				d[i + 1][3] = d[i][3] + d[i][2];
			}
		}
		d[i + 1][0] %= 1000000007;
		d[i + 1][1] %= 1000000007;
		d[i + 1][2] %= 1000000007;
		d[i + 1][3] %= 1000000007;
	}

	cout << d[S.length()][3] << endl;

	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A,B;
    cin>>A>>B;
    cout <<(B%A==0?A+B:B-A)<<"\n";
}

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

int main(void){
    string S;
    int total = 700;
    cin >> S;
    if(S[0]=='o') total+=100;
    if(S[1]=='o') total+=100;
    if(S[2]=='o') total+=100;
    cout << total << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin() (a).end()


int dis[2001];
vector <int> g[2001];
int n, x, y;


void bfs(int s){
	bool visited[n+1];
	memset(visited,0,sizeof(visited));
	int distance[n+1];
	memset(distance,0,sizeof(distance));
	queue <int> q;
	q.push(s);
	visited[s] = true;
	while(q.size()!=0){
		int u = q.front();
		q.pop();
		for(int i = 0; i < g[u].size();i++){
			int  v = g[u][i];
			if(visited[v] == false){
				q.push(v);
				visited[v] = true;
				distance[v] = distance[u]+1;
				if(v>s){
					dis[distance[v]]++;
				}
			}
		}
	}
return ;
}
int main(){
	memset(dis,0,sizeof(dis));
	cin >> n>> x >> y;
	for(int i = 0 ; i< n; i++){
		g[i].pb(i+1);
		g[i+1].pb(i);
	}
	g[x].pb(y);
	g[y].pb(x);
	for(int i = 1 ; i< n ;i++)
		bfs(i);
	for(int i = 1; i < n; i++)cout<<dis[i]<<"\n";
return 0;
}


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

using namespace std;

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < v.size();i++)

#define INF 1000000000
#define pb(a) push_back(a)
#define llong long long
#define vi vector<int>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())

int main(){
	int a;
	int buf;

	REP(i,3){
		a=0;
		cin>>buf;
		a+=buf*3600;
		cin>>buf;
		a+=buf*60;
		cin>>buf;
		a+=buf;

		cin>>buf;
		a-=buf*3600;
		cin>>buf;
		a-=buf*60;
		cin>>buf;
		a-=buf;


		a*=-1;


		cout<<a/3600<<" "<<(a/60)%60<<" "<<a%60<<"\n";
	}

	return 0;
}

Measured memory_bytes: 3088
#include <iostream>
#include <cstring>
#include <cstdio>
#include<cstdint>
#include<utility>
#include<algorithm>
#include<queue>
#include<set>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define rep(i, n) for (int i = 0; i < n; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define MAX 100100
#define MAX_N 200100
#define SENTINEL 2000000000
const int MOD = 1e9+7;
#define NIL -1
const int INF = 1 << 29;
int main(){
    double a,b;
    cin>>a>>b;
    rep(i,b*100){
        if(i*8/100==a && i*10/100==b){
            cout<<i<<endl;
            exit(0);
        }
    }
    cout<<-1<<endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
struct gg{
	int id,num;	
}data[100050];
bool cop(gg x,gg y){
	return 	x.num<y.num;
}
int main(){
	int n;cin>>n;
	for(int i=1;i<=n;i++){
		int num;cin>>num;
		data[i].num=num+1;
		data[i].id=i;	
	}
	sort(data+1,data+1+n,cop);
	for(int i=1;i<=n;i++)cout<<data[i].id<<' ';
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int D;
vector<int> c(30, 0);
vector<vector<int>> s(400, vector<int>(30, 0));

struct schedule {
	int score = 0;
	vector<int> contest;
	vector<int> last;

	schedule() {
		last.assign(30, 0);
	};

	bool operator<(const schedule& s) const {
		return score > s.score;
	}
};

void input() {
	cin >> D;
	for (int i = 1; i <= 26; ++i) { cin >> c[i]; }
	for (int i = 1; i <= D; ++i) {
		for (int j = 1; j <= 26; ++j) { cin >> s[i][j]; }
	}
}

schedule calc_score(schedule sc, int con) {
	schedule ret = sc;
	int day = sc.contest.size() + 1;
	ret.last[con] = day;
	ret.contest.push_back(con);
	ret.score += s[day][con];
	for (int i = 1; i <= 26; ++i) {
		ret.score -= c[i] * (day - ret.last[i]);
	}

	return ret;
}

int main() {
	constexpr int BEAM = 300;
	input();

	vector<schedule> curr;
	curr.emplace_back(schedule());
	for (int d = 1; d <= D; ++d) {
		vector<schedule> nxt;
		for (auto sc : curr) {
			for (int i = 1; i <= 26; ++i) {
				nxt.push_back(calc_score(sc, i));
			}
		}
		sort(nxt.begin(), nxt.end());
		if (nxt.size() > BEAM) { nxt.resize(BEAM); }
		curr = nxt;
	}
	// cerr << "score = " << curr[0].score << endl;
	for (auto t : curr[0].contest) { cout << t << endl; }

	return 0;
}


Measured memory_bytes: 28136