akhauriyash/Code-Regression huggingface dataset:
//
//  main.cpp
//  GCJ
//
//  Created by shitian.ni on 2018/06/19.
//  Copyright © 2018 shitian.ni. All rights reserved.
//

#include <iostream>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <algorithm>
using namespace std;



int main() {
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    int ans=0;
    while(1){
        if(a[0]==a[1]&&a[1]==a[2]){
            break;
        }
        if(a[2]>a[0]&&a[2]>a[1]){
            a[1]+=1;
            a[0]+=1;
        } else {
            a[0]+=2;
        }
        
        sort(a,a+3);
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

class Dice {
public:
	int p[7] = { 0,1,4,5,2,3,6 };
	void North() {
		swap(p[3], p[1]);
		swap(p[1], p[4]);
		swap(p[4], p[6]);
	}
	void East() {
		swap(p[5], p[1]);
		swap(p[1], p[2]);
		swap(p[2], p[6]);
	}
	void West() {
		swap(p[1], p[5]);
		swap(p[5], p[6]); 
		swap(p[6], p[2]);
	}
	void South() {
		swap(p[1], p[3]);
		swap(p[3], p[6]);
		swap(p[6], p[4]);
	}
	void Right() {
		swap(p[2], p[4]);
		swap(p[4], p[5]);
		swap(p[5], p[3]);
	}
	void Left() {
		swap(p[2], p[3]);
		swap(p[3], p[5]);
		swap(p[5], p[4]);
	}
};
int main()
{
	while (1) {
		int n;
		cin >> n;
		if (n == 0)
			break;
		string s[10000];
		Dice D;
		int count = 1;
		for (int i = 0; i < n; i++) {
			cin >> s[i];
			if (s[i][0] == 'N')
				D.North();
			if (s[i][0] == 'E')
				D.East(); 
			if (s[i][0] == 'W')
				D.West();
			if (s[i][0] == 'S')
				D.South();
			if (s[i][0] == 'R')
				D.Right();
			if (s[i][0] == 'L')
				D.Left(); 
			count += D.p[1];
			}
			cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 3352
(defun main ()
  (let* ((s (read-line))
         (y (parse-integer s :start 0 :end 4))
         (m (parse-integer s :start 5 :end 7))
         (d (parse-integer s :start 8 :end 10)))
    (if (or (< y 2019)
            (and (= y 2019)
                 (< m 4))
            (and (= y 2019)
                 (= m 4)
                 (<= d 30)))
        (write-line "Heisei")
        (write-line "TBD"))))
 
;;; #-swank(main)
(main)


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

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> city(n);
    for(int i = 0; i < m * 2; i++){
        int a;
        cin >> a;
        city.at(a-1)++;
    }
    for(int i = 0; i < n; i++){
        cout << city.at(i) << endl;
    }
}


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

// repetition
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// const value
// const ll MOD = 1e9 + 7;
// const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
// const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline ll toLL(string s) {
  ll v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int l = a + b;
  int r = c + d;
  if(l > r) {
    cout << "Left" << endl;
  } else if(r > l) {
    cout << "Right" << endl;
  } else {
    cout << "Balanced" << endl;
  }
  return 0;
}


Measured memory_bytes: 3580
from operator import itemgetter

N = int(input())
X = [[int(x) for x in input().split()] for _ in range(N)]
X.sort(key=itemgetter(1))
sum = 0

for i in range(N):
    sum += X[i][0]
    if sum > X[i][1]:
        print("No")
        quit()
print("Yes")

Measured memory_bytes: 87816
import java.util.Scanner;
public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int n = sc.nextInt();
		int a[] = new int[n];
		
		for(i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		
		selectionsort(n, a);
	}
	public static void selectionsort(int n, int a[]){
		int count = 0;
		for (int i = 0; i <= n - 1; i++){
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		}
		for(int i = 0; i < n; i++){
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		}
		
		System.out.printf("\n%d\n", count);
	}
}


Measured memory_bytes: 26368
import fractions
a,b,c,d=map(int,input().split())
t=b//d-((a-1)//d)
s=b//c-((a-1)//c)
p=fractions.gcd(d,c)
q=c*d//p
u=b//q-((a-1)//q)
print(b-a+1-(t+s-u))


Measured memory_bytes: 5048
#include<bits/stdc++.h>
using namespace std;
int vis[200],m,ans=0;
double k[30000];
struct sc
{
    int x,y;
} s[200];
bool flag=true;
void update(int cnt)
{
    int sum=0;
    for(int i=0; i<cnt; i++)
        for(int j=i+1; j<cnt; j++)
            if(k[j]==k[i])sum++;
    ans=max(sum,ans);
    flag=false;
}
void dfs(int i,int cnt)
{
    while(vis[i]&&i<=m)i++;
    if(i==m+1)
    {
        update(cnt);
        return ;
    }
    vis[i]=1;
    for(int j=i+1; j<=m; j++)
    {
        if(vis[j])continue;
        int a=s[i].x-s[j].x,b=s[i].y-s[j].y;
        k[cnt]=(a==0?100000.0:1.0*b/a);
        vis[j]=1;
        dfs(0,cnt+1);
        vis[j]=0;
    }
    vis[i]=0;
}
int main()
{
    scanf("%d",&m);
    memset(vis,0,sizeof vis);
    for(int i=1; i<=m; i++)scanf("%d %d",&s[i].x,&s[i].y);
    vis[0]=1;
    dfs(0,0);
    cout<<ans<<endl;
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
#define vec(type) vector<type>

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

    for (int i = 0; i < t.size(); i++) {
        if (t[i] == '?') t[i] = 'D';
    }
    cout << t << endl;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
#define ri register int
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	template <class I>
	inline void gi (I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = (x << 1) + (x << 3) + (c & 15); x *= f;
	}
	// print a signed integer
	template <class I>
	inline void print (I x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	// no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} 
using io :: gi;
using io :: putc;
using io :: print;
const int N=2e5+5;
int tot,head[N],nxt[N<<1],adj[N<<1],premx[N],tag[N],f[N],id,bl[N],br[N],ans[N];
inline void addedge(ri x,ri y){
	nxt[++tot]=head[x];
	adj[head[x]=tot]=y;
}
inline void dfs(ri x,ri mx,ri p,ri mx2){
	bl[x]=++id;
	premx[x]=max(premx[f[x]],x);
	if(x>mx) mx=x,mx2=0,++tag[x];
	else{
		if(x>mx2) mx2=x;
		if(mx2<premx[f[mx]])
			++tag[mx];
		else
			++tag[p]; 
	}
	for(ri y,i=head[x];i;i=nxt[i])
		if((y=adj[i])!=f[x])
			f[y]=x,
			dfs(y,mx,x==mx?y:p,mx2);
	br[x]=id;
	ans[bl[x]]+=tag[x];
	ans[br[x]+1]-=tag[x];
}
int main(){
	ri n,i,x,y;
	gi(n);
	for(i=1;i^n;++i) gi(x),gi(y),addedge(x,y),addedge(y,x);
	dfs(1,0,0,0); 
	for(i=1;i<=n;++i) ans[i]+=ans[i-1];
	for(i=2;i<=n;++i) print(--ans[bl[i]]),putc(' ');
	putc('\n');
    return 0;
}

Measured memory_bytes: 22656
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

void dfs(string s, char mx, int N) {
    if (s.length() == N) {
        cout << s << endl;
        return;
    } else {
        for (char c = 'a'; c <= mx + 1; c++) {
            dfs(s + c, max(mx, c), N);
        }
    }
}

int main() {
    int N;
    cin >> N;
    dfs("a", 'a', N);
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int imos[501][501];

int main(){
  int N,M,Q,L,R;
  cin >> N >> M >> Q;
  vector<pair<int,int>> v,que;
  FOR(i,0,M){
    cin >> L >> R;
    imos[L][R]++;
  }
  FOR(i,0,Q){
    cin >> L >> R;
    que.push_back(make_pair(L,R));
  }
  FOR(i,0,501)FOR(j,1,501){
    imos[i][j] += imos[i][j-1];
  }
  FOR(i,0,501)FOR(j,1,501){
    imos[i][j] += imos[i-1][j];
  }
  for(auto q:que){
    cout << imos[N][q.second] - imos[q.first-1][q.second] << endl;
  }
}


Measured memory_bytes: 2804
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	ll x; cin>>x;
	ll y; cin>>y;
	ll an; cin>>an;
	ll bn; cin>>bn;
	ll cn; cin>>cn;
	vector<ll> a(an);
	REP(i,an) cin>>a[i];
	vector<ll> b(bn);
	REP(i,bn) cin>>b[i];
	vector<ll> c(cn);
	REP(i,cn) cin>>c[i];

	vector<pair<ll,ll>> v(an+bn+cn);
	REP(i,an){
		v[i].first=a[i];
		v[i].second=0;
	}
	REP(i,bn){
		v[i+an].first=b[i];
		v[i+an].second=1;
	}
	REP(i,cn){
		v[i+an+bn].first=c[i];
		v[i+an+bn].second=2;
	}
	sort(v.begin(),v.end());

	//cout << "v: "; REP(i,(signed)v.size()) cout<<v[i].first<<" "; cout << endl; //----------cout----------//


	ll n=an+bn+cn;
	ll ans=0;
	ll X=0,Y=0,Z=0;
	ll i=0;
	while(X+Y+Z<x+y){
		if(X<x && v[n-1-i].second==0){
			X++;
			ans+=v[n-1-i].first;
			//cout<<"x "<<v[n-1-i].first<<endl;
		}else if(Y<y && v[n-1-i].second==1){
			Y++;
			ans+=v[n-1-i].first;
			//cout<<"y "<<v[n-1-i].first<<endl;
		}else if(v[n-1-i].second==2){
			Z++;
			ans+=v[n-1-i].first;
			//cout<<"z "<<v[n-1-i].first<<endl;
		}
		i++;
	}
	cout<<ans<<endl;
	return 0;
}
/*
2 2 3 2 1
3 4 5
1 1 
2
*/

Measured memory_bytes: 7296
#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, char* argv[]) {
  long double a, b, c;
  cin >> a >> b >> c;

  if (a + 2 * sqrt(a * b) + b < c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;

}

Measured memory_bytes: 256
#if 1

#include<bits/stdc++.h>
using namespace std;
long long n,j = 0,ans = 0,h = 0;
int a[200005];

int main()
{
	cin >> n;
	for(int i = 1;i <= n;i++) cin >> a[i];
	for(int i = 1;i <= n;i++)
	{
		for(;j <= n && !(h & a[j]);j++) h ^= a[j];
		ans += (j-i);
		h ^= a[i];
	}
	cout << ans;
}

#endif // 1++


Measured memory_bytes: 1024
n = input()
taro_score = 0
hanako_score = 0
for i in range(n):
	taro,hanako = raw_input().split()
	if taro > hanako :
		taro_score += 3
	elif taro == hanako :
		taro_score += 1
		hanako_score += 1
	else :
		hanako_score += 3
print '%d %d' %(taro_score,hanako_score)

Measured memory_bytes: 6268
#include <cstdint>
#include <algorithm>
#include <iostream>
typedef int64_t i64;

static i64 f(i64 b, i64 n) {
	i64 s = 0;
	while(n != 0) {
		s += n % b;
		n /= b;
	}
	return s;
}

int main() {
	i64 n, s;
	std::cin >> n >> s;
	for(i64 b = 2; b * b <= n; b++) {
		if(f(b, n) == s) {
			std::cout << b << std::endl;
			return 0;
		}
	}
	i64 a = n == s ? n + 1 : -1;
	for(i64 k = 1; ; k++) {
		i64 br = n / k; // close
		if(br <= n / br) break;
		i64 bl = n / (k + 1); // open
		//std::cout << "k=" << k << std::endl;
		if((n - s) % k == 0) {
			auto b = 1 + (n - s) / k;
			//std::cout << "k=" << k << " b=(" << bl << "," << br << "]=" << b << std::endl;
			if(bl < b && b <= br && b > n / b) {
				a = b;
			}
		}
	}
	std::cout << a << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
template<typename T>
struct Segtree {
    int n;
    T e;
    vector<T> dat;
    typedef function<T(T a, T b)> Func;
    Func f;
 
    Segtree(){}
    Segtree(int n_input, Func f_input, T e_input){
        initialize(n_input, f_input, e_input);
    }
    void initialize(int n_input, Func f_input, T e_input){
        f = f_input;
        e = e_input;
        n = 1;
        while(n < n_input) n <<= 1;
        dat.resize(2*n-1, e);
    }
 
    void update(int k, T a){
        k += n - 1;
        dat[k] = a;
        while(k > 0){
            k = (k - 1)/2;
            dat[k] = f(dat[2*k+1], dat[2*k+2]);
        }
    }
 
    T get(int k){
        return dat[k+n-1];
    }
 
    T between(int a, int b){
        return query(a, b+1, 0, 0, n);
    }
 
    T query(int a, int b, int k, int l, int r){
        if(r<=a || b<=l) return e;
        if(a<=l && r<=b) return dat[k];
        T vl = query(a, b, 2*k+1, l, (l+r)/2);
        T vr = query(a, b, 2*k+2, (l+r)/2, r);
        return f(vl, vr);
    }
};
 
int main(){
    int N;
    cin >> N;
    vector<pair<int, int>> LR(N);
    for(int i=0; i<N; i++) {
        int l, r;
        cin >> l >> r;
        LR[i] = {l, r+1};
    }
    sort(LR.begin(), LR.end());
 
    Segtree<int> Lmax(N, [](int a, int b){ return max(a, b); }, -1e9);
    Segtree<int> Rmin(N, [](int a, int b){ return min(a, b); }, 1e9+1);
    for(int i=0; i<N; i++){
        Lmax.update(i, LR[i].first);
        Rmin.update(i, LR[i].second);
    }
 
    int ans = 0;
 
    // 1区間孤立
    for(int i=0; i<N; i++){
        int res1 = LR[i].second - LR[i].first;
        int r2 = min(Rmin.between(0, i-1), Rmin.between(i+1, N-1));
        int l2 = max(Lmax.between(0, i-1), Lmax.between(i+1, N-1));
        int res2 = max(0, r2-l2);
        ans = max(ans, res1 + res2);
    }
 
    // 左端ソートしてある境目で二分
    for(int i=1; i<N; i++){
        int res1 = Rmin.between(0, i-1) - Lmax.between(0, i-1);
        int res2 = Rmin.between(i, N-1) - Lmax.between(i, N-1);
        int res = max(0, res1) + max(0, res2);
        ans = max(ans, res);
    }
 
    cout << ans << endl;
    return 0;
}

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

struct Pos {
	double x, y;
}a, b, c, d;

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++ ) {
		cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
		Pos e;
		e.x = b.x - a.x;
		e.y = b.y - a.y;
		Pos f;
		f.x = d.x - c.x;
		f.y = d.y - c.y;
		
		double men = e.x * f.y - e.y * f.x;
		double eps = 1e-12;
		if(-eps <= men && men <= eps)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

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

using namespace std;

typedef pair<int,int> P;

void solve(int n) {
    int m;
    cin >> m;
    int p,q,r;
    cin >> p >> q >> r;

    vector<P> card[2];
    card[0].push_back(P(1,n));

    vector<P> temp;
    for(int i=0; i<m; ++i) {
        int x,y;
        cin >> x >> y;

        card[(i+1)%2].clear();

        int j=0;
        int cnt=0;
        int idx,idy;
        while(j<(int)card[i%2].size()) {
            if(cnt+card[i%2][j].second<=x) {
                temp.push_back(card[i%2][j]);
                cnt+=card[i%2][j].second;
                if(cnt==x) idx=(int)temp.size();
                ++j;
            } else if(cnt<x) {
                temp.push_back(P(card[i%2][j].first,x-cnt));
                card[i%2][j].first+=x-cnt;
                card[i%2][j].second-=x-cnt;
                cnt=x;
                idx=(int)temp.size();
            } else if(cnt+card[i%2][j].second<=y) {
                temp.push_back(card[i%2][j]);
                cnt+=card[i%2][j].second;
                if(cnt==y) idy=(int)temp.size();
                ++j;
            } else if(cnt<y) {
                temp.push_back(P(card[i%2][j].first,y-cnt));
                card[i%2][j].first+=y-cnt;
                card[i%2][j].second-=y-cnt;
                cnt=y;
                idy=(int)temp.size();
            } else {
                temp.push_back(card[i%2][j]);
                cnt+=card[i%2][j].second;
                ++j;
            }
        }

        for(int j=idy; j<(int)temp.size(); ++j) {
            card[(i+1)%2].push_back(temp[j]);
        }
        for(int j=idx; j<idy; ++j) {
            card[(i+1)%2].push_back(temp[j]);
        }
        for(int j=0; j<idx; ++j) {
            card[(i+1)%2].push_back(temp[j]);
        }

        temp.clear();
    }

    int ans=0;
    int c=0;

    for(int i=0; i<(int)card[m%2].size(); ++i) {
        int mx,mn;
        if(c>q) break;
        if(c+card[m%2][i].second<p) {
            c+=card[m%2][i].second;
            continue;
        }
        if(c<p) {
            mn=card[m%2][i].first+p-c-1;
        } else {
            mn=card[m%2][i].first;
        }
        if(c+card[m%2][i].second>q) {
            mx=card[m%2][i].first+q-c-1;
        } else {
            mx=card[m%2][i].first+card[m%2][i].second-1;
        }
        ans+=max(0,min(mx,r)-mn+1);
        c+=card[m%2][i].second;
    }

    cout << ans << endl;

    return;
}


int main() {
    int n;
    while(true) {
        cin >> n;
        if(n==0) break;
        solve(n);
    }
    return 0;
}


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

int needswap(vector<int> s, vector<int> g){
  int res = 0;
  for(int i = 0; i < s.size() ; i++){
    if(s[i] != g[i]){
      int r = -1;
      for(int k = i; k < s.size(); k++){
        if(s[k] == g[i]){
          r = k;
          break;
        } 
      }
      if(r == -1) return 1e8;
      swap(s[i], s[r]);
      res += r - i;
    }
  }
  return res;
}
int main(){
  int n, m; cin >> n >> m;
  vector<int> b(n), p(m);
  for(int i = 0; i < n; i++){
    cin >> b[i];
  }
  for(int i = 0; i < m; i++){
    cin >> p[i];
  }
  vector<vector<int> > g(2, vector<int>());
  for(int i = 0; i <= 1; i++){
    int ff = i;
    for(int c : p){
      for(int k = 0; k < c; k++) g[i].push_back(ff);
      ff = !ff;
    }
  }
  cout << min(needswap(b, g[0]), needswap(b, g[1])) << endl;
}

/*

0 1 0 1 1

0 0 1 1 1
1 1 1 0 0


0 0 1 1 1 0 0

1 1 0 0 0 0 1 
 1 2 1 0

0 0 0 1 0 1 1 0

1 1 1 0 0 0 0 0
 1 2 3 2 2 1 0
*/ 

Measured memory_bytes: 3168
using System.Linq;
using static System.Console;

namespace B
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var input = ReadLine().Split(' ').Select(double.Parse);
            var x = input.First();
            var y = input.Last();
            var a = 2.0 * x - y * .5;
            var b = -x + y * .5;
            if (a - (int) a > .0 || b - (int) b > .0)
            {
                WriteLine("No");
                return;
            }

            if (x >= y)
            {
                WriteLine("No");
                return;
            }

            if (a < 0 || b < 0)
            {
                WriteLine("No");
                return;
            }

            if (!((int) (a + b) == (int) x && (int) (2 * a) + (int) (4 * b) == (int) y))
            {
                WriteLine("No");
                return;
            }


            WriteLine("Yes");
        }
    }
}

Measured memory_bytes: 28244
#!/usr/bin/env -S JULIA_VERSION=0.5.0 julia
# contest: abc155, problem: abc155_b, alphabet: B

function solve(N::Int, A::Vector{Int})
  all(x->isodd(x) || x%3==0 || x%5==0, A) ? println("APPROVED") : println("DENIED")
end

function main()
  tokens = Channel{String}(32)
  Task() do
    for line in eachline(@static VERSION < v"0.6" ? STDIN : stdin)
      startswith(line, '\0') && break
      for token in split(chomp(line))
        put!(tokens, token)
      end
    end
    close(tokens)
  end |> schedule
  N = parse(Int, take!(tokens))
  A = similar(Vector{Int}, N)
  for i in 1:N
    A[i] = parse(Int, take!(tokens))
  end
  solve(N, A)
end

if isempty(get(ENV, "ATCODER_LOCAL", ""))
  isempty(ARGS) && main()
else
  @eval begin
    const samples = [("5\n6 7 9 10 31", "APPROVED"), ("3\n28 27 24", "DENIED")]
    function test(sampleids...)
      isempty(sampleids) && return test(collect(1:length(samples))...)
      ostdin, ostdout = @static VERSION < v"0.6" ? (STDIN, STDOUT) : (stdin, stdout)
      rd, wr = first(redirect_stdout()), last(redirect_stdin())
      try
        map(sampleids) do sampleid
          input, output = samples[sampleid]
          print(ostdout, "Testing sample #$(sampleid)..."); flush(ostdout)
          println(wr, input)
          println(wr, "\0")
          t = @elapsed main()
          println()
          result = strip(String(readavailable(rd)))
          if result == output
            println(ostdout, "OK ($t sec).")
            true
          else
            println(ostdout, "ERROR ($t sec)")
            println(ostdout, "== expected ==\n$output")
            println(ostdout, "== actual ==\n$result\n")
            false
          end
        end |> all
      finally
        redirect_stdin(ostdin)
        redirect_stdout(ostdout)
      end
    end
    submit() = test() && (prog = @__FILE__; run(`atcoder-submit $prog`))
    !isinteractive() && submit()
  end
end


Measured memory_bytes: 171032
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
	string S;int w,len;
	cin>>S>>w;
	len=S.length();
	for(int i=0;i<len;i+=w)
		printf("%c",S[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n;

    while (cin >> n) {
        if (!n)
            break;

        int old;
        int num[7] = {0};

        for (int i = 0; i < n; i++) {
            cin >> old;

            if (old >= 60)
                old = 60;
            num[old / 10]++;
        }
    
        for (int i = 0; i < 7; i++) 
            cout << num[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
typedef long long ll;
using namespace std;
char c[2020][2020];
int l[2020][2020];
int r[2020][2020];
int u[2020][2020];
int d[2020][2020];
int main(){
    memset(l,0,sizeof l);
    memset(r,0,sizeof r);
    memset(u,0,sizeof u);
    memset(d,0,sizeof d);
    int h,w,t=0;cin>>h>>w;
    for(int i=1;i<=h;i++) 
    for(int j=1;j<=w;j++)
    cin>>c[i][j];
    for(int i=1;i<=h;i++) 
    for(int j=1;j<=w;j++)
    if(c[i][j]=='.')
    {l[i][j]=l[i][j-1]+1;u[i][j]=u[i-1][j]+1;}
    for(int i=h;i>=1;i--) 
    for(int j=w;j>=1;j--)
    if(c[i][j]=='.')
    {d[i][j]=d[i+1][j]+1;r[i][j]=r[i][j+1]+1;}
    for(int i=1;i<=h;i++) 
    for(int j=1;j<=w;j++)
    if(c[i][j]=='.')
    t=max(t,l[i][j]+r[i][j]+u[i][j]+d[i][j]-3);
    cout<<t;
}

Measured memory_bytes: 68096
// C ++
#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 <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 <valarray>
#include <vector>

#define rep(i,n) for(int i = 0 ; i < (n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using p = pair<int, int>;
#define N 101

int main()
{
    int n, k,ans=0;
    cin >> n >> k;
    //cout << n << k << endl;

    vector<int> d(N), temp(n);
    vector<vector<int>> a(k, vector<int>(N));

    rep(i, k) {
        cin >> d.at(i);
        //cout << d.at(i) << endl;

        rep(j, d.at(i)) {
            cin >> a.at(i).at(j);
            temp.at(a.at(i).at(j) - 1) += 1;
            //cout << a.at(i).at(j);
        }
        //cout << endl;
    }

    rep(i, n) {
        if (temp.at(i) == 0)
            ans++;
    }

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

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const double PI = acos(-1);
const long long INF = (1LL << 60);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

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

  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;

  ll ans = 0;
  if(a+b >= c*2){
    ans += min(x, y) * c * 2;
    ll amari = max(x,y) - min(x,y);
    if(x > y) ans = min(ans+amari*a, ans+amari*c*2);
    else ans = min(ans+amari*b, ans+amari*c*2);
  }else{
    ans += a*x + b*y;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int n;
	double x, ans = 0;
	char u[4] = {};
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%lf%s", &x, u);
		if (u[0] == 'J') {
			ans += x;
		}
		else {
			ans += x * 380000.0;
		}
	}
	printf("%lf\n", ans);
	return 0;
}


Measured memory_bytes: 128
import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

void main(){
    int n, q, c, x, y;
    readVars(n, q);

    auto a = new int[](n);
    auto ft = new FenwickTree!(int)(a);

    foreach(qi ; 0 .. q){
        readVars(c, x, y);
        x--;

        if(c == 0){
            ft.add(x, y);
        } else {
            writeln(ft.getSum(y) - ft.getSum(x));
        }
    }
}

class FenwickTree(T){
private:
    T[] data;
    int N;

public:
    this(T[] a){
        data = [0] ~ a[];
        N = a.length.to!int;

        foreach (i ; 1 .. N + 1) {
            if (i + (i & (-i)) <= N) {
                data[i + (i & (-i))] += data[i];
            }
        }
    }

    void add(int i, T x) {
        i++;

        while (i <= N) {
            data[i] += x;
            i += i & (-i);
        }
    }

    T getSum(int r) {
        T res;

        while(r > 0){
            res += data[r];
            r -= r & (-r);
        }

        return res;
    }

    void print(){
        stderr.writefln("%(%s %)", data);
    }
}


void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        throw new Exception("args num < input num");
    }
}

Measured memory_bytes: 4248
import sys, math
from itertools import combinations
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    a = list(mi())
    m = 10**100
    for K in range(-100, 101):
        tmp = sum((a[i]-K)**2 for i in range(N))
        m = min(m, tmp)
    print(m)

if __name__ == '__main__':
    main()

Measured memory_bytes: 66432
#include<cstdio>
#include<cstdlib>
using namespace std;

int main(){
  int n, i, a[100005], sum = 0;
  scanf("%d",&n);
  a[0] = a[n+1] = 0;
  for(i = 1; i <= n; i++){
    scanf("%d",&a[i]);
    sum += abs(a[i-1]-a[i]);
  }
  sum += abs(a[n]-a[n+1]);
  for(i = 1; i <= n; i++)
    printf("%d\n",sum - abs(a[i-1]-a[i]) - abs(a[i]-a[i+1]) + abs(a[i-1]-a[i+1]));
}


Measured memory_bytes: 1536
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns      #-}
{-# LANGUAGE CPP               #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections     #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    !n <- readLn :: IO Int
    xs <- U.unfoldrN n (B.readInt.B.dropWhile isSpace) <$> B.getLine
    putStrLn.unwords.map show $ solve xs

solve :: U.Vector Int -> [Int]
solve xs = reverse.go True [] [] $ U.toList xs
  where
    go True fs rs (x:xs) = go False (x:fs) rs xs
    go False fs rs (x:xs) = go True fs (x:rs) xs
    go True fs rs [] = fs ++ reverse rs
    go False fs rs [] = rs ++ reverse fs

Measured memory_bytes: 28924
str1 = input()
wo = list(str1)
li = [0 for i in range(26)]
for i in range(len(wo)):
    li[ord(wo[i])-97] += 1
flag = True
for i in range(26):
    if li[i] % 2 != 0:
     flag = False
if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 8968
#include <bits/stdc++.h>
using namespace std;
int main(){

string s;
  cin>>s;
  if(s=="SUN") cout<<7;
  else if(s=="MON") cout<<6;
  else if(s=="TUE") cout<<5;
  else if(s=="WED") cout<<4;
  else if(s=="THU") cout<<3;
  else if(s=="FRI") cout<<2;
  else cout<<1;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define abs(x) ((x) > 0 ? (x) : -(x))
#define MOD (ll)1000000007 //10^9 + 7
#define endl printf("\n")
typedef long long ll;

int
main(int argc, char *argv[])
{
  int n, k;
  char s[100010];
  scanf("%d %d", &n ,&k);
  scanf("%s", s);

  int j = 0; int x = 0, c = 0;
  while (j < n) {
    x++;
    char t = s[j];
    int f = j;
    while (f < n && s[f] == s[j]) f++;
    c += f - j - 1;
    j = f;
  }

  printf("%d\n", Min(n - 1, c + 2 * k));

  return 0;
}


Measured memory_bytes: 256
N, D = map(int, input().split())
num = [input().split() for _ in range(N)]

X = []
Y = []
count = 0

for n in num:
    X.append(int(n[0]))
    Y.append(int(n[1]))

for x, y in  zip(X, Y):
    dist = x**2 + y**2
    if dist <= D**2:
        count += 1

print(count)


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/27  Problem: 076_arc_b / Link: https://arc076.contest.atcoder.jp/tasks/arc076_b?lang=en  ----- */
/* ------問題------

平面上に、N 個の街があります。i 個目の街は、座標 (xi,yi) にあります。同じ座標に、複数の街があるかもしれません。
座標 (a,b) にある街と座標 (c,d) にある街の間に道を造るのには、min(|a−c|,|b−d|) 円かかります。街と街の間以外に、道を造ることはできません。
任意の 2 つの街の間を、道を何本か通って行き来できるようにするためは、最低で何円必要でしょうか。

-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;



struct UnionFind {
	vector<int> data;
	UnionFind(int n) { data.assign(n, -1); }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
	int size(int x) { return -data[root(x)]; }
};
// UnionFind uf(n); uf.unionSet(i,j); if(uf.same(x,y))


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

	cin >> N;

	using tp = tuple<LL, int, int>;
	vector<PII>a(N);
	vector<PII>b(N);
	UnionFind uf(N);
	vector<tp> edge;

	FOR(i, 0, N) {
		int x, y;
		cin >> x >> y;
		a[i] = PII(x, i);
		b[i] = PII(y, i);
	}


	SORT(a);
	SORT(b);
	FOR(i, 0, N - 1) {
		edge.push_back(tp(abs(a[i].first - a[i + 1].first), a[i].second, a[i + 1].second));
		edge.push_back(tp(abs(b[i].first - b[i + 1].first), b[i].second, b[i + 1].second));
	}

	SORT(edge);

	FOR(i, 0, SZ(edge)) {
		LL a, b, c;
		tie(a, b, c) = edge[i];
		if (!uf.same(b, c)) {
			ans += a;
			uf.unionSet(b, c);
		}
	}


	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 8432
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(new InputStreamReader(System.in));
		int a = sc.nextInt();
		int b = sc.nextInt();

		if(a<b){
			if (a==1) {
				System.out.println("Alice");
			}else {
				System.out.println("Bob");
			}
		}else if (a>b){
			if (b==1) {
				System.out.println("Bob");
			} else {
				System.out.println("Alice");
			}
		}else {
			System.out.println("Draw");
		}

	}
}


Measured memory_bytes: 21844
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! p {
    ($($x:expr),*) => {
        $(println!("{:?}", $x);)*
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
#[allow(unused_imports)]
use std::cmp::*;
trait Each: Iterator{
    fn each<F>(self, mut f: F) where
        Self: Sized, F: FnMut(Self::Item),
    {
        self.fold((), move |(), item| f(item));
    }
}
impl<T:Iterator>Each for T{}

fn main(){
    input!{
        n: usize,
        k: u64,
        h:[u64;n]
    }
    let ans = h.iter().filter(|&&x|x>=k).count();
    p!(ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <stack>
using namespace std;
 
int main(){
    string str;
    while(true){
        getline(cin,str);
        if(str==".") return 0;
        bool ok = true;
        stack<char> s;
        for(auto c:str){
            if(c=='('||c=='['){
                s.push(c);
            }else if(c==']'){
                if(s.size()&&s.top()=='[') s.pop();
                else{
                    ok=false;
                    break;
                }
            }else if(c==')'){
                if(s.size()&&s.top()=='(') s.pop();
                else{
                    ok=false;
                    break;
                }
            }
        }
        if(ok&&!s.size()){
            cout<<"yes"<<endl;
        }else{
            cout<<"no"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3136
N = int(input())
s = [0]*N
for i in range(N):
    s[i] = int(input())
s.sort()

wa = sum(s)
if wa %10 != 0:
    print(wa)
else:
    for i in range(N):
        if s[i] %10 != 0:
            wa -= s[i]
            print(wa)
            break
    else:
        print(0)

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

int main() {
	string s; cin>>s;
	int a=0, b=0;
	for(int i=0; i<s.size(); i++){
		if(s[i]=='A')a++;
		else b++;
	}
	if(a==2&&b==1 || a==1&&b==2)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
}

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

int N;
int A[111], B[111];

int main() {
   cin >> N;
   int bSum = 0;
   for (int i = 0; i < N; i++) {
      cin >> A[i];
   }
   for (int i = 0; i < N; i++) {
      cin >> B[i];
      bSum += B[i];
   }

   int ans = 0;
   int aSum = 0;
   for (int i = 0; i < N; i++) {
      if (i >= 1) A[i] += A[i-1];
      int cand = A[i] + bSum;
      ans = max(ans, cand);
      bSum -= B[i];
   }

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    s=s+s.substr(0,s.size()-1);
    if(s.find(t)!=string::npos)
    {
    	cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
} 

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int a = fs.nextInt();
		int b = fs.nextInt();
		int k = fs.nextInt();
		
		HashSet<Integer> left = new HashSet<>();
		for(int i = 0; i < k; i++) {
			if(a + i > b) {
				break;
			}
			
			left.add(a+i);
		}
		
		HashSet<Integer> right = new HashSet<>();
		for(int i = 0; i < k; i++) {
			if(b - i < a) {
				break;
			}
			
			right.add(b - i);
		}
		
		
		HashSet<Integer> all = new HashSet<>();
		all.addAll(left);
		all.addAll(right);
		
		ArrayList<Integer> list = new ArrayList<>(all);
		list.sort(Comparator.comparing(Integer::intValue));
		
		for(Integer val : list) {
			System.out.println(val);
		}
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


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

int main(){
 int a, b;

cin >> a  >>  b;

if((a*b)%2 == 0){    //偶数ならば
 cout << "Even" << endl;
 }
else{         //奇数ならば
  cout << "Odd" << endl;
 }
}

Measured memory_bytes: 256
#include <stdio.h>
#define LL long long
int p[50],m[50],tot;//p[]记录质数,m[]记录幂次
int main()
{
    LL n;
    int i,j,ans=0;
    scanf("%lld",&n);
    for(i=2; (LL)i*i<=n; i++)
        if(n%i==0)
        {
            p[++tot]=i;
            while(n%i==0)
                n/=i,m[tot]++;
        }
    if(n>1)
        p[++tot]=n,m[tot]=1;
    for(i=1; i<=tot; i++)
    {
        j=1;
        while(1)
        {
            if(m[i]>=j)
                ans++,m[i]-=j;
            else
                break;
            j++;
        }
    }
    printf("%d\n",ans);
    return 0;
}


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

#define N 105

int a[N], n;
int g[N];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i ++) scanf("%d", &a[i]);
    int cnt = n;
    vector <int> v;
    while (cnt --) {
        int pos = -1;
        for (int i = n; i >= 1; i --) {
            if (a[i] == i) {
                pos = i;
                break;
            }
        }
        if (pos == -1) {
            puts("-1");
            return 0;
        }
        for (int i = pos+1; i <= n; i ++) a[i-1] = a[i];
        v.push_back(pos);
        n --;
    }
    reverse(v.begin(), v.end());
    for (auto x : v) printf("%d\n", x);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define pii pair<string, int>
using namespace std;
bool comparator(pii a, pii b)
{
    if(a.first == b.first)
        return a.second > b.second;
    else return a.first < b.first;
}
main()
{
    int n, p;
    string s;
    cin >> n;
    pii ara[n];
    map<pii, int>ind;
    for(int i = 0; i < n; i++)
    {
        cin >> s >> p;
        ara[i].first= s;
        ara[i].second = p;
        ind[pii(s, p)] = i + 1;
    }
    sort(ara, ara+n, comparator);
    for(int i = 0; i < n; i++)
        cout << ind[pii(ara[i].first, ara[i].second)] << endl;
    //main();
}


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
   int n;
   cin >> n;
   ll dp[100] = {0};
   dp[0] = 2;
   dp[1] = 1;
   for (int i = 2; i <= n; i++) {
      dp[i] = dp[i-1] + dp[i-2];
   }

   cout << dp[n] << endl;

   return 0;
}

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

using namespace std;
typedef long long ll;

class UnionFind {
  vector<int> par, siz;

 public:
  UnionFind(int n) {
    par.resize(n);
    siz.resize(n, 1);

    rep(i, n) { par[i] = i; }
  }

  int find(int x) {
    if (par[x] == x) {
      return x;
    } else {
      return par[x] = find(par[x]);
    }
  }

  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
  }

  int size(int x) { return siz[find(x)]; }

  bool isSame(int x, int y) { return find(x) == find(y); }
};

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

  UnionFind fr(n);
  vector<set<int> > cant(n);

  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    cant[a].insert(b);
    cant[b].insert(a);
    fr.unite(a, b);
  }

  rep(i, k) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (fr.isSame(a, b)) {
      cant[a].insert(b);
      cant[b].insert(a);
    }
  }

  rep(i, n) {
    int sug = fr.size(i) - 1;
    sug -= (int)cant[i].size();
    cout << sug << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 25088
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <sstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}
const int MAXN = 2e5+10;
int N,M,Q;
int fa[MAXN];
int q[MAXN];
int p1[MAXN];
int p2[MAXN];
int find(int x)
{
    if(fa[x] == x) return x;
    return fa[x] = find(fa[x]);
}
void init()
{
    for(int i = 1;i <= N;i++){
        fa[i] = i;
    }
}
int main()
{
	N = read();M = read();Q = read();
	init();
	for(int i = 1;i <= Q;i++){
        int a,b,c;
        scanf("%d%d%d",&a,&b,&c);
        a++;
        b++;
        q[i] = c;
        p1[i] = a;
        p2[i] = b;
        if(c == 0){
            int aa = find(a);
            int bb = find(b);
            if(aa!=bb){
                fa[aa] = bb;
            }
        }
	}
	bool flag = 1;
	for(int i = 1;i <= Q;i++){
        if(q[i] == 1){
            flag = 0;
            if(find(p1[i]) == find(p2[i])){
                printf("No");
                return 0;
            }
        }
	}
	ll cnt = 0;
	for(int i = 1;i <= N;i++){
        if(fa[i] == i){
            cnt++;
        }
	}
	//cout<<cnt<<endl;
	ll maxn = cnt*(cnt-1)/2;
	ll ans = M - N + cnt;
	if(!flag&&ans>=cnt&&ans<=maxn){
//        if(cnt<=2){
//            printf("No");
//            return 0;
//        }
        if(cnt>=3)
        printf("Yes");
        else printf("No");
	}
	else if(flag&&ans>=cnt-1&&ans<=maxn){
        printf("Yes");
	}
	else printf("No");
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Keep calm and carry on!
*/


Measured memory_bytes: 1792
n = int(input())
a = [0] + [int(i) for i in input().split()] + [0]

sum = sum([abs(a[i+1]-a[i]) for i in range(n+1)])
for i in range(1, n+1):
    print(sum - abs(a[i]-a[i-1]) - abs(a[i+1]-a[i]) + abs(a[i+1]-a[i-1]))


Measured memory_bytes: 14048