akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(3*n);
    rep(i, 3*n) cin >> a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    ll ans = 0;
    for (int i = 1; i <= 2*n; i+=2) {
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int n;
    std::cin >> n;
    while (n > 0) {
        if (n % 10 == 7) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
        n /= 10;
    }
    std::cout << "No" << std::endl;
    return 0;
}


Measured memory_bytes: 3556
"""
~~ Author : Bhaskar
~~ Dated : 10~06~2020
"""

import sys
from bisect import *
from math import floor,sqrt,ceil,factorial as F,gcd,pi
from itertools import chain,combinations,permutations,accumulate
from collections import Counter,defaultdict,OrderedDict,deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)-1
mod = 1000000007
ch = "abcdefghijklmnopqrstuvwxyz"
lcm = lambda a,b : (a*b)//gcd(a,b)
setbit = lambda x : bin(x)[2:].count("1")
input = lambda : sys.stdin.readline()

def solve():
    n = int(sys.stdin.readline())
    a = list(map(int, sys.stdin.readline().split()))
    d = Counter(a)
    s = sum(a)
    q = int(sys.stdin.readline())
    for _ in range(q):
        b, c = map(int, sys.stdin.readline().split())
        s += d[b]*c - d[b]*b
        d[c] += d[b]
        d[b] = 0
        print(s) 


if __name__ == "__main__":
    try:
        sys.stdin = open('input.txt','r')
        sys.stdout = open('output.txt','w')
    except:
       pass
    solve()



Measured memory_bytes: 23896
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int count = 0;
        count++;
        n -= k;
        if (n % (k - 1) == 0)
            System.out.println(count + n / (k - 1));
        else
            System.out.println(count + n / (k - 1) + 1);
    }
}


Measured memory_bytes: 50784
#include<bits/stdc++.h>
#define fi first
#define vi vector<int>
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long 
using namespace std;
const int mod = 1e9+7;
main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int x;
	cin >> x;
	for (int i = 1999; i >= 0; i-=200) {
		if (x <= i && x > i- 200) cout << (2000-i)/200 + 1;
	}
/*	400
  through 
599
: 
8
-kyu
From 
600
 through 
799
: 
7
-kyu
From 
800
 through 
999
: 
6
-kyu
From 
1000
 through 
1199
: 
5
-kyu
From 
1200
 through 
1399
: 
4
-kyu
From 
1400
 through 
1599
: 
3
-kyu
From 
1600
 through 
1799
: 
2
-kyu
From 
1800
 through 
1999
: 
1
-kyu
What kyu does M-kun have?*/
	
}

Measured memory_bytes: 3648
'use strict';

(function() {
    var fs = require('fs');
    var contents = fs.readFileSync('/dev/stdin', 'utf-8');

    var calc = function(contents) {
        var lines = contents.split("\n");
        for (var i = 0; i < lines.length; i++) {
            var line = lines[i].trim().split(" ");
            var a = parseInt(line[0]);
            var op = line[1];
            var b = parseInt(line[2]);
            if (op === '?') {
                break;
            }

            switch (op) {
            case '+':
                console.log(a + b);
                break;
            case '-':
                console.log(a - b);
                break;
            case '*':
                console.log(a * b);
                break;
            case '/':
                console.log(Math.floor(a / b));
                break;
            }
        }
    }

    calc(contents);
}());

Measured memory_bytes: 15532
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
typedef long long ll;
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pii pair < int , int >
#define pll pair < ll, ll >
#define mp make_pair
#define ff first
#define ld long double
#define ss second
#define vi vector < int >
#define vll vector < ll >
#define pb push_back
#define pf push_front
#define PI 3.1415926535897932384626
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)

const int mod = 1'000'000'007;

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}


	
int main()
{
		fastio;
		ll t = 1;
		//cin >> t;
		rep(tt,1,t+1)
		{
			ll n, K;
			cin >> n >> K;
			vll A(n);
			rep(i, 0, n)
			{
				cin >> A[i];
			}
			vector<ll> dp(K+1);
			rep(i, 0, K+1)
			{
				for(auto y:A)
				{
					if(i-y >=0 && dp[i-y] == 0)
					{
						dp[i] = 1;
					}
				}
			}
			if(dp[K])
			{
				cout << "First" << endl;
			}
			else
			{
				cout << "Second" << endl;
			}
		}
		return 0;
	}
					


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int m,a,b;
bool is_prime[111111];

int main(){
	cin.sync_with_stdio(false);
	for(int i=0;i<=100000;i++)is_prime[i]=true;
	for(int i=2;i<=100000;i++){
		if(is_prime[i])for(int j=i*2;j<=100000;j+=i)is_prime[j]=false;
	}
	while(1){
		cin>>m>>a>>b;
		if(m==0)break;
		int resp,resq,maxx=0;
		for(int p=2;p*p<=m;p++){
			if(is_prime[p]){
				for(int q=p;p*q<=m&&a*q<=b*p;q++){
					if(is_prime[q]&&maxx<p*q){
						maxx=p*q; resp=p; resq=q;
					}
				}
			}
		}
		cout<<resp<<" "<<resq<<endl;
	}
	return 0;
}

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

int main(){
    int N, K;
    cin >> N >> K;
    
    int sunuke[N];
    for(int i=0; i<N; i++){
        sunuke[i] = 0;
    }
    int d[K];
    for(int i=0;i<K;i++){
        cin >> d[i];
        int A[N];
        for(int j=0; j<d[i];j++){
            cin >> A[j];
            sunuke[A[j]-1] += 1;
        }
    }

    int ans = 0;
    for(int i=0; i<N; i++){
        if(sunuke[i] == 0){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var dp=new long[s[0]+2][][];
		var h=new int[s[0]+2][];
		for(int i = 1;i<=s[0]+1;i++) {
			dp[i]=new long[s[1]+2][];
			for(int j = 1;j<=s[1]+1;j++) {dp[i][j]=new long[4];}
			h[i]=new int[s[1]+1];
		}
		for(int i = 0;i<s[2];i++) {
			var e=sc.Ia;
			h[e[0]][e[1]]=e[2];
		}
		for(int i = 1;i<=s[0];i++) {
			for(int j = 1;j<=s[1];j++) {
				for(int l = 0;l<=3;l++) {
					dp[i][j+1][l]=Max(dp[i][j+1][l],dp[i][j][l]);
					if(l==3){
						dp[i+1][j][0]=Max(dp[i+1][j][0],dp[i][j][l]);
						continue;
					}
					dp[i][j+1][l+1]=Max(dp[i][j+1][l+1],dp[i][j][l]+h[i][j]);
					dp[i+1][j][0]=Max(dp[i+1][j][0],dp[i][j][l]+h[i][j]);
				}
			}
		}
		long ans=dp[s[0]][s[1]][3];
		for(int i = 0;i<3;i++) {ans=Max(ans,dp[s[0]][s[1]][i]+h[s[0]][s[1]]);}
		Console.WriteLine("{0}",ans);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> AB(N, vector<int>(2));
  for (int i = 0; i < N; i++) {
    cin >> AB.at(i).at(1) >> AB.at(i).at(0);
  }
  sort(AB.begin(), AB.end());
  int64_t A = 0;
  bool ok = true;
  for (int i = 0; i < N; i++) {
    A += AB.at(i).at(1);
    if (A > AB.at(i).at(0)) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
      

Measured memory_bytes: 14328
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<utility>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<cctype>
#include<cmath>
using namespace std;
int main()
{
	int a,b,x;
	cin >> a >> b >> x;
	if(x>a+b)
	{
		cout << "NO";
		return 0;
	}
	if(x<a)
	{
		cout << "NO";
		return 0;
	}
	cout << "YES";
	return 0;
}

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

int main(){
  ll n, k; cin >> n >> k;
  vector<ll> a(n), f(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++) cin >> f[i];
  ll mn = 0;
  for(int i = 0; i < n; i++){
    mn = max(mn, a[i] * f[i]);
  }
  sort(a.begin(), a.end());
  sort(f.begin(), f.end(), greater<ll>());
  ll ng = -1, ok = mn;
  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    ll cnt = 0;
    for(int i = 0; i < n; i++){
      ll tmp = a[i] - mid / f[i];
      if(tmp < 0) continue;
      cnt += tmp;
    }
    if(cnt <= k) ok = mid;
    else ng = mid;
  }
  cout << ok << endl;
}

Measured memory_bytes: 6400
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  string s; cin>>s;
  if(s == "ARC") cout<<"ABC"<<endl;
  else cout<<"ARC"<<endl;


}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;

void solve() {
    int N;
    cin >> N;
    vector<pair<int,int>> vp(N);
    REP(i,N) {
        int x,y;
        cin >> x >> y;
        vp[i] = make_pair(x,y);
    }

    map<pair<int,int>,int> mp;
    REP(i,N-1)FOR(j,i+1,N) {
        auto [x1,y1] = vp[i];
        auto [x2,y2] = vp[j];

        // 前から後ろ
        auto p1 = make_pair(x2-x1,y2-y1);
        auto p2 = make_pair(x1-x2,y1-y2);
        if(!mp.count(p1)) mp[p1] = 0;
        if(!mp.count(p2)) mp[p2] = 0;
        mp[p1]++; mp[p2]++;
    }

    int mv = 0;
    for(const auto &d: mp) {
        auto [p,cnt]  = d;
        chmax(mv,cnt);
    }

    cout << N-mv << endl;

}

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

Measured memory_bytes: 3728
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial



def main():
    num, max_num = map(int, input().split())
    data = list(map(int, input().split())) + [0]

    ans = 0
    for i in range(num):
        if data[i] + data[i + 1] > max_num:
            ans += min(data[i + 1], data[i] + data[i + 1] - max_num)
            data[i + 1] -= min(data[i + 1], data[i] + data[i + 1] - max_num)

            if data[i] + data[i + 1] > max_num:
                ans += data[i] - max_num

    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 63984
// ███▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓╬╬╬╬╬╬▓█
// ███▓███████▓▓╬╬╬╬╬╬╬╬╬╬╬╬▓███▓▓▓▓█▓╬╬╬▓█
// ███████▓█████▓▓╬╬╬╬╬╬╬╬▓███▓╬╬╬╬╬╬╬▓╬╬▓█
// ████▓▓▓▓╬╬▓█████╬╬╬╬╬╬███▓╬╬╬╬╬╬╬╬╬╬╬╬╬█
// ███▓▓▓▓╬╬╬╬╬╬▓██╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ████▓▓▓╬╬╬╬╬╬╬▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ███▓█▓███████▓▓███▓╬╬╬╬╬╬▓███████▓╬╬╬╬▓█
// ████████████████▓█▓╬╬╬╬╬▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬█
// ███▓▓▓▓▓▓▓╬╬▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ████▓▓▓╬╬╬╬▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ███▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// █████▓▓▓▓▓▓▓▓█▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// █████▓▓▓▓▓▓▓██▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// █████▓▓▓▓▓████▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// ████▓█▓▓▓▓██▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// ████▓▓███▓▓▓▓▓▓▓██▓╬╬╬╬╬╬╬╬╬╬╬╬█▓╬▓╬╬▓██
// █████▓███▓▓▓▓▓▓▓▓████▓▓╬╬╬╬╬╬╬█▓╬╬╬╬╬▓██
// █████▓▓█▓███▓▓▓████╬▓█▓▓╬╬╬▓▓█▓╬╬╬╬╬╬███
// ██████▓██▓███████▓╬╬╬▓▓╬▓▓██▓╬╬╬╬╬╬╬▓███
// ███████▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬████
// ███████▓▓██▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓████
// ████████▓▓▓█████▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█████
// █████████▓▓▓█▓▓▓▓▓███▓╬╬╬╬╬╬╬╬╬╬╬▓██████
// ██████████▓▓▓█▓▓▓╬▓██╬╬╬╬╬╬╬╬╬╬╬▓███████
// ███████████▓▓█▓▓▓▓███▓╬╬╬╬╬╬╬╬╬▓████████
// ██████████████▓▓▓███▓▓╬╬╬╬╬╬╬╬██████████
// ███████████████▓▓▓██▓▓╬╬╬╬╬╬▓███████████
//#include "grader.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <cassert>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define read(FILENAME) assert(freopen((FILENAME + ".in").c_str(), "r", stdin))
#define write(FILENAME) assert(freopen((FILENAME + ".out").c_str(), "w", stdout))
#define files(FILENAME) read(FILENAME), write(FILENAME)
using namespace std;
template <typename A, typename B> void chkmin(A &x, B y) {if (x > y) x = y;}
template <typename A, typename B> void chkmax(A &x, B y) {if (x < y) x = y;}
     
typedef pair <int, int> point;
     
const string FILENAME = "input";
const int MAXN = 1e5, p = 1e9 + 7;

long long d;

long long powx[20];
int kalc[2][20];

bool check(long long A, long long B, long long C) {
	A += B;
	A %= C;
	if (A < 0) 
	 	A += C;
	 return A == 0;
}

long long res(long long d, long long cnt, int L, int R) {
	if (R == L) return cnt * (long long)(d == 0) * 10;
	if (R < L) return cnt * (long long)(d == 0);
	long long ans = 0;
	long long q = powx[R] - powx[L];
	if (abs(d) > q * 10) return 0;
	for (int i = -9; i <= 9; ++i) {
		if (check(d, q * i, powx[L + 1])) {
			ans += res(d + q * i, cnt * kalc[L != 0][10 - i], L + 1, R - 1);
		}
	}
	return ans;
}

int main() {
	//read(FILENAME);
	ios::sync_with_stdio(0);
	cin >> d;
	for (int i = 0; i < 10; ++i) {
		for (int j = 0; j < 10; ++j) {
			if (j != 0) ++kalc[0][10 + i - j];
			++kalc[1][10 + i - j];
		}
	}
	powx[0] = 1;
	for (int i = 0; i < 18; ++i) {
		powx[i + 1] = powx[i] * 10;
	}
	long long ans = 0;
	for (int len = 1; len <= 18; ++len) {
		ans += res(d, 1, 0, len - 1);
	}
	cout << ans << endl;
}








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

void draw(int, int);

int main() {
    int h, w;
    for (;;) {
        cin >> h >> w;
        if (h == 0 && w == 0)
            return 0;
        draw(h, w);
        cout << endl;
    }
}

void draw(int h, int w) {
    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            if (y % 2 == x % 2)
                cout << '#';
            else
                cout << '.';
        }
        cout << endl;
    }
}



Measured memory_bytes: 3092
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define ll long long
using namespace std;
const int N=404;
const ll mod=1e9+7;
int n,m,a[N],b[N],maxx;
ll dp[N][N],mult[N][N],sum[N][N];
inline ll read(){
	char ch=getchar(); ll x=0, f=1;
	while(ch<'0' || ch>'9') {if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();}
	return x*f;}
inline int mx(int a,int b){return a>b ? a : b;}
int main()
{
//	freopen("Children and Candies.in","r",stdin);
	n=read(); m=read();
	for(RG int i=1;i<=n;i++) a[i]=read();
	for(RG int i=1;i<=n;i++) b[i]=read(), maxx=mx(maxx,b[i]);
	for(RG int i=1;i<=maxx;i++)
	{
		mult[i][0]=1;
		for(RG int j=1;j<=m;j++) mult[i][j]=mult[i][j-1]*i%mod;
	}
	for(RG int i=1;i<=maxx;i++)
	 for(RG int j=0;j<=m;j++)
	  sum[i][j]=(sum[i-1][j]+mult[i][j])%mod;
	dp[0][0]=1;
	for(RG int i=1;i<=n;i++)
	 for(RG int j=0;j<=m;j++)
	  for(RG int l=0;l<=j;l++)
	   (dp[i][j]+=dp[i-1][j-l]*((sum[b[i]][l]-sum[a[i]-1][l]+mod)%mod)%mod)%=mod;
	printf("%lld\n",dp[n][m]);
	return 0;
}

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

using ll = long long;

int main() {
    int n; cin >> n;
    vector<ll> a(n), b(n);
    ll sum = 0;
    for(int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        sum += a[i];
    }

    ll ans = 0;
    for(int i = 0; i < n; ++i) {
        if(a[i] <= b[i]) continue;
        ans = max(ans, sum - b[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(void){
   int x,y,r,a,b;
   scanf("%d %d",&x,&y);

   if(x<y){
    a=x;
    b=y;
    x=b;
    y=a;
    
   }

   while(y>0){
      r=x%y;
      x=y;
      y=r;
   }
  printf("%d\n",x);

  return 0;
}


Measured memory_bytes: 2136
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        solve();
    }

    private static void solve() {
        Scanner input = new Scanner(System.in);

        int r = input.nextInt();
        int g = input.nextInt();
        int b = input.nextInt();
        int n = input.nextInt();

        int ansCnt = 0;

        for (int rn = 0; rn <= n/r; rn++) {
        	if (rn * r == n) {
        		ansCnt++;
        	} else {
            	for (int gn = 0; gn <= n/g; gn++) {
            		if (rn * r + gn * g == n) {
            			ansCnt++;
            		} else {
            			int rem = n - (rn * r + gn * g);
            			if (rem > 0) {
            				if (rem % b == 0) {
                    			ansCnt++;
            				}
            			}
            		}
            	}
        	}
        }

        System.out.println(ansCnt);
    }
}


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

SS = ["No"]*len(S)
count = 0
countb = 0

for i in range(len(S)):
  if count == A+B:
      break
  if S[i] == "a":
    SS[i] = "Yes"
    count += 1
  elif S[i] == "b" and countb < B:
    SS[i] = "Yes"
    count +=1
    countb += 1

print('\n'.join(SS))

Measured memory_bytes: 5924
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100 + 5;

int main()
{
    int n;
    cin >> n;
    int flag = 0;
    for(int i = 1; i <= n; i++){
    	int x;
    	cin >> x;
    	if(x % 2 == 0){
    		if(x % 3 != 0 && x % 5 != 0){
    			flag = 1;
			}
		}
	}
	if(!flag)
		cout << "APPROVED" << endl;
	else
		cout << "DENIED" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define endl "\n"
using namespace std;
void solve()
{
	//Enter your code here Tanmay:)
	int a,b,c;
	cin>>a>>b>>c;
	int sum=a+b+c;
	if(sum>=22)
		cout<<"bust";
	else
		cout<<"win";
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int e[101][101];
    int R, C, r, c;
    int s, total;
 
    scanf("%d%d", &R, &C);
    for (r = 1; r <= R; r++) {
        for (c= 1; c <= C; c++) scanf("%d", &e[r][c]);
    }
     
    for (r = 1; r <= R; r++) {
        s = 0;
        for (c = 1; c <= C; c++) s += e[r][c];
        e[r][0] = s;
    }
    total = 0;
    for (c = 1; c <= C; c++) {
        s = 0;
        for (r = 1; r <= R; r++) s += e[r][c];
        e[0][c] = s;
        total += s;
    }
    for (r = 1; r <= R; r++) {
        for (c = 1; c <= C; c++) printf("%d ", e[r][c]);
        printf("%d\n", e[r][0]);
    }
    for (c = 1; c <= C; c++) printf("%d ", e[0][c]);
    printf("%d\n", total);
    return 0;
}




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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define allsort(v) sort(v.begin(),v.end())
const ll mod = 1e9 + 7;
const int inf = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	vector<int>count(N, 1);
		vector<bool>flag(N);
	int x, y;
	flag[0] = true;
	rep(i, M) {
		cin >> x >> y;
		if (flag[x - 1])flag[y - 1] = true;
		count[x - 1]--;
		count[y - 1]++;
		if (count[x - 1] == 0 && flag[x - 1])flag[x - 1] = false;
	}
	int ans = 0;
	for (auto i : flag) {
		if (i)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
package main

import "fmt"

var Q int
var l, r []int

func main() {
	fmt.Scanf("%d", &Q)

	l = make([]int, Q)
	r = make([]int, Q)

	for i := 0; i < Q; i++ {
		fmt.Scanf("%d %d", &l[i], &r[i])
	}

	primes := Primes(100001)
	cs := make([]int, 100001)

	for i := 1; i < 100001; i++ {
		if primes[i] && primes[(i+1)/2] {
			cs[i]++
		}
		cs[i] += cs[i-1]
	}

	for i := 0; i < Q; i++ {
		fmt.Println(cs[r[i]+1] - cs[l[i]-1])
	}
}

func Primes(n int) []bool {
	primes := make([]bool, n)

	for i := 2; i < n; i++ {
		primes[i] = true
	}

	for i := 2; i*i < n; i++ {
		for j := 2; i*j < n; j++ {
			primes[i*j] = false
		}
	}

	return primes
}


Measured memory_bytes: 5888
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=1000000007;
int p[505050];
int sum[505050];
int fac[505050];
int cnt[505050];
int lowbit(int x)
{
	return x&(-x);
}
int n;
void add(int x,int v)
{
	for(int i=x;i<=n;i+=lowbit(i))
		sum[i]+=v;
}
int query(int x)
{
	int ret=0;
	for(int i=x;i;i-=lowbit(i))
		ret+=sum[i];
	return ret;
}
int main()
{
	int le=0,ans=0,le1=0,h=0;
	scanf("%d",&n);
	fac[0]=1;
	for(int i=1;i<=n;i++)
		fac[i]=(long long)fac[i-1]*i%mod;
	for(int i=1;i<=n;i++)
		cnt[i]=1;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&p[i]);
		cnt[p[i]]--;
	}
	for(int i=n-1;i>=1;i--)
		cnt[i]+=cnt[i+1];
	for(int i=1;i<=n;i++)
		if(p[i]==0)
			le++;
	memset(sum,0,sizeof(sum));
	ans=fac[le];
	for(int i=n;i>=1;i--)
	{
		if(p[i])
		{
			ans=((long long)query(p[i])*fac[le]%mod*fac[n-i]+ans)%mod;
			ans=((long long)(cnt[1]-cnt[p[i]])*le1%mod*fac[le-1]%mod*fac[n-i]+ans)%mod;
			add(p[i],1);
			(h+=cnt[p[i]])%=mod;
		}
		else
		{
			if(le>1)
				ans=((long long)le*(le-1)/2%mod*le1%mod*fac[le-2]%mod*fac[n-i]+ans)%mod;
			ans=((long long)h*fac[le-1]%mod*fac[n-i]+ans)%mod;
			le1++;
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 8064
#include<iostream>
#include<string.h>
#define ll long long
using namespace std;
ll prod(int n)
{
	if(n<=1)return 1;
	return n*prod(n-1);	
}
ll cc[51][51];
void init()
{
    cc[0][0] = 1;
    for(int i=1;i<=55;i++)
    {
        cc[i][0] = 1;
        for(int j=1;j<=i;j++)
            cc[i][j] = cc[i-1][j]+cc[i-1][j-1];
        //C[i][j] = (C[i-1][j]+C[i-1][j-1])%MOD;
    }
}
int main()
{
	int n;
	int p,ji,ou;
	int a[55];
	init();
	while(scanf("%d",&n)!=EOF)
	{
		memset(a,0,sizeof(a));
		ji=0;
		ou=0;
		cin>>p;
		for(int i=0;i<n;i++)
		{
			cin>>a[i];
			if(a[i]%2)ji++;
			else ou++;
		}
		ll ans=1;
		ll temp=0;
		for(int i=0;i<ou;i++)
		ans*=2;
		for(int i=0;i<=ji;i=i+2)
		{
			temp+=cc[ji][i];
		}
		if(p==0)
		cout<<ans*temp<<endl;
		else 
		{
			ll temp2=1;
			for(int i=0;i<ji;i++)
			{
				temp2*=2;
			}
			cout<<ans*(temp2-temp)<<endl;
		}
	}
}

Measured memory_bytes: 256
import java.util.*;
class Main
{
  public static void main(String[] args) {
    
    Scanner scan = new Scanner(System.in);
    String s =  scan.next();
    int max = 0 ;
   	for(int i = 0 ; i<s.length()-2 ; i++){
      int a = Integer.parseInt(s.substring(i,i+3));
     // System.out.println(a);
      if(Math.abs(753-a) < Math.abs(753-max) ){
        max = a ;
      }
    }
    System.out.println(Math.abs(753-max));
    
  }
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    unsigned long A[N+1];
    rep(i,N){
        cin >> A[i];
        if(A[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    unsigned long mul = 1;
    rep(i,N){
        unsigned long res = mul;
      	unsigned long res1 = res*A[i];
      	unsigned long res2 = res1/A[i];
        if(res2 != res){//オーバーフローしている
            cout << -1 << endl;
            break;            
        }
        if((mul*A[i] > 1000000000000000000)){
            cout << -1 << endl;
            break;
        }
        mul *= A[i];
        if(i == N-1) cout << mul << endl;
    }
    return 0;
}


Measured memory_bytes: 4396
#include<iostream>
#include<vector>
#include<cstring>

#define INF 99999999

using namespace std;

struct edge{
	int to,cap,rev; 
};

const int MAX_V = 100;

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from,int to,int cap){		//??°???????????\???
	G[from].push_back((edge){to,cap,G[to].size()});
	G[to].push_back((edge){from,0,G[from].size()-1});
}

int dfs(int v,int t,int f){
	if(v == t)	return f;
	used[v] = true;
	for(int i=0;i<G[v].size();i++){
		edge &e = G[v][i];	//?????§?????°??¨????????????(?????????????????£??\???????????????????????????)
		if(!used[e.to] && e.cap > 0){
			int d = dfs(e.to,t,min(f,e.cap));
			if(d > 0){
				e.cap -= d;	//e???G[v][i]?????¨????????¢?????§???????????????????????????G[v][i]??????????????????????????¨??????
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s,int t){
	int flow = 0;
	for(;;){
		memset(used,0,sizeof(used));
		int f = dfs(s,t,INF);
		if(f == 0)	return flow;
		flow += f;
	}
}

int main(){
	int n,m,result;
	cin >> n;	//????????°
	cin >> m;	//?????°
	for(int i=0;i<m;i++){
		int from,to,cap;
		cin >> from;
		cin >> to;
		cin >> cap;
		add_edge(from,to,cap);
	}
	result = max_flow(0,n-1);
	cout << result << "\n";
}

Measured memory_bytes: 3168
#include<stdio.h>
#include<iostream>
using namespace std;;
int yaku(int);

int main(){
  int counter = 0;
  int N;
  cin >> N;

  for(int i=1;i<=N;i+=2){
    int result = yaku(i);
    if(result==8){
      counter++;
    }
  }
  cout << counter;
}

int yaku(int n){

  int counter = 0;
  for(int i=1;i<=n;i++){
    if(n%i==0){
      counter++;
    }
  }
  return counter;
}


Measured memory_bytes: 256
<?php
  list($n, $k) = explode(" ", trim(fgets(STDIN)));
  list($s) = explode(" ", trim(fgets(STDIN)));

  $count = [];
  $pa = 0;
  $count[$pa]=0;
  $cZero = 0;
  $zen = '1';
  for ($i=0; $i<$n; $i++) {
    if($zen == $s[$i]){
      $count[$pa]++;
    }else{
      $pa++;
      $zen = $s[$i];
      if($zen == '0') {
        $cZero++;
      }
      $count[$pa]=1;
    }
  }

  if($cZero <= $k){
    echo $n;
    exit;
  }

  $max = 0;
  for ($i=0; $i<$k*2+1; $i++) {
    $max += $count[$i];
  }

  $sum = $max;
  if($pa % 2 == 1) {
    $pa++;
    $count[$pa]=0;
  }
  for ($i=$k*2+2; $i<=$pa; $i=$i+2) {
//    echo $sum.PHP_EOL;
    $sum+=$count[$i];
    $sum+=$count[$i-1];
    $sum-=$count[$i-$k*2-1];
    $sum-=$count[$i-$k*2-2];
    $max = max($max, $sum);
  }

  echo $max;

Measured memory_bytes: 21148
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();

		print('U', ty - sy, pr);
		print('R', tx - sx, pr);
		print('D', ty - sy, pr);
		print('L', tx - sx, pr);

		print('L', 1, pr);
		print('U', ty - sy + 1, pr);
		print('R', tx - sx + 1, pr);
		print('D', 1, pr);

		print('R', 1, pr);
		print('D', ty - sy + 1, pr);
		print('L', tx - sx + 1, pr);
		print('U', 1, pr);

		pr.println();
	}

	private static void print(char c, int n, Printer pr) {
		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < n; i++) {
			sb.append(c);
		}

		pr.print(sb);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 9928
import numpy
N,K = map(int,input().split())
a= [input().split() for l in range(2*K)]
b=a[1::2]

k=[0]*N
for i in range(K) :
    for j in range(N):
        if (b[i].count(str(j+1))) > 0 :
            k[j]+=1

count=0
for i in range(N):
    if k[i]==0:
        count+=1

print(count)


Measured memory_bytes: 27612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

int main(){
  char a,b,c,d,e,f;
  cin >> a >> b >> c >> d >> e >> f;
  bool suc = 1;
  if(a != f) suc = 0;
  if(b != e) suc = 0;
  if(c != d) suc = 0;
  if(suc) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    n -= 1
    ans = []
    while n >= 0:
        ans.append(chr(ord("a")+n%26))
        n //= 26
        n -= 1
    print(*ans[::-1],sep="")
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 67416
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(new InputStreamReader(System.in));
		char a = sc.next().charAt(0);
		char b = sc.next().charAt(0);
		char c = sc.next().charAt(0);

		System.out.println(String.valueOf(a).toUpperCase()+String.valueOf(b).toUpperCase()+String.valueOf(c).toUpperCase());

	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using ll = long long;
int main()
{
  int X, Y, Z, K;
  std::cin >> X >> Y >> Z >> K;
  std::vector<ll> W;
  std::vector<ll> A(X), B(Y), C(Z);
  for(int i = 0; i < X; i++){std::cin >> A[i];}
  for(int i = 0; i < Y; i++){std::cin >> B[i];}
  for(int i = 0; i < Z; i++){std::cin >> C[i];}
  for(int i = 0; i < X; i++){
  	for(int j = 0; j< Y; j++){
      W.push_back(A[i]+B[j]);
    }
  }
  std::sort(W.begin(),W.end(),std::greater<ll>{});
  W.resize(K);
  std::vector<ll> V;
  for(int i = 0; i < K; i++){
    for(int j = 0; j < Z; j++){
      V.push_back(W[i]+C[j]);
    }
  }
  std::sort(V.begin(),V.end(),std::greater<ll>{});
  for(int i = 0; i < K; i++){std::cout << V[i]<<std::endl;}
  return 0;
}

Measured memory_bytes: 42856
#include <stdio.h>
int main(void){
    
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    
    if(x-r>=0&&x+r<=W&&y-r>=0&&y+r<=H){
          printf("Yes\n");
    }
    else printf("No\n");
    
    return 0;
}



Measured memory_bytes: 2100
from collections import defaultdict
from itertools import permutations

n, c = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(c)]
cmat = [list(map(int, input().split())) for _ in range(n)]

dcnt = [defaultdict(int) for _ in range(3)]
for i, ci in enumerate(cmat, 1):
    for j, cij in enumerate(ci, 1):
        mod = (i + j) % 3
        dcnt[mod][cij - 1] += 1

ans = 10 ** 9
for color in permutations(range(c), 3):
    tmp = 0
    for i, cnt in enumerate(dcnt):
        tmp += sum(d[k][color[i]] * cnt[k] for k in cnt)
    ans = min(ans, tmp)
print(ans)


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

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var a = int.Parse(line[1]);
        var b = int.Parse(line[2]);
        line = Console.ReadLine().Trim().Split(' ');
        var w = Array.ConvertAll(line, long.Parse);
        var ret1 = (decimal)w.OrderByDescending(x => x).Take(a).Average();
        Console.WriteLine("{0:0.000000}", ret1);
        var d = new Dictionary<long, int>();
        for (int i = 0; i < n; i++)
            if (d.ContainsKey(w[i])) d[w[i]]++;
            else d[w[i]] = 1;
        var w2 = d.OrderByDescending(x => x.Key).Select(x => x.Value).ToArray();
        var ret2 = getAns2(w2, a, b);
        Console.WriteLine(ret2);
    }
    public static long getAns2 (int[] w , int a , int b)
    {
        
        var ret = 0L;
        var w0 = w[0];
        if (a == w0) return 1;
        if (a < w0)
        {
            var imax = Math.Min(b, w0);
            for (int i = a; i <= imax; i++)
                ret += Combi(w0, i);
            return ret;
        }
        else
        {
            var aa = a;
            var p = 0;
            while (true)
            {
                if (aa - w[p] > 0) { aa -= w[p]; p++; }
                else if (aa - w[p] < 0) return Combi(w[p], aa);
                else return 1;
            }
        }
    }
    public static long Combi(int n, int r)
    {
        if (n < 2 * r) r = n - r;
        var dp = new long[n + 1, r + 1];
        for (int i = 0; i <= n; i++)
            for (int j = 0; j <= r; j++)
                if (i == j | j == 0) dp[i, j] = 1;
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= r; j++)
                dp[i, j] = dp[i - 1, j] + dp[i - 1, j - 1];
        return dp[n, r];
    }
}

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

char v[112345];

int main () {

	string s;
	cin >> s;

	int top = 0;

	for (int i = 0; i < s.size(); ++i) {
		v[top++] = s[i];
		while (top >= 3 && v[top - 3] != v[top - 1])
			v[top - 2] = v[--top];
	}

	if ((s.size() ^ top) & 1)
		cout << "First\n";
	else
		cout << "Second\n";

	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>

char s[4];

int get(int mask) {
	int ans = s[0] - '0';
	for (int i = 0; i < 3; i++)
		ans += (s[i + 1] - '0') * (((mask >> i) & 1) ? -1 : +1);
	return ans;
}

void print(int mask) {
	printf("%c", s[0]);
	for (int i = 0; i < 3; i++) {
		printf("%c%c", (((mask >> i) & 1) ? '-' : '+'), s[i + 1]);
	}
	printf("=7");
	return;
}

int main() {
	scanf("%s", s);
	for (int mask = 0; mask < 8; mask++)
		if (get(mask) == 7)
			return print(mask), 0;
	return 0;
}

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

int main()
{
    int n, t, a;
    cin >> n >> t >> a;
    double mi = 1e9;
    int mj = -1;
    for (int i = 0; i < n; ++i)
    {
        double h;
        cin >> h;
        double d = fabs(a - (t - h * 0.006));
        if (d < mi)
            mi = d, mj = i;
    }
    cout << mj + 1;
}


Measured memory_bytes: 256
from collections import Counter
import math
n=int(input())
s=[list(input()) for _ in range(n)]
#print(s)
for i in range(n):
    s[i].sort()
    s[i]=" ".join(s[i])
#print(s)
C=Counter(s)
#print(C)
ans=0
for k,v in C.items():
    ans+=v*(v-1)//2
print(ans)

Measured memory_bytes: 32084
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: u32,
        a: u32,
    }
    println!("{}", n * n - a);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
// greater<int>()
typedef long long ll;
ll GCD(ll x, ll y) { return y ? GCD(y, x%y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }

using namespace std;


int main() {

	int H, W;
	while (true) {
		cin >> H >> W;

		if (W == 0 && H == 0)break;

		for (int j = 0; j < H; j++)
		{
			for (int i = 0; i < W; i++)
			{
				if (i == 0 || i == W-1 || j == 0 || j == H-1) {
					cout << "#";
				}
				else {
					cout << ".";

				}
			}
			cout << endl;
		}
		cout << endl;

	}

}



Measured memory_bytes: 3088
#define _GLIBCXX_DEBUG

#include"bits/stdc++.h"
using namespace std;

//loops
#define REP(i,n) for(int i=0;i<(ll)(n);i++)
#define REPD(i,n) for(int i=(ll)(n)-1;i>=0;i--)
#define OneToN(i,n) for(int i=1;i<(ll)(n+1);i++)
#define ZeroToN(i,n) for(int i=0;i<(ll)(n+1);i++)
#define AToB(i,a,b) for(int i=a;i<(ll)(b+1);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)

//bitsearch
#define BITSEARCH(bit, n) for (int bit = 0; bit < (1<<n); ++bit)
#define isOne(bit, i) bit & (1<<i)


//arrays
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define add push_back


#define remove_unique(v) v.erase(unique(ALL(v)), v.end())

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

//pair
#define fir first
#define sec second
#define mp make_pair

//types
#define ll long long
#define vec vector
#define cord2d pair<int,int>
//UNCOMMENT WHEN NEEDED
//#define int ll

//input
template <class T> T get(){ T s; cin >> s; return(s);}
#define gi get<int>()
#define gs get<string>()

template <class T> vector<T> getv(int n) { vec<T> v(n); REP(i, n) cin >> v[i]; return v; }
#define gim(n) getv<int>(n)
#define gsm(n) getv<string>(n)

//output
void print(int a){ cout << a << endl; }
void print(long long a){ cout << a << endl; }
void print(string a){ cout << a << endl; }
void print(char a){ cout << a << endl; }
void print(double a){ cout << a << endl; }
void print(double a, int dig){ cout << std::setprecision(dig) << a << endl; }

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T = int>
void print(vec<T> v){ cout << v << endl; }

template <class T = int>
void print2dVec(vec<vec<T>> v2d){for(vec<T> v: v2d) {print(v);}}

void YesNo1(bool i = true){ return print(i?"Yes":"No"); }
void YESNO2(bool i = true){ return print(i?"YES":"NO"); }

//debug output
#define var_name(var) #var
template <class T> void debug(T &var, int nest = 0, string before = "") { cout << string("          ", nest) << before; print(var); }

//name replacement
#define y0 y0__
#define y1 y1__
#define j0 j0__
#define j1 j1__

//bool lambdas
#define lamb(exp) [](auto i){return exp;}
#define isEven [](int i){return i % 2 == 0;}
#define isOdd [](int i){return i % 2 != 0;}

//constants
const ll INF = 1e18;
const int MOD = 10000007;

//maths
int factorial(int k){ int sum = 1; for (int i = 1; i <= k; ++i) { sum *= i; } return sum; }
int gcd(int a, int b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

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

void Main() {
    //code here
    string s = gs;
    bool bad = false;
    REP(i, 3) {
        if (s[i] == s[i+1]) bad = true;
    }
    if(bad) print("Bad"); else print("Good");
}

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


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

using ll = long long;
const ll INF = 1LL<<60;
const ll MOD = 1000000007LL;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP2(i,x,n) for(ll i=x;i<(ll)(n);i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define PB push_back
#define MP make_pair
#define F first
#define S second

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}


void solve() {
	ll A, B, K;
    cin >> A >> B >> K;
	
	ll ta=A;
    ll ao=B;
    
    if(ta>K){
    	ta -= K;
        K = 0;
    }
    else
    {
        K -= ta;
    	ta=0;
    }
    
//    cout << ta << K << endl;
    if(ao>K){
    	ao -= K;
        K = 0;
    }
    else
    {
        K -= ao;
    	ao = 0;
    }
    
    cout << ta <<' ' << ao << endl;    
    

}

signed main() {
    

    solve();

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll N = 2e5 + 5, mod = 1e9 + 7;
vector<ll> g[N];
ll a[N], n, sz[N], tmp = 1;

ll ksm(ll a, ll n) {
    ll ans = 1;
    while (n) {
        if (n & 1) ans = ans * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ans;
}

void dfs(int u, int fa) {
    sz[u] = 1;
    for (auto v : g[u]) {
        if (v != fa) {
            dfs(v, u);
            sz[u] += sz[v];
        }
    }
    tmp = tmp * sz[u] % mod;
}

void fun(int u, int fa) {
    for (auto v : g[u]) {
        if (v != fa) {
            a[v] = a[u] * ksm(sz[v], mod - 2) % mod * (n - sz[v]) % mod;
            fun(v, u);
        }
    }
}

int main() {
    cin >> n;
    ll jc = 1;
    for (ll i= 2, u, v; i <= n; ++i) {
        cin >> u >> v;
        g[u].push_back(v), g[v].push_back(u);
        jc = jc * i % mod;
    }
    dfs(1, 0);
    a[1] = tmp;
    fun(1, 0);
    for (int i = 1; i <= n; ++i) {
        printf("%lld\n", jc * ksm(a[i], mod - 2) % mod);
    }
    return 0;
}

Measured memory_bytes: 17776
N = int(input())
A = list(map(lambda x: int(x) - 1, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
prev = -1000
for i in range(N):
    ans += B[A[i]]
    if A[i] - prev == 1:
        ans += C[prev]
    prev = A[i]
print(ans)


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

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

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

ll f(int n){
	string s=to_string(n);
	ll ans =0;
	int sp[3] = {3,5,7};
	int su = sz(s), pj=3;
	rep(i,(ll)pow(pj, su)){
		vector<int> vi(su);
		for(int j=0, wki=i; j<su; j++, wki/=pj){
			vi[su-1-j] = wki%pj;
		}
		ll w = 0;
		int ck=0;
		rep(j,su){
			w *=10;
			w += sp[vi[j]];
			if(vi[j]==0) ck|=1;
			else if(vi[j]==1) ck|=2;
			else if(vi[j]==2) ck|=4;
		}
		if(ck ==7 && w <= n){
			ans++;
		}
	}
	return ans;
}



int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	ll ans =0;
	string s=to_string(n);
	int cn= sz(s);
	
	rep2(i,3, cn+1){
		if(i==cn) ans += f(n);
		else{
			ll c=1;
			rep(j,i) c*=10;
			ans += f(c-1);
		}
	}
	
	
	cout << ans <<"\n";

	
	
	return 0;
}


Measured memory_bytes: 256
// ayy
// ' lamo
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld; //CARE
typedef complex<ld> pt;
#define fi first
#define se second
#define pb push_back
const ld eps=1e-8;
const int inf=1e9+99;
const ll linf=1e18+99;
const int P=1e9+7;






void fail() {
	cout<<-1<<endl;
	exit(0);
}






int32_t main() {
	string s; cin>>s;
	string t="";
	for(char c:s) if(c!='x') t+=c;
	string r=t; reverse(r.begin(),r.end());
	if(r!=t) fail();

	vector<int> v;
	int fr=0;
	for(char c:s) {
		if(c=='x') ++fr;
		else v.pb(fr), fr=0;
	}
	v.pb(fr);

	assert(v.size() == t.size()+1);
	int Z=0;
	for(int i=0;i*2<(int)v.size();i++) {
		Z+=max(v[i],v[v.size()-1-i])-min(v[i],v[v.size()-1-i]);
	}
	cout<<Z<<endl;
}













Measured memory_bytes: 1148