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

using namespace std;

typedef long long int ll;

const int N = (int) 3e3+ 10;

int n;
ll a[N];
ll memo[N][N];

ll dp(int l, int r) {
    if(l > r) return 0;
    ll &ans = memo[l][r];
    if(ans != -1) return ans;
    ll left = a[l] - dp(l + 1, r);
    ll right = a[r] - dp(l, r - 1);
    return ans = max(left, right);
}

void solve() {
    cin >> n;
    memset(memo, -1LL, sizeof(memo));
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    cout << dp(0, n - 1) << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    solve();
    return 0;
}

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

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << (a) << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

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

const int N = 111;
const int MOD = 998244353; 
using mask = bitset<N>;

void add(int &x, int y) { 
    x += y;
    if (x >= MOD) x -= MOD;
}

map<string,int> memo;
int go(mask m, int len) {
    if (len < 0) return 0;
    if (len == 0) return 1;

    m.set(len); for (int i = len+1; i < N; i++) m.reset(i);
    string s = m.to_string();
    if (memo.count(s)) return memo[s];
    int &res = memo[s];
    m.reset(len);

    res = go(m>>1, len-1)*(m[0]+1)%MOD;
    for (int l = 1; 2*l <= len; l++) {
        auto nm = m;
        for (int k = 2; k*l <= len; k++) {
            nm &= m >> (l*(k-1));
            add(res, go(nm, l) * (ll) go(m>>(k*l), len-k*l) % MOD);
        }
    }
//    forn(i,len) cerr << m[len-1-i];
//    cerr << ' ' << res << endl;
    return res;
}

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

    string s; cin >> s;
    int n = si(s);
    mask m(s);
    cout << go(m,n) << endl;

    return 0;
}


Measured memory_bytes: 9472
#include <cstdio>
using namespace std;

int h, w;
char a[101][101];
int ans;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};

int dfs(int x, int y, int z){
	if(0 <= x && x < h && 0 <= y && y < w && z == a[x][y]){
		a[x][y] = '/';
		for(int i=0; i<4; i++){
			dfs(x+dx[i], y+dy[i], z);
		}
	}
	return 0;
}

int main(){
	while(1){
		scanf("%d %d", &h, &w);
		if(h == 0 && w == 0) break;
		for(int i=0; i<h; i++){
			scanf("%s", a[i]);
		}
		ans = 0;

		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				if(a[i][j] == '@' || a[i][j] == '#' || a[i][j] == '*'){
					ans++;
					dfs(i, j, a[i][j]);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1508
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s;
    cin>>s;
    int f=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='7') f=1;
    }
    if(f==1) printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 3640
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

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

ll N, A[212345], sum[212345];

int main() {

	scanf("%lld", &N);
	rep(i, N) scanf("%lld", &A[i]);

	rep(i, N) {
		if (!i) sum[i] = A[i];
		else sum[i] = sum[i - 1] + A[i];
	}

	ll ans = 4000000000000000000;

	rep(i, N - 2) {
		ll d1, d2 = i + 1, d3;
		d1 = distance(sum, lower_bound(sum, sum + d2 - 1, sum[d2 - 1] / 2)) + 1;
		d3 = distance(sum, lower_bound(sum + d2 + 1, sum + N, sum[d2 - 1] + (sum[N - 1] - sum[d2 - 1]) / 2)) + 1;

		/*
		vector<ll> v;
		if (0 < d1 && d1 < d2 && d2 < d3 && d3 < N) {
		v.push_back(sum[d1 - 1]);
		v.push_back(sum[d2 - 1] - sum[d1 - 1]);
		v.push_back(sum[d3 - 1] - sum[d2 - 1]);
		v.push_back(sum[N - 1] - sum[d3 - 1]);
		ans = min(ans, *max_element(v.begin(), v.end()) - *min_element(v.begin(), v.end()));
		}*/

		ll d[] = { -1, 0, 1 };
		ll dn = 3;
		rep(i, dn * dn) {
			vector<ll> v;
			ll p = d1 + d[i % dn], q = d2, r = d3 + d[i / dn % dn];
			if (0 < p && p < q && q < r && r < N) {
				v.push_back(sum[p - 1]);
				v.push_back(sum[q - 1] - sum[p - 1]);
				v.push_back(sum[r - 1] - sum[q - 1]);
				v.push_back(sum[N - 1] - sum[r - 1]);
				ans = min(ans, *max_element(v.begin(), v.end()) - *min_element(v.begin(), v.end()));
			}
		}
	}

	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MAX / 2 - 1;
    ll n, x, y;
    cin >> n >> x >> y;
    x--; y--;
    vector<vector<ll>> d(n, vector<ll>(n, inf));
    rep(i, n) d[i][i] = 0;
    rep(i, n) {
        reps(j, i + 1, n) {
            d[i][j] = abs(j - i);
            d[j][i] = abs(j - i);
        }
    }
    d[x][y] = 1;
    d[y][x] = 1;
    map<ll, ll> cnt;
    rep(i, n) {
        rep(j, n) {
            d[i][j] = min(d[i][j], d[i][x] + d[x][y] + d[y][j]);
            d[i][j] = min(d[i][j], d[i][y] + d[y][x] + d[x][j]);
            cnt[d[i][j]]++;
        }
    }
    reps(a, 1, n) {
        cout << (cnt[a] / 2) << endl;
    }
    // rep(i, n) rep(j, n) printf("%lld%s", d[i][j], (j == (n - 1)) ? "\n" : " ");
    return 0;
}


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


void swap(int,int);
int ladder[50];
string change;

int main(){
	int v,h,a,b;
	cin >> v >> h;
	for(int i=1;i<=v;i++){
		ladder[i]= i;
	}
	for(int i=1;i<=h;i++){
		cin >> change;
		//cout << change[2];
		change.replace(change.find(","),1," ");
		//tmp.replace(tmp.find(","),1," ");
		istringstream ss(change);
		ss >> a >> b;

		//temp = ladder[b];
		//ladder[b] = ladder[a];
		//ladder[a] = temp;
//		cout << ladder[a] << ladder[b] << endl;
	//	cout << endl << endl;
		swap(a,b);
		/*for(int i=1;i<=v;i++){
			cout << ladder[i] << endl;
		}
		cout << endl;*/
		//	cout << ladder[change[0]] << "-"<<ladder[change[2]] << endl;
	}
//	cout <<endl;

	for(int i=1;i<=v;i++){
	cout << ladder[i] << endl;
	}
}

void swap(int a,int b){
	int temp;
	temp = ladder[b];
	ladder[b] = ladder[a];
	ladder[a] = temp;
	/*cout << ladder[a] << ladder[b] << endl;
	cout << endl << endl;*/
}

Measured memory_bytes: 0
import sys
input = sys.stdin.buffer.readline
from itertools import combinations
from math import hypot
n=int(input())
P=[tuple(map(int,input().split())) for _ in range(n)]
ans=1e9
for p1,p2 in combinations(P,2):
	X,Y=(p1[0]+p2[0])/2,(p1[1]+p2[1])/2
	r=0
	for x,y in P:
		t=hypot(X-x,Y-y)
		if r<t:r=t
	if ans>r:ans=r
if n>2:
	ans_=1e9
	for p1,p2,p3 in combinations(P,3):
		a=hypot(p2[0]-p3[0],p2[1]-p3[1])
		b=hypot(p3[0]-p1[0],p3[1]-p1[1])
		c=hypot(p1[0]-p2[0],p1[1]-p2[1])
		if (a+b+c)-2*max(a,b,c)<1e-8:continue
		s,t,u=(-a*a+b*b+c*c)*a*a,(a*a-b*b+c*c)*b*b,(a*a+b*b-c*c)*c*c
		X=(s*p1[0]+t*p2[0]+u*p3[0])/(s+t+u)
		Y=(s*p1[1]+t*p2[1]+u*p3[1])/(s+t+u)
		r=0
		for x,y in P:
			t=hypot(X-x,Y-y)
			if r<t:r=t
		if ans_>r:ans_=r
	# print(ans_)
	ans=min(ans,ans_)
print(ans)











Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, res;
char S[300][300], C[300][300];

int main() {
	cin >> N;
	for (int i = 0; i != N; ++i) {
		for (int j = 0; j != N; ++j) {
			cin >> S[i][j];
		}
	}
	for (int i = 0; i != N; ++i) {
		for (int j = 0; j != N; ++j) {
			for (int k = 0; k != N; ++k) {
				C[j][k] = S[(j + i) % N][k];
			}
		}
		bool b = true;
		for (int j = 0; j != N; ++j) {
			for (int k = 0; k != N; ++k) {
				if (C[j][k] != C[k][j]) {
					b = false;
					break;
				}
			}
			if (!b)break;
		}
		if (b)res += N;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 384
S=input()

ptn1=0
ptn2=0
for i in range(len(S)):
    if i%2==0:
        if int(S[i])==0:
            ptn1+=1
        else:
            ptn2+=1
        #print(i,S[i],'ptn1',ptn1,'ptn2',ptn2)
    else:
        if int(S[i])==0:
            ptn2+=1
        else:
            ptn1+=1
        #print(i,S[i],'ptn1',ptn1,'ptn2',ptn2)
        
if ptn1>ptn2:
    print(len(S)-ptn1)
else:
    print(len(S)-ptn2)

Measured memory_bytes: 3188
def main():
    S = input()
    T = input()
    ans = len(S)
    for i in range(len(S)-len(T)+1):
        subS = S[i:i+len(T)]
        diff = 0
        for j in range(len(T)):
            if subS[j] != T[j]:
                diff += 1
        ans = min(diff, ans)
        if ans == 0:
            print(ans)
            return
    print(ans)

if __name__ == "__main__":
    main()


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

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    if (a+b == c ||
        b+c == a ||
        c+a == b ) {
            cout << "Yes" << endl;
        }
    else {
        cout << "No" << endl;
    }
}

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

#define ii pair<int, int>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define INF int(1e9)

using namespace std;

int n, x, y;

vvi graph;

vi dists;
vi count_distances(5000,0);

vi BFS(int origin){
    vi dist(n, INF);

    dist[origin] = 0;

    queue<int> fila;

    fila.push(origin);

    while(!fila.empty()){
        int vertex = fila.front();

        fila.pop();

        //cout << vertex << endl;

        for(auto i : graph[vertex]){
            if(dist[i]>dist[vertex]+1){
                dist[i] = dist[vertex]+1;
                fila.push(i);
                count_distances[dist[i]]++;
            }
        }
    }

    return dist;
}
int main () {
    ios_base::sync_with_stdio(false);

    cin >> n >> x >> y;

    dists.resize(n);
    
    graph.resize(n);

    for(int i=0; i<n-1; i++){
        graph[i].pb(i+1), graph[i+1].pb(i);
        //dists[1]++;
    }
    x--, y--;
    graph[x].pb(y);
    graph[y].pb(x);

    vvi distances(n);
    //dists[1]++;

    for(int i=0; i<n; i++)
        distances[i] = BFS(i);

    for(int i=0; i<n; i++)
        for(int j=i+1; j<n; j++)
            dists[distances[i][j]]++;
        
    for(int i=1; i<=n-1; i++)
        cout << dists[i] << endl;
    return 0;
}

Measured memory_bytes: 16128
n = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

ans = 0
for i in range(n-1):
    if A[i+1] == A[i]+1:
        ans += C[A[i]-1]
print(sum(B)+ans)


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

int main(){
  int N;
  cin >>N;
  map<string, int> S; 
  for(int i=0;i<N;i++){
      string s;
      cin >>s;
      S[s] += 1;    
  }
  int max = 0;
  for(auto p : S){
      if(max<p.second){
          max = p.second;
      }
  }

  for(auto it=S.begin();it !=S.end();it++){
      if(it->second == max){
          cout<<it ->first <<endl;
      }
  }
}



Measured memory_bytes: 25216
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <time.h>

using namespace std;
typedef long long int ll;

int main()
{
	ll x, y;
	scanf("%lld %lld", &x, &y);
	if(x%y==0){
		printf("%d\n", -1);
	}else{
		printf("%lld\n", x);
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    char[] as, bs, cs;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        as = sc.next().toCharArray();
        bs = sc.next().toCharArray();
        cs = sc.next().toCharArray();
        solve();
    }

    void solve() {
        int turn = 0;
        int ap = 0, bp = 0, cp = 0;
        while(true) {
            if (turn == 0) {
                if (ap == as.length) {
                    System.out.println('A');
                    return;
                }
                turn = as[ap++] - 'a';
            } else if (turn == 1) {
                if (bp == bs.length) {
                    System.out.println('B');
                    return;
                }
                turn = bs[bp++] - 'a';
            } else {
                if (cp == cs.length) {
                    System.out.println('C');
                    return;
                }
                turn = cs[cp++] - 'a';
            }
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21076
C=list(map(int,input().split()))
D=list(map(int,input().split()))
E=list(map(int,input().split()))
F=[0,0,0]
G=[0,0,0]
H=[0,0,0]
N=int(input())
for j in range(N):
  b=int(input())
  for i in range(3):
    if b==C[i]:
      F[i]=1
    if b==D[i]:
      G[i]=1
    if b==E[i]:
      H[i]=1
      
for k in range(3):
  if F[k]==G[k]==H[k]==1:
    print('Yes')
    exit()

if sum(F)==3 or sum(G)==3 or sum(H)==3:
  print('Yes')
  exit()

if F[0]==G[1]==H[2]==1 or F[2]==G[1]==H[0]==1:
  print('Yes')
  exit()

print('No')
    
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}

ll gcd(ll a, ll b) {
  if(b==0) return a;
  else return gcd(b, a%b);
}


int main(void) {
  ll N;
  cin >> N;
  ll a[MAX];
  ll i;
  ll sum=0;
  ll min=INF;
  
  for(i=0; i<N; i++) {
    cin >> a[i];
    
    if(a[i]>0) sum+=a[i];
    else sum-=a[i];
    chmin(min, abs(a[i]));
  }
  
  ll cnt_neg=0;
  
  for(i=0; i<N; i++) {
    if(a[i]<0) cnt_neg++;
  }
  
  if(cnt_neg%2==0) {
    pt(sum);
  }else {
    pt(sum-min*2);
  }
  
  
}






Measured memory_bytes: 1024
<?php
  fscanf(STDIN, "%s", $a);
  fscanf(STDIN, "%s", $b);

  $c = 0;

  if ($a[0] == $b[0]) $c += 1;
  if ($a[1] == $b[1]) $c += 1;
  if ($a[2] == $b[2]) $c += 1;

echo $c;

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

int main() {

    string s; cin >> s;
    if (s[0] == 'S') cout << "Cloudy" << endl;
    else if (s[0] == 'C') cout << "Rainy" << endl;
    else cout << "Sunny" << endl;

    return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N; cin >> N;
    vector<ll> A(N); rep(i, N){cin >> A.at(i);}
    ll cnt = 0;
    map<ll, ll> x;
    rep(i, N){
        ll query = A.at(i) - i;
        if (x.find(query) != x.end()){
            cnt += x[query];
        }
        ll key = -(A.at(i) + i);
        if (x.find(key) != x.end()){
            x[key] += 1;
        } else {
            x[key] = 1;
        }
    }
    cout << cnt << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 17064
H,W = map(int,input().split())
src = [input() for i in range(H)]
 
ans = []
for row in src:
    ans.append(list(row))
 
dxy = [(-1,-1),(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1)]
for y in range(H):
    for x in range(W):
        if src[y][x] == '#': continue
        c = 0
        for dx,dy in dxy:
            if x+dx < 0 or x+dx > W-1 or y+dy < 0 or y+dy > H-1: continue
            if src[y+dy][x+dx] == '#': c += 1
        ans[y][x] = c
 
for row in ans:
    print(''.join(list(map(str,row))))

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

int main()
{
    ll a,b,c,d,e,x,y,z,n,tot;

    tot=0;

    cin>>n;

    ll X,Y;

    while(n--)
    {
        cin>>x>>y;
        if(!tot)
        {
            tot=x+y;
            X=x;
            Y=y;
            continue;
        }

        c=X/x; if((X%x)) c++;
        d=Y/y; if((Y%y)) d++;

        X=x*max(c,d);
        Y=y*max(c,d);
    }

    cout<<X+Y<<endl;

    return 0;
}


Measured memory_bytes: 256
/**
*    author:  boutarou
*    created: 10.07.2020 09:44:51
**/

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

int main() {
    lint x;
    lint now = 100;
    cin >> x;
    for (int i = 1;;i++) {
        now += now / 100;
        if (now >= x) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,M;
vector<P> connectVec[100010];
ll potential[100010];
bool finish=false;
void SetPot(ll now){
    for(auto p:connectVec[now]){
        if(finish)break;
        ll v=p.first;
        ll d=p.second;
        if(potential[v]==INF){
            potential[v]=potential[now]+d;
            SetPot(v);
        }else if(potential[v]!=potential[now]+d){
            cout<<"No"<<endl;
            finish=true;
        }
    }
}
int main(){
    cin>>N>>M;
    for(ll i=0;i<M;i++){
        ll l,r,d;
        cin>>l>>r>>d;
        l--;r--;
        connectVec[l].push_back(P(r, d));
        connectVec[r].push_back(P(l,-d));
    }
    for(ll i=0;i<N;i++){
        potential[i]=INF;
    }
    for(ll i=0;i<N;i++){
        if(potential[i]!=INF)continue;
        potential[i]=0;
        SetPot(i);
    }
    if(finish)return 0;
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 16512
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
	string s;
  	cin >> s;
	rep(i,s.size()) {
		if(i%2==0) cout << s[i];
    }
  	cout << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


Measured memory_bytes: 592
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int C = scanner.nextInt();
        
        if((A==B && A!=C) || (A!=B && A==C) || (B==C && A!=B)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21076
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  ll X;
  cin >> X;
  ll moto = 100LL;
  for (int i = 0;; i++)
  {
    if (moto >= X)
    {
      cout << i << endl;
      return 0;
    }
    moto += floor(moto * 0.01);
  }
  return 0;
}

Measured memory_bytes: 3636
/**
*    author:  souzai32
*    created: 13.08.2020 10:05:23
**/

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

int main() {

    long long n,k;
    cin >> n >> k; 
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);

    long long ans=0, count=0, num;
    rep(i,n-1){
        for(int j=n-1; j>i; j--) if(a.at(i)>a.at(j)) ans++;
    }
    ans*=k;
    ans%=long(1e9+7);
    
    sort(a.begin(),a.end(),greater<>());
    long long b=n*(n-1)/2;
    rep(i,n-1){
        if(a.at(i)==a.at(i+1)) count++;
        else count=0;
        b-=count;
        // cout << count << endl;
    }
    // cout << b << endl;
    if(k%2){
        b*=k;
        b%=long(1e9+7);
        b*=(k-1)/2;
        b%=long(1e9+7);
    }
    else{
        b*=k/2;
        b%=long(1e9+7);
        b*=k-1;
        b%=long(1e9+7);
    }
    ans+=b;
    ans%=long(1e9+7);
    // cout << b << endl;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define INF 1000000000000000000
#define all(x) x.begin(), x.end()
#define PI 3.141592653589793

int main() {
    ll x;
    cin >> x;
    ll res = 0;
    x--;
    res = (x / 11) * 2;
    if (x % 11 > 5)
        res += 2;
    else
        res += 1;

    cout << res << endl;
}

Measured memory_bytes: 256
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let l: u64 = sc.read();
    let n: usize = sc.read();
    let x: Vec<u64> = sc.vec(n);

    let ans1 = solve(&x, l);
    let x = x.into_iter().rev().map(|x| l - x).collect();
    let ans2 = solve(&x, l);

    println!("{}", cmp::max(ans1, ans2));
}

fn solve(x: &Vec<u64>, l: u64) -> u64 {
    let n = x.len();

    let mut left_sum = vec![0; n + 1];
    let mut right_sum = vec![0; n + 1];
    for i in 0..n {
        right_sum[i + 1] = right_sum[i] + x[i];
        left_sum[i + 1] = left_sum[i] + (l - x[n - 1 - i]);
    }

    let mut ans = 0;
    for i in 0..n {
        let rest = n - (i + 1);
        let left = (rest + 1) / 2;
        let right = n - left;
        let right_sum = right_sum[right] - right_sum[i + 1];
        let dist = left_sum[left] * 2 + right_sum * 2 + x[i] * 2;
        let last = if rest % 2 == 0 {
            x[right - 1]
        } else {
            l - x[right]
        };

        ans = cmp::max(ans, dist - last);
    }

    ans
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 10492
//  |. . . . . . . . . .|       NEXT  
//  |. . . . . . . . . .|      ______ 
//  |. . . . . . . . . .|     |      |
//  |. . . . . . . . . .|     |  OO  |
//  |. . . . . . . . . .|     |  OO  |
//  |. . . . . . . . . .|     |______|
//  |. . . . I . . . . .|             
//  |. . . . I . . . . .|             
//  |. . . . I . . . . .|     PLAYER  
//  |. . . . I . . . . .|    STYXCEL  
//  |. . . . . . . . . .|             
//  |I J J J . T T T S S|      LINES  
//  |I J O O . L T S S T|          0  
//  |I L O O . L Z Z T T|      SCORE  
//  |I L L L . L L Z Z T|      00021  

#include <bits/stdc++.h>

using namespace std;
//#pragma GCC optimize ("O2,unroll-loops")
#define ll long long
#define ull unsigned long long
#define ld long double
#define vi vector<ll>
#define vii vector<vector<ll>>
#define fr front()
#define bc back()
#define top top()
#define pushb push_back
#define popb pop_back

#define pii pair<ll,ll>
#define piii pair<ll,pair<ll,ll>>
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se

const ll INF=1e9;
const float EPS=1e-9;
const ll MOD=1e9+7;

#define show(x) cerr << x << '\n';

int main(){

    //freopen("inp.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    
    vi pref;
    pref.push_back(0);
    ll a=1;
    
	while(a*3<=2e16){
        a*=3;
        pref.push_back(a);
    }	

    pref.front()=0;

    for(int i=1;i<pref.size();i++)
        pref[i]+=pref[i-1];	

    ll t=0;
    cin>>t;
    	
	ll curt=1;
    ll realt=1;     
    ll pi=0,mult=1;
    
	if(t == 0) {
		cout << 0 << '\n';
		return 0;
	}

	while(curt<t){
        if(curt+pref[pi+1]<=t)
            pi++,mult*=3;
        else if(curt+pref[pi]>t)
            pi--,mult/=3;
        curt+=mult;
        ++realt;
    }
    
	cout<<realt<<endl;

	return 0;
}



Measured memory_bytes: 3172
'use strict';
console.log(function(args){
  const S = args.trim();
  let count = 0, max = 0;
  for ( let i = S.length-1; i >= 0; i-- ) {
    switch( S[i] ) {
      case 'A':
      case 'C':
      case 'G':
      case 'T':
        max = Math.max(++count,max);
        break;
      default:
        count = 0;
    }
  }
  return max.toString();
}(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pll pair<ll,ll>
#define vi vector < int >
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define s(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define pf(x) printf("%d\n",x)
#define pfl(x) printf("%lld\n",x)
#define flash ios_base::sync_with_stdio(false);cin.tie(0)
#define goog(x) cout << "Case #" << x << ": "
#define MAX5 200005
#define MAX6 2000005
#define MLOG 18
#define limit 1e18
#define mod 1000000000   
void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


int power(int x, int y, int p){
    int res = 1;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}


void solve(){
    double r;
    cin >> r;
    r = (2*22*r)/7;
    printf("%0.6f", r);
}

signed main(){  
//  freopen("ii.txt", "w", stdin);
    // flash;
    int t = 1;
    // cin >> t;  
    for(int tc = 1; tc <= t; tc++){
    // goog(tc);
        solve();
    }
}

Measured memory_bytes: 3784
N = int(input())
L = sorted([int(i) for i in input().split()])
from bisect import bisect_left
ans = 0
for i1,a in enumerate(L):
    L_temp = L[i1+1:]
    for i2,b in enumerate(L_temp):
        L_temp2 = L_temp[i2+1:]
        #print(a,b,L_temp2,bisect_left(L_temp2,a+b),a+b,len(L_temp2) - bisect_left(L_temp2,a+b))
        ans += bisect_left(L_temp2,a+b)
print(ans)
            

Measured memory_bytes: 69052
w, h, n = map(int, input().split())

ma = [[0 for i in range(w)] for i in range(h)]


# a == 1 x < xi
# a == 2 x > xi
# a == 3 y < yi
# a == 4 y > yi

for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        for i in range(x):
            for j in range(h):
                ma[j][i] = 1
    if a == 2:
        for i in range(x, w):
            for j in range(h):
                ma[j][i] = 1
    if a == 3:
        for i in range(y):
            for j in range(w):
                ma[i][j] = 1
    if a == 4:
        for i in range(y, h):
            for j in range(w):
                ma[i][j] = 1

count = 0
for i in range(h):
    for j in range(w):
        if ma[i][j] == 0:
            count += 1
print(count)


Measured memory_bytes: 3064
import sys

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 9 + 7


n, k = list(map(int, sys.stdin.readline().split()))
graph = [[] for i in range(n)]
for i in range(n - 1):
    a, b = list(map(int, sys.stdin.readline().split()))
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)
ans = 1
check = [False] * n
stack = [0]
ans = 1
while len(stack) > 0:
    x = stack.pop()
    check[x] = True
    count = 0
    for i in graph[x]:
        if not check[i]:
            count += 1
            stack.append(i)
    if x == 0:
        temp = 1
        for i in range(count):
            temp = temp * (k - 1 - i) % INF
        ans = ans * temp % INF
    else:
        temp = 1
        for i in range(count):
            temp = temp * (k - 2 - i) % INF
        ans = ans * temp % INF
print((ans * k) % INF)

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

int main(void)
{
  int num =0;
  cin >> num;
  int nums[num];
  int sum = 0;
  for(int i=0;i<num;i++)
  {
    cin >> nums[i];
    sum += nums[i];
  }
  sum -= num;
  cout << sum;
  return 0;

}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
ans=10**10
for i in range(1,n):
    a=sum(list(map(int,list(str(i)))))
    b=sum(list(map(int,list(str(n-i)))))
    ans =min(ans,a+b)
print(ans)



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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	int dist = (b - a);
	if(dist & 1){
		cout << "Borys" << endl;
	} else {
		cout << "Alice" << endl;
	}
}


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

using namespace std;

int main() {
		int sx, sy, tx, ty;
		cin >> sx >> sy >> tx >> ty;

		int w = tx - sx;
		int h = ty - sy;

		cout << string(h, 'U') << string(w, 'R');
		cout << string(h, 'D') << string(w, 'L');
		cout << 'L' << string(h+1 ,'U') << string(w+1, 'R') << 'D';
		cout << 'R' << string(h+1 ,'D') << string(w+1, 'L') << 'U';

		cout << endl;
		return 0;
}


Measured memory_bytes: 256
"use sict"
function main(arg) {
var d = arg.trim().split("\n")
var s = d[0]
d.shift()
d.shift()
var f = true
for (var i = 0; i < d.length; i++) {
var r = d[i].split(' ')
if (r[0] === '1') {
f = !f
}
if (r[0] === '2') {
if (r[1] === '1') {
if (f) {
s = r[2] + s
}else {
s += r[2]
}
}
if (r[1] === '2') {
if (f) {
s += r[2]
}else {
s = r[2] + s
}
}
}
}
if (!f) {
s = s.split('').reverse().join('')
}
console.log(s)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 56068
#include <iostream>
using namespace std;
int main() {
   string a,b;
   cin>>a>>b;
   if(a.size()>b.size()){cout<<"GREATER"<<endl;return 0;}
   else if(b.size()>a.size()){cout<<"LESS"<<endl;}
   else{
   	for(int i=0;i<a.size();i++){
   		if(a[i]>b[i]){cout<<"GREATER"<<endl;return 0;}
   	            if(a[i]<b[i]){cout<<"LESS"<<endl;return 0;}
   		if(i==a.size()-1){cout<<"EQUAL"<<endl;return 0;}
   		}
   }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

int main(){
  int h,w,k;
  cin>>h>>w>>k;
  vector<string> vec(h);
  rep(i,h) cin>>vec[i];

  vector<vector<int>> memo(h,vector<int>(w,INF));
  queue<pair<int,int>> q;
  rep(i,h)rep(j,w) if(vec[i][j]=='S'){ q.push(mp(i,j)); memo[i][j] = 0; }

  int ans = INF;
  while(!q.empty()){
    auto p = q.front(); q.pop();
    int x = p.fi, y=p.se;
    int d = min(min(x, h-x-1), min(y, w-y-1));
    int tmp = (d+k-1)/k + 1;
    ans = min(ans, tmp);

    if(memo[x][y]>=k) continue;

    int dx[]={0,-1,1,0}, dy[]={-1,0,0,1};
    rep(i,4){
      int nx = x + dx[i], ny = y+dy[i];
      if(nx<0 || ny<0 || nx>=h || ny>=w || memo[nx][ny]!=INF || vec[nx][ny]=='#') continue;
      memo[nx][ny] = memo[x][y] + 1;
      q.push(mp(nx,ny));
    }
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 2e5 + 9, M = 1e6, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;



ll power(ll b, ll p){
    if(p == 0)return 1;
    ll res = power(b,p/2);
    res *= res;
    res %= modulo;
    if(p & 1)res *= b;
    return res % modulo;
}


int main(){
    init();

    int sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;

    for(int i = sx;i < tx;i++)  cout << 'R';
    for(int i = sy;i < ty;i++)  cout << 'U';
    for(int i = sx;i < tx;i++)  cout << 'L';
    for(int i = sy;i < ty;i++)  cout << 'D';
    cout << 'L';
    for(int i = sy;i <= ty;i++)  cout << 'U';
    for(int i = sx;i <= tx;i++)  cout << 'R';
    cout << 'D';

    cout << 'R';
    for(int i = sy;i <= ty;i++)  cout << 'D';
    for(int i = sx;i <= tx;i++)  cout << 'L';
    cout << 'U';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2005,mod=998244353;
char s[N];
int sum1[N],sum2[N];
ll dp[N<<1][N<<1];
int main()
{
    scanf("%s",s+1);
    int n=strlen(s+1);
    for(int i=1;i<=n;i++)
    {
        sum1[i]=sum1[i-1];
        sum2[i]=sum2[i-1];
        if(s[i]=='0') sum1[i]+=2;
        else if(s[i]=='1') sum1[i]++,sum2[i]++;
        else sum2[i]+=2;
    }
    dp[0][0]=1;
    for(int i=0;i<=sum1[n];i++)
        for(int j=0;j<=sum2[n];j++)
        if(dp[i][j])
    {
        if(i<sum1[min(n,i+j+1)]) (dp[i+1][j]+=dp[i][j])%=mod;
        if(j<sum2[min(n,i+j+1)]) (dp[i][j+1]+=dp[i][j])%=mod;
    }
    printf("%lld\n",dp[sum1[n]][sum2[n]]);
}


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

typedef long long ll;

void solve(ll n) {
	string res;
	while (n--) {
		ll d = n % 26;
		res.push_back(d+97);
		n /= 26;
	}
	reverse(res.begin(), res.end());
	cout << res << endl;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n;
	cin >> n;
	solve(n);
	return 0;
}

Measured memory_bytes: 3604
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var result int64 = 0
	for i := 1; i <= n; i++ {
		if i%3 == 0 || i%5 == 0 {
			continue
		}
		result += int64(i)
	}
	fmt.Println(result)
}


Measured memory_bytes: 1752
#入力 A:使う1個当たりのタップの口数 B:最終的にここまで増やす差し込み口の数
A, B = list(map(int,input().split()))
#タップの必要数をans, 差し込み口の数をsocとする
ans = 0
soc = 1
#差し込み口はタップを使うと増えるが一つ使うと必ず1つ差し込み口を消費する。
while soc < B:
  soc -= 1
  ans += 1
  soc += A
#結果  
print(ans)

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
int main(){
  typedef long long int ll;
int A, B, C;
cin >> A;
bool ans = false;
if(A < 1200)ans = true;
if(ans)cout << "ABC" << endl;
else cout << "ARC" << endl;
        return 0;
}

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

#define ll long long

ll dp[100001];
int main()
{



	
    ll n;
    cin>>n;

dp[1]=0;
     
     ll a[n+1];
     for(ll i=1;i<=n;i++)
     	cin>>a[i];

     dp[2]=dp[1]+abs(a[2]-a[1]);

     for(ll i=3;i<=n;i++)
     {
     	dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
     }
  cout<<dp[n];
}


Measured memory_bytes: 1792
//#include <fstream>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>

using namespace std;

//ifstream cin("tema.in");
//ofstream cout("tema.out");

int main() {
    int k, s, answer = 0;
    cin >> k >> s;
    for (int x = 0; x <= k; x++)
        for (int y = 0; y <= k; y++)
            if (s - x - y >= 0 && s - x - y <= k)
                answer++;
    cout << answer << "\n";
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << 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; }
#define int long long

void solve() {
	int n, W; cin >> n >> W;
    vector<int> w(n), v(n);
    vector<P> x(n);
    rep(i, n) {
        cin >> w[i] >> v[i];
        x[i] = make_pair(v[i], w[i]);
    }
    int ma = w[0];
    rep(i, n) {
        w[i] -= ma;
        x[i].sc -= ma;
    }
    int dp[111][331][111];
    rep(i, 110) {
        rep(j, 330) {
            rep(k, 110) {
                dp[i][j][k] = 0;
            }
        }
    }
    rep(i, n) {
        for(int j = 0; j <= 300; ++j) {
            for(int k = 0; k <= n; ++k) {
                dp[i + 1][j][k] = dp[i][j][k];
                if(j - w[i] >= 0 && k - 1 >= 0)  dp[i + 1][j][k] = max(dp[i][j][k], dp[i][j - w[i]][k - 1] + v[i]);
            }
        }
    }
    int ans = 0;
    for(int k = 0; k <= n; ++k) {
        if(W - k * ma < 0) continue;
        int y = min(W - k * ma, 3 * k);
        for(int j = 0; j <= y; ++j) chmax(ans, dp[n][j][k]);
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 32128
import heapq
import math
def main():
  a,b=map(int,input().split())
  c=list(map(int,input().split()))
  c=[-i for i in c]
  heapq.heapify(c)
    
  for j in range(b):
    x=heapq.heappop(c)
    heapq.heappush(c,math.ceil(x/2))
    
  print(-sum(c))
  
if __name__ == '__main__':
    main()
  


Measured memory_bytes: 14532
#include <iostream>
#include <sstream>

int main() {
    int n, num, i;
    std::stringstream ss;
    std::cin >> n;
    for (i=1;i<=n;i++) {
        num = i;
        while (true) {
            if (i % 3 == 0) {
                ss << " " << i;
                break;
            }
            if (num % 10 == 3) {
                ss << " " << i;
                break;
            } else {
                num /= 10;
                if (num == 0) break;
            }
        }
    }
    std::cout << ss.str() << std::endl;
    return 0;
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

const int mx=200010;
const ll mod=1e9+7;

int n,m;
string s;
int ans = 0;


int main(){
  cin >> n >> s;
  if(n%2!=0){cout << "No" << endl; return 0; }
  m = n/2;
  bool flag = true;
  for(int i=0; i<m; i++){
    if(s[i]!=s[i+m]){flag = false; break;}
  }
  cout << (flag?"Yes":"No") << endl;
  return 0;  
}

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

int inp[12][13];

int main(){
	int n,m,x;	cin>>n>>m>>x;
	for(int i=0;i<n;i++){
		for(int j=0;j<=m;j++)cin>>inp[i][j];
	}


	int ans=1000000000;
	for(int flag=0; flag<(1<<n); flag++){
		vector<int> sum(13,0);
		for(int i=0; i<n; i++){
			if((flag>>i)&1){
				for(int j=0;j<=m;j++){
					sum[j]+=inp[i][j];
				}
			}
		}

		bool can=true;
		for(int i=1;i<=m;i++){
			if(sum[i]<x){
				can=false;	break;
			}
		}

		if(can)ans=min(ans,sum[0]);
	}
	if(ans==1000000000)cout<<-1<<endl;
	else cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3636
import java.util.*;
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 k = sc.nextInt();
      
      	int count = 0;
      	boolean yon = false;
      
      	while(count <= k && !yon){
          if(b <= a) b *= 2;
          else if(c <= b) c *= 2;
          else yon = true;
          count++;
        }
      
      	if(yon) System.out.println("Yes");
        else System.out.println("No");
	}
}


Measured memory_bytes: 35696
#include <stdio.h>

int main(){
	int one=1;

	while(one<10){
		int two=1;
		while(two<10){
			int kotae=one*two;
			printf("%dx%d=%d\n",one,two,kotae);
			two+=1;
		}
		one+=1;
	}
	return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,r,l) for(int i=r;i>=l;i--)
const int MX=2e5;
const int mod=1e9+7;
const double eps=1e-6;
const double pi=3.14159265358979;
int inv2;
using namespace std;
ll in[MX+7],pr[MX+7],prni[MX+7],F[MX+7];
ll qpow(ll a,ll b,ll MOD=mod){for(ll ans=1;;a=a*a%MOD,b>>=1){if(b&1)ans=ans*a%MOD;if(!b)return ans;}}
ll inv(ll a,ll MOD=mod){return qpow(a,MOD-2,MOD);}
ll __gcm(ll a,ll b){return a*b/__gcd(a,b);}
int dcmp(double x){
    if(x>eps)return 1;
    return x<-eps?-1:0;
}
int main()
{
  ios::sync_with_stdio(0),cin.tie(0);
  int n;
  cin>>n;
  ll ans=0;
  for(int i=1;i<=n;i++)
  {
      if(i%3&&i%5)ans+=i;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define il inline
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define mid ((l+r)>>1)
#define MAXN 1000050
#define MAXM 
#define mod 1000003
#define inf (1<<30)
#define eps (1e-6)
#define alpha 0.75
#define rep(i, x, y) for(register int i = x; i <= y; ++i)
#define repd(i, x, y) for(register int i = x; i >= y; --i)
#define file(s) freopen(s".in", "r", stdin), freopen(s".my", "w", stdout)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, int> pli;
typedef pair <int, ll> pil;
typedef pair <ll, ll> pll;
template <typename T> il bool chkmin(T &x, T y) {return x > y ? x = y, 1 : 0;}
template <typename T> il bool chkmax(T &x, T y) {return x < y ? x = y, 1 : 0;}
template <typename T> il void read(T &x) {
	char ch = getchar(); int f = 1; x = 0;
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = x*10+ch-'0', ch = getchar();
	x *= f;
}
template <typename T, typename... Args> il void read(T &x, Args &...args) {
	read(x), read(args...);
}
ll m, x, d, n;
ll f[MAXN], invf[MAXN];
ll fpow(ll x, ll y) {
	ll ret = 1;
	while(y) {
		if(y & 1) ret = ret * x % mod;
		x = x * x % mod;
		y >>= 1;
	}
	return ret;
}
ll calc() {
	if(!x) return 0;
	if(!d) return fpow(x, n);
	x = x * fpow(d, mod-2) % mod;
	if(x + n - 1 >= mod) return 0;
	ll ans = f[x + n -1] * invf[x - 1] % mod;
	return ans * fpow(d, n) % mod;
}
int main() {
	read(m);
	f[0] = 1;
	rep(i, 1, mod-1) f[i] = f[i-1] * i % mod;
	invf[mod-1] = fpow(f[mod-1], mod - 2);
	repd(i, mod-1, 1) invf[i-1] = invf[i] * i % mod;
	while(m--) {
		read(x, d, n);
		printf("%d\n", calc());
	}
	return 0;
}

Measured memory_bytes: 16512