akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

void out(){cout << "\n";}
template<class T,class... Args>
void out(const T &x,const Args &... args){
	cout << x << " ";
	out(args...);
}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll x;
	cin >> x;
	ll ans=x/11*2;
	if(x%11>6) ans+=2;
	else if(x%11>0) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String a = "#";
		while (true) {
			Integer h = sc.nextInt();
			Integer w = sc.nextInt();
			
			if(h == 0 && w == 0) {
				return;
			}
			
			for(Integer i = 0; i < w; i++) {
				System.out.print(a);
			}
			System.out.println();
			
			for(Integer i = 0; i < h-2; i++) {
				System.out.print(a);
				for (Integer j = 0;j < w-2;j++) {
					System.out.print(".");
					
				}
				
				System.out.print(a);
				System.out.println();
			}
			
			
			
			for(Integer i = 0; i < w; i++) {
				System.out.print(a);
			}
			System.out.println();
			System.out.println();
				
		}
		

	}
}


Measured memory_bytes: 36676
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

vi v;

int parity(int n, int r, int k) {
	if(n == 0 || n == 1) return 1;
	if(n < v[k-1]) {
		return parity(n, r, k-1);
	}
	else if(r < n+1-v[k-1]) {
		return parity(n-v[k-1], r, k-1);
	}
	else if(r > v[k-1]-1) {
		return parity(n-v[k-1], r-v[k-1], k-1);
	}
	else {
		return 0;
	}
}

int main() {
//	cout << fixed << setprecision(15);
	int n;
	string s;
	cin >> n >> s;

	if(n == 1) { cout << s << endl; return 0; }

	int b = 1;
	rep(i, 21) { v.push_back(b); b *= 2; }

	bool has2 = false;
	rep(i, n) if(s[i] == '2') {has2 = true; break; }

	char c;
	if(has2) c = '2';
	else c = '3';

	int ans = 0;
	rep(i, n) if(s[i] == c) ans += parity(n-1, i, 20);
	ans %= 2;
	if(!has2) ans *= 2;
	cout << ans << endl;
}


Measured memory_bytes: 1412
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);;

    public static void main(String[] args) {
        int K = sc.nextInt();
        int N = sc.nextInt();
        int A1 = sc.nextInt();
        int prev = A1;
        int gap = 0;
        for (int i = 1; i < N; i++) {
            int A = sc.nextInt();
            if (gap < A - prev) {
                gap = A - prev;
            }
            prev = A;
        }
        if (gap < (A1 - prev + K) % K) {
            gap = (A1 - prev + K) % K;
        }
        System.out.println(K - gap);
    }
}


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

int main(){

  int x;
  cin>>x;
  int h = x / 3600;
  int m = (x / 60) % 60;
  int s = x % 60;
  cout<<h<<":"<<m<<":"<<s<<endl;

  return 0;
}


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>
using namespace std;

int main(void) {
	int a, b;
	cin >> a >> b;
	if ((a * b) % 2 == 0)
		cout << "Even" << endl;
	else
		cout << "Odd" << endl;



	return 0;
}

Measured memory_bytes: 256
def ABC_52_B():
    N = int(input())
    S = input()
    xl=[]
    x=0

    for i in range(N):
        if S[i] == 'I':
            x+=1
        else:
            x-=1

        xl.append(x)
    
    if max(xl)>=0:
        print(max(xl))
    else:
        print(0)

if __name__ == '__main__':

    ABC_52_B()

Measured memory_bytes: 3064
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;$n:expr) => {
        (0..$n).map(|_| scan!()).collect::<Vec<_>>()
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (_, t) = scan!(i64, i64);
    let vs = scan!(i64;;);
    let mut ans = 0;
    for (cur, &next) in vs.iter().zip(vs[1..].iter()) {
        if cur + t - 1 < next {
            ans += t;
        } else {
            ans += next - cur
        }
    }
    ans += t;
    println!("{}", ans);
}


Measured memory_bytes: 10492
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define mod 998244353
#define xx first
#define yy second
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define maxn 500005



using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());


int dppref[maxn];
int dpsuff[maxn];
int noviniz[maxn];
int niz[maxn];

int n,k,c;
int seg[4 * maxn];
void init(int node, int l, int r){
    if(l == r){
        seg[node] = noviniz[l];
        return;
    }
    int mid = (l + r) / 2;
    init(node * 2, l, mid);
    init(node * 2 + 1, mid + 1, r);
    seg[node] = max(seg[node * 2], seg[node * 2 + 1]);
}

int query(int node, int l, int r, int levo, int desno){
    if(r < levo || l > desno)return 0;
    if(l >= levo && r <= desno)return seg[node];
    int mid = (l + r) / 2;
    return max(query(node * 2, l, mid, levo, desno), query(node * 2 + 1, mid + 1, r, levo, desno));
}


int main()
{

    ios_base::sync_with_stdio(false); cin.tie(0);
    int brgud = 0;
    cin >> n >> k >> c;
    c++;
    string x;
    cin >> x;
    ff(i,1,n){
        if(x[i - 1] == 'o'){niz[i] = 1; brgud++;}
        else niz[i] = 0;
    }
    dppref[0] = 0;
    ff(i,1,n){
        dppref[i] = dppref[i - 1];
        if(niz[i] == 1){
            if(i > c)dppref[i] = max(dppref[i], dppref[i - c] + 1);
            else dppref[i] = max(dppref[i], 1);
        }
    }
    dpsuff[n + 1] = 0;
    fb(i,n,0){
        dpsuff[i] = dpsuff[i + 1];
        if(niz[i] == 1){
            dpsuff[i] = max(dpsuff[i], 1 + dpsuff[i + c]);
        }
    }
    ff(i,1,n){
        noviniz[i] = dppref[i] + dpsuff[i + c];
    }
    int sta = dppref[n];
    if(sta < k){
        return 0;
    }
    init(1,1,n);
    ff(i,1,n){
        if(niz[i] == 0)continue;
        int levi = max(i - c + 1, 1);
        int desni = i-1;
        int maks = max(dpsuff[i + 1], dppref[i - 1]);
        if(c <= 2)maks = max(maks, dpsuff[i+1]+dppref[i-1]);
        if(levi <= desni)maks = max(maks, query(1,1,n,levi,desni));
        if(maks < k){
            int pre = max(i-c, 0);
            int posle = i+c;
            if(dppref[pre] + dpsuff[posle] + 1 >= k)cout << i << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 14228
import sys
input = sys.stdin.readline

H, N = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
mx = max([a for a,b in ab])
dp = [[float('inf')]*(H+1+mx) for _ in range(N+1)]
# i番目までの魔法を使った時にモンスターの体力をj減らすするのに必要な魔力の最少値
dp[0][0] = 0

for i in range(N):
  a, b = ab[i]
  for j in range(H+1+mx):
    if j - a >= 0:
      dp[i+1][j] = min(dp[i+1][j-a]+b, dp[i][j])
    else:
      dp[i+1][j] = dp[i][j]

ans = float('inf')
for i in range(H, H+mx+1):
  ans = min(ans, dp[N][i])
print(ans)


Measured memory_bytes: 314376
#include <bits/stdc++.h> 
using namespace std; 
typedef   long long int ll;
int main() 
{   
     ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
    ll n,k,ans=-1;cin>>n;
    string s[n];
    
    map<string,ll>m;
    for (ll i=0;i<n;i++) {
        cin>>s[i];
        m[s[i]]++;
    }
    sort(s,s+n);
    for (ll i=0;i<n;i++) {
        k=m[s[i]];
        ans=max(k,ans);
    }
    for (ll i=0;i<n;i++) {
        if (m[s[i]]==ans) {
            cout<<s[i]<<endl;
            m[s[i]]=-1;
        }
    }
    
   }


Measured memory_bytes: 25728
#include <bits/stdc++.h>
typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;
int main(void)
{
    string s;
    cin >> s;
    int len = s.length();
    rep(i, 0, len)
    {
        if (i % 2 == 0 && (s[i] == 'R' || s[i] == 'U' || s[i] == 'D'))
            continue;
        else if (i % 2 == 1 && (s[i] == 'L' || s[i] == 'U' || s[i] == 'D'))
            continue;
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3560
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,m;
    cin >> n >> m;
    vl a(n);
    vl cnt(n);
    rep(i,n){
        cin >> a[i];
        while(a[i]%2==0){
            a[i]/=2;
            cnt[i]++;
        }
    }
    sort(cnt.begin(),cnt.end());
    if(cnt[0]!=cnt[n-1]){
        cout << 0 << endl;
        return 0;
    }
    ll res=1;
    rep(i,n){
        res=lcm(res,a[i]);
        if(res>m){
            cout << 0 << endl;
            return 0;
        }
    }
    m+=res*pow(2,cnt[0]-1);
    cout << m/((ll)(pow(2,cnt[0])*res)) << endl;
}

Measured memory_bytes: 5144
import numpy as np
n, k = map(int, input().split())
h = list(map(int, input().split()))
h = np.array(h)
dp =np.zeros(n, dtype='int64')
dp[0] = 0
for i in range(1,n):
    lo = max(i-k,0)
    dp[i] = np.min(dp[lo:i]+np.abs(h[i]-h[lo:i]))
print(dp[n-1])


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

#define double long double
#define int long long
#define vec vector
#define pb push_back
#define unset unordered_set
#define ii pair<int, int>
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first,l.second+r.second};
} 
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

inline int Pow(int a, int k) {
  int s = 1; 
  for(; k; k >>= 1) {
    k & 1 ? s = 1LL * s * a % MOD : 0;
    a = 1LL * a * a % MOD;
  }
  return s;
}

const int N = 1e6 + 7;

void input() {
  //freopen("??.in", "r", stdin);
  //freopen("??.out", "w", stdout);
}

void preprocess() {
}

void debug() {
  //  44gg
  if (true) {
  
  }
}

int dp[N];

void solve() {
  preprocess();
  // 50gg
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  FOR(i, 1, n) {
    dp[i] = dp[i - 1];
    if (s[i] == 'C' and s[i - 1] == 'A') {
      dp[i]++;
    }
  }
  FOR(i, 0, q) {
    int L, R;
    cin >> L >> R;
    L--; R--;
    cout << dp[R] - dp[L] << endl;
  }
  //debug();
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

void output() {

}

#undef int
int main() {
#define int long long
	ios_base::sync_with_stdio(false);
	cin.tie();
  //auto beginProgram = chrono::steady_clock::now();

  //int t; cin >> t;
  //while (t--) 
  {
    input();
    solve();
    output();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}


Measured memory_bytes: 1872
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    long double a, b, h, m;
    cin >> a >> b >> h >> m;
    
    long double rad = M_PI * 2 * (h/12 + m/60/12 - m/60);

    long double rsq = (a*a + b*b) - (2*a*b*cosl(rad));

    cerr << rad << " " << rsq << endl;
    
    cout << setprecision(20) << sqrtl(rsq) << endl;
    

    return 0;
}

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

void print(int A[], int N, int cnt) {
    for (int i = 0; i < N; i++) {
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;
    return;
}

void bubbleSort(int A[], int N) {
    int flag = 1, cnt = 0;
    while (flag) {
        flag = 0;
        for (int i = N - 1; i > 0; i--) {
            if (A[i] < A[i - 1]) {
                int tmp = A[i];
                A[i] = A[i - 1];
                A[i - 1] = tmp;
                cnt++;
                flag = 1;
            }
        }
    }
    print(A, N, cnt);
    return;
}

int main() {
    int N, A[110];
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    bubbleSort(A, N);
}


Measured memory_bytes: 3120
import sys

N=int(input())
S=list(map(int,input().split()))
S.sort(reverse=True)
flag=[0]*2**N
flag[0]=1
for _ in range(N):
    h=flag[:]
    child=1
    for parent in range(2**N):
        if flag[parent]==0:
            continue
        while child<2**N:
            if flag[child]==0 and S[parent]>S[child]:
                h[child]=1
                child+=1
                break
            child+=1
    flag=h
for i in flag:
    if i==0:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 120136
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N,M = input_int()

data = []
for i in range(M):
    s,c = input_int()
    data.append([s,c])

def solve(N, data):
    mins = 100000000000
    for i in range(10**N):

        temp = str(i)
        flg = True
        if len(temp)==N:
            for d in data:
                if temp[d[0]-1] != str(d[1]):
                    flg = False
                    break
            if flg==True:
                return temp
    return -1

output = solve(N,data)
print(output)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(i, n) a[idx][i] = v[i]; idx++; PER = a;} while(next_permutation(ALL(v)));} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  LL h;
  cin >> h;
  LL ex = 0;
  while(true)
  {
    if (pow(2, ex) <= h && h <  pow(2, ex+1)) break;
    ex++;
  }
  LL ans = 0;
  REP(i, ex+1) ans += pow(2, i);
  cout << ans;

  return 0;
}


Measured memory_bytes: 256
import itertools
n = int(input())
p = int(input().replace(" ", ""))
q = int(input().replace(" ", ""))
li = []
num = [i + 1 for i in range(n)]
for i in itertools.permutations(num, n):
    s = ""
    for c in i:
        s += str(c)
    li.append(int(s))
print(abs(li.index(p) - li.index(q)))

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

using namespace std;

using lint = long long;

#define MOD_NUMBER 1000000007

template <class T> void vector_print(vector<T> vec) {
  for (unsigned int i = 0; i < vec.size(); i++) {
    cout << vec.at(i);
    if (i < vec.size()-1) {
      cout << " ";
    } else if (i == vec.size()-1) {
      cout << endl;
    }
  }
}

int main() {
  lint n, cnt = 0;
  cin >> n;
  vector<string> S(n);
  for (int i = 0; i < n; i++) {
    cin >> S[i];
  }
  sort(S.begin(), S.end());
  for (int i = 0; i < n-1; i++) {
    if (S[i] == S[i+1]) cnt++;
  }
  cout << S.size()-cnt << endl;
  return 0;
}


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

std::string S = { "abcdefghijklmnopqrstuvwxyz" };

int main() {

	std::string s;
	std::cin >> s;

	for (int i = 0; i < S.size(); ++i) if (S[i] == s[0]) std::cout << S[i + 1] << std::endl;

	return 0;
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int gcd(int a, int b){if (b == 0) return a; return gcd(b, a % b);}
int n;
vi a;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n;
    a.resize(n);
    vi cs1(n+1);
    vi cs2(n+1);
    int ans = 0;
    REP(i,n) cin>>a[i];

    FOR(i,0,n){
        cs1[i+1] =          gcd(cs1[i], a[i]);
        cs2[((n-1)-i)] =    gcd(cs2[(n-1)-i+1], a[(n-1)-i]);
    }

    //DEBUG_VEC(cs1);
    //DEBUG_VEC(cs2);

    REP(i,n){
        int tmp = gcd(cs1[i], cs2[i+1]);
        //DEBUG(tmp);
        if(ans < tmp){
            ans = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
x, n = map(int, input().split())

if n == 0:
    print(x)
    exit()

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

for i in range(100):
    if x-i not in p:
        print(x-i)
        exit()
    elif x+i not in p:
        print(x+i)
        exit()

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

using namespace std;

int n, cnt[100005], ar[100005], ans, two;

int main()
{
    scanf("%d", &n);
    for(int i=1;i<=n;i++)scanf("%d", ar+i), cnt[ar[i]]++;
    for(int i=1;i<=1e5;i++){
        if(cnt[i]<=1)continue;
        if(cnt[i]==2){
            two++;
            continue;
        }
        else{
            if(cnt[i]%2==0){
                ans+=cnt[i]/2-1;
                two++;
            }
            else{
                ans+=cnt[i]/2;
            }
        }
    }
    ans += (two+1)/2;
    printf("%d", n-2*ans);
    return 0;
}


Measured memory_bytes: 1024
using System;
using System.Text.RegularExpressions;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine(); //標準入力
            //string str = "5 5";
            string[] str2 = str.Split(' ');
            int a = int.Parse(str2[0]);
            int b = int.Parse(str2[1]);

            int count = -1;

            count += a;
            if (a<=b)
            {
                count++;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

int main() {
    ll n;
    string s;
    cin >> n >> s;

    vvl dp(n, vl(n+1));  // dp[i][j] : s[i]とs[j]からはじめたとき共通する連続部分列の長さの最大値
    for(ll i = n-2; i >= 0; i--) {
        for(ll j = n-1; i < j; j--) {
            if(s[i] == s[j]) {
                dp[i][j] = dp[i+1][j+1] + 1;
            }
        }
    }

    ll ans = 0;
    rep(i, n) {
        exrep(j, i+1, n-1) {
            chmax(ans, min(j-i, dp[i][j]));
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 198760
abc = [int(input()) for x in range(3)]
x = int(input())
cnt = 0
for i in range(abc[0]+1):
    for j in range(abc[1]+1):
        for k in range(abc[2]+1):
            func = 500*i+100*j+50*k
            if func == x : cnt += 1
            else: continue
print(cnt)

Measured memory_bytes: 3060
object Main {

  import java.util.Scanner

  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val writer = new java.io.PrintWriter(System.out)
    writer.println(solve(sc))
    writer.flush()
  }

  def solve(sc: Scanner): String = {
    val (n, m) = (sc.nextInt(), sc.nextInt())
    val gates = IndexedSeq.fill(m)((sc.nextInt(), sc.nextInt()))
    debug(n, m, gates)

    val leftMax = gates.map { case (l, _) => l }.max
    val rightMin = gates.map { case (_, r) => r }.min
    (if (leftMax > rightMin) 0 else rightMin - leftMax + 1).toString
  }

  private def debug(x: Any): Unit = {
    if (System.getenv("LOCAL_DEBUG") != null) println(x)
  }
}


Measured memory_bytes: 76624
import sys
sys.setrecursionlimit(10**9)


def input():
    return sys.stdin.readline().rstrip()


def main():
    H, W = map(int, input().split())
    S = [list(input()) for i in range(H)]
    ans = float(0)
    memo_y = [[-float('inf')]*W for i in range(H)]
    memo_x = [[-float('inf')]*W for i in range(H)]
    for y in range(H):
        for x in range(W):
            c = float(0)
            if S[y][x] == '.':
                c += float(1)
                c_x = float(0)
                c_y = float(0)
                tmp_x = [x]
                tmp_y = [y]
                if memo_x[y][x] == -float('inf'):
                    for i in range(1, x+1):
                        if S[y][x-i] == '.':
                            c_x += float(1)
                            tmp_x.append(i)
                        else:
                            break
                    for i in range(x+1, W):
                        if S[y][i] == '.':
                            c_x += float(1)
                            tmp_x.append(i)
                        else:
                            break
                    for i in tmp_x:
                        memo_x[y][i] = c_x
                else:
                    c_x += memo_x[y][x]
                if memo_y[y][x] == -float('inf'):
                    for i in range(1, y+1):
                        if S[y-i][x] == '.':
                            c_y += float(1)
                            tmp_y.append(i)
                        else:
                            break
                    for i in range(y+1, H):
                        if S[i][x] == '.':
                            c_y += float(1)
                            tmp_y.append(i)
                        else:
                            break
                    for i in tmp_y:
                        memo_y[i][x] = c_y
                else:
                    c_y += memo_y[y][x]
                c += c_x + c_y
            ans = max(ans, c)
    print(int(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 251016
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;

int N;
char s[500001];
vector<int> v[500000];
int dp[500000];

signed main()
{
	cin >> N;
	cin >> s;

	int flg = 2;
	int left = 0;
	for (int i = 0; i < N - 1; i++)
	{
		if (flg == 0)
		{
			if (s[i] == '0')
			{
				if (s[i + 1] == '0')
				{
					flg = 2;
				}
				else
				{
					for (; left < i - 1; left++)
					{
						v[i + 1].push_back(left);
					}
					flg = 1;
				}
			}
			else if (s[i] == '1')
			{
				flg = 0;
			}
		}
		else if (flg == 1)
		{
			if (s[i] == '0')
			{
				if (s[i + 1] == '0')
				{
					flg = 2;
				}
				else
				{
					left += 2;
					for (; left < i - 1; left++)
					{
						v[i + 1].push_back(left);
					}
					flg = 1;
				}
			}
			else
			{
				v[i].push_back(left);
			}
		}
		else if (flg == 2)
		{
			if (s[i] == '0')
			{
				flg = 2;
			}
			else
			{
				flg = 0;
				left = i;
			}
		}
	}

	if (flg == 1)
	{
		if (s[N - 1] == '1')
		{
			v[N - 1].push_back(left);
		}
	}

	for (int i = 1; i < N; i++)
	{
		dp[i] = dp[i - 1];
		for (int left : v[i])
		{
			int a = (i - left) - 1;
			int b = left > 0 ? dp[left - 1] : 0;
			dp[i] = MAX(dp[i], a + b);
		}
	}

	cout << dp[N - 1] << endl;
}



Measured memory_bytes: 37248
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        t: f64,
        x: f64,
    }

    println!("{}", t / x);
}


Measured memory_bytes: 4352
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int main(){
 int N;
 int *s;
 scanf("%d\n",&N);
 s = (int *)malloc(sizeof(int) * N);
 for(int i = 0;i < N;i++){
  scanf("%d ",&s[i]);
 }
 int i = 0;
 for(i = N - 1;i>= 0;i -= 2) printf("%d ",s[i]);
 for(int j = abs(i + 1);j < N;j += 2) printf("%d ",s[j]);
 return 0;
}

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

#define pb push_back
#define fi first
#define se second
typedef long long ll;

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

	map<string, int> M;
	M["SAT"] = 1;
	M["FRI"] = 2;
	M["THU"] = 3;
	M["WED"] = 4;
	M["TUE"] = 5;
	M["MON"] = 6;
	M["SUN"] = 7;
	
	string s;
	cin >> s;
	cout << M[s] << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x:v)cerr<<x<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;

long long DPTwelvefoldWay12[1010][1010];
long long TwelvefoldWay12(long long n,long long k,long long MOD){
  if(n < k)return 0;
  n -= k;
  DPTwelvefoldWay12[0][0] = 1;
  for(long long i = 0;i < n+1;i++){
    for(long long j = 1;j < k+1;j++){
      DPTwelvefoldWay12[i][j] = DPTwelvefoldWay12[i][j-1];
      if(i >= j){
        DPTwelvefoldWay12[i][j] += DPTwelvefoldWay12[i-j][j];
        DPTwelvefoldWay12[i][j] %= MOD;
      }
    }
  }
  return DPTwelvefoldWay12[n][k];
}

signed main(){
  ll n,k;
  cin >> n >> k;
  cout << TwelvefoldWay12(n,k,INF) << endl;
}


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



Measured memory_bytes: 2044
#### import ####
import sys
sys.setrecursionlimit(10**7)
import math
from collections import defaultdict

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

S = str(input())
T = str(input())

if len(T)>len(S):
  print('UNRESTORABLE')
  sys.exit()

flag = False
for i in range(len(S)-len(T)+1)[::-1]:
  counter = 0
  for j in range(len(T)):
    if (S[i+j]!='?') and (S[i+j]!=T[j]):
      break
    counter += 1
  if counter == len(T):
    flag = True
    break
  
if flag==False:
  print('UNRESTORABLE')
else:
  S = S[0:i] + T + S[i+len(T):]
  S = S.replace('?', 'a')
  print(S)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define P 1000000007
using namespace std;
typedef long long lnt;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, m, a[17];
lnt f[17][1<<16], tot;
lnt fac[1<<16], inv[1<<16];
void init() {
	fac[0] = inv[0] = inv[1] = 1;
	for (int i = 1; i < (1<<n); i++) fac[i] = fac[i-1]*i%P;
	for (int i = 2; i < (1<<n); i++) inv[i] = P-P/i*inv[P%i]%P;
	for (int i = 1; i < (1<<n); i++) inv[i] = inv[i-1]*inv[i]%P;
}
lnt coe(int s) {return __builtin_popcount(s)&1 ? -1LL : 1LL;}
lnt C(int n, int m) {return n < m ? 0 : fac[n]*inv[m]%P*inv[n-m]%P;}
int main() {
	read(n), read(m), init(), f[0][0] = 1;
	for (int i = 1; i <= m; i++) read(a[i]); sort(a+1, a+m+1, greater <int> ());
	for (int i = 0; i < m; i++) for (int s = 0; s < (1<<n); s++) if (f[i][s]) {
		(f[i+1][s] += f[i][s]) %= P;
		for (int j = 0; j < n; j++) if (!(s>>j&1))
			(f[i+1][s|(1<<j)] += C((1<<n)-s-a[i+1], (1<<j)-1)*f[i][s]%P*fac[1<<j]%P) %= P;
	}
	for (int s = 0; s < (1<<n); s++)
		(tot += coe(s)*f[m][s]*fac[(1<<n)-s-1]%P+P) %= P;
	return printf("%lld\n", tot*(1<<n)%P), 0;
}

Measured memory_bytes: 8960
#include<iostream>

using namespace std;

int main() {
	string s;

	//入力
	cin >> s;

	//,をスペースで置き換える
	for (int i = 0; i < s.length(); i++) {
		if (s[i]==',') {
			s[i] = ' ';
		}
	}

	//出力
	cout << s << endl;
	
}

Measured memory_bytes: 256
/*
  AOJ 2241
  Title:Usaneko Matrix
  @kankichi573
*/
#include <stdio.h>
#include <string.h>

int n,u[2],m,card;
int pos[2][2][1000000];
int tateyoko[2][2][500],naname[2][2];


int calc_winner()
{
  int i,j,k,cnt[2],c,ret;

  cnt[0]=cnt[1]=0;

  for(i=0;i<2;i++)
    for(j=0;j<2;j++)
      {
	for(k=0;k<n;k++)
	  {
	    if(tateyoko[i][j][k]==n)
	      cnt[i]++;
	  }
	if(naname[i][j]==n)
	  cnt[i]++;
      }

  //printf(":c=%d %d\n",cnt[0],cnt[1]);

  if(n==1)
    {
      if(cnt[0]>1)
	cnt[0]=1;
      if(cnt[1]>1)
	cnt[1]=1;
    }

  for(i=ret=0;i<2;i++)
    if(cnt[i]>=u[i])
      ret += (i+1);
  
  return(ret);
}

main()
{
  int i,j,k,ret,y,x,num,result;
  memset(pos,-1,sizeof(pos));

  scanf("%d %d %d %d",&n,&u[0],&u[1],&m);
  for(i=0;i<2;i++)
    for(j=0;j<n;j++)
      for(k=0;k<n;k++)
	{
	  scanf("%d",&num);
	  pos[i][0][num]=j;
	  pos[i][1][num]=k;
	}
  
  result=0; 
  for(i=0;i<m;i++)
    {
      scanf("%d",&card);
      //printf("%d|",card);
      for(j=0;j<2;j++)
	{
	  x=pos[j][0][card];
	  y=pos[j][1][card];

	  //printf("xy=%d %d\n",x,y);
	  
	  if(x>=0 && y>=0)
	    {
	      tateyoko[j][0][x]++;
	      tateyoko[j][1][y]++;
	      if(x==y)
		naname[j][0]++;
	      if(x+y==n-1)
		naname[j][1]++;
	    }
	}
      if(result==0)
	{
	  result=calc_winner();
	}
      
    }
  if(result==1)
    printf("USAGI\n");
  else if(result==2)
    printf("NEKO\n");
  else if(result==3||result==0)
    printf("DRAW\n");
    
  
  return(0);
}

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

using namespace std;

int suji(char n) {
	if (n == '0' || n == '1' || n == '2' || n == '3' || n == '4' || n == '5' || n == '6' ||
		n == '7' || n == '8' || n == '9')
		return 1;
	else
		return 0;
}

int main()
{
	int a, b, i, j;
	string S;
	cin >> a; cin >> b;
	cin >> S;

	for (i = 0; i < a + b + 1; i++) {
		if (suji(S[i])==0) {
			if (i != a) {
				cout << "No" << endl;
				return 0;
			}
		}

		if (i==a) {
			if (S[i] != '-') {
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <cstdlib>
#include <memory>
#include <queue>
#include <cassert>
#include <cmath>
#include <ctime>
#include <complex>
#include <bitset>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <numeric>

using namespace std;

#define ws ws_____________________
#define y1 y1_____________________
#define y0 y0_____________________
#define left left_________________
#define right right_______________
#define next next_________________
#define prev prev_________________
#define hash hash_________________

#define pb push_back
#define fst first
#define snd second
#define mp make_pair 
#define sz(C) ((int) (C).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define ford(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define all(C) begin(C), end(C)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef long double ld;
typedef complex<double> cd;

#ifdef LOCAL
#define eprintf(args...) fprintf(stderr, args), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define FILE_NAME "a"


int n;
vi a;

bool read() {
	if  (scanf("%d", &n) < 1) {
		return 0;
	}
	a.resize(n);
	forn(i, n) {
		scanf("%d", &a[i]);
	}
	return 1;
}



bool solve() {
	vi cnt(3);
	for (int x : a) {
		if  (x % 4 == 0) {
			++cnt[2];
		} else if  (x % 2 == 0) {
			++cnt[1];
		} else {
			++cnt[0];
		}
	}

	if  (cnt[1] == 0) {
		return cnt[0] <= cnt[2] + 1;
	}

	if  (cnt[0] > cnt[2]) {
		return 0;
	}
	return 1;
}

int main() {
#ifdef LOCAL
	freopen(FILE_NAME ".in", "r", stdin);
	// freopen(FILE_NAME ".out", "w", stdout);
#endif

	while (read()) {
		puts(solve() ? "Yes" : "No");
	}

#ifdef LOCAL
	cerr.precision(5);
	cerr << "Time: " << fixed << (double) clock() / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}


Measured memory_bytes: 640
local mfl, mce = math.floor, math.ceil
local mmi, mma = math.min, math.max
local n, x, d = io.read("*n", "*n", "*n")
if d == 0 then
  if x == 0 then print(1)
  else print(n + 1)
  end
  os.exit()
elseif d < 0 then
  x, d = -x, -d
end
local ret = 0
local min, max = 0, 0
local t = {}
t[0] = {}
table.insert(t[0], {0, 0})
for i = 1, n do
  min = min + i - 1
  max = max + n - i
  local v = x * i
  local quot = mfl(v / d)
  local rem = v - quot * d
  if rem < 0 then
    rem = rem + d
    quot = quot - 1
  end
  if not t[rem] then t[rem] = {} end
  table.insert(t[rem], {quot + min, quot + max})
end
for k, tbl in pairs(t) do
  table.sort(tbl, function(a, b) return a[1] < b[1] end)
  local curleft, curright = tbl[1][1], tbl[1][2]
  for i = 2, #tbl do
    local l, r = tbl[i][1], tbl[i][2]
    if l <= curright + 1 then
      curright = mma(curright, r)
    else
      ret = ret + (curright - curleft + 1)
      curleft, curright = l, r
    end
  end
  ret = ret + (curright - curleft + 1)
end
print(ret)


Measured memory_bytes: 51264
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize "03"
#pragma GCC target("sse4")

#define ll long long int
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FRE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define f(i,n) for(ll i=0;i<n;i++)
#define fa(i,a,n) for(ll i=a;a<n?i<n:i>=n;a<n?i+=1:i-=1)
#define loop(i,a, n) for(ll i = a; i <= n; i++)
#define loopb(i,a, n) for(ll i = a; i >= n; i--)
#define pb push_back
#define pf push_front
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define setmem(x, k) memset(x, k, sizeof(x))
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define MOD 1000000007
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
// const ll N = 1e6+5;  
// ll a[N], b[N], dp[N], in[N], out[N], level[N], vis[N];
// vl g[N];
ll n, m;

ll dp[100005];

ll fun(vector<ll> &a, ll pos){
    if(pos == n - 1){
        return 0;
    }
    if(pos >= n){
        return INT_MAX;
    }
    if (dp[pos] != -1) return dp[pos];
    return dp[pos] = min(abs(a[pos] - a[pos+1]) + fun(a, pos + 1), abs(a[pos] - a[pos+2]) + fun(a, pos + 2));
}

void solve() {
    // ll k, x, y, p, q, r;
    cin>>n;
    vector<ll> a(n);
    f(i,n) cin >> a[i];
    setmem(dp, -1);
    cout << fun(a, 0);
}

int32_t main() {
    IOS
    ll T;
    // cin >> T;
    // while(T--)
        solve();
    cerr<<"Time elapsed : "<<clock()*1000.0/CLOCKS_PER_SEC<<"ms"<<'\n'; 
    return 0;
}

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

int n, tt, ans = 0;
vector<int> t;


int main() {
    cin >> n >> tt;
    t.resize(n);
    for (int i = 0; i < n; ++i) cin >> t.at(i);

    int end = 0;
    for (int i = 0; i < n; ++i)
    {
        int nextend = t.at(i) + tt;

        ans += (nextend - end);

        if (end < t.at(i))
        {
            ans -= t.at(i) -end;
        }

        end =  nextend;
    }

    cout << ans << endl;
}

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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int N; cin >> N;
    double ans;
    int cnt=0;
    for(int i=1;i<=N;i++){
        if(i%2==1) cnt++;
    }
    ans=cnt*1.0/N;
    printf("%.8f\n",ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main(void)
{	

	int start, end, val, count = 0;
	cin >> start;
	cin >> end;
	cin >> val;

	for (int i = start; i < end + 1; i++)
	{
		if (val%i == 0)count++;

	}

	cout << count << endl;

}

Measured memory_bytes: 1164
#include <stdio.h>

/*

?????????

2????????´??° a ??¨ b ?????????????????§?????\?????????????¨??????????????????°??????????????????????????????:

a ?? b : d (??´??°)
a ?? b ????????? : r (??´??°)
a ?? b : f (???????°???°?????°)
Input
1??????2????????´??° a, b ????????????????????????

Output
d, r, f ???1??????????????§????????£???1??????????????????????????????f??????????????????0.00001??\????????????????????£????????????????????¨????????????
*/

int main( )
{
	int a, b, d, r;
	double f;

	scanf( "%d %d", &a, &b );

	d = a / b;

	r = a % b;

	f = ( double ) a / ( double ) b;

	printf( "%d %d %f\n", d, r, f );

	return 0;
}

Measured memory_bytes: 636
A,B,C,D = map(int,[num for num in input()])

if A+B+C+D == 7:
    print("%s+%s+%s+%s=7" %(A,B,C,D))
elif A-B+C+D == 7:
    print("%s-%s+%s+%s=7" %(A,B,C,D))
elif A+B-C+D == 7:
    print("%s+%s-%s+%s=7" %(A,B,C,D))
elif A+B+C-D == 7:
    print("%s+%s+%s-%s=7" %(A,B,C,D))
elif A-B-C+D == 7:
    print("%s-%s-%s+%s=7" %(A,B,C,D))
elif A-B+C-D == 7:
    print("%s-%s+%s-%s=7" %(A,B,C,D))
elif A+B-C-D == 7:
    print("%s+%s-%s-%s=7" %(A,B,C,D))
elif A-B-C-D == 7:
    print("%s-%s-%s-%s=7" %(A,B,C,D))
else:
    print("No solution found.")


Measured memory_bytes: 3064