akhauriyash/Code-Regression huggingface dataset:
use std::cmp::Ordering;
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let mut iter = line.split_whitespace().map(|s| s.parse::<i32>().unwrap());
    let (a, b) = (iter.next().unwrap(), iter.next().unwrap());
    match a.cmp(&b) {
        Ordering::Equal => println!("a == b"),
        Ordering::Greater => println!("a > b"),
        Ordering::Less => println!("a < b"),
    };
}



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

#define ll long long
#define For(i,a,b) for(int (i)=(a);(i) < (b); ++(i))

const int N =100;

bool isprime(int n)
{
    if (n <= 1)
        return false;
    for (int i = 2; i*i<=n; i++)
        if (n % i == 0)
            return false;

    return true;
}
int binarySearch(int arr[], int l, int r, int x)
{
    if (r >= l) {
        int mid = l + (r - l) / 2;
        if (arr[mid] == x)
            return mid;
        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);
        return binarySearch(arr, mid + 1, r, x);
    }
    return -1;
}
long long lcm(long long a,long long b)
{
    long long p,r;
    p = a*b;
    r = __gcd(a, b);
    return p/r;
}
bool ispalindrome(string s)
{
    int n = s.length();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
            return false;
    }
    return true;
}
bool isPerfectSquare(long double x)
{
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);

}
ll f(ll n) {
	return n * (n - 1) / 2;
}
bool cmp(const tuple<int, string, string>& a,
               const tuple<int, string, string>& b)
{
    return (get<0>(a) < get<0>(b));
}

void solve()
{
    ll n,x,t,p;
    cin>>n>>x>>t;
    p = n/x;
    if(n%x)
    {
        p++;
    }
    cout<<t*p<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll a;
    cin >> a;

    ll v = gcd(360, a);

    cout << 360 / v << endl;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <numeric>
#include <complex>

using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const int INF = (1<<30);
const ll INFL = (1LL<<62);
const ll MOD = 1000000007;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> ll mod_pow(ll a, ll n, T mod) { mod=(ll)mod; ll res=1, p=a%mod; while(n){ if(n&1) res=res*p%mod; p=p*p%mod; n>>=1; } return res; }
template<int mod>
struct ModInt {
    using ll = long long; ll x;
    ModInt() : x(0) {}
    ModInt(int y) : x(y >= 0 ? ll(y % mod) : (ll)((mod - (-y) % mod))) {}
    ModInt(ll y) : x(y >= 0 ? y % mod : (mod - (-y) % mod)) {}
    ModInt &operator+=(const ModInt &rhs) { if((x += rhs.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &rhs) { if((x += mod - rhs.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &rhs) { x = x * rhs.x % mod; return *this; }
    ModInt &operator/=(const ModInt &rhs) { *this *= rhs.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(const ModInt &rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(const ModInt &rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(const ModInt &rhs) const { return ModInt(*this) /= rhs; }
    ModInt operator==(const ModInt &rhs) const { return x == rhs.x; }
    ModInt operator!=(const ModInt &rhs) const { return x != rhs.x; }
    friend ostream &operator<<(ostream &os, const ModInt &rhs) { return os << rhs.x; }
    friend istream &operator>>(istream &is, ModInt &rhs) { ll t; is >> t; rhs = ModInt<mod> (t); return (is); }
private:
    ModInt inverse() const { ll a = x, u = 1LL, v = 0LL, t, b = (ll)mod; while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); } return  ModInt(u); }
};
using mint = ModInt<MOD>;

int main() {
    int N,K;
    cin >> N >> K;
    vector<int> h(N);
    rep(i, N) cin >> h[i];
    vector<ll> dp(N+10);
    fill(all(dp), INFL);
    dp[0] = 0;
    rep(i, N){
        for(int k=1; k <= K; k++){
            if(i+k >= N) continue;
            chmin(dp[i+k], dp[i]+(ll)abs(h[i] - h[i+k]));
        }
    }
    cout << dp[N-1] << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
using namespace std;

int main(){
    int n, t0;
    cin >> n >> t0;
    vector<int> t(n);
    for(int i = 0; i < n; i++) cin >> t[i];

    long long int ans = t0;

    for(int i = 1; i < n; i++){
        if(t[i]-t[i-1] >= t0) ans += t0;
        else ans += t[i]-t[i-1];
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4004
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n + 1);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[i + 1] = a[i] + x;
  }
  long long ans = 0;
  map<long long, long long> cnt;
  for (int i = 0; i <= n; i++) {
    ans += cnt[a[i]];
    cnt[a[i]]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 14336
l = []
for _ in range(5):
    a = int(input())
    b = 10 - a % 10
    if b == 10:
        b = 0
    l.append([a, b])

m = 0
r = 0
total = 0
for a, b in l:
    if b > r:
        m = a
        r = b
    elif b == r and a < m:
        m = a
        r = b
    total += a + b

print(total - r)


Measured memory_bytes: 3060
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;



int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> work(M);
	int num = 0;

	for (int i = 0; i < M; i++) {
		cin >> work[i];
	}
	for (int i = 0; i < M; i++) {
		num += work[i];
	}
	if (num <= N) {
		cout << N - num << endl;
	}
	else {
		cout << "-1" << endl;
	}
}

Measured memory_bytes: 3664
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

//powMod
ll powMod(ll k, ll n, ll mod) {
    ll x = 1;
    while (n > 0) {
        if (n & 1) {
            x = x * k % mod;
        }
        k = k * k % mod;
        n >>= 1;
    }
    return x;
}

int main() {
    int n, p; cin >> n >> p;
    string s; cin >> s;
    ll ans = 0;
    if (p == 5 || p == 2) {
        for (int i = 0; i < n; i++) {
            if (((s[i] - '0') % p) == 0) {
                ans += i + 1;
            }
        }
    }
    else {
        vector<int> cnt(p, 0);
        cnt[0] = 1;
        ll sum = 0;
        for (int i = n - 1; i >= 0; i--) {
            sum += (powMod(10, n - i - 1, p) * (ll)(s[i] - '0')) % p;
            sum %= p;
            ans += cnt[sum];
            cnt[sum]++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <iostream>

using namespace std;

typedef long long ll;

const ll MAX_N = 1E10;

ll N;

ll solve(ll n);
int getDigit(ll n);

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

    cin >> N;

    cout << solve(N) << "\n";

    return 0;
}

ll solve(ll n)
{
    ll a = 1;
    ll b = n;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            a = i;
            b = n / i;
        }
    }

    return getDigit(b);
}

int getDigit(ll n)
{
    int d = 0;
    while (n > 0) {
        d++;
        n /= 10;
    }
    return d;
}

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int abs(int X){
    return X >= 0 ? X : -X;
}

int main(){
    int A, B, V, W, T;
    cin >> A >> V >> B >> W >> T;

    int distance = abs(B - A);
    int step = V - W;
    
    if (step <= 0) {
        cout << "NO" << endl;
    } else {
        unsigned long long int move = step * T;
        if(distance <= move){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007
ll gcd(ll a, ll b) {
    return b != 0ll ? gcd(b, a%b) : a;
}

map<ll, ll> prime_factorization(ll n){
    map<ll,ll> ret;
    for(ll i=2ll;i*i<=n;i ++){
        while(n%i==0ll){
            ret[i] ++;
            n /= i;
        }
    }
    if(n!=1ll) ret[n]=1ll;
    return ret;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //start = chrono::system_clock::now();
        ll A, B;
        cin >> A >> B;
        ll div = gcd(A,B);
        auto divs = prime_factorization(div);
        cout << divs.size()+1 << endl;
    //end = chrono::system_clock::now();
    //cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
    return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) { os << p.first << " " << p.second; return os; }

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; }return false; }
template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>A(N); rep(i, 0, N) { cin >> A[i]; }
	vector<int>B(A);
	int sum = 0;
	rep(i, 0, N) {
		sum += abs(A[i]);
		B[i] = abs(A[i]);
	}
	int zero = count(all(A), 0);
	if (zero) {
		int ans = 0;
		rep(i, 0, N) {
			ans += abs(A[i]);
		}
		cout << ans << endl;
	}
	else {
		rep(i, 0, N - 1) {
			if (A[i] < 0) {
				A[i] *= -1;
				A[i + 1] *= -1;
			}
		}
		dump(A);
		dump(B);
		if (A[N - 1] < 0) {
			sum -= (*min_element(all(B)))*2;
		}
		cout << sum << endl;
	}
	

	return 0;
}


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

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>

using namespace std;

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

const ll MOD = 1000000007;
const ll INF = 99999999;


int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (c >= a && c <= b)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    char a[4];
    scanf("%s",a);
    for(int i=0;;i++){
        if(a[i]=='7'){
            printf("Yes\n");
            break;
        }
        if(a[i]=='\0'){
            printf("No\n");
            break;
        }
    }

}

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

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265358979323846;

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

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

class AFairness {
public:
	void solve(std::istream& in, std::ostream& out) {
		ll a, b, c, k; in>>a>>b>>c>>k;
		if(k&1) out<<b-a;
		else out<<a-b;
	}
};


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


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

# ハーシャッド数

N = int(input())
N_l = list(str(N))
h_x = 0

for x in N_l:
    h_x = h_x + int(x)

if N % h_x == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
#define F first
#define S second
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  cout << fixed << setprecision(10);
  string s;
  cin >> s;
  if(s.at(s.size()-1)=='s'){
    cout << s << "es" << endl;
  }else{
    cout << s << "s" << endl;
  }
}


Measured memory_bytes: 3596
package main

import "fmt"

func main() {
	var r, c int
	fmt.Scan(&r, &c)

	a := make([][]int, r+1)
	for i := 0; i < r+1; i++ {
		a[i] = make([]int, c+1)
	}

	for i := 0; i < r; i++ {
		a[i] = make([]int, c+1)
		for j := 0; j < c; j++ {
			fmt.Scan(&a[i][j])
			a[i][c] += a[i][j]
			a[r][j] += a[i][j]
			a[r][c] += a[i][j]
		}
	}

	for _, ar := range a {
		for j, ac := range ar {
			if j != 0 {
				fmt.Print(" ")
			}
			fmt.Print(ac)
		}
		fmt.Println()
	}
}



Measured memory_bytes: 1824
#!/usr/local/gnu/bin/bash
readonly mul=100000000
readonly mullen=${#mul}
read t x
tmp=`printf "%0${mullen}d" $((t*mul/x))`
tmplen=${#tmp}
slen=$((tmplen-mullen+1))
mlen=$((tmplen-slen))
echo ${tmp:0:$slen}.${tmp: -$mlen}


Measured memory_bytes: 628
using System;
using System.Linq;

class A {
  static void Main(string[] args) {
    string[] strs = Console.ReadLine().Split(' ');
    int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    string str = Console.ReadLine();
    if (strs[0] == str) 
    {
    	Console.WriteLine((--nums[0]).ToString() + " " + nums[1].ToString());
    }
    else
    {
     	Console.WriteLine(nums[0].ToString() + " " + (--nums[1]).ToString());
    }
  }
}

Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>
#include <iomanip>
using namespace std;
typedef pair<int,int> pii;

struct Tank{
    vector<int> b,h;
    vector<int> f,a;
    map<pii, int> state;
    Tank(vector<int> &bb, vector<int> &hh, vector<int> &ff, vector<int> &aa){
        b.push_back(0); h.push_back(50);
        b.insert(b.end(), bb.begin(), bb.end());
        h.insert(h.end(), hh.begin(), hh.end());
        b.push_back(100); h.push_back(50);
        f=ff; a=aa;
    }
    int pour(int p, int amount, int l, int r){
        int bottom = 0;
        if(r-l > 1){
            int maxhidx = max_element(h.begin()+l+1, h.begin()+r) -h.begin();
            bottom = h[maxhidx];
            if(p < b[maxhidx]){
                amount = pour(p, amount, l, maxhidx);
                amount = pour(p, amount, maxhidx, r);
            }else{
                amount = pour(p, amount, maxhidx, r);
                amount = pour(p, amount, l, maxhidx);
            }
        }
        int cap = (b[r] -b[l]) *(min(h[l], h[r]) -bottom) *30;
        amount += state[pii(l,r)];
        state[pii(l,r)] = min(cap, amount);
        return max(0, amount-cap);
    }
    double get(int p, int l, int r){
        double res = 0;
        if(r-l > 1){
            int maxhidx = max_element(h.begin()+l+1, h.begin()+r) -h.begin();
            if(p < b[maxhidx]){
                res += get(p, l, maxhidx);
            }else{
                res += get(p, maxhidx, r);
            }
        }
        res += (double)state[pii(l,r)] /(b[r] -b[l]) /30;
        return res;
    }
    double query(int p, int t){
        state.clear();
        for(int i=0; i<(int)f.size(); i++){
            pour(f[i], t*a[i], 0, (int)b.size()-1);
        }
        return get(p, 0, (int)b.size()-1);
    }
};

int main(){
    cout << fixed << setprecision(10);
    int ds;
    cin >> ds;
    for(int rep=0; rep<ds; rep++){
        int n;
        cin >> n;
        vector<int> b(n), h(n);
        for(int i=0; i<n; i++){
            cin >> b[i] >> h[i];
        }
        int m;
        cin >> m;
        vector<int> f(m), a(m);
        for(int i=0; i<m; i++){
            cin >> f[i] >> a[i];
        }
        Tank tank(b, h, f, a);
        int l;
        cin >> l;
        for(int i=0; i<l; i++){
            int p,t;
            cin >> p >> t;
            cout << tank.query(p, t) << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3204
using System;

namespace AOJ.Volume1
{
    public class Blackjack
    {
        public static int Main()
        {
            while (true)
            {
                string input = Console.ReadLine();
                if (input == "0") { break; }

                var data = input.Split(' ');
                int ace_cnt = 0;
                int point = 0;
                bool burst = false;
                foreach (var d in data)
                {
                    if (d == "1")
                    {
                        // ??¨???????????????
                        ace_cnt++;
                        continue;
                    }
                    int tmp = int.Parse(d);
                    point += tmp >= 10 ? 10 : tmp;
                    if (point >= 22)
                    {
                        // ????????????
                        burst = true;
                        break;
                    }
                }

                if (burst) { Console.WriteLine(0); }
                else if (ace_cnt == 0) { Console.WriteLine(point); }
                else
                {
                    // ??¨???????????????11??¨???????¨??????????????????????
                    int e = 0;
                    for (int i = 1; i <= ace_cnt; i++)
                    {
                        int tmp_p = 11 * i + (ace_cnt - i);
                        if (point + tmp_p > 21) { break; }
                        else { e++; }
                    }

                    point += 11 * e + (ace_cnt - e);
                    if (point >= 22) { point = 0; }
                    Console.WriteLine(point);
                }
            }

            return 0;
        }
    }
}

Measured memory_bytes: 9072
#include<stdio.h>

int main(){/*main*/
  int n=32,i,a[50],j;

  while(1){/*while*/
    n=32;
    scanf("%d",&i);
    if(i==0)break;
    for(j=0;j<i;j++){
      scanf("%d",&a[j]);
    }

    for(j=0;;j++)
      {/*for_game*/
	n=n-((n-1)%5);
	printf("%d\n",n);

	n=n-a[j];
	if(n<=0){
	  printf("0\n");
	  break;
	}
	else{
	  printf("%d\n",n);
	}
	if(j==(i-1))j=-1;
      }/*E_for_game*/

  }/*E_while*/
  return 0;
}/*E_main*/

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
  string S;

  cin >> S;
  
  if(S[0]=='M'){
    cout << 6;
  }else if(S[0]=='W'){
    cout << 4;
  }else if(S[0]=='F'){
    cout << 2;
  }else if(S[0]=='T'){
    if(S[1]=='U'){
      cout << 5;
    }else{
      cout << 3;
    }
  }else if(S[0]=='S'){
    if(S[1]=='U'){
      cout << 7;
    }else{
      cout << 1;
    }
  }   
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

// 1-indexed
template <class T, class Op = T (*) (T, T)>
struct Bit {
  int n;
  vector<T> dat;
  Op op;
  T unit;
  Bit(int n, Op op = Op(), T unit = T()) : n(n), dat(n + 1, unit), op(op), unit(unit) {
  }
  Bit(const vector<T> &arr, Op op = Op(), T unit = T())
    : n(arr.size()), dat(arr.size() + 1), op(op), unit(unit) {
    copy(arr.begin(), arr.end(), dat.begin() + 1);
    for(int i=1; i<n; i++) {
      dat[i + (i & -i)] = op(dat[i + (i & -i)], dat[i]);
    }
  }
  void operate(int k, T a) {
    while(k <= n) {
      dat[k] = op(dat[k], a);
      k += k & -k;
    }
  }
  T accum(int k) {
    T sum = unit;
    while(k > 0) {
      sum = op(sum, dat[k]);
      k -= k & -k;
    }
    return sum;
  }
};

int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.size();
  vector<deque<int>> app(26);
  REP(i,0,n) {
    char c = s[i];
    app[c-'a'].push_back(i);
  }
  int odd = 0;
  REP(i,0,26) {
    if(app[i].size() % 2 == 1) {
      odd++;
    }
  }
  if(odd > 1) {
    cout << -1 << endl;
    return 0;
  }
  VI ps(n);
  vector<PI> head;
  REP(i,0,26) {
    int f = app[i].size();
    REP(j,0,f/2) {
      head.push_back({app[i].front(), i});
      app[i].pop_front();
    }
    if(f % 2 == 1) {
      ps[app[i].front()] = n / 2;
      app[i].pop_front();
    }
  }
  sort(head.begin(), head.end());
  REP(i,0,head.size()) {
    ps[head[i].first] = i;
    int c = head[i].second;
    ps[app[c].back()] = n - i - 1;
    app[c].pop_back();
  }
  ll ans = 0;
  Bit<ll, plus<ll>> bit(n);
  for_each(ps.rbegin(), ps.rend(), [&](int p) {
      ans += bit.accum(p + 1);
      bit.operate(p + 1, 1);
    });
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4748
n, m = map(int, input().split(" "))

xyz = [[0 for i in range(n)] for i in range(8)]

for i in range(n):
    x, y, z = map(int, input().split(" "))
    xyz[0][i] = x+y+z
    xyz[1][i] = x+y-z
    xyz[2][i] = x-y+z
    xyz[3][i] = x-y-z
    xyz[4][i] = -x+y+z
    xyz[5][i] = -x+y-z
    xyz[6][i] = -x-y+z
    xyz[7][i] = -x-y-z

for i in range(8):
    xyz[i] = sorted(xyz[i], reverse=True)

M = -10000000000 * 3 * m
for i in range(8):
    s = sum(xyz[i][0:m])
    if s > M:
        M = s

print(M)



Measured memory_bytes: 3564
#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 <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
#include<omp.h>
using namespace std;
#define eps 0.000001
#define LONG_INF 10000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main(){
	string s;
	cin >> s;
	stack<int> going;
	int ans = 0;
	for (int i = 0; i < s.length(); ++i) {
		if (going.size() == 0 || going.top() == (s[i] - '0')) {
			going.push(s[i] - '0');
		}
		else {
			going.pop();
			ans += 2;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 768
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest 091
# C - 2D Plane 2N Points

from sys import stdin

def graph(red, blue):
    """
    Return the adjacent list of the bipartite graph that consists of
    the red vertices and the blue vertices.
    The red vertices are numbered as 0, 1, ..., N - 1 and
    the blue vertices are numbered as N, N + 1, ..., 2N - 1.
    The returned list contains 2N elements, each of which is
    the adjacent list of a vertex.
    """
    N = len(red)
    adj = [[] for i in range(2 * N)]
    for i in range(N):
        a, b = red[i]
        for j in range(N):
            c, d = blue[j]
            if a < c and b < d:
                adj[i]    .append(j + N)
                adj[j + N].append(i)
    return adj

def dfs(v, g, M, visited, path):
    if visited[v]: return None
    visited[v] = True
    for u in g[v]:
        w = M[u]
        if w == None: return path + [v, u]
        apath = dfs(w, g, M, visited, path + [v, u])
        if apath != None: return apath
    return None

def augPath(g, M):
    """
    For a graph g and a current matching M,
    return an augmenting path.
    If g does not have an augmenting path, then return None.
    """
    nvertices = len(g)
    for v in range(nvertices):
        if M[v] == None:
            visited = [False for v in range(nvertices)]
            apath = dfs(v, g, M, visited, [])
            if apath != None: return apath
    return None

def solve(red, blue):
    g = graph(red, blue)
    nvertices = len(g)
    # empty matching
    M = [None for v in range(nvertices)]
    # Find the maximum matching.
    while True:
        apath = augPath(g, M)
        if apath == None: break
        # Alter the matching.
        for i in range(0, len(apath), 2):
            v, u = apath[i : i + 2]
            M[v], M[u] = u, v
    nmatching = sum(1 for m in M if m != None) // 2
    return nmatching

def readIntPairList(N):
    """Read a list of N pairs of ints from stdin."""
    ls = []
    for i in range(N):
        a, b = [int(w) for w in stdin.readline().split()]
        ls.append((a, b))
    return ls

N = int(stdin.readline())
red  = readIntPairList(N)
blue = readIntPairList(N)
print(solve(red, blue))


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int n;
vector<ll> G[100010];
ll dp[100010][2];

// 0 white
void dfs(int v,int p=-1){
  dp[v][0]=dp[v][1]=1;
  for(auto nv:G[v]){
    if(nv==p)continue;
    dfs(nv,v);
    dp[v][0]=dp[v][0]*((dp[nv][0]+dp[nv][1])%MOD)%MOD;
    dp[v][1]=dp[v][1]*dp[nv][0]%MOD;
  }
}                 
    
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  cin >> n;
  
  rep(i,n-1){
    ll x,y;
    cin >> x >> y;
    x--;
    y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  dfs(0);
  cout << (dp[0][1]+dp[0][0])%MOD << endl;
  
  return 0;     
}


Measured memory_bytes: 14208
#include <stdio.h>

main()
{
  int x[3],a,i,k;
  
  scanf("%d%d%d",&x[0],&x[1],&x[2]);
  
  a = x[0];
  for(i=0;i<3;i++)
    if(a<x[i])a=x[i];
  for(i=0;i<3;i++)
    if(a==x[i])break;
  x[i] *= 10;
  for(k=0;k<3;k++)
  {
    if(k!=i)x[i] += x[k];
  }
  printf("%d\n",x[i]);
}

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

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

typedef long long ll; 
typedef long double ld; 
typedef vector<int> vi; 
typedef pair<int,int> pii; 
#define pb push_back
#define mp make_pair
#define prarr(a,n) cerr<<#a<<" : ";for(ll i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define prmat(mat,row,col) cerr<<#mat<<" :\n";for(ll i=0;i<row;i++) {for(ll j=0;j<col;j++) cerr<<mat[i][j]<<"\t";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define endl '\n'
#define fast_io ios_base::sync_with_stdio(NULL); cin.tie(NULL)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {ll idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
template <class T> void prall(T a) { prc(all(a)); }
const int inf=1000*1000*1000+9; 
const ll infl=1ll*inf*inf; 
const int mod=1000*1000*1000+7;  

// ----------------------------------------------------------------------------	-------------- 

void solve(){
  int n; cin>>n; 
  string s,t; cin>>s>>t; 
  for(int i=0;i<n;i++){
    cout<<s[i]<<t[i]; 
  }
}

int main(){
	// clock_t beg=clock(); 
  fast_io; 
  int testcases=1; 
  // cin>>testcases; 
  cout << fixed << setprecision(13); 
  while(testcases--){
    solve(); 	
  }
	// clock_t end=clock(); 
	// fprintf(stderr, "%lf\n", (double)(end-beg)/(CLOCKS_PER_SEC));
}


Measured memory_bytes: 384
#include <stdio.h>
int main(){
	int n;
	int a,b,c;
	int i;
	scanf("%d", &n);
	for(i = 0;i < n;i++){
		scanf("%d %d %d", &a, &b, &c);
		a*=a;
		b*=b;
		c*=c;
		if(a==b+c || b==a+c || c==a+b)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;


class Factorial {
    private:
        vector<long long> fac;
    public:
        Factorial();
        Factorial(long long n_max);
        void initialization(long long n_max);
        long long getFactorial(long long n);
};

Factorial::Factorial() {}
Factorial::Factorial(long long n_max) {
    fac.clear();
    fac.push_back(1);
    fac.push_back(1);
    for (long long i = 2; i <= n_max; i++) {
        fac.push_back(fac[i-1] * i % MOD);
    }
}
void Factorial::initialization(long long n_max) {
    fac.clear();
    fac.push_back(1);
    fac.push_back(1);
    for (long long i = 2; i <= n_max; i++) {
        fac.push_back(fac[i-1] * i % MOD);
    }
}
long long Factorial::getFactorial(long long n) {
    return fac[n];
}

int main() {
    int N;
    string S;
    cin >> N >> S;
    char path[2 * N];
    int L = 0;
    int R = 0;
    bool isPossible = true;
    for (int i = 0; i < 2 * N; i++) {
        if ((L - R) % 2 == 0) {
            if (S[i] == 'B') {
                path[i] = 'L';
                L++;
            } else {
                path[i] = 'R';
                R++;
            }
        } else {
            if (S[i] == 'W') {
                path[i] = 'L';
                L++;
            } else {
                path[i] = 'R';
                R++;
            }
        }
        if (L < R) {
            isPossible = false;
        }
    }
    if (!isPossible || L != R) cout << 0 << endl;
    else {
        L = 0; R = 0;
        long long ans = 1;
        for (int i = 2 * N - 1; i >= 0; i--) {
            if (path[i] == 'R') R++;
            else {
                ans = ans * (R - L) % MOD;
                L++;
            }
        }
        Factorial fact(N);
        cout << ans * fact.getFactorial(N) % MOD << endl;
    }
    return 0;
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define INF 1LL<<60
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;

struct edge{
	ll a,b;
	int t;
	edge(){}
	edge(int tt, ll aa,ll bb){
		t=tt;
		a=aa;
		b=bb;
	}
};

int n,m,s,g;
vector<edge> G[200005];
ll dp[200005];

ll calc_cost(ll t,ll a,ll b){
	ll v=b/(a+t);
	if(b%(a+t)>0LL)v++;
	return t+v;
}

ll calc_ceil(ll t,ll a,ll b){
	ll v=b/(a+t);
	if(b%(a+t)>0LL)v++;
	//printf("%lld %lld\n",t,v);
	return v;
}

ll calc(ll t,ll a,ll b){
	/**/
	ll l=t,r=b;
	while(l+1LL<r){
		ll mid=(l+r)/2LL;
		if(b/(mid+a)>=(mid+a)){
			l=mid;
		}else{
			r=mid;
		}
	}
	//printf("%lld\n",l+a);
	ll l2=t-1LL,r2=b;
	while(l2+1LL<r2){
		ll mid=(l2+r2)/2LL;
		if(calc_ceil(mid,a,b)>l+a+1LL){
			l2=mid;
		}else{
			r2=mid;
		}
	}
	ll l3=t-1LL,r3=b;
	while(l3+1LL<r3){
		ll mid=(l3+r3)/2LL;
		if(calc_ceil(mid,a,b)>=l+a){
			l3=mid;
		}else{
			r3=mid;
		}
	}
	l2++;
	l3++;
	//printf("%lld %lld %lld %lld\n",l,r,l2,r2);
	ll res=calc_cost(t,a,b);
	for(ll i=min(l2,l3);i<=l2+5LL;i++){
		if(i>=t)res=min(res,calc_cost(i,a,b));
	}
	return res;
}

ll solve(){
	for(int i=0;i<n;i++){
		dp[i]=INF;
	}
	dp[s]=0;
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,s));
	while(que.size()){
		P p=que.top();
		que.pop();
		int v=p.second;
		if(p.first>dp[v])continue;
		//printf("%d\n",v);
		for(int i=0;i<G[v].size();i++){
			edge e=G[v][i];
			int nv=e.t;
			if(dp[nv]<=dp[v])continue;
			ll nc=calc(p.first,e.a,e.b);
			//printf("%lld\n",nc);
			if(dp[nv]>nc){
				dp[nv]=nc;
				que.push(P(nc,nv));
			}
		}
	}
	return dp[g];
}

int main(void){
	scanf("%d%d%d%d",&n,&m,&s,&g);
	s--;
	g--;
	for(int i=0;i<m;i++){
		int u,v;
		ll a,b;
		scanf("%d%d%lld%lld",&u,&v,&a,&b);
		u--;
		v--;
		G[u].push_back(edge(v,a,b));
		G[v].push_back(edge(u,a,b));
	}
	ll ans=solve();
	printf("%lld\n",ans==INF?-1:ans);
	return 0;
} 


Measured memory_bytes: 26608
d, n = map(int, input().split())
def division(x):
    if x % 100 != 0:
        return 0
    else:
        return division(x//100) +1
count= 0
for i in range(1, 1010001):
    if division(i) == d:
        count +=1
    if count == n:
        print(i)
        break

Measured memory_bytes: 3060
import java.util.*;
public class Main { 
    public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       int o=0;
       int n=sc.nextInt();
       int[][] v=new int[9][9];
      for(int i=1;i<=n;i++){
      	String str=String.valueOf(i);
		String str1 = str.substring(0, 1);          
		int x = Integer.parseInt(str1);
        int y=i%10;
        //System.out.println(x+""+y);
        if(x!=0&&y!=0)v[x-1][y-1]++;
      }
      for(int i=0;i<9;i++){
      	for(int j=0;j<9;j++){
          //System.out.println(i+1+" " +(int)(j+1)+ " " +v[i][j]);
          o+=v[i][j]*v[j][i];
        }
      }
      System.out.println(o);
    }
}

Measured memory_bytes: 39352
#include <iostream>
 
using namespace std;
 
int main() {
    int n;
    cin >> n;

    int f[100][10];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> f[i][j];
        }
    }

    int p[100][11];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 11; j++) {
            cin >> p[i][j];
        }
    }

    int m = -2147483647;
    for (int i = 1; i < 1024; i++) {
        int a[10];
        for (int j = 0; j < 10; j++) {
            a[j] = (i >> j) & 1;
        }

        int s = 0;
        for (int j = 0; j < n; j++) {
            int c = 0;
            for (int k = 0; k < 10; k++) {
                if (a[k] && f[j][k]) {
                    c++;
                }
            }
            s += p[j][c];
        }

        if (s > m) {
            m = s;
        }
    }

    cout << m << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int t,p,q,i,n,x;
        cin>>n>>t>>p;
    if((n==t && t != p) || (t == p && n!=p) || (n==p && t!=p))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
int c[20];
int a[20][20];
int main() {
    int n, m, x;
    cin >> n >> m >> x;
    rep(i,n) {
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }
    int ans = INF;
    rep(s, 1<<n) {
        int cost = 0;
        vector<int> sk(m, 0);
        rep(i,n) {
            if (s>>i & 1) {
                cost += c[i];
                rep(j,m) sk[j] += a[i][j];
            }
        }
        bool ok = true;
        rep(i,m) {
            if (sk[i] < x) ok = false;
        }
        if (ok) ans = min(ans,cost);
    }
    if (ans == INF) cout << -1 << endl;
    else cout <<ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int A, B, C, K;
    cin >> A >> B >> C >> K;

    while (A >= B) {
        K--;
        B *= 2;
    }
    while (B >= C) {
        K--;
        C *= 2;
    }
    if (K >= 0) yes;
    else no;
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/m-solutions2020/m_solutions2020_b && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/m-solutions2020/m_solutions2020_b && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/m-solutions2020/m_solutions2020_b && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define int long long
void read(int &x)
{
    x=0;
    int y=1;
    char c=getchar();
    while (c>'9'||c<'0')
    {
        if (c=='-')
            y=-1;
        c=getchar();
    }
    while (c>='0'&&c<='9')
    {
        x=x*10+c-'0';
        c=getchar();
    }
    x*=y;
}
int n,m;
signed main()
{
	read(n);
	read(m);
	if (n*2<=m)
		cout<<n+(m-n*2)/4;
	else
		cout<<m/2;
	return 0;
}

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

int main() {
  int N,D;
  cin >> N >> D;
  if(N%(2*D+1)==0){
    cout << N/(2*D+1) <<endl;
  }
  else {
    cout << N/(2*D+1)+1 << endl;
  }
}


Measured memory_bytes: 256
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
#include <algorithm>
// #include "./Debug.h"

namespace AtCoder {
	using Input = std::vector<std::string>;
	using Num = std::vector<int>;

	Input input(void) {
		Input result;
		{
			std::string buf = "", row = "";
			std::getline(std::cin, buf);
			for (unsigned int i = 0; i < buf.size(); i++) {
				if (' ' == buf[i]) {
					result.push_back(row);
					row = "";
				} else {
					row += buf[i];
				}
			}
			result.push_back(row);
		}
		return result;
	}

	Num replaceToInteger(Input original = { "" }) {
		Num result;
		for (unsigned int i = 0; i < original.size(); i++) {
			result.push_back(atoi(original[i].c_str()));
		}
		return result;
	}
	int min(std::vector<int> vec = { 0 }) {
		return *std::min_element(vec.begin(), vec.end());
	}
	int max(std::vector<int> vec = { 0 }) {
		return *std::max_element(vec.begin(), vec.end());
	}
	unsigned int count(std::vector<int> vec = { 0 }, int findValue = 0) {
		return std::count(vec.begin(), vec.end(), findValue);
	}
}

int main(void) {

	AtCoder::Num s = AtCoder::replaceToInteger(AtCoder::input());

	const int n = s[0], m = s[1];

	AtCoder::Num l, r;
	for (int i = 0; i < m; i++) {
		s = AtCoder::replaceToInteger(AtCoder::input());
		l.push_back(s[0]);
		r.push_back(s[1]);
	}

	int lmax = AtCoder::max(l), rmin = AtCoder::min(r);
	rmin = std::min(rmin, n);

	const int ans = std::max(0, rmin - lmax + 1);

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 1652
#include<stdio.h>
int main(){
    int n,i,j;
    long long int k,d=0,f=0;
    scanf("%d %lld",&n,&k);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(i=0;i<n-1;i++){
        for(j=i+1;j<n;j++){
            if(a[i]>a[j]){
                d++;
            }
            if(a[i]<a[j]){
                f++;
            }
        }
    }
    d=(d*((k*k+k)/2%1000000007)+f*((k*k-k)/2%1000000007))%1000000007;
    printf("%lld",d);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main(){
ll N;cin >> N;
vector<ll> V(N);
vector<ll> A;

rep(i, 0, N)cin >> V[i];

sort(ALL(V));

ll M = V[N - 1];

for(auto v : V ){

    A.push_back(abs(M - v*2));

}

auto Iter = min_element(ALL(A)) - A.begin();

cout << M << " " << V[Iter];

}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

signed main() {
  ll N, L, m=10000000, s=0;
  cin>>N>>L;
  for (ll k = L; k <= (L+(N-1)); k++ ){
    if (abs(k) < abs(m)) {
      m = k;
    }
    s += k;
  }
  cout<<s-m<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a,b,c,d;cin>>a>>b>>c>>d;
    ll a1 = a*c, a2 = a*d, a3 = b*c, a4 = b*d;
    cout<<max(max(a1,a2),max(a3,a4))<<endl;
    return 0;
}

Measured memory_bytes: 3648
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
using namespace std;

int main() {
int r;
cin >> r;
cout << 6.28*r;

return 0;
}
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

Measured memory_bytes: 3788
#include<stdio.h>

int main(){
	int i,n,b,f,r,v;
	int count[4][3][10]={{},{},{}};
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d %d %d",&b,&f,&r,&v);
		count[b-1][f-1][r-1]+=v;
	}
	for(b=0;b<4;b++){
		for(f=0;f<3;f++){
			for(r=0;r<10;r++){
				printf(" %d",count[b][f][r]);
                if(r==9) printf("\n");
            }
            if(f==2 && b!=3) printf("####################\n");
        }
    }
    return 0;
}

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

cnt = 0
for i in range(N):
    t = 0
    for p,q in zip(B, A[i]):
        t += p*q
    if t + C > 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
    string S ;
    cin >> S ;
    if(S[0] != S[1] && S[0] != S[2] && S[1] != S [2])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3604