akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define ll long long

const ll mod = 1e9 + 7;
const ll maxn = 2e5 + 5;
const double pi = 3.1415926535897932384626433832795028841971693993751058209749445923078;
//iostream::sync_with_stdio(false);

int main()
{
	int n, m;
	int p[105];
	cin >> n >> m;
	double sum = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
		sum += p[i];
	}
	sum /= (4 * m);
	int h = 0;
	for (int i = 0; i < n; i++)
	{
		if (p[i] >= sum)
		{
			h++;
		}
	}
	if (h >= m)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n,h,w ;
  cin >> n >> h >> w ; 
  int ans = 0 ;
  
  rep(i,n){
    int a,b ; 
    cin >> a >> b ; 
    if((h<=a) && (w<=b)) ans ++ ;
  }
  
  cout << ans << endl ;


}


Measured memory_bytes: 3628
#include <iostream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <limits>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#include <cmath>
#include <complex>

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

const int INFL = (int)1e9;
const ll INFLL = (ll)1e18;
const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loopll(i, n) for(ll i = 0; i < (ll)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopll1(i, n) for(ll i = 1; i <= (ll)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = (ll)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define Looprll1(i, n) for(ll i = (ll)n; i >= 1; i--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(i, vector.size()) { cout << vector[i] << " "; } cout << endl;
#define printmx(matrix) Loop(i, matrix.size()) { Loop(j, matrix[i].size()) { cout << matrix[i][j] << " "; } cout << endl; }
#define rndf(d) (ll)((double)(d) + (d >= 0 ? 0.5 : -0.5))
#define floorsqrt(x) ((ll)sqrt((double)x) + ((ll)sqrt((double)x) * (ll)sqrt((double)x) <= (ll)(x) ? 0 : -1))
#define ceilsqrt(x) ((ll)sqrt((double)x) + ((ll)x <= (ll)sqrt((double)x) * (ll)sqrt((double)x) ? 0 : 1))
#define rnddiv(a, b) ((ll)(a) / (ll)(b) + ((ll)(a) % (ll)(b) * 2 >= (ll)(b) ? 1 : 0))
#define ceildiv(a, b) ((ll)(a) / (ll)(b) + ((ll)(a) % (ll)(b) == 0 ? 0 : 1))
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)

/*******************************************************/

int main() {
	int n; cin >> n;
	vector<ll> a(n), b(n);
	Loop(i, n) {
		cin >> a[i] >> b[i];
	}
	ll x = a[0], y = b[0];
	ll c;
	Loop1(i, n - 1) {
		c = max(ceildiv(x, a[i]), ceildiv(y, b[i]));
		x = a[i] * c;
		y = b[i] * c;
	}
	cout << x + y << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <ctime>
#include <complex>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
ll pcount(ll x) {return __builtin_popcountll(x);}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	int n; cin >> n;
	vl a(n); rep(i,n) cin >> a[i];
	ll mx = 0;
	ll ans = 0;
	rep(i,n){
		if(mx <= a[i]) chmax(mx, a[i]);
		else{
			ans += mx - a[i];
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 4840
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
   string s;cin>>s;
   int n = s.size();
   int res = 0;
   rep(i,n){
       if(i==0)continue;
       int sz = s.size();
       s.erase(sz-2,2);
       sz -= 2;
       res += 2;
       string t = s.substr(0,sz/2),u = s.substr(sz/2,sz/2);
       if(t==u){
           cout<<sz;
           return 0;
       }
   }
}



Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        // input
        int age = scan.nextInt();
        int price = scan.nextInt();

        // answer
        if(age >= 13){
            System.out.println(price);
        } else if (age >= 6){
            System.out.println(price / 2);
        } else {
            System.out.println(0);
        }

    }
}

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

int main()
{
	int a, b, x;

	cin >> a >> b >> x;

	if (a+b>=x && a<=x){
		cout << "YES" << endl;
	}

	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=[]
H=0
flag=0

for i in range(N):
    a,b,c=map(int,input().split())
    A.append([a,b,c])

A.sort(key=lambda x: -x[2])
for x in range(101):
    for y in range(101):
        H=A[0][2]+abs(A[0][0]-x)+abs(A[0][1]-y)
        flag=0
        for n in range(N):
            if A[n][2] != max(H-abs(A[n][0] - x) - abs(A[n][1] - y,),0):
                flag=1
        if flag==0:
            print(str(x)+" "+str(y)+" "+str(H))
            exit(0)



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


def solve(N, C):
    cnt = 0
    i = 0
    j = N - 1
    while i < N and j >= 0:
        while True:
            if C[i] == "W":
                break
            i += 1
            if i >= N:
                break
        while True:
            if C[j] == "R":
                break
            j -= 1
            if j < 0:
                break
        if i >= j:
            break
        else:
            cnt += 1
            i += 1
            j -= 1
    print(cnt)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))
    S = next(tokens)
    C = [S[i] for i in range(N)]
    solve(N, C)

if __name__ == '__main__':
    main()

Measured memory_bytes: 86924
// Best practice
 
#include<bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii 		pair<int,int>
#define psi 		pair<string,int>
#define vi 			vector<int>
#define vpii  		vector<pii>
#define vvi 		vector<vi>
#define sz(x)	    (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define prec(n) 	fixed<<setprecision(n)
#define ini(a, i) 	memset(a, i, sizeof(a))
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
	#ifndef LOCAL
	~debug() { cerr << endl; }
	eni(!=) cerr << boolalpha << i; ris; }
	eni(==) ris << range(begin(i), end(i)); }
	sim, class b dor(pair < b, c > d) {
	  ris << "(" << d.first << ", " << d.second << ")";
	}
	sim dor(rge<c> d) {
	  *this << "[";
	  for (auto it = d.b; it != d.e; ++it)
	    *this << ", " + 2 * (it == d.b) << *it;
	  ris << "]";
	}
	#else
	sim dor(const c&) { ris; }
	#endif
};
#define imie(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
 
// const int dx[4] = { -1, 1, 0, 0};
// const int dy[4] = {0, 0, -1, 1};
// int dX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
// int dY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
 
 
// Code from Here -------------------------------------------------------------------------------

signed main() {
	tezz
 
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n;
	cin >> n;
	cout << (n/2 + (n%2!=0)) << endl;
 
	return 0;
}  

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,a=1,b=1;
  cin >> n;
  int f=0;
  while(n>0)
  {
    a=n%10;
    if(a==7)
    {
      f=1;
      break;
    }
    else
    {
      n=n/10;
    }
  }
  if(f==1)cout<<"Yes";
  else cout<<"No";

}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	llong X, K, D;
  cin >> X >> K >> D;
  X = abs(X);
  llong ans = 0;
  llong q = X/D;
  llong r = X%D;
  if(q<=K){
    if(K%2==q%2){
      ans = r;
    }else ans = D-r;
  }else{
    ans = X - D*K;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 10000
	maxBufSize     = 10000000
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat() float64 {
	sc.Scan()
	f, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func exclude(str string, i int) string {
	ret := str[:i]
	ret += str[i+1:]
	return ret
}

func perm(pat, str string, ret *[]string) {
	if len(str) == 0 {
		*ret = append(*ret, pat)
		return
	}

	for i := 0; i < len(str); i++ {
		perm(pat+string(str[i]), exclude(str, i), ret)
	}
}

func fact(n int) int {
	if n <= 0 {
		return 1
	}
	return n * fact(n-1)
}

func main() {
	n := nextInt()
	a := 0
	b := 0
	for i := 0; i < n; i++ {
		a *= 10
		a += nextInt()
	}
	for i := 0; i < n; i++ {
		b *= 10
		b += nextInt()
	}

	str := ""
	for i := 0; i < n; i++ {
		str += strconv.Itoa(i + 1)
	}
	l := fact(n)
	ret := make([]string, 0, l)
	perm("", str, &ret)

	as := strconv.Itoa(a)
	bs := strconv.Itoa(b)
	var ai, bi int
	for i := 0; i < l; i++ {
		reti := ret[i]
		if as == reti {
			ai = i
		}
		if bs == reti {
			bi = i
		}
	}
	if ai >= bi {
		fmt.Println(ai - bi)
	} else {
		fmt.Println(bi - ai)
	}
}


Measured memory_bytes: 2176
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
char s[200010];
int l[200010],r[200010],n,a,b,c,d;
int main()
{
	scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
	scanf("%s",s+1);s[0]=s[n+1]='#';
	if(s[a]=='#'||s[b]=='#'||s[c]=='#'||s[d]=='#'||a==b||c==d) return puts("No"),0;
	l[1]=1;r[n]=n;
	for(int i=2;i<=n;i++) l[i]=i;
	for(int i=n-1;i>=1;i--)
	{
		r[i]=i;
		if(s[i+1]!='#') r[i]=r[i+1];
		else if(s[i+2]!='#') r[i]=r[i+2];
	}
	if(a>b) swap(a,b),swap(c,d);
	if(l[a]<=c&&r[a]>=c&&l[b]<=d&&r[b]>=d)
	{
		if(c<d) return puts("Yes"),0;
		else
		{
			for(int i=b;i<=d;i++)
				if(s[i]=='.'&&s[i-1]=='.'&&s[i+1]=='.') return puts("Yes"),0;
			return puts("No"),0;
		}
	}
	else return puts("No"),0;
}

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

int func(int a){
  int ans=0;
  while(a>0){
    a/=10;
    ans++;
  }
  return ans;
}

int main() {
  int n,a=0;cin>>n;
  if(func(n)==1){
    a=n;
  }
  if(func(n)==2){
    a=9;
  }
  if(func(n)==3)a=n-90;
  if(func(n)==4)a=909;
  if(func(n)==5)a=n-9090;
  if(func(n)==6)a=90909;
  cout<<a<<endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main() {
    int X, Y;
    cin >> X >> Y;
    cout << X + Y / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ui unsigned int
#define ull unsigned long long
#define db long double
#define pii pair<int,int>
#define pli pair<ll,int>
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<vi>
#define lb lower_bound
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,b,a) for(int i=(b);i>=(a);--i)
#define rep0(i,a,b) for(int i=(a);i<(b);++i)
#define fore(i,a) for(int i=0;i<a.size();++i)
#define gc() getchar()
#define ls x<<1,l,m
#define rs x<<1|1,m+1,r
inline ll rd()
{
	ll x=0,w=1;char c=gc();while(!isdigit(c)&&c!='-')c=gc();
	if(c=='-')c=gc(),w=-1;while(isdigit(c))x=x*10+c-48,c=gc();return x*w;
}
const int N=2005;
int n,m,S,T,ans,fa[N][N],vis[N][N];vi g[N];vector<pii>V;
void pre(int x,int o){for(int y:g[x])if(y!=fa[o][x])fa[o][y]=x,pre(y,o);}
void dfs(int x)
{
	vis[S][x]=T;
	for(int y:g[x])if(y!=fa[S][x])
	{
		if(vis[S][y])V.pb(mp(T,y));else dfs(y);
	}
}
void sol(int x,int p,int o)
{
	if(vis[o][x]==x)ans++,o=x;
	for(int y:g[x])if(y!=p)sol(y,x,o);
}
int main()
{
	n=rd();m=rd();
	rep(i,1,n-1){int u=rd(),v=rd();g[u].pb(v);g[v].pb(u);}
	rep(i,1,n)pre(i,i);
	rep(i,1,m)
	{
		int u=rd(),v=rd();V.pb(mp(u,v));
		while(!V.empty())
		{
			u=V.back().X;v=V.back().Y;V.pop_back();
			while(u!=v&&vis[u][v])u=vis[u][v];
			while(v!=u&&vis[v][u])v=vis[v][u];
			if(u==v)continue;
			S=u;T=v;dfs(T);S=v;T=u;dfs(T);
		}
	}
	rep(i,1,n)for(int j:g[i])sol(j,i,i);
	printf("%d\n",ans/2);return 0;
}


Measured memory_bytes: 31872
from collections import defaultdict
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
arr = defaultdict(int)
for k, v in Counter(a).items():
    arr[k] = v
q = int(input())
bc = []
for _ in range(q):
    b, c = map(int, input().split())
    bc.append((b, c))

whole = sum([x * y for x, y in arr.items()])

for b, c in bc:
    arr[c] += arr[b]
    tmp = arr[b]
    arr[b] = 0
    whole += (c - b) * tmp
    print(whole)

Measured memory_bytes: 36052
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long int n,k,a,b;
  long long int num[100001];
  for(int i=1;i<=100000;i++){
    num[i]=0;
  }
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>a>>b;
    num[a]+=b;
  }
  int j=0;
  while(k>0){
    j++;
    k-=num[j];
  }
  cout<<j<<endl;
  return 0;
}


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

int64_t solve(int64_t p){
    if(p > 1){
        return 2 * solve(p / 2) + 1;
    }
    else if(p == 1){
        return 1;
    }
    else return 0;
}
int main(){
    int64_t h;
    cin >> h;
    int64_t ans = solve(h);
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main()
{
    string S;
    cin >> S;

    int ans = 0;
    for (int i = 0; i < S.size(); i++)
    {
        if (i > S.size() - i - 1)
            break;
        if (S[i] != S[S.size() - 1 - i])
        {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
long long  mod = 1000000007;
int X[100000], S[100000];
int main()
{
	int N, M;
	int an = 0;
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M; i++) {
		scanf("%d", &X[i]);
	}
	sort(X, X + M);
	an = X[M - 1] - X[0];
	for (int i = 0; i < M - 1; i++) {
		S[i] = X[i + 1] - X[i];
	}
	sort(S, S + M - 1, greater<int>());
	if (N >= M) {
		printf("0");
	}
	else {
		for (int i = 0; i < N-1; i++) {
			an -= S[i];
		}
		printf("%d", an);
	}
	return 0;
}

Measured memory_bytes: 896
"use strict";
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var x = o.a();
  var y = o.a();
  var ans = 0;
  if(x === 1)ans += 300000;
  if(x === 2)ans += 200000;
  if(x === 3)ans += 100000;
  if(y === 1)ans += 300000;
  if(y === 2)ans += 200000;
  if(y === 3)ans += 100000;
  if(x === 1 && y === 1)ans += 400000;
  return ans;
}

Measured memory_bytes: 22964
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int n;
    string s;
    cin >> n >> s;
    ll w = 0;
    rep(i, n) w += (s[i] == '.');
    ll ans = INT32_MAX;
    ll b = 0;
    rep(i, n)
    {
        ans = min(ans, b + w);
        b += (s[i] == '#');
        w -= (s[i] == '.');
    }

    ans = min(ans, b + w);
    cout << ans << endl;

    return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumlate(all(a),0)
#define pb push_back
#define fst first
#define snd second
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  int n; cin >> n;
  set<char> st; char c;
  rep(i,n){ cin >> c; st.insert(c);}
  if(st.size() == 3) cout << "Three\n";
  else cout << "Four\n";
}


Measured memory_bytes: 256
import sys

change = False
debug = False


def print_err(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)


def main():
    """
    0 と 1 からなる文字列 S が与えられます。
    以下の操作を好きな回数繰り返すことで S の要素をすべて 0 にできるような、|S| 以下の最大の整数 K を求めてください。
    S の長さ K 以上の連続する区間 [l,r] を選ぶ(すなわち、r−l+1≥K が満たされる必要がある)。
    l≤i≤r なるすべての整数 i に対し、Si が 0 なら Si を 1 に、Si が 1 なら Si を 0 に置き換える。
    制約
    1≤|S|≤105
    Si(1≤i≤N) は 0 または 1 である
    """
    S = input()

    f(S)


def f(S):
    """
    最大となるKより、1つずつ変えるのは最後の手段
    ※K以上の反転可能であるため

    000: OK
    001, 110:  -> 100, 011
    010, 101:
      11を最終的に反転するように修正していく
        101: 1-3 all
        011: 1-2
        000: 2-3
    011, 100: 11を反転でOK

    0001 となっているとき
    K=3とすれば
    000 をまず反転、その後K+1まで反転すれば、初期状態からK+1番目のみ反転できる
    """
    n = len(S)
    ans = n

    # 反転確認
    table = str.maketrans('01', '10')
    for k in range(1, n):
        if S[k] == S[k - 1]:
            continue

        t = max(k, n - k)
        ans = min(ans, t)

        # 反転を利用して異なる部分を変更
        # 要素数の多い方を対称の異なる文字含めて反転

        # CPython3, PyPy: TLE
        if change:
            if t == k:
                S = S[:t].translate(table) + S[t:]
            else:
                S = S[:k] + S[k:].translate(table)

            if debug:
                print_err("t:", t, "k:", k, "S:", S, sep="\t")

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 40048
#include <bits/stdc++.h>
using namespace std;
#define ok cout << "Yes" << endl;
#define muripo cout << "No" << endl;


int main(){
  int h,w;
  cin >> h >> w;
  char field[h+1][w+1];
  int se;
  se=9;
  
  int i,k;
  for (i=0;i<h;i++){
    
    for (k=0;k<w;k++){
      cin >> field[i][k];
    }
    
  }
  i=0;
  int s;
  
  //一番左列
  for (i=1;i<h-1;i++){
    
    if ( field[i][0] == '#' ){
      
      if ( field[i-1][0] == '#' || field[i+1][0] == '#'){
        continue;
      }
      
      else if ( field[i][1] == '#' ){
        continue;
      }
      
      else{
        se=7;
      }
      
    }
  }
    
    i=0;
    
    
    //一番⇨列
    for (i=1;i<h-1;i++){
      
    if ( field[i][w-1] == '#' ){
      
      if ( field[i-1][w-1] == '#' || field[i+1][w-1] == '#'){
        
        continue;
      }
      
      else if ( field[i][w-2] == '#' ){
        continue;
      }
      
      
      else{
        se=7;
      }
      
    }
    }
      
      //一番上列
   for (i=1;i<h-1;i++){
    if ( field[0][i] == '#' ){
      
      if ( field[0][i-1] == '#' || field[0][i+1] == '#'){
        continue;
      }
      
      else if ( field[1][i+1] == '#' ){
        continue;
      }
      
      else{
        se=7;
      }
      
    }
      }

    //一番下列
     for (i=1;i<h-1;i++){
    if ( field[h-1][i] == '#' ){
      
      if ( field[h-1][i-1] == '#' || field[h-1][i+1] == '#'){
        continue;
        
      }
      
      else if ( field[h-2][i] == '#' ){
        continue;
      }
      
      else{
        se=7;
      }
      
    }
      }

//上下左右
  if (field[0][0]=='#'){
       if (field[1][0] != '#' && field[0][1] != '#'){
         se=7;
       }
     }
  
  if (field[h-1][0]=='#'){
       if (field[h-2][0] != '#' && field[h-1][1] != '#'){
         se=7;
       }
     }
  
  if (field[0][w-1]=='#'){
       if (field[1][w-1] != '#' && field[0][w-2] != '#'){
         se=7;
       }
     }
  if (field[h-1][w-1]=='#'){
       if (field[h-2][w-1] != '#' && field[h-1][w-2] != '#'){
         se=7;
       }
     }
  
  //中心部
  
  int tate,yoko;
  
  for (tate=1;tate<h-1;tate++){
    for (yoko=1;yoko<w-1;yoko++){
      if(field[tate][yoko]=='#'){
        //上下
        if(field[tate][yoko+1]=='#' || field[tate][yoko-1]=='#'){
          continue;
        }
        else if(field[tate+1][yoko]=='#' || field[tate-1][yoko]=='#'){
          continue;
        }
        else {
          se=7;
        }
      }
    }
  }
  
  if(se==7){
    muripo;
  }
  else {
    ok;
  }
}


Measured memory_bytes: 256
MOD = 10**9+7
N, M = [int(x) for x in input().split()]
a_list = []
if (M != 0):
    a_list = [int(input()) for _ in range(M)]
dp = [-1] * (N+1)
dp[0], dp[1] = 1, 1
for a in a_list:
    dp[a] = 0
for i in range(1, N+1):
    if (dp[i] == -1):
        dp[i] = (dp[i-1] + dp[i-2]) % MOD
print(dp[N])


Measured memory_bytes: 50008
require 'set'
N = gets.to_i
S = gets.chomp

def common_char_nums(a, b)
  (Set.new(a.scan(/./)) & Set.new(b.scan(/./))).size
end

puts(
  (0...N).map do |i|
    common_char_nums(S[0...i], S[i...N]) 
  end.max
)


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

int main(){
	string s,ans;

	cin >>s;
	for(int i=0;i<(int)s.size();i++){
		if(s[i]=='0')ans+='0';
		else if(s[i]=='1')ans+='1';
		else if(s[i]=='B'){
			if((int)ans.size()<1)continue;
			else ans.pop_back();
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    from collections import deque
    from itertools import product

    a, b, c, d, e, f = map(int, input().split())

    water_a = []

    i = 0
    while i * a * 100 <= f:
        water_a.append(i * a * 100)
        i += 1

    water = []
    for w in water_a:
        i = 0
        while i * b * 100 + w <= f:
            water.append(i * b * 100 + w)
            i += 1

    sugar_c = []
    i = 0
    while i * c <= f:
        sugar_c.append(i * c)
        i += 1

    sugar = []
    for s in sugar_c:
        i = 0
        while i * d + s <= f:
            sugar.append(i * d + s)
            i += 1

    conc = -1
    ans = None
    for w, s in product(water, sugar):
        if w + s == 0: continue
        if w + s > f: continue
        if s > w // 100 * e: continue
        t_conc = 100 * s / (w + s)
        if t_conc > conc:
            conc = t_conc
            ans = w + s, s
    print(*ans)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()


Measured memory_bytes: 14804
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back 
#define mod 1e9+7
vector<int>dp; 

int min_cost(int b[],int n){
//	cout<<n<<" ";
         if(n==0){
		   dp[n]=b[n]; 
		   return 0;}
		 if(n==1)
		    return  dp[n]=abs(b[n]-b[n-1]);
         if(dp[n] !=-1)
         return dp[n];
         
       return  dp[n]=min( (abs(b[n]-b[n-1])+min_cost(b,n-1)),
                           (abs(b[n]-b[n-2])+min_cost(b,n-2) ) );
                           
         

}

int main(){
      ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);    
          int n;
             cin>>n;
             dp.resize(n+1);
             for(int i=0; i<=n; i++)
               dp[i]=-1;
        //     memset(dp,-1,sizeof(dp));
        
             int b[n];
             for(int i=0; i<n; i++)
                cin>>b[i];
                
        //  cout<<min_cost(b,n-1)<<endl; 
            dp[0]=0;
            dp[1]=abs(b[1]-b[0]);
            for(int i=2;i<n; i++){
			  
			   dp[i]=min( abs(b[i]-b[i-1])+dp[i-1],abs(b[i]-b[i-2])+dp[i-2]);
			   //cout<<dp[i]<<" ";
			  
			}
            cout<<dp[n-1]<<endl;
                 
    }
//a z q !

Measured memory_bytes: 1024
/***************************************************
 * Problem Name : B - Strings with the Same Length.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2019-12-22
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    //~ cout << setprecision (10);
    //~ cout << fixed;
    string s, t;
    int n;
    cin >> n;
    cin >> s >> t;

    for (int i = 0; i < (int) s.size(); i++) {
        cout << s[i] << t[i];
    }

    nl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<utility>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int N;
int cross(pair<int,int>a,pair<int,int>b)
{
	return a.first*b.second-a.second*b.first;
}
bool in(pair<pair<int,int>,pair<int,int> >L,pair<int,int>p)
{
	int crs=cross(make_pair(L.first.first-p.first,L.first.second-p.second),
		make_pair(L.second.first-p.first,L.second.second-p.second));
	if(crs!=0)return false;
	int norm=(L.first.first-L.second.first)*(L.first.first-L.second.first)
		+(L.first.second-L.second.second)*(L.first.second-L.second.second);
	int norma=(L.first.first-p.first)*(L.first.first-p.first)
		+(L.first.second-p.second)*(L.first.second-p.second);
	int normb=(p.first-L.second.first)*(p.first-L.second.first)
		+(p.second-L.second.second)*(p.second-L.second.second);
	return norm>=norma&&norm>=normb;
}
main()
{
	while(cin>>N,N)
	{
		map<string,int>id;
		vector<pair<pair<int,int>,pair<int,int> > >A[10];
		int sz=0;
		for(int i=0;i<N;i++)
		{
			string s;cin>>s;
			int now;
			if(id.find(s)!=id.end())now=id[s];
			else now=id[s]=sz++;
			vector<pair<int,int> >Ps;
			int x,y;
			while(cin>>x,x>=0)
			{
				cin>>y;
				Ps.push_back(make_pair(x,y));
			}
			for(int i=0;i<Ps.size();i++)
			{
				A[now].push_back(minmax(Ps[i],Ps[(i+1)%Ps.size()]));
			}
		}
		int G[10]={};
		for(int i=0;i<sz;i++)for(int j=i+1;j<sz;j++)
		{
			bool flag=false;
			for(pair<pair<int,int>,pair<int,int> >p:A[i])
			{
				for(pair<pair<int,int>,pair<int,int> >q:A[j])
				{
					if(in(p,q.first)&&in(p,q.second)
						||in(q,p.first)&&in(q,p.second)
						||p.first!=q.first&&in(p,q.first)&&in(q,p.first)
						||p.first!=q.second&&in(p,q.second)&&in(q,p.first)
						||p.second!=q.first&&in(p,q.first)&&in(q,p.second)
						||p.second!=q.second&&in(p,q.second)&&in(q,p.second))
					{
						flag=true;
					}
				}
			}
			if(flag)
			{
				G[i]|=1<<j;
				G[j]|=1<<i;
			}
		}
		vector<int>ok;
		for(int i=1;i<1<<sz;i++)
		{
			bool take=true;
			for(int j=0;j<sz;j++)
			{
				if(i>>j&1)
				{
					for(int k=j+1;k<sz;k++)
					{
						if(i>>k&1)
						{
							if(G[j]>>k&1)
							{
								take=false;
							}
						}
					}
				}
			}
			if(take)ok.push_back(i);
		}
		vector<int>dp(1<<sz,114514);
		dp[0]=0;
		for(int i=0;i<1<<sz;i++)
		{
			for(int v:ok)
			{
				dp[i|v]=min(dp[i|v],dp[i]+1);
			}
		}
		cout<<dp[(1<<sz)-1]<<endl;
	}
}



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

#define ld			long double
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD         1000000007
#define sd(t) 		scanf("%d",&(t))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define hii 		cout << "hii" << endl
#define okay 		cout << "okay" << endl
#define hey 		cout << "hey" << endl

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE

const int inf = 1e18;
const int mod = 1e9+7;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   
} 

clock_t time_p=clock();
void starboy1299()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

const int N = 1e5+5;
int arr[N];
vi adj[N];
void solve()
{
    int x; cin >> x;

    for(int i=-1000; i<1001; i++){
        for(int j=-1000; j<1001; j++){
            int num1 = pow(i, 5);
            int num2 = pow(j, 5);
            if(num1-num2 == x){
                cout << i << " " << j << endl;
                return;
            }
        }
    }

    // cout << pow(1, 5) << " " << pow(-32, 5) << endl;
}			 	      	   	        

int32_t main(){
	fast();
    int t = 1;
    // cin>> t;
    for(int i=1; i<=t; i++){
    	// cout << "Case #" << i << ": ";
    	solve();
    }
    starboy1299();
}

Measured memory_bytes: 6680
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;

struct edge {
    int to, cost;
};
typedef vector<vector<edge> > AdjList;
AdjList graph;

typedef pair<int, int> P;

const int INF = 10000000;

vector<int> dist;
vector<int> prever;

void dijkstra(int n, int s){
    dist = vector<int>(n,INF);
    prever = vector<int>(n,-1);
    dist[s] = 0;

    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top();
        que.pop();
        int v = p.second;
        if(dist[v] < p.first){
            continue;
        }
        for(int i=0;i<graph[v].size();i++){
            edge e = graph[v][i];
            if(dist[e.to] > dist[v] + e.cost){
                dist[e.to] = dist[v] + e.cost;
                prever[e.to] = v;
                que.push(P(dist[e.to],e.to));
            }
        }
    }
}

vector<int> get_path(int t){ //頂点tへの最短路
    vector<int> path;
    for(; t != -1;t=prever[t]){
        path.push_back(t);
    }

    reverse(path.begin(), path.end());
    return path;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  // AdjList g(n);
  graph = AdjList(n);
  rep(i, m){
    int from, to;
    cin >> from >> to;
    from--; to--;
    graph[from].push_back({to, 1});
    graph[to].push_back({from, 1});
  }

  dijkstra(n, 0);

  for(auto de : dist){
    if(de == INF){
      cout << "No" << endl;
      return 0;
    }
  }

  vector<int> res(n);
  queue<int> q;
  vector<bool> visited(n);
  visited[0] = true;
  q.push(0);

  while(!q.empty()){
    int from = q.front();
    q.pop();

    for(auto a : graph[from]){
      int to = a.to;
      if(visited[to]) continue;
      visited[to] = true;
      res[to] = from;
      q.push(to);
    }
  }

  cout << "Yes" << endl;
  for (int i = 1; i < n; ++i) {
    cout << res[i] + 1 << endl;
  }


}


Measured memory_bytes: 13524
#include <bits/stdc++.h> 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define _GLIBCXX_DEBUG
typedef long long ll;
using namespace std;
int main(){
  int n;
  cin>>n;
  bool ans=false;
  for(int i=1;i<=9;i++){for(int j=1;j<=9;j++){
    if(i*j==n){ans=true;}}}
  if(ans){cout<<"Yes"<<endl;}
  else cout<<"No"<<endl;
}

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

//#define int long long
//using ll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

constexpr ll ABCD_MAX = 9;

string S;

void input() {
	cin>>S;
}

void solve() {
	ll ans = 0;
	ll D=3;
	vector<int> pattern(D+1,0);	
	while(1){
		ll t=S[0]-'0';
		rep(i,3){
			ll s=S[i+1]-'0';
			if(pattern[i]){
				t+=s;
			}else{
				t-=s;
			}
		}
		debug(t);
		if(t==7){
			cout<<S[0];
			rep(i,3){
				if(pattern[i]){
					cout<<'+';
				}else{
					cout<<'-';
				}
				cout<<S[i+1];
			}
			cout<<"=7"<<endl;
			return;
		}
		//カウントアップ 4^nを列挙できる
		pattern[0]++;
		rep(i,D){
			if(pattern[i]==2){
				pattern[i]=0;
				pattern[i+1]++;
			}
		}
		if(pattern[D]>0)break;
	}


	printf("%lld\n", ans);
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
using namespace std;
#define MATH_PI 3.14159265358979323846
int main(){
	ios::sync_with_stdio(false);
	string s1, s2;
	cin >> s1 >> s2;
	if (s1 == s2)
		cout << "H\n";
	else
		cout << "D\n";
endapp:
	//system("pause > nul");
	return 0;
}

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

int main(){
  int m, h;
  string s, t, u;

  while(1){
    cin>>s;
    if(s[0]=='-') break;
    cin>>m;
    for(int i=0;i<m;i++){
      cin>>h;
      u=s.substr(0, h);
      t=s.substr(h, s.length());
      s=t+u;
    }
    cout<<s<<endl;
  }

  return 0;
}

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

int main(){
 int H,W;
  cin>>H>>W;
  vector<string> A(H);
  for(int i=0;i<H;i++){
    cin>>A.at(i);
  }
  for(int i=0;i<W+2;i++){
    cout<<"#";
  }
  cout<<endl;
  for(int i=0;i<H;i++){
    cout<<"#"<<A.at(i)<<"#"<<endl;
  }
  for(int i=0;i<W+2;i++){
    cout<<"#";
  }
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> v(N,0);
    for(auto&& x: v)
        cin >> x;

    reverse(v.begin(), v.end());

    for(int i=0; i<N; ++i){
        cout << v[i];
        if( i!= N-1)
            cout << ' ';
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3076
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n, POT = 0, POH = 0;
	string taro, hanako;
	cin >> n;
	if (n > 1000)
		n = 1000;
	for (int i = 0; i < n; i++){
		cin >> taro >> hanako;
		if (taro == hanako){
			POT++;
			POH++;
		}
		if (taro > hanako)
			POT += 3;
		if (taro < hanako)
			POH += 3;
	}
	cout << POT << " "<<POH << endl;
}


Measured memory_bytes: 3136
import math

a,b = map(int, input().split())

list_a = []
list_b = []
sqrt_a = math.sqrt(a)
sqrt_b = math.sqrt(b)


for i in range(2, int(sqrt_a) ):  
  if (a % (i) == 0):
    list_a.append( i )
    while( a % (i) == 0 ):
      a = a//(i)
if a > 1:
  list_a.append(a)
      
for i in range(2, int(sqrt_b) ):  
  if (b % (i) == 0):
    list_b.append( i )
    while( b % (i ) == 0 ):
      b = b//(i)
if b > 1:
  list_b.append(b)

#print(list_a)
#print(list_b)

set_a = set(list_a)
set_b = set(list_b)

set_ab = set_a & set_b
  
print(len(set_ab) + 1)
      


Measured memory_bytes: 3064
<?php
$haveCardNum = trim(fgets(STDIN));
$cardCheckList = createCardCheckList();
$nullCards = '';
 
for ($i = 0; $i < $haveCardNum; $i++) {
    list($mark, $num) = getInputExplodeBySpaces();
    $cardCheckList[$mark][$num] = 'check';
}
 
foreach ($cardCheckList as $mark => $value) {
    for ($cardNum = 1; $cardNum <= 13; $cardNum++) {
        if (! isset($cardCheckList[$mark][$cardNum])) {
            $nullCards .= sprintf('%s %d', $mark, $cardNum).PHP_EOL;
        }
    }
}

echo $nullCards;
 
function getInputExplodeBySpaces()
{
    return explode(' ', trim(fgets(STDIN)));
}
 
function createCardCheckList()
{
    foreach(array('S', 'H', 'C', 'D') as $mark) {
        $checkList["$mark"] = array_fill(1, 13, null);
    }
    return $checkList;
}

Measured memory_bytes: 15420
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int s,w;
    cin>>s>>w;
    if(w>=s){
        cout<<"unsafe"<<endl;
    }
    else{
        cout<<"safe"<<endl;
    }
}

Measured memory_bytes: 3568
use proconio::input;

fn main() {
    input! {
        a1: u8,
        a2: u8,
        a3: u8,
    }

    solve(a1, a2, a3);
}

fn solve(a1: u8, a2: u8, a3: u8) {
    let s = a1 + a2 + a3;
    match s.cmp(&22) {
        std::cmp::Ordering::Less => println!("win"),
        _ => println!("bust"),
    }
}


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

int main(){
	
	int n;
	char s[10];
	int banyakAC=0, banyakWA=0, banyakTLE=0, banyakRE=0;
	scanf("%d", &n);
	
	for(int i=0; i<n; i++){
		scanf("%s", &s);
		if(strcmp("AC", s)==0){
			banyakAC+=1;
		}
		else if(strcmp(s, "WA")==0){
			banyakWA+=1;
		}
		else if(strcmp(s, "TLE")==0){
			banyakTLE+=1;	
		}
		else if(strcmp(s, "RE")==0){
			banyakRE+=1;		
		}
	}
	
	printf("AC x %d\n", banyakAC);
	printf("WA x %d\n", banyakWA);
	printf("TLE x %d\n", banyakTLE);
	printf("RE x %d\n", banyakRE);
	
	return 0;
}

Measured memory_bytes: 1704
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <vector>
#include <string>
#include <cctype>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <iostream>
#include <algorithm>
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define PER(i,a,b) for(int i=(a);i>=(b);i--)
#define RVC(i,S) for(int i=0;i<(S).size();i++)
#define RAL(i,u) for(int i=fr[u];i!=-1;i=e[i].next)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
     
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
/*============ Header Template ============*/

int main() {
    int n;
    read(n);
    if(n<1200) printf("ABC\n"); else printf("ARC\n");
    return 0;
}

Measured memory_bytes: 256