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

using namespace std;

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

    int K[N][M];
    for (int n = 0; n < N; n++){
        for (int m = 0; m < M; m++){
            K[n][m] = 0;
        }
    }
    
    for (int n = 0; n < N; n++){
        int k;
        cin >> k;
        
        for (int j = 0; j < k; j++){
            int id;
            cin >> id;
            K[n][id - 1] = 1;
        }
    }

    int cnt = 0;
    for (int m = 0; m < M; m++){
        int is_liked = 0;
        for (int n = 0; n < N; n++){
            is_liked = is_liked + K[n][m];
        }
        if (is_liked == N){
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
        public static int input;
        public static long[] arr;
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                	input = sc.nextInt();
                	arr = new long[input];
                        for (int i = 0; i < input; i++) {
                        	arr[i] = sc.nextLong();
                        }
                        for (int i = input / 2;  i >= 0; i--) {
                                maxHeapify(i);
                        }
                        for (int i = 0; i < input; i++) {
                                System.out.print(" "+arr[i]);
                        }
                        System.out.println("");
                }
        }
        public static void maxHeapify(int i) {
                int left = i * 2 + 1, right = i * 2 + 2, largest;
                if (left < input && arr[left] > arr[i]) {
                        largest = left;
                } else {
                        largest = i;
                }
                if (right < input && arr[right] > arr[largest]) {
                        largest = right;
                }

                if (largest != i) {
                        long tmp = arr[i];
                        arr[i] = arr[largest];
                        arr[largest] = tmp;
                        maxHeapify(largest);
                }
        }
}


Measured memory_bytes: 191604
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define ull unsigned long long

int main(){
    int i,n,a[200002]={},ans=0,cur=1;
    scanf("%d",&n);
    for (i=0; i<n; i++) scanf("%d",&a[i]);
    for (i=0; i<n; i++) {
        if (cur!=a[i]) ans++;
        else cur++;
    }
    if (cur==1) printf("%d",-1);
    else printf("%d",ans);
    return 0;
}



Measured memory_bytes: 896
import math

def isPrime(n):
    if n < 2:
        return False
    else:
        divisors = []
        tem = []
        for p in range(1,math.ceil(n**(1/2)+1)):
            if n % p == 0:
                divisors.append(p)
        
        for divisor in divisors:
            tem.append(n//divisor)
        
        divisors = list(set(sorted(divisors + tem)))
        
        if len(divisors) == 2:
            return True
        else:
            #print(divisors)
            return False

X = int(input())

while True:
    if isPrime(X):
        print(X)
        break
    else:
        X += 1

Measured memory_bytes: 9296
#include<cstdio>
#include<cstring>
char a[10010];
bool c, f;
int main() 
{
    scanf("%s", a);
    for(int i=0; i<strlen(a); i++) 
    {
        if(a[i]=='C') c=true;
        if(a[i]=='F'&&c==true) f=true; 
    }
    if(f==true) printf("Yes\n");
    else printf("No\n");
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n+1), b(n);
  for(int i = 0; i < n+1; i++){
  	cin >> a.at(i);
  }
  for(int i = 0; i < n; i++){
  	cin >> b.at(i);
  }
  
  long long ans = 0;
  for(int i = 0; i < n; i++){
  	ans += min(a.at(i), b.at(i));
  	b.at(i) -= min(a.at(i), b.at(i));
  	ans += min(a.at(i+1), b.at(i));
  	a.at(i+1) -= min(a.at(i+1), b.at(i));
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int n;
	cin >> n;

	vector<Int> a(n);
	for (Int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	Int ans1 = a[n - 1];
	Int ans2;

	Int diff = INF;
	Int temp1 = ans1 / 2;
	Int temp2 = temp1 + 1;
	if (ans1 % 2) {
		Int temp3;
		for (Int i = 0; i < n - 1; i++) {
			temp3 = min(abs(a[i] - temp1), abs(a[i] - temp2));
			if (temp3 < diff) {
				ans2 = a[i];
				diff = temp3;
			}
		}
	}
	else {
		Int temp3;
		for (Int i = 0; i < n - 1; i++) {
			temp3 = abs(a[i] - temp1);
			if (temp3 < diff) {
				ans2 = a[i];
				diff = temp3;
			}
		}
	}

	cout << ans1 << " " << ans2 << "\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <math.h>
typedef long long ll;
using namespace std;

int main() {
	ll a,b;
	cin >> a>>b;
	char c[a+1][b+1];
	for(int i=0;i<a;i++){
		for(int j=0;j<b;j++){
			cin >> c[i][j];
		}
	}
	for(int i=0;i<2*a;i++){
		for(int j=0;j<b;j++){
			cout << c[i/2][j];
		}
		cout << endl;
	}
 	return 0;
}



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

const int N = 2e3 + 7, MXA = 4e6 + 7;
long long M = 1e9 + 7;
int fc[MXA];
int rfc[MXA];
long long pw(int a, int b) {
	if (b == 0)
		return 1;
	int t = pw(a, b / 2);
	t = (t * t) % M;
	if (b % 2)
		t = (t * a) % M;
	return t;
}
int rk;
long long chs(int a, int b) {
	long long t = fc[b];
	t = (t * rk) % M;
	t = (t * pw(fc[b - a], M - 2)) % M;
	return t;
}
int n, k;
int dp[N][N];
int32_t main() {
	fc[0] = rfc[0] =  1;
	
	for (int i = 1; i < MXA; i++)
		fc[i] = (fc[i - 1] * i) % M;
	dp[0][0] = 1;
	cin >> n >> k;
	rk = pw(fc[k - 2], M - 2);
	if (k == 1) {
		cout << 1;
		return 0;
	}
	for (int i = 0; i <= n; i++)
		for (int j = i; j <= n; j++) {
			if (i + j == 0)
				continue;
			if (i > 0)
				dp[i][j] = dp[i - 1][j];
			if (j > i) {
				int tmp = i + j * (k - 1) - 1;
				dp[i][j] += (chs(k - 2, tmp) * dp[i][j - 1]) % M;
				dp[i][j] %= M;
//				cout << i << " " << j << " > " << dp[i][j] << " " << tmp << " " << (fc[tmp] * rfc[k - 2] % M) * rfc[tmp - (k - 2)] % M << endl;
			}
		}
	cout << (dp[n][n] * fc[n]) % M;
	return 0;
}

Measured memory_bytes: 65536
#include <iostream>
using namespace std;
int main(){ 
 int n;
 cin >> n;
  int a=0;
  int b=n;
  for(int i=0;i<9;i++){
    a += (b%10);
    b /= 10;
  };
  
  if(n%a == 0){
  cout<<"Yes"<<endl;
  }
  else{
  cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  int a, b, c;
  std::cin >> a >> b >> c;
  if (a < b && b < c) {
    std::cout << "Yes" << std::endl;
  }
  else
  {
    std::cout << "No" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 3076
import java.util.Scanner;

class Main{

    static double gcd(double a,double b){
	if(b==0) return a;
	else return gcd(b,a%b);
    }
    
    public static void main(String[] args){
	final Scanner sc = new Scanner(System.in);
	while(sc.hasNext()){
	    double a=sc.nextDouble();
	    double b=sc.nextDouble();
	    double g=gcd(a,b);
	    System.out.printf("%.0f %.0f\n",g,(a*b)/g);
	}
    }
}

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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int n, m;
	cin >> n >> m;
	int mn = 0, mx = n;
	while (m--) {
		int l, r;
		cin >> l >> r;
		mn = max(l, mn);
		mx = min(mx, r);
	}
	cout << max(0, mx - mn + 1) << "\n";
}


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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 105;

int n, num[N], mx, mi = 0x3f3f3f3f;

void GG () { puts("Impossible"), exit(0); }

int main () {
	scanf("%d", &n);
	for (int i = 1, j; i <= n; ++i) {
		scanf("%d", &j);
		++num[j];
		if (j > mx) mx = j;
		if (j < mi) mi = j;
	}
	if (num[mi] > 2) return puts("Impossible"), 0;
	for (int i = mi + 1; i < mx; ++i) if (num[i] < 2) GG();
	if (num[mi] == 2 && (num[mx] == 1 || mx % 2 == 0 || (mx + 1) / 2 != mi)) GG();
	if (num[mi] == 1) {
		if (num[mx] == 1 && (!(mx & 1) || (mx - 1) / 2 != mi)) GG();
		if (num[mx] > 1 && ((mx & 1) || mx / 2 != mi)) GG();
	}
	return puts("Possible"), 0;
}

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

int N;
int x[10], y[10];

double dist(int i, int j){
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx*dx + dy*dy, 0.5); //第二引数の0.5は1/2乗の意
}

void solve(){
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> x[i] >> y[i];
    double sum = 0.0;
    vector<int> v(N);
    for(int i = 0; i < N; i++) v[i] = i + 1;
    do{
        for(int i = 0; i < N - 1; i++) sum += dist(v[i], v[i+1]);
    } while(next_permutation(v.begin(), v.end()));
    int Factorial = 1;
    for(int i = 2; i <= N; i++) Factorial *= i;
    cout << fixed << setprecision(10) << sum / Factorial << endl;;
    return;
}

int main(){
    solve();
    return 0;
}

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

  dp = [1e10]*N
  dp[0] = 0
  for i, h in enumerate(H):
    if i == 0:
      continue
    x = max(0, i-K)
    dp[i] = min([d+abs(h-ht) for d, ht in zip(dp[x:i], H[x:i])])
  print(dp[-1])

if __name__ == "__main__":
  main()

Measured memory_bytes: 13928
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll, ll>
#define vi          vector<ll>
#define vvi			vector<vi>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define tr(c,i)		for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x)	((c).find(x) != (c).end()) 
#define cpresent(c,x)	(find(all(c),x) != (c).end()) 
#define int ll
using namespace std;

#define N  100005

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		int n, k;
		cin >> n >> k;
		int a[n];
		memset( a, 0, sizeof(a));

		rep(i, 0, k)
		{
			int d;
			cin >> d;

			rep(j, 0, d)
			{
				int x;
				cin >> x;
				a[x-1] = 1;
			}
		}

		int ans = 0;

		rep(i, 0, n)
		ans+=a[i];

		cout << n-ans;
	}
	return 0;
}

Measured memory_bytes: 3672
#include <stdio.h>

int main(void){

    int a,b;

    scanf("%d %d", &a, &b);
    
    if(a<-1000 || 1000<a ||  b<-1000 || 1000<b){
        printf("Integer a & b should be no less than -1000 and no more than 1000\n");
        return 0;
    }

    if(a<b){
        printf("a < b\n");
    }
    else if(a>b){
        printf("a > b\n");
    }
    else{
        printf("a == b\n");
    }


    return 0;
}


Measured memory_bytes: 2136
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
typedef pair<int, int> PII;
typedef long long ll;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


ll n, t, q, tmp1, tmp2, tmp3;
ll a[100002], d[100002];
ll x[1002];
ll ans[100002];

int main() {

	cin >> n >> t >> q;
	REP(i, 1, n + 1)cin >> a[i] >> d[i];
	REP(i, 1, q + 1)cin >> x[i];

	tmp1 = -1;
	REP(i, 1, n + 1) {
		if (d[i] == 1) {
			tmp1 = d[i];
			tmp2 = a[i];
			tmp3 = i;
		}
		else {
			if (tmp1 != -1) {
				if (abs(a[i] - tmp2) / 2 <= t) {
					ans[i] = (tmp2 + a[i]) / 2;
					ans[tmp3] = ans[i];
					d[i] = 0;
					d[tmp3] = 0;
					tmp1 = -1;
					tmp2 = 0;
					tmp3 = 0;
				}
			}
		}
	}
	tmp1 = -1;
	REP(i, 1, n + 1) {
		if (d[i] == 0) {
			tmp1 = ans[i];
		}
		else if (d[i] == 2) {
			if (tmp1 != -1) {
				if (abs(a[i] - tmp1) <= t) {
					ans[i] = tmp1;
				}
			}
		}
	}
	tmp1 = -1;
	for (int i = n; i > 0; i--) {
		if (d[i] == 0) {
			tmp1 = ans[i];
		}
		else if (d[i] == 1) {
			if (tmp1 != -1) {
				if (abs(a[i] - tmp1) <= t) {
					ans[i] = tmp1;
				}
			}
		}
	}
	REP(i, 1, q + 1) {
		if (ans[x[i]] != 0) {
			cout << ans[x[i]] << endl;
		}
		else {
			if (d[x[i]] == 1) {
				cout << a[x[i]] + t << endl;
			}
			else {
				cout << a[x[i]] - t << endl;
			}
		}
		
	}

	return 0;
}


Measured memory_bytes: 5336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll INF = 1e10;
ll MOD = 1e9 + 7;
int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    int now = h[0];
    int count = 0;
    int ans = 0;
    for(int i = 1; i < n; i++)
    {
        if(now >= h[i])
        {
            now = h[i];
            count++;
            continue;
        }
        else
        {
            ans = max(ans, count);
            count = 0;
            now = h[i];
        }
    }
    cout << max(ans, count) << endl;
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    lint N, A, B;
    cin >> N >> A >> B;
    vector<lint> X(N);
    rep(i, N) cin >> X[i];

    vector<lint> toNext(N - 1);
    for (int i = 0; i <= N - 2; i++) {
        toNext[i] = X[i + 1] - X[i];
    }
    lint ans = 0;
    for (int i = 0; i < N - 1; i++) {
        if (A * toNext[i] <= B) {
            ans += A * toNext[i];
        } else {
            ans += B;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1920
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		int d;
		if(c < b){
			d = c;
			c = b;
			b = d;
		}if(b < a){
			d = b;
			b = a;
			a = d;
		}if(c < b){
			d = c;
			c = b;
			b = d;
		}
		System.out.println(a + " " + b + " " + c);
	}
}


Measured memory_bytes: 26272
// AOJ 2182: Eleven Lover
// 2017.9.20 bal4u@uu
// 2017.11.22

#include <stdio.h>
#include <string.h>

char a[80005];
int dp[2][11];
int t[11][10];

int main()
{
	int i, d, k1, k2, ans;
	char *p;

	for (i = 0; i < 11; i++) for (d = 0; d < 10; d++) t[i][d] = (10*i+d) % 11;
	while (scanf("%s", a) && *a != '0') {
		memset(dp, 0, sizeof(dp)); ans = 0;
		for (k1 = 0, k2 = 1, p = a; *p; k1 = k2, k2 = !k2) {
			memset(dp[k2], 0, sizeof(dp[k2]));
//			for (i = 0; i < 11; i++) dp[k2][i] = 0;
			d = *p++ & 0xf;
			for (i = 0; i < 11; i++) dp[k2][t[i][d]] += dp[k1][i]; 
			ans += dp[k2][0];
			if (d > 0) dp[k2][d]++;
		}
		printf("%d\n", ans);
	}
	return 0;
}

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


int main() {
    int a, b, ab, x, y;
    cin >> a >> b >> ab >> x >> y;

    int minv = a*x + b*y;
    int sum = 2*ab*min(x, y);
    if (x > y) {
        sum += a*(x - y);
    } else if (x < y) {
        sum += b*(y - x);
    }
    minv = min(minv, sum);
    sum = 2*ab*max(x, y);
    minv = min(minv, sum);

    cout << minv << endl;




    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n,m,c;
    cin>>n>>m>>c;
    int arr[m];
    for(int i=0;i<m;i++)
    {
        cin>>arr[i];
    }
    int x;
    int sum=0,count=0;
    while(n--)
    {
        sum=0;
           for(int i=0;i<m;i++)
    {
        cin>>x;
        sum+=(arr[i]*x);
    }
    if(sum+c>0)
    count++;
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 5) {
		b = 0;
	}
	else if (a < 13) {
		b /= 2;
	}
	cout << b << endl;
}

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

int main (){
    string S;
    long long N,i,j,e[310000]={0},w[310000]={0};
    cin>>N>>S;
    
    if(S[0]=='W')w[1]++;
    if(S[0]=='E')e[1]++;
    for(i =1; i<=N; i++){
        if(S[i]=='W')w[i]++;
        if(S[i]=='E')e[i]++;
        w[i]+=w[i-1];
        e[i]+=e[i-1];
    }
    long long ans=LLONG_MAX;
    for(i=1;i<=N;i++){
        long long a=(e[N]-e[i])+w[i-1];
        if(ans>a)
        ans=a;
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5764
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim tmp As String() = Split(Console.ReadLine())
        Dim N As Long = tmp(0)
        Dim K As Long = tmp(1)
        
        Dim Ans As Integer
        If N Mod K = 0 Then
            Ans = 0
        Else
            Ans = 1
        End If
        Console.WriteLine(Ans)
    End Sub
End Module


Measured memory_bytes: 13536
x=int(input())
if 400 <= x<=599:
  print('8')
if 600 <= x<=799:
  print('7')
if 800 <= x<=999:
  print('6')
if 1000 <= x<=1199:
  print('5')
if 1200 <= x<=1399:
  print('4')
if 1400 <= x<=1599:
  print('3')
if 1600 <= x<=1799:
  print('2')
if 1800 <= x<=1999:
  print('1')


Measured memory_bytes: 9180
fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    var ok = false
    for(i in 1 .. 9){
        for(j in 1 .. 9){
            if(i * j == n) ok = true
        }
    }
    println(if(ok) "Yes" else "No")
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();

ll check(ll L, ll N, vector<ll> A) {
	ll ret = 0;
	for (int i=0; i<N; i++) {
		ret += (A[i] + L - 1)/L - 1;
	}
	return ret;
}

int main(int, char**) {
	ll n, k; cin >> n >> k;
	vector<ll> A(n);
	for (int i=0; i<n; i++) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	ll u = A[n - 1];
	ll d = 0;
	while (u - d > 1) {
		ll mid = (u + d) / 2;
		if (check(mid, n, A) <= k) u = mid;
		else d = mid;
	}
	cout << u << endl;

	return 0;
}

Measured memory_bytes: 6440
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
 
#define mod 1000000007
#define inf 1000000000
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}

int main(){
  string s;
  cin >> s;
  if(s == "AAA" || s == "BBB") cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
int a,s,n;
std::bitset<1<<22>d;     
int main(){
    std::cin>>n;d|=1;
    while(n--)std::cin>>a,s+=a,d|=(d<<a);
	while(!d[++s/2]);std::cout<<s/2;
}

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

int N, cnt[10];

int dfs(int no, int n){
    if(pow(10, n-1)<no){
        for(int i=0;i<10;i++) cnt[i] = 0;
        int cur = no;
        while(no){
            cnt[no%10]++; no /= 10;
        }
        if(cnt[3] && cnt[5] && cnt[7] && cur <= N) return 1;
        return 0;
    }

    return dfs(no*10+3, n) + dfs(no*10+5, n) + dfs(no*10+7, n);
}

int main(){
    cin >> N;

    int ans = 0;
    for(int i=3;i<10;i++) ans += dfs(0, i);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

struct UnionFind {
  UnionFind(int n) : data(n, -1) {}

  int root(int ver) { return data[ver] < 0 ? ver : data[ver] = root(data[ver]); }

  bool unite(int u, int v) {
    u = root(u);
    v = root(v);
    if (u == v) return false;
    if (data[u] > data[v]) swap(u, v);
    data[u] += data[v];
    data[v] = u;
    return true;
  }

  bool same(int u, int v) { return root(u) == root(v); }

  int size(int ver) { return -data[root(ver)]; }

private:
  vector<int> data;
};

int main() {
  int n, m; cin >> n >> m;
  UnionFind uf(n);
  while (m--) {
    int a, b; cin >> a >> b; --a; --b;
    uf.unite(a, b);
  }
  int ans = 1;
  REP(i, n) chmax(ans, uf.size(i));
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
#define PI 3.1415926535897932
#define _GLIBCXX_DEBUG
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long num_size(long long X){
  int ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}
int main() {
  
  int N,X;
  cin>>N>>X;
  
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  
  vector<int> P(N+1);
  P[0]=X;
  for(int i=0;i<N;i++){
    P[i+1]=vec[i];
  }
  sort(P.begin(),P.end());
  
  
  int ans=P[1]-P[0];
  
  for(int i=1;i<N;i++){
    ans=GCD(ans,P[i+1]-P[i]);
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3932
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

#define all(x) (x).begin(),(x).end()
#define ll long long
#define pii pair<int,int>
#define N 500500
#define dracarys ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);

const ll mod = (ll)1e9 + 7;

int n;
int b[N];
void solve() {
    cin >> n;
    int A = 0;
    for (int i = 1; i <= n; ++i) cin >> b[i], A ^= b[i];
    for (int i = 1; i <= n; ++i) cout << (b[i] ^ A) << " ";
}

int main() {
//    freopen("sample.in", "r", stdin);
    dracarys
    int t = 1;
//    cin >> t;
    for (int i = 1; i <= t; ++i) {
//        cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 4384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define FORR(x, arr) for(auto& x:arr)
#define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;

int n;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	cout << n/3 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int l = a + b;
    int r = c + d;
    if (l == r) cout << "Balanced" << endl;
    else if (l > r) cout << "Left" << endl;
    else cout << "Right" << endl;
}

Measured memory_bytes: 256
object Main extends App {
	import scala.collection.mutable.Map
	val pw = new java.io.PrintWriter(System.out)
	
	val n, m, k = Scanner.nextInt
	
	val friend, blocked = Array.fill(n+1)(0)
	val uf = UnionFind(1 to n)
	
	Seq.fill(m)((Scanner.nextInt, Scanner.nextInt)) foreach { case (a, b) =>
		uf.unite(a, b)
		friend(a) = friend(a) + 1
		friend(b) = friend(b) + 1
	}
	
	Seq.fill(k)((Scanner.nextInt, Scanner.nextInt)) foreach { case (c, d) =>
		if (uf.same(c,d)) {
			blocked(c) = blocked(c) + 1
			blocked(d) = blocked(d) + 1
		}
	}
 
	(1 to n) foreach { i =>
		pw.print( (uf.size(i) - 1 - friend(i) - blocked(i)).toString + " " )
	}
	
	pw.flush()
}
 
case class UnionFind[T](seq: Seq[T]) {
	import scala.collection.mutable.Map
	private[this] val par: Map[T, T] = Map[T,T](seq.map(elem => elem -> elem): _*)
	private[this] val sz: Map[T, Int] = Map[T, Int](seq.map(elem => elem -> 1): _*)
 
	@scala.annotation.tailrec
	private[this] def find(t: T, acc: Seq[T] = Nil): T = {
		val p = par(t)
		if (p == t) {acc foreach { par(_) = t }; t} else find(p, p +: acc)
	}
 
	def unite(a: T, b: T): Unit = {
		val pa = find(a)
		val pb = find(b)
		
		if (pa == pb) return
		
		if (sz(pa) <= sz(pb)) {
			par(pa) = pb
			sz(pb)  = sz(pa) + sz(pb)
		} else {
			par(pb) = pa
			sz(pa)  = sz(pa) + sz(pb)
		} 
	}
 
	def same(a: T, b: T) = find(a) == find(b)
	
	def size(a: T) = sz(find(a))
}

object Scanner {
  private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0
  @inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
  @inline private def hasNextByte(): Boolean =
    if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else { true }
  @inline private def hasNext(): Boolean = {
    while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
    hasNextByte()
  }
  @inline private def readByte(): Byte =
    if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else { -1 }
  def next(): String = {
    if(!hasNext()) ???
    val sb = new StringBuilder; var b = readByte()
    while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
    sb.toString
  }
  def nextInt(): Int = {
    val n = nextLong()
    if (n < Int.MinValue || Int.MaxValue < n) ???
    n.toInt
  }
  def nextLong(): Long = {
    if(!hasNext()) ???
    var minus = false; var b = readByte()
    if (b == '-') { minus = true; b = readByte() }
    def go (b: Byte, n: Long = 0): Long =
      if ('0' <= b && b <= '9') { go(readByte(), n * 10 + b - '0') }
      else if (minus) { -n } else { n }
    go(b)
  }
  def nextDouble(): Double = next.toDouble
}

Measured memory_bytes: 86904
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,temp;
    cin>>n;
    temp=n;
   /* if(n<4||n<7)
    {
        cout<<"No";
        return 0;
    }*/
    if(n%4==0 || n%7==0)
    {
        cout<<"Yes";
        return 0;
    }
    else
    {
        while(temp>=11)
        {
            if((temp-7)%4==0)
            {
                cout<<"Yes";
                return 0;
            }
            else
            {
                temp=temp-7;
            }
        }
    }
    cout<<"No";
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,count=0,countt=0,countt1=0,countt2=0;
    cin>>n;
    string s[n];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
        if(s[i]=="AC")
            count++;
        else if(s[i]=="WA")
            countt++;
        else if(s[i]=="TLE")
            countt1++;
        else if(s[i]=="RE")
            countt2++;
    }
    cout<<"AC "<<"x "<<count<<endl;
    cout<<"WA "<<"x "<<countt<<endl;
    cout<<"TLE "<<"x "<<countt1<<endl;
    cout<<"RE "<<"x "<<countt2<<endl;
}



Measured memory_bytes: 6760
#include <iostream>

using namespace std;

int main()
{
    int i,m;
    char n;
    int s[13]={0,0,0,0,0,0,0,0,0,0,0,0,0},h[13]={0,0,0,0,0,0,0,0,0,0,0,0,0},c[13]={0,0,0,0,0,0,0,0,0,0,0,0,0},d[13]={0,0,0,0,0,0,0,0,0,0,0,0,0};
    cin >> i;
    for(int t=0;t<i;t++){
        cin >> n >> m;
        if(n=='S') s[m-1]=m;
        else if(n=='H') h[m-1]=m;
        else if(n=='C') c[m-1]=m;
        else if(n=='D') d[m-1]=m;
    }
    for(int t=0;t<13;t++){
        if(s[t]==0) cout << "S " << t+1 << endl;
    }
    for(int t=0;t<13;t++){
        if(h[t]==0) cout << "H " << t+1 << endl;
    }
    for(int t=0;t<13;t++){
        if(c[t]==0) cout << "C " << t+1 << endl;
    }
    for(int t=0;t<13;t++){
        if(d[t]==0) cout << "D " << t+1 << endl;
    }
    return 0;
}



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

int main(){
    string a,b,c;
    cin>>a>>b>>c;
    transform(a.begin(), a.end(), a.begin(), ::toupper);
    transform(b.begin(), b.end(), b.begin(), ::toupper);
    transform(c.begin(), c.end(), c.begin(), ::toupper);
    cout<<a.at(0)<<b.at(0)<<c.at(0)<<endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter};
use std::io::*;
use std::ops::*;
use std::*;

// -----------------------------------------------
// Framework
// -----------------------------------------------

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($arg:expr),*) => {
        #[cfg(debug_assertions)]
        {
            let entries = [$(&stringify!([$arg]:), &$arg as &Debug),*];
            stderr().write_fmt(format_args!("{:#?}\n", entries)).unwrap();
        }
    };
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

// -----------------------------------------------
// Solution
// -----------------------------------------------

#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

/// Wraps a partial-ord value to impl Ord.
#[derive(PartialEq, PartialOrd, Clone, Copy, Debug)]
pub struct OrdAdapter<T>(pub T);

impl<T: PartialEq> Eq for OrdAdapter<T> {}

impl<T: PartialOrd> Ord for OrdAdapter<T> {
    fn cmp(&self, other: &Self) -> Ordering {
        self.partial_cmp(other).unwrap()
    }
}

fn S(N: i64) -> i64 {
    if N < 10 {
        N
    } else {
        N % 10 + S(N / 10)
    }
}

fn R(N: i64) -> f64 {
    N as f64 / S(N) as f64
}

fn f(N: i64) -> i64 {
    let mut n = N;
    let mut m = n;
    let mut d = 0;
    let mut b = 1;
    let mut xs = vec![n];

    while m > 0 && d < 15 {
        n += (9 - m % 10) * b;
        m /= 10;
        b *= 10;
        d += 1;

        xs.push(n);
    }

    debug!(xs);

    xs.into_iter()
        .min_by_key(|&n| (OrdAdapter(R(n)), n))
        .unwrap()
}

pub fn main() {
    // let mut v = Vec::new();
    // let mut n = 1;
    // for _ in 0..1000 {
    //     if n >= 1_000_000_000_000_000_i64 {
    //         break;
    //     }
    //     v.push(n);
    //     n = f(n + 1);
    // }
    // debug!(v, v.len());

    let K = read!(usize);

    let mut n = 1;
    for _ in 0..K {
        println!("{}", n);
        n = f(n + 1);
    }
}


Measured memory_bytes: 4352
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	final long m = (long) 1e9 + 7;

	void run() {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		System.out.println(A / gcd(A, B) * B);
	}

	long gcd(long a, long b) {
		if (a > b)
			return gcd(b, a);
		if (a == 0)
			return b;
		return gcd(a, b % a);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Measured memory_bytes: 22868
#include <iostream>
#include <math.h>

using namespace std;

#define pi 3.14159265359

int main(){
    double a,b,x;
    cin >> a >> b >> x;
    if(x<=a*a*b/2){
        printf("%lf",(180/pi)*atan(b*b*a/(2*x)));
        return 0;
    }else{
        printf("%lf",(180/pi)*atan(2*b/a-2*x/(a*a*a)));
        return 0;
    }
}

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

using ll = long long;
using ull = unsigned long long;
using namespace std;
constexpr int inf = 1<<30;
constexpr int mo = 1e9+7;
constexpr ll infl = 1ll<<60;


int main(){
    cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    ll x,k,d;
    cin>>x>>k>>d;
    if(k%2){
        if(abs(x - d) < abs(x + d)){
            x = x -d;
        }else x = x+d;
        k--;
    }
    d = 2*abs(d);
    x = abs(x);
    ll num = x/d;
    ll ans = x;
    k /= 2;
    if(num > k){
       ans -= k * d;
    }
    else if(num+1 > k or x%d < d - x%d){
        ans = min(x%d,x);
    }else if(x%d > d - x%d){
        ans = min(d - x%d,x);
    }
    cout << ans << endl;
    return 0;
    
}

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

#define MAXN 300000

bool isNotPrime[MAXN];
int primeNum[MAXN];

void checkNumber(int n){
    isNotPrime[n] |= false;
    for(int i = 2; n*i < MAXN; i++){
        isNotPrime[i*n] = true;
    }
}

int main(int argc, const char * argv[]) {
    isNotPrime[1] = true;
    primeNum[2] = 1;
    
    checkNumber(2);
    for(int i = 3; i < MAXN; i++){
        primeNum[i] = primeNum[i-1];
        if(!isNotPrime[i]){
            checkNumber(i);
            primeNum[i]++;
        }
    }
    
    while(1){
        int n; cin >> n;
        if(!n) break;
        
        cout << primeNum[2*n] - primeNum[n] << endl;
    }
}

Measured memory_bytes: 2624
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    D = II()
    C = LMIIS()
    S = []
    for i in range(D):
        S.append(LMIIS())
    T = [0]*D
    for i in range(D):
        T[i] = II()
    satisfaction = 0
    last_held = [-1] * 26
    for i,t in enumerate(T):
        last_held[t-1] = i
        for j,d in enumerate(last_held):
            satisfaction -= C[j] * (i-d)
        satisfaction += S[i][t-1]
        print(satisfaction)




    
main()

Measured memory_bytes: 68748
import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
    i = bisect.bisect_left(A, b)
    j = bisect.bisect_right(C, b)
    ans += i * (N - j)
print(ans)

Measured memory_bytes: 23232
while True :
    H, W = map(int, input().split())
    if H == 0 and W == 0 :
        break
    
    roop = "OFF"
    Tile = [list(input()) for j in range(H)]
    cursol_H = 0
    cursol_W = 0
    roop = "OFF"
    while True :
        if Tile[cursol_H][cursol_W] == ">" :
            Tile[cursol_H][cursol_W] = "/"
            cursol_W += 1
        elif Tile[cursol_H][cursol_W] == "v" :
            Tile[cursol_H][cursol_W] = "/"
            cursol_H += 1
        elif Tile[cursol_H][cursol_W] == "<" :
            Tile[cursol_H][cursol_W] = "/"
            cursol_W -= 1
        elif Tile[cursol_H][cursol_W] == "^" :
            Tile[cursol_H][cursol_W] = "/"
            cursol_H -= 1
        elif Tile[cursol_H][cursol_W] == "/" :
            roop = "ON"
            break
        else :
            break
    
    if roop == "ON" :
        print("LOOP")
    else :
        print(cursol_W, cursol_H)
    
    


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

using namespace std;

int main() {
  string str;
  cin >> str;
  int cnt = 0;
  for (int i = 0; i < 4; i++) {
    if (str[i] == '+') cnt++;
    if (str[i] == '-') cnt--;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n , a , b , beda , maxi , mini;
int main(){
	cin >> n >> a >> b;
	if((abs(a - b) + 1) % 2 == 1){
		beda = abs(a - b)/2;
	}
	else if((abs(a - b) + 1)% 2 == 0){
		if((a - 1) <= (n - b)){
			beda = (a - 1);
			b -= beda;
			if(b % 2 == 1)beda += (b - 1)/2;
			else beda += ((b - 1) / 2) + 1;
		}
		else{
			beda = n - b;
			a += beda;
			if((n - a) % 2 == 0)beda += (n - a)/2;
			else beda += ((n - a)/2) + 1;
		}
	}
	cout << beda << endl;
}

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

int main() {
    long double test_case;
    cin >> test_case;
    cout<<fixed; cout.precision(10);
    cout << (test_case/3)*(test_case/3)*(test_case/3) << endl;
    return 0;
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        Integer num = Integer.parseInt(line);
        num = num * num * num;
        System.out.println(num);
    }
}

Measured memory_bytes: 16864
#include<iostream>

int main(){
  int people[4][3][10];
  int n;
  int b, f, r, v;
  for(int i = 0; i < 4; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 10; k++){
	people[i][j][k] = 0;
      }
    }
  }

  std::cin >> n;

  for(int i = 0; i < n; i++){
    std::cin >> b >> f >> r >> v;
    people[b -1 ][f -1][r - 1] += v;
  }

  for(int i = 0; i < 4; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 10; k++){
	std::cout << ' ' << people[i][j][k];
      }
      std::cout << std::endl;
    }
    if(i != 3) std::cout << "####################" << std::endl;
  }


  return 0;
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	int a[n];
	int x = 0, y = 0;
	for(int i = 0; i < n; ++i){
		cin >> a[i];
	}
	sort(a, a + n);
	reverse(a, a + n);
	for(int i = 0; i < n; ++i){
		if(i % 2 == 0) x += a[i];
		else y += a[i];
	}
	cout << x - y << '\n';
}

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

long long n,s;
inline long long f(long long b,long long n)
{
	if(n<b)
	return n;
	return f(b,n/b)+n%b;
}
int main()
{
	scanf("%lld%lld",&n,&s);
	if(s==n)
	{
		printf("%lld\n",n+1);
		return 0;
	}
	if(s>n)
	{
		printf("-1\n");
		return 0;
	}
	for(long long i=2;i<=sqrt(n)+1;++i)
	{
		if(f(i,n)==s)
		{
			printf("%lld\n",i);
			return 0;
		}
	}
	long long ji=n-s,ans=1e11;
	for(long long i=1;i*i<=ji;++i)
	{
		if(ji%i==0)
		{
			long long b=ji/i+1;
			if(f(b,n)==s)
			ans=min(ans,b);
		}
	}
	if(ans==1e11)
	printf("-1\n");
	else
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func bubbleSort(a []int, n int) {
  flag := true
  count := 0

  for flag {
    flag = false
    for i := n - 1; i > 0; i-- {
      if a[i] < a[i-1] {
        tmp := a[i]
        a[i] = a[i-1]
        a[i-1] = tmp

        flag = true
        count++
      }
    }
  }

  for i := 0; i < n; i++ {
    fmt.Print(a[i])
    if i != n - 1 {
      fmt.Print(" ")
    } else {
      fmt.Println()
    }
  }
  fmt.Println(count)
}

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

  a := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scanf("%d", &a[i])
  }

  bubbleSort(a, n)
}


Measured memory_bytes: 1184
#include<stdio.h>

int main(void){
  int y,m,d;

  while(scanf("%d %d %d",&y,&m,&d)!=EOF){
    if(y<1868)printf("pre-meiji\n");
    else if(y==1868 && m<9)printf("pre-meiji\n");
    else if(y==1868 && m==9 && d<8)printf("pre-meiji\n");
    else if(y<1912)printf("meiji %d %d %d\n",y-1867,m,d);
    else if(y==1912 && m<7)printf("meiji %d %d %d\n",y-1867,m,d);
    else if(y==1912 && m==7 && d<=29)printf("meiji %d %d %d\n",y-1867,m,d);
    else if(y<1926)printf("taisho %d %d %d\n",y-1911,m,d);
    else if(y==1926 && m<12)printf("taisho %d %d %d\n",y-1911,m,d);
    else if(y==1926 && m==12 && d<=24)printf("taisho %d %d %d\n",y-1911,m,d);
    else if(y<1989)printf("showa %d %d %d\n",y-1925,m,d);
    else if(y==1989 && m<1)printf("showa %d %d %d\n",y-1925,m,d);
    else if(y==1989 && m==1 && d<=7)printf("showa %d %d %d\n",y-1925,m,d);
    else printf("heisei %d %d %d\n",y-1988,m,d);
  }

  return 0;
}

Measured memory_bytes: 0
N, M, C = [int(x) for x in input().split()]
B = list([int(x) for x in input().split()])

count = 0
for _ in range(N):
    A = list([int(x) for x in input().split()])

    solve = 0
    for i in range(M):
        solve += A[i] * B[i]
    solve += C

    if solve > 0:
        count += 1

print(count)


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

using ll = long long;

int main(){
  int X,N;
  cin >> X >> N;
  vector<int> p(N);
  rep(i,N)cin >> p[i];
  
  sort(p.begin(), p.end());
/*
  int low_p,high_p;
  low_p = *(upper_bound(p.begin(), p.end(), X));
  high_p = *(lower_bound(p.begin(), p.end(), X));
  cout << low_p <<","<<  high_p << endl;
*/
  int d=0,ans;
  while(true){
    if(!binary_search(p.begin(), p.end(), X-d)){
      // pにX-dが入ってない
      // 複数該当時に最小値を答えるためこちらが先
      ans = X-d;
      break;
    }
    if(!binary_search(p.begin(), p.end(), X+d)){
      // pにX+dが入ってない
      ans = X+d;
      break;
    }
    // pにX+dもX-dもどちらも存在
    d++;
  }

  cout << ans << endl;
}

/*
X<=100;N<=100なので変にBoundにぶたんするより
ゴリ押し全探索が最適そう
*/



Measured memory_bytes: 3616
using System;

class MyClass
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');

        if (str.Length == 3)
        {
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            int c = int.Parse(str[2]);
            if (a < b && b < c)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}

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

using namespace std;

const int N = 2e5+5;

const int mod = 1e9+7;

long long inv[N];
long long fac[N];
long long finv[N];

void cominit(){
    fac[0] = fac[1] =1;
    finv[0] = finv[1] =1;
    inv[1] = 1;
    for(int i = 2; i < N; 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 nCr(long long n , long long r){
    if(n < r)
        return 0;
    if(n < 0 || r < 0)
        return 0;
    return fac[n] * (finv[r] * finv[n - r] % mod) %mod;
}

long long get(int a , int b , int c , int d){
    int steps = c - a + d - b;
    //cout << steps << " " << c - a << "\n";
    return nCr(steps , c - a);
}

int n , m , a , b;

int main(){
    cominit();
    scanf("%d%d%d%d" , &n , &m , &a , &b);


    int row = n - a;
    long long ways = 0;
    for(int col = b + 1; col <= m; col++){
        ways += 1LL * get(1 , 1 , row , col) * get(row + 1 , col , n , m);
        //cout << get(1 , 1 , row , col) * get(row + 1 , col , n , m) << endl;
        ways %= mod;
    }
    printf("%lld\n" , ways);
    return 0;
}


Measured memory_bytes: 8392
n = int(input())
a, b = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
x= 0
y = 0
z = 0
for p in P:
    if p <= a:
        x += 1
    if a+1 <= p <= b:
        y += 1
    elif b+1 <= p:
        z += 1
res = min(x, y, z)
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define one_peace ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int main()
{
    one_peace;
 string a,b,c="";
 int h;
 cin>>h>>a>>b;
 for(int i=0;i<h;i++){
c.push_back(a[i]);
c.push_back(b[i]);
 }
 cout<<c;
    return 0;
}


Measured memory_bytes: 256