akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::map;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  string S{}, T{}; cin >> S >> T;
  auto num = 'z' - 'a' + 1;
  constexpr char kAlpha = 'a';
  vector<ui> vs(num), vt(num);
  for(const auto& c : S) ++vs[c - kAlpha];
  for(const auto& c : T) ++vt[c - kAlpha];

  boost::sort(vs);
  boost::sort(vt);

  ui res{true};
  for(size_t index = 0; index < num; ++index)
  {
    res &= vs[index] == vt[index];
    if(!res) break;
  }

  cout << (res ? "Yes" : "No") << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 916
#include <iostream>
#include <cstdio>
#include <vector>
#include <deque>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <string>

using namespace std;

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)

int main(){
    int A[3];
    int modsum=0;
    int cnt = 0;

    scanf("%d %d %d",&A[0],&A[1],&A[2]);

    REPI(3){
        modsum+=A[i]%2;
    }

    if(modsum==1){
        REPI(3){
            if(A[i]%2==0)
                A[i]++;            
        }
        cnt++;
    }else if(modsum==2){
        REPI(3){
            if(A[i]%2==1)
                A[i]++;
        }
        cnt++;
    }
    
    int max = 0;

    REPI(3){
        if(max<A[i])
            max = A[i];
    }

    
    REPI(3){
        cnt += (max-A[i])/2;
    }

    printf("%d\n",cnt);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const int N = 1e6;
P ab[N];
#define A first
#define B second
int main(){
    ll n,m;
    while(cin>>n>>m){
        for(int i = 0;i<n;i++){
            cin>>ab[i].A>>ab[i].B;
        }
        sort(ab, ab+n);
        ll ans = 0;
        int i = 0;
        while(m>0){
            int mm = min(m , ab[i].B);
            ans += mm * ab[i].A;
            m -= mm;
            i++;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, const T& t){ return v2<T>(r, vector<T>(c, t)); }
#define F first
#define S second

void solve(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> r(n), g(n), b(n);
    r[0] = (s[0]=='R');
    for(int i = 1; i < n; ++i) r[i] = r[i-1]+(s[i]=='R');
    g[0] = (s[0]=='G');
    for(int i = 1; i < n; ++i) g[i] = g[i-1]+(s[i]=='G');
    b[0] = (s[0]=='B');
    for(int i = 1; i < n; ++i) b[i] = b[i-1]+(s[i]=='B');

    ll ans = 0;
    for(int i = 0; i < n; ++i){
        for(int j = i+1; j < n; ++j){
            if((s[i]=='R' && s[j]=='G') || (s[i]=='G' && s[j]=='R')){
                ans += b[n-1]-b[j];
                if(2*j-i<n && s[2*j-i]=='B') --ans;
            }
            else if((s[i]=='R' && s[j]=='B') || (s[i]=='B' && s[j]=='R')){
                ans += g[n-1]-g[j];
                if(2*j-i<n && s[2*j-i]=='G') --ans;
            }
            else if((s[i]=='G' && s[j]=='B') || (s[i]=='B' && s[j]=='G')){
                ans += r[n-1]-r[j];
                if(2*j-i<n && s[2*j-i]=='R') --ans;
            }
        }
    }
    cout << ans << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 3708
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys
input = sys.stdin.readline
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

a,v = ip()
b,w = ip()
t = inp()
if a < b:
    if (a + v*t) >= (b + w*t):
        print("YES")
    else:
        print("NO")
else:
    if (a - v*t) <= (b - w*t):
        print("YES")
    else:
        print("NO")

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

int dp[22][(1<<22)];

int mod=1e9+7;

int matchin(vector<vector<int>> &compat,int i, int n,int womenSubset){

        if(i==n){
            if(womenSubset==0){
                return 1;

            }
            return 0;
        }

        if(dp[i][womenSubset]!=-1){
            return dp[i][womenSubset];
        }

        int ans=0;


        for(int k=0;k<n;k++){

            bool avail=(((1<<k)&(womenSubset))==0)?0:1;

            if(avail && compat[i][k]){
                ans=(ans+matchin(compat,i+1,n,womenSubset^(1<<k)))%mod;
            }


        }

        return dp[i][womenSubset]=ans;



}



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

    vector<vector<int>> compat(n,vector<int>(n));

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

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

    cout<<matchin(compat,0,n,(1<<n)-1);


}


Measured memory_bytes: 364056
N = int(input())
ori1 = [0 for x in  range(N)]
fini = 0
s = input()

init = [[1,1],[1,-1],[-1,1],[-1,-1]]


for it in init:
    flag = 0
    ori = ori1.copy()
    ori[0] = it[0]
    ori[1] = it[1]
    for i in range(N):
        if i == 0:
            continue
        if ori[i] == 1:
            if s[i] == "o":
                if i == N-1:
                    if ori[0] != ori[i-1]:
                        flag = 1

                else:
                    ori[i+1] = ori[i-1]
            else:
                if i == N-1:
                    if ori[0] != -ori[i-1]:
                        flag = 1
                else:
                    ori[i+1] = -ori[i-1]
        else:
            if s[i] == "x":
                if i == N-1:
                    if ori[0] != ori[i-1]:
                        flag = 1
                else:
                    ori[i+1] = ori[i-1]
            else:
                if i == N-1:
                    if ori[0] != -ori[i-1]:
                        flag = 1
                else:
                    ori[i+1] = -ori[i-1]
    if ori[0] == 1:
        if s[0] == "o":
            if ori[1] != ori[-1]:
                flag = 1
        else:
            if ori[1] == ori[-1]:
                flag = 1
    else:
        if s[0] == "x":
            if ori[1] != ori[-1]:
                flag = 1
        else:
            if ori[1] == ori[-1]:
                flag = 1

    if flag == 0:
        ori = ["S" if x == 1 else "W" for x in ori]
        out = ""
        for o in ori:
            out += o
        print(out)
        fini = 1
        break
    else:
        continue

if fini == 0:
    print(-1)

Measured memory_bytes: 6392
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

using namespace std;

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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep2(i, begin_i, end_i) for (int i = (int)begin_i; i < (int)end_i; i++)

long long INF = 1LL<<60;
long long dp[100010];
int h[100010];
int main(){

    int x,a,b,out;
    cin>>x>>a>>b;
    out=(x-a)%b;
    cout<<out<<endl;
    return 0;
}




Measured memory_bytes: 256
n, m = [int(i) for i in input().split()]
bulbs = []
for _ in range(m):
    bulbs.append([int(i) for i in input().split()][1:])

conds = [int(i) for i in input().split()]


def all_on(switches):
    for idx, bulb in enumerate(bulbs):
        switched = 0
        for s in bulb:
            switched = 1 - switched if s in switches else switched
        if switched != conds[idx]:
            return 0
    return 1


def count_all_right(curr_switches, pos):
    if pos == n - 1:
        return all_on(curr_switches) + all_on(curr_switches + [pos + 1])
    return count_all_right(curr_switches + [pos + 1], pos + 1) + count_all_right(
        curr_switches, pos + 1
    )


print(count_all_right([], 0))



Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
   int A,B;
   cin >> A>>B;
   int wa,sa,seki;
   wa = A+B;
   sa = A-B;
   seki = A*B;
   //int wasa = max(wa,sa);
   cout << max({wa,sa,seki}) << endl;
   return 0;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * d.cc: D - Digits Parade
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int K = 13;
const int MOD = 1000000007;

/* typedef */

/* global variables */

char s[MAX_N + 4];
int dp[2][K];

/* subroutines */

inline void addmod(int &a, int b) { a = (a + b) % MOD; }

/* main */

int main() {
  scanf("%s", s);

  dp[0][0] = 1;
  int cur = 0, nxt = 1;

  for (char *cpt = s; *cpt; cpt++) {
    memset(dp[nxt], 0, sizeof(dp[nxt]));

    if (*cpt != '?') {
      int d = *cpt - '0';
      for (int i = 0; i < K; i++)
	addmod(dp[nxt][(i * 10 + d) % K], dp[cur][i]);
    }
    else {
      for (int i = 0; i < K; i++)
	for (int d = 0; d <= 9; d++)
	  addmod(dp[nxt][(i * 10 + d) % K], dp[cur][i]);
    }

    cur ^= 1, nxt ^= 1;
  }

  printf("%d\n", dp[cur][5]);
  return 0;
}


Measured memory_bytes: 512
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

#include <bits/stdc++.h>
using namespace std;

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

int main() {
    int n = read();
    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= 9; ++j) {
            if (i * j == n) {
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define ucin() ios :: sync_with_stdio(0)
typedef vector<int> vi;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef long double ld;
typedef long long ll;
typedef double db;

const int N = 2e5 + 10;
int n;
ll k, a[N], b[N];
bool chk(ll mid) {
	ll cost = 0;
	for(int i = 1; i <= n; i ++) if(a[i] * b[i] > mid){
		ll x = (ll) ceil((a[i] * b[i] - mid) * 1.0 / b[i]);
		if((cost += x) > k) return 0;
	}
	return cost <= k;
}
int main() {
	ucin();
	cin >> n >> k;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	for(int i = 1; i <= n; i ++) cin >> b[i];
	sort(a + 1, a + n + 1);
	sort(b + 1, b + n + 1);
	reverse(b + 1, b + n + 1);
	ll l = 0, r = 1e13, mid, ans = -1;
	while(l <= r) {
		mid = (l + r) >> 1;
		if(chk(mid)) r = (ans = mid) - 1;
		else l = mid + 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
class Dice:
    def __init__(self, num_list):
        self.faces= num_list
        
    def find_rf(self,top,front):
        tf = str(self.faces.index(top)) + str(self.faces.index(front))
        if tf in '12431':
            return self.faces[0]
        elif tf in '03520':
            return self.faces[1]
        elif tf in '01540':
            return self.faces[2]
        elif tf in '04510':
            return self.faces[3]
        elif tf in '02530':
            return self.faces[4]
        else:
            return self.faces[5]


dice = Dice(tuple(map(int,input().split())))
q = int(input())

for i in range(q):
    top, front = map(int, input().split())
    right_face = dice.find_rf(top,front)
    print(right_face)


Measured memory_bytes: 5596
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))

A.sort()
F.sort(reverse=True)

def check(mid):
    cnt = 0
    for i in range(N):
        tmp = mid // F[i]
        cnt += max(A[i] - tmp, 0)
    return cnt <= K

check(2)

l, r = -1, 10**30
while r-l > 1:
    mid = (l+r)//2
    if check(mid):
        r = mid
    else:
        l = mid

print(r)


Measured memory_bytes: 114288
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int N, M;
P vec[100000];

int main(void){
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        vec[i] = make_pair(b, -1 * a);
    }

    sort(vec, vec + M);
    for(int i = 0; i < M; i++) vec[i].second *= -1;

    int pos = 0;
    int res = 0;
    for(int i = 0; i < M; i++){
        if(vec[i].second < pos + 1) continue;

        res++;
        pos = vec[i].first - 1;
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cctype>
using namespace std;
const int maxn=300005;
char str[maxn];
int n,w[maxn],e[maxn];
int main(){
	int ans=99999999;
	scanf("%d",&n);
	scanf("%s",str+1);
	for(register int i=1;i<=n;i++){
		if(str[i]=='E'){e[i]=e[i-1]+1;w[i]=w[i-1];}
		else {w[i]=w[i-1]+1;e[i]=e[i-1];}
	}
	for(register int i=1;i<=n;i++){
		ans=min(ans,w[i-1]+e[n]-e[i]);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int partition(int *a, int lo, int hi)
{
	int i, j, x, t;

	x = a[hi], i = lo-1;
	for (j = lo; j < hi; j++) {
		if (a[j] <= x) i++, t = a[i], a[i] = a[j], a[j] = t;
	}
	t = a[++i], a[i] = a[hi], a[hi] = t;
	return i;
}

int a[100002];

int main()
{
	int n, i, k;
	
	n = in(); for (i = 0; i < n; i++) a[i] = in();
	k = partition(a, 0, n-1);
	printf((!k? "[%d]": "%d"), a[0]);
	for (i = 1; i < n; i++) {
		putchar(' ');
		printf((k==i? "[%d]": "%d"), a[i]);
	}
	putchar('\n');
	return 0;
}


Measured memory_bytes: 2028
// ABC073A - September 9

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;

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

	if ((s[0] == '9')||(s[1] == '9')) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

template<class T, class Cond>
struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  bool operator()(T& a, const T& b) const {
    if(cond(a, b)) { a = b; return true; }
    return false;
  }
};
template<class T, class Cond>
chain<T, Cond> make_chain(Cond cond) { return chain<T, Cond>(cond); }

int main() {
  i64 K;
  cin >> K;
  vector<i64> Q(K + 9);
  rep(i,0,9) Q[i] = i + 1;
  i64 qi = 9;
  rep(i,0,K) {
    i64 n = Q[i] % 10;
    if(Q[i] % 10 != 0) {
      if(qi < K) Q[qi++] = Q[i] * 10 + n - 1;
    }
    if(qi < K) Q[qi++] = Q[i] * 10 + n;
    if(Q[i] % 10 != 9) {
      if(qi < K) Q[qi++] = Q[i] * 10 + n + 1;
    }
  }
  cout << Q[K - 1] << endl;
}


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

#define SQ(a) ((a)*(a))

struct Edge {
	int to;
	double cost;
	Edge(int to, double cost): to(to), cost(cost){}
};

struct State {
	int n;
	double sum;
	State(int n, int sum): n(n), sum(sum){}
	bool operator < (const State &t) const {
		return sum > t.sum;
	}
};

int x[1000], y[1000];
double d[1000];
int pre[1000];
vector<Edge> g[1000];

int btoi[1001];
int itob[1000];

vector<int> rec(int start, int goal)
{
	vector<int> res;
	for (int e = goal; e != -1; e = pre[e]){
		res.push_back(itob[e]);
	}
	reverse(res.begin(), res.end());
	if (res[0] != itob[start] || res[res.size() - 1] != itob[goal]){
		return vector<int>();
	}
	return res;
}

void solve(int start, int goal)
{
	fill(d, d + 1000, 1e50);
	memset(pre, -1, sizeof(pre));
	
	d[start] = 0.0;
	priority_queue<State> que;
	for (que.push(State(start, 0.0)); que.size(); que.pop()){
		State st = que.top();
		if (d[st.n] < st.sum) continue;
		for (int v = 0; v < g[st.n].size(); v++){
			Edge &e = g[st.n][v];
			if (d[e.to] < st.sum + e.cost) continue;
			d[e.to] = st.sum + e.cost;
			pre[e.to] = st.n;
			que.push(State(e.to, st.sum + e.cost));
		}
	}
	
	vector<int> route = rec(start, goal);
	if (route.size() == 0){
		puts("NA");
		return;
	}
	for (int i = 0; i < route.size(); i++){
		if (i) printf(" ");
		printf("%d", route[i]);
	}
	puts("");
}

int main()
{
	int n;
	while (scanf("%d", &n), n){
		for (int i = 0; i < n; i++) g[i].clear();
		for (int i = 0; i < n; i++){
			int b;
			scanf("%d", &b);
			btoi[b] = i;
			itob[i] = b;
			scanf("%d %d", &x[i], &y[i]);
		}
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				if (i == j) continue;
				double dist = sqrt(SQ(x[i] - x[j]) + SQ(y[i] - y[j]));
				if (dist > 50) continue;
				g[i].push_back(Edge(j, dist));
				g[j].push_back(Edge(i, dist));
			}
		}
		
		int m;
		scanf("%d", &m);
		for (int i = 0; i < m; i++){
			int start, goal;
			scanf("%d %d", &start, &goal);
			solve(btoi[start], btoi[goal]);
		}
	}
	
	return 0;
}

Measured memory_bytes: 1404
#include <bits/stdc++.h>
#include <unistd.h>
#include <random>

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end())
#define DOUBLECHANGE(count) cout << setprecision(count)
#define REV(vec) reverse(vec.begin(),vec.end())
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

long long int factorial(long long int a){
    long long int ans = 1;
    for(int i = 0;i < a;i++){
        ans *= i+1;
    }
    return ans;
}

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      int A, B;
      cin >> A >> B;
      if(A >= 13){
          cout << B << endl;
      }
      else if(A <= 5){
          cout << 0 << endl;
      }
      else{
          cout << B/2 << endl;
      }
}


Measured memory_bytes: 256
#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
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  /*
  int N;
  cin>>N;
  vector<int>w(N);
  for(int i=0;i<N;i++)cin>>w[i];
  */
  int P,Q,R;
  cin>>P>>Q>>R;
  int ans=INF;
  ans=min(ans,P+Q);
  ans=min(ans,R+Q);
  ans=min(ans,P+R);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main () {
  int a, b;
  scanf ("%d %d", &a, &b);

  if(a == 1 && b != 1){
    printf("Alice\n");
  } else if (a != 1 && b == 1) {
    printf("Bob\n");
  } else if (a == 1 && b == 1) {
    printf("Draw\n");
  } else if (a>b){
    printf("Alice\n");
  } else if (a<b){
    printf("Bob\n");
  } else if (a==b){
    printf("Draw\n");
  }

  return 0;
}


Measured memory_bytes: 128
#![allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

const INF: i64 = 1001001001001001001;

trait Monoid {
   fn unit() -> Self;
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
enum MaxInt {
   Minimal,
   Val(i64),
}
impl std::ops::Mul for MaxInt {
   type Output = Self;
   fn mul(self, other: Self) -> Self {
      if self > other {
         self
      } else {
         other
      }
   }
}
impl MaxInt {
   fn unwrap(self) -> i64 {
      if let Self::Val(x) = self {
         x
      } else {
         panic!();
      }
   }
}
impl Monoid for MaxInt {
   fn unit() -> Self { MaxInt::Minimal }
}
use MaxInt::*;

#[fastout]
fn main() {
   input! {
      n: usize,
      m: usize,
      p: i64,
      abc: [(Usize1, Usize1, i64); m]
   }
   let mut to = vec![vec![]; n];
   for (a, b, c) in abc {
      to[a].push((b, c - p));
   }

   let mut d = vec![Minimal; n];
   d[0] = Val(0);
   for _ in 0..n {
      for v in 0..n {
         if let Val(x) = d[v] {
            for &(u, c) in to[v].iter() {
               d[u] = d[u] * Val(x + c);
            }
         }
      }
   }
   let ans = d[n - 1];
   for _ in 0..n {
      for v in 0..n {
         if let Val(x) = d[v] {
            for &(u, c) in to[v].iter() {
               if x == INF || d[u] < Val(x + c) {
                  if u == n - 1 {
                     println!("-1");
                     return;
                  }
                  d[u] = Val(INF);
               }
            }
         }
      }
   }
   if let Val(x) = ans {
      println!("{}", max(x, 0));
   } else {
      println!("{}", -1);
   }
}


Measured memory_bytes: 2588
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
#define N 200010
int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    //cout<<"paken"<<endl;
    //cout<<"Paken"<<endl;
    //cout<<"PAKEN"<<endl;
    ll n,m;
    cin>>n>>m;
    cout<<n*m<<endl;
}





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

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define SUM(a) accumulate(all(a),0LL)
#define pb push_back
#define endl '\n'
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok = true, flag = false;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 222222


ll a[MAX];

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


  cin >> n >> m;
  rep(i, n) cin >> a[i+1];
  FOR(i, 1, n) a[i + 1] += a[i];
  vll sum, an[55];
  rep(i, n + 1)FOR(j, i + 1, n + 1) {
    sum.pb(a[j] - a[i]);
  }
  rep(i, sum.size()) an[53].pb(sum[i]);
  rrep(i, 53) {
    cnt = 0;
    rep(j, an[i + 1].size()) if (an[i + 1][j] >> i & 1) cnt++;
    if (cnt >= m) {
      rep(j, an[i + 1].size()) if (an[i + 1][j] >> i & 1) an[i].pb(an[i + 1][j]);
      ans += powl(2, i);
    }
    else {
      an[i] = an[i+1];
    }
  }
  cout << ans << endl;

  return 0;
}


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

int main(){
  int n,i,j,k,num;
  int cards[4][13];
  char mark;

  for(i = 0; i < 4; i++){
    for(j = 1; j <= 13; j++){
      cards[i][j] = 0;
    }
  }

  cin >> n;

  for(k = 0; k < n; k++){
    cin >> mark >> num;

    if(mark == 'S') cards[0][num] = 1;
    if(mark == 'H') cards[1][num] = 1;
    if(mark == 'C') cards[2][num] = 1;
    if(mark == 'D') cards[3][num] = 1;
  }

  for(i = 0; i < 4; i++){
    for(j = 1; j <= 13; j++){
      if(cards[i][j] == 0){
        if(i == 0) cout << 'S' << " " << j << endl;
        if(i == 1) cout << 'H' << " " << j << endl;
        if(i == 2) cout << 'C' << " " << j << endl;
        if(i == 3) cout << 'D' << " " << j << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1160
//Bismillahir Rahmanir Rahim

#include<bits/stdc++.h>
using namespace std;

int main(){
string a, b;
int c=0;
cin>>a>>b;
for(int i=0; i<a.size(); i++){
    if(a[i]!=b[i]) c++;
}
cout<<c;

}



Measured memory_bytes: 3900
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define sec second
#define f first
#define pb push_back
#define pf push_front
#define po pop_back
const ll mod=1000000007;
#define fast ios_base::sync_with_stdio(false)
#define vi vector<ll>
#define vii vector< pair<ll,ll> >
#define pi pair<ll,ll>
#define pii pair< pair<ll,ll> ,ll >
#define set set<ll>
#define tostr to_string
#define toint stoi
#define gcd __gcd
ll maxm(ll a,ll b){return a>b?a:b;}
ll minm(ll a,ll b){return a>b?b:a;}
#define max maxm
#define min minm
const ll inf=1e18;

ll c[2022];
int main()
{
    fast;

  ll n,i;
  string s;
  cin>>s;
  n=s.size();
  ll a[n+4];
  for(i=0;i<n;i++)
    a[i]=s[i]-'0';

  ll dp[n+3]={0},p=10;
  dp[n-1]=a[n-1];
  c[a[n-1]]++;
  for(i=n-2;i>=0;i--)
  {
    dp[i]=(dp[i+1]%2019+ (a[i]%2019 * p%2019)%2019)%2019;
    c[dp[i]]++;
    p=(p*10)%2019;
  }
  c[0]++;
  ll ans=0;
  for(i=0;i<2019;i++)
    ans+=(c[i]*(c[i]-1))/2;

  cout<<ans<<endl;
}


Measured memory_bytes: 6788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <math.h>
#include <stdio.h>
#define INF 1000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long int ll;
using namespace std;

int main() {

	int n, k,h[200010];
	cin >> n >> k;
	for (int i = 0; i < n; i++) { cin >> h[i]; }
	sort(h, h + n);
	ll ans = 0;
	for (int i = 0; i < n - k; i++) {
		ans += h[i];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)

ans1, ans2 = 0,0

maxA = max(A)
B = [1]
t = 1
while t < maxA:
    t *= 2
    B.append(t)

d = dict()
for i in range(N):
    if A[i] in d:
        d[A[i]] += 1
    else:
         d[A[i]] = 1

for i in range(N):
    t = 2**len(bin(A[i])[2::]) - A[i]
    if t in d:
        if t != A[i]:
            if d[t]>0 and d[A[i]]>0:
                ans2 += 1
                d[t] -= 1
                d[A[i]] -= 1
        else:
            if d[t] > 1:
                ans2 += 1
                d[t] -= 2


print(ans1+ans2)

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

ll N, A, B;
ll x[MAX_N];

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

  cin >> N >> A >> B;
  REP(i, N)
    cin >> x[i];

  ll ans = 0ll;
  REP(i, N - 1) {
    ans += min((x[i + 1] - x[i]) * A, B); 
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int N, D; cin >> N >> D;
    cout << (N+D*2) / (D*2+1) << endl;
}

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

signed main(void)
{
	int a, b;
	cin >> a >> b;
	if (a + b < 24)
		cout << a + b << endl;
	else
		cout << a + b - 24 << endl;
	return 0;
}


Measured memory_bytes: 256
let arr1=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
let n = arr1[0]
let x = arr1[1]

let arr2=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var i = 0
var j = 0
var o = 0

while(  i <= x ){
  if( o >= n ) {
    o += 1 
    break
  }
  i += arr2[o]
  o += 1
}

print( o )


Measured memory_bytes: 4208
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
ll D;
ll c[26];
ll s[366][26];
ll t[366];

//スコア計算
ll score(ll days){
	ll ans=0;
	ll last[26];
	rep(i,26)last[i]=0;
	for(ll d=1;d<=days;d++){
		ans+=s[d][t[d]];
		last[t[d]]=d;
		rep(i,26){
			ans-=c[i]*(d-last[i]);
		}
	}
	return ans;
}

ll whole_score;
ll score_typ[26];
void recalc(ll i){
	ll ans=0;
	ll last=0;
	for(ll d=1;d<=D;d++){
		if(t[d]==i){
			ans+=s[d][i];
			last=d;
		}
		ans-=c[i]*(d-last);
	}
	whole_score-=score_typ[i];
	score_typ[i]=ans;
	whole_score+=score_typ[i];
}
void change(ll d,ll q){
	ll b=t[d];
	t[d]=q;
	recalc(b);
	recalc(q);
}
void init_score(){
	whole_score=0;
	rep(i,26){
		score_typ[i]=0;
		recalc(i);
	}
}

//貪欲法
void greedy(){
	for(ll d=1;d<=D;d++){
		ll ma=-1e17,pt=0;
		rep(i,26){
			t[d]=i;
			ll res=score(d);
			if(ma<res){
				ma=res;
				pt=i;
			}
		}
		t[d]=pt;
	}
}

//局所探索_改
void local_search(){
	rep(u,100000){
		ll bef_score=whole_score;
		ll d1,d2;
		do{
			d1=rand()%D+1;
			d2=rand()%D+1;
		}while(d1==d2);
		ll p=t[d1],q=t[d2];
		change(d1,q);
		change(d2,p);
		ll aft_score=whole_score;
		if(bef_score>aft_score){
			change(d1,p);
			change(d2,q);
		}
	}
}


int main(){
	cin>>D;
	rep(i,26)cin>>c[i];
	for(ll d=1;d<=D;d++)rep(j,26)cin>>s[d][j];
	greedy();
	init_score();
	local_search();
	for(ll d=1;d<=D;d++){
		cout<<t[d]+1<<"\n";
	}
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N= 1e7 + 5;
const ll mod=1e9 + 7;

ll n,t;
pair<ll,ll> arr[3005];
ll dp[3005][6005];

bool cmp(pair<ll,ll> a, pair<ll,ll> b){
    if(a.second!=b.second)return a.second>b.second;
    return a.first<b.first;
}
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin>>n>>t;
    for(ll i=1;i<=n;i++)cin>>arr[i].first>>arr[i].second;
    sort(arr+1,arr+1+n);

    for(ll i=1;i<=n;i++){
        for(ll j=1;j<6005;j++)dp[i][j]=dp[i-1][j];
        for(ll j=1;j<=t;j++)dp[i][j+arr[i].first] = max(dp[i][j+arr[i].first] , dp[i-1][j]+arr[i].second );
    }
    ll ans = 0;
    for(ll i=1;i<=n;i++)for(ll j=1;j<6005;j++)ans = max(ans,dp[i][j]);
    cout<<ans;
}



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

int main(){
    int N; cin >> N;
    set<int> s;
    int sp = 0;
    for(int i = 0; i < N; i++){
        int a; cin >> a;
        if(a < 400) s.insert(1);
        else if(a < 800) s.insert(2);
        else if(a < 1200) s.insert(3);
        else if(a < 1600) s.insert(4);
        else if(a < 2000) s.insert(5);
        else if(a < 2400) s.insert(6);
        else if(a < 2800) s.insert(7);
        else if(a < 3200) s.insert(8);
        else sp++;
    }
    cout << max((int)s.size(), 1);
    cout << ' ';
    cout << (int)s.size() + sp << endl;

    return 0;
}

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

using namespace std;

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

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

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

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

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

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
int l;
int x[125252];
int kth[125252][20];

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%d",x+i);
  scanf("%d",&l);
  // kth next
  REP(i,n+1)REP(k,20)kth[i][k]=n;
  FORR(i,0,n){
    // check next
    kth[i][0] = upper_bound(x,x+n,x[i]+l)-x-1;
    // doubling
    FOR(k,1,20)kth[i][k] = kth[kth[i][k-1]][k-1];
  }
  // query
  int q;
  scanf("%d",&q);
  REP(i,q){
    int a,b;
    scanf("%d%d",&a,&b);
    --a;--b;
    if(a>b)swap(a,b);
    int ans = 0;
    FORR(k,0,20){
      int nxt = kth[a][k];
      if(nxt<b){
        a=nxt;
        ans += 1<<k;
      }
    }
    while(a<b){
      a=kth[a][0];
      ans++;
    }
    printf("%d\n",ans);
  }
  return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    i64 x;
    std::cin >> x;
    std::cout << x / 11 * 2 + (x % 11 == 0 ? 0 : x % 11 <= 6 ? 1 : 2) << std::endl;

    return 0;
}


Measured memory_bytes: 384
n=int(input())
mon=list(map(int,input().split()))
yusya=list(map(int,input().split()))
a=sum(mon)
yoryoku=0
for i in range(n):
    
    if mon[i]>=yoryoku:
        mon[i]-=yoryoku
    else:
        mon[i]=0
    if mon[i]>=yusya[i]:
        mon[i]-=yusya[i]
        yoryoku=0
    else:
        yoryoku=yusya[i]-mon[i]
        mon[i]=0
        
mon[-1]-=yoryoku
if mon[-1]<0:
    mon[-1]=0
    
print(a-sum(mon))

Measured memory_bytes: 18624
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

const ll MOD = 1e18+7;

ll mod_pow(ll x, ll n, ll mod){
    ll res = 1;

    while(n > 0){
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}


vector<pair<ll, ll> > prime_factorize(ll n) {
    vector<pair<ll, ll> > res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


int main(){

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

    ll n, p; cin >> n >> p;

    auto vf = prime_factorize(p);

    ll ans = 1;
    for(auto x : vf){
        ans *= mod_pow(x.first, (x.second / n), MOD);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 998244353LL;

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

int main() {
    int n,s;
    cin >> n >> s;
    vint a(n);
    cin >> a;
    vector<vll> dp(n+1, vll(s + 1, 0));
    dp[0][0] = 1;
    REP(i,n){
        REP(j, s + 1){
            dp[i+1][j] = (dp[i+1][j] + 2*dp[i][j] % MOD) % MOD;
            if (j - a[i] >= 0) {
                dp[i + 1][j] = (dp[i + 1][j] + dp[i][j - a[i]]) % MOD;
            }
        }
    }
    cout << dp[n][s] << endl;
}


Measured memory_bytes: 73756
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N, T = list(map(int, input().split()))

A = []
for i in range(N):
    a, b = list(map(int, input().split()))
    A.append([a,b])

A = [0] + sorted(A, key=lambda x: x[0])
dp = [[0 for t in range(T+1)] for i in range(N+1)]
dp[0][0] = 0

for i in range(1,N+1):
    for t in range(0,T):
        if t - A[i][0] >= 0:
            dp[i][t] = max(dp[i-1][t-A[i][0]] + A[i][1], dp[i-1][t])
        else:
            dp[i][t] = dp[i-1][t]

    dp[i][T] = max(max(dp[i-1][max(0,T-A[i][0]):T]) + A[i][1], dp[i-1][T])

print(max(dp[N]))





Measured memory_bytes: 159336
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main()
{
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= 10000; i++){
        int a_x = i * 0.08;
        int a_y = i * 0.10;
        if (a_x == a && a_y == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>


using namespace std;


int main() {

    double PI = 3.141592653589;

    double A, B, H, M;

    cin >> A >> B >> H >> M;


    double h = (H * 60 + M) / 2.0;
    double m = M * 6.0;

    double result = sqrt(A * A + B * B - 2 * A * B * cos(abs(h - m) * PI / 180.0));

    cout << fixed << setprecision(10) << result << endl;


    return 0;

}

Measured memory_bytes: 4228
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    if (a + b == 15)
    {
        cout << "+" << endl;
        return 0;
    }
    if (a * b == 15)
    {
        cout << "*" << endl;
        return 0;
    }
    cout << "x" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

int main()
{
    int a, b, c, tmp;
    cin >> a >> b >> c;
    vector<int> v;
    if (a > b) {
        tmp = b;
        b = a;
        a = tmp;
    }
    if (b > c) {
        tmp = c;
        c = b;
        b = tmp;
    }
    if (a > b) {
        tmp = b;
        b = a;
        a = tmp;
    }
    cout << a << ' ' << b << ' ' << c << endl;
    return 0;
}


Measured memory_bytes: 3092
let () =
  let o,e = Scanf.scanf "%s %s " (fun a b -> a,b) in
  let o = Batteries.String.to_list o in
  let e = Batteries.String.to_list e in

  let rec aux l1 l2 res =
    match l1,l2 with
    | (hd1 :: tl1), (hd2 :: tl2) -> aux tl1 tl2 (res @ [hd1;hd2])
    | (hd1 :: tl1), [] -> res @ [hd1]
    | [], [] -> res
  in

  Printf.printf "%s\n" @@
  Batteries.String.of_list (aux o e [])



Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
 
int main() {
  long long N,H,W;
	H=0;
	W=0;
	cin>>N;
	vector<long long> A(N);
	rep(i,N) cin>>A[i];
	sort(A.rbegin(),A.rend());
	long long E=0;
	rep(i,N){
		long long t=A[i];
		if(E==t){
		  E=0;
			if(H>W)W=max(t,W);
			else H=max(t,H);
		}
		else E=t;
	}
	cout<<H*W<<endl;
	return 0;
}

Measured memory_bytes: 4016
from itertools import combinations_with_replacement
 
N, M, Q = map(int, input().split())
Req = [list(map(int, input().split())) for i in range(Q)]
ans = 0

for A in combinations_with_replacement(range(1, M+1), N):
    point = sum([d for a, b, c, d in Req if A[b-1] - A[a-1] == c])
    ans = max(ans, point)
    
print(ans)

Measured memory_bytes: 9120
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

int H, W;
int a[82][82];
int b[82][82];

bitset<82 * 161> dp[82][82];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    read(H, W);
    rep(i, 0, H) rep(j, 0, W) read(a[i][j]);
    rep(i, 0, H) rep(j, 0, W) read(b[i][j]);

    const auto diff = [&](int i, int j) { return abs(a[i][j] - b[i][j]); };

    dp[0][0][diff(0, 0)] = true;

    rep(i, 0, H) rep(j, 0, W) {
        rep(s, 0, 81 * 161) if (dp[i][j][s]) {
            {
                const int d = diff(i + 1, j);
                dp[i + 1][j][s + d] = true;
                dp[i + 1][j][abs(s - d)] = true;
            }
            {
                const int d = diff(i, j + 1);
                dp[i][j + 1][s + d] = true;
                dp[i][j + 1][abs(s - d)] = true;
            }
        }
    }

    int ans = 0;
    while (!dp[H - 1][W - 1][ans]) ++ans;
    print(ans);

    return 0;
}


Measured memory_bytes: 11008
N = int(input())
W = []
for _ in range(N):
  a, b = map(int, input().split())
  W.append([a, b])
s = 0 
for a, b in sorted(W, key=lambda x: x[1]):
  s += a
  if s > b:
    print('No')
    quit()
print('Yes')


Measured memory_bytes: 39588
n = int(input())

X_min = float("inf")
X_max = -float("inf")
Y_min = float("inf")
Y_max = -float("inf")

for _ in range(n):
    x, y = map(int, input().split())
    X = x - y
    Y = x + y
    X_min = min(X_min, X)
    X_max = max(X_max, X)
    Y_min = min(Y_min, Y)
    Y_max = max(Y_max, Y)

print(max(X_max-X_min, Y_max-Y_min))

Measured memory_bytes: 70832
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#define fi first
#define se second
#define pb(i) push_back(i)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mes(a,b) memset(a,b,sizeof(a))
#define sbs(i,j) substr(i,j)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10;
const int INF = 0x3f3f3f3f;
const int inf = - INF;
const int mod = 1e9+7;
const double pi = acos(-1.0);

int edges[15][15];
bool vis[15];
int n,m;
int dfs(int x){
    bool all_vis=true;
    rep(i,1,n)
        if(!vis[i]) all_vis=false;
    if(all_vis) return 1;
    int res=0;
    rep(i,1,n){
        if(vis[i]) continue;
        if(edges[x][i]){
            vis[i]=true;
            res+=dfs(i);
            vis[i]=false;
        }
    }
    return res;
}
int main(){
    std::ios::sync_with_stdio(false);
    cin>>n>>m;
    rep(i,1,m){
        int x,y;
        cin>>x>>y;
        edges[x][y]=true;
        edges[y][x]=true;
    }
    vis[1]=true;
    cout<<dfs(1)<<endl;
    return 0;
}

Measured memory_bytes: 256