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

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair

using namespace std;

using uint=unsigned int;
using ll=long long;

uint xor128(){
	static uint d[]={1145141919,1919810893,810893364,364114514};
	uint t=d[0]^(d[0]<<11);
	REP(i,3)
		d[i]=d[i+1];
	return d[3]=d[3]^(d[3]>>19)^(t^(t>>8));
}

struct Node{
	Node *l,*r;
	uint pri;
	int s,v,mn;
} buf[200000];

using NP=Node*;

NP newNode(int v){
	static int c=0;
	buf[c]=Node{NULL,NULL,xor128(),1,v,v};
	return &buf[c++];
}

const int inf=1145141919;

inline int Mini(NP x){
	return x?x->mn:inf;
}

inline int Size(NP x){
	return x?x->s:0;
}

inline NP Update(NP x){
	x->s=Size(x->l)+Size(x->r)+1;
	x->mn=min({x->v,Mini(x->l),Mini(x->r)});
	return x;
}

inline NP LinkL(NP x,NP l){
	x->l=l;
	return Update(x);
}

inline NP LinkR(NP x,NP r){
	x->r=r;
	return Update(x);
}

inline NP CutL(NP x){
	x->l=NULL;
	return Update(x);
}

inline NP CutR(NP x){
	x->r=NULL;
	return Update(x);
}

inline NP Merge(NP a,NP b){
	static stack<pair<NP,bool>> pl;
	assert(pl.empty());
	while(a&&b){
		if(a->pri>b->pri){
			pl.push(MP(a,true));
			a=a->r;
		}else{
			pl.push(MP(b,false));
			b=b->l;
		}
	}
	NP t=a?a:b;
	while(!pl.empty()){
		NP p=pl.top().first;
		bool rch=pl.top().second;
		pl.pop();
		if(rch)
			LinkR(p,t);
		else
			LinkL(p,t);
		t=p;
	}
	return t;
}

using Res=Node;

inline Res Split(NP x,int k){
	if(k<=0)
		return Res{NULL,x};
	else if(x->s<=k)
		return Res{x,NULL};
	else if(k<=Size(x->l)){
		Res s=Split(x->l,k);
		return Res{s.l,Merge(s.r,CutL(x))};
	}else{
		Res s=Split(x->r,k-Size(x->l)-1);
		return Res{Merge(CutR(x),s.l),s.r};
	}
}

inline void Set(NP x,int k,int v){
	int ls=Size(x->l);
	if(k<ls)
		Set(x->l,k,v);
	else if(k==ls)
		x->v=v;
	else
		Set(x->r,k-ls-1,v);
	Update(x);
}

int read(){
	int i;
	scanf("%d",&i);
	return i;
}

NP t[200000];

int main(){
	int n=read(),q=read();
	REP(i,n)
		t[i]=newNode(read());
	while(n>1){
		int k=n/2;
		REP(i,k)
			t[i]=Merge(t[i*2],t[i*2+1]);
		if(k*2<n)
			t[k]=t[k*2];
		n=(n+1)/2;
	}
	NP root=t[0];
	REP(_,q){
		int x=read(),y=read(),z=read();
		if(x==0){
			Res s1=Split(root,y);
			Res s2=Split(s1.r,z+1-y-1);
			Res s3=Split(s2.r,1);
			root=Merge(Merge(s1.l,s3.l),Merge(s2.l,s3.r));
		}else if(x==1){
			Res s1=Split(root,y);
			Res s2=Split(s1.r,z+1-y);
			printf("%d\n",Mini(s2.l));
			root=Merge(s1.l,Merge(s2.l,s2.r));
		}else if(x==2){
			Set(root,y,z);
		}
	}
}

Measured memory_bytes: 11032
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

int main()
{
	string S;
	int d[110];
	cin >> S;
	bool atoz[26];
	for (int i = 0; i < 26; i++)
	{
		atoz[i] = false;
	}
		
	for (int i = 0; i < S.size(); i++)
	{
		atoz[(S[i] - 'a')] = true;
	}

	for (int i = 0; i < 26; i++)
	{
		if (!atoz[i])
		{
			cout << (char)(i + 'a') << endl;
			return 0;
		}
			
	}
	cout << "None" << endl;
	
}

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

int main () {
    int x, y;
    cin >> x >> y;

    double a = (double)(4 * x - y) / 2.0;
    double b = (double)(y - 2 * x) / 2.0;
    string ans = "";
    if (a == floor(a) && a >= 0 && b == floor(b) && b >= 0) {
        ans = "Yes";
    } else {
        ans = "No";
    }
    cout << ans << endl;
}




Measured memory_bytes: 3720
import java.util.Scanner;

class Main{
	static final long MOD = 1000000007;


	static long pow=1000000007;




	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int N =sc.nextInt();
		int[] a = new int[N];
		int[] b = new int[N];
		int[] c = new int[N];
		for(int i=0;i < N;i++){
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();			
		}
		int[][] dp = new int[N][3];
		dp[0][0] = a[0];
		dp[0][1] = b[0];
		dp[0][2] = c[0];
		if(N==1){
			System.out.println(Math.max(dp[N-1][0], Math.max(dp[N-1][1], dp[N-1][2])));
			return;
		}
		dp[1][0] = Math.max(dp[0][0], Math.max(dp[0][1], dp[0][2]))+a[1];
		dp[1][1] = Math.max(dp[0][0], Math.max(dp[0][1], dp[0][2]))+b[1];
		dp[1][2] = Math.max(dp[0][0], Math.max(dp[0][1], dp[0][2]))+c[1];

		for(int i = 2;i<N;i++){
			dp[i][0] = Math.max(dp[i-1][1], dp[i-1][2]) + a[i]; 
			dp[i][1] = Math.max(dp[i-1][0], dp[i-1][2]) + b[i]; 
			dp[i][2] = Math.max(dp[i-1][0], dp[i-1][1]) + c[i]; 
					
			
		}

		System.out.println(Math.max(dp[N-1][0], Math.max(dp[N-1][1], dp[N-1][2])));

	}
}







class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



Measured memory_bytes: 95808
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;


void solve(){
    string s;
    cin>>s;
    if(s == "ABC")cout<<"ARC";
    else cout<<"ABC";
}

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


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
using namespace std;

typedef long long int ll;
#define MOD 1000000007;
#define INF 1000000001

class Tree
{
	public:
//		Tree(int _root);
		int root;
		vector<int> next;
		int value = 0;
};
	
double dp[301][301][301];

	
double MemDP(int i,int j,int k, int N)
{
	if(dp[i][j][k]>=0) return dp[i][j][k];
	if(i==0&&j==0&&k==0) return 0.0;
	double ret=0.0;
	if(i!=0) ret+=MemDP(i-1,j,k,N)*i;
	if(j!=0) ret+=MemDP(i+1,j-1,k,N)*j;
	if(k!=0) ret+=MemDP(i,j+1,k-1,N)*k;
	ret+=N;
	ret/=(i+j+k);
	dp[i][j][k] = ret;
	return dp[i][j][k];
}

int main(void) {
	int N;	
	inp(N);
	vector<int> num(3,0);
	rep(i,N){
		int a;
		inp(a);
		num[--a]++;
	}
	rep(i,301)rep(j,301)rep(k,301) dp[i][j][k] = -1;
	cout << setprecision(16) << MemDP(num[0],num[1],num[2],N) << endl;

}


Measured memory_bytes: 213376
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct student
{
	int x;
	int i;
};
student a[100005];

int cmp(student a,student b)
{
	return a.x<b.x;
}
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].x;
		a[i].i=i+1;
	}
	sort(a,a+n,cmp);
	for(int i=0;i<n;i++)
	{
		cout<<a[i].i<<" ";
	}
	putchar(10);
	return 0;
 } 

Measured memory_bytes: 1536
import sys

input = sys.stdin.readline

h, w = map(int, input().split())
map_list = [[0 if s == '#' else 1 for s in input()[:-1]] for _ in range(h)]

h_map = []
for h_list in map_list:
    cnt = 0
    tmp_list = []
    for a in h_list:
        if a == 0:
            if cnt > 0:
                tmp_list.extend([cnt]*cnt)
                cnt = 0
            tmp_list.append(0)
        else:
            cnt += 1
    if cnt > 0:
        tmp_list.extend([cnt]*cnt)
    h_map.append(tmp_list)

w_map = []
for w_arr in [list(x) for x in zip(*map_list)]:
    cnt = 0
    tmp_list = []
    for a in w_arr:
        if a == 0:
            if cnt > 0:
                tmp_list.extend([cnt]*cnt)
                cnt = 0
            tmp_list.append(0)
        else:
            cnt += 1
    if cnt > 0:
        tmp_list.extend([cnt]*cnt)
    w_map.append(tmp_list)
w_map = [list(x) for x in zip(*w_map)]
max_l = 0
for h_list, w_list in zip(h_map, w_map):
    for h_num, w_num in zip(h_list, w_list):
        max_l = max(max_l, h_num + w_num)
print(max_l - 1)


Measured memory_bytes: 186120
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<chrono>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll dp[3001][3001];
signed main(){
  ll n,t,mid=0,tmp,ans=0;
  cin >> n >> t;
  set<ll> st;
  ll a[n],b[n];
  vector<P> v;
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
    v.push_back(P(a[i],b[i]));
  }
  sort(v.begin(),v.end());
  fill(dp[0],dp[3001],0);
  for(int i=0;i<n;i++){
    for(int j=0;j<t;j++){
      dp[i+1][j] = dp[i][j];
      if(j>=v[i].first&&dp[i+1][j]<=dp[i][j-v[i].first]+v[i].second){
        dp[i+1][j] = dp[i][j-v[i].first]+v[i].second;
      }
    }
  }
  for(int i=0;i<n;i++){
    ans = max(ans,dp[i][t-1]+v[i].second);
  }
  cout << ans << endl;
}


Measured memory_bytes: 70784
//In the name of ALLAH the most merciful the most beneficial

#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#include<fstream>
#define sc(x) scanf("%d",&x)
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORd(i,a,b) for(int i=a;i>b;i--)
#define ff first
#define ss second
#define sz(x) x.size()
#define pb push_back

using namespace std;

typedef pair<int,int> pii;
typedef vector<pii> vii;
const int con = 1e5+7;
static const int INF = 0x3f3f3f3f;
static const int MOD = 1e9+7;

int main(){
    /*
    clock_t start,end;
    start = clock();*/

    int arr[3];
    FOR(i,0,3)
        cin >> arr[i];
    sort(arr,arr+3);
    if(arr[0] == 5 && arr[1] == 5 && arr[2] == 7){
        cout << "YES";
    }else{
        cout <<"NO";
    }
    return 0;

    /*end = clock();
    double time = double(end-start)/(double)CLOCKS_PER_SEC;
    cout <<fixed<< time/1000 << "sec";*/
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#define MOD 1000000007
#define ll long long
 
int cmpfunc(const void *a, const void *b){
    return (*(int*)a - *(int*)b);
}
 
void swap(int *a, int *b);
 
int main(int argc, char **argv){
    int n,m,i;
    scanf("%d %d",&n,&m);
    if(n-m>=2 || m-n>=2){
        printf("0\n");
        return 0;
    }
    if(m==n){
        //2*(n!)^2
        ll x=1;
        for(i=1;i<=n;i++){
            x=x*i%MOD;
        }
        x=x*x%MOD;
        x=x*2%MOD;
        printf("%lld\n",x);
    } else {
        if(m<n) swap(&m,&n);
        //m-n=1
        //m!*n!
        ll x=1;
        for(i=1;i<=n;i++){
            x=x*i%MOD;
        }
        for(i=1;i<=m;i++){
            x=x*i%MOD;
        }
        printf("%lld\n",x);
    }
 
    return 0;
}
 
void swap(int *a, int *b){
    int tmp=*a;
    *a = *b;
    *b = tmp;
}

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

using namespace std;

char x;
int a,b;
bool f1,f2;

int main()
{
	cin >> x;
	a+=x-48;
	a*=10;
	cin >> x;
	a+=x-48;
	cin >> x;
	b+=x-48;
	b*=10;
	cin >> x;
	b+=x-48;
	if (a>0 && a<=12) f1=1;
	if (b>0 && b<=12) f2=1;
	if (f1==1 && f2==1) 
	{
		cout << "AMBIGUOUS" << endl;
		return 0;
	}
	if (f1==1 && f2==0) 
	{
		cout << "MMYY" << endl;
		return 0;
	}
	if (f1==0 && f2==1) 
	{
		cout << "YYMM" << endl;
		return 0;
	}
	if (f1==0 && f2==0) 
	{
		cout << "NA" << endl;
		return 0;
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
ll n,p,maxn=0,k,t;
int Judge(ll x,ll y){
	ll num=0;
	while(y%x==0){
		num++;
		y=y/x;
		if(num>=n)
		    break;
	}
	return num;
}
int main(){
	scanf("%lld %lld",&n,&p);
	if(n==1)
	    printf("%lld\n",p);
	else if(n>=40)
	    printf("1\n");
	else{
		for(ll i=2;;i++){
			k=pow(i,n);
			if(k>=p){
				t=i;
				break;
			}
		}
		for(ll i=2;i<=t;i++){
			ll x=Judge(i,p);
			if(x>=n)
			    maxn=i;
		}
		if(maxn==0)
		    printf("1\n");
		else
		    printf("%lld\n",maxn);
	}
	return 0;
}

Measured memory_bytes: 256
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back

#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 20000
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};


//=============================================ASIFAZAD==============================================//
ll dp[10005][1005];
int h, n;
vi a, b;

ll rec(int ht, int pos)
{
    if(ht <= 0)
        return 0;
    if(pos >= n)
        return INT_MAX;
    if(dp[ht][pos] != -1)
        return dp[ht][pos];
    ll c = 0, d = 0, f = 0;
    c = rec(ht, pos + 1);
    d = rec(ht-a[pos], pos + 1) + b[pos];
    f = rec(ht-a[pos], pos) + b[pos];
    return dp[ht][pos] = min(c, min(d, f));
}

int32_t main()
{
    io;
    cin>>h>>n;
    for(int i = 0;i < n; i++)
    {
        int x, y;
        cin>>x>>y;
        a.push_back(x);
        b.push_back(y);
    }
    memset(dp, -1, sizeof(dp));
    cout<<rec(h, 0);
    return 0;
}


Measured memory_bytes: 82988
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>

using namespace std;

void solve();
static int W, H, x, y;

void solve() {
  double S = double(W) * double(H) / 2;
  int flag;
  if (x * 2 == W && y * 2 == H) {
    flag = 1;
  } else {
    flag = 0;
  }
  printf("%lf %d\n", S, flag);
}

int main() {
  cin >> W >> H >> x >> y;
  solve();
  return 0;
}


Measured memory_bytes: 256
while True:
    try:
        a = float(input())
    except:
        break
    S = [a]
    for i in range(2,11):
        if i%2==0:
            Si = S[i-2] * 2
            S.append(Si)
        if i%2==1:
            Si = S[i-2] / 3
            S.append(Si)
    print(f'{sum(S):.6f}')


Measured memory_bytes: 5604
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define mod 1e9+7
using namespace std;
ll dp[3001][3001][2];
ll arr[3001];
int main()
{
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
        scanf("%lld", &arr[i]);
    for(int i=0; i<n; i++)
    {
        dp[i][i][0]=arr[i];
    }
    for(int i=1; i<n; i++)
    {
        for(int j=0; (i+j)<n; j++)
        {
            //cout<<j<<" "<<i<<endl;
            ll t1=arr[(i+j)]+dp[j][(i+j)-1][1];
            ll q1=dp[j][(i+j)-1][0];
            ll t2=arr[j]+dp[j+1][(i+j)][1];
            ll q2=dp[j+1][(i+j)][0];
            if(t1>t2)
            {
                dp[j][(i+j)][0]=t1;
                dp[j][(i+j)][1]=q1;
            }
            else
            {
                dp[j][(i+j)][0]=t2;
                dp[j][(i+j)][1]=q2;
            }
        }
    }
    printf("%lld\n", dp[0][n-1][0]-dp[0][n-1][1]);
    return 0;
}


Measured memory_bytes: 139648
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
const int MOD = 1000000007;


typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(){
  int N;
  cin>>N;
  int D[101],A[101]={0};
  rep(i,N){
    cin>>D[i];
    A[D[i]]=1;
  }
  int ans=0;
  rep(i,101) ans+=A[i];
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int N, L[2005], ANS, T;
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> L[i];
	}
	sort(L, L + N);
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N-1; j++)
		{
			T = lower_bound(L + j + 1, L + N, L[i] + L[j]) - L;
			if (T!=N)
			{
				ANS += T - j - 1;
			}
			else if (L[i]+L[j]>L[N-1])
			{
				ANS += T - j - 1;
			}
		}
	}
	cout << ANS << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}
ll MOD=1000000007;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  bool fl=true;
  if(a==b){
    fl=false;
    if(a!=c){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
  if(a==c && fl){
    fl=false;
    if(a!=b){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
  if(b==c && fl){
    fl=false;
    if(b!=a){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
  if(fl){
    cout<<"No"<<endl;
  }
}

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

typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define MOD 1000000007
const double PI=3.14159265358979323846;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> T Ceil(T a, T b){return (a+b-1)/b;}

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

void printv(vint &v){
    for(auto e:v) cout<<e<<" ";
        cout<<endl;
    }
ll a,b,n;
int main() {
    cout<<fixed<<setprecision(10);

    cin>>a>>b>>n;

    // ll g = gcd(a,b);
    // a /= g;
    // b /= g;

    if(n< b){
        cout<<(a*n)/b - a*(n/b)<<endl;
    }else{
        ll x = b-1;
        cout<<(a*x)/b - a*(x/b)<<endl;
    }


    return 0;

}

Measured memory_bytes: 3592
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner t=new Scanner(System.in);
		int N=t.nextInt(), X=t.nextInt(), cont =1, soma=0;
		int L[] = new int[N];
		for(int i = 0; i < N; i++) {
			L[i] = t.nextInt();
			soma += L[i];
			if(soma <= X) {
			cont += 1;
		}
		}
	
		System.out.println(cont);
	}
}

Measured memory_bytes: 21972
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int mod=1e9+7;
const int maxn=2000;
int n,k;
int f[maxn+8][maxn+8],g[maxn+8][maxn+8];

int read()
{
    int x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}

int power(int a,int k)
{
    if (k<0) return 1;
    int sum=1;
    for (;k;k>>=1,a=1ll*a*a%mod)
    if (k&1)
        sum=1ll*sum*a%mod;
    return sum;
}

int main()
{
    n=read(),k=read();
    g[1][0]=1;
    for (int i=1;i<=k;i++)
        for (int j=1;j<=n-i+1;j++)
	    g[i][j]=(g[i-1][j+1]+g[i][j-1])%mod;
    printf("%lld\n",1ll*g[k][n-k+1]*power(2,n-k-1)%mod);
    return 0;
}


Measured memory_bytes: 16640
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <queue>
#include <cmath>
#define ll long long 
#define ri register int 
#define ull unsigned loong long 
const int maxn=100015;
const int inf=0x7fffffff;
template <class T>inline void read(T &x){
	x=0;int ne=0;char c;
	while(!isdigit(c=getchar()))ne=c=='-';
	x=c-48;
	while(isdigit(c=getchar()))x=(x<<3)+(x<<1)+c-48;
	x=ne?-x:x;return;
}
char str[maxn];
int main(){
	scanf("%s",str+1);int cnt=0;
	int len=strlen(str+1);
	for(ri i=1;i<=len;i++){
		if(i==1){
			if(str[i]!='A'){
			puts("WA");
			return 0;
		    }
		}
		else if(i>=3&&i<=len-1){			 
				if(str[i]=='C')
				{
				  cnt++;
				  if(cnt>1){puts("WA");return 0;}
				}
				else if(str[i]>='A'&&str[i]<='Z'&&str[i]!='A'){
			    puts("WA");
			    return 0;
			    }
			}
		else if(str[i]>='A'&&str[i]<='Z'&&str[i]!='A'){
			    puts("WA");
			    return 0;
		}
	}
	if(!cnt){puts("WA");return 0;}
	puts("AC");
	return 0;
}

Measured memory_bytes: 128
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define int long long
#define mod 1000000007
#define N 900005
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<22,stdin),p1 == p2)?EOF:*p1++)
using namespace std ;
//char buf[(1 << 22)] , *p1 = buf , *p2 = buf ;
int add (int x , int y) { return x + y >= mod ? x + y - mod : x + y ; }
int sub (int x , int y) { return x - y < 0 ? x - y + mod : x - y ; }
inline int read ()
{
    char c = getchar () ; int x = 0 , f = 1 ;
    while (c < '0' || c > '9') { if (c == '-') f = -1 ; c = getchar () ; }
    while (c >= '0' && c <= '9'){ x = x * 10 + c - '0' ; c = getchar () ; }
    return x * f ;
}
int fast (int a , int b)
{
    int ret = 1 ;
    while (b)
    {
        if (b & 1) ret = ret * a % mod ;
        a = a * a % mod ;
        b >>= 1 ;
    }
    return ret ;
}
int fac[N] , iv[N] , three[N] , n , m , k , ans , x = 1 ;
int getc (int a , int b)
{
    // if (a < b || a < 0 || b < 0) return 0 ;
    // if (b == 0 || a == b) return 1 ;
    return (fac[a] * iv[a - b] % mod * iv[b] % mod) % mod ;
}
signed main ()
{
//    freopen (".in" , "r" , stdin) ; freopen (".out" , "w" , stdout) ;
    n = read () , m = read () , k = read () ;
    fac[0] = three[0] = 1 ;
    for (int i = 1 ; i < N ; i ++)
    {
        fac[i] = fac[i - 1] * i % mod ;
        three[i] = three[i - 1] * 3 % mod ;
    }
    for (int i = 0 ; i < N ; i ++)
    {
        iv[i] = fast (fac[i] , mod - 2) ;
    }
    if (m < k) swap (m , k) ;
    for (int i = 0 ; i <= m + k ; i ++)
    {
        ans = add (ans , getc (n + i - 1 , n - 1) * three[m + k - i] % mod * x % mod) ;
        if (i < k) x = x * 2 % mod ;
        else if (i < m) x = sub (x * 2 % mod , getc (i , k)) ;
        else x = sub (x * 2 % mod , getc (i , k) + getc (i , m)) ;
    }
    cout << (ans % mod + mod) % mod ;
}


Measured memory_bytes: 21376
x = int(input())
if 400 <= x <= 599:
  print(8)
elif 600 <= x <= 799:
  print(7)
elif 800 <= x <= 999:
  print(6)
elif 1000 <= x <= 1199:
  print(5)
elif 1200 <= x <= 1399:
  print(4)
elif 1400 <= x <= 1599:
  print(3)
elif 1600 <= x <= 1799:
  print(2)
else:
  print(1)

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

#define sqr(x) ((x) * (x))

int main(){
  int n;
  double  xa, ya, ra, xb, yb, rb, l;
  scanf("%d", &n);
  while(n--){
    scanf("%lf%lf%lf%lf%lf%lf", &xa, &ya, &ra, &xb, &yb, &rb);
    l = sqrt(sqr(xb - xa) + sqr(yb - ya));

    if(ra + rb < l) puts("0");
    else if(ra > rb && ra > l + rb) puts("2");
    else if(rb > ra && rb > l + ra) puts("-2");
    else puts("1");
  }
  return 0;
}

Measured memory_bytes: 620
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoderTest
{
    public class Program
    {
        public static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int h = int.Parse(s[0]);
            int w = int.Parse(s[1]);

            if(h % 3 == 0 || w % 3 == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                int mx = h > w ? h : w;
                int mn = w < h ? w : h;
                int mx_h = mx / 3 + 1;
                int mx_w = mn;
                int d_mx = mx - mx_h;
                int mx1 = d_mx > mx_w ? d_mx : mx_w;
                int mn1 = mx_w < d_mx ? mx_w : d_mx;
                int mn_h = mx1 / 2;
                int mn_w = mn1;
                if(mn1 % 2 == 0)
                {
                    mn_h = mn1 / 2;
                    mn_w = mx1;
                }
                int diff1 = mx_h * mx_w - mn_h * mn_w;

                mx_h = mx / 3;
                mx_w = mn;
                d_mx = mx - mx_h;
                mx1 = d_mx > mx_w ? d_mx : mx_w;
                mn1 = mx_w < d_mx ? mx_w : d_mx;
                mn_h = mx1 / 2;
                mn_w = mn1;
                int mm_h = mn_h + (mx1 % 2);
                int mm_w = mn_w;
                if (mn1 % 2 == 0)
                {
                    mn_h = mn1 / 2;
                    mn_w = mx1;
                    mm_h = mn_h;
                    mm_w = mn_w;
                }
                int diffa = Math.Abs(mx_h * mx_w - mm_h * mm_w);
                int diffb = Math.Abs(mn_h * mn_w - mm_h * mm_w);
                int diff2 = diffa > diffb ? diffa : diffb;

                mx_h = mn / 3 + 1;
                mx_w = mx;
                d_mx = mn - mx_h;
                mx1 = d_mx > mx_w ? d_mx : mx_w;
                mn1 = mx_w < d_mx ? mx_w : d_mx;
                mn_h = mx1 / 2;
                mn_w = mn1;
                if (mn1 % 2 == 0)
                {
                    mn_h = mn1 / 2;
                    mn_w = mx1;
                }
                int diff3 = mx_h * mx_w - mn_h * mn_w;

                mx_h = mn / 3;
                mx_w = mx;
                d_mx = mn - mx_h;
                mx1 = d_mx > mx_w ? d_mx : mx_w;
                mn1 = mx_w < d_mx ? mx_w : d_mx;
                mn_h = mx1 / 2;
                mn_w = mn1;
                mm_h = mn_h + (mx1 % 2);
                mm_w = mn_w;
                if (mn1 % 2 == 0)
                {
                    mn_h = mn1 / 2;
                    mn_w = mx1;
                    mm_h = mn_h;
                    mm_w = mn_w;
                }
                diffa = Math.Abs(mx_h * mx_w - mm_h * mm_w);
                diffb = Math.Abs(mn_h * mn_w - mm_h * mm_w);
                int diff4 = diffa > diffb ? diffa : diffb;

                int diff = new List<int> { diff1, diff2, diff3, diff4 }.Min();
                
                Console.WriteLine(diff);
            }
        }
    }
}


Measured memory_bytes: 13268
def mhd(sx, sy, tx, ty):
    return(abs(sx-tx)+abs(sy-ty))
def inpl(): return [int(i) for i in input().split()]

N = int(input())
Sx, Sy, St = 0, 0, 0
ans = 'Yes'
for _ in range(N):
    Tt, Tx, Ty = inpl()
    if mhd(Sx, Sy, Tx, Ty) > Tt-St or (mhd(Sx, Sy, Tx, Ty) - Tt + St) % 2:
        ans = 'No'
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int N,H,W;

int main(){
    cin>>N>>H>>W;
    out((N-H+1)*(N-W+1));
}


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

void solve(std::vector<long long> A) {}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can
// remove this line by using your custom template)
int main() {
    long long N, A, B;
    string s;
    cin >> N >> A >> B;
    cin >> s;

    long long ac_cnt = 0;
    long long foreign_cnt = 0;

    for (long long i = 1; i <= N; i++) {
        switch (s[i - 1]) {
            case 'a':
                if (ac_cnt < (A + B)) {
                    cout << "Yes" << endl;
                    ac_cnt++;
                } else {
                    cout << "No" << endl;
                }
                break;

            case 'b':
                if ((ac_cnt < (A + B)) && (foreign_cnt + 1) <= B) {
                    cout << "Yes" << endl;
                    ac_cnt++;
                    foreign_cnt++;
                } else {
                    cout << "No" << endl;
                }
                break;

            case 'c': cout << "No" << endl; break;
        }
    }
    return 0;
}


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

int main(){
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());
  
  cout << a[0] + a[1] + a[2] * 10 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

bool is_prime(int n)
{
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)  
        if (n%i == 0 || n%(i+2) == 0)  
           return false;

    return true;
}

int next_prime(int n)
{
    if (n <= 1) {
        return 2;
    }

    if (is_prime(n)) {
        return n;
    }

    while (true) {
        n++;
        if (is_prime(n)) {
            return n;
        }
    }

}

int main(int argc, char const* argv[])
{
    int x;
    std::cin >> x;

    std::cout << next_prime(x);

    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
//		solveA(args);
//		solveB(args);
		solveC(args);
//		solveD(args);
//		solveE(args);
//		solveF(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int a = nextInt();
		pw.println(a+a*a+a*a*a);
	}
	public static void solveB(String[] args) throws Exception{
		String S = nextString();
		String T = nextString();

		int ans = 0;
		for(int i=0;i<S.length();i++) {
			if(S.charAt(i)!=T.charAt(i)) {
				ans++;
			}
		}
		pw.println(ans);
	}
	public static void solveC(String[] args) throws Exception{
		int N = nextInt();
		int M = nextInt();
		int K = nextInt();

		int[] A = nextInts();
		int[] B = nextInts();

		long[] ruiA = new long[N+1];
		long[] ruiB = new long[M+1];

		for(int i=1;i<ruiA.length;i++) {
			ruiA[i]=ruiA[i-1]+A[i-1];
		}
		for(int i=1;i<ruiB.length;i++) {
			ruiB[i]=ruiB[i-1]+B[i-1];
		}
		long ans = 0;
		int b =M;
		for(int i=0;i<N+1;i++) {
			if(ruiA[i]>K) {
				break;
			}
			while(ruiB[b]+ruiA[i]>K) {
				b--;
			}
			ans=Math.max(i+b,ans);
		}
		pw.println(ans);


	}
	public static void solveD(String[] args) throws Exception{
		int N = nextInt();

		long[] x = new long[10000001];
		Arrays.fill(x,1);
		for (int i = 2; i < x.length/2; i++) {
			int c = 2;
			long lim = (long)Math.pow(i,c-1);
			for(int k=i;k<x.length;k+=i) {
				if(lim <k) {
					c++;
					lim=(long)Math.pow(i,c-1);
				}
				x[k]*=c;
			}
		}

		long ans = 1;
		for(int i=2;i<=N;i++) {
			ans+=i*x[i];
		}
		pw.println(ans);

	}



	public static void solveE(String[] args) throws Exception{

	}

	public static void solveF(String[] args) throws Exception{

	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 88992
#include<bits/stdc++.h>
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
using namespace std;
const int INF=1e17+5;
const int maxn=1e5+5;
int n,m,a[maxn],b[maxn],ans,sum;

int32_t main()
{
    IOS;
    int x,y;
    cin>>n>>m>>x>>y;
    int fx=m/x-n/x+(n/x*x==n);
    int fy=m/y-n/y+(n/y*y==n);
    int z=x*y/__gcd(x,y);
    int fz=m/z-n/z+(n/z*z==n);
    cout<<m-n+1-fx-fy+fz;
    return 0;
}

Measured memory_bytes: 256
def dfs(n,depth):
    if used[n]:
        return 0
    if depth==N:
        return 1
    used[n]=1
    ans=0
    for i in range(N):
        if connect[n][i]:
            ans+=dfs(i,depth+1)
    used[n]=0
    return ans

N,M=map(int,input().split())
used=[0]*N
connect=[[0 for i in range(N)]for j in range(N)]
a=[];b=[]

for i in range(M):
    x,y=map(int,input().split())
    a.append(x-1)
    b.append(y-1)

for i in range(M):
    connect[a[i]][b[i]]=connect[b[i]][a[i]]=1

print(dfs(0,1))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 1000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N;
  cin >> N;
  vector<ll> p(N);
  ll ans = 0;
  for (ll i = 0; i < N; ++i)
  {
    ll temp;
    cin >> temp;
    p.at(i) = temp;
    ans += temp;
  }
  sort(p.begin(), p.end());
  ans -= *(p.end() - 1) / 2;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int max(int a,int b){
  if(a>=b){
    return a;
  }else{
    return b;
  }
}

int amax(int a,int b,int c){
  int s=max(a,b);
  int q=max(s,c);
  return q;
}

int main(void){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  printf("%d\n",amax(10*a+b+c,10*b+a+c,10*c+a+b));
  return 0;
}

Measured memory_bytes: 1688
# ABC094D - Binomial Coefficients (ARC095D)
from bisect import bisect_left as bs


def main():
    N = int(input())
    A = sorted(map(int, input().split()))
    if N == 2:
        print(A[1], A[0])
        return
    n, idx = A[-1], bs(A[:-1], A[-1] // 2)
    r = min(
        (abs(A[idx - 1] - n / 2), A[idx - 1]),
        (abs(A[idx] - n / 2), A[idx]),
        (abs(A[idx + 1] - n / 2), A[idx + 1]),
    )
    print(n, r[1])


if __name__ == "__main__":
    main()

Measured memory_bytes: 14428
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define r0 return 0;
#define f(k,i,n,j) for(ll k=i;k<=n;k=k+j)
#define cin(a) cin>>a;
#define loop int t;cin>>t;while(t--)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define mod (1e9+7)
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
signed main()
{
    crap;
    //cout<<1;
    string s;
    cin>>s;
    if(s.size()<6)
    cout<<"No"<<endl;
    else if(s[2]==s[3] && s[4]==s[5])
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
using namespace std;

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

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
ll A, B;
ll soli(ll a) {
  if(a % 4 == 0) {
    return (0 ^ a);
  } else if(a %  4 == 1) {
    return 1;
  } else if(a % 4 == 2) {
    return (1 ^ a);
  } else {
    return 0;
  }
}

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

  cin >> A >> B;
  ll fa = soli(A - 1);
  ll fb = soli(B);
  cout << (fa ^ fb) << endl;
}


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

using namespace std;

template <class T>
T Vec(T v) { return v; }

template <class T, class... Ts>
auto Vec(size_t l, Ts... ts) {
    return vector<decltype(Vec<T>(ts...))>(l, Vec<T>(ts...));
}

const int INF = 1 << 30;

int N;
vector<int> deg;

int rec(int l, int r) {
    static auto dp = Vec<int>(N + 1, N + 1, -1);
    if (r - l <= 1) return 0;
    if (dp[l][r] >= 0) return dp[l][r];
    dp[l][r] = INF;

    for (int p = l + 1; p < r; ++p) {
        dp[l][r] = min(dp[l][r], rec(l, p) + rec(p, r) + deg[l] * deg[p] * deg[r]);
    }
    return dp[l][r];
}

int main() {
    cin >> N;

    deg.resize(N + 1);
    for (int i = 0; i < N; ++i) {
        int r, c;
        cin >> r >> c;
        deg[i] = r;
        if (i == N - 1) deg[i + 1] = c;
    }
    cout << rec(0, N) << endl;
    return 0;
}



Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
int cnt[maxn];
int main()
{
    int n,q,x,y;
    string a;
    cin>>n>>q>>a;
    for(int i=1;i<n;i++)
    {
        cnt[i]+=cnt[i-1];
        if(a[i]=='C'&&a[i-1]=='A')
            cnt[i]++;
    }
    while(q--)
    {
        scanf("%d%d",&x,&y);
        printf("%d\n",cnt[y-1]-cnt[x-1]);
    }
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n, k;
    cin >> n >> k;
    ll a;
    vll x(n);
    REP(i, n){
        cin >> a;
        a--;
        x[a]++;
    }
    VSORTR(x);
    ll res = 0;
    REP(i, n){
        if(i >= k) res += x[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	int r = a % b;
	return gcd(b, r);
}
int main(){
	int n;
	cin >> n;
	cout << ((n + 110) / 111) * 111 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    for(;;){
        string word;
        int hand = 0, sum = 0;
        getline(cin,word);
        if(word == "#"){break;}
        for(int i=0; i<word.size(); i++){
            int flag = 2;
            if(word[i] == 'q'){flag = 1;}
            if(word[i] == 'w'){flag = 1;}
            if(word[i] == 'e'){flag = 1;}
            if(word[i] == 'r'){flag = 1;}
            if(word[i] == 't'){flag = 1;}
            if(word[i] == 'a'){flag = 1;}
            if(word[i] == 's'){flag = 1;}
            if(word[i] == 'd'){flag = 1;}
            if(word[i] == 'f'){flag = 1;}
            if(word[i] == 'g'){flag = 1;}
            if(word[i] == 'z'){flag = 1;}
            if(word[i] == 'x'){flag = 1;}
            if(word[i] == 'c'){flag = 1;}
            if(word[i] == 'v'){flag = 1;}
            if(word[i] == 'b'){flag = 1;}
            if(!hand){hand = flag;}
            else if(hand != flag){hand = flag; sum++;}
        }
        cout <<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int a, b, c, k;
	cin >> a >> b >> c >> k;
	while (k--) {
		if (a >= b) b *= 2;
		else c *= 2;
	}
	if (a < b && b < c) cout << "Yes\n";
	else cout << "No\n";
}

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

int main() {
	int w, h, x, y;
	cin >> w >> h >> x >> y;

	double ans = (double)w * h / 2;
	int num = (w == x * 2 && h == y * 2) ? 1 : 0;
	printf("%.10f %d\n", ans, num);

	return 0;
}

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

int main() {
  int a, b, h, m;
  long double tmp_m, tmp_h, tmp_hm, ans, radian;
  cin >> a >> b >> h >> m;
  tmp_m = m % 60;
  tmp_hm = 0;
  if(tmp_m > 0) {
    tmp_hm = tmp_m / 60.0 * 30;
    tmp_m = tmp_m / 60.0 * 360;
  }
  tmp_h = h % 12;
  if(tmp_h > 0) {
    tmp_h = tmp_h / 12.0 * 360;
  }
  tmp_h = tmp_h + tmp_hm;
  radian = abs(tmp_h - tmp_m) * M_PI / 180.0;
  ans = sqrt(a*a + b*b - 2*a*b*cos(radian));
  cout << setprecision(20) << ans << endl;
  return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(c) begin(c), end(c)

using ll = long long;
using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	
	cout << (N % K == 0 ? 0 : 1) << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
ABs = [list(map(int, input().split())) for _ in range(N)]
ABs = sorted(ABs, key = lambda x:x[1])

now_index = 0
now_time = 0
while now_index < N:
    deadline = ABs[now_index][1]
    now_time += ABs[now_index][0]
    additional_task = 0
    for i in range(now_index+1, N):
        if ABs[i][1] != deadline:
            break
        else:
            now_time += ABs[i][0]
            additional_task+=1
    now_index += 1
    now_index += additional_task
    if now_time > deadline:
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 117748
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
using namespace std;
using ll = long long;

int main() {
	
	int x;

	cin >> x;

	if (x == 2) {
		cout << 2 << endl;
		return 0;
	}

	bool t = true;

	for (int i = 3; i < x; i += 2) {
		if (x % i == 0) {
			x++;
			i = 3;
		}
		if (x <= i) break;
	}

	cout << x << endl;

	return 0;
}

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

int main() {
  int a,b,tot,ans=1;
  cin>>a>>b;

  if(b==1){cout<<0<<endl;return 0;}
  tot=a;
  while(tot<b){
    tot+=a-1;
    ans++;
  }

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

Measured memory_bytes: 256
#include "stdio.h"

int scmp(char *a,char *b){
	for(int i=0;b[i];i++)if(a[i]!=b[i])return 0;
	return 1;
}

char a[1000],b[1000],c[1000];

int main(){
	scanf("%s %s",a,b);
	int l;
	for(l=0;a[l];l++);
	for(int i=0;i<l;i++){
		for(int j = 0;j<l;j++)c[j] = a[(j+i+1)%l];
		if(scmp(c,b)){
			printf("Yes");
			return 0;
		}
	}
	printf("No");
}


Measured memory_bytes: 256
#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>;

const int m = 2019;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  reverse(s.begin(), s.end());
  int x = 1, tot = 0;
  vector<int> cnt(m);
  ll ans = 0;
  rep(i,n) {
    cnt[tot]++;
    tot += (s[i]-'0')*x;
    tot %= m;
    ans += cnt[tot];
    x = x*10%m;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3696
def main():
    N,A,B=map(int,input().split())
    v=list(map(int,input().split()))
    v.sort(reverse=True)
    Amxv=sum(v[:A])
    c=v[A-1]
    m=v[:A].count(c) 
    n=v.count(c)
    fl=[1]*(N+1)
    for i in range(N):
        fl[i+1]=fl[i]*(i+1)
    print(Amxv/A)
    if v[0]-c==0:
        print(sum([fl[n]//(fl[i]*fl[n-i]) for i in range(A,min(B,n)+1)]))
    else:
        print(fl[n]//(fl[m]*fl[n-m]))

if __name__=='__main__':
    main()
    


Measured memory_bytes: 9120