akhauriyash/Code-Regression huggingface dataset:
n, m = map(int, input().split())
pys = [[] for _ in range(n + 1)]

ans = [None for _ in range(m)]

for i in range(m):
    p, y = map(int, input().split())
    lst = [y, i]
    pys[p].append(lst)

for p in range(1, n + 1):
    t = sorted(pys[p], key=lambda x: x[0])
    for j, [y, i] in enumerate(t, 1):
        # ans[i] = f'{p:06}{j:06}'
        ans[i] = '{:06d}{:06d}'.format(p, j)
print('\n'.join(ans))

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

int main(void){
    int N;
    double H,T,t,A,m;
    cin>>N>>T>>A;
    int I;
    m=660;
    

    for(int i=1;i<=N;i++){
        double H;
        cin>>H;
        // cout << "T:"<<T<<", H"<<H<<", A:"<<A<<endl;
        t=abs(T-0.006*H-A);
        // cout << "t = " << t <<endl;
        if(t<m){
            I=i;
            m=t;

        }

    }
    cout<<I<<endl;

    return 0;


}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int c,d,e,f,g,h,i,j;
	float a,b;
	c=0;
	d=0;
	e=0;
	f=0;
	g=0;
	h=0;
	i=0;
	j=0;
	while(scanf("%f %f",&a,&b)!=EOF)	{
		if(1.1<=a && a<=2.0) {
			c+=1;
		}
		else if(a>=0.6) {
			d+=1;
		}
		else if(a>=0.2) {
			e+=1;
		}
		else if(a>=0.1) {
			f+=1;
		}
		if(1.1<=b && b<=2.0) {
			g+=1;
		}
		else if(b>=0.6) {
			h+=1;
		}
		else if(b>=0.2) {
			i+=1;
		}
		else if(b>=0.1) {
			j+=1;
		}
	}
	printf("%d %d\n",c,g);
	printf("%d %d\n",d,h);
	printf("%d %d\n",e,i);
	printf("%d %d\n",f,j);
	return 0;
}

Measured memory_bytes: 624
// this one happened to me too but good thing none of those people i ate with read my code, huh?  A GOOD THING INDEED FOR OL' RYAN
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<(n);i++)
#define per(i,a,n) for (int i=(n)-1;i>=(a);i--)
typedef long long ll;
const ll INF = 1e18;
#define r first
#define c second

int main() {
    ios_base::sync_with_stdio(false);
    int h, w, n;
    cin >> h >> w >> n;
    vector<bool> done(n);
    vector<pair<int, int>> pts(n);
    vector<ll> vals(n);
    map<int, vector<int>> inRow, inCol;
    map<int, ll> rows, cols;
    rep(i, 0, n) {
        cin >> pts[i].r >> pts[i].c >> vals[i];
        inRow[pts[i].r].push_back(i);
        inCol[pts[i].c].push_back(i);
    }
    
    rep(i, 0, n) {
        if (done[i]) continue;
        ll minR = INF, minC = INF;
        minR = 0;
        rows[pts[i].r] = 0;
        queue<int> checks;
        for (auto x : inRow[pts[i].r]) {
            assert(!done[x]);
            checks.push(x);
            done[x] = true;
        }
        
        while (!checks.empty()) {
            int cur = checks.front();
            checks.pop();
            bool re = rows.count(pts[cur].r);
            bool ce = cols.count(pts[cur].c);
            if (re && ce) {
                if (rows[pts[cur].r] + cols[pts[cur].c] != vals[cur]) {
                    cout << "No" << endl;
                    return 0;
                }
            } else if (re) {
                cols[pts[cur].c] = vals[cur] - rows[pts[cur].r];
                minC = min(minC, cols[pts[cur].c]);
                for (auto x : inCol[pts[cur].c]) {
                
                    if (!done[x]) {
                        checks.push(x);
                        done[x] = true;
                    }
                }
            } else if (ce) {
                rows[pts[cur].r] = vals[cur] - cols[pts[cur].c];
                minR = min(minR, rows[pts[cur].r]);
                for (auto x : inRow[pts[cur].r]) {
                    if (!done[x]) {
                        checks.push(x);
                        done[x] = true;
                    }
                }
            } else assert(false);
        }
        if (minR + minC < 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    
    
    //for (auto x : rows) minR = min(x.second, minR);
    //for (auto x : cols) minC = min(x.second, minC);
    
    cout << "Yes" << endl;
    return 0;
}


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

using namespace std;

#define fRead(x)        freopen(x,"r",stdin)
#define fWrite(x)       freopen (x,"w",stdout)

#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define PI              acos(-1.0)
#define mk              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(nullptr);
#ifdef VAMP
     #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template < typename Arg1 >
    void __f(const char* name, Arg1&& arg1){
        cout << name << " = " << arg1 << std::endl;
    }
    template < typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names+1, ',');
        cout.write(names, comma - names) << " = " << arg1 <<" | ";
        __f(comma+1, args...);
    }
#else
    #define debug(...)
#endif

const int N = 200005;
vector<int>g[N];
int n , m;
int vis[N],pr[N];

int dis[N];
int main()
{
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin >> n >> m;
    FOR(i,1,m){
        int a , b;
        cin >> a >> b;
        g[a].pb(b);
        g[b].pb(a);
    }
    queue<int>Q;
    Q.push(1);
    int cnt = 0;
    vis[1] = 1;
    while(!Q.empty()){
        int node = Q.front();
        Q.pop();
        cnt++;
        for(int i : g[node]){
            if(vis[i])continue;
            dis[i] = dis[node] + 1;
            pr[i] = node;
            vis[i] = 1;
            Q.push(i);
        }
    }

    if(cnt == n){
        cout << "Yes\n";
        for(int i = 2;i <= n;i++)cout << pr[i] << "\n";
    }else{
        cout << "No\n";
    }
    #ifdef VAMP
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
}
	

Measured memory_bytes: 13472
using namespace std;
#include <iostream>
#include <algorithm>
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#include <vector>


int main(){

    ll N;
    cin >> N;
    vector<ll> A(N+1),B(N);

    rep(i,N+1){cin >> A[i];}
    rep(i,N){cin >> B[i];}
    
    ll sum_for = 0;
    ll prev = A[0];
    for(ll i=0; i<N; i++){
        ll tmp = min(prev+A[i+1],B[i]);
        sum_for += tmp;
        if(prev >= tmp){
            prev = A[i+1];
        }else if(prev+A[i+1] == tmp){
            prev = 0;
        }else{
            prev = prev+A[i+1] - B[i];
        }
    }

    cout << sum_for << endl;

    /* 
    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());

    int sum_back = 0;
    prev = A[0];
    for(int i=0; i<N; i++){
        int tmp = min(prev+A[i+1],B[i]);
        sum_back += tmp;
        if(prev >= tmp){
            prev = A[i+1];
        }else if(prev+A[i+1] == tmp){
            prev = 0;
        }else{
            prev = prev+A[i+1] - B[i];
        }
    }
    
    cout << max(sum_for,sum_back) << endl;
    */

    

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>

const long N = 1e6;

int main() {
  long n;
  std::cin >> n;

  long cnt = 0;
  long j = 1;
  for (long i = n; i > 0; --i) {
    while (i * j < n)
      j++;
    cnt += j - 1;
  }

  std::cout << cnt << std::endl;
}


Measured memory_bytes: 3228
#include<iostream>
using std::cout;
using std::cin;
using std::endl;

int main()
{
  int k, a, b;
  cin >> k;
  cin >> a >> b;
  
  int tmp = (a / k) * k;
  while (tmp <= b)
  {
    if (a <= tmp && tmp <= b)
    {
      cout << "OK" << endl;
      return 0;
    }
    tmp += k;
  }
  
  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3624
package main

import "fmt"

func main() {
	var n, x int
	fmt.Scan(&n, &x)

	m := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&m[i])
	}

	fmt.Println((x-sum(m))/min(m) + len(m))
}

func min(a []int) (x int) {
	x = a[0]
	for _, i := range a {
		if i < x {
			x = i
		}
	}
	return
}

func sum(a []int) (x int) {
	for _, i := range a {
		x += i
	}
	return
}


Measured memory_bytes: 512
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

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

int main()
{
        //input->compute->output//
        int x1,y1,x2,y2;
        cin>>x1>>y1>>x2>>y2;

        int x=x2;
        int y=y2;
        int dx=x2-x1;
        int dy=y2-y1;

        for(int i=0;i<2;i++){
                swap(dx,dy);
                dx=-dx;
                x+=dx;
                y+=dy;
                cout<<x<<' '<<y<<' ';

        }
        cout<<endl;




        return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;			typedef vector<ll> vl;
typedef vector<vi> vvi; 		typedef vector<vl> vvl;
typedef pair<int, int> 	pii;	typedef pair<ll, ll> pll;
typedef vector<pii> vii; 		typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define in insert
#define mp(a, b) make_pair(a, b)
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define INF INT_MAX
#ifdef KARAN
	#include "../../trace.h"
#else
    #define trace(args...)
#endif

ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
	while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

void solve(){
	int x;
	cin>>x;
	cout<<(x/500)*1000 + ((x%500)/5)*5<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef KARAN
		freopen("inp.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    	freopen("err.txt", "w", stderr);
	#endif
	int t=1;
	// cin>>t;
	while(t--)
		solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, l, r) for(int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for(int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}

inline int read() {
    int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar() ) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar() ) x = (x<<1) + (x<<3) + (ch ^ '0');
    return x * fh;
}

void File() {
#ifdef zjp_shadow
	freopen ("F.in", "r", stdin);
	freopen ("F.out", "w", stdout);
#endif
}

const int Mod = 1e9 + 7, N = 1e6 + 1e3;

typedef long long ll;

ll fac[N], ifac[N], pow3[N];

ll fpm(ll x, int power) {
	ll res = 1;
	for (; power; power >>= 1, (x *= x) %= Mod)
		if (power & 1) (res *= x) %= Mod;
	return res;
}

ll C(int m, int n) {
	if (m > n || n < 0 || m < 0) return 0;
	//cout << fac[n] << ' ' << ifac[m] << ' ' << ifac[n - m] << endl;
	return fac[n] * ifac[m] % Mod * ifac[n - m] % Mod;
}

int n, m, k, tot;

void Init(int maxn) {
	fac[0] = pow3[0] = 1; 
	For (i, 1, maxn) fac[i] = fac[i - 1] * i % Mod, pow3[i] = pow3[i - 1] * 3 % Mod;
	ifac[maxn] = fpm(fac[maxn], Mod - 2);
	Fordown (i, maxn - 1, 0) ifac[i] = ifac[i + 1] * (i + 1) % Mod;
}

inline ll Calc(int m, int S) {
	ll res = 0;
	For (i, 0, min(m, S))
		if (S - i <= k) (res += C(i, S)) %= Mod;
	return res;
}

ll res[N];

int main () {
	File();
	cin >> n >> m >> k; tot = n + m + k;
	Init(tot + 5);


	ll ans = 0, now = 1;
	For (S, 0, m + k) {
		(ans += pow3[tot - (n + S)] * C(n - 1, (n - 1) + S) % Mod * now % Mod) %= Mod;
		now = (now << 1) % Mod;

		if (S >= m) (now += Mod - C(m, S)) %= Mod;
		if (S >= k) (now += Mod - C(k, S)) %= Mod;
	}

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


Measured memory_bytes: 24832
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
    int a,b;
    cin>>a>>b;
    cout<<(a-1)*(b-1);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>

#include <numeric>

#include <map>

#include <deque>

#include <cassert>

#include <memory>

using namespace std;

typedef unsigned long long LL;

int main() {

    float l;
    cin >> l;
    float ans = l*l*l/27.0;
    printf("%.8f", ans);


    

}

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

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

  int N, blue;
  cin >> N >> blue;
  int red = N - blue;

  COMinit();

  for(int i = 0; i < blue; i++){
    cout << (COM((red + 1), (red - i)) % 1000000007) * (COM((blue-1), i) % 1000000007) % 1000000007 <<endl;
  }
}

Measured memory_bytes: 12160
#include <iostream>

using namespace std;

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

  string converted;
  for (char& c : S) {
    int num = (int)c + N;
    if (num > 90)
      converted += (char)(num - 90 + 64);
    else
      converted += (char)num;
  }
  cout << converted << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    string str;
    cin >> str;
    while(str[0]!='0'){
        int a,b=0;
        for(a=0;a<str.size();a++){
            b+=str[a]-'0';
        }
        cout << b << endl;
        cin >> str;
    }
    return 0;
}


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

using namespace std;

typedef long long int ll;
#define pb push_back
#define ALL(a) (a).begin() , a.end()

int mod = 1e9 + 7;
int add(int a, int b){
	if(a + b >= mod)return a+ b - mod;
	return a + b;
}
int mul(int a, int b){
	return 1LL * a * b  % mod;
}
int const N = 200 * 1010;

/********************i**********************************/
void solve(){
	int n, k;
	cin >> n >> k;
	vector<int> vec(n);
	for(auto &a : vec)cin >> a;
	vector<int> dp(n+1, 1e9);
	dp[n-1] = 0;
	for(int x = n-2; x>=0; x--){
		for(int y = x+1; y<= k+x && y < n; y++)
			dp[x] = min(dp[x] , dp[y] + abs(vec[x] - vec[y]) );
	}
	cout << dp[0] << "\n";
}

/******************************************************/
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	int t;
	t = 1;
	// cin >> t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 1024
from collections import defaultdict

n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

ds = defaultdict(int)
dt = defaultdict(int)

for e in s:
    ds[e] += 1

for e in t:
    dt[e] += 1

ans = 0
for k, v in ds.items():
    money = v - dt[k]
    ans = max(ans, money)

print(ans)


Measured memory_bytes: 3316
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()
if x[-1] < y[0] and X < y[0] and Y > x[-1]:
    print('No War')
else:
    print('War')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int n;
int l=0;
string s;
string res;
int main()
{
	scanf("%d",&n);
	cin>>s;
	res=s;
	
	for (int i=0;i<s.size();i++)
	{
		if (s[i]==')')
			l--;
		if (s[i]=='(')
			l++;
		if (l<0)
			res='('+res,l++;
	}
	if (l<0)	
		res='('+res;
	if (l>0)
	{
		for (int i=0;i<l;i++)
			res=res+')';
	}
	cout<<res;
	return 0;	
}

Measured memory_bytes: 256
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

long long gcd(long long a, long long b) {
	long long r = -1;
	if (a < b) {
		swap(a, b);
	}
	while (r != 0) {
		r = a % b;
		if (r == 0) {
			return b;
		}
		else {
			a = b;
			b = r;
		}
	}
}

long long lcm(long long a, long long b) {
	return a * b / gcd(a, b);
}

int main() {
	char c;
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

vector<string> split(string in, char sp = ','){
	vector<string> ret;
	stringstream ss(in);
	string s;
	while(getline(ss, s, sp)){
		ret.emplace_back(s);
	}
	return ret;
}

int main(){
	vector<string> s;
	string in;
	while(cin >> in){
		s.emplace_back(in);
	}

	vector<vector<int>> v(s.size());
	rep(i,s.size()){
		vector<string> sp = split(s[i]);
		for(auto j : sp){
			v[i].emplace_back(stoi(j));
		}
	}

	vector<vector<int>> dp(all(v));
	rep(i,s.size() / 2){
		rep(j,v[i].size()){
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + v[i + 1][j]);
			dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + v[i + 1][j + 1]);
		}
	}
	range(i,s.size() / 2, s.size()){
		rep(j,v[i].size() - 1){
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + v[i + 1][j]);
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j + 1] + v[i + 1][j]);
		}
	}
	cout << dp.back().front() << endl;
}



Measured memory_bytes: 3116
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.solve();
    }
    public void solve() throws Exception {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int M = scan.nextInt();
        int D = scan.nextInt();
        int answer = 0;
        for (int i = 1; i <= M; i++) {
            for (int j = 1; j <= D; j++) {
                if (j < 20) {
                    continue;
                }
                int d10 = j / 10;
                int d1 = j % 10;
                if (d1 < 2) {
                    continue;
                }
                if (d10 * d1 == i) {
                    answer += 1;
                }
            }
        }
        System.out.println(answer);
    }
}


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

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

    bool flag = 1;
    if(s.at(0) == s.at(1) && s.at(1) == s.at(2) && s.at(2) == s.at(3)) flag = 0;
    else if(s.at(0) == s.at(1) && s.at(2) == s.at(3)) flag = 1;
    else if(s.at(0) == s.at(2) && s.at(1) == s.at(3)) flag = 1;
    else if(s.at(0) == s.at(3) && s.at(1) == s.at(2)) flag = 1;
    else flag = 0;

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


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

void solve()
{
	set < ll >s;
	int n,x;cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		s.insert(x);
	}
	if(s.size()==n)
	cout<<"YES";
	else cout<<"NO";
}
int main()
{
	//int t;cin>>t;
	//while(t--)
	solve();
}


Measured memory_bytes: 9600
#include <cstdio>
#include <cstdlib>

int main()
{
	int x, a, b;
	scanf("%d%d%d", &x, &a, &b);

	int da = abs(x - a), db = abs(x - b);
	if (da < db) {
		puts("A");
	} else {
		puts("B");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using i64 = int64_t;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)

int d, c[26], s[365][26], t[365], last[26];

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

	cin >> d;
	rep(i, 0, 26) cin >> c[i];
	rep(i, 0, d) rep(j, 0, 26) cin >> s[i][j];
	rep(i, 0, d) cin >> t[i], --t[i];

	int S = 0;
	rep(i, 0, d) {
		S += s[i][t[i]];
		last[t[i]] = i + 1;
		rep(j, 0, 26)
			S -= c[j] * (i + 1 - last[j]);
		cout << S << '\n';
	}
	return 0;
}

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

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

// LCSセット
const int S_LEN_MAX = 1500;
ll dp[S_LEN_MAX][S_LEN_MAX];
ll LCS(string s, string t){
    // reset
    FOR(i, 0, S_LEN_MAX){
        FOR(j, 0, S_LEN_MAX){
            dp[i][j] = 0;
        }
    }

    ll n = s.size();
    ll m = t.size();
    for (int i=0; i<n; ++i) {
        for (int j=0; j<m; ++j) {
            if (s[i] == t[j]) {
                dp[i+1][j+1] = dp[i][j] + 1;
            }
            else {
                dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
            }
        }
    }
    return dp[n][m];
}

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

    // input
    ll Q;
    cin >> Q;

    while(Q--){
        string s, t; cin >> s >> t;
        ll a = LCS(s, t);
        p(a);
    }
    
    return 0;
}


Measured memory_bytes: 20816
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,c,d,x,y,e,f,g,h;
int arr[]={1,3,5,7,8,10,12};
int brr[]={4,6,9,11};
cin>>x>>y;
if(x==2&&y==2)
    cout<<"Yes";
else if((x==1||x==3||x==5||x==7||x==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||y==8||y==10||y==12))
  cout<<"Yes";
  else if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11))
  cout<<"Yes";
  else cout<<"No";
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int n;
long long d;
long long x,y;
//const double eps=1e-6;
bool dist(long long a,long long b)
{
    if((a*a+b*b)<=d*d)
    return true;
    else
    return false;
}
int main()
{
    scanf("%d %lld",&n,&d);
    int ans=0;
    for(int i=1;i<=n;++i)
    {
        scanf("%lld %lld",&x,&y);
        if(dist(x,y))
        ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3804
#include<stdio.h>

void insertionsort(int A[],int N){
    int v, j;
    for(int i=1; i<N; i++){
        v = A[i];
        j = i - 1;
        while( j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        trace(A,N);
    }
}

void trace(int A[], int N){
    for(int i = 0; i < N; i++){
        if(i > 0) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n");
}

int main(){
    int A[100], N;
    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        scanf("%d", &A[i]);
    }
    trace(A, N);
    insertionsort(A, N);
    return 0;
}


Measured memory_bytes: 2056
import scala.io.StdIn.{readInt,readLine}

object Main {
  def euclid(m:Int,n:Int):Int = if(n==0) m else euclid(n,m%n)

  def main(args:Array[String]) = {
    val n = readInt
    val nums = readLine.split(" ").map(_.toInt)
    var gcm = nums(0)
    for(i <- 1 until n) {
      gcm = euclid(gcm,nums(i))
    }
    for(i<-1 to gcm if gcm%i==0)
      println(i)
  }
}

Measured memory_bytes: 45120
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	string s;
	cin >> s;	
	bool f[s.size()]={};
	rep(i,0,s.size())
		if(s[i]=='W')
			f[i] = 1;
	
	int cnt = 0;
	int F = f[0];
	rep(i,1,s.size()){
		if( F != f[i] ){
			cnt++;
			F = f[i];
		}
	}
	
	P(cnt);
	ret 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111

	void solve(){

		


		while(1){
		ini(n);
		ini(x);
		if(n == 0 and x == 0 )break;
		int tmp = 0;
		FOR(i,1,n+1){
			FOR(i1,i+1,n+1){
				FOR(i2,i1+1,n+1){
					if(i+i1+i2==x)tmp++;
				}
			}
		}
		out(tmp);
		}
		








	}	























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}



Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(ll i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const int INF=2*1e9;
int main()
{
    ll n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringJoiner;
import java.util.StringTokenizer;
import java.util.function.IntUnaryOperator;
import java.util.function.LongUnaryOperator;

class Main {
    static In in = new In();
    static Out out = new Out();
    static long mod = 1000000007;
    static long inf = 0xfffffffffffffffL;

    void solve() {
        String s = in.next();
        int n = s.length() - 1;
        boolean[] a = new boolean[n];
        boolean can = s.charAt(n) == '0' && s.charAt(0) == '1';
        for (int i = 0; i < n; i++) {
            can &= s.charAt(i) == s.charAt(n - 1 - i);
            a[i] = s.charAt(i) == '1';
        }
        if (can) {
            int last = n;
            for (int i = n - 1; i >= 0; i--) {
                out.println(last + 1, i + 1);
                if (a[i]) {
                    last = i;
                }
            }
        } else {
            out.println(-1);
        }
    }

    public static void main(String[]$) {
        new Main().solve();
        out.flush();
    }
}

class In {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 0x10000);
    private StringTokenizer tokenizer;

    String next() {
        try {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (IOException ignored) {
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    char[][] nextCharArray(int n, int m) {
        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        return a;
    }

    int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    int[] nextIntArray(int n, IntUnaryOperator op) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsInt(nextInt());
        }
        return a;
    }

    long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextLong();
        }
        return a;
    }

    long[] nextLongArray(int n, LongUnaryOperator op) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsLong(nextLong());
        }
        return a;
    }
}

class Out {
    private static PrintWriter out = new PrintWriter(System.out);

    void println(Object... a) {
        StringJoiner joiner = new StringJoiner(" ");
        for (Object obj : a) {
            joiner.add(String.valueOf(obj));
        }
        out.println(joiner);
    }

    void flush() {
        out.flush();
    }
}


Measured memory_bytes: 49556
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define mod 1000000007
#define inf 1e17
using namespace std;

int main() 
{ 

   ll n,w;
   cin>>n>>w;
   ll dp[n+1][w+1];
   vector<ll>wght,val;
   for(ll i=0;i<n;i++)
   {
      ll a,b;
      cin>>a>>b;
      wght.pb(a);
      val.pb(b);
   }
   for(ll i=0;i<=n;i++)
   {
      for(ll j=0;j<=w;j++)
      {
         if(i==0 || j==0)
         {
            dp[i][j] = 0;
         }
         else if(j>=wght[i-1])
         {
            dp[i][j] = max(val[i-1] + dp[i-1][j-wght[i-1]],dp[i-1][j]);
         }
         else
         {
            dp[i][j] = dp[i-1][j];
         }
      }
   }
   cout<<dp[n][w]<<endl;
} 

Measured memory_bytes: 79104
//
// Created by TakahiroYamaji on 2020/08/15.
//

#include<iostream>
#include<algorithm>
typedef long long ll;
int N;
ll H[10000];
int main(){
    std::cin >> N;
    for (int i=0;i<N;i++){
        std::cin >> H[i];
    }
    //std::sort(H, H+N);
    int res = 0;
    for (int i=0;i<N;i++){
        for (int j=i+1;j<N;j++){
            for (int k=j+1;k<N;k++){
                if (H[i] + H[j] > H[k] && H[j] + H[k] > H[i] && H[k] + H[i] > H[j]){
                    if (H[i] != H[j] && H[j] != H[k] && H[k] != H[i]){
                        //std::cout << i << " " << j << " " << k << std::endl;
                        res++;
                    }

                }
            }
        }
    }
    std::cout << res << std::endl;
}



Measured memory_bytes: 3196
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int N;
    cin >> N;
    int A[N];
    REP(i,N) cin >> A[i];

    ll ans = 0;
    int l=0, r=1;

    int Sum = A[0];
    while(r<N || l<N){
        while(r<N && (Sum & A[r]) == 0){ Sum+=A[r]; r++;}
        ans += r-l;
        Sum -= A[l];
        l++;
    }

    cout << ans << endl;
    return 0;
}

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

int main(){
  int n, cnt=0, ans=0;
  cin >> n;
  vc c(n);
  rep(i, n){
    cin >> c[i];
    if(c[i]=='W')cnt++;
  }
  if(n>cnt){
    rep(i, cnt){
      if(c[n-i-1]=='R')ans++;
    }
  }

  cout << ans << endl;
  

  return 0;
}

Measured memory_bytes: 3600
import java.util.Scanner;

class Main{
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int length = sc.nextInt();
        String str = sc.next();

        String answer;

        if (str.length()<= length){
            answer = str;
        }else{
            answer = str.substring(0, length) + "...";
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 38572
/*
------------------------------|بسم الله الرحمن الرحيم|------------------------------//
------------"IN THE NAME OF ALLAH, THE MOST GRACIUOS, THE MOST MERCIFUL"-------------//
__________________________________ShahnawazShaikh_____________________________________
*/

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define int int64_t
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);	

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

sort(v.begin(),v.end());

int prev=0,frwd=0;
prev=x;
while(binary_search(v.begin(),v.end(),prev))prev-=1;	
frwd=x;
while(binary_search(v.begin(),v.end(),frwd))frwd+=1;

if((x-prev)<=frwd-x)
    cout<<prev;
else
   cout<<frwd;    	

return 0;	
}

Measured memory_bytes: 3640
import java.io.*;
import java.math.*;
import java.util.*;

class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	//List<Integer> l = new ArrayList<Integer>();
      	int max = 0;
      	int tsum = 0;
      	while(n > 0) {
        	int ele = sc.nextInt();
          	//l.add(ele);
          	n--;
          	max = max > ele ? max : ele;
          	tsum += ele;
        }
	    System.out.println((tsum - max) > max ? "Yes" : "No");
    }
}

Measured memory_bytes: 21844
i = list(input().split(' '))

# print(i)
#print(i[1],i[2])
n = []
for x in range(1,int(i[0])+1):
  num = list(str(x))
  num_sum = sum(list(map(int,num)))
#   print((num_sum))
  if int(i[1]) <= int(num_sum) <= int(i[2]):
      n.append(x)
      
    
print(sum(n))  

Measured memory_bytes: 3544
#include<stdio.h>

int main(){

  int N,H[25];
  int i , c = 1 ,M;
  scanf("%d",&N);

  for ( i=0 ; i<N ; i++ ){
     scanf("%d",&H[i]);
  }
  M=H[0];
  for( i=1; i<N;i++){
   if(H[i]>=M){c++;if(M<H[i]){M=H[i];}}
  }
  printf("%d\n",c);
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] array = scanner.nextLine().toCharArray();
			char prev = ' ';
			for (char c : array) {
				if (prev == c) {
					System.out.println("Bad");
					return;
				}
				prev = c;
			}
			System.out.println("Good");
		}
	}
}


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

int n;
vector<int> l;

bool isOK(int a, int b, int c){
  return (l[a]<l[b]+l[c] && l[b]<l[c]+l[a] && l[c]< l[a]+l[b]);
}

int nibutan(int a, int b){
  int ok=b,ng=n,middle;
  while(ng - ok > 1){
    middle = (ok + ng) / 2;
    if(isOK(a,b,middle)) ok = middle;
    else ng = middle;
  }
  return ok-b;
}

int main(){
  cin>>n;
  l.resize(n);
  rep(i,n){
    cin>>l[i];
  }
  sort(l.begin(),l.end());
  int ans=0;
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      ans+=nibutan(i,j);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int  a,b;
    cin>>a>>b;
    if(a==1||b==1)
    {
        if(a==1&&b==1)
            cout<<"Draw"<<endl;
        else if(a==1)
            cout<<"Alice"<<endl;
        else
            cout<<"Bob"<<endl;
    }
    else
    {
        if(a>b)
        cout<<"Alice"<<endl;
        else if(a==b)
        cout<<"Draw"<<endl;
        else
        cout<<"Bob"<<endl;



    }
//    main();
}


Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())

dif_x = x2 - x1
dif_y = y2 - y1

print(x2 - dif_y, y2 + dif_x, x2 - dif_x - dif_y, y2 + dif_x - dif_y)

Measured memory_bytes: 38384
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <stdio.h>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORa(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define FORs(i,st) for(auto i : st)
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)

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

    map<char,ll> code;
    FOR(i,0,10){
      code['0' + i] = i;
    }
    FOR(i,0,6){
      code['a' + i] = i+10;
    }
    vector<char> encode = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' };

    ll n;
    cin>>n;
    while(n--){
      vector<string> v(9);
      FOR(i,0,9){
        cin>>v[i];
        ll siz = v[i].size();
        FOR(j,0,8-siz){
          v[i] = '0' + v[i];
        }
      }

      ll up = 0; //繰り上がり
      string ans = "00000000";
      FORr(i,0,7){ // 右から見ていく
//        cout<<"i = "<<i<<endl;
        FOR(j,0,16){ // 0~f
          ll sum = up;
          FOR(k,0,8){ // sumは８つ
            char c = v[k][i];
            sum += j ^ code[c];
          }
          ll res = code[v[8][i]] ^ j;
//          cout<<" j = "<<j<<endl;
//          cout<<"  16*"<<sum/16<<"+"<<sum%16<<" "<<res<<"+"<<up<<endl;
          if(sum%16 == res){
            ans[i] = encode[j];
            up = sum/16;
            break;
          }
        }
      }
      ll f=0;
      FOR(i,0,8){
        if(ans[i] == '0' && f == 0){
          continue;
        }
        else f = 1;
        cout<<ans[i];
      }
      if(f == 0) cout<<0;
      cout<<endl;

    }
}



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

signed main(){
	int n,m;
	while(cin >> n >> m,n){
		int ma[110] = {},ans = 0;
		for(int i = 0;i < n;i++){
			int t,d;
			cin >> t >> d;
			ma[t] = max(ma[t],d);
		}
		for(int i = 1;i <= m;i++) ans += ma[i];
		cout << ans << endl;
	}
}


Measured memory_bytes: 3072
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N = ni()
    val S = ns(N)
    val Q = ni()
    val K = na(Q)
    K.foreach { k =>
      var d = 0
      var m = 0
      var dm = 0L
      var ans = 0L
      rep(N) { i =>
        // 先に k-1の状態にしないとCが出てきた処理でk+1になってしまう
        if (i >= k) {
          S(i - k) match {
            case 'D' =>
              d -= 1
              dm -= m

            case 'M' => m -= 1
            case _ =>
          }
        }

        S(i) match {
          case 'D' => d += 1
          case 'M' =>
            m += 1
            dm += d

          case 'C' =>
            ans += dm

          case _ =>
        }
      }

      out.println(ans)
    }
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    rep(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    rep(n) { i =>
      rep(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def rep(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def rep_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    rep(n)(i => res(i) = f(i + offset))
    res
  }


  def sumL(as: Array[Int]): Long = {
    var s = 0L
    rep(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Int](as.length + 1)
    rep(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}

Measured memory_bytes: 36584
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
#define int long long
int a[200100],b[200100],n,m,ans;
signed main(){
    int i,j,k;
    scanf("%lld",&n);
    for(i=1;i<=n;i++){
      scanf("%lld",&a[i]);
      b[i]=i-a[i];
      if(a[i]-a[i-1]>1||a[i]>=i){
        puts("-1");
        return 0;
      }
    }
    for(i=n;i>0;i--){
      if(i!=n&&b[i]==b[i+1])continue;
      ans+=a[i];
    }
    cout<<ans<<"\n";
	return 0;
}


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

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

void bfs(int y, int x){
    if(y < 0 || y >= 12 || x < 0 || x >= 12 || field[y][x] == '0'){
        return;
    }
    field[y][x] = '0';
    for(int i=0; i<4; i++){
        bfs(y+dy[i], x+dx[i]);
    }
}

int main(void){
	while(1){
	    for(int i=0; i<12; i++){
	        for(int j=0; j<12; j++){
	            cin >> field[i][j];
	        }
	    }
	    if(cin.eof()){
	    	break;
	    }
	    int ans = 0;
	    for(int i=0; i<12; i++){
	        for(int j=0; j<12; j++){
	            if(field[i][j] == '1'){
	                bfs(i,j);
	                ans++;
	            }
	        }
	    }
    	cout << ans << endl;
	}
    return 0;
}

Measured memory_bytes: 3076