akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MOD 1000000007
#define MOD2 1000000009
#define endl "\n"
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vll std::vector<int>

int main()
{   
    IOS;
        #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
        #endif


   string s, t;
   cin >> s >> t;

   s = s + t[t.size() - 1];

   if(t == s) 
        cout << "Yes";
    else
        cout << "No";
   


        
        
    


return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}

#define PRINT_VECTOR_MAX 100
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)min(v.size(),PRINT_VECTOR_MAX); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)min(v.size(),PRINT_VECTOR_MAX); i++) {for (ll j = 0; j < (ll)min(v[i].size(),PRINT_VECTOR_MAX); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();
int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}
void Main(){
    int n, q; cin >> n >> q;
    int xm, ym;
    xm = n; ym = n;
    vector<int> xrev(n,-1), yrev(n,-1);
    ll ans = (ll)(n-2) * (n-2);
    Rep(q){
        int c,x; cin >> c >> x;
        if(c == 1){
            xm = min(xm, x);
            if(xrev[x] > 0){
                ans -= (ll)xrev[x] - 2;
            }else{
                ans -= (ll)ym - 2;
                for(int i = x+1; i < n; i++){
                    if(xrev[i] > 0) break;
                    xrev[i] = ym;
                }
            }
        }else{
            ym = min(ym, x);
            if(yrev[x] > 0){
                ans -= (ll)yrev[x] - 2;
            }else{
                ans -= (ll)xm - 2;
                for(int i = x+1; i < n; i++){
                    if(yrev[i] > 0) break;
                    yrev[i] = xm;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

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

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

    int ans = 0;
    while(n--){
        int d;
        cin >> d;
        if (s.find(d) == s.end()){
            ans++;
            s.insert(d);
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
   int N;
   cin>>N;
   stack<int> stk;
  
   for(int i=0;i<N;i++){
      int A;
      cin>>A;
      if(A==stk.size()+1){
         stk.push(A);
      }
   }
   
  if(stk.size()==0){
     cout<<-1<<endl;
  }
  
  if(stk.size()>0){
     cout<<N-stk.size()<<endl;
  }
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <cmath>
#include <climits>

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

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

int main(int argc, char const* argv[])
{
  int a, b;
  cin >> a >> b;
  cout << 100 << " " << 100 << endl;
  for(int i = 0; i < 100; i++){
    for(int j = 0; j < 100; j++){
      if(i < 50){
        // bg: black
        if(a > 1 && (i + j) % 2 == 0 && i % 2 == 0){
          cout << ".";
          a--;
        }
        else cout << "#";
      }else{
        if(b > 1 && (i + j) % 2 == 0 && i % 2 == 1){
          cout << "#";
          b--;
        }
        else cout << ".";
      }
    }
    cout << endl;
  }
	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] a = new int[n];
		for(int i=0; i < n; i++){
			a[i] = scanner.nextInt();
		}

		int val = a[0];
		int now = 0;
		int count = 1;
		while(true){
			if(val == 2){
				System.out.println(count);
				break;
			}
			now = val -1;
			val = a[val-1];
			a[now] = -1;
			count++;
			if(val == -1){
				System.out.println(-1);
				break;
			}
		}
	}
}


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

bool is_prime[2000000];
bool is_nita[2000000];

vector<int> nita;

void sieve(int n) {
	for (int i = 0; i <= n; i++) is_prime[i] = true;
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= n; i++) {
		if (is_prime[i]) {
			for (int j = 2 * i; j <= n; j += i) is_prime[j] = false;
		}
	}
}

void is_2017(int n) {
	for (int i = 2; i <= n; i++) {
		if (is_prime[i]) {
			if (is_prime[(i + 1) / 2]) is_nita[i] = true;
		}
	}
}

void dainyuu(int n) {
	for (int i = 0; i <= n; i++) {
		if (is_nita[i]) {
			nita.push_back(i);
		}
	}
}


int main()
{
	memset(is_prime, false, sizeof(is_prime));
	memset(is_nita, false, sizeof(is_nita));
	int Q = 0;

	int L[100000];
	int R[100000];
	memset(L, 0, sizeof(L));
	memset(R, 0, sizeof(R));

	cin >> Q;
	for (int i = 0; i < Q; i++) {
		cin >> L[i] >> R[i];
	}
	sieve(1000000);
	is_2017(1000000);
	dainyuu(1000000);
	for (int i = 0; i < Q; i++) {
		int count = 0;
		int LN = 0;
		int RN = 0;
		bool lflag = false;
		for (int j = 0; j < nita.size(); j++) {
			if (!lflag) {
				if (nita[j] >= L[i]) {
					lflag = true;
					LN = j;
				}
			}
			if (lflag) {
				if (nita[j] > R[i]) {
					RN = j;
					break;
				}
			}
		}
		cout << RN - LN << endl;
	}
    return 0;
}



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

int main() {
  int k = 0, u = 0, p = 0, c = 0;
  string s;

  cin >> s;

  for(int i = 0; i < s.size(); i++) {
    if(s[i] == 'K')k++;
    else if(s[i] == 'U')u++;
    else if(s[i] == 'P')p++;
    else if(s[i] == 'C')c++;
  }

  int cnt = 0;
  while(k > 0 && u > 0 && p > 0 && c > 0) {
    cnt++;
    k--;
    u--;
    p--;
    c--;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1192
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - 105
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;

typedef long long ll;

const int INF = 1 << 30;
const ll LINF = 1LL << 60;

/* typedef */

/* global variables */

/* subroutines */

int divnum(int n) {
  int c = 0;
  for (int i = 1; i * i <= n; i++)
    if (n % i == 0) {
      int j = n / i;
      c += (i != j) ? 2 : 1;
    }
  return c;
}

/* main */

int main() {
  int n;
  scanf("%d", &n);

  int c = 0;
  for (int i = 1; i <= n; i += 2)
    if (divnum(i) == 8) c++;
  printf("%d\n", c);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ass 1e18
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;
#define debug2(x,y) cout<<#x<<": "<< x<< ", "<< #y<< ": "<< y<< endl;
#define debug3(x,y,z) cout<<#x<<": "<< x<< ", "<< #y<< ": "<< y<<" "<<#z<<" : "<<z<< endl;
using namespace std;
typedef long long int ll;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
ll arr[200005];

int main()
{
	boost
	ll t,n,x,cnt;
	cin>>t;
	cout<<pow(t,3);
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s , t;
    cin >> s >> t ;
    int sz = s.size();
    for(int i = 0 ; i< sz ; i++){
        for(int j = 0 ; j < sz - 1 ; j++){
            swap(s[j],s[j+1]);
           // cout << s <<endl;

        }
         if(s == t)
                break;
    }

    if( s == t ){
        cout << "Yes"<<endl;
    }
    else {
        cout << "No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*GOD     IS    GREAT,
  SO    AM    I*/
#include<bits/stdc++.h>
#include<numeric>
using namespace std;
#define ll long long int
#define ford(i,a,n) for(long long int i=a;i<n;++i)
#define fore(i,a,n) for(long long int i=a;i<=n;i++)
#define foru(i,a,n) for(long long int i=a;i>=n;i--)
#define test ll t;cin>>t;while(t--)
#define op(z) cout<<z<<endl
#define ops(z) cout<<z<<" "
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(vec) (vec).begin(),(vec).end() 
#define debug(x) cout<<#x<<" "<<x<<endl
#define pp pair<ll,ll>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define maxe 1000000
#define MOD 1000000007
ll prime[maxe] = {0},ans=0;
// TO COUNT THE DIGIT IN A NUMBER => floor(log(n)/log10+1)
ll pwe(ll a, ll b) {
    if (b == 0)
        return 1;
    ll res = pwe(a, b / 2);
    res *= res; res %= MOD;
    if (b % 2)
        return (res * a) % MOD;
    else
        return (res );
}

void file()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
ll sumofdigits(ll n) {
    ll sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
void sieve()
{
    prime[0] = 0;
    prime[1] = 0;
    prime[2] = 1;
    ll i, j, k;
    for (i = 3; i <= maxe; i += 2)
    {
        prime[i] = 1;
    }
    for (i = 3; i <= maxe; i++)
    {
        if (prime[i])
        {
            for (j = i * i; j <= maxe; j += 2 * i)prime[j] = 0;
        }
    }
}
bool cmp(pp &a, pp &b)
{
    if (a.first != b.first)
    {
        return b.first > a.first;
    }
    else
    {
        return b.second > a.second;
    }
}
void solve()
{
  ll n,sum=0,ma;
  cin>>n;
  vector<ll> v(n);
  ford(i,0,n)cin>>v[i];
  ma=v[0];
  ford(i,1,n)
  {
    if(ma<v[i])ma=v[i];
    if(v[i]<ma)sum+=(ma-v[i]);
    //debug(sum);
  }
  op(sum);
}
int main()
{
    fastIO
    //sieve();
    //file();
    //test
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4684
using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[][] red = Enumerable.Repeat(0, n).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).OrderBy(x => x[0]).ToArray();
        int[][] blue = Enumerable.Repeat(0, n).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).OrderBy(x => x[0]).ToArray();
        //R,Bは一行2つ以上存在しない
        //それぞれの軸ごとに見て貪欲に取っていく
        //一番xが小さい青について見る
        //xについてはどこでもいいので、yが一番小さい奴を選ぶ
        //x以下で一番yが小さい赤を取る

        //一行に2つない制約を活かしたい
        //
        bool[] redIsUsed = new bool[red.Length];
        bool[] blueIsUsed = new bool[blue.Length];
        for (int i = 0; i < blue.Length; i++)
        {
            int[] minblue = blue[i];
            int maxRedy = -1;
            int minRedInd = -1;
            for (int j = 0; j < red.Length; j++)
            {
                if (!redIsUsed[j] && red[j][0] < minblue[0] && red[j][1] < minblue[1] && maxRedy < red[j][1])
                {
                    maxRedy = red[j][1];
                    minRedInd = j;
                }   
            }
            if (minRedInd != -1)
            {
                blueIsUsed[i] = true;
                redIsUsed[minRedInd] = true;
            }
        }
        Console.WriteLine(redIsUsed.Count(x => x));
    }
}

Measured memory_bytes: 13524
N,T,A,*H = map(int, open(0).read().split())
B=[]
ans = -1;
minim = 10000000000000000;
for i in range(N):
  B.append(T - H[i] * 0.006)
for i in range(N):
  if(abs(B[i]-A) < minim):
    ans = i+1
    minim = abs(B[i]-A)

print(ans)

Measured memory_bytes: 3064
n,k = map(int,input().split())
ans = [0]*n
result =0
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in a:
        ans[j-1] += 1
for i in ans:
    if 0 == i:
        result += 1
print(result)


Measured memory_bytes: 9180
#include <stdio.h>
#define MAX_N 101

double t[MAX_N], v[MAX_N];

double max(double a, double b)
{
    return a > b? a: b;
}

double min(double a, double b)
{
    return a < b? a: b;
}

int main(void)
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%lf", &t[i]);
    for (int i = 0; i < n; i++)
        scanf("%lf", &v[i]);
    double cur = 0.;
    double ans = 0.;
    for (int i = 0; i < n; i++) {
        double inc, kep, dec;
        double lim = 1.E8;
        double tmp = 0.;
        for (int j = i + 1; j <= n; j++) {
            lim = min(lim, v[j] + tmp);
            tmp += t[j];
        }
        inc = min(v[i] - cur, (lim + t[i] - cur) * .5);
        inc = min(inc, t[i]);
        dec = max(0., cur + inc - lim);
        kep = t[i] - inc - dec;
        ans += .5 * (cur * 2. + inc) * inc;
        ans += (cur + inc) * kep;
        ans += .5 * ((cur + inc) * 2. - dec) * dec;
        cur += inc;
        cur -= dec;
    }
    printf("%f\n", ans);
    return 0;
}


Measured memory_bytes: 1748
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
using namespace std;
int main()
{
    long long n,a,b;
    cin>>n>>a>>b;
    if(n%(a+b)==0)
    {
        cout<<(n/(a+b))*a;
    }
    else
    {
        long long t=n%(a+b);
        if(t<a)
            cout<<(n/(a+b))*a+t;
        else
            cout<<(n/(a+b))*a+a;
    }
return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;

ll a, b, c, d, e;
int main() {
	scanf("%lld %lld.%lld", &a, &b, &c);
	d = a * b;
	e = a * c / 100;
	cout << d + e;
	return 0;
}


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

int main()
{
  int n, m;
  cin >> n >> m;
  
  vector<int> p(n);
  rep(i, n) {cin >> p[i]; p[i]--;}
  
  vector<vector<int>> graph(n, vector<int>(0));
  rep(i, m)
  {
    int x, y;
    cin >> x >> y;
    x--; y--;
    graph[x].emplace_back(y);
    graph[y].emplace_back(x);
  }
  rep(i, n)
  {
    sort(graph[i].begin(), graph[i].end());
    graph[i].erase(unique(graph[i].begin(), graph[i].end()), graph[i].end());
    //for(int x : graph[i]) cout << x << " "; cout << endl;
  }
  
  vector<bool> visited(n, false);
  stack<int> stc;
  int res = 0;
  rep(i, n)
  {
    if(visited[i]) continue;
    stc.push(i);
    visited[i] = true;
    
    vector<int> key(0);
    set<int> val;
    
    while(stc.size())
    {
      int x = stc.top();
      stc.pop();
      
      key.emplace_back(x);
      val.insert(p[x]);
      
      for(int y : graph[x])
      {
        if(!visited[y])
        {
          stc.push(y);
          visited[y] = true;
        }
      }
    }
    
    for(int x : key)
    {
      if(val.find(x) != val.end()) res++;
    }
  }
  
  cout << res << endl;
  
  return 0;
}
  
  
  

Measured memory_bytes: 11256
#include<bits/stdc++.h>
using namespace std;
void solve(string x,string y)
{
	y.pop_back();
	cout<<(x==y?"Yes":"No")<<"\n";
}
int main()
{
 string s,t;
 cin>>s>>t;
 solve(s,t);
 return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int n;
int a[200010];
int aa[1000010];
int main(){
	scanf("%d",&n);
	rep(i,0,n)scanf("%d",a+i);
	rep(i,0,n)aa[a[i]]++;

	int ans=0;
	rep(i,0,n){
		int flag=aa[a[i]]==1;
		if(a[i]!=1)flag&=aa[1]==0;
		for(int d=2;d*d<=a[i];d++)if(a[i]%d==0)flag&=aa[d]==0&&aa[a[i]/d]==0;
		if(flag)ans++;
	}
	
	printf("%d",ans);
}

Measured memory_bytes: 6412
fun main(args: Array<String>) {
    val (H1, M1, H2, M2, K) = readLine()!!.split(" ").map(String::toInt)

    val time1 = H1 * 60 + M1
    val time2 = H2 * 60 + M2
    val time = time2 - time1
    val studyCount = time / K

    println((studyCount - 1) * K + (time % K))
}


Measured memory_bytes: 36368
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n;
    cin >> n;
    vint p(n);
    rep(i, n) cin >> p[i];

    vint q(n+1, 0);
    rep(i, n) {
        q[p[i]] = q[p[i]-1] + 1;
    }

    int ans = n - vmax(q);

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

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    int n, m;
    cin >> n >> m;
    int a[n];
    map<int, int, greater<>> d;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        d[a[i]]++;
    }


    ll ans = 0;
    while (m--) {
        auto it = d.begin();
        it->second--;
        d[it->first / 2]++;
        if (it->second == 0) d.erase(it);
    }

    for (auto e : d) {
        ans += (ll) e.first * e.second;
    }

    cout << ans;



}

Measured memory_bytes: 5376
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        System.out.println(str);
    }

    public static void main(String[] args) {

        int N;
        long K;
        int Q;
        int[] Ai;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            K = sc.nextLong();
            Q = sc.nextInt();
            Ai = new int[Q];
            for (int i = 0; i < Ai.length; i++) {
                Ai[i] = sc.nextInt();

            }
        }
        long[] Answer = new long[N];
        long[] Point = new long[N];
        for (int i = 0; i < Ai.length; i++) {
            Answer[ Ai[i] -1]++;
        }
        for(int i = 0; i < Point.length; i++){
            Point[i] = K - Q + Answer[i];
        }
        for(int i = 0; i < Point.length; i++){
            if(Point[i] > 0){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }

        }




    }

}


Measured memory_bytes: 57272
#include<stdio.h>
#define N 100
int main(){
  int i,j,u,k,n,v;
  int Adj[N][N];
  scanf("%d", &n);
  for(i = 0; i<n; i++){
    for(j = 0;j<n;j++){
      Adj[i][j] = 0;
    }
  }

  for(i = 0; i<n  ; i++){
    scanf("%d%d",&u,&k);
    for(j = 0; j<k ; j++){
      scanf("%d",&v);
    Adj[u-1][v-1] = 1;
  }
}

for(i=0; i<n; i++){
  for(j=0; j<n; j++){
    if(j>0){
      printf(" ");
    }
    printf("%d",Adj[i][j]);
  }
  printf("\n");
 }
return 0;
}



Measured memory_bytes: 2112
import sys
from pprint import pprint
readline = sys.stdin.readline

N = int(readline())
A = list(map(int, readline().split()))

inds = [v[1] for v in sorted([(a, i) for i, a in enumerate(A)], reverse=True)]

dp = [[0] * (N+1) for i in range(N+1)]
dp[0][0] = 0

for y in range(N + 1):
    for x in range(N - y + 1):
        if x == 0 and y == 0:
            continue
        
        t = inds[x + y - 1]
        if y == 0:
            dp[y][x] = dp[y][x - 1] + A[t] * (t - (x - 1))
        elif x == 0:
            dp[y][x] = dp[y - 1][x] + A[t] * ((N - y) - t)
        else:
            dp[y][x] = max(dp[y][x - 1] + A[t] * (t - (x - 1)),
                dp[y - 1][x] + A[t] * ((N - y) - t))

ans = max([dp[i][N - i] for i in range(N + 1)])

print(ans)

Measured memory_bytes: 101760
x, y = list(map(int, input().split(' ')))
# K馬(右上のみ) -> パスカルの三角形っぽい
mmm = 1000000000 + 7
sss = x + y
if sss % 3 != 0:
    print(0)
    exit()
hoge = sss // 3
# 上にp, 右にq
# 2p + q = y
# 2q + p = x
# p + q = hoge
# p = y - hoge
# q = x - hoge
p =  y - hoge
q = x - hoge
#print(hoge, p, q)
if p < 0 or q < 0:  # 3 0 の時で Wrong Answer
    print(0)
    exit()

# 二項係数 mod [検索]
fac = []
inv = []
inv_fac = []
def init(n):
    fac.append(1)
    fac.append(1)
    inv.append(0)
    inv.append(1)
    inv_fac.append(1)
    inv_fac.append(1)
    for i in range(2, n):
        fac.append(fac[-1] * i % mmm)
        inv.append(mmm - inv[mmm%i] * (mmm // i) % mmm)
        inv_fac.append(inv_fac[-1] * inv[-1] % mmm)

def choice(a, b):
    if a < b:
        return 0
    return fac[a] * (inv_fac[b] * inv_fac[a-b] % mmm) % mmm

init(hoge * 2 + 1)
print(choice(hoge, p) % mmm)

# nCk - TLE でした
# def choice(a, b):
#     if a == b or b == 0:
#         return 0
#     if a < b:
#         return choice(b, a)
#     bunshi = a
#     t = min(b, (a-b))
#     bunbo = t
#     for i in range(1, t):
#         bunshi *= (a-i) % mmm
#         bunbo *= (t-i) % mmm
#     return bunshi // bunbo


Measured memory_bytes: 167216
// Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector <ll> vec;
typedef pair <ll, ll> pr;
typedef pair <ll, pr> pr2;
typedef map <ll, vector<ll> > mv;

const int MX = 2e6+10;
const int mod = 1e9 + 7;
const ll inf = 1LL << 62;

int dx4[] = { 0, 0, -1, 1 };
int dy4[] = { 1, -1, 0, 0 };

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

// TOOLS
#define LCM(a,b)        (a / __gcd(a,b) ) *b
#define gcd(a,b)        __gcd(a,b)
#define all(x)          (x).begin(), (x).end()
#define mem(a, n)       memset(a, n, sizeof(a))
#define for1(i, n)      for(int i=1; i<=n; i++)
#define for0(i, n)      for(int i=0; i<n; i++)
#define rof0(i, n)      for(int i=n-1; i>=0; i--)
#define rof1(i, n)      for(int i=n; i>=1; i--)
#define forab(i, a, b)  for(int i=a; i<=b; i++)
#define rofab(i, a, b)  for(int i=b; i>=a; i--)
#define pb              push_back
#define pbb             pop_back

// CIN/COUT
#define sin(s)          getline(cin, s)
#define case(a)              cout << "Case "<<(a)<<": "

// SCANF/PRINTF
#define fYES            printf("YES\n")
#define fNO             printf("NO\n")
#define Scf(a)          scanf("%lld", &a)
#define Scf2(a, b)      scanf("%lld %lld", &a, &b)
#define Scf3(a, b, c)   scanf("%lld %lld %lld", &a, &b, &c)
#define Scf4(a,b,c,d)   scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
#define Pnf(a)          printf("%lld\n", a)
#define Pnf2(a, b)      printf("%lld %lld\n", a, b)
#define Pnf3(a, b, c)   printf("%lld %lld %lld\n", a, b, c)
#define Bug(n)          printf(">> %lld <<\n", n)

// OTHERS
#define sz(n)          n.size()
#define clr(v)          v.clear()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define in              freopen("input.txt", "r", stdin)
#define out             freopen("output.txt", "w", stdout)
#define FastIO          { ios_base::sync_with_stdio(false); cin.tie(0); }
#define F               first
#define S               second
#define mpp             make_pair
//End
int mark[100010],mark1[100010];
vector<ll > v,v1;
set<int>S;
int main()
{

    ll n, m, k, q, t, cnt = 0, sum = 0,ans=0, mx = -inf, mn = inf, a, b, c,d,e,f,g,h,i,j,x, y, z,temp, temp1;
    string s, s1, s2, s3,s4,s5,s6,s7;
    cin>>n;
    for0(i,n)
    {
        cin>>a;
        v.pb(a);
    }
    for0(i,n)
    {
        cin>>a;
        if(v[i]-a>0)
            ans+=v[i]-a;
    }
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main() {

        long long points,min;

        cin >> points >> min;

        int counter = points;


        while(points--){
                long long x , y ;
                cin >> x >> y;
                if (sqrt(x * x + y * y) > min){
                        counter --;
                }

                



        }

        cout << counter;



}

Measured memory_bytes: 3644
#include<iostream>
using namespace std;
signed main(){
  string s,c="CODEFESTIVAL2016";
  int count=0;
  cin>>s;
  for(int i=0;i<16;i++){
    if(s[i]!=c[i]){
      count++;
    }
  }
  cout<<count<<'\n';
  return(0);
}


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

vector<vector<pii>>graph;
int n;
vector<int> res;
// v: 頂点、p: 親、pc: vを塗る色、
void dfs(int v, int p, int pc){
    res[v] = pc;
    for(auto i:graph[v]){
        // (隣接頂点, 辺番号)
        if(i.first==p)continue;
        if(i.second%2==1)dfs(i.first, v, 1-pc);
        else dfs(i.first, v, pc);
    }
}
int main(){
    cin >> n;
    graph.assign(n, vector<pii>());
    res.assign(n, 0);
    rep(i, 0, n-1){
        int p, q, r;
        cin >> p >> q >> r;
        p--,q--;
        graph[p].push_back({q, r});
        graph[q].push_back({p, r});
    }
    int ans2=-1;
    dfs(0, -1, 0);
    for(auto i:res){
        cout << i << endl;
    }
}

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

int main(){
	int r,c,rr,cc,n;
	cin >> r >> c;
	rr=r+1;
	cc=c+1;
	int a[rr+1][cc+1];
	for(int i=1;i<=rr;i++){
		for(int j=1;j<=cc;j++){
			a[i][j]=0;
		}
	}
	for(int i=1;i<=r;i++){
		for(int j=1;j<=c;j++){
			cin >> n;
			a[i][j]=n;
			a[i][cc]+=n;
		}
	}
	for(int i=1;i<=rr;i++){
		for(int j=0;j<=cc;j++){
			a[rr][j]+=a[i][j];
		}
	}
	for(int i=0;i<=cc;i++){
		a[rr][i]=a[rr][i]/2;
	}
	for(int i=1;i<=rr;i++){
		for(int j=1;j<=cc;j++){
			cout <<a[i][j];
			if(j==cc){
				cout << endl;
			}else{
				cout << " ";
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  ll a, b;
  cin >> a >> b;
  if ((a + b) % 2 != 0) {
    P("IMPOSSIBLE");
  } else {
    P((a + b) / 2);
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
long long int a,s,d,f[1000][1000],g[1000][1000],k[1000][1000],h,i,j;
int main(void)
{
	scanf("%d %d %d",&a,&s,&d);
	for(i=0;i<a;i++){
		for(j=0;j<s;j++){
			scanf("%lld",&f[i][j]);
		}
	}
	for(i=0;i<s;i++){
		for(j=0;j<d;j++){
			scanf("%lld",&g[i][j]);
		}
	}
	for(i=0;i<a;i++){
		for(h=0;h<d;h++){
			for(j=0;j<s;j++){
				k[i][h]+=f[i][j]*g[j][h];
	//			printf("  %d\n",k[i][h]);
			}
		}
	}
	for(i=0;i<a;i++){
		for(j=0;j<d;j++){
			printf("%lld",k[i][j]);
			if(j!=d-1)
				printf(" ");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 4024
/*
    @Author
       Sujeet Kushwaha
    */
     
    #include <bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define fast ios_base::sync_with_stdio(false)
    #define fast_input cin.tie(NULL)
    #define fast_output cout.tie(NULL)
    // #define vi vector<long long int> 
    #define pb push_back
    #define mp make_pair
    #define pp pop_back
    #define iter vector<int>::iterator
    #define pa pair<long long int ,long long int> 
    #define f(a,b) for(int a=0;a<b;a++)
    #define mod 1000000007
    #define F first
    #define S second
    #define sett set<long long int>
    #define um unordered_map<ll,ll>
    ll powmod(ll a, ll b)
    {
        ll res = 1;
        while (b) {
            if (b&1) {
                res *= a;
            }
            b >>= 1;
            a = (a * a);
        }
     
        return res;
    }
     
    // ll modInv(ll a)
    // {
    //     return powmod(a, mod - 2);
    // }
    // int fastread(){
    //     int x=0;
    //     int c = getchar_unlocked();
    //     while(c<48)
    //         c = getchar_unlocked();
    //     while(c>=48){
    //         x = x*10 + (c - 48);
    //         c = getchar_unlocked();
    //     }
    //     return x;
    // }
    ll b[100005];
    void solve()
    {
      ll n;
      cin>>n;
       string s;
      cin>>s;
      if(n%2)
         cout<<"No"<<endl;
     else
     {
       ll flag=0;
       for(int i=0;i<n/2;i++)
       {
         if(s[i]==s[i+n/2])
         {
            continue;
         }
         flag=1;
       }
       if(flag==0)
         cout<<"Yes"<<endl;
       else
         cout<<"No"<<endl;
     } 
    }
    int main() {
    	fast;
    	fast_input;
    	fast_output;
    // 	ll t;
    // 	cin>>t;
    // 	while(t--)
    // 	{
    	  solve();
    // 	}
    	return 0;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
#define l long long
#define pb push_back
#define mem(a,n) memset(a,n,sizeof(a))
#define find(v,n) find(v.begin(),v.end(),n)
#define sort1(v) sort(v.begin(),v.end())
#define lb(v,n) lower_bound(v.begin(),v.end(),n)-v.begin()
#define ub(v,n) upper_bound(v.begin(),v.end(),n)-v.begin()
#define mod 1000000007
#define reverse(s) reverse(s.begin(),s.end())
//#define pi pair<l,l> 
const double pi=3.141592653589793;
bool isprime(l n)
{
	for(l i=2;i*i<=n;i++)
	{
		if(n%i==0)
			return false;
	}
	return true;
}
/*bool fact(l n)
{
	vector<l> v;
	for(l i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			if(i%2==1||(n/i)%2==1)
			{
				return true;
			}
		}
	}
	return false;
}*/
l power(l a,l b)
{
	l ans=1;
	while(b>0)
	{
		if(b&1)
		{
			ans=(ans*a)%mod;
		}
		b>>=1;
		a=(a*a)%mod;
	}
	return ans%mod;
}//prefixsums*/
/*vector<vector<l> > c(100000);
void dfs(vector<l> v[],l root,bool vis[])
{
	vis[root]=true;
	//cout<<root<<"\n";
	for(l i=0;i<v[root].size();i++)
	{
		if(vis[v[root][i]]==false)
		{
			c[root].pb(v[root][i]);
			dfs(v,v[root][i],vis);
		}
	}
}*/
void frooty()
{
	 l n;
	 cin>>n;
	 if(n%2==0)
	 {
	 	cout<<-1<<"\n";
	 }
	 else
	 {
	 	l count=1;
	 	l k=7;
	 	while(true)
	 	{
	 		if(k%n==0)
	 		{
	 			cout<<count<<"\n";
	 			break;
			}
			if(count>n)
			{
				cout<<-1<<"\n";
				break;
			}
			k=(k%n)*10+7;
			count++;
		}
	 }
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int q=1;
	//cin>>q;
	//q++;
	for(int i=0;i<q;i++)
	{
		frooty();
	}
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>

int main()
{
    int n, k, q;
    std::cin >> n >> k >> q;

    int scorer[q], player[n+1];

    for(int i = 1; i <= n; i++)
    {
        player[i] = 0;
    }

    for(int i = 0; i < q; i++)
    {
        std::cin >> scorer[i];

        player[scorer[i]]++;
        k--;
    }

    for(int i = 1; i <= n; i++)
    {
        player[i] += k;

        if(player[i] > 0)
        {
            std::cout << "Yes" << std::endl;
        }
        else
        {
            std::cout << "No" << std::endl;
        }
    }

    return 0;
}


Measured memory_bytes: 1408
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = sorted(zip(B, A))
B, A = zip(*C)
D = sorted((a, i) for i, a in enumerate(A))
E, indices = zip(*D)
for e, b in zip(E, B):
  if e > b:
    print("No")
    exit()
S = {0}
now = 0
for _ in range(n-1):
  if indices[now] in S:
    print("Yes")
    exit()
  now = indices[now]
  S.add(now)
for i in range(n-1):
  if E[i+1] <= B[i]:
    print("Yes")
    exit()
print("No")

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

using ll=long long; 

void solve(){
	int h,w;
	cin>>h>>w;
	vector<string> s(h);
	for(auto& e:s)cin>>e;
	for(int i=0; i<w+2; i++)cout<<"#";
	cout<<endl;
	for(auto e:s)cout<<"#"<<e<<"#"<<endl;
	for(int i=0; i<w+2; i++)cout<<"#";
	cout<<endl;
}

signed main(){
	//while(1)
	solve();
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int f=0,g,i,j;
  int w,h;
  while(cin>>h&&h){
    cin>>w;
    string s[101][101];
    int a[101][101];
    int n=0;
    for(i=0;i<h+1;i++){
      for(j=0;j<w+1;j++){
	cin>>s[j][i];
	if(s[j][i]=="?")
	  n++;
      }
    }
    

    do{
      g=0;
      for(i=0;i<h;i++){
	int sm=0;
	int ct=0;
	for(j=0;j<w;j++){
	  if(0){
	  }else if(s[j][i]=="!"){
	    sm+=a[j][i];
	  }else if(s[j][i]=="?"){
	    ct++;
	  }else{
	    sm+=atoi(s[j][i].c_str());
	  }
	}
	if(ct==1){
	  for(j=0;s[j][i]!="?";j++);
	  a[j][i]=atoi(s[w][i].c_str())-sm;
	  s[j][i]="!";
	  n--;
	  g=1;
	}
      }
      for(i=0;i<w;i++){
	int sm=0;
	int ct=0;
	for(j=0;j<h;j++){
	  if(0){
	  }else if(s[i][j]=="!"){
	    sm+=a[i][j];
	  }else if(s[i][j]=="?"){
	    ct++;
	  }else{
	    sm+=atoi(s[i][j].c_str());
	  }
	}
	if(ct==1){
	  for(j=0;s[i][j]!="?";j++);
	  a[i][j]=atoi(s[i][h].c_str())-sm;
	  s[i][j]="!";
	  n--;
	  g=1;
	}
      }  
    }while(n&&g);
    if(f)
      cout<<endl;
    else
      f=1;
    if(n){
      cout<<"NO"<<endl;
    }else{
      for(i=0;i<h;i++){
	for(j=0;j<w;j++){
	  if(s[j][i]=="!")
	    cout<<a[j][i]<<endl;
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#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;
#define M1 					1000000007
#define M2 					998244353
#define ll 					long long int
#define pll 				pair<ll,ll>
#define mll 				map<ll,ll>
#define F 					first
#define S 					second
#define PB 					push_back
#define mp 					make_pair
#define lb 					lower_bound
#define ub 					upper_bound
#define V(a) 				vector<a>
#define endl 				'\n'
#define test(t) 			while(t--)
#define PI 					acos(-1.0)
#define rep(i,a,b) 			for(ll i=a;i<b;i++)
#define repp(i,b,a) 		for(ll i=b-1;i>=a;i--)
#define clr(ar, val)		memset(ar, val, sizeof(ar))
#define setbits(x) 			__builtin_popcountll(x)
#define zrobits(x) 			__builtin_ctzll(x)
#define ps(x,y) 			fixed << setprecision(y) << x
#define all(x) 				begin(x),end(x)
#define allr(x) 			rbegin(x),rend(x)
#define pr(a) 				cout<<a<<endl;
#define pr2(a,b) 			cout<<a<<" "<<b<<"\n"
const int inf= 				0x3f3f3f3f;
const ll INF= 				0x3f3f3f3f3f3f3f3f;
const int dx[4]= 			{ 0, -1, 0, 1 };
const int dy[4]= 			{ -1, 0, 1, 0 };

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>
#define o_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll CalculateMex(set<ll> Set){
    ll Mex = 0;
    while(Set.find(Mex)!=Set.end()){
        Mex++;
    }
    return Mex;
}

ll floor_div(ll a, ll b) {
	return a / b - (((a ^ b) < 0) and a % b);
}
ll ceil_div(ll a, ll b){
    return a / b + (((a ^ b) >= 0) and a % b);
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);   
	    freopen("output.txt","w",stdout);
	#endif 
}

void solve()
{
    string n;
  cin >> n;
   	if (n[0] == '7' or n[1] == '7' or n[2]=='7') cout << "Yes";
  else cout << "No";

}

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    test(t){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3644
import math
A,B,C,D = map(int,input().split())

E = C*D // math.gcd(C,D)

i = B//C
j = B//D
k = (A-1)//C
l = (A-1)//E
n = (A-1)//D
m = B//E

res = B-(A-1)-(i-k)-(j-n)+(m-l)
print(res)

Measured memory_bytes: 9188
#!/usr/bin/env python3
n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = map(int,input().split())
ret = 0
for t in T:
  ok = 0
  ng = n
  while ng-ok > 1:
    mid = (ok+ng)//2
    if t < S[mid]:
      ng = mid
    else:
      ok = mid
  if S[ok]==t:
    ret += 1
print(ret)


Measured memory_bytes: 16716
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<double>prob(n);
  for(auto &i:prob)cin>>i;
  double dp[n+1][n+1];
  memset(dp,0,sizeof(dp));
  dp[0][0]=1;
  for(int i=1;i<=n;i++){
    dp[i][0]=dp[i-1][0]*(1-prob[i-1]);
  }
  for(int i=1;i<=n;i++){
    for(int j=1;j<=i;j++){
      dp[i][j]=prob[i-1]*dp[i-1][j-1]+(1-prob[i-1])*dp[i-1][j];
    }
  }
  double answer=0;
  for(int i=n/2+1;i<=n;i++){
    answer+=dp[n][i];
  }
  // for(int i=0;i<=n;i++){
  //   for(int j=0;j<=n/2+1)
  // }
  cout<<setprecision(9)<<answer;
  cout<<endl;
}

Measured memory_bytes: 74060
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < q; i++) {
		    int x = sc.nextInt();
		    if (arr[0] >= x) {
		        sb.append(0).append("\n");
		        continue;
		    }
		    int left = 0;
		    int right = n;
		    while (right - left > 1) {
		        int m = (left + right) / 2;
		        if (arr[m] < x) {
		            left = m;
		        } else {
		            right = m;
		        }
		    }
		    sb.append(right).append("\n");
		}
		System.out.print(sb);
	}
}



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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
typedef pair<int,int> P;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

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

  int n,k;
  string s;
  cin >> n >> k >> s;
  vector<int> v;
  string a = "10";
  bool f = 0;
  int cnt = 0;
  REP(i,n) {
    if (s[i] == a[f]) cnt++;
    else {
      v.pb(cnt);
      f = !f;
      cnt = 1;
    }
  }
  int sum[100010] = {};
  if (cnt) v.pb(cnt);
  if (f) v.pb(0);
  if (sz(v) <= k * 2 + 1) {
    cout << n << endl;
  } else {
    REP(i,sz(v)) {
      sum[i+1] = v[i];
      sum[i+1] += sum[i];
    }
    int ans = 0;
    for (int i = k * 2 + 1; i <= sz(v); i += 2) {
      ans = max(ans,sum[i] - sum[i-k*2-1]);
    }
    cout << ans << endl;
  }
  return 0;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  int d = 0;
  while (n) {
    n /= k;
    d++;
  }
  cout << d << endl;
  return 0;
}

Measured memory_bytes: 3500
N,D=map(int,input().split())
X=[0]*N
Y=[0]*N
A=0
for i in range(N):
  X[i],Y[i]=list(map(int,input().split()))
for i in range(N):
  if ((X[i])**2+(Y[i])**2)**0.5<=D:
    A=A+1
print(A) 


Measured memory_bytes: 24664
#include <stdio.h>

int main() {
  int a[101][101] = {0};
  int b[101] = {0};
  int d[101] = {0};
  int i,j,r,c;
  int x;
  int e = 0;

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

  for(j=0; j<r; j++) {
    for(i=0; i<c; i++) {
      scanf("%d",&x);
      a[j][i] = x;
    }
  }

  for(j=0; j<r; j++){
    for(i=0; i<c; i++) {
      b[i] += a[j][i];
    }
  }

  for(j=0; j<r; j++){
    for(i=0; i<c; i++){
      d[j] += a[j][i];
    }
  }

  for(j=0; j<r; j++) {
    for(i=0; i<c; i++) {
      printf("%d ",a[j][i]);
    }
    printf("%d\n", d[j]);
  }
  for(i =0; i<c; i++) {
    printf("%d " ,b[i]);
    e += b[i];
  }
  printf("%d\n", e);

  return 0;
}



Measured memory_bytes: 2064
#include <iostream>
#include <vector>
 
int main()
{
    int64_t A, B, N;
    std::cin >> A >> B >> N;
 
    auto maxX = std::min(B-1, N);
    std::cout << (A * maxX / B) - A * (maxX / B) << std::endl;
}


Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX_N 15
int n, m, a[MAX_N][MAX_N];
void Rotate( int r, int c, int& size){
  int next[size][size];
  for(int i = 0 ; i < size ; i++ ){
    for(int j = 0 ; j < size ; j++ ){
      next[i][j] = a[r + size - j - 1][c + i];
    }
  }
  for(int i = 0 ; i < size ; i++ ){
    for(int j = 0 ; j < size ; j++ ){
      a[r + i][c + j] = next[i][j];
    }
  }
}
void Reversal(int r,int c,int &size){
  for(int i  = 0 ; i < size ; i++ ){
    for(int j = 0 ; j < size ; j++ ){
      a[r + i][c + j] = !a[r + i][c + j];
    }
  }
}
void Left_shift( int r){
  rotate( a[r], a[r] + 1, a[r] + n);
}
void Right_shift( int r){
  rotate( a[r], a[r] + n - 1, a[r] + n);
}
static const int dy[] = { 1, 0, -1, 0}, dx[] = { 0, 1, 0, -1};
bool used[15][15];
void Island_revesal( int y, int x){
  if(used[y][x]++) return;
  a[y][x] = !a[y][x];
  for(int i = 0 ; i < 4 ; i++ ){
    int ny = y + dy[i], nx = x + dx[i];
    if( ny >= 0 && ny < n && nx >= 0 && nx < n && a[ny][nx] != a[y][x]){
      Island_revesal( ny, nx);
    }
  }
}
int main(){
  cin >> n >> m;
  for(int i = 0 ; i < n ; i++ ){
    for(int j = 0 ; j < n ; j++ ){
      cin >> a[i][j];
    }
  }
  while( m-- ){
    int o;
    cin >> o;
    if(o == 0){
      int r, c, size, angle;
      cin >> r >> c >> size >> angle;
      for(int i = 0 ; i < angle ; i += 90 ) Rotate( r - 1, c - 1, size);
    }else if(o == 1){
      int r, c, size;
      cin >> r >> c >> size;
      Reversal( r - 1, c - 1, size);
    }else if(o == 2){
      int r;
      cin >> r;
      Left_shift( r - 1);
    }else if(o == 3){
      int r;
      cin >> r;
      Right_shift( r - 1);
    }else{
      int r, c;
      for(int i = 0 ; i < n ; i++ )
        for(int j = 0 ; j < n ; j++ ) used[i][j] = false;
      cin >> r >> c;
      Island_revesal( r - 1, c - 1);
    }
  }
  for(int i = 0 ; i < n ; i++ ){
    for(int j = 0 ; j < n ; j++ ){
      cout << (j ? " " : "") << a[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 1196
(d, g), *s = [list(map(int, i.split())) for i in open(0)]
s = [[i[0] * -~n * 100 + i[1], i[0]] for n, i in enumerate(s)]
a = 10**3
for b in range(1 << d):
    su = sum(s[i][0] * (b >> i & 1) for i in range(d))
    n = sum(s[i][1] * (b >> i & 1) for i in range(d))
    if su < g:
        m = d-bin(b)[2:].zfill(d).find("0")
        e = (su-g)//(m*100)
        if -e < s[m-1][1]:
            a = min(a,n - e)
    if su >= g:
        a = min(a,n)
print(a)

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

using namespace std;

typedef long long ll;
const int maxn = 1e5 + 10, MOD = 1e9 + 7;
ll pos[maxn],fac[maxn],facm[maxn];

ll quick_pow(ll a,ll n,ll p)
{
    ll x = a;
    ll res = 1;
    while(n)
    {
        if(n & 1)
        {
            res = ((ll)res * (ll)x) % p;
        }
        n >>= 1;
        x = ((ll)x*(ll)x) % p;
    }
    return res;
}

ll C(ll n,ll k){
    if(k > n) return 0ll;
    if(k == n||k == 0) return 1ll;
    ll ans = fac[k]*fac[n-k]%MOD;
    ans = (fac[n]*quick_pow(ans,MOD-2ll,MOD))%MOD;
    return ans;
}

int main()
{
    fac[0] = 1;
    for(ll i = 1;i < maxn;i++)
        fac[i] = (fac[i-1]*i)%MOD;
	ll n;
	scanf("%lld", &n);
	n++;
	ll m, x;
	for(ll i = 1;i <= n;i++)
	{
		scanf("%lld", &x);
		if (pos[x])
		{
			m = n - (i - pos[x] + 1);
			break;
		}
		pos[x] = i;
	}
	for(ll i = 1;i <= n;i++)
		printf("%lld\n", (C(n, i) - C(m, i-1)+MOD) % MOD);
	return 0;
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

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

  if(a == b and b == c) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
p_list = list(map(int, input().split()))
count = 0
for i in range(1,len(p_list)-1):
    if p_list[i-1] < p_list[i] < p_list[i+1]:
        count += 1
    if p_list[i-1] > p_list[i] > p_list[i+1]:
        count += 1
print(count)

Measured memory_bytes: 3060