akhauriyash/Code-Regression huggingface dataset:
s=input()
n=len(s)
k=int(input())
da=[]
for i in range(0,n):
    for j in range(5):
        if i+j<n+1:
            da.append(s[i:i+j+1])
da=list(set(da))
da=sorted(da)
print(da[k-1])


Measured memory_bytes: 5068
N,a,b = list(map(int,input().split()))
Sum_0 = 0

for i in range(1,N+1):
    Sum_1 = 0
    t = i
    while t != 0:
        Sum_1+=t%10
        t = t//10
        
    if a <= Sum_1 <= b:
        Sum_0+=i
print(Sum_0)

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

#define dump(x) cout << (x) << endl
#define Int int64_t
#define fi first
#define se second

Int INF = 1e18;
Int mod = 1e9+7;

int main() {
    Int n, k;
    cin >> n >> k;
    vector<Int> a(n), b(n);
    for (Int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (Int i = 0; i < n; i++) {
        cin >> b[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end(), greater<Int>());
    Int sum = 0;
    for (Int i = 0; i < n; i++) {
        sum += a[i];
    }
    if (sum <= k) {
        dump(0);
        return 0;
    }
    Int ma = 0;
    for (Int i = 0; i < n; i++) {
        ma = max(ma, a[i] * b[i]);
    }
    Int ok = ma;
    Int ng = 0;
    Int mid = (ok + ng) / 2;
    while (abs(ok - ng) > 1) {
        mid = (ok + ng) / 2;
        bool check = true;
        Int rest = k;
        for (Int i = 0; i < n; i++) {
            Int sub = a[i] - mid / b[i];
            rest -= max((Int)0, sub);
            if (rest < 0) {
                check = false;
                break;
            }
        }
        if (check) {
            ok = mid;
        }
        else {
            ng = mid;
        }
        //cout << ok << " " << ng << endl;
    }
    dump(ok);
    return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>

const long long Mod = 998244353;

long long div_mod(long long x, long long y, long long z)
{
	if (x % y == 0) return x / y;
	else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y;
}

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

	int i, max = N + M * 3;
	long long fact[2500001], fact_inv[2500001];
	for (i = 1, fact[0] = 1; i <= max; i++) fact[i] = fact[i-1] * i % Mod;
	for (i = max - 1, fact_inv[max] = div_mod(1, fact[max], Mod); i >= 0; i--) fact_inv[i] = fact_inv[i+1] * (i + 1) % Mod;
	
	long long ans = fact[max-1] * fact_inv[N-1] % Mod * fact_inv[max-N] % Mod;
	for (i = M - 1; i >= 0; i--) ans = (ans - fact[N+i-2] * fact_inv[N-2] % Mod * fact_inv[i] % Mod * N % Mod + Mod) % Mod;
	for (i = M + 2; i <= M * 3 && i <= N; i += 2) ans = (ans - fact[N] * fact_inv[i] % Mod * fact_inv[N-i] % Mod * fact[(max-N-i)/2+N-1] % Mod * fact_inv[N-1] % Mod * fact_inv[(max-N-i)/2] % Mod + Mod) % Mod;
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 40668
#include<bits/stdc++.h>
#define N 100005
#define int long long
using namespace std;
int n,m;
char c[N];
struct data{
	int x,v;
}a[N];
bool cmp(data a,data b){
	return a.v>b.v;
}
int tree[N<<2];
void Up(int p){
	tree[p]=max(tree[p<<1],tree[p<<1|1]);
}
void Build(int l,int r,int p){
	if(l==r){
		tree[p]=l;
		return;
	}
	int mid=(l+r)>>1;
	Build(l,mid,p<<1);
	Build(mid+1,r,p<<1|1);
	Up(p);
}
int query(int l,int r,int L,int R,int p){
	if(l==L&&r==R)return tree[p];
	int mid=(l+r)>>1;
	if(R<=mid)return query(l,mid,L,R,p<<1);
	else if(L>mid)return query(mid+1,r,L,R,p<<1|1);
	else return max(query(l,mid,L,mid,p<<1),query(mid+1,r,mid+1,R,p<<1|1));
}
void update(int l,int r,int x,int p){
	if(l==r){
		tree[p]=0;
		return;
	}
	int mid=(l+r)>>1;
	if(x<=mid)update(l,mid,x,p<<1);
	else update(mid+1,r,x,p<<1|1);
	Up(p);
}
long long ans;
signed main(){
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=n;i++)scanf("%lld%lld",&a[i].x,&a[i].v);
	sort(a+1,a+n+1,cmp);
	Build(1,m,1);
	for(int i=1;i<=n;i++){
		int x=a[i].x,v=a[i].v;
		if(x>m)continue;
		int t=query(1,m,1,m-x+1,1);
		if(t==0)continue;
		ans+=v;
		update(1,m,t,1);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4992
'''
A - Christmas Eve Eve Eve
https://atcoder.jp/contests/abc115/tasks/abc115_a

>>> main(25)
Christmas

>>> main(22)
Christmas Eve Eve Eve
'''

def main(d):
    day = 25
    _d = day - d
    
    out = ['Christmas']
    
    for _ in range(_d):
        out.append('Eve')
    
    print(' '.join(out))
    
if __name__ == '__main__':
    main(int(input()))

Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int ans = N % 111 == 0 ? N / 111 * 111 : (N / 111 + 1) * 111;
        System.out.println(ans);
    }
}


Measured memory_bytes: 23892
N = int(input())

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

unit = []
for i in range(1, 2**32):
    if 6 ** i > N:
        break
    unit.append(6 ** i)
for i in range(1, 2**32):
    if 9 ** i > N:
        break
    unit.append(9 ** i)

for v in unit:
    dp[v] = 1

for i in range(2, N+1):
    num = dp[i]
    for v in unit:
        num = min(num, dp[v] + dp[i - v])
    dp[i] = num

print(dp[N])



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

int main(){
    int max = 1<<15;        // << はシフト演算
    vector<int> sq(max);
    for( int i = 0; i*i < max; i++ ){
        for( int j = 0; i*i+j*j < max && j <= i; j++ ){
            for( int k = 0; i*i+j*j+k*k < max && k <= j; k++ ){
                for( int l = 0; i*i+j*j+k*k+l*l < max && l <= k; l++ ){
                    sq[i*i+j*j+k*k+l*l]++;
                }
            }
        }
    }
    int n;
    while( cin >> n, n ){
        cout << sq[n] << endl;
    }
}

Measured memory_bytes: 1272
a = int(input())
b = int(input())
c = int(input())
x = int(input())
total = 0
cnt = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            total = 500*i+100*j+50*k
            if total == x:
                cnt += 1
print(cnt)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N;
char s[10];
int l, r;
int fl, fr, fm;

void query(int x, int &fx) {
  printf("%d\n", x); fflush(stdout);
  scanf("%s", s);
  if (s[0] == 'V') exit(EXIT_SUCCESS);
  fx = (s[0] == 'M') ? 1 : -1;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  scanf("%d", &N);
  l = 0; r = N-1;
  
  query(l, fl);
  query(r, fr);

  while (r-l > 1) {
    int m = (l+r)/2;
    query(m, fm);
    if (((m-l+1)&1)^(fl==fm)) r = m, fr = fm;
    else l = m, fl = fm;
  }

  return 0;
}

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

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

    if (n == 1) {
        cout << "Hello World" << endl;
    } else {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll a, ll b){
   if(b == 0) return a;
   return gcd(b, a % b);
}
int main(){
   int n,k; cin >> n >> k;
   vector<ll> x(n);
   rep(i,n) cin >> x[i];
   
   ll MIN = INFINITY;
   if(n == k){
      if(x[n - 1] <= 0) cout << abs(x[0]) << endl;
      else if(x[0] >= 0) cout << x[n - 1] << endl;
      else{
      if(abs(x[0]) >= x[n - 1])cout << abs(x[0]) + 2 * x[n - 1] << endl;
      else cout << abs(x[0] * 2) + x[n - 1]  << endl;
      }
      return 0;
   }
   rep(i,n - k + 1){
      if(x[i + (k - 1)] <= 0)MIN = min(abs(x[i]), MIN);
      else if(x[i] >= 0)MIN = min(x[i + (k - 1)], MIN);
      else{ 
         if(abs(x[i]) >= x[i + (k - 1)])MIN = min(abs(x[i]) + 2 * x[i + (k - 1)], MIN);
         else MIN = min(abs(x[i] * 2) + x[i + (k - 1)], MIN);
      }
   }
   cout << MIN << endl;
}

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

using ll = long long;
using P = pair<int, ll>; // to, cost
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)

const ll INF = 1LL << 60;
vector<vector<P>> G;

int main() {
    int n;
    cin >> n;
    G.resize(n);
    rep(i, n - 1) {
        int a, b, c; scanf("%d%d%d", &a, &b, &c);
        a--; b--;
        G[a].push_back(P(b, c));
        G[b].push_back(P(a, c));
    }
    int q, k; cin >> q >> k;
    k--;

    queue<P> Q;
    vector<ll> d(n, INF);
    d[k] = 0;
    Q.push(P(k, d[k]));
    static bool used[100010] = {0};
    used[k] = true;
    while (Q.size()) {
        P qu = Q.front(); Q.pop();
        for (P& p : G[qu.first]) {
            if (used[p.first]) continue;
            used[qu.first] = true;

            ll nd = qu.second + p.second;
            Q.push(P(p.first, nd));
            d[p.first] = nd;
        }
    }

    rep(j, q) {
        int x, y; scanf("%d%d", &x, &y);
        x--; y--;
        assert(d[x] < INF);
        assert(d[y] < INF);
        cout << d[x] + d[y] << "\n";
    }

    return 0;
}

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

int main() {
    string a,b;
    cin>>a>>b;
    if(a>b)
        cout<<'>'<<endl;
    if(a==b)
        cout<<"="<<endl;
    if(a<b){
        cout<<"<"<<endl;
    }
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())

ll calc_lcm(ll a, ll b)
{
    return ((a/__gcd(a,b))*b);
}

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

    ll n,i,j,ans=0;
    cin>>n;
    string s;
    ll cnt[100];
    memset(cnt,0,sizeof(cnt));
    for(i=1;i<=n;i++)
    {
        s = to_string(i);
        cnt[(s[0]-'0')*10 + (s[sz(s)-1]-'0')]++;
    }
    for(i=11;i<100;i++)
    {
        for(j=11;j<100;j++)
        {
            if((i/10) == (j%10) && (j/10) == (i%10)) ans+=(cnt[i]*cnt[j]);
        }
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <functional>  
#include <algorithm>  
#include <iostream>  
#include <fstream>  
#include <sstream>  
#include <iomanip>  
#include <numeric>  
#include <cstring>  
#include <cassert>  
#include <cstdio>  
#include <string>  
#include <vector>  
#include <bitset>  
#include <queue>  
#include <stack>  
#include <cmath>  
#include <ctime>  
#include <list>  
#include <set>  
#include <map>  
#include <climits>

using namespace std;

#define PB push_back  
#define MP(A, B) make_pair(A, B)  
#define fi first  
#define se second  

#define gcd(a,b) __gcd(a,b)
#define pi acos(-1.0)
#define pii pair<int,int>
#define ll long long  
#define MAX 1000005  
#define MOD 1000000007  
#define INF 0x3f3f3f3f  
#define EXP 1e-8  
#define lowbit(x) (x&-x)  
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 

int main()
{
    ll a, b, n, ans=LONG_MIN;
    cin >> a >> b >> n;
    // for (int i = 0; i < 5*b; ++i) {
    //     cout << floor((double)a*(i)/b) - a*floor((double)(i)/b) << ' ' << i << endl;
    // }
    if (b-1 <= n) {
        // for (ll i = b; i <=n; ++i) {
        //     ll tans =floor((double)a*(i)/b) - a*floor((double)(i)/b);
        //     ans = max(ans, tans); 
        // }
        ll tans = floor((double)a*(b-1)/b) - a*floor((double)(b-1)/b);
        ans = max(ans, tans); 
        cout << ans;
        return 0;}
    if (n <= b) {
        ans = floor((double)a*(n)/b) - a*floor((double)(n)/b);
        ll tans = -1;
        if (n-1>=0) tans = floor((double)a*(n-1)/b) - a*floor((double)(n-1)/b);
        ans = max(ans, tans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3716
import java.math.BigInteger;
import java.util.Scanner;

public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;

	public void mainrun() {
		scan = new Scanner(System.in);

		while(scan.hasNext()) {
			looprun();
		}
	}

	public void looprun() {
		String ans = "NA";
		String s = scan.next();

		boolean skip = false;
		String[] str = s.split("[+=]");

		for(String es : str) {
			if(es.charAt(0) == 'X' && es.length() > 1) {
				skip = true;
				break;
			}
		}

		for(int i = (skip ? 1 : 0 );i <= 9;i++) {

			BigInteger a = new BigInteger(str[0].replaceAll("X", Integer.toString(i)));
			BigInteger b = new BigInteger(str[1].replaceAll("X", Integer.toString(i)));
			BigInteger c = new BigInteger(str[2].replaceAll("X", Integer.toString(i)));

			if(a.add(b).equals(c)) {
				ans = Integer.toString(i);
				break;
			}
		}

		System.out.println(ans);

	}
}


Measured memory_bytes: 30328
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  vector<int> a(n), b(n); REP(i, n) cin >> a[i] >> b[i];
  sort(ALL(a));
  sort(ALL(b));
  if (n & 1) {
    cout << b[n / 2] - a[n / 2] + 1 << '\n';
  } else {
    int ans = 0;
    ll l = (a[n / 2 - 1] + a[n / 2] + 1) / 2;
    ans += (a[n / 2 - 1] + a[n / 2]) & 1;
    ll r = (b[n / 2 - 1] + b[n / 2]) / 2;
    ans += (b[n / 2 - 1] + b[n / 2]) & 1;
    cout << (l > r ? ans - 1 : ans + r - l + 1 + (r - l)) << '\n';
  }
  return 0;
}


Measured memory_bytes: 4752
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		Long[] a = new Long[n];
		String[] a2 = new String[n];
		
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
			a2[i] = String.format("%42s", Long.toBinaryString(a[i])).replace(" ", "0");
		}
		
		long x = 0;
		for (int i=41; i>=0; i--) {
			long test = (long) Math.pow(2, i);
			if (test > k) continue;
			
			int one = 0;
			int zero = 0;
			for (int j=0; j<n; j++) {
				char c = a2[j].charAt(41 - i);
				//System.out.println(a2[j] + "の" + (41 - i) + "文字目は" + c + "です");
				one += 1 ^ Character.getNumericValue(c);
				zero += 0 ^ Character.getNumericValue(c);
			}
			
			if (one > zero) {
				long tmp = x + (long) Math.pow(2, i);
				if (k >= tmp) {
					x = tmp;
				}
			}
		}
		
		long kotae = 0;
		for (int i=0; i<n; i++) {
			kotae += x ^ a[i];
		}
		//System.out.println(x);
		System.out.println(kotae);
	}
}

Measured memory_bytes: 183376
coins = [500, 5, 100, 50, 10, 1]
uresimi = {500: 1000, 5: 5}


def get_uresimi(money, coin_type):
    coin_count = money // coin_type
    if coin_count == 0:
        return 0, money
    surplus = money % (coin_type * coin_count)
    uresisa = uresimi.get(coin_type, 0) * coin_count
    return uresisa, surplus


m = int(input())
uresii = 0
for c in coins:
    u, m = get_uresimi(m, c)
    uresii += u

print(uresii)


Measured memory_bytes: 3060
#include <iostream>
#include <map>

using namespace std;

long n;
map<long, int> map_a;

int main()
{
	long x;

	cin >> n;

	for (long i = 0; i < n; ++i)
	{
		cin >> x;

		if (map_a.find(x) == map_a.end())
		{
			map_a[x] = 1;
		}
		else
		{
			map_a.erase(x);
		}
	}

	cout << map_a.size() << endl;

	return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define eps 1e-8
#define inf INT_MAX
#define mod 1000000009
using namespace std;

int main() {
	speed;
	int n, x;
	string s;
	cin >> n >> x >> s;
	s[x - 1] += 'a' - 'A';
	cout << s << '\n';
	return 0;
}

Measured memory_bytes: 256
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

# Written by NoKnowledgeGG @YlePhan

#import math
#mod = 10**9+7
def main():
  k,s = map(int,input().split())
  ans = 0
  for i in range(k+1):
    for j in range(k+1):
      z = s - i - j
      if 0 <= z <= k:
        ans += 1
  print(ans)
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int gcd(int a,int b){
    return b==0?a:gcd(b,a%b);
}
int main(){
    int n;
    cin>>n;
    vi vec(n);
    cin>>vec;
    vi a(n);
    vi b(n);
    a[0]=vec[0];
    REP(i,n-1){
        a[i+1]=gcd(a[i],vec[i+1]);
    }
    b.back()=vec.back();
    REPR(i,n-2){
        b[i]=gcd(b[i+1],vec[i]);
    }
    int ans=max(a[n-2],b[1]);
    REP(i,n-2){
        chmax(ans,gcd(a[i],b[i+2]));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1408
// inputに入力データ全体が入る
function Main(input) {
    var a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51];
    var S = input[0]-0;
    
    console.log(a[S-1]);
}



Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n"));


Measured memory_bytes: 21064
x1,y1,x2,y2 = map(int,input().split())
xd = x2 - x1
yd = y2 - y1
x3 = x2 - yd
y3 = y2 + xd
x4 = x3 - xd
y4 = y3 - yd
print(x3,y3,x4,y4)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
  private static int countPower(int n) {
    int count = 0;
    while (n % 2 == 0) {
      ++count;
      n /= 2;
    }
    return count;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int max = 0;
    for (int i = 1; i <= n; ++i) {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    }

    System.out.println(ans);
    
    sc.close(); 
  }
}


Measured memory_bytes: 24020
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

W, a, b = MAP()
print(max(0, b-a-W, a-b-W))

Measured memory_bytes: 13676
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD 998244353
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;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main() {
    ll n,count=0,oddcount;
    cin >> n;
    for (ll i=0;i<n;i++){
        ll a;
        cin >> a;
        if (a%4==0){
            count++;
        }else if (a%2==0){
            oddcount++;
        }
    }
    n-=oddcount/2*2;
    if (count>=n/2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3616
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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

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

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

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

fn main() {
    input!{
        n: usize,
        m: usize,
        v: [[usize1]; m],
        p: [usize; m]
    }
    let mut ans: usize = 0;
    'next: for s in 0..1 << n {
        for i in 0..m {
            let mut t = 0;
            for j in v[i].iter() {
                if (1 << j) & s > 0 {
                    t += 1;
                }
            }
            if t % 2 != p[i] {
                continue 'next;
            }
        }
        ans += 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1LL << 60;

int a[4] = {0, 300000, 200000, 100000};

int main() {
  cin.tie(0); ios_base::sync_with_stdio(false);
  int X, Y; cin >> X >> Y;
  int ans = 0;
  if(X <= 3) {
    ans += a[X];
  }
  if(Y <= 3) {
    ans += a[Y];
  }
  if(X == 1 && Y == 1) ans += 400000;
  cout <<ans;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

int main(){
    ll a, b, m;
    cin >> a >> b >> m;

    vector<ll> ref(a), den(b);

    rep(i, a)cin >> ref[i];
    rep(i, b)cin >> den[i];

    ll ans = LINF;
    rep(i, m){
        ll x, y, c;
        cin >> x >> y >> c;
        x--, y--;
        ans = min(ans, ref[x]+den[y]-c);
    }

    sort(ALL(ref));
    sort(ALL(den));

    cout << min(ans, ref.front()+den.front());
}

Measured memory_bytes: 1792
N = int(input())
aLst = []
ans = -1
cnt = 0
for i in range(N):
    aLst.append(int(input()) - 1)

tmp = 0
index = 0
for i in range(N):
    tmp = aLst[tmp]
    aLst[index] = 0
    if tmp == 0:
        break
    elif tmp == 1:
        cnt += 1
        ans = cnt
        break
    else:
        index = tmp
        cnt += 1

print(ans)

Measured memory_bytes: 7084
#include <iostream>
using namespace std;
int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	if (A == B || B == C || A == C)
		if (A == B && A == C)
			cout << "No" << "\n";
		else
			cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
}

Measured memory_bytes: 3568
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi                  3.14159265359
ll INF=1e18+10;
ll MOD=1000000009;

int main()
{
    ll a;cin>>a;
    ll ans=3*a*a;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char Aa;
    scanf("%c",&Aa);

    if(Aa =='a' || Aa == 'e' || Aa == 'i' || Aa == 'o' || Aa=='u')
    {
        printf("vowel\n");
    }

    else
    {
        printf("consonant\n");
    }

}

Measured memory_bytes: 128
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

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

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

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    int a, b;
    cin >> a >> b;
    print(a * b);

    return 0;
}



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

int c[66];
complex<double> a[66];
int main() {
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y >> c[i];
        a[i] = {x, y};
    }
    auto l = 0., r = 2e5;
    for(int e = 0; e < 100; e++) {
        auto t = (l + r) / 2;
        for(int i = 0; i < n; i++) {
            for(int j = i; j < n; j++) {
                auto d = a[i] == a[j] ? 1 : abs(a[j] - a[i]);
                auto r = t / c[i], s = t / c[j];
                auto x = (d * d + r * r - s * s) / d / 2;
                auto y = r * r < x * x ? 0 : sqrt(r * r - x * x);
                for(auto p :
                    {a[i], a[i] + complex<double>(x, y) * (a[j] - a[i]) / d,
                     a[i] + complex<double>(x, -y) * (a[j] - a[i]) / d}) {
                    int cn = 0;
                    for(int l = 0; l < n; l++)
                        if(abs(a[l] - p) <= t / c[l] + 1e-10)
                            cn++;
                    if(cn >= k)
                        goto pn;
                }
            }
        }
        l = t;
        continue;
    pn:
        r = t;
    }
    cout.precision(18);
    cout << l << endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int a,b,c;
		cin>>a>>b>>c;
		if(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a)
			cout<<"YES"<<endl;
		else  
			cout<<"NO"<<endl;
	}
	return 0;	
}

Measured memory_bytes: 1152
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int a, b;
	string op; cin >> a >> op >> b;
	if (op == "+")cout << a + b << endl;
	else cout << a - b << endl;
}

Measured memory_bytes: 256
class dice:
    def __init__(self, first, second, third, fourth, fifth, sixth):
        self.up = first
        self.down = sixth
        self.S = second
        self.E = third
        self.N = fifth
        self.W = fourth
    def spinleft(self):
        temp = self.S
        self.S = self.W
        self.W = self.N
        self.N = self.E
        self.E = temp
    def movetoaim(self, u, S):
        # if upside != u, move dice to make upside become u
        if u == self.down:
            self = self.move("E")
            self = self.move("E")
        elif u != self.up:
            if u == self.S:
                self = self.move("N")
            elif u == self.E:
                self = self.move("W")
            elif u == self.N:
                self = self.move("S")
            else:
                self = self.move("E")
        # if South != S, spin to match them
        if S == self.W:
            self.spinleft()
        elif S == self.N:
            self.spinleft()
            self.spinleft()
        elif S == self.E:
            for i in range(3):
                self.spinleft()
        return self
        
    def move(self, direction):
        if direction == "S":
            temp = self.up
            self.up = self.N
            self.N = self.down
            self.down = self.S
            self.S = temp 
            return self
        elif direction == "E":
            temp = self.up
            self.up = self.W
            self.W = self.down
            self.down = self.E
            self.E = temp
            return self
        elif direction == "N":
            temp = self.up
            self.up = self.S
            self.S = self.down
            self.down = self.N
            self.N = temp
            return self
        else:
            temp = self.up
            self.up = self.E
            self.E = self.down
            self.down = self.W
            self.W = temp
            return self

nums = list(map(int,input().split()))
dice1 = dice(nums[0], nums[1], nums[2], nums[3], nums[4], nums[5])
n = int(input())
for i in range(n):
    aim = list(map(int,input().split()))
    dice1 = dice1.movetoaim(aim[0], aim[1])
    print(str(dice1.E))


Measured memory_bytes: 5616
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
//vector<vector<ll>> piyo(tate,vector<ll> (yoko));

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1000000000
#define ll long long
#define ln cout<<endl;
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str1,str2;
    cin>>a>>n;
    vector<ll> v(n+1);
    rep(i,n) cin>>v[i];
    for(ll i=n-1;i!=0;i--) v[i]=v[i]-v[i-1];
    v[0]=0;
    sum=accumulate(v.begin(),v.end(),0);
    //cout<<sum<<endl;
    v[n]=a-sum;
    a=a-*max_element(v.begin(),v.end());
    cout<<a<<endl;

}


Measured memory_bytes: 1792
#include<iostream>
#define LL long long
#define FIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
using namespace std;

int main()
{
	FIO;
	LL a, b, k; cin>>a>>b>>k;
	if(a==k) { cout<<0<<" "<<b<<endl; return 0; }
	else if(a>k) { cout<<a-k<<" "<<b<<endl; return 0; }
	else k-=a, a=0;

	if(b==k) cout<<a<<" "<<0<<endl;
	else if(b>k) cout<<a<<" "<<b-k<<endl;
	else cout<<0<<" "<<0<<"\n";
}

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

int main()
{
	int N;
	int t[100010]={};
	int x[100010]={};
	int y[100010]={};
	int dt,d;
	
	cin >> N;
	for(int i=1;i<=N;i++)
		cin >> t[i] >> x[i] >> y[i];
	
	for(int i=0;i<N;i++)
	{
		dt=t[i+1]-t[i];
		d=abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
		if(dt<d ||(dt-d)%2!=0)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>

using namespace std;

int main() {
    int a[100],n,x;
    
    cin >> n;
    
    for(int i=0;i<n;i++){
        cin >> x;
        a[i]=x;
    }
    
    for(int i=n-1;i>=0;i--){
        cout << a[i];
        
        if(i==0)
        cout << endl;
        
        else
        cout << " ";
    }
}


Measured memory_bytes: 3100
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define ll long long
# define ln cout<<'\n'
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
 
ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

int factorial(int n)
{
    int x = 1; // 0! = 1

    for (int i = 1; i <= n; ++i)
        x *= i;

    return x;
}

int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}


using namespace std;

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


int main(){
    int N;
    cin >> N;
    int sum =0;
    string n = to_string(N);
    rep(i,n.size()){
        sum += ctoi(n[i]);
    }
    //cout << N << sum << endl;
    if (N%sum==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No"<< endl;
    }
}

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

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

  for(int i = 1; i < n; i++) {
    dp[i] = dp[i-1];
    for(int j = 0; j < i; j++) {
      long long v = dp[j] / a[j];
      long long w = dp[j] + (a[i] - a[j]) * v;
      dp[i] = max(dp[i], w);
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    string s;
    cin >> s;
    int n = s.size();
    int num = 0;
    for(int i=0;i < n-1;i++){
        if(s[i]=='A' && s[i+1] == 'C'){
            num++;
        }
    }
    if(num >= 1){
        cout <<"Yes" << endl;
    }
    else{
        cout <<"No" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int C_MAX = 3;
int main (void) {
  int c[C_MAX][C_MAX];

  for (int i = 0; i < C_MAX; i++) {
    for (int j = 0; j < C_MAX; j++) {
      cin >> c[i][j];
    }
  }

  for (int a0 = 0; a0 <= c[0][0]; a0++) {
    int b0 = c[0][0] - a0;
    int b1 = c[0][1] - a0;
    int b2 = c[0][2] - a0;
    int a1 = c[1][0] - b0;
    int a2 = c[2][0] - b0;
    if (a1 + b1 == c[1][1] && a1 + b2 == c[1][2] && a2 + b1 == c[2][1] && a2 + b2 == c[2][2]) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}

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

int main()
{
    long long X;
    cin >> X;
    long long dep = 100;
    int year =0;


    while(1){
        dep = dep * 1.01;
        //cout << dep <<endl;
        year++;
        //cout << year <<endl;
        if(dep >= X) break;
    }

    cout << year <<endl;

}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
  for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
  for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup \
  cin.tie(0);  \
  ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 998244353;

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (int i = 0; i < v.size(); ++i) {
    is >> v[i];
  }
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < v.size() - 1; ++i) {
    os << v[i] << " ";
  }
  if (v.size() > 0) {
    os << v[v.size() - 1] << endl;
  }
  return os;
}

int main() {
  int d,g;
  cin >> d >> g;
  vint p(d), c(d);
  REP(i, d) { cin >> p[i] >> c[i]; }
  int ans = INT_MAX;
  REP(i, (1 << d)) {
    ll sum = 0;
    int cnt = 0;
    vector<bool> full(d, false);
    REP(j,d){
      if (i & (1 << j)){
        full[j] = true;
        sum += c[j];
        sum += p[j] * (100 * (j + 1));
        cnt += p[j];
      }
    }
    if (sum >= g) {
      ans = min(ans,cnt);
      continue;
    }
    IREP(j, d){
      if (full[j]){
        continue;
      }
      int total_pos = (100 * (j + 1)) * (p[j] - 1);
      if (g - sum <= total_pos){
        int rem = g - sum;
        if (rem % (100 * (j + 1)) == 0) {
          cnt += rem / (100 * (j + 1));
        } else {
          cnt += 1 + rem / (100 * (j + 1));
        }
        ans = min(ans, cnt);
      }
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	static int result=0;
	static int N;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		 N= sc.nextInt();
		int M=sc.nextInt();
		int[] a=new int[M];
		int[] b=new int[M];
		for(int i=0;i<M;i++){
			a[i]=sc.nextInt()-1;
			b[i]=sc.nextInt()-1;
		}
		sub2(a,b,(int)Math.pow(2, N)-2,0);
		System.out.println(result);				

	}
	public static void sub2(int[]a,int[]b,int pass,int pos){
		if(pass==0){
			result++;
			return;
		}
		for(int i=0;i<N;i++){
			if((pass/(int)Math.pow(2,i))%2==1){
				if(sub1(a,b,pos,i)){
					sub2(a,b,pass-(int)Math.pow(2,i),i);
				}
				
			}
		}
		return;
	}
	public static boolean sub1(int[] a,int[] b,int n,int m){
		for(int i=0;i<a.length;i++){
				if(a[i]==n&&b[i]==m){
					return true;
				}
				if(a[i]==m&&b[i]==n){
					return true;
				}
		}
		return false;
	}
}

Measured memory_bytes: 22356
#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
  ll n;
  cin>>n;
  
  string s;
  
  cin>>s;
  
  stack<ll>q;
  
  for(ll i=0;i<n;i++){
      if(s[i]=='R')
      q.push(i);
  }
  
  ll ans=0;
  
  for(ll i=0;i<n;i++){
      if(s[i]=='R')
      continue;
      
      if(q.empty())
      break;
      
      ll x=q.top();
      
      if(x<i)
      break;
      
      swap(s[x],s[i]);
      q.pop();
      ans++;
  }
  
  cout<<ans<<endl;
}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();
  
//Good Bye!
    return 0;
}

Measured memory_bytes: 5144
N = int(input())
N=N+1

a_ =sum(list(range(1,N,1)))
a_3=sum(list(range(3,N,3)))
a_5=sum(list(range(5,N,5)))
a_15=sum(list(range(15,N,15)))
ans=a_ + a_15 -(a_3+a_5)
print(ans)

Measured memory_bytes: 75824
#include <bits/stdc++.h>
#define rp(p) for(int k = 0; k < p; k++)
#define it(q) for(auto j = q.begin(); j != q.end(); j++)
#define f float
#define s string 
#define vi vector<int>
#define vs vector<string>
#define ll long long
#define pb push_back
using namespace std;
   
int main(){
	string a;
	cin >> a;
	if(a[a.length()-1] == 's'){
		a+="es";
	}
	else{
		a+="s";
	}
	cout << a << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <map>

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

    int max = 0;
    std::map<std::string, int> num;
    for (int i = 0; i < n; i++) {
        std::string s;
        std::cin >> s;
        num[s]++;
        max = std::max(max, num[s]);
    }

    for (auto p: num) {
        if (p.second == max) {
            std::cout << p.first << std::endl;
        }
    }
    return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  int l = s.size();
  int m = t.size();
  vector<vector<int> > a(l + 1, vector<int>(m + 1));
  rep(i, l + 1) {
    a[i][0] = i;
  }
  rep(i, m + 1) {
    a[0][i] = i;
  }
  Rep(i, 1, l + 1) {
    Rep(j, 1, m + 1) {
      a[i][j] = min(a[i - 1][j - 1] + (s[i - 1] != t[j - 1]), min(a[i][j - 1] + 1, a[i - 1][j] + 1));
    }
  }
  cout << a[l][m] << endl;
}




Measured memory_bytes: 6828
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
int N,M,a[100],b[100];
double p,dp[1<<14];
int main(){
	cin>>N>>M>>p;
	p/=100;
	rep(i,M) cin>>a[i]>>b[i],a[i]--,b[i]--;
	rep1(i,(1<<N)-1){
		dp[i]=1;
		int s=i&-i;
		int c=i-s;
		while(c>0){
			c=(c-1)&(i-s);
			int x=c+s;
			double d=dp[x];
			rep(j,M){
				if( ((x>>a[j])&1) && !((x>>b[j])&1) && ((i>>b[j])&1) ) d*=p;
				if( ((x>>b[j])&1) && !((x>>a[j])&1) && ((i>>a[j])&1) ) d*=p;
			}
			dp[i]-=d;
		}
	}
	printf("%.12f\n",dp[(1<<N)-1]);
}

Measured memory_bytes: 1368
n,m = map(int, input().split())
a = [0 for i in range(n)]
b = [0 for i in range(n)]
c = [0 for i in range(m)]
d = [0 for i in range(m)]
for i in range(n):
	a[i],b[i] = map(int, input().split())
for i in range(m):
	c[i],d[i] = map(int, input().split())

def dist(a,b,c,d):
	return abs(a-c)+abs(b-d)

for i in range(n):
	aa,bb = a[i],b[i]
	ans = []
	for j in range(m):
		ans.append((dist(aa,bb,c[j],d[j]),j))
	ans.sort()
	print(ans[0][1]+1)


Measured memory_bytes: 39792
#include <cmath>
#include <cstdio>
#define DB double
#define LL long long
#define Int register int
using namespace std;
int main()
{
	LL X;
	scanf("%lld", &X);
	LL Now = 100, tot = 0;
	while (Now < X)
	{
		Now += (LL)Now * 0.01;
		tot ++;
	}
	printf("%lld", tot);
	return 0;
}

Measured memory_bytes: 3228
#include <stdio.h>

int main() {
	int M, D;
	scanf("%d%d", &M, &D);
	int i, j, cnt = 0, d1, d10;
	for (j = 1; j <= M; j++) {
		for (i = 1; i <= D; i++) {
			d1 = i % 10;
			d10 = i / 10;
			if (d1>=2&&d10>=2&&d1*d10 == j) {
				cnt++;
			}
		}
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
const int Maxn = 1e9 + 10;
const int N = 1e5 + 10;
const int INF=(0x7fffffff)/2;
int dp[105][305];
int n, W;
int w[105], v[105];
int d, ans=0;
int main(){
	int i, j, k;
	while(~scanf("%d%d",&n,&W)){
		for(i = 1; i <= n; i++)
			scanf("%d %d", &w[i], &v[i]);
		for(i = 0; i <= n; i++)
			for(j = 0; j <= 300; j++)
				dp[i][j]=0;
		for(i = 1; i <= n; i++)
			for(j = n; j > 0; j--)
				for(k = 300; k >= 0; k--){
				d = w[i] - w[1];
				if(k < d)
					break;
				dp[j][k] = max(dp[j][k], dp[j-1][k-d] + v[i]);
				}
		for(i = 0; i <= n; i++)
			for(j = 0; j <= 300; j++)
				if(1ll*i*w[1]+1ll*j<=1ll*W)
					ans = max(ans, dp[i][j]);
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 384