akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;

// int prime[1000001];
// vector<ll> primes;

// void soe() {
//     int i,j;
//     for(i=2;i<1000001;i++) prime[i] = 1;
//     for(i=2;i<=sqrt(1000001);i++) {
//         if(prime[i] == 1) {
//             for(j=i*i;j<1000001;j+=i) {
//                 prime[j] = 0;
//             }
//         }
//     }
//     for(i=2;i<1000001;i++) {
//         if(prime[i]) primes.pb(i);
//     }
// }

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

    ll a,b;
    cin >> a >> b;
    cout << (a*b)/__gcd(a,b) << "\n";
    return 0;
}




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

typedef long long ll;
#define pb push_back

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

int main(){
    ll x,k,d;
    cin>>x>>k>>d;
    if(d>=abs(x)){
        if(k%2==0) cout<<abs(x);
        else cout<<d-abs(x);
    }else{
        // while(k--){
        //     if(abs(x-d)<abs(x+d)) x = x-d;
        //     else x = x+d;
        // }
        if(k>=abs((x/d))){
            // cout<<"x/d = "<<x/d<<"\n";
            k = k - abs(x/d);
            // cout<<"k = "<<k<<"\n";
            x = abs(x) - abs(x/d)*d;
            // cout<<"after sub x = "<<x<<"\n";
            if(k%2==0) cout<<x;
            else cout<<(min(abs(d-x),abs(d+x)));
        }else{
            x = abs(abs(x) - d*k);
            cout<<x;
        }
    }
    return 0;
}


Measured memory_bytes: 3608
import java.util.*;

public class Main {

	public static void main(String[] args) {
		
		int n,i;
		int sum=0;
		double ave,syg,bsum=0;
		int[] data;
		data = new int[1000];
		Scanner sc = new Scanner(System.in);
		
		while(true) {
			bsum = 0;
			sum = 0;
			n=sc.nextInt();
			if (n==0) {
				break;
			}
			for (i=0 ; i<n ; i++) {
				data[i]=sc.nextInt();
				sum += data[i];
			}
			ave = (double)sum/(double)n;
			for (i=0 ; i<n ; i++) {
				bsum += ((double)data[i]-ave)*((double)data[i]-ave);
			}
			syg = Math.sqrt((double)bsum/(double)n);
			System.out.println(""+syg);
		}
		
		sc.close();
	}	
}


Measured memory_bytes: 31436
n, m = map(int, input().split())
NINF = -10**20
edge = []
dist = [NINF]*n
dist[0] = 0
for _ in range(m):
    a, b, c = map(int, input().split())
    edge.append((a-1, b-1, c))
for i in range(n):
    for a, b, c in edge:
        if dist[a]!=NINF and dist[b] < dist[a] + c:
            dist[b] = dist[a] + c
            if i==n-1 and b==n-1:
                print('inf')
                exit()
print(dist[-1])

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.nextInt();
        int M = sc.nextInt();
        int X = sc.nextInt();
        int a = 0;
        int b = 0;
        for(int i = 0; i < M; i++){
            int c = sc.nextInt();
            if(c < X) a++;
            else b++;
        }
        System.out.println(Math.min(a, b));
        sc.close();

    }

}


Measured memory_bytes: 23764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
		String str="";

		str=bfr.readLine();
		int res=Integer.parseInt(str);
		int goukei=0;
		if(res%10==1) goukei++; res=res/10;
		if(res%10==1) goukei++; res=res/10;
		if(res%10==1) goukei++;

		System.out.println(goukei);

	}
}

Measured memory_bytes: 22740
n = int(input())
s = input()
nw = len([i for i in s if(i == 'W')])
ns = n - nw
i = 0
j = n-1
c = 0
while(i < j):
	if(s[i] == 'W' and s[j] == 'R'):
		c += 1
		i += 1
		j -= 1
	elif s[i] == 'R':
		i += 1
	elif s[j] == 'W':
		j -= 1
print(min([c,nw, ns]))

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

int main(void){
    string s,t;
    cin>>s>>t;
    int n = s.size();
    vector<int> lastS(26,-1),lastT(26,-1);
    bool ok = true;
    rep(i,n){
        if(lastS[s[i]-'a'] != lastT[t[i]-'a']){
            ok = false;
        }
        lastS[s[i]-'a'] = i;
        lastT[t[i]-'a'] = i;
    }
    cout<<((ok) ? "Yes" : "No")<<endl;

    return 0;
}


Measured memory_bytes: 776
from fractions import gcd

a, b = map(int, input().split())

def divisor(n: int) -> list:
    list_of_divisor = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            list_of_divisor.append(i)
            if i != n//i:
                list_of_divisor.append(n//i)
    list_of_divisor.sort()
    return list_of_divisor

def is_prime(n):
    if n <= 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

g = gcd(a, b)
li = divisor(g)

cnt = 1
for i in li:
    if is_prime(i) == True:
        cnt += 1
    
print(cnt)

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

int N;
vector<ll> A;
vector<vector<int>> G;

ll dfs(int v, int p) {
  vector<ll> edges;
  for (int u : G[v]) {
    if (u != p) {
      ll e = dfs(u, v);
      if (e < 0) {
        return -1;
      }
      edges.push_back(e);
    }
  }
  if (edges.empty()) {
    return A[v];
  }
  ll sum = accumulate(edges.begin(), edges.end(), 0ll);
  ll mx = *max_element(edges.begin(), edges.end());
  ll x = 2 * A[v] - sum;
  sum += x;
  mx = max(mx, x);
  if (x < 0 || sum % 2 != 0 || mx > sum / 2) {
    return -1;
  }
  return x;
}

bool solve() {
  if (N == 2) {
    return A[0] == A[1];
  }
  int r = -1;
  for (int v = 0; v < N; v++) {
    if (G[v].size() > 1) {
      r = v;
      break;
    }
  }
  return dfs(r, -1) == 0;
}

int main() {
  cin >> N;
  A.resize(N);
  G.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  cout << (solve() ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 14592
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;

#define DE 1
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#define ALL(s) (s).begin(),(s).end()
#define REP(i,n) for (int i = 0; i < (int)(n); ++i)
#define EACH(i,s) for (typeof((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl

template<class T1, class T2> ostream& operator<<(ostream &s, pair<T1,T2> P){return s<<'<'<<P.first<<", "<<P.second<<'>';}
template<class T> ostream& operator<<(ostream &s, vector<T> P) {s<<"{ ";for(int i=0;i<P.size();++i){if(i>0)s<<", ";s<<P[i];}return s<<" }"<<endl;}
template<class T1, class T2> ostream& operator<<(ostream &s, map<T1,T2> P) {s<<"{ ";for(typeof(P.begin()) it=P.begin();it!=P.end();++it){if(it!=P.begin())s<<", ";s<<'<'<<it->first<<"->"<<it->second<<'>';}return s<<" }"<<endl;}



int dx[4], dy[4];

bool used[4][4];
int res = 0;

void dfs(int con, int x, int y) {
    if (con == 8) {
        ++res;
        return;
    }
    for (int i = 0; i < 4; ++i) {
        int px = x + dx[i], py = y + dy[i];
        if (px < 0 || px >= 4 || py < 0 || py >= 4) continue;
        if (!used[px][py]) {
            used[x][y] = true;
            used[px][py] = true;
            
            int nx = 0, ny = 0;
            while (used[nx][ny]) {
                ++nx;
                if (nx == 4) nx = 0, ++ny;
            }
                
            dfs(con+1, nx, ny);
            used[x][y] = false;
            used[px][py] = false;
        }
    }
}

int main() {
    //freopen( "/Users/macuser/Documents/Programming/Contest/input.in", "r", stdin );
    
    while (cin >> dx[0]) {
        if (dx[0] == 5) break;
        cin >> dy[0] >> dx[1] >> dy[1] >> dx[2] >> dy[2] >> dx[3] >> dy[3];
        
        for (int i = 0; i < 4; ++i) if (dy[i] < 0) {dx[i] = -dx[i]; dy[i] = -dy[i];}
        
        res = 0;
        memset(used, 0, sizeof(used));
        dfs(0, 0, 0);
        
        cout << res << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1160
package main

import (
  "bufio"
  "fmt"
  "os"
  "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func readLine() string {
  sc.Scan()
  return sc.Text()

}

func main() {
  n, _ := strconv.Atoi(readLine())
  fmt.Println(n * n * n)
}

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

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

    vector<char> c;
    while (n > 0) {
        n--;
        c.push_back('a' + n % 26);
        n /= 26;
    }

    reverse(c.begin(), c.end());
    rep(i, c.size()) {
        cout << c[i];
    }
    cout << endl;
}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	scanf("%d",&a);
	double b,sum;
	for(int i=0;i<a;i++)
	{
		scanf("%lf",&b);
		sum+=1/b;
	}
	printf("%lf\n",1/sum);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 2*1e5;
const int mod = 1e9+7;

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

ll com(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

int main() {
    int n, k; cin >> n >> k;
    ll sum = 0;
    COMinit();
    rep(i,min(k+1,n)) {
        sum += com(n,i) * com(n-1,i) % mod;
        sum %= mod;
    }
    cout << sum << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define ii pair<int,int>
#define f(x,y,z) for(int x = y ; x <= z ; x++)
#define fs(arr,n) for(int i = 1 ; i <= n ; i++) cin >> arr[i];
#define fsm(arr,n,m) for(int i = 1 ; i <= n ; i++) for(int j = 1 ; j <= m ; j++) cin >> arr[i][j];
#define fp(arr,n) for(int i = 1 ; i <= n ; i++) cout << arr[i] << " ";
#define fpm(arr,n,m) for(int i = 1 ; i <= n ; i++){ for(int j = 1 ; j <= m ; j++) {cout << arr[i][j] << " ";} cout << "\n";}
#define N 2005
#define fun(arr,i,j,k,l)  arr[k][l]-arr[i-1][l] - arr[k][j] +arr[i-1][j]
#define fun2(arr,i,j,k,l)  arr[k][l]-arr[i][l] - arr[k][j-1] +arr[i][j-1]
#define fun3(arr,i,j,k,l)  arr[k][l]-arr[i-1][l] - arr[k][j-1] +arr[i-1][j-1]
using namespace std;
int n,m,k,prenod[N][N],predgeleft[N][N],predgedown[N][N];
char arr[N][N];
int main() 
{
    fast_io();
    cin >> n >> m >> k;
    fsm(arr,n,m);
    for(int i = 1 ; i <= n ; i++)
    {
        for(int j = 1 ; j <= m ; j++)
        {
            prenod[i][j] = arr[i][j] - '0' + prenod[i][j-1];    
            predgeleft[i][j] = (arr[i][j] == arr[i][j-1] && arr[i][j] == 1+'0'); 
            predgeleft[i][j] += predgeleft[i][j-1];
        }
    }
    for(int i = 1 ; i <= m ; i++)
    {
        for(int j = 1 ; j <= n ; j++)
        {
            prenod[j][i] += prenod[j-1][i];    
            predgeleft[j][i] += predgeleft[j-1][i];
            predgedown[j][i] = (arr[j][i] == arr[j-1][i] && arr[j][i] == 1+'0'); 
            predgedown[j][i] += predgedown[j-1][i];
            
        }
    }
    for(int i = 1 ; i <= n ; i++)
    {
        for(int j = 1 ; j <= m ; j++)
        {
              predgedown[i][j] += predgedown[i][j-1];
        }
    }
    for(int i = 1 ; i <= k ; i++)
    {
              int x1,x2,y1,y2;
              cin >> y1 >> x1>> y2>> x2;
              int nod = fun3(prenod,y1,x1,y2,x2);
              int left = fun(predgeleft,y1,x1,y2,x2);
              int down = fun2(predgedown,y1,x1,y2,x2);
              cout << nod - left-down<< "\n";
    }
    
    
    // cout <<"\n";
    // fpm(predgedown,n,m);
    // cout << "\n" ;
    // fpm(predgeleft,n,m);
    //  cout << "\n";
    // fpm(prenod,n,m);
    return 0;
}

Measured memory_bytes: 52864
#include <iostream>
using namespace std;
int main(void){
    long long A,B,K;
    cin >> A >> B >> K;
    long long S = 0;
    S = K - A;
    if(S <= 0){
        S = 0;
    }
    if(A > 0){
        A -= K;
    }
    if(A <= 0){
        A = 0;
    }
    if(B > 0){
        B -= S;
    }
    if(B <= 0){
        B = 0;
    }
    cout << A << " " << B << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg puts("It's Just Begining.Wait For The End!!!!!\n")
#define CHECK(x) cout << (#x) << " is " << (x) <<"\n";
#define endl printf("\n")
typedef pair<ll,ll> pii;
#define pb push_back
#define ms(a,b) memset(a, b, sizeof(a))
#define in(x) scanf("%lld",&x)
#define out(x) printf("%lld",x)
#define X first
#define Y second
#define sps printf(" ")
#define dou(x) cout<<fixed<<setprecision(6)<<x
#define all(v) v.begin(),v.end()
#define dis(it,it1) distance(it,it1)+1
#define MAX 100005
#define INF 9223372036854775807LL
#define MOD 1000000007
#define print(cs) printf("Case %lld: ",cs)
#define Yesno(ok) if(ok)puts("YES");else puts("NO")
#define yesno(ok) if(ok)puts("Yes");else puts("No")
ll lcm(ll a,ll b){return ((a*b)/__gcd(a,b));}
int main()
{
     ll test=1,cas=1;
     while(test--)
     {
		ll i,j,k,l,n,m,r;
		ll x,y;
		cin>>x>>y;
		if(y&1||y<x*2||y>x*4)puts("No");
		else puts("Yes");
     }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    string b;
    cin >> b;
    switch (b[0]) {
        case 'A':
            cout << "T" << endl;
            break;
        case 'C':
            cout << "G" << endl;
            break;
        case 'G':
            cout << "C" << endl;
            break;
        case 'T':
            cout << "A" << endl;
            break;
    }
    return 0;
}

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

int main(){
	int n, i;

	cin >> n;

	int a[n];

	for(i=0; i<n; i++){
		cin >> a[i];
	}

	for(i=n-1; 0<i; i--){
		cout << a[i] << " ";
	}
	cout << a[0] << endl;

}

Measured memory_bytes: 1160
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

int main() {
	int k, x;
	cin >> k >> x;
	if (500 * k >= x) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(int argc, char* argv[]){
  int a,n;
  scanf("%d",&n);
  printf("%d:",n);
  a=2;
  while(n>=a*a){
    if(n%a==0){
      printf(" %d",a);
      n=n/a;
    } else {
      a++;
    }
  }
  printf(" %d\n",n);
  return 0;
}

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

using namespace std;

string replace (const string& s_) {
    string s = s_;
    for (int i = 0; i < s.size(); i++) {
        if ('a' <= s[i] && s[i] <= 'z') {
            s[i] = s[i] + 'A' - 'a';
        }
    }
    return s;
}

int main (void) {
    string s;
    getline(cin, s);
    cout << replace(s) << endl;
    return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int n, a, b;
ll v[60];
ll dp[60][60];
int main() {
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++)cin >> v[i];
	sort(v, n);
	int cont = 0;
	ll sum = 0LL;
	for (int i = n - 1; i >= 0; i--) {
		if (cont >= a)break;
		else {
			cont++;
			sum += v[i];
		}
	}
	long double ans = (long double)sum / a;
	printf("%.10Lf\n", ans);
	cont = 0;
	for (int i = 0; i < n; i++) {
		if (v[i] == v[n - a]) {
			cont++;
		}
	}
	int coutt = 0;
	for (int i = n - 1; i >= n-a; i--) {
		if (v[i] == v[n - a]) {
			coutt++;
		}
	}
	for (int i = 0; i < 60; i++) {
		dp[i][0] = 1;
		dp[i][i] = 1;
	}
	for (int i = 0; i < cont; i++) {
		for (int j = 0; j < i; j++) {
			if (i >= j + 1) {
				dp[i + 1][j + 1] = dp[i][j + 1] + dp[i][j];
			}
		}
	}
	if (v[n - 1] != v[n - a] ) {
		cout << dp[cont][coutt] << endl;
	}
	else {
		ll summ = 0;
		for (int i = a; i <= min(b,cont); i++) {
			summ += dp[cont][i];
		}
		cout << summ << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

typedef long long int ll;
#define int 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 debug cout << "debug" << endl;
#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;
typedef vector<vector<ll>> matrix;
ll dx[] = {0, 1, 0, -1};
ll dy[] = {-1, 0, 1, 0};
const ll N = 1e7+5;
// ll a[N], b[N], dp[N], level[N], vis[N], in[N], out[N];
// vl g[N];
ll n, m;



void solve() {
	ll t, x, y, l, r;
	cin >> x >> y;
	if(y > 4*x || y < 2*x || y%2){
		cout << "No\n";
		return;
	}
	if((y-2*x) % 2 == 0 && (y-2*x)>=0 && (4*x - y)%2 == 0 && (4*x-y>=0)){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
}

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: 3820
q = int(input())

A = []

for _ in range(q):
    
    command, *list_num = input().split()

    if   command == "0":
        A.append(int(list_num[0]))
    elif command == "1":
        print(A[int(list_num[0])])
    elif command == "2":
        A.pop()
    else:
        raise



Measured memory_bytes: 13356
let rec f()=Scanf.scanf"%d %d
"(fun n x->if n<>0||x<>0then let z=ref 0in for a=1to n do for b=a+1to n do if b<x-a-b&&x-a-b<=n then z:=!z+1done done;f(Printf.printf"%d
"!z));;f()

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

int main() {
  ll a, b;
  cin >> a >> b;
  if (a<0 && b<0) {
    if ((b-a) % 2) cout << "Positive" << endl;
    else cout << "Negative" << endl;
  } else if (a>0 && b>0) {
    cout << "Positive" << endl;
  } else {
    cout << "Zero" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  constexpr int inf = 1e9;

  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  V<> dp(1 << n, inf);
  dp[0] = 0;
  while (m--) {
    int a, b; cin >> a >> b;
    int T = 0;
    while (b--) {
      int c; cin >> c, --c;
      T |= 1 << c;
    }
    auto ndp = dp;
    for (int S = 0; S < 1 << n; ++S) if (dp[S] < inf) {
      ndp[S | T] = min(ndp[S | T], dp[S] + a);
    }
    swap(dp, ndp);
  }
  if (dp.back() < inf) {
    cout << dp.back() << '\n';
  } else {
    cout << -1 << '\n';
  }
}

Measured memory_bytes: 256
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const x = Number(input[0][0]);

  return x < 1200 ? "ABC" : "ARC";
};

console.log(main(read()));


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


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	map<string,int> pam;
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		string S;
		cin>>S;
		pam[S]++;
	}
	int M;
	cin>>M;
	for(int i=0;i<M;i++){
		string S;
		cin>>S;
		pam[S]--;
	}
	int ans=0;
	for(pair<string,int> P:pam){
		ans=max(ans,P.second);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n=int(input())
t=[int(input()) for i in range(n)]
print(lcm_list(t))

Measured memory_bytes: 5432
import scala.io.StdIn.readLine
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args:Array[String]) = {
    val b = new ArrayBuffer[String]
    var s = "0 0"
    while({s = readLine.trim;s} != "0 0") {
      val n = s.split(" ").map(_.toInt)
      val sum = {
        for(i<-1 to n(0)) yield readLine.split(" ").map(_.toInt).toList
      }.toList.transpose.map(_.sum)
        .zipWithIndex
        .sortWith((x,y) => (x._1 > y._1) || (x._1==y._1 && x._2<y._2))
        .map(_._2+1)
      b+=sum.mkString(" ")
    }
    println(b.mkString("\n"))
  }
}

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

#define INF 1<<30

int N, M;
string S;

vector<int> dp;

signed main()
{
  cin >> N >> M;
  cin >> S;

  int count1=0;
  for(auto c : S){
    if(c=='1') {
      if(++count1 >= M) {
        puts("-1");
        return 0;
      }
    }
    else count1=0;
  }

  dp.resize(N+1);
  fill(dp.begin(), dp.end(), INF);
  dp[N] = 0;

  queue<int> q;
  q.push(0);
  for(int i=N-1; i>=0; i--) {
    while((int)q.size()>M || q.front()==INF) q.pop();
    if(S[i]=='1') { q.push(INF); continue; }
    dp[i] = q.front() + 1;
    q.push(dp[i]);
  }

  for(int i=0; i<N;) {
    for(int j=1; j<=M; j++) {
      if(dp[i+j] == dp[i] - 1) {
        cout << j << " ";
        i+=j;
        break;
      }
      assert(j!=M);
    }
  }
  cout << endl;
}

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

using namespace std; 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>; 

#define INF INT_MAX/2 //(1<<(4*4-1))
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

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

  int N,W;
  cin>>N>>W;
  vector<int>w(N),v(N);
  for(int i=0;i<N;i++)cin>>w[i]>>v[i];

  vector<vector<ll> >dp(N+1,vector<ll>(100001,-INF));

  dp[0][0]=0;

  for(int i=1;i<=N;i++){
    for(int j=0;j<=W;j++){
      if(j-w[i-1]>=0)dp[i][j]=max(dp[i-1][j-w[i-1]]+v[i-1],dp[i-1][j]);
      else dp[i][j]=dp[i-1][j];
    }
  }

  ll ans=-INF;
  for(int j=0;j<=W;j++){
    ans=max(ans,dp[N][j]);
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}


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

  string s; cin >> s;
  int cnt = 0;
  for(int i=0;i<SZ(s);++i) {
    cnt += s[i] == 'o';
  }
  cout << (cnt >= 8 - (15 - SZ(s)) ? "YES" : "NO") << endl;

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

int x1,x2,x3,x4,y1,y2,y3,y4;

signed main()
{
    scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
    x3=x2-(y2-y1);
    y3=y2+(x2-x1);
    x4=x1-(y2-y1);
    y4=y1+(x2-x1);
    printf("%d %d %d %d",x3,y3,x4,y4);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <climits>
#include <limits>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#define _USE_MATH_DEFINES
#include <cmath>
#include <complex>

using namespace std;

#define INFD numeric_limits<double>::infinity()
#define INFL (int)1e8
#define INFLL (long long)1e15
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loopll(i, n) for(ll i = 0; i < (ll)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopll1(i, n) for(ll i = 1; i <= (ll)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = (ll)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define Looprll1(i, n) for(ll i = (ll)n; i >= 1; i--)
#define rnd(d) (ll)((double)d + ((d >= 0) ? 0.5 : -0.5))
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

/*******************************************************/

int main() {
  int n; cin >> n;
  vll a(n);
  Loop(i, n) {
    cin >> a[i];
  }
  vll sum(2, 0);
  Loop(i, n) {
    if (a[i] > 0) sum[0] += a[i];
    i++;
  }
  Loop1(i, n - 1) {
    if (a[i] > 0) sum[1] += a[i];
    i++;
  }
  ll ans_sum;
  deque<bool> b(n, false);
  if (sum[0] > sum[1]) {
    Loop(i, n) {
      if (a[i] > 0) b[i] = true;
      i++;
    }
    ans_sum = sum[0];
  }
  else if (sum[1] > sum[0]) {
    Loop1(i, n - 1) {
      if (a[i] > 0) b[i] = true;
      i++;
    }
    ans_sum = sum[1];
  }
  else {
    int max_index = -1;
    ll max_value = LLONG_MIN;
    Loop(i, n) {
      if (a[i] > max_value) {
        max_index = i;
        max_value = a[i];
      }
    }
    b[max_index] = true;
    ans_sum = max_value;
  }
  int cnt = 0;
  vector<int> ans;
  Loopr(i, n) {
    if (!b[i]) {
      ans.push_back(i);
      b.pop_back();
    }
    else {
      break;
    }
  }
  Loop(i, n) {
    if (!b[0]) {
      ans.push_back(0);
      b.pop_front();
    }
    else {
      break;
    }
  }
  if (b.size() >= 3) {
    int i = 0;
    while (i < b.size()) {
      if (i + 2 < b.size() && !b[i] && !b[i + 1] && !b[i + 2]) {
        ans.push_back(i + 1);
        b.erase(b.begin() + i + 2);
        b.erase(b.begin() + i);
      }
      else {
        i++;
      }
    }
    Loop(i, b.size() / 2) {
      ans.push_back(1);
    }
  }
  cout << ans_sum << endl;
  cout << ans.size() << endl;
  Loop(i, ans.size()) {
    cout << ans[i] + 1 << endl;
  }
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.string;
import std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

int DEBUG_LEVEL = 0;
void print()(){ writeln(""); }
void print(T, A ...)(T t, lazy A a){ write(t), print(a); }
void print(int level, T, A ...)(T t, lazy A a){ if(level <= DEBUG_LEVEL) print(t, a); }

void main(string[] args){
	if(args.length > 1 && args[1] == "-debug"){
		if(args.length > 2 && args[2].isNumeric) DEBUG_LEVEL = args[2].to!int;
		else DEBUG_LEVEL = 1;
	}
	
	int a = read.to!int;
	int b = read.to!int;
	
	
	if(a >= 13) b.writeln;
	else if(a >= 6) (b / 2).writeln;
	else 0.writeln;
	
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(void)
{
	int n; 
	cin >> n;
	
	int max=0;
	int sum=0;

	for(int i=1;i<=n;i++)
	{
		int p;
		cin >> p;
		sum+=p;
		if(max<p)
			max=p;
	}

	cout << sum-max/2 << endl;
}

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

class dice{
	public:
		int label[6];
		int tmp1, tmp2;
		void setnumber(){
			for(int i=0; i<6; i++)
				cin >> label[i];
		}
		void rotation(char sign){
			tmp1 = label[0];
			tmp2 = label[5];
			if(sign == 'N'){
				label[0] = label[1];
				label[5] = label[4];
				label[1] = tmp2;
				label[4] = tmp1;
			}
			if(sign == 'S'){
				label[0] = label[4];
				label[5] = label[1];
				label[4] = tmp2;
				label[1] = tmp1;
			}
			if(sign == 'W'){
				label[0] = label[2];
				label[5] = label[3];
				label[2] = tmp2;
				label[3] = tmp1;
			}
			if(sign == 'E'){
				label[0] = label[3];
				label[5] = label[2];
				label[3] = tmp2;
				label[2] = tmp1;
			}
		}
};

int main(){
	dice d;
	d.setnumber();
	string s; cin >> s;
	for(int i=0; i<s.length(); i++)
		d.rotation(s[i]);
	cout << d.label[0] << endl;
	return 0;
}

Measured memory_bytes: 3176
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    p = list(map(int, input().split()))

    c = 0
    for i, v in enumerate(p):
        if (i + 1) != v:
            c += 1
        if c > 2:
            print('NO')
            quit()
    print('YES')

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
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;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}

string to_str(int x){
    string s = "000";
    for(int i = 2; i >= 0 and x > 0; --i, x /= 10){
        s[i] = x%10+'0';
    }
    return s;

}
int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    
    int n;
    string s;
    cin >> n >> s;

    int cnt = 0;
    for(int i = 0; i < 1000; ++i){
        string num = to_str(i);
        num.push_back('#');
        int idx = 0;
        for(int j = 0; j < s.size(); ++j){
            if(s[j] == num[idx]) ++idx;
        }
        if(idx == 3) ++cnt;
    }
    cout << cnt << '\n';
    
    return 0;
}


Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))
s = [0] * 13
for i in a:
  s[i // 400] += 1
ans = 0
for i in range(8):
  if s[i] > 0:
    ans += 1
print(max(1, ans), ans + sum(s[8:]))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x;cin>>n>>x;
    int m;
    int sum=0;
    int mmin=x;
    for(int i=0;i<n;i++){
        cin>>m;
        sum+=m;
        mmin = min(mmin,m);
    }
    int red=x-sum;
    int ans=red/mmin+n;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

def bf(links, n, st=1):
    inf = float('inf')
    dj = [inf] * (n + 1)
    dj[st] = 0
    for i in range(N):
        updated = False
        for link in links:
            fn, tn, lc = link
            lc *= -1
            if dj[fn] + lc < dj[tn]:
                dj[tn] = dj[fn] + lc
                updated = True
        if not updated: break
    else:
        pn = dj[-1]
        for i in range(N):
            updated = False
            for link in links:
                fn, tn, lc = link
                lc *= -1
                if dj[fn] + lc < dj[tn]:
                    dj[tn] = dj[fn] + lc
                    updated = True
            if not updated: break
        return inf if pn != dj[-1] else -dj[-1]
    return -dj[-1]

links = []
for _ in range(M):
    links.append([int(x) for x in input().split()])

print(bf(links, N, 1))


Measured memory_bytes: 3444
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <cmath>
#include <utility>
#include <numeric>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i=0;(i)<(n);(i)++)
#define repi(i, n) for (int i=0;(i)<=(n);(i)++)
#define repr(i, n) for (int i=n;(i)>=0;(i)--)
#define print(x) (cout<<(x)<<"\n")

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    const int n=50;
    ll k; cin>>k;
    ll a=k/n;
    ll b=k%n;
    vector<ll> A(n); rep(i, n) A[i]=(ll)i+a;
    rep(i, n) {
        if (i<b) A[i]+=n-b+1;
        else A[i]-=b;
    }
    print(50);
    rep(i, A.size()) {
        cout << (i ? " " : "") << A[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
using namespace std;

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


int main() {
	int n;
	cin >> n;
	map<ll, int> mp;
	rep(i, n){
		ll a;
		cin >> a;
		mp[a]++;
	}
	int res = 0;
	for (auto x : mp) {
		if (x.second%2==1) res++;
	}
	cout << res << endl;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  	cin>>n;
  	vector<int>a(n);
  	for(int i=0;i<n;i++){
    	cin>>a[i];
    }
  	int sum=0;
  	vector<int>b(0);
  	for(int i=-100;i<=100;i++){
      	sum=0;
    	for(int j=0;j<a.size();j++){
        	sum +=(a[j]-i)*(a[j]-i);
        }
      	b.push_back(sum);
    }
  	sort(b.begin(),b.end());
  	cout<<b[0]<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define  rep(i,a,b)for(int i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const ll INF=10000000000LL;
ll r197(ll n){
	return n%1000000007;
}

typedef pair<int,int>P;

typedef pair<int,P>Pa;
vector<int> v[100001];
bool b[100005]={};
struct edge{
	int score;
	int num;
};
int n,k;
double p[3003];
double dp[3003][1505];
double reg(int m,int v){
	if(dp[m][v]!=-1)return dp[m][v];
	if(v==k)return 1;
	if(m==n)return 0;
	double res=0;
	res+=reg(m+1,v+1)*p[m]+reg(m+1,v)*(1-p[m]);
	return dp[m][v]=res;
}
int main() {
	cin>>n;
	rep(i,0,n)cin>>p[i];
	k=(n%2==0?n/2:n/2+1);
	rep(i,0,n+1){
		rep(j,0,k+1){
			dp[i][j]=-1;
		}
	}
	printf("%.9f",reg(0,0));
	return 0;
}


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

int main(){
  int N, K, n = 1;
  cin >> N >> K;
  for(int i = 0;i < N;i++){
    if(n < K)
      n *= 2;
    else
      n += K;   
  }
  cout << n << endl;
}

Measured memory_bytes: 256
import sys
from copy import copy
A = []
for _ in range(5):
  A.append(int(input()))

def dfs(B):
  if len(B) == 1:
    return B[0]
  ans = float('inf')
  for i in range(len(B)):
    C = copy(B)
    x = C.pop(i)
    if x % 10 != 0:
      x += (10 - x % 10)
    ans = min(ans, x + dfs(C))
  return ans

print(dfs(A))

Measured memory_bytes: 3700
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    string s[n];
    map<string, long long> map;
    for(int i = 0; i < n; i++){
        cin >> s[i];
        vector<char> c;
        for(int j = 0; j < s[i].size(); j++){
            c.push_back(s[i][j]);
        }
        sort(c.begin(), c.end());
        string sorted = "";
        for(int j = 0; j < c.size(); j++){
            sorted += c[j];
        }
        if(map.count(sorted) == 0){
            map[sorted] = 1;
        } else {
            map[sorted]++;
        }
    }
    long long ans = 0;
    for( auto i = map.begin(); i != map.end() ; ++i ) {
        long long a = i->second;
        ans += a*(a-1)/2;
    }
    cout << ans << endl;
    return 0;
}

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

#define MAXN 100005
#define INF 0x3f3f3f3f

using namespace std;

int alturas[MAXN];
int dp[MAXN];

int solve(int n){
    if(n <= 0) return INF;

    if(dp[n] != -1) return dp[n];

    return dp[n] = min(solve(n - 1) + abs(alturas[n - 1] - alturas[n]), solve(n - 2) + abs(alturas[n - 2] - alturas[n]));
}

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

    int n;
    cin >> n;

    for(int i = 1; i <= n; i++) cin >> alturas[i];

    memset(dp, -1, sizeof(dp));

    dp[1] = 0;

    cout << solve(n) << endl;

    return 0;
}

Measured memory_bytes: 2560
// #include {{{
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <tuple>
#include <utility>
#include <random>
#include <limits>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdint>
#include <cassert>
// }}}

using namespace std;

// macros {{{
template<typename T, size_t N>
constexpr size_t NELEMS(T (&)[N]) { return N; }

template<typename InputIt>
void PRINT_RANGE(InputIt first, InputIt last)
{
    for(; first != last; ++first)
        cout << *first << (first==last ? "" : " ");
    cout << "\n";
}

template<typename T>
void PRINT_MATRIX(T mat, size_t nr, size_t nc)
{
    for(size_t r = 0; r < nr; ++r) {
        for(size_t c = 0; c < nc; ++c) {
            cout << mat[r][c] << (c==nc-1 ? "" : " ");
        }
        cout << "\n";
    }
}

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)
// }}}

// types {{{
using ll  = long long;
using ull = unsigned long long;
// }}}

int K, S;

void solve()
{
    ll cnt = 0;
    FOR(x, 0, K+1) {
        FOR(y, 0, K+1) {
            int z = S - x - y;
            if(z < 0 || z > K) continue;

#ifdef DEBUG
            cout << "x,y,z: " << x << " " << y << " " << z << "\n";
#endif
            ++cnt;
        }
    }

    cout << cnt << "\n";
}

int main()
{
    cin >> K >> S;

    solve();

    return 0;
}


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

#ifdef DONLINE_JUDGE
//freopen("a.in", "r", stdin);
//freopen("a.out","w",stdout); // console output is better (in most cases)
#else
// add i/o method of specific testing system
#endif

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int a[n];

    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = n - 1; i >= 0; --i)
    {
        cout << a[i];
        if (i != 0)
            cout << " ";
    }
    cout << endl;

    return 0;
}


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

int main() {
  int a,b;
  cin>>a>>b;
  if((100*a+99)/8<10*b||10*b+9<(100*a+7)/8){cout<<-1<<endl;}
  else{cout<<max((100*a+7)/8,10*b)<<endl;}
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        String S = sc.next();

        int[] blackcount = new int[N];
        int bkl = 0;
        for (int i = 0; i<N; i++) {
            if (S.charAt(i)== '#') bkl++;
            blackcount[i] = bkl;
//            System.out.print(bkl);
        }
//        System.out.println();
        int blackall = blackcount[N-1];
//        System.out.println(blackall);
        int count = N;
        for (int i = 0; i < N; i++) {
            int leftchange = blackcount[i];
            int rightchange = (N-1-i-(blackall-leftchange));
            count = Math.min(count,(leftchange+rightchange));
//            System.out.println("left: " + leftchange + " right: " + rightchange + " count: " + count);
        }
        System.out.println(Math.min(count,N-blackall));
    }
}

Measured memory_bytes: 27404
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>a>>b>>c;
    cin>>n;
    // count = 1;
    bool check = true;

    while(b <= a){
        b*=2;
        count++;
        check = false;
    }


    while(c <= b){

        c*=2;
        count++;
    }

    if(count <=n){
        cout<<"Yes\n";
    }

    else
        cout<<"No\n";
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>



#define rep(i,p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

//63D

vector<ll> hp;
ll n, a, b;

bool search_HP(ll count) {
	ll exp_sum = 0;
	ll exp_damage = count * b;
	rep(i, 0, n) {
		if (hp[i] > exp_damage) {
			exp_sum += (hp[i] - exp_damage) / (a - b);
			if ((hp[i] - exp_damage) % (a - b) != 0) exp_sum++;
		}
	}
	return exp_sum <= count;
}

ll binary_search_Func(ll ub, ll lb, bool (*target_Func)(ll)) {
	while (ub - lb > 1) {
		ll mid = (ub + lb) / 2;
		if (target_Func(mid)) {
			ub = mid;
		}
		else {
			lb = mid;
		}
	}
	return ub;
}

int main(void) {	
	cin >> n >> a >> b;
	hp = vector<ll>(n);
	rep(i, 0, n) {
		cin >> hp[i];
	}
	sort(hp.begin(), hp.end(), greater<>());
	ll ub = hp[0];
	ll lb = 1;
	cout << binary_search_Func(ub, lb, search_HP) << endl;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int maxn = 100;
int T,n,m;




int main() {
    cin>>m;
	cout<<48-m<<endl; 
    return 0;
}




Measured memory_bytes: 256