akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int n, m;

priority_queue<pair<int, ll>> pq;

map<int, vector<ll>> cnt;

ll ans;

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &m);

  for (int i = 0; i < n; ++i) {
    int a;
    ll b;
    scanf("%d %lld", &a, &b);

    cnt[a].push_back(b);
  }

  // for (auto &e: cnt) {
  //   sort(e.second.begin(), e.second.end());
  // }

    // while (!pq.empty()) {
    //   auto cur = pq.top(); pq.pop();

    //   int remain = -1 * cur.first;      
    //   int reward = cur.second;

    //   printf("%d %d\n", remain, reward);
    // }

  ans = 0LL;

  priority_queue<ll> pq;

  for (int i = 1; i <= m; ++i) {
    if (cnt.find(i) != cnt.end()) {
      for (auto &e: cnt[i]) {
        pq.push(e);
      }
    }

    if (!pq.empty()) {
      auto cur = pq.top(); pq.pop();
      ans += cur;
    }        
  }

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 10880
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


struct BinaryIndexedTree{
    ll n;
    vector<ll>dat;
    BinaryIndexedTree(ll n=0):n(n){
        dat.resize(n+1);
    }
    void add(ll k,ll x){
        for(k++;k<=n;k+=k&-k)dat[k]+=x;
    }
    ll sum(ll k){
        ll ret=0;
        for(k++;k;k-=k&-k)ret+=dat[k];
        return ret;
    }
};



ll N;
ll A[111111];

ll S[111111];


bool check(ll x){
    ll K=(N*(N+1)/2)/2;
    
    for(int i=0;i<N;i++){
        S[i+1]=S[i];
        if(A[i]<x)S[i+1]++;
        else S[i+1]--;
    }
    
    vector<ll>vs;
    rep(i,N+1)vs.push_back(S[i]);
    sort(all(vs));vs.erase(unique(all(vs)),vs.end());
    rep(i,N+1)S[i]=lower_bound(all(vs),S[i])-vs.begin();
    
    ll cnt=0;
    BinaryIndexedTree bit(N+114);
    
    rep(i,N){
        bit.add(S[i],1LL);
        cnt+=bit.sum(S[i+1]-1);
    }
    
    return cnt<=K;
}

int main() {
    cin>>N;
    rep(i,N)cin>>A[i];
    
    ll lb=0,ub=1001001001;
    while(ub-lb>1){
        ll mid=(ub+lb)/2;
        if(check(mid))lb=mid;
        else ub=mid;
    }
    cout<<lb<<endl;
    return 0;
    
    return 0;
}









Measured memory_bytes: 3680
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>

using namespace std;

int n;

int main(){
   scanf("%d",&n);
   cout<<"Christmas";
   for(int i=0;i<25-n;i++)printf(" Eve");
   cout<<endl;
}

Measured memory_bytes: 256
object Main extends App {
    val in = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))
    for (Array(n, r) <- in if n > 0 && r > 0) {
        val m = in.take(r).foldRight(0){case (Array(p, c), i) =>
            if (i >= p - 1 + c) i
            else if (i >= c) i - c
            else i + p - 1 
        }
        println(n - m)
    }
}

Measured memory_bytes: 48760
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <deque>

using namespace std;

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

	int n;
	cin >> n;

	char s[100];
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}

	int p = 0, w = 0, g = 0, y = 0;
	for (int i = 0; i < n; i++) {
		switch (s[i]) {
		case 'P':
			if (p == 0) {
				p++;
			}
			break;
		case 'W':
			if (w == 0) {
				w++;
			}
			break;
		case 'G':
			if (g == 0) {
				g++;
			}
			break;
		case 'Y':
			if (y == 0) {
				y++;
			}
			break;
		}
	}
	int t = p + w + g + y;
	if (t == 4) {
		cout << "Four" << endl;
	} else {
		cout << "Three" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <typename T>inline T read()
{
    register T sum=0;
    register char cc=getchar();
    int sym=1;
    while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
    if(cc=='-')sym=-1,cc=getchar();
    sum=sum*10+cc-'0';
    cc=getchar();
    while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
    return sym*sum;
}
template <typename T>inline T read(T &a)
{
    a=read<T>();
    return a;
}
template <typename T,typename... Others> inline void read(T& a, Others&... b)
{
    a=read(a);
	read(b...);
}
int n,ans;
int main()
{
	read(n);
	ans=n/500*1000;
	n%=500;
	ans+=n/5*5;
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
/* ちゃんと考えてわかって実装 */

int main(void){
    ll n, k;
    cin >> n >> k;

    vector<ll> x;
    for(int i=0; i<n; i++){
        int tmpx; cin >> tmpx;
        x.push_back(tmpx);
    }

    ll ans = 1e19;
    for(int l=0; l<=n-k; l++){
        int r = l+k-1;
        ll tmp_ans = min(abs(x[l])+abs(x[l]-x[r]), abs(x[r])+abs(x[l]-x[r]));
        ans = min(ans, tmp_ans);
    }

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

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
    cin>>a;
    b=a;
    reverse(a.begin(),a.end());
    for(int i=0;i<a.size();++i)
    {
        if(a[i]=='b') a[i]='d';
        else if(a[i]=='d') a[i]='b';
        else if(a[i]=='p') a[i]='q';
        else if(a[i]=='q') a[i]='p';
    }
    if(a==b) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<
//        pair<long long, int>, // change type
//        null_type,
//        less<pair<long long, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;
//template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
#define rep(i, start, end) for(int i = start; i < end; ++i)
#define sz(x) (int)(x).size()
#define pb push_back
#define h first
#define p second
#define all(x) x.begin(), x.end()
#define clr(d, v) memset(d, v, sizeof(d))
#define pii pair<int, int>
const double PI = 3.14159265358979323846;
const double eps = (1e-5);
int dcmp(long double x, long double y)
{
    if (abs(x - y) < eps)
        return 0;
    if (x > y)
        return 1;
    return -1;
}

int n;
const int MAX_N = 5005;
pair<int, int> a[MAX_N];
bool cmp(pair<int, int> &x, pair<int, int> &y)
{
    return min(x.h, y.h - x.p) > min(y.h, x.h - y.p);
}

long long mem[MAX_N][MAX_N];
#define INF 0x3F3F3F3F3F3F3F3F

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
////    freopen("facebook.txt", "w", stdout);
//#endif
    cin >> n;
    rep(i,0,n)
        cin >> a[i].h >> a[i].p;
    sort(a, a + n, cmp);

    clr(mem, 0x3F);
    rep(i,0,n)
        mem[i][0] = 0;

    mem[0][1] = a[0].p;
    for (int i = 1; i < n; ++i)
    {
        for (int pick = 1; pick <= i + 1; ++pick)
        {
            mem[i][pick] = mem[i - 1][pick];
            if (mem[i - 1][pick - 1] <= a[i].h)
                mem[i][pick] = min(mem[i][pick], mem[i - 1][pick - 1] + a[i].p);
        }
    }

    int ans = 0;
    for (int pick = 0; pick <= n; ++pick)
    {
        if (mem[n - 1][pick] < INF)
            ans = pick;
    }
    cout << ans;
    return 0;
}

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

const int N = 100;
int dp[N+1][N+1][2];

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

    int n;
    cin>>n;

    string s;
    cin>>s;
    int res=0;
    for(int i=2;i<n;i++){
        if(s[i-2]=='A'&&s[i-1]=='B'&&s[i]=='C') res++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF INT_MAX 
#define mod 1000000007
using namespace std;
int main(){
    int dp[100010];
    dp[0] = 0;
    for(int i=1;i<=100000;i++){
        dp[i] = INF;
        int t = 1;
        while(t <= i){
            dp[i] = min(dp[i],dp[i-t]+1);
            t *= 6;
        }
        int s = 1;
        while(s <= i){
            dp[i] = min(dp[i],dp[i-s]+1);
            s *= 9;
        }
    }
    int N;
    cin >> N;
    cout << dp[N] << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;


string s;
int ans;
char ch[100005];
int siz;

void func(int i, int j) {
	int x = i, y = j;
	while (ch[i] == 's'&&i>0) {
		i--;
	}
	while (ch[j] == 'j' &&j < siz - 1) {
		j++;
	}
	if ((ch[i] == '1'&&ch[j] == '0') ||
		(ch[i] == '0' && ch[j] == '1')
		) {
		ch[i]='s';
      	ch[j]='s';
      	ans++;
      	ans++;     
		if (i > 0 && j < siz - 1)	func(x - 1, y + 1);
	}
}

int main() {
	cin >> s;
  	siz=s.size();
	rep(i,siz){
    	ch[i]=s.at(i);
    }
	rep(i, siz-1) {
		if (ch[i] == 's') continue;

		func(i, i + 1);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;


/*
  dp[k][m]
    鍵 0-k までを使用して、パターンmを開ける場合に dp[k+1][m] 円必要

*/

ll N, M;
int dp[1001][1<<12];

int patterns[1<<12];
int pattern_count;
// mask & x == x となる全てのxをpatternsに入れる
void get_patterns( int mask ){
	pattern_count = 0;
	for ( int i = 0; i < mask; i++ ){
		if ( (mask & i) == i )
			patterns[pattern_count++] = i;
	}
}


int main(){
	cin >> N >> M;
	int N2 = (1<<N);
	
	vector<int> a(M);
	vector<int> m(M);
	for ( int i = 0; i < M; i++ ){
		int b;
		cin >> a[i] >> b;
		for ( int j = 0; j < b; j++ ){
			int c;
			cin >> c;
			m[i] |= (1<<(c-1));
		}
	}
	
	const int BIG = 200000000;
	for ( int k = 0; k <= M; k++ )
		for ( int p = 0; p < N2; p++ )
			dp[k][p] = (p==0) ? 0 : BIG;
	
	
	for ( int k = 0; k < M; k++ ){
		int ak = a[k];
		int mk = m[k];
		get_patterns(mk);
		
		for ( int p = 0; p < N2; p++ ){
			if ( (p & mk) == mk ){ // 鍵kを使う場合
				int d = dp[k][p];
				for ( int i = 0; i < pattern_count; i++ ){
					d = min( d, ak+dp[k][(p&~mk)|patterns[i]] );
				}
				dp[k+1][p] = d;
			}
			else {
				dp[k+1][p] = dp[k][p];
			}
		}
		
		//for ( int p = 0; p < N2; p++ )
		//	cout << (dp[k+1][p] == BIG ? -1 : dp[k+1][p]) << " ";
		//cout << endl;
	}
	
	
	
	cout << (dp[M][N2-1] == BIG ? -1 : dp[M][N2-1]) << endl;
	
	return 0;
}



Measured memory_bytes: 16256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;

int main(){
  int n,m;
  cin >> n >> m;
  VI l(m),r(m);
  rep(i,m){
    cin >> l[i] >> r[i];
  }
  
  int left=0, right=n+1;
  rep(i,m){
    left = max(left, l[i]);
    right = min(right, r[i]);
  }
  
  cout << max(0, (right-left+1)) << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring> 
#include <iostream>
#include <algorithm>
using namespace std;

int N, K, ans = 0;

int main()
{
	scanf("%d%d", &N, &K);
	while(N > 0)
	{
		++ans;
		N /= K;
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main()
{
   ll n,a,b;
   cin>>n>>a>>b;
  
   ll c = n/(a+b);
   ll ans = c*a;
   ll rem = n%(a+b);
   ans = ans+min(rem,a);
   cout<<ans<<"\n";
   return 0;
 }

Measured memory_bytes: 256
#include <stdio.h>
main(){
  int a[9],b[9],c[9];
  /*[0]:oÐ,Ô [1]:oÐ,ª [2]:oÐ,b [3]:ÞÐ,Ô [4]:ÞÐ,ª [5]:ÞÐ,b[6]:ÝÐ,Ô [7]:ÝÐ,ª [8]:ÝÐ,b*/

  scanf("%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]);
  scanf("%d%d%d%d%d%d",&b[0],&b[1],&b[2],&b[3],&b[4],&b[5]);
  scanf("%d%d%d%d%d%d",&c[0],&c[1],&c[2],&c[3],&c[4],&c[5]);

  a[6]=a[3]-a[0];
  b[6]=b[3]-b[0];
  c[6]=c[3]-c[0];

  a[7]=a[4]-a[1];
  b[7]=b[4]-b[1];
  c[7]=c[4]-c[1];

  a[8]=a[5]-a[2];
  if(a[8]<0){
    a[7]--;
    a[8]+=60;
  }

 b[8]=b[5]-b[2];
  if(b[8]<0){
    b[7]--;
    b[8]+=60;
  }

 c[8]=c[5]-c[2];
  if(c[8]<0){
    c[7]--;
    c[8]+=60;
  }
 
  if(a[7]<0){
    a[6]--;
    a[7]+=60;
  }

  if(b[7]<0){
    b[6]--;
    b[7]+=60;
  }

  if(c[7]<0){
    c[6]--;
    c[7]+=60;
  }

  printf("%d %d %d\n%d %d %d\n%d %d %d\n",a[6],a[7],a[8],b[6],b[7],b[8],c[6],c[7],c[8]);

return 0; 
}

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

int main() 
{
  int N;
  cin >> N;
  int a = N / 1000;
  int b = (N - a * 1000) / 100;
  int c = (N - a * 1000 - b * 100) / 10;
  int d = N - a * 1000 - b * 100 - c * 10;
  
  if (a == b && b == c) cout << "Yes" << endl;
  else if (b == c && c== d) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
a=[]
for i in range(N):
	A=int(input())
	B=[]
	for i in range(A):
		b=list(map(int,input().split()))
		B.append(b)
	a.append(B)
ans=0
for i in range(2**N):
	bi=list(str(bin(i)))
	bi=bi[2:]
	bi=[0]*(N-len(bi))+bi
	bi=list(map(int,bi))
	p=1
	for j in range(N):
		if bi[j]==1:
			for k in range(len(a[j])):
				m=a[j][k][0]
				n=a[j][k][1]
				if bi[m-1]!=n:
					p=0
					break
	if p==1:
		ans=max(ans,sum(bi))
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int a,b,n,sum;
  while(scanf("%d %d %d",&a,&b,&n)!=EOF){
    sum = 0;
    for(int i=0,k=a%b*10;i<n;i++){
      sum += k/b;
      k = k % b * 10;
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 1208
import std.stdio,
       std.string,
       std.conv,
       std.algorithm;

void main() {
  int N = readln.chomp.to!(int);
  int[] buf = readln.chomp.split.to!(int[]);
  int D = buf[0], X = buf[1];
  int[] A;
  for (int i = 0; i < N; i++) {
    A ~= readln.chomp.to!(int);
  }

  int ans;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j * A[i] + 1 <= D; j++) {
      ans++;
    }
  }

  writeln(ans + X);
}


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

using namespace std;

long long powMod(long long x, long long k, long long m) {
    if (k == 0) return 1;
    if (k % 2 == 0) return (powMod(x * x % m, k / 2, m) + m) % m;
    else return (x * powMod(x, k - 1, m) + m) % m;
}

long long MOD = 1e9 + 7;

int main() {

    long long n, k;
    cin >> n >> k;

    cout << powMod(k, n, MOD) << endl;
    return 0;
}


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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n)
  {
    cin >> p[i];
  }
  int ans = n - k + 1;
  set<int> s;
  rep(i, k)
  {
    s.insert(p[i]);
  }

  for (int i = k; i < n; i++)
  {
    int mintemp, maxtemp;
    s.insert(p[i]);
    mintemp = *s.begin();
    maxtemp = *(--s.end());
    if ((mintemp == p[i - k]) && (maxtemp == p[i]))
      ans--;
    s.erase(p[i - k]);
  }
  int sortcount = 0;
  int count = 0;
  for (int i = 1; i < n; i++)
  {
    if (p[i - 1] < p[i])
    {
      count++;
    }
    else
    {
      if (count - (k - 2) > 0)
        sortcount++;
      count = 0;
    }
    cerr << count << " " << sortcount << endl;
    if ((i == n - 1))
    {
      if (count - (k - 2) > 0)
        sortcount++;
    }
  }
  if (sortcount >= 2)
    ans -= sortcount - 1;

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


Measured memory_bytes: 10368
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (unsigned int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    ll A,B,C,D,N;
    ll ans=0;
    string S;
    bool F;
int main(){
    cin>>S;
    cout<<(S[2]==S[3]&&S[4]==S[5]?"Yes":"No")<<endl;



    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        long min = Long.MAX_VALUE;
        long amari = 0;

        min = n%k;
        if(min > k-min){
            min = k-min;
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <string>
#include <functional>
 
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};
const double pi = acos(-1);
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){cout << a << " " << b << " " << c << endl;}
#define INT_MAX 1<<30;
const int MAX = 1020000;
const double EPS = 1e-6;
const int mod = 1e9+7;
 
int main(){
    ll x,y; cin >> x >> y;
    ll ans = 1;
    while(x*2<=y){
        ans++;
        x *= 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
int const M=1e6+10,M2=1e6+10,M3=1e3+10,inf=1e9+10,mod=1e9+7;
main()
{
	int n;
	cin>>n;
	int tmp=n;
	int sum=0;
	while(tmp!=0)
		sum+=tmp%10,tmp/=10;
	if(n%sum==0)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.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))

ll n,m;
int main(){
	scanf("%lld%lld",&n,&m);
	m/=1000;
	rep(i,0,2001)rep(j,0,2001){
		ll k=n-i-j;
		if(k>=0&&10*i+5*j+k==m){
			printf("%lld %lld %lld\n",i,j,k);
			return 0;
		}
	}
	puts("-1 -1 -1");
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
//const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(ll& x, ll y) {
	x = min(x, y);
}

void chmax(ll& x, ll y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

ll a, b, n, x;

void solve() {
	cin >> a >> b >> n;
	if (n < b - 1) x = n;
	else x = b - 1;
 	cout << a * x / b - a * (x / b) << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


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

int main() {
  char c;
  int a = 0, b = 0;
  for (int i = 0; i < 3; i++) {
    cin >> c;
    if (c == 'A')
      a++;
    else
      b++;
  }

  if (a == 0 || b == 0)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
A, B, M = (int(x) for x in input().split())
al = [int(x) for x in input().split()]
bl = [int(x) for x in input().split()]
ml = [[int(x) for x in input().split()] for _ in range(M)]
"""
price = []
for l in ml:
    price.append(al[l[0]-1] + bl[l[1]-1] - l[2])
for x in al:
    for y in bl:
        price.append(x+y)
"""
price = [al[l[0]-1] + bl[l[1]-1] - l[2] for l in ml] + [min(al)+min(bl)] 
print(min(price))

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


void solve(long long T, long long X){
	printf("%lf\n", double(T) / double(X));
}

int main(){
    long long T;
    scanf("%lld",&T);
    long long X;
    scanf("%lld",&X);
    solve(T, X);
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<30)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long



signed main(){
	int n,l;
	cin>>n>>l;
	int ans=INF,sum=0;
	int ag;
	lp(i,n){
		if(ans>abs(l+i)){
			ans=abs(l+i);
			ag=l+i;
		}
		sum+=(l+i);
	}
	cout<<sum-ag<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque

v,e,r=map(int, input().split());

edge_info=[0]*v;
for i in range(v):
    edge_info[i] = []

for i in range(e):
    e1, e2, w = map(int, input().split());
    edge_info[e1].append((e2,w))

v_q=deque();

INF = 9999999999999999999
d = [INF for i in range(v)]
d[r] = 0
v_q.append((0,r))
while(len(v_q) != 0):
    cost,u = v_q.popleft()
    if(cost > d[u]):
        continue
    for j in range(len(edge_info[u])):
        e2,w = edge_info[u][j]
        alt = cost+w
        if(d[e2] > alt):
            d[e2] = alt
            v_q.append((alt,e2))

for i in range(v):
    if(d[i] != INF):
        print(d[i])
    else:
        print("INF")


Measured memory_bytes: 90060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(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));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll f(ll n,ll m){
	//puta(n/m);
	return n/m;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b,c,d,e;
	cin>>a>>b>>c>>d;
	e=lcm(c,d);
	cout<<(b-a+1)-((f(b,c)-f(a-1,c))+(f(b,d)-f(a-1,d))-(f(b,e)-f(a-1,e)))<<endl;
}


Measured memory_bytes: 256
N = int(input())
G = [[] for i in range(N)]
for i in range(N-1):
  u, v, w = list(map(int, input().split()))
  u -= 1
  v -= 1
  w = w % 2
  G[u].append([v, w])
  G[v].append([u, w])
  
res = [-1] * N
"""
def dfs(u, p, c):
  res[u] = c
  for n in G[u]:
    if n[0] == p or res[n[0]] != -1:
      continue
    if n[1] == 1:
      dfs(n[0], u, 1-c)
    else:
      dfs(n[0], u, c)
"""
from collections import deque
q = deque()
# 再帰はメモリ的に厳しい？？
def search(q):
  while q:
    u, p, c = q.popleft()
    if res[u] == -1:
      for n in G[u]:
        if n[0] == p or res[n[0]] != -1:
          continue
        if n[1] == 1:
          q.append((n[0], u, 1-c))
        else:
          q.append((n[0], u, c))
    res[u] = c
  
  
def main():
  q.append((0, -1, 1))
  search(q)
  for i in res:
    print(i)
  
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 42532
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

#define MAX

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, D;
	
	cin>>N>>D;
	
	cout<<(N+D*2)/(D*2+1)<<endl;
	
	return 0;
}


Measured memory_bytes: 256
a, b = list(map(int, input().split()))
if a > b:
    a, b = b, a
if 0 < a or (b < 0 and (b - a) % 2 == 1):
    print('Positive')
elif a <= 0 and 0 <= b:
    print('Zero')
else:
    print('Negative')


Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
 
priority_queue<ll> ret;
void divisor(long long n)
{
 
    for (long long i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push(i);
            if (i * i != n)
                ret.push(n / i);
        }
    }
    // sort(ret.begin(), ret.end()); // 昇順に並べる
}
 
int main()
{
    //最大公約数を求める。
    ll n, m;
    cin >> n >> m;
    divisor(m);
    ll k = 0;
    ll u=ret.size();
    while (1)//計算量1をn回
    {
      if (ret.top() < n){
      	break;
      }
        k = ret.top();
        ret.pop();//計算量logn
      if (ret.empty()){
           break;
      }
    }
  
    cout << m/k  << endl;
}


Measured memory_bytes: 256
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            if (s.Contains("RRR"))
                Console.WriteLine(3);
            else
            {
                if (s.Contains("RR"))
                    Console.WriteLine(2);
                else
                {
                    if (s.Contains("R"))
                        Console.WriteLine(1);
                    else
                        Console.WriteLine(0);
                }
            }
        }
    }
}



Measured memory_bytes: 25876
#include <stdio.h>
#include <math.h>
#include <iostream>
#include<string>
#include<vector>
#include <algorithm>
#define REP(a,b) for (int i = a; i <= (b); i++)
using namespace std;
int main() {
	int a,b,c,d;
	cin >> a >> b>>c;
  d=a-b;
	
		cout << d % c << endl;
	}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Xi Lin
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        static public int mod = (int) (1e9 + 7);

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            boolean mark[] = new boolean[n + 1];
            for (int i = 0; i <= n; ++i) mark[i] = true;
            for (int i = 2; i <= n; ++i)
                if (mark[i]) {
                    for (int j = i + i; j <= n; j += i) mark[j] = false;
                }
            long r = 1;
            for (int i = 2; i <= n; ++i)
                if (mark[i]) {
                    int c = 0;
                    for (long p = i; p <= n; p *= i) c += n / p;
                    r = r * (c + 1) % mod;
                }
            out.println(r);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 8404
s = input()
t = input()
counts = []
countt = []
alphabetlist = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i in alphabetlist:
    counts.append(s.count(i))
    countt.append(t.count(i))
if sorted(counts) == sorted(countt):
    print("Yes")
else:
    print("No")


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

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

  int count_N=0;
  int count_M=0;

  if(N>=2){
    count_N=N*(N-1)/2;
  }
  if(M>=2){
    count_M=M*(M-1)/2;
  }
  cout << count_N + count_M << endl;
}


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

ans = 0
for left in range(K + 1):
    for right in range(K + 1):
        if left > N - right or left + right > K:
            continue

        G = V[:left] + V[N - right:]
        G.sort()
        dis = 0
        for i, g in enumerate(G):
            if i >= K - (left + right) or g >= 0:
                break
            dis += g

        ans = max(ans, sum(G) - dis)

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int

int main()
{
    ll n, a[100000];
    int cnt, ans = 0;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    if (n == 1)
    {
        cout << (a[0] != 1) << endl;
        return 0;
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++)
    {
        if (i == 0)
            cnt = 1;
        else if (i == n - 1)
        {
            if (a[i] == a[i - 1])
            {
                cnt++;
            }
            if (cnt < a[i - 1])
            {
                ans += cnt;
            }
            else
            {
                ans += cnt - a[i - 1];
            }
            if (a[i] != a[i - 1])
            {
                ans += 1;
            }
        }
        else
        {
            if (a[i] == a[i - 1])
            {
                cnt++;
            }
            else
            {
                if (cnt < a[i - 1])
                {
                    ans += cnt;
                }
                else
                {
                    ans += cnt - a[i - 1];
                }
                cnt = 1;
            }
        }
        //cout << cnt << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func sum(n []int) int {
	a := 0
	for _, v := range n {
		a += v
	}
	return a
}

var ans float64

func calc(idx, n int, val float64, v []int) {
	if idx == n-2 {
		ans = (val + float64(v[idx+1])) / 2
		return
	}
	calc(idx+1, n, ((val + float64(v[idx+1])) / 2), v)
}

func main() {
	sc.Split(bufio.ScanWords)
	n := getInt()
	v := make([]int, n)

	for i := range v {
		v[i] = getInt()
	}
	sort.Ints(v)

	if n == 2 {
		fmt.Println(float64(v[0]+v[1]) / 2)
		return
	}
	calc(1, n, float64(v[0]+v[1])/2, v)
	fmt.Println(ans)
}


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

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

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int A, B;	
	cin >> A >> B;
  	int ans = max(A+B, A*B);
  	ans = max(ans, A-B);
  	cout << ans << endl;


}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#define P pair<long long, long long>


using namespace std;
const long long int MOD=1e9+7;

int main(){
  string s;
  cin >> s;
  if(s[0]==s[1] && s[1]==s[2]){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std ;
typedef long long int ll ;


int main(){
	ios;
	ll n,l,cnt=0,ai;
	cin>>n>>l;
	for(int i=0; i<n; i++){
		cin>>ai;
		if(ai>=l)cnt++;
	}
	cout<<cnt<<'\n';

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
long long dp[32][55][8];
int len[8];
int cnt[32];
int main()
{
	int n,c;
	scanf("%d%d",&n,&c);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&len[i]);
	}
	sort(len,len+n);
	n--;
	cnt[0]=0;
	for(int i=1;i<(1<<n);i++)
	{
		cnt[i]=cnt[i-(i&(-i))]+1;
	}
	dp[0][len[n]][0]=1;
	for(int i=0;i<c;i++)
	{
		for(int j=1;j<=n;j++)
		{
			for(int k=(1<<n)-1;k>=0;k--)
			{
				if(j>cnt[k]+1)
				{
					continue;
				}
				for(int l=i;l<=c;l++)
				{
					for(int m=0;m<=cnt[k];m++)
					{
						if(l<=i&&m<j)
						{
							continue;
						}
						int mm=m+(m>=j);
						for(int x=0;x<n;x++)
						{
							if(k&(1<<x))
							{
								continue;
							}
							int ll=i+len[x];
							if(ll>c)
							{
								ll=c;
							}
							if(ll*100+j>l*100+mm)
							{
								dp[k|(1<<x)][ll][j]+=dp[k][l][m];
							}
							else
							{
								dp[k|(1<<x)][l][mm]+=dp[k][l][m];
							}
						}
					}
				}
			}
		}
	}
	double ans=0;
	for(int i=0;i<=n;i++)
	{
		ans+=dp[(1<<n)-1][c][i];
	}
	for(int i=1;i<=n;i++)
	{
		ans/=c;
		ans/=i;
	}
	printf("%.16f\n",ans);
	return 0;
}

Measured memory_bytes: 256
#pragma comment (linker, "/STACK:256000000")
 
#define _USE_MATH_DEFINES
#define _CRT_NO_DEPRECEATE
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <memory.h>
#include <sstream>
#include <cassert>
#include <ctime>
#include <complex>
 
//#include <random>
 
using namespace std;
 
 
double PI = 3.1415926535897932384626433832795;
long double EPS = 1e-12;
 
typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
const int MOD = 1e9 + 7;
const int BASE = 1327; 
typedef pair<int, int> pii;
const int MAXN = 100100;

int b, a;
int mas[MAXN];
int was[MAXN];
int n, m;

void solve()
{
	cin >> n >> m;
	for(int i = 0; i < n; ++i)
		mas[i] = 1;
	was[0] = 1;
	for(int i = 0; i < m; ++i)
	{
		int x, y;
		cin >> x >> y;
		x--, y--;
		if (was[x])
		{
			was[y] = 1;
		}
		if (mas[x] == 1)
		{
			was[x] = 0;
		}
		mas[x]--;
		mas[y]++;
	}
	int ans = 0;
	for(int i = 0; i < n; ++i)
	{
		if (was[i])
			ans++;
	}
	cout << ans;
}

 
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _MY_DEBUG
    freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
#else
    //freopen(TASK ".in", "rt", stdin); freopen(TASK ".out", "wt", stdout);
#endif
    srand(1313);
	
	int t = 1;
	//cin >> t;
	
	
		solve();
	
	
    return 0;
}   

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

#define lld long long
#define pi pair<int,int>
#define pl pair<lld,lld>
#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())

int main() {
    lld N,K;
    lld A[200001];
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < N-K; i++) {
        if(A[i] < A[i+K]){
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 5196
# -coding UTF-8 -*-
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
P.sort()

count_a = 0
b_count = 0
i = 0
while i < N:
    if P[i] <= A:
        count_a += 1
    elif B < P[i]:
        b_count += 1
    i += 1

print(int(min(count_a, b_count, N - count_a - b_count)))


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

using namespace std;

int main() {
	int N;
	cin >> N;
	int stack = 0;
	for (int i = 0; i < 10; i++) {
		if (stack >= N) {
			break;
		}
		stack += 1000;
	}
	cout << stack - N;
}

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

N = int(input())
A = [int(x) for x in input().split()]
mod = 7 + 10 ** 9
from collections import Counter
c = Counter(A)
if N % 2 == 1:
    if c[0] != 1:
        print(0)
        sys.exit()
    for i in range(1, N):
        if i % 2 == 0 and c[i] != 2:
            print(0)
            sys.exit()
        elif i % 2 == 1 and c[i] != 0:
            print(0)
            sys.exit()
    print((2 ** (N // 2)) % mod)
else:
    for i in range(N):
        if i % 2 == 0 and c[i] != 0:
            print(0)
            sys.exit()
        elif i % 2 == 1 and c[i] != 2:
            print(0)
            sys.exit()
    print((2 ** (N // 2)) % mod)

Measured memory_bytes: 14628
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import java.util.Map.Entry;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        HashMap<Integer, HashMap<Integer, Integer>> map = new HashMap<>();
        int N = scan.nextInt();
        for(int i = 0; i < N; i++) {
            int A = scan.nextInt();
            HashMap<Integer, Integer> subMap = new HashMap<>();
            for(int j = 0; j < A; j++) {
                int x = scan.nextInt() - 1;
                int y = scan.nextInt();
                subMap.put(x,y);
            }
            map.put(i, subMap);
        }

        int ans = 0;
        long allPattern = (long)Math.pow(2.0, N);
        out: for(long i = 0; i < allPattern; i++) {
            int numOf1 = 0;
            for(int j = 0; j < N; j++) {
                if(((i >> j) & 1) == 1) {
                    numOf1++;
                    HashMap<Integer, Integer> subMap = map.get(j);
                    for(Entry<Integer, Integer> entry :subMap.entrySet()) {
                        if(((i >> entry.getKey()) & 1) != entry.getValue()) {
                            continue out;
                        }
                    }
                }
            }
            if(ans < numOf1)
                ans = numOf1;
        }

        os.println(ans);
    }

}

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

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

const long long MOD = 100000000;

int main(){
  int l,r;
  int ans=2020;
  cin >> l >> r;
  
  if(r-l>=2019) ans=0;
  else{
    for(int i=l;i<=r-1;i++){
      for(int j=i+1;j<=r;j++){
        int t=( (i % 2019) * (j % 2019) ) % 2019;
        ans=min(t,ans);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int N;
    double a, ans=0;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> a;
        ans+=(1.0/a);
    }
    
    printf("%.10lf",1.0/ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
 
int main(){

    string s;
    cin >> s;
    
    if (s[0] == 'S' && s[1] == 'U')
    {
        cout << 7;
    }
    if (s[0] == 'M')
    {
        cout << 6;
    }
    if (s[0] == 'T' && s[1] == 'U')
    {
        cout << 5;
    }
    if (s[0] == 'W')
    {
        cout << 4;
    }
    if (s[0] == 'T' && s[1] == 'H')
    {
        cout << 3;
    }
    if (s[0] == 'F')
    {
        cout << 2;
    }
    if (s[0] == 'S' && s[1] == 'A')
    {
        cout << 1;
    }

	return 0;
}

Measured memory_bytes: 256
using System;

namespace Murasa
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            String con = "AB";
            if (N >= 1000)
            {
                N -= 999;
                Console.WriteLine(con + "D");

            }
            else
            {
                Console.WriteLine(con + "C");
                
            }


        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <string.h>

const int max_dice_number = 105;

void toss_dice_x(int _dice[][7], int x, char direction){
    int temp;
    switch(direction){
        case 'N':
            temp = _dice[x][1];   
            _dice[x][1] = _dice[x][2];
            _dice[x][2] = _dice[x][6];
            _dice[x][6] = _dice[x][5];
            _dice[x][5] = temp;
        break;

        case 'S':
            temp = _dice[x][1];   
            _dice[x][1] = _dice[x][5];
            _dice[x][5] = _dice[x][6];
            _dice[x][6] = _dice[x][2];
            _dice[x][2] = temp;
        break;

        case 'E':
            temp = _dice[x][1];
            _dice[x][1] = _dice[x][4];
            _dice[x][4] = _dice[x][6];
            _dice[x][6] = _dice[x][3];
            _dice[x][3] = temp;
        break;
        
        case 'W':
            temp = _dice[x][1];
            _dice[x][1] = _dice[x][3];
            _dice[x][3] = _dice[x][6];
            _dice[x][6] = _dice[x][4];
            _dice[x][4] = temp;
        break;
    }
}

void counterclock_dicex_90(int _dice[][7], int x){
    toss_dice_x(_dice, x, 'E');
    toss_dice_x(_dice, x, 'S');
    toss_dice_x(_dice, x, 'W');
}


void print_dice(int _dice[][7], int dice_num){
    int i, j;
    for(i=0; i<dice_num; i++){
        for(j=1; j<=6; j++){
            _dice[i][j] -= 1;
            printf("%d ", _dice[i][j]);
        }
        printf("\n");
    }
    
}

int dice_i_compare_to_dice_j(int _dice[][7], int i, int j){
    int k;
    for(k=1; k<=6; k++){
        if(_dice[i][k]!=_dice[j][k]) return 0;
    }
    return 1;
}

int same_dice(int _dice[][7], int dice_i, int dice_j){
    int i, j;
    for(i=0; i<6; i++){
        if(i<4) toss_dice_x(_dice, dice_i, 'N');
        else if(i==4) toss_dice_x(_dice, dice_i , 'W');
        else{
            toss_dice_x(_dice, dice_i, 'E');
            toss_dice_x(_dice, dice_i, 'E');
        }

        for(j=0; j<4; j++){
            counterclock_dicex_90(_dice, dice_i);
            if(dice_i_compare_to_dice_j(_dice, dice_i, dice_j)) return 1;
        }
    }
    return 0;
}

int main(){
    
    int dice[max_dice_number][7];
    int dice_number;
    scanf("%d", &dice_number);

    int i,j;
    for(i=0; i<dice_number; i++){
        for(j=1; j<=6; j++){
            scanf("%d", &dice[i][j]);
        }
    }
    //print_dice(dice, dice_number);
    for(i=0; i<dice_number; i++){
        for(j=i+1; j<dice_number; j++){
            if(same_dice(dice, i, j)){
                printf("No\n");
                return 0;
            }
        }
    }
    printf("Yes\n");
}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define INF 2e8
#define all(a) a.begin(), a.end()
#define pb push_back
#define maxer max_element
#define miner min_element

int main() {
  int n, m, X, Y;
  cin >> n >> m >> X >> Y;

  vector<int> x, y;
  x.pb(X);
  y.pb(Y);

  rep(i, n) {
    int a;
    cin >> a;
    x.pb(a);
  }

  rep(i, m) {
    int a;
    cin >> a;
    y.pb(a);
  }

  cout << (*maxer(all(x)) < *miner(all(y)) ? "No War" : "War") << endl;
}


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

using namespace std;
long long x[10000010], y[10000010];
#define rep(i, n) for (int i = 0; i < (n); i++)
#define lep(j, n) for (int j = 0; j < (n); j++)
#define reps(i, n) for (int i = 1; i < (n); i++)
#define leps(i, n) for (int j = 1; j < (n); j++)
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define int long long
#define gsort(x, n) sort((x), (x) + (n), greater<int>());
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

signed main()
{

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

   string s;
   cin >> s;
   string a = "AC";

   if (s.find(a) != string::npos)
      cout << "Yes" << '\n';
   else
      cout << "No" << '\n';
}

Measured memory_bytes: 256