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>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void solve() {
        int N;
        cin >> N;
        vector<int> x(N), y(N), h(N);
        for (int i = 0; i < N; ++i) {
            cin >> x[i] >> y[i] >> h[i];
        }

        for (int cx = 0; cx <= 100; cx++) {
            for (int cy = 0; cy <= 100; cy++) {
                int H = -1;
                if (cx == 2 && cy == 2) {
                    int a = 114 + 514;
                }
                for (int i = 0; i < N; ++i) {
                    int dist = abs(cx - x[i]) + abs(cy - y[i]);
//                    int H = h[0] + dist;
                    if (h[i] > 0 && H < h[i] + dist) {
                        H = h[i] + dist;
                    }
                }
                bool tapi = true;
                for (int i = 0; i < N; ++i) {
                    int dist = abs(cx - x[i]) + abs(cy - y[i]);
                    int hi = max(H - dist, 0);
                    if (hi != h[i]) tapi = false;
                }
                if (tapi) {
                    cout << cx << " " << cy << " " << H << endl;
                    return;
                }
            }
        }


    }
};


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

    Solve().solve();


    return 0;
}


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

#define int long long int
#define ff first
#define ss second
#define pb push_back


int bexp(int a, int b)
{
	int res = 1;

	while (b)
	{
		if (b & 1) res = (res * a);

		a = (a * a); 
		b >>= 1;
	}
	return res;
}

int gcd(int a, int b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}

#define N 200010
#define MOD 1000000007


int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(10);

	int n, m;
	cin >> n >> m;

	int ans = n * (n - 1) / 2 + m * (m - 1) / 2;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e15;
const ll MOD=1000000007;

int main(){
    ll N,M;cin>>N>>M;
    ll info[N];
    rep(i,N)cin>>info[i];
    map<ll,ll,greater<ll>> a;
    rep(i,M){
        ll B,C;cin>>B>>C;
        if(a.count(C)==0)a.emplace(C,B);
        else a.at(C)+=B;
    }
    rep(i,N){
        ll C=info[i];
        if(a.count(C)==0)a.emplace(C,1);
        else a.at(C)+=1;
    }
    ll ans=0;
    ll i=N;
    for(auto p:a){
        if(p.second<i){
            ans+=p.first*p.second;
            i-=p.second;
        }
        else{
            ans+=p.first*i;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

const int mod = 1e9+7;
const int N = 2e5+234;

int fact[N];

void factorial() {
	fact[0] = 1;
	for (long long i = 1; i < N; ++i) {
		fact[i] = (fact[i-1] * i) % mod;
	}
}

long long binpow(long long b, long long e) {
	if (!e) return 1;
	if (e&1) return b*binpow(b, e-1)%mod;
	return binpow(b*b%mod, e/2);
}

int comb(int n, int k) {
	long long bro = fact[n];
	long long naz = ((long long)fact[k]*fact[n-k])%mod;
	return (bro*binpow(naz, mod-2))%mod;
}

void solve() {
	factorial();
	int h, w, a, b; scanf("%d %d %d %d", &h, &w, &a, &b);
	long long ans = 0;
	for (int i = b+1; i <= w; ++i) {
		int n = h-a, m = i;
		long long fi = comb(m+n-2, n-1);
		n = a, m = w-i+1;
		long long se = comb(m+n-2, n-1);
		ans = (ans + fi*se)%mod;
	}
	printf("%lld", ans);
}

int main() {
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>                          
using namespace std;
int a,b,c;         
int main(){
    cin>>a>>b>>c;
    if(a!=b&&a!=c&&b!=c) cout<<"No";
    else if(a==b&&b==c) cout<<"No";
    else cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N;
  while (cin >> N) {
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    A.push_back(-1);
    bool ok = A[0] == 0;
    ll p = 0, res = 0;
    for (int i = 1; i <= N; i++) {
      if (p + 1 == A[i]) {
        p = A[i];
        continue;
      }
      if (p + 1 < A[i]) {
        ok = false;
        break;
      }
      if (p - (i - 1) > 0) {
        ok = false;
        break;
      }
      res += p;
      p = A[i];
    }
    cout << (ok ? res : -1) << endl;
  }
  return 0;
}


Measured memory_bytes: 4864
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)

typedef long long ll;

vector <ll> v;

void solve(void){
    ll N;
    cin >> N;
    v.resize(N);
    ll sum = 0LL;
    rep(N, i) {
        scanf("%lld\n", &v[i]);
        sum += v[i];
    }

    ll ope = N*(N+1LL)/2LL;
    if (sum % ope) {
        cout << "NO" << endl;
        return;
    }
    ll x = sum / ope, cnt = 0LL;
    rep(N, i) {
        ll dif = v[(i+1)%N]-v[i];
        if ((x-dif)%N || dif > x) {
            cout << "NO" << endl;
            return;
        }
        cnt += (x-dif)/N;
    }

    cout << ((cnt == x)?"YES":"NO") << endl;

}

int main(void){
  solve();
  //cout << "yui(*-v・)yui" << endl;
  return 0;
}


Measured memory_bytes: 1152
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, S: str):
    count = 0
    for i in range(N-2):
        if S[i:i+3] == "ABC":
            count += 1
    print(count)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)


if __name__ == '__main__':
    main()


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

#define N 26

struct Node {
    int parent;
    int left;
    int right;
};

Node tree[N];

void setDepth(int depths[], int node, int depth) {
    depths[node] = depth++;
    if (tree[node].left != -1) {
        setDepth(depths, tree[node].left, depth);
    }
    if (tree[node].right != -1) {
        setDepth(depths, tree[node].right, depth);
    }
}

int setHeight(int height[], int node) {
    int h1 = 0, h2 = 0;
    if (tree[node].left != -1) {
        h1 = setHeight(height, tree[node].left) + 1;
    }
    if (tree[node].right != -1) {
        h2 = setHeight(height, tree[node].right) + 1;
    }
    height[node] = max(h1, h2);

    return height[node];
}

int returnSibling(int node) {
    int parent = tree[node].parent;
    if (parent == -1) {
        return -1;
    }
    if (tree[parent].left == node) {
        return tree[parent].right;
    } else {
        return tree[parent].left;
    }
}

int returnDegree(int node) {
    int degree = 0;
    if (tree[node].left != -1) {
        degree++;
    }
    if (tree[node].right != -1) {
        degree++;
    }

    return degree;
}

string returnType(int node) {
    if (tree[node].parent == -1) {
        return "root";
    } else if (tree[node].left != -1 || tree[node].right != -1) {
        return "internal node";
    } else {
        return "leaf";
    }
}

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

    for (int i = 0; i < n; i++) {
        tree[i].parent = -1;
        tree[i].left = -1;
        tree[i].right = -1;
    }

    int id;
    int left;
    int right;
    for (int i = 0; i < n; i++) {
        cin >> id >> left >> right;
        if (left != -1) {
            tree[id].left = left;
            tree[left].parent = id;
        }
        if (right != -1) {
            tree[id].right = right;
            tree[right].parent = id;
        }
    }

    int height[N];
    int depth[N];
    int root;
    for (int i = 0; i < n; i++) {
        if (tree[i].parent == -1) {
            root = i;
            break;
        }
    }
    setHeight(height, root);
    setDepth(depth, root, 0);

    for (int i = 0; i < n; i++) {
        cout << "node " << i << ": ";
        cout << "parent = " << tree[i].parent << ", ";
        cout << "sibling = " << returnSibling(i) << ", ";
        cout << "degree = " << returnDegree(i) << ", ";
        cout << "depth = " << depth[i] << ", ";
        cout << "height = " << height[i] << ", ";
        cout << returnType(i) << endl;
    }
}


Measured memory_bytes: 3196
N = int(input())
L = list(map(int,input().split()))
M = list(map(int,input().split()))
begin = sum(L)
for i in range(N):
    if M[i] > L[i]:
        L[i+1] -= M[i] - L[i]
        L[i] = 0
        L[i+1] = max(L[i+1],0)
    else:
        L[i] -= M[i]
end = sum(L)
print(begin - end)


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


void solve(long long A, long long B, long long C){
    std::cout << min(C, B/A) << endl;

}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256
s = input()
Q = int(input())
flag = 0

before = []
after = []

for i in range(Q):
	query = input().split()
	if query == ["1"]:
		flag = (flag+1)%2
	else:
		if flag == 0:
			if query[1] == "1":
				before.append(query[2])
			else:
				after.append(query[2])
		else:
			if query[1] == "1":
				after.append(query[2])
			else:
				before.append(query[2])

ans = ""
if flag == 0:
	for c in reversed(before):
		print(c,end = "")
	print(s,end = "")
	for c in after:
		print(c,end = "")
else:
	for c in reversed(after):
		print(c,end = "")
	for c in reversed(s):
		print(c,end = "")
	for c in before:
		print(c,end = "")


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

int main() {
	int n;
	cin >> n;
	vector<tuple<int, int, char, long, string>> tmp;
	for (int i = 0; i < n; ++i) {
		int v, w;
		cin >> v >> w;
		char t;
		cin >> t;
		long d;
		cin >> d;
		string s;
		cin >> s;
		tmp.push_back(make_tuple(v, w, t, d, s));
	}
	sort(tmp.begin(), tmp.end());
	for (tuple<int, int, char, long, string>& i : tmp) cout << get<0>(i) << ' ' << get<1>(i) << ' ' << get<2>(i) << ' ' << get<3>(i) << ' ' << get<4>(i) << endl;
}


Measured memory_bytes: 12268
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
typedef pair<ll, int> LI;
typedef vector<LI> VLI;
int main(int argc, char const* argv[])
{
  ll W, H;
  cin >> W >> H;
  VLI pqs;
  for (int i = 0; i < W; i++) {
    ll p;
    cin >> p;
    pqs.push_back(make_pair(p, 0));
  }
  for (int i = 0; i < H; i++) {
    ll q;
    cin >> q;
    pqs.push_back(make_pair(q, 1));
  }

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

  ll p_cnt = 0;
  ll q_cnt = 0;
  ll res = 0;

  for (int i = 0; i < pqs.size(); i++) {
    LI pq = pqs[i];
    int cost = pq.first;
    if (pq.second == 0) {
      res += cost * (H - q_cnt + 1);
      p_cnt++;
    } else {
      res += cost * (W - p_cnt + 1);
      q_cnt++;
    }
  }

  cout << res << endl;

  return 0;
}


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

void reverse(string s);

int main(){
	string s;
	int len;
	
	getline(cin, s);
	len = s.length();
	
	for(len--; len >= 0; len--){
		cout << s[len];
	}
	
	cout << endl; 
	
	return 0;
}


Measured memory_bytes: 3188
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<stack>
#include<cmath>
#include<queue>
using namespace std;
char a[105],b[105],c[105];
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",strout);
	scanf("%s%s%s",a,b,c);
	printf("%c%c%c\n",a[0],b[0],c[0]);
	return 0;
}


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

int main()
{

	int N, M, max = 0;
	cin >> N;
	vector<int> c(N);
	vector<string> s(N);

	for (int i = 0; i < N; i++)
	{
		cin >> s.at(i);
		c.at(i) = 1;
	}

	cin >> M;

	for (int i = N; i < N + M; i++)
	{
		string t;
		cin >> t;
		s.push_back(t);
		c.push_back(1);
	}

	for (int i = 0; i < N; i++)
	{
		if (c.at(i) < 1)
			continue;

		for (int j = i + 1; j < N + M; j++)
		{
			if (s.at(i) == s.at(j) && j < N)
			{
				c.at(i)++;
				c.at(j) = 0;
			}
			else if (s.at(i) == s.at(j) && j >= N)
			{
				c.at(i)--;
				c.at(j) = 0;
			}
		}
		if (c.at(i) > max)
			max = c.at(i);
	}
	if (max > 0)
		cout << max << endl;
	else
		cout << 0;
}


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

int main(void){
    int n,l;
    cin>>n>>l;

    vector<int> a(n);
    int sum = 0;
    for(int i=0;i<n;i++){
        a[i] = l+i;
        sum += a[i];
    }

    int min = 100000;
    int piv;

    for(int i=0;i<n;i++){
        if(abs(sum -(sum - a[i])) < min){
            min = abs(sum - (sum -a[i]));
            piv = a[i];
        }
    }
    cout<<sum-piv<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 40000001;
const int mod = 1e9 + 7;
LL a[N + 20], fact[N + 20], inv[N + 20];
LL qpow(LL a, LL b, LL p = mod) {
	LL ans = 1;
	for (; b; b >>= 1) {
		if (b & 1) ans = ans * a % p;
		a = a * a % p;
	}
	return ans % p;
}
void prework() {
	fact[0] = 1;
	for (int i = 1; i <= N; i++) fact[i] = fact[i - 1] * i % mod;
	inv[N - 1] = qpow(fact[N - 1], mod - 2) % mod;
	for (int i = N - 2; ~i; i--) inv[i] = inv[i + 1] * (i + 1) % mod;
}
LL nCr(int n, int r) {  // calculate nCr
	if (n - r < 0 || r < 0) return 0;
	return fact[n] % mod * inv[r] % mod * inv[n - r] % mod % mod;
}
int main() {
  int k; cin >> k;
  string s; cin >> s;
  int n = s.length();
  prework();
  int S = 26;  // alphabet size
  LL ans = qpow(S, n + k);
  for (int r = 0; r < n; r++) {
    LL v = nCr(n + k, r) * qpow(S - 1, n + k - r) % mod;
    ans = (ans - v + mod * 2) % mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 629388
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii> 
using vec = vector<T>;

const ll INF = numeric_limits<ll>::max(),
         MOD = 1e9 + 7;

const int INF_i = numeric_limits<int>::max(),
          MAX = 1e6;


vec<vec<pii> > adj;
vec<bool> res;
void dfs(int curr = 0, int prev = -1, bool c = 0) {
    res[curr] = c;
    for (pii edge : adj[curr]) {
        int node = edge.first;
        if (node == prev) continue;
        dfs(node, curr, c ^ edge.second);
    }
}

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    // freopen("in.in", "r", stdin);
    int n;
    cin >> n;
    adj.resize(n);
    res.resize(n);

    for (int i = 0; i < n - 1; i++) {
        int a, b, w;
        cin >> a >> b >> w;
        a--, b--, w &= 1;
        adj[a].push_back({b, w});
        adj[b].push_back({a, w});
    }
    dfs();
    for (bool e : res) {
        cout << e << '\n';
    }
}

Measured memory_bytes: 7808
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//関係性は隣接行列で記録
//過半数：N/2.0で判定
//ある量からある量を引く系の問題：端から定義してやる
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	ll N; cin >> N;
	vector<ll> A(N - 1); rep(i, N-1) cin >> A[i];

	map<ll, ll> p;

	rep(i, N - 1)p[A[i]-1]++;

	rep(i,N) {
		cout << p[i] << endl;
	}
}
	

Measured memory_bytes: 25236
#include <iostream>
int main(){
    int n,m,x,y;
    std::cin >> n >> m;
    int gyouretu[n][m];
    int bectol[m];
    for(int a = 0;a < n;a++){
        for(int b = 0;b < m;b++){
            std::cin >> gyouretu[a][b];
        }
    }
    for(int c = 0;c < m;c++){
        std::cin >>bectol[c];
    }
    for(int d = 0;d < n;d++){
        y = 0;
        for(int e = 0;e < m;e++){
            x = bectol[e] * gyouretu[d][e];
            y = y + x;
            x = 0;
        }
        std::cout << y <<std::endl;
    }
}

Measured memory_bytes: 3120
#include <functional>
#include <iostream>


#define EPSILON 1e-9
 
 
class vector_t {
public:
  double x;
  double y;
  double z;
 
public:
  vector_t(double x = 0, double y = 0, double z = 0) : x(x), y(y), z(z) {};
 
public:
  vector_t operator^(const vector_t& v) const {
    return vector_t(y * v.z - z * v.y,
                    z * v.x - x * v.z,
                    x * v.y - y * v.x);
  };
};
 
 
class point_t {
public:
  double x;
  double y;
  double z;
  double w;
 
public:
  point_t(double x = 0, double y = 0, double z = 0, double w = 1) : x(x), y(y), z(z), w(w) {};
   
public:
  vector_t operator-(const point_t& p) const {
    return vector_t(x - p.x, y - p.y, z - p.z);
  };
};
 
 
class point_triangle_intersect : public std::unary_function<point_t, bool> {
public:
  point_triangle_intersect(const point_t& p1,
                           const point_t& p2,
                           const point_t& p3) :
    p1_(p1), p2_(p2), p3_(p3), s_(((p2 - p1) ^ (p3 - p1)).z)
  {
  };
 
public:
  bool operator()(const point_t& p) const {
    double u = ((p1_ - p3_) ^ (p - p3_)).z / s_;
    double v = ((p2_ - p1_) ^ (p - p1_)).z / s_;

    return (u >= 0 && v >= 0 && u + v <= 1.0 + EPSILON);
  };
 
private:
  point_t p1_;
  point_t p2_;
  point_t p3_;

  double s_;
};
 
 
int main(int argc, char** argv)
{
  double x1, y1, x2, y2, x3, y3, xp, yp;
 
  while (std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
    point_t p1(x1, y1);
    point_t p2(x2, y2);
    point_t p3(x3, y3);
    point_t p (xp, yp);
 
    if (point_triangle_intersect(p1, p2, p3)(p)) {
      std::cout << "YES" << std::endl;
    }
    else {
      std::cout << "NO" << std::endl;
    }
  }
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
int n;
int a[100100];
int v[100100];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	long long res=0;
	for(int i=1;i<=n;i++){
		if(a[i]!=0)
			v[i]=true;
		res+=(long long)(a[i]/2);
		a[i]%=2;
	}
	for(int i=1;i<=n;i++){
		if(a[i]&&a[i+1]){
			res++;
			a[i]=0;
			a[i+1]=0;
		}
		if(a[i]&&v[i+1]){
			a[i+1]=1;
			a[i]=0;
		}
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int main(){
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    pair<double, pair<int, int> > res = make_pair(-1, make_pair(-1, -1));
    for(int a=0; a*100*A<=F; a++){
        for(int b=0; a*100*A+b*100*B<=F; b++){
            int w = a*100*A+b*100*B;
            int max_suger = w/100*E;
            for(int c=0; w+c*C<=F && c*C<=max_suger; c++){
                for(int d=0; w+c*C+d*D<=F && c*C+d*D<=max_suger; d++){
                    int s = c*C+d*D;
                    if(w+s==0)continue;
                    double tmp = 100.0*s/(w+s);
                    //if(tmp>res.first){
                    //    cerr << tmp << ", res: " << res.first << ", a: " << a << "b: " << b << "c: " << c << "d: " << d << endl;
                    //}
                    res = max(res, make_pair(tmp, make_pair(w+s, s)));
                }
            }
        }
    }
    cout << res.second.first << " " << res.second.second << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <stack>
#include <unordered_map>
#include <utility>
#include <vector>

// Aliases
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;

using std::cout;
using std::cerr;
using std::cin;
using std::endl;
using std::string;
using std::vector;
using std::array;

ll continuous(std::string& str, const char c, ll cnt, i32 idx, ll dir)
{
    if (idx < 0 || idx >= static_cast<i32>(str.size())) { return cnt; }

    if (str[idx] != c) { return cnt; }

    return continuous(str, c, cnt + 1, idx + dir, dir);
}

ll cnt_change(std::string& str)
{
    ll cnt = 0;
    for (i32 i = 0; i < static_cast<i32>(str.size()); )
    {
        ll c = continuous(str, str[i], 0, i, 1);
        cnt += c / 2;
        i += c;
    }

    return cnt;
}

void trim(std::string& str)
{
    if (str.size() <= 0) { return; }

    while (str[0] == ' ')
    {
        str = str.substr(1, str.size() - 1);
    }

    while (str[str.size() - 1] == ' ')
    {
        str = str.substr(0, str.size() - 1);
    }
}

bool same(std::string& str)
{
    for (u32 i = 0; i < str.size(); i++)
    {
        if (str[i] != str[0]) { return false; }
    }

    return true;
}

int main()
{
    std::string str;
    ll k;
    cin >> str >> k;

    if (str[0] != str[str.size() - 1])
    {
        cout << cnt_change(str) * k << endl;
    }
    else
    {
        ll end = continuous(str, str[str.size() - 1], 0, str.size() - 1, -1);
        auto head = str.substr(0, str.size() - end);
        auto tail = str.substr(str.size() - end);
        auto new_str = tail + head;
        trim(new_str);
        ll ans = 0;
        if (new_str.size() == 0)
        {
            ans = 0;
        }
        else if (same(new_str))
        {
            ans = new_str.size() * k / 2;
        }
        else
        {
            ans = cnt_change(head)
                + cnt_change(new_str) * (k - 1)
                + cnt_change(tail);
        }

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
    int n,l;
    VI a;
    cin >> n >> l;
    REP(i, n){
        int x;
        cin >> x;
        a.PB(x);
    }


    bool flag = false;
    REP(i, n-1){
        if(l <= a[i]+a[i+1]){
            flag = true;
            cout << "Possible" << endl;
            REP1(j, i+1){
                cout << j << endl;
            }

            for(int j=n-1; j>=i+2; j--){
                cout << j << endl;
            }
            cout << (i+1) << endl;
            return 0;
        }
    }
    if(!flag){
        cout << "Impossible" << endl;
    }
}


Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int Judge(ll n, int k, const vector<ll> & d) {
	int i, s = 0;
	rep(i, d.size()) {
		if ((n & d[i]) == n)
			s++;
	}
	return s >= k;
}

int main(void) {
	int num, i, j, k;
	ll ans = 0;
	cin >> num >> k;
	vector<ll> a(num + 1), d;
	for (i = 1; i <= num; i++)
		cin >> a[i];
	rep(i, num)
		a[i + 1] += a[i];
	rep(i, num) {
		for (j = i + 1; j <= num; j++)
			d.push_back(a[j] - a[i]);
	}
	for (i = 40; i >= 0; i--) {
		if(Judge((1ll << i) + ans, k, d))
			ans += 1ll << i;
	}
	cout << ans << "\n";
	return 0;
}

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

// dist[i][j] ... i <= j
int dist[2000][2000];

int main()
{
    int n, x, y;
    cin >> n >> x >> y;
    x--; y--;

    for (int i = 0; i < n; i++)
        dist[i][i] = 0;
    for (int i = 0; i < n - 1; i++)
        dist[i][i + 1] = 1;

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (i <= x) {
                if (j <= x) {
                    dist[i][j] = j - i;
                } else if (x < j && j < y) {
                    // i <= x < j < y
                    dist[i][j] = min(j - i, (y - j) + 1 + (x - i));
                } else {
                    // i <= x < y <= j
                    dist[i][j] = min(j - i, (j - y) + 1 + (x - i));
                }
            } else if (i < y) {
                // x < i < y
                if (j < y) {
                    // x < i < j < y
                    dist[i][j] = min(j - i, (y - j) + 1 + (i - x));
                } else {
                    // x < i < y <= j
                    dist[i][j] = min(j - i, (j - y) + 1 + (i - x));
                }
            } else {
                // y <= i < j
                dist[i][j] = j - i;
            }
        }
    }
    // for (int i = 0; i < n; i++) {
    //     for (int j = 0; j < n; j++) {
    //         printf("%3d ", dist[i][j]);
    //     }
    //     cout << endl;
    // }
    vector<int> cnt(n, 0);
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            cnt[dist[i][j]]++;
        }
    }
    for (int i = 1; i < n; i++) {
        cout << cnt[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 17348
#include <stdio.h>
#include <stdlib.h>
int main(){
  char s[16];
  int S[100],p=0;
  while (scanf("%s ",s)!=EOF){
    int a,b;
    if(s[0]<'.'){
      a=S[--p];b=S[--p];
      if(*s=='*')S[p++]=b*a;
      else if(*s=='+')S[p++]=b+a;
      else if(*s=='-')S[p++]=b-a;
    }
    else
      S[p++]=atoi(s);
  }
  printf("%d\n", S[--p]);
  return 0;
}

Measured memory_bytes: 552
#include <stdio.h>

int main(void)
{
	int a, b, x;
  	char op[2];
  
	scanf("%d%s%d", &a, op, &b);

  	x = (op[0]=='+')? a+b : a-b;
  
  	printf("%d\n", x);
  
	return 0;
}

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

using namespace std;

long func1(long N, vector<long> a, vector<long> b){
    long ans = 0;
    for(int i=0; i<N; ++i){
        if(a[i] <= b[i]){
            ans += a[i];
            b[i] -= a[i];
            a[i] = 0;
            if(a[i+1] <= b[i]){
                ans += a[i+1];
                b[i] -= a[i+1];
                a[i+1] = 0;
            }else{
                ans += b[i];
                a[i+1] -= b[i];
                b[i] = 0;
            }
        }else{
            ans += b[i];
            a[i] -= b[i];
            b[i] = 0;
            if(a[i+1] <= b[i]){
                ans += a[i+1];
                b[i] -= a[i+1];
                a[i+1] = 0;
            }else{
                ans += b[i];
                a[i+1] -= b[i];
                b[i] = 0;
            }
        }
    }
    return ans;
}

int main(){
    long N;
    cin>>N;

    vector<long> A(N+1), B(N);
    for(int i=0; i<N+1; ++i){
        cin>>A[i];
    }
    for(int i=0; i<N; ++i){
        cin>>B[i];
    }

    long ans1=func1(N, A, B);
    //long ans2=func2(A, B);
    cout<<max(ans1, long(0))<<endl;

    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=2e5;
const int inf=1e9;
int main(){
	long n,s;cin>>n>>s;
	if(n > s){
		set<long> st;
		rep(i,1,1000000){
			if((n - s) % i) continue;
			st.insert(i + 1);
			st.insert((n - s)/i + 1);
		}
		for(long b:st){
			long temp = n,sum = 0;
			while(temp){
				sum += temp % b;
				temp /= b;
			}
			if(sum == s){
				cout<<b<<endl;
				return 0;
			}
		}cout<<-1<<endl;
	}else if(n == s) cout<<n + 1<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 384
function main(input){
	var x = 2, y = Number(input), z, a = x * y;
	if (x < y) {
		t = x;
		x = y;
		y = t;
	}

	z = x % y;
	while (z !== 0) {
		x = y;
		y = z;
		z = x % y;
	}

	console.log(a / y);
}
     
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <iostream>
#include <algorithm>
#include <complex>
#include <vector>
#include <cmath>
using namespace std;
typedef complex<double> P;

const int MAXN = 11;
const double eps = 1e-7;
const double inf = 1e100;
int N, M;
vector<P> Ds;
vector<double> V;
int num[MAXN];

bool equals(double a, double b) {
  return abs(a-b) < eps;
}

double getT(P p, P v, P d, double sp) {
  double a = v.real()*v.real() + v.imag()*v.imag() - sp*sp;
  double b = v.real()*(p.real()-d.real()) + v.imag()*(p.imag()-d.imag());
  double c = (p.real()-d.real())*(p.real()-d.real())
    + (p.imag()-d.imag())*(p.imag()-d.imag());
  double D = b*b - a*c;
  vector<double> t;
  if(equals(D, 0.0)) {
    t.push_back(-b/a);
  } else if(D > 0.0) {
    t.push_back((-b+sqrt(D))/a);
    t.push_back((-b-sqrt(D))/a);
  }
  double res = inf;
  for(int i = 0; i < t.size(); ++i) {
    if(t[i] < 0) continue;
    res = min(res, t[i]);
  }
  return res;;
}

void fly(P p, P v) {
  int getD = -1;
  double minT = inf;
  double t[MAXN];
  for(int i = 0; i < N; ++i) {
    t[i] = getT(p, v, Ds[i], V[i]);
    if(t[i] < minT) {
      getD = i;
      minT = t[i];
    }
  }
  ++num[getD];
  for(int i = 0; i < N; ++i) {
    if(t[i] == inf) continue;
    P endp = p + v*t[i];
    P base = endp - Ds[i];
    Ds[i] += base/abs(base)*V[i]*minT;
  }
}

int main() {
  while(cin >> N >> M && (N|M)) {
    Ds.resize(N);
    V.resize(N);
    for(int i = 0; i < N; ++i) {
      cin >> Ds[i].real() >> Ds[i].imag() >> V[i];
    }
    fill(num, num+MAXN, 0);
    while(M--) {
      P p, v;
      cin >> p.real() >> p.imag() >> v.real() >> v.imag();
      fly(p, v);
    }
    for(int i = 0; i < N; ++i) {
      if(i) cout << " ";
      cout << num[i];
    }
    cout << endl;
  }
  return 0;
}

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

l = list(map(int,input().split()))

l.reverse()

x = 0

sum_x = []

for i in range(n-1):
    x += l[i]
    sum_x.append(x)

sum_y = [sum(l)]*(n-1)

for i in range(n-1):
    sum_y[i] -= sum_x[i]
    
abs_xy = []

for i in range(n-1):
    abs_xy.append(abs(sum_x[i]-sum_y[i]))

print(min(abs_xy))

Measured memory_bytes: 37732
def koch(x0,y0, x1,y1, n):
    if n == 0:
        return [(x0,y0)]
    else:
        v = (y0-y1,x1-x0)
        #print(type(n))
        #print(n[0])
        m = ((x0+x1)/2,(y0+y1)/2)
        c1 = ((2*x0+x1)/3,(2*y0+y1)/3)
        #print(m[0],n[0],m[1],n[1])
        c2x = m[0]+v[0]/(2*(3**(1/2)))
        c2y = m[1]+v[1]/(2*(3**(1/2)))
        c2 = (c2x,c2y)
        c3 = ((x0+2*x1)/3,(y0+2*y1)/3)
        return koch(x0,y0, c1[0],c1[1], n-1) \
        + koch(c1[0],c1[1], c2[0],c2[1], n-1) \
        + koch(c2[0],c2[1], c3[0],c3[1], n-1) \
        + koch(c3[0],c3[1], x1,y1, n-1)
def show_vertex(x,y):
    print("%.8f %.8f" % (x,y))

N = int(input())
V = koch(0,0,100,0,N)+[[100,0]]
for x,y in V:
    show_vertex(x,y)



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

using namespace std;

const int N = 2e5 + 3;

int n;
int t[N * 4], b[N * 4];
int tin[N], tout[N], timer;
vector <int> g[N], vec[N];

void dfs(int v, int pr = -1) {
    tin[v] = ++ timer;
    for (int to : g[v]) {
        if (to == pr)
            continue;
        dfs(to, v);
    }
    tout[v] = timer;
}

bool cmp(int a, int b) {
    return tin[a] > tin[b];
}

void push(int v, int tl, int tr) {
    if (b[v] != -1)
        t[v] = (tr - tl + 1) * b[v];
    if (tl != tr && b[v] != -1) {
        b[v << 1] = b[v];
        b[v << 1 | 1] = b[v];
    }
    b[v] = -1;
}

void upd(int l, int r, int val, int v = 1, int tl = 1, int tr = n) {
    push(v, tl, tr);
    if (l > tr || tl > r) return ;
    if (l <= tl && tr <= r) {
        b[v] = val;
        push(v, tl, tr);
        return ;
    }
    int tm = (tl + tr) >> 1;
    upd(l, r, val, v << 1, tl, tm);
    upd(l, r, val, v << 1 | 1, tm + 1, tr);
    t[v] = t[v << 1] + t[v << 1 | 1];
}

int get(int l, int r, int v = 1, int tl = 1, int tr = n) {
    push(v, tl, tr);
    if (l > tr || tl > r) return 0;
    if (l <= tl && tr <= r) return t[v];
    int tm = (tl + tr) >> 1;
    return get(l, r, v << 1, tl, tm) +
            get(l, r, v << 1 | 1, tm + 1, tr);
}

long long f(int x) {
    return (x + 1) * 1ll * x / 2;
}

int main() {
    cin >> n;

    for (int i = 1, c; i <= n; i++) {
        cin >> c;
        vec[ c ].push_back(i);
    }

    for (int i = 1, u, v; i < n; i++) {
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    dfs(1);

    upd(1, n, 1);

    for (int i = 1; i <= n; i++) {
        sort(vec[i].begin(), vec[i].end(), cmp);
        vector <int> a = vec[i];
        long long ret = f(n);
        for (int x : a) {
            for (int to : g[x]) {
                if (tin[to] < tin[x]) continue;
                ret -= f(get(tin[to], tout[to]));
            }
            upd(tin[x], tout[x], 0);
        }
        ret -= f(get(1, n));
        cout << ret << "\n";
        upd(1, n, 1);
    }
}


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

int main(){
    int n,l;
    string res="";
    cin >> n >> l;
    string s[110];
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    sort(s,s+n);
    for(int i=0;i<n;i++){
        res+=s[i];
    }
    cout << res << endl;
}

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

int main(){
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);
	string s;
	int n;
	bool f = 0;
	cin>>n;
	int r = 111;
	for(int i = 1; i<10; i++)
		if(r*i >= n){
		 cout<<r*i<<'\n';
		 break;
		}
}


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

int main()
{
	int n;
	float b=100000;

	cin>>n;

	for(int i=0;i<n;i++){
		b*=1.05;
		b=(int)((b+999)*0.001);
		b*=1000;
	}
	cout<<(int)b<<endl;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>

using namespace std;
constexpr int MAXN = 10000003;

int prime[MAXN];
bool is_prime[MAXN];

int sieve(int n){
    int res = 0;
    fill(is_prime, is_prime + MAXN, true);
    is_prime[0] = is_prime[1] = false;
    for(int i  =2; i <= n; i++){
        if(!is_prime[i])continue;
        prime[res++] = i;
        for(int j = 2*i; j <= n; j+= i) is_prime[j] = false;
    }
    return res;
}

int a[MAXN] = {};

int main(){
    int hoge = sieve(MAXN - 1);
    a[13] = 13;
    for(int i = 13; i < MAXN; i++){
        if(is_prime[i] && is_prime[i - 2] && is_prime[i - 6] && is_prime[i - 8]) a[i] = i;
        a[i] = max(a[i], a[i - 1]);
    }

    while(1){
        int n; cin >> n;
        if(!n) break;
        cout << a[n] << endl;
    }

    return 0;
}



Measured memory_bytes: 54472
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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

int main() {
  int x;
  cin >> x;
  int ans = 1;
  ll tmp;
  for (int i = 2; i < x + 1; i++) {
    tmp = i;
    while (1) {
      tmp *= i;
      if (tmp > x) break;
      ans = max((int)tmp, ans);
    }
  }
  P(ans);
  return 0;
}



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

int main(){
    int D;
    cin>>D;
    if(D==25)   cout<<"Christmas"<<endl;
    if(D==24)   cout<<"Christmas Eve"<<endl;
    if(D==23)   cout<<"Christmas Eve Eve"<<endl;
    if(D==22)   cout<<"Christmas Eve Eve Eve"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
  int n;
  cin >> n;
  map<pair<ll, ll>, ll> mp;
  map<pair<ll, ll>, bool> mpb;
  mint zeze = 0;
  rep(i, n){
    ll a, b;
    cin >> a >> b;
    if(a == 0 && b == 0){
      zeze += 1;
      continue;
    }
    if(a == 0 || b == 0){
      if(a == 0){
        mp[{a, 1}]++;
        mpb[{a, 1}] = false;
      }else{
        mp[{1, b}]++;
        mpb[{1, b}] = false;
      }
      continue;
    }
    if(a < 0){
      a *= -1;
      b *= -1;
    }
    ll g = gcd(a, b);
    mp[{a/g, b/g}]++;
    mpb[{a/g, b/g}] = false;
  }

  mint ans = 1;
  for(auto p : mp){
    if(mpb[p.first] == true) continue;
    pair<ll, ll> t = {p.first.second, -p.first.first};
    if(t.first < 0){
      t.first *= -1;
      t.second *= -1;
    }
    if(t.first == 0){
      t.second *= -1;
    }

    mint add = 1;
    mint po = 2;
    po = po.pow(p.second);
    po -= 1;
    add += po;
    mpb[p.first] = true;
    if(mp.count(t) == 1){
      po = 2;
      po = po.pow(mp[t]);
      po -= 1;
      add += po;
      mpb[t] = true;
    }
    ans *= add;
  }
  ans -= 1;
  ans += zeze;
  cout << ans.x << endl;

  return 0;
}

Measured memory_bytes: 28496
def main():
    n, *a = map(int, open(0).read().split())
    if n == 1:
        print(1)
        return

    m = max(a) + 1
    l = [0] * m
    for i in a:
        for j in range(i, m, i):
            l[j] += 2
        l[i] -= 1

    ans = sum(l[i] == 1 for i in a)
    print(ans)


if __name__ == "__main__":
    main()


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

now = [0,0,0]
for i in range(n):
    s = list(map(int,input().split()))
    time = s[0] - now[0]
    dis = abs(s[1] - now[1]) + abs(s[2] - now[2])
    if time < dis or (time-dis)%2 == 1:
        print("No")
        exit()
    now = s

print("Yes")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  vector<int> num(3);
  cin>>num[0]>>num[1]>>num[2];
  sort(num.begin(),num.end());
  int sum=0;
  sum=num[1]-num[0];
  sum+=num[2]-num[1];
  cout<<sum<<endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int[] array = new int[]{in.nextInt(), in.nextInt(), in.nextInt()};
            Arrays.sort(array);

            System.out.println(Arrays.equals(array, new int[]{5, 5, 7}) ? "YES" : "NO");
        }

    }
}



Measured memory_bytes: 9552
#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>;

const double pi = 3.141592653589793;

int main() {
    double R;
    cin >> R;
    double ans = 2 * pi * R;
    cout << fixed << setprecision(4) << ans << endl;
}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

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

	int N;
	cin >> N;

	vector<ll> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> plus, minus;
    rep(i, N){
        if(A[i] >= 0) plus.push_back(A[i]);
        else minus.push_back(A[i]);
    }

    sort(plus.begin(), plus.end(), greater<ll>());
    sort(minus.begin(), minus.end());

    if(minus.empty()) minus.push_back(plus.back()), plus.pop_back();
    if(plus.empty()) plus.push_back(minus.back()), minus.pop_back();

    vector<pll> res;
    ll cur = minus[0];
    for(int i = 0; i+1 < plus.size(); i++){
        res.push_back({cur, plus[i]});
        cur -= plus[i];
    }

    res.push_back({plus.back(), cur});
    cur = plus.back() - cur;

    for(int i = 1; i < minus.size(); i++){
        res.push_back({cur, minus[i]});
        cur -= minus[i];
    }

    cout << cur << endl;
    for(auto p : res) cout << p.first << " " << p.second << endl;

}


Measured memory_bytes: 6000
using System;
using System.Collections.Generic;

    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();
            string[] strinputArray = input.Split(' ');
            int[] intinputArray = Array.ConvertAll<string, int>(strinputArray, delegate (string value) { return int.Parse(value); });
            
            if(intinputArray[0] > intinputArray[1])
            {
                if(intinputArray[0] - 1 > intinputArray[1])
                {
                    Console.WriteLine(intinputArray[0] + intinputArray[0] - 1);
                }
                else
                {
                    Console.WriteLine(intinputArray[0] + intinputArray[1]);
                }
            }
            else
            {
                if (intinputArray[0] < intinputArray[1] - 1)
                {
                    Console.WriteLine(intinputArray[1] + intinputArray[1] - 1);
                }
                else
                {
                    Console.WriteLine(intinputArray[0] + intinputArray[1]);
                }
            }
            Console.ReadLine();
        }
    }

Measured memory_bytes: 11092