akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
 int main(void){
     lint A,B,C,X,Y;
     cin >> A >> B >> C >> X >> Y;
     lint ans=200000*C,Cpi=100000;
     lint value=ans;
     rep(i,100000){
         value-=2*C;
         Cpi--;
         if(Cpi<X) value+=A;
         if(Cpi<Y) value+=B;
         ans=min(ans,value);
     }
     cout << ans << endl;
 }

Measured memory_bytes: 256
#include<cstdlib>
#include<cstdio>
#include<iostream>
#include<vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <map>

using namespace std;


int main() {
    int M, D;
    cin >> M >> D;
    int ans = 0;
    for (int m = 1; m <= M; m++) {

        for (int d1 = 2; d1 < 10; d1++) {
            if (m % d1 != 0) {
                continue;
            }
            for (int d10 = 2; d10 < 10; d10++) {
                if(d10*10+d1 > D){
                    break;
                }
                ans += (m == d10 * d1);
            }
        }
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int A,B,C; cin>>A>>B>>C;
  int ans=min(A+B+1,C)+B;
  cout<<ans<<endl;
  }



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

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

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var x int
	fmt.Scanf("%d", &x)

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

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

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  int ans = 0, c = 0;
  for (int i = 0; i < n; i++) {
    cin >> h[i];
    if (h[i] >= c) {
      ans++;
      c = h[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
N = int(sys.stdin.readline())
if N < 6:
  x, y, z = 0, 0, 0
else:
  x = int((N / 6)**0.5)
  y = int(round(((((N -1)/3) - 1/9)**0.5 - 1/3)+ 0.5, 0))
  z = int((N - 5)**0.5 + 1)            
n = [0]*(N+1)
for i in range(1,x+1):
  for j in range(i,y+1):
    for k in range(j, z+1):
      p = int((i + j + k)**2 - i*(j + k) - j*k)
      if N < p:
        break
      if i == j:
        if j == k:
          n[p] += 1
        else:
          n[p] += 3
      else:
        if i == k:
          n[p] += 3
        else:
          if j == k:
            n[p] += 3
          else:
            n[p] += 6
for i in range(1,N+1):
  print(n[i]) 

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

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)
#define leng(n) (int)(log10(n)+1)


typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

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> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
Vi accum(Vi v){Vi ret((v).size());ret[0]=v[0];REP(i,1,(v).size()) ret[i]=ret[i-1]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

Vi yakusuu(int n){
    Vi ret;
    for(int i=1 ; i*i<=n ; ++i){
        if(n%i == 0){
            ret.push_back(i);
            if(i*i!=n) ret.push_back(n/i);
        }
    }
    sort(ALL(ret));
    return ret;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
    int n;
    cin>>n;
    Vi a(n);
    REP(i,0,n){
        cin>>a[i];
        a[i]--;
    }

    int ans=0,now=0;
    REP(i,0,2*n){
        now=a[now];
        ans++;
        if(now==1){
            cout<<ans<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  int p = 0;
  int q = 0;
  int b;
  
  for(int a=1;a<sqrt(N);a++){
    for(int c=1;c<=(N-a*a);c++){
      b = (N-c)/a;
      if((N-c) % a == 0 && a<b){
        p++;
      }
      else if((N-c) % a == 0 && a==b){
        q++;
      }
    }
  }
  
  cout << 2*p+q << endl;
  
}

Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include<iomanip>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;
ll mod=1e9+7;
ll modn(ll a,ll mod)
{
  a%=mod;
  if(a<0)a+=mod;
  return a;
}
long long modinv(long long a,long long mod)
{
  long long cnt=a,res=1;
  long long m=mod-2;
  while(m>0)
  {
    if(m&1)res*=cnt;
    cnt=cnt*cnt;
    cnt%=mod;
    res%=mod;

    m>>=1;
  }
  return res;
}
ll c(ll num,ll d)
{
  if(num==1 || num==d || d==0)return 1;
  return modn(modn(c(num-1,d-1)*num,mod)*modinv(d,mod),mod);
}

int  main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout<<setprecision(10);
  ll n,m;
  cin>>n>>m;
  map<ll,ll> pd;
  ll sqrtm=sqrt(m)+1;
  ll tm=m;
  repi(i,2,sqrtm+1)
  {
    while(tm%i==0){pd[i]++;tm/=i;}
    if(tm==1)break;
  }
  if(tm>1)pd[m]++;
  ll res=1;
  for ( auto p : pd)
  {
    //cout<<p.first<<" "<<p.second<<endl;
    res=modn((ll)res*c(p.second+n-1,p.second),mod);
  }
  cout<<res<<endl;

  return 0;

}


Measured memory_bytes: 256
N = int(input())
B = list(map(int, input().split()))


ans = []
while B:
    itr = list(enumerate(B, start=1))[::-1]
    for i, b in itr:
        if i == b:
            del B[i - 1]
            ans.append(b)
            break
    else:
        print(-1)
        exit()

print(*ans[::-1], sep='\n')


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

using namespace std;

int main(void){
	long long int a, b, c, x, y;
	scanf("%lld %lld %lld %lld %lld", &a, &b, &c, &x, &y);

	long long int mi = min(a*x + b*y, (min(x, y) * 2 * c )+ ( (max(x, y) - min(x, y)) * (max(x, y) == x ? a : b)));
	long long int mini = min((min(x, y) * 2 * c )+ ( (max(x, y) - min(x, y)) * (max(x, y) == x ? a : b)), max(x,y)*2*c);
	printf("%lld\n", min(mi, mini));
	return 0;
}

Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, M = map(int, input().split())
uf = UnionFind(N)

for _ in range(M):
    A, B = map(int, input().split())
    uf.union(A - 1, B - 1)

roots = uf.roots()
print(len(roots)-1)

Measured memory_bytes: 12860
import Control.Monad
import Control.Applicative
import Data.List
import Data.Array

main = do

    [n , t]  <- (map read . words) <$> getLine
    tn <- map read . words <$> getLine
    print (solve t tn)
    


solve :: Int -> [Int] -> Int
solve t (x:[]) = t
solve t (x:ys) = min t ((head ys) - x) + (solve t ys)


Measured memory_bytes: 70012
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
    if('0' <= c && c <= '9') return (c-'0');
    return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
    ll N,M;
    cin>>N>>M;
    if(N*2>=M){
        cout << M/2 << endl;
    }
    else{
        cout << N+(M-2*N)/4 << endl;
    }
}

Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto s = readln.chomp;
  auto t = readln.chomp;

  auto res = false;
  foreach (i; 0..s.length) {
    auto f = true;
    foreach (j; 0..s.length) {
      if (s[j] != t[(j+i)%s.length]) {
        f = false;
      }
    }
    if (f) {
      res = true;
    }
  }

  if (res) {
    writeln("Yes");
  } else {
    writeln("No");
  }
}


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

int main(void){
  int n, x;
  cin >> n >> x;
  
  vector<int> v(n);
  for(int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  
  sort(v.begin(), v.end());
  
  int ans = 0;
  for(int i = 0; i < n; i++) {
    if(v.at(i) > x) {
      break;
    }
    x -= v.at(i);
    ans++;
  }
  if(ans == n && x > 0) {
    cout << ans - 1 << endl;
  } else {
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
def read():
    return int(input())

def reads(sep=None):
    return list(map(int, input().split(sep)))

def check(i, j, a, b):
    for x in range(len(b)):
        for y in range(len(b)):
            if a[i+x][j+y] != b[x][y]:
                return False
    return True

def main():
    n, m = reads();
    a = [input() for _ in range(n)]
    b = [input() for _ in range(m)]
    for i in range(n - m + 1):
        for j in range(n - m + 1):
            if check(i, j, a, b):
                print('Yes')
                return
    print('No')
 
main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

void input() {
  ;
  cin >> N;
  ;
}
int f(int x) {
  if (x == 1) {
    return 1;
  }
  if (x == 0) {
    return 0;
  }
  return (1 + 2 * f(x / 2));
}
void solve() {
  //
  cout << f(N) << endl;
  ;
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << (a * b % 2 == 0 ? "Even" : "Odd") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int max(int a, int b)
{
  return a > b ? a : b;
}

int min(int a, int b)
{
  return a < b ? a : b;
}


int main()
{
  int i;
  int n, r;
  int maxv = -1000000000, minv;

  scanf("%d", &n);
  scanf("%d", &r);
  minv = r;

  for (i = 1; i < n; i++) {
    scanf("%d", &r);
    maxv = max(maxv, r - minv);
    minv = min(minv, r);
  }

  printf("%d\n", maxv);

  return 0;
}



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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<long long, long long> ii;
vector<ii> vec;
long long a[100005], n, dp[100005];
vector<int> graph[100005];

int main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        vec.pb(mp(a[i], i));
    }
    for(int i = 1; i <= n - 1; i++){
        int u, v;
        cin >> u >> v;
        graph[u].pb(v);
        graph[v].pb(u);
    }
    sort(vec.begin(), vec.end());
    for(int i = 0; i < vec.size(); i++){
        if(dp[vec[i].se] == 0){
            for(int j = 0; j < graph[vec[i].se].size(); j++){
                int v = graph[vec[i].se][j];
                if(a[v] > a[vec[i].se])
                    dp[v] = 1;
            }
        }
    }
    for(int i = 1; i <= n; i++){
        if(dp[i])
            cout << i << " ";
    }
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
 int A[200005];
 int con[200005];
using namespace std;

int main(){

string s;
int n,m,i,sum=0,d,k,dog=0,pen=0;
scanf("%d %d",&n,&m);

for(i=0;i<m;i++){scanf("%d",&d); cin>>s; 

if(s[0]=='W' ){
if(con[d]==0 ){A[d]++; }
else{continue;}


	}
else{ 

con[d]=1;
  }

  }
for(i=1;i<=n;i++){dog+=con[i]; pen+=con[i]*A[i];  }
printf("%d %d\n",dog,pen);


	return 0;	
	}


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

int main(){
	vector<char> S(4);
	for(int i = 0; i < 4; i++) cin >> S.at(i);
	sort(S.begin(), S.end());
	if(S.at(0) == S.at(1) && S.at(1) != S.at(2) && S.at(2) == S.at(3)) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        h: usize,
    }
    let mut h = h as u64;
    let mut n = 1u64;
    let mut result = 0;
    while h > 0 {
        result += n;
        n *= 2;
        h /= 2;
    }
    println!("{}", result);
}


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

bool is_prime(int n) {
    if (n==1) {
        return false;
    }
    
    for (int i=2; i*i<=n; i++) {
        if (n%i==0) {
            return false;
        }
    }
    
    return true;
}

signed main() {
    while (true) {
        int n, x;
        cin >> n >> x;
    
        if (n==0 && x==0) {
            break;
        }
        
        vector<int> v;
        
        for (int i=0; i<n; i++) {
            int vi;
            cin >> vi;
            
            while (vi<=x) {
                v.push_back(vi);
                vi *= 2;
            }
        }
        
        int dp[x+1];
        
        for (int i=0; i<=x; i++) {
            dp[i] = 0;
        }
        
        dp[0] = 1;
        
        for (int i=0; i<v.size(); i++) {
            for (int j=0; j<=x; j++) {
                if (dp[j]==1 && j+v[i]<=x) {
                    dp[j+v[i]] = 1;
                }
            }
        }
        
        bool flag = true;
        
        for (int i=x; i>=1; i--) {
            if ((i==1 && dp[i]==1) || (dp[i]==1 && is_prime(i))) {
                cout << i << endl;
                flag = false;
                break;
            }
        }
        
        if (flag) {
            cout << "NA" << endl;
        }
    }
}


Measured memory_bytes: 10924
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let a:String = read();
    let ch: Vec<char> = a.chars().collect();
    let mut aflag = false;
    let mut bflag = false;
    let mut cflag = false;
    for i in 0..3{
	if ch[i]=='a' {
	    aflag=true;
	}else if ch[i]=='b'{
	    bflag=true;
	}else if ch[i]=='c'{
	    cflag=true;
	}
    }
    if aflag&&bflag&&cflag{
	println!("Yes");
    }else{
	println!("No");
    }
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n;
	int flag = 1;
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		int x; cin >> x;
		ans += (flag & x & 1);
		flag ^= 1;
	}
	cout << ans;
}

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

const int MAX_N = 10000;

const int INF = 1 << 29;
int T[MAX_N+10];
int dp[2][2][MAX_N/2+10];

int main ( void )
{
	int n;
	cin >> n;
		int half = n / 2;
		for (int i = 0; i+1 < n; ++i) {
			cin >> T[i+1];
		}
		for (int i = 0; i < 2; ++i)
			for (int j = 0; j < 2; ++j)
				for (int k = 0; k <= half; ++k) { dp[i][j][k] = INF; }
		dp[0][0][0] = 0;
		for (int i = 1; i <= n; ++i) {
			int ii = i & 1, ij = (i + 1) & 1;
			for (int k = 0; k <= half; ++k) {
				dp[ii][0][k] = min(dp[ij][0][k], dp[ij][1][k]);
				if (k > 0) {
					dp[ii][1][k] = min(dp[ij][0][k-1] + T[i-1] + T[i], dp[ij][1][k-1] - T[i-1] + T[i]);
				}
			}
		}
		cout << min(dp[0][0][half], dp[0][1][half]) << endl;
//		cout << min(dp[1][0][half], dp[1][1][half]) << endl;
	return 0;
}

Measured memory_bytes: 1280
n=int(input())
def dfs(s):
    if int(s) > n:
        return 0
    if all(s.count(c)>0 for c in "753"):
        ret = 1
    else:
        ret = 0
    for c in "753":
        ret += dfs(s+c)
    return ret
print(dfs("0"))




Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main() {
  
  int N ;
  cin >> N ;
  
  using pii = pair<pair<string , int> , int>;
  
  vector<pii> rank(N);
  
  for(int i = 0 ; i < N ; i++){
    
    cin >> rank.at(i).first.first >> rank.at(i).first.second ;
    rank.at(i).first.second = -rank.at(i).first.second ;
    rank.at(i).second = i+1 ;
    
  }
  
  sort(rank.begin() , rank.end());
  
  for(int i = 0 ; i < N ; i++){
    
    cout << rank.at(i).second << endl;
    
  }
}

Measured memory_bytes: 256
def main():
    n = int(input())
    ai = list(map(int, input().split()))
    cnt = 0
    
    for i in range(n):
        if i != n-1:
            if ai[i] > ai[i+1]:
                cnt += ai[i]-ai[i+1]
                ai[i+1] = ai[i]
    print(cnt)
    
if __name__ == "__main__":
    main()

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

int main() {
  int N; cin >> N;
  vector<pair<pair<string,int>,int>> X(N,make_pair(make_pair("",0),0));
  for (int i=0;i<N;i++){
    cin >> X.at(i).first.first >> X.at(i).first.second;
    X.at(i).first.second=100-X.at(i).first.second;
    X.at(i).second=i+1;
  }
  sort(X.begin(),X.end());
  for (int i=0;i<N;i++){
    cout << X.at(i).second << endl;
  }
}

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

public class Main {

    public static void main(String[] args) throws IOException {


        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        while(true) {
            
            String[] line = br.readLine().split(" ");
            int n = Integer.parseInt(line[0]);
            int x = Integer.parseInt(line[1]);
            int num = 0;
            
            if(n == 0 && x == 0) { break; }
            
            for (int a = 1; a <= n; a++){
                for (int b = 2; b <= n; b++){
                    for(int c = 3; c <= n; c++){
                        if( a+b+c == x && a < b && b < c ) {
                            num += 1;
                        }
                    }
                }           
            }
            
            System.out.println(num);
            
        }
            
                
    }


}

Measured memory_bytes: 24980
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	long long n,l,ans=0;
	cin>>n>>l;
	long long t[n];
	rep(i,n){
		cin>>t[i];
		if(i==0)continue;
		else{
			if(t[i]<t[i-1]+l)ans+=t[i]-t[i-1];
			else ans+=l;
		}
	}
	cout<<ans+l<<endl;
	return 0;
}

Measured memory_bytes: 1792
n = int(input())

cnt = [[0] * 10 for _ in range(10)]
for i in range(1, n+1):
    cnt[int(str(i)[0])][int(str(i)[-1])] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += cnt[i][j]*cnt[j][i]
print(ans)

Measured memory_bytes: 9200
N = int(input())
A = list(map(int,input().split()))
num = list(range(1,N+1))
dic = dict(zip(num,A))

dic_s = sorted(dic.items(), key=lambda x:x[1])


ans = []
for i in dic_s:
  ans.append(str(i[0]))

ans2 = ' '.join(ans)
print(ans2)



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

char a[3][3];
int i,j;

int main()
{
	ios::sync_with_stdio(false);
	
	for(i=0;i<3;i++)
	{
		for(j=0;j<3;j++)
		{
			cin>>a[i][j];
		}
	}
	
	cout<<a[0][0]<<a[1][1]<<a[2][2]<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
using ll=long long;
const ll INF=1LL<<50;

int main(){
	int n,m;
	cin >> n >> m;
	int a[2000],b[2000];
	ll c[2000];
	for(int i=0;i<m;i++){
		cin >> a[i] >> b[i] >> c[i];
		c[i]=-c[i];
	}

	ll dist[1000];
	for(int i=0;i<n;i++) dist[i]=INF;
	dist[0]=0;
	for(int loop=0;loop<n-1;loop++){
		for(int i=0;i<m;i++){
			if(dist[a[i]-1]==INF) continue;
			if(dist[b[i]-1]>dist[a[i]-1]+c[i]){
				dist[b[i]-1]=dist[a[i]-1]+c[i];
			}
		}
	}

	ll ans=dist[n-1];
	bool negative[1000];
	for(int i=0;i<n;i++) negative[i]=false;
	for(int loop=0;loop<n;loop++){
		for(int i=0;i<m;i++){
			if(dist[a[i]-1]==INF) continue;
			if(dist[b[i]-1]>dist[a[i]-1]+c[i]){
				dist[b[i]-1]=dist[a[i]-1]+c[i];
				negative[b[i]-1]=true;
			}
			if(negative[a[i]-1]==true) negative[b[i]-1]=true;
		}
	}
	if(negative[n-1]) cout << "inf" << endl;
	else cout << -ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 100005;

int main() {
    int n; cin >> n;
    cout << n/3 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  int ab[26]={};
  int i;
  while(getline(cin,str)){
    for(i=0;i<str.size();i++){
      if(str[i]>='a'&&str[i]<='z') ab[str[i]-'a']++;
      else if(str[i]>='A'&&str[i]<='Z') ab[str[i]-'A']++;
    }
  //cout << str << endl;
  }
  for(i=0;i<26;i++){
    cout << (char)('a'+i) << " : " << ab[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, k, n, x, w, ans = 0, count = 0;
  string s, t;
  cin >> x;
  n = 100;
  while (n < x)
  {
    n *= 1.01;
    count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define N 100010
#define inf 0x3f3f3f3f
#define ll long long
int n, t;
int a[N];
int main()
{
    scanf("%d%d", &n, &t);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    int ans = 0, mx = 0;
    int tot = 0;
    for (int i = n; i; i--) {
        mx = max(a[i], mx);
        ans = max(mx - a[i], ans);
    }
    mx = 0;
    for (int i = n; i; i--) {
        mx = max(a[i], mx);
        if (mx - a[i] == ans)
            tot++;
    }
    printf("%d\n", tot);
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string.h>
#include <stdlib.h>
#include <limits>
#include <iomanip>
using namespace std;

int main(){

    int A,B;
    cin >> A >> B;

    int ans = 6 - A - B;
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n,m,x;
  cin>>n>>m>>x;
  int left=0,right=0;
  for(int i=0;i<m;i++){
    int tmp;
    cin>>tmp;
    (tmp<x)?left++:right++;
  }
  cout<<min(left,right)<<endl;
  return 0;
}


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

int n;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;
const ll LINF=1e18;

struct UnionFind{
private:
    vector<int> par;
    vector<int> rank;
public:
    UnionFind(int n){
        par.resize(n);
        rank.resize(n);
        for (int i=0;i<n;i++){
            par[i]=i;
            rank[i]=0;
        }
    }
    int root(int x){
        if(par[x]==x)return x;
        else return par[x]=root(par[x]);
    }
    bool issame(int x,int y){
        return root(x)==root(y);
    }
    bool merge(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y)return false;
        if(rank[x]<rank[y])swap(x,y);
        if(rank[x]==rank[y])++rank[x];
        par[y]=x;
        return true;
    }
};

int main(){
    ll n,m;
    cin>>n>>m;
    UnionFind uf(2*n);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        --a,--b;
        uf.merge(a,b+n);
        uf.merge(a+n,b);
    }
    bool b=true;
    for(int i=0;i<n;i++){
        if(uf.issame(i,i+n)){
            b=false;
            break;
        }
    }
    if(b){
        int par=uf.root(0);
        ll cnt=0;
        for(int i=0;i<n;i++){
            if(uf.root(i)==par)++cnt;
        }
        cout<<cnt*(n-cnt)-m<<endl;
    }
    else{
        cout<<n*(n-1)/2-m<<endl;
    }
}


Measured memory_bytes: 1792
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int x = parseInt(sc.next());
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		out.println(abs(x-a)<abs(x-b)?"A":"B");
	}
}


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

using namespace std;

typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef long double ld;

const int inf = 1e9;
const ll inf64 = 1e18;

int main() {

#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif

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

    string s;
    cin >> s;

    for (char c : s) {
        if (c == '?')
            c = 'D';
        cout << c;
    }
    cout << "\n";

    return 0;
}


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

int main() {
	
	string a;
	int kazu,ten1,ten2;
	char sabu;
	int i;
	ten1=0;
	ten2=0;
	
	while(1){
		cin >> a;
		kazu=a.size();
		if(kazu==1) break;
		for(i=1;i<kazu+1;i++){
			sabu=a[i];
			if(sabu=='A') ten1++;
			if(sabu=='B') ten2++;
		}
		if(ten1<ten2) ten2++;
		if(ten1>ten2) ten1++;
		cout << ten1 << " " << ten2 << endl;
		ten1=0;
		ten2=0;
	}
	
	return 0;
}

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

int main() {
    while (true) {
        int n; cin >> n;
        if (n == 0) { break; }

        int s[1000];
        double m = 0;
        for (int i = 0; i < n; i++) {
            cin >> s[i];
            m += s[i];
        }
        m /= n;

        double a = 0;
        for (int i = 0; i < n; i++) {
            a += pow(s[i] - m, 2);
        }
        a = sqrt(a / n);
        printf("%f\n", a);
    }

    return 0;
}


Measured memory_bytes: 3212
#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;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); if (n == 0) cout << endl; REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

class Combination {
    vector<ll> factorial;
    vector<ll> fact_inverse;
    vector<ll> inverse;
    int mod;

    void init(int size) {
        factorial[0] = 1;
        factorial[1] = 1;
        fact_inverse[0] = 1;
        fact_inverse[1] = 1;
        inverse[1] = 1;

        for (int i = 2; i < size; i++) {
            factorial[i] = factorial[i - 1] * i % mod;
            inverse[i] = mod - inverse[mod % i] * (mod / i) % mod;
            fact_inverse[i] = fact_inverse[i - 1] * inverse[i] % mod;
        }
    }

    public:
        // Up to about 2,000,000 can be processed within 1 sec.
        Combination(int size, int m) {
           factorial = vector<ll>(size);
           fact_inverse = vector<ll>(size);
           inverse = vector<ll>(size);
           mod = m;
           init(size);
        }
    
        ll calc(int n, int k) {
            if (n < k) {
                return 0;
            }
            if (n < 0 || k < 0) {
                return 0;
            }
            return factorial[n] * (fact_inverse[k] * fact_inverse[n - k] % mod) % mod;
        }

        // i.e. nHk
        ll with_repetition(int n, int k) {
            return calc(n + k - 1, k);
        }
};

void solve() {
    ll x, y;
    cin >> x >> y;
    if ((x + y) % 3 != 0 or x * 2 < y or x > y * 2) {
        cout << 0 << endl;
        return;
    }

    int n = (x + y) / 3;
    Combination c(1001001, MOD);
    cout << c.calc(n, x - n) << endl;
}


Measured memory_bytes: 26672
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {
  long double result;
  long double a, b, c;
  
  cin >> a >> b >> c;
  
  result = sqrt(a) + sqrt(b) + 1.0E-14;
  c = sqrt(c);
  
  if(result<c){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{    int A,B,C;
     cin>>A>>B>>C;
     if((A-B)<C)
     {
         cout<<(C-(A-B))<<endl;
     }
     else
     {
         cout<< 0<<endl;
     }




  return 0;
  }


Measured memory_bytes: 888
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<tuple>
using namespace std;

const int INF = 10000;

int main() {
    int n, m;
    while(cin >> n, n) {
        map<string, int> id;
        vector<tuple<int, int>> cross;
        int size = 0;
        for(int i = 0; i < n; ++i) {
            string x, y, input;
            int index;
            cin >> input;
            index = input.find("-");
            x = input.substr(0, index);
            y = input.substr(index + 1, input.size() - index - 1);
            if(!id.count(x)) id[x] = size++;
            if(!id.count(y)) id[y] = size++;
            cross.push_back(tuple<int, int>(id[x], id[y]));
        }

        // adjacent matrix
        vector<vector<int>> distance(size, vector<int>(size, INF));
        for(auto& c: cross) distance[get<0>(c)][get<1>(c)] = 1;
        for(int a = 0; a < size; ++a) for(int b  = a + 1; b < size; ++b) {
            set<int> ac, ca, bc, cb;
            for(auto c: cross) {
                if(get<0>(c) == a) ac.insert(get<1>(c));
                if(get<1>(c) == a) ca.insert(get<0>(c));
                if(get<0>(c) == b) bc.insert(get<1>(c));
                if(get<1>(c) == b) cb.insert(get<0>(c));
            }
            bool condition1 = false;
            bool condition2 = true;
            bool condition3 = true;
            for(auto v: ca) {
                if(bc.count(v)) condition2 = false;
                if(cb.count(v)) condition1 = true;
            }
            for(auto v: ac) {
                if(cb.count(v)) condition3 = false;
                if(bc.count(v)) condition1 = true;
            }
            if(condition1 && condition2 && condition3) {
                distance[a][b] = distance[b][a] = 0;
            }
        }

        // Warshal-Floyd
        for(int k = 0; k < size; ++k) for(int i = 0; i < size; ++i) for(int j = 0; j < size; ++j)
            distance[i][j] = min(distance[i][j], distance[i][k] + distance[k][j]);

        // output
        cout << size << endl;
        for(cin >> m; m > 0; --m) {
            string x, y, input;
            int index;
            cin >> input;
            index = input.find("-");
            x = input.substr(0, index);
            y = input.substr(index + 1, input.size() - index - 1);
            if(!id.count(x) || !id.count(y)) cout << "NO" << endl;
            else cout << (distance[id[x]][id[y]] & 1 ? "YES" : "NO") << endl;
        }
    }
}

Measured memory_bytes: 1412
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())

using namespace std;

#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

typedef pair<ll,ll> Pair;
const ll inf =1000000007;



void solve(){
    string s;
    cin >> s;
    ll a[4];
    rep(i,4){
        a[i]=s[i]-'0';
    }
    char b[3];
    for(ll i=0;i<(1LL<<3);i++){
        ll ans=a[0];
        for(ll j=0;j<3;j++){
            if(i & 1<<j){
                ans+=a[j+1];
                b[j]='+';
                //cout << i <<" "<< j << endl;
            }
            else {
                ans-=a[j+1];
                b[j]='-';
            }
        }

        if(ans==7){
            break;
        }
    }
    cout << s[0] << b[0] <<s[1]<<b[1]<<s[2]<<b[2]<<s[3]<<"=7"<<endl;
}


int main(){
    solve();
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		StringBuffer s = new StringBuffer(scanner.next());
		StringBuffer result = new StringBuffer("");

		for (int i = 0; i < s.length(); i += 2) {
			result.append(s.substring(i, i+1));
		}
		System.out.println(result);
	}

}

Measured memory_bytes: 26092
H,W=map(int,input().split())
cost=[list(map(int,input().split())) for _ in range(10)]

def dijkstra(S,N,cost):
	d = [float("inf")]*N
	used = [False]*N
	d[S] = 0
	
	while True:
		v = -1
		for i in range(N):
			if (not used[i]) and (v == -1):
				v = i
			elif (not used[i]) and d[i] < d[v]:
				v = i
		if v == -1:
			break
		used[v] = True
		
		for j in range(N):
			d[j] = min(d[j], d[v]+cost[v][j])
	
	return d

min_cost=[0]*10
for i in range(10):
    d=dijkstra(i,10,cost)
    min_cost[i]=d[1]

A=[list(map(int,input().split())) for _ in range(H)]
ans=0
for i in range(H):
    for j in range(W):
        if A[i][j]==-1:
            continue
        else:
            ans+=min_cost[A[i][j]]
print(ans)

Measured memory_bytes: 3444
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

template<class T> ostream& operator<<(ostream& os,vector<T> V){
	os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";
}
template<class L,class R> ostream& operator<<(ostream& os,pair<L,R> P){
	return os<<"("<<P.first<<","<<P.second<<")";
}

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template <typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
	const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	ll n, m;
	cin >> n >> m;
	vll v(m);
	ll sum = 0;
	for(ll i = 0; i < m; i++)
		cin >> v[i], sum += v[i];
	ll ans;
	if(sum > n)
		ans = -1;
	else ans = n - sum;
	cout << ans << endl;
}

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

int main(){
    int x,y;
    while(1){
      cin>>x>>y;
      if(x==0&&y==0)break;
          if(x<y){
              cout<<x<<" "<<y<<endl;}
          else{
              cout<<y<<" "<<x<<endl;}
        }
     return 0;
}
   


Measured memory_bytes: 2976
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>//辞書順はnext_permutation
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<utility>//swap(数値交換)
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define rt "\n"
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define please return
#define AC 0

using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}


int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if ((a - b) >= c)cout << 0 << rt;
	else cout << c - (a - b) << rt;
	please AC;
}

// abc : 141 , aoj : ITP1_6_D
//sort, abs, swap, reverse, max, min
//__gcd, sbstring, erase, push_back,stoll、stoi

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long       ll;
typedef long double     ld;
typedef string          str;
#define all(x)			(x).begin(),(x).end()
#define Sort(x)			sort(all(x))
#define A               first
#define B               second
#define sep             ' '
#define endl            '\n'
#define fast_io         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int MAX1 = 2e5 + 7;

ll a, b, c, T, d, e, l, r, x, y, z, mid, cnt, flag, mod = 1e9+7, num[MAX1];
string s, t;
vector <ll> vec;

int main(){
	fast_io;
	cin >> a >> b;
	for (int i = 0; i < a; ++i){
		cin >> x;
		if (x >= b)	++cnt;
	}
	cout << cnt;
    return 0;
}
/*                          now or never                         */


Measured memory_bytes: 256
a, b, k = map(int, input().split(' '))

def divisors(n):
  res = []
  for i in range(1, n + 1):
    if n % i == 0:
      res.append(i)

  return res

common = sorted(list(set(divisors(a)) & set(divisors(b))))
print(common[-k])

Measured memory_bytes: 3060