akhauriyash/Code-Regression huggingface dataset:
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end


n,m = inp
h = inp

t = na2(n,0)
m.times do
  a,b =inp
  t[a-1].push(b-1)
  t[b-1].push(a-1)
end
$t = t
ans = 0
n.times do |i|
  f = true
  t[i].each do |j|
    if(h[i]<=h[j])
      f = false
      break 
    end
  end
  ans += 1 if f
end
p ans



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

int main(){
  ll n,k;
  vector<ll> p(200000); 
  cin >> n >> k;
  rep(i,n) cin >> p[i];
  rep(i,n-k){
    if(p[i]<p[i+k]){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 4660
/*input
10
1 3 2 3 3 2 3 2 1 3
*/
#include<bits/stdc++.h>
using namespace std;

#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test int t;cin>>t;while(t--)
#define X first
#define Y second
#define pb push_back
#define all(s) s.begin(),s.end()

typedef pair<int,int> ii;
typedef long long ll;

const int MOD = 1e9+7;
const int MX = 307;

long double dp[MX+5][MX+5][MX+5];

void solve(){
    long double n;
    cin >> n;
    int c1=0,c2=0,c3=0;
    for(int i=0,x;i<n;i++){
        cin >> x;
        if(x==1)
            c1++;
        if(x==2)
            c2++;
        if(x==3)
            c3++;

        // (x==1) ? c1++ : ((x==2) ? c2++ : c3++);
    }
    // cout << c1;

    for(int k=0;k<MX;k++){
        for(int j=0;j+k<MX;j++){
            for(int i=0;k+i+j<MX;i++){
                if(i==0 && j==0 && k==0){
                    continue;
                }
                long double wait = 1.0*n/(i+j+k);
                long double pi = 1.0*i/(i+j+k);
                long double pj = 1.0*j/(i+j+k);
                long double pk = 1.0*k/(i+j+k);
                if(i){
                    dp[i][j][k] += pi*dp[i-1][j][k];
                }
                if(j){
                    dp[i][j][k] += pj*dp[i+1][j-1][k];
                }
                if(k){
                    dp[i][j][k] += pk*dp[i][j+1][k-1];
                }
                dp[i][j][k] += wait;
            }
        }
        
    }
    cout << fixed << setprecision(16);
    cout << dp[c1][c2][c3];

}

int main(){
    FIN;   
    // test
    solve();
}

Measured memory_bytes: 467200
n=int(input())
h=list(map(int, input().split()))
c1 = abs(h[1]-h[0])
c=[0,c1]
for i in range(n-2):
    d0 = c[i] + abs(h[i]-h[i+2])
    d1 = c[i+1] + abs(h[i+1]-h[i+2])
    if d0<d1:
        c.append(d0)
    else:c.append(d1)
print(c[-1])

Measured memory_bytes: 13980
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;

namespace Atcoder_0403
{
    class Program
    {
        static void Main(string[] args)
        {
            long _targetNumber = GetInput_long()[0];
            HashSet<long> _yakusuSet=new HashSet<long>();
            HashSet<long> _resultSet=new HashSet<long>();

            //Nの約数を取得
            for (long i = 2; i * i <= _targetNumber; i++)
            {
                if (_targetNumber % i == 0)
                {
                    _yakusuSet.Add(i);
                    _yakusuSet.Add(_targetNumber / i);
                }
            }
            //Nの約数についての検証
            foreach(var data in _yakusuSet)
            {
                long temp = _targetNumber;
                while (temp % data == 0)
                {
                    temp /= data;
                }
                if (temp % data == 1)
                {
                    _resultSet.Add(data);
                }
            }
            //Nの約数でない場合についての検証
            for(long i = 2; i * i <= _targetNumber - 1; i++)
            {
                if ((_targetNumber-1) % i == 0)
                {
                    _resultSet.Add(i);
                    _resultSet.Add((_targetNumber-1)/i);
                }
            }
            _resultSet.Add(_targetNumber);
            if(_targetNumber-1>1)_resultSet.Add(_targetNumber-1);
            Console.WriteLine(_resultSet.Count);
        }

        #region input


        static string[] GetInput_string()
        {
            var input = Console.ReadLine().Split(' ');
            return input;
        }

        static int[] GetInput_int()
        {
            var input = GetInput_string();
            var result = new int[input.Length];
            for (int i = 0; i < result.Length; i++)
            {
                result[i] = int.Parse(input[i]);
            }
            return result;
        }
        static long[] GetInput_long()
        {
            var input = GetInput_string();
            var result = new long[input.Length];
            for (int i = 0; i < result.Length; i++)
            {
                result[i] = long.Parse(input[i]);
            }
            return result;
        }
        #endregion
        #region sonota
        static void Swap_array<T>(T[] target, int a, int b)
        {
            T temp = target[a];
            target[a] = target[b];
            target[b] = temp;
        }
        static void Swap_list<T>(List<T> target, int a, int b)
        {
            T temp = target[a];
            target[a] = target[b];
            target[b] = temp;
        }
        #endregion
    }
}


Measured memory_bytes: 13280
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    string str;
    cin >> str;
    transform(str.begin(),str.end(),str.begin(),::tolower);
     
    int count=0;
    while(1){
        string tmp;
        cin>>tmp;
        if(tmp=="END_OF_TEXT") break;
        transform(tmp.begin(),tmp.end(),tmp.begin(),::tolower);
        if(str==tmp) count++;
    }
    cout <<count<<endl;
    
}


Measured memory_bytes: 3220
# encoding: utf-8
N = int(input())

tab = [0] * (N + 1)

for i in range(2, N + 1):
    i_tmp = i
    for p in range(2, N + 1):
        if p < 2: break
        elif i_tmp % p > 0: continue
        for j_p in range(1, 32 + 1):
            if i_tmp % (p ** (j_p + 1)) > 0: break
        i_tmp = i_tmp // (p ** j_p)
        tab[p] += j_p

# print("#", tab)

ans = 1
for tab_i in tab:
    if tab_i < 1: continue
    else: ans = (ans * (tab_i + 1)) % (10 ** 9 + 7)

print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int ans = 0;
		for(int i = 0; i < a + 1; i++) {
			for(int j = 0; j < b + 1; j++) {
				for(int k = 0; k < c + 1; k++) {
					int tmp = 50 * k + 100 * j + 500 * i;
					if(tmp > x)
						break;
					else if(tmp == x)
						ans++;
				}
			}
		}
		System.out.println(ans);
	}
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n,k;
    cin>>n>>k;
    Vec h(n);
    rep(i,n)cin>>h[i];
    sort(ALL(h));
    ll ans = INF;
    rep(i,n){
        if(i+k-1>=n)continue;
        chmin(ans,h[i+k-1]-h[i]);
    }
    cout<<ans<<endl;
    return  0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

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

int main() {
  int H, W;
  char s[51][51];
  cin >> H >> W;
  rep(i, H) rep(j, W) cin >> s[i][j];
  bool can = true;

  rep(i, H) rep(j, W) {
    if (s[i][j] == '.') continue;
    int cnt = 0;
    rep(k, 4) {
      int nx = i + dx[k], ny = j + dy[k];
      if (0 <= nx && nx < H && 0 <= ny && ny < W) {
        if (s[nx][ny] == '.') cnt++;
      }
    }
    if (cnt == 4) can = false;
  }

  string res = (can) ? "Yes" : "No";
  cout << res << endl;
}

Measured memory_bytes: 256
X, Y = map(int, input().split())
mod = int(1e+9 + 7)
n = mod - 2
x, y = (2 * X - Y) // 3, (- X + 2 * Y) // 3

ax = []
while n != 0:
    ax = [n % 2] + ax[:]
    n //= 2
S = 0
if (2 * X - Y) % 3 != 0 or (-X + 2 * Y) % 3 != 0:
    S = 0
elif X > 2 * Y or Y > 2 * X:
  S = 0
else:
    A = [1]
    for i in range(x+y):
        A.append(((i + 1) * A[i]) % mod)
    inv = [1, 1]
    for i in range(len(ax)):
        if ax[i] == 1:
            inv[0] *= A[x]
            inv[1] *= A[y]
            inv[0] %= mod
            inv[1] %= mod
        if i != len(ax) - 1:
            inv[0] *= inv[0] % mod
            inv[0] %= mod
            inv[1] *= inv[1] % mod
            inv[1] %= mod
    S = (inv[0] * inv[1] * A[x+y]) % mod
print(S)

Measured memory_bytes: 29484
<?php 
    fscanf(STDIN, "%d %d", $summer_vacation, $homework_sum);
    $list = explode(" ",trim(fgets(STDIN)));

    $spend_homework = array_sum($list);
    $remaining = $summer_vacation - $spend_homework;
    
    if($summer_vacation < $spend_homework) {
        echo "-1";
    } else {
        echo $remaining;
    }

Measured memory_bytes: 16792
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    cout<<(n+1)/2<<endl;
}

Measured memory_bytes: 3640
N,K = [int(x) for x in input().split()]
V = [int(x) for x in input().split()]
#%%
dp = [[0 for _ in range(N+1)]for _ in range(N+1)]
ans = -10**10
for i in range(N+1):
    for j in range(N+1):
        if(i+j>min(K,N)): continue
        li = []
        if(j!=0):
            li = V[:i]+V[-j:]
        else:
            li = V[:i]
        cnt = 0
        li.sort()
        for x in li:
            if(x<0):
                cnt+=1
            else:
                break
        if(min(cnt,K-(i+j))<0):
            print('aaa')
        dp[i][j] = sum(li[min(cnt,K-(i+j)):])
        ans = max(ans,sum(li[min(cnt,K-(i+j)):]))

print(ans)

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int func(int N)
{
        if (N < 10)
                return N;
        return func(N / 10) + N % 10;
}

int main()
{
        int N, ans = 1000;
        cin >> N;
        rep2(i, 1, N)
        {
                int A = N - i, B = i;
                int tmp = func(A) + func(B);
                ans = min(ans, tmp);
        }
        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
a,b,c,d = [int(i) for i in input().split()]
if b > 0 and d > 0:
    print(max(b*d, a*c))
elif a < 0 and c < 0:
    print(max(b*d, a*c))
else:
    print(max(a*d, b*c))

Measured memory_bytes: 9176
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int modPow(ll a, ll n, ll p) { //繰り返し二乗法 a**n % p
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}
int main(){
  int len = 100100;
  vector<ll> fact(len), invfact(len);
  fact[0] = fact[1] = 1;
  for(int i = 2; i < len; i++) fact[i] = (fact[i - 1] * i) % mod;
  invfact[len - 1] = modPow(fact[len - 1], mod - 2, mod);
  for(ll i = len - 2; i >= 0; i--) invfact[i] = (invfact[i + 1] * (i + 1)) % mod;
  int n,m;
  cin >> n >> m;
  map<int, int> sosu;
  for(int i = 2; i * i <= m; i++){
    while(m % i == 0){
      m /= i;
      sosu[i]++;
    }
  }
  if(m > 1) sosu[m]++;
  ll ans = 1;
  for(auto a : sosu){
    int x = a.second;
    ans *= fact[x + n - 1] * (invfact[x] * invfact[n - 1] % mod) % mod;
    ans %= mod;
  }
  cout << ans << endl;
}

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

using namespace std;

int main(){
	int n, m, l;
	cin >> n >> m >> l;
	
	vector<vector<int> > A(n, vector<int>(m));
	vector<vector<int> > B(m, vector<int>(l));
	vector<vector<long long> > C(n, vector<long long>(l,0));
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> A.at(i).at(j);
		}
	}
	
	for(int i = 0; i < m; i++){
		for(int j = 0; j < l; j++){
			cin >> B.at(i).at(j);
		}
	}
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
			for(int k = 0; k < m; k++){
				C.at(i).at(j) += A.at(i).at(k) * B.at(k).at(j);
			}
			cout << C.at(i).at(j);
			if(j != l-1) cout << " ";
			else cout << endl;
		}
	}
	
}



Measured memory_bytes: 3276
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

vector<int> dx = {-1, -1, -1, 0, 1, 1, 1, 0};
vector<int> dy = {-1, 0, 1, 1, 1, 0, -1, -1}; 
int w, h;
int seen[55][55];

void dfs(const Graph &G, int x, int y){
    seen[y][x] = 1;
    for(int i = 0; i < 8; i++){
        if(x + dx[i] < 0 || x + dx[i] >= w || y + dy[i] < 0 || y + dy[i] >= h || G[y + dy[i]][x + dx[i]] == 0) continue;
        if(seen[y + dy[i]][x + dx[i]] == 1) continue;
        dfs(G, x + dx[i], y + dy[i]);
    }
}

int main(){
    while(true){
        cin >> w >> h;
        if(w == 0 && h == 0) break;
        Graph G(h);
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                int k; cin >> k;
                G[i].push_back(k);
            }
        }
        for(int i = 0; i < 55; i++){
          for(int j = 0; j < 55; j++){
            seen[i][j] = 0;
          }
        }
        int cnt = 0; 
        for(int l = 0; l < h; l++){
            for(int m = 0; m < w; m++){
                if(G[l][m] == 1 && seen[l][m] == 0){
                    dfs(G, m, l);
                    cnt++;
                }
            }
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 3276
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
using ll = long long;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//動的計画法で役に立つ関数
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; }

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {
    if(b==0)return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a/g*b;
}

vector<vector<long long> > comb(int n) {
  vector<vector<long long> > v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int X; cin >> X;
    cout << 48 - X << endl;
  
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#define INF 1000000007
using namespace std;
using P = pair<int, int>;
using ll = long long;
int main(){
    int n;
    cin>>n;
    cout<<3*n*n<<endl;
    return 0;
}


Measured memory_bytes: 256
// Distance II
// ミンコフスキー距離
// ITP1_10_D

package main

import (
	"fmt"
	"math"
)

/*
x	: xベクトル
y	: yベクトル
n	: n次元
p	: ミンコフスキー距離の次数
*/
func minkof(x [100]int, y [100]int, n int, p int) float64 {
	var sum float64
	var dxy float64

	for i := 0; i < n; i++ {
		sum += math.Pow(math.Abs(float64(x[i]-y[i])), float64(p))
	}

	dxy = math.Pow(sum, 1.0/float64(p))

	return dxy
}

/*
p = ∞のときのミンコフスキー距離を求める
*/
func minkof_inf(x [100]int, y [100]int, n int) float64 {
	dxy := -1.0

	for i := 0; i < n; i++ {
		d := math.Abs(float64(x[i] - y[i]))
		if d > dxy {
			dxy = d
		}
	}

	return float64(dxy)
}

func main() {
	var n int
	var x, y [100]int

	fmt.Scanf("%d", &n)
	// fmt.Printf("n = %d\n", n)

	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &x[i])
	}

	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &y[i])
	}

	fmt.Printf("%.6f\n", minkof(x, y, n, 1))
	fmt.Printf("%.6f\n", minkof(x, y, n, 2))
	fmt.Printf("%.6f\n", minkof(x, y, n, 3))
	fmt.Printf("%.6f\n", minkof_inf(x, y, n))
}


Measured memory_bytes: 1212
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  map<int, int> cnt;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    cnt[a]++;
  }
  auto yes = [] () { puts("Yes"); exit(0); };
  auto no = [] () { puts("No"); exit(0); };
  if ((int) cnt.size() == 1 && cnt.begin()->first == 0) yes();
  if (n % 3 != 0) no();
  if ((int) cnt.size() > 3 || (int) cnt.size() == 1) no();
  if ((int) cnt.size() == 2) {
    if (cnt[0] == n / 3) yes();
    else no();
  }
  if ((int) cnt.size() == 3) {
    bool ok = true;
    int res = 0;
    for (auto i : cnt) {
      ok &= i.second == n / 3;
      res ^= i.first;
    }
    ok && !res ? yes() : no();
  }
  return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define per(i, a, b) for (int i = (a); i >= int(b); i--)
using namespace std;

typedef long long ll;
const int maxn = 5000, mod = 1e9 + 7;
int n, A, B, f[maxn + 5], g[maxn + 5], h[maxn + 5];

int qpow(int a, int b) {
	int c = 1;
	for (; b; b >>= 1, a = 1ll * a * a % mod) if (b & 1) c = 1ll * a * c % mod;
	return c;
}

inline int chk_mod(int x) { return x < mod ? x : x - mod; }
inline void mod_add(int &x, int y) { x += y, x < mod ? 0 : x -= mod; }
inline void mod_add(int &x, ll y) { x = (x + y) % mod; }

int F1(int x) { return f[x - 1]; }
int F2(int x) { return x == 1 ? 1 : f[x - 2]; }

int main() {
	scanf("%d %d %d", &n, &A, &B);
	if (A > B) swap(A, B);
	if (A == 1) printf("%d\n", qpow(2, n)), exit(0);
	f[0] = 1;
	rep(i, 1, B - 1) {
		f[i] = f[i - 1];
		if (i >= A) mod_add(f[i], 1);
		rep(j, A, i - 1) mod_add(f[i], f[i - j - 1]);
	}
	g[0] = h[0] = 1;
	rep(i, 1, n) {
		rep(j, 1, min(i, A - 1)) mod_add(g[i], h[i - j]);
		if (i < B) h[i] = F1(i);
		rep(j, 1, min(i - 1, B - 1)) mod_add(h[i], 1ll * g[i - j] * (i == n ? F1(j) : F2(j)));
	}
	int res = qpow(2, n);
	mod_add(res, mod - chk_mod(g[n] + h[n]));
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 3872
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<i32>();
    let (n, m) = (line[0], line[1]);

    println!("{}", cmp::max(n*(n-1)/2, 0) + cmp::max(m*(m-1)/2, 0));
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	char c=getchar();
	int f=0;
	while(!isdigit(c))
	{
		f|=(c=='-');
		c=getchar();
	}
	int x=0;
	while(isdigit(c))
	{
		x=(x<<3)+(x<<1)+(c^48);
		c=getchar();
	}
	return f?-x:x;
}
int a,b;
int sum=1;
int main()
{
	a=read(),b=read();
	if(a<=0&&b>=0)
	{
		cout<<"Zero"<<endl;
	}
	else if(a>0)
	{
		cout<<"Positive"<<endl;
	}
	else if(b<0)
	{
		if((b-a+1)&1==1)
		{
			cout<<"Negative"<<endl;
		}
		else
		{
			cout<<"Positive"<<endl;
		}
	}
	return 0;
}

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

typedef long long ll;

void solve_142D();
ll GetGCD_ll(ll a, ll b); // ll な 最大公約数取得関数
int GetNumFactors(ll n); // 素因数の数を数える

ll A, B; // 入力の２数字, 制約：A, B <= 10^12 なので ll

void solve_142D()
{
  ll gcd = GetGCD_ll(A, B);
  int numFactors = GetNumFactors(gcd);
  printf("%d\n", numFactors + 1);
}

ll GetGCD_ll(ll a, ll b)
// ll な 最大公約数取得関数
{
  ll swap_tmp;
  if (a < b){ // 下の計算のために a > b にしておく
    swap_tmp = a; a = b; b = swap_tmp;
  }

  // ユークリッドの互除法により GDC を求める
  ll remainder = a % b;
  while (remainder != 0L){
    a = b; b = remainder; remainder = a % b;
  }
  return b;
}

int GetNumFactors(ll n)
// 素因数の数を数える
// 戻り値：素因数の数
// 内容や何乗かといった情報は返さない
{
  if (n == 1) return 0; // GDC が 1 の場合は 0 を返して終了

  int numFactors = 0;
  if (n % 2 == 0){ // 偶数の場合は numFactors を 1 にして 2 で割れるだけ割る
    numFactors = 1;
    while (1){
      n /= 2;
      if (n % 2 != 0) break;
    }
  }

  for (ll divisor = 2; divisor * divisor <= n; ++divisor){
    if (n % divisor == 0){ // divisor で割れる場合は numFactors を +1 して divisor で割れるだけ割る
      ++numFactors;
      while (1){
        n /= divisor;
        if (n % divisor != 0) break;
      }
    }
  }
  if (n > 2) // divisor * divisor の比較にして落ちてしまう分を追加；ツイッターで教えてもらっちゃいました（競技終了後）
    numFactors++;
  return numFactors;
}

int main()
{
  scanf("%lld %lld", &A, &B);

  solve_142D();

  return 0;
}


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

const int INF = 1 << 10;


const int MAX_H = (int)50 + 5;
const int MAX_W = (int)50 + 5;

typedef pair<int, int> P;


int h, w;

char s[MAX_H][MAX_W];

int wnum;

int sx, sy; // start
int gx, gy; // goal

int d[MAX_H][MAX_W];

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

int bfs() {
  queue<P> que;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      d[i][j] = INF;
    }
  }

  que.push(P(sx, sy));
  d[sx][sy] = 0;

  while (que.size()) {
    P p = que.front(); que.pop();
    if (p.first == gx && p.second == gy) break;

    for (int i = 0; i < 4; ++i) {
      int nx = p.first + dx[i], ny = p.second + dy[i];
      if (0 <= nx && nx < h && 0 <= ny && ny < w && s[nx][ny] != '#' && d[nx][ny] == INF) {
        que.push(P(nx, ny));
        d[nx][ny] = d[p.first][p.second] + 1;
      }
    }
  }
  return d[gx][gy];
}

int main(void) {
  // Here your code !
	scanf("%d %d", &h ,&w);
	for (int i = 0; i < h; ++i) {
		scanf("%s", &(s[i]));
	}

	for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) {
		if (s[i][j] == '.') {wnum += 1;}
	}

	sx = 0;
	sy = 0;
	gx = h - 1;
	gy = w - 1;

	int ans = bfs();

	if (ans == INF) printf("%d\n", -1);
	else printf("%d\n", wnum - ans - 1);

	return 0;

}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Stack;

public class Main {

	public static int Oper(ArrayList<String> in) {
		String operators = "+-*/";
		Stack<String> stack = new Stack<String>();
		for (int i = 0; i < in.size(); i++) {
			if (!operators.contains(in.get(i))) {
				stack.push(in.get(i));
			} else {
				int y = Integer.parseInt(stack.pop());
				int x= Integer.parseInt(stack.pop());
				int action = operators.indexOf(in.get(i));
				if (action == 0) {
					stack.push(String.valueOf(x+y));
				} else if (action == 1) {
					stack.push(String.valueOf(x-y));
				} else if (action == 2) {
					stack.push(String.valueOf(x*y));
				} else if (action == 3) {
					stack.push(String.valueOf(x/y));
				}
			}
		}
		return Integer.parseInt(stack.pop());
		
	
	}
	public static void main(String[] args) {
		Scanner scan= new Scanner(System.in);
		ArrayList<String> ARRRAY = new ArrayList<>();
		while (scan.hasNext()) {
			ARRRAY.add(scan.next().trim());
		}
		
		System.out.println(Oper(ARRRAY));
		scan.close();
	}

}


Measured memory_bytes: 26428
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

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

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)

int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    ll a[5];
    for(i=0;i<5;i++)
        cin>>a[i];
    for(i=0;i<5;i++)
    {
        if(a[i]==0)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 3560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#define N 2001000
typedef long long ll;
template<typename T> inline void read(T &x) {
  x = 0; char c = getchar(); bool flag = false;
  while (!isdigit(c)) { if (c == '-') flag = true; c = getchar(); }
  while (isdigit(c)) { x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); }
  if (flag) x = -x;
}
using namespace std;
const int P = 1e9 + 7;
int X1, X2, X3, X4, X5, X6;
int Y1, Y2, Y3, Y4, Y5, Y6;
ll jie[N], jieni[N];
inline ll quickpow(ll x, int k) {
  ll res = 1;
  while (k) {
    if (k & 1)  res = res * x % P;
    x = x * x % P;
    k >>= 1;
  }
  return res;
}

inline void init() {
  int up = X6 + Y6;
  jie[0] = jieni[0] = 1;
  for (int i = 1; i <= up; ++i) jie[i] = jie[i - 1] * i % P;
  jieni[up] = quickpow(jie[up], P - 2);
  for (int i = up - 1; i; --i)  jieni[i] = jieni[i + 1] * (i + 1) % P;
}
inline ll get_c(int n, int m) {
  return jie[n] * jieni[m] % P * jieni[n - m] % P;
}
inline ll G(int sx, int sy, int fx, int fy) {
  int x = fx - sx, y = fy - sy;
  return get_c(x + y, x);
}

inline void work() {
  int dx[8] = {X1 - 1, X1 - 1, X2, X2, X5, X5, X6 + 1, X6 + 1};
  int dy[8] = {Y1 - 1, Y2, Y1 - 1, Y2, Y5, Y6 + 1, Y5, Y6 + 1};
  int tp[8] = {1, -1, -1, 1, 1, -1, -1, 1};
  ll ans = 0;
  for (int jzp = 0; jzp < 4; ++jzp) {
    int sx = dx[jzp], sy = dy[jzp];
    for (int zzz = 4; zzz < 8; ++zzz) {
      int fx = dx[zzz], fy = dy[zzz];
      ll res = 0;
      int ntp = tp[jzp] * tp[zzz];
      int x, y;
      for (x = X3, y = Y3; x <= X4; ++x) {
        res = (res - G(sx, sy, x, y - 1) * G(x, y, fx, fy) % P * (x + y)) % P;
      }
      for (x = X3, y = Y3; y <= Y4; ++y) {
        res = (res - G(sx, sy, x - 1, y) * G(x, y, fx, fy) % P * (x + y)) % P;
      }
      for (x = X3, y = Y4; x <= X4; ++x) {
        res = (res + G(sx, sy, x, y) * G(x, y + 1, fx, fy) % P * (x + y + 1)) % P;
      }
      for (x = X4, y = Y3; y <= Y4; ++y) {
        res = (res + G(sx, sy, x, y) * G(x + 1, y, fx, fy) % P * (x + y + 1)) % P;
      }
      ans = (ans + ntp * res) % P;
    }
  }
  printf("%lld\n", (ans % P + P) % P);
}

int main() {
  read(Y1), read(Y2), read(Y3), read(Y4), read(Y5), read(Y6);
  read(X1), read(X2), read(X3), read(X4), read(X5), read(X6);
  init();
  work();
  return 0;
}


Measured memory_bytes: 34484
#include<iostream>
#include<vector>
#include<string>
using namespace std;
string s;
int n;
bool pls[32];
long long ans,nans;
void dfs(int cur){
	if(cur==n-1){
		nans++;
		long long now=0;
//		for(int i=0;i<n-1;i++) cout<<pls[i]<<" ";
//		cout<<endl; 
		for(int i=0;i<n;i++){
//			cout<<pls[i]<<" ";
			now=now*10+s[i]-'0';
			if(pls[i]){
//				ve.push_back(now);
//				cout<<now<<" ";
				ans+=now;
				now=0;
			}
		}
//		cout<<now<<endl;
		ans+=now;
//		cout<<endl;
//		ve.push_back(now);
//		for(int i=0;i<ve.size();i++) ans+=ve[i]; 
		return;
	}
	pls[cur]=0;
	dfs(cur+1);
	pls[cur]=1;
	dfs(cur+1);
}
int main(){
	cin>>s;
	n=s.size();
	dfs(0);
//	cout<<nans<<" "<<ans<<endl;
	cout<<ans<<endl;
	return 0; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    // #include <ext/pb_ds/assoc_container.hpp>
    using namespace std;
    // using namespace _gnu_pbds;
    #define vb __int128
    #define ll long long
    #define ld long double
    #define full(a) a.begin(),a.end()
    #define fr(i,a,b) for(ll i = a ; i < b ; i++)
    #define stoink stack<ll>
    #define quu queue<ll>
    #define quee queue<pair<ll,ll>>
    #define vec vector <ll>
    #define vecd vector<ld>
    #define vg vector<vector<ll> >
    #define eg vector<pair<ll,ll>>
    #define vgw vector<vector<pair<ll,ll> > >
    #define pa pair<ll,ll>
    #define pb push_back
    #define ff first
    #define ss second
    #define pre 0.00000000000000000001
    #define inf 100000000
    #define mod 998244353
    #define endl '\n'
    ll n;
    ll arr[20][20];
    ll val[1 << 20];
    ll dp[1 << 20];
    ll timer = 0;
    ll func(ll mask) {
        if(mask == (1 << n) - 1) {
            return 0;
        }
        if(dp[mask] != -1)
            return dp[mask];
        ll ans = 0;
        ll cnt = 0;
        vec available;
        fr(i,0,n) {
            if(!(mask & (1 << i))) {
                cnt++;
                available.pb(i);
            } 
        }
        for(ll bitmask = 1;bitmask < (1 << cnt) ; bitmask++) {
            ll temp = 0;
            fr(i,0,cnt) {
                if(bitmask & 1 << i) {
                    temp |= (1 << available[i]);
                }
            }
            ans = max(ans,func(mask | temp) + val[temp]);
        }
        return dp[mask] = ans;
    }
    int main()
    {	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
    	cout.tie(NULL);
        memset(dp, -1, sizeof(dp));
        cin >> n;
        fr(i,0,n) fr(j,0,n) cin >> arr[i][j];
        val[0] = 0;
        for(ll mask = 1; mask < (1 << n) ; mask++) {
            vec setbits;
            fr(i,0,n) {
                if((1 << i) & mask) {
                    setbits.pb(i);
                }
            }
            ll res = 0;
            for(int i = 0 ; i < setbits.size() - 1; i++) {
                for(int j = i + 1 ; j < setbits.size() ; j++) {
                    res += arr[setbits[i]][setbits[j]]; 
                }
            }
            val[mask] = res;
        }
        ll ans = 0;
        for(int mask = 1 ; mask < 1 << n ; mask++) {
            ans = max(ans,val[mask] + func(mask));
        }
        cout << ans;
        return 0;
    }	

Measured memory_bytes: 12348
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    ll t1, t2, a1, a2, b1, b2;
    cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;

    a1 *= t1; a2 *= t2;
    b1 *= t1; b2 *= t2;
    a2 += a1;
    b2 += b1;

    if(a2 == b2) {
        cout << "infinity" << endl;
        return 0;
    }

    if(a2 < b2) {
        swap(a1,b1);
        swap(a2,b2);
    }
    
    ll d = a2 - b2;
    ll c = b1 - a1;
    ll ans = 0;
    if(c > 0) {
        ans = (c-1)/d+1;
        ans *= 2;
        ans--;
        if(c%d == 0) {
            ans++;
        } 
    }

    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){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;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
void ppp(T n){cout << n << endl;}
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) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;


int cnt(string s){
    int ans = 0;
    int x = 0;
    for(auto c : s){
        if(c == 'A') ++x;
        else {
            ans += x;
        }
    }
    return ans;
}

int main(){

    string s;
    cin >> s;
    int n = s.size();
    if(n <= 2) {
        ppp(0);
        return 0;
    }

    int a = 0;
    ll ans = 0ll;

    string t = "";
    rep(i, n){
        if(s.substr(i, 2) == "BC"){
            t += 'D'; ++i;
        }
        else t += s[i];
    }

    rep(i, t.size()){
        if(t[i] == 'A') ++a;
        else if(t[i] == 'D') ans += a;
        else a = 0;
    }
    ppp(ans);

    return 0;
}


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

#define rep(i,n) for(int i = 0;i<n;i++)
#define cint(a) int a; cin >> a;
#define cstr(str) string str; cin >> str;


using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main(void) {

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

	long double L;
	cin >> L;
	printf("%.12Le\n", pow(L / 3.0, 3.0));
	
	return 0;
}


Measured memory_bytes: 3872
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  int H,W;
  cin>>H>>W;
  
  REP(i,H){
    REP(j,W){
      string S;
      cin>>S;
      if(S=="snuke") cout<<char(j+'A')<<i+1<<endl;
    }
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
int main()
{ 
  int an;
  int legs;
  cin>>an>>legs;
  int a = (legs - 2*an)/2;
  int b = (4*an - legs)/2;

  if(  a  + b == an && a >= 0 && b >= 0){cout<<"Yes";}
  else{cout<<"No";}

}

Measured memory_bytes: 3632
#include <iostream>
#include<cmath>
#include<vector>
#include<tuple>
#include <ctime>
#include<algorithm>
#include <initializer_list>
#include <cstring> 
#include <queue>
 
#define tii tuple<int,int>
#define vi vector<int>
#define vii vector<vi>
#define ll long long
#define vl vector<ll>
#define vll vector<vl>
 
#define mymod 1000000007
#define mx 99999999
#define mn -99999999
#define sz 101
 
using namespace std;
int n,k;
vi v;
int main() {
    clock_t tstart = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // Start
    cin>>n>>k;
    vi vec(10,1);
    int x;
    for(int i=0;i<k;i++) cin>>x, vec[x] = 0;
    
    v.clear();
    for(int i=0;i<10;i++) if(vec[i])v.push_back(i);
    k = v.size();
    int ans = 0;
    queue<int> q;
    q.push(0);
    while(n>ans) {
        ans = q.front();
        for(auto x:v) q.push(ans*10 + x);
        q.pop();
    }
    cout<<ans;
    // cout<<"\n\nTotal Time Taken : "<<(double)(-tstart + clock())/CLOCKS_PER_SEC<<"sec\n\n";
    return 0;
}
 


Measured memory_bytes: 3740
#include <stdio.h>
int main(void) {
    int rank[100][3]={0},num,point,i,j,temp,n=0;
    while (1) {
        scanf("%d,%d",&num,&point);
        if(num==0&&point==0) break;
        rank[n][0]=num;
        rank[n][1]=point;
        n++;
    }
    for (i=0; i<n; i++) {
        for (j=0; j<n-i-1; j++) {
            if (rank[j][1]<rank[j+1][1]) {
                temp=rank[j][1];
                rank[j][1]=rank[j+1][1];
                rank[j+1][1]=temp;
                temp=rank[j][0];
                rank[j][0]=rank[j+1][0];
                rank[j+1][0]=temp;
            }
        }
    }
    for (i=0; i<n; i++) {
        if (i==0) {
            rank[i][2]=1;
        } else if (rank[i][1]==rank[i-1][1]) {
            rank[i][2]=rank[i-1][2];
        } else {
            rank[i][2]=rank[i-1][2]+1;
        }
    }
    while (scanf("%d",&num)!=EOF) {
        for (i=0; ; i++) {
            if (rank[i][0]==num) {
                printf("%d\n",rank[i][2]);
                break;
            }
        }
    }
    return 0;
}

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int n;
int p[55];
int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cin >> n;

    for (int i = 0; i < n; ++i)
        std::cin >> p[i];

    bool ans = true;
    int before = 0;
    for (int i = 0; i < n; ++i) {
        if (p[i] < before) {
            ans = false;
            break;
        }
        before = p[i];
    }
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j) {
            bool ok = true;
            int before = 0;

            if (ans)
                break;

            for (int k = 0; k < n; ++k) {
                auto num = p[k];
                if (k == i)
                    num = p[j];
                else if (k == j)
                    num = p[i];

                if (num < before) {
                    ok = false;
                    break;
                }

                before = num;
            }

            if (ok) {
                ans = true;
                break;
            }
        }

    if (ans)
        std::cout << "YES" << std::endl;
    else
        std::cout << "NO" << std::endl;

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
zeta = a[: ]
zeta2 = [0] * (1 << N)
for i in range(N):
  for j in range(1 << N):
    if (1 << i) & j:
      if zeta[j] < zeta[(1 << i) ^ j]:
        zeta2[j] = max(zeta[j], zeta2[(1 << i) ^ j])
        zeta[j] = zeta[(1 << i) ^ j]
      elif zeta2[j] < zeta[(1 << i) ^ j]:
        zeta2[j] = zeta[(1 << i) ^ j]

res = 0
for i in range(1, 1 << N):
  res = max(res, zeta[i] + zeta2[i])
  print(res)

Measured memory_bytes: 103756
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=2e5;

int n,m;
int num[N+3];

int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) scanf("%d",&num[i]);
    sort(num+1,num+1+n);
    long long ans=0;
    for(int i=1;i<=n-m;i++)
        ans+=num[i];
    printf("%lld\n",ans);
    return 0;
}


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

using namespace std;
typedef long long ll;

int main(){
  ll N;
  cin >> N;
  ll time[5];
  for(int i=0;i<5;i++){
    cin >> time[i];
  }
  sort(time,time+5);
  ll ans = 0;
  if(N%time[0]!=0) ans = N/time[0]+5;
  else ans = N/time[0] + 4;
  cout << ans << endl;
}


Measured memory_bytes: 3156
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll ans=0;
  int N;
  cin >> N;
  string s;
  string p;
  set<string> T;
  REP(i,N){
    cin >> s;
    T.insert(s);
    if(i!=0 && s[0]!=p[p.size()-1]){
        cout << "No" << endl;
        return 0;
    }
    p=s;
  }
  if(T.size()==N){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
let (>>=) xs f = List.map f xs |> List.concat
let rec replicate_m n xs =
  if n <= 0 then [[]]
  else xs >>= fun x -> List.map (fun y -> x::y) (replicate_m (n-1) xs)

let is_753 =
  let rec aux a b c x =
    if x <= 0 then a && b && c
    else
      match x mod 10 with
      | 3 -> aux true b c (x/10)
      | 5 -> aux a true c (x/10)
      | 7 -> aux a b true (x/10)
      | _ -> false
  in aux false false false

let () =
  Scanf.scanf "%d" @@ fun n ->
  replicate_m 9 [0; 3; 5; 7]
  |> List.fold_left (fun s xs ->
    let v = List.fold_left (fun a b -> 10*a + b) 0 xs in
    if v <= n && is_753 v then s+1 else s) 0
  |> Printf.printf "%d\n"


Measured memory_bytes: 78456
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int q;
    cin >> q;
    vector<int> b(q), c(q);
    for (int i = 0; i < q; i++)
        cin >> b[i] >> c[i];
    
    map<int, int> mp;
    for (int i = 0; i <= 100000; i++)
        mp[i] = 0;
    for (int i = 0; i < n; i++)
        mp[a[i]]++;
    
    ll s = 0;
    for (int i = 0; i < n; i++)
        s += a[i];
    
    for (int i = 0; i < q; i++) {
        int num = mp[b[i]];
        s += (ll)(c[i] - b[i]) * num;
        mp[b[i]] = 0;
        mp[c[i]] += num;
        cout << s << endl;
    }
    
    return 0;
}


Measured memory_bytes: 8984