akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define fi  first
#define se  second
#define int long long

const int   N   = 1e5 + 1;
const int   inf = 1e15;

typedef pair<int,int>   ii;

vector<ii>  g[N];

int n, m, d[N];

int L = -inf;
int R = inf;
int b[N], X;

bool ch = 0;

void dfs(int u) {
    if(d[u] & 1)    L = max(L,-b[u]);
    else            R = min(R,b[u]);
    for(ii e : g[u])   {
        int v = e.fi;
        int C = e.se;
        if(!d[v])   {
            d[v] = d[u] + 1;
            b[v] = C - b[u];
            dfs(v);
        }
        if((d[u] + d[v]) & 1)   {
            if(b[u] + b[v] != C)    {
                cout << "0";
                exit(0);
            }
            continue;
        }
        int val = (C - b[u] - b[v]) * (d[u] & 1 ? 1 : -1);
        if(!ch)
            X = val, ch = 1;
        if(X != val)    {
            cout << "0";
            exit(0);
        }
    }
}

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

    cin >> n >> m;

    while(m--)  {
        int x, y, s;    cin >> x >> y >> s;
        g[x].push_back({y,s});
        g[y].push_back({x,s});
    }

    d[1] = 1;   dfs(1);

    if(ch)  {
        if(X & 1 || X <= 2 * L || X >= 2 * R)
             puts("0");
        else puts("1");
        return 0;
    }

    cout << max(0ll,R - L - 1) << endl;
}


Measured memory_bytes: 14080
#define NDEBUG

#include <cassert>
#include <cstddef>
#include <vector>

template <class Monoid> class dual_segment_tree {
  using size_t = std::size_t;
  using T = typename Monoid::value_type;

public:
  using value_type = T;
  using size_type = size_t;

private:
  static size_t lsb(const size_t x) { return __builtin_ctz(x); }
  static size_t msb(const size_t x) { return 31 - __builtin_clz(x); }
  static void add(T &x, const T y) { x = Monoid::operation(x, y); }

  std::vector<T> tree;

  void push(const size_t index) {
    add(tree[index * 2], tree[index]);
    add(tree[index * 2 + 1], tree[index]);
    tree[index] = Monoid::identity;
  }
  void propagate(const size_t index) {
    if (index == 0)
      return;
    const size_t lsb_ = lsb(index);
    for (size_t h = msb(index); h != lsb_; h -= 1)
      push(index >> h);
  }

public:
  dual_segment_tree() = default;
  explicit dual_segment_tree(const size_t n) : tree(n * 2, Monoid::identity) {}

  size_t size() const noexcept { return tree.size() / 2; }

  T fold(size_t index) const {
    assert(index < size());
    index += size();
    T ret = tree[index];
    while (index != 1) {
      index /= 2;
      add(ret, tree[index]);
    }
    return ret;
  }

  void update(size_t first, size_t last, const T x) {
    assert(first <= last);
    assert(last <= size());
    first += size();
    last += size();
    propagate(first);
    propagate(last);
    while (first != last) {
      if (first % 2 != 0) {
        add(tree[first], x);
        first += 1;
      }
      first /= 2;
      if (last % 2 != 0) {
        last -= 1;
        add(tree[last], x);
      }
      last /= 2;
    }
  }
};

template <class T> class plus_monoid {
public:
  using value_type = T;

  static constexpr T operation(const T &x, const T &y) noexcept {
    return x + y;
  }
  static constexpr T identity = 0;
};
template <class T> constexpr T plus_monoid<T>::identity;

#include <cstdio>

int scan() {
  int r = 0;
  int c;
  while ((c = getchar_unlocked() - '0') >= 0)
    r = r * 10 + c;
  return r;
}

int main() {
  const int n = scan();
  const int q = scan();

  dual_segment_tree<plus_monoid<int>> dst(n);

  for (int k = 0; k != q; k += 1) {
    if (scan() == 0) {
      const int s = scan() - 1;
      const int t = scan();
      const int x = scan();
      dst.update(s, t, x);
    } else {
      const int i = scan() - 1;
      printf("%d\n", dst.fold(i));
    }
  }
}



Measured memory_bytes: 3084
import sys

def main():
    # input = sys.stdin.readline

    n=int(input())
    s=list(map(int,input()))
    # s.pop(-1)
    cnt=0
    for i in range(10):
        if i in s[:-2]:
            idx1=s[:-2].index(i)
            for j in range(10):
                if j in s[idx1+1:-1]:
                    idx2=s[idx1+1:-1].index(j)+idx1+1
                    for k in range(10):
                        if k in s[idx2+1:]:
                            cnt+=1
    print(cnt)

    #
    # tmp=[0,0,0]
    # cnt=0
    # for i in range(0,1000):
    #     if i < 10:
    #         tmp[0]=0
    #         tmp[1]=0
    #         tmp[2]=i
    #     elif i < 100:
    #         tmp[0]=0
    #         tmp[1]=i//10
    #         tmp[2]=i-tmp[1]*10
    #     else:
    #         tmp[0]=i//100
    #         tmp[1]=(i-tmp[0]*100)//10
    #         tmp[2]=i-tmp[0]*100-tmp[1]*10
    #     ketaflg=0
    #     for j in s :
    #         if j == '\n':
    #             break
    #         if tmp[0]==int(j) and ketaflg==0:
    #             ketaflg=1
    #         elif tmp[1]==int(j) and ketaflg==1:
    #             ketaflg=2
    #         elif tmp[2]==int(j) and ketaflg==2:
    #             ketaflg=3
    #             cnt+=1
    #             break
    # print(cnt)


if __name__=='__main__':
    main()


Measured memory_bytes: 132380
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int i,n,hei=0;cin>>n;
	vector<int>num(n);
	for(i=0;i<n;i++){cin>>num[i];hei+=num[i];}
	pair<int,int>ans(mod,0);
	for(i=0;i<n;i++){mineq(ans,mp(abs(hei-num[i]*n),i));}
	cout<<ans.sec<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<cstring>
#include<functional>

using namespace std;

int main()
{
	int n;

	scanf("%d", &n);

	int sol = 0;

	for (int i = 0; i < n; i++)
	{
		int input;

		scanf("%d", &input);

		sol += !(i % 2)*(input % 2);
	}

	printf("%d\n", sol);

	return 0;
}

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

#define FACE_LIMIT 6
#define FACE_NUMBER_LIMIT 100

typedef struct {
	int number[FACE_LIMIT];
} DICE_NUMBER_MAPPER;

typedef struct {
	DICE_NUMBER_MAPPER mapper[FACE_LIMIT];
} DICE;

typedef struct {
	int forward;
	int top;

	int answer;
} QNA;

int InputDice(DICE* dice);
void NumbersToMapper(int* numbers, DICE_NUMBER_MAPPER* mapper);
int Compare(DICE cmpA, DICE cmpB);

int main(void) {
	int size;
	int idx;
	int idy;
	int res;
	DICE* dices;

	do {
		scanf("%d", &size);
	} while(size < 2 || size > 100);

	dices = (DICE*)malloc(sizeof(DICE) * size);
	for (idx = 0; idx < size; idx++) {
		while(InputDice( (dices + idx) ));
	}

	res = 1;
	for (idx = 0; idx < size - 1; idx++) {
		int same = 0;

		for (idy = idx + 1; idy < size; idy++) {
			DICE cmpA = *(dices + idx);
			DICE cmpB = *(dices + idy);
			int compRes = Compare(cmpA, cmpB);
			if (compRes == 1) {
				same = 1;
				break;
			}
		}

		if (same) {
			res = 0;
			break;
		}
	}

	printf("%s\n", res == 1 ? "Yes" : "No");

	free(dices);
}

int InputDice(DICE* dice) {
	int size;
	int nums[FACE_LIMIT];

	for (size = 0; size < FACE_LIMIT; size++) {
		scanf("%d", &nums[size]);
		if (nums[size] < 0 || nums[size] > 100) {
			return -1;
		}
	}

	NumbersToMapper(nums, dice->mapper);

	return 0;
}

void NumbersToMapper(int* numbers, DICE_NUMBER_MAPPER* mapper) {
	int id1;
	int id2;

	int set[][FACE_LIMIT] = {
			{ 0, 1, 2, 4, 3, 5 }
			,{ 1, 0, 3, 5, 2, 4 }
			,{ 2, 0, 1, 5, 4, 3 }
			,{ 3, 1, 0, 4, 5, 2 }
			,{ 4, 0, 2, 5, 3, 1 }
			,{ 5, 1, 3, 4, 2, 0 }
	};

	for (id1 = 0; id1 < FACE_LIMIT; id1++) {
		for (id2 = 0; id2 < FACE_LIMIT; id2++) {
			DICE_NUMBER_MAPPER* map = mapper + id1;
			map->number[id2] = *(numbers + set[id1][id2]);
		}
	}
}

int Compare(DICE cmpA, DICE cmpB) {
	int idx;
	int idi;

	for (idx = 0; idx < FACE_LIMIT; idx++) {
		int lineSame = 0;
		int pivot;

		DICE_NUMBER_MAPPER aMap = cmpA.mapper[idx];
		int finderTop = aMap.number[0];
		int finderBottom = aMap.number[FACE_LIMIT - 1];

		DICE_NUMBER_MAPPER bMap;
		int find = 0;
		for (idi = 0; idi < FACE_LIMIT; idi++) {
			DICE_NUMBER_MAPPER tmp = cmpB.mapper[idi];
			if (tmp.number[0] == finderTop &&
				tmp.number[FACE_LIMIT - 1] == finderBottom) {
				bMap = tmp;
				find = 1;
				break;
			}
		}
		if (!find) {
			return 0;
		}

		for (pivot = 0; pivot < FACE_LIMIT - 2; pivot++) {
			int notSame = 0;

			for (idi = 1; idi < FACE_LIMIT - 1; idi++) {
				int tmpIdx = idi + pivot;
				if (tmpIdx >= FACE_LIMIT - 1) {
					tmpIdx -= FACE_LIMIT - 2;
				}
				if (aMap.number[idi] != bMap.number[tmpIdx]) {
					notSame = 1;
					break;
				}
			}

			if (!notSame) {
				lineSame = 1;
				break;
			}
		}

		if (!lineSame) {
			return 0;
		}
	}

	return 1;
}


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

int main(){
int N;
  cin>>N;
  
  int fx=0, t=N;
   for(int i=0; i<8; i++){
    fx+=t%10;
    t/=10;
   }
  if(N%fx==0){cout<<"Yes";}
  else{cout<<"No";}
}

Measured memory_bytes: 256
#include <iostream>                                                                                                                                                                                         
#include <cstdio>

using namespace std;

int main(){
    int N,M;
    cin >> N >> M;
    int a,b;
    int arr[51] = {}; 
    for(int i=0;i<M;i++){
        cin >> a >> b;
        arr[a] += 1;
        arr[b] += 1;
    }   

    for(int i=1;i<N+1;i++){
        cout << arr[i] << endl;
    }   

    return 0;
}

Measured memory_bytes: 256
N,Y = map(int,input().split())

change = False

for i in range(N+1):
    for j in range(N+1-i):
        if i*10000+j*5000+(N-i-j)*1000==Y:
            print(i,j,N-i-j)
            change = True
            exit()
if change != True:
    print("-1 -1 -1")

Measured memory_bytes: 40940
#include <stdio.h>

typedef struct List {
	struct List *next;
	int v;
} list;

int main()
{
	int i, N, u, w, deg[200001] = {};
	list *adj[200001] = {}, e[400001];
	scanf("%d", &N);
	for (i = 0; i < N - 1; i++) {
		scanf("%d %d", &u, &w);
		e[i*2].v = w;
		e[i*2+1].v = u;
		e[i*2].next = adj[u];
		e[i*2+1].next = adj[w];
		adj[u] = &(e[i*2]);
		adj[w] = &(e[i*2+1]);
		deg[u]++;
		deg[w]++;
	}
	
	int par[200001] = {}, q[200001], head, tail;
	list *p;
	par[1] = 1;
	q[0] = 1;
	for (head = 0, tail = 1; head < tail; head++) {
		u = q[head];
		for (p = adj[u]; p != NULL; p = p->next) {
			if (par[p->v] == 0) {
				par[p->v] = u;
				q[tail++] = p->v;
			}
		}
	}
	for (head--; head >= 0; head--) {
		u = q[head];
		if (par[u] == -1) continue;
		else if (deg[par[u]] >= 3) break;
		else if (par[u] == 1 && deg[par[u]] >= 2) break;
		else if (u == 1) break;
		deg[par[par[u]]]--;
		par[par[u]] = -1;
	}
	if (head >= 0) printf("First\n");
	else printf("Second\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 8300
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }


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

    ll n,t;cin>>n>>t;
    ll dp[100000]={};
    vector<pair<ll,ll>> v;
    rep(i,n){
        ll a,b;cin>>a>>b;
        v.push_back(make_pair(a,b));
    }
    // 時間がかからないやつから考えるのが最適
    sort(ALL(v));
    ll ans=0;
    rep(i,n){
        ll time=v[i].first,deli=v[i].second;
        for(int j=t;j>=0;j--){
            if(j==0||dp[j]>0){
                if(time+j>t&&j!=t) chmax(ans,dp[j]+deli);
                else chmax(dp[time+j],dp[j]+deli);
            }
        }
    }
    rep(i,t+1) chmax(ans,dp[i]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <set>

using namespace std;

int main(void)
{

	int m;
	string s;
	string str1,str2;

	set<string> lines;


	int i1,i2;

	cin >> m;

	for(i1=0;i1<m;i1++){
		cin >> s;
		lines.clear();


		for(i2=1;i2<s.length();i2++){

			str1 = s.substr(0,i2);
			str2 = s.substr(i2);

			lines.insert(str1+str2);
			lines.insert(str2+str1);

			reverse(str1.begin(),str1.end());

			lines.insert(str1+str2);
			lines.insert(str2+str1);

			reverse(str1.begin(),str1.end());
			reverse(str2.begin(),str2.end());

			lines.insert(str1+str2);
			lines.insert(str2+str1);

			reverse(str1.begin(),str1.end());

			lines.insert(str1+str2);
			lines.insert(str2+str1);

		}

		cout << (unsigned int)lines.size() << endl;
	}

	return 0;
}

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

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int main() {
	LL n, m;
	cin >> n >> m;
	if (n * m == 1)
		cout << 1 << endl;
	else if (min(n, m) == 1)
		cout << max(n, m) - 2 << endl;
	else
		cout << (n - 2) * (m - 2) << endl;
	return 0;
}


Measured memory_bytes: 256
import math

n = int(input())
ab = []
for i in range(n):
  ab.append(tuple(map(int,input().split())))
MOD = 1000000007

d = {}
zero = 0
for a,b in ab:
  if a == 0 and b == 0:
    zero += 1
    continue
  g = math.gcd(a,b)
  a //= g
  b //= g
  if b < 0:
    a,b = -a,-b
  elif a < 0 and b == 0:
    a = -a
  rot90 = False
  if a <= 0:
    a,b = b,-a
    rot90 = True
  if (a,b) in d:
    if rot90:
      d[(a,b)][1] += 1
    else:
      d[(a,b)][0] += 1
  else:
    if rot90:
      d[(a,b)] = [0,1]
    else:
      d[(a,b)] = [1,0]
#print(d)

ans = 1
for k,v in d.items():
  tmpans = pow(2,v[0],MOD)+pow(2,v[1],MOD)-1
  tmpans %= MOD
  ans *= tmpans
  ans %= MOD
ans -= 1
ans += zero
print(ans%MOD)

Measured memory_bytes: 139308
#include <stdio.h>
 
 int main(void){
 
    int a,b,c,tem;
    
    scanf("%d %d %d",&a,&b,&c);
 
         if(b < a){
        tem = a;
        a = b;
        b = tem;
 
   }    if(c < b){
        tem = b;
        b = c;
        c = tem;
 
   }    if(b < a){
        tem = a;
        a = b;
        b = tem;
   }

   printf("%d %d %d\n",a,b,c);
    return 0;
}
   

Measured memory_bytes: 596
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define REP(i,n) FOR(i,0,n)
using namespace std;

typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b){ return (conj(a) * b).imag(); }

int main(){
    int n,x,y;
    xy_t p[100];
    double area = 0.0;
    cin >> n;
    REP(i,n){
        cin >> x >> y;
        p[i] = xy_t(x,y);
    }
    REP(i,n-1){
        area += cross_product(p[i], p[i+1]) / 2.0;
    }
    area += cross_product(p[n-1], p[0]) / 2.0;
    cout << fixed << setprecision(1) << area << endl;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

class Solution
{
public:
    int count_num(string s)
    {
        int ans = 0;
        rep(i, 3)
        {
            if (s[i] == '1')
            {
                ans++;
            }
        }
        return ans;
    }
};

int main()
{
    string str;
    cin >> str;
    Solution s;
    cout << s.count_num(str) << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
 
int n, m;
 
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
 
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
 
int main() {
    int x, y, ans = 0;
    cin >> n >> m;
    UnionFind uf(n);
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        x--;
        y--;
        uf.merge(x, y);
    }
    for (int i = 0; i < n; i++) {
        ans = max(ans, uf.size(i));
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if((a==7 && b ==5 && c==5) || (a==5 && b== 7 && c==5) || (a==5 && b==5 && c== 7))
		printf("YES\n");

	else
		printf("NO\n");
    return 0;
	
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n, k;
    cin >> n >> k;
    if (k == 1)
        cout << 0 << endl;
    else {
        cout << n - k << endl;
    }
    return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int main() {
	string s;
	cin >> s;
	int n = s.size();

	string t;
	vi id;

	rep(i, n) {
		if (s[i] != 'x') {
			t.pb(s[i]);
			id.pb(i);
		}
	}

	string rt = t;
	reverse(ALL(rt));

	if (t != rt) {
		puts("-1");
		return 0;
	}

	vi vx;

	int la = -1;
	n = t.size();

	rep(i, n) {
		vx.pb(id[i] - la - 1);
		la = id[i];
	}

	if (n > 0) vx.pb((int)s.size() - 1 - id[n-1]);
	

	vi rvx = vx;
	reverse(ALL(rvx));

	int ret = 0;
	rep(i, (n+1)/2) ret += max(vx[i],rvx[i])-min(vx[i],rvx[i]);

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 1976
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();
		
		int x = x2 - x1;
		int y = y2 - y1;
		
		System.out.println(x2 - y);
		System.out.println(y2 + x);
		System.out.println(x1 - y);
		System.out.println(y1 + x);
		
	}

}


Measured memory_bytes: 23508
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int f;
	cin >> f;
	cout << ((f-30)/2) << endl;
	return 0;
}



Measured memory_bytes: 3100
N = int(input())
ans = [0, 0, 0, 0]
for i in range(N):
  a = input()
  if a == "AC":
    ans[0] += 1
  elif a == "WA":
    ans[1] += 1
  elif a == "TLE":
    ans[2] += 1
  else:
    ans[3] += 1
print("AC x " + str(ans[0]))
print("WA x " + str(ans[1]))
print("TLE x " + str(ans[2]))
print("RE x " + str(ans[3]))

Measured memory_bytes: 69964
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=(3e5)+10;
int n,w,h,ans,mx[maxn*4],lazy[maxn*4];
int a[maxn],b[maxn],t1,t2;
struct node { int x,y; } d[maxn];
bool cmp(node a,node b) {
	return a.x<b.x;
}
void pushdown(int root) {
	if (lazy[root]==0) return;
	mx[root*2]+=lazy[root];
	mx[root*2+1]+=lazy[root];
	lazy[root*2]+=lazy[root];
	lazy[root*2+1]+=lazy[root];
	lazy[root]=0;
}
void add(int L,int R,int l,int r,int root,int delta) {
	if (L<=l&&r<=R) {
		mx[root]+=delta; lazy[root]+=delta; return;
	} pushdown(root);
	int mid=(l+r)/2;
	if (L<=mid) add(L,R,l,mid,root*2,delta);
	if (mid<R) add(L,R,mid+1,r,root*2+1,delta);
	mx[root]=max(mx[root*2],mx[root*2+1]);
}
void solve() {
	sort(d+1,d+n+1,cmp);
	memset(mx,0,sizeof(mx));
	memset(lazy,0,sizeof(lazy));
	t1=t2=a[1]=b[1]=1; add(1,n,1,n,1,h);
	for (int i=2;i<=n;i++) {
		add(1,i-1,1,n,1,d[i].x-d[i-1].x);
		ans=max(ans,mx[1]);
		if (d[i].y>=h/2) {
			add(a[t1],i-1,1,n,1,d[i].y-h);
			while (t1>1&&d[a[t1]].y>=d[i].y)
				add(a[t1-1],a[t1]-1,1,n,1,d[i].y-d[a[t1]].y),t1--;
			a[++t1]=i;
		} else {
			add(b[t2],i-1,1,n,1,-d[i].y);
			while (t2>1&&d[b[t2]].y<=d[i].y)
				add(b[t2-1],b[t2]-1,1,n,1,d[b[t2]].y-d[i].y),t2--;
			b[++t2]=i;
		}
	}
}
int main() {
	read(w); read(h); read(n);
	for (int i=1;i<=n;i++) read(d[i].x),read(d[i].y);
	d[++n]=(node){0,0}; d[++n]=(node){w,h};
	solve(); swap(w,h); for (int i=1;i<=n;i++) swap(d[i].x,d[i].y);
	solve(); printf("%d\n",ans*2);
	return 0;
}

Measured memory_bytes: 14336
N = int(input())
arr = list(map(int,input().split()))
arr = sorted(arr,reverse=True)
ans = 1
idx = 0
if arr[-1]==0:
  ans = 0
for a in arr:
  ans *= a
  if ans > 10**18:
    print('-1')
    exit()
print(ans)
  

Measured memory_bytes: 21660
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int n;
int main() {
	cin >> n;
	int res = (int)(sqrt(n) + 1.0e-7);
	cout << res * res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n;
int ans;

signed main() {
	cin >> n;
	int x = n;
	for (int i = 2; i <= sqrt(n); i++) {
		int cnt = 0;
		while (x%i == 0) {
			cnt++;
			x /= i;
		}
		for (int j = 1;; j++) {
			if (cnt < j)break;
			ans++;
			cnt -= j;
		}
	}
	if (1 < x)ans++;
	cout << ans << endl;
}

Measured memory_bytes: 3648
/* **********************************JAI SAI RAM ************************************* */
//HELP IN CODEFORCES ROUND 641
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll P=1000000007;
ll MAX=1e15;
ll MIN=-1*(1e15);
ll a[3020],f[3020];
void  solve()
{
    ll n,i,j,k,l,m,o,q,r,t;
    cin>>n>>m>>t;
    string s[6];
    for(i=0;i<n;i++)
    {
        cin>>s[i];
    }
    set<vector<ll>> vr,vc;
    k=1<<n;
    for(i=0;i<k;i++)
    {
        j=i;
        l=0;
        vector<ll> v;
        while(j!=0)
        {
            if(j&1)
            {
              v.push_back(l);
            }
            l++;
            j>>=1;
        }
        vr.insert(v);
    }
    k=1<<m;
    for(i=0;i<k;i++)
    {
        j=i;
        l=0;
        vector<ll> v;
        while(j!=0)
        {
            if(j&1)
            {
              v.push_back(l);
            }
            l++;
            j>>=1;
        }
        vc.insert(v);
    }
    ll ans=0;
    for(auto it:vr)
    {
        for(auto it1:vc)
        {
            string s1[6];
            s1[0]=s[0];s1[1]=s[1];s1[2]=s[2];s1[3]=s[3];s1[4]=s[4];s1[5]=s[5];
            for(auto u:it)
            {
                for(j=0;j<m;j++)
                s1[u][j]='R';
            }
            for(auto v:it1)
            {
                for(j=0;j<n;j++)
                s1[j][v]='R';
            }
            ll c=0;
            for(i=0;i<n;i++)
            {
                for(j=0;j<m;j++)
                {
                    if(s1[i][j]=='#')
                    c++;
                }
            }
            if(c==t)
            ans++;
        }
    }
    cout<<ans<<endl;
}
int main()
{
    ll t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


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

using namespace std;


typedef long long ll;
#define loop(i, init, val) for(i = init; i < val; i++)
#define srt(v) sort(v.begin(), v.end())

int main(){
	int i, j, k;
	int n, m;
	cin >> n >> m;
	if(n == m) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
using namespace std;

long long n,a[100010];
long long c1=0,c2=0,sum=0,c=1;

int main() {
    cin >> n;
    rep(i, 0, n) {
        cin >> a[i];
    }
    // 奇数番目を正
    rep(i, 0, n) {
        sum += a[i];
        if (sum * c <= 0) {
            c1 += (abs(sum) + 1);
            sum = c;
        }
        c *= -1;
    }
    // 偶数番目が正
    c = -1;
    sum = 0;
    rep(i, 0, n) {
        sum += a[i];
        if (sum * c <= 0) {
            c2 += abs(sum) + 1;
            sum = c;
        }
        c *= (-1);
    }
    cout << min(c1, c2) << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a),i##Len_=(b);i<i##Len_;i++)
const char* LF = "\n";
namespace{struct _{_(){
    cin.tie(0);
    ios::sync_with_stdio(false);
}}a;}

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

    vector<int> T(N);
    vector<int> X(N);
    vector<int> Y(N);
    REP(i, N) {
        cin >> T[i] >> X[i] >> Y[i];
    }

    bool ans = true;
    int t = 0;
    int x = 0, y = 0;

    REP(i, N) {
        int d = abs(x - X[i]) + abs(y - Y[i]);
        if (d > T[i] - t) ans = false;
        if (((T[i] - t) - d) % 2 == 1) ans = false;
        if (!ans) break;

        t = T[i];
        x = X[i];
        y = Y[i];
    }

    cout << (ans ? "Yes" : "No") << LF;

    return 0;
}


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

bool ok[7368792];
int main() {
	int m, n;
	while (scanf("%d%d", &m, &n), m) {
		memset(ok, 0, sizeof(ok));
		int cnt = 0;
		for (int i = m;; i++) {
			if (!ok[i]) {
				if (++cnt > n) {
					printf("%d\n", i); break;
				}
				for (int j = i; j <= 7368791; j += i)ok[j] = true;
			}
		}
	}
}

Measured memory_bytes: 10356
#include <bits/stdc++.h>
    #define MXX 2000000000
    using namespace std;
     
    int arr[100005];
    int dp[100005];

    int solve(int n){
    	dp[n] = 0; dp[n+1] = MXX;
      	for(int i = (n-1); i>=1; --i){
        	dp[i] = min(dp[i+1]+(abs(arr[i]-arr[i+1])),dp[i+2]+(abs(arr[i]-arr[i+2])));
        }
      	return dp[1];
    }
     
    int main(){
    	int n;
      	scanf("%d",&n);
      	for(int i = 1; i<=n; ++i){
        	scanf("%d",&arr[i]);
        }
        printf("%d\n",solve(n));
      	return 0;
    }

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define INF 100000000000000000ll
#define MAX 10000
typedef long long ll;
using namespace std;

int main()
{
	ll N, W;
	cin >> N >> W;
	vector<vector<ll>> dp(N + 1, vector<ll>(MAX + 1, INF));
	dp[0][0] = 0;
	for (int i = 1, v, w; i <= N; i++) {
		cin >> v >> w;
		for (int j = MAX; j >= 0; j--) {
			if (j < MAX)
				dp[i][j] = min(dp[i][j], dp[i][j + 1]);
			if (j >= v) {
				dp[i][j] = min(dp[i][j], min(dp[i - 1][j], dp[i - 1][j - v] + w));
			}
			else {
				dp[i][j] = min(dp[i][j], dp[i - 1][j]);
			}
		}
	}
	cout << (upper_bound(dp[N].begin(), dp[N].end(), W) - dp[N].begin() - 1) << endl;
	return 0;
}

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

using namespace std;

#define foru(i, l, r) for (register int i = l; i <= r; i++)
#define ford(i, r, l) for (register int i = r; i >= l; i--)

long long a[3];
int main() {
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a + 3);
  cout << ((a[0] & 1 & a[1] & 1 & a[2] & 1) ? a[0] * a[1] : 0) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdlib.h>
#include <stdio.h>

using namespace std;

int main() {
    int n, r;
    cin >> n >> r;
    if (n >= 10) {
        cout << r << endl;
    }
    else {
        cout << r + 100 * (10 - n) << endl;
    }
}



Measured memory_bytes: 256
import heapq

N, M = map(int, input().split())
w = [list(map(int, input().split())) for _ in range(N)]
ans = 0

daylist = [[] for _ in range(10**5)]
for a, b in w:
    daylist[a-1].append(b)

q = []
for i in range(M):
    for b in daylist[i]:
        heapq.heappush(q, -b)
    if q:
        ans += -heapq.heappop(q)
print(ans)

Measured memory_bytes: 39672
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ul N, M;
  cin >> N >> M;
  vector<pair<ul, ul>> AB(N, {0, 0});
  REP(ii, N) { cin >> AB[ii].first >> AB[ii].second; }
  sort(AB.begin(), AB.end());
  ul sum_bottle = 0;
  ul sum_money = 0;
  ul ii = 0;
  while (sum_bottle < M) {
    sum_money += AB[ii].first * AB[ii].second;
    sum_bottle += AB[ii].second;
    ++ii;
  }
  --ii;
  while (sum_bottle > M) {
    sum_money -= AB[ii].first;
    --sum_bottle;
  }
  cout << sum_money << endl;
}


Measured memory_bytes: 1792
use std::collections::HashMap;
fn main() {
    let v = read_vec::<usize>();
    let _= v[0];
    let k = v[1];
    let aa = read_vec::<usize>();
    let mut hm = HashMap::new();
    for a in aa {
        let c = hm.entry(a).or_insert(0);
        *c += 1;
    }
    let count = hm.keys().len();
    if count > k {
        let mut v = hm.values().clone().map(|&i| i).collect::<Vec<usize>>();
        v.sort();
        let mut ans = 0;
        for i in 0..count-k {
            ans += v[i];
        }
        println!("{}", ans);
    } else {
        println!("0");
    }
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 17872
<?php
fscanf(STDIN,"%d %d",$n,$l);
for($i=0; $i<$n; $i++)
{
    $s[$i] = rtrim(fgets(STDIN));
}
sort($s);

$result = "";
for($i=0; $i<$n; $i++)
{
    $result .= $s[$i];
}

echo($result);

Measured memory_bytes: 3828
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

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

#define int long long
	int H,W;
	cin >> H >> W;
	int ans = INT_MAX;
	//横2本
	if(H%3 == 0) ans = min(ans, (LL)0);
	else ans = min(ans, W);
	//縦2本
	if(W%3 == 0) ans = min(ans, (LL)0);
	else ans = min(ans, H);
	//l- T
	for(int i=1; i<W; i++){
		int j = H/2;
		int a[3] = {i*H,(W-i)*j,(W-i)*(H-j)};
		sort(a,a+3);
		ans = min(ans, a[2]-a[0]);
	}
	swap(W,H);
	for(int i=1; i<W; i++){
		int j = H/2;
		int a[3] = {i*H,(W-i)*j,(W-i)*(H-j)};
		sort(a,a+3);
		ans = min(ans, a[2]-a[0]);
	}
	cout << ans << endl;

	return 0;
}


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

char makeSandW(char A,char B,int N);
char check(char back,char foward,char middle);


char t[100010],s[100010];

int main(void){
  int N,i;
  char ans[100010];
  scanf("%d",&N);
  scanf("%s",s);
  if(makeSandW('S','S',N)=='S' && check(t[N-1],t[1],t[0])==s[0]){
    t[N]='\0';
    printf("%s\n",t);
  }else if(makeSandW('S','W',N)=='S' && check(t[N-1],t[1],t[0])==s[0]){
    t[N]='\0';
    printf("%s\n",t);
  }else if(makeSandW('W','S',N)=='W' && check(t[N-1],t[1],t[0])==s[0]){
    t[N]='\0';
    printf("%s\n",t);
  }else if(makeSandW('W','W',N)=='W' && check(t[N-1],t[1],t[0])==s[0]){
    t[N]='\0';
    printf("%s\n",t);
  }else{
    puts("-1");
  }
  return 0;
}

char makeSandW(char A,char B,int N){
  int i;
  t[0]=A;
  t[1]=B;
  for(i=1;i<N;i++){
    if(s[i]=='o' && t[i]=='S'){
      if(t[i-1]=='S'){
        t[i+1]='S';
      }else{
        t[i+1]='W';
      }
    }else if(s[i]=='x' && t[i]=='S'){
      if(t[i-1]=='S'){
        t[i+1]='W';
      }else{
        t[i+1]='S';
      }
    }else if(s[i]=='o' && t[i]=='W'){
      if(t[i-1]=='S'){
        t[i+1]='W';
      }else{
        t[i+1]='S';
      }
    }else if(s[i]=='x' && t[i]=='W'){
      if(t[i-1]=='S'){
        t[i+1]='S';
      }else{
        t[i+1]='W';
      }
    }
  }
  return t[N];
}

char check(char back,char foward,char middle){
  if(middle == 'S'){
    if(back == foward){
      return 'o';
    }else{
      return 'x';
    }
  }else{
    if(back == foward){
      return 'x';
    }else{
      return 'o';
    }
  }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define LIMIT 1000000007 //10^9+7
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

int main(){
	vi z(5);
  rep(i,5)cin>>z[i];

  sort(all(z), [](int a, int b){
    return a%10 < b%10;
  });

  //DEBUG(z);

  int ans = 0;
  bool once = true;
  for(int x: z){
    if(x%10==0)ans+=x;
    else{
      if(once){
        ans += x;
        once = false;
      }else{
        ans += ((x/10)+1)*10;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define f1(n) for(int i=0;i<n;++i)
#define f2(n) for(int i=1;i<=n;++i)
#define lson(x) x<<1
#define rson(x) x<<1|1
#define mp make_pair
using namespace std;
typedef long long ll;
typedef long double llf;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
const int maxn = 2e5 + 5;
const int mod = 0x3f3f3f3f;
const ll Mod = 998244353;
const int inf = 0x3f3f3f3f;
const ll Inf = (ll)1e15;
bool check(string a) {
	int l = a.size();
	for (int i = 0; i < (l + 1) / 2; ++i)
		if (a[i] != a[l - i - 1])return 0;
	return 1;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	string s;
	cin >> s;
	int l = s.size();
	string a, b;
	for (int i = 0; i < (l - 1) / 2; ++i)a += s[i];
	for (int i = (l + 3) / 2 - 1; i < l; ++i)b += s[i];
	//cout << a << ' ' << b << endl;
	//cout << check("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") << endl;
	if (check(a) && check(b)&&l%2==1&&check(s))cout << "Yes\n";
	else cout << "No\n";


	return 0;
}

Measured memory_bytes: 256
#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;

ll solve(ll ai , ll aj , ll bi , ll bj) {
	if(aj > bj){
		swap(ai,bi);
		swap(aj,bj);
	}
	ll s= 1;
	for(int i = 0 ; i < 30 ; i++)
			s *= 3;
	ll dist = abs(ai - bi) + abs(aj - bj);
	ll res = dist;
	while(1){
		s /= 3;
		if(s <= 0)
			break;
		ll nai = ai / s, nbi = bi/s;
		if(nai != nbi)
			break;
		ll naj = aj/s,nbj = bj/s;
		if(nai%3 == 1 && abs(naj-nbj) > 1){
			ll up = s*nai - 1;
			ll bot = s*(nai+1);
			ll loss = min(ai,bi)-up;
			loss = min(loss,bot-max(ai,bi)); 
			res = dist + loss*2;
			break;
		}
	}
	return res;
}
			

void test_case(){
	int q; cin >> q;
	for(int qi = 0 ; qi < q ; qi++){
		ll ai , aj , bi , bj;
		cin >> ai >> aj >> bi >> bj;
		ai--; aj--; bi--;bj--;
		ll ans = 0;
		ans = max(ans , solve(ai,aj,bi,bj));
		ans = max(ans , solve(aj,ai,bj,bi));
		cout<<ans<<"\n";
	}
}
 
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: 3616
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int MOD = 1e9+7;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n; cin >> n;
  vi a(n),b(n),c(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  rep(i,n) cin >> c[i];
  sort(all(a));
  sort(all(b));
  sort(all(c));
  ll ans = 0;
  rep(i,n){
    auto top = lower_bound(all(a),b[i]);
    auto bottom = upper_bound(all(c),b[i]);
    ans += (top-a.begin())*(c.end()-bottom);
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 4496
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N, K; cin >> N >> K;
  vector<int> xs(N); for (auto &x : xs) cin >> x;
  int ans = 1e9;
  for (int j = N - 1; j >= 0 and xs[j] >= 0; --j)
    {auto i = j - K + 1;
    if (i >= 0) ans = min(ans, (xs[i] < 0) * 2 * abs(xs[i]) + xs[j]);}
  for (int j = 0; j < N and xs[j] <= 0; ++j)
    {auto i = j + K - 1;
    if (i < N) ans = min(ans, (xs[i] > 0) * 2 * xs[i] + abs(xs[j]));}
  cout << ans << endl;}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
#define EPS 0.00001

double calcS(double bottom, double l){
  return ((double)bottom * sqrt(pow(l, 2) - pow((double)bottom/2, 2))) / 2;
}

int main(void){
  int a, l, x;
  while(cin >> a >> l >> x){
    double dflt = calcS(a, l);
    double added = calcS(l, ((double)l+x)/2);
    printf("%.7f\n", dflt + added * 2 );
  }
  return 0;
}

Measured memory_bytes: 1196
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    int N;
    cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];
    int two=0,four=0;
    rep(i,N){
        if(A[i]%4==0) four++;
        else if(A[i]%2==0) two++;
    }
    int rem=N;
    rem-=max(0,two-1);
    rem/=2;
    if(rem>four) cout << "No" << endl;
    else cout << "Yes" << endl;
} 

Measured memory_bytes: 640
import java.util.*;
public class Main{
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        int N = S.length(); 
        String[] SS = new String[N];
        String A = "Yes";
        for(int i = 0; i < N; i++) {
            String str = String.valueOf(S.charAt(i));
        SS[i] = str;
        }

        if(N%2 == 1){
        for(int i = 0; i < N-2; i = i+2){
            if(SS[i].equals("L")) A = "No";
            if(SS[i+1].equals("R")) A = "No";
        }
        if(SS[N-1].equals("L")) A = "No";
    }else{
        for(int i = 0; i < N; i = i+2){
            if(SS[i].equals("L")) A = "No";
            if(SS[i+1].equals("R")) A = "No";
        }
    }
        System.out.println(A);
    }
}

Measured memory_bytes: 23764
a,b=map(int,input().split())
suma = 0
diga = 0
sumb = 0
digb = 0
for i in range(a):
    sumb += b * 10 **digb
    digb += 1
for j in range(b):
    suma += a * 10 **diga
    diga +=1
if int(suma) > int(sumb):
    print(suma)
else:
    print(sumb)

Measured memory_bytes: 3064
MOD = 10**9+7
N, K = map(int, input().split())
# tmp_mod = pow(10, 100, MOD)

ans = 0
for i in range(K, N+2): # K個以上、N+1以下選ぶ
    minSum = (i-1)*i//2
    maxSum = (2*N+1-i)*i//2
    cnt = maxSum - minSum + 1
    # ans += (minSum + maxSum) * cnt // 2
    # ans += (tmp_mod * cnt * i) % MOD
    ans += cnt
    ans %= MOD

print(ans)

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

int main() {
  double a, b;
  cin >> a >> b;

  int cand = (int)floor(a / 8 * 100);
  double last = b * 10 + 9;

  if (floor(cand * 0.08) == a && floor(cand * 0.1) == b) {
    cout << cand << endl;
    return 0;
  }

  while (cand < last) {
    cand++;

    if (floor(cand * 0.08) == a && floor(cand * 0.1) == b) {
      cout << cand << endl;
      return 0;
    }
  }

  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 3836
quantity, num = list(map(int, input().split()))
weights = list(map(int, [input() for _ in range(quantity)]))

def truck_num(max_load, weights):
  num = 1
  tmp = 0
  for w in weights:
    if tmp + w <= max_load:
      tmp += w
    else:
      tmp = w
      num += 1
  return num


left = max(weights)
right = 100000 * 10000

while left != right:
  mid = (left + right) // 2
  x = truck_num(mid, weights)
  if x <= num:
    right = mid
  else:
    left = mid + 1

ans = left
print(ans)


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

int main()
{
    int n;
    cin >> n;
    vector<pair<int, int>> vec;
    for (int i = 0; i < n; i++)
    {
        int s1;
        int s2;
        cin >> s1 >> s2;
        vec.push_back({s1, s2});
    }

    int count = 0;
    for (pair<int, int> p : vec)
    {
        count += p.second - p.first + 1;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	/**
	 * Sum of Three Integers
	 * @param 2 ≦ K ≦ 2500
	 * @param 0 ≦ S ≦ 3K
	 * @param 0 ≦ X,Y,Z ≦ K
	 * @result X + Y + Z = S
	 */
	public static void main(String... args) {
		try (Scanner sc = new Scanner(System.in)) {
			int k = sc.nextInt();
			int s = sc.nextInt();
			int count = 0;
			for (int i = 0; i <= k; i++) {
				for (int j = 0; j <= k; j++) {
					if (0 <= s - i - j && s - i - j <= k) {
						count ++;
					}
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 21844