akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<ll,ll>; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
////////////////

ll dp[3010][3010];

void solve(){
  ini(N , T);
  vp v(N); in(v);
  sort(all(v));
  ll ans = 0;
  rep( i , N ) rep( t , T ){
    amax(ans , dp[i][t] + v[i].se);
    amax(dp[i + 1][t] , dp[i][t]);
    if(t + v[i].fi < T) amax(dp[i + 1][t + v[i].fi] , dp[i][t] + v[i].se);
  }
  out(ans);
}


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

int main () {
  int N;
  cin >> N;
  vector<long> T(N);
  for (int i = 0; i < N; i++) {
    cin >> T.at(i);
  }
  for (int i = 0; i < N-1; i++) {
    long a = T.at(i+1), b = T.at(i), r = a%b;
    long c = a, d = b;
    while (r != 0) {
      a = b;
      b = r;
      r = a%b;
    }
    T.at(i+1) = c/b*d;
  }
  cout << T.at(N-1) << endl;
}

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

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("in_b.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    const int N = 200;
    uint64_t A[200] = {0};

    cin >> n;

    bool is_even = true;

    int cnt = 0;

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


    while(is_even)
    {
        for (int i = 0; i < n; i++)
        {
            if (A[i] % 2)
            {
                is_even = false;
            }
            else
            {
                A[i] /= 2;
            }
        }
        if (!is_even) break;
        cnt++;
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	ll s0=0;
	string hoge;
	cout<<0<<endl;
	cin>>hoge;
	if(hoge=="Vacant") return 0;
	if(hoge=="Male") s0=0;
	if(hoge=="Female") s0=1;
	ll lb=0, ub=n;
	while(ub-lb>1) {
		ll mid=(lb+ub)/2;
		cout<<mid<<endl;
		ll tmp;
		string fuga;
		cin>>fuga;
		if(fuga=="Vacant") return 0;
		if(fuga=="Male") tmp=0;
		else tmp=1;
		if(s0==0) {
			if(mid%2==tmp) {
				lb=mid;
			} else {
				ub=mid;
			}
		} else {
			if(mid%2!=tmp) {
				lb=mid;
			} else {
				ub=mid;
			}
		}
	}
	cout<<lb<<endl;
	string piyo;
	cin>>piyo;
	return 0;
}


Measured memory_bytes: 852
#include<bits/stdc++.h>
using namespace std;
string a[1001];
int main() 
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<n;i++)cout<<a[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d;
  string s;
  long long ans = 0;
  
  cin >> a;

  if(a >= 1200) s = "ARC";
  else s = "ABC";
  cout << s << endl;

}

Measured memory_bytes: 256
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <vector>
using namespace std;

int n, m, a[305][305], f[305], p[305];
bool ok[305];
int main(){
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n ; ++i){
        for(int j = 1; j <= m ; ++j)
            scanf("%d", &a[i][j]);
        ++f[a[i][1]];
        p[i] = 1;
    }

    int Sol = n;
    for(int i = 1; i < m ; ++i){
        int Max = 0, w = 0;
        for(int i = 1; i <= m ; ++i)
            if(f[i] > Max) Max = f[i], w = i;
        if(Sol > Max) Sol = Max;
        ok[w] = 1;
        for(int i = 1; i <= n ; ++i){
            --f[a[i][p[i]]];
            while(ok[a[i][p[i]]]) ++p[i];
            ++f[a[i][p[i]]];
        }
    }
    printf("%d", Sol);
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
int main()
{
     ll t,r=0,g=0,b=0,n,tot,ans;
     string str;
     cin>>n;
     cin>>str;
     for(int i=0;i<n;i++)
     {
         if(str[i]=='R')
            r++;
         else if(str[i]=='G')
            g++;
         else
            b++;
     }
     ans=r*g*b;
     tot=int('R')+int('G')+int('B');
     for(int i=0;i<n;i++)
     {
         for(int j=i+1;j<n;j++)
         {
             ll k=2*j-i;
             if(k<n && (int(str[i])+int(str[j])+int(str[k]))==tot)
                ans--;
         }
     }
     cout<<ans<<endl;
}


Measured memory_bytes: 3636
{-# LANGUAGE OverloadedLists     #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
--import           Control.Monad.Loops
import           Data.IORef
import           Data.Maybe
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import           GHC.Base
import           System.IO

import qualified Data.Array    as A
import qualified Data.IntMap   as I
import           Data.List
import qualified Data.Map      as M
import qualified Data.Set      as S
import qualified Data.Vector   as V

-- for Text
(+.+) = T.append
(!.!) = T.index

-- for Vector
count :: (a -> Bool) -> V.Vector a -> Int
count p = V.length . V.filter p

-- for IO
readT :: Read a => T.Text -> a
readT = read . T.unpack

getLineSpc :: Read a => IO [a]
getLineSpc = do
  t <- T.getLine
  let xs = map readT $ T.split (== ' ') t
  return xs

getLineSpcVec :: Read a => IO (V.Vector a)
getLineSpcVec = do
  t <- T.getLine
  let xs = V.fromList $ map readT $ T.split (== ' ') t
  return xs

----------
-- main --
----------
main :: IO ()
main = a121

a121 :: IO ()
a121 = do
  ab' <- T.getLine
  let ab      = read $ T.unpack $ T.filter (/= ' ') ab' :: Int
      squares = V.fromList [n ^ 2 | n <- [1..999]]
  if ab `V.elem` squares
    then
    putStrLn "Yes"
    else
    putStrLn "No"

Measured memory_bytes: 508
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Solve
{
    public Solve() { }
    public static int Main()
    {
        new Solve().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int A = cin.nextInt();
        int B = cin.nextInt();
        int C = cin.nextInt();

        if (C <= A + B)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x1 = in.nextInt();
        int x2 = in.nextInt();
        int x3 = in.nextInt();
        int x4 = in.nextInt();
        int x5 = in.nextInt();

        if (x1 == 0) {
            System.out.println(1);
        }
        if (x2 == 0) {
            System.out.println(2);
        }
        if (x3 == 0) {
            System.out.println(3);
        }
        if (x4 == 0) {
            System.out.println(4);
        }
        if (x5 == 0) {
            System.out.println(5);
        }

    }
}


Measured memory_bytes: 35692
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String S=sc.next();
        int index=S.length();
        while(index>0){
            if(index>=7 && S.substring(index-7,index).equals("dreamer")){
                index-=7;
            }else if(index>=6 && S.substring(index-6,index).equals("eraser")){
                index-=6;
            }else if(index>=5 && (S.substring(index-5,index).equals("dream") || S.substring(index-5,index).equals("erase"))){
                index-=5;
            }else{
                System.out.println("NO");
                break;
            }
        }
        if(index == 0){
            System.out.println("YES");
        }
    }
}

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

int main() {
	int n;
	double m = 0;
	double t;
	string s;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> t >> s;
		if (s == "JPY") {
			m += t;
		}
		else {
			m += t * 380000.0;
		}
	}

	cout << m << endl;
	return 0;
}

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

void Print(int n, int **A){
    int i, j;
    for(i = 1; i <= n; i++){
        for(j = 1; j <= n; j++){
            if(j != 1) cout << ' ';
            cout << A[i][j];
        }
        cout << endl;
    }
}

int main(){
    int n, u, k, v;
    cin >> n;
    int A[n+1][n+1];
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            A[i][j] = 0;
        }
    }
    for(int i = 0; i < n; i++){
        scanf("%d %d", &u, &k);
        for(int j = 0; j < k; j++){
            scanf("%d", &v);
            A[u][v] = 1;
        }
    }

    int i, j;
    for(i = 1; i <= n; i++){
        for(j = 1; j <= n; j++){
            if(j != 1) cout << ' ';
            cout << A[i][j];
        }
        cout << endl;
    }

    return 0;

}


Measured memory_bytes: 3228
#include <iostream>

using namespace std;

int main() 
{
    int N;
    cin>>N;
    if(N==0){
        cout<<2<<endl;
        return 0;
    }else if(N==1){
        cout<<1<<endl;
        return 0;
    }

    long long ans = 0;
    long long prev_1 = 1;
    long long prev_2 = 2;
    for(int i = 2;i<=N;i++){
        if(i==N){
            ans = prev_1 + prev_2;
        }else{
            ans = prev_1 + prev_2;
            prev_2 = prev_1;
            prev_1 = ans;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author HARSHAD
 */

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265358979323846;

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

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

class TaskC {
public:
    int n, k;
	void solve(std::istream& in, std::ostream& out) {
		in>>n>>k;
        --n, --k;
        out<<(n/k + (n%k!=0));
	}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	TaskC solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c;
    while(scanf("%d%d%d",&a,&b,&c)==3)
    {
        if(a+b+c==17)
        {
            printf("YES\n");
        }
        else
            printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 128
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


N, X = map(int, input().split())
x = list(map(int, input().split()))

x.append(X)
x.sort()

y = []
for i in range(N):
    y.append(abs(x[i]-x[i+1]))

ans = y[0]
for i in range(1, len(y)):
    if gcd(ans, y[i]):
        ans = gcd(ans, y[i])

print(ans)


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

#define int long long

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999

using namespace std;

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

int lcm(int a, int b){
    return a*b/gcd(a, b);
}

int32_t main(){
    int n, m;
    cin >> n >> m;
    vector<int> p(n), c(n);
    REP(i, n){
        cin >> p[i] >> c[i];
    }

    int ans=INF;
    REP(i, pow(2, n)){
        int sum=0, cnt=0;
        REP(j, n){
            if(i & (1 << j)){
                sum+=100*(j+1)*p[j]+c[j];
                cnt+=p[j];
            }
        }

        for(int j=n-1; j>=0; j--){
            if(!(i & (1 << j))){
                int t=0;
                while(sum<m && t<p[j]){
                    sum+=(j+1)*100;
                    cnt++;
                    t++;
                }
            }
        }

        ans = min(ans, cnt);
    }

    cout << ans << endl;
}

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

const int MAX_N = 100;
int N, K;
int plan[MAX_N + 1];
int memo[MAX_N + 1][4][4];
int solve(int n, int b1, int b2){
	if(n == N+1) return 1;
	if(memo[n][b1][b2] != -1) return memo[n][b1][b2];
	if(plan[n] != 0){
		if(b1 == b2 && b1 == plan[n])
			return 0;
		else
			return solve(n+1, plan[n], b1)%10000;
	}
	int t=0;
	for(int i=1; i<=3; ++i){
		if(b1==b2 && b1==i ) continue;
		t+=solve(n+1, i, b1)%10000;
	}
	return memo[n][b1][b2] = t%10000;
}
int main(){
	scanf("%d %d", &N, &K);
	for(int i=0; i<K; ++i){
		int d, k;
		scanf("%d %d", &d, &k);
		plan[d] = k;
	}
	for(int i=0; i<=N; ++i)
		for(int j=0; j<4; ++j)
			for(int k=0; k<4; ++k)
				memo[i][j][k] = -1;
	printf("%d\n", solve(1, 0, 0));
	return 0;
}

Measured memory_bytes: 1032
N, T = map(int, input().split())
t = list(map(int, input().split()))
t_water = 0

for i in range(N - 1):
    t_diff = t[i + 1] - t[i]
    if t_diff > T:
        t_water += T
    else:
        t_water += t_diff

print(t_water + T)

Measured memory_bytes: 25200
program main
implicit None
	integer(8)::n,i,p,q,r,s
	integer(8),allocatable::a(:),b(:),c(:)
	
	read*,n
	allocate(a(n),b(n),c(n))
	
	do i=1,n
		read*,a(i),b(i)
		c(i) = a(i)+b(i)
	enddo
	
	call h3(c,a,b,n)
	
	p = 1
	q = 1
	do
		if(p > n)exit
		do
			if(q+1 > n)exit
			if(c(p) /=c(q+1))exit
			q = q+1
		enddo
		call h3(a(p:q),b(p:q),c(p:q),q-p+1)
		
		p = q+1
		q = q+1
	enddo
	
	p = 0;q = 0
	
	do i = 1,n/2
		p = p + a(n-2*i+2)
		q = q + b(n-2*i+1)
	enddo
	
	if(mod(n,2) == 1) p = p+a(1)
	
	print *,p-q
end program main

subroutine h3(a,b,c,n)
implicit None
	integer(8)::a(n),b(n),c(n),x,y,z
	integer(8)::n,i,ie,i0,i1,i2
	
	do i = n/2,1,-1
		x = a(i);y = b(i);z = c(i);ie = n + 1; i0 = i; i1 = i0 * 2
		do while(i1 < ie)
			i2 = i1 + 1
			if(i2 < ie .and. a(i1) < a(i2)) i1 = i2
			if(a(i1) > x)then
				a(i0) = a(i1);a(i1) = x
				b(i0) = b(i1);b(i1) = y
				c(i0) = c(i1);c(i1) = z
				else
				exit
			endif
			i0 = i1;i1 = i0 *2
		enddo
	enddo
	do ie = n,2,-1
		x = a(ie);y = b(ie);z = c(ie)
		a(ie) = a(1);b(ie) = b(1);c(ie) = c(1)
		a(1) = x;b(1) = y;c(1) = z
		i0 =1;i1 =2
		do while(i1 <ie)
			i2 = i1 +1
			if(i2 < ie .and. a(i1) < a(i2)) i1 = i2
			if(a(i1) > x)then
				a(i0) = a(i1);a(i1) = x
				b(i0) = b(i1);b(i1) = y
				c(i0) = c(i1);c(i1) = z
				else
				exit
			endif
			i0 = i1;i1 = i0 *2
		enddo
	enddo
end subroutine h3

Measured memory_bytes: 2560
from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
from fractions import gcd
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

def lcm(x, y): return (x * y) // gcd(x, y)

A, B, C, D = inp_list()

# (B 以下の条件を満たす自然数の個数) - (A - 1 以下の条件を満たす自然数の個数)
lcm_cd = lcm(C, D)
B_ans = B - B // C - B // D + B // lcm_cd
A1 = A - 1
A1_ans = A1 - A1 // C - A1 // D + A1 // lcm_cd
ans = B_ans - A1_ans
print(ans)


Measured memory_bytes: 5200
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
#![macro_use]
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::ops::*;
use std::rc::*;
use std::str::*;
use std::string::*;
use std::*;

const MOD: usize = 1000000007;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let S: String = sc.read();

    let ans:String = if S=="ABC" {"ARC".to_string()} else {"ABC".to_string()};
    println!("{}",ans);
    
}

fn next() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok().unwrap();
    s
}
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()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn gcd(mut a: u64, mut b: u64) -> u64 {
    if a < b {
        std::mem::swap(&mut a, &mut b)
    }
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
fn yn(val: bool) {
    if val {
        println! {"Yes"}
    } else {
        println! {"No"}
    }
}
fn digits_sum(mut val: usize) -> usize {
    let mut ret = 0;
    while val > 0 {
        ret += val % 10;
        val /= 10;
    }
    ret
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);
impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        Self(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 2164
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  vector<string>data(H);
  int count=0;
  for(int i=0;i<H;i++)cin>>data[i];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(data[i][j]=='#')
      count++;
    }
  }

  vector<vector<int>>dist(H,vector<int>(W,-1));
  using pir=pair<int,int>;
  queue<pir> que;

  dist[0][0]=1;
  que.push(pir(0,0));

  int dx[4]={0,0,1,-1};
  int dy[4]={1,-1,0,0};
  while(!que.empty()){
    auto v=que.front();
    que.pop();
    for(int i=0;i<4;i++){
      int nx=v.second+dx[i];
      int ny=v.first+dy[i];
      if(nx<0||nx>=W||ny<0||ny>=H)continue;
      if(dist[ny][nx]!=-1)continue;
      if(data[ny][nx]=='#')continue;
      dist[ny][nx]=dist[v.first][v.second]+1;
      que.push(pir(ny,nx));
    }
  }
  if(dist[H-1][W-1]==-1){
    cout<<-1<<endl;
    return 0;
  }
  int ans=H*W-dist[H-1][W-1]-count;
  cout<<ans<<endl;
}

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

int main(){
  int  a[3];
  cin >> a[0] >> a[1] >> a[2];
  int ans;
  int tmp;
  for(int i=0;i<2;i++){
    if(a[i]>a[i+1]){
      tmp = a[i];
      a[i] = a[i+1];
      a[i+1] = tmp;
    }
  }
  cout << a[2]*10 + a[0] + a[1] << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main()
{
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int at = 0;
  int bt = 0;
  int ct = 0;
  
  int max = 0;
  
  if(k <= a)
    max = k;
  
  else if(a < k && k <= a + b)
    max = a;
  
  else if(a + b < k)
    max = a - (k - (a + b));
  
  printf("%d", max);
}

int main()
{
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    vi l(n * 2);
    REP(i, n * 2) cin >> l[i];
    SORT(l);
    int ans = 0;
    REP(i, n) ans += l[i * 2];
    cout << ans << endl;
}


Measured memory_bytes: 256
const main = (input) => {
  input = input.trim().split('\n')
  const [h, w, m] = input[0].split(' ').map(Number)

  const hs = new Array(h).fill(0)
  const ws = new Array(w).fill(0)
  const bomb = new Map()

  for (let i=1; i<=m; i++) {
    const [hi, wi] = input[i].split(' ').map(Number)
    hs[hi-1]++
    ws[wi-1]++
    bomb.set(`${hi-1}:${wi-1}`, true)
  }

  let hmx = 0
  let wmx = 0

  let topH = []
  let topW = []

  for (let i=0; i<Math.max(hs.length, ws.length); i++) {
    if (hs[i] && hs[i] > hmx) {
      hmx = hs[i]
      topH = [[i, hs[i]]]
    }
    else if (hs[i] && hs[i] === hmx) topH.push([i, hs[i]])

    if (ws[i] && ws[i] > wmx) {
      wmx = ws[i]
      topW = [[i, ws[i]]]
    }
    else if (ws[i] && ws[i] === wmx) topW.push([i, ws[i]])
  }

  for (let x=0; x<topH.length; x++) {
    for (let y=0; y<topW.length; y++) {
      if (!bomb.has(`${topH[x][0]}:${topW[y][0]}`)) return console.log(hmx + wmx)
    }
  }
  return console.log(hmx + wmx - 1)
}

process.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 190560
process.stdin.resume();
process.stdin.setEncoding('utf8');
// 自分の得意な言語で
// Let's チャレンジ！！

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
 
  var N = parseInt(lines[0],10);
  var need = lines[1].split(' ').map(value=>parseInt(value,10));
  var print = (value)=>console.log(value);

  var count = 0;
  
  for(var i=0;i<N;i++){
  	while(need[i] !==0){
      need[i] --;
      for(var j=i+1;j<N;j++){
      	if(need[j] !==0){
        	need[j]--;
        }else{
        	break;
        }
      }
      
      count++;
    }
    
  
  }
  print(count);
  
});

Measured memory_bytes: 30812
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void join(const Type &a){for(auto elem:a)cout<<elem<<' ';cout<<endl;}

typedef pair<llong,llong> pll;

vector<pll > primefactor(llong n){//素因数分解.
    vector<pll > ret;
    for(llong i=2;i*i<=n;++i){
		if(n%i==0){
			llong cnt=0;
			while(n%i==0)n/=i,cnt++;
			ret.push_back(pll(i,cnt));
		}
	}
    if(n!=1) ret.push_back(pll(n,1));
    return ret;
}

int main(){
	llong a,b;
	cin>>a>>b;
	
	llong n=__gcd(a,b);
	
	vector<pll> v=primefactor(n);
	
	cout<<v.size()+1<<endl;
}//reply to exp.

Measured memory_bytes: 256
#include <stdio.h>
 
int main() {
  int H , W,i,j;
 
  while(1){
      scanf("%d",&H);/*縦を入力*/
     scanf("%d",&W);/*横を入力*/
    if(H == 0 && W == 0) {/*WとHがともに真の場合*/
      break;  /*ループから抜ける*/
    }
    for(j=1; j<=H; j++) {
      for(i=1; i<=W; i++) {
    printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
 
}


Measured memory_bytes: 2076
#include <bits/stdc++.h>
#define s second
#define f first
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

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

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

int main(){ _

	string S;
	cin >> S;

	int N = S.size();

	int l = 0;
	for(int i = N - 1; i >= 0; i--)
		if(S[i] == 'A') l = i;

	int r;

	int id = -1;
	for(auto x : S){
		id++;
		if(x == 'Z') r = id;
	}

	cout << r-l + 1 << endl;

	return 0;
}


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

int main()
{
    long long n , x , fmx , smx , ans;
    vector <long long> vec;
    vector <long long> vec2;
    cin >> n;
    for(long long i = 0; i < n; i++)
    {
        cin >> x;
        vec.push_back(x);
        vec2.push_back(x);
    }
    sort(vec2.begin(), vec2.end());
    fmx = vec2[vec2.size() - 1];
    smx = vec2[vec2.size() - 2];
    for(long long i = 0; i < n; i++)
    {
        if(vec[i] != fmx)
        {
            ans = fmx;
        }else
        {
            ans = smx;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 4964
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
const int inf = 1e+9;


int main() {
	int h1,m1,h2,m2,k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;

	int t1 = h1 * 60 + m1;
	int t2 = h2 * 60 + m2;
	cout << t2 - t1 - k << endl; 

	return 0;
}


Measured memory_bytes: 3192
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 998244353;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int len = (int)1e6 + 1;
	
	
	void doIt() {
		String S = sc.next();
		System.out.println((S.equals("ABC")?"ARC":"ABC"));
	}
	
	
	public static void main(String[] args) {
		new Main().doIt();
	}

}


Measured memory_bytes: 35656
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <tuple>
using namespace std;


int main(int argc, const char * argv[]) {
  int n;
  cin >> n;
  using p = tuple<string, int, int>;
  string a;
  int b;
  vector<p> ab;
  for(int i = 0; i < n ; i++){
    cin >> a >> b;
    ab.push_back(make_tuple(a, -b, i+1));
  }
  sort(ab.begin(), ab.end());
  int j;
  for(int i = 0; i < n; i++){
    tie(a,b, j) = ab.at(i);
    cout << j << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{  int a,b,c,d,k;

            while(~scanf("%d",&k))
            {   d=k%10;
                c=(k/10)%10;
                b=(k/100)%10;
                a=(k/1000)%10;
                if(a+b+c+d==7) {printf("%d+%d+%d+%d=7\n",a,b,c,d);return 0;}
                if(a+b-c+d==7) {printf("%d+%d-%d+%d=7\n",a,b,c,d);return 0;}
                if(a+b-c-d==7) {printf("%d+%d-%d-%d=7\n",a,b,c,d);return 0;}
                if(a+b+c-d==7) {printf("%d+%d+%d-%d=7\n",a,b,c,d);return 0;}
                if(a-b+c+d==7) {printf("%d-%d+%d+%d=7\n",a,b,c,d);return 0;}
                if(a-b-c+d==7) {printf("%d-%d-%d+%d=7\n",a,b,c,d);return 0;}
                if(a-b+c-d==7) {printf("%d-%d+%d-%d=7\n",a,b,c,d);return 0;}
                if(a-b-c-d==7) {printf("%d=%d-%d-%d=7\n",a,b,c,d);return 0;}



            }



}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

char S[100];
ll i, j, k;
int main(){
    scanf("%s", S);
    for (i = 0; S[i];i++)
    {
        if(i%2==0&&S[i]=='L'){
            break;
        }else if(i%2==1&&S[i]=='R'){
            break;
        }
    }
    printf("%s", S[i] ? "No" : "Yes");
    return 0;
}

Measured memory_bytes: 384
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>

#if __cplusplus >= 201103 //C++11~
#include <tuple>

#endif



using namespace std;

typedef pair<int,int> Paint;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
#define MOD 1000000007

#define pb push_back
#define fir first
#define scn second

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")



/*
確認ポイント
cout<< (char)数値 //数値にあった文字に置き換えられる
cout<< (double)int型/(2など)//小数になる
YesNo大文字小文字間違えてないか
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
sqrt(数値型)でrootが取れる
vector.unique()は隣接した同じ要素を削除するので先にソートをする
tupleはC++11以降

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main() { 
  int n;cin>>n;
  string s;cin>>s;
  int ans = 0;
  int tmp = 1;
  for(int i = 1; n > i; i++){
    if(s[i-1]!=s[i]){
      ans++;
      tmp = 1;
    }else{
      tmp++;
    }
    
  }
  cout << ans+1 << endl;
}




Measured memory_bytes: 512
#!/usr/bin/env python3
import sys
import heapq

def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
    mix_list = [[a, b] for a, b in zip(A, B)]
    mix_list = sorted(mix_list, key=lambda x:(x[0], x[1]))
    A, B = zip(*mix_list)

    heap = []
    heapq.heapify(heap)

    head = 0
    earned = 0
    for i in range(1, M+1):
        while (head < len(A)) and (A[head] <= i):
            heapq.heappush(heap, -B[head])
            head += 1
        if len(heap) == 0:
            pass
        else:
            accepted = -heapq.heappop(heap)
            earned += accepted
    print(earned)



def solve_dp(N: int, M: int, A: "List[int]", B: "List[int]"):
    """
    動的計画法による実装、解としては合っているが遅い
    """
    mix_list = [[a, b] for a, b in zip(A, B)]
    # mix_list = sorted(mix_list, key = lambda x: x[0])
    A = [a for a, b in mix_list]
    B = [b for a, b in mix_list]
    dp = [[0 for i in range(N)] for j in range(M)]
    for i in range(M):
        if A[0] <= (i + 1):
            dp[i][0] = B[0]
    for j in range(1, N):
        if A[j] <= 1:
            dp[0][j] = max(B[j], dp[i][j - 1])
    for i in range(1, M):
        for j in range(1, N):
            if A[j] <= (i + 1):
                dp[i][j] = max(B[j] + dp[i - 1][j - 1], dp[i][j - 1])
            else:
                dp[i][j] = dp[i][j - 1]
    print(dp[M - 1][N - 1])
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int()] * (N)  # type: "List[int]" 
    B = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, A, B)


if __name__ == '__main__':
    main()


Measured memory_bytes: 29992
import math
N = int(input())
W = list(map(int,input().split()))
min = 10**4+1
sum_W = sum(W)
for i in range(N-1):
    S1 = 0
    S2 = 0
    for j in range(i+1):
        S1 += W[j]
    S2 = sum_W - S1
    S1_S2 = math.fabs(S1-S2)
    if S1_S2 < min:
        min = S1_S2
print(int(min))


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < n; i++)
#define REP(n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using INT64 = long long;
using UINT64 = unsigned long long;
#define MOD 1000000007


map<string,map<int,int>> dp;
vector<string> last3;

int ifAGC(const string &s) {
    REP(s.size()){
        string tmp = s;
        if (i >= 1) {
            swap(tmp[i],tmp[i-1]);
        }
        auto f = tmp.find("AGC");
        if (f != string::npos) return 0;
    }
    return 1;
}

int countdp(int x){
    int r = 0;
    for(const string &s:last3) {
        //cerr << s << ":" << dp[s][x]<< endl;
        r += dp[s][x];
        r %= MOD;
    }
    return r;
}


int main(void)
{
    IOS
    const string ACGT = "ACGT";
    int n;
    cin >> n;

    for(const char &c:ACGT) {
        string s = {c};
        for(const char &d:ACGT) {
            string s2 = s + d;
            for(const char &e:ACGT) {
                string s3 = s2 + e;
                last3.emplace_back(s3);
                dp[s3][3] = ifAGC(s3);
            }
        }
    }

    if (n < 3) {
        cout << (int) pow(4,n) << endl;
    } else if (n == 3) {
        cout << countdp(3) << endl;
    } else {
        FOR(i,3,n) {
            for(const string &s:last3) {
                for(const char &c:ACGT) {
                    string tmp = s + c;
                    //cerr << tmp << endl;
                    dp[tmp.substr(1,3)][i+1] += dp[s][i] * ifAGC(tmp);
                    dp[tmp.substr(1,3)][i+1] %= MOD;
                }
            }
        }
        cout << countdp(n) << endl;
    }



    return 0;
}


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

using namespace std;

// 今,選んだ枚数,合計
long long dp[50][51][2501];

int main()
{
	int n, a, x[50];
	cin >> n >> a;
	for (int i = 0; i < n; i++)
		cin >> x[i];
	dp[0][0][0] = 1;
	dp[0][1][x[0]] = 1;
	for (int i = 1; i < n; i++)
		for (int j = 0; j < n + 1; j++)
			for (int k = 0; k < 2501; k++)
				dp[i][j][k] = dp[i - 1][j][k] + (j == 0 || k - x[i] < 0 ? 0 : dp[i - 1][j - 1][k - x[i]]);
	long long ans = 0;
	for (int i = 1; i < n + 1; i++)
		ans += dp[n - 1][i][i * a];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 49024
using System;
using System.Linq;
namespace AtCoderTemplate
{
    public class App
    {
        public static void Main()=>Console.WriteLine("{1}",Console.ReadLine(),Console.ReadLine().ToCharArray().GroupBy(c=>c).Select(g=>g.Count()+1).Aggregate(1,(long i,int c)=>(i*c)%1000000007)-1);
    }
}

Measured memory_bytes: 14816
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>

using namespace std;

typedef long long int lli;

int gcd(int a, int b){
	return b != 0 ? gcd(b, a%b) : a;
}

int lcm(int a, int b){
	return a*b / gcd(a, b);
}

#define N_MAX 310
#define MOD 1000000007

void solv()
{
	lli A, B, K; scanf("%lld%lld%lld", &A, &B, &K);

	//if (K < A){
	//	printf("%lld %lld", A - K, B);
	//}
	//else if (A <= K && K < A + B){
	//	printf("0 %lld", B - (K - A));
	//}
	//else{
	//	printf("0 0");
	//}

	if (K < A){
		printf("%lld %lld\n", A - K, B);
		return;
	}

	if (K >= A + B){
		A = 0;
		B = 0;

		printf("%lld %lld\n", A, B);
		return;
	}
	else{
		B = B - (K - A);
		A = 0;

		printf("%lld %lld\n", A, B);
		return;
	}



	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String str[];
		double stack[];
		int stackIndex;

		stack = new double[100];
		while (sc.hasNext()) {
			stackIndex = 0;
			str = sc.nextLine().split(" ");
			for (int i = 0; i < str.length; i++) {
				if (!str[i].equals("+") && !str[i].equals("-") && !str[i].equals("*") && !str[i].equals("/")) {
					stack[stackIndex++] = Double.valueOf(str[i]);
				} else if (str[i].equals("+")) {
					stack[stackIndex - 2] = stack[stackIndex - 2] + stack[stackIndex - 1];
					stackIndex--;
				} else if (str[i].equals("-")) {
					stack[stackIndex - 2] = stack[stackIndex - 2] - stack[stackIndex - 1];
					stackIndex--;
				} else if (str[i].equals("*")) {
					stack[stackIndex - 2] = stack[stackIndex - 2] * stack[stackIndex - 1];
					stackIndex--;
				} else if (str[i].equals("/")) {
					stack[stackIndex - 2] = stack[stackIndex - 2] / stack[stackIndex - 1];
					stackIndex--;
				}
			}
			System.out.println(stack[0]);
		}
	}
}

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

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define fst first
#define snd second

const int N = 21;
char s[N][N];
int dist[N][N];
bool visited[N][N];
int h, w;

bool ok(int x, int y)
{
    return x >= 0 && x < h
        && y >= 0 && y < w
        && s[x][y] == '.' && !visited[x][y];
}

int bfs(int i, int j)
{
    queue<pair<int, int>> q;
    q.push(mp(i, j));
    visited[i][j] = true;
    dist[i][j] = 0;
    while(!q.empty())
    {
        pair<int, int> cur = q.front();
        q.pop();
        int x = cur.fst, y = cur.snd;
        vector<pair<int, int>> moves =
        {
            {-1, 0}, {1, 0}, {0, -1}, {0, 1},
        };
        for(auto mv : moves)
        {
            int nx = x + mv.fst, ny = y + mv.snd;
            if(ok(nx, ny))
            {
                q.push(mp(nx, ny));
                dist[nx][ny] = dist[x][y] + 1;
                visited[nx][ny] = true;
            }
        }
    }
    int ans = -1e9;
    for(int k = 0; k < h; k++)
    {
        for(int l = 0; l < w; l++)
            ans = max(ans, dist[k][l]);
    }
    for(int k = 0; k < h; k++)
    {
        for(int l = 0; l < w; l++)
        {
            visited[k][l] = false;
            dist[k][j] = 0;
        }
    }

    return ans;
}

int main()
{
    cin >> h >> w;
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
            cin >> s[i][j];
    }
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            dist[i][j] = 0;
            visited[i][j] = false;
        }
    }

    int ans = -1e9;
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            if(s[i][j] == '.')
                ans = max(ans, bfs(i, j));
        }
    }

    cout << ans;

    return 0;
}


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

int main(){
    char s;
    vector<int> count(26);
    int num;
    char a='a';

    while (cin >> s)
    {
        if('A' <= s && s <= 'Z') 
        {
            num = s-'A';
            count.at(num)++;
        }
        else if ('a' <= s && s <= 'z')
        {
            num = s-'a';
            count.at(num)++;
        }
    }
    
    for (int i = 0; i < 26; i++)
    {
        cout << a << " : " << count.at(i) << endl;
        a++;
    }
    
}


Measured memory_bytes: 3108
from collections import defaultdict
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [(A[i], 1) for i in range(N)]

changes = [None] * M
for i in range(M):
    b, c = map(int, input().split())
    changes[i] = (c, b)

allVals = A + changes

allVals.sort(key = lambda x:x[0], reverse = True)
# print(allVals)

i = 0
j = -1
res = 0
while True:
    j += 1
    res += allVals[j][0] * allVals[j][1]
    i += allVals[j][1]

    if i >= N:
        res -= allVals[j][0] * (i - N)
        break



print(res)


Measured memory_bytes: 38920
def main(arrayB: list):
    arrayB.reverse()
    arrayA = [arrayB[0]]
    for i in range(len(arrayB)):
        arrayA.append(
            min(arrayB[i], arrayB[i + 1]) if i < len(arrayB) - 1 else arrayB[i]
        )
    print(sum(arrayA))


N = int(input())
line = list(map(int, input().split()))
main(line)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
using ll = long long;
const int INF = 1e9 + 5;

void print_vector2(vector<vector<ll> >v){
    for(ll i=0;i<v.size();i++){
        for(ll j=0;j< v[i].size();j++){
            cout<<v[i][j]<<" ";
        }cout<<"\n";
    }
}

void print_vector1(vector<ll> v){
    for(ll i=0; i<v.size();i++){
        cout<<v[i]<<" ";
    }cout<<"\n";
}

ll gcd(ll a, ll b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;
    if (a == b)
        return a;
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}

int main(){
    string s, t;
    cin>>s>>t;
    if(s.size()<t.size()){
            ll cnt = 0;
        for(ll i = 0; i<s.size(); i++){
            if(s[i] == t[i]){
                cnt++;
            }
            else{
                break;
            }
        }
        if(cnt == s.size()){
            cout<<"Yes";
        }
        else{
            cout<<"No";
        }
    }
    else{
        cout<<"No";
    }

    return 0;
}


Measured memory_bytes: 3624
def resolve():
    N = int(input())
    A = input().split()
    import collections
    deq = collections.deque()
    addleft = True if N%2==1 else False
    for a in A:
        if addleft:
            deq.appendleft(a)
        else:
            deq.append(a)
        addleft = (not addleft)
    print(" ".join(deq))

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 116696