akhauriyash/Code-Regression huggingface dataset:
N, K = map(int, input().split())
A = list(map(int, input().split()))
S = sum(A)
max_div = int(S**0.5)

# Sの約数を列挙する
small_div = []
large_div = []
for i in range(1, max_div+1):
  if S%i == 0:
    small_div.append(i)
    large_div.append(S//i)

# 約数を降順に並べる
div = large_div + small_div[::-1]

ans = 1
for d in div:
  r = []
  for a in A:
    r.append(a%d)
  
  r.sort()
  # (d-ri)足すか、ri引くか、それぞれ累積和を求めておく
  minus = [0]*(N+1)
  plus = [0]*(N+1)
  for i, ri in enumerate(r, 1):
    minus[i] = minus[i-1] + ri
  
  for i, ri in enumerate(r[::-1], 1):
    plus[i] = plus[i-1] + (d - ri)
  
  plus = plus[::-1]
  for m, p in zip(minus, plus):
    if m == p and m <= K:
      ans = d
      break
  
  else:
    continue
  
  break

print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
#define reprd(i,a,b) for (int i=(a);i>=(b);--i)
#define repr(i,n) reprd(i,n,0)
typedef long long ll;

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; }

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

const int Max = 110000;
int N, K;
int h[Max];

int main(int argc, const char * argv[]) {
    cin >> N >> K;
    inputArray(h, N);

    int ans = 0;
    rep(i, N) {
        if (h[i] >= K) {
            ans ++;
        }
    }

    output(ans);

    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

char univ[10000000][20] = {};
char arr[20] = {};
long univcnt = 0;

long conv(char c){
  switch(c){
    case '0':
      return 0;
    case '1':
      return 3;
    case '2':
      return 5;
    case '3':
      return 7;
  }
}
      
void make_pat(int floor, char num,int invfloor){
  if(floor == 1){
    arr[invfloor] = num;
    strcpy(univ[univcnt],arr);
    univcnt++;
  }else{
    arr[invfloor] = num;
    make_pat(floor-1,'0',invfloor+1);
    make_pat(floor-1,'1',invfloor+1);
    make_pat(floor-1,'2',invfloor+1);
    make_pat(floor-1,'3',invfloor+1);
  }
}
    
    
  

long power_ (long a,long n){
  long result=1;
  long i = 0;
  if(n == 0){
    return 1;
  }else{
    for(i=0;i<n;i++){
      result *= a;
    }
    return result;
  }
}
    
int main(){
  long n = 0;
  long ndeg = 0;
  long i = 0;
  long j = 0;
  long ok = 0;
  long check = 0;
  long num = 0;
  long cnt = 0;
  int threecheck = 0;
  int fivecheck = 0;
  int sevencheck = 0;
  scanf("%ld",&n);
  long a[10] = {};
  make_pat(10,'0',0);
  make_pat(10,'1',0);
  make_pat(10,'2',0);
  make_pat(10,'3',0);
  for(i=0;i<univcnt;i++){
    ok = 1;
    threecheck = 0;
    fivecheck = 0;
    sevencheck = 0;
    check = 0;
    
    for(j=0;j<10;j++){
      if(univ[i][j] == '1'){
        threecheck = 1;
        check = 1;
      }else if(univ[i][j] == '2'){
        fivecheck = 1;
        check = 1;
      }else if(univ[i][j] == '3'){
        sevencheck = 1;
        check = 1;
      }else{
        if(check){
          ok = 0;
        }
      }
    }
    
    if(ok&&threecheck&&fivecheck&&sevencheck){
      //printf("%s/",univ[i]);
      num = 0;
      for(j=0;j<10;j++){
        num += conv(univ[i][9-j])*power_(10,j);
      }
      //printf("%ld/",num);
      if(num <= n){
        cnt++;
      }
    }
  }
  printf("%ld",cnt);
  return 0;
}
  

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

int N;
int a[100];

int main() {
    cin >> N;
    rep(i, N) cin >> a[i];

    sort(a, a + N);

    int dist = 0;
    for (int i = 1; i <= N - 1; i++) {
        dist += (a[i] - a[i - 1]);
    }

    cout << dist << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 100000;

int main(){
    
    int s[maxn];
    int t[maxn];
    int c[maxn];
    int timetable[2*maxn+2];
    int sum[2*maxn+2]={0};
    int n,ch;
    
    cin >> n>>ch;
    rep(i,n){
        cin >> s[i]>>t[i]>>c[i];
        c[i]--;
    }
    
    rep(i,ch){
        rep(j,2*maxn+2)timetable[j]=0;
        rep(j,n){
            if(c[j]==i){
                timetable[2*s[j]-1]++;
                timetable[2*t[j]]--;
            }
        }
        rep(j,2*maxn+1)timetable[j+1]+=timetable[j];
        rep(j,2*maxn+2)if(timetable[j]>0)sum[j]++;
    }
    
    int ans=0;
    rep(i,2*maxn+2)ans=max(sum[i],ans);
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
int main()
{
    string S;
    cin >> S;

    string alpha = "";
    alpha += S[0];
    int ans = 1;
    string in = "";



    repd(i, 1, S.size()) {
        in += S[i];
        if (alpha.compare(in) != 0) {
            //cout << alpha << ":" << in << endl;;
            alpha = in;
            ans++;
            in = "";
        }
    }

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

Measured memory_bytes: 640
fn main() {
    let (n, a): (u64, [u64; 5]) = {
        (
            read(),
            [
                read(),
                read(),
                read(),
                read(),
                read(),
            ]
        )
    };
    
    let neck = *(a.iter().min().unwrap());

    println!(
        "{}",
        4 + (n + (neck - 1)) / neck
    )
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

Measured memory_bytes: 4352
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
using namespace std;
typedef long long LL;

int num(LL x)
{
	int p=0;
	for(int i = 1;x>0;i++){
		x=x/10;
		p++;
	}
	return p;
}

int main(){
	LL n,temp;
	int j,s=100;
	scanf("%lld",&n);
	for(LL i = 1;i <= sqrt(n);i++){
		temp=n/i;
		if(n%i==0)
		{
			j = num(temp);
			s=min(s,j);
		}
	}
	printf("%d\n",s);
}

Measured memory_bytes: 256
import sys
import copy

infty = 10**10

def merge(A,left,mid,right):

	n1 = mid -left
	n2 = right - mid

	L = []
	R = []

	for i in range(n1):
		L.append(A[left+i])
	for i in range(n2):
		R.append(A[mid+i])

	eInfty = ['X',infty]
	L.append(eInfty)
	R.append(eInfty)

	i = 0
	j = 0
	cnt = 0

	for k in range(left,right):

		cnt += 1

		if L[i][1] <= R[j][1]:
			A[k] = L[i]
			i = i + 1
		else:
			A[k] = R[j]
			j = j + 1
		

	return cnt


def mergeSort(A,left,right):

	cnt = 0

	if left+1 < right:

		mid = (left + right) // 2
		cnt += mergeSort(A,left,mid)
		cnt += mergeSort(A,mid,right)
		cnt += merge(A,left,mid,right)

	return cnt


def Partition(A,p,r):

	# choose pivot
	#A[r],A[r//2] = A[r//2],A[r]

	x = A[r][1]
	i = p-1
	for j in range(p,r):

		if A[j][1] <= x:

			i += 1
			A[i],A[j] = A[j],A[i]

	A[i+1],A[r] = A[r],A[i+1]

	return i+1

def Quicksort(A,p,r):

	if p < r:

		q = Partition(A,p,r)
		Quicksort(A,p,q-1)
		Quicksort(A,q+1,r)

def isStable(M,Q):

	for i in range(len(M)):

		if M[i] != Q[i]:

			return False

	return True

def test():

	n = int(sys.stdin.readline())
	deck = []

	for i in range(n):

		inputs = list(sys.stdin.readline().split())
		inputs[1] = int(inputs[1])

		deck.append(inputs)

	original = copy.deepcopy(deck)
	result = mergeSort(original,0,n)

	Quicksort(deck,0,n-1)

	if isStable(original,deck) == True:
		print("Stable")
	else:
		print("Not stable")

	for i in range(n):
		print(f"{deck[i][0]} {deck[i][1]}")


if __name__ == "__main__":
	test()



Measured memory_bytes: 41848
#include <stdio.h>
#include <math.h>

int main()
{
    char str[4];
    int i,n,K,j;
    scanf("%s", str);
    n = 0;
    j = 0;
    while (str[n] != '\0') {  /* str[n] が終端文字（ヌル文字 '\0'）でない間繰り返す */
        n++;
    }

    if('R' == str[0] && 'R' == str[1] && 'R' == str[2]){
        printf("3");
    }else if('R' == str[0] && 'S' == str[1]){
        printf("1");
    }else if('R' == str[2] && 'S' == str[1]){
        printf("1");
    }else if('S' == str[0] && 'R' == str[1] &&'S' == str[2]){
        printf("1");
    }else if('R' == str[0] && 'R' == str[1] &&'S' == str[2]){
        printf("2");
    }else if('R' == str[1] && 'R' == str[2] &&'S' == str[0]){
        printf("2");
    }else{
        printf("0");
    }
    //printf("B\n");

    
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
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 ll MOD = 1e9+7;

ll DP[3500][7000];

int main(){
    ll N, T;
    cin >> N >> T;
    vector<pair<ll, ll> > AB;
    REP(i,N){
        ll a, b;
        cin >> a >> b;
        AB.emplace_back(a,b);
    }

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

    REP(i,N){
        REP(j,7000){
                DP[i][j] = -1;
        }
    }

    DP[0][0] = 0;
    for(int i = 0; i < N; i++){
        auto p = AB[i];
        ll a = p.first;
        ll b = p.second;
        for(int w = 0; w < 3100; w++){
            if(DP[i][w] == -1) continue;
            chmax(DP[i+1][w+a], DP[i][w]+b);
            chmax(DP[i+1][w], DP[i][w]);
        }
    }

    REP(i,N+1){
        REP(j,3000){
            chmax(DP[i][j+1], DP[i][j]);
        }
    }

    //REP(i,N+1){
    //    printf("%d : %d\n", i, DP[i][T-1]);
    //}

    ll ans = 0;
    REP(i,N){
        auto p = AB[i];
        ll a = p.first;
        ll b = p.second;
        chmax(ans, b + DP[i][T-1]);
    }
    
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main (){
	int a,b;
while(cin >> a >> b){
	if(a == 0 && b == 0) break; 
	for(int i = 1;i <= a;i++){
		for(int y = 1;y <= b;y++){
			cout << "#";
		}
		cout << endl;
	}
	cout << endl;

}

return 0;
}

Measured memory_bytes: 3056
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import qualified Data.Array.IO as A
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

toTup [a,b] = (a,b)

main :: IO ()
main = do
    [n,m] <- r'
    as' <- replicateM m readLn :: IO [Int]
    let as = (-1):(as' ++ [n+1])
    let dif = map ((fib!!) . pred) $ zipWith (-) (tail as) as
    print $ (foldl' (*) 1 dif) `mod` 1000000007


fib = 0:1:zipWith(+)fib(tail fib)

Measured memory_bytes: 611708
/***********************************************
 *                   _ooOoo_                   *
 *                  o8888888o                  *
 *                  88" . "88                  *
 *                  (| -_- |)                  *
 *                  O\  =  /O                  *
 *               ____/`---'\____               *
 *             .'  \\|     |//  `.             *
 *            /  \\|||  :  |||//  \            *
 *           /  _||||| -:- |||||-  \           *
 *           |   | \\\  -   * |    |           *
 *           | \_|  ''\---/''  |   |           *
 *           \  .-\__  `-`  ___/-. /           *
 *         ___`. .'  /--.--\  `. . __          *
 *      ."" '<  `.___\_<|>_/___.'  >'"".       *
 *     | | :  `- \`.;`\ _ /`;.`/ - ` : | |     *
 *     \  \ `-.   \_ __\ /__ _/   .-` /  /     *
 *======`-.____`-.___\_____/___.-`____.-'======*
 *                   `=---='                   *
 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

             佛祖保佑       永无BUG

   本程序已经经过开光处理，绝无可能再产生bug
 **********************************************/
#include<algorithm>
#include <iostream>
#include  <cstdlib>
#include  <cstring>
#include   <string>
#include   <vector>
#include   <cstdio>
#include    <queue>
#include    <stack>
#include    <ctime>
#include    <cmath>
#include      <map>
#include      <set>
#define ll long long
#define INF 0x3f3f3f3f
#define pii pair<int,int>
#define mkp(a,b) make_pair(a,b)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define db1(x) cout<<#x<<"="<<(x)<<endl
#define db2(x,y) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<endl
#define db3(x,y,z) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<", "<<#z<<"="<<(z)<<endl
#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<22,stdin),p1==p2)?EOF:*p1++)
using namespace std;
char buf[(1<<22)],*p1=buf,*p2=buf;
inline ll read(){
    char c=getchar();ll x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
    return x*f;
}
const int maxn=4005;
int main(){
    #ifdef DanDan
    freopen("in.txt","r",stdin);
    //freopen("in.txt","w",stdout);
    clock_t start=clock();
    #endif //DanDan
    string s;cin>>s;
    int len=s.length();
    int ok=1;
    for(int i=0;ok&&i<len;i++){
        if(i%2==0&&s[i]=='L')ok=0;
        if(i%2==1&&s[i]=='R')ok=0;
    }
    printf(ok?"Yes\n":"No\n");
    #ifdef DanDan
    clockid_t end=clock();
    double endtime=(double)(end-start)/CLOCKS_PER_SEC;
    printf("\n\n\n\n\n");
    cout<<"Total time:"<<endtime<<"s"<<endl;        //s为单位
    cout<<"Total time:"<<endtime*1000<<"ms"<<endl;    //ms为单位
    #endif //DanDan
    return 0;
}


// ━━━━━━神兽出没━━━━━━
//      ┏┓       ┏┓
//     ┏┛┻━━━━━━━┛┻┓
//     ┃           ┃
//     ┃     ━     ┃
//     ????━????   ┃
//     ┃           ┃
//     ┃    ┻      ┃
//     ┃           ┃
//     ┗━┓       ┏━┛
//       ┃       ┃
//       ┃       ┃
//       ┃       ┗━━━┓
//       ┃           ┣┓
//       ┃           ┏┛
//       ┗┓┓┏━━━━━┳┓┏┛
//        ┃┫┫     ┃┫┫
//        ┗┻┛     ┗┻┛
//
// ━━━━━━感觉萌萌哒━━━━━━



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  lb  lower_bound
#define  ub  upper_bound
#define  F   first
#define  S   second
const int N=1e4+5;
int a[N],b[N],dp[N];
int main()
{
    ft
    int i,j,h,n;
    cin>>h>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    for(i=1;i<=h;i++)
    {
        dp[i]=INT_MAX;
    }
    for(i=0;i<n;i++)
    {
        for(j=1;j<=h;j++)
        {
            dp[j]=min(dp[j],(dp[max(0,(j-a[i]))]+b[i]));
        }
    }
    cout<<dp[h]<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, a, b, c, d, e, f;
    cin >> N;
    a = N % 1000;
    b = a % 100;
    c = b % 10;
    d = (b - c) / 10;
    e = (a - b) / 100;
    f = (N - a) / 1000;
    if ((f==e) && (e==d) && (d==c)){
    cout << "Yes" << endl;
    }
    else if ((f==e) && (e==d)){
    cout << "Yes" << endl;
    }
    else if ((e==d) && (d==c)){
    cout << "Yes" << endl;
    }
    else{
    cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b) cout<<c<<endl;
	else if(a==c) cout<<b<<endl;
	else if(b==c) cout<<a<<endl; 
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int n,k,i,j,d,m;
  int count = 0;
  int a[101] = {0};

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

    for(i=0; i<n; i++){
      if(a[i] == 0)
      count++;
    }

    printf("%d", count);

  return 0;
}


Measured memory_bytes: 1708
#include <bits/stdc++.h>
#define ll long long
#define db double
using namespace std;
const int INF=0x3f3f3f3f;
int h,w;
multiset<int> s;
map<int,int> mp;
int main()
{
    scanf("%d%d",&h,&w);
    for(int i=0;i<w;i++)
        s.insert(0),mp[i]=i;
    for(int i=0,x,y;i<h;i++)
    {
        scanf("%d%d",&x,&y);
        auto tmp=mp.lower_bound(x-1);
        int m=-1;
        while(tmp!=mp.end() && tmp->first<=y)
        {
            m=max(m,tmp->second);
            int p=(tmp->first)-(tmp->second);
            s.erase(s.find(p));
            mp.erase(tmp++);
        }
        if(m!=-1 && y<w)
        {
            s.insert(y-m);
            mp[y]=m;
        }
        printf("%d\n",s.empty()?-1:*s.begin()+i+1);
    }
    return 0;
}


Measured memory_bytes: 22500
S = input()
Q = int(input())

F, B = [], []
reverse = False
for i in range(Q):
	Query = input().split()
	if Query[0] == '1':
		reverse = not reverse
	else:
		if not reverse:
			if Query[1] == '1':
				F.append(Query[2])
			else:
				B.append(Query[2])
		else:
			if Query[1] == '1':
				B.append(Query[2])
			else:
				F.append(Query[2])

if not reverse:
	ans = "".join(reversed(F))
	ans += "".join(S)
	ans += "".join(B)
	print(ans)
else:
	ans = "".join(reversed(B))
	ans += "".join(reversed(S))
	ans += "".join(F)
	print(ans)

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

using namespace std;

int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 0; i < n; i++) { int a; cin >> a; if (a % 2) cnt++; }
  if (cnt % 2) puts("NO"); else puts("YES");
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    if (n>99999) cout << 90909 << endl;
    if (99999>=n and n>=10000) cout << n-9999+909 << endl;
    if (9999>=n and n>=1000) cout << 909 << endl;
    if (999>=n and n>=100) cout << n-99+9 << endl;
    if (99>=n and n>=10) cout << 9 << endl;
    if (9>=n) cout << n << endl;
    return 0;
}

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

using namespace std;


int main() {
    int n;
    cin >> n;
    vector<string> w(n);
    for(int i = 0; i < n; i++) {
        cin >> w[i];
    }
    bool ok = true;
    for(int i = 0; i < n-1; i++) {
        int sz = w[i].size();
        if(w[i][sz-1] != w[i+1][0]) {
            ok = false;
        }
    }
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            if(i != j && w[i] == w[j]) {
                ok = false;
            }
        }
    }
    if(ok) {
        puts("Yes");
    } else {
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<fstream>
#include<utility>
#include<string>
#include<iomanip>
#include<queue> 
#include<cmath>
#include<utility>
#include<set>
using namespace std;
bool compare(int a, int b)
{
  return a > b;
}
int main()
{
  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  int a, b;
  cin >> a >> b;
  if(a > b)
  	swap(a, b);
  for(int i = 0; i < b; i++)
  	cout << a;
  cout << '\n';
}


Measured memory_bytes: 256
n,a,b=map(int,input().split())
if (b-a)%2==0:
    print((b-a)//2)
else:
    ans1=min(b-1,n-a)
    ans2=0
    kyori=b-a-1
    ans2+=min(a-1,n-b)+1
    ans2+=kyori//2
    print(min(ans1,ans2))

Measured memory_bytes: 61476
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n;
  cin >> n;
  vector<ll> b(n);
  int flg = 0;
  int k = 0;
  rep(i, n) {
    ll a;
    cin >> a;
    if(a < 0) flg ^= 1;
    b[i] = abs(a);
    if(b[k] > b[i]) k = i;
  }

  b[k] *= 1 - 2 * flg;
  ll ans = 0LL;
  rep(i, n) ans += b[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        if(a>b)
            printf("a > b\n");
        else if(a<b)
            printf("a < b\n");
        else
            printf("a == b\n");
    }
    return 0;
}

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

using namespace std;

int M, N;

int main()
{
    scanf("%d%d", &M, &N);
    vector<int> even;
    vector<int> odd;
    for(int i=0; i<N; i++)
    {
        int a;
        scanf("%d", &a);
        if(a%2==0)
            even.push_back(a);
        else
            odd.push_back(a);
    }
    if(odd.size()>2)
        printf("Impossible\n");
    else
    {
        if(!odd.empty())
        {
            even.insert(even.begin(), odd.back());
            odd.pop_back();
        }
        if(!odd.empty())
        {
            even.push_back(odd.back());
            odd.pop_back();
        }
        for(auto& it: even)
            printf("%d ", it);
        printf("\n");
        if(N==1)
        {
            if(even[0]==1)
                printf("1\n1\n");
            else
                printf("2\n%d 1\n", even[0]-1);
        }
        else
        {
            even[0]--;
            even.back()++;
            if(even[0]==0)
                even.erase(even.begin());
            printf("%d\n", even.size());
            for(auto& it: even)
                printf("%d ", it);
            printf("\n");
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        boolean[][] bl = new boolean[3][];
        int[][] A = new int[3][];
        for(int i=0;i<3;i++){
            bl[i] = new boolean[3];
            A[i] = new int[3];
            Arrays.fill(bl[i], false);
        }
        for(int y=0;y<3;y++){
            for(int x=0;x<3;x++){
                A[y][x] = sc.nextInt();
            }
        }
        int N = sc.nextInt();
        for(int i=0;i<N;i++){
            int b = sc.nextInt();
            for(int y=0;y<3;y++){
                for(int x=0;x<3;x++){
                    if(b == A[y][x]){
                        bl[y][x]=true;
                    }
                }
            }
        }
        boolean okflag = false;
        for(int i=0;i<3;i++){
            if(bl[i][0] == bl[i][1] && bl[i][1] == bl[i][2] && bl[i][1]){
                okflag = true;
            }
            if(bl[0][i] == bl[1][i] && bl[1][i] == bl[2][i] && bl[2][i]){
                okflag = true;
            }
        }
        if(bl[0][0] == bl[1][1] && bl[1][1] == bl[2][2] && bl[2][2]){
            okflag = true;
        }
        if(bl[0][2] == bl[1][1] && bl[1][1] == bl[2][0] && bl[1][1]){
            okflag = true;
        }
        if(okflag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }

}


Measured memory_bytes: 23124
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>

int getDigit(int num){
	int ret=0;
	while(num!=0){
		num=num/10;
		ret++;
	}

	return ret;
}


struct city{
	int num;
	int year;
};

struct cityNo{
	int top;
	int bottom;
};


int main(){
	int n,m;

	std::cin>>n>>m;

	std::vector<int> pList(m);
	std::vector<int> yList(m);
	std::vector<std::vector<city> > cList(n);
	std::vector<cityNo> cnList(m);


	for(int i=0; i<m; i++)
		std::cin>>pList[i]>>yList[i];

	for(int i=0; i<m; i++){
		int pref= pList[i]-1;
		cList[pref].push_back({i, yList[i]});
	}
	
	for(int i=0; i<n; i++){
		if(cList[i].empty())
			continue;

		std::stable_sort(cList[i].begin(), cList[i].end(), 
			[](const city& x, const city& y){return x.year< y.year;});
	}
	
	for(int i=0; i<n; i++){
		for(int j=0; j< cList[i].size(); j++){
			int index= cList[i][j].num;
			cnList[index]={i,j};
		}
	}





	for(int i=0; i<m; i++){
		int digitTop= getDigit(cnList[i].top+1);
		int digitBottom= getDigit(cnList[i].bottom+1);

		for(int j=0; j< 6-digitTop; j++)
			std::cout<<"0";
		std::cout<<cnList[i].top+1;
		for(int j=0; j< 6-digitBottom; j++)
			std::cout<<"0";
		std::cout<<cnList[i].bottom+1<<std::endl;
	}
	


	return 0;
	

}

Measured memory_bytes: 8576
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <tuple>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int sum = 0;
    for(int i=0; i<n; ++i){
        sum += i+1;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
x, k, d= map(int, input().split())
x = abs(x)
if x - k * d >= 0:
    print(x - k * d)
else:
    ans1 = x % d
    check = x // d
    ans2 = ans1 - d
    if((k-check)%2==0):
        print(ans1)
    else:
        print(abs(ans2))


Measured memory_bytes: 9096
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
#define dcml(n) fixed<<setprecision(n)
//CONST
//------------------------------------------
const ll INF=1010000000000000017LL;
const ll MOD=1000000007LL;
const ld EPS=1e-12;
const ld PI=3.14159265358979323846;
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define  FORS(i,m,n) for(ll (i)=(m);   (i)<=(n); (i)++)
#define  RFOR(i,m,n) for(ll (i)=(n)-1; (i)>=(n); (i)--)
#define RFORS(i,m,n) for(ll (i)=(n);   (i)>(n);  (i)--)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
#define WREPS(i,in,j,jn) REPS(i,in)REPS(j,jn)
//-----------------------------------------
//namespace
using namespace std;
//ライブラリはここに
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

//-----------------------------------------
int main(void){
    ll N;string S;cin>>N>>S;
    bool used[10];REP(i,10)used[i]=false;
    ll cnt=0;
    REP(i,N-2){
        ll n1=S[i]-'0';
        if(used[n1])continue;
        else used[n1]=true;
        bool used2[10];REP(i,10)used2[i]=false;
        FOR(j,i+1,N-1){
            ll n2=S[j]-'0';
            if(used2[n2])continue;
            else used2[n2]=true;
            bool used3[10];REP(i,10)used3[i]=false;
            FOR(k,j+1,N){
                ll n3=S[k]-'0';
                if(used3[n3])continue;
                else used3[n3]=true;
                cnt++;
            }
        }
    }
    cout<<cnt<<"\n";
}

Measured memory_bytes: 256
open Scanf
open Printf

let prime = [
        3;
        5;
        7;
        11;
        13;
      ]

let num = [
  3 * 5 * 7;
  3 * 5 * 11;
  3 * 5 * 13;
  3 * 7 * 11;
  3 * 7 * 13;
  3 * 11 * 13;
  5 * 7 * 11;
  5 * 7 * 13;
  7 * 11 * 13;
  3 * 3 * 3 * 5;
  3 * 3 * 3 * 7;
]

let f n = List.length @@ List.filter (fun k -> k <= n) num

let () = let ans = scanf "%d\n" f in
  printf "%d\n" ans

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

int fuc(int n, int m) {
  int mod = 1000000007;
  long long sum1 = 1;
  for (int i = 1; i <= n; ++i) {
    sum1 = ((sum1 % mod) * (i % mod)) % mod;
  }
  
  long long sum2 = 1;
  for (int i = 1; i <= m; ++i) {
    sum2 = ((sum2 % mod) * (i % mod)) % mod;
  }
  return ((sum2 % mod) * (sum1 % mod)) % mod;
}

int fuc(int x) {
  int sum = 1;
  for (int i = 1; i <= x; ++i) {
    sum *= i;
    sum %= 1000000007;
  }
  return sum;
}

int main() {
  int n, m; // 犬n匹, 猿m匹
  cin >> n >> m;
  if ((n - m) > 1 || (n - m) < -1) {
    cout << 0 << endl;
    return 0;
  }
  if ((n - m) == 1 || (n - m) == -1) {
    cout << fuc(n, m) << endl;
    return 0;
  }
  cout << (fuc(n,  m) * 2) % 1000000007 << endl;
  return 0;
}


Measured memory_bytes: 256
S = input()
N = len(S)

flag = "Yes"

for i in range(len(S)):

    if S[i] != S[len(S)-1-i]:
        flag = "No"

T = S[:(N-1)//2]


for i in range(len(T)):

    if T[i] != T[len(T)-1-i]:
        flag = "No"

U = S[(N+3)//2-1:]



for i in range(len(U)):

    if U[i] != U[len(U)-1-i]:
        flag = "No"

print (flag)



Measured memory_bytes: 3064
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var M = one[1];
  var edge = new Array(M);
  var output = 0;
  //ある辺1個だけ使わない場合のグラフを構築する
  //はばたんでグループ分けしてグループの個数が2個ならoutput++;
  for(var i = 0; i < M; i++){
    edge[i] = nextIntArray();
  }
  for(var i = 0; i < M; i++){
    var list = new Array(N);
    for(var j = 0; j < N; j++){
      list[j] = {
        "index" : j,
      	"group" : null,
        "child" : []
      };
    }
    for(var j = 0; j < M; j++){
      if(j != i){
         var tmp = edge[j];
         list[tmp[0] - 1]["child"].push(tmp[1] - 1);
         list[tmp[1] - 1]["child"].push(tmp[0] - 1);
      }
    }
    //myerr(list);
    var groupSize = 0;
    for(var j = 0; j < N; j++){
      bfs(j);
    }
    //myerr(list);
    if(groupSize != 1){
       output++;
    }
    function bfs(index){
      if(list[index]["group"] != null){
         return;
      }
      groupSize++;
      var queue = [list[index]];
      while(queue.length > 0){
        var tmp = queue.shift();
        list[tmp["index"]]["group"] = groupSize;
        //myerr(list[tmp["index"]]["group"]);
        var children = tmp["child"];
        for(var k = 0; k < children.length; k++){
          if(list[children[k]]["group"] == null){
             queue.push(list[children[k]]);
          }
        }
      }
    }
  }
  myout(output);
}

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

using namespace std;

int main() {
	string s;
	cin >> s;
	string abc = "bdpq";
	string abc2 = "dbqp";
	int sz = s.size();
	if (sz % 2 == 0) {
		bool h = true;
		for (int i = 0; i < sz/2; i++) {
			for (int j = 0; j < 4; j++) {
				if (s[i] == abc[j]) {
					if (s[sz-1-i] == abc2[j]) {
					} else {
						h = false;
					}
				}
			}
		}
		if (h) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 512
import bisect,sys
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac =fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV
        
    return CONV()



sys.setrecursionlimit(200005)


def main():
    N= iRaw()
    As = isRaw()
    nbukas = [0]*N
    for a in As:
        nbukas[a-1]+=1
    return "\n".join([str(nb) for nb in nbukas])

if __name__ == "__main__":
    print(main())


Measured memory_bytes: 102964
#include<bits/stdc++.h>
using namespace std;
const int inf = 2e9;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,ans=0;
    cin >> n;
    map<int,int> mp;
    vector<pair<int,int>> cand;
    for (int i=0,x;i < n; ++i) {
        cin >> x;
        ++mp[x];
        for (int s = 1<<__lg(inf); s >= x; s >>= 1) 
            cand.emplace_back(min(x,s-x),max(x,s-x));
    }
    sort(begin(cand),end(cand),greater<pair<int,int>>());
    for (auto p : cand) {
        int x,y;
        tie(x,y) = p;
        int z = min(mp[x],mp[y]);
        if (x == y)
            z/=2;
        ans += z;
        mp[x] -= z;
        mp[y] -= z;
    }
    cout << ans << endl;
}



Measured memory_bytes: 40296
package main

import (
	"fmt"
	"io"
	"os"
)

func answer(reader io.Reader, writer io.Writer) {
	var x, y, r, g, b, n int
	_, _ = fmt.Fscan(reader, &r)
	_, _ = fmt.Fscan(reader, &g)
	_, _ = fmt.Fscan(reader, &b)
	_, _ = fmt.Fscan(reader, &n)
	count := 0
	x = n / r
	for i:=x;i>=0;i-- {
		if i*r == n {
			count++
			//_, _ = fmt.Printf("%d: %d, 0, 0\n", count, i)
		} else {
			y = (n-i*r) / g
			for j:=y;j>=0;j-- {
				if i*r + j*g == n {
					count++
					//_, _ = fmt.Printf("%d: %d, %d, 0\n", count, i, j)
				} else {
					if (n-i*r-j*g) % b == 0 {
						count++
						//_, _ = fmt.Printf("%d: %d, %d, %d\n", count, i, j,(n-i*r-j*g)/b)
					}
				}
			}

		}
	}

	//_, _ = fmt.Printf("%d\n", count)
	_, _ = fmt.Fprintf(writer, "%d", count)
}

func main() {
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int n,d,a[100],b,i,sum=0;
    scanf("%d %d %d",&n,&d,&b);
    d=d-1;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        a[i]=d/a[i]+1;
        sum=sum+a[i];
    }
    printf("%d",sum+b);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main(){
    ll a[] ={0,1,3,1,2,1,2,1,1,2,1,2,1};
    ll x,y;
    cin>>x>>y;
    cout<<(a[x]==a[y] ? "Yes":"No");
    return 0;
}

Measured memory_bytes: 256
import numpy as np
s = input()

item = np.arange(len(s) - 1) + 1
n = len(item)
count = 0
for i in range(2 ** n):
    sidx = 0
    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            eidx = item[j]
            count += int(s[sidx:eidx])
            sidx = eidx
    count += int(s[sidx:])
print(count)

Measured memory_bytes: 12484
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll bg=1234567890123;
#define ff(i,n) for(i=0;i<n;i++)
#define gg1(n1) cin>>n1;
#define gg(n1,n2) cin>>n1>>n2;
#define gg3(n1,n2,n3) cin>>n1>>n2>>n3;
#define hh(n) cout<<n<<endl;
#define t top
#define p push
#define pb push_back
#define mp make_pair
ll dp[100][100001];
int main()
{
  ll n,w1,i,j;
  cin>>n>>w1;
  ll v[n],w[n];
  for(i=0;i<n;i++)
    cin>>w[i]>>v[i];
  for(i=0;i<n;i++)
     for(j=0;j<=100000;j++)
        dp[i][j]=bg;
  dp[0][0]=0;
  dp[0][v[0]]=w[0];
  for(i=0;i<n-1;i++)
  {
       for(j=0;j<=100000;j++)
       {
            if(dp[i][j]!=bg)
            {
                 dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
                 if(j+v[i+1]<=100000)
                 {
                      dp[i+1][j+v[i+1]]=min(dp[i+1][j+v[i+1]],dp[i][j]+w[i+1]);
                 }
            }
       }
  }
  ll maxi=0;
  for(i=100000;i>=0;i--)
   if(dp[n-1][i]<=w1)
    {
         maxi=i;
         break;
    }  
  cout<<maxi<<endl;  
  return 0;
}

Measured memory_bytes: 78336
#include <stdio.h>

#include <iostream>
using namespace std;
#include <stdio.h>
int main()
{
	int n, i, j, card[4][14] = { 0 }, ans[52], x;
	char X;
	cin >> n;
	for (i = 0; i<n; i++){
		cin >> X >> x;
		switch (X){
		case 'S':  card[0][x] = 1; card[0][0]++; break;
		case 'H':  card[1][x] = 1; card[1][0]++; break;
		case 'C':  card[2][x] = 1; card[2][0]++; break;
		case 'D':  card[3][x] = 1; card[3][0]++; break;
		}
	}
	for (i = 0; i<4; i++){
		if (card[i][0]<13){
			for (j = 1; j <= 13; j++){
				if (card[i][j] == 0){
					switch (i){
					case 0: printf("S"); break;
					case 1: printf("H"); break;
					case 2: printf("C"); break;
					case 3: printf("D"); break;
					}
					printf(" %d\n", j);
				}
			}
		}
	}
}

Measured memory_bytes: 1148
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
char s[20];
long long ans, n;
bool pls[20];
long long calc() {
    long long t = 0, sum = 0;
    for (int i = 0; i < n - 1; ++i) {
        t = t * 10 + s[i];
        if (pls[i]) {
            sum += t;
            t = 0;
        }
    }
    t = t * 10 + s[n - 1];
    return t + sum;
}
void dfs(int k) {
    if (k == n - 1) {
        ans += calc();
        return;
    }
    pls[k] = false;
    dfs(k + 1);
    pls[k] = true;
    dfs(k + 1);
}
int main() {
    cin >> s;
    n = strlen(s);
    for (int i = 0; i < n; ++i) {
        s[i] -= '0';
    }
    dfs(0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
If you want to shine like a sun, first burn like a sun.
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

        
	ll a,b,c;
	cin>>a>>b>>c;

	if(c >= (a+b))
	{
		cout<<0<<" "<<0;
	}
	else if(c >= a)
	{
		c = c-a;
		b -= c;
		a = 0;
		cout<<a<<" "<<b;
	}
	else
	{
		a -= c;
		cout<<a<<" "<<b;
	}

        
        












    return 0;
}	

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<int>>
constexpr auto mod = 1000000007;


//2のn乗を求めるよ！！！
int ni(int n) {
	if (n == 0)return 1;
	int x = ni(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;
}

//フィボナッチ数列のx番目を求めるよ！
int f(int x,vector<int> s) {
	if (x == 0)return 0;
	if (x == 1)return 1;
	if (s[x] != 0)return s[x];
	s[x] = f(x - 1,s) + f(x - 2,s);
	return s[x];
}

//aとｂの最大公約数を求めるよ！
int gcd(int a, int b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}



// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b,ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//m進数のn桁を全列挙やで
void dfs(int m, int n) {

	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			cout << now << endl;
		}
		else {
			for (int i = m-1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}



int main() {
	string s;
	cin >> s;
	int a = s.size();
	int b[2] = {0};
	int w[2] = { 0 };
	rep(i, 0, a) {
		int x = s[i] - '0';
		if (i % 2 == 0) {
			if (x == 0)b[0]++;
			else w[0]++;
		}
		else {
			if (x == 0)b[1]++;
			else w[1]++;
		}
	}
	int ans = max(b[0] + w[1], b[1] + w[0]);
 ans = a - ans;
	cout << ans << endl;
}
  


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll; ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);
ll fac(ll x){if(x==0) return 1;  return x*fac(x-1);}

int main(){
    ll n, ans=0; cin>>n;
    for(ll i=1;i<=n;i++){
        ll cnt=0;
        if(i%2==0) continue;
        for(ll j=1;j<=i;j++) if(i%j==0) cnt++;
        if(cnt==8) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cctype>
#include <cstdio>
using namespace std;
typedef long long ll;
typedef string::const_iterator State;
#define rep(i,n) for(int i=0;i<(n);i++)

class Parser{
public:
	int expression(State &begin){
		int ret = term(begin);
		for(;;){
			if(*begin == '+'){
				begin++;
				ret += term(begin);
			}else if(*begin == '-'){
				begin++;
				ret -= term(begin);
			}else{
				break;
			}
		}
		return ret;
	}
	int term(State &begin){
		int ret = factor(begin);
		for(;;){
			if(*begin == '*'){
				begin++;
				ret *= factor(begin);
			}else if(*begin == '/'){
				begin++;
				ret /= factor(begin);
			}else{
				break;
			}
		}
		return ret;
	}
	int factor(State &begin){
		int ret;
		if(*begin == '('){
			begin++;//'('?????????
			ret = expression(begin);
			begin++;//')'?????????
		}else{
			ret = number(begin);
		}
		return ret;
	}
	int number(State &begin){
		int ret = 0;
		while(isdigit(*begin)){
			ret *= 10;
			ret += *begin - '0';
			begin++;
		}
		return ret;
	}
};

int main(void){
	int n; cin >> n;
	rep(i, n){
		Parser ps;
		string s; cin >> s;
		string tmp = s.substr(0, s.size() - 1);
		// cout << tmp << endl;
		State begin = s.begin();
		int ret = ps.expression(begin);
		printf("%d\n", ret);
	}
	return 0;
}

Measured memory_bytes: 3232
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

int main() {
	int n, m; cin >> n >> m;
	vector<pair<int, int> > seq(n);
	for (int i = 0; i < n; ++i) seq[i] = make_pair(m + 1, i + 1);
	for (int i = 0; i < m; ++i) {
		int e; cin >> e;
		seq[e - 1].first = m - i;
	}
	sort(seq.begin(), seq.end());
	for (auto a : seq) cout << a.second << endl;

	return 0;
}


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

int main() {
    int N;
    cin >> N;
    if (N == 1) cout << "Hello World" << endl;
    else {
        int A, B;
        cin >> A >> B;
        cout << A + B << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) a.begin(), a.end()
typedef long long int ll;
using namespace std;

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

    int ans = 0;
    REP(i, s.size()) {
        if (s[i] == '+')
            ans++;
        else
            ans--;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N, ans;

int main()
{
	in >> N;
	std::vector<LL>A(N);
	rep(i, N) in >> A[i];
	rep(i, N)
	{
		rep(j, N)
		{
			ans = std::max<LL>(ans, abs(A[i] - A[j]));
		}
	}
	out << ans << std::endl;
	return 0;
}


Measured memory_bytes: 256