akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>

#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

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

using namespace std;

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}
template<typename T>
T lcm( T m, T n )
{
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;

    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

long long dp[52][52][2600];

int main() {
    int N,A;
    long long ans=0;
    map<long long, int> P;
    cin >> N >>A;
    vector<long long>a(N+1,0);

    for(int i=1; i<=N; i++){
        cin >> a[i];
    }

    for(int j=0; j<=N; j++){
        for(int k=0; k<=N; k++){
            for(int s=0; s<=2501; s++){
                if(j==0 && k==0 && s==0){
                    dp[j][k][s]=1;
                }else if(j>=1 && s<a[j]){
                    dp[j][k][s]=dp[j-1][k][s];
                }else if(j>=1 && k>=1 && s>=a[j]){
                    dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-a[j]];
                }else{
                    dp[j][k][s]=0;
                }
            }
        }
    }

    for(int i=1; i<=N; i++){
        ans+=dp[N][i][i*A];
    }

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



Measured memory_bytes: 54016
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
#include<iomanip>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp(a, b) make_pair(a, b)
#define mt(a,b,c) make_tuple(a,b,c)
#define rank qwertyuio
#define next dfghjk
#define plus fsghsf
#define minus ytryr
#define pb push_back
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
 
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int mod = (int)1e9 + 7;
const int mod1 = (int)1e9 + 9;
const int mod2 = 998244353;
const int mod3 = (int)1e6+3;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;
 
 
ll binary_search(vector<ll> arr,ll val,ll l,ll r){
    ll m=l+(r-l)/2;
    if(l>=r){
        return l;
    }
    if(val<arr[m]){
        return binary_search(arr,val,l,m);
    }
    else{
        return binary_search(arr,val,m+1,r);
    }
}//return position less than
ll binary_search2(vector<ll> arr,ll val,ll l,ll r){
    ll m=l+(r-l)/2;
    if(l>=r){
        return l;
    }
    if(val<=arr[m]){//changed here
        return binary_search2(arr,val,l,m);
    }
    else{
        return binary_search2(arr,val,m+1,r);
    }
}//return position less than or equal
ll power(ll x, ll y) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % mod;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % mod; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll n) 
{ 
    return power(n, mod-2); 
}
ll gcdl(ll a ,ll b){ 
    if (a == 0) 
        return b;  
    return gcdl(b % a, a);  
 }

int main()
{   ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int h,w,n;
    cin>>h>>w>>n;
    if(h>=w){
        if(n%h){
            cout<<n/h+1;
        }
        else{
            cout<<n/h;
        }
    }
    else{
        if(n%w){
        cout<<n/w+1;
        }
        else{
            cout<<n/w;
        }
    }

    return 0;
             
    
}

Measured memory_bytes: 256
s=input()
front=[]
back=[]
ans="Yes"
for i in range((len(s)-1)//2):
  front.append(s[i])
for i in range((len(s)+3)//2-1,len(s)):
  back.append(s[i])
back.reverse()
if front!=back:
  ans="No"

fro=[]
bac=[]
if len(front)%2!=0 and len(front)!=1:
  for i in range((len(front)-1)//2):
    fro.append(front[i])
  for i in range((len(front)+3)//2-1,len(front)):
    bac.append(front[i])
  bac.reverse()
  if fro!=bac:
    ans="No"
elif len(front)%2==0:
  for i in range(len(front)//2):
    fro.append(front[i])
  for i in range(len(front)//2,len(front)):
    bac.append(front[i])
  bac.reverse()
  if fro!=bac:
    ans="No"

print(ans)

Measured memory_bytes: 38384
while(n=gets.to_i)>0
e=Hash.new{|h,k|h[k]=[]}
l=(1..n).map{i,j=gets.split.map(&:to_i);e[i][j]=1;[i,j]}
m=0
l.each{|i,j|
l.each{|t,u|
x=t-i
y=u-j
m=[m,x**2+y**2].max if (i!=j||t!=u)&&i>-y&&j>x&&t>-y&&u>x&&e[i+y][j-x]&&e[t+y][u-x]
}
}
p m
end

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

int main() {
  long min[2048];
  long xs[2048];
  long n, x;
  scanf("%ld %ld", &n, &x);
  for(int i = 1; i <= n; ++i) {
    scanf("%ld", &xs[i]);
    min[i] = xs[i];
  }

  long res = (1LL << 50);
  for(int d = 0; d < n; ++d) {
    // step 1 : update min
    for(int i = 1; i <= n; ++i) {
      min[i] = std::min(min[i], xs[(i - d + 100 * n - 1) % n + 1]);
    }
    // step 2 : calctemp
    long temp = d * x;
    for(int i = 1; i <= n; ++i) {
      temp += min[i];
    }
    // step 3 : min
    res = std::min(res, temp);
  }
  printf("%ld\n", res);
  
  return 0;
}



Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;

public class Main {
	public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		Map<Integer, Integer> m = new HashMap<Integer, Integer>();
		Map<Integer, Integer> m2 = new HashMap<Integer, Integer>();

		int cnt = 0;

		sc.nextLine();
		String tmp = "";
		int no = 0;
		String AC = "";
		for (int i = 0; i < M; i++) {
			tmp = sc.nextLine();
			no = Integer.parseInt(tmp.split(" ")[0]);
			AC = tmp.split(" ")[1];

			if (m.get(no) == null) {
				if (AC.equals("AC")) {
					m.put(no, 1);
					m2.put(no, 0);
				} else {
					m.put(no, 0);
					m2.put(no, 1);
				}
			} else {
				if (AC.equals("AC") && m.get(no) != 1) {
					m.put(no, 1);
				} else if (AC.equals("WA") && m.get(no) == 0) {
					m2.put(no, m2.get(no) + 1);
				}
			}
		}

		int ansCnt = 0;
		int wacnt = 0;
		for (int key : m.keySet()) {
			if (m.get(key) == 1) {
				ansCnt++;
				wacnt += m2.get(key);
			}
		}

		System.out.println(ansCnt + " " + wacnt);

	}
}


Measured memory_bytes: 159408
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <list> 
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<string>
#include<fstream>
#include<set>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define ld long double
#define vi vector<int>
#define vll vector<long long>
#define pi pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define B begin()
#define E end()
#define S size()
#define m9 1000000007
#define endl "\n"
using namespace std;
 
 

 
ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powmod(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = powmod(x, y/2, m) % m; 
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
} 

 
ll mul_inv(ll a, ll b) {
    ll b0 = b, t, q;
    ll x0 = 0ll, x1 = 1ll;
    if (b == 1ll) return 1ll;
    while (a > 1ll) {
        q = a / b;
        t = b, b = a % b, a = t;
        t = x0, x0 = x1 - q * x0, x1 = t;
    }
    if (x1 < 0ll) x1 += b0;
    return x1;
}
 
 
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define pin(a) for(auto x:a)cout<<x<<" ";cout<<endl
#define fck(a) cout<<a;exit(0)
#define vvll vector<vector<ll> >
#define A(b) b.begin(),b.end()
#define vpi std::vector<pll>
#include <array>
#include <stack>
#define arr2 array<ll,2>
#define arr3 array<ll,3>
#define varr2 vector<array<ll,2> >
#define varr3 vector<array<ll,3> >
//include<bits/stdc++.h>
 
 
bool fa(vll &x,vll &y){return x[0]<y[0];}
bool fa1(vll &x,vll &y){return x[1]<y[1];}
bool f1(pll &x,pll &y){return x.second>y.second;}
bool f2(pll &x,pll &y){
    return x.first>y.first;
}
 
 
bool f3(ll &x,ll &y){
    return x>y; 
    }


const ll maxn=2e5+2;





int main()
{ fastio;
//freopen("input.txt, "r", stdin); 
//freopen("output.txt", "w", stdout);

ll n,q;cin>>n>>q;
ll b[n];
forl(i,0,n)cin>>b[i];
vll seg(n+n,0ll);
vector<varr2>gr(n+1);
ll ans[q];
forl(i,0,q){
ll x,y;cin>>x>>y;
x--;y--;
gr[y].pb({x,i});
}

map<ll,ll>en;
forl(i,0,n){
    ll p1=i;
    for(seg[p1+=n]=1;p1>1;p1>>=1){
        seg[p1>>1]=seg[p1]+seg[p1^1];
    }
    if(en.find(b[i])!=en.E){
        p1=en[b[i]];
    for(seg[p1+=n]=0;p1>1;p1>>=1){
        seg[p1>>1]=seg[p1]+seg[p1^1];
    }
    }
    en[b[i]]=i;
    for(auto f:gr[i]){
        ll l=f[0],r=i+1;
        ll x=0;
        for(l+=n,r+=n;l<r;l>>=1,r>>=1){
            if(l%2){
                x+=seg[l++];
            }
            if(r%2){
                x+=seg[--r];
            }
        }
        ans[f[1]]=x;
    }
}

forl(i,0,q){
    cout<<ans[i]<<"\n";
}
  







return 0;
}





  







Measured memory_bytes: 75460
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;


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

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();

        int n = scanner.nextInt();
        int m = scanner.nextInt();

        Map<Integer,Integer> map = new HashMap<Integer,Integer>();

        int tmp = 0;
        int tmp2 = 0;
        for(int i=0;i<n;i++) {
        	tmp = scanner.nextInt();
        	for(int j=0;j<tmp;j++) {
        		tmp2 = scanner.nextInt();
        		if(map.containsKey(tmp2)) {
        			map.put(tmp2, map.get(tmp2)+1);
        		}else {
        			map.put(tmp2, 1);
        		}
        	}
        }

        int cnt = 0;
        for(Map.Entry<Integer, Integer> entry : map.entrySet()) {
            if(entry.getValue()==n) {
            	cnt ++ ;
            }
        }
        System.out.println(cnt);

    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";
        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0);
                i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}

Measured memory_bytes: 21460
#include <vector>
#include <iostream>
#include <algorithm>
struct Pair {
	Pair(const int &v = 0, const int &i = 0) :val(v), idx(i) {};
	bool operator==(const Pair &other) const {
		return val == other.val;
	}
	bool operator<(const Pair &other) const {
		return val < other.val;
	}
	bool operator>(const Pair &other) const {
		return val > other.val;
	}
	bool operator<=(const Pair &other) const {
		return val <= other.val;
	}
	bool operator>=(const Pair &other) const {
		return val >= other.val;
	}
	int val, idx;
};
class BIT {
public:
	BIT(const int &n) :vector(n + 1) {};
	int get_num(const int &idx) const {
		if (idx == 0) {
			return 0;
		}
		else {
			return vector.at(idx) + get_num(idx - last_bit(idx));
		}
	}
	void set_num(const int &idx) {
		if (idx < vector.size()) {
			++vector.at(idx);
			set_num(idx + last_bit(idx));
		}
	}
private:
	int last_bit(const int &n) const {
		return (-n) & n;
	}
	std::vector<int> vector;
};
int main() {
	int n;
	std::cin >> n;
	BIT bit(n);
	std::vector<Pair> vector(n);
	for (auto i = 1; i <= n; ++i){
		int a;
		std::cin >> a;
		vector.at(i - 1) = Pair(a, i);
	}
	sort(vector.begin(), vector.end());
	long long int sum = 0;
	for (auto i = n - 1; i >= 0; --i) {
		sum += bit.get_num(vector.at(i).idx);
		bit.set_num(vector.at(i).idx);
	}
	std::cout << sum << std::endl;
	return 0;
}

Measured memory_bytes: 5208
N,A,B=list(map(int,input().split()))
l=list(map(int,input().split()))
l.sort(reverse=True)
all_n=l.count(l[0])
from scipy.special import comb
from collections import Counter
l2=l[0:A]
l_c=Counter(l)
max_mean=sum(l2)/A
l2=Counter(l2).items()
print(max_mean)
ans=1
if l[0]==l[A-1]:
   ans=0
   for i in range(A,B+1):
      ans+=comb(all_n,i,exact=True)
   print(ans)
   exit()
for i,j in l2:
   ans*=comb(l_c[i],j,exact=True)
print(ans)

Measured memory_bytes: 42404
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

N = int(input())
A = list(map(int, input().split()))

L = [0]
R = [0]
for n in range(N-1):
    L.append(gcd(L[-1],A[n]))
    R.append(gcd(R[-1],A[N-n-1]))
    
GCDs = []
for n in range(N):
    GCDs.append(gcd(L[n], R[N-n-1]))
    
print(max(GCDs))

Measured memory_bytes: 14080
#include<cstdio>
#define ll long long
using namespace std;

ll a, b, c, k;

int main() {
	scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
	if(k % 2 == 0) printf("%lld", a - b); else printf("%lld", b - a);
}

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

using ll = long long;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}

int main() {
  int N; cin >> N;
  string A, B, C; cin >> A >> B >> C;

  int cnt = 0;
  REP(i, N) {
    if(A[i] == B[i] && B[i] == C[i]) {
      
    }
    else if(A[i] == B[i]) {
      cnt++;
    }
    else if(A[i] == C[i]) {
      cnt++;
    }
    else if(C[i] == B[i]) {
      cnt++;
    } else {
      cnt = cnt + 2;
    }
  }

  cout << cnt << endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()
r = 0
g = 0
b = 0
ans = 0

for i in range(n):
    if s[i] == 'R':
        r += 1
    if s[i] == 'G':
        g += 1
    if s[i] == 'B':
        b += 1
rgb = {
    'R': r,
    'G': g,
    'B': b
}
for i in range(n):
    if s[i] != 'R':
        continue
    for j in range(n):
        if s[j] != 'G':
            continue
        mem = 0
        if (i+j)%2 == 0:
            k = (i+j)//2
            if s[k] == 'B':
                mem += 1
        if 2*i-j >= 0 and 2*i-j < n:
            if s[2*i-j] == 'B':
                mem += 1
        if 2*j-i >= 0 and 2*j-i < n:
            if s[2*j-i] == 'B':
                mem += 1
        ans += b-mem


print(ans)


Measured memory_bytes: 9240
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vi perm(n), inv(n);
    rep(i,0,n) {
        cin >> perm[i];
        --perm[i];
    }
    rep(i,0,n) inv[perm[i]]=i;
    int best=0;
    int i=0;
    while(i<n) {
        int x=1;
        while(i+1<n && inv[i+1]>inv[i]) {
            ++i;
            ++x;
        }
        best=max(best,x);
        ++i;
    }
    cout<<n-best<<"\n";
}


Measured memory_bytes: 1792
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        l: [usize; n],
    }
    let mut count = 0;
    let mut pos_a = 0;
    let mut i_cnt = 0;
    for i in &l {
        i_cnt += 1;
        let mut j_cnt = 0;
        for j in &l {
            if i_cnt > j_cnt {
                j_cnt += 1;
                continue;
            }
            j_cnt += 1;
            if *i == *j {
                continue;
            }
            let mut k_cnt = 0;
            for k in &l {
                if j_cnt > k_cnt {
                    k_cnt += 1;
                    continue;
                }
                k_cnt += 1;
                if *j == *k || *k == *i {
                    continue
                }
                let amari = (*i+*j+*k)%2;
                if (*i+*j+*k)/2 + amari <= *i || (*i+*j+*k)/2 + amari <= *j || (*i+*j+*k)/2 + amari <= *k {
                    continue;
                }
                //println!("{} {} {}", *i, *j, *k);
                count += 1;
            }
        }
    }

    println!("{}", count);
    
}


Measured memory_bytes: 2204
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define DBG(X) cout<<" "<<#X<<" : "<<X<<endl
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;

const int INF = 1e9;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;

struct Input
{
	int n;char c;char str[10010];string s;ll l;double d;
	int nextInt(){scanf("%d", &n);return n;}
	ll nextLong(){scanf("%lld", &l);return l;}
	double nextDouble(){scanf("%lf", &d);return d;}
	char nextChar(){scanf("%c", &c);return c;}
	string next(){scanf("%s", str);return string(str);}
	string nextLine(){getline(cin, s);return s;}
};
Input in;

int main(){
	int n, r;
	while(~scanf("%d%d", &n, &r)){
		vi c(r);
		rep(i, r) scanf("%d", &c[i]);
		queue<int> a, b, q;
		rep(i, n) q.push(i);
		rep(i, r){
			rep(j, n / 2) b.push(q.front()), q.pop();
			while(!q.empty()) a.push(q.front()), q.pop();

			while(!a.empty() || !b.empty()){
				for(int j = 0; j < c[i]; j++){
					if(a.size()==0) break;
					q.push(a.front());
					a.pop();
				}
				for(int j = 0; j < c[i]; j++){
					if(b.size()==0) break;
					q.push(b.front());
					b.pop();
				}
			}
		}
		int ans;
		while(q.size()) ans = q.front(), q.pop();
		printf("%d\n", ans);
	}
}

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

using namespace std;

typedef long long ll;

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

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	int l = a + b;
	int r = c + d;
	if(l > r){
		cout << "Left" << endl;
	}else if(l == r){
		cout << "Balanced" << endl;
	}else{
		cout << "Right" << endl;
	}
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
static const double pi = 3.141592653589793;

/*ll par[MAX];
ll Rank[MAX];
ll Gr[MAX];*/
vector<ll> par(MAX, 0);
vector<ll> Rank(MAX, 0);
vector<ll> Gr(MAX, 0);
ll Score=0;

void init(ll n){
    rep(i, n){
        par[i]=i;
        Rank[i]=0;
        Gr[i]=1;
    }
  	Score=n;

}

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

void unite(ll x, ll y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    if(Rank[x]<Rank[y]){
        Score-=(Gr[y]-1)*(Gr[y])/2;
      	Score-=(Gr[x]-1)*(Gr[x])/2;
        par[x]=y;
        Gr[y]+=Gr[x];
        Score+=(Gr[y]-1)*(Gr[y])/2;
    }
    else{
        par[y]=x;
        Score-=(Gr[x]-1)*(Gr[x])/2;
      	Score-=(Gr[y]-1)*(Gr[y])/2;
        Gr[x]+=Gr[y];
        Score+=(Gr[x]-1)*(Gr[x])/2;
        if(Rank[x]==Rank[y])Rank[x]++;
    }

}

bool same(ll x, ll y){
    return find(x)==find(y);
}

int main(){
    ll N, M;
    cin>>N>>M;
    vector<ll> A(M), B(M);
    rep(i, M){
        cin>>A[i]>>B[i];
        A[i]--; B[i]--;
    }
    init(N);
    vector<ll> Sc(M);
    Sc[M-1]=N*(N-1)/2;
    rep(i, M){
        unite(A[M-1-i], B[M-1-i]);
        if(i<M-1){
			Sc[M-2-i]=N*(N+1)/2-Score;
        }
      	//cout<<Score<<endl;
    }
    rep(i, M){
        cout<<Sc[i]<<endl;
    }
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
#define INF INT_MAX
using namespace std;
int main(void){
	int n;
	cin >> n;
	int a[n], b[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++) cin >> b[i];
	int rmn = INF, lmn = INF;
	for(int i = 0; i < n; i++){
		if(a[i]) lmn = min(lmn, b[i]);
		else rmn = min(rmn, b[i]);
	}
	if(rmn == INF || lmn == INF) cout << 0 << endl;
	else cout << rmn + lmn << endl;
	return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
   int x;cin>>x;;
   for(int i=1;;i++){
       if((360*i)%x==0){
          int res=(360*i)/x;
          cout<<res<<endl;
          return 0;
       }
   }
}

Measured memory_bytes: 3592
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner ob=new Scanner(System.in);
		int n=ob.nextInt();
		int a[]=new int[n];
		for (int i=0; i<n; i++) {
			a[i]=ob.nextInt();
		}
		Arrays.sort(a);
		// for(int i=0;i<=k;i++){System.out.println(a[i]);}
		int count=0;
		out:
		for (int i=0; i<n-2; i++) {
			for (int j=i+1; j<n-1; j++) {
				for (int k=j+1; k<n; k++) {
					if (a[i]!=a[j]&&a[j]!=a[k]&&a[i]!=a[k]) {
						if ((a[i]+a[j])>a[k]&&a[j]+a[k]>a[i]&&a[i]+a[k]>a[j]) {
							count++;
						}

					}
				}
			}
		}
		System.out.println(count);
	}
}


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

#include <unistd.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
 
 
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
int dx_ori[4] = { -1,0, 1,0 }, dy_ori[4] = { 0,1,0,-1 };
int dx[4] = {0, 0, 0, 0}, dy[4] = {0, 0, 0, 0};
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


ll gcd(ll a, ll b) {
  if (b > a) {
    swap(a, b);
  }
  ll r = a%b;
  while (r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}

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



signed main() {
  fio();
  int a, b, n;
  string s, t;
  cin >> a >> b;
  cout << lcm(a, b) << endl;
}


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

int main(){
  int N;
  cin >> N;
  int ans = 0,cnt = 0;
  vector<int> H(N);
  for(int i = 0;i < N;++i)
    cin >> H[i];
  for(int i = 1;i < N;++i){
    if(H[i - 1] >= H[i])cnt++;
    else{
      ans = max(cnt,ans);
      cnt = 0;
    }
  }
  ans = max(cnt,ans);
  cout << ans;
}


Measured memory_bytes: 640
// ankit_singhal
#define boostit ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf push_front
#define vi vector<ll>
#define pii pair<ll,ll>
#define qi queue<ll>
#define mem(a,b) memset(a,b,sizeof(a))
#define print(a) cout<<a<<'\n'
#define sorted(arr) sort(arr.begin(),arr.end())
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define read(a) scanf("%d", &a)
#define f(a,n) for(ll i=a;i<n;i++)
#define in(a,n,arr) for(ll i=a;i<n;i++)cin>>arr[i];
#define in2(n,m,arr) for(ll i=0;i<n;i++){for(ll j=0;j<m;j++)cin>>arr[i][j];}
#define pown  1<<n
#define mod 1e9+7
#define mm 1e6
/*typedef tree<int, null_type, less<int>, rb_tree_tag,
 tree_order_statistics_node_update>
 ordered_set;
 typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
 tree_order_statistics_node_update>
 ordered_multiset;*/
//map<pii,ll> ma,visi;

/*vector<ll> v;
 void SieveOfEratosthenes(int n)
 {
 bool prime[n+1];
 memset(prime, true, sizeof(prime));
 
 for (int p=2; p*p<=n; p++)
 {
 if (prime[p] == true)
 {
 for (int i=p*p; i<=n; i += p)
 prime[i] = false;
 }
 }
 for (int p=2; p<=n; p++)
 if (prime[p])
 v.pb(p);
 }
*/
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*ll ans[(ll)mm];
ll get(ll x)
{
    //while(ans[x]!=x){x=ans[x];}
    if(ans[x]==x)return x;
    return ans[x]=get(ans[x]);
    
    //return;
}
void merge(ll a,ll b)
{
    ll temp=get(a);
    ll temp2=get(b);
    if(temp==temp2)return;
    //ans[temp]=temp2;
}*/
int main()
{
    boostit;
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        print(((n-1)*n)/2);
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
    
}


Measured memory_bytes: 256
N, M = map(int, input().split())
p_list = []

res = M
total_p = 0
for i in range(N):
    a, b = map(int, input().split())
    p_list.append(a)
    p_list.append(b)

for price, amount in sorted(zip(p_list[::2], p_list[1::2])):
    total_p += price * min(res, amount)
    res -= amount
    if res <= 0:
        break
        
print(total_p)



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, k; cin >> n >> k;
	ll l=-1;
	string s; cin >> s;
	ll ans=0;
	vll arr;
	ll i=0, cnt=0;
	bool flg=true;
	rep(i, n){
		if (flg){
			if (s[i]=='1') cnt++;
			if (s[i]=='0') arr.pb(cnt), cnt=1, flg=false;
		}else{
			if (s[i]=='0') cnt++;
			if (s[i]=='1') arr.pb(cnt), cnt=1, flg=true;
		}
	}
	if (cnt) arr.pb(cnt);
	if (arr.size()%2==0) arr.pb(0);

	vll sum;
	sum.pb(0);
	rep(i, arr.size()){
		sum.pb(arr[i]+sum.back());
	}

	if (k >= arr.size()/2){
		ans = n;
	}else{
		rep(i, sum.size()-k*2-1){
			if (i % 2 == 1) continue;
			ans = max(ans, sum[i+k*2+1]-sum[i]);
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 2676
#include<bits/stdc++.h>
using namespace std;
vector<int> visited;
vector<int> siz;
vector<vector<int>> ed;
int dfs(int p,int u){
    if(visited[u]==2){
        return siz[u];
    }
    if(visited[u]==1){
        return siz[u];
    }
    if(ed[u].size()==0){
        visited[u]=2;
        siz[u]=0;
        return 0;
    }
    visited[u]=1;
    int maxi=0;
    for(auto x:ed[u]){
       maxi=max(maxi,dfs(u,x));
    }
    visited[u]=2;
    maxi=maxi+1;
    siz[u]=maxi;
    return maxi;
}
int main(){
    int n,m;
    cin>>n>>m;
    vector<int> a(n+1,0);
    visited=a;
    siz=a;
    vector<vector<int>> e(n+1);
    for(int i=0;i<m;i++){
        int c,d;
        cin>>c>>d;
        e[c].push_back(d);
    }
    int ans=0;
    ed=e;
    for(int i=1;i<=n;i++){
        if(visited[i]==0){
            int l =dfs(-1,i);
            ans=max(l,ans);
        }
    }
   // for(int i=1;i<=n;i++)cout<<siz[i]<<endl;
    cout<<ans<<endl;
}


Measured memory_bytes: 15104
#include <iostream>
#include <stdio.h>

#define MAX_S 1'000'000'000

using namespace std;

int main() {
  int N, K, S;
  cin >> N >> K >> S;
  for (int i = 0; i < K; ++i) {
    printf("%d ", S);
  }
  if (S == MAX_S) {
    for (int i = K; i < N; ++i) {
      printf("1 ");
    }
  } else {
    for (int i = K; i < N; ++i) {
      printf("%d ", MAX_S);
    }
  }
  printf("\n");
}

Measured memory_bytes: 3204
def main():
    s = input()
    t = input()
    n = len(t)
    ans = 0

    for i in range(len(s) - n + 1):
        cnt = 0
        for a, b in zip(s[i:i + n], t):
            if a == b: cnt += 1
        ans = max(ans, cnt)
    print(n - ans)

if __name__ == '__main__':
    main()



Measured memory_bytes: 9052
a, b, k = map(int, input().split())
for i in range(k):
    if i % 2 == 0:
        if a % 2 == 1:
            a -= 1
        b += a // 2
        a //= 2
    else:
        if b % 2 == 1:
            b -= 1
        a += b // 2
        b //= 2
print(a, b)


Measured memory_bytes: 2940
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MAX 300005
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
   	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}

 int main()
 {
     long long int a,b,c,k,s=0;
     cin>>a>>b>>c>>k;
      if(a<=k)
      {
          s+=a;
          k-=a;
      }
      else
      {
          s+=k;
          k=0;
      }
      if(b<=k)
        k-=b;
      else
        k=0;
      if(c<=k)
        s-=c;
      else
        s-=k;
      cout<<s<<endl;
 }

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

vector<vector<char>> s(MAX,vector<char>(MAX));
int n;

bool same(int a, int b){
    bool f = true;
    rep(i,n){
        rep(j,n){
            if(s[(i+a)%n][(j+b)%n] != s[(j+a)%n][(i+b)%n]) f = false;
        }
    }
    return f;
}

int main(){
    cin >> n;
    rep(i,n){
        rep(j,n) cin >> s[i][j];
    }
    int ans = 0;
    if(same(0,0)) ans += n;
    for(int i = 1; i <= n-1; i++){
        if(same(i,0)) ans += n-i;
        if(same(0,i)) ans += n-i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
using System;
using System.Text.RegularExpressions;

namespace Atcoder2
{
    class Program
    {

        public static void Main(string[] args)
        {
            string[] tmpStr = Console.ReadLine().Split(' ');
            int min = int.Parse(tmpStr[0]);
            int max = int.Parse(tmpStr[1]);
            int num = int.Parse(tmpStr[2]);
            int count = 0;
            for(int i = min; i <= max; i++)
            {
                if (i % num == 0)
                {
                    count += 1;
                }
            }

            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 27528
from fractions import gcd
def lcm_base(x,y):
    return (x*y) // gcd(x,y)

N,M = map(int,input().split())
S = input()
T = input()
ans = lcm_base(N,M)
for i in range(N):
    if M*i % N != 0:
        continue
    j = M*i // N
    if j >= M:
        continue
    if S[i] != T[j]:
        print(-1)
        exit()
print(ans)

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

int main() {
    string s;
    cin >> s;
    string ans = "Yes";
    if(s.length() % 2 == 1) {
        ans = "No";
    } else {
        for(int i = 0; i < s.length(); i++) {
            if( (i % 2 == 0 && s[i] != 'h')
            || (i % 2 == 1 && s[i] != 'i') ) {
                ans = "No";
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = map( int, input().split())
hate = set( input().split())

usable = sorted( list( {str(i) for i in range(10)} - hate))

l = len(str(n))

def check(l):
    num = []
    if l == 1:
        for i in usable:
            num.append(int(i))
    elif l == 2:
        for ii in usable:
            for i in usable:
                num.append(int( ii + i))
    elif l == 3:
        for iii in usable:
            for ii in usable:
                for i in usable:
                    num.append(int( iii + ii + i))
    elif l == 4:
        for iv in usable:
            for iii in usable:
                for ii in usable:
                    for i in usable:
                        num.append(int( iv + iii + ii + i))
    else:
        for v in usable:
            for iv in usable:
                for iii in usable:
                    for ii in usable:
                        for i in usable:
                            num.append(int( str(v) + str(iv) + str(iii) + str(ii) + str(i)))
    return num

truf = False
num = check(l)
for i in num:
    if n <= i:
        print(i)
        truf = True
        break
if not truf:
    num = check(l+1)
    for i in num:
        if n <= i:
            print(i)
            break

Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps=1e-8;
int size(pair<P, P> x) {
	return(x.second.first - x.first.first + 1)*(x.second.second - x.first.second + 1);
}
bool sizeby(pair<P, P> x, pair<P, P> y) {
	if (size(x) < size(y))return true;
	return false;
}
int main() {
	int n, w, d;
	while (cin >> n >> w >> d, w) {
		vector<pair<P, P>> v;
		v.push_back({ {1,1},{w,d} });
		rep(i, n) {
			int p, s; cin >> p >> s; p--;
			pair<P, P> now = v[p]; v.erase(v.begin() + p);
			pair<P, P> c1, c2;
			int wid = now.second.first - now.first.first + 1;
			int hei = now.second.second - now.first.second + 1;
			s %= (wid * 2 + hei * 2);
			if (s < wid) {
				c1 = { now.first,{now.first.first + s - 1,now.second.second} };
				c2 = { {now.first.first + s,now.first.second},now.second };
			}
			else if (s < wid + hei) {
				s -= wid;
				c1 = { now.first,{now.second.first,now.first.second + s - 1} };
				c2 = { {now.first.first,now.first.second + s},now.second };
			}
			else if (s < wid * 2 + hei) {
				s = wid * 2 + hei - s;
				c1 = { now.first,{ now.first.first + s - 1,now.second.second } };
				c2 = { { now.first.first + s,now.first.second },now.second };
			}
			else {
				s = wid * 2 + hei * 2 - s;
				c1 = { now.first,{ now.second.first,now.first.second + s - 1 } };
				c2 = { { now.first.first,now.first.second + s },now.second };
			}
			if (size(c1) < size(c2)) {
				v.push_back(c1);
				v.push_back(c2);
			}
			else {
				v.push_back(c2);
				v.push_back(c1);
			}
		}
		sort(v.begin(), v.end(), sizeby);
		int len = v.size();
		rep(i, len) {
			cout << size(v[i]);
			if (i < len - 1)cout << " ";
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3036
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
// typedef long  l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;

int gcd(int a,int b){
  if(a<b)swap(a,b);
  int c=a%b;
  while(c!=0){
    a=b;
    b=c;
    c=a%b;
  }
  return b;
}

int main(){
  double t,x;cin>>t>>x;
  cout<<fixed<<setprecision(6)<<t/x<<endl; 

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define SQR(X)  ( (X)*(X) )
#define CUBE(X) ( (X)*(X)*(X) )
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;
 
 
void reader(int &a){scanf("%d",&a);}
void reader(double &a){scanf("%lf",&a);}
void reader(char &a){scanf(" %c",&a);}
void reader(char a[]){scanf("%s",a);}
void reader(ll &a){scanf("%lld",&a);}
void reader(ull &a){scanf("%llu",&a);}
// void reader(string& a){cin >> a;};
template<class T,class U> void reader(T& t,U& u){reader(t); reader(u);}
template<class T,class U,class V> void reader(T& t,U& u,V& v){reader(t); reader(u); reader(v);}
 
void writer(int a,char c) {printf("%d",a); putchar(c);}
void writer(ll a,char c) {printf("%lld",a); putchar(c);}
void writer(double a,char c) {printf("%.20lf",a); putchar(c);}
void writer(char a[]) {printf("%s",a);};
void writer(char a[],char c) {printf("%s",a);putchar(c);};
void writer(char a,char c) {putchar(a); putchar(c);};
template<class T>void writerLn(T t){writer(t,'\n');}
template<class T,class U>void writerLn(T t,U u){writer(t,' ');writer(u,'\n');}
template<class T,class U,class V> void writerLn(T t,U u,V v){writer(t,' ');writer(u,' ');writer(v,'\n');}
template<class T> void writerArr(T x[], int n){int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');}
template<class T> void writerVec(vector<T> x){int n=x.size();int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');}
 
vector<std::string> split(const std::string &str, char sep){std::vector<std::string> v;std::stringstream ss(str);std::string buffer;while(std::getline(ss,buffer,sep)){v.push_back(buffer);}return v;}
 
// #define int ll
bool test = true;
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };
ull mod = (int)1e9 + 7;
//..................
int H;
#define MAX (int)1e7

signed main(){
  int i,j,k,l;
  for(i = 1; i < 10; i++) {
	for(j = 1; j < 10; j++) {
	  printf("%dx%d=%d\n",i,j,i*j);
	}
  }
  return 0;
}

Measured memory_bytes: 3108
import java.text.DecimalFormat;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        final long N = sc.nextLong();
        final long A = sc.nextLong();
        final long B = sc.nextLong();
        
        out.println((B - A) % 2 == 0 ? (B - A) / 2 : (B - A) / 2 + Math.min(A - 1, N - B) + 1);

        out.flush();
    }

}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    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: 22356
//
//  main.cpp
//  B-Frog_2
//
//  Created by david chong on 10/30/19.
//  Copyright © 2019 david chong. All rights reserved.
//

#include <iostream>
#include <vector>
#include <climits>

using namespace std;

int solve(int k, vector<int> & inVec) {
    
    vector<int> dp(inVec.size());
    
    dp[0] = 0;
    
    vector<int> tempVec;
    
    int count = 1;
    int myMin = INT_MAX;
    
    for(int i = 1; i < inVec.size(); i++) {
        
        count = 1;
        myMin = INT_MAX;
        
        while(count <= k && (i - count >= 0) ) {
            myMin = min(myMin, abs(inVec[i] - inVec[i-count]) + dp[i-count]);
            count++;
        }
        dp[i] = myMin;
    }
    
        
    return dp.back();
}


int main(int argc, const char * argv[]) {
    
//    freopen("input.in", "r", stdin);
    
    int n, k;
    
    cin >> n >> k;
    
    vector<int> inVec(n);
    
    for(int i = 0; i < n; i++) {
        cin >> inVec[i];
    }
    
    printf("%i\n", solve(k, inVec));
    
    return 0;
}


Measured memory_bytes: 1024
using System;

namespace ABC_126_A_Csharp_ver
{
    class Program
    {
        static void Main(string[] args)
        {
            var word = Console.ReadLine().Split(' ');
            string S = Console.ReadLine();
            int N = int.Parse(word[0]);
            int K = int.Parse(word[1]);
            char[] s = S.ToCharArray();
            s[K - 1] = Char.ToLower(s[K - 1]);
            Console.WriteLine(s);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,a,b,i;
  cin>>n>>m;
  vector<set<int>> s(n);
  vector<int> c(n);
  for(i=0;i<m;i++){
    cin>>a>>b;
    a--;b--;
    s.at(a).insert(b);
    s.at(b).insert(a);
  }
  queue<int> q;
  q.push(0);
  c.at(0)=1;
  int cnt=1,cnta=1,ans=0;
  set<int> st;
  for(i=1;i<n;i++) st.insert(i);
  while(cnta<n){
    while(!q.empty()){
      int u=q.front();
      q.pop();
      for(auto z:s.at(u)){
        if(c.at(z)==0){
          c.at(z)=1;
          st.erase(z);
          q.push(z);
          cnt++;
          cnta++;
        }
      }
    }
    ans=max(ans,cnt);
    if(cnta==n) break;
    else{
      i=*st.begin();
      st.erase(i);
      q.push(i);
      c.at(i)=1;
      cnt=1;
      cnta++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 41784