akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }
int a[100001];

signed main() {
  SS(int,n);
  SV(int,a,n);
  int sum=0;
  rep(i,n){
      sum^=a[i];
  }
  rep(i,n){
      cout<<(sum^a[i])<<" ";
  }
  cout<<endl;
}

Measured memory_bytes: 3968
void main()
{
    long[] tmp = rdRow;
    long n = tmp[0], k = tmp[1];
    long[] x = rdRow;

    long result = 1L << 60;
    foreach (i; 0 .. n-k+1)
    {
        long time = abs(x[i]-x[i+k-1]) + min(x[i].abs, x[i+k-1].abs);
        result = min(result, time);
    }

    result.writeln;
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 4372
#include <iostream>
#include <array>
#include <algorithm>

int main() {
    std::array<int, 10> arr;

    for (int i = 0; i < 10; ++i) {
        std::cin >> arr[i];
    }
    
    std::sort(arr.begin(), arr.end(), std::greater<int>());
    
    std::cout << arr[0] << std::endl;
    std::cout << arr[1] << std::endl;
    std::cout << arr[2] << std::endl;

    return 0;
}

Measured memory_bytes: 1172
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    dump(n);
    cin >> n;
    dump(n);
    int dp[100000][3] = {}, h[100000][3] = {};
    REP(i,0,n) cin >> h[i][0] >> h[i][1] >> h[i][2];
    REP(i,0,3) dp[0][i] = h[0][i];
    REP(i,1,n) REP(j,0,3) REP(k,0,3) {
        if (j == k) continue;
        dp[i][j] = max(dp[i][j], dp[i-1][k] + h[i][j]);
        // cerr << dp[i][j] << endl;
    }
    int ans = 0;
    REP(i,0,3) ans = max(ans, dp[n-1][i]);
    cout << ans << endl;
}

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

Measured memory_bytes: 2560
w,h,n=map(int,input().split())
x1=0
y1=0
x2=w
y2=h
for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        x1=max(x1,x)
    elif a==2:
        x2=min(x2,x)
    elif a==3:
        y1=max(y1,y)
    elif a==4:
        y2=min(y2,y)
print(max(0,(x2-x1))*max(0,(y2-y1)))

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

struct flower{
    int height;
    int bty;
};

ll solve(vector<flower> v,int n){
    ll dp[n+1];
    dp[1] = v[1].bty;
    map<ll,ll> meaningFull;
    meaningFull[v[1].height] = dp[1];
    ll ans = dp[1];
    for(int i=2;i<=n;i++){
        dp[i] = v[i].bty;
        auto it  = meaningFull.upper_bound(v[i].height);
        if(it != meaningFull.begin()){
            it--;
            dp[i] += it->second;
        }
        meaningFull[v[i].height] = dp[i];
        it = meaningFull.upper_bound(v[i].height);
        while(it != meaningFull.end() && it->second <= dp[i]){
            auto temp = it;
            temp++;
            meaningFull.erase(it);
            it = temp;
        }
        ans = max(ans,dp[i]);
    }
    return ans;
}

int main() {
    int n;
    cin>>n;
    vector<flower> v(n+1);
    for(int i=1;i<=n;i++){
        cin>>v[i].height;
    }
    for(int i=1;i<=n;i++){
        cin>>v[i].bty;
    }
    cout<<solve(v,n)<<endl;
}


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

int main() {
  int H,W;
  cin >> H >> W;

  vector<string> f(H+2);
  for (int i = 0; i < W+2; i++) {
    f.at(0) += "#";
    f.at(H+1) += "#";
  }

  for (int i = 1; i < H+1; i++) {
    string str;
    cin >> str;
    f.at(i) = "#" + str + "#";
  }

  for (int i = 0; i < H+2; i++) {
    for (int j = 0; j < W+2; j++) {
      cout << f.at(i).at(j);
    }
    cout << endl;
  }

}


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

typedef long long LL;
const int N = 100005;
int n, q, f[N], c; LL m;
std::vector<std::pair<int, int>> v1, v2;
int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }
void link(int x, int y) { f[find(x)] = find(y); }
int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> m >> q;
	for (int i = 0; i < n; ++i) f[i] = i;
	for (int i = 1, x, y, z; i <= q; ++i)
		std::cin >> x >> y >> z, (z ? v2 : v1).emplace_back(x, y);
	for (auto e : v1) link(e.first, e.second);
	for (auto e : v2) if (find(e.first) == find(e.second)) return std::cout << "No\n", 0;
	for (int i = 0; i < n; ++i) c += f[i] == i;
	std::cout << ((v2.size() ? std::max(3, c) : c - 1) <= m - (n - c) && m - (n - c) <= (LL) c * (c - 1) / 2 ? "Yes" : "No") << '\n';
	return 0;
}

Measured memory_bytes: 1912
#include <stdio.h>
#include <stdlib.h>
int asc(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}
     
int main(void){
  int n,k,min=2000000000,sa;
  int i;
  scanf("%d %d",&n,&k);
  int h[n];
  for(i=0;i<n;i++)
    scanf("%d", &h[i]);
  qsort(h, n, sizeof(int), asc);
  for(i=0;i<=n-k;i++){
    sa=h[i+k-1]-h[i];
    if(sa<min)
      min=sa;
  }
  printf("%d\n", min);
  return 0;
}

Measured memory_bytes: 892
def gcd(a,b):
        while b!=0:
                a,b=b,a%b
        return a

A, B, C, D = map(int, input().split(" "))
ans = 0
Bc = B // C
Bd = B // D
ck = gcd(C,D)
asb = C*D//ck
Bs = B//asb

newb = B - Bc - Bd + Bs

Ac = (A-1) // C
Ad = (A-1) // D
As = (A-1)//asb

newa = (A-1)-Ac-Ad+As

print(int(newb-newa))

Measured memory_bytes: 3064
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  ans=inf
  for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
      ans=min(ans,i+n//i-2)
  return ans

# main()
print(main())


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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = (int)1e5 + 9;
const int LOG = 40;
const int MOD = (int)1e9 + 7;

int dp[N][LOG];

int main(){
  fastIO;
  int n, m;
  cin >> n >> m;
  dp[0][0] = 1;
  int s;
  for(int i = 1; i <= n; i ++ ){
    s = 0;
    for(int j = 0 ; j < LOG; j ++ ){
      s += dp[i - 1][j];
      s %= MOD;
      dp[i][j] = s;
    }
  }
  int cnt;
  int ans = 1;
  for(int i = 2; i * i <= m ; i ++ ){
    if(m % i != 0) continue;
    cnt = 0;
    while(m % i == 0){
      cnt ++ ;
      m /= i;
    }
    ans = (ans * 1ll * dp[n][cnt]) % MOD;
  }
  if(m != 1) ans = (ans * 1ll * dp[n][1]) % MOD;
  cout << ans << "\n";
  return 0;
}

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

int main() {
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    a.push_back(a[0] + k);
    int max = 0, res = 0;
    for (int i = 0; i < n; i++){
        int temp;
        temp = a[i + 1] - a[i];
        res += temp;
        if (temp > max) max = temp;
    }
    cout << res - max << endl;
}


Measured memory_bytes: 4844
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define answer(x) cout << (x) << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const uint64_t MOD = 1000000007;

int digits(uint64_t n) {
    return floor(log2l((long double)n)) + 1;
}

int main() {
    int n;
    cin >> n;
    uint64_t a[n], ans = 0, m = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        m = max(m, a[i]);
    }

    int mr = digits(m);
    for (int i = 0; i < mr; i++) {
        uint64_t zero = 0, iti = 0;
        for (int k = 0; k < n; k++) {
            if ((a[k] >> i) & 1) {
                iti++;
            } else {
                zero++;
            }
        }
        ans += (((1LL << i) % MOD) * ((zero * iti) % MOD)) % MOD;
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}


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

int main() {

    int n;
    cin >> n;
    int tou[4][3][10] = {}; 

    rep(i, n){
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    tou[b - 1][f - 1][r - 1] += v;
    }

    rep(i, 4){
        rep(j, 3){
            cout << " ";
            rep(k, 10){
                cout << tou[i][j][k];
                if(k < 9) cout << " ";
            }
            cout << endl;
        }
        if(i < 3) cout << "####################" << endl;
        
    }


}





Measured memory_bytes: 3116
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string S,T;
  cin>>S>>T;
  sort(ALL(S));
  sort(rALL(T));
  if(S<T){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e6 * 2 + 10, INF = 1e9 * 1e9 + 10;



int main()
{
	fastInp;

	ll n;
	cin >> n;

	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ll vl = (i + 1) * (n - i);
		ans += vl;
	}
	for (int i = 0; i < n - 1; i++) {
		ll u, v;
		cin >> u >> v;
		if (u > v) swap(u, v);
		u--; v--;
		ll vl = (u + 1) * (n - v);
		ans -= vl;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int sum=0,gosa=0;
    rep(i,5){
        int p;
        cin >> p;
        sum += (p+9)/10 * 10;
        if(p%10==0) continue;
        gosa = max(gosa,10-p%10);
    }
    cout << sum - gosa << endl;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    int n;
    string s, t;
    cin >> s >> t;
    s += s;
    cout << (s.find(t) != string::npos ? "Yes" : "No") << endl;
}

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

ll v[3005][3005];
ll dp[3005][3005][4];

int main()
{
    int r, c, k;
    cin >> r >> c >> k;
    for(int i = 0; i < k; i++){
        int a, b;
        ll w;
        cin >> a >> b >> w;
        a--; b--;
        v[a][b] = w;
    }
    for(int i = 1; i <= r; i++){
        for(int j = 1; j <= c; j++){
            dp[i][j][0] = max(dp[i][j - 1][0], dp[i - 1][j][3]);
            dp[i][j][1] = max(dp[i][j][0] + v[i - 1][j - 1], dp[i][j - 1][1]);
            dp[i][j][2] = max(max(dp[i][j - 1][1] + v[i - 1][j - 1], dp[i][j - 1][2]), dp[i][j][1]);
            dp[i][j][3] = max(max(dp[i][j - 1][2] + v[i - 1][j - 1], dp[i][j - 1][3]), dp[i][j][2]);
        }
    }
    cout << dp[r][c][3] << endl;
}


Measured memory_bytes: 355488
#include<iostream>
using namespace std;
int main() {
	int  N, K;
	cin >> N >> K;
	int start = 1;
	for (int i = 0; i < N; ++i) {
		if (start * 2 <= start + K)
			start *= 2;
		else
			start += K;
	}
	cout << start << endl;
	return 0;
}

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

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define MOD_1_000_000_007 (1000000007LL)
#define LINF (1LL<<60)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep2(i, n)  for (long long i = 2; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)
#define repc2(n, i) for (long long i = (long long)(n); i >= 2; i--)
#define REP(i, n, m) for (long long i = (long long)(n); i < (long long)(m); i++)

namespace solver {
  using namespace std;
  typedef long long ll;

  ll N, W, ws[110], vs[110], dp[2][100010];

  void init() {
    cin >> N >> W;
    rep(i, N) cin >> ws[i] >> vs[i];
  }

  void solve() {
    rep(j, W+1) dp[0][j] = 0;
    rep(i, N) rep(j, W+1) {
      if(j<ws[i]) dp[(i+1)%2][j] = dp[i%2][j];
      else dp[(i+1)%2][j] = max(dp[i%2][j], dp[i%2][j-ws[i]]+vs[i]);
    }
    cout << dp[N%2][W] << endl;
  }
}

int main() {
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 1792
n,k = map(int,input().split())
num = [0] * 100000
for i in range(n):
  c,d = map(int,input().split())
  num[c-1] += d
sum = 0
for i in range(100000):
  sum += num[i]
  if sum >= k:
    print(i + 1)
    exit()

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

int main(void){
    int n;
    int i, j, mask;
    int tmp;
    int f[100] = {0};
    long int p[100][11] = {0};
    int kabutta;
    long int profit = 0;
    long int answer;

    scanf("%d", &n);
    for (i = 0; i < n*10; i++){
        scanf(" %d", &tmp);
        if (tmp == 1){
            f[i/10] += (int)pow(2, (9-i%10));
        }
    }
    for (i = 0; i < n*11; i++){
        scanf(" %ld", &p[i/11][i%11]);
    }

    for (i = 1; i < (1 << 10); i++){
        for (j = 0; j < n; j++){
            kabutta = 0;
            if ((i & f[j]) > 0){
                for (mask = 1; mask < (1 << 10); mask = (mask << 1)){
                    if (((i & f[j]) & mask) == mask){
                        kabutta++;
                    }
                }
            }
            profit += p[j][kabutta];
        }
        if (i == 1){
            answer = profit;
        }
        answer = answer>profit?answer:profit;
        profit = 0;
    }

    printf("%ld\n", answer);
    


    return 0;
}

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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    int n;
    while (cin >> n) {
        VI A(n);
        FOR(i,0,n)
            cin >> A[i];
        sort(ALL(A));
        LL ans = 0;
        FOR(i,0,n) FOR(j,i+1,n) if (j < n-1){
            ans += upper_bound(&A[0],&A[n],A[i]+A[j]-1) - &A[j+1];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    # 2円の中心間の距離の2乗
    def D2(x1,y1,x2,y2):
        return (x1-x2)**2+(y1-y2)**2

    # 2円が交点を持つか
    def check(R1,R2):
        x1,y1,r1 = R1
        x2,y2,r2 = R2
        d2 = D2(x1,y1,x2,y2)
        if (r1-r2)**2 < d2 <= (r1+r2)**2:
            return 1
        else:
            return 0

    # 2円の交点を出力
    def point(R1,R2):
        if not check(R1,R2):
            return []
        else:
            x1,y1,r1 = R1
            x2,y2,r2 = R2
            x2 -= x1
            y2 -= y1
            r = x2**2+y2**2
            a = (r+r1**2-r2**2)/2
            d = (r*r1**2-a**2)**0.5
            X,Y = a*x2/r, a*y2/r
            k = d/r
            X1,Y1 = X+y2*k+x1, Y-x2*k+y1
            X2,Y2 = X-y2*k+x1, Y+x2*k+y1
            return [(X1,Y1),(X2,Y2)]

    # 円に点が入っているか
    def inR(p,R):
        x2,y2 = p
        x1,y1,r1 = R
        d2 = D2(x1,y1,x2,y2)
        if d2 <= r1**2+1e-3:
            return 1
        else:
            return 0

    n,k = LI()
    p = LIR(n)
    l = 0
    r = 1000000
    while r-l > 1e-6:
        t = (l+r) / 2
        P = []
        for i in range(n):
            xi,yi,ci = p[i]
            ri = t/ci
            P.append((xi,yi))
            for j in range(i):
                xj,yj,cj = p[j]
                rj = t/cj
                ps = point((xi,yi,ri),(xj,yj,rj))
                for pi in ps:
                    P.append(pi)
        for pi in P:
            s = 0
            for x,y,c in p:
                r1 = t/c
                if inR(pi,(x,y,r1)):
                    s += 1
                if s >= k:
                    break
            if s >= k:
                r = t
                break
        else:
            l = t
    print(l)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 54360
#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, a, b;
    string s;
    cin >> n >> a >> b;
    cin >> s;

    int sum = 0;
    int b_c = 0;
    rep(i, s.size()) {
        if (s.at(i) == 'a') {
            if (sum < a + b) {
                cout << "Yes" << endl;
                sum++;
            }
            else
                cout << "No" << endl;
        }
        else if (s.at(i) == 'b') {
            if (sum < a + b && b_c < b) {
                cout << "Yes" << endl;
                sum++;
                b_c++;
            }
            else
                cout << "No" << endl;
        }
        else if (s.at(i) == 'c') {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>


int main() {
    std::string s; std::cin >> s;
    const std::string k = "keyence";
    for (size_t i = 0; i <= k.size(); i++) {

        bool f = true;
        for (size_t j = 0; j < i; j++) {
            if (s[j] != k[j]) {
                f = false;
                break;
            }
        }
        if (!f) {
            continue;
        }

        for (size_t j = 0; j < k.size() - i; j++) {
            if (s[s.size() - 1 - j] != k[k.size() - 1 - j]) {
                f = false;
                break;
            }
        }

        if (f) {
            std::cout << "YES" << std::endl;
            return 0;
        }

    }

    std::cout << "NO" << std::endl;
    return 0;
}

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

int main(){
    int N;
    int d[110];
    cin >> N;
    for (int i = 0; i < N; i++) cin >> d[i];

    int ans = 0;

    for (int i = 0; i < N-1; i++){
        for (int j = i+1; j < N; j++){
            ans += d[i] * d[j];
        }
    }

    cout << ans << "\n";

    return 0;
}


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

using namespace std;

int main() {
  int N, A[100000];
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  sort(A, A + N);
  reverse(A, A + N);

  int pos = 0;
  for(int i = 0; i < N; i++) {
    if(i + 1 <= A[i]) {
      pos = i;
    } else {
      break;
    }
  }
  int length = 0;
  for(int i = pos; i + 1 < N; i++) {
    if(pos < A[i + 1]) ++length;
  }
  if(length % 2 == 0 && (A[pos] - pos + 1) % 2 == 0) cout << "Second\n";
  else cout << "First" << endl;
}

Measured memory_bytes: 640
/**
*    created: 02.07.2020 00:00:29
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const int MOD = 1000000007;
// const int MOD = 998244353;
const long double pi = acos(-1.0);
const int INF = 1LL << 60;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    cout << 24 + 24 - n << endl;
    return 0;
}

Measured memory_bytes: 3652
class UnionFind:
    def __init__(self):
        '''\
Create an empty union find data structure.'''
        self.num_weights = {}
        self.parent_pointers = {}
        self.num_to_objects = {}
        self.objects_to_num = {}
        self.__repr__ = self.__str__
    def insert_objects(self, objects):
        '''\
Insert a sequence of objects into the structure.  All must be Python hashable.'''
        for object in objects:
            self.find(object);
    def find(self, object):
        '''\
Find the root of the set that an object is in.
If the object was not known, will make it known, and it becomes its own set.
Object must be Python hashable.'''
        if not object in self.objects_to_num:
            obj_num = len(self.objects_to_num)
            self.num_weights[obj_num] = 1
            self.objects_to_num[object] = obj_num
            self.num_to_objects[obj_num] = object
            self.parent_pointers[obj_num] = obj_num
            return object
        stk = [self.objects_to_num[object]]
        par = self.parent_pointers[stk[-1]]
        while par != stk[-1]:
            stk.append(par)
            par = self.parent_pointers[par]
        for i in stk:
            self.parent_pointers[i] = par
        return self.num_to_objects[par]
    def union(self, object1, object2):
        '''\
Combine the sets that contain the two objects given.
Both objects must be Python hashable.
If either or both objects are unknown, will make them known, and combine them.'''
        o1p = self.find(object1)
        o2p = self.find(object2)
        if o1p != o2p:
            on1 = self.objects_to_num[o1p]
            on2 = self.objects_to_num[o2p]
            w1 = self.num_weights[on1]
            w2 = self.num_weights[on2]
            if w1 < w2:
                o1p, o2p, on1, on2, w1, w2 = o2p, o1p, on2, on1, w2, w1
            self.num_weights[on1] = w1+w2
            del self.num_weights[on2]
            self.parent_pointers[on2] = on1
    def __str__(self):
        '''\
Included for testing purposes only.
All information needed from the union find data structure can be attained
using find.'''
        sets = {}
        for i in range(len(self.objects_to_num)):
            sets[i] = []
        for i in self.objects_to_num:
            sets[self.objects_to_num[self.find(i)]].append(i)
        out = []
        for i in sets.values():
            if i:
                out.append(repr(i))
        return ', '.join(out)

 
uf = UnionFind()
n, m = map(int, input().split())
uf.insert_objects(range(1, n+1))
for _ in range(m):
  i, j = map(int, input().split())
  uf.union(i, j)
components = len({uf.find(i) for i in range(1,n+1)})
print(components - 1)

Measured memory_bytes: 37716
(let* ((n (read))
       (l1 (loop repeat n
                 collect (read-line)))
       (m (read))
       (l2 (loop repeat m
                 collect (read-line))))
  (format t "~A~%"
          (max 0
               (loop for i in l1
                     maximize (- (count i l1 :test #'string=) (count i l2 :test #'string=))))))


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

int main() {
long double a,b,c;
long double eps=1.0e-14;
cin>>a>>b>>c;
if(sqrt(a)+sqrt(b)+eps<sqrt(c)){
    cout<<"Yes"<<endl;
}
else
cout<<"No"<<endl;

return 0;
}

Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(int i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define fi first
#define se second
#define endl '\n'
#define trav(x,A) for(auto &x:A)
#define veci vector<int>
#define vecl vector<long long>
#define FORI(a,b,c) for(int a=b;a<c;a++)
#define FORD(a,b,c) for(int a=b;a>c;a--)
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e5);

ll cntx=0,cnty=0;
vecl ADJ[2*INIT+1];
vector<bool> visit(2*INIT+1,false);
void dfs(ll v,ll d)
{
	visit[v]=true;
	if (d%2==1)
	{
		cnty++;
	}
	else
	{
		cntx++;
	}
	for (auto u:ADJ[v])
	{
		if (!visit[u])
		{
			dfs(u,d+1);
		}
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	

	READV(N);
	FORI(i,0,N)
	{
		READV(x);
		READV(y);
		ADJ[x].push_back(y+INIT);
		ADJ[y+INIT].push_back(x);
	}
	ll ans=0;
	FORI(i,1,INIT+1)
	{
		cntx=0;
		cnty=0;
		if (!visit[i])
		{
			dfs(i,0);
		}
		ans+=cnty*cntx;
	}
	cout<<ans-N<<endl;

	return 0;
}

Measured memory_bytes: 10112
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	//~ int n; cin >> n;
	int count = 0 , l , r , d;
	cin >> l >> r >> d;
	for(int i = l ; i <=r ; i++){
		if(i%d==0)
			count++;
	}
	cout<<count;
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <algorithm>
#include <math.h>

using namespace std;

bool rangeCheck(int row,int col){
	if(row >= 0 && row <= 11 && col >=0 && col<= 11)return true;
	else{
		return false;
	}
}

void erase(char buf[12][13],int row,int col){
	buf[row][col] = '0';
	if(rangeCheck(row,col-1)&&buf[row][col-1] == '1')erase(buf,row,col-1);
	if(rangeCheck(row+1,col)&&buf[row+1][col] == '1')erase(buf,row+1,col);
	if(rangeCheck(row,col+1)&&buf[row][col+1] == '1')erase(buf,row,col+1);
}

int main(){

	char buf[12][13];
	int count;

	while(scanf("%s",buf[0])!=EOF){
		for(int i=1; i <= 11; i++){
			scanf("%s",buf[i]);
		}
		getchar();
		count = 0;

		for(int i=0; i < 12; i++){
			for(int k=0; k < 12; k++){
				if(buf[i][k] == '1'){
					count++;
					erase(buf,i,k);
				}
			}
		}

		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 2564
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int n,a[3],b[100001][3];
string s[100001];
char ans[100001];
int main(){
    cin>>n>>a[0]>>a[1]>>a[2];
    rep(i,n){
        cin>>s[i];
        b[i][s[i][0]-'A']=1;
        b[i][s[i][1]-'A']=1;
    }
    rep(i,n){
        if(a[s[i][0]-'A']==0&&a[s[i][1]-'A']==0){
            cout<<"No"<<endl;
            return 0;
        }
        if(a[s[i][0]-'A']==0){
            ans[i]=s[i][0];
            ++a[s[i][0]-'A'];
            --a[s[i][1]-'A'];
        }
        else if(a[s[i][1]-'A']==0){
            ans[i]=s[i][1];
            --a[s[i][0]-'A'];
            ++a[s[i][1]-'A'];
        }
        else if(i<n-1&&(a[s[i][0]-'A']<=1||a[s[i][1]-'A']<=1)){
            if(a[s[i][0]-'A']<=1&&b[i+1][s[i][0]-'A']){
                ans[i]=s[i][0];
                ++a[s[i][0]-'A'];
                --a[s[i][1]-'A'];
            }
            else{
                ans[i]=s[i][1];
                --a[s[i][0]-'A'];
                ++a[s[i][1]-'A'];
            }
        }
        else{
            ans[i]=s[i][0];
            ++a[s[i][0]-'A'];
            --a[s[i][1]-'A'];
        }
    }
    cout<<"Yes"<<endl;
    rep(i,n) cout<<ans[i]<<endl;
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    ll N,A,B; cin >> N >> A >> B;

    ll d = A-B;
    vector<ll> h(N);
    REP(i,N) cin >> h[i];
    sort(ALL(h));

    int ng = -1;
    int ok = INF;
    while(abs(ok-ng)>1){
        int mid = (ok+ng)/2;

        vector<ll> H(h);
        REP(i,N) H[i] -= mid * B;
        int itr = upper_bound(ALL(H), 0) - H.begin();
        ll cnt = 0;
        FOR(i,itr,N){
            cnt += (H[i]-1)/d + 1;
        }
        if(mid >= cnt){//ここに条件をかく
            ok = mid;
        }else{
            ng = mid;
        }
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 4844
n,l=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-1):
  if a[i]+a[i+1]>=l:
    print('Possible')
    ans=[i+1]+list(range(i,0,-1))+list(range(i+2,n))
    print(*ans[::-1],sep='\n')
    break
else:print('Impossible')

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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
    cin >> d.at(i);
  }
  
  int sum = 0;
  for (int i = 0; i < N-1; i++) {
    for (int j = i + 1; j < N; j++) {
      sum += d.at(i) * d.at(j);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
n = int(input())
 
numbers = list(map(int, input().split(' ')))
approved = True
 
for num in numbers:
  if (num % 2 == 0):
    if (num % 3 == 0) or (num % 5 == 0):
      approved = True
      continue
    else:
      approved = False
      print('DENIED')
      break
if approved:
  print('APPROVED')

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <map>
using namespace std;
#define MX 100005
int a[MX];

int gcd(int a,int b)
{
    return b==0?a:gcd(b,a%b);
}

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    int mmm=0;
    int ok=0;
    for (int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        mmm = max(mmm,a[i]);
        if (a[i]==m) ok=1;
    }

    int y = a[0];
    for (int i=1;i<n;i++)
    {
        y = gcd(y,a[i]);
    }
    if ((mmm>=m&&m%y==0)||ok)
        printf("POSSIBLE\n");
    else
        printf("IMPOSSIBLE\n");

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;
typedef long long ll;

int main() {
  int A, B;
  cin >> A >> B;
  cout << max({A + B, A - B, A * B}) << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> List = new ArrayList<>();
        int N = sc.nextInt();
        int num = 0;
        int min = 999999999;
        for(int i=0;i<N;i++){
            int num2 = sc.nextInt();
            num+=num2;
            List.add(num);
        }
        for(int i:List){
            int s1 = num-i;
            int s2 = num -s1;
            int num2 = Math.abs(s1-s2);
            if(min>num2) min = num2;
        }
        System.out.println(min);
    }
}


Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
#define MAX (123456 * 2)

bool primes[MAX + 1];

void init() {
  primes[0] = false;
  primes[1] = false;
  for (int i = 2; i <= MAX; i++)
    primes[i] = true;

  int end = sqrt(MAX + 1);
  for (int i = 2; i <= end; i++)
    if (primes[i])
      for (int j = i * 2; j <= MAX; j += i)
	primes[j] = false;
}

int solve(int n) {
  int cnt = 0;
  for (int i = n + 1; i <= 2 * n; i++)
    if (primes[i]) cnt++;
    
  return cnt;
}

int main() {
  init();
  int n;
  while(cin >> n, n) {
    cout << solve(n) << endl;
  }
}


Measured memory_bytes: 3340
//shara's here
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll x,y;
    cin>>x>>y;
    if(x*500>=y)cout<<"Yes";
    else cout<<"No";
return 0;
}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;



int main() {
  string s;
  cin >> s;
  rep(i,19){if(i==5 ||i==13){cout << " " ;}else{cout << s[i];}}
  cout << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<int,int>;
const int INF=1001001;
const int NMAX=8;



int main()
{
	int n,m;
	cin>>n>>m;
	priority_queue<ll, vector<ll>, greater<ll>> a;
	rep(i,n){
		ll temp;
		cin>>temp;
		a.push(temp);
}


vector<P> v(m);
rep(i,m){
	int b1,c1;
	cin>>b1>>c1;
	v[i]=make_pair(c1,b1);
}
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
rep(i,m){
	int c=v[i].first;
	int b=v[i].second;

	rep(j,b){
		int p=a.top();
	//	cout<<b<<'b'<<c<<'c'<<endl;
		//cout<<*it1<<'i'<<endl;
		if (p>=c)break;
		a.pop();
	a.push(c);


}
}
ll ans=0;


while (!a.empty()){
int now=a.top();
a.pop();
	ans+=now;
//	cout<<now<<'a'<<endl;

}
cout<<ans;
}


Measured memory_bytes: 1908
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

typedef pair<int, int> P;

int main() {
	int n;

	while (cin >> n && n != 0) {
		int ans = 0;
		P p;
		map<P, bool> mp;

		for (int i = 0; i < n; ++i) {
			cin >> p.first >> p.second;
			mp[p] = true;
		}

		auto itb = mp.begin(), ite = mp.end();
		for (auto it1 = itb; it1 != ite; ++it1) {
			for (auto it2 = itb; it2 != ite; ++it2) {
				if (it1 == it2)
					continue;
				P f = it1->first, s = it2->first;
				if (!(f.first < s.first))
					continue;

				int dx = s.first - f.first, dy = s.second - f.second;
				if (mp.find(P(f.first + dy, f.second - dx)) != ite && mp.find(P(f.first + dx + dy, f.second - dx + dy)) != ite) {
					ans = max(ans, dx*dx + dy*dy);
				}
			}
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3224
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include"math.h"

#define MAX 100000000
int a[MAX];
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int tmp = a;
    a = b;
    b = tmp;
    tmp = a;
    a = c;
    c = tmp;
    cout << a << " " << b << " " << c << endl;
    return 0;
}

Measured memory_bytes: 256
H, W = [int(x) for x in input().split()]

canvas = []
for i in range(H):
	canvas.append(input())

check = False

for i in range(H):
	for j in range(W):
		if canvas[i][j] == '#':
			check = True
			if i > 0:
				if canvas[i-1][j] == '#':
					check = False
			if i < H - 1 and check:
				if canvas[i+1][j] == '#':
					check = False
			if j > 0 and check:
				if canvas[i][j-1] == '#':
					check = False
			if j < W - 1 and check:
				if canvas[i][j+1] == '#':
					check = False
			if check:
				print('No')
				break
	if check:
		break
	if i == H - 1:
		print('Yes')

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var str = "";
			while ((str = Console.ReadLine()) != null)
			{
				var ab = str.Split(' ').Select(i => int.Parse(i)).ToArray();
				Console.WriteLine((ab[0] + ab[1]).ToString().Length);
			}
		}
	}
}

Measured memory_bytes: 5956
use num::Integer;

#[allow(unused_imports)]
use proconio::{fastout, input, marker::Chars};

#[fastout]
pub fn main() {
    input! {
        k: usize,
    }

    let table = (0..=k)
        .map(|i| (0..=k).map(|j| i.gcd(&j)).collect::<Vec<_>>())
        .collect::<Vec<Vec<_>>>();
    println!(
        "{}",
        (1..=k)
            .map(|i| (1..=k)
                .map(|j| {
                    let ij = table[i][j];
                    (1..=k).map(|h| table[ij][h]).sum::<usize>()
                })
                .sum::<usize>())
            .sum::<usize>()
    );
}


Measured memory_bytes: 2284
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>

#define rep(i ,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

const int mod = 1e9+7;

int main(){
    int n = 0;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    
    ll ans = 0, x = 0;
    rep(i, n){
        ans = (ans + a[i]*x)%mod;
        x = (x + a[i])%mod;
    }
    cout << ans%mod << endl;
    return 0;
}

Measured memory_bytes: 4824
/*
    Auther: ghoshashis545 Ashis Ghosh
    College: Jalpaiguri Govt Enggineering College
*/
#include<bits/stdc++.h>
#include<string>
#include<algorithm>
using namespace std;
#define ll long long
#define int long long
#define ld long double
#define ff first
#define ss string 
#define se second
#define alt(v) v.begin(),v.end()
#define ralt(v) v.rbegin(),v.rend()
#define pb emplace_back
#define mp make_pair
#define fab(i,a,b) for(ll i=(a);i<(b);i++)
#define fba(i,a,b) for(ll i=(b);i>=(a);i--)
#define arr(i,n) fab(i,0,n)
int mod=1000000007;
int dx[]={-1,1,0,0};
int dy[]={0,0,1,-1};
bool test =0;
const int N=5e5+5;
int pow(int a, int b, int m)
{
    int ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%m;
        b/=2;
        a=(a*a)%m;
    }
    return ans;
}
 
int fact[N], invfact[N];
 
int modinv(int k)
{
    return pow(k, mod-2, mod);
}
 
void precompute()
{
    fact[0]=fact[1]=1;
    for(int i=2;i<N;i++)
    {
        fact[i]=fact[i-1]*i;
        fact[i]%=mod;
    }
    invfact[N-1]=modinv(fact[N-1]);
    for(int i=N-2;i>=0;i--)
    {
        invfact[i]=invfact[i+1]*(i+1);
        invfact[i]%=mod;
    }
}
 
int nCr(int x, int y)
{
    if(y>x)
        return 0;
    int num=fact[x];
    num*=invfact[y];
    num%=mod;
    num*=invfact[x-y];
    num%=mod;
    return num;
}
 

void solve()
{
    precompute();
    int n,m;
    cin>>n>>m;
    int x=(nCr(m,n)*fact[n])%mod;
    int y=x;
    for(int i=1;i<=n;i++){
        int y1=(nCr(m-i,n-i)*fact[n-i])%mod;
        y1=(y1*nCr(n,i))%mod;
        if(i&1)
            y-=y1;
        else
            y+=y1;
        y+=mod;
        y%=mod;
    }
    cout<<(x*y)%mod;
}











signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    if(test)
    cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 11428
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



n, m = LI()
original = LIR(n)


ret = -INF
for i in range(8):
    copy = [[original[a][b] for b in range(3)] for a in range (n)]
    for j in range(3):
        if 1 << j & i:
            for k in range(n):
                copy[k][j] *= -1
    s = sorted([sum(copy[l]) for l in range(n)],reverse=True)
    ret = max(ret, sum(s[:m]))




print(ret)

Measured memory_bytes: 45404