akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define INF 1000000000000000000
typedef long long ll;
vector<vector<bool>>dp(4020,vector<bool>(32020));
bool solve(vector<int>v,int z){
    rep(i,4020){
        rep(j,32020)dp[i][j]=false;
    }
    dp[0][16010]=true;
    rep(i,v.size()){
        rep(j,32020){
            if(dp[i][j]){dp[i+1][j+v[i]]=true;dp[i+1][j-v[i]]=true;}
        }
    }
    return dp[v.size()][16010+z];
}
int main(){
    vector<int>X,Y;
    string s;cin>>s;s+='T';int ct=-1,x,y,c=0;cin>>x>>y;
    rep(i,s.size()){
        if(s[i]=='F')c++;
        else{
            if(ct==-1)x-=c;
            else{
                if(ct%2==1)X.push_back(c);
                if(ct%2==0)Y.push_back(c);
            }
            ct++;c=0;
        }
    }
    if(solve(X,x)&&solve(Y,y))cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 16256
#include <iostream>
#include <cstring>
#include <queue>

#define gc (c = getchar())
#define gi(x) scanf("%d",&x)
#define gid(x, y) scanf("%d%d",&x,&y)
#define gll(x) scanf("%lld",&x);

#define pi(x) printf("%d\n",&x)

#define pll(x) printf("%lld\n",&x)
#define dbg(x) std::cerr << #x << " " << x << std::endl

inline long long max(long long x, long long y) { return x > y ? x : y; }

inline long long min(long long x, long long y) { return x > y ? y : x; }


const int maxn = 1e5 + 5;
int seq[maxn];
int main(){
    int n;
    std::cin >> n;
    for(int i = 1; i <= n; ++ i) std::cin >> seq[i];
    seq[n + 1] = 1e9 + 1;
    for(int i = n; i >= 1; -- i){
        if(seq[i] > seq[i + 1]) seq[i] --;
        if (seq[i] > seq[i + 1]) return !(std::cout << "No"<< std::endl);
    }
    std::cout << "Yes"<< std::endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	int n,d; 
	scanf("%d",&n);
	ll ans=0,c;
	int nw=0;
	for (int i=0;i<n;i++){
		scanf("%d%lld",&d,&c);
		if (!nw){
			nw=d;c--;
			if (!c) continue;
		}
		if (d==3 || d==6){
			if (d==3) ans+=c/3*4;
			else ans+=c/3*5;
			c%=3;
		}
		else ans+=c/9*(9+d);
		c%=9;
		while (c--){
			nw+=d;
			ans++;
			if (nw>=10){
				nw=nw/10+nw%10;
				ans++;
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 256
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>
#include <list>
#include <random>

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;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;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
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(a > b){a = b; return 1;} return 0;}


int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  if(n == 3){
    cout << 2 << endl;
    cout << "1 3" << endl;
    cout << "2 3" << endl;
    return 0;
  }
  if(n == 4){
    cout << 4 << endl;
    cout << "1 2" << endl;
    cout << "2 4" << endl;
    cout << "4 3" << endl;
    cout << "3 1" << endl;
    return 0;
  }
  if(n % 2 == 0)cout << 2 * n << endl;
  else cout << 2 * (n - 1) << endl;
  if(n % 2 == 0){
    for(int i = 0; i < n / 2 - 1; i++){
      cout << i + 1 << " " << i + 2 << endl;
      cout << i + 1 << " " << n + 1 - i - 2 << endl;
      cout << n - i << " " << i + 2 << endl;
      cout << n - i << " " << n + 1 - i - 2 << endl;
    }
    cout << 1 << " " << n / 2 << endl;
    cout << 1 << " " << n + 1 - n / 2 << endl;
    cout << n << " " << n / 2 << endl;
    cout << n << " " << n + 1 - n / 2 << endl;
  }else{
    n--;
    for(int i = 0; i < n / 2 - 1; i++){
      cout << i + 1 << " " << i + 2 << endl;
      cout << i + 1 << " " << n + 1 - i - 2 << endl;
      cout << n - i << " " << i + 2 << endl;
      cout << n - i << " " << n + 1 - i - 2 << endl;
    }
    cout << 1 << " " << n + 1 << endl;
    cout << n << " " << n + 1 << endl;
    cout << n / 2 << " " << n + 1 << endl;
    cout << n + 1 - n / 2 << " " << n + 1 << endl;
  }
	return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
cards = [list(map(int, input().split())) for _ in range(M)]
hit=ans=0
for n, m in sorted(cards, key=lambda x: x[0])[::-1]:
    if n >= N:
        hit += 1
    else:
        ans += N-n
        hit += 1
    if hit == M-1:
        break
print(ans)

Measured memory_bytes: 7856
#include<bits/stdc++.h>
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define ss st.st
#define sn st.nd 
#define mod 1000000007
/****************************/
using namespace std;
ll n,m;
string s;
int a[110][2];
int main()
{
	cin>>n;
	rep(i,n) cin>>a[i][0]>>a[i][1];
	bool flag=0;
	rep(i,n-2)
	{
		if(a[i][0]==a[i][1]&&a[i+1][0]==a[i+1][1]&&a[i+2][0]==a[i+2][1])
		{
			flag=1;
			break;
		}
	}
	if(flag) cout<<"Yes";
	else
	{
		cout<<"No";
	}
	return 0;
}

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

int darker() {//dfsとは違い、一度通ったマスを封鎖したりはしない。その代わりに最短距離を表した配列を使う。
    int64_t H,W;
    cin >> H >> W;
    vector<vector<char>> A(H,vector<char>(W));//マスの文字
    vector<vector<int64_t>> n(H,vector<int64_t>(W,-1));//マスのひっくり返る番目(-1はまだ)
    for (int64_t i = 0; i < H; i++){
        for(int64_t j = 0; j < W; j++){
            cin >> A.at(i).at(j);
        }
    }
    queue<pair<int64_t,int64_t>> q;//座標をいれるキュー
    vector<int> dx = {1,0,-1,0};
    vector<int> dy = {0,-1,0,1};//移動の四方向
    int64_t x,y,nx,ny;
    int64_t max_n = 0;

    for(int64_t i = 0; i < H; i++){
        for(int64_t j = 0; j < W; j++){
            if(A.at(i).at(j) == '#'){
                q.push(make_pair(i,j));
                n.at(i).at(j) = 0;
            }
        }
    }

    while(!q.empty()){
        x = q.front().first;
        y = q.front().second;
        q.pop();

        for (int i = 0; i < 4; i++){//四方向の探索
            nx = x+dx[i];
            ny = y+dy[i];
            if(nx >= 0 && nx< H && ny >= 0 && ny < W && A.at(nx).at(ny) == '.' && n.at(nx).at(ny) == -1){//範囲内かつ進めるかつ未到達
                q.push(make_pair(nx,ny));
                n.at(nx).at(ny) = n.at(x).at(y) + 1;
                if(max_n < n.at(x).at(y) + 1){
                    max_n = n.at(x).at(y) + 1;
                }
            }
        }
    }
    // for(int64_t i = 0; i < H; i++){
    //     for(int64_t j = 0; j < W; j++){
    //         cout << n.at(i).at(j);
    //     }
    //     cout << endl;
    // }
    return max_n;
}

int main(){
    int64_t ans = darker();
    cout << ans << endl;
}


Measured memory_bytes: 25524
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#include<algorithm>
#include<queue>
typedef long long ll;
#include<vector>
#define cin(n) scanf("%lld",&(n))
#define cout(n) printf("%lld",(n))
#define couc(c) printf("%c",(c))
#define coutn printf("\n")
#define cout_ printf(" ")
#define debug() printf("haha\n")
const int MAXN= 1e6 + 5 ;
ll t;
ll n,k;
ll a[MAXN];
ll an;
ll minn=100000000000;
int main()
{
    cin(n);
    cin(k);
    for(int i=1;i<=n;i++)
        cin(a[i]);
    sort(a+1,a+n+1);
    for(int i=1;i<=n-k+1;i++)
    {
        if(a[k+i-1]-a[i]<minn)
            minn=a[k+i-1]-a[i];
    }


    cout(minn);
    coutn;
    return 0;
}



Measured memory_bytes: 1024
import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int sx = scan.nextInt();
		int sy = scan.nextInt();
		int tx = scan.nextInt();
		int ty = scan.nextInt();

		int width = tx-sx;
		int height = ty-sy;
		for(int i = 0; i < Math.abs(height); i++) moveY(height);
		for(int i = 0; i < Math.abs(width); i++) moveX(width);
		for(int i = 0; i < Math.abs(height); i++) moveY(-height);
		for(int i = 0; i < Math.abs(width); i++) moveX(-width);
		moveX(-width);
		for(int i = 0; i < Math.abs(height)+1; i++) moveY(height);
		for(int i = 0; i < Math.abs(width)+1; i++) moveX(width);
		moveY(-height);
		moveX(width);
		for(int i = 0; i < Math.abs(height)+1; i++) moveY(-height);
		for(int i = 0; i < Math.abs(width)+1; i++) moveX(-width);
		moveY(height);

		System.out.println();
	}

	static void moveX(int _in) {
		System.out.print((_in>0)?"R":"L");
	}

	static void moveY(int _in) {
		System.out.print((_in>0)?"U":"D");
	}
}


Measured memory_bytes: 16776
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <locale>
using namespace std;
int main(){
	pair<int, int> NyT;
	pair<int, int> cyt;
	int costoMenor = 10001;
	cin>>NyT.first;
	cin>>NyT.second;
	for (int i = 0; i < NyT.first; i++)
	{
		cin>>cyt.first;
		cin>>cyt.second;
		if(cyt.second<=NyT.second){
			if(costoMenor > cyt.first){
				costoMenor = cyt.first;
			}
		}
	}
	if(costoMenor == 10001){
		cout<<"TLE";
	}else{
		cout<<costoMenor;
	}
	
	return 0;
}

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

using namespace std;

long long int k, n, i, j, a, b, c, h, sum;
const int maxn = 1000;
int e[maxn][maxn];
int q[maxn];
int w[maxn];
double u, m;

int main()
{
	cin >> n >> k;
	for(i = 0; i < n; i++){
		cin >> b;
		if(b >= k){
			c++;
		}
	}
	cout << c;
}


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

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

    vector<double> X(N), H(N);
    for(int i=0; i<N; i++) {
        cin >> X[i] >> H[i];
    }

    double ub = 1e9, lb = 0;
    for(int i=0; i<200; i++) {
        double mid = (ub + lb) / 2;
        bool ok = true;
        for(int k=0; k<N; k++) {
            double y = mid / T * X[k];
            ok &= (y >= H[k]);
        }
        if(ok) ub = mid;
        else lb = mid;
    }
    printf("%.12f\n", ub);
    return 0;
}



Measured memory_bytes: 3292
#include<iostream>
#include<queue>
#include<cmath>

using namespace std;

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

class MCF {
private:
  struct edge { int to, cap, cost, rev; };
  typedef pair<int, int> P;

  const static int INF = 1e9;

  int v;
  vector<vector<edge> > g;
  vector<int> h, dist, prevv, preve;

public:
  MCF() : v(0) {}

  int next() {
    g.push_back(vector<edge>());
    h.push_back(0);
    dist.push_back(0);
    prevv.push_back(0);
    preve.push_back(0);
    return v++;
  }

  void add_edge(int from, int to, int cap, int cost) {
    g[from].push_back((edge){to, cap, cost, (int)g[to].size()});
    g[to].push_back((edge){from, 0, -cost, (int)g[from].size() - 1});
  }

  int run(int s, int t, int f) {
    int res = 0;
    fill(h.begin(), h.end(), 0);
    while (f > 0) {
      priority_queue<P, vector<P>, greater<P> > que;
      fill(dist.begin(), dist.end(), INF);
      dist[s] = 0;
      que.push(P(0, s));
      while (!que.empty()) {
	P p = que.top(); que.pop();
	int v = p.second;
	if (dist[v] < p.first) continue;
	rep (i, g[v].size()) {
	  edge &e = g[v][i];
	  if (e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]) {
	    dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
	    prevv[e.to] = v;
	    preve[e.to] = i;
	    que.push(P(dist[e.to], e.to));
	  }
	}
      }
      if (dist[t] == INF) {
	return -1;
      }
      rep (i, v) h[i] += dist[i];
      int d = f;
      for (int i = t; i != s; i = prevv[i]) d = min(d, g[prevv[i]][preve[i]].cap);
      f -= d;
      res += d * h[t];
      for (int i = t; i != s; i = prevv[i]) {
	edge &e = g[prevv[i]][preve[i]];
	e.cap -= d;
	g[i][e.rev].cap += d;
      }
    }
    return res;
  }

};

int main() {
  int n;
  cin >> n;
  int p[n];
  rep (i, n) cin >> p[i];
  MCF mcf;
  int from = mcf.next();
  int to = mcf.next();
  int left[n], right[n];
  rep (i, n) left[i] = mcf.next();
  rep (i, n) right[i] = mcf.next();
  rep (i, n) mcf.add_edge(from, left[i], 1, 0);
  rep (i, n) mcf.add_edge(right[i], to, 1, 0);
  rep (i, n) rep (j, n) if (p[i] - 1 != j) mcf.add_edge(left[i], right[j], 1, p[i] * abs(i - j));
  cout << mcf.run(from, to, n) << endl;
}

Measured memory_bytes: 1684
import std.algorithm;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.meta;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;

long solve(ref int N, ref int M, ref int P, ref int[] A, ref int[] B, ref int[] C) {
    auto cost = new long[](N + 1);
    auto used = new bool[](N + 1);

    fill(cost, long.max);
    cost[1] = 0;
    used[1] = true;

    foreach (t; 0 .. (2 * N)) {
        bool update = false;
        foreach (i; 0 .. M) {
            auto a = A[i];
            auto b = B[i];
            auto c = P - C[i];
            if (used[a] && cost[b] > cost[a] + c) {
                update = true;
                cost[b] = cost[a] + c;
                used[b] = true;
                if (b == N && t >= N)
                    return -1;
            }
        }
        if (!update)
            break;
    }

    return max(0, -cost[N]);
}

void main() {
    int N;
    readf(" %d", &N);
    int M;
    readf(" %d", &M);
    int P;
    readf(" %d", &P);
    int[] A = new int[](cast(uint) M);
    int[] B = new int[](cast(uint) M);
    int[] C = new int[](cast(uint) M);
    for (int i = 0; i < M; i++) {
        readf(" %d", &A[i]);
        readf(" %d", &B[i]);
        readf(" %d", &C[i]);
    }
    auto ans = solve(N, M, P, A, B, C);
    writeln(ans);
}


Measured memory_bytes: 380
//20
#include<iostream>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<functional>

using namespace std;

int main(){
  int n;
  cin>>n;
  while(n--){
    string s;
    cin>>s;
    string sl=s,sh=s;
    sort(sl.begin(),sl.end());
    sort(sh.begin(),sh.end(),greater<char>());
    cout<<atoi(sh.c_str())-atoi(sl.c_str())<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,q;
	cin>>n>>k>>q;
	int s[q],p[n];
	for(int i=1;i<=n;i++)p[i]=k-q;
	for(int i=1;i<=q;i++){
		cin>>s[i];
		p[s[i]]++;
	}
	for(int i=1;i<=n;i++){
		if(p[i]>0)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}


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

const int mod = 1e9+7;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll ans = 0;
    rep(i,60){
        ll x = 0;
        rep(j,n) if(a[j]>>i&1) x++;
        ll now = x*(n-x) % mod;
        rep(j,i) now = now*2%mod;
        ans += now;
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5636
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        long ans = 1;
        for (int i=0;i<N;i++){
         long n = in.nextLong();
         ans = lcm(ans,n);
        }
        System.out.println(ans);
    }
        public static long gcd(long a, long b){
        while(true){
            if(a == 0) return b;
            b %= a;
            if(b == 0) return a;
            a %= b;
        }
    }
    public static long lcm(long a, long b){
        if(gcd(a, b) > 0){
            return a/gcd(a,b)*b;
        }else{
            return 0;
        }
    }
}

Measured memory_bytes: 21844
n,a,b = map(int,input().split())
if bin(a^b).count("1")%2 == 0:
  print("NO")
  exit()
st = min(a,b)
dif = a^b
t = 1<<(n-1)
chls = []
chcnt = n-1
for i in range(n)[::-1]:
  if dif&1<<i:
    chls.append((chcnt,i))
    chcnt -= 1
def change(x,p,q):
  if (x>>p)&1 ^ (x>>q)&1:
    x ^= (1<<p)+(1<<q)
  return x
def changeall(x):
  for l,r in chls[::-1]:
    x = change(x,l,r)
  x ^= st
  return x
if n == 1:
  print("YES")
  print(a,b)
  exit()
ls = []
x = 0
for i in range(1,2**n):
  cnt = 0
  while i%2 == 0:
    i //= 2
    cnt += 1
  ls.append(1<<cnt)
chcnt += 1
while chcnt < n-1:
  i = chcnt+1
  ls[-2**i] //= 2
  ls[-2**(i-1)] *= 2
  ls[-2**(i-1)-2**i] *= 2
  chcnt += 2
nls = [0]
for i in ls:
  nls.append(nls[-1]^i)
print("YES")
ansls = [changeall(nls[i]) for i in range(2**n)]
if a < b:
  print(*ansls)
else:
  print(*ansls[::-1])

Measured memory_bytes: 61836
N = int(input())
ans = 0
ana_dict = {}
for i in range(N):
    str = input()
    str= ''.join(sorted(str))
    if str in ana_dict:
        ans+=ana_dict[str]
        ana_dict[str]+=1
    else:
        ana_dict.setdefault(str, 1)
print(ans)

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

int main() {
	int H,W,K;
	cin >> H >> W >> K;
	vector<vector<char>> c(H,vector<char>(W));
	vector<int> cho_h(H), cho_w(W);
	rep(i,H) rep(j,W) cin >> c[i][j];
	int max_H = (1<<H);
	int max_W = (1<<W);
	int ans = 0;

	rep(i,max_H) rep(j,max_W) {
		// 行・列の組合せを抽出
		int tmp_h,tmp_w;
		tmp_h = i, tmp_w = j;
		rep(h,H) {
			cho_h[h] = tmp_h % 2;
			tmp_h /= 2;
		}
		rep(w,W) {
			cho_w[w] = tmp_w % 2;
			tmp_w /= 2;
		}
		// 赤く塗った時の黒いマスをカウント
		int cnt = 0;
		rep(h,H) rep(w,W) {
			if (c[h][w] == '#' && cho_h[h] == 0 && cho_w[w] == 0) cnt++;
		}
		if (cnt == K) ans++;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3612
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<vector<int> > v(n);
    for(int i=0; i<n; ++i){
        int t, d;
        cin >> t >> d;
        v[t-1].push_back(d);
    }

    priority_queue<int> pq;
    long long sum = 0;
    int cnt = 0;
    for(int i=0; i<n; ++i){
        if(v[i].empty())
            continue;
        sort(v[i].rbegin(), v[i].rend());
        sum += v[i][0];
        ++ cnt;
        for(int j=1; j<(int)v[i].size(); ++j)
            pq.push(v[i][j]);
    }

    long long ans = 0;
    sort(v.begin(), v.end());
    for(int i=0; i<n; ++i){
        if(v[i].empty())
            continue;

        while(cnt < k){
            sum += pq.top();
            pq.pop();
            ++ cnt;
        }
        if(cnt == k){
            long long x = n - i;
            ans = max(ans, x * x + sum);
        }
        sum -= v[i][0];
        pq.push(v[i][0]);
        -- cnt;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6144
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n; cin>>n;
    rep(i,n){
    pdd a,b,c,d; cin>>a.first>>a.second>>b.first>>b.second;
    cin>>c.first>>c.second>>d.first>>d.second;
    if(abs((c.first-d.first)*(a.second-b.second)-(a.first-b.first)*(c.second-d.second))<=EPS)
        cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mod 998244353
#define N 100005
int n;
vector<int> g[2005];
int vis[2005],len[2005];
int ans[2005];

void bfs(int s)
{
    memset(vis,0,sizeof vis);
    memset(len,0,sizeof len);
    vis[s]=1;
    queue<int> q;
    q.push(s);
    while(!q.empty())
    {
        int u=q.front();
        q.pop();
        for(int i=0;i<g[u].size();i++)
        {
            int v=g[u][i];
            if(!vis[v])
            {
                vis[v]=1;
                len[v]=len[u]+1;
                q.push(v);
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        ans[len[i]]++;
    }
}

int main()
{
    int x,y;
    cin>>n>>x>>y;
    for(int i=1;i<n;i++)
    {
        g[i].pb(i+1);
        g[i+1].pb(i);
    }
    g[x].pb(y);
    g[y].pb(x);
    for(int i=1;i<=n;i++)
    {
        bfs(i);
    }
    for(int i=1;i<n;i++) cout<<ans[i]/2<<endl;
}


Measured memory_bytes: 384
#![allow(clippy::needless_range_loop)]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::*;

fn main() {
    input! {
        n: Bytes,
    }

    let sum: usize = n.iter().map(|x| (x - b'0') as usize).sum();
    if sum % 9 == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2332
import java.util.*;

public class Main{
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        int  com = 0;
        String c = " ";
        String d = " ";
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        for(int i=0;i<b;i++){//aをb個並べる
        	c=c+String.valueOf(a);
        }
       	for(int k=0;k<a;k++){//bをa個並べる
        	d =d+String.valueOf(b); 
        }
        //System.out.println(c);
        //System.out.println(d);
        com = c.compareTo(d);
        
        if(com<=0){
        	System.out.println(c);
        }else{
        	System.out.println(d);
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    string S;
    cin>>S;
    int n=S.size();
    if(n<=25){
        for(char m='a';m<='z';m++){
            bool z=true;
            rep(i,n){
                if(S[i]==m) z=false;
            }
            if(z) {
                cout << S << m << endl;
                return 0;
            }
        }
    }else{
        if(S=="zyxwvutsrqponmlkjihgfedcba") {
            cout << -1 << endl;
            return 0;
        }
        char x='z';
        int y;
        for(int i=25;i>=0;i--){
            if(S[i]>S[i-1]) {
                x=S[i-1];
                y=i;
                break;
            }
        }
        char ans='z';
        for(char m=x;m<='z';m++){
            for(int i=y;i<=25;i++){
                if(m==S[i]) {
                    ans=min(m,ans);
                    break;
                }
            }
        }


        cout << S.substr(0,y-1) << ans << endl;

    }



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;


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

  ll s = a[0] ^ a[1];

  for (int i = 2; i < n; ++i) s ^= a[i];

  rep(i, n) cout << (s^a[i]) << " ";
  cout << endl;
}


Measured memory_bytes: 4848
#include <bits/stdc++.h>
#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 k; string s;
    cin >> k >> s;
    int sz = s.size();
    if (sz <= k) cout << s;
    else
    {
        rep(i, k) cout << s[i];
        cout << "...";
    }
    puts("");
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int m = 0;
  rep(i, n - 1) m = max(m, a[i + 1] - a[i]);
  m = max(m, a[0] + k - a[n - 1]);
  cout << k - m;
}


Measured memory_bytes: 4020
#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 FORR(i, m, n) for(int i = m;i >= n;i--)

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

int main(void) {
    int a, b, c;
    cin >>a >>b >>c;
    if(a>c || a+b<c){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    
    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////
    int N;
    cin >> N;
    string S;
    for (int i=0;i<N;i++){
        cin >>S;
        if(S=="Y"){
            cout<<"Four"<<endl;
            break;
        }
        if(i==N-1){
            cout<<"Three"<<endl;
        }
    }
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;int main(){int a=1e9,z=-1,i=0;string s;cin>>s;for(;i<s.size();++i){if(s[i]=='A')a=min(a,i);if(s[i]=='Z')z=i+1;}cout<<z-a<<endl;}


Measured memory_bytes: 640
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		long x[] = new long[n], y[] = new long[n];
		
		for(int i=0;i<n;i++){
			x[i] = sc.nextLong();
			y[i] = sc.nextLong();
		}
		
		long parity = Math.abs((x[0] + y[0]) % 2);
		
		boolean f = true;
		for(int i=1;i<n;i++){
			if(Math.abs((x[i]+y[i])%2) != parity)
				f = false;
		}
		
		if(f){
			long a[] = new long[31];
			
			a[0] = 1;
			for(int i=1;i<31;i++){
				a[i] = a[i-1]*2;
			}
			
			
			if(parity==0){
				System.out.println(32);
				System.out.print(1+" ");
			}
			else{
				System.out.println(31);
			}
			
			for(int i=30;i>=0;i--){
				System.out.print(i==30 ? a[i]:" "+a[i]);
			}
			System.out.println();
			
			
			for(int i=0;i<n;i++){
				if(parity==0){
					if(Math.abs(x[i]-1) + Math.abs(y[i]) <= (1L<<31) -1){
						x[i] -= 1;
						System.out.print("R");
					}
					else if(Math.abs(x[i]+1) + Math.abs(y[i]) <= (1L<<31) -1){
						x[i] += 1;
						System.out.print("L");
					}
					else if(Math.abs(x[i]) + Math.abs(y[i]-1) <= (1L<<31) -1){
						y[i] -=1;
						System.out.print("U");
					}
					else{
						y[i]+=1;
						System.out.print("D");
					}
				}
				
				
				for(int j=30;j>=0;j--){
					
					if(Math.abs(x[i]-a[j]) + Math.abs(y[i]) <= (1L<<j) -1){
						x[i] -= a[j];
						System.out.print("R");
					}
					else if(Math.abs(x[i]+a[j]) + Math.abs(y[i]) <= (1L<<j) -1){
						x[i] += a[j];
						System.out.print("L");
					}
					else if(Math.abs(x[i]) + Math.abs(y[i]-a[j]) <= (1L<<j) -1){
						y[i] -= a[j];
						System.out.print("U");
					}
					else{
						y[i] += a[j];
						System.out.print("D");
					}
				}
				System.out.println();
			}
			
		}
		else{
			System.out.println(-1);
		}
	}

}


Measured memory_bytes: 30228
#include <stdio.h>
int ans = 0;
int min(int a, int b){return a > b ? b : a;}
int d[202][202];
int chk[202];
int n;
int dfs(int a, int f){
    int i, j;
    chk[a] = 0;
    for(i = 2*n+1; i >= 0; i--){
        if(chk[i] != -1 || d[a][i] == 0){
            continue;
        }
        if(i == 2*n+1){
            int flow = min(f, d[a][i]);
            ans += flow;
            d[i][a] += flow;
            d[a][i] -= flow;
            return flow;
        }
        int tmp = dfs(i, min(f, d[a][i]));
        if(tmp != 0){
            d[i][a] += tmp;
            d[a][i] -= tmp;
            return tmp;
        }
    }
    return 0;
}

int main(void){
    scanf("%d", &n);
    int p[100], q[100];
    int r[100], s[100];
    int i, j, k;
    for(i = 0; i < 2*n + 2; i++){
        for(j = 0; j < 2*n + 2; j++){
            d[i][j] = 0;
        }
    }
    for(i = 0; i < n; i++){
        scanf("%d%d", &p[i], &q[i]);
        d[0][i+1] = 1; 
    }
    for(i = 0; i < n; i++){
        scanf("%d%d", &r[i], &s[i]);
        d[i+n+1][2*n+1] = 1;
    }

    

    for(i = 0; i < n; i++){
        for(j = 0; j < n; j++){
            if(p[i] < r[j] && q[i] < s[j]){
                d[i+1][j+1+n] = 1;//赤い点→青い点
            }
        }
    }



    while(1){
        for(i = 0; i < 2*n+2; i++){
            chk[i] = -1;
        }
        int ans_before = ans;
        dfs(0, 100000);
        if(ans == ans_before){
            break;
        }
    }

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


}

Measured memory_bytes: 1856
#include<iostream>
using namespace std;
int main(){
    int n;
    int debt = 100000;
    cin >> n;
    for(int i = 0;i < n; i++){
        debt *= 1.05;
        if(debt % 1000 != 0){
            debt /= 1000;
            debt *= 1000;
            debt += 1000;
        }
    }

    cout << debt << endl;
    return 0;
}

Measured memory_bytes: 0
#include <stdio.h>


int trans(x,y,z){
  if((z-(x-y))>0){
  return z-(x-y);
  }else{
    return 0;
  }
}
int main(void){
  int A,B,C,kekka;
  scanf("%d %d %d",&A,&B,&C);
  kekka = trans(A,B,C);
  printf("%d",kekka);
}

Measured memory_bytes: 128
# D
def main():
  #N = 4000
  #S = ["RGB"[random.randint(0, 2)] for _ in range(N)]

  N = int(input())
  S = input()

  import collections

  c = collections.Counter(S)

  total = c["B"]*c["G"]*c["R"]

  for d in range(1, N//2+1):
    for i in range(N-d-d):
      if len({S[i], S[i+d], S[i+d+d]})==3:
        total -= 1
  
  print(total)

main()

Measured memory_bytes: 9468
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int res = 0;
  string s;
  cin >> s;
  
  if(s=="SUN"){
    res=7;
  }else if(s=="MON"){
    res=6;
  }else if(s=="TUE"){
    res=5;
  }else if(s=="WED"){
    res=4;
  }else if(s=="THU"){
    res=3;
  }else if(s=="FRI"){
    res=2;
  }else if(s=="SAT"){
    res=1;
  }else{
    cout << "ERROR" << endl;
  }
  
  cout << res << endl;
}

Measured memory_bytes: 256
S = input()[::-1]
A = ["dream"[::-1], "dreamer"[::-1], "erase"[::-1], "eraser"[::-1]]
s = 0
t = 1
while(s != len(S)):
    t2 = 0
    for a in A:
        if S[s:s+len(a)] == a:
            s += len(a)
            t2 = 1

    if t2 ==0:
        t = 0
        break
    
if t:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3316
#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-1); i >= 0; --i)

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; }

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int X, Y;
    cin >> X >> Y;

    rep(i, X+1) {
        int j = X - i;
        if (i * 2 + j * 4 == Y) {
            puts("Yes");
            return 0;
        }
    }

    puts("No");
}

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

int main() {

  int S;
  cin >> S;

  int h = S / 3600;
  S = S % 3600;
  int m = S / 60;
  S = S % 60;
  
  cout << h << ":" << m << ":" << S << endl;

  return 0;

}


Measured memory_bytes: 3096
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    string str;
    cin >> str;

    if (str == "ani") {
        cout << "square1001" << endl;
    } else {
        cout << "e869120" << endl;
    }

}












Measured memory_bytes: 3160
checkCoffee :: String -> String
checkCoffee x = if check
                then "Yes"
                else "No"
  where front = (x!!2 == x!!3)
        back = (x!!4 == x!!5)
        check = (front && back)

main :: IO ()
main = do
  n <- getLine
  putStrLn (checkCoffee n)

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

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

  string ans = "Yes";
  int n;
  cin >> n;
  unordered_set<string> used;
  string s;
  cin >> s;
  used.insert(s);
  string t = s;
  for (int i = 1; i < n; i++) {
    cin >> s;
    if (s[0] != t[t.size()-1] || used.find(s) != used.end()) {
      ans = "No";
    }
    used.insert(s);
    t = s;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
n = int(input())
t = list(map(int, input().split()))
m = int(input())
s = sum(t)
ans = []
for i in range(m):
    p, x = map(int, input().split())
    ans.append(s+x-t[p-1])
for i in range(m):
    print(ans[i])

Measured memory_bytes: 3064
import java.util.Scanner;


public class Main{
	public static void main(String [] args){

        Scanner sc = new Scanner(System.in);
	// 整数の入力
	int a = sc.nextInt();
	int b = sc.nextInt();
	int t = sc.nextInt();
	
	double byou = t + 0.5; 
	double byou1 = byou/a;
        int byou2 = (int)byou1;
        
	

	int answer = byou2*b; 

	System.out.println(answer);
}

	

}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;

bool isok(ll mid, ll temp, ll k, vector<ll>& sumb) {
  return temp + sumb[mid] <= k;
}
int main() {
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> a(n), b(m);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];

  vector<ll> suma(n, 0), sumb(m, 0);
  partial_sum(a.begin(), a.end(), suma.begin());
  partial_sum(b.begin(), b.end(), sumb.begin());
  suma.insert(suma.begin(), 0);
  sumb.insert(sumb.begin(), 0);

  ll ans = 0;

  for (int i = 0; i < n + 1; i++) {
    ll temp = suma[i];

    ll ok = -1, ng = m + 1, mid;
    while (ng - ok > 1) {
      mid = (ok + ng) / 2;
      if (isok(mid, temp, k, sumb)) {
        ok = mid;
      } else {
        // cout << "a" << endl;
        ng = mid;
      }
    }

    // cout << ok << " " << ng << endl;
    ans = max(ans, ok == -1 ? 0 : ok + i);
  }

  cout << ans << endl;
}

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

const int N = 2005;
const int INF = 1e9;

int n, a[N * 2], pos[N * 2];
char c[N * 2];
int dp[N * 2][N];

struct Fenwick {
	int t[N];

	void upd(int x) {
		for (; x > 0; x -= x & -x) t[x]++;
	}

	int get(int x) {
		int ret = 0;
		for (; x < N; x += x & -x) ret += t[x];
		return ret;
	}
} bitB[N * 2], bitW[N * 2];

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

	cin >> n;
	for (int i = 1; i <= n + n; ++i) {
		cin >> c[i] >> a[i];
		if (c[i] == 'B') pos[a[i]] = i;
		else pos[a[i] + n] = i;
	}

	for (int i = 1; i <= n + n; ++i) {
		bitB[i] = bitB[i - 1];
		bitW[i] = bitW[i - 1];
		if (c[i] == 'W') {
			bitW[i].upd(a[i]);
		} else {
			bitB[i].upd(a[i]);
		}
	}

	for (int i = 0; i <= n + n; ++i) {
		for (int j = 0; j <= n; ++j) {
			dp[i][j] = INF; // reset
		}
	}

	dp[0][0] = 0;
	for (int i = 0; i < n + n; ++i) {
		for (int b = 0; b <= i && b <= n; ++b) { // B
			if (dp[i][b] == INF) continue;
			int w = i - b; // W
			if (w < n) {
				int p = pos[w + 1 + n];
				dp[i + 1][b] = min(dp[i + 1][b], dp[i][b] + bitW[p - 1].get(w + 1) + bitB[p - 1].get(b + 1));
			}
			if (b < n) {
				int p = pos[b + 1];
				dp[i + 1][b + 1] = min(dp[i + 1][b + 1], dp[i][b] + bitW[p - 1].get(w + 1) + bitB[p - 1].get(b + 1));
			}
		}
	}

	cout << dp[n + n][n] << endl;
}

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

#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< pii,vector<pii> ,greater< pii >>

using namespace std;


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

/*int power(int a,int n)
{
    if(n == 1)return a%mod;
    if(n == 0)return 1;
    if(n&1)return ((a%mod)*(power((a*a)%mod,n/2))%mod)%mod;
    return power((a*a)%mod,n/2)%mod;
}*/
//const int md = 998244353;



signed main()
{
    showoff;
    int n,m;
    cin >> n >> m;
    vector<pii>v(n+5);
    FOR(i,0,n){
        cin >> v[i].f >> v[i].se;
    }
    sort(v.begin(),v.begin()+n);
    int ans = 0,i = 0;
    while(m > 0){
        ans += min(m,v[i].se)*v[i].f;
        m -= min(m,v[i].se);
        ++i;
    }
    cout << ans;
    return 0;
}
//*->for large size of matrix +around 1e7 memory take int not long long ......

Measured memory_bytes: 1792
from bisect import bisect_left


def main():
    N = int(input())
    L = list(map(int, input().split(" ")))
    L.sort()
    result = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = bisect_left(L, L[i] + L[j])
            result += k - j - 1
    print(result)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define FOR(n) for(int i=0;i<n;i++)
#define For(i,n) for(int i=0;i<n;i++)
#define ll long long
ll mob=1000000007;
int main()
{int n,k,s;
cin>>n>>k>>s;
int l=0;
for(int i=0;i<n;i++)
{
    if(l<k)
    {
        cout<<s<<" ";
        l++;
    }
    else 
    {if(s!=1)
     cout<<s-1<<" ";
     else
     cout<<5<<" ";        
    }
}
 return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>

using namespace std;

int main()
{
  int a[3];

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

  sort(begin(a), end(a));

  cout << a[0] << " " << a[1] << " " << a[2] << endl;

  return 0;
}



Measured memory_bytes: 3124
use strict;
use warnings;
use utf8;
use Data::Dumper;

use feature qw(say);

my $list = <STDIN>;
chomp $list;

my ($x, $y) = (split/ /, $list);
my $b_2 = $y - 2 * $x;

if ($b_2 >= 0 && $b_2 % 2 == 0) {
    my $b_count = $b_2/2;
    my $a_count = $x - $b_count;

    if ($b_count >= 0 && $a_count >= 0) {
        say 'Yes';
    } else {
        say 'No';
    }
} else {
    say 'No';
}


Measured memory_bytes: 6444
import java.util.Scanner;
import java.util.InputMismatchException;

class Main {
   public static void main(String args[]) {
      int x=0 ,y=0;
      Scanner scanner = new Scanner(System.in);
      x = scanner.nextInt();
      y = scanner.nextInt();
      scanner.close();
      int kansi = y*2+1;
      if (x%kansi == 0) {
         System.out.println(x/kansi);
      } else {
         System.out.println(x/kansi + 1);
      }
   }
}


Measured memory_bytes: 21844
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;
 
#define  GODSPEED       ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define  f              first                 
#define  s              second
#define  newl           cout<<"\n";
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<"\n";
#define  deb2(a,b)      cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define  all(a)         a.begin(),a.end()           
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   N     =  2e5+5;
const ll   mod   =  1e9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   LEVEL =  log2(N)+1;

int x;

void solve(){
	cin >> x;
	deb1(1-x)
}

int main(){
	GODSPEED;
	int test = 1;
	//cin>>test;
	for(int i = 1; i <= test; i++){
		solve();
	}
	#ifndef ONLINE_JUDGE
	cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif
}

Measured memory_bytes: 3636
#include <stdio.h>
int main(){
int a, b, sum;
  scanf("%d %d",&a, &b);
  
  sum = 100 * (10 - a);
    
  if(a >= 10){
    printf("%d\n",b);
  }
  
  else {
    printf("%d\n",sum + b);
  }
  
  return 0;
}

Measured memory_bytes: 128
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	std::string s;
	std::cin >> s;
	int result = 0;
	for (auto ch : s) {
		if (ch == '1')
			++result;
	}
	std::cout << result << "\n";
}


Measured memory_bytes: 512
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const int INF = 1000000;
const double PI=3.14159265359;


int main(){

  // ifstream in("12.txt");
  // cin.rdbuf(in.rdbuf());

  ll n;cin>>n;
  ll a[n],b[n];
  ll asum=0,bsum=0;

  rep(i,0,n){
    cin>>a[i];
    asum+=a[i];
  }
  rep(i,0,n){
    cin>>b[i];
    bsum+=b[i];
  }

  if(asum<bsum){
    out(-1);
    return 0;
  }

  ll sum=0;
  multiset<ll,greater<ll>>se;
  ll ans=0;
  rep(i,0,n){
    if(a[i]<b[i]){
      sum+=b[i]-a[i];
      ans++;
    }else if(a[i]>b[i]){
      se.insert(a[i]-b[i]);
    }
  }
  if(sum==0){
    out(0);
    return 0;
  }
  // out(sum);
  for(multiset<ll,greater<ll>>::iterator itr=se.begin();itr!=se.end();itr++){
    sum-=*itr;
    ans++;
    if(sum<=0){
      out(ans);
      return 0;
    }
  }

  return 0;
}


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

vector<ll> keta_bunkai(ll a){
    string s = to_string(a);
    vector<ll> ret;
    for(auto p : s){
        ret.push_back((ll)(p - '0'));
    }
    return ret;
}

int main(){
    ll N, K;
    cin >> N >> K;
    vector<bool> D(10, true);
    rep(i, 0, K){
        ll d;
        cin >> d;
        D[d] = false;
    }
    rep(i, N, 10*N){
        bool f = true;
        auto p = keta_bunkai(i);
        for(auto q : p){
            if(!D[q]) f = false;
        }
        if(f){
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

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

using namespace std;

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

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

int main(){
  fastIO;
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int par = 0;
  while(a > 0 && c > 0){
    if(par == 0) c -= b;
    else a -= d;
    par ^= 1;
  }
  if(par == 0) cout << "No\n";
  else cout << "Yes\n";
  return 0;
}

Measured memory_bytes: 3640
from scipy.misc import comb
gusu, kisu = input().split()
gusu = int(gusu) # 個数
kisu = int(kisu) # 個数
gusu_num = comb(gusu, 2, exact=True)
kisu_num = comb(kisu, 2, exact=True)
print(gusu_num + kisu_num)

Measured memory_bytes: 14036
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a[200001];
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int m=0,b[200000];
	bool ans[200001];
	for(int i=n;i>0;i--){
		int cnt=0;
		for(int j=2*i;j<=n;j+=i)
			if(ans[j])
				cnt++;
		if(cnt%2!=a[i]){
			ans[i]=true;
			b[m]=i;
			m++;
		}else
			ans[i]=false;
	}
	cout<<m<<endl;
	for(int i=0;i<m;i++)
		cout<<b[i]<<(i+1==m?'\n':' ');
}


Measured memory_bytes: 2432