akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
int N;
vector<int> A;

int main(void){
    
    cin >> N;
    
    for(int i = 0; i < N; ++i){
        int n;
        cin >> n;
        A.push_back(n);
    }
    
    int j = 0, nsum = 0, bsum = 0;
    long long result = 0;
    for(int i = 0; i < N; ++i){
        while(j < N && (bsum ^ A[j]) == (nsum + A[j])){
            bsum ^= A[j];
            nsum += A[j];
            ++j;
        }
        result += j - i;
        bsum ^= A[i];
        nsum -= A[i];
    }
    
    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 1400
import itertools
import collections
import bisect
import math

def main():
    N = int(input())
    last = N
    for i in range(5):
        s = int(input())
        last = min(last, s)

    ans = math.ceil(N / last) + 4
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
import math
N, M = map(int, input().split())
mod = 10**9+7

if abs(N-M) > 1:
  print(0)
  exit()

if N < M:
  N, M = M, N

if N == M:
  ans = math.factorial(N)
  ans %= mod
  ans *= math.factorial(M)
  ans %= mod
  ans *= 2
  ans %= mod
else:
  ans = math.factorial(M)
  ans %= mod
  ans *= math.factorial(N)
  ans %= mod
  

print(ans)

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

void	add(bool be_reversed, string &S, int F, char C)
{
	if (!be_reversed && F == 1)
		S.insert(0, 1, C);
	if (!be_reversed && F == 2)
		S.push_back(C);
	if (be_reversed && F == 1)
		S.push_back(C);
	if (be_reversed && F == 2)
		S.insert(0, 1, C);
}

int	main()
{
	string	S;
	int		Q;
	cin >> S >> Q;
	bool	be_reversed = false;
	int		type;
	char	C;
	int		F;
	for (int i = 0; i < Q; ++i) {
		cin >> type;
		if (type == 1)
			be_reversed = !be_reversed;
		else {
			cin >> F >> C;
			add(be_reversed, S, F, C);
		}
	}
	if (be_reversed)
		reverse(S.begin(), S.end());
	cout << S << endl;
}	


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

int main() {
    int n;
    cin >> n;
    int arr[4][3][10] = {0};
    while(n) {
        int no, floor, room, num;
        cin >> no >> floor >> room >> num;
        arr[no-1][floor-1][room-1] += num;
        n--;
    }
    
    for (int i=0; i<4; i++) {
        for (int j=0; j<3; j++) {
            for (int k=0; k<10; k++) {
                cout <<" "<< arr[i][j][k];
            }
            cout <<endl;
        }
      if (i!=3)  cout << "####################"<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3080
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        int X = scanner.nextInt();
        int Y = scanner.nextInt();

        double b = 0.5 * Y - X;
        double a = X - b;

        if (b >= 0 && a >= 0) {
            if (b == (int)b && a == (int)a) {
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");
    }
}


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

int main() {
  string t; cin >> t;
  rep(i, t.size()) {
    if (t[i] == '?')
      cout << 'D';
    else cout << t[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>a>>b;
	int len=a.size();
	int lne=b.size();
	for(int i=0;i<len+lne;i++)
	{
		if(i%2==0) cout<<a[i/2];
		if(i%2==1) cout<<b[i/2];
	}   
    cout<<endl;
	return 0;
}

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

using namespace std;

int main ( ) {
    int N, A, B;
    int mult = 0;

    cin >> N >> A >> B;

    mult = N * A;
    if (mult < B) {
        cout << mult << endl;
    } else if (mult > B) {
        cout << B << endl;
    } else {
        cout << mult  << endl;
    }
}

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

using namespace std;

using ll = long long;

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

    int a, b;
    cin >> a >> b;
    if (10 <= a + b) cout << "error\n";
    else cout << a + b << endl;

    return 0;
}


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

// #define int long long
#define rep(i, n) for (ll i = (ll)(0); i < (ll)(n); ++i)
#define reps(i, n) for (ll i = (ll)(1); i <= (ll)(n); ++i)
#define rrep(i, n) for (ll i = ((ll)(n)-1); i >= 0; i--)
#define rreps(i, n) for (ll i = ((ll)(n)); i > 0; i--)
#define irep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); ++i)
#define ireps(i, m, n) for (ll i = (ll)(m); i <= (ll)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) ll(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll n;

const ll maxn=1005;
vll G[maxn];
bool reachable1[maxn];
void dfs(ll v){
  if(reachable1[v]) return;
  reachable1[v]=true;
  for(auto nv: G[v]){
    dfs(nv);
  }
}

vll rG[maxn];
bool reachableN[maxn];
void rdfs(ll v){
  if(reachableN[v]) return;
  reachableN[v]=true;
  for(auto nv: rG[v]){
    rdfs(nv);
  }
}

vector<tuple<ll,ll,ll>> es;
ll dist[maxn];
bool ok[maxn];
bool bellmanford(ll s){
  fill(dist,dist+n,INF);
  dist[s]=0;
  bool update=true;
  ll cnt=0;
  while(update){
    update=false;
    for(auto e: es){
      ll a,b,c;
      tie(a,b,c)=e;
      if(!ok[a]||!ok[b]) continue;
      if(chmin(dist[b],dist[a]+c)){
        update=true;
      }
    }
    if(cnt>=n){
      return true;
    }
    cnt++;
  }
  return false;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll m; cin>>n>>m;
  rep(i,m){
    ll a,b,c; cin>>a>>b>>c;
    a--,b--; c=-c;
    es.emplace_back(a,b,c);
    G[a].push_back(b);
    rG[b].push_back(a);
  }
  dfs(0);
  rdfs(n-1);
  rep(i,n) ok[i]=reachable1[i]&&reachableN[i];
  if(bellmanford(0)){
    cout<<"inf"<<endl;
  }else{
    cout<<-dist[n-1]<<endl;
  }
}

Measured memory_bytes: 512
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,M;
LL A[100];

string ans = "Yes";

void solve(){
	sort(A,A+N,greater<LL>());
	LL standard = 0;
	for(int i=0;i<N;i++) standard+=A[i];
	if(standard%(4*M)==0) standard /= (4*M);
	else standard = standard/(4*M) + 1;
	for(int i=0;i<M;i++){
		if(A[i]<standard){
			ans = "No";
			return;
		}
	}
}

int main(){
    cin >> N >> M;
    for(int i=0;i<N;i++) cin >> A[i];
 
    solve();

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
/*
*/
using Graph = vector<bitset<10>>;
ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}
const ll P =  1000000007;
ll factorial(ll n){
   ll ans = 1;
   for(int i = n;i>=1;i--){
     ans *= i;
     ans %= P;
   }
   return ans;
}

int main(){
  int N;
  cin >> N;
  int dp[N+1000];//N円を払いきる硬貨の最小枚数
  rep(i,N+1){
    dp[i] = i;//最初全て1円で払うときの枚数をdpに入れる
  }
 for(int n = 6;n<=N;n++){
  for(int p6 = 6;p6 <= n; p6 *= 6){
    dp[n] = min(dp[n] ,dp[n-p6] + 1);
  }
 }
 for(int n = 9;n<=N;n++){
  for(int p9 = 9;p9 <= n; p9 *= 9){
    dp[n] = min(dp[n] ,dp[n-p9] + 1);
  }
 }
 cout << dp[N] << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>

using namespace std;

#define pb push_back
#define int long long
#define ld long double

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    string s = to_string(n);
    if(s[0]=='9' || s[1]=='9'){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        try {
 
            String str[] = br.readLine().split("\\s+");
            int array[] = new int[str.length];
 
            for(int i = 0; i < str.length; i++){
                array[i] = Integer.parseInt(str[i]);
            }
 
            Dice dice = new Dice();
            dice.setNumber(array[0], array[1], array[2], array[3], array[4], array[5]);
 
 
            str = br.readLine().split("\\s+");
            for(int i = 0; i < str.length; i++){
                array[i] = Integer.parseInt(str[i]);
            }
            Dice dice2 = new Dice();
            dice2.setNumber(array[0], array[1], array[2], array[3], array[4], array[5]);
 
            if(dice.equals(dice2)){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
 
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
 
class Dice{
 
    private int number[];
    private int work[];
    private final String order = "NNNNWNNNWNNNENNNENNNWNNN";
 
    Dice(){
        number = new int[6];
        work = new int[6];
    }
 
 
    public void roll(char dst){
        for(int i = 0; i < 6; i++) work[i] = number[i];
        switch(dst){
        case 'E':
            setNumber(work[3],work[1],work[0],work[5],work[4],work[2]);
            break;
        case 'N':
            setNumber(work[1],work[5],work[2],work[3],work[0],work[4]);
            break;
        case 'S':
            setNumber(work[4],work[0],work[2],work[3],work[5],work[1]);
            break;
        case 'W':
            setNumber(work[2],work[1],work[5],work[0],work[4],work[3]);
            break;
        }
    };
 
    public int getTop(){
        return number[0];
    }
 
    public void setNumber(int n0,int n1,int n2,int n3,int n4,int n5){
        number[0] = n0;
        number[1] = n1;
        number[2] = n2;
        number[3] = n3;
        number[4] = n4;
        number[5] = n5;
    }
 
    public boolean equals(Object object){
 
        if(object == this)return true;
        if(object == null)return false;
        if(!(object instanceof Dice))return false;
 
        Dice another = (Dice)object;
 
        boolean FLG;
 
        for(int i = 0; i < order.length(); i++){
            roll(order.charAt(i));
            FLG = true;
            for(int k = 0; k < 6; k++){
                if(this.number[k] != another.number[k]){
                    FLG = false;
                    break;
                }
            }
            if(FLG)return true;
        }
 
        return false;
    }
};


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

int main(){
    int ans=0,D;
    vector<int> a(3);
    for (int i=0; i<3; i++){
        cin >> a.at(i); 
    }
    if(a.at(1)<a.at(2)){
        D=a.at(1);
        a.at(1)=a.at(2);
        a.at(2)=D;
    }
    if(a.at(0)<a.at(1)){
        D=a.at(0);
        a.at(0)=a.at(1);
        a.at(1)=D;
    }
    if((a.at(1)-a.at(2))%2==0)  ans=a.at(0)-a.at(1)+(a.at(1)-a.at(2))/2;
    else ans= a.at(0)-a.at(1)+(a.at(1)-a.at(2)-1)/2+2;
    cout << ans << endl;
}


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

int n, m;
bool G[50][50], seen[50];

void dfs(int v){
    seen[v] = true;
    for(int i = 0; i < n; i++){
        if(seen[i]) continue;
        if(!G[v][i]) continue;
        dfs(i);
    }
}

int main(){
    cin >> n >> m;
    vector<int> a(m), b(m);
    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        --a[i]; --b[i];
        G[a[i]][b[i]] = G[b[i]][a[i]] = true;
    }
    int ans = 0;
    for(int i = 0; i < m; i++){
        G[a[i]][b[i]] = G[b[i]][a[i]] = false;
        for(int j = 0; j < n; j++) seen[j] = false;
        dfs(0);
        bool ok = false;
        for(int j = 0; j < n; j++){
            if(!seen[j]) ok = true;
        }
        if(ok) ans++;
        G[a[i]][b[i]] = G[b[i]][a[i]] = true;
    }
    cout << ans << endl;
}

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

struct edge {int to, idx;};

int main() {
  int n;
  cin >> n;
  vector<vector<edge> > G(n);
  int k = 0;
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    edge e;
    e.idx = i; e.to = b;
    G[a].push_back(e);
    e.idx = i; e.to = a;
    G[b].push_back(e);
  }
  vector<int> C(n-1, -1), VC(n,-1);
  queue<int> que;
  que.push(0);
  while(!que.empty()) {
    int u = que.front(); que.pop();
    int col = 0;
    for (auto e : G[u]) {
      if (C[e.idx] != -1) continue;
      col++;
      if (VC[u] == col) col++;
      C[e.idx] = col;
      VC[e.to] = col;
      que.push(e.to);
    }
    k = max(k,col);
  }
  cout << k << endl;
  rep(i,n-1) cout << C[i] << endl;
  return 0;
}

Measured memory_bytes: 7424
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {
    
    new Main().run();
  }

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String op;
      String[] words;
      Tree tree = new Tree();

      for(int i=0,k=0; i<n; i++,k=0){
        words = br.readLine().split(" ");
        op  = words[k++];
        if ( op.equals("insert") ) { 
          tree.insert(Integer.parseInt(words[k++]));
        }
        else {
          tree.dispRoundPath();
        }
      }

    }
    catch(IOException e) {
      System.out.println("IOException!");
    }
  }
}

class Tree {

  static final BTreeNode NIL = new BTreeNode(-1);
  BTreeNode root;
  StringBuilder buf;

  public Tree() {
    root = NIL;
    buf = new StringBuilder();
  }

  public void insert(int val) {
    BTreeNode y = NIL;
    BTreeNode x = root;
    BTreeNode z = new BTreeNode(val);

    while( !x.equals(NIL) ) {
      y = x;
      if( z.key < x.key )
        x = x.left;
      else
        x = x.right;
    }
    z.parent = y;

    if( y.equals(NIL) ){
      root = z;
    }
    else if( z.key < y.key )
      y.left = z;
    else
      y.right = z;
  } 
  void preParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      buf.append(" ").append(u.key);
      preParse(u.left);
      preParse(u.right);
    }
  }
  void inParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      inParse(u.left);
      buf.append(" ").append(u.key);
      inParse(u.right);
    }
  }

  void dispRoundPath() {

    inParse(root);
    buf.append("\n");
    preParse(root);
    buf.append("\n");

    System.out.print(buf);
    buf.setLength(0);
  }
}

class BTreeNode {
  final int key;
  BTreeNode parent,left,right;

  public BTreeNode(int key) {
    this.key = key;
    this.parent =
    this.left =
    this.right = Tree.NIL;
  }

  @Override
  public boolean equals(Object o) {
    if(o == this) return true;
    if(o == null) return false;
    if(!(o instanceof BTreeNode)) return false;

    BTreeNode node = (BTreeNode)o;
    if(!(this.key == node.key)) return false;

    return true;
  }
}


Measured memory_bytes: 126532
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += j
    
    return table
  
n=int(input())
print(sum(num_divisors_table(n)))

Measured memory_bytes: 151524
from bisect import bisect_left, bisect_right

N, M = map(int, input().split())
*A, = map(int, input().split())
A.sort()
ac = [0]*(N+1)
for i in range(1, N+1):
    ac[i] = ac[i-1]+A[i-1]

# ll = []
# for i in A:
#     for j in A:
#         ll.append(i+j)
# ll.sort()

def f(x):
    v = 0
    for i in A:
        v += N-bisect_right(A, x-i)
    return v

def get_nearest(l):
    ans = 10**12
    for i in A:
        res = bisect_right(A, l-i)
        if 0<=res<N:
            ans = min(ans, A[res]+i)
    return ans

l, r = 0, 10**12+1
while r-l>1:
    m = (l+r)//2
    if f(m)>=M:
        l = m
    else:
        r = m

ans = 0
for i in A:
    v1 = N-bisect_right(A, r-i)
    ans += ac[N]-ac[N-v1]+v1*i
ans += (M-f(r))*get_nearest(l)

print(ans)

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

int main(){
  int n;
  cin >> n;
  vector<int> v;
  for(int i=0;i<n;i++){
    int z;
    cin >> z;
    z--;
    v.push_back(z);
  }
  int now = 0, c= 0;
  for(;;)
  {
    if(now == 1){
      cout << c << endl;
      break;
    }
    if(c >= n)
    {
      cout << -1 << endl;
      break;
    }
    c++;
    now = v[now];
  }
}


Measured memory_bytes: 892
K=int(input())
A,B =map(int,input().split())
# ans = K
# i = 1

# while True:
#     if(ans >=A and ans<=B): # もし飛距離(Kの倍数)が範囲の中に入っていたら、OK
#         print("OK")
#         break
#     if(ans > B): # 飛距離が上限より大きくなったら、NG
#         print("NG")
#         break
#     ans = K *i
#     i += 1

print("OK") if(A<= (B//K)*K) else print("NG")

Measured memory_bytes: 9000
#include <iostream>
#include <bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define INF 1000000000
#define MOD 1000000007
#define M 998244353
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define int ll
#define endl "\n"
#define fori(i, a, b) for(i=a; i<b; i++)
#define ford(i, a, b) for(i=a; i>b; i--)
using namespace std;
const ll N = 500043;
ll fact[N];
ll add(ll x, ll y)
{
	x += y;
	while(x >= MOD) x -= MOD;
	while(x < 0) x += MOD;
	return x;
}
ll mul(ll x, ll y)
{
	return (x * 1ll * y) % MOD;
}
ll mulmod(ll a, ll b)
{
    ll res = 0;
    a = a % MOD;
    while (b>0)
    {
        if (b % 2 == 1)
            res = (res + a) % MOD;
        a = (a * 2) % MOD;
        b /= 2;
    }
    return res % MOD; 
}
ll binpow(ll x, ll y)
{
	ll z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = mul(z, x);
		x = mul(x, x);
		y /= 2;
	}
	return z;
}
ll inv(ll x)
{
	return binpow(x, MOD - 2);
}
ll divide(ll x, ll y)
{
	return mul(x, inv(y));
}
void precalc()
{
	fact[0] = 1;
	ll i;
	fori(i, 1, N)
		fact[i] = mul(i, fact[i - 1]);
}
ll C(ll n, ll k)
{
	if(k > n)
	    return 0;
	return divide(fact[n], mul(fact[n-k], fact[k]));
}
ll arr[10];
ll prod()
{
    ll v=1, i;
    fori(i, 0, 10)
        v*=arr[i];
    return v;
}

int solve()
{
   int a, b;
   cin >> a >> b;
   int p = a*b;
   return p;
}
signed main()
{
    io
    int t;
    t=1;
    // cin >> t;
    while(t--)
        cout << solve() << endl;
        // solve();
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

struct restaurant
{
    int p, poz;
    char s[101];
} rest[101];

bool verif(restaurant &r1, restaurant &r2)
{
    if(strcmp(r1.s, r2.s)<0 || strcmp(r1.s, r2.s)==0 && r1.p>r2.p)
        return true;
    else
        return false;
}

int main()
{
    int n, i;
    cin>>n;
    for(i=1; i<=n; i++)
    {
        cin>>rest[i].s>>rest[i].p;
        rest[i].poz=i;
    }
    sort(rest+1, rest+n+1, verif);
    for(i=1; i<=n; i++)
        cout<<rest[i].poz<<endl;
}


Measured memory_bytes: 256
A = list(map(int, input().split()))
b = [[0, 1], [2, 1], [2, 0]]
l = 0
n = []
for i, j in b:
    l = l + abs(A[j]-A[i])
    n.append(abs(A[j]-A[i]))
l = l - max(n)
print(l)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
namespace io{
	const int l=1<<20;
	char buf[l],*s,*t;
	inline char gc(){
		if(s==t){
			t=(s=buf)+fread(buf,1,l,stdin);
			return s==t?EOF:*s++;
		}
		return *s++;
	}
	char c;
	template<class IT>inline void gi(IT &x){
		x=0;c=gc();while(c<'0'||c>'9')c=gc();
		while('0'<=c&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=gc();}
	}
};
using io::gi;
template<class IT>inline void _int(      IT &a,      IT &b  ){if(a>b)swap(a,b);}
template<class IT>inline void cmin(      IT &a,const IT &b=0){if(a>b)a=b;}
template<class IT>inline void cmax(      IT &a,const IT &b=0){if(a<b)a=b;}
template<class IT>inline IT   _min(const IT &a,const IT &b=0){return a>b? b:a;}
template<class IT>inline IT   _max(const IT &a,const IT &b=0){return a<b? b:a;}
template<class IT>inline IT   _abs(const IT &a              ){return a<0?-a:a;}

const int N=205;

int d[N][N],vis[N],n0,f;
void dfs(int v){
	int x=vis[v];int y=x^3,i=1;
	for(;i<=n0;++i)if(d[v][i]==1){
		if(vis[i]==x){f=1;return;}
		else if(!vis[i]){vis[i]=y;dfs(i);}
	}
}
char s[N];
int main(){
//	freopen("b.in","r",stdin);
//	freopen("b.out","w",stdout);
	int n,i,j,k,z=0;
	scanf("%d",&n);n0=n;
	for(i=1;i<=n;++i){
		scanf("%s",s+1);
		for(j=1;j<=n;++j)if(s[j]=='1')d[i][j]=1;else d[i][j]=N;
		d[i][i]=0;
	}
	for(i=1;i<=n;++i)if(!vis[i]){vis[i]=1;dfs(i);if(f){printf("-1");return 0;}}
	for(k=1;k<=n;++k)for(i=1;i<=n;++i)for(j=1;j<=n;++j)cmin(d[i][j],d[k][i]+d[k][j]);
	for(i=1;i<=n;++i)for(j=1;j<=n;++j)if(d[i][j]!=N)cmax(z,d[i][j]);
	printf("%d",z+1);
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class C
{
	public static void Main()
	{
		int N = GetInt();
		long[] A = new long[N];
		long[] B = new long[N];
		long[] C = new long[N];
		for(int i = 0; i < N; i++)
		{
			A[i] = GetLong();
			B[i] = GetLong();
			C[i] = A[i] + B[i];
		}
		Array.Sort(C);
		Array.Reverse(C);

		long ans = - B.Sum();
		for(int i = 0; i < N; i += 2)
			ans += C[i];

		Console.WriteLine(ans);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 17604
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
ll dp[110][5][2] = {};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string K;
    ll D;
    cin >> K >> D;
    ll keta = K.size();
    dp[0][0][0] = 1;
    rep(i,0,keta){
        rep(j,0,D+1){
            ll d = K[i] - '0';
            rep(k,0,d+1){
                if(k == d){
                    if(k == 0){
                        dp[i+1][j][0] += dp[i][j][0];
                    }else{
                        dp[i+1][j+1][0] += dp[i][j][0];
                    }
                    // dp[i+1][(j+k)%D][0] %= MOD;
                }else{
                    if(k == 0){
                        dp[i+1][j][1] += dp[i][j][0];
                    }else{
                        dp[i+1][j+1][1] += dp[i][j][0];

                    }
                    // dp[i+1][(j+k)%D][1] %= MOD;
                }
            }
            rep(k,0,10){
                if(k == 0){
                    dp[i+1][j][1] += dp[i][j][1];

                }else{
                    dp[i+1][j+1][1] += dp[i][j][1];
                }
                // dp[i+1][(j+k)%D][1] %= MOD;
            }
        }
    }
    ll ans = (dp[keta][D][0] + dp[keta][D][1]);
    print(ans);


    

}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m;
    cin>>n;
    int N[n];
    for(int i=0;i<n;i++){
        cin>>N[i];
    }
    cin>>m;
    int M[m];
    for(int i=0;i<m;i++){
        cin>>M[i];
    }
    int sum=0;
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            if(M[i]==N[j]){
                sum++;
                break;
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define N 100100
using namespace std;
vector<int> g[N];
int deg[N],val[N],tv[N];
int id[N],cnt;
bool del[N];
int main(){
	long long ans=0;
	int n,m,x,y;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d%d",&x,&y);
		g[x].push_back(y);
		g[y].push_back(x);
		deg[x]++;
		deg[y]++;
	}
	queue<int> q;
	for(int i=1;i<=n;i++){
		if(deg[i]==1) q.push(i);
		val[i]=1;
	}
	while(!q.empty()){
		int u=q.front();
		q.pop();
		if(deg[u]!=1){
			continue;
		}
		del[u]=true;
		ans+=abs(val[u]);
		for(int i=0;i<g[u].size();i++){
			int v=g[u][i];
			if(del[v]) continue;
			val[v]-=val[u];
			if(--deg[v]==1) q.push(v);
		}
	}
	for(int i=1;i<=n;i++){
		if(!del[i]){
			while(1){
				del[i]=true;
				id[cnt++]=i;
				int nxt=-1;
				for(int j=0;j<g[i].size();j++){
					if(del[g[i][j]]) continue;
					nxt=g[i][j];
					break;
				}
				if(nxt<0) break;
				i=nxt;
			}
			break;
		}
	}
	if(cnt==1){
		if(val[id[0]]) puts("-1");
		else printf("%lld\n",ans);
	}
	else if(cnt&1){
		long long tmp=0;
		for(int i=0;i<cnt;i++){
			tmp+=val[id[i]];
		}
		if(tmp&1) puts("-1");
		else{
			tmp>>=1;
			for(int i=1;i<cnt;i+=2){
				tmp-=val[id[i]];
			}
			for(int i=0;i<cnt;i++){
				ans+=abs(tmp);
				tmp=val[id[i]]-tmp;
			}
			printf("%lld\n",ans);
		}
	}
	else{
		long long tmp=0;
		for(int i=0;i<cnt;i++){
			if(i&1) tv[i]=-tmp;
			else tv[i]=tmp;
			tmp=val[id[i]]-tmp;
		}
		if(tmp) puts("-1");
		else{
			sort(tv,tv+cnt);
			for(int i=0;i<cnt-1-i;i++){
				ans+=tv[cnt-1-i]-tv[i];
			}
			printf("%lld\n",ans);
		}
	}
	return 0;
}

Measured memory_bytes: 7424
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
float PHI = 1.6180339;
const float  PI_F=3.14159265358979f;
#define MAX 1000 m
#define endl "\n"    
#define manhunt 32 
//typedef long long float;
#define int long long
typedef pair<int, int> pii;
//#define float unsigned long long
typedef pair<int, int> pii;
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define CHAR_SIZE 26 
#define pi pair<int,int> 

int modpow(int x, int n, int m) { if (n == 0) return 1%m; long long u = modpow(x,n/2,m); u = (u*u)%m; if (n%2 == 1) u = (u*x)%m; return u; } 


int add(int x, int y) 
{
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
int sub(int x, int y) 
{
	x -= y;
	if (x < 0) return x + MOD2;
	return x;
}
int inv(int a, int m = MOD2)
{
	return modpow(a, m - 2, m);
}
int mul(int a, int b) 
{
	return (long long) a * b % MOD2;
}


int nCrModp(int n, int r, int p) 
{ 
    int C[r+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1; 
    for (int i = 1; i <= n; i++) 
    { 
        for (int j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 


int32_t main()
{
    FAST
    cout << fixed << setprecision(2);
 
    
    int k,n;
    cin>>k>>n;
    int arr[n+10];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    vector<int>diff;
    for(int i=0;i<n-1;i++)
    {
        int x=arr[i+1]-arr[i];
        diff.push_back(x);
    }
    int x=(arr[0]-0)+(k-arr[n-1]);
    diff.push_back(x);
    int tot=0;
    sort(diff.begin(),diff.end());
    /* for(int c:diff)
    cout<<c<<endl; */
    for(int i=0;i<diff.size()-1;i++)
    tot+=diff[i];
    cout<<tot<<endl;


    return 0;
}


//    1 2 1 2 1 2 1 2 1

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


int main() {
    ll a,b,c;
    cin >> a >> b >> c;

    if(a%2 == 0 || b%2==0 || c%2==0){
        pl(0)
    } else {
        pl(min(a*b,min(b*c,c*a)))
    }

    return 0;
}


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

int n, dp[100100][4], a[100100][4];

int solve(int pos, int last) {
	if(pos == n) return 0;
	int &ret = dp[pos][last];
	if(ret != -1) return ret;
	ret = 0;
	for(int i = 0; i < 3; i++) {
		if(last == i) continue;
		ret = max(ret, solve(pos+1, i) + a[pos][i]);
	}
	return ret;
}

int main() {
	cin>>n;
	for(int i = 0; i < n; i++) {
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	memset(dp, -1, sizeof(dp));
	cout<<solve(0, 3)<<endl;
	return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
  string o, e;
  cin >> o >> e;
  if (o.length() == e.length() ) {
    for (int i = 0; i < o.length(); i++) {
      cout << o[i] << e[i];
    }
    cout << endl;
  }
  else {
    cout << o[0];
    for (int i = 0; i < e.length(); i++) {
      cout << e[i] << o[i+1];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
a, b, q = list(map(int, input().split()))
s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]
x = [int(input()) for _ in range(q)]

def bs(z, st):
    l = 0
    r = len(st) - 1
    while r - l != 1:
        m = (l + r) // 2
        if st[m] <= z:
            l = m
        else:
            r = m
    return l

for xi in x:
    tmps = []
    tmpt = []
    if xi <= s[0]:
        tmps.append(s[0] - xi)
    elif s[-1] <= xi:
        tmps.append(s[-1] - xi)
    else:
        tmp = bs(xi, s)
        tmps.append(s[tmp] - xi)
        tmps.append(s[tmp + 1] - xi)

    if xi <= t[0]:
        tmpt.append(t[0] - xi)
    elif t[-1] <= xi:
        tmpt.append(t[-1] - xi)
    else:
        tmp = bs(xi, t)
        tmpt.append(t[tmp] - xi)
        tmpt.append(t[tmp + 1] - xi)
    anss = []
    for i in tmps:
        for j in tmpt:
            if i // abs(i) == j // abs(j):
                anss.append(max(abs(i), abs(j)))
            else:
                maxij = max(abs(i), abs(j)) 
                minij = min(abs(i), abs(j)) 
                anss.append(abs(maxij + minij * 2))
    anss.sort()
    print(anss[0])

Measured memory_bytes: 16160
#include "bits/stdc++.h"
using namespace std;
typedef long long lint;
typedef pair<lint,lint> P;
#define rep(i, n) for (lint i = 0; i < (n); i++)
#define INF LLONG_MAX
#define MAX_V 100005
struct edge{lint to,cost;};
lint n;
vector<edge> vec[MAX_V];
lint d[MAX_V];
void dijkstra(lint k);
void dijkstra2(lint k);
signed main(){
    cin>>n;
    rep(i,n-1){  
        lint a,b,c;
        cin>>a>>b>>c;
        a--;
        b--;
        vec[a].push_back({b,c});
        vec[b].push_back({a,c});
    }          
    lint q,k;
    cin>>q>>k;
    k--;
    dijkstra2(k);
    rep(i,q){
        lint x,y;
        cin>>x>>y; 
        x--;
        y--;
         cout<<d[x]+d[y]<<endl;
    }
    return 0;
}
void dijkstra(lint k){
    priority_queue<P, vector<P>,greater<P> >que;
    fill(d,d+n,INF);
    d[k]=0;
    que.push(P(0,k));
    while(!que.empty()){
        P p=que.top();
        que.pop();
        lint v= p.second;
        if(d[v]<p.first)continue;
        for(lint i=0;i<vec[v].size();i++){
            edge temp=vec[v][i];
            if(d[temp.to]>d[v]+temp.cost){
                d[temp.to]=d[v]+temp.cost;
                que.push(P(d[temp.to],temp.to));
            }
        }
    }
}

void dijkstra2(lint k){
    queue<P>que;
    fill(d,d+n,INF);
    d[k]=0;
    que.push(P(0,k));
    while(!que.empty()){
        P p=que.front();
        que.pop();
        lint v= p.second;
        for(lint i=0;i<vec[v].size();i++){
            edge temp=vec[v][i];
            if(d[temp.to]>d[v]+temp.cost){
                d[temp.to]=d[v]+temp.cost;
                que.push(P(d[temp.to],temp.to));
            }
        }
    }
}


Measured memory_bytes: 10736
#include<iostream>
#include<stdio.h>
using namespace std;
using ll=long long;
#include<algorithm>
#include<set>
#include<vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using P=pair<int,int>;
const int mod=1000000007;

int main(){
int a,b;
cin>>a>>b;
if(a<=b)rep(i,b)cout<<a;
else rep(i,a)cout<<b;
return 0;
}



Measured memory_bytes: 3156
fn main() {
    let mut a: Vec<_> = (0..10)
        .map(|_| {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).unwrap();
            s.trim_right().to_owned().parse::<u32>().unwrap()
        })
        .collect();
    a.sort_by_key(|&x| std::u32::MAX-x);
    for &x in a.iter().take(3) {
        println!("{}", x);
    }
}




Measured memory_bytes: 5024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define _GLIBCXX_DEBUG
static const int MAX = 20;


int main(){
  int N, D, ans, i = 1;
  cin >> N >> D;
  while(true){
    if((2*D+1)*i >= N){
      ans = i;
      break;
    }
    i++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Y cout << "Yes\n"
#define N cout << "No\n"
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define R(i, n) for (int i = 0; i < n; i++)
#define RE(i, a, b) for (int i = a; i >= b; i--)

long long mod = 1000000007 , ans = 1 ;
int p(long long a , long long b)
{
    while(b)
    {
        if(b%2)
        {
            ans = ( (ans%mod)*(a%mod) ) %mod ;
        }
        a = ((a%mod)*(a%mod))%mod ;
        b /= 2 ;
    }
    return ans ;
}


int prime[1000010] ;
void fun()
{
	for (int i = 2; i < 1000001; i++)
	{
		if (prime[i] == 0)
		{
			for (int j = i + i; j < 1000001; j += i)
			{
				prime[j] = 1;
			}
		}
	}
}
int gcd(ll a,ll b)
{
     if(b == 0)
     {
          return a ;
     }
     return gcd(b,a%b) ;
}
int main()
{
     // ios_base::sync_with_stdio(false);
     // cin.tie(NULL);
     ll n , arr[200010] ;
     cin >> n ;
     R(i,n)
     {
          int x ;
          cin >> x ;
          if(i == 0)
          {
               arr[i] = x ;
          }
          else
          {
               arr[i] = x + arr[i-1] ;
          }
     }
     ans = 0 ;
     R(i,n-1)
     {
          ll x = arr[n-1]-arr[i] ;
          ll z ;
          if(i == 0)
          {
               z = ( (x%mod)*(arr[0]%mod) )%mod ;
          }
          else
          {
               z = ( (x%mod)*((arr[i]-arr[i-1])%mod) )%mod ;
          }
          ans = ( (ans%mod) + (z%mod) )%mod ;
     }
     cout << ans << endl ;
}


Measured memory_bytes: 5196
N,M=map(int, input().split())
G=[list() for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G[a].append(b)
    G[b].append(a)
ans=0
index=-1
for i in range(1,N):
    for p in G[i]:
        if index<p<i:
            ans+=1
            index=i-1
import time
time.sleep(1.54)
print(ans)


Measured memory_bytes: 23472
import sys

sys.setrecursionlimit(100000)
from collections import defaultdict

G = defaultdict(list)


N, M = map(int, input().split())
visited = [[False for i in range(N)] for j in range(5)]
for i in range(M):
    v,u = map(int, input().split())
    G[v-1].append(u-1)
    G[u-1].append(v-1)

# 頂点間に奇数長のパスがあるかどうか確認するために 2部グラフ 判定をする
COLOR = [0 for i in range(N)]

def dfs(pos, color):
    global COLOR
    COLOR[pos] = color
    ans = True
    for to in G[pos]:
        if COLOR[to] == color:
            return False
        elif COLOR[to] == 0:
            ans &= dfs(to, -color)
    return ans

if dfs(0, 1):
    count = 0
    for i in COLOR:
        if i == -1:
            count += 1
    another = N-count
    print(count*another-M)
else:
    # 2 部グラフではなかったので、完全グラフから M を引いた値を出力する
    print(N*(N-1)//2-M)


Measured memory_bytes: 52424
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static double gravity = 9.8;

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String in;
    while ((in = reader.readLine()) != null) {
      double minVelocity = Double.parseDouble(in);
      double minHeight = Math.pow(minVelocity, 2) / (2 * gravity);
      System.out.println((int) Math.ceil((minHeight + 5) / 5));
    }
  }

}

Measured memory_bytes: 24232
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        void solve(InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int d = in.nextInt();
            if (Math.abs(c - a) <= d ||
                    (Math.abs(b - a) <= d && Math.abs(c - b) <= d)) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

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

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

Measured memory_bytes: 22996
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;

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

	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;

	if (A + B <= 2 * C) {
		cout << A * X + B * Y << endl;
	}
	else {
		if (X >= Y) {
			cout << 2 * C * Y + min(A,2*C) * (X - Y) << endl;
		}
		else {
			cout << 2 * C * X + min(B,2*C) * (Y - X) << endl;
		}
	}

	return 0;
}

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

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

//C++14 (GCC 5.4.1)

//ユークリッドの互除法
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}
int main() {
    int A,B,K;
    cin >>A>>B>>K;
    
    //-----------------------------------
    bool is=false;
    int gcdab=gcd(A,B);

    vector<int> divisors;
    for (int i = 1; i * i <= gcdab; i++) {
        if (gcdab % i) continue;
        divisors.push_back(i);
        if (i * i != gcdab) divisors.push_back(gcdab / i);
    }
    sort(divisors.begin(),divisors.end());
    cout << divisors[divisors.size()-K] <<endl;
    return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 100000007;
using Graph = vector<vector<int>>;

int main(){
    int A,B;
    cin >> A >> B;
    int ans = -1;
    for(int p = 1; p < 2000;++p){
        int a = p*2;
        a/=25;
        int b = p/10;
        if(a==A&&b==B){
            ans = p;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		if(s.charAt(2)==s.charAt(3)&& s.charAt(4)==s.charAt(5)){
		 System.out.println("Yes");
		}else{
		    System.out.println("No");
		}

	}

}

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

int main(int argc,char* argv[])
{
    int N,K,X,Y;
    cin>>N>>K>>X>>Y;
    if(K>=N) cout<<X*N<<endl;   
    else cout<<X*K+Y*(N-K)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n,m,pre[1010];
queue<int> q;
vector<int> sq[1010],now,ans;

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*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	n=read();m=read();
	rep(i,1,m)
	{
		int u=read(),v=read();
		sq[u].pb(v);
	}
	rep(st,1,n)
	{
		memset(pre,0,sizeof(pre));
		int len=sq[st].size();
		rep(i,0,len-1)
		{
			int v=sq[st][i];
			pre[v]=st;q.push(v);
		}
		while (!q.empty())
		{
			int u=q.front();q.pop();
			if (u==st)
			{
				vector<int> now;now.clear();
				int tmp=pre[st];now.pb(st);
				while (tmp!=st)
				{
					now.pb(tmp);tmp=pre[tmp];
				}
				if ((ans.size()==0) || (ans.size()>now.size())) ans=now;
			}
			int len=sq[u].size();
			rep(i,0,len-1)
			{
				int v=sq[u][i];
				if (pre[v]==0)
				{
					pre[v]=u;q.push(v);
				}
			}
		}
	}
	if (ans.size()==0) puts("-1");
	else
	{
		int len=ans.size();
		printf("%d\n",len);
		per(i,len-1,0) printf("%d\n",ans[i]);
	}
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
 
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define ALL(X)      (X).begin(),(X).end()
typedef long long LL;
 
using namespace std;

#define NMAX 105 
#define WMAX 10005
#define DIAGONAL 1
#define TOP 0

struct Item{
	int value, weight;
};

int N, W;
Item items[NMAX + 1];
int C[NMAX + 1][WMAX + 1], G[NMAX + 1][WMAX + 1];

void compute(int &maxValue, vector<int> &selection){
	FOR(w,0,W+1){
		C[0][w] = 0;
		G[0][w] = DIAGONAL;
	}

	FOR(i,1,N+1){
		C[i][0] = 0;
	}

	FOR(i,1,N+1){
		FOR(w,1,W+1){
			C[i][w] = C[i-1][w];
			G[i][w] = TOP;
			if (items[i].weight > w) continue;
			if (items[i].value + C[i-1][w - items[i].weight] > C[i-1][w]){
				C[i][w] = items[i].value + C[i-1][w - items[i].weight];
				G[i][w] = DIAGONAL;
			}
		}
	}

	maxValue = C[N][W];
	selection.clear();
	for (int i=N, w=W; i>=1; i--){
		if(G[i][w] == DIAGONAL){
			selection.push_back(i);
			w -= items[i].weight;
		}
	}

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


}




void input(){
	cin >> N >> W;
	FOR(i,1,N+1){
		cin >> items[i].value >> items[i].weight;
	}
}

int main(){
	int maxValue;
	vector<int> selection;
	input();
	compute(maxValue, selection);

	cout << maxValue << endl;

	return 0;

}

Measured memory_bytes: 9408
#include <stdio.h>

/* ツマツジツッツクツナツδ督バツーツづ慊づ敖づェツつセツつッツづ姪「ツ妥ィツづ個青ォツ篠ソツ湘」ツ仕ツ陛サツづ按つ「 */

int main(void){
	int cards[13], t, i;
	
	while(1){
		next:
	
		/* init */
		for(i=0; i<13; i++) cards[i]=0;
		
		/* input */
		for(i=0; i<5; i++){
			if(scanf("%d%*c",&t)==EOF) return 0;
			cards[t-1]++;
		}
		
		/* four card */
		for(i=0; i<13; i++)
			if(cards[i]==4){
				puts("four card");
				goto next;
			}
		
		/* full house */
		t=0;
		for(i=0; i<13; i++){
			if((cards[i]==3&&t==2)||(cards[i]==2&&t==3)){
				puts("full house");
				goto next;
			}
			else if(cards[i]>t) t=cards[i];
		}
		
		/* straight */
		for(i=0; i<10; i++){
			for(t=0; t<5; t++) if(!cards[(i+t)%13]) break;
			if(t==5){
				puts("straight");
				goto next;
			}
		}
		
		/* three card */
		for(i=0; i<13; i++)
			if(cards[i]==3){
				puts("three card");
				goto next;
			}
			
		/* two pair */
		t=0;
		for(i=0; i<13; i++)
			if(cards[i]==2) t++;
		if(t){
			if(t==2) puts("two pair");
			else puts("one pair");
			goto next;
		}
		
		puts("null");
	}
}

Measured memory_bytes: 0