akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	string S;
	cin >> S;
	for(int i =0; i < (int)S.length(); i++) if(S[i] == 'C')
		for(int j =i+1; j < (int)S.length(); j++) if(S[j] == 'F') {
			cout << "Yes\n";
			return 0;
		}
	cout << "No\n";
	return 0;}

// look at my code
// my code is amazing


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        for (int i = 1; ; i++){
            int j = sc.nextInt();
            if (j == 0) break;
            System.out.println("Case " + i + ": " + j);
        }
    }
}


Measured memory_bytes: 42124
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

#define PI 4*atan(1);

vector<bool> a;
void func(int n){

  for(int i = 0; i <= n; i++){
    a.push_back(true);
  }
  for(int i = 2; i * i <= n; i++){
    if(a[i]){
      for(int j = 2; i * j <= n; j++){
        a[i * j] = 0;
      }
    }
  }
  int cnt = 0;
  for(int i = 2; i <= n; i++){
    if(a[i]){
      cnt++;
    }
  }
  cout << cnt << endl;
}

int main(){
  int n;
  while(cin >> n){
    func(n);
  }
}

Measured memory_bytes: 3172
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000009;

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

	int ans = 1000000000;
	sort(h.begin(),h.end()); 

	for(int i = 0;i < n;i++){
		if(i + k - 1 < n){
			ans = min(ans,h[i+k-1] - h[i]);
		}
	}
	cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int K; cin >> K;
  string S; cin >> S;
  int n = S.length();
  if (n <= K) cout << S << endl;
  else {
    string T;
    rep(i, K) T+= S[i];
    T += "...";
    cout << T << endl;
  }
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
//#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  rep(i, n) {
    string s;
    cin >> s;
    sort(s);
    mp[s]++;
  }

  ll sum = 0;
  for (auto &p : mp) {
    ll i = p.second;
    sum += i * (i - 1) / 2;
  }
  p(sum);
}

Measured memory_bytes: 11136
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S, T = map(str, input().split())

for i in range(N):
  print(S[i], end="")
  print(T[i], end="")
  
print()

Measured memory_bytes: 5188
#include<bits/stdc++.h>
#define pb push_back
#define mod int(1e9+7)
#define N int(2e5+100)
#define ll long long int
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define si second
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
   int n,m;
   cin>>n>>m;
   int a[m],sum=0;
   for(int i=0;i<m;i++)
      cin>>a[i];
   for(int i=0;i<m;i++)
      sum+=a[i];
   if(sum>n)
      cout<<-1<<endl;
   else
      cout<<(n-sum)<<endl;
   return 0;
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

long long H,W;

long long cal(long long h,long long w) {
    long long A,B,C,ans = 1000000;
    
    for(int i = 1;i < h;i++) {
        A = i * w;
        B = w / 2 * (h - i);
        C = h * w - A - B;
        ans = min(ans,max(A,C) - min(A,B));
    }

    for(int i = 1;i < h;i++) {
        A = i * w;
        B = (h - i) / 2 * w;
        C = h * w - A - B;
        ans = min(ans,max(A,C) - min(A,B)); 
    }

    return ans;
}


int main() {
  
  cin >> H >> W;
  cout << min(cal(H,W),cal(W,H)) << endl;
  
}


Measured memory_bytes: 256
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
x = []
y = []
n.times do
  xx, yy = gets.chomp.split.map(&:to_i)
  x.push xx
  y.push yy
end

if n == 1
  puts 1
  exit
end


h = Hash.new(0)
n.times do |i|
  n.times do |j|
    next if i == j
    len = [x[i] - x[j], y[i] - y[j]]
    h[len] += 1
  end
end

puts n - h.values.max




Measured memory_bytes: 14588
/*
  Contest 099
  A - ABD
  Rakesh Kumar --> 24/09/2020
 */

#include <bits/stdc++.h>

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

    int n = 0;
    std::cin >> n;
    std::string r = "AB";
    r += (n / 1000) + 'C';
    std::cout << r << std::endl;

    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define pb push_back
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); freopen("/home/aman/Desktop/Kachda/output.txt", "w", stdout);

using namespace std;

string l;
int dp[100011];

int power(int a, int b, int m)
{
    int ans = 1;
    a %= m;
    while(b){
        if(b & 1) ans = (ans * a) % m;
        a = (a * a) % m;
        b >>= 1;
    }
    return ans;
}

signed main()
{

 	FLASH

 	cin>>l;
 	reverse(l.begin(), l.end());

 	int n = l.size();
 	if(l[0] == '0'){
 		dp[0] = 1;
 	}
 	else{
 		dp[0] = 3;
 	}

 	fr(i, 1, n){
 		if(l[i] == '1'){
 			dp[i] = power(3, i, mod) + 2*dp[i - 1];
 		}
 		else{
 			dp[i] = dp[i - 1];
 		}
 		dp[i] %= mod;
 	}


 	cout<<dp[n - 1];



}

Measured memory_bytes: 1232
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define int long long
#define double long double
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int mypow(int a, int b) {
	if (!b)return 1;
	if (b % 2)return mypow(a, b - 1) * a % 13;
	int memo = mypow(a, b / 2);
	return memo * memo % 13;
}
int a[2][13];
signed main() {
	string s;
	cin >> s;
	a[0][0] = 1;
	rep(i, s.size()) {
		if (s[i] == '?') {
			rep(j, 10) {
				rep(k, 13) {
					a[1][(k + j * mypow(10, s.size() - i - 1)) % 13] += a[0][k];
				}
			}
		}
		else {
			rep(j, 13) {
				a[1][(j + (s[i] - '0') * mypow(10, s.size() - i - 1)) % 13] += a[0][j];
			}
		}
		rep(j, 13) {
			a[1][j] %= mod;
			a[0][j] = a[1][j];
			a[1][j] = 0;
		}
	}
	cout << a[0][5] << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>

using namespace std;

const int MAXN = 1e5+10;
int arr[MAXN];
int main()
{
    int N,K;
    cin >> N >>K;
    for(int i = 0 ; i < N ; i++)
    {
        cin >>arr[i];
    }
    sort(arr,arr+N);
    int minn = arr[N-1]-arr[0];
    for(int i = 0 ; i+K-1 < N ; i++)
    {
        minn = min(minn, arr[i+K-1]-arr[i]);
    }
    cout<<minn<<endl;
	return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Set<Integer> set = new HashSet<>();

		int n = sc.nextInt();
		while (sc.hasNextInt()) {
			set.add(sc.nextInt());
		}
		System.out.println(set.size());
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>

using namespace std;
int dp[12][2][2][2][2] = {0};
int main(){
	int i,j,k,l,m;
	string s;
	cin >> s;
	int n = s.size();
	int x = s[0] - '0';
	for(i=1;i<=x;i++){
		if(i==3 || i==5 || i==7) dp[0][i==3][i==5][i==7][x==i]++;
	}
	for(i=1;i<n;i++){
		int x = s[i] - '0';
		for(int j: {3,5,7}){
			dp[i][j==3][j==5][j==7][0]++;
			for(k=0;k<2;k++){
				for(l=0;l<2;l++){
					for(m=0;m<2;m++){
						dp[i][k|(j==3)][l|(j==5)][m|(j==7)][0] += dp[i-1][k][l][m][0];
						if(j<=x) dp[i][k|(j==3)][l|(j==5)][m|(j==7)][(x==j)] += dp[i-1][k][l][m][1];
					}
				}
			}
		}
	}
	cout << dp[n-1][1][1][1][0] + dp[n-1][1][1][1][1] << endl;
}
				

Measured memory_bytes: 256
from math import sqrt
X = int(input())

def is_prime(n):
    for i in range(2, int(sqrt(n+0.1))+1):
        r = n % i
        if r == 0:
            return False
    return True

x = X
while(True):
    if (is_prime(x)):
        print(x)
        break
    else:
        x += 1

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <tuple>
#include <cmath>
#include <cstdio>
#include <cassert>
#include <functional>
#define _LIBCPP_DEBUG 0
using namespace std;
using ll = long long;

int main(void)
{
    int n;
    cin >> n;
    
    vector<int> a(n+1),b(n);
    for (int i = 0; i < n+1; i++)
    {
        cin >> a.at(i);
    }
    for (int i = 0; i < n; i++)
    {
        cin >> b.at(i);
    }
    
    ll count=0;
    for (int i = 0; i < n; i++)
    {
        if (b.at(i)<=a.at(i))
        {
            count+=b.at(i);
        }
        else if (b.at(i)<=a.at(i)+a.at(i+1))
        {
            count+=b.at(i);
            if (b.at(i)>a.at(i))
            {
                a.at(i+1) -= b.at(i) - a.at(i);
            }
        }
        else if (b.at(i)>a.at(i)+a.at(i+1))
        {
            count+=a.at(i)+a.at(i+1);
            a.at(i+1)=0;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
         
int main() {
  int N;
  cin >> N; 
  vector<int> buttons(N+1);
  
  for (int i = 1; i <= N; i++) {
    cin >> buttons.at(i);
  }  
  
  // search all 
  vector<bool> pushed(N+1);
  int i = 1;
  
  for (int x = 0; x <= N; x++) 
      pushed.at(x) = false;
    
  int count = 0;
    
  while (true) {
    pushed.at(i) = true;
    count++;

    // next button 
    i = buttons.at(i);

    // reached button2 ?
    if ( i == 2 ) {
      cout << count << endl;
      break;
    }
    // infinite loop ?
    if (pushed.at(i) || (count >= N)) {
      cout << -1 << endl;
      break;
    }  
  }  
}

Measured memory_bytes: 640
import sys
from operator import itemgetter

def solve():
    input = sys.stdin.readline
    N = int(input())
    W = [[int(w) for w in input().split()] for _ in range(N)]
    W.sort()
    W.sort(key = itemgetter(1))
    time = 0
    for i, w in enumerate(W):
        if time + w[0] > w[1]:
            print("No")
            break
        else:
            time += w[0]
    else: print("Yes")

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 41204
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<functional>
#include<set>
#include<complex>
#include<limits>
#include<map>
#include<set>

int main()
{
	std::string str;
	std::cin >> str;
	if (str.size() % 2 == 0)
	{
		if (str.front() == str.back())
		{
			std::cout << "First" << std::endl;
		}
		else
		{
			std::cout << "Second" << std::endl;
		}
	}
	else
	{
		if (str.front() == str.back())
		{
			std::cout << "Second" << std::endl;
		}
		else
		{
			std::cout << "First" << std::endl;
		}
	}

}

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

typedef long long ll;

int main() {
	string a,b;
	cin >> a;
	b = a;
	for (int i = 0;i < a.size();i++) {
		if (a[i] == '1') {
			b[i] = '9';
		} else {
			b[i] = '1';
		}
	}
	cout << b << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <queue>
#include <time.h>

using namespace std;

#define INT_MAX 2147483647
typedef long long ll;

ll gcd(ll m, ll n);		//最大公倍数
ll lcm(ll m, ll n);		//最小公倍数

int main(void) {

	string ans = "No";
	
	int n;
	cin >> n;

	int tmp = n;
	for (int i = 1; i * 4 <= n; i++) {
		if (tmp % 4 == 0 || tmp % 7 == 0) {
			ans = "Yes";
			break;
		}
		tmp = n - i * 4;
		if (tmp % 7 == 0) {
			ans = "Yes";
			break;
		}
	}

	cout << ans << endl;

	return 0;

}

// 2番目から3要素だけ抜き出した部分文字列を取得する
//std::string result = s.substr(2, 3);  

#if 1
//最大公倍数
ll gcd(ll m, ll n)
{
	ll temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}
#endif

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>

int par[60];
int unifind(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
	}
}
//木の根を求める
int unifind_root(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = unifind_root(par[x]);
	}
}
//同じグループか判定
bool unifind_same(int x, int y) {
	return unifind_root(x) == unifind_root(y);
}
//グループ併合
int unifind_unite(int x, int y) {
	x = unifind_root(x);
	y = unifind_root(y);
	if (x == y) {
		return 0;
	}
	par[x] = y;
}

main() {
	int n,m;
	int result = 0;
	int s[100][2];
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &s[i][0], &s[i][1]);
      s[i][0]--;
      s[i][1]--;
	}
	unifind(n);
	for (int i = 0; i < m; i++) {


		for (int j = 0; j < m; j++) {
			if (j != i) {
				unifind_unite(s[j][0], s[j][1]);
			}
			
		}


		for (int j = 1; j < n; j++) {
			if (unifind_same(0 , j)) {
              
              if(j==n-1){result++; break;}
				continue;
			}
			break;
         
		}
		unifind(n);

	}
	printf("%d", m-result);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;
 
#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}
 
 
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
 
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
 
  int N;
  while(cin>>N, N){
    int M;
    cin >> M;
    int P, Q, R;
    cin >> P >> Q >> R;
    --P;
     
    vector<PII> s[2];
    int crt = 0, nxt = 1;
    s[crt].PB(MP(0,R));
    REP(i,M){
      int a, b;
      cin >> a >> b;
      s[nxt].clear();

      for(auto r: s[crt]){
        int l1 = N - b;
        int l2 = N - a;

		if(r.FF < a){
		  s[nxt].EB(l2 + r.FF, min(N, l2 + r.SS));
		}
		if(b < r.SS){
		  s[nxt].EB(max(0, r.FF-b), r.SS - b);
		}
		int lft = max(a, r.FF);
		int rht = min(b, r.SS);
		if(rht - lft > 0 && a <= lft && rht <= b){
		  s[nxt].EB(l1 + lft - a, l1 + rht - a);
		}
      }
      swap(crt, nxt);
    }
     
    int ans = 0;
    for(auto&& ra: s[crt]){
	  if(ra.SS <= P || Q <= ra.FF) continue;
      int l = max(P, ra.FF);
      int r = min(Q, ra.SS);

	  ans += max(0, r-l);
    }
    cout << ans << endl;
  }
 
  return 0;
}

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

#define ll long long
#define llong long long
#define REP(i,n) for(auto i=0;i<n;++i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define ALL(v) v.begin(),v.end()
#define pb push_back

using namespace std;

int distance(int a, int b, int j){
  int x1 = a % j, y1 = a / j, x2 = b % j, y2 = b / j;
  return abs(x1 - x2) + abs(y1 - y2);
}

int main(){

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

  int ans = 999999999;
  FOR(i,1,101){
    FOR(j,1,101){
      if(i * j < n) continue;
      ans = min(ans, distance(a,b,j) + distance(c,d,j));
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>

using namespace std;

void solve() {
    //greedy algo is not correct!!!
    /*
    int i = 0, pos = 0;
    while (pos < x) {
        ++i;
        pos += i;
    }
    if (pos != x) {
        pos -= 2*i - 1;
        i -= 2;
        i += x - pos - i;
    }
    cout << i;
    */
    long long ans=0, x, l, r;
    cin >> x;
    l = 0; r = 2 * x;
    // ans = min(t | (1 + 2 + ... + t >= x)
    int i=0;
    while (l < r) {
        long long mid = (l + r) / 2;
        if (mid*(mid + 1) >= 2*x) {
            r = mid;
        } else {
            l = mid + 1;
        }
    }
    ans = r;
    cout << ans;
}

int main() {

    solve();
    return 0;
}


Measured memory_bytes: 3136
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i+=1)
#define reps(i,a,b) for(int i=a;i>=b;i-=1)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pi pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define in1(x) int x; cin>>x;
#define in2(x, y) int x, y; cin>>x>>y;
#define in3(x, y, z) int x, y, z; cin>>x>>y>>z;
#define in4(x, y, z, w) int x, y, z, w; cin>>x>>y>>z>>w;
#define mi unordered_map<int,int>
#define mem(x) memset(x, 0, sizeof(x))
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
using namespace std;
bool primes[1000001];vi prime; void seive(); int gcd(int a, int b); int power(int x, int y);

int32_t main(void){
	IOS;
	in3(a, b, c);
	in1(k);
	while(b <= a)
	{
		b*=2;
		k -= 1;
	}
	while(c <= b)
	{
		c *= 2;
		k -= 1;
	}
	if(k < 0) cout<<"No\n";
	else cout<<"Yes\n";
}

void seive(){memset(primes, true, sizeof(primes));primes[0] = primes[1] = false;for(int i = 2; i*i<=1000000;i += 1){
if(primes[i]){for(int j = i*i; j <= 1000000;j += i) primes[j] = false;}}rep(i, 2, 1000001){if(primes[i]) prime.pb(i);}}
int gcd(int a, int b){return b==0 ? a : gcd(b, a%b);}
int power(int x, int y){ int res = 1;x = x % mod; if (x == 0) return 0;
while (y > 0){ if(y & 1) res = (res*x) % mod; y = y>>1; x = (x*x) % mod;} return res;}


Measured memory_bytes: 3640
/******************************************
* AUTHOR : AMAN SAXENA *
* "There's some good in this world, and it's worth fighting for." *
* INSTITUTION : KIET Group of Institutions *
******************************************/
#include <bits/stdc++.h>

const long long MODULO=1000000007;
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define FOR1(i,a,n) for(int i=a;i<=n;i++)
#define FOR2(i,a,n) for(int i=a;i>=n;i--)
#define pb push_back
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pi 3.14159265359

using namespace std;

template <typename TYPE> void in(TYPE &x){cin>>x;}

void solve()
{
    int x, y, f=0;
    cin >> x >> y;
    FOR(i,0,x+1)
    {
        if((i*4 + (x-i)*2) == y)
        {
            f=1;
            break;
        }
    }
    cout << ((f)? "Yes\n": "No\n");
}

void test()
{
    int t;
    cin>>t;
    while(t--) //for(int j=1;j<=t;j++) cout << "Case #" << j << ": ";
    {
        solve();
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    // test();
    solve();
    
    return 0;
}

Measured memory_bytes: 3648
# C - Back and Forth

# 1回目Go上→右、2回目Back下→左、3回目Go左1回→上→右→下1回、4回目Back右1回→下→左→上1回

sx, sy, tx, ty = map(int, input().split())

route = ""

route += "U"*(ty-sy) + "R"*(tx-sx) 
route += "D"*(ty-sy) + "L"*(tx-sx)
route += "L" + "U"*(ty-sy+1) + "R"*(tx-sx+1) + "D"
route += "R" + "D"*(ty-sy+1) + "L"*(tx-sx+1) + "U"

print(route)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;
int K;
int dfs(int k, int n, string s) {
    //cout << k << " " << s << endl;

    if ((int)s.size() == n) {
        if (k == K) {
            cout << s << endl;
        }
        k++;
        return k;
    }
    if ((int)s.size() == 0) {
        for (int i = 1; i < 10; i++) {
            string ns = s;
            ns.push_back((char)(i + '0'));
            k = dfs(k, n, ns);
        }
    } else {
        for (int i = 0; i < 10; i++) {
            if (abs((int)(s.back() - '0') - i) <= 1) {
                string ns = s;
                ns.push_back((char)(i + '0'));
                k = dfs(k, n, ns);
            }
        }
    }
    return k;
}

int main() {
    cin >> K;
    int k = 1;
    int n = 1;
    while (k <= K) {
        k = dfs(k, n, "");
        n++;
    }
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>

using namespace std;

int n = 0;
int s = 0;
static int ans;

void check(int atai, int num, int count){
	if (num > 9) {
		if (atai == s && count == n) {
			ans++;
		}
		return;
	}
	check(atai + num, num + 1, count + 1);
	check(atai, num + 1, count);
}


int main(int argc, char **argv)
{
	while (cin >> n >> s) {
		ans = 0;
		if (n == 0 && s == 0) {
			break;
		}
		check(0, 0, 0);
		cout << ans << endl;
	}
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())
#define all(a) (a).begin(), (a).end()

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//print
#define pv(val) cerr << #val << '=' << (val) << endl

const int INF = 1e9;

int main(void){

	int a; cin >> a;
	int ans = a + a*a + a*a*a;
	cout << ans << endl;


	return 0;

}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> a(n), b(n), c(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) cin >> c[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    auto ar = lower_bound(a.begin(), a.end(), b[i]);
    auto cl = upper_bound(c.begin(), c.end(), b[i]);
    ans += (ll) (ar - a.begin()) * (c.end() - cl);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
/*package whatever //do not write package name here */

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s = 0;
		int[] b = new int[n - 1];
		for(int i = 0;i < n - 1;i++)
		{
		    b[i] = sc.nextInt();
		    if(i == 0)
		    s += b[0];
		    if(i > 0)
		    {
		        if(b[i] < b[i - 1])
		        b[i - 1] = b[i];
		    }
		}
		for(int i = 0;i < n - 1;i++)
		s += b[i];
		System.out.println(s);
	}
}

Measured memory_bytes: 22100
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
z = 0
while a[z] < 0:
    z += 1
am = a[:z]
ap = a[z:]

if k <= len(am)*len(ap):
    ap = ap[::-1]
    a = -(10**18)-10
    b = 1000
    while True:
        if b-a <= 1:
            break
        m = (a+b)//2
        count = 0
        r = 0
        while r+1 < len(am) and ap[0]*am[r] <= m:
            r += 1
        for i in range(len(ap)):
            while r > 0 and ap[i]*am[r] > m:
                r -= 1
            if ap[i]*am[r] <= m:
                count += r+1
            else:
                count += r
        if count < k:
            a = m
        else:
            b = m
    print(b)
else:
    k -= len(am)*len(ap)
    am = list(map(lambda x: -x, am[::-1]))
    a = -1000
    b = 10**18+10
    while True:
        if b-a <= 1:
            break
        m = (a+b)//2
        count = 0
        r = len(ap)-1
        for i in range(len(ap)):
            while r > 0 and ap[i]*ap[r] > m:
                r -= 1
            if ap[i]*ap[r] <= m:
                if i <= r:
                    count -= 1
                count += r+1
            else:
                if i < r:
                    count -= 1
                count += r
        r = len(am)-1
        for i in range(len(am)):
            while r > 0 and am[i]*am[r] > m:
                r -= 1
            if am[i]*am[r] <= m:
                if i <= r:
                    count -= 1
                count += r+1
            else:
                if i < r:
                    count -= 1
                count += r
        if count//2 < k:
            a = m
        else:
            b = m
    print(b)

Measured memory_bytes: 98516
<?php
  list($a, $b, $x) = explode(" ", trim(fgets(STDIN)));

  // 半分以下
  if ($x * 2 <= $b * $a * $a){
    echo rad2deg(atan($b / ((2*$x) / ($b*$a))));
  }
  // 半分より多い
  else{
    $p = (($a * $b) - ($x / $a)) * (2 / $a);
    $tan = $p / $a;
    echo sprintf("%f", rad2deg(atan($tan) )) . PHP_EOL;
  }

Measured memory_bytes: 4604
// BFS

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REPS(i,n) for(int i=1;i<=(int)(n);i++)
using namespace std;
using ll = long long;
using ld = long double;

int P[8], Q[8];
int a, b;

int cnt = 0;
vector<int> permutation;
void dfs(int depth, const int N) {
    if (depth == N) {
        cnt++;
        bool flg_P = true, flg_Q = true;
        REP (i, N) {
            if (permutation.at(i) != P[i]) {
                flg_P = false;
            }
            if (permutation.at(i) != Q[i]) {
                flg_Q = false;
            }
        }
        if (flg_P) {
            a = cnt;
        }
        if (flg_Q) {
            b = cnt;
        }
    }
    else {
        REP (i, N) {
            bool ok = true;
            if (depth) {
                for (int j = 0; j < depth; j++) {
                    if (i == permutation.at(j)) {
                        ok = false;
                    }
                }
            }
            if (ok) {
                permutation.push_back(i);
                dfs(depth+1, N);
            }
        }
    }
    permutation.pop_back();
}

int main(void) {
    int N;
    cin >> N;
    REP (i, N) {
        cin >> P[i];
        P[i]--;
    }
    REP (i, N) {
        cin >> Q[i];
        Q[i]--;
    }

    dfs(0, N);
    int ans = abs(a-b);
    cout << ans << endl;
}

Measured memory_bytes: 256
require 'prime'
# 約数リスト
def divisors(n)
  n.prime_division.inject([1]) do |array, (k, v)|
    (0..v).map{ |i| k ** i }.product(array).map{ |a, b| a * b }
  end.sort
end

n = gets.to_i

list_1 = divisors(n - 1).select { |d| d > 1 }
list_2 = []
divisors(n).select { |d| d > 1 }.each do |divisor|
  num = n
  loop do
    div, mod = num.divmod(divisor)
    if mod == 0
      num = div
    else
      num -= divisor * div
    end
    break if div == 0
  end
  list_2 << divisor if num == 1
end
puts (list_1 + list_2).uniq.size


Measured memory_bytes: 2556
fun main(args:Array<String>) {

    // 空白区切りの数字を順に配列にする
    val list = readLine()!!.split(" ").map(String::toInt)
    val n = list[0]
    val d = list[1]
    val length = (2 * d + 1)
    val add = if(n % length == 0) 0 else 1 
    println((n / length + add).toString())

}


Measured memory_bytes: 37748
#include<stdio.h>
int main(void)
{
	int H, W, i, n;
	while (1)
	{
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0)break;
		for (i = 0; i < H; i++)
		{
			for (n = 0; n < W; n++)
			{
				if ((i+n)%2 == 0)
				{
					printf("#");
				}
				else
				{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1004
import heapq
N, M = map(int, input().split())
job = [[] for _ in range(M+1)]
q = []
for i in range(N):
  a, b = map(int, input().split())
  if(a <= M):
    job[a].append(b)
  
ans = 0
for day in range(M+1):
  for value in job[day]:
    heapq.heappush(q, value*(-1))
  if(len(q) > 0):
    ans += heapq.heappop(q)*(-1)
  
print(ans)

Measured memory_bytes: 18412
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N-1)]

anss = []
for i in range(N-1):
    now = 0
    for c,s,f in src[i:]:
        if now < s: now = s
        now += (f-(now%f))%f + c
    anss.append(now)
anss.append(0)
print(*anss, sep='\n')


Measured memory_bytes: 3188
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long (i) = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

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

  ll n,k;
  std::cin>>n>>k;

  std::vector<long double> sum(1010,0);

  rep(i,1,1010)sum[i]=sum[i-1]+i;

  std::vector<ll> p(n);
  rep(i,0,n)std::cin>>p[i];

  long double ans=0,temp=0;

  rep(i,0,k)temp+=sum[p[i]]/p[i];
  ans=temp;

  rep(i,k,n){
    temp+=sum[p[i]]/p[i];
    temp-=sum[p[i-k]]/p[i-k];
    chmax(ans,temp);
  }

  std::cout<<std::setprecision(10)<<std::fixed<<ans<<"\n";

  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    int k;
    cin>>k;

    vi gs;
    rep(i, k) rep(j, k) gs.push_back(__gcd(i + 1, j + 1));
    ll ans = 0;
    for (auto g : gs) rep(i, k) {
        ans += __gcd(g, i + 1);
    }
    cout<<ans<<endl;
}

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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using Pint = pair<int, int>;
const ll mod = 1e9+7;

int dp[(int)1e3+1][(int)1e4+1];


int main(int argc, char const* argv[])
{
  int h, n;
  cin>>h>>n;

  REP(i,h+1) dp[0][i] = INT_MAX - (int)1e4 - 1;
  dp[0][0] = 0;

  REP1(i,n+1) {
    int a, b;
    cin>>a>>b;
    REP(j,h+1) {
      // dp[i][j] = INT_MAX - (int)1e4 - 1; // 参照し直すことがないのでいらない
      int ja = j-a >= 0 ? j-a : 0;
      dp[i][j] = min(dp[i-1][j], dp[i][ja]+b);
    }
  }

  cout << dp[n][h] << endl;

  return 0;
}

Measured memory_bytes: 39296
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll gcd(ll x,ll y){
    if(!y)
        return x;
    return gcd(y,x%y);
}
ll n,m;
int main()
{
   // freopen("light.in","r",stdin);
   // freopen("light.out","w",stdout);
    scanf("%lld%lld",&n,&m);
    ll k=n-gcd(n,m);
    printf("%lld\n",k*3);
}

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

using namespace std;

#define N 10010

int A[N][N];
int B[N];
int C[N];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++)
			scanf("%d", &A[i][j]);
	for(int i = 0; i < m; i++)
		scanf("%d", &B[i]);
	
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++)
			C[i] += A[i][j] * B[j];
		
	for(int i = 0; i < n; i++)
		printf("%d\n", C[i]);
	
	return 0;
}


Measured memory_bytes: 3644
# encoding:utf-8
import copy
import numpy as np
import random

a,b = map(int,input().split())
# 1digit
def function(n):
    if n==0 or n==1:
        return n
    else:
        if n%4==0:
            return n
        elif n%4==1:
            return 1
        elif n%4==2:
            return n+1
        else:
            return 0

if a==0:
    print(function(b))
    exit()

else:
    print(function(a-1)^function(b))





'''
# F(0,n)を求める
def F(n):
    if n==0:
        tmp_ans = 0
    else:
        true_count = (n+1)//2
        if (n+1)%2==0:
            if true_count%2==0:
                tmp_ans = 0
            else:
                tmp_ans = 1
        else:
            if true_count%2==0:
                tmp_ans = n
            else:
                if n%2==0:
                    tmp_ans = n+1
                else:
                    tmp_ans = n-1

    return tmp_ans

max_digit = 0
num = b
while num > 0:
    max_digit += 1
    num = num//2

a_digits= []
b_digits = []
digits = []

A = F(a-1)
B = F(b)
# print(A,B)
for i in range(max_digit):
    a_digits.append(A%2)
    b_digits.append(B%2)
    A = A//2
    B = B//2

for i in range(max_digit):
    if (a_digits[i] == 1 and b_digits[i] == 1) or (a_digits[i] == 0 and b_digits[i]==0):
        digits.append(0)
    else:
        digits.append(1)

ans = 0
for i in range(max_digit):
    ans += digits[i]*2**i

print(ans)
'''
'''
if a == b:
    print(a)
    exit()

def xor_0(a,b):
    if((b-a+1)//2)%2 == 0:
        if (b-a+1)%2==0:
            digit = 0
        else:
            if a%2==0:
                # 0 xor 0
                digit = 1
            else:
                # 1 xor 1
                digit = 1
    else:
        if (b-a+1)%2==0:
            digit = 1
        else:
            if a%2==0:
                # 0 xor 0
                digit = 1
            else:
                # 0 xor 1
                digit = 0

    return digit

max_digit = 0
num = b
while num > 0:
    max_digit += 1
    num = num//2

def digit_xor(a,b,i):
    if i == 0:
        return xor_0(a,b)
    else:
        count = 0
        posi_a = a%(2**(i+1))
        if posi_a>2**i:
            count += 2**i-a+1
        elif posi_a==0:
            pass
        else:
            count += 2**i

        posi_b = b%(2**(i+1))
        if posi_b > 2**i:
            count += 2**i
        else:
            count += posi_b

    if count%2==0:
        return 0
    else:
        return 1


digits = []
for i in range(max_digit):
    digits.append(digit_xor(a,b,i))

ans = 0
print(digits)
for i in range(len(digits)):
    ans += digits[i]*2**i

print(ans)
'''


Measured memory_bytes: 13388
n,p=map(int,input().split())
a=list(map(int,input().split()))
z=o=0
for i in a:
  if i&1:o+=1
  else:z+=1
if o==0:
  if p==1:print(0)
  else:print(2**n)
else:print(2**(n-1))

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


N=int(input())
data=[]
for i in range(N):
    text = input()
    data.append((int(text.split()[0]), int(text.split()[1])))

data = sorted(data, key=lambda x: x[0])
data = sorted(data, key=lambda x: x[1])


imakonojikan=0

for i in range(len(data)):
    imakonojikan+=data[i][0]
    if data[i][1]<imakonojikan :
        print('No')
        exit(0)

print('Yes')


exit(0)


Measured memory_bytes: 33392
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define pb push_back
#define MOD 1000000007
#define INF 1000000000
#define EPS 0.0000000001
typedef long long ll;

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

    
    int a,b;
    cin>>a>>b;
    int x=1;
    int count=0;
    for(int i=0;i<1000000;i++){
        if(x<b){
            x--;
            x+=a;
            count++;
        }
        else{
            break;
        }
    }
    cout<<count<<endl;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> l(n);
	rep(i,n) cin >> l[i];
	if (n < 3) cout << 0 << endl;
	int cnt = 0;
	rep(i,n) {
		for (int j = i; j < n;j++) {
			if (l[j] == l[i]) continue;
			for (int k = j; k < n; k++) {
				if (l[k] == l[i] || l[k] == l[j]) continue;
				int lmax = max(max(l[i],l[j]),l[k]);
				int lmin = min(min(l[i],l[j]),l[k]);
				int l2nd;
				if (l[i] != lmax && l[i] != lmin) l2nd = l[i];
				if (l[j] != lmax && l[j] != lmin) l2nd = l[j];
				if (l[k] != lmax && l[k] != lmin) l2nd = l[k];
				if (lmax < lmin + l2nd) cnt++;
			}
		}
	}
	if (n >= 3) cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 3628
def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    x = [0] * n
    x0 = 0
    for i in range(n):
        if i % 2 == 0:
            x0 += a[i]
        else:
            x0 -= a[i]
    x0 = x0
    x[0] = x0
    for i in range(n-1):
        x[i+1] = 2 * a[i] - x[i]
    print(' '.join([str(a) for a in x]))


main()


Measured memory_bytes: 19140
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

list_a = [a, b, c, d, e]
list_b = [a, b, c, d, e]
exist = False
for i in list_a:
    for j in list_b:
        if abs(i - j) > k:
            exist = True
if exist:
    print(":(")
else:
    print("Yay!")

Measured memory_bytes: 3064
<?php

# B - Guidebook

fscanf(STDIN, "%d", $N);

$array = [];
for ( $i = 0 ; $i < $N ; $i++ ) {
    fscanf(STDIN, "%s %d", $S, $P);
    $array[] = ['city' => $S, 'score' => $P];
    $sort_array[] = ['city' => $S, 'score' => $P];
}

foreach ($sort_array as $key => $value) {
    $city[$key] = $value['city'];
    $score[$key] = $value['score'];
}
array_multisort($city, SORT_ASC, $score, SORT_DESC, $sort_array);

foreach ($sort_array as $key => $value) {
    for ( $i = 0 ; $i < 100 ; $i++ ) {
        if ($array[$i]['city'] == $value['city'] && $array[$i]['score'] == $value['score']) {
            echo ($i + 1) . PHP_EOL;
        }
    }
}


Measured memory_bytes: 4728
#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;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
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;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long K){
  const ll x[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout<<x[K-1]<<endl;
  return;
}

int main(){
  cout<<setprecision(1000);
    long long K;
    scanf("%lld",&K);
    solve(K);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
char s[32];
int len,tong[32];
long long answer;
void charge(int dep,long long num,int cnt) {
	if(dep==len) {
		long long ans=num;
	//	printf("%d ",num);
		for(int i=cnt;i>=1;--i) {
			ans+=tong[i];
		//	printf("%d ",tong[i]);
		}
		//printf("\n");
		answer+=ans;
		return ;
	}
	tong[cnt+1]=num;
	charge(dep+1,s[dep]-'0',cnt+1);
	tong[cnt+1]=0;
	charge(dep+1,num*10+s[dep]-'0',cnt);
}
int main() {
	scanf("%s",s);
	len=strlen(s);
	answer=0;
	charge(0,0,0);
	printf("%lld\n",answer/2);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
map<int,int> blo;
int A[100005];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a;
		cin>>a;
		blo[a] = 1;
	}
	A[0] = 1;
	for(int i=1;i<=n;i++)
	{
		if(!blo[i-1])
		{
			A[i] += A[i-1];
		}
		if(i-2>=0&&!blo[i-2])
			A[i] += A[i-2];
		A[i] = A[i]%(1000000007);
	}
	cout<<A[n]<<endl;
	return 0;
}

Measured memory_bytes: 6912
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

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

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll x, y; cin  >> x >> y;
    cout << x + y +2 - (gcd(x,y)+1) << endl;
    return 0;
}

Measured memory_bytes: 3160
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    string s;
    cin >> s;

    ll a_index = 0;
    FOR(i, 0, s.size()){
        if(s[i] == 'A'){
            a_index = i;
            break;
        }
    }

    ll z_index = 0;
    for(int i=s.size()-1; i>=0; i--){
        if(s[i]=='Z'){
            z_index = i;
            break;
        }
    }

    p(z_index - a_index + 1);

    return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n,k,ans=0;
    cin >> n>>k;
    vector<int> l(n);
    
    for(int i = 0; i < n; i++)
    {
        cin>>l[i];
    }
    sort(all(l));
    reverse(all(l));
    
    for(int i = 0; i < k; i++)
    {
        ans+=l[i];
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
"use strict";

const Main = args => {
  const input = args.trim().split("\n").map(e => e.split(""));
  let S = { a: input[0], b: input[1], c: input[2] };
  let current = 'a';
  let winner = '';

  while (true) {
    if (S[current].length === 0) {
      winner = current;
      break;
    }
    let next = S[current][0];
    S[current].shift();
    current = next;
  }
  console.log(winner.toUpperCase());
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
package main

import "fmt"

func main() {
	var A, B, C int
	fmt.Scanf("%d%d%d", &A, &B, &C)
	//fmt.Println(A,B,C,)
	if (C >= A) && (C <= B) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}



Measured memory_bytes: 512