akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

int main()
{
    int n, l;
    std::cin >> n >> l;

    std::string strArr[n];

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

    std::sort(strArr, strArr + n);

    for(int i = 0; i < n; i++)
    {
        std::cout << strArr[i];
    }

    std::cout << std::endl;

    return 0;
}


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

#define ll long long
#define pb push_back

vector<int>g[100003];
vector<int>v(100003);
queue<int>q;

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

    if(n%2==0)
    {
        cout<<0.5<<endl;
    }
    else
    {
        double a = (n/2)+1;
        double b = n;
        cout<<setprecision(7)<<fixed<<a/b<<endl;
    }


}










Measured memory_bytes: 2944
import math

A, B = map(int, input().split())
Al = math.ceil(A / 0.08)
Am = math.ceil((A+1)/0.08)

Bl = int(B / 0.1)
Bm = int((B+1) / 0.1)

Ar = list(range(Al, Am))
Br = list(range(Bl, Bm))

for i in Ar:
    if i in Br:
        print(i)
        break
    else:
        continue
else:
    print(-1)

Measured memory_bytes: 3064
n, k = map(int, input().split())
li = dict()

for i in range(n):
    a,b = map(int, input().split())
    li.setdefault(a,0)
    li[a] += b

li = sorted(li.items())
ans = 0
for i in range(len(li)):
    ans += li[i][1]
    if ans >= k:
        print(li[i][0])
        exit()

Measured memory_bytes: 52696
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
LL x, y, s1, s2, s3, best = 10000000000;
int main(){
	scanf("%lld%lld", &x, &y);
	if (x*y % 3 == 0) { puts("0"); return 0; }
	if (x%3) best = y; if (y%3) best = min(x,y);
	s1 = x/3*y; s2 = (x-x/3)*(y/2); s3 = x*y-s1-s2;
	best = min(best, max(s1, max(s2, s3)) - min(s1, min(s2, s3)));
	s1 = (x+2)/3*y; s2 = (x-(x+2)/3)*(y/2); s3 = x*y-s1-s2;
	best = min(best, max(s1, max(s2, s3)) - min(s1, min(s2, s3)));
	swap(x, y);
	s1 = x/3*y; s2 = (x-x/3)*(y/2); s3 = x*y-s1-s2;
	best = min(best, max(s1, max(s2, s3)) - min(s1, min(s2, s3)));
	s1 = (x+2)/3*y; s2 = (x-(x+2)/3)*(y/2); s3 = x*y-s1-s2;
	best = min(best, max(s1, max(s2, s3)) - min(s1, min(s2, s3)));
	printf("%lld\n", best);
	return 0;
}

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

using namespace std;
int main()
{
    int a, c;
    int i = 0;
    
    cin >> a;
    int d[a];
    while(i<a){
        d[i] = 0;
        i++;
    }
    i = 0;
    while(i<a-1){
        cin >> c;
        d[c-1] += 1;
        i++;
    }
    i=0;
    while(i<a){
        cout << d[i] << endl;
        i++;
    }
}

Measured memory_bytes: 4416
S = input()
count = 0

while S != "":
	while S[0] != "A" and S[0] != "C" and S[0] !="G" and S[0] !="T":
#		print(S)
		S = S[1:]
		if S == "":
			break
	
	if S == "":
		break
	c = 0
	while S[0] == "A" or S[0] == "C" or S[0] =="G" or S[0] =="T":
		c +=1
		if count < c:
			count = c
	
#		print("count = " + str(count) + ", S = " + S)
		S = S[1:]
#		print(S)
		if S == "":
			break
	
	if S == "":
		break

print(count)


Measured memory_bytes: 3064
#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 par[100001];
int treesize[100001];
int group = 100000;

int find(int x) {           //親探し
	if (x == par[x]) {
		return x;
	}
	else {
		int z = find(par[x]);
		par[x] = z;
		return z;
	}
}

bool  unit(int x, int y) {

	int xpar = find(x);
	int ypar = find(y);

	if (xpar == ypar) { return false; }   //すでに結合済み
	group--;
	par[ypar] = xpar;
	treesize[xpar] += treesize[ypar];
	return true;
}

int main()
{
	int N,M;
	cin >> N >> M;
	map<int, int> K;
	fx(N) {
		int p;
		cin >> p;
		par[p] = p;
		K[p] = x + 1;
	}
	fx(M) {
		int a, b;
		cin >> a >> b;
		unit(a, b);
	}
	int ans = 0;
	fx(N) {
		if (find(x+1)==find(K[x+1])) {
			ans++;
		}
	}
	ce(ans)
    return 0;
}



Measured memory_bytes: 5760
#include<cstdio>
#include<queue>
#include<cstring>
#define maxn 805
#define INF 0x3f3f3f3f
using namespace std;
typedef pair<int,int> PII;
int h,w,k,dist[maxn][maxn],sx,sy,d[5]={0,1,0,-1,0},ans=INF;
char s[maxn][maxn];
queue<PII> q;
int Get(int i,int j)
{
	int tmp=(i+k-2)/k;
	tmp=min(tmp,(j+k-2)/k);
	tmp=min(tmp,(h-i+k-1)/k);
	tmp=min(tmp,(w-j+k-1)/k);
	return tmp;
}
int main()
{
	scanf("%d%d%d",&h,&w,&k);
	for(int i=1;i<=h;i++) scanf("%s",s[i]+1);
	for(int i=1;i<=h&&!sx;i++)
		for(int j=1;j<=w&&!sx;j++)
			if(s[i][j]=='S') sx=i,sy=j;
	memset(dist,0x3f,sizeof(dist));
	dist[sx][sy]=0;
	q.push(PII(sx,sy));
	while(!q.empty())
	{
		int x=q.front().first,y=q.front().second;
		q.pop();
		if(dist[x][y]==k) continue;
		for(int i=1;i<=4;i++)
		{
			int cx=x+d[i-1],cy=y+d[i];
			if(cx<1||cy<1||cx>h||cy>w||dist[x][y]+1>=dist[cx][cy]||s[cx][cy]=='#') continue;
			dist[cx][cy]=dist[x][y]+1; q.push(PII(cx,cy));
		}
	}
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			if(dist[i][j]<INF)
				ans=min(ans,Get(i,j)+1);
	printf("%d\n",ans);
}


Measured memory_bytes: 3456
def main():
	N, K = map(int,input().split())
	points = [0]*N
	max_x, max_y, min_x, min_y = -10**9, -10**9, 10**9, 10**9
	for i in range(N):
		points[i] = list(map(int, input().split()))
		max_x = max(max_x, points[i][0])
		min_x = min(min_x, points[i][0])
		max_y = max(max_y, points[i][1])
		min_y = min(min_y, points[i][1])

	points.sort(key=lambda x:x[0])
	ans = (max_x-min_x)*(max_y-min_y)
	for r in range(K, N+1):
		for l in range(N-r+1):
			w = points[r+l-1][0] - points[l][0]
			this_points = sorted(list(points[l:l+r]), key=lambda x:x[1])
			for b in range(r-K+1):
				h = this_points[b+K-1][1] - this_points[b][1]
				ans = min(ans, w*h)
	print(ans)


if __name__ == '__main__':
    main()

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

int main () {
  int a, b, c;
  cin >> a >> b >> c;
  int n = 100 * a + 10 * b + c;
  if (n % 4 == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
stack = [0]
top = 0

def push(x):
    global top
    top += 1
    stack.insert(top, x)

def pop():
    global top
    top -= 1
    return stack[top+1]

def main():
    input_line = input().split(" ")
    for i in input_line:
        if i == "+":
            a = pop()
            b = pop()
            push(a+b)
        elif i == "-":
            b = pop()
            a = pop()
            push(a-b)
        elif i == "*":
            a = pop()
            b = pop()
            push(a*b)
        else:
            push(int(i))
    
    print(pop())

if __name__ == '__main__':
    main()
    



Measured memory_bytes: 5600
N,A,B=map(int,input().split())
S=str(input())
ac=0
bc=0
for i in range(N):
    if S[i]=='c':
        print('No')
    elif S[i]=='a':

        if ac+bc <A+B:
            ac +=1
            print('Yes')
        else:
            print('No')
    else:

        if bc<B and ac+bc<A+B:
            print('Yes')
            bc += 1
        else:
            print('No')

Measured memory_bytes: 4016
fn input_line() -> Vec<String> {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).unwrap();
  return buf
    .split_whitespace()
    .map(|word| String::from(word))
    .collect();
}

fn main() {
  let inputs = input_line();
  let n: usize = inputs[0].parse().unwrap();
  let inputs = input_line();
  let mut a: Vec<i64> = Vec::new();
  for i in 0..n {
    a.push(inputs[i].parse().unwrap());
  }

  let mut tops: Vec<usize> = Vec::new();
  for i in 1..(n - 1) {
    if a[i - 1] < a[i] && a[i + 1] <= a[i] {
      tops.push(i);
    }
  }
  if a[n - 2] < a[n - 1] {
    tops.push(n - 1);
  }

  let mut bottoms: Vec<usize> = Vec::new();
  for i in 0..tops.len() {
    let mut bottom = 200;
    let mut bottom_i: usize = 0;
    let left = if i == 0 {
      0
    } else {
      tops[i - 1]
    };
    for j in left..tops[i] {
      if a[j] < bottom {
        bottom = a[j];
        bottom_i = j;
      }
    }
    bottoms.push(bottom_i);
  }

  let mut money: i64 = 1000;
  for i in 0..bottoms.len() {
    let buy_value = a[bottoms[i]];
    let stock = money / buy_value;
    money -= buy_value * stock;
    let sell_value = a[tops[i]];
    money += sell_value * stock;
  }

  println!("{}", money);
}

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

int main(){
  int h,w,k;
  cin>>h>>w>>k;
  vector<string> s(h);
  rep(i,h)cin>>s[i];
  int ans=0;

  for(int is=0;is<(1<<h);++is)
    for(int js=0;js<(1<<w);js++){
      int cnt=0;
      for(int i=0;i<h;++i)
	for(int j=0;j<w;j++){
	  if(is>>i&1)continue;
	  if(js>>j&1)continue;
	  if(s[i][j]=='#')cnt++;
	}
      if(cnt==k)ans++;
    }
  
  
    
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
using namespace std;
int n,b[200],i;
vector<int> ans;
int main(){
    cin>>n;
    for(i=1;i<=n;i++)cin>>b[i];
    
    while(n){
        for(i=n;i&&b[i]!=i;i--){}
        if(!i){
            cout<<-1<<endl;
            return 0;
        }
        ans.push_back(i);
        for(;i<=n;i++)b[i]=b[i+1];
        n--;
    }
    for(i=ans.size()-1;i>=0;i--)cout<<ans[i]<<endl;
    return 0;
}


Measured memory_bytes: 256
/*
NAME:
 ___   _      _   ___  
/ __| /_\    /_\ |   \ 
\__ \/ _ \  / _ \| |) |
|___/_/ \_\/_/ \_\___/ 

lang: 
  ___   _      _   
 / __)_| |_  _| |_ 
( (__(_   _)(_   _)
 \___) |_|    |_|  

*/
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>
 
using namespace std;
 
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()

typedef long long ll;
typedef long l;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<l> vl;
typedef vector<ll> vll;

const int INF = 1 << 29;
const int MOD = 1e9 + 7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }
 
void solve(){
	int x,n;
	cin>>x>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	bool f[101]={0};
	for(int i=0;i<n;i++) f[a[i]]=1;
	int cnt1=0,cnt2=0;
	for(int i=x;i<=100;i++){
		if(f[i]==1) cnt1++;
		else break;
	}
	for(int i=x;i>=0;i--){
		if(f[i]==1) cnt2++;
		else break;
	}
	if(cnt1<cnt2) cout<<x+cnt1<<endl;
	else if(cnt1>=cnt2) cout<<x-cnt2<<endl;

}

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

	solve();

	return 0;
}

Measured memory_bytes: 3200
using CompLib.Util;
using System;
using System.Text;

public class Program
{
    long K, Q;
    long[] D;
    long[] N, X, M;
    public void Solve()
    {
        var sc = new Scanner();
        K = sc.NextInt();
        Q = sc.NextInt();
        D = sc.LongArray();
        N = new long[Q];
        X = new long[Q];
        M = new long[Q];
        for (int i = 0; i < Q; i++)
        {
            N[i] = sc.NextInt();
            X[i] = sc.NextInt();
            M[i] = sc.NextInt();
        }
        var sb = new StringBuilder();

        for (int i = 0; i < Q; i++)
        {
            var dm = new long[K];
            for (int j = 0; j < K; j++)
            {
                dm[j] = D[j] % M[i] == 0 ? M[i] : D[j] % M[i];
            }
            // a[j] == a[j + 1]となる場合
            // 0をmとすることで下のに統合できる

            // a[j] >= a[j+1]となる場合
            // a[j]をmで割った商 + 1 == a[j+1]をmで割った商

            long f = X[i];

            long l = X[i];

            for (int j = 0; j < K; j++)
            {
                if (j < ((N[i] - 1) % K))
                {
                    l += dm[j] * ((N[i] - 1) / K + 1);
                }
                else
                {
                    l += dm[j] * ((N[i] - 1) / K);
                }
            }

            long b = (l / M[i]) - (f / M[i]);
            sb.AppendLine((N[i] - 1 - b).ToString());
        }
        Console.Write(sb.ToString());

    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;
    class Scanner
    {
        private int _index;
        private string[] _line;
        const char separator = ' ';

        public Scanner()
        {
            _index = 0;
            _line = new string[0];
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(separator);
                _index = 0;
            }
            return _line[_index++];
        }
        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(separator);
            _index = _line.Length;
            return _line;
        }
        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
    }
}

Measured memory_bytes: 35040
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

A, B = reads()
print("Yay!" if A <= 8 and B <= 8 else ":(")

Measured memory_bytes: 3828
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define    endl        '\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repp(i,a,b)    for(ll int i=b-1;i>=a;i--)
#define tr(container,it) for(__typeof__(container.begin()) it = container.begin(); it != container.end(); it++)
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define mpi         map<pair<ll int,ll int>,ll int>
#define vii         vector<pair<ll,pair<ll,ll> > >
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        998244353
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;
#define N  10000
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";



void solve(){
	ll x;
	cin>>x;
	ll z=100,an=0;
	while(z<x){
		an++;
		z+=z/100;
	}
	cout<<an;
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll TESTS=1,an=1,f;
    // cin>>TESTS;
    while(TESTS--){
        // cout<<"Case #"<<an<<": ";
        an++;
        solve();

    }
    return 0;
}

Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Read();
            var ans = 0;
            for (int i = 0; i < 3; i++)
            {
                if (x[i].ToString() == "1") ans++;
            }
            WriteLine(ans);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

using namespace std;

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

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

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

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

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

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

    ll n;
    cin>>n;
    YES(n==3||n==5||n==7)
    return  0;
}


Measured memory_bytes: 256
import sys
import itertools
from itertools import accumulate
def main():
    import itertools
    def eratosthenes_sieve(n):
        table = [0] * (n + 1)
        prime_list = []
        for i in range(2, n + 1):
            if table[i] == 0:
                prime_list.append(i)
                for j in range(i + i, n + 1, i):
                    table[j] = 1
        return prime_list
        def inputs():return (int(x) for x in input().split())
    input = sys.stdin.readline
    def inputs():
        return [int(x) for x in input().split()]
    S = input()
    x,y=inputs()
    cnt=0
    s =[]
    if S[0]=="T":
        s.append(0)
        cnt+=1
    else:
        cnt+=1
    for i in range(len(S)-2):
        if S[i]==S[i+1]:
            cnt+=1
        else:
            s.append(cnt)
            cnt=1
    s.append(cnt)
    flag=1
    x1 = []
    y1 = []
    t= 0
    for i in range(len(s)):
        if i%2==0:
            if flag==1:
              if i!=0:
                x1.append(s[i])
            else:
                y1.append(s[i])
        else:
            flag=(flag+s[i])%2
            t+=s[i]
    x2 = sum(x1)+s[0]
    y2= sum(y1)
    if abs(x)>x2 or abs(y)>y2:
      print("No")
      exit()
    m = max(x2,y2,t)
    dpx=[[-1]*(m*2+5) for i in range(len(x1)+1)]
    dpx[0][m+s[0]]=1
    dpy =[[-1]*(m*2+5) for i in range(len(y1)+1)]
    dpy[0][m]=1
    for i in range(len(x1)):
        for j in range(m*2):
          if dpx[i][j]!=-1:
            if j+x1[i]<=(m)*2:
                dpx[i+1][j+x1[i]]=1
            if j-x1[i]>=0:
                dpx[i+1][j-x1[i]]=1      
    for i in range(len(y1)):
        for j in range(m*2):
          if dpy[i][j]!=-1:
            if j+y1[i]<=m*2:
                dpy[i+1][j+y1[i]]=1
                #print(j+y1[i])
            if j-y1[i]>=0:
                dpy[i+1][j-y1[i]]=1
                #print(j-y1[i])
    if dpx[len(x1)][m+x]==1 and dpy[len(y1)][m+y]==1:
        print("Yes")
    else:
        print("No")
main()


Measured memory_bytes: 285448
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
(defmacro dp (name args memo-size &body body)
  (let ((memo (gensym)))
    `(let ((,memo (make-array ,memo-size :initial-element nil)))
       (defun ,name ,args
         (or (aref ,memo ,@args)
             (setf (aref ,memo ,@args)
                   ,@body))))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
        (cons (subseq str 0 pos)
              (split x (subseq str (+ pos size))))
        (list str))))

(defmacro collect-times (time body)
  `(loop repeat ,time collect ,body))

(defun read-times (time)
  (collect-times time (read)))

(defun binary-search (l r f &aux (m (ash (+ l r) -1)))
  "f の結果がtになる最小の値を見つけます"
  (if (= l r)
      l
      (if (funcall f m)
          (binary-search l m f)
          (binary-search (1+ m) r f))))

(defmacro aif (expr then else)
    `(let ((it ,expr))
       ,then
       ,else))

(defun main (str)
  (loop for i from 1 below (length str)
        maximize
        (length (remove-duplicates
                 (intersection
                  (coerce (subseq str 0 i) 'list)
                  (coerce (subseq str i) 'list))))))

#-swank
(let ((n (read))
      (str (read-line)))
  (princ (main str)))


Measured memory_bytes: 14268
#include <cstdio>
#include <string>
#include <algorithm>
#include <iostream>

using namespace std;

const int INF = 0x3f3f3f3f;
const int maxn = 2000;

int N,v[maxn],len[maxn];
int dp[maxn];

string s[maxn],str;

int main()
{
    int cas = 1;
    while(cin >> N && N)
    {
        for(int i=0;i<N;i++)
        {
            cin >> s[i] >> v[i];
            len[i] = s[i].length();
        }
        cin >> str;
        int length = str.length();

        for(int i=0;i<=length;i++) dp[i] = -INF;
        dp[0] = 0;

        for(int i=0;i<=length;i++)
        {
            for(int j=0;j<N;j++)
            {
                int End = i - len[j];
                if(End>=0 && dp[End]>=0 && str.substr(End,len[j]) == s[j])
                    {dp[i] = max(dp[i],dp[End]+v[j]);}
            }
        }

        int mx = dp[length];

        for(int i=0;i<=mx;i++) dp[i] = INF;
        dp[0] = 0;

        for(int i=0;i<N;i++)
        {
            for(int j=0;j<=mx-v[i];j++)
                dp[j+v[i]] = min(dp[j+v[i]] , dp[j]+len[i]);
        }
        cout << "Case "<<cas++<< ": " << dp[mx] << endl;
    }
}

Measured memory_bytes: 1272
N = int(input())
A = list(map(int, input().split()))

for i in range(1, N):
    print(' '.join(list(map(str, A))))
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    
print(' '.join(list(map(str, A))))


Measured memory_bytes: 5600
import math
n = int(input())
xy = []
for i in range(n):
	xy.append(list(map(int, input().split())))
d = []
for i in range(n-1):
	for j in range(i, n):
		d.append(((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**(1/2))
print(2*sum(d)/n)

Measured memory_bytes: 3064
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int D[400001],T[400001];
int main(){
    int N,M;
    cin>>N;
    for(int i=0;i<N;i++)cin>>D[i];
    cin>>M;
    for(int i=0;i<M;i++)cin>>T[i];
    sort(D,D+N);sort(T,T+M);
    int al=0;
    for(int i=0;i<N;i++){
        if(D[i]==T[al]){
            al++;
        }
    }
    if(al==M)puts("YES");
    else puts("NO");
    return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long q = sc.nextLong();
        long h = sc.nextLong();
        long s = sc.nextLong();
        long d = sc.nextLong();
        long n = sc.nextLong();
        q *= 4;
        h *= 2;
        long ans = 0;
        if(n >= 2) {
            ans += Math.min(q * 2, (Math.min(h * 2, (Math.min(s * 2, d))))) * (n / 2);
            n = n - (n / 2) * 2;
        }
        ans += Math.min(q, (Math.min(h, s))) * n;
        System.out.println(ans);
    }
}

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

const int MOD = 1000000007;
const int INF = 1e9;

int main(){

  string s = "";
  int k;
  cin >> k;

  for(int i = 0; i < k; i++){
    s.push_back('A');
    s.push_back('C');
    s.push_back('L');
  }
  cout << s << endl;
  

  return 0;
}

Measured memory_bytes: 3524
#include <stdio.h>
#include <ctype.h>

int main(void) {
  char c, t[26] = {0}, i;
 
  while ((c = getchar()) != EOF) {
    if (isalpha(c)) {
      t[tolower(c) - 'a']++;
    }
  }

  for (i = 0; i < 26; i++) {
    printf("%c : %d\n", i + 'a', t[i]);
  }

  return 0;
}

Measured memory_bytes: 524
n, m = map(int, input().split())
k = []
for _ in range(m):
    k.append(input().split())
p = [int(_) for _ in input().split()]

#print(k)
#print(p)

ans = 0
for i in range(2**n):
    state = [0] * n
    for j in range(n):
        state[j] = (i >> j) & 1

    #print(state)

    cnt = 0
    for j in range(m):
        num_on = 0
        for l in range(1, len(k[j])):
            if state[int(k[j][l]) - 1] == 1:
                num_on += 1
        if num_on % 2 == p[j]:
            cnt += 1
    if cnt == m:
        ans += 1

print(ans)

Measured memory_bytes: 3064
/*
Author : Hocky Yudhiono
5/31/2020 7:35:09 PM

1. You can sort the query if offline!
2. Don't bring the dp remaining state when dfsing on DP on Tree.
3. Try to reverse (Think from the back) if you stuck.
4. Be careful when submitting Div. 2 D-F, dont waste it on stupid WAs.
5. Try to reduce a problem
*/

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <cstdio>
#include <limits>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef vector<int> vi;
typedef pair<LL,LL> PLL;
typedef pair<LL,int> PLI;
typedef pair<int,int> PII;
typedef pair<int,int> pii;
typedef vector<vector<LL>> VVL;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define popf pop_front
#define pf push_front
#define popb pop_back
#define mp make_pair
#define pb push_back
#define remove erase
#define fi first
#define se second

//If the time limit is strict, try not to use long double

//Remember to undefine if the problem is interactive
#define endl '\n'
#define DEBUG(X) cout << ">>> DEBUG(" << __LINE__ << ") " << #X << " = " << (X) << endl

const double EPS = 1e-9;
const int INFMEM = 63;
const int INF = 1061109567;
const LL LINF = 4557430888798830399LL;
const double DINF = numeric_limits<double>::infinity();
const LL MOD = 998244353LL;
const int dx[8] = {0,0,1,-1,1,-1,1,-1};
const int dy[8] = {1,-1,0,0,1,-1,-1,1};
// Do dir^1 to get reverse direction
const char dch[4] = {'R','L','D','U'};
// const string ds[8] = {"E","W","S","N","SE","NW","SW","NE"};
const double PI = 3.141592653589793;

inline void open(string a){
    freopen((a+".in").c_str(),"r",stdin);
    freopen((a+".out").c_str(),"w",stdout);
}

inline void fasterios(){
    //Do not use if interactive
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

LL n,s;
LL isi[3005];
LL sum[3005];

LL memo[3005];

LL expo(LL a, LL b, LL MODULO = MOD){
    LL ret = 1;
    while(b > 0){
        if(b&1) ret = (ret*a)%MODULO;
        a = (a*a)%MODULO; b >>= 1;
    }
    return ret;
}

int main(){
    fasterios();
    cin >> n >> s; 
    for(int i = 1;i <= n;i++){
        cin >> isi[i];
    }
    memo[0] = expo(2,n);
    for(int i = 1;i <= n;i++){
        LL tmp = isi[i];
        for(int j = s;j >= 0;j--)
            if(j+tmp <= s && memo[j])
                memo[j+tmp] = (memo[j+tmp]+(memo[j]*expo(2,MOD-2))%MOD)%MOD;
        // for(int j = 0;j <= s;j++) cout << memo[j] << " \n"[j == s];
    }
    cout << memo[s] << endl;
    return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

#define MAX 4
int main(void)
{
	int n,i,j;
	char c;
	int num;
	unsigned short his[MAX] = {0};
	char c1[MAX];

	cin >> n;
	for (i=0; i<n; i++) {
		cin >> c;
		cin >> num;

		switch (c) {
		case 'S':
			his[0] |= (1 << (num-1));
			break;
		case 'H':
			his[1] |= (1 << (num-1));
			break;
		case 'C':
			his[2] |= (1 << (num-1));
			break;
		case 'D':
			his[3] |= (1 << (num-1));
			break;
		default:
			break;
		}
	}
	c1[0] = 'S';
	c1[1] = 'H';
	c1[2] = 'C';
	c1[3] = 'D';
	for (i = 0; i < MAX; i++) {
		for (j = 0; j < 13; j++) {
			if (((his[i]>>j) & 1) == 0) {
				cout << c1[i] << " " << j+1 << endl;
			}
		}
	}
	return 0;
}



Measured memory_bytes: 3008
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;


typedef long long i64;
const int inf = (int)1.05e9;


int main()
{
	int n;

	scanf("%d", &n);

	if(n == 3) {
		printf("2 5 63\n");
		return 0;
	} else if(n == 4) {
		printf("2 5 20 63\n");
		return 0;
	}

	int an = n - 2;
	int bn = 2;

	if(an > 15000) {
		int diff = an - 15000;
		if((bn + diff) % 2 != 0)
			diff += 1;
		bn += diff;
		an -= diff;
	}

	vector<int> ans;

	int an_r = an % 3;
	int an_q = an - an_r;

	for(int i = 0; i < an_q; ++i)
		ans.push_back(2 * i + 2);
	if(an_r == 1) {
		ans.push_back(2 * an_q + 2 + 4);
	} else if(an_r == 2) {
		ans.push_back(2 * an_q + 2 + 0);
		ans.push_back(2 * an_q + 2 + 2);
	}

	for(int i = 0; i < bn; ++i)
		ans.push_back(6 * i + 3);

	for(int i = 0; i < (int)ans.size(); ++i)
		printf("%d%c", ans[i], i + 1 == ans.size() ? '\n' : ' ');

	return 0;
}

/* waffle */


Measured memory_bytes: 512
#include<iostream>

int main(){
    int N, K, X, Y;
    std::cin >> N >> K >> X >> Y;
    int res = 0;
    if(N <= K){
        res += X * N;
    }else{
        res += X * K;
        res += Y * (N - K);
    }
    std::cout << res << std::endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

using vi = vector<int>;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define show(x) cout << #x << " = " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define YesNo {cout<<"Yes";}else{cout<<"No";}
#define YESNO {cout<<"YES";}else{cout<<"NO";}
#define v(T) vector<T>

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> bool lcmp(const pair<T, T>& l, const pair<T, T>& r) {
  return l.first < r.first;
}
template<class T> istream& operator>>(istream& i, v(T)& v) {
  F0R(j, sz(v)) i >> v[j];
  return i;
}
template<class A, class B> istream& operator>>(istream& i, pair<A, B>& p) {
  return i >> p.first >> p.second;
}
template<class A, class B, class C> istream& operator>>(istream& i, tuple<A, B, C>& t) {
  return i >> get<0>(t) >> get<1>(t) >> get<2>(t);
}
template<class T> ostream& operator<<(ostream& o, const vector<T>& v) {
  F0R(i, v.size()) {
    o << v[i] << ' ';
  }
  o << newl;
  return o;
}
template<class T1, class T2> ostream& operator<<(ostream& o, const map<T1, T2>& m) {
  for (auto& p : m) {
    o << p.first << ": " << p.second << newl;
  }
  o << newl;
  return o;
}

#if 1

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<tuple<int, int, int>> as(N);
  F0R(i, N) {
    cin >> as[i];
  }

  F0R(cx, 101) {
    F0R(cy, 101) {
      int h = -1, mh = INT32_MAX;

      bool find = true;
      F0R(i, N) {
        int d = abs(get<0>(as[i]) - cx) + abs(get<1>(as[i]) - cy);
        if (get<2>(as[i])) {
          int ch = get<2>(as[i]) + d;
          if ((h >= 0 && h != ch) || (h < 0 && mh < ch)) {
            find = false;
            break;
          }
          h = ch;
        }
        else {
          if ((h >= 0 && h > d) || !d) {
            find = false;
            break;
          }
          chmin(mh, d);
        }
      }
      if (h < 0 && mh == 1) h = 1;
      if (find && h > 0) {
        cout << cx << " " << cy << " " << h << newl;
        return 0;
      }
    }

  }

  int n = 0;
  while (true) {
    n++;
  }
}
#endif


Measured memory_bytes: 3652
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <vector>
#include <algorithm>
#include <tuple>
#include <map>

template <class Tp>
class lines {
  std::map<Tp, Tp> ll;

  bool is_redundant(const typename std::map<Tp, Tp>::iterator& it) const {
    if (it == ll.begin() || it == ll.end()) return false;
    auto next = std::next(it);
    if (next == ll.end()) return false;
    auto prev = std::prev(it);

    Tp a1, b1, a2, b2, a3, b3;
    std::tie(a1, b1) = *prev;
    std::tie(a2, b2) = *it;
    std::tie(a3, b3) = *next;

    return (b1-b2) * (a3-a2) <= (b2-b3) * (a2-a1);
  }

public:
  void append(Tp a, Tp b) {
    if (ll.empty()) {
      ll.emplace(a, b);
      return;
    }

    auto it = ll.lower_bound(a);
    if (it != ll.end() && it->first == a) {
      if (it->second <= b) {
        return;
      }
      it->second = b;
    } else if (it == ll.begin() || it == ll.end()) {
      it = ll.emplace_hint(it, a, b);
    } else {
      it = ll.emplace_hint(it, a, b);
      if (is_redundant(it)) {
        ll.erase(it);
        return;
      }
    }

    auto prev = std::prev(it);
    while (is_redundant(prev)) {
      ll.erase(prev);
      prev = std::prev(it);
    }

    auto next = std::next(it);
    while (is_redundant(next)) {
      next = ll.erase(next);
    }
  }

  Tp min_at(Tp x) const {
    assert(!ll.empty());
    if (ll.size() == 1) {
      Tp a = ll.begin()->first;
      Tp b = ll.begin()->second;
      return a*x + b;
    }

    Tp lb = ll.begin()->first;
    auto last = std::prev(ll.end());
    Tp ub = last->first;
    while (ub-lb > 1) {
      Tp mid = (lb+ub) / 2;
      auto it1 = ll.upper_bound(mid);
      auto it0 = std::prev(it1);
      Tp a0, b0, a1, b1;
      std::tie(a0, b0) = *it0;
      std::tie(a1, b1) = *it1;
      ((a0*x+b0 < a1*x+b1)? ub:lb) = mid;
    }

    auto it1 = ll.upper_bound(lb);
    auto it0 = std::prev(it1);

    Tp a0, b0, a1, b1;
    std::tie(a0, b0) = *it0;
    std::tie(a1, b1) = *it1;
    return std::min(a0*x+b0, a1*x+b1);
  }
};

int main() {
  size_t N;
  intmax_t C;
  scanf("%zu %jd", &N, &C);

  std::vector<intmax_t> h(N);
  for (auto& hi: h) scanf("%jd", &hi);

  std::vector<intmax_t> dp(N);
  lines<intmax_t> cht;
  for (size_t i = 0; i+1 < N; ++i) {
    cht.append(-2*h[i], dp[i]+h[i]*h[i]);
    dp[i+1] = cht.min_at(h[i+1]) + h[i+1]*h[i+1] + C;
  }

  printf("%jd\n", dp[N-1]);
}


Measured memory_bytes: 15872
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
using namespace std;

int main(){
    double t, x;
    cin >> t >> x;
    cout << t / x << endl;
    return 0;
}

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

a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n):
    a[i], b[i], c[i] = map(int, input().split())

dp = [[0] * 3 for _ in range(n)]
dp[-1] = [a[-1], b[-1], c[-1]]

for i in range(n - 2, -1, -1):
    dp[i][0] = a[i] + max(dp[i + 1][1], dp[i + 1][2])
    dp[i][1] = b[i] + max(dp[i + 1][2], dp[i + 1][0])
    dp[i][2] = c[i] + max(dp[i + 1][0], dp[i + 1][1])

print(max(dp[0]))

Measured memory_bytes: 61784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    ll a,b,k;
    cin>>a>>b>>k;
    if(a>=k){
        cout<<a-k<<' '<<b<<endl;
    }else{
        k-=a;
        cout<<0<<' '<<max(0ll,b-k)<<endl;
    }
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 10;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef pair<double, double> P;

void print_line(vector<int> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

int main() {
    int n;


    cin >> n;
    vector<P> ks(n + 1, P(0, 0));
    vector<vector<double>> p_sum(n + 1, vector<double>(n + 1, 0));
    vector<vector<double>> q_sum(n + 1, vector<double>(n + 1, 0));
    vector<vector<double>> dp(n + 1, vector<double>(n + 1, 0));;

    for (int i = 0; i < n; ++i) cin >> ks[i].first;
    for (int i = 0; i < n + 1; ++i) cin >> ks[i].second;
    for (int i = 0; i < n + 1; ++i) dp[i][i] = ks[i].second;

    for (int i = 0; i < n; ++i) {
        p_sum[i][i] = ks[i].first;
        for (int j = i + 1; j < n; ++j) {
            p_sum[i][j] = p_sum[i][j - 1] + ks[j].first;
        }
    }

    for (int i = 0; i < n + 1; ++i) {
        q_sum[i][i] = ks[i].second;
        for (int j = i + 1; j < n + 1; ++j) {
            q_sum[i][j] = q_sum[i][j - 1] + ks[j].second;
        }
    }

    for (int i = 1; i < n + 1; ++i) {
        for (int j = 0; j < (n + 1) - i; ++j) {
            dp[j][j + i] = INF;
            for (int k = 0; k < i; ++k) {
                double t = dp[j][j + k] + dp[j + k + 1][j + i] + p_sum[j][j + i - 1] + q_sum[j][j + i];
                dp[j][j + i] = min(dp[j][j + i], t);
            }
        }
    }

    printf("%.20f\n", dp[0][n]);

}




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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A, B, C;
	cin >> A >> B >> C;
	cout << max(0LL, C - (A - B)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <map>
#include <set>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if(n>999){
        cout << "ABD" << endl;
    }
    else cout << "ABC" << endl;

    return 0;
}

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

int main () {
	
	int a=0, b=0, t=0, i=0;

	cin >> a >> b >>t;

	int aux=a;
	i = 1;
	while (a<= t) {
		i++;
		a += aux;
	}

	if (t%a != 0) i--;

	cout << (b*i) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1e+9
#define MOD 1000000007
using namespace std;


int main(){
    int H,W;
    int h,w;
    cin >> H >> W >> h >> w;
    cout<<(H-h)*(W-w)<<endl;
    return 0;
}


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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
  ll n; cin >> n;
  vector<ll> a(n);
  ll num = 0;
  ll sum = 0;
  rep(i,n){
    cin >> a[i];
    if(a[i]<0){
      num++;
      a[i] = -a[i];
    }
    sum += a[i];
  }

  if(num%2==0){
    cout << sum << endl;
  }else{
    sort(a.begin(), a.end(), less<ll>());
    sum -= 2*a[0];
    cout << sum << endl;
  }

  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int x=(int)(s.at(0)-'0')*10+(int)(s.at(1)-'0');
  int y=(int)(s.at(2)-'0')*10+(int)(s.at(3)-'0');
  cout<<(0<x&&x<13?(0<y&&y<13?"AMBIGUOUS":"MMYY"):(0<y&&y<13?"YYMM":"NA"))<<endl;
}

Measured memory_bytes: 256