akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		String next;
		int op1, op2;
		Stack<Integer> stack = new Stack<Integer>();

		while(scanner.hasNext()){
			next = scanner.next();
			switch(next){
				case "+":
					op1 = stack.pop();
					op2 = stack.pop();
					stack.push(op2+op1);
					break;
				case "-":
					op1 = stack.pop();
					op2 = stack.pop();
					stack.push(op2-op1);
					break;
				case "*":
					op1 = stack.pop();
					op2 = stack.pop();
					stack.push(op2*op1);
					break;
				default :
					stack.push(Integer.parseInt(next));
			}
		}

		System.out.println(stack.pop());

	}
}

Measured memory_bytes: 26120
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

using piv = pair<int, vector<int>>;

int main() {
    string s; cin >> s;
    vector<int> cnt(26, 0);
    for (char c: s) cnt[c - 'a']++;
    priority_queue<piv, vector<piv>, greater<piv>> pq;
    for (int i = 0; i < 26; i++) if (cnt[i]) {
        pq.emplace(cnt[i], vector<int>({i}));
    }
    if (pq.size() == 1) {
        cout << s.length() << endl;
        return 0;
    }
    vector<int> len(26, 0);
    while (pq.size() > 1) {
        int sum = 0;
        vector<int> nums;
        for (int cnt: {0, 1}) {
            piv p = pq.top(); pq.pop();
            sum += p.first;
            copy(p.second.begin(), p.second.end(), back_inserter(nums));
        }
        for (int i: nums) len[i]++;
        pq.emplace(sum, nums);
    }
    int ans = 0;
    for (char c: s) ans += len[c - 'a'];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
from collections import defaultdict
N, u, v = map(int, input().split())
d = defaultdict(list)
for _ in range(N-1):
    A, B = map(int, input().split())
    d[A].append(B)
    d[B].append(A)

def get_dist(s):
    dist = [-1]*(N+1)
    dist[s] = 0

    q = [s]
    while q:
        a = q.pop()
        for b in d[a]:
            if dist[b]!=-1:
                continue
            dist[b] = dist[a] + 1
            q.append(b)
    return dist

du, dv = get_dist(u), get_dist(v)
ds = [(i,j[0], j[1]) for i,j in enumerate(zip(du, dv)) if j[0]<j[1]]
ds.sort(key=lambda x:-x[2])
a, b, c = ds[0]
print(c-1)

Measured memory_bytes: 85976
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<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,x,y) 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 scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define pb push_back
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, flag;
ll dx[5] = { 1,-1,0,0,0 }, dy[5] = { 0,0,1,-1,0 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111

ll num[15];

void dfs(ll cur, ll prev, ll mini) {
  if (cur == 24) {
	ll x = min(mini, 24 - prev);
	ans = max(ans, x);
	return;
  }

  if (cur < 12) {
	if (num[cur] == 2) dfs(cur + 1, cur, min(mini, cur - prev));
	else if (num[cur] == 1) {
	  num[cur]--;
	  dfs(cur + 1, cur, min(mini, cur - prev));
	  num[cur]++;
	  dfs(cur + 1, prev, mini);
	}
	else dfs(cur + 1, prev, mini);
  }
  else {
	if (num[24 - cur]) dfs(cur + 1, cur, min(mini, cur - prev));
	else dfs(cur + 1, prev, mini);
  }

}

int main(void) {
  cin >> n;
  rep(i, n) {
	scan(tmp);
	num[tmp]++;
  }
  if (num[0] || num[12] > 1) {
	cout << "0" << endl;
	return 0;
  }
  rep(i, 13) {
	if (num[i] > 2) {
	  cout << "0" << endl;
	  return 0;
	}
  }

  ans = 0;
  dfs(1, 0, inf);
  cout << ans << endl;

  return 0;
}

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

int main() {
    long long N;
    vector<string> s;
    vector<int> t;
    string X;
    cin >> N;
    for (auto i = 0; i < N; i++) {
        string str;
        cin >> str;
        int tim;
        cin >> tim;
        s.push_back(str);
        t.push_back(tim);
    }
    cin >> X;
    size_t i = 0;
    for (;i < N; i++) {
        if (s[i] == X) {
            i ++;
            break;
        }
    }
    long long res = 0;
    for (;i < N; i++) {
        res += t[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int x;
	cin >> x;
	long long int p=100;
	for (long long int i = 0; i < x; ++i)
	{
		p=p*(1.01);
		if(p>=x){
			cout << i+1 << endl;
			break;
		}
	}

}

Measured memory_bytes: 3640
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int i,j,n,m,d,low,high,mid,cnt,min,sum,flg;
	int ten[100001],hai[10001]; 
	while(1) {
		scanf("%d",&d);
		if(d==0) break;
		scanf("%d",&n);
		scanf("%d",&m);
		ten[0]=0;
		for(i=1;i<n;i++) scanf("%d",&ten[i]);
		ten[n]=d;
		for(i=0;i<m;i++) scanf("%d",&hai[i]);
		sort(ten,ten+(n+1));
//		for(i=0;i<=n;i++) printf("%d\n",ten[i]);
		sum=0;
	
		for(i=0;i<m;i++) {
			flg=0;
			low=0;
			high=n;	
			min=2100000000;
			while(low<=high) {
				mid=(low+high)/2;
				if(ten[mid]==hai[i]) {
					min=0;
					break;
				}
				if(ten[mid]<hai[i]) {
					low=mid+1;
					if(min>hai[i]-ten[mid]) min=hai[i]-ten[mid];
//					printf("%d-%d\n",hai[i],ten[mid]);
				}
				else {
					high=mid-1;
					if(min>ten[mid]-hai[i]) min=ten[mid]-hai[i];
//					printf("%d-%d\n",ten[mid],hai[i]);
				}
			}
//			printf("min=%d\n",min);
			sum+=min;
		}
		printf("%d\n",sum);
	}
	return 0;
}
	

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

typedef long long int lli;
typedef long int li;


int main(){
    ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	long long a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;
    long long d1 = v * t;
    long long d2 = w * t;
    if(b >= a){
        b =  b + d2;
        a = a + d1;
        if(a >= b) cout << "YES\n";
        else cout << "NO\n";
    }
    else {
        b = b - d2;
        a = a - d1;
        if(a <= b) cout << "YES\n";
        else cout << "NO\n";
    }
}	

/*
	check for corner cases.
	When using log check for zeros.
	Use queues and stacks if they are helping.           
                            
    (___)           
    . . )____________ 
   _|__/\           |\
  (o_o_) \__________| \
           /|     ||   )     
          < |     ||  
*/



Measured memory_bytes: 3652
import java.io.InputStreamReader;
import java.io.LineNumberReader;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_10_B
 * 
 * @author eitatsuro
 * 
 */
public class Main {
    public static void main(String[] args) {
        try {
            LineNumberReader lineNumReader = new LineNumberReader(
                    new InputStreamReader(System.in));
            
            String inputStr = null;
            double a = 0;
            double b = 0;
            double C = 0;
            
            double S = 0;
            double L = 0;
            double h = 0;
            
            while ((inputStr = lineNumReader.readLine()) != null) {
                
                // ??????????????????????????????.
                if (lineNumReader.getLineNumber() == 1) {
                    String[] points = inputStr.split(" ");
                    a = Double.parseDouble(points[0]);
                    b = Double.parseDouble(points[1]);
                    C = Double.parseDouble(points[2]);

                    
                    // ??¢???????¨????.
                    double rad = 2.0*Math.PI*(C/360);
                    S = 0.5 * b * a * Math.sin(rad);
                    
                    // ?????¨.
                    // ?????????????????????????????????????±???????.
                    double remainLine = Math.sqrt(a*a + b*b -2*a*b*Math.cos(rad)); 
                    L = remainLine + a + b;
                    
                    // a???????????¨????????¨????????????h
                    h = 2*S/a;

                    // ????????????.
                    System.out.println(String.format("%.8f", S));
                    System.out.println(String.format("%.8f", L));
                    System.out.println(String.format("%.8f", h));
                }
                
                if (lineNumReader.getLineNumber() > 1) {
                    break;
                }
            }
            
            lineNumReader.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
        
    }
    
    public static String shuffle(String original, int h) {
        StringBuilder shuffledStr = new StringBuilder(original);
        String temp = shuffledStr.substring(0, h);
        shuffledStr.delete(0, h);
        shuffledStr.append(temp);
        return shuffledStr.toString();
        
    }
}

Measured memory_bytes: 24752
#include<bits/stdc++.h>
using namespace std;
int a[102];
int main()
{
    int m,n,k;
    cin>>m>>n>>k;
      int s=0;
    for(int i=1;i<=min(m,n);i++)
     {
         if(m%i==0&&n%i==0)
            a[s++]=i;
     }
     cout<<a[s-k]<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
int main(){
  long long N, M;
  cin >> N >> M;
  vector<long long> A(N);
  vector<long long> B(N);

  for(long long i = 0; i < N; i++){
    cin >> A[i] >> B[i];
  }

  vector<pair<long long,long long> > AB(N);
  for(int i = 0; i < N; i++){
    AB[i] = make_pair(A[i],B[i]);
  }

  sort(AB.begin(),AB.end());

  long long ans = 0;

  /*for(auto count : AB){
    for(int i = 0; i < N; i++){
      int d = min(count.second,M);
      ans += count.first * d;
      M -= d;
    }
    }*/

  for(auto count : AB){
    long long d = min(count.second,M);
    ans += count.first * d;
    M -= d;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3456
#include <stdio.h>
 
int rot[5][7] = {
{0,1,2,3,4,5,6},{0,2,6,3,4,1,5},{0,4,2,1,6,5,3},{0,3,2,6,1,5,4},{0,5,1,3,4,6,2}};
int assign[7];      // サイコロの1～6の各面に割り当てる数字
int tr['Z'];
 
void dice_init(int *a)
{
    int i;
    int t[5] = {0,'N','E','W','S'};
    for (i = 1; i <= 6; i++) assign[i] = a[i];
    for (i = 1; i <= 4; i++) tr[t[i]] = i;
}
 
char s[102];
int main()
{
    int i, k1, k2;
    int a[7], dice[2][7];
    char *p;
 
    for (i = 1; i <= 6; i++) scanf("%d", a+i);
    dice_init(a);
    scanf("%s", p=s);
    for (i = 1; i <= 6; i++) dice[0][i] = rot[0][i];
    for (k1 = 0, k2 = 1; *p; k1 = k2, k2 = !k2) {
        for (i = 1; i <= 6; i++) dice[k2][i] = dice[k1][rot[tr[*p]][i]];
        p++;
    }
    printf("%d\n", assign[dice[k1][1]]);
    return 0;
}


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

using namespace std;

#define EPS (1e-9)
typedef complex<double> Point;

int main(){
  int N;
  while(cin >> N, N){
    Point p[N];
    for(int i = 0 ; i < N ; i++){
      scanf("%lf,%lf",&p[i].real(),&p[i].imag());
    }
    int res = 1;
    for(int i = 0 ; i < N-1 ; i++){
      for(int j = 0 ; j < N ; j++){
        Point np = p[j]-p[i];
        double d = abs(np);
        if(d + EPS > 2.0){ continue; }
        np /= d;
        np *= Point(0,1);
        Point cp = (p[i]+p[j])/2.0;
        Point v = sqrt(1.0-d*d/4.0)*np;
        int cnt = 2;
        Point center = cp + v;
        for(int k = 0 ; k < N ; k++){
          if(i == k || j == k){ continue; }
          Point diff = center-p[k];
          if(norm(diff) < 1.0 + EPS){
            cnt++;
          }
        }
        res = max(res,cnt);
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1292
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
	char p;
	std::cin >> p;
	if(p=='A'){
	    std::cout << 'T' << std::endl;
	}else if(p=='T'){
	    std::cout << 'A' << std::endl;
	}else if(p=='G'){
	    std::cout << 'C' << std::endl;
	}else if(p=='C'){
	    std::cout << 'G' << std::endl;
	}
	
	return 0;
}

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

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

    vector<int> A(N);
    vector<int> B(N);
    long long sub_minus = 0;
    vector<int> sub_plus;
    int ans = 0;

    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> B[i];
        int sub = A[i] - B[i];
        if (sub >= 0)
        {
            sub_plus.push_back(sub);
        }
        else
        {
            sub_minus += sub;
            ans++;
        }
    }

    if (accumulate(A.begin(), A.end(), 0LL) < accumulate(B.begin(), B.end(), 0LL))
    {
        cout << -1 << endl;
        return 0;
    }
    if (sub_minus == 0)
    {
        cout << 0 << endl;
        return 0;
    }

    sort(sub_plus.begin(), sub_plus.end(), greater<int>());
    for (int i = 0; i < sub_plus.size(); i++)
    {
        sub_minus += sub_plus[i];
        ans++;
        if (sub_minus >= 0)
        {
            cout << ans << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 1660
N, M = [int(x) for x in input().split()]

vs = set()
dvs = [0 for _ in range(N+1)]
def dfs_w(v, d):
    # dfs while版 
    stack = [v]
    path = []
    cd=ld= 0
    while True:
        if len(stack) == 0:
            break
        v = stack.pop()
        if v in vs:
            p = stack.pop()
            dvs[-p] = max(dvs[-p], dvs[v]+1)
            continue
        if v < 0:
            c = path.pop()
            dvs[-v] = max(dvs[-v], dvs[c]+1)
            cd -= 1
        else:
            vs.add(v)
            path.append(v)
            ld = max(ld, cd)
            cd += 1
            for u in d[v]:
                stack += [-v, u]
    return False

d = [set() for _ in range(N+1)]
for _ in range(M):
    a, b = [int(x) for x in input().split()]
    d[a].add(b)

for i in range(N):
    i += 1
    if i in vs:
        continue
    dfs_w(i, d)
print(max(dvs))


Measured memory_bytes: 81072
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=110;
int c[N];

int main()
{
	int k=0,n;scanf("%d",&n);
	for(int i=1,x;i<=n;++i) scanf("%d",&x),++c[x],k=max(k,x);
	bool ok=true;
	if(k&1)
	{
		for(int i=k;i>=(k+1)/2;--i) 
		{
			c[i]-=2;
			if(c[i]<0){ok=false;break;};
		};
		for(int i=1;i<(k+1)/2+1;++i) 
			if(c[i]>0){ok=false;break;};
	}else
	{
		for(int i=k;i>=k/2+1;--i)
		{
			c[i]-=2;
			if(c[i]<0){ok=false;break;};
		};
		if(--c[k/2]<0) ok=false;
		for(int i=1;i<k/2+1;++i) 
			if(c[i]>0){ok=false;break;};
	};
	puts(ok?"Possible":"Impossible");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;


int main(){

  vector<int>h;

  for(int i = 0; i < 10; i++){
    int t;
    cin >> t;
    h.push_back(t);
  }
  sort(h.rbegin(),h.rend());

  for(int i = 0; i < 3; i++){
    cout << h[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
typedef long long int ll;
const ll N = 1e5 +9;
const ll p = 31;
// const ll m = 1e9 + 7;
const ll inf= 1e14;
const ll mod = 1e9+7;
#define x first
#define y second
#define pb push_back
#define mp make_pair
using pii = pair<ll, ll>;
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }
std::vector<ll> adj[N],nadj[3*N];
ll dist[3*N];bool vis[3*N];

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

    ll T= 1;
    // cin >> T;
    while(T--){
        ll n,m,u,v;cin>>n>>m;
        for(int i = 0;i<n;i++){
            dist[3*i]=inf;
            dist[3*i +1]=inf;
            dist[3*i +2]=inf;
        }
        for(int i = 0;i<m;i++){
            cin>>u>>v;u--;v--;
            adj[u].pb(v);
            nadj[3*u].pb(3*v+1);
            nadj[3*u+1].pb(3*v+2);
            nadj[3*u +2].pb(3*v);
        }
        ll s,t;cin>>s>>t;s--;t--;
        memset(vis,0,sizeof(vis));
        dist[3*s] = 0;
        queue<ll> q;
        q.push(3*s);
        while(!q.empty()){
            ll v = q.front();
            q.pop();
            for(auto u:nadj[v]){
                if(vis[u])continue;
                vis[u] = 1;
                dist[u] = min(dist[u],dist[v]+1);
                q.push(u);
            }
        }
        ll ans= dist[t*3];
        if(ans==inf){
            cout<<-1;
        }
        else{
            cout<<ans/3<<'\n';
        }
        
        
    }
    return 0;
}   

Measured memory_bytes: 24832
#include <bits/stdc++.h>
using namespace std;
#define rep for(int i = 0;i<n;i++)
#define ll long long
 
//const int INF = 1e8;
typedef pair<int,int>P;
int dx[4] = {1,0,-1,0};int dy[4] = {0,1,0,-1};
queue<P> que;

int main(){
    int n;cin >> n;
    int p[n]; rep{cin >> p[i];}
    int sum = 0;
    for(int i = 1;i<n-1;i++){
        if(p[i+1]> p[i] and p[i] > p[i-1]){
            sum += 1;
        }else if(p[i+1] < p[i] and p[i] < p[i-1]){
            sum += 1;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int n, i;
    int a[5000];
    int j, k;
    int sum, max;

    for (;;) {
        scanf("%d", &n);
        if (n == 0) break;

        for (i = 0; i < n; i++) {
            scanf("%d", &a[i]);
        }

        max = -1000000;
        for (j = 0; j < n; j++) {
            sum = 0;
            for (k = j; k < n; k++) {
                sum += a[k];
                if (sum > max) max = sum;
            }
        }

        printf("%d\n", max);
    }

    return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
 
const int H = 40;
ll dp[H];
 
struct Shop {
	ll a, b;
	Shop(ll av, ll bv) : a(av), b(bv) {}
 
	bool operator<(const Shop& rhs) const {
		return a * rhs.b > rhs.a * b;
	}
};
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
 
	// Increment all b_i's and t by one to account for the time to traverse between stores
 
	// If we visit stores i and j, and have already spent k time, we spend
	// (a_i k + b_i) + (a_j (a_i k + b_i + k) + b_j)
	// = a_i k + b_i + a_j a_i k + a_j b_i + a_j k + b_j
	// = (a_i k + a_j k + b_i + b_j + a_i a_j k) + a_j b_i
 
	// So we visit i first if a_j b_i <= a_i b_j
	// that is, a_j / b_j <= a_i / b_i
	// So we visit in decreasing order of a_i / b_i
 
	// How many stores with a_i > 0 can we visit?
	// We go from k to at least (k + 1) + k >= 2k,
	// thus at most log_2(T)
 
	// 1 0, 2 1
	// 1 -> 3 -> 11
	// 1 -> 5 -> 11
 
	int n;
	ll t;
	cin >> n >> t;
 
	dp[0] = 0;
	for (int j = 1; j < H; ++j) dp[j] = t + 1;
 
	vector<ll> offs = {0};
	vector<Shop> shops;
	for (int i = 0; i < n; ++i) {
		ll a, b;
		cin >> a >> b;
		++b; // Time to move to next shop
		if (a == 0) offs.push_back(b);
		else shops.emplace_back(a, b);
	}
	sort(shops.begin(), shops.end());
	
	for (auto sp : shops) {
		for (int m = H-2; m >= 0; --m) {
			ll off = dp[m] + (dp[m] + 1) * sp.a + sp.b;
			if (off <= t) dp[m+1] = min(dp[m+1], off);
		}
	}
 
	sort(offs.begin(), offs.end());
	for (int i = 1; i < (int)offs.size(); ++i) offs[i] += offs[i-1];
 
	int j = (int)offs.size() - 1;
	int res = 0;
	for (int m = 0; m < H; ++m) {
		while(j >= 0 && dp[m] + offs[j] > t) --j;
		if (j < 0) break;
		res = max(res, m + j);
	}
	cout << res << '\n';
}

Measured memory_bytes: 6512
#include <iostream>

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

using namespace std;

int main(){
	int n;
	cin >> n;
	int p[n];
	int max_value = 0;
	int sum = 0;
	
	rep(i,n) {
		cin >> p[i];
		max_value = max_value > p[i] ? max_value:p[i];
		sum += p[i];
	}
	
	sum -= max_value/2;
	
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3628
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	N := nextInt(sc)
	D := make(map[int]int, 0)
	for i := 0; i < N; i++ {
		D[nextInt(sc)]++
	}
	M := nextInt(sc)
	T := make(map[int]int, 0)
	for i := 0; i < M; i++ {
		T[nextInt(sc)]++
	}
	// fmt.Println("N", N, "D", D, "M", M, "T", T)
	ans := "YES"
	for k, v := range T {
		if D[k] < v {
			ans = "NO"
			break
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 17536
S = int(input())
A = 0
B = 0
ans = "NA"
if 0 < S//100 < 13 :
  A = 1

if 0 < S%100 < 13 :
  B = 1

if A == 1 and B == 1 :
  ans = "AMBIGUOUS"

elif A == 1 :
  ans = "MMYY"

elif B == 1:
  ans = "YYMM"

print(ans)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cctype>
using namespace std;

int main(){
    string A,B;
    cin >> A >> B;
    if (A==B){
      puts("H");
    } else {
      puts("D");
  }
}


Measured memory_bytes: 256
#![allow(unused)]

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

fn main() {
    input! {
        n: usize,
        xus: [(f64,String);n],
    }

    let ans: f64 = xus
        .iter()
        .map(|x| if x.1 == "JPY" { x.0 } else { x.0 * 380000.0 })
        .sum();
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long int
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int N = 1e6 + 5;
const int oo = 1e9 + 5;
const LL ooll = 1e18 + 5;
const int MOD = 1e9 + 7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l, r) uniform_int_distribution<int>(l, r)(rng)

int v[205];
void solve() {
    LL x, d, k;
    cin >> x >> k >> d;
    if (x < 0) x *= -1;
    LL y = x % d;
    if ((x - y) / d >= k) {
        cout << x - k * d << '\n';
    } else {
        LL go = k - (x - y) / d;
        if (go & 1) cout << abs(y - d) << '\n';
        else cout << y << '\n';
    }
}

int main() {
    FASTIO;
    int T = 1;
    // cin >> T;
    while(T--) {
        solve();
    }
    // cerr << fixed << setprecision(10);
    // cerr << (clock() - start) / ((long double)CLOCKS_PER_SEC) << '\n';
    return 0;
} 

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(true){
		int num=0;
		int[] cc= new int[5];
		int n, m, s, g1, g2;
		
		while(num<5){
			cc[num]=sc.nextInt();
			num++;
        }
		n=cc[0];
		m=cc[1];
		s=cc[2];
		g1=cc[3];
		g2=cc[4];
		
		if(n==0 && m==0){
			if(s==0 && g1==0){
				if(g2==0){break;}
			}
		}
		
		int[][] road= new int[n][n];
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				road[i][j]=1000000;
				if(i==j){
					road[i][j]=0;
				}
			}
		}
		

		num=0;
		int i,j,cost;
		while(num<m){
			i=sc.nextInt();
			j=sc.nextInt();
			cost=sc.nextInt();
			road[i-1][j-1]=cost;
			num++;
		}

		for(int k=0;k<n;k++){
			for(i=0;i<n;i++){
				for(j=0;j<n;j++){
					if(road[i][j]>road[i][k]+road[k][j]){
						road[i][j]=road[i][k]+road[k][j];
					}
				}
			}
		}
		int r=1000000;
		for(int k=0;k<n;k++){
			if(r>road[s-1][k]+road[k][g1-1]+road[k][g2-1]){
				r=road[s-1][k]+road[k][g1-1]+road[k][g2-1];
			}
		}
		System.out.println(r);
		}
	}
}

Measured memory_bytes: 61156
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
// 素因数分解
vector<pair<long long, long long>> prime_factorize(long long n)
{
  vector<pair<long long, long long>> res;
  for (long long 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()
{
  int k;
  string s;
  cin >> k >> s;
  if (s.size() > k)
  {
    for (int i = 0; i < k; i++)
    {
      cout << s[i];
    }
    cout << "..." << endl;
  }
  else
  {
    cout << s << endl;
  }
  return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

const ll INF = 1LL << 60;

int main() {
    int n;
    while (cin >> n, n) {
        PQ que;
        que.push(P(0LL,INF));
        map<P,ll> m;
        while (n--) {
            char c;
            cin >> c;
            if (c == 'W') {
                ll t, l;
                cin >> t >> l;
                P p;
                while (true) {
                    p = que.top(); que.pop();
                    ll s = p.first, g = p.second;
                    if (s + l - 1 <= g) {
                        if (s + l - 1 < g)
                            que.push(P(s + l, g));
                        m[P(s, s + l - 1)] = t;
                        break;
                    } else {
                        m[P(s, g)] = t;
                        l -= g - s + 1;
                    }
                }
            } else if (c == 'D') {
                ll t; cin >> t;
                auto tmp(m);
                for (auto i : tmp) {
                    if (i.second == t) {
                        que.push(i.first);
                        m.erase(m.find(i.first));
                    }
                }
            } else {
                ll x; cin >> x;
                bool flag = true;
                for (auto i : m) {
                    if (i.first.first <= x && x <= i.first.second) {
                        cout << i.second << endl;
                        flag = false;
                        break;
                    }
                }
                if (flag)
                    cout << -1 << endl;
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3544
#include <iostream>
using namespace std;
int main(void){
    int n,q[200008]={0},m=0;
    cin>>n;
    for(int i=0;i<n;i++){
        int p;
        cin>>p;
        if(q[p-1]==0){
            q[p]=1;
        }else{
            q[p]=q[p-1]+1;
        }
    }
    for(int i=0;i<n;i++){
        m=max(m,q[i+1]);
    }
    cout<<n-m<<endl;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
int fa[MAXN],a[MAXN],b[MAXN];
int n,m;
int main(){
	SF("%d%d",&n,&m);
	int cnt=0;
	for(int i=1;i<=m;i++){
		SF("%d",&a[i]);
		if(a[i]%2==1)
			cnt++;
	}
	if(m==1){
		PF("%d\n",a[1]);	
		if(a[1]==1)
			PF("1\n1");
		else
			PF("2\n%d %d",a[1]-1,1);
		return 0;
	}
	if(cnt>2){
		PF("Impossible");
		return 0;	
	}
	for(int i=1;i<=m;i++)
		if(a[i]%2==1){
			swap(a[i],a[1]);
			break;
		}
	for(int i=m-1;i>1;i--)
		if(a[i]%2==1){
			swap(a[i],a[m]);
			break;	
		}
	for(int i=1;i<=m;i++)
		PF("%d ",a[i]);
	b[1]=a[1]+1;
	for(int i=2;i<m;i++)
		b[i]=a[i];
	b[m]=a[m]-1;
	if(b[m]==0)
		m--;
	PF("\n%d\n",m);
	for(int i=1;i<=m;i++)
		PF("%d ",b[i]);
}

Measured memory_bytes: 128
a,b,c,k=map(int,input().split())
ans=0
if k>=a:
    k-=a
    ans+=a
else:
    ans+=k
    k=0
if k>=b:
    k-=b
else:
    k=0
if k>=c:
    ans-=c
    k-=c
else:
    ans-=k
    k=0
print(ans)
        
        


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

const int maxW = 1e5 + 10;

int n, m, v[110], w[110];
long long f[110][maxW];

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i)
        scanf("%d%d", &w[i], &v[i]);
    memset(f, 0, sizeof(f));
    for (int i = 1; i <= n; ++i)
        for (int j = 0; j <= m; ++j)
        {
            f[i][j] = f[i - 1][j];
            if (j - w[i] >= 0)
                f[i][j] = max(f[i][j], f[i - 1][j - w[i]] + v[i]);
        }
    printf("%lld", f[n][m]);
}

Measured memory_bytes: 86144
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    if(k==0):
        print(n**2)
        return
    ans=0
    for b in range(k+1,n+1):
        q=(n-k)//b+1
        ans+=q*(b-k)-max(0,(q*b-1)-n)
    print(ans)
resolve()

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

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var siritori = Console.ReadLine().Split(' ');

            if (siritori[0][siritori[0].Length - 1] == siritori[1][0] && siritori[1][siritori[1].Length - 1] == siritori[2][0])
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var solver = new Solver();
            solver.Calc();
        }
    }

    public class Solver
    {
        public struct AB
        {
            public int A;
            public int B;
        }

        int N;
        List<string> list = new List<string>();



        public void AddNext(string input, int count)
        {


            if (count == N)
            {
                list.Add(input + "1");
                list.Add(input + "0");
                return;
            }
            else
            {

                AddNext(input + "1", count + 1);
                AddNext(input + "0", count + 1);
            }

        }

        public void Calc()
        {

            var p = Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray();

            var A = p[0];
            var B = p[1];
            var H = p[2];
            var M = p[3];


            var angle = Math.Abs(12.0 / 60.0 * M - (H + M / 60.0)) * 360 / 12;
            var angle2 = 360 - angle;

            angle = Math.Min(angle, angle2);

            var c = Math.Sqrt(A * A + B * B - 2 * A * B * Math.Cos(angle * Math.PI / 180));
            Console.WriteLine(c);


        }


    }

}


Measured memory_bytes: 28576
#include<stdio.h>

int main(void)

{
    int a,b,d,r;
    double f;

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

    d = a / b;
    r = a % b;
    f = (double)a / b;

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

    return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;
#define INF (int)(1e9)
#define EPS (1e-7)
#define MOD ((ll)1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n); ++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  (a.begin(),a.end())
#define RALL(a) (a.begin(),a.end(),greater<int>())
#define pb push_back
#define vec vector<int>


/*--------------------------------------------*/
/*ll factorial(ll);
void list_Prime(ll);
ll divisor(ll);
ll lcm(ll, ll);//AとBの最小公倍数
ll gcd(ll,ll);

int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
*/
/*--------------------------------------------*/
/*--------------------------------------------*/
/*
ll factorial(ll n){
    if(n==1)return 1;
    return n*factorial(n-1);
}
ll lcm(ll A, ll B) {//最小公倍数
    ll a = A;
    ll b = B;
    if (a == 0 || b == 0) { return 0; }
    if (a < 0) { a = -a; }
    if (b < 0) { b = -b; }
    while (b > 0) {
        ll c = a % b;
        a = b;
        b = c;
    }
    return A/a*B;
}

ll gcd(ll a,ll b){
    while (b != 0) {
        int t = b;
        b = a % b;
        a = t;
    }
    return a;
}

vector<ll> prime_list(ll n){//n以下の素数を全て見つける
    vector<ll> is_prime(n);//is_prime[i]が1ならiは素数
    for(ll i=2;i<=n;i++)is_prime[i]=1;//最初はみんな素数かも
    for(ll i=2;i*i<=n;i++){//素数の整数倍を消していく(√nまで)
        if(is_prime[i]){
            for(ll j=2*i;j<=n;j++){
                if(j%i==0){
                    is_prime[j]=0;                
                }
            }
        }
    }return is_prime;
}vector<ll>k=prime_list(n);REP(i,n){if(k[i])cout<<i<<endl;}のように使う

//入力はすべて正とする
bool is_prime(int n) {//素数判定o(√n)
    for (int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return n!=1;//1の場合は例外
}

vector<ll> divisor(ll n){//約数の列挙o(√n)
    vector<ll> res;
    for(ll i=1;i*i<=n;i++) {
        if(n%i == 0){
        res.push_back(i);
        if(i!=n/i)res.push_back(n/i);
        }
    }
    return res;
}//vector<ll>k=divisor(n);rep(i,k.size())cout<<k[i]<<endl;//のように使う

map<ll,ll> prime_factor(ll n){//素因数分解o(√n)
    map<ll,ll>res;    
    for(ll i=2;i*i<=n;i++) {
        while (n%i==0) { 
            ++res[i];
            n/=i;
        }
    }
    if (n!=1)res[n]=1;
    return res;
}//map<ll,ll> k=prime_factor(n);for(auto i=k.begin();i!=k.end();i++){cout<<i->first<<" "<<i->second<<endl;}//みたいに使う
*/
/*--------------------------------------------*/


int main(){
    int a,b,c,k;cin>>a>>b>>c>>k;
    int m=max(max(a,b),c);
    int s=m;
    rep(i,k)m*=2;
    if(s==a){cout<<m+b+c<<endl;return 0;}
    if(s==b){cout<<a+m+c<<endl;return 0;}
    else cout<<a+b+m<<endl;
}




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

using ll  = long long;
using pii = pair<int,int>;
#define dbg(n) cout<<'\n'<<#n<<" is "<<n<<'\n';
#define pb push_back
#define all(v) v.begin(), v.end()
#define cs(i) cout<<"Case "<<i+1<<": " 

const int sz = 3e3+5;
const int INF = 1e9+5;
string a,b,ans;
int dp[sz][sz];
void printLCS(int i,int j){
    if(i==0||j==0)
        return;
    else if(a[i-1]==b[j-1]){
        ans.pb(a[i-1]);  
        printLCS(i-1,j-1);    
    }
    else if(dp[i-1][j]>dp[i][j-1]){
        printLCS(i-1,j);
    }
    else if(dp[i-1][j]<dp[i][j-1]){
        printLCS(i,j-1);
    }
    else{
        printLCS(i,j-1);
    }
}

int main(){

    cin>>a>>b;
    
    for(int i=1;i<=a.size();i++){
        for(int j=1;j<=b.size();j++){
            if(a[i-1]==b[j-1])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    printLCS(a.size(),b.size());
    reverse(all(ans));
    cout<<ans<<endl;

    return 0;
}


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

int main() {
	int sum = 0;
	for(int i = 0; i < 4; ++i) {
		int time;
		cin >> time;
		sum += time;
	}

	cout << sum / 60 << "\n" << sum % 60 << endl;
	return EXIT_SUCCESS;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define Cout(s) cout << s << endl;
using ll = long long;
using P = pair<int, int>;

const ll INF = 1ll << 60;
ll MOD = 1e9 + 7;

int main()
{

    int a, b, k;
    cin >> a >> b >> k;
    k--;
    int n = max(a, b);
    vector<int> arr;

    for (int i = 1; i <= n; i++)
    {
        if (a % i == 0 && b % i == 0)
            arr.push_back(i);
    }

    sort(arr.rbegin(), arr.rend());

    Cout(arr[k]);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stack>

using namespace std;

int main (){
  stack<int> s;
  char str[100];
  int a, b;
  
  while (scanf("%s", str) != EOF) {
    if (str[0] == '+') {
      b = s.top();
      s.pop();
      a = s.top();
      s.pop();
      s.push(a + b);  
    } else if (str[0] == '-') {
      b = s.top();
      s.pop();
      a = s.top();
      s.pop();
      s.push(a - b);  
    } else if (str[0] == '*') {
      b = s.top();
      s.pop();
      a = s.top();
      s.pop();
      s.push(a * b);  
    } else {
      s.push(atoi(str));
    }
  }

  printf("%d\n", s.top());

  return 0;
}


Measured memory_bytes: 3216
/**
*
* Author: MARS
* Lang: GNU C++14
*
**/

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

#define F first
#define S second
#define ii pair < int , ll >
#define LS pair < ll , string >

typedef unsigned long long ull;
typedef long double ldbl;
typedef long long ll;
typedef double dbl;

const ldbl E = 2.71828182845904523536;
const ldbl pi = acos(-1);
const dbl eps = 1e-9;
const ll mod = 1e9+7;
const ll inf = 1LL<<60;

/** /////////// ** Code ** /////////// **/

const int N=200200;
vector<ii>adj[N];
ll vis[N];
bool ok=1;

void DFS(int u,ll k){
    if(vis[u] != inf){
        if(vis[u] != k) ok=0;
        return ;
    }

    vis[u]=k;
    for(auto v:adj[u])
        DFS(v.F,k+v.S);

}

int main()
{
    int n,m; scanf("%d%d",&n,&m);
    while(m--){
        int u,v,d; scanf("%d%d%d",&u,&v,&d);
        adj[u].push_back({v,d});
        adj[v].push_back({u,-1*d});
    }

    for(int i=1 ; i<=n ; i++) vis[i]=inf;

    for(int i=1 ; i<=n ; i++){
        if(vis[i] != inf) continue;
        DFS(i,1);
    }

    if(ok) printf("Yes");
    else printf("No");

    return 0;
}


Measured memory_bytes: 17920
A, B, M = gets.split.map(&:to_i)

arr = gets.split.map(&:to_i)
brr = gets.split.map(&:to_i)
lists = []
M.times do
  s, t, u = gets.split.map(&:to_i)
  lists << arr[s-1] + brr[t-1] - u
end
# p lists
a_min = arr.min
b_min = brr.min
ab_min = a_min + b_min
l_min = lists.min
puts ab_min <= l_min ? ab_min : l_min

Measured memory_bytes: 19228
#include <cstdio>
#include <iostream>
#include <vector>

#define N 100000

using namespace std;

vector<int> G[N];
int color[N];

void dfs(int s,int c){
  color[s]=c;
  for(int i=0;i<G[s].size();i++){
    if(color[G[s][i]]!=c) dfs(G[s][i],c);
  }
}

int main(){
  int n,m;
  scanf("%d %d",&n,&m);
  for(int i=0;i<n;i++) color[i]=-1;
  for(int i=0;i<m;i++){
    int s,t;
    scanf("%d %d",&s,&t);
    G[s].push_back(t);
    G[t].push_back(s);
  }
  int q; scanf("%d",&q);
  for(int i=0;i<n;i++){
    if(color[i]==-1)
      dfs(i,i); //node_id and color_id
  }
  for(int i=0;i<q;i++){
    int s,t;
    scanf("%d %d",&s,&t);
    if(color[s]==color[t]) cout << "yes\n";
    else cout << "no\n";
  }
}

Measured memory_bytes: 12080
a = input().split("/")

if int(a[0]) < 2019:
  print("Heisei")
elif int(a[0]) == 2019 and int(a[1]) <= 4:
  print("Heisei")
elif int(a[0]) == 2019 and int(a[1]) >= 5:
  print("TBD")
else:
  print("TBD")

Measured memory_bytes: 3060
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#define Mod 1000000007
#define INF 1e14
typedef long long int ll;
const ll N=1e5+5;
int main()
{
   ll m,d;
   cin>>m>>d;
   ll ans=0;
   ll i,j;
   for(i=1;i<=m;i++)
   {
       for(j=1;j<=d;j++)
       {
           ll p,q;
           q=j%10;
           p=j/10;
           if(p>=2&&q>=2)
           {
               if(p*q==i)
                ans++;
           }
       }
   }
   cout<<ans;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
  long long N, M;
  scanf("%lld %lld", &N, &M);
  if (N > M) {
    swap(N, M);
  }
  long long ans;
  if (N >= 2) {
    ans = (N-2) * (M-2);
  } else {
    if (M == 1) {
      ans = 1;
    } else {
      ans = M-2;
    }
  }
  printf("%lld", ans);
  return 0;
}


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

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using namespace std;

using ll = long long;
using LL = long long;

class Edge{
public:
    int from,to;
    ll value, konzatu;
    Edge(int a,int b,ll c, ll d){
        from = a;
        to = b;
        value = c;
        konzatu = d;
    }
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

ll cnt = 0;
int K;
void lunlun(int n, string s){
    if(n == s.size()){
        cnt++;
        if(cnt == K){
            cout<<s<<endl;
        }
        return;
    }
    if(s.empty()){
        for(int i = 1;i <= 9;i++){
            s = to_string(i);
            lunlun(n, s);
        }
    }else{
        char c = s.back();
        for(char i = '0';i <= '9';i++){
            if(abs(c - i) <= 1){
                s.push_back(i);
                lunlun(n, s);
                s.pop_back();
            }
        }
    }
}

int main(){
    cin >> K;

    for(int i = 1;i <= 12;i++){
        lunlun(i, string());
    }
}

Measured memory_bytes: 256
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   

int main(){
    std::ios::sync_with_stdio(false);
    ll n,a,b;
    cin>>n>>a>>b;
    cout<<min(a*n,b)<<endl;
    return 0;
    
}



Measured memory_bytes: 256
#include <stdio.h>

int main (){
    int i;
    char C[4];
    for (i=0;i<4;i++){
        scanf("%c",&C[i]);
    }
    if(C[0] == 'Y'){
        if(C[1] == 'A'){
            if(C[2] == 'K'){
                if (C[3] == 'I'){
                    printf ("Yes\n");
                }else {printf("No\n");}
            }else {printf("No\n");}
        }else {printf("No\n");}
    }else {printf("No\n");}

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007


int main() {
	
	int N,A;
	cin>>N>>A;
	
	int element[N+10];
	fx(N){
		int a;
		cin>>a;
		element[x]=a-A;
	}
	
	ll dp[N+5][3001];
	fx(3001){
			dp[0][x]=0;
	}
dp[0][1500]=1;
	for(int x=1;x<=N;x++){
      for(int y=0;y<=3000;y++){
        dp[x][y]=dp[x-1][y];
      }
		for(int y=0;y<=3000;y++){
			if(y+element[x-1]<0||y+element[x-1]>3000){continue;}
			
			dp[x][y+element[x-1]]+=dp[x-1][y];
			
		}
	}

	ce(dp[N][1500]-1)
}

Measured memory_bytes: 1408
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

ques = ord('?')

def Z_algo2(s):
    ls = len(s)
    lcp = [0]*ls
    lcp[0] = ls
    i,j = 1,0
    while i < ls:
        while i+j < ls and (s[j] == s[i+j] or s[j] == '?' or s[i+j] == '?'):
            j += 1
        lcp[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while i+k < ls and k + lcp[k] < j:
            lcp[i+k] = lcp[k]
            k += 1
        i += k
        j -= k
    return lcp

def Z_algo(s,t):
  l = [0]*len(t)
  for i in range(len(t)):
    j = 0
    while j < len(s) and i+j < len(t) and (s[j] == t[i+j] or s[j] == ques or t[i+j] == ques):
      j += 1
    l[i] = j
  return l

a = list(map(ord, list(ns())))
b = list(map(ord, list(ns())))
c = list(map(ord, list(ns())))

l = [a, b, c]
g = [[0]*3 for _ in range(3)]
for i in range(3):
    for j in range(3):
        if i != j:
            g[i][j] = Z_algo(l[i],l[j])
            # print(i,j,g[i][j])
ans = sum(len(x) for x in l)
for i in range(3):
    for j in range(3):
        if i == j: continue
        k = 3-i-j
        li = [ii for ii in range(len(l[i])) if g[j][i][ii] >= min(len(l[i]) - ii, len(l[j]))]
        lj = [ii for ii in range(len(l[j])) if g[k][j][ii] >= min(len(l[j]) - ii, len(l[k]))]
        lk = [ii for ii in range(len(l[i])) if g[k][i][ii] >= min(len(l[i]) - ii, len(l[k]))]
        if li:
            c = max(len(l[i]), min(li) + len(l[j])) + len(l[k])
            if ans > c: ans = c
        for ii in li:
            for jj in lj:
                kk = ii + jj
                if kk >= len(l[i]) or g[k][i][kk] >= min(len(l[i]) - kk, len(l[k])):
                    c = max(len(l[i]), ii + len(l[j]), kk + len(l[k]))
                    if ans > c: ans = c
        for ii in li:
            for kk in lk:
                if kk < ii + len(l[j]): continue
                c = max(len(l[i]), ii + len(l[j]), kk + len(l[k]))
                if ans > c: ans = c
print(ans)


Measured memory_bytes: 53980