akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

//Badminton
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			char[] s = sc.next().toCharArray();
			if(s[0]=='0')break;
			int a = 0;
			int b = 0;
			for(int i=1;i<s.length;i++){
				if(s[i]=='A')a++;
				else b++;
			}
			if(a>b)a++;
			else b++;
			System.out.println(a+" "+b);
			for(int j=0;j<2;j++){
				s = sc.next().toCharArray();
				a = 0;
				b = 0;
				for(int i=1;i<s.length;i++){
					if(s[i]=='A')a++;
					else b++;
				}
				if(a>b)a++;
				else b++;
				System.out.println(a+" "+b);
			}
		}
	}
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<ll,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	double l;
	cin >>l;
	double w = l /3.0;
	printf("%.14f\n", w*w*w);
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int n,i,count1=0;

    scanf("%d",&n);
    int ar[n+1];
    for(i=1;i<=n;i++)
    {
        scanf("%d",&ar[i]);
    }
    for(i=1;i<=n;i++)
    {
            if(ar[i]!=i)
            {
                count1++;
            }
    }
    if(count1==0 || count1 ==2)
    {
           printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }


    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
int n;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin>>n;
    vi a(n+1,0);
    REP(i,n-1){
        int tmp;
        cin>>tmp;
        //DEBUG(tmp);
        a[tmp]++;
    }

    FOR(i,1,n+1){
        cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3992
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<bits/stdc++.h>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3F3F3F3F
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
string s;
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='1')
		s[i]='9';
		else
		s[i]='1';
	}
	cout<<s;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        int ans = 0;
        for(int i=a; i<=b; i++) {
            int tmp = i;
            int[] num = new int[5];
            int lCnt = 0;
            while(true) {
                if(tmp > 0) {
                    num[lCnt] = tmp % 10;
                    tmp /= 10;
                } else {
                    break;
                }
                lCnt++;
            }
            if(num[0] == num[4] && num[1] == num[3]) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 25940
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int N,R;
  cin>>N>>R;
  if(N>=10) cout<<R<<endl;
  else cout<<R+100*(10-N)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL<<60;
#define rev(s) (string((s).rbegin(), (s).rend()))

int n,m;
vector<vector<int>> field(100010,vector<int>());
int dp[100010];

int rec(int v) {
    if (dp[v]!=-1) {
        return dp[v];
    }
    int len = 0;
    rep(i,field[v].size()) {
        len = max(len,rec(field[v][i])+1);
    }
    dp[v] = len;
    return len;
}

int main () {

    cin>>n>>m;

    rep(i,m) {
        int a,b;cin>>a>>b;
        field[a-1].push_back(b-1);
    }

    rep(i,100010) {
        dp[i]=-1;
    }
    
    int ans=0;
    rep(i,n) {
        ans=max(ans,rec(i));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 8192
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0,1,0,-1 };
const ll dy[4] = { -1, 0, 1,0 };
const ll INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}
///////////////////////////////////////


int main() {
	ll N, K; cin >> N >> K;
	vector<ll>x;
	vector<ll>y;
	REP(i, N) {
		ll a, b; cin >> a >> b;
		x.push_back(a);
		y.push_back(b);
	}
	ll ans = 1e18*5;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			for (int k = 0; k < N ; ++k) {
				for (int l = 0; l < N; ++l) {
					if (i == j || k == l)continue;
					if (x[i] > x[j])continue;
					if (y[k] > y[l])continue;
					int cnt = 0;
					for (int m = 0; m < N; ++m) {
						if (x[i] <= x[m] && x[m] <= x[j] && y[k] <= y[m] && y[m] <= y[l]) {
							cnt++;
						}
					}
					if (cnt >= K) {
						ll key = (x[j] - x[i])*(y[l] - y[k]);
						if (key > 0) {
							ans = min(ans, key);
						}
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

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

  int64_t res = 0;
  for (int64_t i = 1; i <= n; ++i) {
    int64_t kou = n / i;
    int64_t jougen = i * kou;
    res += (i + jougen) * kou / 2;
  }

  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#include <string>
const int mxN=2e5;
const int maxN=5e3;
#define ld long double
#define pb push_back
#define mp make_pair
#define ins insert
#define vi vector<int>

int main()
{
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0;i<n;i++)
        cin >> a[i];
    sort(a.begin(),a.end());
    int ans=0;
    for(int i=0;i<k;i++)
        ans+=a[i];
    cout << ans;
}

Measured memory_bytes: 3612
if __name__ == '__main__':
    a, b = map(int, input().split())
    lista=[]
    for i in range(a):
        c = [int(i) for i in input().split()]
        lista.append(c)

    listb=[]
    for i in range(b):
        c = [int(i) for i in input().split()]
        listb.append(c)

    listc =[]

    for i in lista:
        min = 10**9
        minroot=-1
        for j in range(len(listb)):
            root = abs(i[0] - listb[j][0])  + abs(i[1] - listb[j][1])
            if root <min:
                min =root
                minroot=j+1
        listc.append(minroot)
    for i in listc:
        print(i)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,x;
  cin >> x;
  for (int i=0; i<240; i++){
    A = i-120;
    for (int j=0; j<240; j++){
      B = j-120;
      if (A*A*A*A*A-B*B*B*B*B==x) break;
    }
    if (A*A*A*A*A-B*B*B*B*B==x) break;
  }
  cout << A << " " << B << endl;
}

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

int main() {
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c, vector<int>(c));
    rep(i, c) rep(j, c) cin >> d[i][j];
    vector<vector<int>> counts(3, vector<int>(c));
    rep(i, n) rep(j, n) {
        int d;
        cin >> d;
        counts[(i+j) % 3][d - 1]++;
    }
    int ans = 1e9;
    for (int c1 = 0; c1 < c; c1++) {
        for (int c2 = 0; c2 < c; c2++) {
            for (int c3 = 0; c3 < c; c3++) {
                if (c1 == c2 || c2 == c3 || c1 == c3) continue;
                int iwa = 0;
                rep(i, c) {
                    iwa += d[i][c1] * counts[0][i];
                    iwa += d[i][c2] * counts[1][i];
                    iwa += d[i][c3] * counts[2][i];
                }
                ans = min(ans, iwa);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

vector<uint64_t> factorial;
uint64_t mod = 1000000007;

uint64_t factor(uint64_t t) {
  if (factorial[t]) {
    return factorial[t];
  } else {
    for (int i = 2; i <= t; ++i) {
      factorial[i] = factorial[i-1] * i % mod;
    }
    return factorial[t];
  }
}

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

  factorial.resize(100001);
  factorial[0] = 1;
  factorial[1] = 1;
  factorial[2] = 2;
  factorial[3] = 6;

  int n, m;
  cin >> n >> m;

  if (1 < abs(n-m)) {
    cout << 0 << "\n";
    return 0;
  }
  if (n > m) swap(n,m);
  if (n == m) {
    cout << (2 * factor(n) * factor(n)) % mod << "\n";
  } else {
    cout << (factor(n) * factor(m)) % mod << "\n";
  }
}


Measured memory_bytes: 1024
n=int(input())
l=list(map(int,input().split()))
r=0
for i in range(n):
	li=l[i]
	for j in range(i,n):
		lj=l[j]
		if li==lj:continue
		for k in range(j,n):
			lk=l[k]
			if li==lk or lj==lk:continue
			if li<lj+lk and lj<li+lk and lk<lj+li:r+=1
print(r)

Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin>>n>>s;
    int ans=0;
    int b=0;
    rep(i,n){
      if(s[i]=='#'){
        b++;
      }
    }
    vector<int> l(n+1,0),r(n+1,0),sum(n+1,0);//左の黒, 右の白の個数
    l[0]=0,r[0]=n-b;
    sum[0]=n-b;
    rep(i,n){
      if(s[i]=='#'){
        l[i+1]=l[i]+1;
        r[i+1]=r[i];
      }else{
        l[i+1]=l[i];
        r[i+1]=r[i]-1;
      }
      sum[i+1]=l[i+1]+r[i+1];
    }
    cout<<*min_element(begin(sum),end(sum))<<endl;
}

Measured memory_bytes: 2964
s = input()
ans = 0

for i in range(len(s)):
    if i == 0:
        pre = s[i]
    else:
        if s[i] == pre:
            ans += 1
            if s[i] == "0":
                pre = "1"
            else:
                pre = "0"
        else:
            pre = s[i]
            
print(ans)

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

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define int long long

int32_t main(){
	string s;
	cin >> s;
	cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No");
}


Measured memory_bytes: 256
// AtCoder Beginner Contest 113 - Problem D: Number of Amidakuji (https://beta.atcoder.jp/contests/abc113/tasks/abc113_d)
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

#define REPN(i, N) for (int (i) = 0; (i) < N; (i)++)

const int MAXH { 110 }, MAXW { 10 };
const int MOD { 1000000007 };

// dp[h][k] = # de Amidakuji com altura h que terminam na coluna k (indexada em 0, não 1)
// O Amidakuji é construído de cima para baixo, (o topo tem altura h = 0)
ll dp[MAXH][MAXW];

void solve(int H, int W, int K)
{
    // Corner case: uma única coluna
    dp[0][0] = 1;

    // DP bottom-up
    REPN(h, H)
    {
        REPN(w, W)
        {
            // Todas as possíveis escolhas de barras horizontais para a altura h
            // Há W - 1 barras horizontais possíveis entre W barras verticais
            // As novas barras entram em baixo das anteriores
            REPN(k, 1 << (W - 1))
            {
                // Duas linhas horizontais não podem ser conectar
                bool share = false;

                REPN(i, W - 2)
                {
                    if (k & (1 << i) and k & (1 << (i + 1)))
                    {
                        share = true;
                        break;
                    }
                }

                if (share)
                    continue;

                if (w and k & (1 << (w - 1)))
                {
                    // Há uma conexão para a esquerda: quem terminava em w agora termina em (w - 1)
                    dp[h + 1][w - 1] += dp[h][w];
                    dp[h + 1][w - 1] %= MOD;
                } else if (w < W - 1 and k & (1 << w))
                {
                    // Há uma conexão para a direita: quem terminava em w agora termina em (w + 1)
                    dp[h + 1][w + 1] += dp[h][w];
                    dp[h + 1][w + 1] %= MOD;
                } else
                {
                    // Não há conexões: segue diretamente em w
                    dp[h + 1][w] += dp[h][w];
                    dp[h + 1][w] %= MOD;
                }
            }
        }
    }
 
    auto ans = dp[H][K - 1];

    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    int H, W, K;
    cin >> H >> W >> K;

    solve(H, W, K);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#define inf 0x3f3f3f3f
#define LL long long

using namespace std;

int main()
{
    string str1,str2;
    cin>>str1>>str2;
    str1=str1+str1;
    str2=str2+str2;
    int len=str1.size();
    string str3,str4;
    int flag=0;
    for(int i=0;i<=len/2;i++){
        str3=str1.substr(i,len/2);
        for(int j=0;j<=len/2;j++){
            str4=str2.substr(j,len/2);
            if(str3==str4){
                //cout<<str3<<" "<<str4<<endl;
                cout<<"Yes"<<endl;
                flag=1;
                break;
            }
        }
        if(flag) break;
    }
    if(!flag) cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
char op;
int a,b;
//cin >> 1 >> 2 >> 3;
while(1){
scanf("%d %c %d",&a,&op,&b);
if(op=='?')break;
if(op=='+'){
printf("%d\n",a+b);
}else if(op=='-'){
printf("%d\n",a-b);
}else if(op=='*'){
printf("%d\n",a*b);
}else{
printf("%d\n",a/b); 
}
}
}





Measured memory_bytes: 2040
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ a, b, c, d ] <- replicateM 4 readInt
	print $ min a b + min c d
	
    

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

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

    vector<long long int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }

    long long int ans = 0;
    long long int count = 0;
    for(int i=0; i<n; i++){
        if(a[i] != 0) count += a[i];
        if(a[i] == 0 || i == n-1){
            ans += count / 2;
            count = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int ans = 0;
  char s[3];for(int i = 0; i < 3; ++i) cin >> s[i];
  for(int i = 0; i < 3; ++i)
    if(s[i] == '1') ans += 1;
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int dfs( int val, vector<vector<int>> &adj, vector<int> &visited)
{
	if( val > adj.size() || adj[val].size() == 0 )
		return 1;

	if( visited[val] != 0 )
		return visited[val];	

	int mval = 0 ; 
	for( auto it : adj[val] )
	{
		visited[it] = dfs( it, adj, visited);
		mval = max(visited[it], mval);
	}
	visited[val] = mval+1;

	return visited[val];
}	


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

	vector< vector<int> > adj(n+1, vector<int> () );

	for( int i=1 ; i<=m ; i++ )
	{
		int x, y;
		cin>>x>>y;
		adj[x].push_back(y);
	}

	vector<int> visited(n+1);

	int ans = 0 ; 
	for( int i=1 ; i<=n ; i++)
	{
		ans = max(ans, dfs( i, adj, visited ));
	}

	cout<<ans-1;
	return 0 ;
}

Measured memory_bytes: 10240
n = int(input())
d,x = [int(i) for i in input().split()]

A = [int(input()) for i in range(n)]
ans = 0

for a in A:
    cnt = 0
    c = 0
    while c <= d:
        cnt += 1
        c = cnt*a+1
        ans += 1
    
    
ans += x

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n;
    ll m, a[112345], b[112345];
    pair<ll, ll> p[112345];

    cin >> n >> m;

    REP(i, n)
    cin >> p[i].first >> p[i].second;

    sort(p, p + n);

    ll res = 0;

    int i = 0;

    while (m > 0)
    {
        res += min(m, p[i].second) * p[i].first;
        m -= min(m, p[i].second);

        i++;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 2048
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<algorithm>
typedef signed long long int int64;
inline unsigned getint() {
    register char ch;
    while(!isdigit(ch=getchar()));
    register unsigned x=ch^'0';
    while(isdigit(ch=getchar())) x=(((x<<2)+x)<<1)+(ch^'0');
    return x;
}
inline int64 min(const int64 &a,const int64 &b) {
    return a<b?a:b;
}
const int64 inf=0x7ffffffffffffff;
const int N=200001;
int n;
class FenwickTree {
    private:
        int64 val[N];
        int lowbit(const int &x) const {
            return x&-x;
        }
    public:
        FenwickTree() {
            std::fill(&val[0],&val[N],inf);
        }
        void modify(int p,const int64 &x) {
            while(p<=n) {
                if(x<val[p]) {
                    val[p]=x;
                } else {
                    return;
                }
                p+=lowbit(p);
            }
        }
        int64 query(int p) const {
            int64 ret=inf;
            while(p) {
                ret=min(ret,val[p]);
                p-=lowbit(p);
            }
            return ret;
        }
};
FenwickTree ta;
class RevFenwickTree {
    private:
        int64 val[N];
        int lowbit(const int &x) const {
            return x&-x;
        }
    public:
        RevFenwickTree() {
            std::fill(&val[0],&val[N],inf);
        }
        void modify(int p,const int64 &x) {
            while(p) {
                if(x<val[p]) {
                    val[p]=x;
                } else {
                    return;
                }
                p-=lowbit(p);
            }
        }
        int64 query(int p) const {
            int64 ret=inf;
            while(p<=n) {
                ret=min(ret,val[p]);
                p+=lowbit(p);
            }
            return ret;
        }
};
RevFenwickTree tb;
int64 f[N];
inline void modify(const int &p,const int64 x) {
    if(x<f[p]) {
        f[p]=x;
        ta.modify(p,x-p);
        tb.modify(p,x+p);
    }
}
int main() {
    n=getint();
    int q=getint(),a=getint(),b=getint();
    std::fill(&f[0],&f[N],inf);
    modify(a,0);
    int64 sum=0;
    while(q--) {
        a=b;
        b=getint();
        sum+=abs(a-b);
        int64 t1=ta.query(b)+b,t2=tb.query(b)-b;
        modify(a,min(t1,t2)-abs(a-b));
    }
    int64 tmp=inf;
    for(register int i=1;i<=n;i++) {
        tmp=min(tmp,f[i]);
    }
    printf("%lld\n",tmp+sum);
    return 0;
}

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

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    string s;
    cin >> s;

    if(s == "Sunny") cout << "Cloudy\n";
    else if(s == "Cloudy") cout << "Rainy\n";
    else cout << "Sunny\n";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a,b;
    char op;
    scanf("%d %c %d", &a, &op, &b);
    if(op=='+') printf("%d", a+b);
    else if(op=='-') printf("%d", a-b);
    else printf("%c", op);
    return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define F first
#define S second
#define def(x) cerr << #x << " is " << x << endl;
#define mod 1000000007
#define pb push_back
#define FOR(i,a,n) for(ll i=a;i<n;i++)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(a) a.begin(),a.end()
const int NUM = 2e5 + 5;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
int main(){
    ios
    int num_tests=1; 
    //cin>>num_tests;
    while(num_tests-->0){
    ll a,b,c,d,rem;
    ll n; cin>>n;
    string str1,str="abcdefghijklmnopqrstuvwxyz";
    while(n!=0)
    {
        rem=n%26;
        n=n/26;
        if(rem==0)
        {
            str1+=str[25];
            n--;
        }
        else
        {
            str1+=str[rem-1];
        }
    }
    reverse(all(str1));
    cout<<str1;
    }   
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
ll mod = 1000000007;

int main() {
    ll m1, m2, d1, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if (m1 != m2) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}



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

int main(int argc, const char * argv[]) {
    int N;
    
    cin >> N;
    
    int tmp = N;
    int sum = 0;
    while (tmp > 0) {
        sum = sum + (tmp % 10);
        tmp /= 10;
    }
    
    if (N % sum == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
      int A = Integer.parseInt(scanner.next());
      int B = Integer.parseInt(scanner.next());
      int C = Integer.parseInt(scanner.next());
      int D = Integer.parseInt(scanner.next());
      int area_1 = A*B;
      int area_2 = C*D;
      if (area_1<area_2){
        System.out.println(area_2);
      } else {
        System.out.println(area_1);
      }
    }
}
      

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

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    for(int i = 1; i < n; i++) {
        if(a[i] == a[i - 1]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 4848
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

map<ii, int> MAP, visited;
vi ans(10);
ll h, w;

void visit(ii v) {
    if (visited[v] || v.F <= 0 || v.S <= 0 || v.F > h-2 || v.S > w-2) return;
    visited[v] = 1;
    int cnt = 0;
    for (int i = 0; i <= 2; ++i) {
        for (int j = 0; j <= 2; ++j) {
            cnt += MAP[ii(i + v.F, j + v.S)];
        }
    }
    if (cnt) {
        ans[0]++;
        ans[cnt]++; 
    }
}

void process(ii v) {
    for (int i = 0; i <= 2; ++i) {
        for (int j = 0; j <= 2; ++j) {
            visit(ii(v.F - i, v.S - j));
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> h >> w >> n;
    vii V(n);
    for (int i = 0; i < n; ++i) {
        cin >> V[i].F >> V[i].S;
        MAP[V[i]] = 1;
    }
    for (int i = 0; i < n; ++i) {
        process(V[i]);
    }
    cout << (h-2)*(w-2) - ans[0] << "\n";
    for (int i = 1; i <= 9; ++i) {
        cout << ans[i] << "\n";
    }
    return 0;
}

Measured memory_bytes: 213504
#include<cstdio>
int main(){
	int a,b,c,t;
	scanf("%d%d%d",&a,&b,&c);
	if(a<b){t=a;a=b;b=t;}
	if(a<c){t=a;a=c;c=t;}
	printf("%d\n",a*10+b+c);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007

int main() {

	double A, B;
	cin >> A >> B;
	cout << A / B << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<unordered_set>
#include<vector>
#include<cstring>
#include<sstream>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;

string value(int n) {
    string s = "a";

    for (int i = 1; i < n; i++) {
        bool flag = false;
        for (int j = s.size()-1; j >= 0; j--) {
            if (s[j] < 'z') {
                s[j]++;
                for (int k = j+1; k < s.size(); k++) s[k] = 'a';
                flag = true;
                break;
            }
        }

        if (!flag) s = string(s.size()+1, 'a');
    }

    return s;
}

long long power(long long n, long long k) {
    if (k == 0) return 1ll;
    else if (k == 1) return n;

    long long p = power(n, k/2);

    //cout << n << endl;

    if (k%2 == 0) return p*p;
    else return p*p*n;
}

string solve(long long n) {
    int k = 1;
    long long r = 0;
    while (true) {
        long long tmp = r + power(26ll, k);
        if (tmp >= n) break;
        r = tmp;
        k++;
    }
    
    //cout << k << endl;

    string res = "";

    for (int i = 0; i < k; i++) {
        if (n%26 == 0) {
            res = "z" + res;
            n--;
        }
        else res = char('a'+(n%26)-1) + res;

        n /= 26;
    }

    return res;
}

int main() {
    long long n;
    cin >> n;
    
//    for (int n = 1; n <= 100000; n++) {
//        string a = solve(n);
//        string b = value(n);

//        if (a != b) {
//            cout << n << " " << a << " " << b << endl;
//            break;
//        }

//        cout << "Success " << n << endl;
//    }

    cout << solve(n) << endl;
}


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

int main() {
	long long X, Y = 100;
	cin >> X;
	for (int i = 1; ; i++) {
		Y *= 1.01;
		if (Y >= X) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		for (int i = A; i <= B; i++) {
			if (i % K == 0) {
				System.out.println("OK");
				return;
			}
		}
		System.out.println("NG");
	}

}


Measured memory_bytes: 35812
import math

n = input()
answer =  len(n)
number = int(n)
for a in range(int(math.sqrt(int(n))),1,-1):
  if number%a != 0:
    continue
  b = number//a
  answer = min(answer, max(len(str(a)),len(str(b))))
  break
  
print(answer)

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

void solve() {
  int N, K;
  ll count = 0;
  cin >> N >> K;
  vector<int> h(N);
  REP(i, N) { cin >> h[i]; }
  sort(ALL(h));
  FOR(i, 0, N - K - 1) {
    count += h[i];
  }
  cout << count << endl;
}

signed main() {
  solve();

  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)

int a[] = { 1, 5, 10, 50, 100, 500 };
int N[6];
int ret[666667];

int min(int x, int y) { return x < y ? x : y; }

int main()
{
	REP(p, 1, 666667) {
		int t = p;
		rep(i, 6) { int k=t/a[5-i]; ret[p]+=k; t-=k*a[5-i]; }
	}
	int P;
	while (scanf("%d", &P), P) {
		rep(i, 6) scanf("%d", N+i);

		int res = (1<<29);
		REP(p, P, P+501) {
			int t = p;
			int pay = 0;
			rep(i, 6) {
				int k=min(N[5-i], t/a[5-i]);
				pay+=k;
				if (pay >= res) goto NEXT;
				t-=k*a[5-i];
			}
			if (!t) res = min(res, pay+ret[p-P]);
NEXT:;
		}
		printf("%d\n", res);
	}
	return 0;
}

Measured memory_bytes: 2948
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;

enum dir
{
	w = 0, e = 1
};

int psum[300001][2];
char b[300001];
int main()
{
	int n;
	cin >> n;
	cin.get();
	for (int i = 0; i < n; ++i)
		scanf("%c", &b[i]);
	memset(psum, 0, sizeof(psum));

	if (b[0] == 'E')
		psum[0][e] = 1;
	else
		psum[0][w] = 1;

	for (int i = 1; i < n; ++i)
	{
		if (b[i] == 'W')
		{
			psum[i][w] = psum[i - 1][w] + 1;
			psum[i][e] = psum[i - 1][e];
		}			
		else
		{
			psum[i][e] = psum[i - 1][e] + 1;
			psum[i][w] = psum[i - 1][w];
		}			
	}

	int minSum = 987654321;
	for (int i = 0; i < n; ++i)
	{
		int sum = 0;
		if (i - 1 >= 0)
			sum += psum[i - 1][w];
		sum += psum[n - 1][e] - psum[i][e];
		minSum = min(minSum, sum);
	}

	cout << minSum;

	return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long N, std::vector<std::string> S)
{
  set<string> ss;
  for (auto s : S)
  {
    ss.insert(s);
  }
  cout << ss.size() << endl;
}

int main()
{
  cout << setprecision(10);
  long long N;
  scanf("%lld", &N);
  std::vector<std::string> S(N);
  for (int i = 0; i < N; i++)
  {
    std::cin >> S[i];
  }
  solve(N, std::move(S));
  return 0;
}


Measured memory_bytes: 25136
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 3003;
const int mod = (int) 1e9 + 7;

int n;
string s;
int dp[N][N];

// given [0, n-idx-1] and taking value at index j, knowing the previous operator
// if < then solve(idx+1, [j, j+1, j+2, ...])
// if > then solve(idx+1, [j-1, j-2, ...])
int calc(int idx, int j) {
	if (idx == n)
		return 1;
	if (j < 0 || j > n - idx - 1)
		return 0;
	int &ret = dp[idx][j];
	if (ret != -1)
		return ret;
	ret = 0;
	if (s[idx] == '<')
		(ret += calc(idx, j + 1)) %= mod;
	else
		(ret += calc(idx, j - 1)) %= mod;

	if (s[idx + 1] == '<')
		(ret += calc(idx + 1, j)) %= mod;
	else
		(ret += calc(idx + 1, j - 1)) %= mod;
	return ret;
}

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n >> s;
	s = "<" + s + "<";
	MMS(dp, -1);
	cout << calc(0, 0) << endl;
	return 0;
}


Measured memory_bytes: 246528
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define N 200000
int num[N+10],n2[N+10],a[N+10];
int main()
{
	int n,m,x,y,nz;
	cin>>n>>m;
	nz=n;
	rep(i,n){
		cin>>a[i];
		num[a[i]]++;
		if(a[i]>=num[a[i]] && n2[a[i]-num[a[i]]]==0) nz--;
		n2[a[i]-num[a[i]]]++;
	}
	rep(i,m){
		//rep(j,n) cout<<n2[j]<<' ';cout<<endl;
		
		cin>>x>>y;x--;
		
		if(a[x]>=num[a[x]] && n2[a[x]-num[a[x]]]==1) nz++;
		if(a[x]>=num[a[x]]) n2[a[x]-num[a[x]]]--;
		num[a[x]]--;
		
		num[y]++;
		if(y>=num[y] && n2[y-num[y]]==0) nz--;
		if(y>=num[y]) n2[y-num[y]]++;
		
		a[x]=y;
		cout<<nz<<endl;
	}
}


Measured memory_bytes: 3712
/* ABC120 */
/* A */
#include <iostream>
#include <string>
using namespace std;

int main(void){

    int A, B, C;
    cin >> A >> B >> C;

    int S;
    S = B / A;

    if (S < C) cout << S << endl;
    else if (S >= C) cout << C << endl;
}

Measured memory_bytes: 256
///
// File:  c.cpp
// Author: ymiyamoto
//
// Created on Fri May 25 23:23:57 2018
//
#include <bits/stdc++.h>
using namespace std;

#define rep(_n, _init, _N) for (int32_t _n = _init; _n < (int32_t)(_N); _n++)
#define rrep(_n, _N, _end) for (int32_t _n = (int32_t)(_N); _n >= _end; _n--)
#define iceil(_x, _y) (((_x) + (_y)-1) / (_y))
#define ifloor(_x, _y) ((_x) / (_y))

static const double pi = 2 * asin(1);
static const double precision = 10e-9;
static int N, M, K;
static vector<vector<int>> graph(2 * 1e5, vector<int>{});
static vector<int> visited(2 * 1e5);

void dfs(int root)
{
  visited[root] = true;

  for (auto r : graph[root]) {
    if (!visited[r]) {
      dfs(r);
    }
  }
}

int32_t main()
{
  cin >> N >> M;

  for (int i = 0; i < N; i++) {
    cin >> K;
    for (int j = 0; j < K; j++) {
      int l;
      cin >> l;
      l--;
      graph[i].push_back(l + N);
      graph[l + N].push_back(i);
    }
  }

  dfs(0);

  for (int i = 0; i < N; i++) {
    if (!visited[i]) {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
int k=0,n=0, m=0, l=0,a=0, b=0, c=0, d=0,e=0,ans=0,ans2=0,x=0,y=0;
string s,t,S;
signed main() {
  vector<int>A(2);
    REP(i,2)cin>>A[i];
    SORT(A);
    REP(i,A[1])cout <<A[0];
}
    

Measured memory_bytes: 3632
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define maxn 100005
using namespace std;
typedef long long ll;
int n;
ll a[maxn],b[maxn],cnt[maxn];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		b[i]=a[i];
	}
	sort(b+1,b+1+n);
	int sz=unique(b+1,b+1+n)-(b+1);
	for(int i=1;i<=n;i++)
	{
		a[i]=lower_bound(b+1,b+1+sz,a[i])-b;
		cnt[a[i]]++;
	}
	ll ans=0;
	for(int i=1;i<=n;i++)
	{
		if(cnt[a[i]]>=b[a[i]])
		{
			ans+=(cnt[a[i]]-b[a[i]]);
			cnt[a[i]]=b[a[i]];
		}
		else
		{
			ans+=cnt[a[i]];
			cnt[a[i]]=0;
		}
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 2560
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vv = vector<vector<ll>>;
using edge = struct {
  int to;
  int cost;
};
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end());
#define MIN(vec) *std::min_element(vec.begin(), vec.end());
#define BIT(n, num) std::bitset<(n)>((num)).to_string()
#define REV(T) greater<T>()

typedef pair<ll, ll> Pair;
bool pairCompare(const Pair &firstElof, const Pair &secondElof) {
  return firstElof.second > secondElof.second;
}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1)
    ret[n] = 1;
  return ret;
}

ll factorial(int n) {
  ll ans = 1;
  for (int i = 2; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll P(int n, int m) {
  ll ans = 1;
  for (int i = m + 1; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll power(int n, int m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = power(n, m / 2);
    return (tmp * tmp) % MOD;
  } else {
    return (n * power(n, m - 1)) % MOD;
  }
}
ll C(int n, int m) {
  return (P(n, n - m) * power(factorial(m), MOD - 2)) % MOD;
}
ll GCD(ll a, ll b) {
  if (b == 0)
    return a;
  return GCD(b, a % b);
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ll A, B, K;
  ll count = 0;
  cin >> A >> B >> K;
  auto c = divisor(GCD(A, B));
  sort(ALL(c), REV(ll));
  AUTO(i, c) {
    count++;
    if (count == K)
      cout << i << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
s = input()
n = len(s)
s_1 = s[:(n-1)//2]
s_2 = s[(n-1)//2 +1:]
s_1_new = ''.join(list(reversed(s_1)))
s_2_new = ''.join(list(reversed(s_2)))
s_new = ''.join(list(reversed(s)))
if s == s_new and s_1 == s_1_new and s_2 == s_2_new:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <ctime>
#include <cstdlib>


using namespace std;

int main() {
    
    double r;
    cin >> r;
    cout << fixed << setprecision(20);
    cout << r * r * M_PI << " " << 2 * r * M_PI << endl;

}



Measured memory_bytes: 3268
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 13;
const int MAXM = 2010;
const int MAXK = 110;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    int res = 0;
    FOR(i,1,n) {
        int x;
        cin >> x;
        res += (x >= k);
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string>
#include <algorithm>
#include <map>
#include <iostream>
using namespace std;
map<string, int> a, b;
string str;
int main(){
int N, M;
cin>>N;
for(int i=1; i<=N; ++i){ cin>>str; a[str]++; }
cin>>M;
for(int i=1; i<=M; ++i){ cin>>str; b[str]++; }
int best = 0;
for(map<string, int>::iterator it=a.begin(); it!=a.end(); ++it){
best = max(best, it->second - b[it->first]);
}
printf("%d\n", best);
return 0;
}

Measured memory_bytes: 256