akhauriyash/Code-Regression huggingface dataset:
// parameter "input" gets all data
// 速度テスト

function nbrDividor(n){
	var nbr=0;
	for (var i = 1; i <=n; i++) {
		if(n%i==0)
			nbr++;
	}
	return nbr;

}
function Main(input) {

	var a = parseInt(input, 10);
	var ans = 0;
	for (var i = 1; i <=a; i++) {
		if(nbrDividor(i)==8 && i%2==1){
			ans++;
		}
	}
	//output
	console.log('%d',ans);
}
// Don't edit this line!


Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <memory>
#include <unordered_map>

struct Node {
public:
    Node(int key_in) :
        parent(nullptr),
        left(nullptr),
        right(nullptr),
        key(key_in)
    {}

public:
    Node* parent;
    Node* left;
    Node* right;
    int   key;
};

struct Tree {
public:
    Tree() :
        root(nullptr)
    {}

    Node* root;
};

void insert(Tree& t, Node* z)
{
    Node* y = nullptr;
    Node* x = t.root;
    while (x != nullptr) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z->parent = y;

    if (y == nullptr) {
        t.root = z;
    } else if (z->key < y->key) {
        y->left = z;
    } else {
        y->right = z;
    }
}

void printInOrder(Node* node)
{
    if (node->left != nullptr) {
        printInOrder(node->left);
    }

    std::printf(" %d", node->key);

    if (node->right != nullptr) {
        printInOrder(node->right);
    }
}

void printPreorder(Node* node)
{
    std::printf(" %d", node->key);

    if (node->left != nullptr) {
        printPreorder(node->left);
    }

    if (node->right != nullptr) {
        printPreorder(node->right);
    }
}

void print(Tree& t)
{
    Node* root = t.root;
    if (root == nullptr) {
        return;
    }

    printInOrder(root);
    std::cout << std::endl;
    printPreorder(root);
    std::cout << std::endl;
}

void find(Tree& t, int key)
{
    Node* node = t.root;
    while (node != nullptr) {
        if (node->key == key) {
            std::cout << "yes" << std::endl;
            return;
        } else if (node->key < key) {
            node = node->right;
        } else {
            node = node->left ;
        }
    }

    std::cout << "no" << std::endl;
}

int main()
{
    Tree t;

    int n;
    std::cin >> n;

    std::string str;
    int key;
    for (int i = 0; i < n; ++i) {
        std::cin >> str;
        if (str == "insert") {
            std::cin >> key;
            Node* node = new Node(key);
            insert(t, node);
        } else if (str == "find") {
            std::cin >> key;
            find(t, key);
        } else if (str == "print") {
            print(t);
        } else {
            return -1;
        }
    }

    return 0;
}


Measured memory_bytes: 21928
#include <bits/stdc++.h>
#define MOD 1000000007
#define pb push_back
#define ll long long
using namespace std;
const int nmax=201234;

int n,nw,nw2;
ll k,res,a[64][51][51],b[64][51];

int main()
{
    scanf("%d %lld",&n,&k);
    for(int i=1; i<=n; ++i)
    {
        for(int j=1; j<=n; ++j)
            scanf("%lld",&a[nw][i][j]);
        b[nw2][i]=1;
    }
    while(k)
    {
        if(k&1)
        {
            ++nw2;
            for(int i=1; i<=n; ++i)
            {
                for(int k=1; k<=n; ++k)
                {
                    b[nw2][i]+=b[nw2-1][k]*a[nw][k][i];
                    b[nw2][i]%=MOD;
                }
            }
        }
        k>>=1;
        ++nw;
        for(int i=1; i<=n; ++i)
        {
            for(int j=1; j<=n; ++j)
            {
                for(int k=1; k<=n; ++k)
                {
                    a[nw][i][j]+=a[nw-1][i][k]*a[nw-1][k][j];
                    a[nw][i][j]%=MOD;
                }
            }
        }
    }
    for(int i=1; i<=n; ++i)
        res=(res+b[nw2][i])%MOD;
    printf("%lld",res);
    return 0;
}


Measured memory_bytes: 1536
#include "bits/stdc++.h"

using namespace std;
using uint = unsigned int;
using int64 = long long;
using i64 = int64;
using uint64 = unsigned long long;
using vint = vector<int>;
using vint64 = vector<int64>;
template<typename T>
using p_que = priority_queue<T>;
#define rep(i,N) for(int i=0;i<(int)(N);++i)
#define rep1(i,N) for(int i=1;i<=(int)(N);++i)
#define fs first
#define sc second
#define eb emplace_back
#define all(x) x.begin(),x.end()

template<typename T>
vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "[";
	for (auto& e : v) os << e << ", ";
	return os << "]";
}

template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U> p) {
	return os << "P(" << p.first << ", " << p.second << ")";
}

template<class T, class U> ostream& operator<<(ostream& os, const map<T, U>& mp) {
	os << "{";
	for (auto& e : mp) os << e << " ";
	return os << "}";
}

void Main();
signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
}

/* Cut from here! */

//#define int long long

void Main() {
	int a, b; cin >> a >> b;
	int N; cin >> N;
	vector<int> used(1010, 0);
	for (int i = 0; i < N; ++i) {
		int s, f; cin >> s >> f;
		for (int j = s; j < f; ++j) used[j] = 1;
	}
	bool can = true;
	for (int i = a; i < b; ++i) {
		can =can&& (used[i] == 0);
	}
	if (can) cout << 0 << endl;
	else cout << 1 << endl;
}


Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
typedef vector<string> vs;
typedef pair<l_l,ll> lll;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
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;
}
const int mod = 1000000007;
struct mint {
ll x;
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 {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
mint dp[10010][101][2];
int main(){
    string s;cin>>s;
    ll n=sz(s);
    ll d;cin>>d;
    dp[0][0][1]=1;
    rep(i,n){
        ll now=s[i]-'0';
        rep(j,d){
            rep(k,10){
                dp[i+1][(j+k)%d][0]+=dp[i][j][0];
                if(k<now)dp[i+1][(j+k)%d][0]+=dp[i][j][1];
            }
            dp[i+1][(j+now)%d][1]+=dp[i][j][1];
        }
    }
    mint ans=dp[n][0][0]+dp[n][0][1];
    ans-=1;
    cout<<ans.x<<endl;
    return 0;
}

Measured memory_bytes: 19436
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

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

    for(int i = 0; i < 11 ; i++){
        if(1000 * i >= n){
            System.out.println(1000*i - n);
            System.exit(0);
        }
    }




    





    
    


    
	}
}

Measured memory_bytes: 35540
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			int t, n, s = 0;
			StringTokenizer st = new StringTokenizer(line);
			t = Integer.parseInt(st.nextToken());
			n = Integer.parseInt(st.nextToken());

			if (t > 1) {
				s = n * (6000 - t * 1000);
			} else {
				s = n * 6000;
			}
			System.out.println(s);
		}
	}
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

VV<int> g;
V<int> vis, col;

void dfs(int p, int c) {
    if (vis[p]) return;
    vis[p] = true;
    col[p] = c;
    for (int d: g[p]) {
        dfs(d, 1-c);
    }
}

void mark() {
    int n = int(g.size());
    vis = V<int>(n);
    col = V<int>(n);
    for (int i = 0; i < n; i++) {
        dfs(i, 0);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    int n;
    V<int> dv(2);
    cin >> n >> dv[0] >> dv[1];
    int base = 1;
    VV<int> col2(2*n, V<int>(2*n));
    using P = pair<int, int>;
    for (int d: dv) {
        V<P> v;
        for (int h = -2*n; h <= 2*n; h++) {
            int rm = d - h*h;
            if (rm < 0) continue;
            int r = int(sqrt(rm) + 1e-9);
            if (h*h + r*r != d) continue;
            v.push_back(P(h, r));
            v.push_back(P(-h, r));
            v.push_back(P(h, -r));
            v.push_back(P(-h, -r));
        }
        sort(begin(v), end(v));
        v.erase(unique(begin(v), end(v)), end(v));
        g = VV<int>(4*n*n);
        for (int h = 0; h < 2*n; h++) {
            for (int r = 0; r < 2*n; r++) {
                for (auto p: v) {
                    int nh = h + p.first, nr = r + p.second;
                    if (!(0 <= nh && nh < 2*n && 0 <= nr && nr < 2*n)) continue;
                    int id1 = h*(2*n) + r;
                    int id2 = nh*(2*n) + nr;
                    g[id1].push_back(id2);
                }
            }
        }
        mark();
        for (int h = 0; h < 2*n; h++) {
            for (int r = 0; r < 2*n; r++) {
                int id = h*(2*n) + r;
                if (col[id]) col2[h][r] += base;
            }
        }
        base *= 2;
    }

    VV<P> pots(4);
    for (int h = 0; h < 2*n; h++) {
        for (int r = 0; r < 2*n; r++) {
            pots[col2[h][r]].push_back(P(h, r));
        }
    }
    sort(begin(pots), end(pots), [&](const V<P> &l, const V<P> &r){
        return l.size() > r.size();
    });
    auto ans = pots[0];
    assert(ans.size() >= n*n);
    ans.resize(n*n);
    for (auto p: ans) {
        cout << p.first << " " << p.second << endl;
    }
    return 0;
}


Measured memory_bytes: 80256
n = int(input())
x = list(sorted(list(map(int,input().split()))))

flag = 1
if n % 2 == 1 :
    for i in range(0,n):
        if i == 0 :
            co = 0
            if x[i] == 0:
                x[i] = -1

        elif i != 0 and i <= n-2 and (i) % 2 ==1 :
            if x[i] == i+1 and x[i+1] == i+ 1 and (i+1) % 2 == 0:
                x[i] = -1
                x[i+1] = -1
        else:
            continue
else:
    for i in range(0,n):  
        if x[i] == i+1 and x[i+1] == i+ 1 and (i+1) % 2 == 1 and i <= n-2:
            x[i] = -1
            x[i+1] = -1
        else:
            continue
            
if list(set(x)) == [-1]:
    ans = 1
    if n >=2:
        for i in range(n // 2 ):
            ans = (ans * 2) % (10 ** 9 + 7)
        
    print(ans)
else:
    print(0)
    


Measured memory_bytes: 14008
# coding: utf-8
# Your code here!

Q = int(input())
for l in range(Q):
    c,a,n = [int(i) for i in input().split()]
    ans = 0
    
    while n > 0 and c > 0 and a > 0:
        c = c - 1
        a = a - 1
        n = n - 1
        ans = ans + 1
        
    while a > 0 and c > 1:
        c = c - 2
        a = a - 1
        ans = ans + 1
    
    while c > 2:
        c = c - 3
        ans = ans + 1
        
    print(ans)
    
        
        
        


Measured memory_bytes: 5608
def whichcolor(n):
	if n < 3200:
		return n / 400
	else:
		return 8

def countnotzero(lst):
	cnt = 0
	for i in range(0, len(lst)):
		if lst[i] != 0:
			cnt += 1
	return cnt

n = int(raw_input())
inpt = map(int, raw_input().split())

color = [0, 0, 0, 0, 0, 0, 0, 0]
almighty = 0

for i in range(0, n):
	c = whichcolor(inpt[i])
	if c == 8:
		almighty += 1
	else:
		color[c] += 1

nzro = countnotzero(color)
min = nzro
if min == 0:
	min = 1
max = nzro + almighty
print str(min) + ' ' + str(max)


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

#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=10000005;
const int mod=998244353;
int n,ans;
int fac[maxn],ifac[maxn],pw2[maxn];
int C(int a,int b){
	if(a<b||a<0||b<0)return 0;
	return 1LL*fac[a]*ifac[b]%mod*ifac[a-b]%mod;
}

int main(){
	scanf("%d",&n);
	fac[0]=ifac[0]=fac[1]=ifac[1]=1;
	for(int i=2;i<=n;i++){
		fac[i]=1LL*fac[i-1]*i%mod;
		ifac[i]=1LL*ifac[mod%i]*(mod-mod/i)%mod;
	}
	REP(i,n)ifac[i]=1LL*ifac[i-1]*ifac[i]%mod;
	pw2[0]=1;
	ans=1;
	REP(i,n){
		pw2[i]=2LL*pw2[i-1]%mod;
		ans=3LL*ans%mod;
	}
	for(int i=n/2+1;i<=n;i++){
		ans-=2LL*C(n,i)%mod*pw2[n-i]%mod;
		if(ans<0)ans+=mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 117376
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < 3; i++) {
			int a = sc.nextInt();
			max = Math.max(max, a);
			min = Math.min(min, a);
		}
		System.out.println(max - min);
    }
}


Measured memory_bytes: 21844
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#include <math.h>
#define pb push_back
using namespace std;
using ll = long long;
const char E = '\n';
const int N = 100005;
const ll mod = 1e9+7;
const int lim = 1e5;

mt19937_64 mt_rnd_64(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll l, ll r) {
    return (mt_rnd_64() % (r-l+1)) + l;
}

ll n, a[N], l[N], mx;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i=1; i<=n; i++)
    {
        cin >> a[i];
        l[i] = INT_MAX;
    }
    for (int i=1; i<=n; i++)
    {
        int L = 1, R = mx + 1;
        while (R - L > 1)
        {
            int mid = (L+R)/2;
            if (a[i] <= l[mid]) L = mid;
            else R = mid;
        }
        if (a[i] <= l[L] && i != 1 && l[R] == INT_MAX) mx ++;
        if (a[i] <= l[L] && i != 1) l[R] = max((l[R]==INT_MAX?0:l[R]), a[i]);
        else l[L] = max(l[L], a[i]);
        if (i == 1) l[1] = a[i], mx ++;
    }
    for (int i=n; i>=1; i--)
    {
        if (l[i] != INT_MAX)
        {
            cout << i;
            return 0;
        }
    }
    return 0;
}


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

int dsum(int a){
  int ret=0;
  for(int i=0; i<6; i++){
    ret += a%10;
    a /= 10;
  }
  return ret;
}

int main(){
  int n;
  cin >> n;
  int ret = 1000;
  for(int a=1; a<=n/2; a++){
    ret = min(ret, dsum(a)+dsum(n-a));
  }
  cout << ret;
  return 0;
}



Measured memory_bytes: 256
import Data.Char

solver::String->Bool
solver str = let a:b:rest = str in
             let restrv = reverse rest in
             let l:rest2 = restrv in
             let notC = filter ('C'/=) rest2 in
             let isC  = filter ('C'==) rest2 in
             (a=='A')&&(isLower b)&&(isLower l)&&(length isC ==1)&&(and (map isLower notC))

main::IO()
main=do
  str<-getLine
  putStr (if solver str then "AC\n" else "WA\n") 

Measured memory_bytes: 380
N = int(input())
XY = [list(map(int,input().split())) for _ in range(N)]

num_type = sum(XY[0])%2 
for xy in XY:
    if(sum(xy)%2 != num_type):
        print(-1)
        break
else:
    m = 40-num_type
    print(m)
    D = [2**i for i in range(38,-1,-1)]
    if not(num_type):
        D.append(1)

    print(' '.join(map(str,D)))
    for xy in XY:
        p = xy
        w = ""
        for i in range(m):
            if 0<=p[0]-p[1] and 0<=p[0]+p[1]:
                w += "R"
                p[0] -= D[i]
            elif 0>p[0]-p[1] and 0<=p[0]+p[1]:
                w += "U"
                p[1] -= D[i]
            elif 0<=p[0]-p[1] and 0>p[0]+p[1]:
                w += "D"
                p[1] += D[i]
            else:
                w += "L"
                p[0] += D[i]
        print(w)


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

const int N = 1e5 + 5;
int n;
int ans;

int f(int n) {
  int cnt = 0;
  while (n > 0){
    cnt++;
    n /= 2;
  }
  return cnt;
}


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);    
    
    cin >> n;
    int mx = 0;
    for (int i = 1; i <= n; i++){
      if (mx < f(i)){
        mx = f(i);
        ans = i;
      }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll N;
    cin >> N;
    ll A[100010];
    rep(i,0,N) cin >> A[i];
    sort(A, A+N);
    ll ans = 1;
    rep(i,0,N){
        if(A[i] == 0){
            print(0);
            return;
        }
        if(ans > INF / A[i]){
            print(-1);
            return;
        }else{
            ans *= A[i];
        }
    }
    print(ans);


    

}

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


Measured memory_bytes: 4424
//Khodaya aghideye man ra az dast oghde am masoon dar!
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, greater<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, greater_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
#pragma optimize O3
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 3;
const int infint = (ll)1e9;
const ll inf = (ll)1e18;
int a[MAXN];
int main()
{	
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, L;
	cin >> n >> L;
	for (ll i = 0; i < n; i++)
		cin >> a[i];
	int ind = -1;
	for (ll i = 1; i < n; i++)
		if(a[i] + a[i - 1] >= L)
			ind = i;
	if(ind == -1)
		return cout << "Impossible", 0;
	cout << "Possible" << endl;
	for (int i = 1; i < ind; i++)
		cout << i << "\n";
	
	for (int i = n - 1; i > ind; i--)
		cout << i << "\n";
	cout << ind;
}

Measured memory_bytes: 1280
package main

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

func mapf(f interface{}, list interface{}) interface{} {
	fv, listv := reflect.ValueOf(f), reflect.ValueOf(list)

	if fv.Kind() != reflect.Func || listv.Kind() != reflect.Slice {
		return nil
	}

	len := listv.Len()
	ret := reflect.MakeSlice(reflect.SliceOf(fv.Type().Out(0)), len, listv.Cap())

	for i := 0; i < len; i++ {
		v := fv.Call([]reflect.Value{listv.Index(i)})
		ret.Index(i).Set(v[0])
	}

	return ret.Interface()
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()

	arr, _ := mapf(strconv.Atoi, strings.Split(scanner.Text(), " ")).([]int)
	a, b := arr[0], arr[1]

	fmt.Printf("%d %d %.5f\n", a/b, a%b, float64(a)/float64(b))
}



Measured memory_bytes: 1336
s = input()
l = len(s)

def check(a):
  n = len(a)
  if n % 2 == 0:
    for i in range(n//2):
      if a[i] != a[n-i-1]:
        return False
    return True
  else:
    for i in range((n-1)//2):
      if a[i] != a[n-i-1]:
        return False
    return True

res = "No"
if check(s):
  #print(s)
  if check(s[:(l-1)//2]):
    if check(s[(l+3)//2 - 1:]):
      res = "Yes"

print(res)

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

using namespace std;

int partition(vector<pair<int,string>> &a, int p, int r) {

	int x = a[r].first;
	int i = p-1;
	for (int j = p; j < r; j++) {
		if (a[j].first <= x) {
			i++;
			swap(a[i], a[j]);
		}
	}
	swap(a[i+1], a[r]);
	return i+1;

}

int quicksort(vector<pair<int,string>>&a, int p, int r) {
	if (p < r) {
		int q = partition(a, p, r);
		quicksort(a, p, q - 1);
		quicksort(a, q + 1, r);
	}
	return 0;
}


int merge(vector<pair<int,string>> &a, int left, int mid, int right, int &counter) {
	int n1 = mid - left;
	int n2 = right - mid;
	vector<pair<int,string>> l(n1 + 1, pair<int,string>());
	vector<pair<int,string>> r(n2 + 1, pair<int,string>());

	for (int i = 0; i < n1; i++) {
		l[i] = a[left + i];
	}
	for (int i = 0; i < n2; i++) {
		r[i] = a[mid + i];
	}
	l[n1].first = INT_MAX;
	r[n2].first = INT_MAX;

	int i = 0;
	int j = 0;

	for (int k = left; k < right; k++) {
		counter++;
		if (l[i].first <= r[j].first) {
			a[k] = l[i];
			i++;
		}
		else {
			a[k] = r[j];
			j++;
		}
	}
	return 0;
}

int mergeSort(vector<pair<int,string>> &a, int left, int right, int &counter) {
	if (left + 1 >= right) {
		return 0;
	}

	int mid = (left + right) / 2;

	mergeSort(a, left, mid, counter);
	mergeSort(a, mid, right, counter);
	merge(a, left, mid, right, counter);
	return 0;
}


int main() {

	int n;
	cin >> n;

	vector<pair<int,string>> a(n, pair<int,string> ());

	for (int i = 0; i < n; i++) {
		cin >> a[i].second >> a[i].first;
	}
	vector<pair<int, string>> b(n, pair<int, string>());
	b = a;

	int p = 0;
	int r = n - 1;
	quicksort(a, p, r);

		int left = 0, right = n;
	int counter = 0;

	mergeSort(b, left, right, counter);

	for (int i = 0; i < n; i++) {

		if (a[i].second != b[i].second) {
			cout << "Not stable" << endl;
			break;
		}
		if (i == n - 1) {
			cout << "Stable" << endl;
		}
	}

	for (int i = 0; i < n; i++) {
		cout << a[i].second << " " << a[i].first << endl;
	}
}


Measured memory_bytes: 12212
uses crt;
var a:array[0..100000] of int64;
    n,i,w,wmax,j:longint;
    v:int64;
begin
    clrscr;
    read(n,wmax);
    fillchar(a,sizeof(a),0);
    for i:=1 to n do
      begin
          readln(w,v);
          for j := wmax downto w do if v+a[j-w]>a[j] then a[j]:=v+a[j-w];
      end;
      writeln(a[wmax]);
      readln;
end.

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
typedef long long ll;

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >>d;
    ll ans = -1e18 - 10;
    ans = max(a * c, ans);
    ans = max(ans, a * d);
    ans = max(ans, b * c);
    ans = max(ans, b * d);
    cout << ans << endl;
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int maxc=0;

  for(int i=1;i<N;i++){ 
    int sum=0;

    for(char c='a';c<='z';c++){
      bool left=false,right=false;

      for(int l=0;l<i;l++){
	if(S.at(l)==c) left=true;
      }

      for(int r=i;r<N;r++) {
	if(S.at(r)==c) right=true;
      }

      if(left&&right) sum++;
    }

    maxc=max(maxc,sum);
  }
  cout << maxc << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<map>
#include<set>
#include<vector>
using namespace std;
#define mod 1000000007
#define ll long long 
#define forn for(int i = 0; i <n; i++)

int arr[10];

int main() {
	int lk, k;
	cin>>lk>>k;
	if(lk*500 >= k)cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

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

typedef long long LL;
const int maxn = 1e5;
int n, a, b, m[maxn+3];

bool judge(LL x)
{
    LL sum = 0;
    for(int i=0; i<n; ++i)
    {
        LL t = (LL)m[i]-x*b;
        if(t>0)
        {
            sum += (int)ceil(t*1.0/(a-b));
            if(sum > x || sum < 0)
                return false;
        }
    }
    return true;
}
int main()
{
        scanf("%d%d%d",&n,&a,&b);
        int imax = 0;
        for(int i=0; i<n; ++i) scanf("%d",&m[i]), imax = max(imax, m[i]);
        LL l=0, r=imax;
        while(l<r)
        {
            LL mid = l+r>>1;
            if(judge(mid)) r=mid;
            else l=mid+1;
        }
        printf("%lld\n",r);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

vector <ll> so;
ll a[1010][1010];
ll b[1010];
int main() {
	for(int i=2;i<=1000;i++){
		ll now=i;bool ch=true;
		for(int j=sqrt(now);j>=2;j--){
			if(now%j==0){
				ch=false;
				break;
			}
		}
		if(ch){
			so.push_back(i);
		}
	}
	for(int i=2;i<=1000;i++){
		ll now=i;
		for(int j=0;j<so.size();j++){
			ll nowso=so[j];
			while(now%nowso==0){
				a[i][nowso]++;
				now=now/nowso;
			}
		}
	}
	ll n;
	cin>>n;
	for(int i=2;i<=n;i++){
		ll now=0;
		for(int j=2;j<=n;j++){
			now+=a[j][i];
		}
		b[i]=now;
	}
	ll ans=1;
	for(int i=2;i<=n;i++){
		ll now=b[i]+1;
			ans*=now;
			ans%=inf;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 6400
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int A = cin.nextInt();
        int B = cin.nextInt();
        int C = cin.nextInt();
        if(gcd(C, B) % gcd(A, B) == 0)
        {
            Console.WriteLine("YES");
        }
        else Console.WriteLine("NO");
    }
    
    long gcd(long a, long b)
    {
        if (b == 0) return a;
        return gcd(b, a % b);
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
ll f(ll n,ll m){
	if(n==0)return 1;
	if(n%2==0){
		ll t=f(n/2,m);
		return t*t%MOD;
	}
	return m*f(n-1,m)%MOD;
}

signed main(){
	ll n,m; cin>>m>>n;
	cout<<f(n,m)<<endl;
	
	
	return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
string s[100];
int n,j,i;
int dfs(int p){

  int res=0,o=s[j].size();

  if(isdigit(s[j][p]))return s[j][p]-'0';

  if(s[j][p]=='+')
    while(s[j+1].size()>o)j++,res+=dfs(p+1);

  else{
    res=1;
    while(s[j+1].size()>o)j++,res*=dfs(p+1);
  }

  return res;
}
int main(){
  while(cin>>n,n){

    for(j=i=0;i<100;i++)s[i]="";
    for(i=0;i<n;i++)cin>>s[i];

    cout<<dfs(0)<<endl;
  }
}

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

int main(){
	int x;
	cin >> x;
	while(1){
		bool ok = true;
		for(int i = 2; i < x; i++){
			if(x%i == 0){
				ok = false;
				break;
			}
		}
		if(ok) break;
		++x;
	}
	cout << x << endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
char s[200010];
int main(){
    scanf("%s",s+1);
    int n=strlen(s+1);
    ll ans=0,tot=0;
    for(int i=1;i<=n;i++){
        if(s[i]=='A') tot++;
        else{
            if(s[i]=='C'){
                tot=0;
            }else{
                if(s[i+1]=='C'){
                    ans+=tot;
                    i++;continue;
                }else{
                    tot=0;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

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

	int n;
	cin >> n;

	ll m, v, p;
	cin >> m >> v >> p;
	
	vector<ll> as(n);
	for (int i = 0; i < n; ++i) cin >> as[i];
	sort(as.begin(), as.end());
	
	int low = 0;
	int high = n;
	while(low != high) {
		int mid = (low + high + 1) >> 1;
		int i = n-mid;

		// Can problem i get selected?
		// We have to give in total m(v-p) votes to problems i+1 ... n-p,
		// At most m to each of them, and they all have to have at most x
		ll x = as[i] + m;
		ll tar = m * max(0ll, v-(i+1)-(p-1));
		ll can = 0;
		bool fail = false;
		for (int j = i+1; j <= n-p; ++j) {
			if (as[j] > x) fail = true;
			else can += min(m, x - as[j]);
		}
		if (can >= tar && !fail) {
			low = mid;
		} else {
			high = mid - 1;
		}
		
	}
	cout << low << '\n';
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

int main()
{
    int a, b;
    cin >> a >> b;
    if (1<= a and a <= 9 and 1<=b and b <=9)
        cout << a*b;
    else
        cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
n, w = map(int, input().split())
wv = []
for _ in range(n):
    wv.append(list(map(int, input().split())))

dp = [[0]*(w+1) for _ in range(n+1)]

for n_ in range(1, n+1):
    for w_ in range(1, w+1):
        temp_w = wv[n_-1][0]
        temp_v = wv[n_-1][1]
        
        if temp_w <= w_:
            dp[n_][w_] = max(dp[n_-1][w_-temp_w]+temp_v, dp[n_-1][w_])
        else:
            dp[n_][w_] = dp[n_-1][w_]

print(dp[n][w])

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

int main(){
    int n, a;
    scanf("%d", &n);
    deque<int> b;
    rep(i, n){
        scanf("%d", &a);
        if(i % 2) b.push_front(a);
        else b.push_back(a);
    }
    if(n % 2) reverse(b.begin(), b.end());
    rep(i, n){
        if(i) printf(" ");
        printf("%d", b[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 2944
#create date: 2020-04-19 21:00

import sys
stdin = sys.stdin
import math

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    r = ni()
    print(2*math.pi*r)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

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

int main() {
	int N,A,B;
	cin>>N>>A>>B;
	int ans = min(A*N,B);
	
	cout<<ans<<endl;
}

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

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

    if(a > 0)   cout << "Positive" << endl;
    else if(a <= 0 && b >= 0)   cout << "Zero" << endl;
    else{
        if((b-a+1)%2 == 1)  cout << "Negative" << endl;
        else                cout << "Positive" << endl;
    } 

    return 0;
}

Measured memory_bytes: 256
# Refered #5850116 submit
import numpy as np

h, w = map(int, input().split())
s = np.array([list(input()) for _ in range(h)]) == '.'

ups = np.zeros((h, w), dtype = int)
downs = np.zeros((h, w), dtype = int)
lefts = np.zeros((h, w), dtype = int)
rights = np.zeros((h, w), dtype = int)

for i in range(1, h):
    ups[i] = (ups[i-1]+1)*s[i-1]
for i in range(h-2, -1, -1):
    downs[i] = (downs[i+1]+1)*s[i+1]
for j in range(1, w):
    lefts[:, j] = (lefts[:, j-1]+1)*s[:, j-1]
for j in range(w-2, -1, -1):
    rights[:, j] = (rights[:, j+1]+1)*s[:, j+1]
counts = ups+downs+lefts+rights
ans = np.max(counts*s)+1
print(ans)


Measured memory_bytes: 219816
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>
#include <math.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;

int main()
{
    string s;
    cin>>s;
    int n = s.size();
    vvii alpha_idx(26);
    rep(i,26){
        alpha_idx[i].pb(0);
    }
    rep(i,n){
        alpha_idx[s[i] - 'a'].pb(i+1);
    }
    rep(i,26){
        alpha_idx[i].pb(n+1);
    }
    vii res(n + 2, infi);
    vector<set<ll>> bef(n + 2);
    res[n+1] = 0;
    repr(i,n,-1){
        rep(j,26){
            int idx = upper_bound(all(alpha_idx[j]), i) - alpha_idx[j].begin();
            int nex = alpha_idx[j][idx];
            if (res[nex]+1<res[i]){
                res[i]=res[nex]+1;
            }
        }
    }
    string t = "";
    int ans = res[0], now = 0;
    rep(i,ans){
        rep(j,26){
            int idx = upper_bound(all(alpha_idx[j]), now) - alpha_idx[j].begin();
            int nex = alpha_idx[j][idx];
            if (res[nex]+1==res[now]){
                t += (char)(j + 'a');
                now = nex;
                break;
            }
        }
    }
    cout << t << endl;
}


Measured memory_bytes: 11524
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007;
#define pi 3.14159265358979323846
#define Endl endl
#define LINF 100000000000000007LL
#define ll long long
using namespace std;
signed main(){
	map<int,int> mope;
	int n;
	cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++){ cin>>a[i]; mope[a[i]]++; }
	int ans = 0;
	for(int i=0;i<=214514;i++){
		ans += (mope[i]-1) * mope[i] / 2;
	}
	for(int i=0;i<n;i++){
		int cur = a[i];
		cout<<ans-mope[cur]+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 17536
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x, n = map(int, readline().split())

p = set(map(int, readline().split()))

ans = x
tmp = 300
for i in reversed(range(-1, 102)):
    if i not in p:
        if tmp >= abs(x - i):
            tmp = abs(x - i)
            ans = i
print(ans)


Measured memory_bytes: 9200
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        a: i64, mut b: i64,mut c: i64, k: i64
    }
    let mut r = 0;
    while a >= b {
        b *= 2;
        r += 1;
    }
    while b >= c {
        c *= 2;
        r += 1;
    }
    if k >= r {
        println!("Yes");
    } else {
        println!("No");
    }
    // println!("{}", );
}


Measured memory_bytes: 2160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }

ll a[100001];
ll b[100001];
int n;

int main()
{
    read(n);
    for(int i=1; i<=n; ++i) read(a[i], b[i]);
    ll ss=0;
    for(int i=n; 1<=i; --i){
        a[i] += ss;
        ll r=(b[i]-a[i] % b[i])%b[i];
        a[i] += r;
        ss += r;
    }
    printf("%lld\n", ss);
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define mod   1000000007
using namespace std;
const int N = 1e4 + 5;
const int M = 105;
vector<long long>num;
int dp[N][M][2];
int n, m;
string s;
int d;
long long help(long long idx, long long sum, long long tight)
{
    if (idx == num.size())
        return (sum%d==0);
    if (dp[idx][sum][tight] != -1)
        return dp[idx][sum][tight];
    long long res = 0;
    int biggest;
    if (tight)
     biggest= (num[idx]) ;
     else
        biggest=9;
    for (int i = 0; i <= biggest; i++)
    {
        int newtight = ((num[idx])== i) ? tight : 0;
        res =(res+help(idx + 1, (sum + i) % d, newtight))%mod;
    }
    return dp[idx][sum][tight] = res;
}
long long solve(string s)
{
    memset(dp, -1, sizeof dp);
    num.clear();
    for(int i=0;i<=s.size()-1;i++)
        num.push_back(s[i]-'0');
    return (help(0, 0, 1) -1 + mod) % mod;
}
int main()
{
    cin>>s;
    cin>>d;
    cout<<solve(s);
    return 0;
}


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

int search(vector<int> A, int n, int key) {
	int i = 0;
	A[n] = key;
	while (A[i] != key) i++;
	return i != n;
}

int main() {
	int n, q, key, sum = 0;
	vector<int> A(10001);
	cin >> n;
	for (int i = 0; i < n; i++)cin >> A[i];

	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> key;
		if (search(A, n, key)) sum++;
	}
	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 3216
import std;

int calc(string s) {
    int[2019] a;
    a[0] = 1;
    int ans = 0;
    int p = 1;
    int now = 0;
    foreach_reverse (c; s) {
        now = (now  + p * (c - '0')) % 2019;
        p = p * 10 % 2019;
        ans += a[now];
        a[now]++;
    }
    return ans;
}

void main() {
    string s = read!string;
    writeln(calc(s));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


Measured memory_bytes: 3860
// Shift-JIS（シフトジス）

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

int main()
{
    int N, Z = 0;
    cin >> N;
    vector<int> V(N);
    vector<int> C(N);
    for (int i = 0; i < N; i++) {
        cin >> V.at(i);
    }
    for (int i = 0; i < N; i++) {
        cin >> C.at(i);
    }
    for (int i = 0; i < N; i++) {
        if (V.at(i) > C.at(i)) {
            Z += V.at(i) - C.at(i);
        }
    }
    cout << Z << endl;
}


Measured memory_bytes: 256
# encoding:utf-8
import copy
import numpy as np
import random

nums = list(input())
nums = [int(i) for i in nums]

def make2digits(n):
    digits = []
    for i in range(3):
        if n % 2 == 1:
            digits.append(1)
        else:
            digits.append(0)
        n = n//2
    return digits

for i in range(8):
    count = nums[0]
    choices = make2digits(i)
    # print(choices)
    for j in range(len(choices)):
        if choices[j]==0:
            count -= nums[j+1]
        else:
            count += nums[j+1]
    # print(count)
    if count == 7:
        ans_choice = choices
        break


plusminus = ["-","+"]
ans = ""
nums = [str(i) for i in nums]
for i in range(3):
    ans = ans + nums[i] + plusminus[ans_choice[i]]

ans = ans+nums[-1]+"=7"
print(ans)


Measured memory_bytes: 22100
import java.util.Scanner;

public class Main {
    public static boolean debug = true;

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

        int ans = n*n*n;

        System.out.println(ans);

    }


    public static void d(String message){
        if(debug){
            System.out.println(message);
        }
    }
}

Measured memory_bytes: 22996
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//ABC168D
//ABC168C
//ABC168B
//ABC168A

int main(void) {
  int n, k, i, cou=0, tmp;
  scanf("%d", &n);
  n%=10;
  if(n==2||n==4||n==5||n==7||n==9)printf("hon");
  else if(n==3)printf("bon");
  else printf("pon");

}


Measured memory_bytes: 1732
import java.util.Scanner;

public class Main {
	
	
	public static final int SIZE = 8;
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		char[][] input = new char[SIZE][SIZE];
		char[][] output = new char[SIZE][SIZE];
		for(int i = 0; i < SIZE; i++){
			input[i] = sc.nextLine().toCharArray();
		}
		
		for(int i = 0; i < 3; i++){
			System.out.println((i+1)*90);
			for(int j = 0; j < SIZE; j++){
				for(int k = 0; k < SIZE; k++){
					output[k][(SIZE - 1) - j] = input[j][k];
				}	
			}
			
			for(int j = 0; j < SIZE; j++){
				for(int k = 0; k < SIZE; k++){
					System.out.print(output[j][k]);
				}
				System.out.println();
			}
			
			char[][] tmp = input;
			input = output;
			output = tmp;
		}
	}
	
}

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

const int N = 5;
vector<int> G[N];
int deg[N], cnt[N];

int main() {
    ios::sync_with_stdio(false);
    for (int i = 1; i <= 3; i++) {
        int a, b;
        cin >> a >> b;
        deg[a] += 1;
        deg[b] += 1;
    }
    for (int i = 1; i <= 4; i++) {
        cnt[deg[i]] += 1;
    }
    if (cnt[1] == 2 && cnt[2] == 2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int N = scanner.nextInt();
        int[] cnts = new int[N];
        for(int i = 0; i < N; i++) {
            cnts[i] = scanner.nextInt();
        }
        ArrayList<Integer> ans = new ArrayList<>();
        int[] sums = new int[N+1];
        for(int i = N; i > 0; i--) {
            int above = 0;
            for(int j = i + i; j <= N; j+= i) {
                above += sums[j-1];
            }
            above %= 2;
            int cur;
            if (above == 1) {
                if (cnts[i-1] == 0) cur = 1;
                else cur = 0;
            }
            else {
                if (cnts[i-1] == 0) cur = 0;
                else cur =1;
            }
            if (cur == 1) ans.add(i);
            sums[i-1] = cur;
        }
        out.println(ans.size());
        for(int i = 0; i < ans.size(); i++) {
            if (i > 0) out.print(" ");
            out.print(ans.get(i));
        }
        out.flush();
    }
    
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        
        int[] readIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
}


Measured memory_bytes: 43016
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<vector>
#include<climits>
using namespace std;

int main(void){

    int n;
    cin>>n;
    
    vector<int> v, c;

    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        v.push_back(a);
    }

     for(int i=0;i<n;i++){
        int a;
        cin>>a;
        c.push_back(a);
    }

    int sum = 0;

    for(int i=0;i<n;i++){
        if(v[i] > c[i]) sum += (v[i] - c[i]);
    }

    cout<<sum<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
using namespace std;
int main()
{
    string s;
    string t;
    cin >> s;
    cin >> t;
  int c = 0;
    
    rep (i, s.length()) {
      if (s[i] == t[i]) {
        ++c;
      }
    }
    
  
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
    string s;
    int a = 0;
    cin >> s;
    for (auto c: s) {
        if (c == 'x') a++;
    }
    if (a <= 7) {
        puts("YES");
    }
    else {
        puts("NO");
    }
}

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

int main() {
	string s;
	map<char, int> mp;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		mp[s[i]]++;
	}
	if ((!mp['N'] && !mp['S']) || (mp['N'] && mp['S'])) {
		if ((!mp['E'] && !mp['W']) || (mp['E'] && mp['W'])) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

int main()
{
    char s[201];
    cin >> s;
    int length=strlen(s);
    while(length>=2){
        int flag=1;
        length-=2;
        for(int i=0; i<length/2; i++){
            if(s[i]!=s[i+length/2]){
                flag=0;
                break;
            }
        }
        if(flag==1){
            cout << length << endl;
            break;
        }
    }
    
    return 0;
}

Measured memory_bytes: 760