akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Threading.Tasks;



class Program
{
	//Main
	static void Main(string[] args)
	{
		//出力準備（AutoFlushを切る）
		var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
		Console.SetOut(sw);
		//解答
		Solve();
		//出力終了
		Console.Out.Flush();
	}

	static void Solve()
	{
		//読み込む
		int N = int.Parse(Console.ReadLine());
		bool[] zoro = new bool[N];

		for(int i=0; i<N; i++){
			string[] line = Console.ReadLine().Split(' ');
			if(line[0] == line[1]){
				zoro[i] = true;
			}
		}

		bool found = false;

		for(int i=0; i<N-2; i++){
			if(zoro[i] && zoro[i+1] && zoro[i+2]){
				found = true;
				break;
			}
		}

		if(found){
			Console.WriteLine("Yes");
		}else{
			Console.WriteLine("No");
		}
	}
}


Measured memory_bytes: 17872
n = input()
li = list(map(int, input().split()))

li.sort()
ans = 0
cnt = 0
check = 0

for i in li:
    if i != check:
        if cnt >= check:
            ans += cnt - check
        else:
            ans += cnt

        check = i
        cnt = 1
    else:
        cnt += 1
else:
    if cnt >= check:
        ans += cnt - check
    else:
        ans += cnt

print(ans)

Measured memory_bytes: 14212
/*
	AGC013 A
	長さ N の配列 A が与えられます。 A を何箇所かで切って、A の連続した部分であるようないくつかの数列に分けます。 
	この時、分けられたあとの数列は全て、単調非減少または単調非増加な列になっている必要があります。
	最小で何個の数列に分ければ良いかを求めて下さい。
*/
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;

double EPS = 1e-10;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define int(x) int x; scanf("%d",&x);
#define lint(x) long long x; scanf("%lld",&x);
#define vint(v,n) vector<int> v(n); rep(i,n) scanf("%d", &v[i]);
#define vlint(v,n) vector<lint> v(n); rep(i,n) scanf("%lld", &v[i]);
#define double(x) double x; scanf("%lf",&x);
#define vdouble(v,n) vector<double> v(n); rep(i,n) scanf("%lf", &v[i]);
#define string(x) string x; cin >> x;

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

	int * A = new int[N];
	REP(i, N)
	{
		cin >> A[i];
	}

	int count = 1;
	bool isIncreasing;
	int j = 0;
	for (int i = 0; i < N - 1; i++)
	{
		if (j)
		{
			if ((isIncreasing && A[i] > A[i + 1]) ||
				(!isIncreasing && A[i] < A[i + 1]))
			{
				count++;
				j = 0;
			}
			else
			{
				j++;
			}
		}
		else
		{
			if (A[i] < A[i + 1])
			{
				isIncreasing = true;
				j++;
			}
			else if (A[i] > A[i + 1])
			{
				isIncreasing = false;
				j++;
			}
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 640
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

int main(){
    int k;
    cin >> k;
    ll sum =0;
    for (int a = 1; a <= k; a++){
        for (int b = 1; b <= k; b++){
            for (int c = 1; c <= k; c++){
                int s = min(a, min(b,c));
                for (int i = s; i >= 1; i--){
                    if ((a%i == 0)&&(b%i == 0)&&(c%i == 0)){
                        sum += i;
                        break;
                    }
                }
            }
        }
    }
    cout << sum;
    return 0;
}




Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define pb push_back
#define mp make_pair
typedef pair<ll,ll> P;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};


int main(){
    string S; cin>>S;
    vec d;
    ll N=S.size();
    d.pb(0);
    rep(i,N) d.pb(S.at(i)-'0');
    reverse(ALL(d));
    rep(i,N){
        if(d.at(i)>5) {d.at(i)=10-d.at(i); d.at(i+1)++;}
        if(d.at(i)==5 && d.at(i+1)>=5 && d.at(i+1)<=9) d.at(i+1)++;
    }
    ll ans=0;
    //rep(i,N+1) cout<<d.at(i)<<' ';
    rep(i,N+1) ans+=d.at(i);
    cout<<ans<<endl;

}

Measured memory_bytes: 11896
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <ctime>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
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 vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll 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] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,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";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

struct dat{
	ll d,u,r;
};

int main(){
	ll n,x,d; cin >> n >> x >> d;
	if(d == 0){
		if(x == 0) cout << 1 << endl;
		else cout << n + 1 << endl;
		return 0;
	}
	vector<dat> v(n+2);
	ll t = n*(n-1)/2;
	ll q = x / d;
	ll r = 2 * x % d;
	ll ans = 0;
	rep(i,n+1){
		v[i].d = i*(i-1) - t;
		v[i].u = t - (n-i)*(n-i-1);
		ans += (v[i].u - v[i].d) / 2 + 1;
	}
	vector<map<ll,set<P>>> mse(2);
	v[0].r = 0;
	ll sumq = 0;
	rep(i,n+1){
		//print3(v[i].d, v[i].u, v[i].r);
		ll ab = abs(v[i].d);
		auto itr = lower_bound(all(mse[ab%2][v[i].r]), P(v[i].d, -inf));
		vpl li;
		while(itr != mse[ab%2][v[i].r].end() && (*itr).second <= v[i].u){
			ans -= (min((*itr).first, v[i].u) - max((*itr).second, v[i].d)) / 2 + 1;
			li.emplace_back(*itr);
			itr++;
		}
		for(auto j : li) mse[ab%2][v[i].r].erase(j);
		mse[ab%2][v[i].r].emplace(v[i].u, v[i].d);
		ll q;
		if(x < 0) q = (2 * x - abs(d) + 1) / d;
		else q = 2 * x / d;
		ll r = 2 * x - d * q;
		if(v[i].r + r >= abs(d)){
			if(d < 0) q--;
			else q++;
			v[i+1].r = v[i].r + r - abs(d);
		}else{
			v[i+1].r = v[i].r + r;
		}
		sumq += q;
		v[i+1].d += sumq;
		v[i+1].u += sumq;
		//cout << ans << endl;
	}
	cout << ans << endl;
}

Measured memory_bytes: 36224
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <numeric>

using namespace std;

int main(){
   int n,k;
   cin>>n>>k;
   vector<int> a(n);
   vector<int> ball(n+1);
   for(int i=0;i<n;i++){
      cin>>a[i];
      ball[a[i]]++;
   }
   int num=0;
   for(int i=0;i<=n;i++){
      if(ball[i]>0)num++;
   }
   int ans=0;
   sort(ball.begin(),ball.end());
   int m=0;
   while(num-k>0){
      if(ball[m]>0){
         ans+=ball[m];
         num--;
      }
      m++;
   }
   cout<<ans<<endl;

}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

string s;

int main(){
	cin >> s;
	int ans = 0;
	rep(i,s.size())ans += (s[i]=='1');
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e18;
const ll N =(1e5+5); // TODO : change value as per problem
const ll MOD = 1e9+7;


void solve(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int ans = -INF;
    ans = max(ans,a*c);
    ans = max(ans,a*d);
    ans = max(ans,b*c);
    ans = max(ans,b*d);
    cout << ans << endl;
}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

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

int main(){
  ll N, K, a;
  cin >> N >> K;
  map<ll, ll> mp;
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;

  while(cin >> a){
      mp[a] += 1;
  }

  ll ans = 0;
  ll max = 0;
  for(auto x:mp){
    pq.push({x.second, x.first});
  }
  while(pq.size() > K){
    ans += pq.top().first;
    pq.pop();      
  }

  cout << ans << endl;
}


Measured memory_bytes: 17776
#include <cstdio>
#include <cstdlib>
#include <algorithm>

using namespace std;

#define LL long long

int main()
{
	int h,w;
	scanf("%d%d",&h,&w);
	LL ans=1e17;
	if(h%3==0)ans=0;
	else ans=w;
	if(w%3==0)ans=0;
	else ans=min(ans,(LL)h);
	for(int i=1;i<h;i++)
	{
		LL t1=(LL)i*w;
		LL t2=(LL)(h-i)*(w/2),t3=(LL)(h-i)*w-t2;
		LL re=max(abs(t1-t2),abs(t1-t3));
		//if(re==32704)printf("%d %lld %lld %lld\n",i,t1,t2,t3); 
		ans=min(ans,re);
	}  
	swap(h,w);
	for(int i=1;i<h;i++)
	{
		LL t1=(LL)i*w;
		LL t2=(LL)(h-i)*(w/2),t3=(LL)(h-i)*w-t2;
		LL re=max(abs(t1-t2),abs(t1-t3));
		//if(re==32704)printf("%d %lld %lld %lld\n",i,t1,t2,t3); 
		ans=min(ans,re);
	}  
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
sa = list(input())
sb = list(input())
sc = list(input())

next_turn = "a"
ans = ""
while True:
    if next_turn == "a":
        if len(sa) == 0:
            ans = "A"
            break
        next_turn = sa[0]
        del sa[0]
    elif next_turn == "b":
        if len(sb) == 0:
            ans = "B"
            break
        next_turn = sb[0]
        del sb[0]
    else:
        if len(sc) == 0:
            ans = "C"
            break
        next_turn = sc[0]
        del sc[0]

print(ans)


Measured memory_bytes: 3064
a, b, k = map(int, input().split())
if (b - a + 1) <= 2 * k:
	for i in range(a, b+1):
		print(i)
else:
	for i in range(a, a+k):
		print(i)
	for i in range(b-k+1, b+1):
		print(i)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <functional>
#include <random>
using namespace std;
#define Would
#define you

const int MOD = 1e9 + 7;
const int INF = 999999999;

long long a, b, c, k[100005], ans=1, cou, mon;
int main() {
	cin >> a >> b >> c;
	for (int i = 0; i < a; ++i) { cin >> k[i]; }
	sort(k, k + a);
	mon = k[0];
	for (int i = 0; i < a; ++i) {
		if (k[i] <= mon + c && cou < b) { ++cou; }
		else {
			mon = k[i];
			cou = 1;
			++ans;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
N, K = map(int, input().split())
mod = 10 ** 9 + 7

L = 0
R = 0
for i in range(K):
    L += i
    R += (N - i)

ans = 0
for x in range(K, N + 2):
    ans = (ans + (R - L + 1)) % mod
    L += x
    R += (N - x)

print(ans % mod)

Measured memory_bytes: 9192
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();

    if (400<= x && x<=599) {
      System.out.println(8);
    } else if (600<=x && x<=799) {
      System.out.println(7);
    } else if (800<=x && x<=999) {
      System.out.println(6);
    } else if (1000<=x && x<=1199) {
      System.out.println(5);
    } else if (1200<=x && x<=1399) {
      System.out.println(4);
    } else if (1400<=x && x<=1599) {
      System.out.println(3);
    } else if (1600<=x && x<=1799) {
      System.out.println(2);
    } else if (1800<=x && x<=1999) {
      System.out.println(1);
    }
  }

}


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

int main(){
  int A, B, C, D, money;
  money = 0;
  cin >> A >> B >> C >> D;
  if (A < B) money += A;
    else money += B;
  if (C < D) money += C;
  	else money += D;
  cout << money << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    const ll inf = LONG_LONG_MIN / 2 + 1;
    ll n, t;
    cin >> n >> t;
    vector<pair<ll, ll>> ab(n);
    rep(i, n) cin >> ab[i].first >> ab[i].second;
    vector<vector<ll>> dp(t + 1, vector<ll>(2, inf));
    dp[0][0] = 0;
    ll ans = 0;
    rep(i, n) {
        rrep(j, t + 1) {
            rep(k, 2) {
                if ((j >= ab[i].first) && (dp[j - ab[i].first][k] != inf)) {
                    dp[j][k] = max(dp[j][k], dp[j - ab[i].first][k] + ab[i].second);
                    ans = max(ans, dp[j][k]);
                }
            }
            if ((j > 0) && (dp[j - 1][0] != inf)) {
                dp[j][1] = max(dp[j][1], dp[j - 1][0] + ab[i].second);
                ans = max(ans, dp[j][1]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define pb push_back
#define MOD 1000000007
#define INF 1000000000000
#define EPS 0.00000000001
typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    int a,b,c;
    cin>>a>>b;
    c=a+b;
    if(a%3==0||b%3==0||c%3==0){
        cout<<"Possible"<<endl;
    }
    else{
        cout<<"Impossible"<<endl;
    }
}


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

using namespace std;

int main(){
	vector<int> data;
	data.push_back(2);
	data.push_back(3);
	for(int i=4;i<1000000;i++){
		bool flag = true;
		for(int j=2;j*j<=i;j++){
			if(i%j==0){
				flag = false;
			}
		}
		if(flag){
			data.push_back(i);
		}
	}

	while(true){
		int n,p;
		cin >> n >> p;
		if(n == -1 && p == -1){
			break;
		}

		int count = 0;
		while(data[count] <= n){
			count++;
		}
		vector<int> anslist;
		for(int i=count;i<count+70;i++){
			for(int j=i;j<count+70;j++){
				anslist.push_back(data[i]+data[j]);
			}
		}
		sort(anslist.begin(),anslist.end());

		cout << anslist[p-1] << endl;
	}
}

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

int main()
{
	while (true){
		int n;
		cin >> n;
		if (!n) break;

		for (int i = 0; i < n; i++){
			int in1[4], in2[4];
			for (int j = 0; j < 4; j++) cin >> in1[j];
			for (int j = 0; j < 4; j++) cin >> in2[j];

			int m[4][4];
			for (int j = 0; j < 4; j++){
				for (int k = 0; k < 4; k++){
					m[j][k] = in1[j] * in2[k];
				}
			}

			int out[4];
			out[0] = m[0][0] - m[1][1] - m[2][2] - m[3][3];
			out[1] = m[0][1] + m[1][0] + m[2][3] - m[3][2];
			out[2] = m[0][2] - m[1][3] + m[2][0] + m[3][1];
			out[3] = m[0][3] + m[1][2] - m[2][1] + m[3][0];

			for (int i = 0; i < 3; i++) cout << out[i] << " ";
			cout << out[3] << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main(){
    int N,ans=0;
    cin >> N;
    vector<pair<int,int>> ab(N),cd(N);
    vector<bool> abunused(N,true);
    for(int i=0;i<N;i++){
        cin >> ab[i].first >> ab[i].second;
    }
    for(int i=0;i<N;i++){
        cin >> cd[i].first >> cd[i].second;
    }

    sort(ab.begin(),ab.end());
    sort(cd.begin(),cd.end());

    for(int i=0;i<N;i++){
        int mx=N,mxy=-1,mxnum=-1;
        for(int j=0;j<N;j++){
            if(cd[i].first<=ab[j].first){
                mx = j;
                break;
            }
        }
        for(int j=0;j<mx;j++){
            if(abunused[j] && mxy<ab[j].second && ab[j].second<cd[i].second){
                mxy = ab[j].second;
                mxnum = j;
            } 
        }
        if(mxy!=-1){
            abunused[mxnum] = false;
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn input_int_tuple() -> (i32, i32, i32) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<i32> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1], vec[2])
}

fn main() {
    let (n, a, b) = input_int_tuple();
    if a * n > b {
        println!("{}", b);
    } else {
        println!("{}", a * n);
    }
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Programminng
{
    class AOJ_Volume0004
    {
        static void Main(string[] args)
        {

            while(true)
            {
                var input = Console.ReadLine();
                if(string.IsNullOrEmpty(input)) break;

                double a, b, c, d, e, f, x, y;
                string[] s = input.Split(' ');
                a = double.Parse(s[0]);
                b = double.Parse(s[1]);
                c = double.Parse(s[2]);
                d = double.Parse(s[3]);
                e = double.Parse(s[4]);
                f = double.Parse(s[5]);

                x = (c * e - b * f) / (double)(a * e - b * d);
                y = (c * d - a * f) / (double)(b * d - a * e);
                if (-0.0004 < x && x <= 0) x = 0;
                if (-0.0004 < y && y <= 0) y = 0;

                Console.WriteLine("{0:F3} {1:F3}",x,y);
            }
        }
    }
}

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

int main()
{
  int n, temp;
  cin >> n;
  bool ans = true;
  for(int i = 0; i < n; i++)
  {
      cin >> temp;
      if(temp%2 == 0)
      {
          if(!(temp%3==0 || temp%5 == 0))
            ans = false;
      }
  }
  if(ans)
    cout << "APPROVED";
  else
    cout <<"DENIED";

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double a = scanner.nextDouble();
        double b = scanner.nextDouble();
        double c = a * b;
        double d = c / 3.305785;
        System.out.printf("%.4f\n", d);

    }
}



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

int main() {
    int n,m,q;
    cin >> n >> m >> q;
    int a[505][505];
    int c[505][505];

    for(int i=0; i<=n; i++){
        for(int j=0; j<=n; j++){
            a[i][j]=0;
            c[i][j]=0;
        }
    }

    for(int i=0; i<m; i++){
        int x,y;
        cin >> x >> y;
        a[x][y] += 1;
    }
    for(int i=1; i<=n; i++){
        for(int j=1; j<=n; j++){
            c[i][j]=c[i-1][j]+c[i][j-1]-c[i-1][j-1]+a[i][j];
        }
    }


    for(int i=0; i<q; i++){
        int x,y;
        cin >> x >> y;
        //cout << c[y][y] << " " <<c[x-1][x-1]<<" " <<c[y][x-1]<< " " <<c[x-1][y] << endl;
        cout << c[y][y]+c[x-1][x-1]-c[y][x-1]-c[x-1][y] << endl;
        }
          
}


Measured memory_bytes: 2944
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            for (int i = 1; i <10; i++)
            {
                for (int j = i; j < 10; j++)
                {
                    if (i * j == n)
                    {
                        Console.WriteLine("Yes");
                        return;
                    }
                }
            }

            Console.WriteLine("No");
        }
    }
}


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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;
    //agc016 b
    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        int[] a = in.ni(n);
        boolean flag = false;
        OUT:for (int i = 0; i <= 1; i++) {

            int kind = a[0]+i;
            int not_same = 0, same = 0;
            for (int j = 0; j < n; j++){
                if (kind == a[j]+1) not_same++;
                else if(kind == a[j]) same++;
                else continue OUT;
            }
            int res = kind-not_same;
            if(res==0&&same==0) flag = true;
            else if(res>0&&check(same, res)) flag = true;
            
            if(flag) break;
        }
        out.println(flag?"Yes":"No");
    }
    public static boolean check(int same, int res){
        return same-2*(res-1)>=2;
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 35164
#include <algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;

int weight[101],value[101];
int dp[101][10001];


int main(){
  long ii,jj,kk;
  vector<int> ret;
  int n,W;
  

   cin >> n >> W;

  for(ii=0;ii<n;ii++){
    cin >> value[ii] >> weight[ii];
  }

  for(ii=0;ii<W;ii++){
    dp[0][ii] = 0;
  }

  //cout << "input end" << endl;
  
  for(ii=0;ii<n;ii++){
    for(jj=0;jj<=W;jj++){

      if(jj-weight[ii]>=0){
        int cnt;

        //cnt = 1;
        //cout << "cnt:" << cnt << endl;

        dp[ii+1][jj] = max(dp[ii][jj],
                           max(  dp[ii]  [jj-weight[ii]] + value[ii]
                                ,dp[ii+1][jj-weight[ii]] + value[ii]));

        //cout << "dp:ww" << jj <<":"<< dp[ii+1][jj] << endl;
      }
      
      else{
        dp[ii+1][jj] = dp[ii][jj];
      }
      
    }
  }

//  for(ii=0;ii<=n;ii++){
//    for(jj=0;jj<=W;jj++){
//      cout << dp[ii][jj] << "\t";
//    }
//  
//    cout << endl;
//    
//  }
  
  cout << dp[n][W] << endl;
  return 0;
}



Measured memory_bytes: 7048
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int[] S=new int[n];
		int count=0;
		int x;
		for(int i=0;i<n;i++){
			x=scan.nextInt();
			S[i]=x;
		}
		int q=scan.nextInt();
		for(int i=0;i<q;i++){
			x=scan.nextInt();
			for(int j=0;j<n;j++){
				if(S[j]==x){
					count++;
					break;
				}
			}
		}
		System.out.println(count);
		scan.close();
	}
}

Measured memory_bytes: 30940
using System;
using System.Linq;

public class Program
{
	//limit
	static int A, B, C, N;

	static int[] l;

	public static void Main(string[] args)
	{
		// スペース区切りの整数の入力
		var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

		var H = input[0];
		var W = input[1];

		// スペース区切りの整数の入力
		input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

		var h = input[0];
		var w = input[1];

		Console.WriteLine((H - h) * (W - w));
	}
}


Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <string>
#include <set>
using namespace std;

int main(){
    int N;
    string S;
    cin >> N >> S;
    vector<int> cnt(26);
    for(int i=0;i<N;i++){
        cnt[S[i]-'a']++;
    }
    bool judge = false;
    for(int i=0;i<26;i++) if(cnt[i]>1) judge = true;
    if(!judge){
        cout << 0 << endl;
        return 0;
    }
    auto prekmp = [&](string x,int m,vector<int>& kmpnext){
        int i = 0,j = kmpnext[0] = -1;
        while(i<m){
            while(j>-1 && x[i]!=x[j]) j = kmpnext[j];
            i++; j++;
            if(x[i]==x[j]) kmpnext[i] = kmpnext[j];
            else kmpnext[i] = j;
        }
    };
    auto KMP = [&](string x,int m,string y,int n){
        vector<int> kmpnext(m+1);
        int i = 0,j = 0;
        prekmp(x,m,kmpnext);
        while(j<n){
            while(i>-1 && x[i]!=y[j]) i = kmpnext[i];
            i++; j++;
            if(i>=m){
                i = kmpnext[i];
                return true;
            }
        }
        return false;
    };
    auto ok = [&](int len){
        bool res = false;
        for(int i=0;i<=N-2*len;i++){
            string now = S.substr(i,len);
            string ne = "";
            for(int j=i+len;j<N;j++) ne += S[j];
            if(len>ne.size()) continue;
            res |= KMP(now,now.size(),ne,ne.size());
            if(res) return res;
        }
        return res;
    };
    int l = 0,r = N;
    while(l+1<r){
        int m = (l+r)/2;
        if(ok(m)) l = m;
        else r = m;
    } 
    cout << l << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int q;
    cin >> q;
    vl a(q), b(q);
    for (int i = 0; i < q; ++i) {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < q; ++i) {
        if (a[i] > b[i])
            swap(a[i], b[i]);
        if (a[i] == b[i] || abs(a[i] - b[i]) == 1) {
            cout << 2 * a[i] - 2 << "\n";
            continue;
        }
        ll c = ll(sqrt(double(a[i]) * double(b[i])));
        if (c * c >= a[i] * b[i])
            c--;
        if (c * (c + 1) >= a[i] * b[i])
            cout << 2 * c - 2 << "\n";
        else
            cout << 2 * c - 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


from bisect import bisect_left

n = ni()
a = [ni() for _ in range(n)]
lists = [[] for _ in range(n)]

lasts = [-1] * n

for ai in a:
    idx = bisect_left(lasts, ai)
    lists[idx-1].append(ai)
    lasts[idx-1] = ai

ans = 0
for lasti in lasts[::-1]:
    if lasti != -1:
        ans += 1

print(ans)

Measured memory_bytes: 20376
from collections import deque
import sys
input = sys.stdin.readline


class BIT():
    """区間加算、一点取得クエリをそれぞれO(logN)で答える
    add: 区間[l, r)にvalを加える
    get_val: i番目の値を求める
    i, l, rは0-indexed
    """
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)

    def _add(self, i, val):
        while i > 0:
            self.bit[i] += val
            i -= i & -i

    def get_val(self, i):
        """i番目の値を求める"""
        i = i + 1
        s = 0
        while i <= self.n:
            s += self.bit[i]
            i += i & -i
        return s

    def add(self, l, r, val):
        """区間[l, r)にvalを加える"""
        self._add(r, val)
        self._add(l, -val)


r, c, n = map(int, input().split())
info = [list(map(int, input().split())) for i in range(n)]

def solve(x1, y1):
    if y1 == 0:
        return x1
    if x1 == r:
        return r + y1
    if y1 == c:
        return r + c + (r-x1)
    if x1 == 0:
        return r + c + r + (c-y1)

li = []
for i in range(n):
    x1, y1, x2, y2 = info[i]
    if (x1 % r == 0 or y1 % c == 0) and (x2 % r == 0 or y2 % c == 0):
        pos1, pos2 = solve(x1, y1), solve(x2, y2)
        li.append((pos1, i))
        li.append((pos2, i))

li = sorted(li)
q = deque([])
for i in range(len(li)):
    _, j = li[i]
    if q and q[-1] == j:
        q.pop()
    else:
        q.append(j)
if q:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 80220
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)

namespace std {
	template<class S, class T> pair<S, T> operator + (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first + b.first, a.second + b.second);}
	template<class S, class T> pair<S, T> operator - (const pair<S, T> &a, const pair<S, T> &b) {return mp<S, T>(a.first - b.first, a.second - b.second);}
	template<class S, class T> pair<S, T>& operator += (pair<S, T> &a, const pair<S, T> &other) {return a = a + other;}
	template<class S, class T> pair<S, T>& operator -= (pair<S, T> &a, const pair<S, T> &other) {return a = a - other;}
	template<class S, class T> ostream& operator << (ostream& ost, pair<S, T> p) {ost << "(" << p.first << ", " << p.second << ")";return ost;}
	template<class T> ostream& print_iterable_container(ostream& ost, T& container) {
		for (auto&& iter = begin(container); iter != end(container); ++iter) ost << (iter == begin(container) ? " [ " : ", ") << (*iter);
		return ost << " ]";
	}
#	define APPLY_PRINT_ITERABLE_CONTAINER(container_type)\
	template<class T> ostream& operator << (ostream& ost, container_type<T>& container) {\
		return print_iterable_container(ost, container);\
	}
	APPLY_PRINT_ITERABLE_CONTAINER(vector);
	APPLY_PRINT_ITERABLE_CONTAINER(list);
	APPLY_PRINT_ITERABLE_CONTAINER(deque);
}

template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

using ld = long double;

template<class T> using VV = vector<vector<T> >;
template<class T> using maxPQ = priority_queue<T>;
template<class T> using minPQ = priority_queue<T, vector<T>, greater<T> >;
template<class T, class U> using uomap = unordered_map<T, U>;
template<class T> using uoset = unordered_set<T>;

const ll INF = 1001001001;
const ll INFll = (ll)INF * INF;
const ll MOD = 1000000007;
const ll MOD_FFT = 998244353;
const ld EPS = 1e-15;

//function<void(int,int)> tensi_no_3p=[&](int v,int d){
//};

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

int main() {
	string s;
	cin >> s;
	int n = s.size();
	if (s[0] != '1' || s[n - 1] != '0') no();
	rep(i, n - 1) if (s[i] != s[n - 2 - i]) no();
	int a = 1;
	rep(i, n - 1) {
		cout << a << " " << (i + 2) << endl;
		if (s[i] == '1') {
			a = i + 2;
		}
		else {
		}
	}
	return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define MOD 1000000007
#define y1 dskgj
#define y2 dskfj
#define N 310
typedef long long ll;
using namespace std;
ll n,i,j,k,x,y,z,m,Q,w,h;
ll a[100500], b[100500];
int main() {
    cin >> n;
    for (i = 0; i < n; i++)
    {
        cin >> x;
        a[x]++;
    }
    ll ans = 0;
    for (i = 0; i <= 100000; i++)
        ans = max(ans, a[i] + a[i+1] + a[i+2]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
for(int i=1;;i++){
 int a=sc.nextInt();
 if(a==0){
     break;
 }
 System.out.println("Case "+i+": "+a);

}
    }
}


Measured memory_bytes: 41428
import sys
n,t = list(map(int, input().split()))
imincost=1001
for _ in range(n):
    c_,t_ = list(map(int, input().split()))
    if t_ <= t and c_ <imincost:
        imincost = c_
print(imincost if imincost != 1001 else "TLE")

Measured memory_bytes: 2940
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<cctype>
using namespace std;

int main() {
	char a, b;
	cin >> a >> b;
	if (a == b)
		cout << 'H' << endl;
	else
		cout << 'D' << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    
    if (a <= c && c <= b) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

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

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n; cin >> n;
    string s; cin >> s;
    for(int i = 0; i < n - 1; i++) if(s.substr(0, i + 1) == s.substr(i + 1, n - i - 1))
    {
        cout << "Yes";
        return 0;
    }
    cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#define LL long long
const int maxn = 1e6+33;
const int mod = 1e9+7;
string s1,s2;
int main()
{
    cin>>s1>>s2;
    int len = s1.length();
    for(int i=0;i<len;i++){
        string s="";
        s+=s1.substr(i,len-i)+s1.substr(0,i);
        if(s==s2){
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
        int a,b,c,x,y;
        cin >> a >> b >> c >> x >> y;

        int ans,m1,m2;
        if(2*c-a-b>=0) m1=a*x+b*y;
        else m1=a*x+b*y+(2*c-a-b)*min(x,y);

        if(x<y){
                if(2*c-b>=0) m2=b*y+(2*c-b)*x;
                else m2=b*y+(2*c-b)*y;
        }else if(x>y){
                if(2*c-a>=0) m2=a*x+(2*c-a)*y;
                else m2=a*x+(2*c-a)*x;
        }else{
                m2=min(a*x+b*y,2*c*max(x,y));
        }

        ans=min(m1,m2);

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 384
import java.util.*;

class Point{
    int x; int y;
    public Point(int x, int y){
        this.x = x;
        this.y = y;
    }
}

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());
        char[][] maze = new char[h][w];
        int vacant = 0;
        for(int i=0;i<h;i++){
            maze[i] = sc.next().toCharArray();
            for(int j=0;j<w;j++){
                if(maze[i][j]=='.'){
                    vacant++;
                }
            }
        }
        sc.close();
        Deque<Point> points = new ArrayDeque<Point>();
        points.addLast(new Point(0,0));
        int[][] distance = new int[h][w];
        for(int i=0;i<h;i++){
            Arrays.fill(distance[i],h*w+1);
        }
        distance[0][0] = 0;
        while(true){
            int x; int y;
            try{
                Point p = points.removeFirst();
                x = p.x; y = p.y;
            }catch(NoSuchElementException e){
                break;
            }
            maze[y][x] = '#';
            if(x==w-1 && y==h-1){
                break;
            }
            int[] dx = {-1,0,1,0}; int[] dy = {0,-1,0,1};
            for(int i=0;i<4;i++){
                int nx = x + dx[i];
                int ny = y + dy[i];
                if(nx==-1 || nx==w || ny==-1 || ny==h || maze[ny][nx]=='#' || distance[ny][nx] != h*w+1){
                    continue;
                }else{
                    points.addLast(new Point(nx,ny));
                    distance[ny][nx] = distance[y][x] + 1;
                }
            }
        }
        if(distance[h-1][w-1] == h*w+1){
            System.out.println(-1);
        }else{
            System.out.println(vacant - distance[h-1][w-1]-1);
        }
    }
}

Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {
    public static Scanner in = new Scanner(System.in);

    public static void main(String[] args) {
        int n = in.nextInt();
        int answer = -1, mod = 0;
        for (int i = 1; i <= (int) 1e6; i++) {
            mod = mod * 10 + 7;
            mod %= n;
            if (mod == 0) {
                answer = i; break;
            }
        }
        System.out.println(answer);
    }
}

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

int main()
{
	int n;cin>>n;
	int a[n+1];
	int f[n+1],ans=0;
	f[0]=0;a[0]=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		f[i]=max(a[i-1],f[i-1]);
	}
	for(int i=1;i<=n;i++)if(f[i]<=a[i])ans++;
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    private static Scanner sc;
    private static int[][] neg8 = new int[][]{{-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            int[][] pattern = new int[][]{{1, 1, 1}, {1, 1,0}, {1,0,0}, {0,0,0}, {0,0,1}, {0,1,1}, {0, 1,0}, {1, 0, 1}};
            int A,B,C,D;
            String s = sc.next();
            A = Character.getNumericValue(s.charAt(0));
            B = Character.getNumericValue(s.charAt(1));
            C = Character.getNumericValue(s.charAt(2));
            D = Character.getNumericValue(s.charAt(3));

            int patternIndex = 0;
            for (int i = 0; i < pattern.length; i++) {
                int[] p = pattern[i];
                int ans = A;
                ans = p[0] == 1 ? ans + B : ans - B;
                ans = p[1] == 1 ? ans + C : ans - C;
                ans = p[2] == 1 ? ans + D : ans - D;
                if (ans == 7) {
                    patternIndex = i;
                    break;
                }
            }

            int[] hit = pattern[patternIndex];
            StringBuilder sb = new StringBuilder();
            sb.append(A);
            sb.append(hit[0]==1?"+":"-");
            sb.append(B);
            sb.append(hit[1]==1?"+":"-");
            sb.append(C);
            sb.append(hit[2]==1?"+":"-");
            sb.append(D);
            sb.append("=7");

            System.out.println(sb.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}



Measured memory_bytes: 23124
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(void)
{
  int A, S, s;
  scanf("%d", &A);
  S = A / 100;
  s = A % 100;
  if (S == 00) {
      if (s == 00) {
          printf("NA");
      }
      else if(s > 12) {
          printf("NA");
      }
      else {
          printf("YYMM");
      }
  }
  else if (S > 12) {
      if (s == 00) {
          printf("NA");
      }
      else if(s > 12) {
          printf("NA");
      }
      else {
          printf("YYMM");
      }
  }
  else {
      if (s == 00) {
          printf("MMYY");
      }
      else if(s > 12) {
          printf("MMYY");
      }
      else {
          printf("AMBIGUOUS");
      }
  }
 return 0;
}

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

int main(){
 int n,x,a=0;  cin>>  n >> x  ;
  
  vector<int>vec(n);
  for(int i=0; i< n ;i++)  cin>>vec.at(i);  
 vector<int>ans(n);
  for(int i=0; i< n ;i++){
  if(i==0){
    ans.at(i)=vec.at(i);
  if(ans.at(i)<=x) a++;
  }
    else{
      ans.at(i)=ans.at(i-1)+vec.at(i);
    if(ans.at(i)<=x) a++;
    }
  }
  cout<<a+1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    sort(s.begin(),s.end());

    if(s[0]==s[1] && s[1]!=s[2] && s[2]==s[3])
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    exit(0);
}


Measured memory_bytes: 256
N, M = gets.split.map{|i|i.to_i}

AL = Array.new(N + 1){[]}
M.times{
    a, b, c = gets.split.map{|i|i.to_i}
    AL[a] << [b, c]
    AL[b] << [a, c]
}

def cost(s, e)
    d = Array.new(N + 1){|i|i == s ? 0 : 10 ** 9}
    prev = Array.new(N + 1){nil}
    q = Array.new(N){|i|i + 1}

    until q.empty?
        u = q.min_by{|i|d[i]}
        q.delete(u)
        AL[u].each{|edge|
            v = edge[0]
            l = d[u] + edge[1]
            if l < d[v]
                d[v] = l
                prev[v] = u
            end
        }
    end
    d[e]
end

count = 0
(1..N).each{|s|
    AL[s].each{|l|
        next if l[0] < s
        c = cost(s, l[0])
        if c < l[1]
            count += 1
        end
    }
}

puts count


Measured memory_bytes: 2300
#include<bits/stdc++.h>
 
using namespace std;
int main()
 
{
 
string s;
 
    cin>>s;
    int x=0;
 
    for( int i=0;i<3;i++){
            if(s[i]=='1'){
                x++;
            }
    }
 
    cout<<x<<endl;
 
return 0;
 
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    ll N, K;
    cin >> N >> K;
    ll mod = N % K;
    cout << min(mod, K - mod) << endl;
    return 0;
}

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

int main() {
	// your code goes here
	string s;
	cin >>s;
	long l= s.length();
	long left=0, right=l-1;
	long count=0;
	
	while(left<=right){
		if(s[left]==s[right]){
			left++;
			right--;
		}else if(s[left]=='x'){
			count++; left++;
		}else if(s[right]=='x'){
			count++; right--;
		}else{
			count=-1; break;
		}
		
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 512