akhauriyash/Code-Regression huggingface dataset:
using System;


class UnionFind
{
    /// <summary>
    /// 正の値は親nodeを示す。
    /// 負の値は、そのnodeが根であることと、そのnodeを根とする木のサイズ * (-1) を示す。
    /// </summary>
    public int[] Data;

    public UnionFind(int nNodes=0){
        Data = new int[nNodes];
        for(int i=0; i<nNodes; i++){
            Data[i] = -1;
        };
    }

    /// <summary>
    /// iNode番目のノードが属する木の根の番号を返す。
    /// </summary>
    int FindRoot(int iNode){
        if(Data[iNode] < 0){
            return iNode;
        }else{
            return Data[iNode] = FindRoot(Data[iNode]);
        }
    }

    /// <summary>
    /// iNodeが属する木のサイズを返す
    /// </summary>
    public int Size(int iNode){
        return -Data[FindRoot(iNode)];
    }

    
    /// <summary>
    /// 2つの木をくっつける。
    /// くっつけたらtrue, すでに同一の木であればfalseを返す。
    /// </summary>
    public bool Unite(int i1, int i2){
        i1 = FindRoot(i1);
        i2 = FindRoot(i2);
        if(i1 == i2){
            return false;
        }

        // 木が深くならないように (深くなるとFindの計算量がふえる)、
        // サイズが小さい木をサイズが大きい木へマージする
        int iLarge, iSmall;
        if(i1 > i2){
            // i1, i2 はサイズ * (-1)を表す！
            iLarge = i2;
            iSmall = i1;
        }else{
            iLarge = i1;
            iSmall = i2;
        }
        Data[iLarge] += Data[iSmall];
        Data[iSmall] = iLarge;
        return true;
    }

    /// <summary>
    /// 2つのノードが同一の木に属しているか否かを返す
    /// </summary>
    public bool HasSameRoot(int i1, int i2){
        return FindRoot(i1) == FindRoot(i2);
    }
}

class Program
{
    static void Main(string[] args)
    {
        string[] nmk = Console.ReadLine().Split(' ');
        int 
        N = int.Parse(nmk[0]),
        M = int.Parse(nmk[1]),
        K = int.Parse(nmk[2]);

        UnionFind uf = new UnionFind(N);
        int[] nFriends = new int[N];
        for(int i=0; i<M; i++){
            string[] ab = Console.ReadLine().Split(' ');
            int a = int.Parse(ab[0]) - 1, b = int.Parse(ab[1]) - 1;
            nFriends[a]++;
            nFriends[b]++;
            uf.Unite(a, b);
        }

        int[] nBlockedCands = new int[N];
        for(int i=0; i<K; i++){
            string[] ab = Console.ReadLine().Split(' ');
            int a = int.Parse(ab[0]) - 1, b = int.Parse(ab[1]) - 1;
            if(uf.HasSameRoot(a, b)){
                nBlockedCands[a]++;
                nBlockedCands[b]++;
            }
        }

        for(int i=0; i<N; i++){
            Console.Write(uf.Size(i) - nFriends[i] - nBlockedCands[i] - 1 /* self */);
            Console.Write(i == N-1 ? '\n' : ' ');
        }
    }
}


Measured memory_bytes: 17780
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        String A = "";
        String B = "";
        for (int i = 0; i < Integer.parseInt(b); i++) {
            A += a;
        }
        for (int i = 0; i < Integer.parseInt(a); i++) {
            B += b;
        }
        System.out.print((A.compareTo(B)) < 0 ? A : B);
    }
}

Measured memory_bytes: 22996
#include <map>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <sstream>
#include <vector>
using namespace std;

int main()
{
	int N;
	int L[110];
	cin >> N;
	for (int i = 0; i < N; i++) cin >> L[i];

	sort(L, L + N);
	int tmp = 0;
	for (int i = 0; i < N - 1; i++)
	{
		tmp += L[i];
	}
	if (tmp > L[N - 1])
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;

ll gcd(ll x, ll y) {
    if (x > y) swap(x, y);
    ll m = 1;
    while (m != 0) {
        m = y % x;
        y = x;
        x = m;
    }
    return y;
}

int main() {
    int n;
    cin >> n;
    vector<ll> numbers(n);
    rep(i, n) cin >> numbers[i];

    vector<ll> lr(n);
    vector<ll> rl(n);

    lr.front() = numbers.front();
    rl.back() = numbers.back();

    rep(i, n) {
        if (i == 0)continue;
        lr[i] = gcd(lr[i - 1], numbers[i]);
    }

    rep(i, n) {
        if (i == 0)continue;
        ll j = n - i - 1;

        rl[j] = gcd(rl[j + 1], numbers[j]);
    }


    vector<ll> candidate(n);
    rep(i, n) {
        if (i == 0) {
            candidate[i] = rl[1];
        } else if (i == n - 1) {
            candidate[i] = lr[n - 2];
        } else {
            candidate[i] = gcd(lr[i - 1], rl[i + 1]);
        }
    }

    cout << *max_element(candidate.begin(), candidate.end()) << endl;

}


Measured memory_bytes: 3328
N=int(input())
X=list(map(int,input().split()))
X.sort()
s=X[0]
e=X[-1]
ans=10**10
for i in range(s, e+1):
    tmp=0
    for x in X:
        tmp+=(i-x)**2
    if tmp<ans:
        ans=tmp
print(ans)

Measured memory_bytes: 3064
#include <iostream>
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)
	         {
	            Card t=A[j];
	            A[j]=A[j-1];
	            A[j-1]=t;
	          }
        }
    }
}

void sentaku(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;
	}

      Card t=A[i];
      A[i]=A[minj];
      A[minj]=t;
    }
}

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 Stable(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);
sentaku(C2, N);

print(C1, N);
cout << "Stable" << endl;
print(C2, N);

  if(Stable(C1, C2, N))
  {
    cout << "Stable" << endl;
  }
  else
  {
    cout << "Not stable" << endl;
  }

  return 0;
}



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

int main(){
    int N,Y;
    cin >> N >>Y;

    int ans10000=-1,ans5000=-1,ans1000=-1;
    for(int a=0;a<=N;a++){
        for(int b=0;b<=N;b++){
            int c=N-a-b;
            if(10000*a+5000*b+1000*c==Y&&c>=0){
                ans10000=a;
                ans5000=b;
                ans1000=c;
            }
        }
    }

    cout << ans10000 << " " << ans5000 << " " << ans1000 <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    int ans = power(2, n);
    int num1 = 1, num2 = 1;
    rep(i, a) num1 = Mul(num1, n - i);
    rep(i, a) num1 = Div(num1, i + 1);
    rep(i, b) num2 = Mul(num2, n - i);
    rep(i, b) num2 = Div(num2, i + 1);
    //cout << num1 << "  " << num2 << endl;
    cout << (ans - num1 - num2 + mod * 2 - 1) % mod << endl;

    return 0;
}


Measured memory_bytes: 3660
'use strict';

function Main(input) {
    // N
    // A1 A2 A3...An
    // Q
    // B1 C1
    // B2 C2
    // ...
    // BQ CQ
    let tmp = input.trim().split('\n');
    const N = Number(tmp[0]);
    let A = tmp[1]
        .split(' ')
        .sort((a, b) => a - b)
        .map((v) => BigInt(v));
    const Q = Number(tmp[2]);
    const BC = tmp.splice(3).map((v) => v.split(' ').map((v) => BigInt(v)));

    let arr = new Array(100001).fill(0n);
    for (const v of A) {
        arr[v] += 1n;
    }

    let result = arr.reduce((sum, v, i) => sum + v * BigInt(i));

    for (let i = 0; i < Q; i++) {
        const diff = (BC[i][1] - BC[i][0]) * arr[BC[i][0]];
        result += diff;
        console.log(String(result));

        arr[BC[i][1]] += arr[BC[i][0]];
        arr[BC[i][0]] = 0n;
    }

    return;
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 95004
#include<iostream>
using namespace std;
int main()
{
    string  s;
    cin>>s;
    if(s=="abc"||s=="cba"||s=="bac"||s=="cab"||s=="acb"||s=="bca")
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }



    return 0;
}


Measured memory_bytes: 256
def solve(n, k, s):
    s = list(map(lambda c: c=='L', s))
    i = 1
    while i < n:
        if (k > 0) and (s[i] != s[i-1]):
            l = i
            while (i+1 < n) and (s[i] == s[i+1]):
                i += 1
            r = i
            for j in range(l, r+1):
                s[j] = not s[j]
            k -= 1
        i += 1
    ans = 0
    for i in range(1, n):
        if s[i] == s[i-1]:
            ans += 1
    return ans

n, k = map(int, input().split())
s = input()
print(solve(n, k, s))

Measured memory_bytes: 4084
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
//constexpr ll MOD = 1e9+7;
constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

Vec fac, finv;

ll PowMod(ll a, ll n){
	if(n < 0) return PowMod(PowMod(a, -n), MOD-2);
	if(n == 0) return 1;
	if(n == 1) return a;
	if(n%2 == 0) return PowMod(a*a%MOD, n/2);
	return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll inv(ll a){
	if(a == 1) return 1;
	return PowMod(a, MOD - 2);
}

void init(ll n = 2e6){
	fac.resize(n+1);
	fac[0] = 1;
	repn(i, n) fac[i] = fac[i-1]*i%MOD;
	finv.resize(n+1);
	finv[n] = PowMod(fac[n], MOD-2);
	repr(i, n) finv[i] = finv[i+1]*(i+1)%MOD;
	finv[0] = 1;
}

ll combi(ll n, ll k){
	return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main(void){
	init();
	ll n, m, k;
	cin >> n >> m >> k;
	Vec a(k + 1);
	rep(i, k + 1){
		if(i == 0) a[i] = m * PowMod(m - 1, n - 1) % MOD;
		else a[i] = a[i - 1] * inv(m - 1) % MOD;
	}

	rep(i, k + 1){
		a[i] *= combi(n - 1, i);
		a[i] %= MOD;
	}

	ll ans = 0;
	rep(i, k + 1){
		ans += a[i];
		ans %= MOD;
	}

	if(n - 1 == k && m == 1) co(1);
	else co(ans);

	return 0;
}


Measured memory_bytes: 35948
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(input())

ans = [i for i in range(1, n + 1) if i % 3 != 0 and i % 5 != 0]
print(sum(ans))

Measured memory_bytes: 30424
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>
using namespace std;
typedef  long long int lint;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define P pair<int,int>

const int INF = INT_MAX;

struct SegmentTree {
	int n;
	vector<int> node;

	SegmentTree(const vector<int>& v) {
		int sz = v.size();
		n = 1; while (n < sz) n *= 2;
		node.resize(2 * n - 1, INF);

		//最下段
		for (int i = 0; i < sz; i++) node[i + n - 1] = v[i];
		//親に入れる（下から）
		for (int i = n - 2; i >= 0; i--) node[i] = min(node[2 * i + 1], node[2 * i + 2]);
	}

	void update(int x, int val) {
		x += n - 1;

		node[x] = val;
		while (x > 0) {
			x = (x - 1) / 2;
			node[x] = min(node[2 * x + 1], node[2 * x + 2]);
		}
	}

	int getmin(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;

		if (r <= a || b <= l) return INF;

		if (a <= l && r <= b) return node[k];

		int vl = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
		int vr = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
};


int main() {

	int n, q;
	cin >> n >> q;

	vector<int> v(n);
	for (int i = 0; i < n; i++) {
		v[i] = INF;
	}
	SegmentTree seg(v);

	for (int i = 0; i < q; i++) {
		int qtype;
		cin >> qtype;
		if (qtype == 0) {
			int i, x;
			cin >> i >> x;
			seg.update(i, x);
		}
		else {
			int s, t;
			cin >> s >> t;
			++t;
			cout << seg.getmin(s, t) << endl;
		}
	}

}


Measured memory_bytes: 4124
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author win11905
 */

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define long long long
#define pii pair<int, int>
#define x first
#define y second
using namespace std;
const long MOD = 1e9+7, LINF = 1e18 + 1e16;
const int INF = 1e9+1;
const double EPS = 1e-10;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};


class TaskB {
private:
	string str;
	char A[5];
public:
	void solve(istream& cin, ostream& cout) {
		cin >> str;
		int mn = 1e5;
		for(int i = 0; i < (int)str.size() - 2; ++i) {
			for(int j = 0; j < 3; ++j) A[j] = str[i+j];
			int val;
			sscanf(A, "%d", &val);
			mn = min(mn, abs(val - 753));
		}
		cout << mn << endl;
	}
};

class Solver {
public:
	void solve(std::istream& in, std::ostream& out) {
		TaskB *obj = new TaskB();
		obj->solve(in, out);
	}
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	Solver solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<math.h>

#define DIV 1000000007
using namespace std;
using ll = long long;

typedef struct {
	vector<int> edge;
	int con;
	int clr;
}node_t;
vector<node_t> node;

queue<int> q;


int main(void) {
	int N, K;
	cin >> N >> K;
	
	node = vector<node_t>(N + 1);
	for (int i = 0; i < N-1; i++) {
		int a, b;
		cin >> a >> b;
		node[a].edge.push_back(b);
		node[b].edge.push_back(a);
	}

	vector<bool> visit(N + 1);
	q.push(1);
	visit[1] = true;
	node[1].clr = K;
	ll ans = K;
	bool flag = true;
	while (!q.empty()) {
		int x = q.front();
		q.pop();	
		for (auto to : node[x].edge) {
			if (visit[to]) continue;
			visit[to] = true;
			node[to].clr = K - 1 - node[x].con;
			if (node[to].clr <= 0) {
				flag = false;
				break;
			}
			ans *= node[to].clr;
			ans %= DIV;
			node[x].con++;
			node[to].con++;
			q.push(to);
		}
		if (!flag) {
			break;
		}

	}

	if (flag)
		cout << ans << endl;
	else
		cout << 0 << endl;

}


Measured memory_bytes: 7288
N, K = gets.chomp.split(" ").map(&:to_i)

def forScore(score)
  for i in 0..K
    return i if score >= K
    score = score * 2
  end
end

percentage = []

for i in 1..N
  percentage << (1.0 / N) * (0.5 ** forScore(i))
end

answer = 0

percentage.each do |s|
  answer += s
end

puts answer


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

int main() {

    int n; cin >> n;
    vector<pair<int, int> > v(n);
    rep(i, n){
        int x, l;
        cin >> x >> l;
        v[i].first = x + l; v[i].second = x - l;
    }

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

    int y = -1e9, ans = 0;

    for (auto p : v) {

        if (p.second >= y){
            ans++;
            y = p.first;
        }
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
	int k;
	string s;
	cin >> k >> s;
	if (s.size()<=k) cout << s << endl;
	else{
		for (int i=0; i<k; i++) cout << s[i];
		cout << "..." << endl;
	}
	return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int a, b;
  cin >> a >> b;
  cout << (a ^ b) << endl;
}


Measured memory_bytes: 256
import bisect
N=int(input())
L=sorted(list(map(int,input().split())))

ans=0
for i in range(N-1):
  for j in range(i+1,N):
    ans+=bisect.bisect_left(L,L[i]+L[j])-j-1
    # ans+=bisect.bisect_left(L,L[i]+L[j],j+1)-j-1
print(ans)

Measured memory_bytes: 3188
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    val ans = IntArray(n + 1) { 0 }

    for (x in 1..n) {
        if ((x * x) + (x) + 1 + (1 * x) >= n) break

        for (y in 1..n) {
            if ((x * x) + (y * y) + (x * y) + (y) + (x) >= n) break

            for (z in 1..n) {
                if ((x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x) > n) break

                val count = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x)
                if (count <= n) {
                    ans[count]++
                }
            }
        }
    }
    ans.takeLast(n).forEach {
        println(it)
    }
}

Measured memory_bytes: 40548
ENV[Z='RUBY_THREAD_VM_STACK_SIZE']||exec({Z=>?5*8},'ruby',$0)
p=*0...gets.to_i;s=0;
f=->a{a==p[a]?a: p[a]=f[p[a]]}
a,b=$<.map{|s|s.split.map &:to_i}.transpose.map{|a|a.each_with_index.sort.each_cons(2).map{|(x,i),(y,j)|[y-x,i,j]}};
(a+b).sort_by{|a|a[0]}.each{|c,a,b|(s+=c;p[f[b]]=f[a])if f[a]!=f[b]}
p s

Measured memory_bytes: 92500
#include <iostream>
#include <string>
using namespace std;
 
int main() {
  int a,b; cin>>a>>b;
  if(a==1&&b==2) cout<<3<<endl;
  else if(a==2&&b==1) cout<<3<<endl;
  else if(a==1&&b==3) cout<<2<<endl;
  else if(a==3&&b==1) cout<<2<<endl;
  else if(a==2&&b==3) cout<<1<<endl;
  else if(a==3&&b==2) cout<<1<<endl;
  return 0;
}

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

#define MAX ((int)100000)
#define endl '\n'

using namespace std;

int balls[ MAX ];
bool red[ MAX ];

void initialize(int n){
	for(int i = 0 ; i < n ; i++)
		balls[ i ] = 1, red[ i ] = 0;
	red[ 0 ] = 1;
}

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

	int n, m, x, y, ans = 1;
	cin >> n >> m;
	initialize(n);
	while(m--){
		cin >> x >> y;
		balls[ --x ]--;
		balls[ --y ]++;
		if(red[ x ] && !red[ y ])
			ans++, red[ y ] = 1;
		if(!balls[ x ] && red[ x ])
			red[ x ] = 0, ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 768
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Numerics;
using System.Reflection.Metadata;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics.X86;
using System.Text;
using System.Threading;

namespace AtCoder
{
	public class Program
	{
		public static void Main()
		{
			var nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			int n = nm[0];
			int m = nm[1];

			var ab = new (int a, int b)[n];
			for (int i = 0; i < n; i++) {
				var temp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
				ab[i] = (temp[0], temp[1]);
			}

			Array.Sort(ab, (x, y) => x.a.CompareTo(y.a));
			var q = new Queue<(int a, int b)>();
			foreach (var item in ab) {
				q.Enqueue(item);
			}

			var heap = new (int a, int b)[n];
			int count = 0;

			void Enqueue((int a, int b) item)
			{
				heap[count] = item;
				++count;

				int me = count - 1;
				while (me > 0) {
					int p = (me - 1) / 2;
					if (heap[p].b < item.b) {
						heap[me] = heap[p];
						me = p;
					} else {
						break;
					}
				}

				heap[me] = item;
			}

			(int a, int b) Dequeue()
			{
				var ret = heap[0];
				int n = count - 1;

				var item = heap[n];
				int me = 0;
				int c = me * 2 + 1;
				while (c < n) {
					if (c != n - 1 && heap[c].b < heap[c + 1].b) {
						++c;
					}

					if (item.b < heap[c].b) {
						heap[me] = heap[c];
						me = c;
						c = c * 2 + 1;
					} else {
						break;
					}
				}

				heap[me] = item;
				--count;

				return ret;
			}


			long ans = 0;
			for (int i = m; i >= 0; i--) {
				while (q.Count > 0 && m - i >= q.Peek().a) {
					Enqueue(q.Dequeue());
				}

				if (count > 0) {
					var next = Dequeue();
					ans += next.b;
				}
			}

			Console.WriteLine(ans);
		}
	}
}


Measured memory_bytes: 50316
#include <stdio.h>

main(){
    int n,m,s;
    int i,j;

    scanf("%d %d",&n,&m);

    int a[n][m],b[m];

    for(i=0;i<n*m;i++)
        scanf("%d",&a[0][i]);
    for(i=0;i<m;i++)
        scanf("%d",&b[i]);

    for(i=0;i<n;i++){
        s=0;
        for(j=0;j<m;j++){
            s+=a[i][j]*b[j];
        }
        printf("%d\n",s);

    }

    return 0;

}

Measured memory_bytes: 640
while True:
  a,op,b = input().split()
  a=int(a)
  op=str(op)
  b=int(b)
  
  if op=='?':
    break
  elif  op=='+':
    print("{:d}".format(a+b))
  elif op=='-':
    print("{:d}".format(a-b))
  elif op=='/':
    print("{:d}".format(a//b))
  elif op=="*":
    print("{:d}".format(a*b))


Measured memory_bytes: 5600
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	string S;
	cin >> S;

	int cnt = 0;
	for (int i = 0; i < S.length(); i++) cnt += S[i] - '0';

	cout << S.length() - abs((int)(S.length()) - 2 * cnt);
	return 0;
}

Measured memory_bytes: 512
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto abc = new int[](3);
  readf("%s %s %s\n", &abc[0], &abc[1], &abc[2]);

  auto eo = new int[](3);
  foreach (i; 0..3) {
    eo[i] = abc[i] % 2;
  }
  int num;
  if (eo.sum % 3 != 0) {
    if (eo[0] == eo[1]) {
      abc[0]++;
      abc[1]++;
    } else if (eo[0] == eo[2]) {
      abc[0]++;
      abc[2]++;
    } else {
      abc[1]++;
      abc[2]++;
    }
    num++;
  }

  auto m = max(abc[0], max(abc[1], abc[2]));
  foreach (i; 0..3) {
    while (abc[i] != m) {
      abc[i] += 2;
      num++;
    }
  }
  num.writeln;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

counter = 0
for i in range(n):
    # i-th
    _counter = min(a[i], b[i])
    a[i] -= _counter
    counter += _counter

    left_b = b[i] - _counter
    if left_b > 0:
        __counter = min(left_b, a[i + 1])
        a[i + 1] -= __counter
        counter += __counter

print(counter)


Measured memory_bytes: 82148
maxDiff :: (Num a, Ord a) => [a] -> a
maxDiff (x:xs) = iter (x,x) xs where
    iter (h,l) [] = h - l
    iter (h,l) (m:ms)
        | m > h = iter (m,l) ms
        | l > m = iter (h,m) ms
        | otherwise = iter (h,l) ms

main = getContents >>= print . maxDiff . map (read :: String -> Double) . lines

Measured memory_bytes: 3896
import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*

fun main() {
    val jin = BufferedReader(InputStreamReader(System.`in`))
    val (n, k, s, t) = jin.readLine().split(" ").map { it.toInt() }
    val choose = Array(n + 1) { LongArray(n + 1) }
    choose[0][0] = 1L
    for (a in 1..n) {
        choose[a][0] = 1L
        choose[a][a] = 1L
        for (b in 1 until a) {
            choose[a][b] = choose[a - 1][b] + choose[a - 1][b - 1]
        }
    }
    val chooseSums = LongArray(n + 1)
    for (a in 0..n) {
        for (b in 1..k) {
            chooseSums[a] += choose[a][b]
        }
    }
    val tokenizer = StringTokenizer(jin.readLine())
    val array = IntArray(n) { tokenizer.nextToken().toInt() }
    val addends = mutableListOf<Pair<Int, Long>>()
    for (mask in 0 until (1 shl 18)) {
        if ((mask and s) == s && (mask or t) == t) {
            val groups = mutableMapOf<Int, Int>()
            for (a in array) {
                if ((a and s) == s && (a or t) == t) {
                    groups[a and mask] = (groups[a and mask] ?: 0) + 1
                }
            }
            var local = 0L
            for (amt in groups.values) {
                local += chooseSums[amt]
            }
            addends.add(Pair(Integer.bitCount(mask xor s), local))
        }
    }
    var answer = 0L
    addends.sortBy { it.first }
    for (addend in addends) {
        if (addend.first % 2 == 0) {
            answer += addend.second
        } else {
            answer -= addend.second
        }
    }
    println(answer)
}

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

using namespace std;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define int long long
#define ll long long
#define lson node<<1
#define rson (node<<1)+1
#define endl "\n"

const int maxn=2e6+10;
const ll mod=1e9+7;
const double pi=acos(-1);

ll qpow(ll a,ll n)
{
    ll b=1;
    while(n)
    {
        if(n&1)
            b=b*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return b;
}
int gcd(int a,int b)
{
    return b?gcd(b,a%b):a;
}
int lcm(int a,int b)
{
    return a*b/gcd(a,b);
}
//int prime[maxn],s,v[maxn];
//void prime_init()
//{
//    for(int i=2; i<=maxn; i++)
//    {
//        if(!v[i])
//        {
//            prime[s++]=i;
//            for(int j=1; j*i<=maxn; j++)
//                v[i*j]=1;
//        }
//    }
//}

signed main()
{
    int n;
    cin>>n;
    if(n>=30)
        cout<<"Yes";
    else 
        cout<<"No";
    return 0;
}


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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		String str = input.readLine();
		String[] list = str.split(" ");
		if(list[0].equals(list[1])) {
			System.out.println(list[2]);
		}else if(list[0].equals(list[2])) {
			System.out.println(list[1]);
		}else {
			System.out.println(list[0]);
		}
	}
}


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

int main() {
     double N,K;
     double ret=0;
    cin >> N >> K;

    for(int i=1;i<=N;i++){
        double temp =1/N;
         int now=i;
         while(now<K){
             now*=2;
             temp/=2;
         }
         ret+=temp;
    }

cout << fixed << setprecision(15) << ret << endl;
return 0;
}

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

using namespace std;

typedef long long ll;

ll n;
ll x[500005];
ll i,j;
ll ans;
ll num;
ll a,b;


int main(){
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> x[i];
		if(x[i] % 2 == 0)a++;
		if(x[i] % 2 == 1)b++;
	}
	if(a == 0 || b == 0){
		cout << 0 << endl;
		return 0;
	}
	if(b%2==1){
		cout << n-1 << endl;
	}else{
		cout << n-2 << endl;
	}
	return 0;
}



Measured memory_bytes: 4616
#include<cstdio>
#include<iostream>
#include<string>
using namespace std;
static const int H = 8;
static const int W = 8;

string s[H];

int dy[8] = {0, -1, -1, -1, 0, 1, 1, 1};
int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
char ch[2] = {'o', 'x'};

bool inside(int y, int x){
	return y >= 0 && y < H && x >= 0 && x < W;
}

int main(){
	for(int i = 0; i < H; i++) cin >> s[i];
	int cnt = 0;
	int turn = 0;
	for(;;){
		if(cnt >= 2) break;
		cnt++;
		int y = -1, x = -1, num = 0;
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				int cy = i, cx = j;
				if(turn == 0){
					cy = H - i - 1;
					cx = W - j - 1;
				}
				if(s[cy][cx] == 'o' || s[cy][cx] == 'x') continue;
				int num2 = 0;
				for(int k = 0; k < 8; k++){
					int ny = cy + dy[k];
					int nx = cx + dx[k];
					int cnt2 = 0;
					while(inside(ny, nx) && s[ny][nx] == ch[(turn + 1) % 2]){
						ny += dy[k];
						nx += dx[k];
						cnt2++;
					}
					if(inside(ny, nx) && s[ny][nx] == ch[turn]) num2 += cnt2;
				}
				if(num2 >= num){
					y = cy;
					x = cx;
					num = num2;
				}
			}
		}
		turn = (turn + 1) % 2;
		if(num == 0) continue;
		cnt = 0;
		s[y][x] = ch[(turn + 1) % 2];
		for(int i = 0; i < 8; i++){
			int cy = y + dy[i];
			int cx = x + dx[i];
			while(inside(cy, cx) && s[cy][cx] == ch[turn]){
				cy += dy[i];
				cx += dx[i];
			}
			if(inside(cy, cx) && s[cy][cx] == ch[(turn + 1) % 2]){
				int cy2 = y + dy[i];
				int cx2 = x + dx[i];
				for(;;){
					if(inside(cy2, cx2) && s[cy2][cx2] == ch[(turn + 1) % 2]) break;
					s[cy2][cx2] = ch[(turn + 1) % 2];
					cy2 += dy[i];
					cx2 += dx[i];
				}
			}
		}
	}
	for(int i = 0; i < H; i++) cout << s[i] << endl;
	return 0;
}



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

int main(){
  int n;cin>>n;
  vector<long long> arr(n);
  for(int i=0;i<n;++i)cin>>arr[i];
  sort(arr.begin(),arr.end());
  int index = lower_bound(arr.begin(),arr.end(),0)-arr.begin();
  vector<pair<int,int>> steps;
  int l,r;
  long long result = 0;

  if(index==0){
    for(int j=1;j<n-1;++j){
      steps.push_back(make_pair(arr[0],arr[j]));
      arr[0] = arr[0]-arr[j];
    }
    steps.push_back(make_pair(arr[n-1],arr[0]));
    result = arr[n-1]-arr[0];
    
  }else if(index == arr.size()){
    for(int j=n-2;j>=0;--j){
      steps.push_back(make_pair(arr[n-1],arr[j]));
      arr[n-1] = arr[n-1]-arr[j];
    }
    result = arr[n-1];
    }else{ 
    for(int j=index;j<n-1;++j){
      steps.push_back(make_pair(arr[0],arr[j]));
      arr[0] = arr[0]-arr[j];
    }
    
    for(int j=0;j<index;++j){
       steps.push_back(make_pair(arr[n-1],arr[j]));
       arr[n-1] = arr[n-1]-arr[j];     
    }
    result = arr[n-1];
  } 
  
  cout<<result<<endl;
  for(auto i:steps){
    cout<<i.first<<" "<<i.second<<endl;
  }
  return 0;
}

Measured memory_bytes: 3572
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
using ll = long long;
using uint = unsigned;
using ull = unsigned long long;
using P = pair<int,int>;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int n; cin >> n;
    rep(i,3) {
        int t = n%10;
        if (t==7) {
            cout<<"Yes" << endl;
            return 0;
        }
        else n/=10;
    }
    cout <<"No" << endl;
    return 0;
}



















Measured memory_bytes: 3620
#include<iostream>
using namespace std;
int main()
{
	long long a[300];
	int x;	cin>>x;
	for(int i=1;i<=x;i++)
		cin>>a[i];
	for(int i=1;;i++)
	{
		for(int j=1;j<=x;j++)
		{
			if(a[j]%2==1)
			{
				cout<<i-1<<endl;
				return 0;
			}
		}
		for(int j=1;j<=x;j++)
			a[j]/=2;
	}
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int n, tmp_d;
    int card[4][13];
    for(int i=0; i<4; i++){
        for(int l=0; l<13; l++) card[i][l] = 0;
    }
    char tmp_c, dummy;
    scanf("%d\n", &n);
    for(int i=0; i<n; i++){
        scanf("%c %d\n", &tmp_c, &tmp_d);
        if(tmp_c=='S') card[0][tmp_d-1] = 1;
        else if(tmp_c=='H') card[1][tmp_d-1] = 1;
        else if(tmp_c=='C') card[2][tmp_d-1] = 1;
        else card[3][tmp_d-1] = 1;
    }
    for(int i=0; i<4; i++){
        for(int l=0; l<13; l++){
            if(!card[i][l]){
                if(!i) printf("S %d\n", l+1);
                else if(i==1) printf("H %d\n", l+1);
                else if(i==2) printf("C %d\n", l+1);
                else printf("D %d\n", l+1);
            }
        }
    }
    return 0;
}


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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int32_t main()
{
    IOS
    string s,t;
    int ans=0;
    cin>>s>>t;
    for (int i=0;i<3;i++) if (s[i]==t[i]) ans++;
    cout<<ans<<endl;
}



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

using namespace std;
using ull = unsigned long long;

int main() {
    map<string, int> si;
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        string tmp;
        cin >> tmp;
        ++si[tmp];
    }

    map<string, int> ti;
    int M;
    cin >> M;
    for (int i = 0; i < M; ++i) {
        string tmp;
        cin >> tmp;
        ++ti[tmp];
    }

    int ans = 0;
    for (const auto& s : si) {
        ans = max(ans, s.second - ti[s.first]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 504
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace lean
{
    class Program
    {
        static void Main()
        {
            //long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            string S = Console.ReadLine();
            int N=S.Length;
            if (S.Substring(0, (N - 1)/2) == S.Substring((N + 3) / 2 - 1, (N - 1) / 2))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1LL<<60;
long double pi=3.14159265358979323846L;
double eps=1e-12;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    int a[n];
    deque<int> dq;
    rep(i,0,n){
        cin>>a[i];
        if(i%2)dq.push_front(a[i]);
        else dq.push_back(a[i]);
    }
    if(n%2==1)reverse(dq.begin(),dq.end());
    rep(i,0,n)cout<<dq[i]<<" ";
    cout<<endl;
}







Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
bool ispali(string s)
{
    ll i,j,k,l=s.length();
    i=0;
    j=l-1;
    while(i<l/2)
    {
        if(s[i]!=s[j])
        return false;
        i++;
        j--;
    }
    return true;
}
int main()
{
    ll t,i,j,k,l,m,n,o,p,q,r,s,a[100002];
    cin>>l;
    ll ans=0;
      
    long double an,kk,ll;
    ll=l;
    ll=ll/3;
    an=ll*ll*ll;
    
    cout<<fixed<<setprecision(16)<<an<<endl;
    return 0;
}

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

int main() {
	string s;cin>>s;
	if(s[0]!='A'){
		cout<<"WA"<<endl;
		return 0;
	}
	int count=0;
	for(int i=2;i<s.size()-1;i++){
		if(s[i]=='C')count++;
	}
	if(count!=1){
		cout<<"WA"<<endl;
		return 0;
	}
	count=0;
	for(int i=0;i<s.size();i++){
		if(s[i]<'a'){
			count++;
		}
//		cout<<int(s[i])<<endl;
	}
	if(count!=2){
		cout<<"WA"<<endl;
	}else{
		cout<<"AC"<<endl;
	}
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;
typedef vector<pp> vpp;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define all(e) (e).begin(), (e).end()
#define pb push_back


template <typename T>
void printV(vector<T> A) {
    if (A.empty()) cerr << "EMTPY\n";
    else { 
        cerr << "[";
        for (int i = 0; i < A.size() -1 ; ++i) {
            cerr << A[i] << ", ";
        }
        if (A.size()) cerr << A.back() << "]\n";
    }
}


template <typename T>
void printVV(vector<vector<T>> A) {
    cerr << "[";
    for (auto v : A) {
        printV<T>(v);
    }
    cerr << "]";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&& ...args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}

int main(int argc, char **argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x; cin >> x;
    ll b = 100, ans = 0;
    while (b < x) {
        ans += 1;
        b = b + 0.01 * b;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3652
import math
n, d = map(int, input().split())
x = [list(map(int,input().split())) for _ in range(n)]
counter = 0
for i in range(n):
    for j in range(i+1, n):
        dif = [(x[i][di] - x[j][di])**2 for di in range(d)]
        sumdif = sum(dif)
        if sumdif == int(math.sqrt(sumdif))**2:
            counter += 1
print(counter)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
int main()
{
    int n,y,a,b,c;
    int ans1=-1,ans2=-1,ans3=-1;
    cin>>n>>y;
    for(a=0;a<=n;a++){
        for(b=0;a+b<=n;b++){
            c=n-a-b;
            int ttl=10000*a+5000*b+1000*c;
            if(ttl==y)
            ans1=a,ans2=b,ans3=c;
        }
    }
    cout<<ans1<<" "<<ans2<<" "<<ans3<<endl;
    return 0;
}

Measured memory_bytes: 256
from typing import List


def answer(n: int, w: List[str]) -> str:
    if len(set(w)) != len(w):
        return 'No'

    for i in range(1, len(w)):
        if not w[i].startswith(w[i - 1][-1]):
            return 'No'

    return 'Yes'


def main():
    n = int(input())
    w = [input() for _ in range(n)]
    print(answer(n, w))


if __name__ == '__main__':
    main()


Measured memory_bytes: 10260
#include<stdio.h>

int main(void)
{
   int n,a[100],index,tmp,alice=0,bob=0;
   int i,j;

   scanf("%d",&n);
   for(i=1;i<=n;i++)
      scanf("%d",&a[i]);

   for(i=1;i<n;i++){
     index = i;
     for(j=i+1;j<=n;j++){
       if(a[j]>a[index])
         index = j;
     }
     tmp = a[i];
     a[i] = a[index];
     a[index] = tmp;
   }

   for(i=1;i<=n;i=i+2){
      alice = alice + a[i];
   }
   for(i=2;i<=n;i=i+2)
       bob = bob + a[i];
   a[0] = alice -bob;

   printf("%d\n",a[0]);
   return 0;
}


Measured memory_bytes: 128
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;

//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int a,b;
  cin >> a >> b;

  if(a == b){
  	for(int i = 0; i < a ; i++){
  		cout << a;
  	}
  	cout << endl;
  	return 0;
  }
  else if(a < b){
  	for(int i = 0 ; i < b; i++){
  		cout << a;
  	}
  	cout << endl;
  	return 0;
  }
  else{
  	for(int i = 0 ; i < a; i++){
  		cout << b;
  	}
  	cout << endl;
  	return 0;
  }

  //check types
  //do not eb if you resize
  //resize before you access by idx
  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 print(n) cout << n << endl
#define in(v) int v; cin >> v
#define vint vector<int>
#define pb push_back
typedef long long int ll;


int main(){
  string t;cin>>t;
  if(t.size()==1){
    if(t[0]=='?'){
      t[0]='D';
    }
    print(t);
    return 0;
  }
  for(int i=0;i<t.size()-2;i++){
    if(t[i+1]=='?'){
      if(t[i]=='P'){
        t[i+1]='D';
      }else if(t[i]=='D'){
        if(t[i+2]=='?'){
          t[i+2]='D';
          t[i+1]='P';
        }else if(t[i+2]=='D'){
          t[i+1]='P';
        }else{
          t[i+1]='D';
        }
      }else{
        t[i+1]='D';
      }
    }
  }
  if(t[0]=='?')t[0]='D';
  if(t[t.size()-1]=='?'){
    t[t.size()-1]='D';
  }
  print(t);
  return 0;
}

Measured memory_bytes: 3752
/*
      author : nishi5451
      created: 12.08.2020 14:23:17
*/

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


int main(){
    string s;
    cin >> s;
    if(s.size()==3)
        reverse(s.begin(),s.end());
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3636