akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<utility>
using namespace std;

int judge(pair<double, double> p1, pair<double, double> p2){
	double S = p1.first*p2.second - p2.first*p1.second;
	if (0 < S) return 1;
	if (0 > S) return -1;
	if (0 == S) return 0;
}

int main(){
	pair<double, double> A, B, C, P;

	while (cin >> A.first >> A.second >> B.first >> B.second >> C.first >> C.second >> P.first >> P.second){
		pair<double, double> AB, BC, CA, AP, BP, CP;
		AB = { B.first - A.first, B.second - A.second };
		BC = { C.first - B.first, C.second - B.second };
		CA = { A.first - C.first, A.second - C.second };
		AP = { P.first - A.first, P.second - A.second };
		BP = { P.first - B.first, P.second - B.second };
		CP = { P.first - C.first, P.second - C.second };
		
		if (judge(AP, AB) == judge(BP, BC) && judge(BP, BC) == judge(CP, CA) && judge(CP, CA) == judge(AP, AB)){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3048
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{

    

    class Program
    {

        static int N;
        static int A;
        static int B;
        static int C;
        static int[] data;
        static int INF = (int)Math.Pow(10, 9);
        static int[] bmp;

        static int Solve(int current, int a, int b, int c)
        {

            if(current == N)
            {
                List<int> tmp = new List<int>();

                tmp.Add(a);
                tmp.Add(b);
                tmp.Add(c);

                tmp.Sort();

                if(tmp.First() > 0)
                {
                    return Math.Abs(A - a) + Math.Abs(B - b) + Math.Abs(C - c) - 30;
                }
                else
                {
                    return INF;
                }

            }

            List<int> list = new List<int>();

            list.Add(Solve(current + 1, a, b, c));
            list.Add(Solve(current + 1, a + bmp[current], b, c) + 10);
            list.Add(Solve(current + 1, a, b + bmp[current], c) + 10);
            list.Add(Solve(current + 1, a, b, c + bmp[current]) + 10);

            list.Sort();

            return list.First();
            
        }

        

        static void Main(string[] args)
        {
            data = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            N = data[0];
            A = data[1];
            B = data[2];
            C = data[3];

            bmp = new int[N];

            for(int i = 0; i < N; i++)
            {
                bmp[i] = int.Parse(Console.ReadLine());
            }
            
            Console.WriteLine(Solve(0, 0, 0, 0));

        }
    }
}


Measured memory_bytes: 17488
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;i++)
#define FORD(i,a,b) for (int i=a;i>=b;i--)
using namespace std;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int ts,s,now,tmp[66666];
vector<int> stk[2];
char a[66666];
bool f[66666],g[66666];
int n,x,y;
int main(){
	scanf("%s",a+1);
	n=strlen(a+1);
	cin>>x>>y;
	x+=8000,y+=8000;
	now=0;
	FOR(i,1,n)
		if (a[i]=='F') ++s;
		else{
			stk[now].pb(s);
			s=0;
			now^=1;
		}
	if (s) stk[now].pb(s);
	for (int i=0;i<stk[0].size();++i) tmp[++ts]=stk[0][i];
	f[8000+tmp[1]]=1;
	FOR(i,2,ts){
		FOR(j,0,16000) g[j]=0;
		FOR(j,0,16000)
			if (f[j]) g[j+tmp[i]]=g[j-tmp[i]]=1;
		FOR(j,0,16000)
			f[j]=g[j];
	}
	if (!f[x]) return puts("No"),0;
	
	ts=0;
	for (int i=0;i<stk[1].size();++i) tmp[++ts]=stk[1][i];
	memset(f,0,sizeof(f));
	f[8000]=1;
	FOR(i,1,ts){
		FOR(j,0,16000) g[j]=0;
		FOR(j,0,16000)
			if (f[j]) g[j+tmp[i]]=g[j-tmp[i]]=1;
		FOR(j,0,16000)
			f[j]=g[j];
	}
	if (!f[y]) return puts("No"),0;
	puts("Yes");
	return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>

using std::max;
using std::min;

const int MAXN=1e5+5;
char s[MAXN];

int main(){
	scanf("%s",s+1);
	int n=strlen(s+1),ans=n;
	for(int i=1;i<n;++i){
		if(s[i]!=s[i+1])
			ans=min(ans,max(i,n-i));
	}
	printf("%d",ans);
	return 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;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 998244353;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

ll kai[2000001];
ll mokai[2000001];

ll mod_pow (ll x, ll y) {
    ll ret = 1;
    while (y) {
        if (y&1) ret = ret*x%MOD;
        x = x*x%MOD;
        y /= 2;
    }
    return ret;
}

void init (int _n) {
    kai[0] = 1;
    for (int i = 1; i <= _n; i++) kai[i] = kai[i-1]*i%MOD;
    for (int i = 0; i <= _n; i++) mokai[i] = mod_pow(kai[i],MOD-2);
}

ll conb (ll x, ll y) {
    ll z = x-y;
    ll ret = kai[x]*mokai[y]%MOD;
    ret = ret*mokai[z]%MOD;
    return ret;
}

ll n, m;

int main() {
    init(2000000);
    cin >> n >> m;
    ll ans = 0;
    for (int i = m%2; i <= min(n,m); i += 2) {
        ll M = m + (m-i)/2;
        ans = (ans + conb(n-1+M, n-1) * conb(n, i)) % MOD;
    }
    ans = (ans - n * (conb(n-1+m-1, n-1)+MOD) + MOD*MOD) % MOD;
    cout << ans << endl;
}


Measured memory_bytes: 31616
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
  int N;
  cin >> N;
  int d[110];
  rep(i, N) {
    cin >> d[i];
  }
  int num[110] = {0};
  rep(i, N) {
    num[d[i]]++;
  }
  int ans = 0;
  rep(i, 110) {
    if(num[i] > 0) {
      ans++;
    }
  }
  cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
const int inf = 0x3f3f3f3f;
char buf[(1 << 22)], *p1 = buf, *p2 = buf;
#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
inline int read() {
    char c = getchar(); int x = 0;
    for (;not isdigit(c); c = getchar());
    for (;isdigit(c); x = x * 10 + c - '0', c = getchar());
    return x;
}

int main () {
    int T;
    // T = read();/
    T = 1;
    while (T--) {
        int n; bool flag = 0;
        n = read();
        int Min = inf, Max = 0;
        int sizMi = 0, sizMa = 0;
        for (int i = 1, tmp; i <= n; i += 1) {
            tmp = read();
            Min = tmp < Min ? sizMi = 0, tmp : Min;
            Max = tmp > Max ? sizMa = 0, tmp : Max;
            sizMi += tmp == Min ? 1 : 0, sizMa += tmp == Max ? 1 : 0;
        }
        if (Min == Max and Min == n - 1) {
        	printf("Yes\n");
        	continue;
        }
        if (Min == Max) sizMi = 0;
        int ZhiShao = sizMi + 1;
        int ZhiDuo = sizMa / 2 + sizMi;
        if (Max < ZhiShao or Max > ZhiDuo) flag = true;
        if (Min < Max - 1) flag = true;
        printf("%s\n", not flag ? "Yes" : "No");
    }
    return 0;
}

/*
analyse:
    If a_max > a_min + 1, it must be false;
    If a_i = a_j - 1, means Size_a_i = 1, Size_a_j > 1, Col_a_i not equal Col_a_j;
    If a_i = a_j, means Size_a_i = 1 and Size_a_j = 1 or Size_a_i > 1 and Size_a_j > 1;
    
    All in all, 
    Note the num of the a_min is A, the num of the a_max if B;
    If n - A < B, is must be false;
*/


Measured memory_bytes: 768
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	vector<vi> a(3,vi(3));
	for(auto &i:a)for(auto &j:i)cin>>j;
	int n;
	cin>>n;
	while(n--) {
		int val;
		cin>>val;
		for(auto &i:a)for(auto &j:i)if(j==val)j=-1;
	}
	bool ans = false;
	ans|=a[0][0]==a[1][1]&&a[1][1]==a[2][2]&&a[0][0]==-1;
	ans|=a[0][2]==a[1][1]&&a[1][1]==a[2][0]&&a[0][2]==-1;
	REP(i,0,2) {
		bool curr = true;
		REP(j,0,2) curr&=a[i][j]==-1;
		ans|=curr;
	}
	REP(i,0,2) {
		bool curr = true;
		REP(j,0,2) curr&=a[j][i]==-1;
		ans|=curr;
	}	
	cout<<(ans?"Yes":"No");	
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3656
<?php
  // 差が1以内のみ可能。
  // 差が0のときは oxoxoxとxoxoxo, 1のときはoxoxoのみ
  $nm = array_map("intVal", explode(" ", trim(fgets(STDIN))));
  $n = $nm[0];
  $m = $nm[1];
  $inf = pow(10, 9) + 7;
  if(abs($n - $m)>1){
    echo 0 . PHP_EOL;
  }elseif($n == $m){
    $x = 1;
    for($i=1; $i<=$n; $i++){
      $x = ($x * $i)%$inf;
    }
    echo (($x*$x)%$inf*2)%$inf . PHP_EOL;
  }else{
    $x = 1;
    $y = 1;
    for($i=1; $i<=max($n, $m); $i++){
      $x = ($x * $i)%$inf;
    }
    for($i=1; $i<=min($n, $m); $i++){
      $y = ($y * $i)%$inf;
    }
    echo ($x*$y)%$inf . PHP_EOL;
  }
?>

Measured memory_bytes: 4604
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <sstream>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{   
    int h,w;
    cin >> h >> w;
    int n = h*w;
    vector<int> s(n);
    int white_cnt = 0;
    rep(i,h)
    {
        string si;
        cin >> si;
        rep(j,w)
        {
            if(si.substr(j,1)==".")
            {
                white_cnt++;
                s[i*w+j] = 0;
            }
            else
                s[i*w+j] = 1;
        }
    }

    vector<int> dist(n,-1);
    queue<int> que;
    dist[0] = 0;
    que.push(0);
    int shift[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};

    while(!que.empty())
    {
        int v = que.front();
        que.pop();

        int x = v%w;
        int y = v/w;

        rep(i,4)
        {
            int nx = x + shift[i][0];
            int ny = y + shift[i][1];
            if(nx<0 || nx>=w) continue;
            if(ny<0 || ny>=h) continue;

            int nv = ny*w + nx;
            if(dist[nv] != -1) continue;
            if(s[nv] == 1) continue;

            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }

    if(dist[n-1] == -1)
        cout << -1 << endl;
    else
        cout << white_cnt-(dist[n-1]+1) << endl;
    return 0;
}

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



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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

int f(int n){
	if(n%2 == 0) return n/2;
	else return 3*n+1;
}

int main(void){

	int s; scanf("%d", &s);
	int array[100000] = {0};

	array[s] = 1;
	int i = 1;
	while(array[s] != 2){
		s = f(s);
		array[s]++;
		i++;
	}
	
	printf("%d\n",i);


	return 0;

}


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

using namespace std;

const int MAXN = 1e3 + 3;
const int MOD = 1e9 + 7;
int dp[MAXN][MAXN];
char mat[MAXN][MAXN];

int main () {
    int H,W;
    scanf("%d%d",&H,&W);
    for (int i=0;i<H;i++) {
        for (int j=0;j<W;j++) {
            scanf(" %c",&mat[i][j]);
        }
    }
    for (int i=1;i<H;i++) {
        if (mat[i][0]=='.') {
            dp[i][0]=1;
        }
        else {
            break;
        }
    }
    for (int i=1;i<W;i++) {
        if (mat[0][i]=='.') {
            dp[0][i]=1;
        }
        else {
            break;
        }
    }
    for (int i=1;i<H;i++) {
        for (int j=1;j<W;j++) {
            if (mat[i][j]=='.') {
                dp[i][j] = (dp[i-1][j]+dp[i][j-1])%MOD;
            }
        }
    }
    printf("%d",dp[H-1][W-1]);
    return 0;
}


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

int main(){
	int L, A, B, C, D, a, b, c, d;
	scanf("%d\n", &L);
	scanf("%d\n", &A);
	scanf("%d\n", &B);
	scanf("%d\n", &C);
	scanf("%d", &D);
	a = A / C;
	if(A % C != 0){
		a = a + 1;
	}
	b = B / D;
	if(B % D != 0){
		b = b + 1;
	}
	c = fmax(a, b);
	d = L - c;
	printf("%d\n", d);
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793
const int INF = 100000000;
int dx[] = {0,1,-1,0,1,-1,1,-1};
int dy[] = {1,0,0,-1,1,-1,-1,1};

typedef tuple<int, int, int, int> T;

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    vector<T> v;
    for(int i = 1; i <= m; i++){
        int p, y, x = 0;
        scanf("%d%d", &p, &y);
        v.emplace_back(p, y, x, i);
    }
    sort(v.begin(), v.end());
    int tmp = 0;
    int num = 1;
    for(auto &t: v){
        if(get<0>(t) != tmp){
            tmp = get<0>(t);
            num = 1;
            get<2>(t) = num;
            num++;
        }else{
            get<2>(t) = num;
            num++;
        }
    }
    sort(v.begin(), v.end(),
            [](T const &iLhs, T const &iRhs){
                return get<3>(iLhs) < get<3>(iRhs);
            }
    );
    for(auto t: v)
        printf("%06d%06d\n", get<0>(t), get<2>(t));
}


Measured memory_bytes: 3184
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

long long a,b,k;

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

cin >> a >> b >> k;

long long q = k;
k-=a;
if (k>0)
	if (k>b)
		cout << 0 << " "<< 0;
	else
		cout << 0 << " "<< b-k;
else
	cout << a-q << " " << b;




return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int,int> P;
int main()
{
  ll N;
  cin >> N;
  ll sum=0;
  rep(i,N+1){
    if(i%3!=0&&i%5!=0){
      sum += i;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3596
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,f,n,sum;
	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		n=1000-n;
		a=n/500;
		n=n%500;
		b=n/100;
		n=n%100;
		c=n/50;
		n=n%50;
		d=n/10;
		n=n%10;
		e=n/5;
		n=n%5;
		f=n/1;
		a=a+b+c+d+e+f;
		printf("%d\n",a);
	}
	return 0;
}


Measured memory_bytes: 1992
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>


int main()
{
	int x, n;
	std::cin >> x >> n;
	std::vector<int> P;
	for (int i = 0; i < n; i++)
	{
		int p;
		std::cin >> p;
		P.push_back(p);
	}
	int dist = 100;
	int ans = 0;
	for (int i = 102; i > -2; i--)
	{
		if ((std::find(P.begin(), P.end(), i) == P.end()) && (std::abs(x - i) <= dist))
		{
			dist = std::abs(x - i);
			ans = i;
		}
	}
	std::cout << ans << '\n';
	
}

Measured memory_bytes: 3620
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int solve()
{
    double N;

    std::cin >> N;

    double X = N / 1.08;

    double low = floor(X);
    double high = ceil(X);

    if (floor(low * 1.08) == N)
        cout << low << endl;
    else if (floor(high * 1.08) == N)
        cout << high << endl;
    else
        cout << ":(" << endl;

    return 0;
}

int main()
{
    solve();

    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

from collections import defaultdict as dd
n,m=[int(i) for i in input().split()]
brkn = dd(int)
mod = 10**9+7
for i in range(m):
    num = int(input())
    brkn[num]+=1
dp = [-1]*(n+1)

def func(curr):
    if(curr==0):
        dp[0]=1
        return dp[0]
    if(curr>0 and (curr in brkn)):
        dp[curr]=0
        return dp[curr]%mod
    if(curr==1):
        dp[1]=1
        return dp[1]
    if(dp[curr]!=-1):
        return dp[curr]%mod
    else:
        dp[curr] =  (func(curr-1) + func(curr-2))%mod
        return dp[curr]%mod

print(func(n))
        


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

int main(){
  int n, m, x;
  cin >> n >> m >> x;

  int  a[m];

  int Tox = 0;
  int xToN = 0;
  for(int i = 0; i < m; i++){
    cin >> a[i];
    if(x > a[i]) Tox++;
    else xToN++;
  }

  if(Tox < xToN) cout << Tox << endl;
  else  cout << xToN << endl;

}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    int a[n],sum1 = 0;
    for(int i=0;i<n;i++)
    {
        scanf("%d", &a[i]);
        sum1+=a[i];
    }

    printf("%d\n",sum1-n);
    return 0;
}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import sys

def io_generator():
	while True:
		yield raw_input()

#+++++++++++++++++++

def main(io):
	n=int(io.next())
	ret=0
	for _ in range(n):
		x,u=io.next().split()
		rate= 1 if u=='JPY' else 380000.0
		ret+=rate*float(x)
		
	return ret

#++++++++++++++++++++

if __name__ == "__main__":
	io=io_generator()
	print main(io)

Measured memory_bytes: 2568
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

n, x = list(map(int, input().split()))
l = list(map(int, input().split()))

j = 1
jx = 0
for i in range(len(l)):
    jx += l[i]
    if jx > x:
        break
    j += 1

print(j)


Measured memory_bytes: 3316
package main

import (
	"fmt"
	"os"
)

func main() {
	var a int
	fmt.Scan(&a)
	if a > 81 {
		fmt.Println("No")
		os.Exit(0)
	} else {
		for i := 1; i < 10; i++ {
			if a%i == 0 && a/i < 10 {
				fmt.Println("Yes")
				os.Exit(0)
			}
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

inline int read(){
	long long s=0,w=1;
	char ch = getchar();
	while(ch < '0' || ch > '9'){
		if(ch == '-')w = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9'){
		s = s*10+ch-'0';
		ch = getchar();
	}
	return w*s;
}

int n;

int main(){
	cin >> n;
	int a;
	int ans = 0;
	for(int i = 1;i <= n;++i){
		a = read();
		ans ^= a;
	}
	if(ans){
		cout << "No";
	}else{
		cout << "Yes";
	}
	return 0;
}

Measured memory_bytes: 256
w = int(input())
n = int(input())
kuji = [i+1 for i in range(w)]
for _ in range(n):
    a, b = map(int, input().split(','))
    kuji[a-1], kuji[b-1] = kuji[b-1], kuji[a-1]
print(*kuji, sep="\n")


Measured memory_bytes: 5604
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while(sc.hasNext()){
			
			int a = sc.nextInt();
			String op = sc.next();
			int b = sc.nextInt();
			
			if(op.equals("+")){
				System.out.println(a + b);
			}else if(op.equals("-")){
				System.out.println(a - b);
			}else if(op.equals("*")){
				System.out.println(a * b);
			}else if(op.equals("/")){
				System.out.println(a / b);
			}else if(op.equals("?")){
				break;
			}
		}
	}
}

Measured memory_bytes: 26168
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, k = LI()
    ab = LIR(n)
    def f(k):
        res = 0
        for a, b in ab:
            if k & a == a:
                res += b
        return res
    ans = f(k)
    for i in range(31):
        i1 = (1 << i)
        if k & i1:
            K = (k | (i1 - 1)) ^ i1
            res = f(K)
            if ans < res:
                ans = res
    print(ans)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 58204
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <iomanip>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

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

	int N, K;
	cin >> N >> K;

	//for (int i = 1; i <= N; i++) {
	//	for (int j = 1; j <= N; j++) {
	//		
	//		cerr << setw(2) << i%j << " ";

	//	}
	//	cerr << "\n";
	//}

	vector<int> rem(N);
	lint ans = !K;
	for (int i = 1; i < N; i++) {
		if (K <= i) ans += N / (i + 1) * (i - K + 1) + max(N % (i + 1) - K + 1, 0);
	}

	cout << ans << "\n";

	return 0;
}

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

template<class T>
struct Edge{
	int from,to;
	T cost;
	Edge(int to,T cost) : to(to),cost(cost){}
	Edge(int from,int to,T cost) : from(from),to(to),cost(cost){}
	operator int() const noexcept { return to; }
};

template<class T>
using WeightedGraph = vector<vector<Edge<T>>>;
using Graph = vector<vector<int>>;
template<class T>
using Matrix = vector<vector<T>>;

template<class T = int>
vector<T> BFS(const Graph &G,int source = 0){
	vector<T> dist(G.size(),-1);
	queue<int> que;
	dist[source] = 0;
	que.push(source);
	for(T d = 0;;d++){
		int siz = que.size();
		if(siz == 0) break;
		for(int i = 0;i < siz;i++){
			int v = que.front();que.pop();
			for(int to : G[v]){
				if(dist[to] == -1){
					dist[to] = d + 1;
					que.push(to);
				}
			}
		}
	}
	return dist;
}

signed main(){
	const int INF = 1e+9;
	int n,m;
	cin >> n >> m;
	Graph G(n * 2);
	for(int i = 0;i < m;i++){
		int a,b;
		cin >> a >> b; a--;b--;
		G[a].emplace_back(b + n);
		G[b].emplace_back(a + n);
		G[a + n].emplace_back(b);
		G[b + n].emplace_back(a);
	}
	auto dist = BFS(G);
	int ans = 0;
	for(int i = 0;i < n;i++){
		if(dist[i] == -1 || dist[i + n] == -1) ans = INF;
		else ans = max(ans,max(dist[i],dist[i + n]) - 1);
	}
	if(ans == INF) cout << -1 << endl;
	else cout << ans << endl;
}


Measured memory_bytes: 15644
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll H,W; cin >> H >> W;
    vector <string> X(H);
    loop(i,0,H) cin >> X[i];
    vector < vector <int> > dp(H, vector<int>(W)); 
    for (int i=0; i<H; ++i) {
        for (int j=0; j<W; ++j)
        {
            if (i==0 && j==0) {
                dp[i][j]=((X[i][j]=='#') ? 1 : 0);
            }
            else {
                if (i>0 && j>0) {
                    ll t1, t2;
                    if (X[i-1][j]=='#' || X[i][j]!='#') t1=dp[i-1][j];
                    else if (X[i][j]=='#') t1=dp[i-1][j]+1;
                    if (X[i][j-1]=='#' || X[i][j]!='#') t2=dp[i][j-1];
                    else if (X[i][j]=='#') t2=dp[i][j-1]+1; 
                    dp[i][j]=min(t1,t2);
                } 
                else if (i>0) {
                    if (X[i-1][j]=='#' || X[i][j]!='#') dp[i][j]=dp[i-1][j];
                    else if (X[i][j]=='#') dp[i][j]=dp[i-1][j] + 1;
                }
                else if (j>0) {
                    if (X[i][j-1]=='#' || X[i][j]!='#') dp[i][j]=dp[i][j-1];
                    else if (X[i][j]=='#') dp[i][j]=dp[i][j-1] +  1;
                }
            }
            // cout << i << " " << j << " " << dp[i][j] << "\n";
        }
    }
    cout << dp[H-1][W-1] << "\n";
    return 0;
}

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v.at(i); 
    }

    cout << count_if(v.begin(), v.end(), [&k](int x){return x >= k;}) << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<map>
#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 n;
    cin >> n;
    map<string,int> mp;
    rep(i,n){
        string s;
        cin >> s;
        mp[s]++;
    }
    int mx = 0;
    for(auto p: mp) mx = max(mx, p.second);
    for(auto p: mp){
        if(p.second != mx) continue;
        cout << p.first << endl;
    }
    return 0;
}

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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    string S;
    cin >> S;

    rep(i,0,int(S.size())-1) if(S[i]=='A' and S[i+1]=='C'){
        cout << "Yes" << endl;
        return;
    }

    cout << "No" << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W, &H, &x, &y, &r);
    
    if(x-r<0 || x+r>W || y-r<0 || y+r>H){
        printf("No\n");
    }else{
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 2108
int main()
{
	int A, B, X;
	int c, ans;

	scanf("%d%d%d", &A, &B, &X);
	if (A >= 2 * B){
	    ans = ((X - 1) / 500 + 1) * B;
	}
	else {
		ans = X / 1000 * A;
		c = X % 1000;
		if (c) {
			if (c <= 500 && B < A) ans += B;
			else ans += A;
		}
	}
	printf("%d\n", ans);
	
	return 0;
}



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

using namespace std;

#define LL long long
#define N 2200

const LL mod=1000000007;
LL n,m,ans,f[N][N],fac[N*N],ifac[N*N];

LL inv(LL x){return x==1?1:(mod-mod/x)*inv(mod%x)%mod;}

LL C(LL x,LL y){
	return fac[x]*ifac[y]%mod*ifac[x-y]%mod;
}

int main(){
	scanf("%lld%lld",&n,&m);
	fac[0]=1; for (LL i=1;i<=n*m;++i) fac[i]=fac[i-1]*i%mod;
	ifac[n*m]=inv(fac[n*m]); for (LL i=n*m-1;i>=0;--i) ifac[i]=ifac[i+1]*(i+1)%mod;
	if (m==1){puts("1"); return 0;}
	f[0][0]=1;
	for (LL i=1;i<=n;++i){
		f[i][0]=1;
		for (LL j=1;j<i;++j)
			f[i][j]=(f[i][j-1]*C(n-i+(n-j+1)*(m-1)-1,m-2)+f[i-1][j])%mod;
		f[i][i]=f[i][i-1]*C(n-i+(n-i+1)*(m-1)-1,m-2)%mod;
	}
	ans=f[n][n]*fac[n]%mod;
	printf("%lld\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 102656
#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>
#include <stdlib.h> 
#include <time.h>
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 drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };


int t, ans;
int cnt[1000006];
bool ipr[1000006];

void sieve(int n) {
	rep(i, t) {
		int tmp;
		cin >> tmp;
		ipr[tmp] = true;
		cnt[tmp]++;
	}
	if (cnt[1] == 1) {
		ans = 1;
		return;
	}
	else if (cnt[1] >= 2) {
		ans = 0;
		return;
	}
	ipr[0] = false;
	ipr[1] = false;
	REP(i, 2, n + 1) {
		if (ipr[i]) {
			ans++;
			for (int j = 2 * i; j <= n; j += i) {
				ipr[j] = false;
			}
		}
	}

	rep(i, 1000001) {
		if (ipr[i]) {
			if (cnt[i] >= 2)ans--;
		}
	}

	return;

}

int main() {

	cin >> t;
	sieve(1000000);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 8512
N=int(input())
S=[input() for i in range(N)]
count=0
countA=0
countB=0
countB_A=0
for s in S:
    countA+=s[0]=="B"
    countB+=s[-1]=="A"
    countB_A+=s[0]=="B" and s[-1]=="A"
    for i in range(len(s)-1):
        count+=s[i]+s[i+1]=="AB"
if countA==countB==countB_A and countB_A:
    count-=1
print(count+min(countA,countB))


Measured memory_bytes: 45272
import java.io.*;
import java.util.*;
public class Main{
   public static void main(String[] args) throws IOException{
       
       ArrayList<String> arr=new ArrayList<>();
       
       BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
       int idx=Integer.parseInt(bf.readLine());
       
       for(int i=0;i<idx;i++){
           arr.add(bf.readLine());
       }
       
       for(int i=1;i<14;i++){
           if(arr.contains("S "+i)==false)
               System.out.println("S "+i);
       }
       
       for(int i=1;i<14;i++){
           if(arr.contains("H "+i)==false)
               System.out.println("H "+i);
       }
       
       for(int i=1;i<14;i++){
           if(arr.contains("C "+i)==false)
               System.out.println("C "+i);
       }
       
       for(int i=1;i<14;i++){
           if(arr.contains("D "+i)==false)
               System.out.println("D "+i);
       }
   } 
}

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

int main() {
  int L, R, d;
  cin >> L >> R >> d;
  
  int a = 0;
  for (int i = 0; i < R - L + 1; i++) {
    if ((L + i) % d == 0) {
      a++;
    }
  }
  
  cout << a << endl;
}

Measured memory_bytes: 3592
import sys
sys.setrecursionlimit(10 ** 7)

from bisect import bisect_left

n = int(input())
a = list(map(int, input().split()))
uv = [list(map(int, input().split())) for _ in range(n - 1)]

INF = 10 ** 10

adj = [[] for _ in range(n)]
for u, v in uv:
    u -= 1
    v -= 1
    adj[u].append(v)
    adj[v].append(u)

arrived = [False] * n
arrived[0] = True

ans = [None] * n
ans[0] = 1

dp = [INF] * n
dp[0] = a[0]


def dfs(u):
    for v in adj[u]:
        if not arrived[v]:
            arrived[v] = True
            idx = bisect_left(dp, a[v])
            tmp = dp[idx]
            dp[idx] = a[v]
            ans[v] = bisect_left(dp, INF)
            dfs(v)
            dp[idx] = tmp


dfs(0)
print(*ans, sep="\n")


Measured memory_bytes: 262684
#include <iostream>
#include <stack>
#include <cstdlib>
#include <cstdio>
using namespace std;

int main(){
	char buf[256];
	stack<int> st;
	while( cin>>buf ){
		if( buf[0] == '+' ){
			int a = st.top();
			//printf( "pop %d\n",a );
			st.pop();
			int b = st.top();
			//printf( "pop %d\n",b );
			st.pop(); 
			//printf( "push %d\n",a + b );
			st.push( a + b );
		}else if( buf[0] == '-' ){
			int a = st.top();
			//printf( "pop %d\n",a );
			st.pop();
			int b = st.top();
			//printf( "pop %d\n",b );
			st.pop();
			//printf( "push %d\n",a - b );
			st.push( b - a );
		}else if( buf[0] == '*' ){
			int a = st.top();
			//printf( "pop %d\n",a );
			st.pop();
			int b = st.top();
			//printf( "pop %d\n",b );
			st.pop(); 
			//printf( "push %d\n",a * b );
			st.push( a * b );
		}else{
			int a = atoi( buf );
			//printf( "push %d\n",a );
			st.push( a );
		}
	}
	cout << st.top() << endl;
	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = n-1; i > 0; --i)
#define PB push_back
#define MP make_pair

const int MAX = 1e5+10;

int N;
int A[MAX], B[MAX];
vii C;
bool used[MAX];

int main() {
    cin >> N;
    ll sumA = 0, sumB = 0;
    REP (i, N) {
        int a, b;
        cin >> a >> b;
        A[i] = a; B[i] = b;
        C.PB(MP(a,i)); C.PB(MP(b,i));
        sumA += a; sumB += b;
    }
    sort(C.begin(), C.end());

    bool check = false;
    ll sum_ = 0;
    REP (n, N) {
        int i = C[n].second, c = C[n].first;
        check |= used[i];
        used[i] = true;
        sum_ += c;
    }

    ll ans = min(sumA, sumB);
    if (check) {
        ans = min(ans, sum_);
    } else {
        REP (i, N) {
            ll res = sum_ + max(A[i], B[i]);
            REPR (j, N) if (C[j].second != i) {
                res -= C[j].first;
                break;
            }
            ans = min(ans, res);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3956
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;
using ll = long long;
template<typename T> void print(T t) {cout << t << endl;}

int main() {
	string S; 
	cin >> S;
	ll ans = 0, prev=0;
	vector<ll> v(S.size());
	for (size_t i = 0; i < S.size(); i++) {
		if (S[i] == 'B') v[i] = ++prev;
		else ans += prev;
	}
	print(ans);
}

Measured memory_bytes: 5224
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;
int n, m, s;
const int mod = 1e5;
ll dp[2][2001][3001];

int main(int argc, char const* argv[])
{
	while(true){
			scanf("%d %d %d", &n, &m, &s);
			if(n == 0)break;
			int target = s - n * n * (n * n + 1) / 2;
			int sup = m - n * n;
			for(int i = 0; i < 2; i++){
					for(int j = 0; j <= sup; j++){
							for(int k = 0; k <= target; k++){
									if(j == 0 && k == 0)dp[i][j][k] = 1;
									else dp[i][j][k] = 0;
							}
					}
			}
			dp[0][0][0] = 1;
			for(int i = 0; i < n * n; i++){
					for(int j = 1; j <= sup; j++){
							for(int k = 1; k <= target; k++){
									dp[(i+1) & 1][j][k] = dp[i & 1][j][k];
									if(k - (n * n - i) >= 0)dp[(i+1) & 1][j][k] += dp[(i+1) & 1][j-1][k-(n * n - i)];
									dp[(i+1) & 1][j][k] %= mod;
							}
					}
			}
			int res = 0;
			for(int i = 0; i <= sup; i++)res = (res + dp[(n*n) & 1][i][target]) % mod;
			cout << res << endl;
	}
	return 0;
}



Measured memory_bytes: 72808
MOD = 10**9+7
n,k = map(int,input().split())

ans = 0

def culc(a):
    smallest = a * (a-1) //2
    largest = smallest + a * (n-a+1)
    return largest - smallest + 1

for a in range(k,n+2):
    ans += culc(a)
    ans %= MOD

print(ans)

Measured memory_bytes: 9200
package main

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

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
        sc.Scan()
        return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
        buf := make([]byte, 0, 1000000)
        for {
                l, p, e := rdr.ReadLine()
                if e != nil {
                        panic(e)
                }
                buf = append(buf, l...)
                if !p {
                        break
                }
        }
        return string(buf)
}

func strSprit(str string) []string {
        cols := strings.Split(str, " ")
        return cols
}

func parseInt(str string) int {
        n, _ := strconv.Atoi(str)
        return n
}

func intSprit(str string) []int {
        strs := strSprit(str)
        cols := make([]int, len(strs))
        for i, v := range strs {
                cols[i] = parseInt(v)
        }
        return cols
}

type SortSlice []int

func (s SortSlice) Len() int {
        return len(s)
}

func (s SortSlice) Swap(i, j int) {
        s[i], s[j] = s[j], s[i]
}

func (s SortSlice) Less(i, j int) bool {
        return s[i] < s[j]
}

func reverseString(str string) string {
        buf := []rune(str)
        for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 {
                buf[i], buf[j] = buf[j], buf[i]
        }
        return string(buf)
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////

func main() {
        line := readBigLine()
        N := parseInt(line)

        str := readBigLine()

        wests := make([]int, N+1)
        easts := make([]int, N+1)

        wcount := 0
        ecount := 0
        for i, s := range str {
                if string(s) == "W" {
                        wests[i+1] = wests[i] + 1
                        easts[i+1] = easts[i]
                        wcount++
                } else {
                        wests[i+1] = wests[i]
                        easts[i+1] = easts[i] + 1
                        ecount++
                }
        }

        min := N
        for i := 1; i <= N; i++ {
                tcount := 0
                tcount += wests[i-1]
                tcount += ecount - easts[i]
                if min > tcount {
                        min = tcount
                }
        }

        fmt.Println(min)
}



Measured memory_bytes: 7552
#include<iostream>
#include<algorithm>
#include<map>
#include<string>
#include<vector>
#include<cmath>
using namespace std;

typedef pair<double, string> P;

double exp(int j, double a, double b){
    switch(j){
    case 0:
	return a + b;
    case 1:
	return a - b;
    case 2:
	return b - a;
    case 3:
	return a * b;
    }
}

string comb(int j, string a, string b){
    switch(j){
    case 0:
	return "(" + a + "+" + b + ")";
    case 1:
	return "(" + a + "-" + b + ")";
    case 2:
	return "(" + b + "-" + a + ")";
    case 3:
	return "(" + a + "*" + b + ")";
    }
}

vector<P> solve(vector<double> x){
    vector<P> res;
    if(x.size() == 1){
	string r = "";r += '0' + x[0];
	res.push_back(P(x[0], r));
	return res;    
    }
    for(int i = 0;i < x.size() - 1;i++){
	vector<P> a = solve(vector<double>(x.begin(), x.begin() + i + 1));
	vector<P> b = solve(vector<double>(x.begin() + i + 1, x.end()));

	for(int i = 0;i < a.size();i++){
	    for(int j = 0;j < b.size();j++){
		for(int k = 0;k < 4;k++){
		    double td = exp(k, a[i].first, b[j].first);
		    string rem = comb(k, a[i].second, b[j].second);
		    res.push_back(P(td, rem));
		}
	    }
	}
    }
}

int main(){
    vector<double> x(4);
    while(cin >> x[0] >> x[1] >> x[2] >> x[3]){
	if(x[0] == 0)return 0;
	vector<P> ans;
	sort(x.begin(), x.end());
	do{
	    vector<P> tmp = solve(x);
	    ans.insert(ans.end(), tmp.begin(), tmp.end());
	}while(next_permutation(x.begin(), x.end()));
	string res = "0";
	for(int i = 0;i < ans.size();i++){
	    if(fabs(ans[i].first - 10) < 1e-10){
		res = ans[i].second;break;
	    }
	}
	cout << res << endl;
    }
}

Measured memory_bytes: 1744
#include <cstdio>
#include<iostream>
#include<string>
#include<utility>
#include<stack>

using namespace std;

int main(void){

	string inp;
	stack<pair<int,int> > now;
	int iland[14][14];
	int cnt;
	int x,y;
	int dx[]={ 0, 0, 1,-1};
	int dy[]={ 1,-1, 0, 0};

	while(cin>>inp){
		cnt=0;
		for(int i=0;i<12;i++){
			iland[1][i+1]=inp[i]-'0';
		}
		for(int i=2;i<13;i++){
			cin>>inp;
			for(int j=0;j<12;j++){
				iland[i][j+1]=inp[j]-'0';
			}
		}
		for(int i=0;i<14;i++){
			iland[0][i]=0;
			iland[i][0]=0;
			iland[13][i]=0;
			iland[i][13]=0;
		}
		for(int i=1;i<13;i++){
			for(int j=1;j<13;j++){
				if(iland[i][j]==1){
					cnt++;
					now.push(pair<int,int>(i,j));
					while(!now.empty()){
						x=now.top().second,y=now.top().first;
						now.pop();
						iland[y][x]=0;
						for(int k=0;k<4;k++){
							if(iland[y+dy[k]][x+dx[k]]==1){
								now.push(pair<int,int>(y+dy[k],x+dx[k]));
							}
						}
					}
				}
			}
		}
		cout<<cnt<<endl;
	}

    return 0;
}

Measured memory_bytes: 1188
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n).map(|_| iterator.next().unwrap().parse().unwrap()).collect();

    if a.contains(&0) {
        return "0".to_string();
    }

    let mut ans: usize = 1;
    for i in 0..n {
        let ai: usize = a[i];
        if ans > 1_000_000_000_000_000_000 / ai {
            return "-1".to_string();
        }
        ans *= ai;
    }

    return ans.to_string();
}


Measured memory_bytes: 4672
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<double, int>pii;
struct _IO { _IO() { ios::sync_with_stdio(0); cin.tie(0); } }_io;
using namespace std;
double d[1010];
int n, vis[1010];
struct node {
	int x, y;
	double r;
}N[1010];
double dis(int u, int v) {
	return hypot(N[u].x - N[v].x, N[u].y - N[v].y);
}
void bfs() {
	for (int i = 1; i <= n; i++) d[i] = 1e12;
	queue<pii>q;
	q.push({ 0,0 });
	while (!q.empty()) {
		auto now = q.front();
		q.pop();
		int u = now.se;
		vis[u] = 0;
		double c = -now.fi;
		for (int i = 1; i <= n; i++) {
			double k = max(dis(u, i) - (N[u].r + N[i].r), 0.0);
			if (d[u] + k < d[i]) {
				d[i] = d[u] + k;
				if (!vis[i]) {
					vis[i] = 1;
					q.push({ -d[i],i });
				}
			}
		}
	}
}
int main() {
	pii st, ed;
	cin >> st.fi >> st.se;
	cin >> ed.fi >> ed.se;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> N[i].x >> N[i].y >> N[i].r;
	}
	n++;
	N[0] = { (int)st.fi,st.se,0 };
	N[n] = { (int)ed.first,ed.se,0 };
	bfs();
	cout << fixed << setprecision(9) << d[n] << '\n';
}


Measured memory_bytes: 3820
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
const int maxx = 110;
const LL inf = (1LL << 32);


LL A[maxx][maxx];
int v,e;

void floyd(){
	for(int k=0;k<v;k++){
		for(int i=0;i<v;i++){
			if(A[i][k]==inf) continue;
			for(int j=0;j<v;j++){
				if(A[k][j]==inf) continue;
				A[i][j]=min(A[i][j],A[i][k]+A[k][j]);
			}
		}
	}
	
}

int main (){
	int x,y,z;
	cin>>v>>e;
	for(int i=0;i<maxx;i++){
		for(int j=0;j<maxx;j++)	
			A[i][j]= i==j?0:inf ;
	}
	while(e--){
		cin>>x>>y>>z;
		A[x][y]=z;
	}
	floyd();
	
	bool negative = false;
	for (int i = 0; i < v; i++)
		if (A[i][i] < 0)
			negative = true;

	if (negative)
		printf("NEGATIVE CYCLE\n");
	else {
		for (int i = 0; i < v; i++) {
			for (int j = 0; j < v; j++) {
				if (A[i][j] == inf)
					printf("INF");
				else
					printf("%lld", A[i][j]);
				printf("%c", j == v - 1 ? '\n' : ' ');
			}
		}
	}
	
	return 0;
}


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

using namespace std;

int main()
{
    #ifdef LOCAL_EXEC
    #else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #endif // LOCAL_EXEC
    long long int n,i,j,k,x=0,y;
    cin>>n;
    for(i=1;i<=n-1;i++){
        x+=(n-1)/i;
    }
    cout<<x;
    return 0;
}


Measured memory_bytes: 3628
N = int(input())
b = [N/1,N/2,N/3,N/4,N/5,N/6,N/7,N/8,N/9]
check = 0
for a in b:
    if float(a) == int(a) and a < 10 :
        check += 1
if check > 0:
    print("Yes")
else:
    print("No")

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

int main() {
	int n, arr [100],i;
	int maxi = 0 ,mini = 1000000000 ;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	for (int j = 0; j < n; j++) {
		if (arr[j] < mini)
		  mini = arr[j];
	}
	for (int l = 0; l < n; l++) {
		if (arr[l] > maxi)
		  maxi = arr[l];
	}
	cout << (maxi - mini);
	  
	return 0;
}

Measured memory_bytes: 256
N, M = [int(i) for i in input().split()]
Groups = [1 for i in range(N)]
dsts = [-1 for i in range(N)]
ABs = [[int(i)-1 for i in input().split()] for i in range(M)]
for A, B in ABs:
    dst = min(A, B)
    src = max(A, B)
    # print('A', A, B, dst, src)
    while(dsts[dst] != -1):
        dst = dsts[dst]
    while(dsts[src] != -1):
        src = dsts[src]
    if dst != min(A, B):
        omdst = min(A, B)
        while(dsts[omdst] != dst):
            n_omdst = dsts[omdst]
            dsts[omdst] = dst
            omdst = n_omdst
    if src != max(A, B):
        omsrc = max(A, B)
        while(dsts[omsrc] != src):
            n_omsrc = dsts[omsrc]
            dsts[omsrc] = src
            omsrc = n_omsrc

    if dst == src:
        continue
    dst2 = min(dst, src)
    src2 = max(dst, src)
    dsts[src2] = dst2
    Groups[dst2] += Groups[src2]
    Groups[src2] = 0
    # print(Groups)
    # print(dsts)
print(max(Groups))


Measured memory_bytes: 45452
import sys
sys.setrecursionlimit(sys.getrecursionlimit()*1000)
n = int(input())
g = [[] for _ in range(n+1)]
for _ in range(n-1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
a = []
def f(i, p):
    a.append(i)
    if i == n:
        return True
    for j in g[i]:
        if j != p:
            if f(j, i):
                return True
    a.pop()
f(1,0)
m = (len(a)+1) // 2
def h(i, j, p):
    if i == j:
        return 1
    return 1 + sum(h(k, j, i) for k in g[i] if k != p)
if h(1, a[m], 0) > h(n, a[m-1], 0):
    print("Fennec")
else:
    print("Snuke")


Measured memory_bytes: 147708