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

class Main{
  public static void main(String args[]){
    Scanner scan = new Scanner(System.in);

    String str1 = scan.next();
    String str2 = scan.next();
    char[]  charArg1 = new char[3];
    char[]  charArg2 = new char[3];

    for (int i = 0 ; i < 3 ; i++){
        charArg1 [i] = str1.charAt(i);
        charArg2 [i] = str2.charAt(i);
    }
    
    //【CHECK】charArg1
	 if(!(charArg1 [0] ==(charArg2 [2])) ){
	 	System.out.println("NO");
	 	return;
	 }
	 if(!(charArg1 [1] ==(charArg2 [1]) )){
	 	System.out.println("NO");
	 	return;
	 }
	 if(!(charArg1 [2] ==(charArg2 [0]) )){
	 	System.out.println("NO");
	 	return;
	 }

    //【CHECK】charArg2
	 if(!(charArg2 [0] ==(charArg1 [2]) )){
	 	System.out.println("NO");
	 	return;
	 }
	 if(!(charArg2 [1] ==(charArg1 [1]) )){
	 	System.out.println("NO");
	 	return;
	 }
	 if(!(charArg2 [2] ==(charArg1 [0]) )){
	 	System.out.println("NO");
	 	return;
	 }

	System.out.println("YES");
	return;
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define rep(a,b,c) for(a=b;a<c;a++)
#define repj(a,b,c) for(a=b;a<c;a++)
#define repr for(i=n-1;i>=0;i--)
#define pii pair<ll,ll>
#define pll pair<ll, ll>
#define inf 100000001
const double pie  =3.141592653589793238463;
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<=n;i++)
#define vr vector
#define POP(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define ef else if
#define all(x) (x).begin(), (x).end()
#define SORT(A) sort(A.begin(),A.end());
#define REV(A) reverse(A.begin(), A.end());
#define lenth length()
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n" 
const ll dx[4] = { -1, 1, 0, 0};
const ll dy[4] = {0, 0, -1, 1};
ll XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
ll YY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
#define precise(x) cout<<fixed<<setprecision(x)
#define t1(x)                cerr<<#x<<": "<<x<<endl
#define t2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define t4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define t5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define t6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
using namespace std;
void SieveOfEratosthenes(ll n) 
{ 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (ll i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // for (ll p=2; p<=n; p++) 
       // if (prime[p]) 
          // cout << p << " "; 
} 

ll power(ll x, ll y) 
{ 
    ll res = 1; 
    while (y > 0) 
    { 
        if (y & 1) 
            res = res * x; 
        y = y >> 1; 
        x = x * x; 
    } 
    return res; 
}
int main()
{
    fastio
    ll t,i,j,k,l,m,n,a,x,b,y,z,c,h,d,f,e,p,o,nl,np,q,r,g;
    cin>>n;
    ll arr[n];
    ll cur=0;
    map<ll,ll>mp;
    rep(i,0,n)
    {
        cin>>arr[i];
        cur+=arr[i];
        mp[arr[i]]++;
    }
    cin>>q;
    // for(auto x : mp)
    // {
    //     cout<<x.ff<<" "<<x.ss<<endl;
    // }
    // cout<<endl;
    while(q--)
    {
        cin>>a>>b;
        y= cur - mp[a]*a + mp[a]*b;
        mp[b]=mp[b]+mp[a];
        mp[a]=0;
        cur=y;
        cout<<y<<endl;
        // for(auto x : mp)
        // {
        //     cout<<x.ff<<" "<<x.ss<<endl;
        // }
        // cout<<endl;
    }
}

Measured memory_bytes: 10352
S = input()

ans = 0
divider = len(S) - 1  # +を入れることのできる個数

for i in range(1, len(S) + 1) :
    now = int(S[-i])
    mask = 0
    for j in range(i) :
        mask *= 10
        weight = 2**(max(0,j-1))
        mask += now * weight

    count = 2**(divider - i + 1)
    ans += mask * count

print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) throws Exception {
		String lefts = "qwertasdfgzxcvb";
		for (String l = sc.next(); !l.equals("#"); l = sc.next()) {
			boolean left = lefts.indexOf(l.charAt(0)) >= 0;
			int ans = 0;
			for (char c : l.toCharArray()) {
				boolean nl = lefts.indexOf(c) >= 0;
				if (left != nl) ++ans;
				left = nl;
			}
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 20004
#include <cstdio>
#include <vector>

using namespace std;

typedef pair<int,int> P;

int main() {
    int N;
    scanf("%d", &N);
    vector<P> primes;
    bool isprime;
    for (int i=2; i<=N; i++) {
        int n = i;
        isprime = true;
        for (size_t j=0; j<primes.size(); j++) {
            while (n % primes[j].first == 0) {
                if (isprime) isprime = false;
                primes[j].second++;
                n /= primes[j].first;
            }
            if (n == 1) break;
        }
        if (isprime) primes.push_back({i, 2});
    }
    int num3=0, num5=0, num15=0, num25=0, num75=0;
    for (size_t j=0; j<primes.size(); j++) {
        if (primes[j].second >= 75) num75++;
        if (primes[j].second >= 25) num25++;
        if (primes[j].second >= 15) num15++;
        if (primes[j].second >= 5) num5++;
        if (primes[j].second >= 3) num3++;
    }
    printf("%d\n", num5*(num5-1)*(num3-2)/2 + num25*(num3-1) + num15*(num5-1) + num75);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[1000000];
int main(){
	ll n;
	cin>>n;
	n--;
	ll base=26;
	ll start=0;
	int cnt=1;
	while(!(start<=n and n<start+base)){
		cnt++;
		start+=base;
		base*=26;
	}
	n-=start;
//	cout<<n<<" "<<cnt<<endl;
	
	for (int i=1;i<=cnt;i++)a[i]=0;
	int p=0;
	while(n){
		a[++p]=n%26;
		n/=26;
	}
	for (int i=cnt;i>=1;i--){
		cout<<(char)(a[i]+'a');
	}
//	cout<<endl;
//	main();
	return 0;
}

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

using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;

#define Max 1000001
#define intinf 2147483647
#define longlonginf 9223372036854775807
#define MOD 998244353
#define MOD2 1000000007
#define fastio ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define vint vector<int>
#define vll vector<long long>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define F(i,n) for(int i = 0;i<n;i++)
#define Fr(i,l,r) for(int i = l;i <= r;i++)
#define rF(i,n) for(int i = n-1;i>=0;i--)
#define all(arr) arr.begin(),arr.end()


ll Lpow(ll a,ll b)
{
    ll ans = 1;
    while(b > 0)
    {
        if(b%2)
            ans = (ans*a);
        a = (a*a);
        b = b/2;
    }
    return ans;
}

ll gcd(ll a,ll b)
{
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);
}

int n;
vector<vector<int>> adj(100005);

vector<vector<ll>> dp(100005,vector<ll>(2,0));

void dfs(int node,int p)
{
    for(auto x : adj[node])
    {
        if(x != p)
            dfs(x,node);
    }

    ll w = 1;
    ll b = 1;
    
    for(auto x : adj[node])
    {
        if(x != p)
        {
            w = w*(dp[x][0] + dp[x][1])%MOD2;
            b = b*dp[x][0]%MOD2;
        }
    }
    
    dp[node][0] = w;
    dp[node][1] = b;
}

signed main()
{
    fastio;
    
    cin >> n;
    int a,b;
    F(i,n-1)
    {
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    
    dfs(1,1);
    
    
    cout << (dp[1][0] + dp[1][1])%MOD2 << endl;
    
    return 0;
}


Measured memory_bytes: 15360
// #pragma GCC optimize("Ofast,unroll-all-loops")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define all(v) v.begin(), v.end()
#define len(v) ((int)(v).size())
#define pb push_back
#define kek pop_back
#define pii pair<int, int>
#define mp make_pair
#define int ll

#define debug(x) cout << #x << " = " << x << endl;

const int INF = (is_same<int, ll>::value ? 1e18 + 666 : 1e9 + 666);

// const int MEM_SIZE = 1e8;
// char mem[MEM_SIZE];
// int cur_mem_ptr = 0;

// void* operator new(size_t n) {
//     cur_mem_ptr += n;
//     return mem + cur_mem_ptr - n;
// }

// void operator delete(void*) noexcept {}
// void operator delete(void*, size_t) noexcept {}

template<class t1, class t2>
bool cmin(t1 &a, const t2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class t1, class t2>
bool cmax(t1 &a, const t2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#ifndef LOCAL
void UseFiles(const string &s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}
#else
void UseFiles(const string&) {}
#endif

void run();

signed main() {
    // UseFiles("squads");
    iostream::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    run();
}

const int m = 2019;

void run() {
    string s;
    cin >> s;
    int n = len(s);
    vector<int> cnt(m, 0);
    int cur = 0, curp = 1;
    ++cnt[cur];
    int ans = 0;
    for (int i = n - 1; i > -1; --i) {
        cur += (s[i] - '0') * curp;
        cur %= m;
        curp = curp * 10 % m;
        ans += cnt[cur];
        ++cnt[cur];
    }
    cout << ans << endl;
}

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


int main(){
	int K, S;
	cin >> K >> S;
	int ans = 0;
	for(int X = 0; X <= K; X++){
		for(int Y = 0; Y <= K; Y++){
			int Z = S - X - Y;
			if(0<=Z && Z <= K) ans++;
		}
	}
	cout << ans << endl;

}












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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#define pi 3.141592653589
#define MOD 1000000007
#define to() int t; cin>>t; while(t--)
#define pb push_back
#define in insert
#define mp make_pair
#define ff first
#define ss second
#define si(s) s.size()
#define fori(it,v) for(it=v.begin();it!=v.end(); it++) 
#define for1(low,high,k) for(int i=low;i<high;i+=k)
#define for11(low,high,k) for(int j=low;j<high;j+=k)
#define for2(low,high,k) for(int i=low;i<=high;i+=k)
#define rev(high,low,k)  for(int i=high;i>=low ;i-=k)
#define all(x) x.begin(), x.end()
#define fil(x,i) memset(x,i,sizeof(x));
#define setbits(x) __builtin_popcount(x)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout) 
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;

//bool cmp(pair<ll,ll>a,pair<ll,ll>b){
//	return abs(a.ff+a.ss)<abs(b.ff+b.ss);
//}

int main()
{
	boost;
	int n; cin>>n;
	vector<pair<ll,ll> >v(n);
	ll maxi1=-1e9,mini1=1e15;
	ll maxi2=-1e9,mini2=1e15;
	for1(0,n,1){ cin>>v[i].ff>>v[i].ss; 
		maxi1=max(maxi1,v[i].ff+v[i].ss);
		mini1=min(mini1,v[i].ff+v[i].ss);
		maxi2=max(maxi2,v[i].ff-v[i].ss);
		mini2=min(mini2,v[i].ff-v[i].ss);
	}
	ll ans=max(maxi1-mini1,maxi2-mini2);
	//sort(all(v),cmp);
	//ll ans=abs(v[n-1].ff+v[n-1].ss)-abs(v[0].ff+v[0].ss);
	cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 6360
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;


int main()
{
	ll N;
	cin >> N;
	vector<ll> A;
	ll btnk = 1e15 + 1;
	rep(i, 5)
	{
		ll tmp;
		cin >> tmp;
		btnk = min(btnk, tmp);
		A.push_back(tmp);
	}
	ll ans = 5 + (N-1) / btnk;
	co(ans);
	return 0;
}


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

class ModComb {
    long long *fact, *facti;
    const int mod;
public:
    explicit ModComb(int n, int m) : mod(m) {
        fact = new long long[n+1];
        facti = new long long[n+1];
        fact[0] = 1; facti[0] = 1;
        for (int i = 1; i <= n; i++) fact[i] = (fact[i-1] * i) % m;
        // calc 1/n!
        long long &inv = facti[n], pw = fact[n];
        inv = 1;
        for (int e = mod-2; e > 0; e /= 2) {
            if (e&1) inv = inv * pw % mod;
            pw = pw * pw % mod;
        }
        for (int i = n-1; i > 0; i--) facti[i] = (facti[i+1] * (i+1)) % m;
    }

    ~ModComb() {
        if (fact) delete[] fact;
        if (facti) delete[] facti;
    }

    long long get(int n, int k) const {
        if (n < 0 || k < 0 || k > n) return 0;
        return fact[n] * facti[k] % mod * facti[n-k] % mod;
    }
};


int main() {
    int n, k; cin >> n >> k;
    const int M = 1000000007;
    ModComb mc(n+2, M);
    long long ans = 1;
    for (int i = 1; i <= min(n-1, k); i++)
        ans = (ans + mc.get(n-1, i) * mc.get(n, i)) % M;
    cout << ans << endl;
}


Measured memory_bytes: 3328
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
using namespace std;
using pii = pair<int,int>;

inline int gcd(int x, int y)
{
    int r;
    if (x < y) swap(x, y);
    while (y)
        r=x%y, x=y, y=r;
    return (x);
}

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

   int x, y;
   cin >> x >> y;

   outl(gcd(x,y));
}




Measured memory_bytes: 3188
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <functional>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
using namespace std;
// #define int long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
typedef long long ll;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
const int fINF = 0x3f3f3f3f;
const int nINF = 1<<31;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, int> pci;

/////////////////////////////////////////////////////////////////////

const int N = 100+10, C = 1e5+10;
int n, c, v[N], w[N];
ll dp[N][C];

signed main() {
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(7);
    memset(dp, -1, sizeof(dp));
    cin >> n >> c;
    FOR(i, 1, n) cin >> w[i] >> v[i];
    dp[0][c] = 0;
    FOR(i, 1, n) {
    	FORD(j, c, 0) {
    		if(dp[i-1][j] != -1) {
    			if(j-w[i] >= 0) dp[i][j-w[i]] = max(dp[i][j-w[i]], dp[i-1][j]+v[i]);
    			dp[i][j] = max(dp[i][j], dp[i-1][j]);
    		}
    	}
    }
    ll ans = 0;
    FOR(i, 0, c) ans = max(ans, dp[n][i]);
    cout << ans << endl;

    return 0;
}

// Easy things to check:
// - LONG LONGS (WA)
// - const int N is correct (WA, RTE)
// - .size()-k underflow (WA, RTE, TLE)
// - small n edge cases (WA)

// Rare mistakes made in the past:
// - division by 0 (WA)
// - integer division (WA)
// - setprecision (WA)
// - INF not big enough using ll (WA)
// - setting min to 0 instead of -INF (WA)
// - outputting debug (WA)
// - allocating too much memory (locRTE, MLE)
// - stack size (locRTE)


Measured memory_bytes: 86272
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    string s;
    int ans = 0;

    cin >> n >> s;

    for (int i = 0; i < n-2; i++) {
        if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
            ans++;
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
def pr(f)
  printf "%f\n",f
end
def calc(ar)
  ave = ar.sum/ar.size.to_f
  var = ar.inject(0.0) do |sum,f|
    sum + (f-ave)**2
  end
  var = var/ar.size
  return Math.sqrt(var)
end
def code_run
  until (iN=$stdin.gets.to_i)==0 do
    pr calc($stdin.gets.split.map(&:to_i))
  end
end

code_run


Measured memory_bytes: 6940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 998244353;
ll inv[10000100];
ll FactorialInv[10000100];
ll Factorial[10000100];
ll beki(ll a, ll b){
    if(b == 0){
        return 1;
    }
    ll ans = beki(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}
void init_combination(){
    const int MAX = 10000002;
    Factorial[0] = 1;
    inv[0] = 1;
    for(int i = 1; i <= MAX; i++){
        Factorial[i] = Factorial[i - 1] * i % mod;
    }
    FactorialInv[MAX] = beki(Factorial[MAX], mod - 2);
    for(ll i = MAX - 1; i >= 0; i--) {
        FactorialInv[i] = FactorialInv[i+1] * (i+1) % mod;
    }
    for(int i = 1; i <= MAX; i++) {
        inv[i] = FactorialInv[i] * Factorial[i-1] % mod;
    }
}
ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = Factorial[a] * FactorialInv[b] % mod;
    ans = ans * FactorialInv[a - b] % mod;
    return ans;
}

bool Empty = false;
ll num[100500];
ll N;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    init_combination();
    cin >> N;
    for(int i = 1; i <= N; i++) {
        ll D;
        cin >> D;
        if(i == 1 && D != 0) {
            cout << 0 << endl;
            return 0;
        }
        if(i != 1 && D == 0) {
            cout << 0 << endl;
            return 0;
        }
        num[D]++;
    }
    ll ans = 1;
    for(int i = 1; i <= N; i++) {
        if(num[i] == 0) {
            Empty = true;
            continue;
        }
        if(Empty) {
            ans = 0;
        }
        ans *= beki(num[i-1], num[i]);
        ans  %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 235392
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
double pi=3.141592653589793;

const int MOD = 1000000007;

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

ll N,M;
vector<ll>A(106);

void batten(ll i,ll k){
	if(i==N)return;
	if((A[i]%k)>(A[i+1]%k)){
		swap(A[i],A[i+1]);
		batten(i+1,k);
		return;
	}else{
		batten(i+1,k);
		return;
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll N,H,W;
	cin>>N>>H>>W;
	ll ans=0;
	for(int i=0;i<N;i++){
		ll h,w;
		cin>>h>>w;
		if(h>=H&&w>=W)ans++;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=a;i<n;i++)
#define mat vector<vector<int> >
struct Minimum_Steiner_Tree{
	mat V;
	vector<int>T;
	int n,numT,Inf=1e8;
	Minimum_Steiner_Tree(int sz):n(sz),numT(0),V(sz,vector<int>(sz)){
		REP(i,0,sz)REP(j,0,sz)V[i][j]=(i==j?0:Inf);
	}
	void add_edge(int a,int b,int c){ V[a][b]=V[b][a]=c; }
	void add_vertex(int a){ T.push_back(a); numT++;}
	int build(){
		if(numT<=1)return 0;
		mat d(V);
		REP(k,0,n)REP(i,0,n)REP(j,0,n)d[i][j]=min( d[i][j], d[i][k] + d[k][j] );
		int OPT[(1<<numT)][n];
		REP(i,0,(1<<numT))REP(j,0,n)OPT[i][j]=Inf;
		REP(i,0,numT)REP(j,0,n)OPT[1<<i][j]=d[T[i]][j];
		REP(S,1,(1<<numT))if(S&(S-1)){
			REP(i,0,n)REP(j,0,S)if((S|j)==S) OPT[S][i] = min( OPT[S][i], OPT[j][i] + OPT[S-j][i] );
			REP(i,0,n)REP(j,0,n) OPT[S][i] = min( OPT[S][i], OPT[S][j] + d[i][j] );
		}
		int ans=Inf;
		REP(i,0,(1<<numT))REP(j,0,n)ans = min(ans, OPT[i][j] + OPT[((1 << numT)-1)-i][j]);
		return n-ans-1;
	}
};
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int main(){
	int h,w,t;
	while(cin>>h>>w,h){
		Minimum_Steiner_Tree M(h*w);
		REP(i,0,h)REP(j,0,w){
			cin>>t;
			if(t)M.add_vertex(i*w+j);
			REP(k,0,4){
				int y=i+dy[k];
				int x=j+dx[k];
				if(y<0||x<0||y>=h||x>=w)continue;
				M.add_edge(i*w+j,y*w+x,1);
			}
		}
		cout<<M.build()<<endl;
	}
}


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

int main()
{
    int n, d, t;
    scanf("%d%d", &n, &d);
    if (n % (d * 2 + 1))
        t = n / (d * 2 + 1) + 1;
    else
        t = n / (d * 2 + 1);
    printf("%d\n", t);
    return 0;
}

Measured memory_bytes: 256
N, K = gets.chomp.split(' ').map(&:to_i)
P = gets.chomp.split(' ').map { |p_i| Rational((p_i.to_i * (p_i.to_i + 1) / 2), p_i.to_i) }

s = []
s[0] = Rational(0)
N.times do |i|
  s[i + 1] = P[i] + s[i]
end

e = []
(K..N).each do |i|
  e[i] = s[i] - s[i - K]
end
puts e.compact.max.to_f


Measured memory_bytes: 36028
/*
* @author:  codancer
* @createTime:  
*/
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll mod = 998244353;
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
typedef vector<int> VI;
typedef vector<ll> VII;
typedef pair<int,int> pii;
ll dp[5000][5000];
int main(){
	int n,s;
	cin>>n>>s;
	vector<int> a(n+1);
	rep(i,1,n) cin>>a[i];
	dp[0][0]=1;
	rep(i,1,n){
		rep(j,a[i],s){
			dp[i][j]+=dp[i-1][j-a[i]];// put in S & U
			dp[i][j]%=mod;
		}
		rep(j,0,s){
			dp[i][j]+=2*dp[i-1][j];// DON'T PUT IN U
			dp[i][j]%=mod;
		}
	}
	cout<<dp[n][s]<<endl;
	return 0;
}

Measured memory_bytes: 85920
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod  = 1e9 + 7;
const ll N = 1e6 + 5;

int n,all,cnt[N];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    for(int i=1;i<=n;i++){
    	int x;cin>>x;
    	cnt[x]++;
    	all=gcd(all,x);
    }
    bool ok=true;
    for(int i=2;i<N&&ok;i++){
    	int sum=0;
    	for(int j=i;j<N;j+=i) sum+=cnt[j];
		if(sum>1) ok=false;
    }
    cout<<(ok?"pairwise coprime":all==1?"setwise coprime":"not coprime")<<endl;
    return 0;
}

Measured memory_bytes: 7480
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())

    sum = min(a,b) +min(c,d)
    print(sum)


Measured memory_bytes: 3828
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
#define INF 1 << 30
typedef pair<int, int> P;

int n, M[100][100], d[100];

void dijkstra(void) {
    int i, u, v;
    P t;
    priority_queue<P, vector<P>, greater<P> > pq;

    pq.push(make_pair(0, 0));
    while (!pq.empty()) {
        t = pq.top(); pq.pop();
        v = t.first;
        u = t.second;

        if (d[u] != INF) continue;
        d[u] = v;

        for (i = 0; i < n; i++) {
            if (d[i] != INF || M[u][i] == INF) continue;
            pq.push(make_pair(v + M[u][i], i));
        }
    }
}

int main(void) {
    int i, j, u, k, v, c;
    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        d[i] = INF;
        for (j = 0; j < n; j++) M[i][j] = INF;
    }

    for (i = 0; i < n; i++) {
        scanf("%d %d", &u, &k);
        for (j = 0; j < k; j++) {
            scanf("%d %d", &v, &c);
            M[u][v] = c;
        }
    }

    dijkstra();

    for (i = 0; i < n; i++) printf("%d %d\n", i, d[i]);

    return 0;
}

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

int main(){
  long n, m;
  cin >> n >> m;
  vector<long long int> a(n);
  vector<tuple<long long int, int>> cb(m+10);
  
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  
  rep(i, m){
    int b;
    long long int c;
    cin >> b >> c;
    cb.push_back(tie(c, b));
  }
  sort(cb.rbegin(), cb.rend());
  
  long id = 0;
  rep(i, m){
    long bb;
    long long int cc;
    tie(cc, bb) = cb[i];
    for(long j = id; j < min(n, id+bb); j++){
      if(a.at(j) < cc) a.at(j) = cc;
      else break;
    }
    id += bb;
  }
  
  long long int ans = 0;
  rep(i, n) ans += a.at(i);
  cout << ans << endl;
}

Measured memory_bytes: 5504
#pragma warning(disable:4996)

#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <complex>
#include <iterator>
#include <random>
#include <time.h>
#include <tuple>
#include <functional>
#include <list>
#include <limits.h>
#define mp make_pair
#define ni(x) scanf("%d", &(x))
#define nii(x,y) scanf("%d%d",&(x),&(y))
#define mul(x,y) ((ll)(x)*(y)%mod)
#define mtp make_tuple
#define F(i,n) for(int i = 0; i < (n); i++)
#define FF(i,n) for(int i = 1; i <= (n); i++)
#define FE(i,n) for(int i = 0; i <= (n); i++)

#ifndef __GNUG__
int __builtin_popcount(int n) {
	int x = 0;
	while (n)n -= n&(-n), x++;
	return x;
}
#endif

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
const int inf = 2012345678;
const ll infl = 9012345678901234567;
const double pi = 3.1415926535897932384626433832795;
//----------------------------------------------------------------------------//

int main() {
#ifndef __GNUG__
	freopen("input.txt", "r", stdin);
#endif
	int n, p; nii(n, p);
	int c = 0, d = 0;
	F(i, n) {
		int x; ni(x);
		if (x & 1)c++;
		else d++;
	}
	if (c == 0) {
		if (p) puts("0");
		else printf("%lld\n", 1LL << d);
	}
	else printf("%lld\n", 1LL << (c + d - 1));
	return 0;
}


Measured memory_bytes: 256
// created by anaksoleh
// 21 Feb 2020

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

#define MAXN 100005

int n;
vector<int> v(MAXN);
vector<int> dp(MAXN);
/*
int solve(int idx){
    if(idx <= 0)return 0;
    if(idx == 1)return abs(v[1] - v[0]);
    if(dp[idx])return dp[idx];
    dp[idx] = min(solve(idx-1) + abs(v[idx]-v[idx-1]),solve(idx-2) + abs(v[idx] - v[idx-2])); 
    return dp[idx];
}
*/

void solve(int len){
    dp[0] = 0;
    dp[1] = abs(v[1] - v[0]);
    for(int i = 2 ; i <= len ; i++){
        dp[i] = min(dp[i-1] + abs(v[i] - v[i-1]), dp[i-2] + abs(v[i] - v[i-2]));
    }
    cout << dp[len] << '\n';
}

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

    cin >> n;
    for(int i = 0 ; i < n ; i++)
        cin >> v[i];
    solve(n-1);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
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 eachdo(e,array) for(const auto& e : array)

template<class T> bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
typedef long long ll;
const ll INF=1e18;
const ll MOD=1e9+7;

int main(){
    ll N,M;cin>>N>>M;
    map<ll,vector<ll>> list;
    rep(i,N){
        ll a,b;cin>>a>>b;
        list[a].push_back(b);
    }
    ll res=0;
    priority_queue<ll> que;
    rep1(i,M){
        eachdo(e,list[i]){
            que.push(e);
        }
        if(!que.empty()){
            res+=que.top();
            que.pop();
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 10880
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
// #include<assert.h>
#include<random>
using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD1 998244353 
#define MEM_SIZE 100010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
 

//BELOW
void solve(void)
{
  int N;cin>>N;
  map<pair<int,int>,int> mp1,mp2;
  int res = 0;
  for (int i = 1; i <= N; i++)
  {
    string s = to_string(i);
    int X= (int)(s.front() - '0');
    int Y= (int)(s.back() - '0');
    // DEBUG(X,Y,"\n");
    mp1[make_pair(X,Y)]++;
  }
      for (int i = 1; i <= 9; i++)
    {
      for (int j = 1; j <= 9; j++)
      {
        res += mp1[make_pair(i,j)]*mp1[make_pair(j,i)];
      }
      
    }
    
  cout<<res<<endl;
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3604
N, K = map(int, input().split())
# 小さい方から順にk個とったものと、大きい方から順にk個とったものの差
# １刻みから作る最小と最大間は、全てを満たす


def calc(x, N):
    a = x * (x - 1) // 2
    b = (2 * N - x + 1) * x // 2
    return b - a + 1


tot = 0
for i in range(K, N + 2):
    ans = calc(i, N)
 #   print(ans)
    tot += ans

aa = tot % (10 ** 9 + 7)

print(aa)


Measured memory_bytes: 9084
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int n,ne=0,no=0;
	cin>>n;
	for (int i = 0; i < n; i++) {
		int t;
		cin>>t;
		if(t%2)no++;
		else ne++;
	}
	ne+=no/2;
	no%=2;
	while(ne>1){
		ne=ne-ne/2;
	}
	if(ne+no==1)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct tree{
    int to;
    long long far;
};
vector<tree> v[100001];
long long depth[100001];
void dfs(int k,int x,long long sum){
    depth[k]=sum;
    for(auto &e:v[k]){
        if(e.to==x)continue;
        dfs(e.to,k,sum+e.far);
    }
}
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n-1;i++){
        int a,b,c;
        cin >>a>>b>>c;
        v[a-1].push_back({b-1,c});
        v[b-1].push_back({a-1,c});
    }
    long long q,k;
    cin>>q>>k;
    dfs(k-1, -1, 0);
    for(int i=0;i<q;i++){
        long long x,y;
        cin>>x>>y;
        cout<<depth[x-1]+depth[y-1]<<endl;
    }
}


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if(u < 0) u += m;
    cout << u << endl;
    return u;
}

ll paty_counter(ll level, ll x){
    ll size = pow(2, level+2) - 3;
    ll pmi = pow(2, level) - 1;
    if(x == 0){
        return 0;
    }else if(level == 0){    
        return 1;
    }else{
        if(x <= (size - 1)/2){
            return paty_counter(level-1, x-1);
        }else{
            return pmi + 1 + paty_counter(level-1, x - pow(2, level+1) + 3 - 2);
        }
    }

}
 
int main() {
    ll x;
    cin >> x ;
    ll year = 0;
    ll money = 100;
    while(true){
        if(money >= x){
            break;
        }
        money = money + money / 100;
        year ++;
        //cout << money << endl;
    }
    cout << year << endl;
}



Measured memory_bytes: 3680
#include <iostream>

using namespace std;

int main () {
  int l[10];
  int v1, v2;
  
  while (cin >> l[0]) {
    cin.ignore();
    for(int i = 1; i < 10; i++) {
      cin >> l[i];
      cin.ignore();
    }
    cin >> v1;
    cin.ignore();
    cin >> v2;

    int l_total = 0;
    for(int i = 0; i < 10; i++) {
      l_total += l[i];
    }

    double cross = 1.0 * v1 * l_total / (v1 + v2);
    
    int l_partsum = 0;
    for(int i = 0; i < 10; i++) {
      l_partsum += l[i];
      if(cross <= l_partsum){
        cout << i + 1 << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 1160
require 'set'
lines = readlines.map{|line| line.split(' ').map(&:to_i)}
x=lines[0][0]
a=lines[1]
b=1
c=Set.new
for i in 0..x-1
  d=c.add?(a[i])
  if d==nil then
    b=0
    break
  end
end
if b==1 then
  puts 'YES'
else
  puts 'NO'
end

Measured memory_bytes: 28448
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>

using namespace std;

vector<int> parse() {
  int n, x;
  cin >> n;
  vector<int> A;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    A.push_back(x);
  }
  return A;
}

int main() {
  auto A = parse();
  int k;
  cin >> k; // skip q
  while (cin >> k)
    cout << distance(A.begin(), lower_bound(A.begin(), A.end(), k)) << endl;
}


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

int main() {
	string s;
      cin >> s;
    int count=0;

 if(s.at(0)!=s.at(1))count++;
  else if(s.at(1)!=s.at(2))count++;
  
  if(count>=1)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;
typedef long long ll;
ll INF=1<<29;

int main(){
	ios::sync_with_stdio(false);
	int imos[100001];
	memset(imos,0,sizeof(imos));
	int N,C,tmp=0;
	cin>>N>>C;
	vector<int>s(N),t(N),c(N);
	vector<vector<int>> start(C+1,vector<int>(100001));
	vector<vector<int>> goal(C+1,vector<int>(100001));
	for(int i=0;i<N;i++){
		cin>>s[i]>>t[i]>>c[i];
		imos[s[i]]++;
		imos[t[i]+1]--;
		start[c[i]][s[i]]++;
		goal[c[i]][t[i]]++;
	}
	for(int i=0;i<100001;i++){
		if(i==0) continue;
		imos[i]+=imos[i-1];
	}
	for(int i=0;i<100001;i++){
		int x=0;
		for(int j=0;j<C+1;j++){
			x+=min(start[j][i],goal[j][i]);
		}
		if(imos[i]-x>=tmp){
			tmp=imos[i]-x;
		}
	}
	cout<<tmp<<endl;
	return 0;
}

Measured memory_bytes: 26488
#include<bits/stdc++.h>
#define ll long long
using namespace std;

int n,q,a,b;
ll zb=0;
vector<int> V;
int arr[100005];

int main() {
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> a;
        V.push_back(a);
        arr[a]++;
        zb+=a;
    }

    cin >> q;
    for (int i=0;i<q;i++) {
        cin >> a >> b;
        zb+=(b-a)*arr[a];
        arr[b]+=arr[a];
        arr[a]=0;
        cout << zb << endl;
    }


}


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


long long LOG(long long x)
{
    long long ans = 0;
    while(x%2==0)
    {
        ans++;
        x/=2;
    }
    return ans;
}

int main()
{
    long long x;
    int n;cin>>n;
    long long ans = 0;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        ans += LOG(x);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
using namespace std;
static const int N = 100;
static const int INFTY = (1 << 21);

int n, M[N][N], d[N];

void bfs(int s) {
	queue<int> q;
	q.push(s);
	for(int i =0; i < n; i++) {
		d[i] = INFTY;
	}
	d[s] = 0;
	int u;
	while(!q.empty()) {
		u = q.front();
		q.pop();
    	for(int v = 0; v < n; v++) {
		    if(M[u][v] == 0) continue;
			if(d[v] != INFTY) continue;
			d[v] = d[u] + 1;
			q.push(v);
			} 
	}
	for(int i = 0; i < n; i++) {
		cout << i + 1 << " " << ( (d[i] == INFTY) ? (-1) : d[i] ) << endl;
	} 	
}

int main() {
	int v, k ,u;
	cin >> n;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
		    M[i][j] = 0;	
		}
	}
	
	for(int i = 0; i < n; i++) {
		cin >> u >> k;
		for(int j = 0; j < k; j++) {
			cin >> v;
			M[u-1][v-1] = 1;
		}
	}
	
	bfs(0);
	
	return 0;
	
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

using namespace std;
using ll = long long;

int main()
{
    string S,T;
    cin >> S >> T;

    int diff = 1001;
    if(S.find(T) == 0){
        cout << 0 << endl;
        return 0;
    } 

    rep(si,S.size()-T.size()+1){
        int tmp_diff = 0;
        rep(ti,T.size()){
            if(S[si+ti] != T[ti]) tmp_diff +=1; 
        }
        if(tmp_diff < diff) diff = tmp_diff;
    }

    cout << diff << endl;
    return 0;
}


Measured memory_bytes: 3636
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

class Main{
    public static void main(String[] args) throws IOException {
        int rows = receiveInt();
        int cols = receiveInt();
        int goal = receiveInt();

        int big = rows > cols ? rows : cols;
        int small = rows + cols - big;

        int ans = 0;
        for(int i = 0; i < big; i++) {
            goal -= big;
            ans++;
            if(goal <= 0) break;
        }
        
        println(ans);
        flush();
    }



    // 入出力関連
    static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static final PrintWriter pw = new PrintWriter(System.out);
    enum Delimiter {
        NONE(""),
        SPACE(" "),
        DOT("\\."),
        COMMA(",");

        private String regex;
        private Delimiter(String regex) {
            this.regex = regex;
        }
        public String getRegex() { return regex; }
    }

    static String receive() throws IOException { return br.readLine(); }
    static int receiveInt() throws IOException { return Integer.parseInt(br.readLine()); }
    static char receiveChar() throws IOException { return  br.readLine().charAt(0); }
    static char[] receiveCharArray() throws IOException { return  br.readLine().toCharArray(); }
    static int[] receiveIntArray(Delimiter delimiter) throws IOException {
        return Stream.of(br.readLine().split(delimiter.getRegex())).mapToInt(Integer::parseInt).toArray();
    }
    static String[] receiveStringArray(Delimiter delimiter) throws IOException {
        return Stream.of(br.readLine().split(delimiter.getRegex())).toArray(String[]::new);
    }

    static void print(Object obj) { pw.print(obj); }
    static void println(Object obj) { pw.println(obj); }
    static void flush() { pw.flush(); }
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__",", __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

int main(){
  long T; int n;
  cin>>T>>n;
  vector<long> s(n),t(n);
  rep(i,n) cin>>s[i]>>t[i];

  auto solve = [&](){
    long mx = 0;
    long crnt = 0;
    int j = 0;
    rep(i,n){
      // t[i]?????§?????????
      crnt += t[i]-s[i];
      while(j<n && s[j] < t[i]-T){
        if(crnt - (t[j]-s[j]) <= T && t[i] - T <= t[j]) mx = max(mx, crnt - (t[j]-s[j]) + t[j] - (t[i]-T));
        crnt -= t[j]-s[j];
        j++;
      }//dbg(crnt);
      mx = max(mx, crnt);
    }
    return mx;
  };

  long ans = solve();

  rep(i,n) s[i]*=-1, t[i]*=-1, swap(s[i],t[i]);
  reverse(all(s)); reverse(all(t));

  ans = max(ans, solve());

  cout << ans << endl;

  return 0;
}

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


int main(){
  int A, B, C;
  cin >> A >> B >> C;

  bool ok = false;
  for (int i = 1; i <= B; i++)
  {
    if (A * i % B == C){
      ok = true;
      break;
    }

  }
    
  cout << (ok ? "YES" : "NO") << endl;
}


Measured memory_bytes: 3592
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int a, b, c;
  cin >> a >> b >> c;

  if(b - a == c - b){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
using namespace std;
int h1,m1,h2,m2,k;
int main(void){
	cin>>h1>>m1>>h2>>m2>>k;
	int a=h2*60+m2-h1*60-m1;
	cout<<a-k;
	return 0;
} 

Measured memory_bytes: 3620
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <numeric>
#include <functional>

using namespace std;

vector<int> fact, ifact;
const int mod = 1000000007;

vector<int> range_mod_inverse(int n, const int mod) {
  vector<int> ret(n + 1);
  ret[1] = 1;
  for (int i = 2; i <= n; i++)
    ret[i] = (long long)(mod - mod / i) * ret[mod%i] % mod;
  return ret;
}

vector<int> getFactorials(int n, const int mod) {
  vector<int> ret(1, 1);
  for (int i = 1; i <= n; i++) ret.push_back((long long)ret.back()*i%mod);
  return ret;
}

vector<int> getInverseFactorials(int n, const int mod) {
  vector<int> invmod(range_mod_inverse(n, mod));
  vector<int> ret(1, 1);
  for (int i = 1; i <= n; i++) ret.push_back((long long)ret.back()*invmod[i] % mod);
  return ret;
}

long long binomial(long long n, long long r) {
  if (n < 0 || r < 0 || r > n)
    return 0;
  return (long long)fact[n] * ifact[r] % mod * ifact[n-r] % mod;
}

int main()
{
  fact = getFactorials(200005, mod);
  ifact = getInverseFactorials(200005, mod);
  int h, w, a, b;
  scanf("%d%d%d%d", &h, &w, &a, &b);
  long long ans = binomial(h-1+w-1, w-1);
  for (int i = b - 1; i >= 0; i--) {
    int j = a - 1 - (b - 1 - i);
    if (j < 0)
      break;
    int x = i;
    int y = h - j - 1;
    ans -= binomial(x + y, x) * binomial(w-1-x + h-1-y, w-1-x) % mod;
  }
  ans %= mod;
  ans += mod;
  ans %= mod;
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main(){
    int n,k;
    string s;
    cin >> n >> k >> s;
    int edge=0,red=0;
    for(int i=0; i<n-1; i++){
        if(s[i]=='R'&&s[i+1]=='L')red++;
    }
    if(s[0]=='L')edge++;
    if(s[n-1]=='R')edge++;
    if(edge==2){
        if(red>=k){
            red-=k;
        }
        else{
            red=0;
            edge=1;
        }
    }
    else if(edge==1){
        red-=k;
        if(red<=0)red=0;
    }
    else{
        if(red<=k){
            edge=1;
            red=0;
        }
        else red-=k;
    }
    cout << n-(edge+red*2) << endl;
}

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

int main()
{
    int N;
    int max = -1;
    int ans;
    cin >> N;
    rep(i, N)
    {
        int temp = i + 1;
        int cnt = 0;
        while (temp % 2 != 1)
        {
            temp /= 2;
            cnt++;
        }
        if (cnt > max)
        {
            max = cnt;
            ans = i + 1;
        }
    }
    cout << ans << endl;
}


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

int main()
{
    long long a, b, number = 0;
    scanf("%lld %lld", &a, &b);
    if(2 * a >= b)
        number = b / 2;
    else
    {
        number = a;
        b = b - 2 * a;
        number += b / 4;
    }
    printf("%lld\n", number);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
long long N, ans;

int main() {
	scanf("%lld", &N);
	ans = N - 1;
	for(long long i = 2; i <= sqrt(N); i++) {
		if(N % i) continue;
		ans = min(ans, i + N/i - 2);
		// printf("%lld\n", i + N/i - 2);
	}
	printf("%lld", ans);
		
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

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

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

  string ans = "";
  ll d = 1;
  while (n != 0) {
    if (n == d) {
      ans += "1";
      break;
    }
    d *= -2;
    if (n % d != 0) {
      ans += "1";
      n -= d / -2;
    } else {
      ans += "0";
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int x[n],y[n],z[n];
for(int i=0;i<n;i++)
cin>>x[i]>>y[i]>>z[i];
for(int j=0;j<n-1;j++)
{long long ans=0;
int a=x[j],b=y[j],c=z[j];
ans=a+b;                 
for(int i=j+1;i<n-1;i++)
{
a=x[i],b=y[i],c=z[i];

    if(ans>b)
    {
       if(ans%c)
       ans=ans-ans%c+c;
        ans+=a;
    }
    else 
    ans=b+a;
}

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

return 0;
}
 


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

using namespace std;

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

	return 0;
}


Measured memory_bytes: 3220
#include<bits/stdc++.h>
#define pb push_back
#define ll long long int
#define pp pair<int,int>
#define pl pair<ll,ll>
#define fi first
#define si second
using namespace std;
int main() {
	int n;
	cin>>n;
	cout<<((n/500)*1000+((n%500)/5)*5)<<endl;
    return 0;
}




Measured memory_bytes: 256
import numpy as np

H, W, K = map(int, input().split())
lis = [[] for i in range(H)]
for i in range(H):
  st = input()
  for j in range(W):
  	lis[i].append(st[j])

lis = np.array(lis)
total_black = np.count_nonzero(lis == "#")
row_black = np.count_nonzero(lis == "#", axis=1)
column_black = np.count_nonzero(lis == "#", axis=0)
ans = 0

for i in range(2**H):
  for j in range(2**W):
    black = 0
    for k in range(H):
      if (i >> k)&1:
        black += row_black[k]
      for l in range(W):
        if not k and (j >> l)&1:
          black += column_black[l]
        if (i >> k)&1 and (j >> l)&1:
          black -= np.count_nonzero(lis[k][l] == "#")
    if K == total_black - black:
      ans += 1
                  
print(ans)

Measured memory_bytes: 27104