akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			//				solveA();
			solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		long numX = nextLong();
		long numT = nextLong();

		out.println(numX - numT > 0 ? numX - numT : 0);
	}

	private void solveB() {
		String wk = next();

		StringBuilder builder = IntStream.range(0, wk.length()).filter(i -> (i % 2 == 0))
				.collect(() -> new StringBuilder(), (t, i) -> {
					t.append(wk.charAt(i));
				}, (t, u) -> t.append(u));

		out.println(builder.toString());
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

Measured memory_bytes: 26068
object Main extends App {
  val n: Long = scala.io.StdIn.readLong()
  val digits = for { i<-Iterator.iterate(1l)(_ + 1l).takeWhile(_ <= math.sqrt(n))
        if n%i == 0 
      } yield math.max(i.toString.length, (n/i).toString.length)
  println(digits.toList.min)
}

Measured memory_bytes: 30528
S = input()
flag = 'WA'
if S[0] == 'A':
    ss = S[1]
    s = S[2:]
    cnt_c = 0
    for i in range(len(s)-1):
        m = s[i]
        if m == 'C':
            cnt_c += 1
            #print(s[i])
            m = 'c'
        ss += m
    ss += s[-1:]
    #print(ss)
    if cnt_c == 1 and ss.islower():
        flag = 'AC'

print(flag)

Measured memory_bytes: 3064
/* B - Homework */

#include <stdio.h>

int main(void){
  int N, M, i, A;
  scanf("%d %d", &N, &M);
  for(i = 0; i < M; i++){
    scanf("%d", &A);
    N -= A;
    if(N < 0){
      N = -1;
      break;
    }
  }
  printf("%d\n", N);

  return 0;
}


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

int main() {
  int A, B, count = 0, test;
  int deci[5], round;
  cin >> A >> B;

  for(int i = A; i <= B; ++i) {
    test = i;
//    cout << "i=" << i << endl;
	for(int j = 0; j < 5; ++j) {
      deci[j] = test % 10;
      test /= 10;
//    cout << deci[j] << " ";
    }
//    cout << endl;
    
    round = 10000 * deci[0] + 1000 * deci[1] + 100 * deci[2] + 10 * deci[3] + deci[4]; 
    if( i == round ) {
      count++;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define M 999999

int main(){
  int i, n;
  
  int A[M];
  scanf("%d", &n);
  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);

  for ( i = 1; i <= n; i++ ) {
    printf("node %d: key = %d, ", i, A[i]);
        if ( i / 2 ==1 || i /2 >1 ) {
    	printf("parent key = %d, ", A[i/2]);
    }
    if ( i*2 < n ||  i*2 == n ) {
    	printf("left key = %d, ", A[i*2]);
    }
    if ( i*2+1 < n ||  i*2+1 == n) {
    	printf("right key = %d, ", A[i*2+1]);
    }  
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2056
#include <iostream>
#include <boost/math/common_factor_rt.hpp>
using namespace std;
using namespace boost::math;

int main() {
	int a, b;
	while (cin >> a >> b) {
		int Ngcd = gcd(a, b);
		int Nlcm = lcm(a, b);
		cout << Ngcd << " " << Nlcm << endl;
	}
	return 0;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
#define pi 3.14159265358979
using ll = long long;
using P = pair<int,int>;

ll divisor=998244353;
int main(){
	int n;
	cin>>n;
	int rest = n%10;
	if(rest==2||rest==4||rest==5||rest==7||rest==9){
		puts("hon");
	}else if(rest==0||rest==1||rest==6||rest==8){
		puts("pon");
	}else{
		puts("bon");
	}
}


Measured memory_bytes: 3600
import sys

read = sys.stdin.read


def main():
    N, K = map(int, read().split())

    dp1 = [0] * (K + 1)
    dp2 = [0] * (K + 1)
    dp1[0] = 1

    for x in map(int, str(N)):
        for j in range(K, -1, -1):
            if j > 0:
                dp2[j] += dp2[j - 1] * 9
                if x != 0:
                    dp2[j] += dp1[j - 1] * (x - 1) + dp1[j]
                    dp1[j] = dp1[j - 1]
            else:
                dp1[j] = 0
                dp2[j] = 1

    print(dp1[K] + dp2[K])
    return


if __name__ == '__main__':
    main()


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

#define int long long
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define x first
#define y second

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

	int n;
	cin>>n;
	vector<char> ans;
	int z=0;
	while (n){
		char x=n%26+'a'-1;
		ans.pb(x);
		z++;
		if (ans[z-1]<'a') ans[z-1]='z',n-=26;
		n/=26;
	}
	reverse(ans.begin(),ans.end());
	for (int i=0; i<ans.size(); i++)
		cout<<ans[i];
	cout<<endl;
	return 0;
}

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

inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = -1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
	return x * f;
}

const int N = 1e7 + 5;
const int P = 998244353;
int fac[N], ifac[N];

int Pow(int x, int t)
{
	int res = 1;
	for (; t; t >>= 1, x = 1LL * x * x % P)
		if (t & 1) res = 1LL * res * x % P;
	return res;
}

int C(int n, int m)
{
	if (n < m || m < 0) return 0;
	return 1LL * fac[n] * ifac[m] % P * ifac[n - m] % P;
}

int main()
{
	int n = read();
	
	fac[0] = 1;
	for (int i = 1; i <= n; ++i) fac[i] = 1LL * i * fac[i - 1] % P;
	ifac[n] = Pow(fac[n], P - 2);
	for (int i = n; i >= 1; --i) ifac[i - 1] = 1LL * i * ifac[i] % P;
	
	int ans = Pow(3, n); 
	for (int i = n / 2 + 1; i <= n; ++i) 
		ans = (ans - 2LL * C(n, i) * Pow(2, n - i) % P + P) % P;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 78336
from collections import defaultdict

N, K, L = map(int, input().split())


# union-findを実装
root_road = [-1] * N
root_train = [-1] * N


def find_road(x):
    if root_road[x] < 0:
        return x

    root_road[x] = find_road(root_road[x])
    return root_road[x]


def union_road(x, y):
    x = find_road(x)
    y = find_road(y)
    if x == y:
        return

    root_road[x] += root_road[y]
    root_road[y] = x


def same_road(x, y):
    return find_road(x) == find_road(y)


def find_train(x):
    if root_train[x] < 0:
        return x

    root_train[x] = find_train(root_train[x])
    return root_train[x]


def union_train(x, y):
    x = find_train(x)
    y = find_train(y)
    if x == y:
        return

    root_train[x] += root_train[y]
    root_train[y] = x


def same_train(x, y):
    return find_train(x) == find_train(y)


dc = defaultdict(list)
dt = defaultdict(list)
for _ in range(K):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    dc[p].append(q)
    dc[q].append(p)
    union_road(p, q)

for _ in range(L):
    r, s = map(int, input().split())
    r -= 1
    s -= 1
    dt[r].append(s)
    dt[s].append(r)
    union_train(r, s)

# print(root_road, root_train)
dic = {}
for i in range(N):
    if (find_road(i), find_train(i)) not in dic:
        dic[(find_road(i), find_train(i))] = 1
        continue
    else:
        dic[(find_road(i), find_train(i))] += 1

ans = []
for i in range(N):
    ans.append(dic[(find_road(i), find_train(i))])
print(*ans)


Measured memory_bytes: 77572
#include <stdio.h>
#include <math.h>

int isPrime(int);

int main(){
  int a[10000],i,n,c=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(isPrime(a[i])==1)c++;
  }
 printf("%d\n",c);
 return 0;
}
    
int isPrime(int x){
  int i;
  if(x==2)return 1;
  if(x<2||x%2==0)return 0;
  i=3;
  while(i<=sqrt(x)){
    if(x%i==0)return 0;
    i=i+2;
  }
  return 1;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

const int MAX = 1000001;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(void){
    int N; cin >> N;
    int ans = 0;
    int A[N][N];
    rep(i, N){
        string S; cin >> S;
        rep(j, N){
            A[i][j] = S[j] - 'a';
        }
    }
    int B[N][N];
    
    for(int b = 0; b < N; b++){
        bool ok = true;
        rep(i, N){
            rep(j, N){
                int x1 = i, y1 = (j+b) % N;
                int x2 = j, y2 = (i+b) % N;
                if(A[x1][y1] != A[x2][y2]) ok = false;
            }
        }
        if(ok) ans += N;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
/**
 *      ABC 108 解きなおし
 *      author  : kyomukyomupurin
 *      created : 2018-09-01 22:50:27
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    long long count1 = 0; long long count2 = 0; long long count = 0;
    long long N, K; cin >> N >> K;

    if (K % 2 == 1){
        for (int i = 1; i <= N; ++i) {
            if (i % K == 0){
                ++count;
            }
        }
        cout << count * count * count << endl;
    }
    else {
        for (int i = 1; i <= N; ++i) {
            if (i % K == 0){
                ++count1;
            }
            else if (i % K == K / 2){
                ++count2;
            }
        }
        cout << count1 * count1 * count1 + count2 * count2 * count2 << endl;
    }

    return 0;
}



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

public class Main {      
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long T = sc.nextLong();
        long[] arr = new long[5];
        for (int i=0; i<5; i++) {
            arr[i] = sc.nextLong();
        }
        Arrays.sort(arr);
        DecimalFormat format = new DecimalFormat("0.#");
        long out = (long)(Math.floor(T/arr[0])+5);
        if (T % arr[0]==0) out--;
        System.out.println(format.format(out));
    }
}


Measured memory_bytes: 23252
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
template<typename T> inline void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> inline void chmax(T& a, T b) { if (a < b) a = b; }
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
ll XY[200000], tmp[200000];
void pakuri_sort(int N, ll A[]) {
	const int b = 8;
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N = getint();
	int saidai = 0;
	int saishou = 1e9;
	int saidai2 = 0;
	int saishou2 = 1e9;
	rep(i, N) {
		int x = getint();
		int y = getint();
		if (x > y) swap(x, y);
		chmax(saidai, y);
		chmax(saidai2, x);
		chmin(saishou, x);
		chmin(saishou2, y);
		XY[i] = ((ll)y << 32) + x;
	}
	ll kotae = 1ll * (saidai - saishou2) * (saidai2 - saishou);

	pakuri_sort(N, XY);

	int m = (1 << 31) - 1;
	int saishou3 = 1e9;
	ll haba = saidai - saishou;
	rep(i, N) {
		int x = XY[i] & m;
		int y = XY[i] >> 32;
		if (saishou3 < x) break;
		chmin(kotae, haba * (saidai2 - x));
		chmin(saishou3, y);
		chmax(saidai2, y);
	}
	chmin(kotae, haba* (saidai2 - saishou3));
	printf("%lld", kotae);

	Would you please return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007

int main(){
    lli n,k;
    cin>>n>>k;
    lli i,j,l;
    lli a[n+1];
    for(i=1;i<=n;i++) cin>>a[i];
    lli dp[n+1][k+1];
    for(i=0;i<=n;i++){
        for(j=0;j<=k;j++){
            dp[i][j]=0;
        }
    }
    dp[0][0]=1;
    lli x[k+1]={0};
    for(i=1;i<=n;i++){
        for(j=0;j<=k;j++){
            if(j==0) x[j]=dp[i-1][j];
            else x[j]=x[j-1]+dp[i-1][j];
            x[j]%=mod;
        }
        /*for(j=0;j<=k;j++){
            for(l=0;l<=a[i] && j-l>=0;l++){
                dp[i][j]+=dp[i-1][j-l];
            }
        }*/
        for(j=0;j<=k;j++){
            if(j>a[i])
            dp[i][j]=dp[i][j] + (x[j] - x[j-a[i]-1] + mod)%mod;
            else
            dp[i][j]=dp[i][j] + x[j];
            
            dp[i][j]%=mod;
        }
    }
    cout<<dp[n][k]<<endl;
    return 0;
}

Measured memory_bytes: 79872
#include <iostream>
#include <string>
#include <cmath>
#include <fstream>
#include <chrono>
#include <iomanip>
#include <vector>
#include <utility>
#include <time.h>
#include <set>
#include <unordered_set>
#include <list>
#include <iterator>
#include <time.h>
#include <chrono>
#include <deque>
#include <cstdio>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <climits>
#include <tuple>
#include <map>
using namespace std;

#define ll long long
#define ldb long double
const ll M = 1e9 + 7;

ll mod(ll a, ll b)
{
	return (b + (a % b)) % b;
}

ll mulMod(ll a, ll b)
{
	return ((a % M) * (b % M)) % M;
}

ll subMod(ll a, ll b)
{
	return mod((mod(a, M) - mod(b, M)), M);
}

ll dayofweek(ll d, ll m, ll y)
{
	static ll t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };
	y -= m < 3;
	return (y + y / 4 - y / 100 +
		y / 400 + t[m - 1] + d) % 7;
}

void test()
{

}



//ll nCr(ll n, ll r)
//{
//	ll* C = new ll[r + 1];
//
//	for (ll i = 0; i <= r; i++)
//	{
//		C[i] = 0;
//	}
//
//	C[0] = 1;
//	for (ll i = 1; i <= n; i++)
//	{
//		for (ll j = min(i, r); j > 0; j--)
//		{
//			C[j] = (C[j] + C[j - 1]) % M;
//		}
//	}
//
//	ll temp = C[r];
//	delete[] C;
//	return temp;
//}
//
//ll nCrLucas(ll n, ll r)
//{
//	if (r == 0) return 1;
//
//	ll ni = n % M, ri = r % M;
//	return (nCrLucas(n / M, r / M) * nCr(ni, ri)) % M;
//}


// C function for extended Euclidean Algorithm 
ll gcdExtended(ll a, ll b, ll* x, ll* y);

// Function to find modulo inverse of b. It returns 
// -1 when inverse doesn't 
ll modInverse(ll b, ll m)
{
	ll x, y; // used in extended GCD algorithm 
	ll g = gcdExtended(b, m, &x, &y);

	// Return -1 if b and m are not co-prime 
	if (g != 1)
		return -1;

	// m is added to handle negative x 
	return (x % m + m) % m;
}

// Function to compute a/b under modlo m 
ll modDivide(ll a, ll b, ll m)
{
	a = a % m;
	ll inv = modInverse(b, m);
	/*if (inv == -1)
		cout << "Division not defined";
	else
		cout << "Result of division is " << (inv * a) % m;*/

	return (inv * a) % m;
}

// C function for extended Euclidean Algorithm (used to 
// find modular inverse. 
ll gcdExtended(ll a, ll b, ll* x, ll* y)
{
	// Base Case 
	if (a == 0)
	{
		*x = 0, * y = 1;
		return b;
	}

	ll x1, y1; // To store results of recursive call 
	ll gcd = gcdExtended(b % a, a, &x1, &y1);

	// Update x and y using results of recursive 
	// call 
	*x = y1 - (b / a) * x1;
	*y = x1;

	return gcd;
}

ll power(ll x, ll y)
{
	ll temp;
	if (y == 0) return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0) return mulMod(temp, temp);
	else return mulMod(x, mulMod(temp, temp));
}


void solve()
{
	ll n, a, b;
	cin >> n >> a >> b;

	ll sum = power(2, n) - 1;
	ll x1 = 1, x2 = 1;
	ll y1 = 1, y2 = 1;

	for (ll i = 0; i < a; i++)
	{
		x1 = mulMod(x1, n - i);
		x2 = mulMod(x2, a - i);
	}

	for (ll i = 0; i < b; i++)
	{
		y1 = mulMod(y1, n - i);
		y2 = mulMod(y2, b - i);
	}

	cout << subMod(subMod(sum, modDivide(x1, x2, M)), modDivide(y1, y2, M));
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	//test();

	solve();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <locale>

using namespace std;

int main()
{
  map<char, int> counts;
  for (string s; getline(cin, s);)
    for (char c : s)
      if (isalpha(c, locale()))
        counts[tolower(c, locale())]++;
 
  for (char c = 'a'; c < 'a' + 26; ++c) {
    cout << c << " : " << counts[c] << endl;
  }
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1001001001;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  char p;
  cin >> p;
  if(p - 'a' >= 0) puts("a");
  else puts("A");
  return 0;
}

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

//最小公倍数を求める関数
ll lcm(ll a,ll b){
    ll c,d,e;
    c=max(a,b);
    d=min(a,b);
    while(1){
        c=c%d;
        if(c==0){
            break;
        }
        e=d;
        d=c;
        c=e;
    }
    return a*b/d;
}

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll ac,bc,ad,bd,acd,bcd;
    ac=(a-1)/c;
    bc=b/c;
    ad=(a-1)/d;
    bd=b/d;
    acd=(a-1)/lcm(c,d);
    bcd=b/lcm(c,d);

ll ans;
ans=b-a+1-(bc-ac)-(bd-ad)+(bcd-acd);
    cout << ans << endl;


    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define gc getchar
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x1 uvuvwevwevwe
#define y1 onyetenyevwe
#define x2 ugwemubwem
#define y2 ossas
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
template <typename T> void scan(T &angka){
	angka=0;char input=gc();T kali=1;
	while(!(48<=input&&input<=57)){	if(input=='-')	kali=-1;input=gc();}
	while(48<=input&&input<=57)	angka=(angka<<3)+(angka<<1)+input-48,input=gc();angka*=kali;
}
template <typename T1,typename T2> void scan(T1 &angka1,T2 &angka2){
	scan(angka1);scan(angka2);
}
const int MAXN=100000;
int pos[MAXN+5],n,m;
//sudah punya posisi atau tidak
bool sudah[MAXN+5],visited[MAXN+5];
vector <pii> node[MAXN+5];
bool solve=true;
void dovisit(int now){
	if(visited[now])
		return;
	visited[now]=true;
	if(!sudah[now])
		pos[now]=0;
	sudah[now]=true;
	for(auto v:node[now])
	{
		if(!sudah[v.fi])
		{
			pos[v.fi]=pos[now]+v.se;
			sudah[v.fi]=true;
		}
		else
			solve=solve&&(pos[v.fi]==pos[now]+v.se);
		dovisit(v.fi);
	}
}
int main()
{
	memset(sudah,false,sizeof(sudah));
	scan(n,m);
	for(int i=0;i<m;i++)
	{
		int l,r,jarak;
		scan(l,r),scan(jarak);
		node[l].pb(mp(r,jarak));
		node[r].pb(mp(l,-jarak));
	}
	for(int i=1;i<=n;i++)
		dovisit(i);
	if(!solve)
		cout<<"No"<<endl;
	else
		cout<<"Yes"<<endl;
}

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

#define endl "\n"
#define ll long long
#define F first
#define S second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define mll unordered_map<ll,ll>
#define dec(v) sort(v.rbegin(),v.rend());
#define REP(i, n) for (int i = 0; i < (n); i++)
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<ll> vll;

#define deb(x) cout << ">" << #x << '=' << x << endl;
#define setbits(n) __builtin_popcountll(n)
#define done {cout<<"-1"<<endl; return;}

#define inf INT_MAX
#define ninf INT_MIN
const ll N = 2e5 + 5;
#define MOD 1000000009

int check(string s, string t) {
   int ans = 0;
   for (int i = 0; i < s.size(); i++)
      if (s[i] != t[i]) ans++;
   return ans;
}
void solve()
{
   string s, t;
   cin >> s >> t;
   int ans = inf;
   for (int i = 0; i < (s.size() - t.size() + 1); i++)
   {
      ans = min(ans, check(s.substr(i, t.size()), t));
   }
   cout << ans << endl;
}
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
   freopen("inputc.txt", "r", stdin);
   freopen("outputc.txt", "w", stdout);
#endif
   int t = 1;
   //cin >> t;
   while (t--)  solve();
   cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
   return 0;
}

Measured memory_bytes: 3848
#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;

int main(void){
  ll n; cin>>n;
  ll ret=0;
  for(ll i=1; i<sqrt(n); ++i){
    if( n % i == 0 && (n/i-1) != i ){
      ret += (n/i)-1;
    }
  }
  cout<< ret <<endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
#define INF 2000000000
#define REP(i,b,n) for(int i = (b); i < n; i++)
#define rREP(i,b,n) for(int i = n; i >= b; i--)
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const string lowercase = "abcdefghijklmnopqrstuvwxyz";
const string uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int gcd(int a, int b){return b ? gcd(b, a % b): a;}

int main()
{
    int t, x;
    cin >> t >> x;
    cout << (double)t/(double)x << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		char [] w = sc.next().toCharArray();
		char [] a = new char [26];
		int  [] c = new int  [26];
		int n = 0;
		boolean h = true; 
		boolean s = true; 
		
		for(int i = 0; i < w.length; i++){	
		h = true;
		for(int j = 0; j < a.length; j++){
		if( w[i] == a[j] ) { h = false; }  
		}
		if(h){
		a[n] = w[i]; 
		for(int j = 0; j < w.length; j++){
		if(w[i] == w[j]){ c[n] += 1; }}
		n += 1;
		}
		}
		
		for(int i = 0; i < n; i++){	
		if( c[i] % 2 == 0 ){} else { s = false; }}
		
		if(s){ System.out.print("Yes"); } else { System.out.print("No"); }
	}}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int a,b; cin >> a >> b;

  for(int i = 1;i<=1300;i++){
    if((a == (int)(i*0.08)) && (b == (int)(i*0.1))){
      cout << i << endl;
      return 0;
    }
  }
  cout << "-1" << endl;
  
  return 0;
}


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

int main(){
	int a, n;
	int min = INT_MAX;
	int max = INT_MIN;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> a;
		if(a < min) min = a;
		if(a > max) max = a;
	}
	cout << max - min;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

main() {
    int64_t n;
    cin >> n;

    vector<unordered_map<int64_t, bool>> xy(n);
    for (auto i : irange(0L, n)) {
        int64_t a;
        cin >> a;

        for (auto j : irange(0L, a)) {
            int64_t x, y;
            cin >> x >> y;
            --x;
            xy[i][x] = y;
        }
    }

    uint64_t ans = 0;
    for (uint64_t b = 0; b < (1L << n); ++b) {
        bitset<15> bs(b);

        bool ok = true;
        for (auto i : irange(0L, n)) {
            if (!bs[i]) {
                continue;
            }
            for (const auto& kv : xy[i]) {
                if (bs[kv.first] != kv.second) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        }

        if (ok) {
            ans = max(ans, bs.count());
        }
    }

    cout << ans << endl;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  int m1, m2, d1, d2;
  cin >> m1 >> d1 >> m2 >> d2;
  cout << (d2 == 1);

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int i;
	int before[5],after[5];
	int sum[5] = {0};
	int max = 0;
	int number;
	while(scanf("%d %d",&before[0],&after[0])){
		if(before[0] == 0 && after[0] == 0){
			break;
		}
		sum[0] = before[0] + after[0];
		for(i = 1;i < 5;i++){
			scanf("%d %d",&before[i],&after[i]);
			sum[i] = before[i] + after[i];
		}
		for(i = 0;i < 5;i++){
			if(sum[i] > max){
				max = sum[i];
				number = i;
			}
		}
		if(number == 0){
			printf("A %d\n",max);
		}
		else if(number == 1){
			printf("B %d\n",max);
		}
		else if(number == 2){
			printf("C %d\n",max);
		}
		else if(number == 3){
			printf("D %d\n",max);
		}
		else{
			printf("E %d\n",max);
		}
		max = 0;
	}
	return 0;
}

Measured memory_bytes: 600
// D - Five, Five Everywhere
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

using VB = vector<bool>;
#define P_N 55555

// 素数列挙 (エラトステネスの篩)
vector<bool> primes_create(int n){
	vector<bool> p(n+1, true);
	p[0] = p[1] = false;
	for(int i=2; i*i<=n; ++i)
		if(p[i]) for(int j=i+i; j<=n; j+=i) p[j] = false;
	return p;
}

int main(){
	int N; cin>>N;
	VB P = primes_create(P_N);
	vi ans;
	for(int p=11; p<P.size(); p+=10){
		if(!P[p]) continue;
		if(p%5 != 1) continue;
		ans.push_back(p);
		if(ans.size() == N) break;
	}
	for(auto a:ans) cout<<a<<" ";
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> sw(m,vector<int>(n));
    rep(i,m){
        int k;
        cin >> k;
        rep(j,k){
            int s;
            cin >> s;
            s--;
            sw[i][s]=1;
        }
    }
    vector<int> on(m);
    rep(i,m){
        cin >> on[i];
    }
    int res = 0;
    rep(i,1<<n){
        bool flag = true;

        rep(j,m){
            int amari = 0;
            rep(k,n){
                if(i>>k&1) {
                    if(sw[j][k]==1) amari=1-amari;
                }
            }
            if(amari!=on[j]) flag = false;
        }

        if(flag) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
n = int(input())
a_list = list(map(int, input().split()))

result = [[0 for _ in range(w)] for _ in range(h)]
height = 0
width = 0
count = -1

for i in range(1, n + 1):
    a = a_list[i - 1]
    for j in range(a):
        result[height][width] = i
        count += 1
        if width >= 0:
            width += 1
        else:
            width -= 1
        if count % w == w-1:
            height += 1
            if width >= 0:
                width = -1
            else:
                width = 0


for r in result:
    print(*r)


Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b;
  cin>>a>>b;
  
  if (a>b) 
    	for (int i=0; i<a; i++)
          cout<<b;
  else for (int i=0; i<b; i++)
    cout<<a;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define $ ios::sync_with_stdio(0);
#define endl '\n'
using namespace std;
using ll = long long int;
using ii = pair<ll, ll>;
using vi = vector<ll>;
using vii = vector<ii>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 2123;
vector<string> vs;
int main() {$
    int n, m;
    cin >> n >> m;
    string s;
    while (n--) {
        cin >> s;
        vs.emplace_back(s);
    }
    sort(vs.begin(), vs.end());
    for (auto s : vs) {
        cout << s;
    }
    cout << endl;
}


Measured memory_bytes: 256
import sys


def resolve(in_):
    _N = next(in_).strip()
    N = map(int, _N)
    s = sum(N)
    return 'Yes' if s % 9 == 0 else 'No'


def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()


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

int main() {
	long long a,b,c,d;
	cin>>a>>b>>c>>d;
	long long a1,a2,a3,a4;
	a1=a*c;
	a2=a*d;
	a3=b*c;
	a4=b*d;
	cout<<max(max(a1,a2),max(a3,a4));
	return 0;
}


Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
 
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String[] arr = br.readLine().split(" ");
        double T = Double.parseDouble(arr[0]);
        double X = Double.parseDouble(arr[1]);
        out.println(T / X);
        out.close();
    }
}


Measured memory_bytes: 21204
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<int> res(N),sign(N);
	for (int i = 0; i < N; ++i) {
		char c;
		cin >> c;
		if (c == 'o') {
			sign[i] = 1;
		}
		else {
			sign[i] = -1;
		}
	}
	bool find = false;
	for (int fv = 0; !find && fv < 2; ++fv) {
		res[0] = 1 - (2*fv);
		for (int sv = 0; !find && sv < 2; ++sv) {
			res[1] = 1 - (2*sv);
			for (int i = 1; i < N-1; ++i) {
				res[i+1] = res[i]*sign[i]*res[i-1];
			}
			if ((res[0] == res[N-1]*sign[N-1]*res[N-2])&&(res[1] == res[0]*sign[0]*res[N-1])) {
				for (int i = 0; i < N; ++i) {
					if (res[i] > 0) {
						cout << "S";
					}
					else {
						cout << "W";
					}
				}
				cout << endl;
				find = true;
			}
		}
	}
	if (!find) {
		cout << -1 << endl;
	}
	return 0;
}



Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
// #define MOD 1000000007
#define MOD 998244353
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }




void solve(void)
{
  int N;cin>>N;
  int tot = 0,b = 0,ANS = 0;
  vector<int> vec (N+1,0);
  
  for (int i = 0; i <= N; i++)
  {
    cin>>vec[i];
    tot += vec[i];
  }
  b = 1;
  bool flag = true;
  for (int i = 0; i <= N; i++)
  {
    if(b < vec[i])
    {
      flag = false;
      break;
    }
    ANS += b;
    b -= vec[i];
    tot -= vec[i];
    b = min(b*2,tot);
  }
  if(!flag) cout<<-1<<endl;
  else cout<<ANS<<endl;
  
  
  
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 4004
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793


   
int main(){
  string t;
  cin >> t;
  int n=t.size();
  rep(i,n){
    if(t.at(i)=='?'){
       t.at(i)='D';
    }
  }
  cout << t << endl;
}

Measured memory_bytes: 3708
#include <iostream>
using namespace std;
int main(void){
    
    int a, b;
    cin >> a >> b;
  
    int seki = a *b;
    if(seki % 2 == 0){
        cout << "Even" << endl;
    }
    else {
        cout << "Odd" << endl;
    }
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>

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

  const unsigned int digit = S.size();

  const unsigned int mod = 13;
  const unsigned int large_mod = 1e+9 + 7;
  std::vector<std::vector<long long>> dp(digit + 1, std::vector<long long>(mod, 0));
  dp.at(0).at(0) = 1;

  for (unsigned int i = 0; i < digit; ++i) {
    size_t keta_amari;
    const int i_amari = i % 6;
    if (i_amari == 0) {
      keta_amari = 1;
    } else if (i_amari == 1) {
      keta_amari = 10;
    } else if (i_amari == 2) {
      keta_amari = 9;
    } else if (i_amari == 3) {
      keta_amari = 12;
    } else if (i_amari == 4) {
      keta_amari = 3;
    } else if (i_amari == 5) {
      keta_amari = 4;
    }

    const char x = S[digit - 1 - i];
    if (x != '?') {
      const unsigned int number = x - '0';
      for (size_t j = 0; j < mod; ++j) {
        const unsigned int amari = (keta_amari * number) % mod;
        const unsigned int target_index = (j + amari) % mod;
        dp.at(i + 1).at(target_index) = dp.at(i).at(j);
      }
    } else {
      for (unsigned int number = 0; number < 10; ++number) {
        for (size_t j = 0; j < mod; ++j) {
          const unsigned int amari = (keta_amari * number) % mod;
          const unsigned int target_index = (j + amari) % mod;
          dp.at(i + 1).at(target_index) = (dp.at(i + 1).at(target_index) + dp.at(i).at(j)) % large_mod;
        }
      }
    }
  }

  std::cout << dp.at(digit).at(5) << std::endl;

  return 0;
}


Measured memory_bytes: 13696
import java.util.Scanner;

public class Main {
	// AOJ2017 2問目
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String a, b;

		Star: while (true) {
			int count = 0, lena = 0, lenb = 0;
			a = s.next();
			if (a.equals(".")) {
				break;
			}
			b = s.next();
			// a=b
			if (a.equals(b)) {
				System.out.println("IDENTICAL");
				continue;
			} // それ以外
			else if (a.contains("\"") && b.contains("\"")) {
				String[] A = a.split("\"", -1);
				lena = A.length;
				String[] B = b.split("\"", -1);
				lenb = B.length;

				if (lena != lenb) {
					System.out.println("DIFFERENT");
					continue;
				}
				// aとbの"で囲まれた文字列を比較
				for (int i = 1; i < lena; i += 2) {
					if (!(A[i].equals(B[i]))) {
						count++;
					}
				}
				// aとbの"で囲まれていない文字列を比較
				for (int i = 0; i < lena; i += 2) {
					if (!(A[i].equals(B[i]))) {
						System.out.println("DIFFERENT");
						continue Star;
					}
				}
			}

			if (count == 1) {
				System.out.println("CLOSE");
			} else {
				System.out.println("DIFFERENT");
			}
		}
		s.close();
	}

}


Measured memory_bytes: 28844
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

K=one_int()



def solve(start, goal, lists):
    ret_lists=[]
    
    for i in lists:
        str_i = str(i)
        t = int(str_i[-1])
        
        if t==0:
            ret_lists.append(i*10)
            start+=1
            if start==goal:
                return ret_lists, start
            
            ret_lists.append(i*10+1)
            start+=1
            if start==goal:
                return ret_lists, start

        elif t==9:
            ret_lists.append(i*10+8)
            start+=1
            if start==goal:
                return ret_lists, start
            
            ret_lists.append(i*10+9)
            start+=1
            if start==goal:
                return ret_lists, start
        
        else:
            for s in range(-1,2):
                ret_lists.append(i*10+int(t)+s)
                start+=1
                if start==goal:
                    return ret_lists, start
  
    return ret_lists, start

if K>9:
    lists = [i for i in range(1,10)]
    start = 9
    while True:
        lists, start = solve(start, K, lists)
        if K<=start:
            print(lists[-1])
            break
else:
    print(K)

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout << name << ": " << arg1 << std::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(...)
#endif

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long

const int N = 1e5 + 10;
const int mod = 1e9 + 7;

int32_t main(){
    boost;

  
    
    //code
    string s;

    cin >> s;

    if(s[0] == s[1] or s[1] == s[2] or s[2] == s[3]){
    	cout << "Bad";
    }
    else{
    	cout << "Good";
    }
    return 0;
}

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

int main()
{
    cin >> N >> M;
    int wa[N+1];
    for (int i = 1; i < N+1; i++){
        wa[i] = 0;
    }
    int correct = 0;
    int penalty = 0;
    
    for (int i = 0; i < M; i++) {
        int S1;
        string S2;
        cin >> S1 >> S2;
        if (wa[S1] == -1) continue;
        if (S2 == "WA") {
            wa[S1]++;
        }
        else {
            correct++;
            penalty += wa[S1];
            wa[S1] = -1;
        }
    }
    cout << correct << " " << penalty;
}

Measured memory_bytes: 640
n = [i for i in input()]
length = len(n) -1

for i in range(2 ** length):
    ops = ['-'] * length
    for j in range(length):
        if (i >> j) & 1:
            ops[length - 1 - j] = '+'
    
    formula = str()
    for num , op in zip(n, ops + ['']):
        formula += (num + op)
    
    if eval(formula) == 7:
        print(formula+'=7')
        break

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

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

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

int dp[3005][3005];

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n;
	string s;
	cin >> n >> s;
	dp[1][1] = 1;
	for(int i = 0; i < n - 1; i++) {
		for(int j = 1; j <= i + 2; j++) {
			if(s[i] == '>') {
				dp[i + 2][j] = (dp[i + 2][j] + dp[i + 1][i + 1] - dp[i + 1][j - 1] + mod) % mod;
			}
			else {
				dp[i + 2][j] = (dp[i + 2][j] + dp[i + 1][j - 1]) % mod;
			}
		}
		for(int j = 2; j <= i + 2; j++) {
			dp[i + 2][j] = (dp[i + 2][j] + dp[i + 2][j - 1]) % mod;
		}
	}
	cout << dp[n][n];

	return 0;
}

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

int b[65];

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

//combination mod prime
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main(){
  int n; cin >> n;
  vector<ll> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 63 ; j++){ 
         if (a[i]&(1ull<<j)) b[j]++;
        }
    }
  
 mint ans = 0;
 mint now;
 for(int i = 0; i < 63; i++){
   now = mint(2).pow(i);
   now *= b[i];
   now *= n-b[i];
   ans += now;
 }
 cout << ans << endl;
 return 0;
}


Measured memory_bytes: 5540
d=int(input())
C=sorted((c,e) for e,c in enumerate(map(int,input().split())))[::-1]
p1,p2,p3,p4,p5=C[:5],C[5:10],C[10:15],C[15:20],C[20:]
p=p1+p2+p3+p1+p2+p4+p1+p3+p2+p1+p4+p2+p1+p3+p5
for i in range(d): print(p[i%len(p)][1]+1)

Measured memory_bytes: 9016
#include <bits/stdc++.h> 
using namespace std; 
int main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
    cin>>a[i];
}
sort(a,a+n);

double ans=a[0];
for(int i=1;i<n;i++){
    ans=(ans+a[i])/2;
    
}
cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int, input().split()))

    money = 1000
    stock = 0

    for i in range(N - 1):
        if i == 0:
            stock += money // A[i]
            money = money % A[i]
        if A[i] < A[i + 1]:
            stock += money // A[i]
            money = money % A[i]
        if A[i] > A[i + 1]:
            money += stock * A[i]
            stock = 0

    money += stock * A[-1]

    print(money)


if __name__ == "__main__":
    main()


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

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define loop while(true)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

typedef long long ll;
typedef pair<int, int> P;

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
  ll mod=1000000007;
  ll a[2010]={};
  a[0]=0;
  a[1]=0;
  a[2]=0;
  a[3]=1;
  a[4]=1;
  a[5]=1;
  rep2(i,6,2005){
    int r=i-2;
    a[i]=1;
    rep(j,r){
      a[i]+=a[j];
      a[i]%=mod;
    }
  }
  int s;
  cin>>s;
  cout<<a[s];
  
  return 0;
}


Measured memory_bytes: 3648
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)

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

    vector<vector<long long>> dp(2, vector<long long>(2020, 0));

    long long cv = stoi(S.substr(0, 4));
    dp[1][cv % 2019]++;
    long long count = dp[1][0];
    for (long long i = 4; i < S.size(); i++)
    {
        for (long long j = 0; j < 2019; j++)
        {
            dp[i % 2][((j * 10) + (S[i] - '0')) % 2019] = dp[(i - 1) % 2][j];
        }
        cv = (cv * 10) % 10000;
        cv += S[i] - '0';
        dp[i % 2][cv % 2019]++;
        count += dp[i % 2][0];
    }

    cout << count << endl;
}

Measured memory_bytes: 3760
N, M = gets.split.map(&:to_i)
edge_list = M.times.map { gets.split.map(&:to_i) }
indegree = Array.new(N, 0)
graph = Array.new(N) { [] }
edge_list.each do |(u, v)|
  u -= 1
  v -= 1
  graph[u].push(v)
  indegree[v] += 1 
end
zero_vertex_list = []
indegree.each.with_index do |c, i|
  zero_vertex_list.push(i) if c == 0
end

def next_edges(vertex_list, graph, indegree)
  ret = []
  vertex_list.each do |u|
    graph[u].each do |v|
      indegree[v] -= 1
      ret.push(v) if indegree[v] == 0
    end
  end
  ret
end

ans = 0
while !zero_vertex_list.empty?
  ans += 1
  zero_vertex_list = next_edges(zero_vertex_list, graph, indegree)
end
ans -= 1
puts ans

Measured memory_bytes: 16508