akhauriyash/Code-Regression huggingface dataset:
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
hc = [[0] * w for i in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            if j > 0:
                hc[i][j] = hc[i][j - 1] + 1
            else:
                hc[i][j] = 1
for i in range(h):
    for j in range(w - 1, -1, -1):
        if s[i][j] == ".":
            if j < w - 1:
                if hc[i][j] < hc[i][j + 1]:
                    hc[i][j] = hc[i][j + 1]
wc = [[0] * h for i in range(w)]
for i in range(w):
    for j in range(h):
        if s[j][i] == ".":
            if j > 0:
                wc[i][j] = wc[i][j - 1] + 1
            else:
                wc[i][j] = 1
for i in range(w):
    for j in range(h - 1, -1, -1):
        if s[j][i] == ".":
            if j < h - 1:
                if wc[i][j] < wc[i][j + 1]:
                    wc[i][j] = wc[i][j + 1]
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, hc[i][j] + wc[j][i] - 1)
print(ans)

Measured memory_bytes: 244488
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define MAX 100000
int main() {
    int n,k;
    cin >> n >> k;
    vector<int> dp(MAX,0);
    vector<int> arr(n);
    for(int i=0;i<n;i++){
        cin >> arr[i];
        dp[arr[i]] = 1;
    }
    for(int i=0;i<=k;i++){
        if(!dp[i]){
            for(int j=0;j<n;j++){
                if(i-arr[j]>=0) dp[i] = dp[i] || !dp[i-arr[j]];
            }
        }
    }
    if(dp[k]) cout << "First" << endl;
    else cout << "Second" << endl;
	return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[101010],B[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	int ma=0;
	FOR(i,N) {
		cin>>A[i]>>B[i];
		ma=max(ma,A[i]);
	}
	
	FOR(i,N) if(ma==A[i]) cout<<A[i]+B[i]<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        int ma=0,mi=10000,sum=0,n,si,i;
        Scanner s = new Scanner(System.in);
        while(true){
           n = s.nextInt();
           if(n==0)break;
           for(i=0;i<n;i++){
            si = s.nextInt();
            sum += si;
            if(ma<si)ma = si;
            if(mi>si)mi = si;
           }
           System.out.println((sum-ma-mi)/(n-2));
           sum=0;
           ma=0;
           mi=10000;
        }
    }
}


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

int best[1 << 26];

int main() {
	string s;
	cin >> s;
	int n = s.size(), a[n + 1]{};
	for (int i = 0; i < n; i++) {
		a[i + 1] = a[i] ^ (1 << (s[i] - 'a'));
	}
	int f[n + 1]{}, inf = 1e9;
	fill(best, best + (1 << 26), inf);
	best[a[0]] = 0;
	for (int i = 1; i <= n; i++) {
		f[i] = inf;
		for (int bit = -1; bit < 26; bit++) {
			int new_a = a[i];
			if (0 <= bit) {
				new_a ^= (1 << bit);
			}
			f[i] = min(f[i], best[new_a] + 1);
		}
		best[a[i]] = min(best[a[i]], f[i]);
	}
	cout << f[n] << endl;
	return 0;
}

Measured memory_bytes: 264324
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cctype>
#define INF 1000000000
using namespace std;
bool debug=false;

int main(){
    long long N,M;
    map<double,int>mp;
    cin>>N>>M;

    for(int i=0;i<M;i++){
        int a,b;
        cin>>a>>b;
        if(a>b)swap(a,b);
        mp[a+0.5]++;mp[b+0.5]--;
    }
    bool ok=true;
    for(int i=0;i<=N;i++){
        mp[i+0.5]+=mp[i-0.5];
        //cout<<mp[i+0.5]<<endl;
        if(mp[i+0.5]%2==1){
            ok=false;
            break;
        }
    }
    if(ok)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 6528
<?php

$tmp = [];
while ($line = fgets(STDIN)) {
    $tmp[] = trim($line);
}

$N = $tmp[0];

$A_list[] = explode(' ', $tmp[1]);
$A_list[] = explode(' ', $tmp[2]);

// x座標,y座標,合計
$dp[0][] = [0, 0, $A_list[0][0]];
for ($i = 0; $i < $N; $i++) {

    $count = count($dp[$i]);
    for ($p = 0; $p < $count; $p++) {

        $coord = $dp[$i][$p];

        // 右
        $center = $coord;
        $center[1]++;
        if (!empty($A_list[$center[0]][$center[1]])) {
            $dp[$i + 1][] = [$center[0], $center[1], $center[2] + $A_list[$center[0]][$center[1]]];
        }

        // 下
        $center = $coord;
        $center[0]++;
        if (!empty($A_list[$center[0]][$center[1]])) {
            $dp[$i + 1][] = [$center[0], $center[1], $center[2] + $A_list[$center[0]][$center[1]]];
        }
    }
}

$count = count($dp[$N]);
$result = $dp[$N][0][2];
for ($i = 1; $i < $count; $i++) {
    if ($result < $dp[$N][$i][2])
        $result = $dp[$N][$i][2];
}

print_r($result);

Measured memory_bytes: 6776
#include<iostream>
using namespace std;
int main()
{
	string s;
	cin >> s;
	if(s[0] != s[1] && s[0] != s[2] && s[1] != s[2])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back
#define pp pair<int,int>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define int long long
#define mod 1000000007
int n,a[22][22],memo[1<<22];
int rec(int mask)
{
	if(mask==(1<<n)-1)
	{
		return 1;
	}
	if(memo[mask]!=-1) return memo[mask];
	int setbits = 0;
	int tmp = mask;
	while(tmp) tmp-=(tmp&(-tmp)),setbits++;

	int ans = 0;
	for(int j=0;j<n;j++)
	{
		if((~mask) & (1<<j))
		{
			if(a[setbits][j])
			{
			int mask2 = mask | (1<<j);
			ans += rec(mask2);
			ans%=mod;
			}
		}
	}
	return memo[mask] = ans;

}
 main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt.txt","r",stdin);
	// freopen("output.txt.txt","w",stdout);
	// #endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>n;

	for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>a[i][j];
	memset(memo,-1,sizeof(memo));
	cout<<rec(0)<<endl;

}

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

const ll MX = 1e18;
const long double PI = acos(-1);

int main()
{
    ll a, b, c, d; cin >> a >> b >> c >> d;

    ll ans1 = a * c;
    ll ans2 = a * d;
    ll ans3 = b * c;
    ll ans4 = b * d;

    ans1 = max(ans1, ans2);
    ans3 = max(ans3, ans4);
   
    pri(max(ans1, ans3));
    return 0;
}


Measured memory_bytes: 3616
w, h, n = map(int, input().split())

fie = [[1]*h for i in range(w)]

for i in range(n):
        x, y, a = map(int, input().split())
        if a==1:
                for j in range(x):
                        for k in range(h): fie[j][k] = 0
        if a==2:
                for j in range(x, w):
                        for k in range(h): fie[j][k] = 0
        if a==3:
                for j in range(w):
                        for k in range(y): fie[j][k] = 0
        if a==4:
                for j in range(w):
                        for k in range(y, h): fie[j][k] = 0
sm = 0
for i in range(w): sm += sum(fie[i])
print(sm)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
	string s;
	cin >> s;
	
	if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') cout << 3 << '\n';
	else if (s[0] == 'R' && s[1] == 'R') cout << 2 << '\n';
	else if (s[1] == 'R' && s[2] == 'R') cout << 2 << '\n';
	else if (s[0] == 'S' && s[1] == 'S' && s[2] == 'S') cout << 0 << '\n';
	else cout << 1 << '\n'; 
	
 	return 0;
}

Measured memory_bytes: 3620
n,k=map(int,input().split())
l=list(map(int,input().split()))
kiseki=[-1]*n
i=0
v=1
while kiseki[v-1]==-1:
  kiseki[v-1]=i
  v=l[v-1]
  i+=1
saisyo=kiseki[v-1]
kuri=i-saisyo

if saisyo>k:
  print(kiseki.index(k)+1)
else:
  amari=(k-saisyo)%kuri
  print(kiseki.index(amari+saisyo)+1)

Measured memory_bytes: 32384
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

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


	int N;
	cin >> N;
	map<pair<ll, ll>, int> MP;
	int a0 = 0, b0 = 0;
	int ab00 = 0;

	rep(i, N) {
		ll a, b;
		cin >> a >> b;

		if (a == 0 && b == 0) {
			ab00++;
			continue;
		}
		if (a == 0) {
			a0++;
			continue;
		}
		if (b == 0) {
			b0++;
			continue;
		}

		ll G = __gcd(a, b);
		a /= G;
		b /= G;
		if (a < 0) {
			a = -a;
			b = -b;
		}
		MP[mp(a, b)]++;
	}

	ll kotae = 1;

	map<pair<ll, ll>, int> MP2 = MP;

	for (auto p : MP) {
		int k1 = p.second;
		int k2;
		if (p.first.second > 0) {
			k2 = MP2[mp(p.first.second, -p.first.first)];
		}
		else {
			k2 = MP2[mp(-p.first.second, p.first.first)];
		}
		if (k2 == 0) {
			kotae = kotae * modpow(2, k1) % mod;
			continue;
		}
		if (p.first.second < 0) continue;
		ll tmp = (modpow(2, k1) + modpow(2, k2) - 1) % mod;
		kotae = kotae * tmp % mod;
	}

	if (a0 && b0) {
		ll tmp = (modpow(2, a0) + modpow(2, b0) - 1) % mod;
		kotae = kotae * tmp % mod;
	}
	else if (a0) {
		kotae = kotae * modpow(2, a0) % mod;
	}
	else if (b0) {
		kotae = kotae * modpow(2, b0) % mod;
	}

	co((kotae - 1 + ab00 + 2 * mod) % mod);

	Would you please return 0;
}

Measured memory_bytes: 40976
sx, sy, tx, ty = gets.chomp.split(" ").map(&:to_i)
nv = ty - sy
nh = tx - sx
p1 = "U" * (nv - 1) + "R" * (nh - 1) + "U" + "R"
p2 = "D" * (nv - 1) + "L" * (nh - 1) + "D" + "L"
p3 = "L" + "U" * (nv + 1) + "R" * (nh + 1) + "D"
p4 = "R" + "D" * (nv + 1) + "L" * (nh + 1) + "U"
puts p1 + p2 + p3 + p4


Measured memory_bytes: 2044
H, W = map(int, input().split())
s = "#"*(W+2)
for _ in range(H):
    s+="#"+input().strip()+"#"
s += "#"*(W+2)

#for i, c in enumerate(s):
#    print(i, c)
ff = (W+2)*(H+2)
from scipy.sparse.csgraph import csgraph_from_dense,floyd_warshall
dp = [[-1]*ff for _ in range(ff)]
for i in range(1, H+1):
    for j in range(1, W+1):
        u = j+(W+2)*i
        v = j+(W+2)*(i-1)
        if s[u] == "." and s[u-1] == ".":
#            print(u,u-1)
            dp[u][u-1] = 1
        if s[u] == "." and s[v] == ".":
#            print(u,v)
            dp[u][v] = 1
#print(dp)
G = csgraph_from_dense(dp,  null_value=-1)
Q = floyd_warshall(G, directed=False)
r = -1
for q in Q:
    for x in q:
        if x < 10**9:
            r = max(r, int(x))
print(r)

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

int main(){
    string s;
    cin >>s;
  //cout <<s.size() <<endl;
 
    if(s[s.size()-1]=='2' or s[s.size()-1]=='4' or s[s.size()-1]=='5' 
       or s[s.size()-1]=='7' or s[s.size()-1]=='9')cout <<"hon" <<endl;
else if(s[s.size()-1]=='0' or s[s.size()-1]=='1' or s[s.size()-1]=='6' or s[s.size()-1]=='8' )cout <<"pon" <<endl;
else cout <<"bon" <<endl;
//*/
return 0;
}


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

#define ll long long
#define mod 1000000007

const int N = 3001;
long double p[N + 5];
long double dp[N + 5][N + 5];
int main() {

    ll n;
    cin >> n;

    for (ll i = 1; i <= n; ++i)
        cin >> p[i];
    dp[0][0] = 1.0;

    for (ll i = 1; i <= n; ++i)
    {
        long double tails = 1 - p[i], heads = p[i];
        dp[i][0] = dp[i - 1][0] * tails;
        for (int j = 1; j <= i; ++j)
        {
            dp[i][j] = dp[i - 1][j] * tails + dp[i - 1][j - 1] * heads;
            // cout << dp[i][j] << ' ';
        }
        // cout << endl;
    }
    double ans = 0;
    for (ll i = n / 2 + 1; i <= n; ++i)
        ans += dp[n][i];

    cout << fixed << setprecision(11) << ans;
    return 0 ;
}


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

ll powm(ll b, ll p)
{
    if (p == 0)
        return 1;
    if (p % 2 == 1)
        return b * powm(b, p - 1);
    else
    {
        ll t = powm(b, p / 2);
        return t * t;
    }
}

int main()
{
    ll n;
    cin >> n;
    ll md, count = 0;
    for (md = 0; 1; md++)
    {
        count += powm(26, md);
        if (count > n)
            break;
    }
    vector<int> s(md);
    for (int i = 1; i <= md; i++)
    {
        s[i - 1] = n % 26;
        if (s[i - 1] == 0)
        {
            s[i - 1] = 26;
            n -= 26;
        }
        n /= 26;
    }
    for (int i = md - 1; i >= 0; i--)
    {
        char t = 'a' + s[i] - 1;
        cout << t;
    }
    cout << endl;
}


Measured memory_bytes: 3608
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vint a(n);
    REP(i,n) cin >> a[i];
    int ans = INF;
    for(int x = -100; x<=100;++x){
        int t = 0;
        REP(i,n){
            t += (x-a[i])*(x-a[i]);
        }
        ans = min(ans,t);
    }
    cout << ans << 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++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int x[4],y[4];
  REP(i,2) cin >> x[i] >> y[i];
  x[2] = x[1] - (y[1]-y[0]);
  y[2] = y[1] + x[1] - x[0];
  x[3] = x[0] - (y[1]-y[0]);
  y[3] = y[0] + x[1] - x[0];
  printf("%d %d %d %d", x[2],y[2],x[3],y[3]);
  return 0;
}

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

int main(void){
    while(true){
        string str;
        cin >> str;
        if(str == "-") break;
        
        int m;
        cin >> m;
        for(int i = 0; i < m; i++){
            int h;
            cin >> h;
            str = str.substr(h, str.size() - h) + str.substr(0, h);
        }
        cout << str << endl;
    }

    return 0;
}



Measured memory_bytes: 3220
N=int(input())
A=[tuple(map(int,input().split())) for i in range(N)]
A.sort(key=lambda x: x[1])
a=0
b=0 
c=0 
for i in range(len(A)):
   a+=A[i][0]
   b=A[i][1]
   if a>b:
      c+=1
      print('No')
      break
if c==0:
  print('Yes')

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


//c++ templte for help............................................................................................................................................
typedef long long ll;

//template<typename... T>
//void print1(T... t){
	//((cout<<t<<" "),...);
//}

//template<typename... T>
//void print2(T... t){
		//vector<vector<ll>> ans={t...};
		//for(ll i=0;i<(ll)ans.size();i++){
			//if(i!=0) cout<<"\t\t";
			//else cout<<"\t";
			//for(ll j=0;j<(ll)ans[i].size();j++){
				//cout<<ans[i][j]<<" ";
			//}
			//if(i!=(ll)ans.size()-1)
			//cout<<endl;
		//}
//}	
//#define deb(...) cout<<" [ "#__VA_ARGS__<<" : "; print1(__VA_ARGS__); cout<<"]"<<endl; 
//#define vdeb(...) cout<<" [ "#__VA_ARGS__<<" : "; print2(__VA_ARGS__); cout<<"]"<<endl;





	
 
//for loop
//#define fo(i,n) for(int i=0;i<(ll)n;i++)
//#define Fo(i,k,n) for(int i=k;i<n;i++)
 
 
//to print vector element 
//template<typename T>
//void printV(T vec){
	//fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	//cout<<endl;
	//}
	
 
#define M int(1e9+7)
const int INF=1e9+5;
 
//iterate map
//template<typename T>
//void itR(T map){
	 //for(auto itr=map.begin();itr!=map.end();itr++){
				//deb(itr->first,itr->second);
			//}
	//cout<<endl;
//}


 
 
 
//c++ template for help...........................................................................................................................................


ll solve(){
	int h,w,m;
	cin>>h>>w>>m;
	
	vector<vector<char>> vec(h,vector<char>(w));
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>vec[i][j];
		}
	}
	
	int ans=0;
	for(int mask=0;mask<(1<<(h+w));mask++){
		multiset<int> row;
		multiset<int> col;
		for(int i=0;i<(h+w);i++){
			if(((1<<i)&mask)){
				if(i<h) row.insert(i);
				else col.insert(i-h);
			}
		}
		int count=0;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if((row.count(i)==0 and col.count(j)==0) and vec[i][j]=='#'){
					count++;
				}
			}
		}
		if(count==m) {ans++;}
	}
	return ans;
}

int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(10);
	ios::sync_with_stdio(0);
	cin.tie(0);
	

	//ll testCase;
	//cin>>testCase;
	//for(ll tt=0;tt<testCase;tt++){
		//solve();
		ll ans=solve();
		cout<<ans<<endl;
	//}
	return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define DEBUG(x) cout << #x << " = " << x << endl

using namespace std;

const int NMAX = 2e5;
int n, a[NMAX], c[NMAX];

int main() {
  ios::sync_with_stdio(0);
  /* freopen("input.txt", "r", stdin); */
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    c[a[i]]++;
  }
  
  int r = 0;
  for (int i = 0; i < 1e5; i++) {
    if (i == 0) {
      r = max(r, c[i] + c[i + 1]);
    } else {
      r = max(r, c[i - 1] + c[i] + c[i + 1]);
    }
  }

  cout << r;
}


Measured memory_bytes: 1024
def examC():
    A, B, C, D, E, F = LI()
    water =set()
    for i in range(30):
        for j in range(30):
            if 100 * (i*A+j*B) > F or (i==0 and j==0):
                continue
            water.add(100 * (A*i+B*j))
    sugar = set()
    for i in water:
        j = 0
        while(True):
            if (j * C) * 100 > i * E or i+(j*C)>F:
                break
            k = 0
            while(True):
                if (j*C+k*D)*100>i*E or i+(j*C+k*D)>F:
                    j +=1
                    break
                sugar.add((i+j*C+k*D,j*C+k*D))
                k +=1
    ans = [0,0]; cur = float(-1)
    for i in sugar:
        if cur<i[1]/i[0]:
            ans = [i[0],i[1]]
            cur = i[1]/i[0]
    print(" ".join(map(str,ans)))
#    print(sugar)


import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

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

namespace AtCoder20170211 {
	class Program {
		static void Main(string[] args) {
			var input = Convert.ToInt32(Console.ReadLine());

			Console.WriteLine(input * 800 - Math.Floor(input / 15m ) * 200);
		}
	}
}


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

int main(){
  int N, A;
  cin >> N >> A;
  if(A >= N % 500){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
N, T = map(int, input().split())
ct = []
c = []
t = []
for i in range(N):
    ct.append(list(map(int, input().split())))
    c.append(ct[i][0])
    t.append(ct[i][1])

cost = 1000
if T < min(t):
    print("TLE")
else:
    for i in range(N):
        if t[i] <= T:
            if c[i] <= cost:
                cost = c[i]
    print(cost)


Measured memory_bytes: 3064
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a), i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main()
{
	string S;
	cin >> S;
	cout << string(S.length(), 'x') << endl;
}


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

//region Template
#include "ext/pb_ds/assoc_container.hpp"
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int MOD = 1000000007;

using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(const string& USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }
/*
template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
 */
//endregion

/* Notes:
 * Farah </3
 */

const int MAXN = 2e5 + 6;

vector<vector<int>> adj;

int cur = 0;

int comp[MAXN], comp2[MAXN];

map<pair<int, int>, int> mp;

void dfs(int x){
	if(comp[x] != 0) return;
	comp[x] = cur;
	for(auto y : adj[x]){
		dfs(y);
	}
}

void dfs2(int x){
	if(comp2[x] != 0) return;
	comp2[x] = cur;
	for(auto y : adj[x]){
		dfs2(y);
	}
}

int main() {
	#ifdef LOCAL

	setIn("in.txt");
	setOut("out.txt");
	#endif

	int n;
	cin >> n;


	adj.assign(n + 1, vector<int>());
	int k, l;
	cin >> k >> l;

	for(int i = 0; i < k; i++){
		int u , v;
		cin >> u >> v;

		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	for(int i = 1; i <= n; i++){
		if(comp[i] == 0){
			cur++;
			dfs(i);
		}
	}

	adj.clear();
	adj.assign(n + 1, vector<int>());

	for(int i = 0; i < l; i++){
		int u , v;
		cin >> u >> v;

		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	cur = 0;
	for(int i = 1; i <= n; i++){
		if(comp2[i] == 0){
			cur++;
			dfs2(i);
		}
	}


	for(int i = 1; i <= n; i++){
		mp[{comp[i], comp2[i]}]++;
	}

	for(int i = 1; i <= n; i++){
		cout << mp[{comp[i], comp2[i]}] << " ";
	}
}


Measured memory_bytes: 20224
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    sort(all(s),greater<char>());
    cout<<(s[n/2]=='R' ? "Yes" : "No")<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
int n, k;
void solve() {
    cin >> n >> k;
    cout << (n + k - 3) / (k - 1) << endl;
    return;
}
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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 (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
int main(int args, char* argv[]) {
    solve();
}

Measured memory_bytes: 256
# import sys
# input = sys.stdin.readline
import itertools

# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    h, w = input_list()
    count = 0
    for _ in range(h):
        s = list(input())
        count += s.count('#')
    if h+w-1 == count:
        print('Possible')
    else:
        print('Impossible')

def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()


Measured memory_bytes: 62020
#include <iostream>
#include <map>
#include <cmath>

using namespace std;

constexpr int dir[][2] = {
    { -1,  0 },
    {  0,  1 },
    {  1,  0 },
    {  0, -1 }
};

int main()
{
    int n;
    while( cin >> n ) {
        if ( n == 0 )
            break;
        
        map<int, pair<int, int>> pos;
        pos[0] = make_pair( 0, 0 );
        int minx = 0, miny = 0;
        int maxx = 0, maxy = 0;

        for( int i=0; i<n-1; ++i ) {
            int ni, di;
            cin >> ni >> di;
            const int x = pos[ni].first + dir[di][0];
            const int y = pos[ni].second + dir[di][1];
            minx = min( minx, x ); miny = min( miny, y );
            maxx = max( maxx, x ); maxy = max( maxy, y );

            pos[i+1] = make_pair( x, y );
        }

        cout << abs( maxx - minx )+1 << " " << abs( maxy - miny )+1 << endl;
    }
}

Measured memory_bytes: 1208
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a*c %mod;}a=a*a %mod;b>>=1;}return c;}
vi calc(ll x){vi res; while(x>0){res.eb(x%10);x/=10;}reverse(all(res)); return res;}

void solve() {
  int a,b;
  cin>>a>>b;
  bool f=false;
  REP(i,1,1251){
    if(i*8/100==a && i/10==b){
      f=true;
      out(i);
      break;
    }
  }
  if(f==false) out(-1);
}

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


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 1e5 + 5;
int n , m;
int u[N] , v[N];
int par[N] , sz[N];
ll ans[N];
int find(int u)
{
	return (par[u] == u) ? u : par[u] = find(par[u]);
}
ll join(int u , int v)
{
	u = find(par[u]) , v = find(par[v]);
	if(u == v)
		return 0;
	ll ret = sz[u] * sz[v];
	if(sz[u] > sz[v])
		swap(u , v);
	par[v] = u;
	sz[u] += sz[v];
	return ret;
}
int main()
{
	abdelrahman010
	cin >> n >> m;
	for(int i = 1;i <= n;i++)
		sz[i] = 1 , par[i] = i;
	for(int i = 0;i < m;i++)
		cin >> u[i] >> v[i];
	for(int i = m - 1;i >= 0;i--)
		ans[i] = join(u[i] , v[i]);
	ll lst = 0;
	for(int i = 0;i < m;i++)
		cout << ans[i] + lst << '\n' , lst += ans[i];
	return 0;
}


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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'

int n;
double a[55];

int main()
{
	IOS;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	} 
	sort(a, a+n);
	double s = a[0];
	for (int i = 1; i < n; i++) {
		s = (s + a[i]) / 2;
	}
	cout << s << endl;
	return 0;
}



Measured memory_bytes: 256
n,k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0]*(n)
dp[0] = 0

for i in range(1, n):
  j = max(0, i-k)
  dp[i] = min([dpk + abs(h[i]-hk) for dpk, hk in zip(dp[j:i], h[j:i])])
  
print(dp[n-1])

Measured memory_bytes: 13980
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

const LL MOD = 1e9 + 7;
const LL BIT_MAX = 2200000; // 2^21 = 2097152

LL dp[21][BIT_MAX] = {0};

LL a[25][25] = {0};

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

    LL n;
    cin>>n;
    REP(i,n)REP(j,n){
        cin>>a[i][j];
    }

    vector<vector<LL>> bit(n);
    REP(i,n){
        REP(j,n){
            if(a[i][j] == 1){
                bit[i].PB(1 << j);
            }
        }
    }

    for(LL b : bit[0]){
        dp[0][b] = 1;
    }
    REP(i,n-1){
        FOR(j, 1, BIT_MAX){
            if(dp[i][j] == 0)continue;
            for(LL b : bit[i+1]){
                if((j & b) != 0)continue;
                dp[i+1][j | b] += dp[i][j];
                dp[i+1][j | b] %= MOD;
            }
        }
    }

    PUTS(dp[n-1][(1 << n)-1]);
}

Measured memory_bytes: 319744
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    string S;
    cin >> N >> S;
    int sum[N+1];
    sum[0]=0;
    rep(i,N){
        int x=0;
        if(S.at(i)=='W') x=1;
        sum[i+1]=sum[i]+x;
    }
    int ans=INF;
    for(int i=0;i<N;i++){
        ans=min(ans,sum[i]+N-i-1-(sum[N]-sum[i+1]));
    }
    cout << ans << endl;



}



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


int main(){
    long long int n,a,b;
    long long int ans;
    cin >> n >> a >> b;
    if(a>b) swap(a,b);
    if((b-a)%2==0){
        ans = (b-a)/2;
    }else{
        //左端に行く場合
        long long int lans = a+(b-a-1)/2;
        long long int rans = n-b+1 + (b-a-1)/2;
        ans = min(lans,rans);
    }
    cout << ans << endl;
}

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

int main(){
  int N, K, t;
  cin >> N >> K;
  t = 0;
  for(int i = 0; i < N; i++){
    int a;
    cin >> a;
    t += min(2*a, 2*(K -a));
  }
  cout << t << endl;
}

Measured memory_bytes: 256
function Main(input) {
  input = input.trim()
  input = input.split(" ");
var a = parseInt(input[0],16);

var b = parseInt(input[1],16);
if(a<b){
  console.log("<")
}else if(a>b){
  console.log(">")
}else{
  console.log("=")
}

}Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    ll t,i,j,n,m,l,r,s=0;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>r;
        s+=r;
    }
    if(s>n)
    {
        s=-1;
    }
    else
    {
        s=n-s;
    }
    cout<<s<<"\n";
    return 0;
}



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

int main() {
  int d;
  cin >> d;
  if (d == 25) cout << "Christmas" << endl;
  else if (d == 24) cout << "Christmas Eve" << endl;
  else if (d == 23) cout << "Christmas Eve Eve" << endl;
  else cout << "Christmas Eve Eve Eve" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        if(s.equals(t.substring(0,t.length()-1))) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

long long N, A, B, C;
string S[100005];
string ans[100005];

void fin() {
	cout << "No" << endl;
	exit(0);
}

int main(){
	cin >> N >> A >> B >> C;
	for(long long i = 0; i < N; i++) {
		cin >> S[i];
	}


	for(long long i = 0; i < N; i++) {
		if(S[i] == "AB") {
			if(A == 0) {
				if(B == 0) {
					fin();
				}
				ans[i] = 'A';
				A++;
				B--;
			}else if(B == 0) {
				if(A == 0) {
					fin();
				}
				ans[i] = 'B';
				B++;
				A--;
			} else {
				//最後 or 次もAB, 適当でいい
				if(i == N-1 || S[i+1] == "AB") {
					ans[i] = 'B';
					B++;
					A--;
				} else if(S[i+1] == "BC") {
					ans[i] = 'B';
					B++;
					A--;
				} else if (S[i+1] == "AC") {
					ans[i] = 'A';
					A++;
					B--;
				} else {
					cout << "ERROR1" << endl;
					return 1;
				}
			}
		} else if (S[i] == "BC") {
			if(B == 0) {
				if(C == 0) {
					fin();
				}
				ans[i] = 'B';
				B++;
				C--;
			}else if(C == 0) {
				if(B == 0) {
					fin();
				}
				ans[i] = 'C';
				C++;
				B--;
			} else {
				//最後 or 次もBC, 適当でいい
				if(i == N-1 || S[i+1] == "BC") {
					ans[i] = 'B';
					B++;
					C--;
				} else if(S[i+1] == "AB") {
					ans[i] = 'B';
					B++;
					C--;
				} else if (S[i+1] == "AC") {
					ans[i] = 'C';
					C++;
					B--;
				} else {
					cout << "ERROR2" << endl;
					return 1;
				}
			}
		} else if (S[i] == "AC") {
			if(A == 0) {
				if(C == 0) {
					fin();
				}
				ans[i] = 'A';
				A++;
				C--;
			}else if(C == 0) {
				if(A == 0) {
					fin();
				}
				ans[i] = 'C';
				C++;
				A--;
			} else {
				//最後 or 次もAC, 適当でいい
				if(i == N-1 || S[i+1] == "AC") {
					ans[i] = 'A';
					A++;
					C--;
				} else if(S[i+1] == "AB") {
					ans[i] = 'A';
					A++;
					C--;
				} else if (S[i+1] == "BC") {
					ans[i] = 'C';
					C++;
					A--;
				} else {
					cout << "ERROR3" << endl;
					return 1;
				}
			}
		} else {
			cout << "ERROR4" << endl;
			return 1;
		}
	}

	cout << "Yes" << endl;
	for(long long i = 0; i < N; i++) {
		cout << ans[i] << endl;
	}
}


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

class Program
{
    static void Main(string[] args)
    {
        var n = long.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

        // b[i] = a[i] + i
        var b = new long[n];
        for (int i = 0; i < n; i++) b[i] = a[i] + i;

        // c[j] = j - a[j]
        // NOTE: j >= i
        var c = new long[n];
        for (int j = 0; j < n; j++) c[j] = j - a[j];

        // 一致する数を数える
        var histgram = new Dictionary<long, long>();
        for(int i = 0; i < n; i++)
        {
            if (!histgram.ContainsKey(c[i])) histgram.Add(c[i], 0);
            histgram[c[i]]++;
        }

        var ans = 0l;
        for(int i = 0; i < n; i++)
        {
            if (histgram.ContainsKey(b[i])) ans += histgram[b[i]];
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 59788
#include<iostream>

using namespace std;

int main() {

	long long A, B, K; 
	cin >> A >> B >> K;

	if (A > K) {
		cout << A - K << " " << B;
	}
	else if (A + B < K) {
		cout << "0 " << "0";
	}
	else {
		cout << "0 " << A + B - K;
	}

	return 0;
}

Measured memory_bytes: 256
<?php
$arr = explode(' ', fgets(STDIN));

$p = (int) $arr[0];
$q = (int) $arr[1];
$r = (int) $arr[2];


$pqSum = $p + $q;
$qrSum = $q + $r;
$prSum = $p + $r;

echo min($pqSum, $qrSum, $prSum) . PHP_EOL;

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int main(){
    int n, ans = 0; sc(n)
    while ((1<<ans) <= n) ans += 1;
    cout << (1<<(ans-1)) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int main(){
    int W,H,N,ans=0;
    cin>>W>>H>>N;
    int X[N]={},Y[N]={},a[N]={};
    bool A[W+1][H+1]={false};
    for(int i=0;i<N;i++) cin>>X[i]>>Y[i]>>a[i];
    for(int i=0;i<N;i++){
        if(a[i]==1){
            for(int j=1;j<=X[i];j++){
                for(int k=1;k<=H;k++){
                    A[j][k]=true;
                }
            }
        }else if(a[i]==2){
            for(int j=X[i]+1;j<=W;j++){
                for(int k=1;k<=H;k++){
                    A[j][k]=true;
                }
            }
        }else if(a[i]==3){
            for(int j=1;j<=W;j++){
                for(int k=1;k<=Y[i];k++){
                    A[j][k]=true;
                }
            }
        }else{
            for(int j=1;j<=W;j++){
                for(int k=Y[i]+1;k<=H;k++){
                    A[j][k]=true;
                }
            }
        }
    }
    for(int j=1;j<=W;j++){
        for(int k=1;k<=H;k++){
            if(!A[j][k]) ans++;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
ll inf = 1e10;
ll w[105], v[105];
ll dp[300005] = {};
ll d[200005];
vector<int> g[100005];
int main() {
	ll a, b, k;
	cin >> a >> b >> k;
	ll ans = a - k;
	
	if (ans < 0) {
		ans = 0;
		ll ans2= b - (k - a);
		if (ans2 < 0) {
			ans2 = 0;
		}
		cout << ans <<" "<< ans2 << endl;
		return 0;
	}
	else {
		cout << ans <<" "<< b << endl;
		return 0;
	}
	return 0;
}


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

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool connect(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool isSame(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int cnt[100005];
int fr_cnt[100005];
int block_cnt[100005];

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int n,m,k;cin>>n>>m>>k;

  UnionFind uf = UnionFind(n);

  for(int i=0;i<m;i++){
    int a,b;cin>>a>>b;a--,b--;
    uf.connect(a, b);
    fr_cnt[a]++;
    fr_cnt[b]++;
  }
  for(int i=0;i<k;i++){
    int c,d;cin>>c>>d;c--,d--;
    if(uf.isSame(c,d)){
      block_cnt[c]++;      block_cnt[d]++;

    }
  }
  for(int i=0;i<n;i++){
    if(i)cout<<' ';
    cout<<uf.size(i)-1-fr_cnt[i]-block_cnt[i];
  }
  cout<<endl;

  return 0;
}


Measured memory_bytes: 2048
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
//cout << setprecision(123);
int main(){
  int p,q,r;
  cin>>p>>q>>r;
  cout<<p+q+r-max({p,q,r})<<endl;
}

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

using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        switch (s[0]) {
            case 'A': {
                ac++;
                break;
            }
            case 'W': {
                wa++;
                break;
            }
            case 'T': {
                tle++;
                break;
            }
            case 'R': {
                re++;
                break;
            }
        }
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa<< endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}

Measured memory_bytes: 3608
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces


def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

N = ni()
li = primes(10**7)
ct = 0
ans = []
for num in li:
    if num % 10 == 7:
        ct += 1
        ans.append(num)
        if ct == N:
            break 
print(*ans)



Measured memory_bytes: 225304
<?php
    $s = trim(fgets(STDIN));
    $s = explode(' ', $s);
$count = 0;
for ($i = $s[0]; $i <= $s[1]; $i++) {
    if ($s[2] % $i == 0) {
         $count++;
    }
}
echo $count . PHP_EOL;
exit;
?>

Measured memory_bytes: 15340
#include<stdio.h>
#include<string.h>
using namespace std;
char a[3];

int main(void)
{
    memset(a,'\0',sizeof(a));
    scanf("%s",a);
    if(a[0]=='A'&&a[1]=='B'&&a[2]=='C')
        printf("ARC");
    if(a[0]=='A'&&a[1]=='R'&&a[2]=='C')
        printf("ABC");
    return 0;
}

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

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (int)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	int N, M;
	cin >> N >> M;

	vector<int> a(M), b(M);
	vector<vector<int>> c(M);
	REP(i, M) {
		cin >> a[i] >> b[i];
		REP(j, b[i]) {
			int tmp; 
			cin >> tmp;
			tmp--;
			c[i].emplace_back(tmp);
		}
	}

	int bitMax = 1 << N;
	vector<vector<int>> dp(M + 1, vector<int>(bitMax, INF));
	dp[0][0] = 0;
	REP(i, M) {
		int bitPtn = 0;
		for (auto one : c[i]) {
			bitPtn |= (0x1 << one);
		}

		REP(j, bitMax) {
			if (dp[i][j] != INF) {
				int nextBitPtn = j | bitPtn;
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
				dp[i + 1][nextBitPtn] = min(dp[i + 1][nextBitPtn], dp[i][j] + a[i]);
			}
		}
	}

	if (dp[M][bitMax - 1] == INF) {
		cout << -1 << endl;
	} else {
		cout << dp[M][bitMax - 1] << endl;
	}
	return 0;
}


Measured memory_bytes: 16384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		int num = in.nextInt();
		int count = 1;

		for (count = 1; count <= num; count++) {

			// 3??§?????????????????°?????¨???
			if (count % 3 == 0) {

				System.out.print(" " + count);

				// ???????????????3?????°?????¨???
			} else if (count % 10 == 3) {

				System.out.print(" " + count);

			} else {

				int x = count;

				while (x > 10) {

					x /= 10;

					if (x % 10 == 3) {

						System.out.print(" " + count);
						break;

					}
				}
			}
		}
		System.out.println("");
	}
}

Measured memory_bytes: 28480