akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define int long long
#define ld long double
#define all(x) x.begin(),x.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define vi vector<int>
#define vstr vector<string>
#define vbool vector<bool>
#define vvi vector<vector<int> >
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define vpair vector<pii > 
#define mkp make_pair
#define scan(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) {cout<<a[i]<<' ';}cout<<'\n'
#define mem(a,v) memset(a,v,sizeof(a))
#define loop(i,a,b) for (int i = a; i < b; i++)
#define loope(i,a,b) for (int i = a; i <= b; i++)
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::fixed );std::cout.precision(9)
#define PI 3.14159265
#define S second
#define F first
#define CHECK cout<<"CHEDEDWB"<<endl
int mod = 1e9+7;
int inf = 1e18;
//int m_inf = INT_MIN;


void solve()
{
	int n;
	cin>>n;
	vector<vector<int>> c(10,vector<int>(10,0));
	for(int i = 1;i<=n;i++)
	{
		if(i%10==0)	continue;
		int l = i,r;
		while(l>9)	l /= 10;
		r = i%10;
		c[l-1][r-1]++;
	}
	int ans = 0;
	for(int i = 0;i<9;i++)
	{
		for(int j = 0;j<9;j++)
		{
			ans += c[i][j]*c[j][i];
		}
	}
	cout<<ans<<endl;
}

int32_t main()
{
	FastIO; PRECISION;
	int t = 1;
	//cin>>t;
	while(t--)
		solve();
	return 0;
} 

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

int main() {
    int N;  cin >> N;
    long long ans = 1;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    bool zero = false;
    for (int i = 0; i < N; ++i) {
        if (A[i] == 0) zero = true;
    }
    if (!zero) {
        for (int i = 0; i < N; ++i) {
            if (A[i] > (long long)1e18 / ans) {
                cout << -1 << endl;
                return 0;
            }
            ans *= A[i];
        }
        cout << ans << endl;
    }
    else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 4052
n = int(input())


s = list(map(int,list(input().rstrip().split())))

count = 0

for i in range(n):
  target = s[i]
  while s[i] % 2 == 0:
    if(target % 2 == 1):
      break
    else:
      count += 1
      target = int(target/2)

print(count)

Measured memory_bytes: 4148
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
void sol() {
    int n, k = 1, f = 0;
    cin >> n;
    int a;
    for(int i=0; i<n; i++) {
        cin >> a;
        if(a == k) {
            f = 1;
            k++;
        }
    }
    if(f) {
        cout << n - k + 1;
    }
    else {
        cout << -1;
    }
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; while(T--) 
  sol();
  return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	ll N, L, T;
	ll X[100005], W[100005];

	cin >> N >> L >> T;
	rep(i,N) cin >> X[i] >> W[i];

	ll loop = T / L;
	ll cnt = 0;
	rep(i,N) if( W[0] != W[i] ) cnt += 2;
	cnt *= loop;

	rep(i,N) if( W[0] != W[i] ){
		ll a = X[0];
		ll b = X[i];
		if( W[0] == 2 ) a += L;
		if( abs(a-b) <= 2 * (T % L) ) cnt++;
		if( abs(a-b) + L <= 2 * (T % L) ) cnt++;
	}

	//cout << "cnt: " << cnt << endl;

	cnt %= N;

	vector<pair<ll,pii>> v;
	rep(i,N){
		if( W[i] == 1 ) v.emplace_back((X[i] + T%L    )%L, pii(-W[i], i));
		if( W[i] == 2 ) v.emplace_back((X[i] + L - T%L)%L, pii(-W[i], i));
	}
	sort(all(v));

	//for(auto t: v) cout << t.X << "," << t.Y.X << "," << t.Y.Y << endl;

	int pos;
	rep(i,N) if( v[i].Y.Y == 0 ){
		//cout << "init pos: " << i << endl;
		if( W[0] == 1 ) pos = (i + N - cnt) % N;
		if( W[0] == 2 ) pos = (i + N + cnt) % N;
		break;
	}

	rep(i,N){
		cout << v[pos].X << endl;
		pos = (pos + 1) % N;
	}

	return 0;
}

Measured memory_bytes: 4464
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
4
0 1 2
1 2 1
1 3 3

output:
5
"""

import sys
from collections import deque
from math import isinf


def generate_adj_table(v_table):
    for each in v_table:
        source, target, cost = map(int, each)
        init_adj_table[source].setdefault(target, cost)
        init_adj_table[target].setdefault(source, cost)

    return init_adj_table


def graph_bfs(v_init):
    global distance
    distance = [float('inf')] * vertices
    distance[v_init] = 0
    queue.appendleft(v_init)

    while queue:
        current = queue.popleft()
        adj_weight = adj_table[current]
        for adj in adj_weight.keys():
            if isinf(distance[adj]):
                distance[adj] = distance[current] + adj_weight[adj]
                queue.append(adj)
    return None


def solve():
    graph_bfs(init_v)
    diameter, bridge_v = 0, 0
    for v in range(vertices):
        if isinf(distance[v]):
            continue
        if diameter < distance[v]:
            diameter = distance[v]
            bridge_v = v

    graph_bfs(bridge_v)
    diameter = 0
    for v in range(vertices):
        if isinf(distance[v]):
            continue
        diameter = max(diameter, distance[v])

    return diameter


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices = int(_input[0])
    v_info = map(lambda x: x.split(), _input[1:])

    queue = deque()
    distance = [float('inf')] * vertices

    init_adj_table = tuple(dict() for _ in range(vertices))
    adj_table = generate_adj_table(v_info)

    init_v = 0
    print(solve())

Measured memory_bytes: 59724
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef long long ll;
struct P {
	ll time, pos;
};
struct T {
	ll time, can;
};
struct B {
	ll time, to;
};
ll a[100000];
T b[100000];
vector<B>e[100000];
const ll inf = 800000000000000;
int main() {
	int n, m;
	cin >> n >> m;
	char a[50][50], b[50][50];
	for (int i = 0; i < n; i++) {
		string u;
		cin >> u;
		for (int j = 0; j < n; j++) {
			a[i][j] = u[j];
		}
	}
	for (int i = 0; i < m; i++) {
		string u;
		cin >> u;
		for (int j = 0; j < m; j++) {
			b[i][j] = u[j];
		}
	}
	bool l = false;
	for (int i = 0; i <= (n - m); i++) {
		for (int j = 0; j <= (n - m); j++) {
			for (int x = 0; x < m; x++) {
				for (int y = 0; y < m; y++) {
					if (a[i + x][j + y] != b[x][y]) {
						goto stop;
					}
				}
			}
			l = true;
		stop:;
		}
	}
	if (l) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 2560
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;

const ll INF = 1LL<<60;

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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i,n) cin >> h[i];
  vector<ll> dp(n,INF);
  dp[0] = 0;
  rep(i,n){
    rep(j,k){
      if(i-j-1<0)
        break;
      chmin(dp[i], dp[i-j-1]+abs(h[i]-h[i-j-1]));
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

LL p(LL n) {
    return n*n*n*n*n;
}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    LL x;cin >> x;
    for(LL a = -1000;a<1000;a++){
        for(LL b = -1000;b<1000;b++){
            if(p(a)-p(b) == x){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3648
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
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...);
}

typedef long long int64;
typedef pair<int, int> ii;
#define SZ(x) (int)((x).size())
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

const int N = 3e5 + 10;

int main() {
  int n, m, len;
  cin >> n >> m >> len;
  vector<int> x(len), y(len);
  vector<int> row(N), col(N);
  for (int i = 0; i < len; ++i) {
    cin >> x[i] >> y[i];
    row[x[i]]++;
    col[y[i]]++;
  }
  int mx_row = *max_element(row.begin(), row.end());
  int mx_col = *max_element(col.begin(), col.end());
  int ret = mx_row + mx_col;
  int cnt = 0;
  for (int i = 0; i < len; ++i) {
    if (row[x[i]] == mx_row && col[y[i]] == mx_col) ++cnt;
  }
  int64 X = 0, Y = 0;
  for (int i = 0; i < N; ++i) if (row[i] == mx_row) ++X;
  for (int i = 0; i < N; ++i) if (col[i] == mx_col) ++Y;
  if (cnt == X * Y) ret--;
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 7628
s=raw_input()
n=len(s)
h=n/2
if n%2==0:
    count=0
else:
    count=1 if s[h]=="(" or s[h]==")" else 0
for i in range(h):
    if s[i]==s[n-i-1]==")":
        count+=1
    elif s[i]==s[n-i-1]=="(":
        count+=1
    elif s[i]=="(" and s[n-i-1]==")":
        pass
    elif s[i]==")" and s[n-i-1]=="(":
        pass
    elif s[i]!=s[n-i-1]:
        count+=1
print count

Measured memory_bytes: 4252
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b&&a!=c){
        cout<<"Yes";
    }
    else if(a==c&&a!=b){
        cout<<"Yes";
    }
    else if(b==c&&a!=b){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <queue>
#include <cassert>
using namespace std;
using lint = long long;
const long mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<long> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } long C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

int main(){
    int N;
    string s;
    cin >> N >> s;
    Yes(character_count(s, 'R') > character_count(s, 'B'));
}


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

typedef long long ll;
using namespace std;

typedef pair<ll, ll> P;

bool cmp(const P& a,const P& b) {
  return a.second > b.second;
}

int main(void) {
  int n, m; 
  cin >> n >> m;
  vector<ll> as; 
  vector< P > bcs;
  for (int i = 0; i < n; i++) {
    ll t; cin >> t; as.push_back(t);
  }
  sort(as.begin(), as.end());
  for (int i = 0; i < m; i++) {
    ll t, t2; cin >> t >> t2;
    bcs.push_back(make_pair(t, t2));
  }
  sort(bcs.begin(), bcs.end(), cmp);
  int cur = 0;
  int cnt = 0;
  ll sum = 0;
  int stopindex = n;
  for (int i = 0; i < n; i++) 
  {
    if (bcs[cur].second < as[i]) {
      stopindex = i;
      break;
    }

    if (cnt < bcs[cur].first) {
      sum += bcs[cur].second;
      cnt++;
    }
    else {
      cur++; cnt = 0;
      if (bcs.size() <= cur) {
        stopindex = i;
        break;
      }

      if (bcs[cur].second < as[i]) {
        stopindex = i;
        break;
      }

      if (cnt < bcs[cur].first) {
        sum += bcs[cur].second;
        cnt++;
      }
    }
  } 

  for (int i = stopindex; i < n; i++) {
    sum += as[i];
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define mst(a,b) memset(a,b,sizeof(a))
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define lowbit(x) (x&(-x))
#define X first
#define Y second
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long long LL;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<ll,ll> pll;
const int maxn = 2000 + 10;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const long double eps = 1e-8;
const long double PI = acos(-1.0);
const int mod = 1e8 + 7;
const int N = 1555;
int main() {
#ifdef local
    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n,m; cin>>n>>m;
    int ans=0;
    for (int i=1;i*i<=m;i++){
        if (m%i==0){
            if (m/i>=n) ans=max(ans,i);
            if (i>=n) ans=max(ans,m/i);
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvl;
const int mod = 1000000007;
const int N = 3e5;
typedef long long int lli;

int main()
{

ll n,i,x;
   sl(n);
    vll a;
    map<int,int> mp;

    fo(i,n)
    {
       sl(x);
       a.pb(x);
       mp[x]++;
    }

    ll ans=0;

    fo(i,n)
    {
       if(mp[a[i]]!=0)
       {
           if (a[i]<mp[a[i]])  {  ans += mp[a[i]]-a[i];  mp.erase(a[i]); }
           else if(mp[a[i]]<a[i]) { ans += mp[a[i]]; mp.erase(a[i]);}
    }

    }


   cout<<ans;
return 0;

}





Measured memory_bytes: 5492
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define si set <ll>
#define vi vector <ll>
#define popcount(x) __builtin_popcountll(x)
#define mii map <ll,ll>
#define vpi vector <pair <ll,ll> >
#define sz(c) (int)c.size()
#define fr first
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define mem0(a) memset(a,0,sizeof(a))
#define rep(i,a,n) for( ll i=a ; i<n ; i++)
#define ld long double
#define rall(a) (a).rbegin(),(a).rend()

ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}


void solve()
{
	int x,y;
	cin>>x>>y;
	if((y-2*x)%2==0 and (y-2*x)/2>=0 and x-(y-2*x)/2>=0)
		cout<<"Yes"<<"\n";
	else
		cout<<"No"<<"\n";
}

int main()       
{
	fastio
	ll t=1;
	while(t--)
		solve();
	return 0;
}

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

int main(){
	string s,t;
	cin>>s>>t;
	int ans=0;
	if (s[0]==t[0]) {
		ans++;
	}
	if (s[1]==t[1]) {
		ans++;
	}
	if (s[2]==t[2]) {
		ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
x,n = map(int, input().split())
if n > 0:
	l = list(map(int,input().split()))
else:
	l = []
tl = []
for i in range(0,102):
	if i not in l:
		tl.append(i)
tlabs = []
for i in tl:
	tlabs.append(abs(x - i))
ans = tl[tlabs.index(min(tlabs))]
print(ans)

Measured memory_bytes: 9152
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

int mod = -1;
int inv[50000];
int Pow(int x, int n){
	if(n < 0)n += mod-1;
	int ans = 1;
	while(n > 0){
		if(n & 1)ans = (ans*x)%mod;
		x = (x*x)%mod;
		n >>= 1;
	}
	return ans;
}

string erase_space(string str){
	int n = str.size();
	string ans = "";
	rep(i,n){
		if(str[i] == ' ')continue;
		ans += str[i];
	}
	return ans;
}

int flag;
class Arithmetic{
public:
	string str;
	int n;
	void init(string s){str = s;n = str.size();}
	int add(int a, int b){return (mod+a+b%mod)%mod;}
	int mul(int a, int b){return (a*b)%mod;}
	int div(int a, int b){
		if(b == 0){flag = 0;return 0;}
		return mul(a, inv[b]);
	}
	
	P get_num(int p){
		int ans = 0, q = -1, f = 0;
		if(str[p] == '(')return solve(p+1, 0);
		if(str[p] == '-'){f = 1;p++;}
		if(str[p] == '('){P pi = solve(p+1, 0);return P(-pi.fi, pi.se);}
		repi(i,p,n){
			if(!isdigit(str[i]))break;
			ans = ans*10+(str[i]-'0');q = i;
		}
		if(f)return P(-ans, q);
		return P(ans, q);
	}
	
	P solve(int pp = 0, int f = 0){
		P pi = get_num(pp);
		int ans = pi.fi, p = pi.se+1;
		repi(i,p,n){
			if(f and str[i] == ')')return P(ans, i-1);
			if(str[i] == ')')return P(ans, i);
			if(str[i] == '*' or str[i] == '/'){
				pi = get_num(i+1);
				if(str[i] == '*')ans = mul(ans, pi.fi);
				if(str[i] == '/')ans = div(ans, pi.fi);
				//if(f and str[pi.se+1] == ')')return P(ans, pi.se);
			}
			if(str[i] == '+' or str[i] == '-'){
				if(f)return P(ans, i-1);
				if(str[i] == '+')pi = solve(i+1, 1);
				if(str[i] == '-')pi = solve(i, 1);
				ans = add(ans, pi.fi);
			}
			i = pi.se;
		}
		return P(ans, n-1);
	}
};

signed main(){
	Arithmetic A;
	/*mod = 17;
	string str = "1+3*(2+3/5*2)+7";
	//string str = "(2+3/5*2)";
	A.init(str);
	//printf("%lld\n", Pow(5, -1));
	printf("%lld\n", A.solve().fi);*/
	while(1){
		string str;
		getline(cin, str);
		if(str == "0:")break;
		int idx = 0;
		rep(i,str.size()){if(str[i] == ':'){idx = i;break;}}
		mod = atoll(str.substr(0, idx).c_str());
		str = erase_space(str.substr(idx+1, str.size()-idx-1));
		//rep(i,mod)inv[i] = Pow(i, -1);
		inv[1]=1;
		for(int i=2;i<mod;i++)inv[i]=mod-mod/i*inv[mod%i]%mod;
		flag = 1;
		A.init(str);
		P p = A.solve();
		if(flag == 0)cout << "NG" << endl;
		else{
			cout << str << " = " << p.fi;
			printf(" (mod %lld)\n", mod);
		}
	}
	return 0;
}





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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res,a,b;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[200][200],ara2[n_size];


	cin>>n>>m;
	mem(ara);
	f(i,0,m-1)
	{
	    cin>>a>>b;
	    ara[a][b]++;
	    ara[b][a]++;
	}


	f(i,1,n){
	    count=0;
        f(j,1,n)
        {
            if(ara[i][j]>0) count+=ara[i][j];
        }
        cout<<count<<endl;
	}

}


Measured memory_bytes: 384
from bisect import bisect_left, bisect_right

n = int(input())
col_maxs = []
for _ in range(n):
    a = int(input()) * (-1)
    if not col_maxs:
        col_maxs.append(a)
        continue

    curr_max = col_maxs[-1]
    if a >= curr_max:
        col_maxs.append(a)
    else:
        # aより大きい最小要素のindex/value
        ind = bisect_right(col_maxs, a)
        col_maxs[ind] = a

print(len(col_maxs))

Measured memory_bytes: 80644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector< vector<int> > VVI;
typedef vector< vector<int> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair

int main(){
  int N;
  cin>>N;
  vector<string> S(N);
  rep(i,N) cin>>S[i];
  map<string,int> M;
  rep(i,N) M[S[i]]++;
  auto X=M.begin();
  int A=0;
  rep(i,M.size()){
    pair<string,int> P=*X;
    if(A<P.second) A=P.second;
    X++;
  }
  X=M.begin();
  rep(i,M.size()){
    pair<string,int> P=*X;
    if(P.second==A) cout<<P.first<<endl;
    X++;
  }
}

Measured memory_bytes: 26752
#include <cstdio>
#include <cstring>

int main() {
    char s[101], p[101], tmp[202];

    scanf("%s", s);
    scanf("%s", p);

    strcpy(tmp, s);
    strcat(tmp, s);

    if ( strstr(tmp, p) == NULL ) printf("No\n");
    else printf("Yes\n");

    return 0;
}

Measured memory_bytes: 2716
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {

  int n, a = 0, b = 0;
  string buffier;
  cin >> buffier;
  for(int i = 0;i < buffier.size();i++){
    a = a * 10 + buffier[i] - '0';
    b += buffier[i] - '0';
  }
  if(a % b == 0){
    cout << "Yes";
  }else{
    cout << "No";
  }
}


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

bool dfs(vector<int>& d, int level, int acc, string& ans)
{
    if (level == d.size()) {
        return acc == 7;
    }
    ans += "+" + to_string(d[level]);
    if (dfs(d, level + 1, acc + d[level], ans)) {
        return true;
    }
    ans.pop_back();
    ans.pop_back();
    ans += "-" + to_string(d[level]);
    if (dfs(d, level + 1, acc - d[level], ans)) {
        return true;
    }
    ans.pop_back();
    ans.pop_back();
    return false;
}

int main()
{
    int n;
    cin >> n;
    vector<int> d{(n/1000)%10, (n/100)%10, (n/10)%10, n%10};
    string ans = to_string(d[0]);
    dfs(d, 1, d[0], ans);
    cout << ans << "=7" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int n,a,b;
	int x;
	int save;
	int simpan;
	int hasil;
	int total=0;
	int t;
	cin>>n>>a>>b;
	for(x=1;x<=n;x++)
	{
		simpan=x;
		save=x;
		hasil=0;
		for(t=1;t<=5;t++)
		{
			hasil=hasil+simpan%10;
			simpan=simpan/10;
		}
		if(hasil>=a&&hasil<=b)
		{
			total=total+save;
		}
	}
	cout<<total<<endl;
	return 0;
	
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    char[] c = str.toCharArray();
    int n = 0;

    for (int i = 0 ; i < 4 ; i++ ) {
      if (c[i] == '+') {
        n = n + 1;
      } else {
        n = n - 1;
      }
    }
    System.out.println(n);
  }
}


Measured memory_bytes: 21204
#include <stdio.h>

int main(void){
	int N, A, B, pA, pB;
	scanf("%d%d%d", &N, &A, &B);

	pA = A * N;
	pB = B;

	if (pA > pB) {
		printf("%d", pB);
	} else {
		printf("%d", pA);
	}



	return 0;
}

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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

ll ncr(int n,int r)
{
	ll res=1;
	rep(i,r) res=res*(n-i)/(i+1);
	return res;
}

tuple<int,int> solve_naive(int n,vi a)
{
	int x=0,y=0;
	per(i,n) rep(j,i){
		if(ncr(x,y)<ncr(a[i],a[j]))
			x=a[i],y=a[j];
	}
	return mt(x,y);
}

tuple<int,int> solve(int n,vi a)
{
	int x=a.back();
	a.pop_back();
	int y=a.back();

	int i=lower_bound(all(a),x/2)-begin(a);
	if(i<n-1&&abs(y-x/2)>abs(a[i]-x/2))
		y=a[i];
	if(i>0&&abs(y-x/2)>abs(a[i-1]-x/2))
		y=a[i-1];
	return mt(x,y);
}

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n;cin>>n&&n;){
		vi a(n);
		rep(i,n) cin>>a[i];
		sort(all(a));
		int x,y; tie(x,y)=solve(n,a);
		cout<<x<<' '<<y<<endl;
	}
}


Measured memory_bytes: 1024
from itertools import permutations


def dist(points,a,b):
    x = ((points[a][0]-points[b][0])**2+(points[a][1]-points[b][1])**2)**0.5
    return x

def resolve():
    N = int(input())

    points = [ [int(j) for j in input().split()]  for i in range(N)]
    score =0
    count =0
    for route in permutations(range(N),N):
        
        for a,b in zip(route,route[1:]):
            score += dist(points,a,b)

        count +=1

    print(score/count)




if __name__ == "__main__":
    resolve()

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

int N;
double pw;
double vw[100000];
double pf[100000];
double vf[100000];
double th[100000];

double sim(double W) {
	double sum = W * pw;
	for(int i = 0; i < N; i++) {
		double rem = th[i] - W * vw[i];
		if(rem < 0) continue;
		sum += rem / vf[i] * pf[i];
	}
	return sum;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	while(cin >> N, N) {
		cin >> pw;
		for(int i = 0; i < N; i++) {
			cin >> vw[i] >> pf[i] >> vf[i] >> th[i];
		}

		double l = 0, r = 1e9;
		for(int loop = 0; loop < 200; loop++) {
			double ll = (l + l + r) / 3.0, rr = (l + r + r) / 3.0;
			if(sim(ll) > sim(rr)) {
				l = ll;
			}
			else {
				r = rr;
			}
		}
		cout << sim(l) << endl;
	}
}

Measured memory_bytes: 6392
#include <iostream>
#include <string>
#include <deque>
#include <cstdlib>

using namespace std;
const long long INF = 1LL << 60;
typedef long long int lli;

int main()
{
    // Input numbers
    int a, b, h;
    cin >> a >> b >> h;

    cout << (int)((a+b)*h/2) << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
#define MOD (int)1e9+7

int Acnt[100001];

int main()
{
	int n; cin >> n;
	int num = 0;
	bool flag = true;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		Acnt[a]++;
		if (n % 2 == a % 2)flag = false;
		if (a && Acnt[a] == 1)num++;
	}
	for (int i = 0; i < n; i++) {
		if (i && Acnt[i] && Acnt[i] != 2)flag = false;
		else if (i == 0 && Acnt[i] && Acnt[i] != 1)flag = false;
	}
	long long ans = 1;

	for (int i = 0; i < num; i++) {
		ans *= 2;
		ans %= MOD;
	}

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

    return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n,x;
  cin>>n>>x;
  vll a(n);
  vll b(n);
  rep(i,n) {
    cin>>a[i];
    b[i]=a[i];
  }
  ll ans=0;
  rep(i,n-1){
    if(a[i]+a[i+1]>x){
      ll k=a[i]+a[i+1]-x;
      if(k>=a[i+1]){
        a[i+1]=0;
        k-=a[i+1];
        a[i]-=k;
        ans+=k;
      }
      else{
        a[i+1]-=k;
        ans+=k;
      }
    }
  }
  ll anss=0;
  for(int i=n-1;i>0;i--){
    if(b[i]+b[i-1]>x){
      ll k=b[i]+b[i-1]-x;
      if(k>=b[i-1]){
        b[i-1]=0;
        k-=b[i-1];
        b[i]-=k;
        anss+=k;
      }
      else{
        b[i-1]-=k;
        anss+=k;
      }
    }
  }
  mins(ans,anss);
  COUT(ans);
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  int A, B, C;
  ll K;
  cin >> A >> B >> C >> K;
  if (K%2) swap(A, B);
  cout << A-B << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

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

    for (i=1;i<=n ; ++i) {
        int x=i;
        if (x%3==0) {
            printf(" %d",i );
        }
        else{
            while (1) {
                if (x%10==3) {
                    printf(" %d",i);
                    break;
                }
                x/=10;
                if (x==0) {
                    break;
                }
        }
        }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 600
A,B,H,M = map(int,input().split())

import math

ji = (30 * H) + (0.5 * M)
hu = 6 * M
ka = ji- hu

if ka == 0:
    print(abs(B-A))
elif abs(ka) == 180:
    print(A+B)
elif ka > 0:
    co = math.cos(math.radians(ka))
    ans = A**2 + B**2 - 2*A*B*co
    print(ans**(0.5))
elif ka < 0:
    ka *= -1
    co = math.cos(math.radians(ka))
    ans = A**2 + B**2 - 2*A*B*co
    print(ans**(0.5))

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
  int n;
  while(cin>>n, n) {
    int ba[n][n];
    int x = n/2;
    int y = x;
    y++;

    memset(ba, 0, sizeof(ba));
    int i = 1;
    while (i<=n*n) {
     
      if (x<0) {
        x = n - 1;
        continue;
      } else if (x>=n) {
        x = 0;
        continue;
      } else if (y>=n) {
        y = 0;
        continue;
      } else if(ba[x][y] != 0) {
        x--;
        y++;
        continue;
      } else {
        ba[x][y] = i++;
        x++;
        y++;
      }
    }
    REP(i,n) {
      REP(j,n) {
        printf("%4d", ba[j][i]);
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;

int main()
{
    char a;
    cin >> a;
    if('A'<= a && a <= 'Z') cout << 'A' << endl;
    else cout << 'a' << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int main(){
  ll n;cin >> n;
  vector<ll> c(n);
  for(int i=0;i<n;i++){
    cin >> c[i];
  }
  sort(c.begin(),c.end());
  vector<ll> t(n);
  t[0]=1;
  for(int i=1;i<n;i++){
    t[i]=t[i-1]*4;
    t[i]%=mod;
  }
  ll ans=0;
  for(ll i=0;i<n;i++){
    ans+=(c[i]*(n+1-i))%mod;
    ans%=mod;
  }
  ans*=t[n-1];
  ans%=mod;
  cout << ans << endl;
}

Measured memory_bytes: 3328
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	n := nextInt()
	m := nextInt()
	xs := make([]int, n)
	for i := 0; i < n; i++ {
		xs[i] = nextInt()
	}
	ys := make([]int, m)
	for i := 0; i < m; i++ {
		ys[i] = nextInt()
	}
	p := int(math.Pow10(9)) + 7

	var X, Y int
	for i, x := range xs {
		X += i*x - (n-(i+1))*x
	}
	for i, y := range ys {
		Y += i*y - (m-(i+1))*y
	}

	fmt.Println((X % p) * (Y % p) % p)
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func diff(x, y int) int {
	return abs(-(x) + y)
}

// ---------- Util.


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

edges = []
for _ in range(M):
  a, b = map(int, input().split())
  edges.append((a-1, b-1))
edges = edges[::-1]

# Union-Find
parent = [i for i in range(N)]
rank = [1] * (N)
count = [1] * (N)
def get_root(node):
  global parent
  if parent[node] == node:
    return node
  root = get_root(parent[node])
  parent[node] = root
  return root

def is_group(a, b):
  return get_root(a) == get_root(b)

def get_count(a):
  global count
  return count[get_root(a)]

def union(a, b):
  global rank
  root_a = get_root(a)
  rank_a = rank[root_a]
  root_b = get_root(b)
  rank_b = rank[root_b]
  if rank_a < rank_b:
    parent[root_a] = root_b
    count[root_b] += count[root_a]
  else:
    parent[root_b] = root_a
    count[root_a] += count[root_b]
    if rank_a == rank_b:
      rank[root_a] += 1

ans = [N * (N-1) // 2]
for f, t in edges[:-1]:
  if is_group(f, t):
    ans.append(ans[-1])
  else:
    ans.append(ans[-1] - get_count(f) * get_count(t))
    union(f, t)

for a in ans[::-1]:
  print(a)

Measured memory_bytes: 25996
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    int x, a, b;
    scan(x, a, b);

    writeln(abs(x - a) < abs(x - b) ? "A" : "B");
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	private static FastScanner sc = new FastScanner();
	
	public static void main(String[] args) {
		int H = sc.nextInt();
		int W = sc.nextInt();
		
		if(H%3==0 || W%3==0) {
			System.out.println(0);
			return;
		}
		
		int min = Math.min(H, W);
		
		int[] a = {H/3, H/3+1};
		for(int i=0; i<=1; i++) {
			int s1 = a[i] * W;
			int s2;
			int s3;
			if(W%2 == 0) {
				s2 = (H - a[i]) * (W/2);
				s3 = s2;
			} else {
				s2 = (H - a[i]) * (W/2);
				s3 = (H - a[i]) * ((W/2)+1);
			}
			
			int temp = Math.max(Math.max(Math.abs(s1-s2), Math.abs(s2-s3)), Math.abs(s3-s1));
			if(temp < min) {
				min = temp;
			}
		}
		
		
		int[] b = {W/3, W/3+1};
		for(int i=0; i<=1; i++) {
			int s1 = b[i] * H;
			int s2;
			int s3;
			if(H%2 == 0) {
				s2 = (W - b[i]) * (H/2);
				s3 = s2;
			} else {
				s2 = (W - b[i]) * (H/2);
				s3 = (W - b[i]) * ((H/2)+1);
			}
			
			int temp = Math.max(Math.max(Math.abs(s1-s2), Math.abs(s2-s3)), Math.abs(s3-s1));
			if(temp < min) {
				min = temp;
			}
		}
		
		System.out.println(min);
	}

	static 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;}
	    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	    public boolean hasNext() { skipUnprintable(); 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() {
	        return Long.parseLong(next());
	    }
	    public int nextInt(){
	    	return Integer.parseInt(next());
	    }
	}
}


Measured memory_bytes: 23124
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << min(a, b) + min(c, d) << endl;
	return 0;
}


Measured memory_bytes: 256