akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
string chk(string s,int a){
    char c = '0'+a;
    s = s+c;
    sort(s.begin(),s.end(),greater<char>());
    return s;
}
int main(){
    int n,m;
    cin >> n >> m;
    int a[m];
    for(int i=0;i<m;i++)cin >> a[i];
    int mat[10] = {-1,2,5,5,4,5,6,3,7,6};
    vector<string>dp(n+1);
    for(int i=0;i<n;i++){
        if(i!=0 && dp[i]=="")continue;
        for(int j=0;j<m;j++){
            if(i+mat[a[j]] > n)continue;
            string tmp = chk(dp[i],a[j]);
            if(tmp.length() > dp[i+mat[a[j]]].length()){
                dp[i+mat[a[j]]] = tmp;
            }else if(tmp.length() == dp[i+mat[a[j]]].length() && tmp > dp[i+mat[a[j]]]){
                dp[i+mat[a[j]]] = tmp;
            }
        }
    }
    cout << dp[n]<<endl;
}

Measured memory_bytes: 54748
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	@SuppressWarnings("unchecked")
	private void run() {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		int s = scanner.nextInt();
		List<Pair>[] lists = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			lists[i] = new ArrayList<Pair>();
		}
		for (int i = 0; i < m; i++) {
			int v = scanner.nextInt();
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			lists[v].add(new Pair(a, b));
		}
		PriorityQueue<Pair> pq = new PriorityQueue<Pair>();
		pq.add(new Pair(s, 0));
		int[] cost = new int[n];
		Arrays.fill(cost, Integer.MAX_VALUE);
		cost[s] = 0;
		while (!pq.isEmpty()) {
			Pair pair = pq.poll();
			if (cost[pair.a] < pair.b)
				continue;
			for (Pair p : lists[pair.a]) {
				if (cost[p.a] > pair.b + p.b) {
					cost[p.a] = pair.b + p.b;
					pq.offer(new Pair(p.a, cost[p.a]));
				}
			}

		}
		for (int a : cost) {
			if (a == Integer.MAX_VALUE )
				System.out.println("INF");
			else
				System.out.println(a);
		}

	}

	class Pair implements Comparable<Pair> {
		int a, b;

		public Pair(int a, int b) {
			super();
			this.a = a;
			this.b = b;
		}

		@Override
		public String toString() {
			return "Pair [a=" + a + ", b=" + b + "]";
		}

		@Override
		public int compareTo(Pair o) {
			return this.b - o.b;
		}

	}
}

Measured memory_bytes: 322740
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
const int INF = 999;

vector<int> v[100];
bool vis[100];
bool f[100];

int search(int now)
{
	//vis[now] = true;
	
	int res = 1;
	for (int i = 0; i < v[now].size(); i++){
		vis[now] = true;
		if (!vis[v[now][i]]) res = max(res, search(v[now][i]) + 1);
		vis[now] = false;
	}
	
	//vis[now] = false;
	
	return res;
}
	
int main()
{
	int n;
	while (scanf("%d", &n), n){
		for (int i = 0; i < 100; i++){
			v[i].clear();
		}
		memset(vis, 0, sizeof(vis));
		memset(f, 0, sizeof(f));
		
		for (int i = 0; i < n; i++){
			int a, b;
			scanf("%d %d", &a, &b);
			a--; b--;
			v[a].PB(b);
			v[b].PB(a);
			
			f[a] = true;
			f[b] = true;
		}
		/*
		int mini = INF;
		for (int i = 0; i < n; i++){
			mini = min(mini, (int)v[i].size());
		}
		*/
		int maxi = 0;
		for (int i = 0; i < 100; i++){
			//if (v[i].size() - mini <= 1){
			if (f[i]){
				maxi = max(maxi, search(i));
			}
			//}
		}
		printf("%d\n", maxi);
	}
	
	return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N=0, A=-1;
  cin >> N >> A;
  if(N<1||100<N||A<0||N*N<A)
    cout << "入力エラー(制約 : 1≦N≦100, 0≦A≦N*N)" << endl;
  else cout << (N*N)-A << endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    ll a, b, c, k;
    cin >> a>> b >> c >> k;
    ll ans = 0;
    if(k - a > 0) {
        ans += a;
        k -= a;
        k -= b;
        if(k > 0) ans -= k; 
    } else ans += k;
    cout << ans<< endl;
    return 0;
}

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

using namespace std;

int main()
{
  	string S;
  	cin >> S;
  	int N = stoi(S);
  	int SN = 0;
  	for(const char ch : S){
      	SN += static_cast<int>(ch - '0');
    }
  	if(N % SN == 0) cout << "Yes" << endl;
  	else cout << "No" << endl;
}

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

using namespace std;

int main () {
    int N, M, K;
    cin >> N >> M >> K;
    vector<long long> A(N), B(M), preA(N+1), preB(M+1);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        preA[i+1] += A[i] + preA[i];
        // cout << preA[i+1] << " ";
    }
    // cout << endl;
    for (int i = 0; i < M; i++) {
        cin >> B[i];
        preB[i+1] += B[i] + preB[i];
        // cout << preB[i+1] << " ";
    }
    int res = 0;
    int posB = M;
    for (int i = 0; i <= N; i++) {
        int lenB = K - preA[i];
        if (lenB < 0) break;
        while (posB >= 0 && preB[posB] > lenB) {
            posB--;
        }
        // cout <<i << " " << posB << endl;
        res = max(res, posB+i);
    }
    cout << res << endl;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  ll n,k;
  cin>>n>>k;
  ll sum=0;
  ll bns=0;
  vector<ll> neta[111111];
  for(int i=0;i<n;i++){
    int t,d;
    cin>>t>>d;
    neta[t].pb(d);
    sum+=d;
    if(neta[t].size()==1&&bns<k)bns++;
  }
  
  if(n==k){
    cout<<sum+bns*bns<<endl;
    return 0;
  }
  
  priority_queue<ll> iq,oq;
  for(int i=1;i<=n;i++){
    if(neta[i].size()==0)continue;
    sort(all(neta[i]));
    iq.push(-neta[i][neta[i].size()-1]);
    for(int j=0;j<neta[i].size()-1;j++)
	 oq.push(neta[i][j]);
  }
  //  dbg(bns);
  while(iq.size()>k)iq.pop();
  while(iq.size()<k){
    iq.push(-oq.top());
    oq.pop();
  }
  //  dbg(bns);
  while(oq.size()&&-iq.top()<=oq.top()-2*bns+1){
    bns--;
    iq.pop();
    iq.push(-oq.top());
    oq.pop();
  }
  //  dbg(bns);
  ll ans=0;
  while(iq.size()){
    ans+=-iq.top();
    //dbg(-iq.top());
    iq.pop();
  }
  //  dbg(bns);
  cout<<ans+bns*bns<<endl;
  return 0;
}




Measured memory_bytes: 7160
#include <iostream>
using namespace std;
int main()
{
	int a[100]={0};
	int A,B,C,D,sum=0;
	cin>>A>>B>>C>>D;
		for(int i=0;i<=110;i++)
		{
			if(i>=A&&i<B)
			a[i]++;
			if(i>=C&&i<D)
			a[i]++; 
		 } 
		 for(int i=0;i<=110;i++)
		 {
		 	if(a[i]==2)
		 	sum++; 
		 }
	
		cout<<sum<<endl;
return 0;	
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N, A, B;
  std::cin >> N >> A >> B;

  if (A > B) {
    std::cout << 0 << std::endl;
  } else {
    if (N == 1) {
      if (A < B) {
        std::cout << 0 << std::endl;
      } else {
        std::cout << 1 << std::endl;
      }
    } else {
      std::cout << (N - 2) * (B - A) + 1 << std::endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 30
#define u32d unsigned int
#define LL   long long
#define INF  0x7FFFFFFF
using namespace std;

int po[11][11];

int main(){
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j){
			cin >> po[i][j];	
		}
	}
	int ans = 0;
	for(int i = 0; i < n; ++i){
		for(int j = i + 1; j < n; ++j){
			double sum = 0;
			for(int k = 0; k < m; ++k){
				sum = sum + abs(po[i][k] - po[j][k]) * abs(po[i][k] - po[j][k]);
			}
			sum = sqrt(sum);
			if(sum - floor(sum) == 0){
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 256
n = int(input())
x = list(map(float, input().split()))
y = list(map(float, input().split()))
p_1 = sum([abs(x[i]-y[i]) for i in range(n)])
p_2 = (sum([(x[i]-y[i])**2 for i in range(n)]))**0.5
p_3 = (sum([(abs(x[i]-y[i]))**3 for i in range(n)]))**(1/3)
p_inf = max([abs(x[i]-y[i]) for i in range(n)])

print("{:.5f}".format(p_1))
print("{:.5f}".format(p_2))
print("{:.5f}".format(p_3))
print("{:.5f}".format(p_inf))

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

int main() {
  int H , W;
  cin >> H >> W;
  vector<string> vec(H);
  for (int j = 0;j < W + 2;j++){
    cout << '#';
  }
  cout << endl;
  for (int i = 0;i < H;i++){
    cin >> vec.at(i);
    cout << '#' << vec.at(i) << '#' << endl;
  }
  for (int j = 0;j < W + 2;j++){
    cout << '#';
  }
  cout << endl;
}


Measured memory_bytes: 256
integer N,K
integer,allocatable,dimension(:)::A
integer B(200000),sizeB
integer tmp,tmpcnt,ans
read*,N,K
allocate(A(N))
read*,A
call heapsort(N,A)
tmp=A(1);tmpcnt=0;sizeB=0
do i=1,N
  if(A(i)==tmp)then
    tmpcnt=tmpcnt+1
  else
    sizeB=sizeB+1
    B(sizeB)=tmpcnt
    tmp=A(i)
    tmpcnt=1
  endif
end do
sizeB=sizeB+1
B(sizeB)=tmpcnt
call heapsort(sizeB,B(1:sizeB))
if(sizeB>K)then
  ans=sum(B(1:sizeB-K))
else
  ans=0
endif
print"(I0)",ans
contains
subroutine heapsort(n,array)
  implicit none
!ここの入力は状況に応じて変更すること
  integer,intent(in) :: n
  integer,intent(inout) :: array(1:n)
  integer::i,k,j,l
  integer:: t

  l=n/2+1
  k=n
  do while(k /= 1)
     if(l > 1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k == 1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j<=k)
        if(j < k)then
           if(array(j) < array(j+1))j=j+1
        endif
        if (t < array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo
  return
end subroutine heapsort
end

Measured memory_bytes: 2304
#include <iostream>
#include <vector>
#include <map>
#include <queue>
using namespace std;
int INF = 1000000;
int main(){
	int H, W;
	cin >> H >> W;
	vector<vector<char>> a(H, vector<char>(W, 0));
	for (int i = 0; i < H; i++){
		for (int j = 0; j < W; j++){
			cin >> a[i][j];
		}
	}
	vector<map<int, int>> E(H + W);
	int S, T;
	for (int i = 0; i < H; i++){
		for (int j = 0; j < W; j++){
			if (a[i][j] != '.'){
				int v = E.size();
				E.push_back(map<int, int>());
				int c;
				if (a[i][j] == 'S'){
					c = INF;
					S = v;
				} else if (a[i][j] == 'T'){
					c = INF;
					T = v;
				} else {
					c = 1;
				}
				E[v][i] = c;
				E[i][v] = c;
				E[v][H + j] = c;
				E[H + j][v] = c;
			}
		}
	}
	int V = E.size();
	int F = 0;
	while (1){
		vector<int> flow(V, INF);
		vector<int> prev(V, -1);
		prev[S] = V;
		queue<int> Q;
		Q.push(S);
		while (!Q.empty()){
			int v = Q.front();
			Q.pop();
			for (auto edge : E[v]){
				int w = edge.first;
				int c = edge.second;
				if (prev[w] == -1){
					prev[w] = v;
					flow[w] = min(flow[v], c);
					Q.push(w);
				}
			}
		}
		if (prev[T] == -1){
			break;
		}
		int f = flow[T];
		int v = T;
		while (v != S){
			E[v][prev[v]] += f;
			E[prev[v]][v] -= f;
			if (E[prev[v]][v] == 0){
				E[prev[v]].erase(v);
			}
			v = prev[v];
		}
		F += f;
	}
	if (F >= INF){
		cout << -1 << endl;
	} else {
		cout << F << endl;
	}
}

Measured memory_bytes: 5516
using System;

public class ACSMBC_B
{
    public static void Main()
    {
        int i = int.Parse(Console.ReadLine());
        int n = (int)Math.Ceiling(i / 1.08);
        if (i == (int)Math.Truncate(n * 1.08)) Console.WriteLine(n);
        else Console.WriteLine(":(");
    }
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;  typedef pair<ll,ll> pii;
typedef vector<int> VI; typedef vector<ll> VL;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, K;
	cin >>n >>K;
	VI x(n), y(n);
	rep(i ,n) cin>>x[i] >>y[i];
	
	auto xs=x, ys=y;
	sort(all(xs)); sort(all(ys));
	xs.erase(unique(all(xs)), xs.end());
	ys.erase(unique(all(ys)), ys.end());
	
	int xz=sz(xs), yz=sz(ys);
	vector<VI> d(yz, VI(xz));
	vector<VI> sk(yz+1, VI(xz+1));

	ll ans = (1LL<<62) + (1LL<<61);
	rep(sy, yz) rep2(ey, sy, yz) rep(sx, xz) rep2(ex, sx, xz){
		int sm = 0;
		rep(z, n){
			if(ys[sy] <= y[z] && y[z] <= ys[ey] &&
			   xs[sx] <= x[z] && x[z] <= xs[ex] ){ sm++; }
			if(sm >=K){
				ll area = (ll)(ys[ey] - ys[sy]) * (xs[ex] - xs[sx]);
				ans = min(ans,  area);
				//dbg(sm, area);
			}
		}
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

typedef long long ll;

int main()
{
   int N, M;
   cin >> N >> M;
   vector<string> S(N);
   for (int i = 0; i < N; i++)
   {
      cin >> S[i];
   }
   mcf_graph<ll, ll> graph(6001);
   int arrived[60][60];
   int dirX[] = {1, 0};
   int dirY[] = {0, 1};
   ll base = 0;
   for (int i = 0; i < N; i++)
   {
      for (int j = 0; j < M; j++)
      {
         graph.add_edge(5999, i * M + j, 1, 0);
         graph.add_edge(2500 + i * M + j, 6000, 1, 0);
         if (S[i][j] == 'o')
         {
            base += 5000;
            memset(arrived, -1, sizeof(arrived));
            queue<pair<int, int>> q;
            arrived[i][j] = 0;
            q.push(make_pair(i, j));
            while (!q.empty())
            {
               pair<int, int> p = q.front();
               q.pop();
               graph.add_edge(i * M + j, 2500 + p.first * M + p.second, 1, 5000 - arrived[p.first][p.second]);
               for (int k = 0; k < 2; k++)
               {
                  int ii = p.first + dirX[k];
                  int jj = p.second + dirY[k];
                  if (0 <= ii && ii < N && 0 <= jj && jj < M && S[ii][jj] != '#' && arrived[ii][jj] == -1)
                  {
                     arrived[ii][jj] = arrived[p.first][p.second] + 1;
                     q.push(make_pair(ii, jj));
                  }
               }
            }
         }
      }
   }
   cout << base - graph.flow(5999, 6000).second << endl;

   return 0;
}


Measured memory_bytes: 9080
// Problem A
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
// using lll = __int128;
#define RST(a) memset(a, 0, sizeof(a))
#define RSTV(a, v) memset(a, v, sizeof(a))
#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
const int INF = 0x3f3f3f3f;
template <class T>
inline T in() {
  T x = 0;
  bool flag = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch - '0');
    ch = getchar();
  }
  if (flag) return x;
  return ~(x - 1);
}
template <class T>
inline void in(T& x) {
  x = 0;
  bool flag = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch - '0');
    ch = getchar();
  }
  if (!flag) x = ~(x - 1);
}
template <class T>
inline void out(T x) {
  if (x < 0) {
    putchar('-');
    x = ~(x - 1);
  }
  char s[40], top = 0;
  while (x) {
    s[++top] = x % 10;
    x /= 10;
  }
  if (!top) s[++top] = 0;
  while (top) putchar(s[top--] + '0');
}
int main() {
  ll s = in<ll>();
  int x1 = ceill(sqrtl(s));
  int y2 = x1;
  int x2 = 1;
  int y1 = (__int128)x1 * x1 - s;
  out(0);
  putchar(' ');
  out(0);
  putchar(' ');
  out(x1);
  putchar(' ');
  out(y1);
  putchar(' ');
  out(x2);
  putchar(' ');
  out(y2);
}


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

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<i64> a(n);
  REP(i, n) cin >> a[i];
  i64 ans = 0;
  REP(i, n - 1) {
    if (a[i] % 2 && a[i + 1]) {
      ++ans;
      a[i] -= 1;
      a[i + 1] -= 1;
    }
  }
  REP(i, n) { ans += a[i] / 2; }
  cout << ans << endl;
}


Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n;
    cin >> n;
    vector<ll> a(1LL<<n);
    REP(i, 1LL<<n) cin >> a[i];    

    auto merge = [](PII x, PII y) {
        vector<ll> v({x.first, x.second, y.first, y.second});
        sort(ALL(v));
        return PII(v[3], v[2]);
    };

    vector<PII> dp(1LL<<n);
    REP(i, 1LL<<n) dp[i].first = a[i];
    REP(i, n) REP(j, 1LL<<n) if(j&(1LL<<i)) dp[j] = merge(dp[j], dp[j^(1LL<<i)]);

    ll ma = 0;
    FOR(i, 1, 1LL<<n) {
        chmax(ma, dp[i].first+dp[i].second);
        cout << ma << "\n";
    }
    cout << flush;

    return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    cout<<(a-1)*(b-1)<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        double x1, y1, x2, y2;
        Scanner sc = new Scanner(System.in);
        x1 = sc.nextDouble();
        y1 = sc.nextDouble();
        x2 = sc.nextDouble();
        y2 = sc.nextDouble();
        System.out.printf("%.9f\n", Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
    }
}


Measured memory_bytes: 28168
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main() {
    string s;
    cin >> s;
    if (s.at(0) == s.at(2)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
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 a1 = ReadInt();
            var a2 = ReadInt();
            var a3 = ReadInt();
            var a4 = ReadInt();

            var ans = 0;
            if (a1 < a2) ans += a1;
            else ans += a2;
            if (a3 < a4) ans += a3;
            else ans += a4;
            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;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main() {
  int A, B;
  cin >> A >> B;
  if (A <= 12) {
    B /= 2;
  }
  if (A <= 5) {
    B = 0;
  }
  cout << B << endl;
}

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

#ifdef _DEBUG
#define debug(x) cout << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#define INFILE freopen("input.txt", "r", stdin)
#else
#define debug(x)
#define INFILE
#endif

#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL9_MOD = 1000000009LL;
static constexpr ll LL7_MOD = 1000000007LL;
static constexpr ll INF = 1LL << 60;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

double dp[3010][3010];

int main(int argc, char* argv[]) {
  INFILE;

  ll n;
  cin >> n;

  vector<double> probs(n, 0.0);
  scan(probs);
  dp[0][0] = 1.0;

  REP(i, 0, n) {
    REP(j, 0, i + 1) {
      double p = probs[i];
      double rev_p = 1.0 - p;

      dp[i + 1][j] += dp[i][j] * rev_p;
      dp[i + 1][j + 1] += dp[i][j] * p;
    }
  }

  double result = accumulate(begin(dp[n]) + (n / 2 + 1), begin(dp[n]) + n + 1, double(0.0));
  cout << fixed << setprecision(10) << result << endl;

  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

template <class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


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

typedef long long ll;
typedef unsigned long long ull;

int main(void) {
    ll N;
    ll count = 0;
    vector<ll> edges;
    cin >> N;
    for(ll i = 0;i < N;i++) {
        ll temp;
        cin >> temp;
        edges.push_back(temp);
    }
    sort(edges.begin(), edges.end());
    for(ll i = 0;i < N - 2;i++) {
        ll a = edges[i];
        for(ll j = i + 1;j < N - 1;j++) {
            ll b = edges[j];
            auto iter = lower_bound(edges.begin(), edges.end(), a + b);
            ll number = N - 1 - distance(iter, edges.end());
            count += number - j;
        }
    }
    cout << count << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

ll mod = 1e9 + 7;

int main() {
    ll n, k;
    cin >> n >> k;
    ll usi = k * (k - 1) / 2;
    usi %= mod;
    vector<int> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];

    ll ret = 0;
    for (int i = 0; i < n; i++) {
        ll after = 0;
        ll all = 0;
        for (int j = 0; j < n; j++) {
            if (i == j)continue;
            if (v[i] > v[j]) {
                if (i < j) after++;
                all++;
            }
        }
        ret += after * k;
        ret %= mod;
        ret += all * usi;
        ret %= mod;
    }

    cout << ret << endl;
    return 0;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> f;
	for (int i = 1; i <= sqrt(m); i++) {
		if (m % i == 0) {
			f.push_back(i);
			f.push_back(m / i);
		}
	}
	int max = 0;
	for (int i = 0; i < f.size(); i++)
		if (max < f[i] && f[i] <= m / n)
			max = f[i];
	cout << max << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>
using namespace std;

//typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;

int main(void) {
	string S,year,month,date;
	int y, m, d,j;
	j = 0;
	cin >> S;
	year = S.substr(0, 4);
	month = S.substr(5, 2);
	date = S.substr(8, 2);

	y = stoi(year);
	m = stoi(month);
	d = stoi(date);
	if (y > 2019)j = 1;
	else if (y == 2019 && m >= 5)j = 1;


	if (j == 1)cout << "TBD" << endl;
	else cout << "Heisei" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define el '\n'

int main() {
  int n;
  cin >> n;
  pair<int, int> ar[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i].first;
  }
  for (int i = 0; i < n; i++) {
    cin >> ar[i].second;
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += max(0, ar[i].first-ar[i].second);
  }
  cout << sum << el;
  return 0;
}

Measured memory_bytes: 256
N,A,B=map(int, input().split())
S=input().strip()

total = 0
totalB = 0
for c in S:
    if c == 'a':
        if total < A + B:
            total += 1
            print('Yes')
        else:
            print('No')
    elif c == 'b':
        if total < A + B and totalB < B:
            total += 1
            totalB += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 70108
#define DEBUG 0
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll LLINF = 1e16;
const int MOD = 1000000007;
const int MOD2 = 998244353;
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
    do {\
        std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        std::cerr << std::noboolalpha;\
    } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
    { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
os << "{";
    for (auto it = v.begin(); it != v.end(); it++)
        {os << (it != v.begin() ? "," : "") << *it;}
    return os << "}";
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    for(int i = 0;i<n;i++){
        cin >> a[i];
        sum += a[i];
    }
    // cout << sum <<endl;
    int flag = 0;
    for(int i=0;i<n;i++){
        if(a[i]*4*m >= sum) flag++; 
    }
    if(flag >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3652
#include <stdio.h>

long dp[101][10][1001];
int n,s;

long dfs(int now,int k,int t){
    if (t < 0 || k < 0)
	return 0;
    if (now < 0) {
        if (k == 0 && t == 0)
	    return 1;
        else
	    return 0;
    }
    if(dp[now][k][t] != -1)
	return dp[now][k][t];

    dp[now][k][t] = dfs(now-1, k, t) + dfs(now-1, k-1, t-now);
    return dp[now][k][t];
}

int main(void) {
    for (int i = 0; i < 101; i++)
	for (int j = 0; j < 10; j++)
	    for (int k = 0; k < 1001; k++)
	dp[i][j][k] = -1;

    while (1) {
	scanf("%d", &n);
	scanf("%d", &s);
	if (n == 0) break;
	printf("%ld\n", dfs(100, n, s));
    }

    return 0;
}



Measured memory_bytes: 10668
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vb= vector<bool>;
using vl= vector<ll>;
using vs= vector<string>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

ll nC2(ll n){
  return n*(n-1)/2;
}

int main(void){
  ll n,c=0;
  cin >> n;
  vl a(n);
  vl cnt(n,0);
  rep(i,0,n){
    cin >> a[i];
    a[i]--;
    cnt[a[i]]++;
  }
  rep(i,0,n){
    c+= nC2(cnt[i]);
  }
  rep(i,0,n){
    cout << c-nC2(cnt[a[i]])+nC2(cnt[a[i]]-1) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 5760
#include <stdio.h>
int main () {
  int n, a[100], i, v, j, k;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++) {
    scanf("%d", &a[i]);
  }
  for(i = 0 ; i < n ; i++) {
    printf("%d", a[i]);
    if(i != n-1) printf(" ");
  }
  printf("\n");

  for(i = 1 ; i <= n-1 ; i++) {
    v = a[i];
    j = i - 1;
    while(j >= 0 && a[j] > v){
      a[j+1] = a[j];
      j--; 
      a[j+1] = v; 
    }
    for(k = 0 ; k < n ; k++) {
      printf("%d", a[k]);
      if(k != n-1) printf(" ");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define SENTINEL 2000000000
#define llong long long

llong merge(int A[],int left,int midth,int right){
    int i,j,k,n1,n2;
    llong ans=0;
    n1=midth-left;
    n2=right-midth;
    int B[n1],C[n2];
    B[n1]=C[n2]=SENTINEL;
    for(i=0;i<n1;i++)B[i]=A[left+i];
    for(i=0;i<n2;i++)C[i]=A[midth+i];
    i=j=0;
    for(k=left;k<right;k++){
        if(B[i]>C[j]){A[k]=C[j];ans+=n1-i;j++;}
        else{A[k]=B[i];i++;}
    }
    return ans;
}

llong merge_sort(int A[],int left,int right){
    llong ans=0;
    if(left+1<right){
        int midth=(left+right)/2;
        ans+=merge_sort(A,left,midth);
        ans+=merge_sort(A,midth,right);
        ans+=merge(A,left,midth,right);
    }
    return ans;
}

llong count_inversion(int A[],int n){
    llong i;
    i=merge_sort(A,0,n);
    return i;
}

int main(){
    llong i;
    int n;
    scanf("%d",&n);
    int A[n];
    for(i=0;i<n;i++)scanf("%d",&A[i]);
    i=count_inversion(A,n);
    printf("%ld\n",i);
}


Measured memory_bytes: 4760
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 /*int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }*/
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int a){
	par= vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int gcm(int a,int b){
    if(b==0)
        return a;
    return gcm(b,a%b);
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
/*struct dfs(){

}*/
signed main(){
	int a;
	cin>>a;
	if(a%ketas(a)==0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;


void setIO(string name) {
    ios_base::sync_with_stdio(0); cin.tie(0);
    freopen((name+".in").c_str(),"r",stdin);
    freopen((name+".out").c_str(),"w",stdout);
}

int32_t main()
{
  BOOST;
	int l,r,d;
	cin>>l>>r>>d;
	cout<<r/d-(l-1)/d;
	
  return 0;
}


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

int main()
{
  vector<int> stairs(31, 0);
  stairs[0] = 1;
  for (int i = 0; i < 31; ++i) {
    if (i+1 < 31)
      stairs[i+1] += stairs[i];
    if (i+2 < 31)
      stairs[i+2] += stairs[i];
    if (i+3 < 31)
      stairs[i+3] += stairs[i];
  }

  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    int ans = stairs[n];
    if (ans % 10 != 0)
      ans += 9;
    ans /= 10;

    if (ans % 365 != 0)
      ans += 364;
    ans /= 365;

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

Measured memory_bytes: 0
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
const int maxn=2000+5;
int a[maxn],num[maxn],len;
int n,k,m;
bool b[maxn];
int c[maxn];
inline bool chk2(int si,int x){
	int r=a[si]+x,l=a[si];
	int ans=0;
	for (int i=1;i<=n;i++){
		if (l<=a[i]&&a[i]<=r){
			c[i]=1;
		}
		else if (a[i]>r) c[i]=2;
		else c[i]=0;
	}
	int cur1=0,cur2=0;
	for (int i=1;i<=n;i++){
		if (si==i) continue;
		if (c[i]==0){
			if (cur1>=k){
				ans+=min(cur2,cur1-k+1);
			}
			cur2=cur1=0;
			continue;
		}
		if (c[i]==2){
			cur1++;
			continue;
		}
		if (c[i]==1){
			cur1++;
			cur2++;
			continue;
		}
	}
	if (cur1>=k){
		ans+=min(cur2,cur1-k+1);
	}
	return ans>=m-1;
}
inline bool chk(int x){
	for (int i=1;i<=n;i++){
		if (b[i]==0) continue;
		if (chk2(i,x)){
			return true;
		}
	}
	return false;
}
int main(){
	cin>>n>>k>>m;
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for (int l=1;l+k-1<=n;l++){
		int r=l+k-1;
		int cur=2e9;
		for (int i=l;i<=r;i++){
			cur=min(cur,a[i]);
		}
		for (int i=l;i<=r;i++){
			if (cur==a[i]) b[i]=1;
		}
	}
	int l=0,r=1e9,ans=-1;
	while(l<=r){
		int mid=(l+r)/2;
		if (chk(mid)){
			r=mid-1;
			ans=mid;
		}
		else l=mid+1;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3764
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
 
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int sub(int a,int b){
	a-=b;
	if(a<0){
		a+=mod;
	}
	return a;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1){
			res=mul(res,a);
		}
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
		output<<i<<' ';
	return output;
}
 
const int N=1000002;

void solve(){
	ll a,b,k;
	cin>>a>>b>>k;
	ll rem=min(a,k);
	cout<<max(0ll,a-k)<<' '<<max(0ll,b-(k-rem));
}

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	string s; cin >> s;

	int count = 0;
	string prev = s;
	FOR_LT(i, 0, s.size()) {
		if (prev.size() == 1 && prev == s.substr(i, 1)) {
			count++;
			prev = s.substr(i, 2);
			i++;
			continue;
		}
		else if (i == s.size() - 2 && s[i] == s[i + 1]) {
			count++;
			i++;
			continue;
		}

		prev = s.substr(i, 1);
		count++;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 720
///*
#include<iostream>
using namespace std;

int main() {

	int nowrating, performance, nextrating;
	cin >> nowrating >> nextrating;
	
	performance = 2 * nextrating - nowrating;
	//2nextrating - nowrating =  performance

	//cout <<"nowrating = "<<nowrating << endl;
	//cout <<"nextrating = "<< nextrating << endl;
	//cout <<"performance = "<< performance << endl;

	cout << performance << endl;

	return 0;
}
//*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

string s;
int main(){
    cin >> s;
    if(s=="SUN"){
        printf("7\n");
    } else if(s=="SAT"){
        printf("1\n");
    } else if(s=="MON"){
        printf("6\n");
    }else if(s=="TUE"){
        printf("5\n");
    }else if(s=="WED"){
        printf("4\n");
    }else if(s=="THU"){
        printf("3\n");
    }else if(s=="FRI"){
        printf("2\n");
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;

const string YES = "Yes";
const string NO = "No";

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

    string ans = YES;
    if (x < 30){
        ans = NO;
    }

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


Measured memory_bytes: 3628
object Main {
  def main(args: Array[String]): Unit = {
    solve2
  }

  def solve2(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n, m = sc.nextInt
    val p = new Array[Int](m)
    val s = new Array[String](m)
    for (i <- 0 until m) {
      p(i) = sc.nextInt
      s(i) = sc.next
    }
    val ac = new Array[Int](n)
    val pena = new Array[Int](n)
    for (i <- 0 until m) {
      val index = p(i) - 1
      if (ac(index) == 0) {
        if (s(i) == "AC") {
          ac(index) += 1
        } else if (s(i) == "WA") {
          pena(index) += 1
        }
      }
    }

    var AC = 0
    var PENA = 0
    for (i <- 0 until n) {
      AC += ac(i)
      if (ac(i) != 0) {
        PENA += pena(i)
      }
    }

    println(AC + " " + PENA)
  }


  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n, m = sc.nextInt
    val p = new Array[Int](m)
    val s = new Array[String](m)
    for (i <- 0 until m) {
      p(i) = sc.nextInt
      s(i) = sc.next
    }
    val acNos = scala.collection.mutable.Set[Int]()
    val penaCounts = scala.collection.mutable.Map[Int, Int]()
    var acs = 0
    for (i <- 0 until m) {
      if (!acNos.contains(p(i))) {
        if (s(i) == "AC") {
          acs += 1
          acNos += p(i)
        } else if (s(i) == "WA") {
          penaCounts.put(p(i), penaCounts.getOrElse(p(i), 0) + 1)
        }
      }
    }

    var penas = 0
    for (i <- acNos.toList) {
      val penaConunt = penaCounts.getOrElse(i, 0)
      penas += penaConunt
    }

    println(acs + " " + penas)
  }

}


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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{	rtn
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2];
int gcd(int a, int b)
{
	if (a == 0)
		return b;
	return gcd(b % a, a);
}

void solve()
{
	int k;
	cin >> k;
	int ans = 0;
	lop(i, 1, k + 1)lop(j, 1, k + 1)lop(l, 1, k + 1) ans += gcd(gcd(i, j), l);
	cout << ans;

}

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

	int test = 1;
	// cin >> test;

	// cout << setprecision(9) << fixed;
	// clock_t z = clock();
	while (test--)solve();
	// cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);
}





Measured memory_bytes: 3652