akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

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


Measured memory_bytes: 256
use itertools::Itertools;
fn main() {
    proconio::input! {
        n: usize,
    }
    let ans = (1..=n)
        .map(|i| if i % 3 == 0 || i % 5 == 0 { 0 } else { i })
        .sum::<usize>();
    println!("{}", ans);
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define ForE(it,v) for(auto it : v)
#define mod 1000000007
#define All(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>

using namespace std;

int a,b,c;
int n,m,cnt,ans;
string S,t;
bool dp[30009][4][1009];

main()
{
        cin>>n>>S;
        dp[0][0][0]=true;

        rep(i,n)
        {
                rep(j,4)
                {
                        rep(k,1000)
                        {
                        if(dp[i][j][k]==false)continue;

                        if(j<3)dp[i+1][j+1][k*10+S[i]-'0']=true;
                        dp[i+1][j][k]=true;
                        //if(j>0)printf("%d %d %d\n",i,j,k);
                        }
                }
        }

        cnt=1;
        rep(i,1000)
        {
                if(dp[n][3][i]==true)
                {
                        ans++;
                        //printf("%3d %d\n",cnt,dp[n][3][i]);
                }
                cnt++;
        }
        cout<<ans<<endl;
}

Measured memory_bytes: 118528
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



int main(void){

    int num=1;
    int n;
    cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    bool ch=false;
    rep(i,n){
        // cout<<v[i]<<' '<<num<<endl;
        if(v[i]==num){
            num++;
            ch=1;
        }
        // cout<<num<<endl<<endl;
    }
    // cout<<num<<" "<<n<<endl;
    num--;
    if(!ch)fin(-1);
    else fin(n-num);
    
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}
int GCD(int x, int y)
{
	return x ? GCD(y % x, x) : y;
}
typedef pair<int, int> P;

bool ps1(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first昇順
	return forall_a_in_P.first < forall_b_in_P.first;
}
bool ps2(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first降順
	return forall_a_in_P.first > forall_b_in_P.first;
}
bool ps3(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second昇順
	return forall_a_in_P.second < forall_b_in_P.second;
}
bool ps4(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second降順
	return forall_a_in_P.second > forall_b_in_P.second;
}

int main()
{
	int n;
	cin >> n;
	vector<int> b(n);
	deque<int> ans;
	string t = "";
	rep(i, n)
	{
		cin >> b[i];
		char tmp = '0' + b[i];
		t += tmp;
	}
	//cout<<t<<endl;
	while (t.size() != 0)
	{
		int m = t.size();
		int mm = m;
		int tmp = 0;
		bool ok = false;
		rep(i, m)
		{
			char cm = '0' + i + 1;
			if (t[i] == cm)
			{
				tmp = i;
				ok = true;
			}
		}
		if (ok)
		{
			t.erase(tmp, 1);
		}
		else
		{
			break;
		}
		ans.push_front(tmp + 1);
		//cout<<t.size()<<endl;
	}
	if (t.size() == 0)
	{
		rep(i, n)
		{
			cout << ans[i] << endl;
		}
	}
	else
	{
		cout << -1 << endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int i, j, h, w;

  while(1){
    scanf("%d%d", &h, &w);
    if(h == 0 && w == 0)  break;
    for(i = 0; i < h; i++){
      for(j = 0; j < w; j++){
	if(i == 0 || i == h-1 || j == 0 || j == w-1){
	  printf("#");
	}else{
	  printf(".");
	}
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <functional>
typedef long long ll;
using namespace std;

int main() {
    ll a,b,n;
    cin >> a >> b >> n;
    ll x = n;
    if (n >= b-1) x = b -1;
    ll ans = a*x/b - a*(x/b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  int N,T,c,t,mt=1000,root=0;
  cin>>N>>T;
  
  for(int k=0;k<N;k++){
    	cin>>c>>t;
	if(t>T){continue;}
    if(c<=mt)mt=c;root=k+1;
  	}
  
  	if(root==0)cout<<"TLE"<<endl;
	else cout<<mt<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLong()) {
            long X = sc.nextLong();
            long sum = 0;
            long i;
            for (i = 1; sum < X; i++) {
                sum += i;
            }
            System.out.println(i - 1);
        }
    }
}


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

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

    string S;
    cin >> S;

    int ans = 0;
    for (int i = 0; i < N - 1; i++)
    {
        if (S[i] == S[i + 1])
        {
            ans++;
        }
    }

    ans = min(ans + K * 2, N - 1);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main() {
  int n; ll k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];

  vector<int> s;
  vector<int> ord(n+1, -1);
  int c = 1, l = 0;
  {
    int v = 1;
    while (ord[v] == -1) {
      ord[v] = s.size();
      s.push_back(v);
      v = a[v-1];
    }
    c = s.size() - ord[v];
    l = ord[v];
  }

  if (k < l) cout << s[k] << endl;
  else {
    k -= l;
    k %= c;
    cout << s[l+k] << endl;
  }
  return 0;
}


Measured memory_bytes: 5892
N,K,C = map(int,input().split())
S = input()

L = []
R = []

i = 0
while i < N:
    if S[i] == "o":
        L.append(i)
        i += C
    i += 1

j = N-1
while j >= 0:
    if S[j] == "o":
        R.append(j)
        j -= C
    j -= 1   

for i in range(K):
    if L[i] == R[K-1-i]:
        print(L[i]+1)


Measured memory_bytes: 25180
using System;

public class Hello
{
    public const int INF = 999999999;
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            var m = int.Parse(Console.ReadLine().Trim());
            if (n == 0 && m == 0) break;
            var dp = new int[n, n];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++) if (i != j) dp[i, j] = INF;
            for (int i = 0; i < m; i++)
            {
                string[] line = Console.ReadLine().Trim().Split(' ');
                var a = int.Parse(line[0]) - 1;
                var b = int.Parse(line[1]) - 1;
                dp[a, b] = 1;
                dp[b, a] = 1;
            }
            goWarshall(dp);
            var count = 0;
            for (int i = 0; i < n; i++)
                if (dp[0, i] == 1 | dp[0, i] == 2) count++;
            Console.WriteLine(count);
        }
    }
    public static void goWarshall(int[,] dp)
    {
        var n = dp.GetLength(0);
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                for (int k = 0; k < n; k++)
                    dp[j, k] = Math.Min(dp[j, k], dp[j, i] + dp[i, k]);
    }
}



Measured memory_bytes: 10888
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
const int MAXN=3e3+10;
const int MOD=1e9+7;
int n;
int dp[MAXN][MAXN];
char s[MAXN];
int add(int x,int y){
	return (x+y)%MOD;
}
int sub(int x,int y){
	int z=x-y;
	if(z<0) z+=MOD;
	return z;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	cin>>n;
	for(int i=1;i<n;i++) cin>>s[i];
	dp[1][1]=1;
	for(int i=2;i<=n;i++){
		for(int j=1;j<=i;j++){
			if(s[n-i+1]=='<'){
				dp[i][j]=sub(dp[i-1][i-1],dp[i-1][j-1]);
			}
			else if(s[n-i+1]=='>'){
				dp[i][j]=dp[i-1][j-1];
			}
		}
		for(int j=2;j<=i;j++){
			dp[i][j]=add(dp[i][j],dp[i][j-1]);
		}
	}
	cout<<dp[n][n]<<"\n";
	return 0;
}

Measured memory_bytes: 34304
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main()
{
    int K, A, B;
    cin >> K;
    cin >> A >> B;

    for (int i=A; i<= B; i++) {
        if ((i%K) == 0)  {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}


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

//
int main()
{
  cin.tie(0);
ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A;
int common;
  cin>>common;
    for (int i = 1; i < N; i++)
    {
        int ai;
        cin >> ai;
        A.push_back(ai);
    }
  for(auto x:A)
  {
    common=__gcd(x,common);
  }
    cout << common << endl;
}


Measured memory_bytes: 892
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const double EPS = 1e-12;
const double INF = 1e12;

typedef complex<double> P;
typedef vector< complex<double> >polygon;
namespace std {
  	bool operator < (const P& a, const P& b) {
    	return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  	}
}
double cross(const P& a, const P& b) {
  	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}


int contains(const polygon& poly, const P & p) {
	bool in = false;
	for (int i = 0; i < SZ(poly); ++i) {
		P a = poly[i] - p, b = poly[(i+1)%SZ(poly)] - p;
		if (imag(a) > imag(b)) swap(a, b);
		if (imag(a) <= 0 && 0 < imag(b))
	  		if (cross(a, b) < 0) in = !in;
		if (cross(a, b) == 0 && dot(a, b) <= 0) return 1;
	}
	return in ? 2 : 0;
}


int main(){
	
	vector<string>res;
	polygon tri(3);
	P p;
	while(cin>>tri[0].real()>>tri[0].imag()>>tri[1].real()>>tri[1].imag()>>tri[2].real()>>tri[2].imag()>>p.real()>>p.imag()){
		if(contains(tri,p)==2)res.PB("YES");
		else res.PB("NO");
	}
	REP(i,SZ(res))cout<<res[i]<<endl;
	return 0;
}

Measured memory_bytes: 1236
//ITP1_3_C

using System;
using System.Collections.Generic;
/*using System.Linq;
using System.Text;
using System.Threading.Tasks;*/

class Program { 
    static void Main(string[] args)
    {
        int i = 0;
        while (i < 3000) {

            //?????????????????????????????????int??????iaaray????????????????????\

            int[] iarray = Array.ConvertAll<string, int>((Console.ReadLine().Split(' ')), delegate (string value)
            {
                return int.Parse(value);
            });

            if (iarray[0] == 0 && iarray[1] == 0)       //??\??????????????¨???0????????????
                break;

            Array.Sort(iarray);             //???????????§???????????????
            Console.WriteLine(iarray[0] +" "+ iarray[1]);
            i++;
        }
    }

}

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

int main() {
  ll n, m, a, ans = 0;
  cin >> n >> m;

  priority_queue<ll> pq;
  for (int i = 0; i < n; i++) {
    cin >> a;
    pq.push(a);
  }

  while (m--) {
    a = pq.top();
    pq.push(a / 2);
    pq.pop();
  }

  while (n--) {
    ans += pq.top();
    pq.pop();
  }

  cout << ans << endl;
}

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

struct Edge{
    int s,d;
};
using Graph=vector<vector<int>>;
map<pair<int,int>,int> mp2;
int cntBridge(const Graph& g){
    int n=g.size();
    vector<int> pre(n,-1),low(n,-1);
    int k=0;
    int res=0;
    int root=0;
    function<int(int,int)> dfs=[&](int v,int pv){
        if(pre[v]!=-1) return low[v];
        pre[v]=k++;
        low[v]=pre[v];
        for(auto &to:g[v]){
            if(to!=pv){
                if(pre[to]==-1){
                    low[v]=min(low[v],dfs(to,v));
                    if(low[to]==pre[to] && to!=root){
                        if(mp2[{v,to}]==1){
                            res++;
                            //cerr<<v<<" "<<to<<endl;
                        }
                    }
                }
                else{
                    low[v]=min(low[v],dfs(to,v));
                }
            }
        }
        return low[v];
    };
    vector<int> f(n,0);
    for(int i=0;i<n;i++){
        if(pre[i]==-1){
            root=i;
            dfs(i,-1);
            f[i]=1;
        }
    }
    return res;
}
int main(){
    int n,m;
    cin>>n>>m;
    map<int,vector<Edge>> mp;
    for(int i=0;i<m;i++){
        int s,d,c;
        cin>>s>>d>>c;
        s--,d--;
        mp[c].push_back({s,d});
    }    
    Graph g(n);
    int cnt=0;
    int sum=0;

    vector<int> rank(n);
    vector<int> par(n);
    iota(par.begin(),par.end(),0);
    function<int(int)> find=[&](int x){
        if(par[x]==x) return x;
        else return par[x]=find(par[x]);
    };
    auto unite=[&](int x,int y){
        x=find(x),y=find(y);
        if(x==y) return;
        if(rank[x]<rank[y]) par[x]=y;
        else{
            if(rank[x]==rank[y]) rank[x]++;
            par[y]=x;
        }
    };

    for(auto &e:mp){
        int c=e.first;
        vector<Edge> edges=e.second;
        Graph g(n);
        for(auto &e:edges){
            int x=find(e.s),y=find(e.d);
            if(x==y) continue;
            //cerr<<"#"<<x<<" "<<y<<endl;
            mp2[{x,y}]++;
            mp2[{y,x}]++;
            //cerr<<mp2[{x,y}]<<endl;
            //cerr<<mp2[{y,x}]<<endl;
            g[x].push_back(y);
            g[y].push_back(x);
        }
        int x=cntBridge(g);
        cnt+=x;
        sum+=x*c;
        for(auto &e:edges) unite(e.s,e.d);
    }
    cout<<cnt<<" "<<sum<<endl;
    return 0;
}


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

using namespace std;
const int inf = 1e9 +5;

int main(){

#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
int n;
// ll sum;
ll W;
cin>>n;
vector<ll>w(n);
vector<int>val(n);

cin>>W;
int val_sum =0;
for(int i=0;i<n;i++){
	cin>>w[i]>>val[i];
	val_sum+=val[i];
}
ll dp[n+1][val_sum+1];

for(int i=0;i<=val_sum;i++)
	dp[0][i] = inf;
for(int i=0;i<=n;i++)
	dp[i][0] = 0;
for(int i=1;i<=n;i++){
	for(int j=1;j<=val_sum;j++){
		if(val[i-1]<=j){
			// if(dp[i-1][j-val[i-1]]==inf)
				// dp[i][j] = min(dp[i-1][j],w[i-1]);
			// else
				dp[i][j] = min(dp[i-1][j],w[i-1]+dp[i-1][j-val[i-1]]);
		}	
		else
			dp[i][j] = dp[i-1][j];
		// if(dp[i][j]!=inf)
			// cout<<dp[i][j];
		// else
			// cout<<-1;
	}
	// cout<<endl;
}
int ans =0;
for(int i=val_sum;i>0;i--){
	if(dp[n][i]<=W)
		ans = max(ans,i);

}

cout<<ans<<endl;


}
		

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)
#define fi first
#define se second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  long long K;
  scanf("%lld", &K);

  ll ta = max(0LL, K - A);
  A = max(0LL, A - K);
  B = max(0LL, B - ta);

  cout << A << " " << B << endl;
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) {
  T c = min(a, b), d = max(a, b);
  return c * (d / gcd(c, d));
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


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

int main(){
	vector<string> divi = {"dream", "dreamer", "erase", "eraser"};
	string s;
	cin >> s;
	
	rep(i, 4) reverse(divi.at(i).begin(), divi.at(i).end());
	reverse(s.begin(), s.end());

	bool can = true;
	for(int i = 0; i < s.size();){
		bool can2 = false;
		for(int j = 0; j < 4; j++){
			string d = divi.at(j);
			if(d == s.substr(i, d.size())){
				can2 = true;
				i += d.size();
			}
		}
		if(!can2){
			can = false;
			break;
		}
	}
	if(can) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 512
n = gets.to_s.chomp.chars
k = gets.to_s.to_i

sz = n.size
dpj = Array.new(sz+1){ [0] * (k+1) }
dpl = Array.new(sz+1){ [0] * (k+1) }
dpj[0][0] = 1

n.each_with_index do |c, i|
  
  (k+1).times do |j|
    dpj[i+1][j] += dpj[i][j] if c == '0'
    dpl[i+1][j] += dpj[i][j] if c >  '0'
    dpl[i+1][j] += dpl[i][j]
  end
  
  k.times do |j|
    dpj[i+1][j+1] += dpj[i][j] if c >  '0'
    dpl[i+1][j+1] += dpj[i][j] * [0, c.ord-'1'.ord].max
    dpl[i+1][j+1] += dpl[i][j] * 9
  end
end  

puts dpj[sz][k] + dpl[sz][k]

Measured memory_bytes: 1788
N = int(input())
S = list(input())

smap = {
    'R': 0,
    'G': 1,
    'B': 2,
}

def get_t(a, b):
    a, b = smap[a], smap[b]
    if a + b == 1:
        return 2
    elif a + b == 3:
        return 0
    else:
        return 1

d = [[0 for _ in range(3)] for _ in range(N)]

for i in range(N):
    for j in range(N):
        if i < j:
            s = S[j]
            d[i][smap[s]] += 1

ans = 0
for j in range(1, N-1):
    c = S[j]
    for i in range(0, j):        
        l = S[i]
        if c == l:
            continue
        t = get_t(c, l)
            
        if j + j - i < N and smap[S[j + (j - i)]] == t:
            ans -= 1
        ans += d[j][t]

print(ans)


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

namespace DPL_1D_1{
    public class Program{
        public static void Main(string[] args){
            var input = Console.ReadLine();
            var lis = new int[100000];
            lis[0] = int.MaxValue;
            var length = 1;
            while((input = Console.ReadLine()) != null){
                var a = int.Parse(input);
                if(lis[length - 1] < a){
                    lis[length++] = a;
                    continue;
                }

                var left = 0;
                var right = length;
                while(left < right) {
                    var mid = (left + right) / 2;
                    if(lis[mid] == a) break;
                    if(a < lis[mid]) right = mid;
                    else left = mid + 1;
                }
                lis[(left + right) / 2] = a;
            }
            Console.WriteLine(length);
        }
    }
}

Measured memory_bytes: 9912
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<(a+b>=c?"Yes":"No")<<endl;
}










Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)

f_inf = sys.maxsize

N, M, P = map(int, input().split())
ABC_d = {}
for m in range(M):
    A, B, C = map(int, input().split())
    if A in ABC_d:
        ABC_d[A].append([B, C - P])
    else:
        ABC_d[A] = [[B, C - P]]

cost = [-f_inf] * N
cost[0] = 0

def solve(pos, cnt):
    global cost

    if not(pos in ABC_d): return
    if cnt > N: cost[pos-1] = f_inf;

    for B, C in ABC_d[pos]:
        if cost[B - 1] == f_inf or cost[B - 1] >= cost[pos - 1] + C:
            pass
        elif cost[pos-1] == f_inf:
            cost[B-1] = f_inf
            solve(B, cnt + 1)
        elif cost[B - 1] < cost[pos - 1] + C:
            cost[B - 1] = cost[pos - 1] + C
            solve(B, cnt + 1)

solve(1, 1)

if (cost[-1] == sys.maxsize):
    print (-1)
else:
    print (max(0, int(cost[-1])))


Measured memory_bytes: 125016
#include<bits/stdc++.h>
using namespace std;
const int N=45,mod=1e9+7;	
int n,m,K,p[N][N],f[2][20][1<<20],nxt[1<<20][20];
inline void add(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int main(){
	cin>>n>>m>>K;
	int x,y,z,lim=(1<<n)-1;n--;
	memset(p,-1,sizeof(p));
	for(int i=1;i<=K;i++){
		scanf("%d%d%d",&x,&y,&z);
		p[x][y]=z;
	}
	for(int i=0;i<=lim;i++){
		for(int j=0;j<n;j++){
			if(!(i>>j&1)){
				for(int k=j+1;k<n;k++)
				if(i>>k&1){nxt[i][j]=i^(1<<k)^(1<<j);break;}
				if(!nxt[i][j])nxt[i][j]=i^(1<<j);
			}
		}
	}
	bool t=0;
	f[t^1][n][0]=1;
	for(int i=1;i<=m;i++,t^=1){
		for(int j=0;j<=lim;j++)f[t][0][j]=f[t^1][n][j],f[t^1][n][j]=0;
		for(int j=0;j<n;j++){
			for(int k=0;k<=lim;k++){
				if(!f[t][j][k])continue;
				if(p[i][j+1]!=(k>>j&1^1))add(f[t][j+1][k],f[t][j][k]);
				if(p[i][j+1] && !(k>>j&1))add(f[t][j+1][nxt[k][j]],f[t][j][k]);
				f[t][j][k]=0;
			}
		}
	}
	int ans=0;t^=1;
	for(int i=0;i<=lim;i++)add(ans,f[t][n][i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 246016
using System;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var sum = 0;
        var d = new int[n];
        for (int i = 0; i < n; i++)
        {
            d[i] = int.Parse(Console.ReadLine());
            sum += d[i];
        }

        if (sum % 10 != 0)
        {
            Console.WriteLine(sum);
            return;
        }

        var max = 0;
        for (int i = 0; i < n; i++)
        {
            if ((sum - d[i]) % 10 != 0)
            {
                max = Math.Max(max, sum - d[i]);
            }
        }

        Console.WriteLine(max);
    }
}


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

int main() {
  string s;
  cin >> s;
  int ans = 0;
  if (s == "SUN")
    ans = 7;
  else if (s == "MON")
    ans = 6;
  else if (s == "TUE")
    ans = 5;
  else if (s == "WED")
    ans = 4;
  else if (s == "THU")
    ans = 3;
  else if (s == "FRI")
    ans = 2;
  else if (s == "SAT")
    ans = 1;
  cout << ans << endl;
}


Measured memory_bytes: 256
def slove():
    import sys, collections
    input = sys.stdin.readline
    a = dict(collections.Counter(list(map(int, input().rstrip('\n').split()))).most_common())
    print("YES" if a[5] == 2 and a[7] == 1 else "NO")


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38512
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int R = sc.nextInt();
        
        if (N >= 10) {
            System.out.println(R);
        }
        
        else {
            System.out.println(R + (100*(10-N)));
        }
    }
}


Measured memory_bytes: 21716
val M = 1000000007L

fun co(n: Long): Co {
    return Co((n % M + M) % M)
}

fun main(args: Array<String>) {
    val s = readLine()!!
    val dp = Array(s.length + 1) {Array(13){co(0)}}
    dp[0][0] = co(1)
    for (i in 0 until s.length) {
        if (s[i] == '?') {
            for (j in 0 until 13) {
                for (d in 0 until 10) {
                    dp[i+1][(j * 10 + d) % 13] += dp[i][j]
                }
            }
        } else {
            val c = Character.getNumericValue(s[i])
            for (j in 0 until 13) {
                dp[i+1][(j * 10 + c) % 13] += dp[i][j]
            }
        }
    }
    println(dp[s.length][5].n)
}

data class Co(val n: Long) {
    inline operator fun plus(other: Co): Co {
        return co(n + other.n)
    }
    operator fun minus(other: Co): Co {
        return co(n - other.n)
    }
    operator fun times(other: Co): Co {
        return co(n * other.n)
    }
    operator fun div(other: Co): Co {
        return this * other.pow(M - 2)
    }
    fun pow(k_: Long): Co {
        var k = k_
        var a = this
        var res = co(1)
        while (k > 0) {
            if (k.and(1) == 1L) {
                res *= a
            }
            a *= a
            k = k.shr(1)
        }
        return res
    }
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : (x))
#define all(x) x.begin(), x.end() // sort(all(x))
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair((x), (y))

typedef long long ll;

typedef double T;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tiii;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<T> vt;
typedef vector<vt> vvt;
typedef vector<pii> vpi;
typedef vector<pii> vpl;
typedef vector<vpi> graph;
typedef complex<T> Pt;
typedef pair<Pt, Pt> Line;

const ll MOD = 1000; // 998244353;
const T EPS = 1e-10;
const int INF = 1e9 + 1;

/* Mod Library */

struct Mod {
    ll x;
    Mod (ll x = 0) : x(x) {}
    Mod operator+(Mod b) { return Mod((x + b.x)%MOD); }
    Mod operator-(Mod b) { return Mod((x - b.x + MOD)%MOD); }
    Mod operator*(Mod b) { return Mod((x * b.x)%MOD); }
    Mod operator/(Mod b) { return *this * inverse(b); }
    Mod operator%(Mod b) { return Mod(x % b.x); }

    ll euclid(ll a, ll b, ll &x, ll &y) {
        if (b) {
            ll d = euclid(b, a%b, y, x);
            y -= a/b*x;
            return d;
        }
        x = 1; 
        y = 0;
        return a;
    }
    
    Mod inverse(Mod a) {
        ll x, y, g = euclid(a.x, MOD, x, y);
        assert(g == 1);
        return Mod((x + MOD)%MOD);
    }

    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this^(e/2);
        r = r*r;
        return e&1 ? *this*r : r;
    }
};

/* Input Library */
template <typename A, typename B>
istream& operator>>(istream &in, pair<A, B> &p) {
    in >> p.first >> p.second;
    return in;
}

template <typename A, typename B>
ostream& operator<<(ostream &out, pair<A, B> &p) {
    out << p.first << " " << p.second;
    return out;
}

template <typename I>
istream& operator>>(istream &in, vector<I> &a) {
    trav(i, a) in >> i;
    return in;
}

template <typename I>
ostream& operator<<(ostream &out, vector<I> &a) {
    rep(i, 0, sz(a)) {
        if (i) out << " ";
        out << a[i];
    }
    return out;
}

void fast_io() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    //cout.tie(0);
    cin.exceptions(cin.failbit);
}

/* Solution */

void solve_test() {
    int n;
    cin >> n;
    vi h(n);
    cin >> h;

    int best = 0, cur = 0;
    for (int i = 1; i < n; ++i) {
        if (h[i] <= h[i-1]) {
            ++cur;
            best = max(cur, best);
        } else {
            best = max(cur, best);
            cur = 0;
        }
    }
    cout << best << endl;
}

void setup() {

}

int main() {
    setup();
    srand(time(0));
    fast_io();
    int t = 1;
    // cin >> t;
    while (t--) {
        solve_test();
    }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
 
int main() {
  // input
  long long n,a,b;cin >> n >> a >> b;
 
  // compute 
  long long div;
  long long ans = 0;
  div = n / (a + b);
  if(a == 0){
    cout << "0" << endl;
    return 0;
  }
  if((n % (a + b)) / a == 0){
     ans = div * a + (n -(a + b) * div);    
  }else{
     ans = div * a + a;
  }
  
  // output  
  cout << ans << endl;
  
}

Measured memory_bytes: 3608
use std::io::*;
use std::str::FromStr;

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn safe_read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn read<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.safe_read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let a: i32 = sc.read();
    let b: i32 = sc.read();
    let op = if a < b {
        "<"
    } else if a == b {
        "=="
    } else {
        ">"
    };
    println!("a {} b", op);
}



Measured memory_bytes: 5024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
int ABS(int a){return max(a,-a);}
ll ABS(ll a){return max(a,-a);}
double ABS(double a){return max(a,-a);}

const int N = 100005;
int arr[N];
int dp[N];

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

  ios::sync_with_stdio(0);
  cin.tie(0);

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

  for(int i=1;i<=n;i++)
    cin>>arr[i];

  for(int i=1;i<=n;i++)
    dp[i] = INT_MAX;

  dp[1]=0;

  for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=k;j++)
    {
      if(i+j<=n)
        dp[i+j] = min(dp[i+j],dp[i]+ABS(arr[i]-arr[i+j]));
    }
  }

  cout<<dp[n];
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<vector>
using namespace std;

typedef long long ll;
const int MAXN=5e5+5;

int n,K;
int p[MAXN],q[MAXN],in[MAXN];
set<int> f,b;
set<int>::iterator it;
vector<int> E[MAXN];

int main(){

    scanf("%d%d",&n,&K);
    for(int i=1;i<=n;i++){
        scanf("%d",&p[i]);
        q[p[i]]=i;
    }
    for(int i=1;i<K;i++) f.insert(p[i]);
    for(int i=1;i<=n;i++){
        if(i+K-1<=n) f.insert(p[i+K-1]);
        f.erase(p[i-1]);
        b.insert(p[i]);
        if(i>K) b.erase(p[i-K]);

        it=f.upper_bound(p[i]);
        if(it!=f.end()) E[q[*it]].push_back(i),in[i]++;
        it=b.upper_bound(p[i]);
        if(it!=b.end()) E[q[*it]].push_back(i),in[i]++;
    }
    f.clear();
    for(int i=1;i<=n;i++)
        if(!in[i])
            f.insert(-i);
    int l=0;
    while(f.size()){
        int u=-(*f.begin());
        p[++l]=u;
        f.erase(f.begin());
        for(int i=0;i<(int)E[u].size();i++){
            int v=E[u][i];
            if((--in[v])==0)
                f.insert(-v);
        }
    }
    for(int i=1;i<=n;i++)
        q[p[i]]=n-i+1;
    for(int i=1;i<=n;i++)
        printf("%d\n",q[i]);

    fclose(stdin);
    fclose(stdout);
}


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

#define FILE
#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

int T;
int f;
char c;
int rev;
int type;
int main()
{
    #ifdef FILEs
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);

    string t;
    cin >> t;
    deque<char> d(t.begin(), t.end());
    cin >> T;
    while(T --){
        cin >> type;
        if(type == 1){
            rev ^= 1;
        }
        else{
            cin >> f >> c;
            if(rev == 1){
                f = 3 - f;
            }
            if(f == 1){
                d.push_front(c);
            }
            else{
                d.push_back(c);
            }
        }
    }
    if(rev == 1){
        reverse(d.begin(), d.end());
    }
    for(auto x: d){
        cout << x;
    }
}


Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  	cin>>n;
  	vector<int>a(n);
  	for(int i=0;i<n;i++){
    	cin>>a[i];
    }
  	int cou=0,ans=0;
  
  while(1){
    	cou=0;
  	for(int i=0;i<n;i++){
    	if(a[i]%2==0){
        	a[i]=a[i]/2;
          	cou++;
        }
    }
    if(cou!=n){
    	break;
    }
    ans++;
  }
  	cout<<ans<<endl;
    	
    
}

Measured memory_bytes: 256
import java.util.*;


import java.io.*;
/**
 * MLASERP
 */
public class Main {

    
    static MyScanner in  = new MyScanner();
   static int mod  = 1000000007;
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      static StringTokenizer st;
      static int []dr  = {1,-1,0,0};
      static int [] dc = {0,0,-1,1};
public static void main(String[] args) {
   String S = in.next();
   String T = in.next();
   int min = T.length();
   for(int i=0;i<=S.length()-T.length();i++){
        min = Math.min(compare(S.substring(i, i+T.length()),T),min);
   }
   out.println(min);
   out.flush();
}
private static int compare(String substring, String t) {
    int val = 0;
    for(int i=0;i<t.length();i++){
        if(t.charAt(i)!=substring.charAt(i))
            val++;
    }
    return val;
}
static int rcToxy(int r, int c,int W){
    return r*W+c;
}
static class Node{
    int r, c,prev,change;
    Node(int r, int c){
        this.r =r ;
        this.c = c;
    }
}
public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;
 
      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }
 
      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
 
      int nextInt() {
          return Integer.parseInt(next());
      }
 
      long nextLong() {
          return Long.parseLong(next());
      }
 
      double nextDouble() {
          return Double.parseDouble(next());
      }
 
      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
}

Measured memory_bytes: 33592
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

std::string S;
int ans;

int main()
{
	in >> S;
	ans += S[0] - '0';
	ans += S[1] - '0';
	ans += S[2] - '0';
	out << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())

sys.setrecursionlimit(10 ** 9)


def main():
    A, B = MAP()
    L = [A+B, A-B, A*B]
    print(max(L))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38460
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int count = 0;
        for(int i = 0; i < n; i++){
            if(isprime(Integer.parseInt(sc.next()))) count++;
        }
        System.out.println(count);
    }
    
    static boolean isprime(int x){
        if(x == 2) return true;
        if(x < 2 || x%2 == 0) return false;
        double sqrt = Math.sqrt(x+1);
        for(int i = 3; i <= sqrt; i += 2){
            if(x%i == 0) return false;
        }
        return true;
    }
}


Measured memory_bytes: 41372
#include "bits/stdc++.h"
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
typedef long long ll;

int INF = 1000000005;
using namespace std;

int main() {
    int n,a[4];
    cin >> n;
    REP(i, 4) {
        a[3-i] = n % 10;
        n /= 10;
    }
    REP(i, 1 << 3) {
        int ans=a[0];
        REP(j, 3) {
            ans += (i&(1 << j) ? a[j + 1] : (-a[j + 1]));
        }
        if (ans == 7) {
            cout << a[0];
            REP(j, 3) {
                cout << (i&(1 << j) ? '+' : '-') << a[j + 1];
            }
            cout << "=7" << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
/*Huyyt*/
#include<bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int dir[8][2] = {{0, 1}, {1, 0}, {0, -1}, { -1, 0}, {1, 1}, {1, -1}, { -1, -1}, { -1, 1}};
const int mod = 998244353, gakki = 5 + 2 + 1 + 19880611 + 1e9;
const int MAXN = 2e5 + 5, MAXM = 2e5 + 5, N = 1e5 + 5;
int to[MAXM << 1], nxt[MAXM << 1], Head[MAXN], tot = 1;
inline void addedge(int u, int v)
{
        to[++tot] = v;
        nxt[tot] = Head[u];
        Head[u] = tot;
}
vector<int> l, r;
int main()
{
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        int n;
        cin >> n;
        l.push_back(0), r.push_back(0);
        for (int i = 1; i <= n; i++)
        {
                int L, R;
                cin >> L >> R;
                l.push_back(L);
                r.push_back(R);
        }
        ll anser = 0;
        sort(l.rbegin(), l.rend());
        sort(r.begin(), r.end());
        for (int i = 0; i <= n; i++)
        {
                if (l[i] > r[i])
                {
                        anser += 2LL * (l[i] - r[i]);
                }
        }
        cout << anser << endl;
        return 0;
}


Measured memory_bytes: 1276
import sys
import bisect
from math import ceil, floor, sqrt
readline = sys.stdin.buffer.readline
MOD = int(1e9 + 7)

def LL():
    return list(map(int, readline().split()))

n = int(readline())
A = LL()

counter = [0] * 60
ans = 0
for i in range(60):
    for v in A:
        counter[i] += (v >> i) & 1
    ans += pow(2, i, MOD) * (n - counter[i]) * counter[i]
    ans %= MOD
print(ans)

Measured memory_bytes: 89712
using static System.Console;
using static System.Convert;

class Program
{
    static void Main(string[] args)
    {
        var price = ToInt32(ReadLine());
        for(var i = 0; i < int.MaxValue; i++)
        {
            if (4 * i > price) { WriteLine("No"); break; }
            if ((price - 4 * i) % 7 == 0) { WriteLine("Yes");break; }
        }
    }
}



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

using ll    = long long;
using ull   = unsigned long long;
using veci  = vector<int>;
using vecll = vector<ll>;
#define EPS (1e-7)
#define INF (1e9)
#define PI  (acos(-1))
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define REP(i,n) for(int i= 0;i<(int)(n);++i)
#define pb push_back

veci enum_div(int n){
	veci ret;
	ret.pb(1);
	for(int i=1;i*i<n;i++){
		if(n%i==0){
			ret.pb(i);
			if(i != n/i){ret.pb(n/i);}
		}
	}
	ret.pb(n);
	return ret;
}
int gcb(int a,int b){return ((b == 0)? a : gcb(b,a%b));}
int gcd(int a,int b){return (a*b) / gcb(a,b);}

int main(){
    int a,b;
    cin >> a >> b;
    cout << (a+b)%24 << endl;
    return 0;
}



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

int main()
{
    int n,cur;
    cin >> n;
    long long ans = 0;
    cin >> cur;
    long long tot[3] = { 0,0,cur };
    for (int i = 2; i <= n; i++) {
        cin >> cur;
        if (i % 2) {
            tot[1] = max(tot[1], tot[2]);
            tot[0] += cur;
            tot[2] += cur;
        }
        else {
            tot[0] = max(tot[0], tot[1]);
            tot[1] += cur;
        }
    }
    cout << (n % 2 ? max(tot[0], tot[1]) : max(tot[1], tot[2]));
}

Measured memory_bytes: 3640
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  int N, X;
  cin >> N >> X;
  int min_m = 1000;
  rep(i, N) {
    int m;
    cin >> m;
    min_m = min(min_m, m);
    X -= m;
  }
  int answer = N + (X / min_m);
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

string a[1010];
ll dp[1010][1010];

int main(int argc, char const *argv[])
{
	int h, w; cin >> h >> w;
	rep(i, h) cin >> a[i];
	dp[0][0] = 1;
	rep(i, h)rep(j, w){
		if (a[i][j] == '#') continue;
		if (i - 1 >= 0) (dp[i][j] += dp[i - 1][j]) %= MOD;
		if (j - 1 >= 0) (dp[i][j] += dp[i][j - 1]) %= MOD;
	}

	printf("%lld\n", dp[h - 1][w - 1]);
	return 0;
}


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

int main(){
    string s;
    cin >> s;
    if((s.at(2) == s.at(3)) && (s.at(4) == s.at(5))){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
} 

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

long long n, t, a, maxd[100002], par[100002], dist, ans=0;
vector<long long>adjl[100002];

long long dfs1(long long now, long long bef, long long distnow){
	par[now]=bef;
	if (now==t) dist=distnow;
	if (adjl[now].size()==1 && adjl[now][0]==bef){
		return maxd[now]=0;
	}
	for (long long next : adjl[now]){
		if (next==bef) continue;
		maxd[now]=max(maxd[now],dfs1(next,now,distnow+1)+1);
	}
	return maxd[now];
}

int main(){
	memset(maxd,-1,sizeof maxd);
	cin >> n >> t >> a;
	for (int i=0;i<n-1;i++){
		long long u, v;
		cin >> u >> v;
		adjl[u].push_back(v);
		adjl[v].push_back(u);
	}
	dfs1(a,0,0);
	long long tmp=0;
	while (dist>0){
//		cout << tmp << " " << maxd[t] << " " << dist << "\n";
		ans=max(ans,tmp+maxd[t]+dist-1);
		dist-=2;
		tmp++;
		t=par[t];
	}
	cout << ans << "\n";
}

Measured memory_bytes: 11264