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

using namespace std;
const int maxn=102;
int a[maxn];
int main()
{
   int x,n;
   cin>>x>>n;
   int b;
   for(int i=1;i<=n;++i)
   {
      cin>>b;
      a[b]++; 
   } 
   int ans=0;
   int minn=100;
   for(int i=0;i<102;++i)
   {
      if(!a[i])
      {
         if(minn>abs(i-x))
         {
            ans=i;
            minn=abs(i-x); 
         } 
      } 
   }
   cout<<ans<<endl;
   return 0; 
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}
template<typename T,typename U>
ll FindErase(T &v,U tar){
  ll cnt = 0;
  for(auto it = v.begin(); it != v.end();){
    if(*it == tar){
      it = v.erase(it);
      ++cnt;
    }
    else{
      ++it;
    }
  }
  return cnt;
}

template<typename T>
bool SuffixErase(T &v,size_t suf){
  if(suf > v.size()) return false;
  for(auto it = v.begin(); it != v.end();){
    if(distance(v.begin(),it) == suf){
      v.erase(it);
      return true;
    }
    else{
      ++it;
    }
  }
  return false;
}

struct data{
  string name;
  ll n,p;
  bool f;
  vector<string> v;
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin >> n && n){
    string s;
    ll p;
    map<string,ll> m;
    map<string,bool> m2;
    rep(i,n){
      cin >> s >> p;
      m[s] = p;
      m2[s] = true;
    }
    ll t;
    cin >> t;
    vector<data> v(t);
    rep(i,t){
      cin >> v[i].name;
      v[i].f = false;
      m2[v[i].name] = false;
      cin >> v[i].n;
      rep(j,v[i].n){
        cin >> s;
        v[i].v.push_back(s);
      }
    }

    while(1){
      bool f = true;
      rep(i,t){
        if(!v[i].f){
          v[i].p = 0;
          rep(j,v[i].n){
            if(!m2[v[i].v[j]]){
              f = false;
              break;
            }
            v[i].p += m[v[i].v[j]];
            if(v[i].n - 1 == j){
              v[i].f = true;
              m2[v[i].name] = true;
              m[v[i].name] = min(m[v[i].name],v[i].p);
            }
          }
        }
      }
      if(f) break;
    }
    cin >> s;
    cout << m[s] << endl;
  }

  return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>
#include <bitset>
#include <fstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

#define INF 1000000007ll
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )
#define err(x) cerr << #x << " = " << x << endl;
#define SIZE 0

pll cost[4];
bool compr (pll a, pll b) {
   return (a.X * a.Y < b.X * b.Y);
}
int main() {
   ll N;
   cost[0].Y = 8; 
   cost[1].Y = 4;
   cost[2].Y = 2;
   cost[3].Y = 1;
   cin >> cost[0].X >> cost[1].X >> cost[2].X >> cost[3].X >> N;
   sort (cost, cost + 4, compr);
   if (cost[0].Y == 1) {
      ll res = (N / 2) * cost[0].X;
      if (N % 2) {
         res += (cost[1].Y / 2) * cost[1].X;
      }
      cout << res << endl;
   } 
   else cout << (N * cost[0].Y / 2) * cost[0].X << endl;

   return 0;
}

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

public class Main {
    static final Scanner sc    = new Scanner(System.in);
    static final int     MOD   = (int) 1E9 + 7;
    static final long    INF_L = (long) 4E18;
    static final int     INF   = Integer.MAX_VALUE;
    
    public static void main(String[] args) {
        int H = nint();
        int W = nint();
        int N = nint();
        long max = max(H, W);
        System.out.println((N + max - 1)/ max);
    }
    
    @Deprecated
    static int nint() {
        return sc.nextInt();
    }

    @Deprecated
    static int[] nints(int N) {
        return nints(N, 0, 0);
    }

    @Deprecated
    private static int[] nints(int N, int padL, int padR) {
        int[] a = new int[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nint();
        return a;
    }

    static long nlong() {
        return sc.nextLong();
    }

    static long[] nlongs(int N) {
        return nlongs(N, 0, 0);
    }

    static long[] nlongs(int N, int padL, int padR) {
        long[] a = new long[padL + N + padR];
        for (int i = 0; i < N; i++)
            a[padL + i] = nlong();
        return a;
    }

    static double ndouble() {
        return sc.nextDouble();
    }

    static double[] ndoubles(int N) {
        return ndoubles(N, 0, 0);
    }

    static double[] ndoubles(int N, int padL, int padR) {
        double[] d = new double[N + padL + padR];
        for (int i = 0; i < N; i++) {
            d[padL + i] = ndouble();
        }
        return d;
    }

    static String nstr() {
        return sc.next();
    }

    static char[] nchars() {
        return sc.next().toCharArray();
    }

    static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }

    static char[][] nchars2(int H, int W) {
        return nchars2(H, W, 0, 0);
    }

    static char[][] nchars2(int H, int W, int padLU, int padRD) {
        char[][] a2 = new char[H + padLU + padRD][W + padLU + padRD];
        for (int i = 0; i < H; i++)
            System.arraycopy(nchars(), 0, a2[padLU + i], padLU, W);
        return a2;
    }

    static long min(long... ls) {
        return Arrays.stream(ls).min().getAsLong();
    }

    static long max(long... ls) {
        return Arrays.stream(ls).max().getAsLong();
    }

    static long abs(long a) {
        return Math.abs(a);
    }
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;
  unordered_map<ll, int> count(N);
  ll a;
  REP(i, N) {
    cin >> a;
    if (count.find(a) == count.end()) {
      count.insert(make_pair(a, 1));
    } else {
      count.at(a)++;
    }
  }

  for (auto const &it : count) {
    if (it.second > 1) {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define int long long
#define vll vector<long long>
#define pii pair<long long ,long long >
#define vvi vector< vector<long long > >
#define vpii vector<pair<int,int>>
#define pll  pair<long long ,long long >
#define pb  push_back
#define ff  first
#define sec second
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend())
#define m_p make_pair
#define all(x) (x.begin(),x.end())
#define sz(v) ((int)(v.size()))
#define endl '\n'
typedef vector< long long > vi ;
const int MOD = 1e9 + 7 ;
int size = 10000000;


void solve() {

	int n, k; cin >> n ;
	vi a(n); for ( int i = 0 ; i < n; i++ ) cin >> a[i];

	int sum = 1000;

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

		if (a[i] <= a[i + 1]) {
			int x = floor( sum / a[i]);
			sum -= x * a[i];
			sum += x * a[i + 1];

		}

	}

	cout << sum << endl;

}


int32_t main() {
	fast;
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/

	int T = 1; //cin>>T;
	while (T--) {
		solve();
	}

	return 0;
}



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

signed main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int a, b, c, d; cin >> a >> b >> c >> d;
  cout << (abs(a - c) <= d or abs(a - b) <= d and abs(b - c) <= d ? "Yes" : "No") << "\n";
  return 0;
}

Measured memory_bytes: 256
// B - Colorful Creatures

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

ll A[100000];

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

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

	sort(A, A+N);

	int invalid_colors = 0;
	ll size = 0;

	for (int i=0; i<N-1; i++) {
		size += A[i];
		if (size * 2 < A[i+1]) invalid_colors = i + 1;
	}

	int ans = N - invalid_colors;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4464
#include <bits/stdc++.h>
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define pb push_back
#define ff first
#define ss second
#define all(v) (v).begin(), (v).end()

using namespace std;

int gcd(int a, int b){
    return b == 0 ? a : gcd(b, a%b);
}
int lcm(int a, int b){
    return (a*b)/gcd(a,b);
}
int ncr(int n, int k){
    int res = 1;
    if ( k > n - k )
        k = n - k;

    for (int i = 0; i < k; ++i){
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

int fibonacci(int n){
    double phi = (1LL + sqrt(5))/(double)2;
    int nth_fib = round(pow(phi,n)/sqrt(5));
    return nth_fib;
}

signed main(){

    fastIO

    int n;
    cin >> n;
    int arr[n];
    int sum = 0;
    for(int i =0; i < n; i++){
        cin >> arr[i];
        // sum += arr[i];
    }
    int maxe = *max_element(arr, arr+n);
    int fin = 1e9;
    for(int i = 0; i<= maxe; i++){
        int ans = 0;
        for(int j =0; j < n; j++){
            ans += (arr[j] - i)*(arr[j] - i);
        }
        fin = min(fin , ans);
    }
    cout << fin ;
    // sum /= n;
    // int ans =0 ;
    // for(int i =0; i < n; i++){
    //     ans += (arr[i] - sum)*(arr[i] - sum);
    // }
    // cout << ans;

    return 0;
}

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

#define PI 3.14159265359
using namespace std;
class dice{
public:
	int d[6];
	void set(int n, int x){
		d[n] = x;
	}
	int get(int n){
		return d[n];
	}
	void rotate(char c){
		int tmp;
		if (c == 'W'){
			tmp = d[3];
			d[3] = d[0];
			d[0] = d[2];
			d[2] = d[5];
			d[5] = tmp;
		}
		else if (c == 'E'){
			tmp = d[5];
			d[5] = d[2];
			d[2] = d[0];
			d[0] = d[3];
			d[3] = tmp;
		}
		else  if (c == 'N'){
			tmp = d[0];
			d[0] = d[1];
			d[1] = d[5];
			d[5] = d[4];
			d[4] = tmp;
		}
		else {
			tmp = d[4];
			d[4] = d[5];
			d[5] = d[1];
			d[1] = d[0];
			d[0] = tmp;
		}
	}
};

int main(){
	int tmp, q, u, r;
	dice d;

	vector<vector<int> > v;
	vector<int> v1{ 0, 1, 5, 4, 0 };
	v.push_back(v1);
	reverse(v1.begin(), v1.end());
	v.push_back(v1);
	vector<int> v2{ 0, 3, 5, 2, 0 };
	v.push_back(v2);
	reverse(v2.begin(), v2.end());
	v.push_back(v2);
	vector<int> v3{ 3, 1, 2, 4, 3 };
	v.push_back(v3);
	reverse(v3.begin(), v3.end());
	v.push_back(v3);
	vector<int> ans{ 2, 3, 1, 4, 0, 5 };

	for (int i = 0; i < 6; i++){
		cin >> tmp;
		d.set(i, tmp);
	}
	cin >> q ;
	for (int k = 0; k < q; k++){
		cin >> u >> r;
		for (int i = 0; i < 6; i++){
			for (int j = 1; j < 5; j++){
				if (d.get(v[i][j - 1]) == u && d.get(v[i][j]) == r){
					cout << d.get(ans[i]) << endl;
					i = 6;
					j = 5;
				}
			}
		}
	}
}

Measured memory_bytes: 3112
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(answer(n));
    }
    
    public static int answer(int n) {
        int count =0;
        for (int i=1; i<=n; i++) {
            int digits = (int)Math.log10(i)+1; //if 10 or 20
            if(digits%2 != 0) {
                count+=1;
            }
        }
        return count;
    }
}

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

int main() {

    int N;
    cin >> N;

    vector<int> A(N);
    int a;
    rep(i, N) {
        cin >> a;
        A[i] = a-1;
    }

    int ans = 0;
    rep(i, N) {
        int j = A[i];
        if (A[j] == i) ans++;
    }

    cout << ans / 2 << endl;

    return 0;
}


Measured memory_bytes: 3736
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    int N,M;
    map<string,int> blue;
    map<string,int> red;
    string s[111],t[111];
    
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> s[i];
        blue[s[i]]++;
    }
    cin >> M;
    for(int i=0;i<M;i++){
        cin >> t[i];
        red[t[i]]++;
    }
    int tmp[N];
    for(int i=0;i<N;i++){
        tmp[i] = blue[s[i]]-red[s[i]];
    }
    
    int ans = 0;
    for(int i=0;i<N;i++){
    ans = max(ans,tmp[i]);
    }
    
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std ;
int a[100010] ;
int main(){
    int n ;
    cin >> n ;
    for( int i = 1 ; i <= n ; i++ )
        scanf( "%d" , &a[i] ) ;
    sort( a + 1 , a + 1 + n ) ;
    int minx = 2147483647 ;
    int id = -1 ;
    for( int i = 1 ; i <= n - 1 ; i++ ){
        int res = abs( 2 * a[i] - a[n] ) ;
        if ( res < minx ) { minx = res ; id = i ; }
    }
    cout << a[n] << " " << a[id] << endl ;
    return 0 ;
}

Measured memory_bytes: 640
#include <iostream>

using namespace  std;

int main()
{
   int A,B;
   cin >> A >> B;
   if(A == B) cout << "IMPOSSIBLE" << endl;
   else if((A+B)%2!=0) cout << "IMPOSSIBLE" << endl;
   else cout << (A+B)/2 << endl;

   return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    std::string s;
    std::cin >> s;
    i64 j = 0, ret = 0;
    for (i64 i = 0; i < s.size(); i++) {
        if (s[i] == 'W') {
            ret += i - j;
            j++;
        }
    }

    std::cout << ret << std::endl;
    return 0;
}

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

using namespace std;

int dp[10000000];

int solve(int n) {

    if(dp[n] != -1) {
        return dp[n];
    }

    if(n < 10) {
        return 0;
    }

    int nn= 0;

    for(int i = (int)log10(n); i > 0; --i) {
        nn = max(nn, (n / (int)pow((double)10, i)) * (n % (int)pow((double)10, i)));
    }

    return dp[n] = solve(nn) + 1;

}

int main() {

    int q, n;

    memset(dp, -1, sizeof(dp));

    cin >> q;

    for(int i = 0; i < q; ++i) {
        cin >> n;
        cout << solve(n) << endl;
    }

}

Measured memory_bytes: 40280
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            String[] str1 = sc.next().split("");
            String[] str2 = sc.next().split("");
            int count = 0;
            for(int i = 0; i < str1.length; i++){
              if(str1[i].equals(str2[i])){
                count++;
              }
            }
            if(count == str1.length){
              System.out.println("Yes");
            } else {
              System.out.println("No");
            }
            }
}

Measured memory_bytes: 35604
package main

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

func main() {
	a := getInt()
	b := getInt()

	fmt.Println((a + b) % 24)
}

// -----------------------------------------

var scanner = wordScanner()

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}


Measured memory_bytes: 640
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [input() for _ in range(n)]

n,t = map(int, input().split())
l = [list(map(int,input().split())) for i in range(n)]

costs = []
for i in range(n):
    if l[i][1] <= t:
        costs.append(l[i][0])

if len(costs) == 0:
    print("TLE")
else:
    print(min(costs))



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

using namespace std;

int main(void) {
  int N, M;
  cin >> N >> M;
  vector <pair<int, int>> ab;
  for(int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    ab.push_back(pair <int, int> (y, x));
  }

  sort(ab.begin(), ab.end());

  int bridge = ab[0].first - 1;
  int count = 1;
  for(int i = 1; i < M; i++) {
    if(ab[i].second > bridge) {
      count++;
      bridge = ab[i].first - 1;
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 1400
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

    int n,k,b,ans=0;
	string s;
	cin >> n >> k >> b;

	ans = n*k;

	if(ans>b){
		ans = b;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int n;
long long x;
long long layers[51]; 
long long ps[51];
long long func(int n,long long x)
{
    if(n==0) return 1;
    if(x<=1) return 0;
    else if(x<=1+layers[n-1]) return func(n-1,x-1);
    else if(x==layers[n-1]+2) return ps[n-1]+1;// B pre p
    else if(x>=2+layers[n-1]&&x<=2*layers[n-1]+2) return ps[n-1]+func(n-1,x-2-layers[n-1])+1;
    else if(x==3+2*layers[n-1]) return 2*ps[n-1]+1;
}
int main()
{
    ios::sync_with_stdio(false);
    layers[0]=1;
    ps[0]=1;
    for(int i=1;i<=50;i++)
    {
        layers[i]=2*layers[i-1]+3;
        ps[i]=2*ps[i-1]+1;// B pre p pre B  2*pre+1
    }
    while(cin>>n>>x)
    {
       cout<<func(n,x)<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)((n) - 1); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define INF = 1e9;
#define debug(x) cout << #x << ":" << x << endl
using namespace std;
int main(){
    intl n;
    cin >> n;
    intl l;
    cin >> l;
    string s[n];
    rep(i, n){
        cin >> s[i];
    }
    sort(s,s+n);
    string t = "";
    rep(i, n){
        t += s[i];
    }
    cout <<  t << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <vector>
#include <ctime>
#include <unordered_set>
#include <string>
#include <map>
#include <unordered_map>
#include <random>
#include <set>
#include <cassert>
#include <string.h>
#include <limits.h>
#include <stack>
#include <functional>
#include <queue>
#include <numeric>
#include <bitset>
#include <iterator>
#include <algorithm>
#include <sstream>
 
 
#define inf 0x3f3f3f3f
#define sup_inf 2e18
#define pb push_back	
#define ii pair<int,int>
#define f first
#define s second
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define iii pair<int, ii >
#define in freopen("arquivoentrada","r",stdin);
#define out freopen("myfile.txt", "w", stdout);	
#define eps 1e-9
#define pi 3.14159265359
const int mod = 1e9 +7  ;
 
using namespace std;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long long ll;

using namespace std;

const int maxn = 3e5 + 100;
const int MAX = 1e3 + 10;

signed main (){
	int n , k ; cin >> n >> k;

	cout << bool(n % k) << '\n';
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
ll h, w, k;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> h >> w >> k;
    ll dp[h + 1][w + 1];
    if (w == 1)
    {
        cout << 1 << "\n";
        return 0;
    }
    for (int i = 0; i <= h; i++)
    {
        for (int j = 0; j <= w; j++)
            dp[i][j] = 0;
    }
    dp[0][1] = 1;
    ll fib[10];
    fib[0] = 1;
    fib[1] = 1;
    fib[2] = 1;
    fib[3] = 2;
    fib[4] = 3;
    fib[5] = 5;
    fib[6] = 8;
    fib[7] = 13;
    fib[8] = 21;
    fib[9] = 13 + 21;
    //fib[9] = fib[8] + 21;
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if (j == 1)
            {
                dp[i][j] = dp[i - 1][j] * fib[w + 1 - 1] + dp[i - 1][j + 1] * fib[w + 1 - 2];
            }

            else if (j == w)
            {
                dp[i][j] = dp[i - 1][j] * fib[w + 1 - 1] + dp[i - 1][j - 1] * fib[w + 1 - 2];
            }
            else
            {
                dp[i][j] = dp[i - 1][j] * fib[w - j + 1] * fib[j - 1 + 1];
                dp[i][j] %= MOD;
                dp[i][j] += dp[i - 1][j - 1] * fib[w - j + 1] * fib[j - 2 + 1];
                dp[i][j] %= MOD;
                dp[i][j] += dp[i - 1][j + 1] * fib[w - j - 1 + 1] * fib[j - 1 + 1];
            }
            dp[i][j] %= MOD;
        }
    }
    cout << dp[h][k] << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long int 
#define pb push_back 
#define mod 1e9+7
vector<ll>pr;
int find(ll x){
      // cout<<x<<" ";  
     if( pr[x]<0 )
       return x;
       else
       {  
         pr[x]=find(pr[x]);   
            return pr[x];    
       }      
}

 void connect(ll x,ll y){
        
       
       x= find(x);   y=find(y);
            //cout<<x<<" "<<y<<endl;
            if(x==y)
            return;
           if(abs(pr[x]) < abs(pr[y]) ) 
            { swap(x,y);
		 }
             pr[x]+=pr[y];
             pr[y]=x;    
        
              
 }
 bool in_same_path(ll u,ll v){
 
      if(find(u)==find(v))
        return true;
       else 
        return false;
 }
int main(){
      ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);   
      ll n,m,k;
        cin>>n>>m>>k;
        pr.resize(n);
        ll ans[n];
        for(int i=0; i<n; i++)
          {pr[i]=-1; ans[i]=0;}
          
       // ll pr[n+1]={-1};
        for(ll i=0; i<m; i++){
          ll u,v;
            cin>>u>>v;  u--; v--;
            connect(u,v);
           ans[u]--; ans[v]--;
        }
        
          //cout<<endl;
        for(int i=0; i<n; i++){
		  
		ans[i]+=  abs(pr[find(i)])-1;
		}
	
	 for(int i=0; i<k; i++){
	         int u,v;
	           cin>>u>>v;
	           u--; v--;
	           if(in_same_path(u,v))
	           {     ans[u]--; ans[v]--;
		   }
	 }
	 for(int i=0; i<n; i++)
	 cout<<ans[i]<<" ";
        
    
    }
//aaa


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

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF (1 << 29)
#define LLINF (1LL << 60)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;

string to_string(string s) { return s; }
template <class S>
string to_string(unordered_set<S> s);
template <class S>
string to_string(set<S> s);
template <class S, class T>
string to_string(map<S, T> m);
template <class T>
string to_string(vector<T> v);

template <class S, class T>
string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + "," + to_string(p.second) + "}";
}

template <class S>
string to_string(unordered_set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}

template <class S>
string to_string(set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}

template <class S, class T>
string to_string(map<S, T> m) {
  string ret = "{";
  for (pair<S, T> x : m) ret += to_string(x) + ",";
  return ret + "}";
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < (int)v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() { cerr << endl; }

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

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

int main() {
  cin.tie(0);
  int M;
  cin >> M;
  ll sum = 0, ans = 0;
  FOR(i, M) {
    ll d, c;
    cin >> d >> c;
    sum += d * c;
    ans += c;
  }
  ans--;
  while (sum >= 10) {
    ans += sum / 10;
    sum = sum % 10 + sum / 10;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int[] ra (int n) {
  auto a = new int[n];
  foreach (i; 0 .. n) readf (" %d", &a[i]);
  return a;
}

int minE (int[] a) {
  int res = int.max;
  foreach (x; a) res = min (res, x);
  return res;
}

void main() {
  int na, nb, m;
  readf (" %d %d %d", &na, &nb, &m);
  auto a = ra (na);
  auto b = ra (nb);
  //a[i] + b[j] - c[i,j] -> minimize
  //a[0] + b[0]
  int res = minE (a) + minE (b); 
  foreach (k; 0 .. m) {
    int i, j, w;
    readf (" %d %d %d", &i, &j, &w);
    res = min (res, a[i-1] + b[j-1] - w);
  }
  writeln (res);
}



Measured memory_bytes: 3068
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

#define int long long

#define fst first
#define scd second
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)

typedef pair<int, int> pii;

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

const int inf = 3e18;

int X[100010];
int Y[100010];
pii pos[100010];
int v[100010];

signed main()
{
	omajinai;

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

	int N; cin >> N;

	rep(i, N) {
		cin >> X[i];
		cin >> Y[i];
		pos[i] = pii(X[i], Y[i]);
	}

	sort(X, X + N);
	sort(Y, Y + N);

	int x, y;
	
	if (N % 2 == 0) {
		int ans = inf;
		int ansx = -1, ansy = -1;

		rep(i, 2) {
			rep(j, 2) {
				int x = X[N / 2 - i], y = Y[N / 2 - j];
				
				int sum = 0;
				int ma = 0;
				rep(k, N) {
					int a = abs(x - pos[k].fst) + abs(y - pos[k].scd);
					sum += a * 2;
					chmax(ma, a);
				}
				sum -= ma;

				if (ans >= sum) {
					ans = sum;
					ansx = x;
					ansy = y;
				}
			}
		}

		cout << ans << endl;
		cout << ansx << ' ' << ansy << endl;
	} else {
		x = X[N / 2], y = Y[N / 2];

		int ma = 0;
		int v = 0;

		rep(i, N) {
			int a = abs(x - pos[i].fst) + abs(y - pos[i].scd);
			v += a * 2;
			ma = max(ma, a);
		}
		v -= ma;

		cout << v << endl;
		cout << x << ' ' << y << endl;
	}
}

Measured memory_bytes: 4344
NtoX = {}
for i in range(1, 54001):
    NtoX[i] = -1
for i in range(1, 50001):
    n = int(i*1.08)
    NtoX[n] = i
    
N = int(input())
print(":(" if NtoX[N]==-1 else NtoX[N])

Measured memory_bytes: 9452
// All Heil Fire Lord Zuko

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;

const int N = 3 * 100 * 1000 + 19;

int n, c, k;
int a[N];

int main() {
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n >> c >> k;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    LL ans = 0, mx = a[0] + k, p = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > mx || p + 1 > c) {
            mx = a[i] + k;
            ans++;
            p = 1;
        }
        else
            p++;
    }
    cout << ++ans;
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    double a[n],b[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    double d1 = 0,d2 = 0,d3 = 0,d4 = 0;
    double sum2 = 0, sum3 = 0;
    for(int i = 0; i < n; i++){
        d1 += abs(a[i]-b[i]);
        sum2 += abs(a[i]-b[i])*abs(a[i]-b[i]);
        sum3 += abs(a[i]-b[i])*abs(a[i]-b[i])*abs(a[i]-b[i]);
        d4 = max(d4,abs(a[i]-b[i]));
    }
    double q = 1/3;

    d2 = sqrt(sum2);
    d3 = cbrt(sum3);

    printf("%f\n",d1);
    printf("%f\n",d2);
    printf("%f\n",d3);
    printf("%f\n",d4);

    return 0;
}


Measured memory_bytes: 3388
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
using namespace std;


#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)   for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<ll, ll>
#define    mem(a)       memset(a,0,sizeof(a))
const ll mod = 1000000007;

void fio()
{
#ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    freopen("Output.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
    double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
    time_taken *= 1e-9;
    cout << "\nExecuted in: " << fixed
         << time_taken << setprecision(9);
    cout << " sec";
#endif
}



void solve(){

    // std::vector<int> v;
    // for(int i=0;i<1;i++)
    // {
    //     int x;
    //     cin>>x;
    //     v.push_back(x);

    // }

    double d,t,s;
    cin>>d>>t>>s;
    double taken =d/s;
    if(taken>t)
        cout<<"No";
    else cout<<"Yes";





}

int main()
{
    //auto start = chrono::high_resolution_clock::now();
    boost;
    fio();
    ll t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    //auto end = chrono::high_resolution_clock::now();
    //TIME(start, end);
    return 0;
}

Measured memory_bytes: 3736
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, i321) => {
        read_value!($next, i32) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// # Examples
//
// # integers
// input! { n: i32, m: i32, ... }
//
// # array
// input! { n: i32, v: [i32; n], }
//
// # matrix
// input! { n: i32, m: i32, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: i32,
//     w: i32,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: i32, b: i32, c: i32,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}
fn main() {
    input! { r: i32, g: i32, b: i32 }
    if (100*r+10*g+b) % 4 ==0 {
        println!("YES");
    } else {
        println!("NO");
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <cmath>
#include <limits>
#define REP(i,n) for (int i = 0; (i) < (n); ++(i))
using namespace std;

template <class T> struct StarrySkyTreeMin {

    int N;
    vector<T> node_acc, node_min;
    const T INF = numeric_limits<T>::max() / 2;
  
    StarrySkyTreeMin (int n) {
        N = 2 << (int)log2(n);
        node_acc.resize(N*2,0);
        node_min.resize(N*2,0); 
    }

    void add(int l, int r, T val) {
        _add(l,r,val,0,0,N);
    }
    
    T get_min(int l, int r) {
        return _get_min(l,r,0,0,N);
    }

    void _add(int a, int b, T x, int k, int l, int r) {
        if (r <= a || b <= l) return;
        if (a <= l && r <= b) {
            node_acc[k] += x;
        } else {
            _add(a,b,x,k*2+1,l,(l+r)/2);
            _add(a,b,x,k*2+2,(l+r)/2,r);
            T l_val = node_min[k*2+1] + node_acc[k*2+1];
            T r_val = node_min[k*2+2] + node_acc[k*2+2];
            node_min[k] = min(l_val,r_val);
        }
    }

    T _get_min(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b) return node_min[k] + node_acc[k];
        T l_val = _get_min(a,b,k*2+1,l,(l+r)/2);
        T r_val = _get_min(a,b,k*2+2,(l+r)/2,r);
        return min(l_val,r_val) + node_acc[k];
    }

};

int main() {

    StarrySkyTreeMin<int> inst(100010);

    int n,q; cin >> n >> q;
    REP(i,q) {
        int com; cin >>com;
        if(com == 0) {
            int s,t,x;
            cin >> s >> t >> x;
            inst.add(s,t+1,x);
        } else {
            int a; cin >> a;
            cout << inst.get_min(a,a+1) << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)

int main(){
    int H, W; cin >> H >> W;
    vector<vector<int> > A(H, vector<int>(W));
    rep(i , 0, H) rep(j, 0, W) cin >> A[i][j];
    rep(i , 0, H) rep(j, 0, W) {int t;cin >> t; A[i][j] = abs(A[i][j] - t);}
    int MAX = (H+W)*80;
    vector<vector<vector<bool> > > dp(H, vector<vector<bool>>(W, vector<bool>(MAX,false)));

    rep(i, 0, H) rep(j, 0, W) rep(k, 0, MAX){
        if(i == 0 && j == 0){
            dp[i][j][A[i][j]] = true;
            continue;
        }else if(i == 0){
            dp[i][j][k] = (dp[i][j-1][abs(k - A[i][j])] || dp[i][j-1][abs(k + A[i][j])]);
        }else if(j == 0){
            dp[i][j][k] = (dp[i-1][j][abs(k - A[i][j])] || dp[i-1][j][abs(k + A[i][j])]);
        }else{
            dp[i][j][k] = (dp[i][j-1][abs(k - A[i][j])] || dp[i][j-1][abs(k + A[i][j])] || dp[i-1][j][abs(k - A[i][j])] || dp[i-1][j][abs(k + A[i][j])]);
        }
    }
    //int ans = INT32_MAX;
    rep(i, 0, MAX){
        if(dp[H-1][W-1][i]){cout << i << endl; return 0;}
    }
}

Measured memory_bytes: 12416
S = str(input())
i = 0
count = 0
a = ["dream","dreamer","erase","eraser"]

if S in a:
  print("YES")
  quit()


while i < len(S) - 7:
  if S[i] == "d":
    if S[i: i+6] == "dreamd":
      i += 5
    elif S[i:i+8] == "dreamera":
      i += 5
    elif S[i:i+8] == "dreamerd":
      i += 7
    elif S[i:i+8] == "dreamere":
      i += 7
    else:
      count += 1
      break
  elif S[i] == "e":
    if (S[i:i+6] == "erasee") or (S[i:i+6] == "erased"):
      i += 5
    elif (S[i:i+7] == "erasere") or (S[i:i+7] == "eraserd"):
      i += 6
    else:
      count += 1
      break
  else:
    count += 1
    break
      
S2 = S[::-1]
#print(count)
if count == 0:
  if (S2[0:5] == "maerd") or (S2[0:7] == "remaerd") or (S2[0:5] == "esare") or (S2[0:6] == "resare"): 
    print("YES")
    quit()
  
print("NO")

Measured memory_bytes: 41968
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=9223372036854775806;
const int inf=2147483646;
vector<pair<int,int>> a;
int n;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	cin>>n;
	for (int i=0,x,y;i<n;i++)
		cin>>x>>y,
		a.push_back({y,x});
	sort(a.begin(),a.end());
	int t=0;
	for (int i=0;i<n;i++){
		if (t+a[i].second>a[i].first){
			cout<<"No";
			return 0;
		}
		t+=a[i].second;
	}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<string,int> P;
double a[1000];
int main()
{
	int n;
	double ans=0.0;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	reverse(a,a+n);
	for(int i=0;i<n;i++)
		ans+=1.0/a[i];
	ans=1.0/ans;
	cout<<setprecision(12)<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int len,a[4],ok = 0;
char s[100010],ch;
int main(){
	scanf("%s",s+1);
	len=strlen(s+1);
	for(int i=1;i<=len;i++){
		if(s[i]=='a') a[1]++; 
		else if(s[i]=='b') a[2]++;
		else a[3]++;
	}
	sort(a+1,a+3+1);
	if(a[1]==a[2]&&a[2]==a[3]) ok=1;
	if((a[1]==(a[2]-1))&&a[2]==a[3]) ok=1;
	if(a[1]==a[2]&&a[2]==a[3]-1) ok=1;
	if(ok) puts("YES");
	else puts("NO");
	return 0;
}

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

struct node{
	int key;
	struct node *prev,*next;
};

typedef struct node* nP;

nP NIL;

void Insert(int x){
	nP data=(nP)malloc(sizeof(struct node));
	data->key=x;
	
	data->next = NIL->next;
	NIL->next->prev = data;

	NIL->next = data;
	data->prev=NIL;

	return;
}

nP Search(int x){
	nP i;
	for(i=NIL->next; i!=NIL; i=i->next){
		if(i->key==x){
			//printf("found!\n");
			return i;
		}
			
	}

	return NULL;
}
void Delete(int x){
	nP pos=Search(x);
	if(pos!=NULL){
		pos->prev->next = pos->next;
		pos->next->prev = pos->prev;
		free(pos);
	}

	return;
}

int main(){
	NIL=(nP)malloc(sizeof(struct node));
	NIL->key=-1;
	NIL->prev=NIL;
	NIL->next=NIL;

	nP tmp,pos;

	int i,n,k;	scanf("%d",&n);
	char com[20];
	for(i=0;i<n;i++){
		scanf("%s",com);
		if(com[0]=='i'){
			scanf("%d",&k);
			Insert(k);

		}else if(com[6]=='\0'){
			scanf("%d",&k);
			Delete(k);
		}else if(com[6]=='F'){
			pos=NIL->next;
			
			pos->prev->next = pos->next;
			pos->next->prev = pos->prev;

			free(pos);

		}else{
			pos=NIL->prev;

			pos->prev->next = pos->next;
			pos->next->prev = pos->prev;

			free(pos);

		}
	}

	for(tmp=NIL->next; tmp!=NIL; tmp=tmp->next){
		if(tmp != NIL->next)printf(" ");
		printf("%d",tmp->key);
	}printf("\n");

	return 0;
}



Measured memory_bytes: 33816
#include<bits/stdc++.h>
#define ll long long
#define N 200010
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
string s;
int na,a[N];
ll ansn;
int main(){
	cin>>s;
	for (int i=0;i<s.length();i++){
		if (s[i]=='A'){
			a[++na]=1;
		}else{
			if (i+1<s.length()&&s[i]=='B'&&s[i+1]=='C'){a[++na]=2;i++;}
			else a[++na]=3;
		}
	}
	for (int l=1,r=0;l<=na;l=r+1){
		if (a[l]!=3){
			while (r+1<=na&&a[r+1]!=3)r++;
			for (int i=l,su=0;i<=r;i++){
				if (a[i]==1)su++;
				else ansn+=su;
			}
		}else{
			r=l;
		}
	}
	cout<<ansn<<endl;
	return 0;
}


Measured memory_bytes: 1412
#include<bits/stdc++.h>
using namespace std;
 
signed main()
{
  int a,b,c,k; cin >> a >> b >> c >> k;
  if(k<=a){
    cout << k << "\n";
  }else if(k<=a+b){
    cout << a << "\n";
  }else{
    cout << a+(k-(a+b))*-1 << "\n";
  }
}

Measured memory_bytes: 3636
#include<stdio.h>
#define INF 1000000000

int m[100][2];

int main(void){
	int dp[100][100];
	int n;
	int i,j,k;
	int tmp;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&(m[i][0]),&(m[i][1]));
	}
	for(i=0;i<n;i++){
		dp[i][i]=0;
	}
	for(i=0;i<n-1;i++){
		dp[i][i+1]=m[i][0]*m[i][1]*m[i+1][1];
	}
	for(i=2;i<n;i++){
		for(j=0;j+i<n;j++){
			dp[j][j+i]=INF;
			for(k=0;k<i;k++){
				tmp=dp[j][j+k]+dp[j+k+1][j+i]+m[j][0]*m[j+k][1]*m[j+i][1];
				if(tmp<dp[j][j+i]){
					dp[j][j+i]=tmp;
				}
			}
		}
	}
	printf("%d\n",dp[0][n-1]);
	return 0;
}	

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

using namespace std;

int main()
{
    string S;
    cin >> S;
    bool flag = true;
    for(int i=0;i<S.size();i++){
        if(i % 2 == 0){
            if(S[i] == 'L'){
                flag = false;
                break;
            }
        }
        else{
            if(S[i] == 'R'){
                flag = false;
                break;
            }
        }
    }
    if(flag) cout << "Yes";
    else cout << "No";
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
   string s,t;
   cin >> s >> t;
   int ns = s.size();
   int nt = t.size();
   int res;
   int min=2000;
   for(int i = 0; i < ns-nt+1; ++i) {
     res = 0;
     string sub = s.substr(i,nt);
     for (int j = 0; j < nt; ++j) {
       if(sub[j] != t[j]) res++;
     }
     if (res < min ) min = res;
     if (min ==0) break;
   }
   cout << min << endl;
}

Measured memory_bytes: 3632
package main

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

func main() {
	n := readInt()
	k := readInt()
	check := make([]int, n)

	for i := 0; i < k; i++ {
		count := readInt()
		for j := 0; j < count; j++ {
			check[readInt()-1]++
		}
	}

	result := 0
	for i := 0; i < n; i++ {
		if check[i] == 0 {
			result++
		}
	}

	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 1828
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-6;
const double PI = 3.14159265;
const ll MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 100005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE;

int val[3];
int target[MAXN];
ll dp[MAXN][3];
ll pref[MAXN];

int check(int i, int j) {
    if (target[i] == (j + 1) % 3) return val[j];
    return 0;
}

int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> k;
    for (int i = 0; i < 3; i++) {
        cin >> val[i];
    }
    string T;
    cin >> T;
    for (int i = 0; i < n; i++) {
        if (T[i] == 'r')
            target[i + 1] = 0, pref[i + 1] = pref[i] + val[2];
        else if (T[i] == 's')
            target[i + 1] = 1, pref[i + 1] = pref[i] + val[0];
        else
            target[i + 1] = 2, pref[i + 1] = pref[i] + val[1];
    }
    ll sum = 0;
    for (int i = 0; i < k; i++) {
        int j = i;
        for (; j <= n; j += k) {
            if (!j) continue;
            for (int s = 0; s < 3; s++) {
                if (j - k > 0) {
                    for (int z = 0; z < 3; z++) {
                        if (z == s) continue;
                        dp[j][s] = max(dp[j][s], dp[j - k][z] + check(j, s));
                    }
                } else {
                    dp[j][s] = check(j, s);
                }
            }
        }
        j -= k;
        sum += max(dp[j][0], max(dp[j][1], dp[j][2]));
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4048