akhauriyash/Code-Regression huggingface dataset:
if __name__ == '__main__':
    def judge(x):
        if x % 4 == 0:
            return x
        elif x % 4 == 1:
            return 1
        elif x % 4 == 2:
            return x + 1
        else:
            return 0

    a, b = map(int, input().split())
    fa = judge(a - 1)
    fb = judge(b)
    print(fa ^ fb)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll n; cin >> n;
  //1-indexed
  vector<ll> a(n+1);
  REP(i,n) cin >> a[i+1];
  vector<ll> b(n+1), ans;
  IFOR(i,1,n+1){
    b[i] = a[i];
    for(ll j= 2*i; j<=n; j+=i){
      b[i] ^= b[j];
    }
    if(b[i]) ans.push_back(i);
  }
  ll m = SZ(ans);
  cout << m << endl;
  REP(i,m) cout << ans[i] << " \n"[i==m-1];
}



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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
#define P pair<int, int>
struct data{
	int place;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
};
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};



int main(){
	int a, b;
	cin >> a >> b;
	cout << a + b/2 << endl;

	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]

A.sort()
BC.sort(key=lambda x:x[1], reverse=True)

a_i = 0
is_fin = False
for b, c in BC:
    if is_fin:
        break

    for _ in range(b):
        if A[a_i] < c:
            A[a_i] = c 
            a_i += 1
            if a_i >= len(A):
                is_fin = True
                break
        else:
            is_fin = True
            break

print(sum(A))


Measured memory_bytes: 81492
package main
import "fmt"
func main(){
    for i:=1;i<10;i++{
        for j:=1;j<10;j++{
            fmt.Print(i)
            fmt.Print("x")
            fmt.Print(j)
            fmt.Print("=")
            fmt.Println(i*j)
        }
    }
}



Measured memory_bytes: 1052
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string str;
    getline(cin, str);

    int res = str.size();
    for (size_t i = 0; i + 1 < str.size(); i += 1) {
        if (str[i] != str[i + 1]) {
            res = min<int>(res, max(i + 1, str.size() - i - 1));
        }
    }

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <stdio.h>
#include <cmath>
#include <tgmath.h>

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

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


int main() {
    ll n;
    cin>>n;

    ll ans=0;

    ans+=(n/500)*1000;

    n%=500;

    ans+=(n/5)*5;

    cout<<ans<<endl;

}


Measured memory_bytes: 256
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define inf INT_MAX/3
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 3.141592653589793
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define FOR(i,a,b) for( int i=(a),_b=(b);i<=_b;i++)
#define DOW(i,b,a) for( int i=(b),_a=(a);i>=_a;i--)
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
#define N 20000009
bool prime[N];
vector<ll> prm;
void seive ()
{

    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {
        if (prime[i] == true)
        {
            prm.pb(i);
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
}
void pr (int f)
{
    if(f==1)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}
int main()
{
    fast;
    string a,b;
    cin>>a>>b;
    string x= a+b;
    int f=0;
    ll num= tolong(x);
    ll sq= sqrt(num);
    if(sq*sq==num) f=1;
    pr(f);
    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int MOD=1000000007;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;


int main(){
	int n,m,k[11],p[11],s[11][11],ans=0;
	bool light[10]={},swi[10]={};
	cin>>n>>m;
	rep(i,0,m){
		cin>>k[i];
		rep(j,0,k[i])cin>>s[i][j];
	}
	rep(i,0,m)cin>>p[i];
	rep(i,0,1<<n){
		rep(z,0,10)light[z]=swi[z]=false;
		rep(j,0,n){
			if(1&i>>j){
				swi[j]=true;
			}
		}
		rep(j,0,m){
			int tmp=0;
			rep(l,0,k[j])if(swi[s[j][l]-1]==true)tmp++;
			if(tmp%2==p[j])light[j]=true;
		}
//		rep(z,0,m)cout<<light[z]<<" ";
//		cout<<endl;
		rep(j,0,m){
			if(light[j]!=true)break;
			if(j==m-1)ans++;
		}
	}
	cout<<ans<<endl;

}


Measured memory_bytes: 256
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#include<vector>
#include<set>
#include<map>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=200010;
int a[N],n;
int main()
{
    cin>>n;
    int last=0;
    ll res=0;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++)
    {
        if(a[i]<last) res+=last-a[i];
        else last=a[i];
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 4360
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;
string   s; 
void fun(int ans,int idx,string cur){
	if (idx>3 and ans==7) cout <<cur << "=7",exit(0);
	if (idx>3) return;
	fun(ans+(s[idx]-'0'),idx+1,cur+'+'+s[idx]);
	fun(ans-(s[idx]-'0'),idx+1,cur+'-'+s[idx]);
}

signed main()
{
    cin>>s;
    string h;
    h=s[0];
    fun(s[0]-'0',1,h);
    h= "-"; h += s[0];
    fun(-(s[0]-'0'),1,h);
    return 0;
}


Measured memory_bytes: 3588
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        if(A > 8 || B > 8){
            System.out.println(":(");
        }else{
            System.out.println("Yay!");
        }
    }
}


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

ll n, a, b;

int main(){
	scanf("%lld %lld %lld", &n, &a, &b);
	if(a > b) swap(a, b);
	if((b - a) % 2 == 0){
		printf("%lld\n", (b - a) / 2ll);
		return 0;
	}else{
		printf("%lld\n", min((n * 2 - a - b + 1ll) / 2ll, (a + b - 1ll) / 2ll));
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
import collections
import sys
sys.setrecursionlimit(2*10**5)
I = [int(_) for _ in open(0).read().split()]
N = I[0]
AB = I[1:]
G = collections.defaultdict(set)
for a, b in zip(AB[::2], AB[1::2]):
    G[a].add(b)
    G[b].add(a)
color = [None] * (N + 1)


def dfs(G, v, cur):
    color[v] = cur
    for w in G[v]:
        if color[w] is None:
            dfs(G, w, 1 - cur)


dfs(G, 1, 0)
c=collections.Counter(color[1:])
cand1 = set(range(1, N + 1, 3))
cand2 = set(range(2, N + 1, 3))
cand3 = set(range(3, N + 1, 3))

i0, i1 = 0, 1
if c[0] > c[1]:
    i0, i1 = 1, 0

ans = [None] * (N + 1)
if c[i0] <= len(cand3):
    for i in range(1, N + 1):
        if color[i]==i0:
            ans[i] = cand3.pop()
        else:
            if cand1:
                ans[i] = cand1.pop()
            elif cand2:
                ans[i] = cand2.pop()
            elif cand3:
                ans[i] = cand3.pop()
else:
    for i in range(1, N + 1):
        if color[i] == i0:
            if cand2:
                ans[i] = cand2.pop()
            elif cand3:
                ans[i] = cand3.pop()
        else:
            if cand1:
                ans[i] = cand1.pop()
            elif cand3:
                ans[i] = cand3.pop()
print(*ans[1:])


Measured memory_bytes: 206204
<?php
list($a,$b) = explode(" ",trim(fgets(STDIN)));
if($a == 1){
$a = 14;
}
if($b == 1){
$b = 14;
}
if($a == $b){
echo "Draw";
}elseif($a > $b){
echo "Alice";
}else{
echo "Bob";
}

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

using namespace std;

int main()
{
    int x = 0, a = 0, b = 0;
    while (cin >> x >> a >> b) {
        if (abs(x - a) > abs(x - b)) cout << "B" << endl;
        else cout << "A" << endl;
    }
}

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

struct Card {char suit, value;};;

void bubble(struct Card A[], int N){
    for(int i = 0; i < N ; i++){
        for(int j = N-1; j >=i+1;  j--){
            if(A[j].value < A[j-1].value){
                swap(A[j], A[j-1]);
            }
        }
    }
} 

void selection(struct Card A[], int N){
    for(int i = 0; i < N; i++){
        int minj = i;
        for(int j = i; j < N; j++){
            if(A[j].value < A[minj].value) minj = j;
        }
        swap(A[i], A[minj]);
    }
}

void print(struct Card A[], int N){
    for(int i = 0; i < N; i++){
        if(i > 0) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N){
    for(int i = 0; i < N; i++){
        if(C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

int main(){
    Card C1[100], C2[100];
    int N;
    char ch;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> C1[i].suit >> C1[i].value;
    }
    for(int i = 0; i < N; i++) C2[i] = C1[i];
    bubble(C1, N);
    selection(C2, N);
    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);
    if(isStable(C1, C2, N)){
        cout << "Stable" << endl;
    }
    else{
        cout << "Not stable" << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid
/// ye tec khaphan ke yadam bemone : age jayi didi soale masir hamiltoni mikhad rasasho bokon yal oilery;
/// age ye ja mikhasti to dp az ozv i k ta entekhab koni bejash ye log bezan (nominal) hamoon 2**k va o 1 ent kon

///\\\///\\\///\\\\\\\\\\\\\\\\\///\\\///\\\///

const int N=410,mod=1e9+7;
ll a[N];
int32_t main(){
    sync;
    string s;
    cin >> s;
    ll n=s.size();
    for (int i=0;i<n-1;i++){
        if (s[i]==s[i+1]){
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
    }
    for (int i=0;i<n-2;i++){
        if (s[i]==s[i+2]){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << endl;

}


















Measured memory_bytes: 512
N, M = map(int, input().split())

if (N == 1):
  if (M == 1):
    print(1)
  else:
    print(M-2)
elif (N == 2):
  print(0)
else:
  if (M == 1):
    print(N-2)
  elif (M == 2):
    print(0)
  else:
    print((N-2)*(M-2))


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

using namespace std;
typedef long long ll;



int N,Q;
vector<vector<int>> to;
vector<int> ans;


void dfs(int u, int v = -1){
    
    for (int i:to[u]) {
        if(i==v) continue;
        ans[i] += ans[u];
        dfs(i,u);
    }
    
}


int main()
{
    cin >> N >> Q;
    to.resize(N);
    rep(i,N-1){
        int a,b;
        cin >> a >> b;
        a--,b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    
    ans.assign(N,0);
    
    rep(i,Q){
        int p,x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }
    
    
    dfs(0);
    rep(i,N) cout << ans[i] << " ";
    cout << endl;
    
    return 0;
}



Measured memory_bytes: 23552
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
string u = "RDLU";

int h,w;
int k;
vector<string> s;
bool visited[20][20];
char ans[100];

bool dfs(int x,int y,int c,int d){
    if(c==k) return true;
    for (int i = 0; i < 4; i++) {
        if(d == (i + 2)%4) continue;
        int nx = x, ny = y;
        bool f = false;
        while(0 <= nx && nx < w && 0 <= ny && ny < h){
            if(!visited[ny][nx]&&s[ny][nx] == 'o'){
                f = true;
                break;
            }
            ny += dy[i];
            nx += dx[i];
        }
        if(!f) continue;
        visited[ny][nx] = true;
        if(dfs(nx,ny,c+1,i)){
            ans[c] = u[i];
            return true;
        }
        visited[ny][nx] = false;
    }
    return false;
}


int main(){
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        string t;cin >> t;
        s.pb(t);
    }
    int d = 0;
    int sx,sy;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if(s[i][j] == '.') continue;
            if(s[i][j] == 'o') k++;
            else{
                if(s[i][j] == 'R') d = 0;
                else if(s[i][j] == 'L') d = 2;
                else if(s[i][j] == 'D') d = 1;
                else if(s[i][j] == 'U') d = 3;
                sx = j,sy = i;
            }
        }
    }
    dfs(sx,sy,0,d);
    for (int i = 0; i < k; i++) {
        cout << ans[i];
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3216
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <deque>
using namespace std;

const int maxn = 2e5 + 5;

vector<int> G[maxn];

typedef long long LL;

struct data{
	LL a,b,c;
	data(LL a = 0,LL b = 0,LL c = 0):a(a),b(b),c(c){}
};

deque<data> dp[maxn];

const LL mod = 1e9 + 7;

LL qpow(LL a,LL n){
	LL ret = 1;
	while(n > 0){
		if(n & 1){
			ret = ret * a % mod;
		}
		a = a * a % mod;
		n >>= 1;
	}
	return ret;
}


int n;
int cnt[maxn];

void pre(int u,int dep){
	cnt[dep]++;
	for(auto v : G[u]){
		pre(v,dep + 1);
	}
}

void solve(int u,int dep){
	deque<data> & now = dp[u];
	for(auto v : G[u]){
		solve(v,dep + 1);
		if(dp[v].size() > now.size())
			swap(now,dp[v]);
	}
	int mx = 0;
	for(auto v : G[u]){
		mx = max(mx,(int) dp[v].size());
		for(int i = 0;i < dp[v].size();i++){
			LL tmpa = (now[i].a * dp[v][i].a) % mod;
			LL tmpb = (now[i].a * dp[v][i].b + now[i].b * dp[v][i].a) % mod;
			LL tmpc = (now[i].b * dp[v][i].b + now[i].c * (dp[v][i].a + dp[v][i].b)) % mod;
			now[i].a = tmpa;
			now[i].b = tmpb;
			now[i].c = tmpc;
		}
	}
	for(int k = 0;k < mx;k++){
		now[k].a = (now[k].a + now[k].c) % mod;
		now[k].c = 0LL;
	}
	now.push_front(data(1LL,1LL,0LL));
}

int main(){
	cin >> n;
	for(int i = 1;i <= n;i++){
		int x;
		scanf("%d",&x);
		G[x].push_back(i);
	}	
	pre(0,0);
	solve(0,0);
	LL res = 0;
	for(int i = 0;i < dp[0].size();i++){
		res = (res + dp[0][i].b * qpow(2,n + 1 - cnt[i]) % mod) % mod;
	}
	cout << res << endl;
	return 0;
}



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

using namespace std;

int main() {
    while (true) {
        int ans = 0;
        int n, x;
        cin >> n >> x;
        if (n == 0 && x == 0) {
            break;
        }
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                for (int k = 1; k <= n; k++) {
                    if (i >= j || j >= k) {
                        continue;
                    }
                    if (i + j + k == x) {
                        ans++;
                    }
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3096
N = int(input())
S = []
for i in range(N):
  temp = str(input()); temp = list(temp)
  S.append(temp)
ans = 0
for alpha in range(-N+1,N): #-N+1 ~ N-1
  #print(alpha)
  Flag = True
  for i in range(N):
    if not Flag:
      break
    for j in range(N):
      p = (j-alpha+N)%N
      q = (i+alpha)%N
      #print(alpha,S[i][j],p,q,S[p][q])
      if S[i][j] != S[p][q]:
        Flag = False
        break
  if Flag:
    ans += N - abs(alpha)
print(ans)        

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n, q;
string s;

int acc[MAX_N];

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &q);

  cin >> s;

  int cnt_ac = 0;

  acc[0] = 0;

  for (int i = 1; i <= n - 1; ++i) {
    if (s[i] == 'C' && s[i - 1] == 'A') cnt_ac += 1;

    acc[i] = cnt_ac;
  }

  for (int i = 0; i < q; ++i) {
    int l, r;
    scanf("%d %d", &l, &r);

    int tmp = acc[r - 1] - acc[l - 1];

    printf("%d\n", tmp);
  }

  return 0;
}


Measured memory_bytes: 1408
s = $stdin.gets

s = s.split

for e in 0...s.length
    s[e] = s[e].to_i
end

result = ""
for i in 0..s[0]
    for j in 0..s[0]-i
        k = s[0] - i - j
        if i + j + k == s[0] && 10000*i + 5000*j + 1000*k == s[1] then
                result = i.to_s + " " + j.to_s + " " + k.to_s
            end
    end
end

result = "-1 -1 -1"  if result == ""

print result

Measured memory_bytes: 1788
#include<stdio.h>

int main(){
  int N;
  scanf("%d", &N);

  int i, B[N];

  for(i = 0; i < N; i++){
    scanf("%d", &B[i]);
  }

  for(i = 0; i < N; i++){
    if(B[i] > i + 1){
      printf("-1\n");
      return 0;
    }
  }
  
  int j, k;
  int A[N];
  int c[2];

  for(i = 0; i < N; i++){
    j = 0;
    k = 0;
    c[0] = 0;
    c[1] = 0;
    while(k < N){
      if(B[k] == j + 1 && B[k] > c[0]){
        c[0] = B[k];
        c[1] = k;
        //printf("%d %d\n", c[0], c[1]);
      }
      if(B[k] != 0){
        j++;
      }
      k++;
    }
    A[N - 1 - i] = c[0];
    B[c[1]] = 0;
  }

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

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string s;
    cin >> s;
    cout << string(s.length(), 'x') << endl;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
    int n; std::cin >> n;
    int four = 0, two = 0, other = 0;
    for (int i = 0; i < n; i++) {
        int a = 0; std::cin >> a;
        if ((a%4) == 0) {
            four++;
        } else if ((a%2) == 0) {
            two++;
        } else {
            other++;
        }
    }
    bool ret = false;
    if ((other <= four) || ((other == four+1) && two == 0)) {
        ret = true;
    }

    std::cout << ((ret)?"Yes":"No") << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N,K; cin >> N >> K; int ans=0; int cnt=0;
    string S; cin >> S;
    rep(i,N-1){
       if(S[i]==S[i+1]) ans++;
       else cnt++;
    }
    if(cnt%2==0) ans+=min(cnt/2,K)*2;
    else if(cnt/2+1<=K) {int a=cnt/2; ans+=a*2+1;}
    else ans+=K*2;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
	string s;
	cin>>s;
	string t;
	cin>>t;
	ll fl=0;
	for(ll i=0;i<s.size();i++)
	{
		if(s[i]!=t[i])
		fl=1;
	}
	if(fl==1)
	cout<<"No"<<endl;
	else
	{
		cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

template<typename T> bool chmax( T &a, T b ) { if ( a < b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, T b ) { if ( a > b ) { a = b; return ( true ); } else { return ( false ); } }

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp( a, b ) make_pair( a, b )
#define mt( ... ) make_tuple( __VA_ARGS__ )

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()

#define MOD ( (ll)( 1e9 + 7 ) )


int main()
{
	ll X, Y, Z, K;
	cin >> X >> Y >> Z >> K;

	vector<ll> A( X ), B( Y ), C( Z );
	rep( i, X ) { cin >> A[i]; }
	rep( i, Y ) { cin >> B[i]; }
	rep( i, Z ) { cin >> C[i]; }

	// A/B/Cを降順ソート
	sort( ALL( A ), greater<ll>() );
	sort( ALL( B ), greater<ll>() );
	sort( ALL( C ), greater<ll>() );

	// A/B/Cからそれぞれi/j/k番目のケーキを選ぶパターンを
	// i * j * k <= K となるように全て選び、最後にソートする
	vector<ll> res;
	rep( i, X )
	{
		rep( j, Y )
		{
			rep( k, Z )
			{
				if ( ( i + 1 ) * ( j + 1 ) * ( k + 1 ) <= K )
				{
					res.eb( A[i] + B[j] + C[k] );
				}
				else
				{
					break;
				}
			}
		}
	}

	sort( ALL( res ), greater<ll>() );

	rep( i, K )
	{
		cout << res[i] << endl;
	}

	return ( 0 );
}


Measured memory_bytes: 1404
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
using pqueg = priority_queue<int, vector<int>, greater<int>>;
using pquel = priority_queue<int, vector<int>, less<int>>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
int lcm(int a, int b){
  return a / __gcd(a, b) * b;
}
int r_int(int a, int b){
  return rand() % b + a;
}
const lint mod=1e9+7;

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

  if(s.size() > k){
    s = s.substr(0,k);
    s.append("...");
  }

  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 3628
//#pragma comment(linker, "/STACK:36777216")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <sstream>
#include <vector>
#include <complex>
#include <ctime>
#include <stack>

//#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector< VI > VVI;
typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define REP(i, n) for(int i = 0; i < (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define FOR(i, x, y) for(int i = (x); i <= (y); ++i)
#define RFOR(i, y, x) for(int i = (x); i >= (y); --i)
#define SZ(a) (int)(a).size()
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a)) 
#define CLEAR(x) memset(x, 0, sizeof x);
#define COPY(FROM, TO) memcpy(TO, FROM, sizeof TO);
#define UNIQUE(c) SORT(c),(c).resize(unique(ALL(c))-(c).begin())
#define pb push_back
#define mk make_pair
#define sqr(x) ((x)*(x))
#define X first
#define Y second
//typedef tree<int, null_type, less<int>, 
//  rb_tree_tag, tree_order_statistics_node_update> order_set;

const long double PI = acos(-1.0);
const double EPS = 1E-6;
const int INF = 2 * (1e+9) + 1;
const int MAXN = 3 * 100000001;
const int MOD = (1e+9) + 7;


ll n, m, k;
string s;
int main() {
    //freopen("a.txt", "r", stdin);
    cin >> s;
    REP(i, s.length()) {
        if (s[i] == '7') {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 3044
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう！
int main(){
    int n;
    std::cin >> n;
    VEC(ll,a,n);
    std::vector<ll> b(a);
    
    rep(i,n){
        a[i]+=(i+1);
    }
    rep(i,n){
        b[i]=(i+1)-b[i];
    }
    /*rep(i,n){
        ppri(a[i],b[i]);
    }*/
    std::map<ll, ll> m,mm;
    rep(i,n){
        m[a[i]]++;
    }
    rep(i,n){
        mm[b[i]]++;
    }
    ll ans=0;
    erep(i,m){
        ans+=i.se*mm[i.fi];
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 40592
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int gcd(int a,int b){

   if(a%b == 0)
    return b;
   else
    return gcd(b,a%b);

 }

 long long numbers[500005];

 int main(){

 string s;
 cin>>s;

  int n = s.length();

   numbers[0] = 0;

   long long sum=0;
   for(int i=0;i<n;i++)
   {
          if(s[i] == '<')
          numbers[i+1] = numbers[i]+1;
   }

   for(int i=n-1;i>=0;i--){
      if(s[i]== '>')
     {
         if(numbers[i] <= numbers[i+1] )
            numbers[i] = numbers[i+1]+1;
      }
   }


   for(int i=0;i<=n;i++)
    sum = sum+numbers[i];


   cout<<sum<<endl;


 return 0;
 }


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

using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    ll k; cin >> k;
    vector<ll> v;
    rep(i, 10)v.push_back(i);
    ll x = 10, y = 9;
    for (int i = 0; i < v.size(); i++)
    {
        if (x == 100000000000)break;
        ll z = v[i] / (x/10);
        if (z > 0)v.push_back((z-1)*x + v[i]);
        v.push_back(z*x+v[i]);
        if (z < 9)v.push_back((z+1)*x + v[i]);
        if (v[i] == y){
            y += x*9;
            x *= 10;
        }
    }
    sort(v.begin(), v.end());
    int cnt = 0;
    ll memo = -1;
    for (int i = 0; i < v.size(); i++)
    {
        if (v[i] == memo)continue;
        if (cnt == k){
            cout << v[i] << endl;
            return 0;
        }
        cnt++;
        memo = v[i];
    }
    
}

Measured memory_bytes: 11616
import java.util.Map.Entry;
import java.io.*;
import java.util.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		String S = sc.next() + "!";
		String p = "AKIHABARA!";
		int index = 0;
		
		if(S.length() < 6){
			System.out.println("NO");
			return;
		}
		
		for(int i = 0; i < p.length(); i++){
			if(S.charAt(index) == p.charAt(i)){
				index++;
				continue;
			}else{
				char c = S.charAt(index);
				if(p.charAt(i) == 'A' && (c == 'K' || c == 'B' || c == 'R' || c == '!')){
					continue;
				}else{
					System.out.println("NO");
					return;
				}
			}
		}
		
		System.out.println("YES");
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


Measured memory_bytes: 22740
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true){
			String[] tmpArray = br.readLine().split(" ");
			
			int n = Integer.parseInt(tmpArray[0]);
			int w = Integer.parseInt(tmpArray[1]);
			int d = Integer.parseInt(tmpArray[2]);
			
			if(n == 0 && w == 0 && d == 0){
				break;
			}
			
			int[][] cut = new int[n][2];
			
			for(int i = 0; i < n; i++){
				tmpArray = br.readLine().split(" ");
				
				cut[i][0] = Integer.parseInt(tmpArray[0]);
				cut[i][1] = Integer.parseInt(tmpArray[1]);
			}
			solve(w, d, cut);
		}
	}
	
	static void solve(int w, int d, int[][] cut){
		ArrayList<Piece> list = new ArrayList<Piece>();
		list.add(new Piece(w, d));
		
		int n = cut.length;
		
		for(int i = 0; i < n; i++){
			Piece[] child = list.get(cut[i][0] - 1).cut(cut[i][1]);
			list.remove(cut[i][0] - 1);
			list.add(child[0]);
			list.add(child[1]);
			
			//debug
//			System.out.println("i = "+i);
//			Iterator<Piece> it = list.iterator();
//			while(it.hasNext()){
//				Piece p = it.next();
//				
//				System.out.print(p.w*p.d);
//				if(it.hasNext()){
//					System.out.print(" ");
//				}
//			}
//			System.out.println();
		}
		
		Collections.sort(list);
		
		//output
		Iterator<Piece> it = list.iterator();
		while(it.hasNext()){
			Piece p = it.next();
			
			System.out.print(p.w*p.d);
			if(it.hasNext()){
				System.out.print(" ");
			}
		}
		System.out.println();
	}
}

class Piece implements Comparable<Piece>{
//	int id;
	int w;
	int d;
	
	public Piece (int w, int d){
//		this.id = id;
		this.w = w;
		this.d = d;
	}

	@Override
	public int compareTo(Piece p) {
		return this.w*this.d - p.w*p.d;
	}
	
	public Piece[] cut(int pos){
		Piece[] child = new Piece[2];
		pos %= 2*(w+d);
		//垂直カット
		if(pos < w || (pos > w + d && pos < w*2 + d)){
			if(pos > w){
				pos -= w + d;
			}
			
			if(pos*d <= (w - pos)*d){
				child[0] = new Piece(pos, d);
				child[1] = new Piece(w - pos, d);
			}
			else {
				child[1] = new Piece(pos, d);
				child[0] = new Piece(w - pos, d);
			}
		}
		//水平カット
		else{
			if(pos > w*2 + d){
				pos -= w + d;
			}
			
			if(w*(pos - w) <= w*(d - pos + w)){
				child[0] = new Piece(w, pos - w);
				child[1] = new Piece(w, d - pos + w);
			}
			else {
				child[1] = new Piece(w, pos - w);
				child[0] = new Piece(w, d - pos + w);
			}
		}
		
		return child;
	}
}



Measured memory_bytes: 32784
#include <cstdio>
#include <cmath>

long long dp[11][2][8];

int main()
{
  char s[12];
  scanf("%s", s);
  dp[0][0][0] = 1;
  int i;
  for (i = 0; s[i]; ++i)
  {
    int D = s[i] - '0';
    for (int j = 0; j < 2; ++j)
    {
      for (int m = 0; m < (1 << 3); ++m)
      {
        for (int k = 0; k <= (j ? 9 : D); ++k)
        {
          if (k != 3 && k != 5 && k != 7) continue;
          dp[i + 1][j || k < D][m | (k == 3 ? 1 : k == 5 ? 2 : 4)] += dp[i][j][m];
        }
      }
    }
  }
  long long ans = 0;
  for (long long j = 3; j < (long long)i; ++j)
  {
    ans += (long long)std::pow(3, j) - 3 * (long long)std::pow(2, j) + 3;
  }
  printf("%lld\n", dp[i][0][7] + dp[i][1][7] + ans);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
#define N 1005
#define LL long long

int x,y,z,k;
LL maxsum;
LL a[N],b[N],c[N];
int fa,fb,fc;
LL cal(int aa,int bb,int cc)
{
	return a[aa]+b[bb]+c[cc];
}
struct comb
{
	int a,b,c;
	comb(int x,int y,int z)
	{
		a=x;
		b=y;
		c=z;
	}
	bool operator<(const comb& x) const
	{
		return cal(a,b,c)<cal(x.a,x.b,x.c);
	}	
};
priority_queue<comb> q;

void dig(int typ)
{
	(!typ)?fa++:(typ==1)?fb++:fc++;
	for(int i=0;i<=((!typ)?fb:(typ==1)?fc:fa);i++)
	for(int j=0;j<=((!typ)?fc:(typ==1)?fa:fb);j++)
		q.push((!typ)?comb(fa,i,j):(typ==1)?comb(j,fb,i):comb(i,j,fc));
} 

int main()
{
	
	cin>>x>>y>>z>>k;
	for(int i=0;i<x;i++)
		cin>>a[i];
	for(int i=0;i<y;i++)
		cin>>b[i];
	for(int i=0;i<z;i++)
		cin>>c[i];
	sort(a,a+x);
	reverse(a,a+x);
	sort(b,b+y);
	reverse(b,b+x);
	sort(c,c+z);
	reverse(c,c+x);
	
	q.push(comb(0,0,0));
	while(k--)
	{
		comb p=q.top();
		cout<<a[p.a]+b[p.b]+c[p.c]<<'\n';
		q.pop();
		if(p.a==fa && fa!=x-1) dig(0);
		if(p.b==fb && fb!=y-1) dig(1);
		if(p.c==fc && fc!=z-1) dig(2);
	}
		
	return 0;
}

Measured memory_bytes: 26728
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 
using namespace std;
int main()
{
    long long a,b,c,d;

    while (~scanf("%lld %lld %lld %lld", &a,&b,&c,&d)) {
        auto gnum = [&](long long x, long long y,long long z) {
            return y/z - (x-1)/z;
        };

        long long lcm = c*d / __gcd(c,d);

        printf("%lld\n", b-a+1 - (gnum(a,b,c) + gnum(a,b,d) - gnum(a,b,lcm)));
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
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; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
long long MOD = 1000000007;


template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}

long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }

long long dp[200100];

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

    int ans = max({a,b,c}) - min({a,b,c});

    cout << ans << endl;
}



Measured memory_bytes: 3632
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
	if(one[0] <= one[1]){
		myout("unsafe");
	}else{
		myout("safe");
	}
}

Measured memory_bytes: 29632
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------


typedef long long ll;
ll N;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;

    rep(h, 1, 3501) rep(n, 1, 3501) {
        // 4/N = 1/h + 1/n + 1/w
        
        ll up = N * h * n;
        ll dow = 4LL * h * n - N * n - N * h;
        if (dow == 0) continue;
        if (up % dow != 0) continue;
        ll w = up / dow;
        if (0 < w && w <= 3500) {
            printf("%d %d %lld\n", h, n, w);
            return;
        }
    }
}

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

int main(){
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  cout << vec.at(N/2) - vec.at(N/2 - 1);
}

Measured memory_bytes: 3712
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;
import std.range;
import core.stdc.stdlib;
import std.math;

void main() {
  int[] answers;
  answers ~= readln.chomp.to!int;
  answers ~= readln.chomp.to!int;
  answers = answers.sort().array;

  if (answers[0] == 1 && answers[1] == 2) writeln(3);
  if (answers[0] == 1 && answers[1] == 3) writeln(2);
  if (answers[0] == 2 && answers[1] == 3) writeln(1);
}


Measured memory_bytes: 256
N, K, Q = map(int, input().split())
A = list()
for _ in range(Q):
    A.append(int(input()))

N_count = [0] * N
for a in A:
    N_count[a-1] += 1

for n in N_count:
    if K - (Q - n) > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 8640
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ld T, X;
  cin >> T >> X;
  ld ans = T / X;
  COUTF(ans);
  return 0;
}

Measured memory_bytes: 256
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
a, b, c = [list(i) for i in zip(*l)]
dp = [[0, 0, 0] for i in range(n+1)]
for i in range(n):
    dp[i+1][0] = max(dp[i][1]+a[i], dp[i][2]+a[i])
    dp[i+1][1] = max(dp[i][0]+b[i], dp[i][2]+b[i])
    dp[i+1][2] = max(dp[i][0]+c[i], dp[i][1]+c[i])
print(max(dp[-1][0], dp[-1][1], dp[-1][2]))


Measured memory_bytes: 52360
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void output(vector<int> a);
int main(void){
	int n;
	int q;
	//int index=0;

	
	int count=0;
	cin >> n;
	vector<int> S(n);
	
	for(int i=0 ; i< n; i++){
		cin >> S[i];
	}
	
	
	cin >> q;
	vector<int> T(q);
	for(int i=0 ; i< q; i++){
		cin >> T[i];
	}
	
	
	/*for(int i=0 ; i< q; i++){
		if(i!=0){
			if(T[i-1]>T[i]){
				n=index;
				index
			}
			
		}
	}*/
		
		//for(int j=index ; j< n; j++){
			
	for(int i=0 ; i< q; i++){
			if (std::binary_search (S.begin(), S.end(), T[i])){
				count++;
				//break;
				//index =j;
				
			}
			
		}
	
	
	cout << count<< endl;
}

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

using namespace std;

#define i64 int64_t
#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define fore(i,a) for (auto &i : a)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-10;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

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

int cntAC[100001];
int cum[100001];

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;

    for (int i = 0; i < n - 1; ++i) {
        if (s[i] == 'A' && s[i + 1] == 'C') cntAC[i + 1] = 1;
    }
    
    /*
    for (int i = 0; i < n; ++i) {
        cout << cntAC[i] << endl;
    }
    */

    cum[0] = 0;
    for (int i = 1; i < n; ++i) {
        cum[i] = cum[i - 1] + cntAC[i];
    }

    rep(i, q) {
        int l, r;
        cin >> l >> r;
        cout << cum[r - 1] - cum[l - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1872
#include<iostream>
using namespace std;
int main(){
int n,i=1;
	long long max=-1000000,min=1000000,sum=0,a;
	cin>>n;
	while(i<=n){
			cin>>a;
			if(a<min) min=a;
			if(a>max) max=a;
			sum+=a;
			i++;
		}
		cout<<min<<" "<<max<<" "<<sum<<endl;
		return 0;
		}
		
			

Measured memory_bytes: 1172
#include <stdio.h>

int main(void)
{
	int a,b[21],c[21],i,sum=0;
	scanf("%d",&a);
	
	for(i=0;i<a;i++){
		scanf("%d",&b[i]);
	}
	for(i=0;i<a;i++){
		scanf("%d",&c[i]);
	}
	for(i=0;i<a;i++){
		if(b[i]-c[i]>0)sum=sum+b[i]-c[i];
	}
	
	printf("%d\n",sum);
	
	return 0;
}


Measured memory_bytes: 128