akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;

int main()
{
	int a, b;
	while(cin >> a >> b){
		int x = (a + b) / 2;
		double y = (a + b) / 2.0;
		if(y - x >= 0.5)	cout << x + 1 << endl;
		else cout << x << endl;
	}
	return 0;
}

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

int		main(void)
{
	int		a, b, x;
	cin >> a >> b >> x;
	int		tmp = 0;
	bool	flag = false;
	tmp += a;
	if (tmp != x)
	{
		for (size_t i = 0; i <= b; i++)
		{
			tmp++;
			if (tmp == x)
				flag = true;
		}
		cout << (flag ? "YES" : "NO") << endl;
	}
	else
		cout << "YES" << endl;
}

Measured memory_bytes: 256
avl=input().split()
bwl=input().split()
t=int(input())
a=int(avl[0])
v=int(avl[1])
b=int(bwl[0])
w=int(bwl[1])

dist=b-a
if(dist<0):
    dist=-dist
spd=v-w
if(spd*t>=dist):
    print("YES")
else:
    print("NO")


Measured memory_bytes: 9192
import java.util.Scanner;

public class Main {

    static long fanc(long a, long b) {
        long fa = 0, fb = 0;
        while(a != 0) {
            a /= 10;
            fa++;
        }
        while(b != 0) {
            b /= 10;
            fb++;
        }
        return ((fa < fb) ? fb : fa);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        long N = scan.nextLong();
        long a,b,min = N;

        for(a = 1; a <= Math.sqrt(N); a++) {
            if(N%a!=0) {
                continue;
            }
            b = N/a;
            min = (min < fanc(a, b) ? min : fanc(a, b));
            //System.out.println(a + " " + b + " " + min);
        }

        System.out.println(min);
    }
}

Measured memory_bytes: 21844
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;

const int INF = 1<<29;

const int MAX_V = 100000;

//union-find tree defenition

int par[MAX_V];

void init(int n){
    fill(par, par+n, -1);
}

int find(int x){
    if(par[x] < 0) return x;
    return par[x] = find(par[x]);
}

bool same(int a, int b){
    return find(a) == find(b);
}

bool unite(int a, int b){
    int xa = find(a), xb = find(b);
    if(xa == xb) return false;
    if(par[xa] < par[xb]){
        par[xb] = xa;
    }else{
        if(par[xa] == par[xb]){
            par[xb]--;
        }
        par[xa] = xb;
    }
    return true;
}

//END union-find tree definition

struct edge{
    int from;
    int to;
    int cost;
    edge(){}
    ~edge(){}
    edge(int a, int b, int c) : from(a), to(b), cost(c){}
    bool operator < (const edge& r) const {
        return cost < r.cost;
    }
};

vector<edge> G;
int V;

void append_edge(int from, int to, int cost){
    G.push_back(edge(from, to, cost));
}

int kruskal(void){
    init(V);
    sort(G.begin(), G.end());
    int ret = 0;
    for(int i = 0; i < G.size(); i++){
        if(unite(G[i].from, G[i].to)){
            ret += G[i].cost;
        }
    }
    return ret;
}

int main(){
    int m, a, b, c;
    while(scanf("%d%d", &V, &m) && V){
        G.clear();
        for(int x = 0; x < m; x++){
            scanf("%d,%d,%d", &a, &b, &c);
            append_edge(a, b, c / 100 - 1);
        }
        int res = kruskal();
        printf("%d\n", res);
    }
    return 0;
}

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

int ToNum(string str){
  int num = 0;
  for(int i = 0 ; i < str.size(); i++){
    if(str[i] == 'm'){
      if('0'<=str[i-1]&&str[i-1]<='9' && i-1 >= 0){
	num+=10000*(str[i-1]-'0');
      }else num+=10000;
    }else if(str[i] == 'c'){
      if('0'<=str[i-1]&&str[i-1]<='9' && i-1 >= 0){
	num+=1000*(str[i-1]-'0');
      }else num+=1000;
    }else if(str[i] == 'x'){
      if('0'<=str[i-1]&&str[i-1]<='9' && i-1 >= 0){
	num+=100*(str[i-1]-'0');
      }	else num+=100;
    }else if(str[i] == 'i'){
      if('0'<=str[i-1]&&str[i-1]<='9' && i-1 >= 0){
	num+=10*(str[i-1]-'0');
      }else num += 10;
    }
  }
  if('0'<=str[str.size()-1] && str[str.size()-1] <= '9')num+=str[str.size()-1]-'0';
  return num;
}

string ToStr(int num){

  string ans = "";
  int t = 10000;
  while(1){
    int a = (num/t)%10;
    if(0 < a && a <= 9 && t == 10000){
      if(a > 1)ans+=char(a+'0');
      ans+='m';
    }
    if(0 < a && a <= 9 && t == 1000){
      if(a > 1)ans+=char(a+'0');
      ans+='c';
    }
    if(0 < a && a <= 9 && t == 100){
      if(a > 1)ans+=char(a+'0');
      ans+='x';
    }
    if(0 < a && a <= 9 && t == 10){
      if(a > 1)ans+=char(a+'0');
      ans+='i';
    }
    if(0 < a && a <= 9 && t == 1){
      ans+=char(a+'0');
    }
    t/=10;
    if(t == 0)break;
  }
  return ans;
}

int main(){
  int n;
  string num1,num2;
  cin >> n;
  while(n--){
    cin >> num1 >> num2; 
    int a = ToNum(num1);
    int b = ToNum(num2);
    a = a+b;
    string ans = ToStr(a);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
#define forn(i,n) for(ll i=0;i < ll (n); i++)

class DisjointSet{
    vector<ll>Parent, Rank;
public:
    DisjointSet(ll n)
    {
        forn(i,n+1) Parent.push_back(i), Rank.push_back(0);
    }
    ll Find(ll x)
    {
        if(Parent[x]==x) return x;
        else Parent[x]=Find(Parent[x]);
        return Parent[x];
    }
    void Union(ll x, ll y)
    {
        ll u=Find(x);
        ll v=Find(y);
        if(u==v) return;
        if(Rank[u] > Rank[v]) Parent[v]=u;
        else
        {
            Parent[u]=v;
            if(Rank[u]==Rank[v]) Rank[u]++;
        }
        return;
    }
};

int main()
{
    ll n,m;
    cin>>n>>m;
    DisjointSet dis(n);
    ll j,k;
    ll ans=1;
    forn(i,m)
    {
        cin>>j>>k;
        dis.Union(j,k);
    }
    map<ll, ll>mp;
    forn(i,n)
    {
        ll u=dis.Find(i+1);
        mp[u]++;
        ans=max(mp[u], ans);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 18792
import java.util.Scanner;

public class Main{
  static public void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int K = sc.nextInt();
    
    if(A >= K){
      System.out.println(K);
    }else if((A+B) >= K){
      System.out.println(A);
    }else{
      System.out.println(A - (K-(A+B)));
    }
    
  }
}

Measured memory_bytes: 35752
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 100000;
const int INF = 1e9 + 5;

int pa[MAXN+5], sz[MAXN+5], a[MAXN+5], N, K, Q;
PII b[MAXN+5];
bool enable[MAXN+5];
multiset<int> global;
priority_queue<int, vector<int>, greater<int>> candidate[MAXN+5];

void init() {
	for (int i = 0; i < N; i++) {
		pa[i] = i;
		sz[i] = 1;
		enable[i] = false;
		candidate[i].push(a[i]);
	}
}

int find_root(int x) {
	return pa[x] == x ? x : pa[x] = find_root(pa[x]);
}

void merge(int x, int y) {
	x = find_root(x);
	y = find_root(y);
	if (x == y) return;
	if (sz[x] < sz[y]) swap(x, y);
	while (!candidate[y].empty()) {
		candidate[x].push(candidate[y].top());
		candidate[y].pop();
	}
	pa[y] = x;
	sz[y] += x;
}

int test(PII p) {
	int x = p.first, pos = p.second;
	enable[pos] = true;
	if (pos > 0 && enable[pos - 1]) merge(pos, pos - 1);
	if (pos < N - 1 && enable[pos + 1]) merge(pos, pos + 1);
	
	int root = find_root(pos);
	while (candidate[root].size() >= K) {
		if (global.size() < Q) {
			global.insert(candidate[root].top());
			candidate[root].pop();
		}
		else if (*global.rbegin() > candidate[root].top()) {
			global.erase(--global.end());
			global.insert(candidate[root].top());
			candidate[root].pop();
		}
		else break;
	}
	
//	cout << "SZ " << candidate[root].size() << "\n";
//	cout << "Test " << p.first << " at " << p.second << "\n";
//	for (int x : global) cout << x << " "; cout << "\n";
	
	if (global.size() < Q) return INF;
	return *global.rbegin() - *global.begin();
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N >> K >> Q;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		b[i] = {a[i], i};
	}
	
	int ans = INF;
	sort(b, b + N);
	init();
	for (int i = N - 1; i >= 0; i--) {
		ans = min(ans, test(b[i]));
	}
	
	cout << ans << '\n';
	/**** Note MAXN ****/
}


Measured memory_bytes: 14976
#include <iostream>
#include <algorithm>
using namespace std;
static const int NUM_MAX = static_cast<int>(1e+2);
static const int VAL_MAX = static_cast<int>(1e+3);

/* Display array elements */
void trace(int A[], int N) {
	for (int i = 0; i < N; i++) {
		if (i > 0) cout << ' ';
		cout << A[i];
	}
	cout << '\n';
}

/* Insertion sort */
void insertionSort(int A[], int N) {
	int j, val;
	for (int i = 1; i < N; i++) {
		val = A[i];
		j = i - 1;
		while ((j >= 0) && (val < A[j])) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = val;
		trace(A, N);
	}
}

int main() {
	int argc, argv[NUM_MAX];

	cin >> argc;

	for (int i = 0; i < argc; i++) cin >> argv[i];
	
	trace(argv, argc);
	insertionSort(argv, argc);

	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
int main()
{
    int W, H, K, N;
    std::cin >> W >> H >> K >> N;
    using P = std::pair<int, int>;
    std::vector<P> dog;
    for (int i = 0, y, x; i < N; i++) { std::cin >> x >> y, dog.push_back({y - 1, x - 1}); }
    std::sort(dog.begin(), dog.end());
    const int WNUM = (W + 1) / 2;
    auto ok = [&](const int y, const int x) { return std::upper_bound(dog.begin(), dog.end(), P{y, x}) == std::lower_bound(dog.begin(), dog.end(), P{y, x}); };
    int two = 0;
    int ans = 0;
    for (int y = 2; y < H; y += 2) {
        std::vector<int> memo(W, -1);
        auto rec = [&](auto&& self, const int x) {
            if (x == -2) { return 0; }
            if (memo[x] != -1) { return memo[x]; }
            if (x == 0) { return memo[x] = (ok(y - 1, x) ? 1 : 2); }
            return memo[x] = std::min((ok(y - 1, x - 1) ? 2 : 4) + self(self, x - 4), (ok(y - 1, x) ? 1 : 2) + self(self, x - 2));
        };
        const int score = rec(rec, W - 1);
        ans += score, two += score - WNUM;
    }
    if (K < WNUM) { return std::cout << -1 << std::endl, 0; }
    K -= WNUM;
    const int t = std::min(K, two);
    ans -= 2 * t, K -= t, ans -= K;
    std::cout << std::max(0, ans) << std::endl;
    return 0;
}



Measured memory_bytes: 3880
#include <cstdio>
#include <vector>

void readInput(std::vector<int>& numList) {
    int size = 0;
    scanf("%d", &size);

    numList.resize(size);

    for (size_t i = 0; i < numList.size(); ++i) {
        int num = 0;
        scanf("%d", &num);
        numList[i] = num;
    }
}

int selectionSort(std::vector<int>& numList) {
    using std::swap;

    int swapCount = 0;

    for (size_t i=0; i < numList.size(); ++i) {
        size_t minj = i;

        for (size_t j = i; j < numList.size(); ++j) {
            if (numList[j] < numList[minj]) {
                minj = j;
            }
        }

        if (i != minj) {
            swap(numList[i], numList[minj]);
            ++swapCount;
        }
    }

    return swapCount;
}

int main() {
    std::vector<int> numList;
    readInput(numList);

    int swapCount = selectionSort(numList);

    for (size_t i = 0; i < numList.size()-1; ++i) {
        printf("%d ", numList[i]);
    }
    printf("%d\n%d\n", numList.back(), swapCount);

    return 0;
}



Measured memory_bytes: 2760
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll H, W;
  cin >> H >> W;
  vl C(26, 0);
  REP(i, H) {
    string s;
    cin >> s;
    REP(j, W) C[s[j] - 'a']++;
  }
  vl A(4, 0);
  REP(i, 26) { A[C[i] % 4]++; }

  bool ok = false;
  if (H % 2 == 0 && W % 2 == 0) {
    if (A[1] == 0 && A[3] == 0 && A[2] == 0)
      ok = true;
  } else if (H % 2 == 1 && W % 2 == 1) {
    if (A[1] + A[3] == 1) {
      if (A[3] + A[2] <= (H + W - 2) / 2)
        ok = true;
    }
  } else {
    if (A[1] + A[3] == 0) {
      if (H % 2 == 1) {
        if (A[2] <= W / 2)
          ok = true;
      } else if (W % 2 == 1) {
        if (A[2] <= H / 2)
          ok = true;
      }
    }
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a_list = []
TF = []
d = []
for i in range(k):
    d.append(int(input()))
    a = list(map(int, input().split()))
    a_list[len(a_list):len(a_list)] = a

for j in range(1, n+1):
    TF.append(j in a_list)

print(TF.count(False))


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

ll f[310][90010];
int num[310],n;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline ll pls(const ll &x,const ll &y) { return (x+y<mod)?x+y:x+y-mod; }
inline ll mns(const ll &x,const ll &y) { return (x-y<0)?x-y+mod:x-y; }
inline ll ksm(ll x,ll y) { ll res=1;for (;y;y>>=1,x=x*x%mod) if (y&1) res=res*x%mod;return res; }

int main()
{
	n=rd();
	for (int i=1;i<=n;i++) num[i]=rd();
	f[0][0]=1;
	int sum=0;
	for (int i=1;i<=n;i++) sum+=num[i];
	for (int i=1;i<=n;i++)
	{
		for (int j=sum;~j;j--)
		{
			f[i][j]=pls(f[i-1][j],f[i-1][j]);
			if (j>=num[i]) f[i][j]=pls(f[i][j],f[i-1][j-num[i]]);
		}
	}
	ll ans=ksm(3,n);
	for (int i=(sum+1)/2;i<=sum;i++) ans=mns(ans,f[n][i]*3%mod);
	memset(f,0,sizeof(f));
	f[0][0]=1;
	for (int i=1;i<=n;i++)
	{
		for (int j=sum;~j;j--)
		{
			f[i][j]=f[i-1][j];
			if (j>=num[i]) f[i][j]=pls(f[i][j],f[i-1][j-num[i]]);
		}
	}
	if (sum%2==0)
	{
		ans=pls(ans,f[n][sum/2]*3%mod);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 218240
#include<iostream>
#include<vector>

using namespace std;

int main()
{
	int t, n, at;

	int st, et;

	while(cin >> t)
	{
		if(t == 0) break;

		at = 0;

		cin >> n;

		for(int i= 0;i < n; i++)
		{
			cin >> st >> et;
			at += (et - st);
		}

		if( at >= t )
		{
			cout << "OK" << endl;
		}
		else
		{
			cout << t - at << endl;
		}
	}
}

Measured memory_bytes: 1160
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i32,
        b: i32,
    }

    let mut ans = 0;
    'outer: for n in a..(b+1) {
        let s = n.to_string();
        let len = s.len();
        let mid = (len as f64 / 2.0_f64).ceil() as usize;

        for i in 0..(mid - 1) {
            let j = len - 1 - i;
            let istr = s.chars().nth(i).unwrap();
            let jstr = s.chars().nth(j).unwrap();
            if istr != jstr {
                continue 'outer;
            }
        }

        ans += 1;
    }

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



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

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

  int cnt_P = 0;
  int cnt_W = 0;
  int cnt_G = 0;
  int cnt_Y = 0;
  int cnt_kind = 0;
  for (int i = 0; i < N; i++) {
    string x;
    cin >> x;

    if (x == "P") {
      cnt_P++;
    }
    else if (x == "W") {
      cnt_W++;
    }
    else if (x == "G") {
      cnt_G++;
    } 
    else if (x == "Y") {
      cnt_Y++;
    }
  }
    if (cnt_P>0) cnt_kind++;
    if (cnt_W>0) cnt_kind++;
    if (cnt_G>0) cnt_kind++;
    if (cnt_Y>0) cnt_kind++;
    
    if (cnt_kind == 3) cout << "Three" << endl;
    if (cnt_kind == 4) cout << "Four" << endl;

  

}


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

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    long long a, b, k;
    cin >> a >> b >> k;
    long long fs = min(a, k);
    a -= fs, k -= fs;
    long long sc = min(b, k);
    b -= sc, k -= sc;
    cout << a << " " << b;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef pair<double,double> PD;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd> > Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;


#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod
#define MUL(a,b) a=(a*b)%mod

const ll BIG=1e9;
struct F{
    ll Two; ll Five;
};

bool two_sort(F x, F y){
    return x.Two!= y.Two ? x.Two<y.Two : x.Five<y.Five;
}

bool five_sort(F x, F y){
    return x.Five!=y.Five ? x.Five<y.Five : x.Two<y.Two;
}

F Change(string S){
    ll Count=9;
    bool below=false;
    ll ret=0;
    rep(i,S.size()){
        if(S[i]=='.') below=true;
        else{
            ret*=10;
            ret+=(S[i]-'0');
            if(below) Count--;
        }
    }
    ll two=Count, five=Count;
    while(!(ret%2)){
        ret/=2;
        two++;
    }
    while(!(ret%5)){
        ret/=5;
        five++;
    }
    if(two>=18) two=18;
    if(five>=18) five=18;
    F RET={two,five};
    return RET;
}

int main(){
    ll N; cin>>N;
    vector<F> d;
    ll Count=0;
    rep(i,N){
        string S; cin>>S;
        d.pb(Change(S));
        if(d[i].Two>=9 && d[i].Five>=9) Count++;
    }

    sort(ALL(d),two_sort);
    vec x(19,0);
    ll memo=N-1;
    ll ans=0;
    rep(i,N){
        while(memo>=0){
            if(d[memo].Two+d[i].Two<18) break;
            x[d[memo].Five]++;
            memo--;
        }
        REP(j,18-d[i].Five,19) ans+=x[j];
    }
    ans-=Count;
    ans/=2;
    cout<<ans<<endl;



    
    
}

Measured memory_bytes: 7388
#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
signed main(){
	int n,a,b,c,d,ans=0;
	cin>>n>>a>>b;
	f(i,n){
		cin>>c>>d;
		if(a<=c&&b<=d) ans++;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
    int H, M;
    cin >> H >> M;
    vector<string> a(H);
    for(int i=0; i<H; ++i) {
        cin >> a[i];
    }
    string s(M, '.');
    vector<vector<int> > con(2);
    for(int i=0; i<H; ++i) {
        if(a[i] == s) {
            con[0].push_back(i);
        }
    }
    int d=0;
    for(int i=0; i<M; ++i) {
        for(int j=0; j < H; ++j) {
            if(a[j][i] == '.') {
                ++d; 
            } 
        }
        if(d == H) {
            con[1].push_back(i);
        }
        d=0;
    }
    for(int i=0; i < H; ++i) {
        bool i_ = true;
        for(int k = 0; k<con[0].size(); ++k) {
            if(con[0][k] == i) {
                i_ = false;
                break;
            }
        }
        for(int j=0; j < M; ++j) {
            bool j_ = true;
            for(int l=0;l<con[1].size(); ++l) {
                if(con[1][l] == j) {
                    j_ = false;
                    break;
                }
            }
            if(i_ && j_) {
                cout << a[i][j];
            }
        }
        if(i_) {
            cout << endl;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    long long ans=0,k=0,t;
    vector<long long> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int i=0; i<n; i++){
        ans+=a[i];
        ans%=(1000000007*2);
        t=a[i]*a[i];
        t%=(1000000007*2);
        k+=t;
        k%=(1000000007*2);
    }
    ans*=ans;
    ans%=(1000000007*2);
    if(ans-k<0) ans+=(1000000007*2);
    ans=(ans-k);
    ans%=(1000000007*2);
    ans/=2;
    cout << ans;
}

Measured memory_bytes: 4764
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
using namespace std;
typedef long long int ll;

int main(){
	int N;
	cin >> N;
	int ans = 1000000000;
	for(int i = 1; i <= N - 1; i++){
		int a = i, b = N - i;
		int num = 0;
		while(a > 0){
			num += a % 10;
			a /= 10;
		}
		while(b > 0){
			num += b % 10;
			b /= 10;
		}
		ans = min(ans, num);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define umap unordered_map
#define uset unordered_set
#define ll long long
#define lll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define fo(i,a,b) for(int i=a;i<b;i++)
#define Lets_be_precise cout<<fixed<<setprecision(10)
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
// const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
const int MAXN=100000+11;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
	cin>>v[i];
}
//#define cerr if(false)cerr//uncomment to remove cerr from program...
void solveforthiscase(const int & test)
{//deb(test);
cin>>n;
vector<ll> factors;
umap<ll,bool> vis;
for(ll i=1;i*i<=n;i++)
{
  if(n%i==0)
  {
      factors.pb(i);
      if(i!=n/i)
      {
          factors.pb(n/i);
      }
  }
}

ll ans=0;
for(auto x:factors)
{
    if(x==1)
    continue;
    ll tempn=n;
    while(tempn>=x)
    {
        if(tempn%x==0)
        {tempn/=x;continue;}
        else
        {
        if(tempn%x==1)
        ans++;
        break;
        }
    }
    if(tempn==1)
    ans++;
}
n--;
vll factors2;
for(ll i=1;i*i<=n;i++)
{
  if(n%i==0)
  {
      factors2.pb(i);
      if(i!=n/i)
      {
          factors2.pb(n/i);
      }
  }
}
n++;
for(auto x:factors2)
{
    if(n%x==1)
    ans++;
}
cout<<ans;
return ;
}

int main()
{
	ios_base::sync_with_stdio(false);
	Lets_be_precise;
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

Measured memory_bytes: 384
import sys
import math
N = int(input())
def solve(num):
    d = math.floor(num**(1/2))
    for i in range(1,d+1):
        if num % i == 0:
            yield [i,num//i]

if N == 2:
    print(1)
    sys.exit()

cnt = 0
for a,b in solve(N-1):
    if a == b:
        cnt += 1
    else:
        cnt += 2

cnt -= 1

for s in solve(N):
    if s[0] == s[1]:
        s.pop()
    for a in s:
        if a == 1:
            continue

        tmp = N
        while True:
            tmp,m = divmod(tmp, a)
            if m == 0:
                continue
            elif m == 1:
                cnt += 1
            break

print(cnt)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N ;
  cin >> N;
  if(N % 10 ==7 || N%100/10 == 7 || N / 100 == 7){
    cout << "Yes" << endl;
  }else{   
   cout << "No" << endl;
  }
}


Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
using namespace std;

using ll = long long;
struct Data { int p, i; };

int main() {
  int n; cin >> n;
  vector<Data> lp;
  for (int i = 0; i < n; ++i) {
    int p; cin >> p;
    lp.push_back((Data){p, i});
  }
  sort(lp.begin(), lp.end(), [&](auto &l, auto &r) {
    return l.p > r.p;
  });
  multiset<int> done;
  ll ans = 0;

  done.insert(-1);
  done.insert(-1);
  done.insert(n);
  done.insert(n);
  for (int i = 0; i < n; ++i) {
    done.insert(lp[i].i);
    auto it = done.lower_bound(lp[i].i);
    int j = *it;
    auto ib1 = prev(it);
    auto ib2 = prev(ib1);
    auto in1 = next(it);
    auto in2 = next(in1);
    ll tmp = 0;
    tmp += (*in2-*in1)*(j-*ib1);
    tmp += (*in1-j)*(*ib1-*ib2);
    // cerr << i << " " << j << " " << *ib2 << " " << *ib1 << " " << *in1 <<  " " << *in2 << " " << tmp << endl;
    ans += tmp*(ll)lp[i].p;
  }
  cout << ans << endl;
}


Measured memory_bytes: 5748
n,m = map(int,input().split())
s = str(input())
now = n
ans = ""
while now != 0:
    for num in range(min(m,now),0,-1):
        if s[now-num] == "0":
            now -= num
            ans=str(num)+" "+ans
            break
        else:
            if num == 1:
                print(-1)
                exit()
print(ans)

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

int main() {
    int N;
    cin >> N;
    vector<string> s(N);
    for (int i = 0; i < N; i++) {
        cin >> s[i];
    }
    int M;
    cin >> M;
    vector<string> t(M);
    for (int i = 0; i < M; i++) {
        cin >> t[i];
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int c = count(s.begin(), s.end(), s[i]);
        c -= count(t.begin(), t.end(), s[i]);
        ans = max(ans, c);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n, x, y = map(int, input().split())
l = [0]*(n-1)
for i in range(1, n+1):
    for j in range(i+1, n+1):
        num = min(abs(i-j), abs(i-x) + abs(j-y) + 1)
        l[num-1] += 1
for i in l:
    print(i)

Measured memory_bytes: 46044
import java.io.*;

class Main {
    public static void main(String [] args){
        
        for(int i = 1; i <= 9; ++i){
            for(int j = 1; j <= 9; ++j){
                System.out.println(i + "x" + j + "=" + i * j);
            }
        }
    }
}


Measured memory_bytes: 24096
# -*- coding: utf-8 -*-
N = int(input())
A = list(map(int, input().split(' ')))
B = list(map(int, input().split(' ')))

import math
n1 = sum([max(0, a-b)  for a, b in zip(A, B)])
n2 = sum([max(0, int(math.floor((b-a)/2))) for a, b in zip(A, B)])

if n2 >= n1:
    print('Yes')
else:
    print('No')





Measured memory_bytes: 42384
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define co(x) cout << (x) << "\n"
#define pb push_back
#define Never
#define To

using namespace std;

int main(){

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

	int A[3];

	cin >> A[0] >> A[1] >> A[2];

	if(A[0] + A[1] + A[2] >= 22 ) {
		cout << "bust" << endl;
	} else {
		cout << "win" << endl;
	}

	Never To return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=14;
const int MAXM=1005;
const int INF=0X3F3F3F3F;
int N,M,dp[MAXM][1<<MAXN],Ans=INF;
struct Node{int a,b,c;}s[MAXM];
int main(){
	scanf("%d%d",&N,&M);
	for(int i=1;i<=M;i++){
		scanf("%d%d",&s[i].a,&s[i].b);
		for(int j=1,x;j<=s[i].b;j++){
			scanf("%d",&x);
			s[i].c+=(1<<(x-1));
		}
	}
	memset(dp,0X3F,sizeof(dp));
	dp[0][0]=0;
	for(int i=1;i<=M;i++){
		for(int j=0;j<(1<<N);j++)
			dp[i][j]=dp[i-1][j];
		for(int j=0;j<(1<<N);j++)
			dp[i][j|s[i].c]=min(dp[i][j|s[i].c],dp[i-1][j]+s[i].a);
	}
	for(int i=1;i<=M;i++)
		Ans=min(Ans,dp[i][(1<<N)-1]);
	if(Ans==INF)puts("-1");
	else printf("%d\n",Ans);
}

Measured memory_bytes: 64512
n = int(input())
cards = input().split()


def print_stable(original_list, sorted_list):
    for n in range(1, 10):
        original_list_n = filter(lambda card: int(card[1]) == n, original_list)
        sorted_list_n = filter(lambda card: int(card[1]) == n, sorted_list)
        is_same = all(map(lambda c: c[0] == c[1], zip(original_list_n, sorted_list_n)))
        if not is_same:
            print('Not stable')
            return
    print('Stable')


def print_list(l):
    print(' '.join(map(str, l)))


def bubble_sort(l):
    swapped = True
    while swapped:
        swapped = False
        for i in range(n - 1, 0, -1):
            if l[i][1] < l[i - 1][1]:
                l[i], l[i - 1] = l[i - 1], l[i]
                swapped = True
    return l


def selection_sort(l):
    for i in range(n - 1):
        min_index = i
        for j in range(i + 1, n):
            if l[j][1] < l[min_index][1]:
                min_index = j
        l[i], l[min_index] = l[min_index], l[i]
    return l


bubble_list = bubble_sort(cards[:])
print_list(bubble_list)
print_stable(cards, bubble_list)

selection_list = selection_sort(cards[:])
print_list(selection_list)
print_stable(cards, selection_list)



Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
#define maxn -20000000000 //negative value to break code and force you to put right constraint
#define mod 1000000007
#define md(x) (x) % mod;
#define sc scanf
#define pr printf
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ps push
#define prt(x) cout << (#x) << " is " << (x) << endl
#define EPS 1e-9
#define INF 100000000000
#define INFd 1e9
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<double> vd;

int main()
{
	ll n,m1;
	cin>>n>>m1;
	char m[1005][1005];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m1;j++)
		{
			cin>>m[i][j];
		}
	}
	ll ans[1005][1005];
	ans[0][0]=1;
	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<m1;j++)
		{
			if(i==0&&j==0)
				continue;
			if(i==0)
			{
				if(m[i][j]=='.')
					ans[i][j]=ans[i][j-1];
			}
			else if(j==0)
			{
				if(m[i][j]=='.')
					ans[i][j]=ans[i-1][j];
			}
			else
			{
				if(m[i][j]=='.')
					ans[i][j]=ans[i-1][j]+ans[i][j-1];
			}
			ans[i][j]%=mod;

		}
	}
	cout<<ans[n-1][m1-1];
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define vc vector<int>
#define um unordered_map<int,int>
#define ll long long 
#define rep(i,a,b) for(__typeof(a) i=a; i<b; i++)
#define si(a) a.size()
#define all(a) a.begin(),a.end()
#define ss(a) a.second
#define ff(a) a.first
#define M 1000000
#define pb push_back
#define repit(i,a) for(auto i=a.begin(); i!=a.end(); i++)
#define take(arr,n) for(int i=0;i<n;i++)cin>>arr[i]
#define out(arr,n) for(int i=0;i<n;i++)cout<<arr[i]<<' '
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define reprev(i,b,a) for(__typeof(b) i=b; i>=a; i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define doublearray vector<vector<int>>
#define mod 998244353 
using namespace std;
ll max(ll a, ll b){ return a>b?a:b; }
ll min(ll a, ll b){ return a<b?a:b; }
// ll gcd(ll a, ll b){
//     if(b==0) return a;
//     return gcd(b,a%b);
// }
// ll lcm(ll a, ll b){
//     return (a*b)/gcd(a,b);
// }
int main(){
    fastio;
    string s,t; cin>>s>>t;
  	ll a=0;
  rep(i,0,si(s)){
    if(s[i]!=t[i])a++;
  }
  cout<<a<<endl;
    return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string a,b,c;cin >>a>>b>>c;
    cout <<a[0]<<b[0]<<c[0]<<endl;
}


Measured memory_bytes: 3660
<?php
$sc = new Scanner();
$a = $sc->nextInt();
$b = $sc->nextInt();
$c = $sc->nextInt();

$p1Max = $a;
$p1 = $b;
$p1Rest = $a - $b;
$p2 = $c;
$p2Rest = max($p2 - $p1Rest, 0);

Out::println($p2Rest);

class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
}

class Out {
    public static function println($str = "") {
        echo $str . PHP_EOL;
    }
}


Measured memory_bytes: 3700
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
typedef pair<int,int> P;
int main(void){
  int n,m,i,d,t;
  map<int,int> a;
  map<int,int>::iterator ite;
  cin >> n;
  for (i=0;i<n;i++){
    cin >> d;
    ite=a.find(d);
    if (ite==a.end()) a.insert(P(d,1));
    else ite->second++;
  }
  cin >> m;
  for (i=0;i<m;i++){
    cin >> t;
    ite=a.find(t);
    if (ite==a.end() || ite->second==0){
      cout << "NO" << endl;
      return 0;
    }
    ite->second--;
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 9600
/**************************************************************
	File name: B.cpp
	Author: huhao
	Email: 826538400@qq.com
	Create time: 2019/8/17 下午8:31:08
**************************************************************/
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define fr(i,a,b) for(int i=(a),end_##i=(b);i<=end_##i;i++)
#define fd(i,a,b) for(int i=(a),end_##i=(b);i>=end_##i;i--)
int read()
{
	int r=0,t=1,c=getchar();
	while(c<'0'||c>'9')
	{
		t=c=='-'?-1:1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		r=(r<<3)+(r<<1)+(c^48);
		c=getchar();
	}
	return r*t;
}
const int N=300010,mod=998244353;
char s[N];
int a[N],x,y,X,Y,n;
long long ans=1;
int main()
{
	n=read()*3;
	scanf("%s",s+1);
	x=1;
	y=2;
	fr(i,1,n)
	{
		s[i]=s[i]=='G'?1:(s[i]=='R'?2:3);
		if(s[i]==x)
			X++;
		else if(s[i]==y)
		{
			if(X!=Y)
			{
				ans=ans*(X-Y)%mod;
				Y++;
			}
			else
			{
				swap(x,y);
				X++;
			}
		}
		else
		{
			if(Y)
			{
				ans=ans*Y%mod;
				Y--;
				X--;
			}
			else if(X)
			{
				y=s[i];
				Y++;
				ans=ans*X%mod;
			}
			else
			{
				x=s[i];
				X++;
			}
		}
	}
	fr(i,1,n/3)
		ans=ans*i%mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 512
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
//    double s[] = new double[n];
    double answer=0;
    for(int i=0;i<n;i++){
      answer += 1/sc.nextDouble();
    }
    answer = 1/answer;
    System.out.println(answer);    
  }
}

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

int main()
{
	string s, t = "CODEFESTIVAL2016";
	cin >> s;
	int x = 0;
	for (int i = 0; i < s.length(); ++i) {
		if (s[i] != t[i]) ++x;
	}
	cout << x << endl;

	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define int long long
#define sz(x) (int)(x.size())
using namespace std;

const int N = 5e3 + 5;
const int inf = 1e18;
const int mod = 1e9 + 7;



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

   int n, k;
   cin >> n >> k;
   int ans = n;
   if(n > k){
   	n %= k;
   	ans = min(ans, n);
   	ans = min(ans, abs(n-k));
   }else{
   	ans = min(ans, abs(n-k));
   }
   cout << ans << '\n';
}



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

const int N=3000;
double f[N];

int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	
	int n; scanf("%d",&n);
	f[0]=1;
	for(int i=1;i<=n;++i) {
		double p; scanf("%lf",&p);
		for(int j=n;j>=1;--j) f[j]=f[j]*(1-p)+f[j-1]*p;
		f[0]*=(1-p);
	}
	double ans=0;
	for(int i=n/2+1;i<=n;++i) ans+=f[i];
	printf("%.10lf\n",ans);
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <numeric>

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

using namespace std;


int main() {
    string s;
    ll k;
    cin >> s >> k;
    for (ll i = 0; i < min((long long)s.size(),k); i++) {
        if (s[i] != '1') {
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << '1' << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
def main():    
    x, y = map(int, input().split())
    a = 4*x-y
    if not y%2 == 0:
        print('No')
        return
    if a/2 >= 0 and a/2 <= x:
        print('Yes')
    else:
        print('No')

main()

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

int main(){

     string O;
     string E; 

     cin >> O;
     cin >> E;

     int term = O.size() + E.size();

     string pass[term];
     int j = 0;
     int k = 0;

     for(int i=0; i<term; i++){
         if((i % 2) == 0 ){
             pass[i] = O[k];
             k += 1;
         }else{
             pass[i] = E[j];
             j += 1;
         }
     }

     for(int i=0; i<term; i++){
        cout << pass[i] <<flush;
     }
     cout << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
int n;
int bit[100010];
void add(int v, int x) {

	while (v <= n)
	{
		bit[v] += x;
		v += v & -v;
	}
}

ll sum(int v) {
	ll r = 0;
	while (v > 0)
	{
		r += bit[v];
		v -= v & -v;
	}
	return r;
}
void put(string v) {
	cout << "a" << v<< "b" << endl;
}
void solv() {

	int i = 1;
	while (i <= 10000)
	{
		int c;
		cin >> c;
		if (c == 0) break;
		cout << "Case " << i << ": " << c << endl;
		i++;
	}

}


int main() {
	//	COMinit();
	solv();

	return 0;
}



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



namespace ConsoleApplication2
{

    class Program
    {
        static void Main(string[] args)
        {

            string[] input = Console.ReadLine().Split(' ');
            string[] string2 = Console.ReadLine().Split(' ');
            int day, task,res;

            day = int.Parse(input[0]);

            int cost=0;

            int[] underworker = new int[string2.Count()];
            int[] result = new int[string2.Count()+1];

            for (int i=0;i< string2.Count();i++)
            {
                result[i] = 0;
                underworker[i] += int.Parse(string2[i]);
            }

            for(int j=0;j<underworker.Count();j++)
            {
                result[underworker[j]-1]++;
            }
            for (int i = 0; i<underworker.Count()+1; i++)
            {
                Console.WriteLine(result[i]);
            }


        }
    }
}


Measured memory_bytes: 39944
#include <cstdio>
using namespace std;

int n, k, x, y;

int main(){
	scanf("%d %d %d %d", &n, &k, &x, &y);
	if(n > k){
		printf("%d\n", k * x + (n - k) * y);
	}else{
		printf("%d\n", n * x);
	}
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left!=NIL){
    x=x->left;
  }
  return x;
  //ok
}

Node treeMaximum(Node x){
  while(x->right!=NIL){
    x=x->right;
  }
  return x;
  //ok
}

Node treeSearch(Node u, int k){
  if(u==NIL || k==u->key){
    return u;
  }
  if(k<u->key){
    return treeSearch(u->left,k);
      }
  else{
    return treeSearch(u->right,k);
      }
  //ok
}

Node treeSuccessor(Node x){
  Node y;
  
  if(x->right!=NIL){
    return treeMinimum(x->right);
      }
  y=x->parent;
  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
//treeSearch(root,x)を使っているのでz==treeSearch
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left == NIL || z->right == NIL){
    y=z;
  }else{
    //Treeに当たるものがないので書かないでやってみる
    y=treeSuccessor(z);
  }
  if(y->left !=NIL){
    x=y->left;
  }
  else{
    x=y->right;
  }
  if(x!=NIL){
    x->parent=y->parent;
  }
  if(y->parent==NIL){
    root=x;
  }else if(y==y->parent->left){
    y->parent->left=x;
  }else{
    y->parent->right=x;
  }
  if(y!=z){
    z->key=y->key;
  }
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }else{
      x=x->right;
    }
  }
  z->parent=y;

  if(y==NIL){
    root=z;
  }else if(z->key < y->key){
    y->left=z;
  }else{
    y->right=z;
  }
}

void inorder(Node u){
  if(u!=NIL){
    inorder(u->left);
      printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
  if(u==NIL){
    return;
  }
    printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20484
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

int main()
{
  ll n; cin>>n;
  deque<ll> d;
  rep(i, n) {
    ll a; cin>>a;
    if (i%2) d.push_front(a);
    else d.push_back(a);
  }
  if (n%2) reverse(d.begin(), d.end());
  rep(i, n) {
    if (i > 0) cout << " ";
    cout << d[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3840
h,w = map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
tizu = [[0]*w for i in range(h)]
ima = 0
ima2 = 0
for i in range(n):
  b = a[i]
  for j in range(b):
    tizu[ima][ima2] = i+1
    if ima %2 == 0:
      ima2 += 1
    else:
      ima2 -= 1
    if ima2 == w and ima%2 == 0:
      ima +=1
      ima2 -=1
    elif ima2 == -1 and ima%2 == 1:
      ima += 1
      ima2 += 1
for i in range(h):
  print(" ".join(map(str,tizu[i])))

Measured memory_bytes: 3568