akhauriyash/Code-Regression huggingface dataset:
/*
 * atcoder/abc089/b.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
void solve();
int main() { solve(); return 0; }

#define ld long double
void solve() {
  int n=3;
  vector<string> S(n);
  vector<int> N(n);
  loop(i,0,n) cin >> S[i];
  loop(i,0,n) N[i] = S[i].size()-1;
  vector<string> A { "NO", "YES" };
  cout << A[S[0][N[0]]==S[1][0] and S[1][N[1]] == S[2][0]] << endl;
}


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

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define endl "\n"

int n, val[4];
double dp[305][305][305];

double dfs(int a, int b, int c) {
	if (a == 0 && b == 0 && c == 0) return 0.0;
	else if (dp[a][b][c]) return dp[a][b][c];
	double ans = (double)n / (a + b + c);
	if (a) ans += (double)a / (a + b + c) * dfs(a - 1, b, c);
	if (b) ans += (double)b / (a + b + c) * dfs(a + 1, b - 1, c);
	if (c) ans += (double)c / (a + b + c) * dfs(a, b + 1, c - 1);
	return dp[a][b][c] = ans;
}

int main() {

	int temp;
	cin >> n;
	fo(i, n) {
		cin >> temp;
		val[temp]++;
	}

	cout << setprecision(14) << dfs(val[1], val[2], val[3]);

	return 0;
}

Measured memory_bytes: 112604
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
using ll = long long;

int n,m;
string s,t;

int main() {
  cin >> s;
  cout << (s[2]==s[3] && s[4]==s[5] ? "Yes" : "No") << endl;
}

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

int main()
{
    int N, M;

    cin >> N >> M;

    //firstは金額、secondは個数
    vector<pair<int, int>> pairs(N);

    for (int i = 0; i < N; i++)
    {
        int a, b;
        cin >> a >> b;
        pairs[i] = make_pair(a, b);
    }

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

    long long ans = 0;

    /*
    int store = 0;

    for (int i = 0; i < M; i++) //iは買ったドリンクの本数
    {
        pair<int, int> pair = pairs[store];

        int price = pair.first;
        int num = pair.second;

        ans = ans + (long long)price;

        num--;
        pairs[store] = make_pair(price, num);

        if (num == 0)
        {
            store++;
        }
    }
    */
    int i = 0;
    while ((M > 0) && (i < N))
    {
        pair<int, int> pair = pairs[i];

        int price = pair.first;
        int num = pair.second;

        /*if (M >= num)
        {
            ans = ans + (long long)price * (long long)num;
            M = M - num;
        }
        else
        {
            ans = ans + (long long)price * (long long)M;
            M = 0;
        }
        */

        ans = ans + (long long)price * (long long)min(num, M);
        M = M - min(num, M);

        i++;
    }

    cout << ans << endl;

    return 0;
}

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

string solve(vector<int> &moves, int k){

    bool dp[k+1];
    memset(dp,0,sizeof dp);

    for(int i=1;i<=k;i++){
        for(auto m : moves){
            if(m>i) continue;
            if(dp[i-m]==0)
                dp[i] = 1;
        }
    }

    return dp[k] ? "First" : "Second";
}

int main() {
    
    int n,k;
    cin>>n>>k;

    vector<int> moves(n);
    for(int i=0;i<n;i++)
        cin>>moves[i];

    cout<<solve(moves,k);

    return 0;
}


Measured memory_bytes: 3656
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<string>
#include<queue>
#include<stack>
#include<iostream>
#include<cmath>
using namespace std;
#define inf 0x3f3f3f3f
const int maxn = 20 + 8;

int n,m,sx,sy,x,y;
int g[maxn][maxn];
int ans;
int dx[] = {-1,0,1,0};
int dy[] = {0,1,0,-1};

bool is_in(int x,int y)
{
    return x >= 0 && x < n && y >= 0 && y < m;
}
void dfs(int r,int c,int num)
{
    if(num == 10 || num >= ans) return;
    for(int i = 0; i < 4; ++i){
        int x = r + dx[i];
        int y = c + dy[i];
        if(!is_in(x,y) || g[x][y] == 1) continue;
        while(is_in(x,y) && g[x][y] == 0)
        {
            x += dx[i];
            y += dy[i];
        }
        if(!is_in(x,y)) continue;
       // cout << " a2: " << x-dx[i] <<" "<< y-dy[i] <<"\n";
        if(g[x][y] == 3)
        {
            ans = min(ans, num);
            return;
        }
        g[x][y] = 0;
         dfs(x - dx[i], y - dy[i],num + 1);
         g[x][y] = 1;

    }
}

int main()
{
    //freopen("in.txt","r",stdin);
    while(scanf("%d%d", &m, &n) && n + m )
    {
        sx = 0,sy = 0;
        memset(g,0,sizeof g);
        for(int i = 0; i < n; ++i)
        {
            for(int j = 0; j < m; ++j)
            {
                scanf("%d",&g[i][j]);
                if(g[i][j] == 2)
                {
                    sx = i; sy = j;
                }
            }
        }
        g[sx][sy] = 0;
        ans = inf;
        dfs(sx,sy,0);
        printf("%d\n", ans == inf ? -1 : ans + 1);
    }
    return 0;
}

/*
  0 1 2 3 4 5
0 1 0 0 2 1 0
1 1 1 0 0 0 0
2 0 0 0 0 0 3
3 0 0 0 0 0 0
4 1 0 0 0 0 1
5 0 1 1 1 1 1

*/

Measured memory_bytes: 3164
#include<iostream>
#include<algorithm>
#define LL long long
LL N, M;
LL ans;
int main() {
	std::cin >> N >> M;
	if (N == 1 && M == 1) {
		ans = 1;
	}else if (N >= 2 && M >= 2) {
		ans = (N - 2)*(M - 2);
	}
	else {
		ans = N*M - 2;

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



Measured memory_bytes: 256
S = list(input())
ans = 0

S_set=list(set(S))

if len(S_set) != 2:
    print('No')
    exit()

for s in S_set:
    if S.count(s) == 2:
        ans += 1

if ans == 2:
    print('Yes')
else:
    print('No')

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

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

	vector<string> S(N);

	rep(i, N){
		cin >> S[i];
	}
	sort(S.begin(), S.end());
	S.erase(unique(S.begin(), S.end()), S.end());
	
	cout << S.size() << endl;
}


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

A_eve = []
ans = 'APPROVED'

for i in A:
  if i % 2 == 0:
    A_eve.append(i)
    
for j in A_eve:
  if j % 3 != 0 and j % 5 != 0:
    ans = 'DENIED'
    break
    
print(ans)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  ll x;
  cin >> x;
  ll now = 100, year = 0;

  while (now < x) {
    now += now / 100;
    year++;
  }

  cout << year << endl;
  return 0;
}

Measured memory_bytes: 3640
import sys
sys.setrecursionlimit(10**7)

l=input()
n = len(l)
mod = 10**9+7

p3 = [1]
for _ in range(len(l)+5):
    p3.append((p3[-1]*3)%mod)

def dfs(k,f):
    if k == n:
        return 1
    if not f:
        return p3[n-k]
    if l[k] == "1":
        return (dfs(k+1,False)+dfs(k+1,True)*2)%mod
    else:
        return dfs(k+1,True)%mod

print(dfs(0,True))

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

#define N 100009

using namespace std;

int a[N];

int main(){
	int i,j,t1,t2,t3,t4,n,k,pos,tempans,ans=1e9;
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		if(a[i]==1){
			pos=i;
		}
	}
	for(i=0;i<n;i++){
		t1=ceil((1.0*(i-0))/(k-1));
		t2=ceil((1.0*(n-1-i))/(k-1));
		ans=min(ans,t1+t2);
	}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   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;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

  int main(){      
        lint a,b,c,d;
        cin>>a>>b>>c>>d;
        lint x=(c+b-1)/b;
        lint y=(a+d-1)/d;
            if(x>y)cout<<"No";
            else cout<<"Yes";

          }
  
     


Measured memory_bytes: 3680
package main
import (
	"bufio"
	"fmt"
	"os"
)
var r = bufio.NewReader(os.Stdin)
func main() {
	var a int
	var b int
	fmt.Fscan(r, &a, &b)
	
	area := a*b
	length := 2 * a + 2 * b
	fmt.Println(area,length)
	
}


Measured memory_bytes: 1108
#include <iostream>
using namespace std;
  
void judge(string s)
{
    unsigned sum = 0;
    unsigned count = 0;
    for(int i = 0; i < s.size(); i++)
    {
        sum += s[i] - '0';
        if(sum >= 10)
        {
            sum -= 9;
            count++;
        }
    }
    if((count + s.size()) % 2)
        cout << "Audrey wins.\n";
    else
        cout << "Fabre wins.\n";
}
  
int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        judge(s);
    }
}

Measured memory_bytes: 3032
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int a,b;
vector<string> ans;

void solve(int n,int m,string s){
	if(a==n&&b==m){
		ans.push_back(s);
		return ;
	}
	if(n>=6||m>=6)return;
	if(n==5&&m==5)return;
	if((n==5&&m<4)||(m==5&&n<4))return;
	solve(n+1,m,s+"A");
	solve(n,m+1,s+"B");
}

int main(){
	cin >> a >> b;
	solve(0,0,"");
	sort(ans.begin(),ans.end());
	for(auto p:ans){
		cout << p << endl;
	}
	return 0;
}


Measured memory_bytes: 3212
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
int main() {
	int N;
	ll S = 0;
	map<string, ll> data;
	string str;
	scanf("%d", &N);
	rep(i, 0, N) {
		cin >> str;
		sort(all(str));
		data[str]++;
	}
	for (auto it : data) {
		S += it.second * (it.second - 1) / 2;
	}
	printf("%lld\n", S);
	return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    long long n,x,p[64],q=0;
    cin>>n>>x;
    x--;
    p[0]=1;
    for(int i=1;i<64;i++){
        p[i]=p[i-1]*2;
    }
    for(long long i=n;i>=0;i--){
        //cout<<q<<endl;
        if(x==p[i+2]-4){
            q+=p[i+1]-1;
            i=0;
        }else if(x>=p[i+1]-2){
            q+=p[i]-1+1;
            //if(x==p[i+1]-2)q++;
            x-=p[i+1]-3+2;
        }else{
            x--;
        }
    }
    cout<<q<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 1,0 },{ 0,1 }
};


template<int MOD>
struct ModInt {
	static const int Mod = MOD;
	unsigned x;
	ModInt() : x(0) {}
	ModInt(signed sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	ModInt(signed long long sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	int get() const { return (int) x; }

	ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
	ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }

	ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
	ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
	ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
	ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }

	ModInt inverse() const {
		signed a = x, b = MOD, u = 1, v = 0;
		while (b) {
			signed t = a / b;
			a -= t * b; std::swap(a, b);
			u -= t * v; std::swap(u, v);
		}
		if (u < 0) u += Mod;
		ModInt res; res.x = (unsigned) u;
		return res;
	}
};
typedef ModInt<1000000007> mint;

ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x%mod;
		x = x*x%mod;
		n >>= 1;
	}
	return res;
}

ll func(ll a, ll b) {
	if (!a || !b)
		return -b;
	return (b / a)*a * 2 + func(b%a, a);
}

signed main() {
	ll n, x;
	scnaf("%lld %lld", &n, &x);
	ll a = x, b = n - x;
	if (a > b) {
		swap(a, b);
	}
	printf("%lld", func(a, b) + a + b);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    int d;
    cin>>n>>s;
    for(int i=0;i<s.length();i++)
    {
        d=s[i]-'A';
        d=d+n;
        d=d%26;
        s[i]=(char)('A'+d);

    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#define ll long long
using namespace std;
ll _11[18];
int main()
{
	ll d;
	scanf("%lld",&d);
	if(d%9){puts("0");return 0;}
	d/=9;
	ll ans=0;
	for(int i=1;i<=17;i++) _11[i]=_11[i-1]*10+1;
	ll len=1;
	for(int i=1;i<=17;i++)
	{
		ll res=1,del=d,L=len,R=1,b=_11[i];
		for(int j=0;j<=(i>>1);j++)
		{
			res*=10-abs(del%(R*10)/R)-(!j);
            del-=b*(del%(R*10)/R);
            b-=L+R;
            L/=10;
            R*=10;
        }
        if(!del) ans+=res;
        len*=10;
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 256
k, s = map(int, input().split())

from itertools import product

k_list = list(range(k+1))
count = 0
for x, y in product(k_list, k_list):
  # print(x, y, s-x-y)
  if 0<=s-x-y<=k:
    count+=1
print(count)

Measured memory_bytes: 3060
<?php
$n = intval(fgets(STDIN));
$c = 0;
for($i = 0; $i < $n; $i++){
    $a[] = intval(fgets(STDIN));
    $b[] = $i;
}
array_multisort($a, $b);
for($i = 0; $i < $n; $i++){
    $c+=$b[$i] % 2 == 1 && $i % 2 == 0;
}
echo $c,"\n";

Measured memory_bytes: 22260
#include<iostream>

int main()
{
	int n, m;
	int A[101][101];
	int b[101];
	int ans = 0;

	std::cin >> n >> m;

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

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

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			ans += (A[i][j] * b[j]);
		}
		std::cout << ans << std::endl;
		ans = 0;
	}
}

Measured memory_bytes: 1200
package main

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

type Point struct {
	x      int
	y      int
	matchd bool
}

type Points []Point
type RedPoints Points
type BluePoints Points

func (p RedPoints) Len() int {
	return len(p)
}
func (p RedPoints) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p BluePoints) Len() int {
	return len(p)
}
func (p BluePoints) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p RedPoints) Less(i, j int) bool {
	return p[i].y > p[j].y
}

func (p BluePoints) Less(i, j int) bool {
	return p[i].x < p[j].x
}

func routine(r io.Reader, w io.Writer) {
	var N int
	fmt.Fscanf(r, "%d\n", &N)
	reds := make(RedPoints, N)
	blues := make(BluePoints, N)
	for i := 0; i < N; i++ {
		var x, y int
		fmt.Fscanf(r, "%d %d\n", &x, &y)
		reds[i].x = x
		reds[i].y = y

	}
	// sort.Slice(reds, func(i int, j int) bool {
	// 	return reds[i].y > reds[j].y
	// })
	sort.Sort(reds)

	for i := 0; i < N; i++ {
		var x, y int
		fmt.Fscanf(r, "%d %d\n", &x, &y)
		blues[i].x = x
		blues[i].y = y
	}

	// sort.Slice(blues, func(i int, j int) bool {
	// 	return blues[i].x < blues[j].x
	// })
	sort.Sort(blues)

	matchCount := 0
	for bi, blue := range blues {
		if blues[bi].matchd {
			continue
		}
		for ri, red := range reds {
			if reds[ri].matchd {
				continue
			}
			// fmt.Fprintf(w, "red=%d blue=%d test=%v\n", ri, bi, (red.x < blue.x && red.y < blue.y))
			if red.x < blue.x && red.y < blue.y {
				blues[bi].matchd = true
				reds[ri].matchd = true
				matchCount++
				break
			}
		}
	}

	// fmt.Fprintf(w, "reds = %v\n", reds)
	// fmt.Fprintf(w, "blues = %v\n", blues)
	fmt.Fprint(w, matchCount)
}

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


Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long N, long long M){
  vector<ll> v;
  for(ll i=1; i*i<=M; i++) {
    if(M%i) continue;
    v.push_back(i);
    v.push_back(M/i);
  }
  sort(v.rbegin(), v.rend());
  for(auto x : v) {
    if(x*N<=M) {
      std::cout << x << std::endl;
      return;
    }
  }
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);
  solve(N, M);
  return 0;
}



Measured memory_bytes: 256
N,M = list(map(int,input().split()))
L = [list(map(int,input().split())) for _ in range(M)]
LL = {}
for i in range(1,N+1):
    LL[i] = 0
for l in L:
    LL[l[0]] += 1
    LL[l[1]] += 1
for i in range(1,N+1):
    print(LL[i])

Measured memory_bytes: 3060
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, s, e) for(int i=s; i<e; i++)
#define REF(i, s, e) for(int i=s; i>e; i--)
typedef long long ll;

int n;

//aとbの最大公約数を返す
int gcd(ll a, ll b) {
	//aの方が大きくなるよう入れ替え
	if (a < b) swap(a, b);
	
	//b == 0ならaを返す
	if (b == 0) return a;

	//終了条件
	if (a % b == 0) return b;

	return gcd(b, a%b);
}

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

	cin >> n;

	vector<ll> a(n);
	FOR(i, 0, n) cin >> a[i];

	//cout << gcd(a[2], a[1]) << endl;

	//累積和計算
	//左累積和L
	vector<ll> L(n+1,0);
	FOR(i, 0, n) {
		L[i + 1] = gcd(L[i], a[i]);
	}

	//cout << "L:" << endl;
	//FOR(i, 0, n+1) cout << L[i] << endl;
	//cout << endl;

	//右累積和R
	vector<ll> R(n + 1, 0);
	REF(i, n-1, -1) {
		R[i] = gcd(R[i + 1], a[i]);
	}

	//cout << "R:" << endl;
	//FOR(i, 0, n + 1) cout << R[i] << endl;
	//cout << endl;

	//aからa[i]を抜いたgcdを計算、最大値を更新
	//ans = gcd(L[i], R[i+1])
	ll max1 = 0;
	FOR(i, 0, n) {
		ll ans = gcd(L[i], R[i + 1]);
		//cout << "ans:" << ans << endl;
		max1 = max(max1, ans);
	}
	cout << max1 << endl;
}

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

int main(){
    int N, M;
    int Menu[30] = {0};

    cin >> N >> M;

    for(int i = 0; i < N; i++){
        int num;
        cin >> num;
        for(int j = 0; j < num; j++){
            int ip;
            cin >> ip;
            Menu[ip - 1]++;
        }
    }

    int ans = 0;
    for(int k = 0; k < M; k++){
        if(Menu[k] == N)
            ans++;
    }
    cout << ans << endl;


    return 0;
}

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

int		main(void)
{
	string	a;	cin >> a;
	for (auto &i : a)
	{
		if (i == '9')
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

map<int,int> m1;
map<int,int> m2;
int main() {
  int n;
  cin >> n;
  rep(i,n){
    int v;
    cin >> v;
    if(i%2==0) m1[v]+=1;
    else m2[v]+=1;
  }
  int even_max = 0,odd_max=0;
  int con;
  for(auto key : m1){
    if(even_max < key.se){
      even_max = key.se;
      con = key.fi;
    }
  }
  for(auto key : m2){
    if(key.fi != con) maxs(odd_max,key.se);
  }
  int ans = n-even_max-odd_max;

  even_max = 0,odd_max=0;
  for(auto key : m2){
    if(odd_max < key.se){
      odd_max = key.se;
      con = key.fi;
    }
  }

  for(auto key : m1){
    if(key.fi != con) maxs(even_max,key.se);
  }
  mins(ans,n-even_max-odd_max);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{
    ll n,i;
    cin>>n;
    unordered_map<ll,ll>mp;
    ll x;
    for(i=0;i<n;i++)
    {
        cin>>x;
        if(mp.find(x)==mp.end())
        {
            mp[x]++;
        }
        else
        {
            mp.erase(x);
        }
    }
    cout<<mp.size()<<endl;
}


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

using namespace std;

typedef long long LL;

struct cww{cww(){
    ios::sync_with_stdio(false);cin.tie(0);
    cout<<fixed;
    cout<<setprecision(10);
}}star;
#define fin "\n"


#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

template <typename T>
inline void chmin(T &l,T r){l=min(l,r);}

template <typename T>
inline void chmax(T &l,T r){l=max(l,r);}

struct edge{
    int to;double cost;
    bool operator<(const edge& o)const {return cost < o.cost;}
    bool operator>(const edge& o)const {return cost > o.cost;}
};
typedef vector<int> V;
typedef vector<edge> E;
typedef vector<E> Graph;
const double INF = 1e18;


E dijkstra(int s, Graph &g){
    int n = g.size();
    E dist(n,edge{-1,INF});
    priority_queue<edge, E, greater<edge>> que;
    que.push(edge{s,0});
    while (que.empty() == false){
        auto e = que.top(); que.pop();
        int v=e.to; 
        if (dist[v].cost < e.cost)continue;
	for (auto& d : g[e.to]){
            int u=d.to;
            double nc=e.cost+d.cost;
	    if (dist[u].cost <= nc)continue;
	    dist[u] = edge{v,nc};
	    que.push(edge{u,nc});
	}
    }
    return dist;
}

double calc(double x,double y,double r){
    return max(sqrt(x*x+y*y)-r,0.0);
}
int main(){
    double sx,sy,gx,gy;
    cin>>sx>>sy>>gx>>gy;
    int N;
    cin>>N;
    vector<double> x(N),y(N),r(N);
    REP(i,N)cin>>x[i]>>y[i]>>r[i];

    int S=N++;
    int G=N++;
    x.push_back(sx);y.push_back(sy);r.push_back(0);
    x.push_back(gx);y.push_back(gy);r.push_back(0);
    Graph g(N);
    REP(i,N)REP(j,N)if(i!=j)g[i].push_back(edge{j,calc(x[i]-x[j],y[i]-y[j],r[i]+r[j])});
    auto d=dijkstra(S,g);
    cout<<d[G].cost<<endl;
    return 0;
}


Measured memory_bytes: 20612
package main

import (
	"fmt"
	"sort"
)

func solve(n []int) {
	if len(n) == 1 {
		fmt.Println(n[0])
		return
	}
	sort.Ints(n)
	var temp []int
	temp = append(temp, n[0])
	for i := 1; i < len(n); i++ {
		if n[i]%n[0] != 0 {
			temp = append(temp, n[i]%n[0])
		}
	}
	n = []int{}
	for _, v := range temp {
		n = append(n, v)
	}
	solve(n)
}
func main() {
	var n int
	fmt.Scan(&n)
	var a = make([]int, n)
	for i, _ := range a {
		fmt.Scan(&a[i])
	}
	solve(a)
}

Measured memory_bytes: 7424
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#define mod 1000000007
typedef long long ll;
using namespace std;

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

  vector<int> div; // 割る数. nの平方根以下で素数である数.
    for(int i=2;i*i<=100003;++i){ // 素数でないものを排除する.
        bool flag = true;
        for(int j=2;j<=i;++j){
            if(j<i && i%j==0) flag = false;
        }
        if(flag) div.push_back(i);
    }

    vector<int> ans;
    for(int i=2;i<=100003;i++){
        bool Flag = true; 
        for(auto it=div.begin();it!=div.end();++it){
            if(*it<i && i%*it==0) Flag = false;
        }
        if(Flag) ans.push_back(i);
    }

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

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

int main(){
    int w, h, n;
    cin >> w >> h >> n;

    int x1 = 0, x2 = w;
    int y1 = 0, y2 = h;
    for(int i=0; i<n; i++){
        int x, y, a;
        cin >> x >> y >> a;
        if(a == 1) x1 = max(x1, x);
        if(a == 2) x2 = min(x2, x);
        if(a == 3) y1 = max(y1, y);
        if(a == 4) y2 = min(y2, y);
    }

    cout << max(x2 - x1, 0) * max(y2 - y1, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#define ll long long
using namespace std;
int main(){
     int a,b;
     cin >> a >> b;
     int temp=0;
     if(b < a){
          temp=a;
          a=b;
          b=temp;
     }
     if(b-a >= 1){
          cout << 2*b -1 << endl;
     }else if(a == b){
          cout << 2*a << endl;
     }
     return 0;
}

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

int main() {
    int A,B;
    cin>>A>>B;
    int answer=0;
    int finish=0;
    while(answer<1251&&finish<1)
    {answer++;
        if(answer*8/100==A&&answer/10==B)
        {finish++;
            cout<<answer<<endl;
        }
    }
    if (answer==1251)
    {cout<<-1<<endl;}}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	vector<vector<int>> vec(n);
	rep(i, n) {
		int t, d;
		cin >> t >> d;
		t--;
		vec[t].emplace_back(d);
	}
	vector<P> p;
	rep(i, n) {
		if (vec[i].size()) {
			sort(all(vec[i]));
			rep(j, vec[i].size()) {
				p.emplace_back(vec[i][j], j == vec[i].size() - 1);
			}
		}
	}
	sort(rall(p));
	priority_queue<int, vector<int>, greater<int>> pq;
	int ki = 0, ch = 0;
	ll tot = 0;
	ll ans = 0;
	rep(i, n) {
		int d = p[i].first, w = p[i].second;
		tot += d;
		ch++;
		ki += w;
		if (!w) pq.push(d);
		if (ch > k) {
			ch--;
			if (!pq.size()) break;
			tot -= pq.top();
			pq.pop();
		}
		if (ch == k) ans = max(ans, tot + (ll)ki * ki);
	}
	cout << ans << endl;
	return 0;
}


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

int a[111111];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		scanf("%d", a + i);
	sort(a, a + n);
	stringstream s;
	for (int i = 1; i < n - 1; i++) {
		if (a[i] < 0) s << a[n - 1] << ' ' << a[i] << '\n', a[n - 1] -= a[i];
		else s << a[0] << ' ' << a[i] << '\n', a[0] -= a[i];
	}
	s << a[n - 1] << ' ' << a[0];
	cout << a[n - 1] - a[0] << '\n' << s.str() << endl;
	return 0;
}


Measured memory_bytes: 6148
#include <stdio.h>

int main(void)
{
	int n, i;
	int e, p1, p2, cnt;
	long long num[4000] = {0};
	int flag[4000] = {0};
	long long tmp;

	while (1) {
		scanf("%d", &n);
		if (n == 0) {
			break;
		}
		cnt = 1;
		for (i = 0; i < 4000; ++i) {
			num[i] = 0;
			flag[i] = 0;
		}
		
		for (i = 0; i < n; ++i) {
			scanf("%d %d %d", &e, &p1, &p2);
			num[e] += p1 * p2;
			
			
			if (num[e] >= 1000000) {
				cnt = 0;
				if (flag[e] == 0) {
					printf("%d\n", e);
					flag[e] = 1;
				}
			}
		}
		if (cnt) printf("NA\n");
	}
	
	return 0;
}

Measured memory_bytes: 664
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n,m;
vector<int> preci[100010];
vector<int> potomci[100010];
int br[100010];
int dp[100010];

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

	cin>>n>>m;
	int x,y;
	for(int i=0;i<m;i++)
    {
        cin>>x>>y;
        preci[y].push_back(x);
        potomci[x].push_back(y);
        br[y]++;
    }

    queue<int> red;
    vector<int> topolosko;
    for(int i=1;i<=n;i++)
        if(br[i]==0)
            red.push(i);

    while(!red.empty())
    {
        int tek=red.front();
        red.pop();
        topolosko.push_back(tek);
        for(int i=0;i<potomci[tek].size();i++)
        {
            br[potomci[tek][i]]--;
            if(br[potomci[tek][i]]==0)
                red.push(potomci[tek][i]);
        }
    }

    for(int i=0;i<n;i++)
    {
        int tek=topolosko[i];
        for(int i=0;i<preci[tek].size();i++)
            dp[tek]=max(dp[tek], dp[preci[tek][i]]+1);
    }

    int sol=0;
    for(int i=1;i<=n;i++)
        if(dp[i]>sol)
            sol=dp[i];

    cout<<sol;

	return 0;
}


Measured memory_bytes: 12540
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t) {
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define PB push_back


#define MOD 1000000009LL
#define EPS 1e-8


int main() {

	int n;
	cin >> n;
	vector<string> s(n);
	for (int i = 0; i<n; i++) {
		cin >> s[i];
		// cout<<i<<" "<<s[i]<<endl;
	}

	//for (int i = 0; i<n; i++) {
	//	cout << s[i] << endl;
	//}
	std::sort(s.begin(), s.end(), [](string i, string j) {return i.size()<j.size(); });

	//cout << endl;
	/*for (int i = 0; i<n; i++) {
		cout << s[i] << endl;
	}*/
	string common;

	//bool used[50][50] = { false };

	for (int i = 0; i<s[0].size(); i++) {
		char a = s[0].at(i);
		for (int j = 1; j<s.size(); j++) {
			int pos;
			if ((pos = s[j].find(a)) != string::npos) {
				/*if (used[j][pos]) { goto GONEXT; }
				used[j][pos]=true;*/
				s[j][pos] = '0';
			}
			else {

				for (int k = 1; k < s.size(); k++) { if ((pos = s[k].find(a)) != string::npos) { s[k][pos] = a;} }

				goto GONEXT;
			}
		}

		common += a;
	GONEXT:;
	}

	sort(common.begin(), common.end());
	cout << common << endl;

}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    ll k, x; cin>>k>>x;
    for(int i=-k+1; i<=k-1; i++){
        cout<<x+i;
        if(i<k-1) cout<<" ";
    }
    cout<<endl;
    return 0;
}

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

int main() {
  int a,b,c; cin >> a >> b >> c;
  for(int i=1; i<=b; i++) {
    if (i*a%b == c) { cout << "YES" << endl; return 0; }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
vector<int> vec;
vec = {1,0,1,0,1,0,1,1,0,1,0,1};
int x,y;
cin >> x >> y;
if (x == 2 || y == 2) {
    cout << "No" << endl;
    return 0;
}
x--;
y--;
if (vec.at(x) == vec.at(y)) cout << "Yes" << endl;
else cout << "No" << endl;


return 0;
}

Measured memory_bytes: 256
while True:
    n,x = map(int,input().split())
    if n==0 and x==0:
        break
    
    cnt = 0
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            l = x-(i+j)
            if l >= 1 and l <= n and l > j:
                cnt += 1
    print(cnt)


Measured memory_bytes: 5596
#include<stdio.h>
int main(void)
{
   int v,h,t,s;
   scanf("%d",&v);
   h = v / 3600;
   v = v % 3600;
   t = v / 60;
   v = v % 60;
   s = v ;
   printf("%d:%d:%d\n", h, t, s);
   return 0;
}

Measured memory_bytes: 1860
#include<bits/stdc++.h>
using namespace std;
int main(){  
    char a[10000],b[10000];
    int i,sb,zz;
    scanf("%s",&a);
    scanf("%s",&b);
    sb=0;
    zz=0;
    for(i=0;i<strlen(a)+strlen(b);i+=2){
        if(sb<strlen(a))
            cout << a[sb];
        if(zz<strlen(b))
            cout << b[zz];
        sb++;
        zz++;
    }
    return 0;  
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(void){
	int H,W,i,j;
	for(;;){
		scanf("%d %d",&H,&W);
		if(H==0&&W==0){
			break;
		}
		for(i=1;i<=H;i++){
			for(j=1;j<=W;j++){
				if(i==1||i==H||j==1||j==W){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1716
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (let* ((s (read-line))
         (y (parse-integer s :end 4))
         (m (parse-integer s :start 5 :end 7))
         (d (parse-integer s :start 8 :end 10)))
    (if (or (< y 2019)
            (and (= y 2019)
                 (< m 4))
            (and (= y 2019)
                 (= m 4)
                 (<= d 30)))
        (write-line "Heisei")
        (write-line "TBD"))))

#-swank(main)



Measured memory_bytes: 15200
#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
ll gcd(ll x,ll y){
  if(y==0)return x;
  else return gcd(y,x%y);
}
vector<pair<ll,int>> fact(ll n){
  vector<pair<ll,int>>res;
  for(ll i=2;i*i<=n;i++){
    if(n%i==0){
      res.push_back({i,1});
      while(n%i==0){
        n/=i;res.back().second++;
      }
    }
  }
  if(n!=1)res.push_back({n,1});
  return res;
}
int main(){
  ll a,b;cin>>a>>b;
  ll n = gcd(a,b);

  auto res = fact(n);
  ll ans = res.size()+1;
  cout<<ans<<endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int A, B;
    char op;
    cin >> A >> op >> B;
    if (op == '+') {
        cout << A + B << endl;
    } else {
        cout << A - B << endl;
    }
    return 0;
}


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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var hn = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var h = hn[0];
        var n = hn[1];
        var magics = new Magic[n];
        for (int i = 0; i < magics.Length; ++i)
        {
            var ab = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            magics[i] = new Magic(ab[0], ab[1]);
        }

        var dp = new Transitive<int>[h + 1];
        for (int i = 1; i < dp.Length; ++i)
        {
            dp[i] = int.MaxValue;
        }
        for (int i = 0; i < magics.Length; ++i)
        {
            var t = Math.Min(dp.Length, magics[i].Power);
            for (int j = 1; j < t; ++j)
            {
                dp[j] -= magics[i].Cost;
            }
            for (int j = magics[i].Power; j < dp.Length; ++j)
            {
                dp[j] -= dp[j - magics[i].Power].Value + magics[i].Cost;
            }
        }

        Console.WriteLine(dp[h]);
    }

    struct Transitive<T>
    where T : IComparable<T>
    {
        public readonly T Value;
        public Transitive(T value)
        {
            Value = value;
        }

        public override string ToString() => Value.ToString();
        
        public static implicit operator Transitive<T>(T value) => new Transitive<T>(value);
        public static Transitive<T> operator -(Transitive<T> x, Transitive<T> y) => x.Value.CompareTo(y.Value) < 0 ? x : y;
        public static Transitive<T> operator +(Transitive<T> x, Transitive<T> y) => x.Value.CompareTo(y.Value) > 0 ? x : y;
    }

    struct Magic
    {
        public readonly int Power;
        public readonly int Cost;

        public Magic(int p, int c)
        {
            Power = p;
            Cost = c;
        }
    }
}


Measured memory_bytes: 13396
N,x=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
for i in range(N-1):
  a=A[i]+A[i+1]
  if a>x:
    if (a-x)>A[i+1]:
      A[i+1]=0
    else:
      A[i+1]-=(a-x)
    cnt+=(a-x)
print(cnt)

Measured memory_bytes: 14132
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a + b == 15) {
            System.out.println("+");
        } else if (a * b == 15) {
            System.out.println("*");
        } else {
            System.out.println("x");
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int ans=0;
  for(int i=0;i<=a ;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
        if(500*i+100*j+50*k == x){
          ans++;
        }
      }    
    }
  }

  cout<<ans<<endl;
}









  


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    int n, x;
    cin >> n >> x;
    
    int d = 0, ans = 1, l;
    REP(i, n){
        cin >> l;
        d = d + l;
        if(d > x) break;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
ans = [0]*m
for _ in range(n):
    T = list(map(int,input().split()))
    for i in range(1,len(T)):
        ans[T[i]-1] += 1


ans_s = 0
for a in ans:
    if a == n:
        ans_s += 1

print(ans_s)

Measured memory_bytes: 3064
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>
using namespace std;

#define ll long long

void solve()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> H(N);
    vector<ll> A(M);
    vector<ll> B(M);
    map<ll, ll> mp;
    ll count = 0;

    for (ll i = 0; i < N; i++)
    {
        cin >> H.at(i);
    }

    for (ll i = 0; i < M; i++)
    {
        cin >> A.at(i) >> B.at(i);
        A.at(i)--;
        B.at(i)--;

        // 計算
        if (H.at(A.at(i)) < H.at(B.at(i)))
        {
            if (mp[A.at(i)] == (ll)NULL)
            {
                mp[A.at(i)] = 1;
                count++;
            }
        }
        else if (H.at(A.at(i)) > H.at(B.at(i)))
        {
            if (mp[B.at(i)] == (ll)NULL)
            {
                mp[B.at(i)] = 1;
                count++;
            }
        }
        else // 等しい場合は両方とも良い展望台ではない
        {
            if (mp[A.at(i)] == (ll)NULL)
            {
                mp[A.at(i)] = 1;
                count++;
            }

            if (mp[B.at(i)] == (ll)NULL)
            {
                mp[B.at(i)] = 1;
                count++;
            }
        }
    }

    cout << N - count << endl;

    return;
}

int main()
{
    solve();
    return 0;
}


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

#define endl "\n"
#define fo for(int i=0;i<n;i++)
#define loopSolve int t; cin>>t; while(t--){solve();}
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

int mod = 1e9+7;

int getBits(ll num){
	return (int)log2(num) + 1;
}

ll power(int a, int b){
    return (ll)(pow(a,b)+0.5)%mod;
}

vector<int> gV(int n){
    vector<int> v(n);
    fo { cin>>v[i];  }
    return v;
}

int* gA(int n){
    int* arr = new int[n];
    fo cin>>arr[i];
    return arr;
}

void solve(){

    string s;
    cin>>s;

    int l = s.size();

    if(s[l-1]=='s')
        cout<<s+"es"<<endl;
    else
        cout<<s+"s"<<endl;


}


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

    solve();
    //loopSolve;

	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int N;
    cin >> N;
    set<string> dict;
    string cur, prev;
    cin >> cur;
    dict.insert(cur);
    bool ok = true;
    for (int i = 1; i < N; i++) {
        prev = cur;
        cin >> cur;
        auto result = dict.insert(cur);
        if (!result.second) {
            ok = false;
            break;
        }
        if (prev[prev.size() - 1] != cur[0]) {
            ok = false;
            break;
        }
    }
    if (ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    let a = buf.trim().parse::<i32>().ok().unwrap();
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    if a >= 3200 {
        println!("{}", s);
    } else {
        println!("red");
    }
}

Measured memory_bytes: 4352
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;
 





import static java.util.Comparator.*;
 
public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
//        solver.test();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    //================================================================================
    public void solve() {
    	long A = Long.parseLong(sc.next());
    	long B = Long.parseLong(sc.next());
    	long K = Long.parseLong(sc.next());
    	if(K <= A)	out.println((A-K) + " " + B);
    	else 		out.println("0 " + (K - A <= B ? (B-(K-A)) : 0));
    }
}

Measured memory_bytes: 23892