akhauriyash/Code-Regression huggingface dataset:
fun main(args : Array<String>) {
    val (N, M, C) = readLine()!!.split(" ").map { it.toInt() }
    val B = readLine()!!.split(" ").map { it.toInt() }

    var answer = 0
    (1..N).forEach {
        val A = readLine()!!.split(" ").map { it.toInt() }
        var sum = C
        A.forEachIndexed { index, a ->
            sum += a * B[index]
        }

        if (sum > 0) {
            answer++
        }
    }

    println(answer)
}

Measured memory_bytes: 38064
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)
	args := [3]int{a, b, c}
	five := 0
	seven := 0
	for _, v := range args {
		if v == 5 {
			five += 1
		} else if v == 7 {
			seven += 1
		}
	}
	if five == 2 && seven == 1 {
		fmt.Print("YES")
	} else {
		fmt.Print("NO")
	}
}


Measured memory_bytes: 1828
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

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

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n;
	cin>>n;
	cout<<180*(n-2)<<endl;

	return 0;
}

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

/*
入力がでかい。
for loop ではなさそう。
N>=Kのときは、とりあえずあまりをはじき出す。
あまりがKに近いが0に近いかで場合分け
0に近い場合はそのあまりが最小値
Kにちかい場合はKとあまりの差が最小値
*/

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

    long d = N % K;
    cout << min(d, abs(K-d)) << endl;
}

Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,r;
    cin>>n;
    bool ok=false;
    while(n>0){
        r = n%10;
        if(r==7){
            ok=true;
            break;
        }
        n/=10;
    }
    if(ok)cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    rep(i, n) scanf("%d", &a[i]);
    sort(a.begin(), a.end());
    int ans = a[a.size() - 1] - a[0];
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f0(i, n) for(int i(0); i < (n); i++)
#define f1(i, n) for(int i(1); i <= n; i++)
#define bit(x, y) (((x) >> (y))&1ll)

using namespace std;
typedef long long ll;

ll n;

bool check(ll k){
    if(k < 0) return 0;
    f0(i, 34) if(bit(k, i) && i % 2) return 0;
    return 1;
}

ll res = n;
bool ok = 0;
void back1(int i){
    if(i > 33){
        if(check(res)) ok = 1;
        return ;
    }
    f0(j, 2){
        res = res + j*1ll*(1ll << i);
        back1(i + 2);
        if(ok) return ;
        res = res - j*1ll*(1ll << i);
    }
}

int main(){
    ios_base::sync_with_stdio(0);
 
    cin >> n;
    if(n==0){
        cout << 0;
        return 0;
    }
    res = n;
    back1(1);

    ll s1 = res;
    ll s2 = res - n;
    ll s = s1 | s2;

    ll k = log2(s);
    for(ll i = k; i >= 0; i--){
        cout << bit(s, i);
    }
}



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

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



int main(){
    long N;
    long long sum=0,all=1,tmp1=1,tmp2=1;
    cin >> N;
    rep(i,N){
        all = all*10;
        all = all%mod;

        tmp1 = tmp1*9;
        tmp1 = tmp1%mod;

        tmp2 = tmp2*8;
        tmp2 = tmp2%mod;
    }

    sum = all -2*tmp1 + tmp2;
    sum = sum % mod;
    
    if(sum<0) sum = sum+mod;

  //  cout << all << " " << tmp1 << " " << tmp2 << endl;
    cout << sum << endl;
}



Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<string>

using namespace std;
#define ll long long

int main(){
    int N, K;
    int m = 1;
    int tt=0;
    bool flag = true;
    set<int> s;
    set<int> g;
    cin >> N >> K;
    set<int> D;
    for(int i = 0; i < K; i++){
        cin >> tt;
        if(D.count(tt) == 0){
            D.insert(tt);
        }
        if(m == tt){
            m++;
        }
    }
    for(int i = N; i < 1e9; i++){
        int t = i;
        flag = true;
        while(t > 0){
            int a = t % 10;
            t /= 10;
            if(D.count(a) > 0){
                flag = false;
            }
        }
        if(flag){
            cout << i << endl;
            return 0;
        } 
    }
}


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

using namespace std;

int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);

  for (int i = 0; i < M; ++i) {
    cin >> B[i];
  }

  int ans = 0;
  int a;
  for (int i = 0; i < N; ++i ) {
    int score = 0;
    for (int j = 0; j < M; ++j) {
      cin >> a;
      score += a * B[j];
    }
    score += C;
    if (score > 0) ans++;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
data=list(map(int,input().split()))
goukei=0
num=data[3]
for i in range(0,len(data)-1):
    if data[i]<=num:
        if i==0:
            goukei=goukei+data[i]
        elif i==2:
            goukei=goukei-data[i]
        num=num-data[i]
    else:
        if i==0:
            goukei=goukei+num
        elif i==2:
            goukei=goukei-num
        num=0
print(goukei)

Measured memory_bytes: 9152
#include <stdio.h>
                                                                                                
  
int main(void){
                                                                                                
   
    int n, l, r, i;
   
    int a = 0;
   
      
    scanf("%d", &n);
   

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

        scanf("%d %d", &l, &r);

        a += ( r - l + 1 );

       }
   

    printf("%d\n", a );


    return 0;
                                                          
}

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

int main (void) {
  int n;
  int t[100010];
  int x[100010];
  int y[100010];

  t[0] = x[0] = y[0] = 0;

  cin >> n;
  for (int i = 0; i < n; i++) cin >> t[i+1] >> x[i+1] >> y[i+1];

  int dist, time;
  bool flag = true;

  for (int i = 0; i < n; i++) {
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
    time = t[i+1] - t[i];

    if ((dist <= time) && ((time % 2) == (dist % 2))) {
    } else {
      flag = false;
    }
  }

  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int N,M;
    cin>>N>>M;
    int ans=1;
    for(int i=1;i*i<=M;i++){
        if(M%i!=0)continue;
        int x=M/i;
        if(x>=N){chmax(ans,i);}
        if(i>=N){chmax(ans,x);}
    }
    cout<<ans<<endl;
}

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

public class Main {
	public static void main(String args[]) throws Exception {
		BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
		String[] s = stdR.readLine().split(" ");
		int a = Integer.parseInt(s[0]);
		int b = Integer.parseInt(s[1]);
		if ((a & 1) == 0) {
			System.out.println("Even");
		} else if ((b & 1) == 0) {
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}
	}
}

Measured memory_bytes: 20692
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
 
#include <bits/stdc++.h>
 
using namespace std;
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  
#define pb push_back
#define in insert
#define f first
#define s second
#define ll long long
#define dd double
  
const int mod = 1e9 + 7;
const int N = 2e5 + 7;
const int inf = 2e9;
const ll INF = 1e18;

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	// freopen("*.in", "r", stdin);freopen("*.out", "w", stdout);
	int x, y;
	cin >> x >> y;
	if (y - 2*x < 0 || (y - 2*x) % 2) {
		cout << "No";
		return 0;
	}
	int m = (y - 2*x) / 2; 
	if (x - m >= 0) cout << "Yes";
	else cout << "No"; 
}

Measured memory_bytes: 3648
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	string s;
	cin>>s;
	int l=s.length();
	int tmp=l;
	FOR(i,1,l){
		if(s[i-1]!=s[i]){
			int t=max(i,l-i);
			tmp=min(t,tmp);
		}
	}
	cout<<tmp;
    return 0;
}


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

int main(void){
    int me, A, book, debt;
    cin >> me >> A >> book;
     
    if(me >= book){
        cout << 0 << endl;
    }
     
    else{
        debt = book - me;
        if(A >= debt){
            cout << debt << endl;
        }
        else cout << "NA" << endl;
    }
    return 0;
}

/*
　自分の所持金が本の値段より多ければ、借金は０円。
　不足しているとき、不足分がＡ君の所持金より少なければ、Ａ君から借りる。
　不足分がＡ君の所持金より多ければ、「NA」を返す。
*/


Measured memory_bytes: 3116
#include<stdio.h>

int main(void){
  int n;
  scanf("%d",&n);
  int d[n],q[n];
  for(int i=0;i<n;i++){
    scanf("%d %d",&d[i],&q[i]);
  }
    for(int i=2;i<n;i++){
      if(d[i]==q[i]){
        if(d[i-1]==q[i-1]){
          if(d[i-2]==q[i-2]){
            printf("Yes\n");
            return 0;
          }
        }
      }
    }
  printf("No\n");
  return 0;
}
        
  
      

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int X, Y, Z;
    cin >> X >> Y >> Z;
    int cnt{};
    for( int i = 0; i <= 100000; i++ )
    {
        if( Y * i + Z * ( i + 1 ) <= X )
        {
            cnt = i;
        }
        else
        {
            break;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int N,A,B;

bool Check(int x) {
    int sum = 0;

    for(;x != 0;x /= 10) {
        sum += x % 10;
    }

    if(A <= sum && sum <= B)
        return true;

    return false;
}

int main(void) {
    cin>>N>>A>>B;
    long long sum = 0;

    for(int i = 1;i <= N;i++) {
        if(Check(i)) {
            sum += i;
        }
    }

    cout<<sum<<endl;

    return 0;
}



Measured memory_bytes: 888
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#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 a, b, c, k;
  cin >> a >> b >> c >> k;

  int cnt = 0;
  while (a >= b) {
    b *= 2;
    cnt++;
  }
  while (b >= c) {
    c *= 2;
    cnt++;
  }

  if (cnt <= k)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=100010;
bool w[N],v[N];
int fa[N],sz[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
inline int find(int x,int &y) {
    if(fa[x]==x) return x;
    fa[x]=find(fa[x],y);
    return v[x]^=y,y=v[x],fa[x];
}
int main() {
    int n,m,A=0,B=0,C=0;
    cin>>n>>m;
    for(int i=1;i<=n;i++) fa[i]=i,sz[i]=1;
    for(int i=1;i<=m;i++) {
	int X=0,Y=0,x=find(gi(),X),y=find(gi(),Y);
	if(x!=y) fa[x]=y,v[x]=X^Y^1,w[y]|=w[x],sz[y]+=sz[x];
	else w[x]|=X^Y^1;
    }
    for(int i=1;i<=n;i++)
	if(fa[i]==i) {
	    if(sz[i]==1) ++A;
	    else if(w[i]) ++B;
	    else ++C;
	}
    cout<<B+C+C+2LL*B*C+2LL*C*(C-1)+2LL*A*n-1LL*A*A+1LL*B*(B-1);
    return 0;
}

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

int main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  cout << h2 * 60 + m2 - h1 * 60 - m1 - k << endl;
}


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

int n;
long long ans = 0;
long long a[200002];
bool b = false;

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	sort(a + 1, a + 1 + n);
	ans += a[n];
	int tot = (n - 2) / 2;
	if ((n - 2) % 2 == 1) {
		b = true;
	}
	else {
		b = false;
	}
	for (int i = n - 1; i >= n - tot; i--) {
		ans = ans + a[i] * 2;
		//cout << a[i] << endl;
	}
	//cout << ans << endl;
	if (b) ans += a[2 + tot];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5180
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)

typedef unsigned long long ull;

int main(){
	int n; cin>>n;
	vector<int> v(6);
	FOR(i,n){
		double d; cin>>d;
		v[min(max((int)(d-160)/5,0),5)]++;
	}
	FOR(i,6){
		printf("%d:",i+1);
		FOR(j,v[i]) putchar('*');
		putchar('\n');
	}

	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <thread>
#include <functional>
#include <bitset>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DO(i, first, last) for (int i = first; last <= i; i--)

using namespace std;

bool is_goal(int n, uint32_t state) {
	if (state == 0) return true;

	for (int i = 0; i < n; i++) {
		if (((state >> (i * 2)) & 3) != 2) return false;
	}

	return true;
}

struct Search {
	int64_t  val;
	uint32_t state;

	Search& operator *() { return *this; }
};

void add(priority_queue < Search, vector<Search>, function<bool(const Search&, const Search&)>> & search,
	unordered_set<uint32_t> & searched, const Search & cur)
{
	if (searched.find(cur.state) != searched.end()) {
		return;
	}

	search.push(cur);
	searched.insert(cur.state);
}

void solve(int n, int m)
{
	uint32_t init_state = 0;
	{
		int n_a; cin >> n_a;
		FOR_LT(i, 0, n_a) {
			// do nothing
			int a; cin >> a;
		}

		int n_b; cin >> n_b;
		FOR_LT(i, 0, n_b) {
			int b; cin >> b;
			b--;
			init_state |= (1 << (b * 2));
		}

		int n_c; cin >> n_c;
		FOR_LT(i, 0, n_c) {
			int c; cin >> c;
			c--;
			init_state |= (2 << (c * 2));
		}
	}

	unordered_set<uint32_t> searched;

	priority_queue < Search, vector<Search>, function<bool(const Search&, const Search&)>>
		search([](const auto & lhs, const auto & rhs) { return lhs.val > rhs.val; });
	search.push({ 0, init_state });
	searched.insert(init_state);

	while (!search.empty()) {
		const auto cur = search.top();
		search.pop();

		if (m < cur.val) {
			cout << -1 << endl;
			return;
		}

		if (is_goal(n, cur.state)) {
			cout << cur.val << endl;
			return;
		}

		int has_top_a = 0;
		int has_top_b = 0;
		int has_top_c = 0;
		FOR_DO(i, n - 1, 0) {
			uint32_t s = ((cur.state) >> (i * 2)) & 3;

			if (!has_top_a && s == 0) {
				if (!has_top_b) {
					uint32_t next = cur.state;
					next ^= (1 << (i * 2));
	
					add(search, searched, { cur.val + 1, next});
				}
				has_top_a = 1;
			}
			if (!has_top_b && s == 1) {
				if (!has_top_a) {
					uint32_t next = cur.state;
					next ^= (1 << (i * 2));

					add(search, searched, { cur.val + 1, next });
				}
				if (!has_top_c) {
					uint32_t next = cur.state;
					next ^= (3 << (i * 2));

					add(search, searched, { cur.val + 1, next });
				}
				has_top_b = 1;
			}
			if (!has_top_c && s == 2) {
				if (!has_top_b) {
					uint32_t next = cur.state;
					next ^= (3 << (i * 2));

					add(search, searched, { cur.val + 1, next });
				}
				has_top_c = 1;
			}
			if (has_top_a + has_top_b + has_top_c == 2) {
				break;
			}
		}
	}

	assert(!"error");
}

int main()
{
	while (true) {
		int n, m; cin >> n >> m;
		if (n == 0 && m == 0) {
			return 0;
		}

		solve(n, m);
	}

	return 0;
}


Measured memory_bytes: 120632
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define inputv(arr,n) for(ll i=0;i<n;i++){ll value;cin>>value;arr.pb(value);}
#define sz(a) ((ll)(a).size())
#define len(a) ((ll)(a).length())
#define precise cout<<fixed<<setprecision(0); 
#define F first
#define S second
#define vi vector <int> 
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define YES cout<<"Yes\n"
#define NO cout<<"No\n"
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
inline ll max(ll a,ll b)
{return ((a>b)?a:b);}
inline ll min(ll a,ll b)
{return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b)
{if(b==0) return a;a%=b;return gcd(b,a);}
#define nl cout<<"\n"
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
// hashing for pairs
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
//sort in reverse order
bool compare(ll x, ll y){
    return x>y;
}
void solve()
{
  ll n,x,t,val=0;
  cin>>n>>x>>t;
  if(n%x!=0)
  {
    val = t;
  }
  cout<<(n/x)*t + val;nl;
  return;
}
int main()
{
    IOS;
    int T=1;
   // cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3780
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    string s,t;
    cin >> s >> t;
    vector<int> as(26,0),at(26,0);
    int slen = s.length();
    int tlen = t.length();
    rep(i,slen){
        as[s[i]-'a']++;
    }
    rep(i,tlen){
        at[t[i]-'a']++;
    }
    // rep(i,26){
    //     cout << as[i] << " ";
    // }
    // cout << endl;

    // rep(i,26){
    //     cout<< at[i] << " ";
    // }
    // cout << endl;


    string al = "abcdefghijklmnopqrstuvwxyz";

    string ss="",tt="";
    rep(i,26){
        rep(j,as[i]){
            ss += al[i];
        }
    }
    rep(i,26){
        rep(j,at[25-i]){
            tt += al[25-i];
        }
    }
    //cout << ss << " " << tt << endl;
    if(ss < tt){
        cout << "Yes"  <<endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
A=[0]
B=[0]
for i in range(n):
    A.append(A[i]+a[i])
for i in range(m):
    B.append(B[i]+b[i])

ans=0
j=m
for i in range(n+1):
    if A[i]>k:
        break
    while B[j]>k-A[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)

Measured memory_bytes: 134352
def wa(nature):
    nature_i = len(nature)
    return nature_i*(nature_i+1)//2
in_str = input()
moji_ls = []
i = 1
taiki = in_str[0]
len_in_str =len(in_str)
while i < len_in_str:
    if taiki[0] == in_str[i]:
        taiki += in_str[i]
        i += 1
    else:
        moji_ls.append(taiki)
        taiki = in_str[i]
        i += 1
moji_ls.append(taiki)
#print(moji_ls)
#print(len(moji_ls))
sub = 0
moji_ls_len = len(moji_ls)
i = 0
while i < moji_ls_len:
    if moji_ls[i][0] == '<':
        if i == moji_ls_len-1:
            sub += wa(moji_ls[i])
        else:
            sub += wa(moji_ls[i]) - min(len(moji_ls[i]),len(moji_ls[i+1]))
    else:
        sub += wa(moji_ls[i])
    i += 1
print(sub)


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

int main(){
	int n; cin >> n;
    int y=0;
    for(int i = 0; i < n; ++i){
    	int x; cin >> x;
        y |= x;
    }
    int ans = 0;
    while(!(y&1)){ans++;y>>=1;}
    cout << ans << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod =1e+9+7;

int main(){
    ll n,k,x,y; cin>>n>>k>>x>>y;
    if(n<=k)cout<<n*x<<endl;
    else cout<<(n-k)*y+k*x<<endl;
}





























































































Measured memory_bytes: 3596
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define int long long


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

    string s; cin >> s;
    int q; cin >> q;

    int a = 0;

    int t,f;
    char c;

    string l = "",r = "";

    for(int i = 0;i < q;i ++){
        cin >> t;
        if(t == 1){
            a ++;
        }else{
            cin >> f >> c;
            if(a % 2 == 0 && f == 1){
                l += c;
            }else if(a % 2 == 0 && f == 2){
                r += c;
            }else if(a % 2 == 1 && f == 1){
                r += c;
            }else{
                l += c;
            }
        }
    }

    reverse(l.begin(),l.end());

    s = l + s + r;

    if(a % 2 == 0){
        cout << s << endl;
    }else{
        reverse(s.begin(),s.end());
        cout << s << endl;
    }
}







Measured memory_bytes: 1200
#include<stdio.h>

int main(){
	
	int a,b,c,d,f,i,j,x[200];
	
	for(i=0;i<200;i++){
		x[i]=0;
	}
	i=0;
	
	while(scanf("%d",&a)!=EOF){
		scanf("%d",&b);
		c=0;
		d=0;
		c=a+b;
		
		while(1){
			c=c/10;
			d=d+1;
			if(c==0){
				x[i]=d;
				break;
			}
		}
		i=i+1;
	}
	
	for(j=0;j<i;j++){
		printf("%d\n",x[j]);
	}


return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
#include <stdlib.h>

int asc(const void *a, const void *b) {
  return *(long long *)a - *(long long *)b;
}

int main(void){
    int n, k, i;
    scanf("%d%d",&n,&k);
    long long h[n];
    long long l = 1000000000;
    for(i=0;i<n;i++){
        scanf("%lld",&h[i]);
    }
    qsort(h, n, sizeof(long long), asc);
    for(i=0; i+k-1<n; i++){
        if(l > h[i+k-1]-h[i] ){
            l = h[i+k-1]-h[i];
        }
    }
    printf("%lld\n",l);
    return 0;
}

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int n,m=0,a[100010],b[100010],c[100010],ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		if(a[i]!=c[m]){
			c[++m]=a[i];
			b[m]=1;
		}
		else{
			b[m]=b[m]+1;
		}
	}
	for(int i=1;i<=m;i++){
		if(b[i]>=c[i]){
			ans=ans+b[i]-c[i];
		}
		else{
			ans=ans+b[i];
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1408
import sys

input = sys.stdin.readline


def solve():
    t_stamina, t_attack, a_stamina, a_attack = map(int, input().split())
    t_num_attack_to_be_beaten = - (-t_stamina // a_attack)
    a_num_attack_to_be_beaten = - (-a_stamina // t_attack)

    if t_num_attack_to_be_beaten >= a_num_attack_to_be_beaten:
        return 'Yes'
    else:
        return 'No'


if __name__ == '__main__':
    answer = solve()
    print(answer)


Measured memory_bytes: 9172
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

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

int N,M,K;
const int MAXN=128;
const int INF=1e+9;
int G1[MAXN][MAXN];
int G2[MAXN][MAXN];

int main()
{
	while(cin>>M>>N&&(M||N))
	{
		rep(i,N){ rep(j,N){ G1[i][j]=G2[i][j]=(i==j?0:INF); } }

		rep(i,M)
		{ 
			int a,b,c,d;
			cin>>a>>b>>c>>d; --a; --b;
			G1[a][b]=G1[b][a]=c;
			G2[a][b]=G2[b][a]=d;
		}

		rep(point,N) rep(from,N) rep(to,N)
		{
			G1[from][to] = min(G1[from][to],G1[from][point]+G1[point][to]);
			G2[from][to] = min(G2[from][to],G2[from][point]+G2[point][to]);
		}

		cin>>K;
		rep(i,K)
		{
			int a,b,c; cin>>a>>b>>c; --a; --b;
			cout<<(c?G2[a][b]:G1[a][b])<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1264
def main():
    from random import sample
    from operator import itemgetter
    e=enumerate
    n,a=open(0)
    n=int(n)
    d=[0]+[-2**64]*n
    for j,(a,i)in e(sorted(sample([(a,i)for i,a in e(map(int,a.split()))],n),key=itemgetter(0),reverse=1)):
        d=[max(t+a*(~i-j+k+n),d[k-1]+a*abs(~i+k))for k,t in e(d)]
    print(max(d))
main()

Measured memory_bytes: 9972
#pragma comment(linker, "/stack:200000000")

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) return cout<<a,0;

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;

const int N = 30000 + 1 ;	
int n , m ,  k;
int a[N];
int sum1 = 0 , sum2 = 0;

main(){
	
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	string s;
	cin >> n;
	cin >> s;
	if(n >= 3200)
		ret(s);
	ret("red");

}

Measured memory_bytes: 256
import sys
sys.getrecursionlimit()

def dfs(i,s=''):
  global ans
  if i==len(t)-1:
    s+=t[-1]
    ans+=eval(s)
  else:
    dfs(i+1,s+t[i])
    dfs(i+1,s+t[i]+'+')

ans=0
t=list(input())
dfs(0,s='')
print(ans)

Measured memory_bytes: 3060
#!/usr/bin/env python3
from math import degrees, atan

a, b, x = map(int, input().split())
bot = a * a * b
if x * 2 > bot:
    print(degrees(atan((bot - x) * 2 / a**3)))
else:
    print(degrees(atan(b**2 * a / (2 * x))))


Measured memory_bytes: 9296
import sys

n,m=map(int,input().split())
ln=[list(input()) for i in range(n)]
lm=[list(input()) for i in range(m)]

flg=0
for i in range(n-m+1):
  for j in range(n-m+1):
    if ln[i][j:j+m]==lm[0][0:]:
      flg=1
      for k in range(m-1):
        if ln[i+k+1][j:j+m]!=lm[k+1][0:]:
          flg=0
    if flg==1:
      print("Yes")
      sys.exit()
print("No")
          

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

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

int main(){
	int x;
	std::cin >> x;
	if(x == 1){
		std::cout << 0 << std::endl;
	}else{
		std::cout << 1 << std::endl;
	}
	return 0;
	
}

Measured memory_bytes: 3588
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = B[A[0]-1]
for i in range(1,N):
  ans += B[A[i]-1]
  if A[i-1] + 1 == A[i]:
    ans += C[A[i-1]-1]
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define x first
#define y second
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define endl '\n'


int main()
{
	int k,a,b;
	cin>>k>>a>>b;
	a=(a+k-1)/k;
	a*=k;
	if(a<=b)cout<<"OK"<<endl;
	else cout<<"NG"<<endl;
	return 0;
}

Measured memory_bytes: 3676
#include <iostream>
#include <utility>
#include <algorithm>

using namespace std;

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

  pair<int, int> p[n];
  for(int i = 0; i < n; i++){
    cin >> p[i].second >> p[i].first;
    if(p[i].first < p[i].second){
      cout << "No";
      return 0;
    }
  }

  sort(p, p+n);

  int time = 0;
  for(int k = 0; k < n; k++){
    time += p[k].second;
    if(p[k].first < time){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}
  
  


Measured memory_bytes: 1792
a=int(input())
b=int(input())
c=int(input())
x=int(input())

cnt=0
for i in range(0,a+1):
    for j in range(0,b+1):
        for k in range(0,c+1):
            if x==(500*i+100*j+50*k):
                cnt+=1
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N;
  cin >> N;
  
  int sum = 0;
   
  for(int i = 0; i < N; i++){
    int a1, a2;
    
    cin >> a1 >> a2;
    
    if(a1 == a2){
      sum += 1;
      
      if(sum == 3){
        cout << "Yes" << endl;
        break;
      }
      
      else{
        continue;
      }      
    }
   
    if(i != N-1){
      sum = 0;
      continue;      
    }
   
    
    if(i == N-1){
      break;
    }
    
  }

  if(sum !=3){
    cout << "No" << endl;
  }
  
}

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

int main() {
    ll N;
    cin >> N;
    if (N % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    ll x = 10;
    while (x <= N) {
        ans += N / x;
        x *= 5;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n=int(raw_input())
for i in range(n):
    w=raw_input()
    if len(w)<7:
        print w
    else:
        for i in range(len(w)-6):
            if w[i:i+7]=="Hoshino":
                w=w[:i]+"Hoshina"+w[i+7:]
        print w

Measured memory_bytes: 4228
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
#define n_max 100000

#define rep(i,n) for(int i = 0; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

int main()
{
    ll n,a,b,c,d,e;

    cin >> n;
    cin >> a >> b >> c >> d >> e;
    
    ll m = min(a,min(b,min(c,min(d,e))));    
    cout << (n+m-1)/m +4 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n, k;  scanf("%d %d", &n, &k);
  long long int table[200005] = {0};
  int tmp;
  for(int i=1; i<k; i++){
    scanf("%d", &tmp);
    table[i] = table[i-1] + tmp;
  }
  long long int summax = 0;
  int ans = 0;
  for(int i=k; i<=n; i++){
    scanf("%d", &tmp);
    table[i] = table[i-1] + tmp;
    if(summax < table[i] - table[i-k]){
      summax = table[i] - table[i-k];
      ans = i;
    }
  }
  double expect = 0;
  for(int i=0; i<k; i++){
    long long int value = table[ans-i]-table[ans-i-1];
    expect = expect + (double)(value+1)*value/2/value;
  }
  printf("%f\n", expect);
  return 0;
}


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

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector <string> vs;

#define forl(i,a,b) for (int i = a; i < b; i++)
#define rfor(i,b,a) for (int i = b; i >= a; i--)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define srt(x) sort(x.begin(), x.end())
#define sumup(x) accumulate(x.begin(), x.end(), 0)
#define PI 3.141592653589793238
#define MOD 1000000007

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s, t;
    cin>>s>>t;
    t = t.substr(0,s.length());
    if(s==t) cout<<"Yes\n";
    else cout<<"No\n";
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll x, y;
    cin >> x >> y;
    rep(i, 0, x+1){
        ll t = i;
        ll k = x - i;
        ll c = 2 * t + 4 * k;
        if(c == y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
using ll = long long;
int main(){ 
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll b=0,c;
    rep(i,n){
        if(a[i]==1){
            break;
        }
        if(i==n-1){
            cout<<-1;
            return 0;
        }
    }
    for(int i=1;i<n+1;i++){
    for(int j=b;j<n;j++){
        if(a[j]==i){
        b=j;
        break;
        }
        if(j==n-1){
            cout<<n-i+1;
            return 0;
        }
    }
    }
    cout<<0;
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
   
struct node{
   
int id;
struct node* parentNode;
struct node* leftChild;
struct node* rightChild;
   
};
   
struct node *createNode(int);
void insert(struct node*);
void printNodes(void);
int findNode(int, struct node*);
void preOrder(struct node *);
void inOrder(struct node *);
   
struct node* nodes[500002];
struct node* root;
  
int num_nodes=0, n;
  
main(){
   
int i, id;
char com[7];
 struct node* tmpNode;
   
scanf("%d",&n);
   
for(i=0; i<n; i++){
   
scanf("%s",com);
if(com[0]=='i'){
scanf("%d",&id);
insert(createNode(id));
}else if(com[0]=='p'){
printNodes();
}else if(com[0]=='f'){
scanf("%d",&id);
    if(findNode(id, root)){
        printf("yes\n");   
    }else{
        printf("no\n");
    }
}
   
}/* END OF LOOP */
  
 return 0;
   
}
  
struct node *createNode(int id){
  struct node *newNode;
  if(id<0) return NULL;
  
  newNode=(struct node*)malloc(sizeof(struct node));
  newNode->id=id;
  newNode->parentNode=NULL;
  newNode->rightChild=NULL;
  newNode->leftChild=NULL;
    
  nodes[num_nodes++]=newNode;
  return newNode;
}
   
void insert(struct node* z){
   
  struct node* y = NULL;
  struct node* x = root;
  
  while(x != NULL){
    y = x;
    if(z->id < x->id){
      x = x->leftChild;
    }else{
      x = x->rightChild;
    }
  }
  z->parentNode = y;
  if(y == NULL){
    root = z;
  }else{
    if(z->id < y->id){
      y->leftChild = z;
    }else{
      y->rightChild = z;
    }
  }
   
}
   
void printNodes(void){
     
  inOrder(root);
  printf("\n");
  preOrder(root);
  printf("\n");
  
}
 
int findNode(int searchingId, struct node* nd){
     
    if(nd->id == searchingId) return 1;
    if(nd->id < searchingId && nd->rightChild){
        return findNode(searchingId, nd->rightChild);
    }
    if(nd->id > searchingId && nd->leftChild){
        return findNode(searchingId, nd->leftChild);
    }
    return 0;
     
}
   
void preOrder(struct node* nd){
  printf(" %d",nd->id);
  if(nd->leftChild){
    preOrder(nd->leftChild);
  }
  if(nd->rightChild){
    preOrder(nd->rightChild);
  }
   
}
   
void inOrder(struct node* nd){
  if(nd->leftChild){
    inOrder(nd->leftChild);
  }
  printf(" %d",nd->id);
  if(nd->rightChild){
    inOrder(nd->rightChild);
  }
   
}

Measured memory_bytes: 11000
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール
string ask(ll q) {
    string ans;
    cout << q << endl;
    cin >> ans;
    if (ans == "Vacant") exit(EXIT_SUCCESS);
    return ans;
}

// 処理内容
int main() {
    
    ll n; cin >> n;
    
    string ans_f = ask(0);
    string ans_b = ask(n-1);

    ll left = 0;
    ll right = n-1;

    while (1) {
        ll mid = (left + right) / 2;
        string ans_m = ask(mid);
        if ((ans_m == ans_f) ^ ((mid - left) % 2 == 0)) {
            right = mid;
            ans_b = ans_m;
        } else {
            left = mid;
            ans_f = ans_m;
        }
    }
    
}

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

using namespace std;

#define MAX_N 200000

using ll = long long;
ll tbl[2 * 100000 +1] = {0};
vector <ll> v;

using ll = long long;
int main(){
  ll n;
  cin >> n;
  cin.ignore();

  

  ll tmp_a;
  for (ll i = 0; i < n; i++){
    cin >> tmp_a;
    ++tbl[tmp_a];
    v.push_back(tmp_a);
  }

  ll ans = 0;
  for(int i = 1; i <= n; i++){
    if(tbl[i] <= 1) continue;
    ans += (tbl[i] * (tbl[i]-1)) / 2;
  }

  ll ans_tmp;
  for(ll i = 0; i < v.size(); i++){
    tmp_a = v[i];
    if(tbl[tmp_a] <= 1){
      printf("%lld\n", ans);
      continue;
    }
    ans_tmp = ans - (tbl[tmp_a] * (tbl[tmp_a] - 1)) / 2 + ((tbl[tmp_a]-1) * (tbl[tmp_a]-2)) / 2;
    printf("%lld\n", ans_tmp);
  }

  return 0;
}
  


Measured memory_bytes: 4848
#include <cstdio>
#include <string>
#include <iostream>
#include <math.h>

using namespace std;



void reduce(int arr[64][64], int lead[64], int* d) {
    for(int i = 0; i < *d-1; i++) {
        if(arr[*d-1][lead[i]]==1) {
            for(int k = lead[i]; k < 64; k++) {
                arr[*d-1][k] = arr[*d-1][k]^arr[i][k];
            }
        }
    }
    int t = 0;
    for(int i = 0; i < 64; i++) {
        if(arr[*d-1][i]!=0) {
            t = 1;
            lead[*d-1] = i;
            break;
        }
    }
    if(t==0) {
        *d = *d-1;
        return;
    }

    for(int i = *d-2; i >=0; i--) {
        if(lead[i+1]<lead[i]) {
            for(int j = 0; j < 64; j++) {
                t = arr[i][j];
                arr[i][j] = arr[i+1][j];
                arr[i+1][j] = t;
            }
            t = lead[i];
            lead[i] = lead[i+1];
            lead[i+1] = t;
        } else return;
    }
    return;
}


int solve() {
    int n;
    cin>>n;
    long *a = new long[n];
    for(int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    string s;
    cin>>s;

    int arr[64][64];
    int lead[64];
    int d = 0;
    int t;
    long temp;
    for(int i = s.length()-1; i >=0; i--) {
        t = d;
        temp = a[i];
        for(int j = 63; j >=0; j--) {
            arr[d][j] = temp%2;
            temp/=2;
        }
        d++;
        reduce(arr,lead,&d);

        if(s[i]=='1'&&t!=d) return 1;
    }
    return 0;


}


int main(void){

    

    long t;
    cin >>t;
    string ans;

    for(int i = 0 ; i < t; i++) {
        cout<<solve()<<"\n";
    }






    return 0;
}

Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define pi acos(-1.0)/*
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second*/
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)


int main()
{

    ll a,b,c,k,i,ans=0,v;

    cin>>a>>b>>c>>k;

    v = min(a,k);
    k = k-v;

    ans += v;

    v = min(k,b);
    k = k-v;

    ans = ans -0*v;


    v = min(k,c);

    ans = ans -1*v;

    cout<<ans;


    return 0;
}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();
		int[] A = new int[N];
		float votes = 0;
		for (int i = 0; i < N; i++) {
			A[i] = scan.nextInt();
			votes += A[i];
		}

		Arrays.sort(A);
		int k = A[N-M];

		if (k >= votes/(4*M)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 35736
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}

using Graph = vector<vector<pair<int, int>>>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> b(n);
    rep(i, n) cin >> b[i];
    vector<int> aa(n);
    vector<int> bb(n);
    vector<int> cc(n,1);
    if(n==1&&b[0]==a[0]){cout<<1<<endl;}
    else if(n==1){cout<<0<<endl;}
    else{
        aa[0]=1;
        bb[n-1]=1;
        Rep(i,1,n){
            if(a[i-1]<a[i]) aa[i]=1;
        }
        for(int i=n-2;i>=0;i--){
            if(b[i]>b[i+1]) bb[i]=1;
        }
        int dame=0;
        ll ans=1;
        rep(i,n){
            if(aa[i]==1&&bb[i]==1){
                if(a[i]!=b[i]) dame++;
            }
            else if(aa[i]==bb[i]){
                cc[i]=min(a[i],b[i]);
            }
            else{
                if(aa[i]==1){
                    if(a[i]<=b[i]){
                        cc[i]=1;
                    }
                    else{
                        dame++;
                    }
                }
                if(bb[i]==1){
                    if(b[i]<=a[i]){
                        cc[i]=1;
                    }
                    else{
                        dame++;
                    }
                }
            }
            ans*=cc[i];
            ans%=MOD;
            //cout<<aa[i]<<" "<<bb[i]<<" "<<cc[i]<<endl;
        }
        if(dame==0){
            cout<<ans<<endl;
        }
        else{
            cout<<0<<endl;
        }
    }
}

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

int main(void){
    int n;
    while(cin>>n, n){
        bool on = 0, l = 0, r = 0;
        int cnt = 0;
        rep(i,n){
            string s;
            cin>>s;
            if(s[0]=='l') l ^= 1;
            if(s[0]=='r') r ^= 1;
            if(l==r && on^l){
                on ^= 1;
                cnt++;
            }
        }
        cout<<cnt<<endl;
    }
}



Measured memory_bytes: 3164
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
        String s = sc.next();
        String[] sArray = s.split("");
        int i = 0;
      	for(i = 0; i < a;i++){
 		try {
        	Integer.parseInt(sArray[i]);
        	} catch (NumberFormatException e) {
          	System.out.println("No");
          	System.exit(0);
   			}
        }
      	if(!sArray[a].equals("-")){
            System.out.println("No");
            System.exit(0);
          }
      	for(i = a + 1; i < a + b + 1;i++){
 		try { 
        	Integer.parseInt(sArray[i]);
        	} catch (NumberFormatException e) {
          	System.out.println("No");
      	    System.exit(0);
   			}
        }
      	System.out.println("Yes");

	}
}

Measured memory_bytes: 35828
A, B, C, D, E, F = map(int, input().split())

ws = set()
ss = set()
for a in range(0, F+1, A*100):
    for b in range(0, F+1-a, B*100):
        ws.add(a + b)

for c in range(0, F+1, C):
    for d in range(0, F+1-c, D):
        ss.add(c + d)

mx = -1
ans = 0, 0
for w in ws:
    if w == 0:
        continue
    for s in ss:
        x = s * 100 / w
        if w + s <= F and x <= E and mx < x:
            mx = x
            ans = s + w, s

print(*ans)


Measured memory_bytes: 3188
n, l = map(int, input().split())
a = []
for i in range(l, n + l):
    a.append(i)
if a[0] > 0:
    b = a.pop(0)
elif a[n - 1] < 0:
    b = a.pop(n - 1)
else:
    for j in range(n):
        if a[j] == 0:
            b = a.pop(j)
            break
print(sum(a))

Measured memory_bytes: 9156