akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define loop(i,a,b) for(ll i=a; i<b; i++)
#define revloop(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back
#define vl vector<ll>
#define vvl vector<vl>
#define pl pair<ll,ll>
#define vpl vector<pl>
#define all(c) (c).begin(), (c).end()
#define sz(a) ll((a).size())
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i!=(c).end(); i++))
#define mp make_pair

int main()
{
   ll n;
   cin>>n;
   ll h[n+1], dp[n+1]={0};
   loop(i,1,n+1) cin>>h[i];
   dp[2]=abs(h[2]-h[1]);
   loop(i,3,n+1)
   {
   	ll a = dp[i-2] + abs(h[i]-h[i-2]);
   	ll b = dp[i-1] + abs(h[i]-h[i-1]);
   	dp[i] = min(a,b);
   }
   cout<<dp[n];
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vb = vector<bool>;
const int INF = 1e9;
const int MOD = 1e9+7;

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N; cin >> N;
    vl A(N+1); REPS(i, N) cin >> A[i];
    ll ans = 0;
    bool remind = false;
    REPS(i, N)
    {
        if(A[i] == 0)
        {
            remind = false;
            continue;
        }
        if(remind)
        {
            ans++;
            A[i]--;
            remind = false;
        }
        ans += A[i]/2;
        A[i] -= A[i]/2 * 2;
        if(A[i] % 2 == 1) remind = true;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <malloc.h>

using namespace std;

int main(void)
{
	cin.exceptions(ios::failbit);

	int k, n;

	cin >> n >> k;

	if (k > 1000 || n > 1000 || k < 1 || n < 1)
	{
		return 0;
	}
	int l;
	int i = 0;
	int* p = (int*)malloc(sizeof(int)* n);
	while (cin >> l)
	{
		p[i] = l;
		i++;

		if (i == n)
		{
			break;
		}
	}

	for (i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			if (p[i] > p[j])
			{
				int tmp = p[i];
				p[i] = p[j];
				p[j] = tmp;
			}
		}
	}

	int total = 0;
	for (i = 0; i < k; i++)
	{
		total += p[i];
	}

	cout << total << endl;

	free(p);

	return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    // train[i][j]:i~j間の電車の数
    vector<vector<int>> train(n, vector<int>(n, 0));
    for (int i = 0; i < m; i++) {
        int l, r;
        cin >> l >> r;
        train[l - 1][r - 1]++;
    }
    // s[i][j]:[0,i)×[0,j)の和
    vector<vector<int>> s(n + 1, vector<int>(n + 1));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            s[i + 1][j + 1] = s[i + 1][j] + s[i][j + 1] - s[i][j] + train[i][j];
        }
    }
    //クエリに答える
    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> x >> y;
        cout << s[y][y] - s[y][x - 1] - s[x - 1][y] + s[x - 1][x - 1] << endl;
    }
    return 0;
}

Measured memory_bytes: 2944
/*
[ ( ^ _ ^ ) ]
*/
// problem: atc/abc168_d
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000000


int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    vector<vector<int>> g(n+1);
    for(int i=0; i<m; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        g[x].push_back(y);
        g[y].push_back(x);
    }
    vector<int> par(n+1, -1);
    vector<bool> vis(n+1);
    queue<int> q;
    q.push(1);
    par[1] = 1;
    vis[1] = true;
    while(!q.empty()) {
        int v = q.front();
        q.pop();
        // cout << "v=" <<v<< endl;
        for(int u: g[v]) {
            if(!vis[u]) {
                // cout << "\tu="<< u << endl; 
                vis[u] = true;
                par[u] = v;
                q.push(u);
            }
        }
    }
    for(int i=1; i<=n; i++) {
        if(par[i]<=0) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    for(int i=2; i<=n; i++) {
        printf("%d\n", par[i]);
    }
}


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

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

using namespace std;

template <class T>
void printv(vector<T> v)
{
  cout << '[';
  for (auto vec: v)
  {
    cout << vec << ' ';
  }
  cout << ']' << endl;
}

int vector_finder(std::vector<char> vec, char number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main()
{
  int a;
  cin >> a;
  set<int> s;

  vector<string> v = {"", "3", "5", "7"};

  for (int i = 0; i < 4; i++)
  {
    for (int j = 0; j < 4; j++)
    {
      for (int k = 0; k < 4; k++)
      {
        for (int l = 0; l < 4; l++)
        {
          for (int m = 0; m < 4; m++)
          {
            for (int n = 0; n < 4; n++)
            {
              for (int o = 0; o < 4; o++)
              {
                for (int p = 0; p < 4; p++)
                {
                  for (int q = 0; q < 4; q++)
                  {
                    string str = v[i] + v[j] + v[k] + v[l] + v[m] + v[n] + v[o] + v[p] + v[q];
                    if (str.find("3") != std::string::npos && str.find("5") != std::string::npos && str.find("7") != std::string::npos)
                    {
                      int tmp = stoi(str);
                      if (tmp <= a)
                      {
                        s.insert(tmp);
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  cout << s.size() << endl;
}

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

/*long fact(int n) {
	int fac = 1;
	for (int i = 1; i <= n; i++) {
		fac *= i;
	}
	return fac;
}*/

/*long fact(int n) {
	if (n == 0) {
		return 1;
	}
	return (n * fact(n - 1)) % (;
}*/

int main() {
	int x;
	long long sum = 1;
	cin >> x;
	for (int i = 1; i <= x; i++) {
		sum *= i;
		sum %= (long long)(pow(10, 9) + 7);
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
# B - Can you solve this?
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for i in range(N):
    tmp = 0
    for j in range(M):
        tmp += A[i][j]*B[j]
    ans = ans+1 if tmp+C>0 else ans
print(ans)

Measured memory_bytes: 62248
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }

void main()
{
	auto N = RD;
	auto K = RD;
	auto p = RDA;
	
	auto a = new long[](N);
	foreach (i; 0..K)
		a[0] += p[i];

	foreach (i; 0..N-K)
	{
		a[i+1] = a[i] + p[i+K] - p[i];
	}

	auto pos = a.MIN_POS!"a > b"();
	double ans = 0.0;
	foreach (i; pos..pos+K)
	{
		ans += (p[i]+1.0) / 2.0;
	}

	writefln(FMT_F, ans);
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 10536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N, M; cin >> N >> M;
    int ans = 0;

    for(int i=1; i*i<=M; i++) if(M%i == 0){
        if(M/i >= N) ans = max(ans, i);
        if(i >= N) ans = max(ans, M/i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;

int MOD = 1000000007;

signed main(){
    int n,k;
    cin >> n >> k;
    int d[10];
    rep(i,k) cin >> d[i];
    rep(i,k) cerr << d[i] << endl;;

    for(int i = n;i < 10000000;i++){
        int c = 1;
        rep(j,k) if(i%10 == d[j]) c = 0;
        if(i >= 10){
            rep(j,k) if((i/10)%10 == d[j]) c = 0;
        }
        if(i >= 100){
            rep(j,k) if((i/100)%10 == d[j]) c = 0;
        }
        if(i >= 1000){
            rep(j,k) if((i/1000)%10 == d[j]) c = 0;
        }
        if(i >= 10000){
            rep(j,k) if((i/10000)%10 == d[j]) c = 0;
        }
        if(i >= 100000){
            rep(j,k) if((i/100000)%10 == d[j]) c = 0;
        }
        if(i >= 1000000){
            rep(j,k) if((i/1000000)%10 == d[j]) c = 0;
        }
        if(c == 1){
            cout << i << endl;
            return 0;
        }
    }

    
    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a, b;
	scanf("%d %d", &a, &b);
	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: 580
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
  ll N; cin >> N;
  string S; cin >> S;
  ll K; cin >> K;
  char target = S[K-1];
  for (ll j=0; j < S.length(); ++j) {
    cout << (S[j] == target ? target : '*');
  }
  cout << endl;
  return 0;
}


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

//typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;

int main(void) {
	int A, B, C;
	cin >> A >> B >> C;
	if (A + B >= C)cout << "Yes" << endl;
	else cout << "No" << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
ll N,K;
int main(){
    cin >> N >> K;
    if(N<K)cout << min(K-N,N) << endl;
    else if(N>K)cout << min(N%K, K-(N%K)) << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3516
import java.util.Scanner;

public class Main {
	char[] c;
	int id;

	int expression() {
		int res = term();
		while (c[id] == '+' || c[id] == '-') {
			if (c[id] == '+') {
				id++;
				res += term();
			} else {
				id++;
				res -= term();
			}
		}
		return res;
	}

	int term() {
		int res = fact();
		while (c[id] == '*' || c[id] == '/') {
			if (c[id] == '*') {
				id++;
				res *= fact();
			} else {
				id++;
				res /= fact();
			}
		}
		return res;
	}

	int fact() {
		int res = 0;
		if (c[id] == '(') {
			id++;
			res = expression();
			id++;
		} else if (c[id] == '+') {
			id++;
			res = fact();
		} else if (c[id] == '-') {
			id++;
			res = -fact();
		} else {
			res = number();
		}
		return res;
	}

	int number() {
		int res = 0;
		while ('0' <= c[id] && c[id] <= '9') {
			res *= 10;
			res += c[id] - '0';
			id++;
		}
		return res;
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		for (int T = sc.nextInt() - 1; 0 <= T; T--) {
			c = sc.next().toCharArray();
			id = 0;
			System.out.println(expression());
		}
	}

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

}

Measured memory_bytes: 17292
n = int(input())
x=[]
y=[]
for i in range(n):
        x0,y0=list(map(int, input().split()))
        x.append(x0)
        y.append(y0)

import itertools
import math
a=[i for i in range(n)]
com=[]
for v in itertools.permutations(a):
    com.append(v)
sum = 0
for v in com:
  #print("{}:".format(v))
  for i in range(n-1):
    #print(v[i],end="")
    sum+=math.sqrt( (x[ v[i+1] ]-x[ v[i] ])**2+ (y[ v[i+1] ]-y[ v[i] ])**2 )

print(sum/len(com))

Measured memory_bytes: 7984
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL);
vector<double> p(200005);
int main() {
	ios;
	int n,k,i,l,r;

	long double s=0,t=0;
	cin>>n>>k;
	for(i=0;i<n;i++)
	cin>>p[i];
	for(i=0;i<k;i++) s+=(p[i]+1)/2;
	t=s;
	// l=0,r=k-1;
	for(i=k;i<n;i++)
	{
		t=t+(p[i]+1)/2-(p[i-k]+1)/2;
		s=max(s,t);
	}
	cout << fixed << setprecision(6) << s;
}


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

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

const ll mod = 1000000007;

int main() {
    int n,m;
    cin >> n >> m;
    int s[n];
    rep(i,n) cin >> s[i];
    int t[m];
    rep(i,m) cin >> t[i];

    ll dp[n+1][m+1];
    rep(i,n+1) rep(j,m+1) dp[i][j] = 0;

    rep(i,n) {
      rep(j,m) {
        dp[i+1][j+1] = (mod+dp[i+1][j]+dp[i][j+1]-dp[i][j])%mod;
        if (s[i] == t[j]) {
          dp[i+1][j+1] = (dp[i+1][j+1] + dp[i][j] + 1)%mod;
        }
      }
    }
    cout << (dp[n][m]+1)%mod << endl;
    return 0;
}




Measured memory_bytes: 34824
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
const int iv=mod-mod/2;
struct statt{
	int dp[3];
	statt(int a,int b,int c){
		dp[0]=a,dp[1]=b,dp[2]=c;
	}
};
vector<statt>s[200050];
vector<int>E[200050];int rt[200050]={0},n;
inline ll kasumi(ll x,ll mi){
	ll res=1;
	while(mi){
		if(mi&1) res=res*x%mod;
		x=x*x%mod;mi>>=1;
	}
	return res;	
}
inline int merge(int x,int y){
	if(s[x].size()<s[y].size()) swap(x,y);
	int xsz=s[x].size()-1,ysz=s[y].size()-1;
	for(int i=0;i<=ysz;i++){
		int px=xsz-i,py=ysz-i;
		int t0,t1,t2;
		t0=1ll*s[x][px].dp[0]*s[y][py].dp[0]%mod;
		t1=(1ll*s[x][px].dp[1]*s[y][py].dp[0]%mod+1ll*s[x][px].dp[0]*s[y][py].dp[1]%mod)%mod;
		t2=(1LL*s[x][px].dp[1]*s[y][py].dp[1]%mod+(1LL*s[x][px].dp[0]+s[x][px].dp[1])%mod*s[y][py].dp[2]%mod+(1LL*s[y][py].dp[0]+s[y][py].dp[1])%mod*s[x][px].dp[2]%mod+1LL*s[x][px].dp[2]*s[y][py].dp[2]%mod)%mod;
		s[x][px].dp[0]=t0,s[x][px].dp[1]=t1,s[x][px].dp[2]=t2;
	}
	s[y].clear();
	return x;
}
inline int rd(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=0;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return f?x:-x;
}
inline int min(int a,int b){
	return a<b?a:b; 
}
inline int max(int a,int b){
	return a>b?a:b;
}
inline void dfs(int now){
	int dep=0;rt[now]=now;
	if(E[now].size()==0){
		s[rt[now]].push_back(statt(iv,iv,0));
		return;
	}
	int siz=E[now].size();
	for(int i=0;i<siz;i++){
		int y=E[now][i];
		dfs(y);dep=max(dep,min((int)s[rt[now]].size(),(int)s[rt[y]].size()));
		rt[now]=merge(rt[now],rt[y]);
	}
	int id=rt[now],sz=s[id].size()-1;
	for(int i=0;i<dep;i++){
		s[id][sz-i].dp[0]=(s[id][sz-i].dp[0]+s[id][sz-i].dp[2])%mod;
		s[id][sz-i].dp[2]=0;
	}
	s[id].push_back(statt(iv,iv,0));
}
int main(){
	n=rd();int u;
	for(int i=1;i<=n;i++){
		u=rd();
		E[u].push_back(i);
	}dfs(0);ll sum=0;
	for(int i=0;i<s[rt[0]].size();i++){
		sum=(sum+s[rt[0]][i].dp[1])%mod;
	}
	cout<<sum*kasumi(2,n+1)%mod;
	return 0;
}
/*
31
0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 2 15 6 12 10 12 16 5 3 20 1 25 20 23 24 23
*/

Measured memory_bytes: 35188
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  string s;
  cin>>s;
  rep(i,0,s.length()){
    if(s[i]=='1') s[i]='9';
    else if(s[i]=='9') s[i]='1';
  }
  cout<<s<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3600
import sys


def input():
    return sys.stdin.readline().strip()


N, K = map(int, input().split())
k_bitlen = K.bit_length()
dp = [[0] * N for _ in range(k_bitlen + 1)]
dp[0] = list(map(lambda x: int(x) - 1, input().split()))

for k in range(k_bitlen):
    for i in range(N):
        dp[k + 1][i] = dp[k][dp[k][i]]
pos = 0
for k in range(k_bitlen):
    if K >> k & 1:
        pos = dp[k][pos]
print(pos + 1)

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

public class ABC0124_A2 {
    private static void Main(string[] args) {
        var inputs = new List<string>() {
            Console.ReadLine().Trim(),
            Console.ReadLine().Trim()
        };

        ConvertInputs(inputs);
    }

    private static void ConvertInputs(List<string> inputs) {
        var texts = inputs[1].Split(' ').ToList();
        var numbers = ConvertListToInt(texts);

        Solve(numbers);
    }

    private static void Solve(List<int> numbers) {
        var count = 1;

        for (var eastIndex = 1; eastIndex < numbers.Count; eastIndex++) {
            if (CanViewOcean(numbers, eastIndex))
                count++;
        }

        OutputAnswer(count.ToString());
    }

    private static void OutputAnswer(string text) => Console.WriteLine(text);

    private static List<int> ConvertListToInt(List<string> texts) => texts.Select(x => int.Parse(x)).ToList();

    private static bool CanViewOcean(List<int> numbers, int eastIndex) {
        for (var westIndex = 0; westIndex < eastIndex; westIndex++) {
            if (numbers[eastIndex] < numbers[westIndex])
                return false;
        }

        return true;
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
void solve(long long a,long long b){
    if(a>b)swap(a,b);
    if(b-a<=1){
        cout<<(a-1)*2<<endl;
        return;
    }
    //c^2<abを満たす最大のcを探す
    long long c = sqrt(a*b);
    if(c*c==a*b)c--;
    long long d=c*2-1;
    if(c>=a)d--;
    if(c*(c+1)<a*b)d++;
    cout<<d<<endl;
    
}
int main(void){
    // Your code here!
    int n;cin>>n;
    for(int i=0;i<n;i++){
        long long a,b;cin>>a>>b;
        solve(a,b);
    }
}


Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef pair<int ,string> pis;
 
 
const int INF = 10000000;


int main(){
	string s;
	cin>>s;
	int ans = 0;
	for(int i = 0; i < s.size() / 2; i++){
		if(s[i] == '(' && s[s.size() - i - 1] != ')') ans++;
		else if(s[i] == ')' && s[s.size() - i - 1] != '(') ans++;
		else if((s[i] == 'i' || s[i] == 'w') && s[i] != s[s.size() - i - 1]) ans++;
	}
	//cout<<ans<<endl;
	if(s.size() % 2 == 1 && (s[s.size() / 2] == '(' || s[s.size() / 2] == ')')) ans++;

	cout<<ans<<endl;
}

Measured memory_bytes: 1184
n,d=list(map(int,input().split()))
x=[input().split() for i in range(n)]

result=[]
result_hikaku=[]
for j in range(n-1):
    for k in range(j+1,n):
        cnt=0
        for l in range(d):
            cnt +=(int(x[j][l])-int(x[k][l]))**2
        result.append((cnt)**(1/2))
        result_hikaku.append(round((cnt)**(1/2)))

count=0
for m in range(len(result)):
    if result[m]==result_hikaku[m]:
        count+=1
print(count)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = 100100100;
const double PI = 3.14159265358979323846;
typedef long long ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) for (ll i = 0; i < (n); ++i)

int main() {
  ll n, a, b;
  string winner;
  cin >> n >> a >> b;
  if ((b - a) % 2 == 0) {
    winner = "Alice";
  } else if ((b - a) % 2 == 1) {
    winner = "Borys";
  }

  cout << winner << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main()
{
    int a,b,n ; cin>>a>>b>>n ;
    int x=min(n,b-1) ;
    int p=(a*x)/b , q=a*(x/b) ;
    cout<<p-q<<endl ;
}


Measured memory_bytes: 3636
start = int(input())
# 検討している数字の範囲は10**5だが、見つけたい素数はその範囲を越えている可能性がある
# 10**5を越える最初の素数は100003で、rangeの特性上10**5+4とした
stop = 10**5 + 4

# if, elseは必ずしも同じforループ内で動かなくてもよい
# もし普通にif, elseを書くと、1つ処理を行ってfalseだとすぐelseになる
# でも今回は、1つの処理ではなく、まとまった処理を行った上で全てfalseの時を知りたいので、forの階層がずれる

for i in range(start, stop, 1):
    for j in range(2, round(i**0.5)+1, 1):
        if i % j == 0:
            break
    else:
        print(i)
        break

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  ll n, a, b;
  cin >> n >> a >> b;
  vector<ll> x(n);
  int i;
  rep(i,n) cin >> x[i];
  ll ans = 0;
  rep(i,n-1)
  {
    ans += min((x[i+1]-x[i])*a, b);
  }
  cout << ans << endl;
}



Measured memory_bytes: 1024
op = "start"
while op != "?":    
    calc = input().split()
    a = int(calc[0])
    op = calc[1]
    b = int(calc[2])
    if op == "+" : ans = a + b
    elif op == "-" : ans = a - b
    elif op == "*" : ans = a * b
    elif op == "/" : ans = int(a / b)
    elif op == "?" : break
    print(ans)


Measured memory_bytes: 5592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
int main() {
  int N;
  cin >> N;
  long long int A[N];
  Bint sum=0;
  Bint array_sum=0;
  Bint mod=1000000007;
  for(int i=0;i<N;i++){
    cin >> A[i];
    sum+=A[i];
    array_sum+=A[i]*A[i];
  }
  sum=sum*sum;
  cout << ((sum-array_sum)/2)%mod;
  cout << endl;
  return 0;
}


Measured memory_bytes: 5208
//              _      _                 
//             (_)    | |                
//    _ __ ___  _  ___| |__   __ _  ___  
//   | '_ ` _ \| |/ __| '_ \ / _` |/ _ \ 
//   | | | | | | | (__| | | | (_| | (_) |
//   |_| |_| |_|_|\___|_| |_|\__,_|\___/ 
//                                       
// 
#include <bits/stdc++.h>
#define int long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
/*#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
using namespace std;

int32_t main()
{
  BOOST;
  char a;
  cin>>a;
  if ((int)a>=65 && (int)a<=90)cout<<'A';
  else cout<<'a';
  return 0;
}


Measured memory_bytes: 3636
n=int(input())
l=[int(i) for i in input().split()]
if n<3:
    print(0)
else:
    s=set()
    for i in range(n):
        for j in range(n):
            for k in range(n):
                if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i] and (i,j,k) not in s:
                    if l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[k]+l[i]>l[j]:
                        x=sorted([i,j,k])
                        s.add(tuple(x))
    
    print(len(s))

Measured memory_bytes: 30960
package main
import "fmt"
func main() {
  var k,n int
  fmt.Scan(&k,&n)
  if k%2 == 0 {
    fmt.Print(k/2)
    for i:=1;i<n;i++ { fmt.Print(" ");fmt.Print(k) }
    fmt.Println()
    return
  }
  b := make([]int,n)
  for i:=0;i<n;i++ { b[i] = (k+1)/2 }
  for i:=0;i<n/2;i++ {
    if b[len(b)-1] == 1 { b = b[:len(b)-1];continue }
    b[len(b)-1]--
    for len(b) < n { b = append(b,k) }
  }
  fmt.Print(b[0])
  for i:=1;i<len(b);i++ { fmt.Print(" ");fmt.Print(b[i]) }
  fmt.Println()
}

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

int main()
{
    size_t N, K;
    cin >> N >> K;

    vector<int> sunuke(N, 0);
    size_t d, A;
    for (size_t i = 0; i < K; i++)
    {
        cin >> d;
        for (size_t j = 0; j < d; j++)
        {
            cin >> A;
            A--;
            sunuke[A]++;
        }
    }
    int ans = 0;
    for (int a : sunuke)
    {
        if (a == 0)
        {
            ans++;
        }
    }
    cout << ans << endl;
}


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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60; 

string s[302];
bool ok[604];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  vl a(N); rep(i,N) cin >> a[i];
  map<ll,ll> mp;
  ll s=0;
  ll ans = 0;
  mp[0]=1;
  rep(i,N){
    s += a[i];
    ans += mp[s];
    if(mp.count(s)) mp[s]++;
    else mp[s]=1;
    // for(auto itr=mp.begin();itr!=mp.end();itr++){
    //   cout << itr->first << " " << itr->second << endl;
    // }
    // cout << "" << endl;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 14336
n,m = map(int, input().split())
h = list(map(int, input().split()))
check = [0 for i in range(n)]

for _ in range(m):
    a,b = map(int, input().split())
    if h[a-1]>h[b-1]:
        check[b-1] += 1
    elif h[a-1]<h[b-1]:
        check[a-1] += 1
    else:
        check[a-1] += 1
        check[b-1] += 1

ans = sum([c == 0 for c in check])
print(ans)
#print(check)

Measured memory_bytes: 20000
import heapq
Q = int(input())
INF = 2 * (10 ** 9)
a1, a2 = [INF], [INF]
asum1 = 0
asum2 = 0
bsum = 0
for i in range(Q):
    query = list(map(int, input().split()))
    if query[0] == 3:
        break
    if query[0] == 1:
        a, b = query[1:]
        bsum += b
        if len(a1) == len(a2):
            if -a1[0] > a:
                asum1 += a
                heapq.heappush(a1, -a)
            else:
                asum2 += a
                heapq.heappush(a2, a)
                asum1 += a2[0]
                asum2 -= a2[0]
                heapq.heappush(a1, -heapq.heappop(a2))
        else:
            if a2[0] < a:
                asum2 += a
                heapq.heappush(a2, a)
            else:
                asum1 += a
                heapq.heappush(a1, -a)
                asum2 += -a1[0]
                asum1 -= -a1[0]
                heapq.heappush(a2, -heapq.heappop(a1))
    else:
        m = -a1[0]
        print(m, m * (len(a1) - 1) -
              asum1 + asum2 - m * (len(a2) - 1) + bsum)

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

int main() {

  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int count = 0;

  for (int i = 0; i <= A; i++) {
      for (int j = 0; j <= B; j++) {
          for (int k = 0; k <= C; k++) {
              if (X==500*i+100*j+50*k)
                count++;
          }
      }
  }

  cout << count << endl;
              
}

Measured memory_bytes: 256
def solve():
    a, b, c = read()
    result = think(a, b, c)
    write(result)


def read():
    return read_int(3)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(a, b, c):
    if b + c >= a:
        return b + c - a
    else:
        return 0


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void puts_all(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void puts_all(const T &value, const Args&... args){std::cout << value << " ";puts_all(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int N;
  while(cin >> N){
    vector<int> X(N); cin >> X;

    int ans = INT_MAX;

    FORE(p,0,100){
      int t = 0;

      for(auto &x : X){
        t += (x-p) * (x-p);
      }

      chmin(ans, t);
    }
    

    puts_all(ans);
  }
  
  return 0;
}


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

class UnionFindTree {
  struct edge {
    int node;
    int distance;
  };
  vector<edge> root;
  vector<int> rank;

  edge findRoot(int x) {
    if(x != root[x].node) {
      edge e = findRoot(root[x].node);
      root[x] = edge{e.node, e.distance + root[x].distance};
    }
    return root[x];
  }

public:

  UnionFindTree(int size) {
    rank = vector<int>(size, 0);
    root = vector<edge>(size, edge{});
    for(int i = 0; i < size; i++) root[i] = edge{i,0};
  }

  void relate(int x, int y, int z) {
    edge ex = findRoot(x);
    edge ey = findRoot(y);
    if(ex.node == ey.node)return;

    int d = z + ey.distance - ex.distance;
    if(rank[ex.node] < rank[ey.node]) {
      root[ex.node] = edge{ey.node, d};
    } else {
      root[ey.node] = edge{ex.node, -d};
      if(rank[ex.node] == rank[ey.node]) rank[ex.node]++;
    }
  }

  string difference(int x, int y) {
    edge ex = findRoot(x);
    edge ey = findRoot(y);
    if(ex.node == ey.node) {
      return to_string(ex.distance - ey.distance);
    } else {
      return "?";
    };
  }
};

int main () {
  int n, q;
  cin >> n >> q;
  UnionFindTree uft(n);

  rep(i,q) {
    int c, x, y, z;
    cin >> c;
    if(c == 0) {
      cin >> x >> y >> z;
      uft.relate(x, y, z);
      continue;
    }
    cin >> x >> y;
    cout << uft.difference(x, y) << endl;
  }

  return 0;
}



Measured memory_bytes: 3928
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int N = sc.nextInt();
        int[] A = new int[N];
        int ans = 1;
        int sign = 0;
        for (int i = 0; i < N; ++i) {
            A[i] = sc.nextInt();

            if (i > 0 && A[i - 1] != A[i]) {
                if (sign == 0) {
                    sign = (A[i - 1] < A[i]) ? 1 : -1;
                } else if (sign == -1) {
                    if (A[i - 1] < A[i]) {
                        sign = 0;
                        ++ans;
                    }
                } else {
                    if (A[i - 1] > A[i]) {
                        sign = 0;
                        ++ans;
                    }
                }
            }
        }

        _out.println(ans);
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 50236
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    if N == 1:
        print("Yes")
        print(2)
        print(*[1, 1], sep=" ")
        print(*[1, 1], sep=" ")
        return
    answer = "No"
    for i in range(1, N):
        if (2 * N) % i == 0:
            if (2 * N) // i == i + 1:
                answer = "Yes"
                cnt = i
                break
    print(answer)
    if answer == "No":
        return
    else:
        print(cnt + 1)
        answer = [[] for _ in range(cnt + 1)]
        next_num = 1
        next_place = 1
        while next_num <= N:
            for i in range(cnt + 1):
                if len(answer[i]) < cnt:
                    answer[i].append(next_num)
                    answer[next_place].append(next_num)
                    if len(answer[i]) == cnt:
                        next_place = i + 2
                    else:
                        next_place += 1
                    break
            next_num += 1

        for i in range(cnt + 1):
            ans = [cnt] + answer[i]
            print(*ans, sep=" ")


if __name__ == "__main__":
    main()


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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);

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

    for (int l=k ; l<n; l++){
        if ( a.at(l) > a.at(l-k)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
const double PI = acos(-1);
using namespace std;
int main() {
    int h, w;
    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0){
            break;
        }
        for (int  i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                cout << "#";
                /* code */
            }
            cout << endl;
            
            /* code */
        }
        cout << endl;
    }
}



Measured memory_bytes: 3080
/**
 *    author: gxfireball       
**/
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
using namespace std;

void solve(){
    int n;
    cin >> n;
    vector<int> arr;
    for(int i=0;i<n;++i){
      	int temp;
      	cin>>temp;
        arr.push_back(temp);
    }
    if(n==1){
    	cout<<0;
    	return;
    }
    sort(arr.begin(),arr.end(),greater<int>());
    
    ll sum=0,j=0;
    for(int i=0;i<n-1; ++i){
    	sum += arr[j];
    	if(i%2==0) j++;
    	
    }
    cout<<sum;

}

int main(){
    fastio;
    int t;
    t = 1;
    //cin>>t;
    while(t--){
    	solve();
    }
    return 0;
}



Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;
  int k;
  cin>>k;
  int c=0;
  for(int i=0;i<k;i++){
    int x;
    cin>>x;
    c|=1<<x;
  }
  for(int b=0;b<(1<<n);b++){
    if((b&c)!=c) continue;
    cout<<b<<":";
    for(int i=0;i<n;i++)
      if((b>>i)&1) cout<<" "<<i;
    cout<<"\n";
  }
  cout<<flush;
  return 0;
}



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

int charToInt(char c) {
  return (int)c - (int)'0';
}

void showSoroban(string num) {
  string str = "00000";
  for(int i = 0; i < num.length(); i++) {
    str[i+5-(int)num.length()] = num[i];
  }
  for(int i = 0; i < str.length(); i++) {
    if(charToInt(str[i]) >= 5) cout << ' ';
    else                       cout << '*';
  }
  cout << endl;
  for(int i = 0; i < str.length(); i++) {
    if(charToInt(str[i]) >= 5) cout << '*';
    else                       cout << ' ';
  }
  cout << endl;
  for(int i = 0; i < str.length(); i++) cout << '=';
  cout << endl;
  for(int n = 0; n < 5; n++) {
    for(int i = 0; i < str.length(); i++) {
      if(charToInt(str[i])%5 == n) cout << ' ';
      else                         cout << '*';
    }
    cout << endl;
  }
}

int main() {
  string str;
  int i = 0;
  while(cin >> str) {
    if(i != 0) cout << endl;
    showSoroban(str);
    i++;
  }
  return 0;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#define ios std::ios::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define PI acos(-1.0)
#define EPS 1e-9 //epsilon 10^-9, checking for equality 
#define pb push_back
#define fi first
#define se second
#define go(i,a,n) for(int i=a;i<n;i++)
#define og(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(i,n) go(i,0,n)
#define per(i,n) og(i,0,n)
#define sz(x) (x.size())
#define isort(x) sort(x.begin(),x.end())
#define dsort(x) sort(x.rbegin(),x.rend())
#define all(x) x.begin(),x.end()
#define rall(x) (x).rbegin(),(x).rend()
#define pr(x) cout<<(x)<<endl
#define exist(e,s) ((s).find(e)!=(s).end()) //Element e in structure s
#define existstr(c,s) ((s).find(c) !=string::npos) //Character in structure
#define fo(x,s) for(auto &x:s) //for all x in structure s
typedef vector<int> vi;typedef vector<ll> vll;typedef vector< vector<int> > vvi;
typedef vector< vector<ll> > vvll;typedef pair<int,int> ii;typedef pair<int, pair<int,int> > iii;
typedef pair<ll,ll> pll;typedef vector<ii> vii;typedef vector<iii> viii;typedef map<int,int> mii;
const int inf=1e9+7; //10^9 +7
inline void rvi(vi& v, int n){int temp; go(i,0,n){cin>>temp;v.pb(temp);}}
inline void rvll(vll& v, int n){ll temp;go(i,0,n){cin>>temp;v.pb(temp);}}
inline void prvi(vi&a){go(i,0,a.size()){cout<<a[i]<<" ";}cout<<endl;}
inline void prvll(vll&a){go(i,0,a.size()){cout<<a[i]<<" ";}cout<<endl;}
inline void prmii(map<int,int>& m){for(auto x:m){cout<<x.fi<<" "<<x.se<<endl;}}
inline vll prefixsum(vi& a){vll b;b.pb(a[0]);go(i,1,a.size()){b.pb(a[i]+b[i-1]);}return b;}
inline vll suffixsum(vi& a){vll b(sz(a));b[sz(a)-1]=a[sz(a)-1];og(i,0,sz(a)-1){b[i]=a[i]+b[i+1];}return b;}
inline vll prefixsum(vll& a){vll b;b.pb(a[0]);go(i,1,a.size()){b.pb(a[i]+b[i-1]);}return b;}
inline vll suffixsum(vll& a){vll b(sz(a));b[sz(a)-1]=a[sz(a)-1];og(i,0,sz(a)-1){b[i]=a[i]+b[i+1];}return b;}
void solve();
int main(){ios;solve();return 0;}
//--------SOLVE---------------------------------------------------------------------
void solve()
{
 	int n;cin>>n;
 	int cc=0;
 	for(int i=1;i<=n;i=i+2)
 	{
 		int count=0;
 		for(int j=1;j<=i;j++)
 		{
 			if(i%j==0)
 			{
 				count++;
 			}
 		}
 		if(count==8) cc++;
 	}
 	cout<<cc<<endl;
}

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

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let S: Vec<char> = sc.chars();
    let mut ans = 0;
    for i in 0..S.len()/2 {
        if S[i] != S[S.len() - 1 - i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {

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

    String C = "abcdefghijklmnopqrstuvwxyz";
    char[] c = C.toCharArray();

    for (int i = 0; i < 26; i++) {
      if (!s.contains(String.valueOf(c[i]))) {
        System.out.println(c[i]);
        return;
      }
    }

    System.out.println("None");

  }

}


Measured memory_bytes: 26280
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring> 
#include<cassert>
#include<cmath>
#include<sstream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
long long a[100005];
int main(){
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	int cnt=0;
	if(s[0]=='0') cnt++;
	a[cnt]=1;
	for(int i=1;i<n;i++){
		if(s[i]==s[i-1]) a[cnt]++;
		else{
			a[++cnt]++;
		} 
	}
	n=cnt+1;
	long long sum=0;
	long long ma;
	for(int i=0;i<min(n,2*k+1);i++) sum+=a[i];
	ma=sum;
	for(int i=2;i<=n-2*k;i+=2){
		sum-=a[i-1];
		sum-=a[i-2];
		sum+=a[i+2*k];
		sum+=a[i+2*k-1];
		ma=max(ma,sum);
	}
	cout<<ma;
}

Measured memory_bytes: 1280
#include<stdio.h>

int main(void){
  int i;
  char s[4];
  int a=0,b=0,c=0;
  
  scanf("%c%c%c",&s[0],&s[1],&s[2]);
  
  for(i=0;i<3;i++){
      if(s[i]=='a')
        a++;
      if(s[i]=='b')
        b++;
      if(s[i]=='c')
        c++;
  }
  
  if(a==1&&b==1&&c==1)
    printf("Yes\n");
  else 
    printf("No\n");
    
  return 0;
}

Measured memory_bytes: 128