akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

//諸機能
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(27) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //ジャッジシステムでいい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion


int main() {
	int w, h; put w >> h;
	ll ret = 0;
	vector<ll> p; p.resize(w);
	vector<ll> q; q.resize(h);
	rep(i, w) {
		put p[i];
	}
	rep(i, h) {
		put q[i];
	}
	sort(all(p));
	sort(all(q));
	ll wrem = w+1;
	ll hrem = h+1;
	int x = 0;
	int y = 0;
	p.push_back(INF);
	q.push_back(INF);
	while ( !(p[x] == INF && q[y] == INF) ) {
		dbg2(p[x], q[y]);
		if (p[x] < q[y]) {
			ret += hrem * p[x];
			dbg(hrem * p[x]);
			wrem--;
			x++;
		}
		else {
			ret += wrem * q[y];
			dbg(wrem * q[y]);
			hrem--;
			y++;
		}
	}
	
	putans(ret);

END:
	return 0;
}



Measured memory_bytes: 2560
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstring>
#include <unordered_set>
#include <chrono>
#include <cassert>

//#pragma GCC optimize("Ofast,unroll-loops,fast-math,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt")
//#pragma GCC target("avx,avx2")

using namespace std;

//#define int long long
#define pii pair<int, int>
#define mp make_pair
const int SZ = 5e5 + 4;
const int inf = 2e9;
int hashpow = 41;
int mod = 1e9 + 7;

int n, k;
int a[SZ];

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

inline void solve() {
    for (int i = k; i < n; ++i) {
        if (a[i] > a[i - k]) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
}

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

//    int t;
//    cin >> t;
//    for (int i = 0; i < t; ++i) {
        read();
        solve();
//    }

    return 0;
}

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

int main(void) {
  int n, m, k;
  cin >> n >> m >> k;

  bool ok = false;

  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      if (m * i + n * j - 2 * i * j == k) ok = true;
    }
  }
  
  cout << (ok ? "Yes" : "No") << endl;
  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 H = sc.nextInt();
            int W = sc.nextInt();
            if(H == 0 && W == 0) break;

            for(int i = 1; i <= H; i++){
                for(int j = 1; j <= W; j++){
                    if((i + j) % 2 == 0){
                        System.out.print("#");
                    }else{
                        System.out.print(".");
                    }
                }
                System.out.println();
            }
            System.out.println();

        }

    }
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> vv(H, vector<char> (W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j ++) {
      char c;
      cin >> c;
      vv.at(i).at(j) = c;
    }
  }
  vector<int> vh, vw;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (vv.at(i).at(j) == '#') {
        break;
      }
      if (j == W-1) {
        vh.push_back(i);
      }
    }
  }
  vh.push_back(-1);
  for (int i = 0; i < W; i++) {
    for (int j = 0; j < H; j++) {
      if (vv.at(j).at(i) == '#') {
        break;
      }
      if (j == H-1) {
        vw.push_back(i);
      }
    }
  }
  vw.push_back(-1);
  int h=0, w=0;
  for (int i = 0; i < H; i++) {
    if (i == vh.at(h)) {
      h++;
      continue;
    }
    for (int j = 0; j < W;j++) {
      if (j == vw.at(w)) {
        w++;
        continue;
      }
      cout << vv.at(i).at(j);
    }
    w=0;
    cout << endl;
  }
}
  

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, math.MaxInt64)
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	s := readString()
	fmt.Printf("%v%v%v\n", string(s[0]), len(s)-2, string(s[len(s)-1]))
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int A, P;
  cin >> A >> P;
  cout << (3*A+P) / 2 << endl;
  return 0;
}

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

int start[6]={2,4,5,3,1,6};
int now[6],next[6];

void ns(int from,int to){
	int d[2][6]={0,5,2,4,1,3,4,0,5,2,1,3};
	for(int i=0;i<6;i++){
		next[d[to][i]] = now[d[from][i]];
	}
}

void ew(int from,int to){
	int d[2][6]={4,3,5,1,2,0,3,5,1,4,2,0};
	for(int i=0;i<6;i++){
		next[d[to][i]] = now[d[from][i]];
	}
}

void rl(int from,int to){
	int d[2][6]={0,1,2,3,4,5,1,2,3,0,4,5};
	for(int i=0;i<6;i++){
		next[d[to][i]] = now[d[from][i]];
	}
}

int main(void){
	int n,sum;
	string s;

	while(cin>>n && n){
		sum = 1;
		copy(start,start+6,now);

		while(n--){
			cin>>s;

			if(s == "North"){ns(0,1);}
			else if(s == "South"){ns(1,0);}
			else if(s == "East"){ew(0,1);}
			else if(s == "West"){ew(1,0);}
			else if(s == "Right"){rl(0,1);}
			else{rl(1,0);}

			copy(next,next+6,now);
			sum += now[4];
		}
		cout<<sum<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
// インクルード
#include <bits/stdc++.h>

// 名前空間省略
using namespace std;

// メイン関数
int main()
{
    // 標準入出力　高速化
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    
    switch(n%10){
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        cout << "hon" << endl;
        break;

    case 0:
    case 1:
    case 6:
    case 8:
        cout << "pon" << endl;
        break;

    case 3:
        cout << "bon" << endl;
        break;
    }
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,zx,xc,f[200009];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	for(i=1; i<=a; i++) cin>>f[i];
	sort(f+1,f+a+1);
	for(i=1; i<=b; i++) c+=f[i];
	cout<<c;
	return 0;
}

Measured memory_bytes: 3668
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	int data_n;
	cin >> data_n;
	while (data_n--){
		int n, k;
		cin >> n >> k;
		vector<int> home(n);
		REP(i, n){
			cin >> home[i];
		}
		vector<int> sub;
		REP(i,n-1){
			sub.push_back(home[i + 1] - home[i]);
		}
		RSORT(sub);
		int ans = home[n - 1] - home[0];
		if (n > k){
			REP(i, k - 1){
				ans -= sub[i];
			}
			cout << ans << endl;
		}
		else{
			cout << 0 << endl;
		}
	}
		
}

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

using namespace std ;
#define   ll long long
#define   null NULL
#define   endl '\n'
#define   mp make_pair
#define   pb push_back
#define   ff first
#define   ss second

ll mod = (ll)(1e9 + 7);
ll inf = (ll)(1e17 + 17);
vector <vector <char>> v (1000, vector<char> (1000)) ;
vector <vector <int>> dp (1000, vector<int> (1000)) ;
int N , M ;

int main () {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	cin >> N >> M ;
	for (int i = 0 ; i < N ; i++) {
		for (int j = 0 ; j < M ; j++) {
			cin >> v[i][j] ;
			dp[i][j] = 0 ;
		}
	}
	bool flag = 0 ;
	for (int i = 0 ; i < N ; i++) {
		if (v[0][i] == '#') {
			flag = 1 ;
		}
		if (!flag)
			dp[0][i] = 1 ;
		else dp[0][i] = 0 ;
	}
	flag = 0 ;
	for (int j = 0 ; j < M ; j++) {
		if (v[j][0] == '#') {
			flag = 1 ;
		}
		if (!flag)
			dp[j][0] = 1 ;
		else dp[j][0] = 0 ;
	}
	for (int i = 1 ; i < N ; i++) {
		for (int j = 1 ; j < M; j++) {
			if (v[i][j] == '#') {
				dp[i][j] = 0 ;
			}
			else dp[i][j] = (dp[i][j - 1] % mod + dp[i - 1][j] % mod) % mod ;
		}
	}
	cout << dp[N - 1][M - 1] % mod ;
	return 0 ;
}

Measured memory_bytes: 8584
#define _USE_MATH_DEFINES
#include <sstream> //string stream its useful!
#include<string>
#include<iostream>
#include<utility> //pair
#include <vector> // vector
#include <algorithm>    // swap,sort,binary_search
#include <functional>   // std::greater
#include <map> //map
#include<set> //set
#include<queue> //queue
#include<list> //list
#include<cmath>
#include<numeric>
#include<cassert>
#include <iomanip> //cout<<setprecision
#include <regex>

typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
ll W = 1000000007;
// tuple にすれば回るんじゃないかな。


using namespace std;
void omajinai() {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(15);
    //freopen("txt.csv","r",stdin);
}



static function<ll(ll,ll)> sumfunc = [](ll l1,ll l2)->ll{return l1 + l2;};
class UF{
public:
    vector<ll> v;
    vector<ll> v2;
    function<ll(ll,ll)> func;
    UF(long t,function<ll(ll,ll)> func){
        v = vector<ll>(t);
        v2 = vector<ll>(t);
        for(int i = 0; i<v.size();i++) v[i] = i;
        this->func = func;
    }
    long getunion(long t){
        if(v[t] == t) return t;
        v[t] = getunion(v[t]);
        return v[t];
    }
    void unite(pair<long,long> p){
        long a = getunion(p.first), b = getunion(p.second);
        if(a>b) swap(a,b);
        v[b] = a;
        v2[a] = func(v2[b],v2[a]);
    }
    long sizeofunion(){
        long sum = 0;
        for(int i = 0 ; i<v.size();i++) if(v[i] == i ) sum++;
        return sum;
    }
};

class Main{
public:
    
    int M,N;
    vector<vector<char> > A,B;
    
    Main(){
        cin>>N>>M;
        A =vector<vector<char> >(N,vector<char>(N));
        B =vector<vector<char> >(M,vector<char>(M));
        REP(i,N) REP(j,N){
            cin>>A[i][j];
        }
        REP(i,M) REP(j,M){
            cin>>B[i][j];
        }
        
    }
    
    void run(){
        bool isok;
        REP(i,N-M+1)REP(j,N-M+1){
            isok = true;
            REP(k,M)REP(l,M){
                isok = isok & (A[i+k][j+l]== B[k][l]);
            }
            if(isok){cout<<"Yes"<<endl; return;}
        }
        cout<<"No"<<endl;
        return;
    }
};

int main(){
    omajinai();
    Main().run();
}


Measured memory_bytes: 256
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 09/12/20 01:19:46
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  ll n,k; cin>>n>>k;
  vector<ll> M, P;
  int zs = 0;
  for (int i = 0; i < n; i++) {
    ll a; cin>>a;
    if (a < 0)
      M.push_back(-a);
    else
      P.push_back(a);
    if (a == 0)
      zs++;
  }
  sort(M.begin(), M.end());
  sort(P.begin(), P.end());
  ll minuses = M.size() * P.size();
  if (k <= minuses) {
    P.erase(P.begin(), upper_bound(P.begin(), P.end(), 0));
    auto count_check = [&](ll x) {
      ll res = 0;
      if (x == 0) {
        res = M.size() * P.size();
      } else {
        for (auto m : M) {
          res += P.end() - lower_bound(P.begin(), P.end(), (x-1)/m+1);
        }
      }
      return k <= res;
    };
    ll l = 0, r = 1e18+1;
    while (l+1 < r) {
      auto c = (l+r)/2;
      if (count_check(c)) {
        l = c;
      } else {
        r = c;
      }
    }
    cout << -l << endl;

  } else {
    k -= minuses;
    auto count_check = [&](ll x) {
      ll res = 0;
      for (int i = 0; i < P.size(); i++) {
        if (P[i] == 0) {
          if (x >= 0)
            res += i;
        } else {
          res += upper_bound(P.begin(), P.begin()+i, x/P[i]) - P.begin();
        }
      }
      for (int i = 0; i < M.size(); i++) {
        res += upper_bound(M.begin(), M.begin()+i, x/M[i]) - M.begin();
      }
      return k <= res;
    };
    ll l = -1, r = 1e18;
    while (l+1 < r) {
      auto c = (l+r)/2;
      if (count_check(c)) {
        r = c;
      } else {
        l = c;
      }
    }
    cout << r << endl;
  }

  return 0;
}


Measured memory_bytes: 5596
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] n = sc.next().toCharArray();
        if (n[0] == n[1] || n[1] == n[2] || n[2] == n[3]) {
            System.out.println("Bad");
        } else {
            System.out.println("Good");
        }
    }
}


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

#define ll 					long long
#define db					double
#define ull 				unsigned long long
#define pii 				pair<int,int>
#define fi 					first
#define se 					second
#define vi 					vector<int>
#define vl					vector<ll>
#define psb 				push_back
#define ppb 				pop_back
#define all(x)			 	(x).begin(),(x).end()
#define sz(x)				(int)(x).size()
#define endln 				printf("\n")
#define gc					getchar_unlocked
#define setmin(x)			memset((x), -1, sizeof((x)))
#define setnul(x)			memset((x), 0, sizeof((x)))
#ifndef getchar_unlocked
#define getchar_unlocked 	getchar
#endif
const int inf = 1e9 + 5;
const ll infll = 1e18+5;
const int mod = 998244353;

template <typename T>
void gi(T &ret) {
	ret = 0; char inp=gc(); int kl=1;
	while (inp<'0' || inp>'9') {if (inp=='-') kl=-1; inp=gc();}
	while ('0'<=inp && inp<='9') ret=(ret<<3)+(ret<<1)+(inp-'0'), inp=gc();
	if (kl<1) ret=-ret;
}

const int MAXN = 3e5+5;
ll fakt[MAXN], inv[MAXN];

ll pk (ll x, int k) {
	if (k==1) return x;
	ll ret = pk(x,k/2);
	ret = (ret * ret)%mod;
	if (k&1) ret = (ret * x)%mod;
	return ret;
}

void precomp() {
	fakt[0] = fakt[1] = inv[0] = inv[1] = 1ll;
	for (int i=2; i<MAXN; i++) {
		fakt[i] = (fakt[i-1] * (ll)i)%mod;
		inv[i] = pk(fakt[i],mod-2);
	}
}

ll kombin (int v, int k) {
	ll ret = (fakt[v] * inv[v-k])%mod;
	ret = (ret * inv[k])%mod;
	return ret;
}

ll n, va, vb, vk;

ll solve () {
	ll ret = 0ll;
	for (ll i=0; i<=n; i++) {
		ll need = vk - (va * i);
		if (need<0) break;
		if (need%vb) continue;
		need /= vb;
		if (need>n) continue;
		// printf ("masuk\n");
		// printf ("%d %d %d %d\n", n, i, n, (int)need);
		ret += (kombin(n,i) * kombin(n,(int)need))%mod;
		ret %= mod;
	}
	return ret;
}

int main() {
	precomp();
	gi(n); gi(va); gi(vb); gi(vk);
	printf ("%lld\n", solve());
	return 0;
}

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

int main()
{
  long int a,b,c,k,t;
  
  scanf("%ld", &a);
  scanf("%ld", &b);
  scanf("%ld", &c);
  scanf("%ld", &k);
  
  if(k <= a)
  {
    printf("%ld", k);
  }else if(k <= a + b)
  {
    t = a;
    printf("%ld", t);
  }
  else 
  {
    t = a - (k - (a + b));
    printf("%ld", t);
  }
  return 0; 
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int g[500][500];
void calc(vector<int> &v,int l){
	if(v.size()<=1)
		return;
	vector<int> a[2];
	for(int i=0;i<v.size();++i)
		a[i&1].push_back(v[i]);
	for(auto x:a[0])
		for(auto y:a[1])
			g[x][y]=g[y][x]=l;
	calc(a[0],l+1);
	calc(a[1],l+1);
}
int main(){
	cin>>n;
	vector<int> v(n);
	for(int i=0;i<n;++i)
		v[i]=i;
	calc(v,1);
	for(int i=0;i<n;++i){
		for(int j=i+1;j<n;++j)
			printf("%d ",g[i][j]);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N,M,X,Y;
    cin >> N >> M >> X >> Y;
    vector<int> x(N),y(M);
    for(int i=0; i<N; i++){
        cin >> x.at(i);
    }
    for(int i=0; i<M; i++){
        cin >> y.at(i);
    }
    int count=0;
    for(int i=X+1; i<=Y; i++){
        for(int j=0; j<N; j++){
            if(x.at(j)>=i){
                count++;
                break;
            }
        }
        for(int k=0; k<M; k++){
            if(y.at(k)<i){
                count++;
                break;
            }
        }
        if(count==0){
            cout << "No War" << endl;
            return 0;
        }
        count=0;   
    }
    cout << "War" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    ll n;
    cin >> n;
    vector<ll> a(5);
    for(int i = 0; i < 5; ++i)  cin >> a[i];
    ll mine = *min_element(a.begin(), a.end());
    ll ans = n / mine + 5;
    if(n % mine == 0)   --ans;
    cout << ans << endl;
}

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

 
int main() {
    int n,m;
    cin>>n>>m;
    map<int,int> A,B;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        if(a==1)B[b]=1;
        if(b==n)A[a]=1;
    }
    for(auto p:A){
        if(B[p.first]==1){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll inf=1e9+7;
const ll mod=1e9+7;
int main(){
    ll n;cin>>n;
    vector<ll>a(n);
    rep(i,n)cin>>a[i];
    sort(all(a));
    ll ma=a[n-1];
    ll mi=ma;
    ll j=a[0];
    rep(i,n-1){
        if(mi>abs((ma+1)/2-a[i])){
            mi=abs((ma+1)/2-a[i]);
            j=a[i];
        }
    }
    cout<<ma<<' '<<j<<endl;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, d float64
	fmt.Scan(&a, &b, &c, &d)

	ans := math.Min(b, d) - math.Max(a, c)
	if ans < 0 {
		ans = 0
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string.h>
using namespace std;

#define ii pair<ll, ll>
#define ll long long
int min(int a, int b)
{
	return (a < b ? a : b);
}
ll max(ll a, ll b)
{
	return (a > b ? a : b);
}
int abso(int x)
{
	return (x >= 0 ? x : -x);
}

int N;
long double P[3000];

long double MEMO[3000][3000];

long double dp(int k, int i)
{
	if (k == 0)return 1.0;
	if (i < 0)return 0.0;
	if (MEMO[k][i] >= 0.0)return MEMO[k][i];
	return MEMO[k][i] = dp(k - 1, i - 1)*P[i] + dp(k, i - 1)*(1 - P[i]);
}
int half(int n)
{
	return n / 2 + 1;
}
int main()
{
	cout.precision(11);
	cin >> N;
	memset(MEMO, -1.0, sizeof MEMO);
	for (int i = 0; i < N; i++)cin >> P[i];
	cout << dp(half(N-1), N - 1) << endl;
}

Measured memory_bytes: 141056
#include<bits/stdc++.h>
using namespace std;
int main()
{
   map<int,int>m;
   int i,j,k,l,c,r;
    cin>>c>>r;
     for(i=0;i<r;i++){
      cin>>j>>k;
      m[j]++;m[k]++;
   }
    for(i=1;i<=c;i++){
    cout<<m[i]<<endl;
  }
      

}

Measured memory_bytes: 256
n=int(input())
R=[]
for i in range(n):
    R.append(int(input()))
Rmin=R[0]
Rmax=-2000000000
for i in range(1,n):
    Rmax=max(Rmax,R[i]-Rmin)
    Rmin=min(Rmin,R[i])
print(Rmax)
    


Measured memory_bytes: 13588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[200005];
int main()
{
    int n;
    cin>>n;
    ll sum=0;

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    ll sum1=0;
    ll ans=sum;
    for(int i=0;i<n;i++)
    {
        sum1+=a[i];
        ans=min(ans,abs(sum-sum1*2));
    }
    cout<<ans<<'\n';
}



Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
using namespace std;

typedef long long int ll;

const ll MAXN = 8020;

int main()
{
  string s;
  cin >> s;
  int x,y;
  cin >> x >> y;

  vector<int> t;
  int cnt = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'T'){
      if(cnt != 0) t.push_back(cnt);
      t.push_back(0);
      cnt = 0;
    }else{
      cnt++;
      if(i == s.size()-1) t.push_back(cnt);
    }
  }

  bool dp_x[MAXN][MAXN*2] = {false}, dp_y[MAXN][MAXN*2] = {false};
  dp_x[0][8000] = true;
  dp_y[0][8000] = true;

  bool flag = false;
  bool xy = true; // trueならx軸について見ている
  int cnt_x = 0,cnt_y = 0;

  for(int i = 0; i < t.size(); i++){
    if(t[i] == 0){
      xy  = !xy;
    }else if(xy){
      cnt_x++;
      for(int j = 0; j < MAXN*2; j++){
        if(dp_x[cnt_x-1][j]){
          if(j+t[i] < MAXN*2) dp_x[cnt_x][j+t[i]] = true;
          if(j-t[i] >= 0 && flag) dp_x[cnt_x][j-t[i]] = true;
        }
      }
    }else if(!xy){
      cnt_y++;
      for(int j = 0; j < MAXN*2; j++){
        if(dp_y[cnt_y-1][j]){
          if(j+t[i] < MAXN*2) dp_y[cnt_y][j+t[i]] = true;
          if(j-t[i] >= 0) dp_y[cnt_y][j-t[i]] = true;
        }
      }
    }

    if(!flag) flag = true;
  }

  cout << ((dp_x[cnt_x][x+8000] && dp_y[cnt_y][y+8000]) ? "Yes" : "No") << endl;

  return 0;
}

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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	int n,k;
	cin >> n >> k;
	vi a(n);
	rep(i,n){
		cin >> a[i];
	}

	rep(i,n-k){
		int out = a[i];
		int in = a[i+k];
		if(in > out){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
}

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

Measured memory_bytes: 4780
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
using namespace std;
int main(){
    int price=700;
    
    for(int n=0;n<3;n++){
        char s =getchar();
        if(s=='o')price+=100;
    }

    cout<<price<<endl;
}

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

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;

const int MAX_N = 500000;
int N, Q;
int D;
int d[MAX_N+1];
int a[MAX_N+1];
int b[MAX_N+1];

int main() {
  cin >> N >> D;
  for (int i = 1; i <= N; ++i) cin >> d[i];
  cin >> Q;

  a[0] = D;
  for (int i = 1; i <= N; ++i) {
    if (d[i] < 2 * a[i-1]) a[i] = abs(a[i-1] - d[i]);
    else a[i] = a[i-1];
  }

  b[N] = 1;
  for (int i = N-1; i >= 1; --i) {
    if (d[i+1] < 2 * b[i+1]) b[i] = b[i+1] + d[i+1];
    else b[i] = b[i+1];
  }
  
  while (Q--) {
    int q;
    cin >> q;
    if (a[q-1] >= b[q]) cout << "YES" << endl;
    else cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 7808
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str, T: str):
    print(YES if S+T[-1] == T else NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()


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

#define fi first
#define se second

const int N = 110;

using namespace std;

int main()
{
        ios_base::sync_with_stdio(0);

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        int n;
        cin >> n;
        vector < pair < int, int > > a(n);
        for(int i = 0; i < n; i++){
                cin >> a[i].fi;
                a[i].se = i;
        }
        int A = 0, B = 0;
        sort(a.begin(), a.end());
        for(int i = 0; i < n; i++){
                if(a[i].se % 2 != i % 2){
                        if(i & 1) A += 1;
                        else B += 1;
                }
        }
        cout << max(A, B) << "\n";
}


Measured memory_bytes: 1024
h,w = map(int,input().split())
maze = []
for _ in range(h):
  s = input()
  if s != '.'*w:
    maze.append(s)
h = len(maze)
skip = []
for j in range(w):
  for i in range(h):
    if maze[i][j] == '#':
      break
  else:
    skip.append(j)

for i in range(h):
  for j in range(w):
    if j not in skip:
      print(maze[i][j],end= '')
  print()



Measured memory_bytes: 4468
#include <bits/stdc++.h>
using namespace std;
bool is_sqrt(long long n) {
   if(floor(sqrt(n))==sqrt(n)) {
       return true;
   } else {
       return false;
   }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long n;
    cin >> n;
    for(int i = n;i > 0;i--) {
        if(is_sqrt(i)) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
 
        
  int main(){
     long double a,b,c;
      cin>>a>>b>>c;
     long double x=a+b+2*sqrt(a)*sqrt(b);
      if(x<c)cout<<"Yes";
      else cout<<"No";
  }
 

Measured memory_bytes: 256
program ABC047A
    implicit none
    integer(8)::i,flg
    integer(8),dimension(3)::A

    read(5,*)(A(i),i=1,3)
    flg=maxval(A)

    do i=1,3
        if(A(i)/=maxval(A))then
            flg=flg-A(i)
        end if
    end do

    if(flg==0)then
        print'(A)',"Yes"
    else
        print'(A)',"No"
    end if
    
end program ABC047A

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

int main() {
    string s;
    string t;
    cin>>s>>t;
    int n = s.size();
    int m = t.size();
    int dp[n + 1][m + 1] = {0};
    int k = 0;
    
    for(int i = 0 ; i < n + 1 ; i++){
        for(int j = 0; j < m  + 1; j++){
            if( i == 0 || j == 0)dp[i][j] = 0;
            else{
                if(s[i-1] == t[j-1]){
                dp[i][j] = 1 + dp[i-1][j-1];
            }
            else{
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
            }
            
        }
    }
    
   char ans[dp[n][m] + 1];
   ans[dp[n][m]] = '\0';
   int index = dp[n][m] - 1;
   int i = n;
   int j = m;
   while(i > 0 && j > 0){
  	if(s[i-1] == t[j-1]){
  	    ans[index--] = s[i-1];
  	    i--;
  	    j--;
  	}else{
  	    if(dp[i-1][j] > dp[i][j-1])i--;
  	    else j--;
  	}
    }
  	cout<<ans;
	// your code goes here
	return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
  string s;
  cin >> s;
  bool flag = true;
  REP(i, s.size()){
    if(i%2 == 0 && (s[i] != 'R' && s[i] != 'U' && s[i] != 'D')) flag = false;
    if(i%2 == 1 && (s[i] != 'L' && s[i] != 'U' && s[i] != 'D')) flag = false;

  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
 
class ITP1
{
    static void Main()
    {
        int a;
        int[] x = new int[6];
        int[] y = new int[6];
        string str1 = Console.ReadLine();
        string str2 = Console.ReadLine();
        for (int i = 0; i < 6; i++)
        {
            x[i] = int.Parse(str1.Split()[i]);
            y[i] = int.Parse(str2.Split()[i]);
        }
 
 
        for (int i = 0; i < 15; i++)
        {
            if (x[0] == y[0] && x[5] == y[5])
            {
                if (x[1] == y[1] && x[4] == y[4])
                {
                    if (x[2] == y[2] && x[3] == y[3])
                    {
                        Console.WriteLine("Yes");
                        return;
                    }
                }
                else
                {
                    /*SpinCW*/
                    a = y[4]; y[4] = y[3]; y[3] = y[1]; y[1] = y[2]; y[2] = a;
                }
            }
            else
            {
                if (i % 2 == 0)
                {
                    /*RolS*/
                    a = y[0]; y[0] = y[4]; y[4] = y[5]; y[5] = y[1]; y[1] = a;
                }
                else
                {
                    /*RolE*/
                    a = y[0]; y[0] = y[3]; y[3] = y[5]; y[5] = y[2]; y[2] = a;
                }
            }
        }
        Console.WriteLine("No");
    }
}

Measured memory_bytes: 19652
#include <bits/stdc++.h>
using namespace std;
long long f(long long n,long long k){
    long long tmp=n-n%k;
    long long res=(tmp+k)*(n/k)/2;
    return res;
}
int main() {
    long long N,ans=0;
    cin>>N;
    for(int i=1;i<=N;i++){
        ans+=f(N,i);
    }
    cout<<ans;
}

Measured memory_bytes: 3652
#include<iostream>


using namespace std;

int main(void){
    int A,B,K,T,V;
    
    
    cin>>A>>B>>K;
    V=0;
    T=min(A,B);

    int P[T+1];
    for(int i=0;i<=T;i++){
        P[i]=0;
    }
    
    for(int i=0;i<T;i++){
        if(A%(T-i)==0){
            P[T-i]=P[T-i]+1;       
            
        }
        if(B%(T-i)==0){
            P[T-i]=P[T-i]+1;        
            
        }
    }

    for(int i=0;i<T;i++){
        if(P[T-i]==2){
            
            V=V+1;
            if(V==K){
                cout<<T-i<<endl;
                return 0;
            }
                   
            
        }
    
    }
       
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
 int x, n, min, max;
 cin >> n;
 min = 1000000;
 max = -1000000;
 long long total = 0;

 for (int i=0; i<n; ++i)
 {
  cin >> x;
  total += x;
  max = std::max(max, x);
  min = std::min(min, x);
 }
 cout << min << " " << max << " " << total<< endl;
 return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  long long N;
  long long K;
  cin >> N;
  cin >> K;
  
  long long I = N / K;
  cout << min(N - I * K, abs(N - (I + 1) * K)) << endl;
  return 0;
}

Measured memory_bytes: 3160
#include <stdio.h>
int sa(int a,int b){
    int c;
    if(a>b)
        c=a-b;
    else
        c=b-a;
    return c;
    
}

int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
 if (sa(a,c)<=d)
         printf("Yes");
    
 else
     if(sa(a,b)<=d&&sa(b,c)<=d)
     printf("Yes");
    
    else
        printf("No");
    
    
    
}


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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if ((a + b) == (c + d))
    {
        cout << "Balanced" << endl;
    }
    else if ((a + b) > (c + d))
    {
        cout << "Left" << endl;
    }
    else
    {
        cout << "Right" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

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

int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll q = lcm(c,d);
    ll ans = 0;
    ans += b/c + b/d - b/q;
    ans -= (a-1)/c + (a-1)/d - (a-1)/q;
    cout << b - a  + 1 - ans ;

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int inf =1e18;
const int MODN=1000000007;
int32_t main(){
	int n;cin>>n;
	vector<int> arrmv(n);
	for(int i=0;i<n;i++)cin>>arrmv[i];
	vector<int> C(3,0);
	int ans=1;
	for(int i=0;i<n;i++){
		int cnt=0;int id=-1;
		for(int j=0;j<3;j++){
		if(arrmv[i]==C[j])cnt++,id=j;}
		if(id==-1){
			cout<<0<<endl;
			return 0;
		}
		C[id]++;
		ans*=cnt;
		ans%=MODN;
	}
		cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  const [r, c] = parseLine(lines[0]);
  const sumRow = Array(c + 1).fill(0);
  for (let i = 1; i <= r; i++) {
    const row = parseLine(lines[i]);
    const sum = row.reduce((p, c) => p + c);
    row.push(sum);
    for (let j = 0; j < c + 1; j++) {
      sumRow[j] = sumRow[j] + row[j];
    }
    console.log(row.join(" "));
  }
  console.log(sumRow.join(" "));
});

function parseLine(s) {
  return s.split(" ").map((s) => Number(s));
}



Measured memory_bytes: 17876
#include<bits/stdc++.h>
using namespace std;
int mod=1e9+7;

int add(int a,int b){
  return (a+b)%mod;
}

int N;
char t[2][100];

int dp[100][4][4];

int rec(int x,int a,int b){
  if(dp[x][a][b]!=-1)return dp[x][a][b];
  int res=0;
  if(x==N)return 1;
  
  if(t[0][x]==t[1][x]){
    for(int i=0;i<3;i++){
      if(a==i||b==i)continue;
      res=add(res, rec(x+1,i,i) );
    }
  }else{
    
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
        if(i==j||a==i||b==j)continue;
        res=add(res, rec(x+2,i,j) );
      }
    }
    
  }
  return dp[x][a][b]=res;
}

int main(){
  memset(dp,-1,sizeof(dp));
  
  cin>>N;
  for(int i=0;i<2;i++){
    for(int j=0;j<N;j++){
      cin>>t[i][j];
    }
  }
  
  cout<< rec(0,3,3) <<endl;


  return 0;
}


Measured memory_bytes: 256
s=str(input())
arr = [0] * (len(s)+1)

for i in range(len(s)):
    if s[i] == '>': continue
    arr[i+1] = arr[i] + 1

for i in range(len(s))[::-1]:
    if s[i] == '<': continue
    
    if arr[i] > arr[i+1]+1:continue
    else: arr[i] = arr[i+1]+1
print(sum(arr))

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

#define FOR(i, j, n) for (int i(j); i < n; ++i)
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define dbg(x) std::cerr<<#x<<" = " << (x) << std::endl
#define pnl(x) std::cout << x << "\n"

typedef	std::vector<int>	vi;
typedef std::pair<int,int>	ii;
typedef std::vector<std::string>	vs;
typedef std::vector<ii>	vii;
typedef std::vector<long long>	vl;
typedef	long long ll;


const int	NB_D = 4;
const int	DY[] = {-1, 1, 0, 0};
const int	DX[] = {0, 0, -1, 1};

int		sum_digits(int n)
{
	std::string s = std::to_string(n);

	int	sum(0);
	for (auto c : s)
		sum += c - '0';
	return sum;
}

int		main(void)
{
	std::ios_base::sync_with_stdio(false);
	int	N;
	std::cin >> N;

	if (N % sum_digits(N) == 0)
		pnl("Yes");
	else
		pnl("No");
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 200001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int n, k;
  scanf("%d %d", &n, &k);
  int h[MAX];
  rep(i, 0, n) scanf("%d", &h[i]);

  qsort(h, n, sizeof(int), des);

  long long int ans = 0;
  rep(i, k, n) ans += h[i];
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1788
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n;
    cin >> n;
    vector<double> v(n);
    rep(i, n) cin >> v[i];
    sort(ALL(v));

    double ans = v[0];
    for(int i = 1; i < n; i++){
        ans = (ans + v[i]) / 2.0;
    }
    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<int> Div(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

int graph[205][205];
void WarshallFloyd(int sz) {
    for( int k = 1; k <= sz; ++k ) {
        for( int i = 1; i <= sz; ++i ) {
            for( int j = 1; j <= sz; ++j ) {
                if( graph[i][k] == INF || graph[k][j] == INF ) {
                    continue;

                }
                graph[i][j] = min( graph[i][j], 
                                    graph[i][k] + graph[k][j] );

            }
        }
    }
    return;

}

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

    int n, m, r;
    cin >> n >> m >> r;
    vector<int> v(r);
    for(int i = 0; i < r; ++i) {
        cin >> v[i];

    }
    sort(all(v));

    for(int i = 0; i <= n; ++i) {
        for(int j = 0; j <= n; ++j) {
            graph[i][j] = INF;

        }
    }

    while(m--) {
        int a, b, c;
        cin >> a >> b >> c;
        graph[a][b] = graph[b][a] = c;

    }
    WarshallFloyd(n);
    int res = INF;
    do {
        int sum = 0;
        for(int i = 0; i < r - 1; ++i) {
            sum += graph[v[i]][v[i + 1]];

        }
        res = min(res, sum);

    } while(next_permutation(all(v)));

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int long a,b;
    cin >> a >> b;
    auto x = bitset<32>(a);
    auto y = bitset<32>(b);
    cout << (x&y) << endl;
    cout << (x|y) << endl;
    cout << (x^y) << endl;
}



Measured memory_bytes: 3116
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> n;
  vi a(n),l(n),r(n);
  REP(i,n){
    cin>>a[i];
  }

  REP(i,n){
    if ((i-a[i])>=0){
      l[i-a[i]]++;
    }
    if ((i+a[i])<n){
      r[i+a[i]]++;
    }
  }

  REP(i,n){
    if ((i-a[i])>=0){
      ans+=r[i-a[i]];
    }
    if ((i+a[i])<n){
      ans+=l[i+a[i]];
    }
    
  }




  cout<<(ans/2)<<endl;
  return 0;
}

Measured memory_bytes: 8012
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())

def f(n):
    ans = 1
    for i in range(2, n + 1):
        if n % i == 0:
            ans += 1
    return ans


ans = 0
for i in range(1, N + 1):
    if i % 2 == 0:
        continue
    if f(i) == 8:
        ans += 1
print(ans)



Measured memory_bytes: 66304
#include <cstdio>

unsigned int info[15][15];

int main()
{
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
  {
    int j;
    scanf("%d", &j);
    while (j > 0)
    {
      --j;
      int a, b;
      scanf("%d%d", &a, &b);
      info[i][a - 1] = b + 1;
    }
  }

  int ans = 0;
  for (int i = (1 << n) - 1; i > 0; --i)
  {
    bool ok = true;
    for (int j = 0; j < n; ++j)
    {
      if ((i & (1 << j)) == 0) continue;
      for (int k = 0; k < n; ++k)
      {
        if (info[j][k] == 0) continue;
        if (info[j][k] - 1 != ((i >> k) & 1))
        {
          ok = false;
          break;
        }
      }
    }
    if (ok)
    {
      if (ans < __builtin_popcount(i)) ans = __builtin_popcount(i);
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef int Int;
typedef pair<Int,Int> pii;
typedef pair<Int,double> pid;
typedef pair<double,double> pdd;
typedef pair<Int,pii> pip;
typedef pair<double,Int> pdp;
#define A first
#define B second
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (x).size()
#define CLR(x) memset(x,0,sizeof x)
#define pdebug() printf("%d\n",__LINE__)
#define Itype(a) typeof(a.begin()) 
#define REP(i,a,b) for(int i = (a);i <= (b);i++)
#define FORO(i,n) REP(i,0,(int)n-1)
#define FORI(i,n) REP(i,1,(int)n)
#define FORIT(i,t) for(Itype(t) i = t.begin();i != t.end();i++)
#define eps 1e-6
#define sqr(x) ((x)*(x))
#define dist(_a,_b) sqrt(sqr(_a.A-_b.A)+sqr(_a.B-_b.B))
#define norm(_a) sqrt(sqr(_a.A)+sqr(_a.B))
template<typename T>void getMin(T &a,T b) { if(a > b) a = b; }
template<typename T>void getMax(T &a,T b) { if(a < b) a = b; }
const int MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    int N = SZ(S);
    int ans = 0;
    vector<int> pre(N + 1);
    FORO(i, N) pre[i] = i - 1;
    for(int i = 1;i < N;i++) {
        int p = pre[i];
        //cout << i << " " << p << endl;
        if(p == -1) continue;
        if(S[i] != S[p]) {
            ans += 2;
            pre[i + 1] = pre[p];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 848
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N, K, A[200010]; 
	cin >> N >> K; 
	for(int i = 1; i <= N; i++) cin >> A[i]; 
	int S[45][200010] = {}; 
	int T = 0; 
	for(int i = 1; i <= N; i++) S[0][i] = A[i]; 
	for(int t = 1; t < 45; t++){
		int D[200010] = {}; 
		for(int i = 1; i <= N; i++){
			D[max(i - S[t-1][i], 1)] ++; 
			if(i + S[t-1][i] + 1 <= N) D[i + S[t-1][i] + 1] --; 
		}
		int mn = 1145141919; 
		for(int i = 1; i <= N; i++){
			S[t][i] = S[t][i-1] + D[i]; 
			mn = min(mn, S[t][i]); 
		}
		if(mn == N){
			T = t; break; 
		}
	}
	for(int i = 1; i <= N; i++){
		cout << S[min(K, T)][i] << " "; 
	}
	cout << endl; 
}

Measured memory_bytes: 40292