akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

const ll M = 1000000007;
const ll N = 400000;

ll n, k;
ll ans;
ll fc[400005];
ll fi[400005];

ll C(ll p, ll q)
{
    return fc[p] * fi[q] % M * fi[p - q] % M;
}

int main()
{
    cin>>n>>k;
    k = min(k, n - 1);
    fc[0] = 1;
    for(ll i = 1; i <= N; i++)
    {
        fc[i] = fc[i - 1] * i;
        fc[i] %= M;
    }
    fi[N] = 1;
    for(ll i = 0, j = fc[N]; (1 << i) <= M - 2; i++)
    {
        if((M - 2) & (1 << i)) fi[N] *= j;
        fi[N] %= M;
        j *= j;
        j %= M;
    }
    for(ll i = N - 1; i >= 0; i--)
    {
        fi[i] = fi[i + 1] * (i + 1) % M;
    }
    ans = C(2 * n - 1, n);
    for(ll i = k + 1; i <= n - 1; i++)
    {
        ans -= C(n, i) * C(n - 1, i) % M;
        ans = (ans + M) % M;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(i, name)in(i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(i,v) for(auto &i:(v))
#define all(v) (v).begin(),(v).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, R);
  printf("%.10lf", (double)R * 2 * 3.14159265359);
}


Measured memory_bytes: 3780
#include <stdio.h>

int main(void)
{
	int L, A, B, C, D, ja, math;
	int i;
	
	scanf("%d %d %d %d %d", &L, &A, &B, &C, &D);
	
	ja = (A / C) + (A % C != 0);
	math = (B / D) + (B % D != 0);
	
	if (ja > math){
		printf("%d\n", L - ja);
	}
	else {
		printf("%d\n", L - math);
	}
	
	return (0);
}

Measured memory_bytes: 596
//If you are reading this then you are at wrong place.
#include<bits/stdc++.h>
#define mod 1000000007
#define lli long long int
using namespace std;
bool prime [1000001];
void debug(lli a){cout<<a<<endl;}
lli sieve(lli a){memset(prime,true,sizeof(prime));lli p,i;for(p=2;p*p<=a;p++){if(prime[p]==true){for(i=p*2;i<=a;i+=p)prime[i]=false;}}return 0;}
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli find_max(lli __a,lli __b){return __a^((__a^__b) & -(__a<__b));}
lli add(lli __a,lli __b,lli MOD){lli x = (__a+__b)%MOD; return x; }
lli mul(lli a,lli b,lli MOD){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b,lli MOD){lli x = (a-b+MOD)%MOD; return x; }
lli div(lli a,lli b,lli MOD){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}
int main()
{
	//ifstream cin("testcase.txt");
	//ofstream cout("output.txt");	
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);	
	cout.precision(20);
	lli t,i,j;
	//cin>>t;
	//memset(dp, -1, sizeof dp);
	t=1;
	lli counter1=0;
	while(t--)
	{
		counter1++;
		int a,b,c;
		cin>>a>>b>>c;
		int q=a*100+b*10+c;
		if(q%4==0)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		
		//cout<<"Case #"<<counter1<<" ";
		//cout<<endl;	
	}	
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<list>
#include<queue>
#include<string.h>
#include<functional>
#include<stack>
#include<deque>
#include<string>
#include<limits.h>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
using namespace std;

signed main() {
	int a, b; cin >> a >> b;
	if (a % 3 && b % 3 && (a + b) % 3)puts("Impossible");
	else puts("Possible");
}

Measured memory_bytes: 256
n = int(input())
arr = list(map(int,input().split()))

sums = [0 for i in range(n)]

wa = 0
for i in range(n):
  wa += arr[i]
  sums[i] = wa
ans = None
low = 1000000000
for i in range(n):
  t = abs(2*sums[i]-sums[-1])
  if t < low:
    low = t
    ans = i
print(low)

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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    set<string> s;
    string now;
    cin >> now;
    s.insert(now);
    fori(i, 0, n - 1) {
        string cur;
        cin >> cur;
        if(cur[0] != now.back()) {
            cout << "No" << '\n';
            return 0;
        }
        if(s.count(cur)) {
            cout << "No" << '\n';
            return 0;
        }
        now = cur;
        s.insert(now);
    }
    cout << "Yes" << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n , x) for (int i = (int)(x); i < (int)(n); ++i)
#define repB(i, n) for (int i = n; i >= 1; --i)
#define repBX(i, n , x) for (int i = (int)(n); i >= int(X); --i)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    int a,b;
    cin >> a >> b;
    int A=0,B=0;
    rep(i,a){
        A = A * 10 + b;
    }
    rep(i,b){
        B = B * 10 + a;
    }
    if(a!=b){
        if(a>b)cout << A << endl;
        else cout << B << endl;
    }else cout << min(A,B) << endl;
    
    return 0;
}

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

int main(){
  int N,X,Y; cin >> N >> X >> Y;
  int count[5000];
  for(int i=1; i<=N-1; i++){
    for(int j=i+1; j<=N; j++){
      count[min(j-i,abs(X-i)+1+abs(Y-j))]++;
    }
  }
  
  for(int k=1; k<=N-1; k++) cout << count[k] << endl;
}

Measured memory_bytes: 256
import heapq

n,m=map(int,input().split())
a=[]

for i in input().split():
    heapq.heappush(a,-int(i))

for j in range(m):
    highest = heapq.heappop(a)
    heapq.heappush(a,-(-highest//2))

print(-(sum(a)))

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

int main() {
    long long a, b; cin >> a >> b;
    if (a == 0 || b == 0) {
        cout << "Zero" << '\n';
    } else if (a > 0 && b > 0) {
        cout << "Positive" << '\n';
    } else if (a < 0 && b > 0) {
        cout << "Zero" << '\n';
    } else {
        cout << ((a-b+1)%2 == 0 ? "Positive" : "Negative") << '\n';
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(n,v) cout<<#v<<":";for(int i=0;i<n;i++)cout<<v[i]<<" ";cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll ans=0;
    rep(i,n){
        ans+=a[i]/2;
        a[i]%=2;
        if(a[i]==1&&i!=n-1&&a[i+1]>0){
            ans++;
            a[i]--;a[i+1]--;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {

	string s;
	cin >> s;

	int ans;
	if (s == "RRR") ans = 3;
	if (s == "RRS") ans = 2;
	if (s == "RSR") ans = 1;
	if (s == "SRR") ans = 2;
	if (s == "RSS") ans = 1;
	if (s == "SRS") ans = 1;
	if (s == "SSR") ans = 1;
	if (s == "SSS") ans = 0;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3600
#include <cstdio>
#include <iostream>
#include <stack>
#include <string>
using namespace std;

int main(){
	string s;
	int ans=0;
	stack<int> st;
	while(getline(cin, s)){
		int i=0;	
		while(i<s.size()){
			
			if(s[i]>='0' && s[i]<='9') st.push(s[i++]-'0');
			else{++i; continue;}
			
			while(i<s.size() && s[i]>='0' && s[i]<='9'){
				int tmp=st.top();
				st.pop();
				int a=s[i]-'0';
				st.push(tmp*10+a);
				++i;
			}
			ans+=st.top();
			st.pop();
		}
		//printf("%d\n", ans);
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 1192
#include <iostream>
#include <cstring>

using namespace std;

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

int side[6][6] = {
	{0, 3, 5, 2, 4, 0},
	{4, 0, 1, 6, 0, 3},
	{2, 6, 0, 0, 1, 5},
	{5, 1, 0, 0, 6, 2},
	{3, 0, 6, 1, 0, 4},
	{0, 4, 2, 5, 3, 0}
};

int main(){
	int n;
	int height[300][300];
	int top[300][300];
	while(cin >> n, n){
		memset(height, 0, sizeof(height));
		memset(top, 0, sizeof(top));

		int t, f; cin >> t >> f;
		top[150][150] = t;
		height[150][150] = 1;

		for(int i=1;i<n;i++){
			cin >> t >> f;
			int dice[6];
			dice[0] = f;
			dice[2] = 7-f;
			dice[4] = t;
			dice[5] = 7-t;
			dice[1] = side[t-1][f-1];
			dice[3] = 7-dice[1];
			int x = 150, y = 150;
			while(true){
				int dir = -1;
				for(int j=0;j<4;j++){
					if(dice[j] >= 4 && (dir == -1 || dice[j] > dice[dir]) && height[x][y] > height[x+dx[j]][y+dy[j]]){
						dir = j;
					}
				}
				if(dir == -1){
					height[x][y]++;
					top[x][y] = dice[4];
					break;
				}
				x += dx[dir];
				y += dy[dir];
				int tmp = dice[dir];
				dice[dir] = dice[4];
				dice[4] = dice[(dir+2)%4];
				dice[(dir+2)%4] = dice[5];
				dice[5] = tmp;
			}
		}

		int res[6] = {0, 0, 0, 0, 0, 0};
		for(int i=0;i<300;i++)
			for(int j=0;j<300;j++)
				if(top[i][j] != 0) res[top[i][j]-1]++;
		cout << res[0];
		for(int i=1;i<6;i++) cout << " " << res[i];
		cout << endl;
	}
}

Measured memory_bytes: 1568
#include <stdio.h>
#include <string.h>

int main(void)
{
	int i;
	char str[100000];
	int jans, ians;
	
	while (fgets(str, 1000000, stdin) != NULL){
		
		str[strlen(str) - 1] = '\0';
		
		i = 0;
		ians = jans = 0;
		while (str[i] != '\0'){
			if (str[i + 1] == 'O' && str[i + 2] == 'I'){
				if (str[i] == 'J'){
					jans++;
				}
				if (str[i] == 'I'){
					ians++;
				}
			}
			i++;
		}
		
		printf("%d\n%d\n", jans, ians);
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
// (setq-default c-basic-offset 2)

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

  long long ret = max({a * c, a * d, b * c, b * d});
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 3612
S = list(input())
T = list(input())

LT = len(T)
same = 0
if len(S) - LT != 0:
    for i in range(len(S) - LT):
        tS = S[i:i+LT]
        tmp = 0
        for j in range(LT):
            if T[j] == tS[j]:
                tmp += 1
        same = max(same,tmp)
    print(LT - same)
else:
    ans = 0
    for i in range(LT):
        if T[i] == S[i]:
            ans += 1
    print(LT - ans)

Measured memory_bytes: 9036
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    vector<vector<int> >x(n),y(n);
    int answer = 0,count;

    REP(i,n){
        cin >> a[i];
        REP(j,a[i]){
            int X,Y;
            cin >> X >> Y;
            x[i].push_back(X);
            y[i].push_back(Y);
        }
    }
    for (int bit = 0; bit < (1<<n); ++bit) {
        count = 0;
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) {
                count++;
                REP(j,a[i]){
                    int b = (bit&(1 << (x[i][j]-1)));
                    if(b != 0)b=1;
                    //cout <<"aaa"<< b << endl;
                    if(b != y[i][j]){
                        count = 0;
                        goto Contradiction;
                    }
                }
            }
            /*else{
                REP(j,a[i]){
                    int b = (bit&(1 << (x[i][j]-1)));
                    if(b != 0)b=1;
                    //cout <<"aaa"<< b << endl;
                    if(b != (y[i][j]^1)){
                        count = 0;
                        goto Contradiction;
                    }
                }
            }*/
        }
        
        Contradiction:
        //cout << bit << " " << count << endl;
        answer = max(answer,count);
    }
    cout << answer << endl;

    return 0;
}

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

using namespace std;

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch: s) {
    if (ch == delim) {
      if (!item.empty()) {
        elems.push_back(item);
      }
      item.clear();
    }
    else {
      item += ch;
    }
  }
  if (!item.empty()) {
    elems.push_back(item);
  }
  return elems;
}

string to_str_with_zero(int i, int w) {
  ostringstream sout;
  sout << std::setfill('0') << std::setw(w) << i;
  string s = sout.str();
  return s;
}

int letter_to_int(char c) {
  return tolower(c) - 'a';
}

int compare_array(vector<int> a1, vector<int>a2) {
  if (a1.size() != a2.size()) {
    return a1.size() - a2.size();
  }
  for (int i=0; i<a1.size(); i++) {
    if (a1.at(i) != a2.at(i)) {
      return a1.at(i) - a2.at(i);
    }
  }
  return 0;
}

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

char int_to_char(int a) {
  if (a == -1) {
    return 'z';
  }
  else {
    return 'a' + a;
  }
}

long nCr(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

int divide_count(int a, int divider) {
  int r = 0;
  while(a % divider == 0) {
    a /= divider;
    r++;
  }
  return r;
}

bool is_prime(int a) {
  int i = 2;
  while(i * i <= a) {
    if(a % i == 0) {
      return false;
    }
    i++;
  }
  return true;
}

vector<vector<int>> all_comb(int n, int k) {
  vector<vector<int>> combs(nCr(n, k), vector<int>(k));
  for(int i=0; i<k; i++) {
    combs[0][i] = i;
    combs[1][i] = i;
  }
  
  for(long i=1; i<nCr(n, k); i++) {
    int p = 1;
    while(combs[i][k - p] == n - p) {
      p++;
      if(p > k) {
        break;
      }
    }
    combs[i][k - p]++;
    int q = combs[i][k - p];
    for(int j=1; j<p; j++) {
      combs[i][k - p + j] = q + j;
    }

    if(i < nCr(n, k) - 1) {
      for(int j=0; j<k; j++) {
        combs[i + 1][j] = combs[i][j];
      }
    }
  }

  return combs;
}

int main() {
  std::cout << std::setprecision(9);
  long n;
  cin >> n;
  
  long ans = n * (n - 1) / 2;
  cout << ans << endl;
}

Measured memory_bytes: 3644
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())


def FLIST(n):
    res = [1]
    for i in range(1, n+1):
        res.append(res[i-1]*i % DVSR)
    return res


N = II()
AS = LI()
DP = {}
DP[(0, 0)] = 0

mm = -(10**18)
for i in range(N):
    NX = {}
    for ((cnt, isUsed), value) in DP.items():
        if isUsed:
            if cnt >= (i // 2 - 5):
                NX[(cnt, 0)] = max(value, NX.get((cnt, 0)) or mm)
        else:
            if cnt >= (i // 2 - 5):
                NX[(cnt, 0)] = max(value, NX.get((cnt, 0)) or mm)
            if cnt >= (i // 2 - 5):
                NX[(cnt+1, 1)] = max(value + AS[i],
                                     NX.get((cnt+1, 1)) or mm)
    DP = NX
    # print(NX)

res = -(10**18)
for ((cnt, _), value) in DP.items():
    if cnt == N//2:
        res = max(res, value)
print(res)


Measured memory_bytes: 104528
#include<bits/stdc++.h>
namespace lib
{
	#define LL long long
	#define ull unsigned long long
	#define rgi register int
	#define rgl register long long
	#define rgc register char
	const double pi=acos(-1); 
	using namespace std;
	class fastio
	{
		private:
			#define _NUMLEN 112
			char _num[_NUMLEN],_ch; int _f,_head; bool _useSTD;
		public:
			fastio() {_f=0,_head=0,_useSTD=0,SUF=_ch=' ';}
			char SUF;
			inline void ioSTD() {_useSTD=1; ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); }
			inline void gc(char & _c) {if(_useSTD)cin>>_c; else _c=getchar(); }
			inline void pc(char _c) {if(_useSTD)cout<<_c; else putchar(_c); }
			template<typename _T> inline fastio & operator - (_T & _x)
			{
				if(_useSTD)cin>>_x; else{
					_x=0; 
					while(!isdigit(_ch)) _f|=_ch=='-',gc(_ch); 
					while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),gc(_ch); 
					_f&&(_x=-_x,_f=0); 
				}return *this; 
			}
			template<typename _T> inline fastio & operator + (_T _x)
			{
				if(_useSTD)cout<<_x<<SUF; else{
					_T _k; 
					if(_x==0) {pc('0'),pc(SUF);return *this;} if(_x<0) pc('-'),_x=-_x;
					while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k; while(_head>0) pc(_num[_head]),--_head;
					pc(SUF);
				}return *this; 
			}
			template<typename _T> inline fastio & operator >> (_T & _x) {cin>>_x;return *this;}
			template<typename _T> inline fastio & operator << (_T _x) {cout<<_x;return *this;}
			#define edn pc('\n')
	}io;
	inline void fileio(string _r,string _w) {if(_r[0]!='-')freopen(_r.c_str(),"r",stdin); if(_w[0]!='-')freopen(_w.c_str(),"w",stdout); }
	#define mem(_x,_set) memset(_x,_set,sizeof(_x))
}
using namespace lib;
// ----------------------------

// #define int ll
const int maxn=100004;
const int mod=1000000007,inf=1000000007;

LL n, a, b, fac1 = 1LL, fac2 = 1LL, fac_a = 1LL, fac_b = 1LL;

LL qpow(LL base, LL power) {
	LL res = 1LL % mod;
	while (power) {
		if (power & 1) res = res * base % mod;
		base = base * base % mod;
		power >>= 1;
	}
	return res;
}

LL inv(LL x) { return qpow(x, mod - 2); }

int main() {
	scanf("%lld %lld %lld", &n, &a, &b);
	LL pre = (qpow(2, n) + mod - 1) % mod;
	for(LL i = n; i >= n - a + 1; --i) {
		fac1 = fac1 * i % mod;
	}
	for(LL i = 1; i <= a; ++i) {
		fac_a = fac_a * i % mod;
	}
	fac1 = fac1 * inv(fac_a) % mod;
	for(LL i = n; i >= n - b + 1; --i) {
		fac2 = fac2 * i % mod;
	}
	for(LL i = 1; i <= b; ++i) {
		fac_b = fac_b * i % mod;
	}
	fac2 = fac2 * inv(fac_b) % mod;
	
	printf("%lld", ((pre - fac1 - fac2) % mod + mod) % mod);
	
	return 0;
}

// ----------------------------
// by imzzy

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
# stdin = open("sample.txt")

MOD = 1000000007

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def combination(m,n):
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def main():
    a, b, n = [int(x) for x in stdin.readline().rstrip().split()]
    if n >= b:
        print((a*(b-1))//b)
    else:
        print((a*n)//b)
main()

Measured memory_bytes: 9908
def main():
	a, b, k = [int(x) for x in input().split(" ")]

	result = retDivs(a,b)
	print(result[len(result)-k])
def retDivs(a, b):
	n = 0
	ret = []
	for x in range(1,max(a, b)+1):
		if a%x == 0 and b%x == 0:
			ret.append(x)
	
	return ret



if __name__ == "__main__":
	main()

Measured memory_bytes: 3060
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
li=[a,b,c,d,e]
p=[]
q=[]
for i in range(5):
  p.append(((li[i]-1)//10+1)*10)
  q.append(((li[i]//10+1)*10-li[i])%10)
print(sum(p)-max(q))
  

Measured memory_bytes: 3064
import copy
s = input()
k = [0] * 6
t = []
while True:
    i = 0
    if "+" in s[1:]:
        i = 1 + s[1:].index("+")
    if "-" in s[1:]:
        if i > 0:i = min(i, 1 + s[1:].index("-"))
        else:i = 1 + s[1:].index("-")
    if i == 0:
        k[0] = int(s)
        break
    j = s.index("x")
    if j + 3 == i:
        if j == 0:k[int(s[j + 2])] = 1
        else:k[int(s[j + 2])] = int(s[:j])
    else:
        if j == 0:k[1] = 1
        elif j == 1:k[1] = int(s[0] + "1")
        else:k[1] = int(s[:j])
    s = s[i:]
while True:
    if k[-1] == 0:k.pop()
    else:break
while True:
    i = 1
    while i <= abs(k[0]):
        if k[0] % i == 0:
            j = k[0] // i
            kn = copy.deepcopy(k)
            for l in range(len(kn) - 1):
                if kn[l] % j == 0:
                    kn[l + 1] -= kn[l] // j
                    kn[l] //= j
                else:
                    break
            else:
                if kn[-1] == 0:
                    kn.pop()
                    t.append(j)
                    k = copy.deepcopy(kn)
                    break
            j *= -1
            kn = copy.deepcopy(k)
            for l in range(len(kn) - 1):
                if kn[l] % j == 0:
                    kn[l + 1] -= kn[l] // j
                    kn[l] //= j
                else:
                    break
            else:
                if kn[-1] == 0:
                    kn.pop()
                    t.append(j)
                    k = copy.deepcopy(kn)
                    break
        i += 1
    if len(k) == 2:
        t.append(k[0])
        break
t.sort()
s = ""
for i in t:s += "(x{})".format(i) if i < 0 else "(x+{})".format(i)
print(s)


Measured memory_bytes: 6356
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
  int n, x, t;

  cin >> n >> x >> t;

  if (n % x == 0)
  {
    cout << t * (n / x) << endl;
  }
  else
  {
    cout << t * (n / x + 1) << endl;
  }

  return 0;
}

Measured memory_bytes: 3672
N, P = map(int, input().split())
ans = 0
if N == 1:
    print(P)
elif N >= P or N > 50:
    print(1)

else:
    for i in range(1, int(P**(1/N)+2)):
        if P % i**N == 0:
            ans = i
    print(ans)


Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
using namespace std;
const int maxn = 100+10;
char cmap[maxn][maxn],ch;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int m,n,k;

void dfs(int x,int y,char ch){
    for(int i=0;i<4;++i){
        int nx=x+dx[i];
        int ny=y+dy[i];
        if(nx>=0&&nx<m&&ny>=0&&ny<n&&cmap[nx][ny]==ch){
            cmap[nx][ny]='0';
            dfs(nx,ny,ch);
        }
    }
}

int main ()
{
    while(scanf("%d%d",&m,&n)&&m>0&&n>0) {
        k=0;
        for(int i=0; i<m; ++i)
            for(int j=0; j<n; ++j)
                cin>>cmap[i][j];
        for(int i=0; i<m; ++i)
            for(int j=0; j<n; ++j)
                if(cmap[i][j]!='0') {
                    dfs(i,j,cmap[i][j]);
                    k++;
                }
        printf("%d\n",k);
    }
    return 0;
}

Measured memory_bytes: 1684
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;
using myui = uint64_t;

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

    {
        char c;
        cin >> c;
        switch(c) {
            case 'A':
                cout << 'T' << endl;
                break;
            case 'C':
                cout << 'G' << endl;
                break;
            case 'G':
                cout << 'C' << endl;
                break;
            case 'T':
                cout << 'A' << endl;
                break;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}


int main()
{
	int n;
	cin >> n;
	vector<int> t(n);
	rep(i, n) cin >> t[i];
	int m;
	cin >> m;
	vector<pair<int, int>> d(m);
	rep(i, m) {
		int p, x;
		cin >> p >> x;
		p--;
		d[i] = pair<int, int>(p, x);
	}
	rep(i, m) {
		ll ans = accumulate(all(t),0);
		ans -= t[d[i].first];
		ans += d[i].second;
		cout << ans << endl;
	}

	return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  
  vector<int> B(N + 10, 0);
  for (int i = 0; i < N; i++) B.at(A.at(i))++;
  sort(B.begin(), B.end());
  reverse(B.begin(), B.end());
  
  int ans = 0;
  for (int i = 0; i < N + 10; i++){
    if (B.at(i) == 0){
      cout << ans << endl;
      break;
    }
    else if (i < K) continue;
    else ans += B.at(i);
  }
    
}


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

using namespace std;

typedef long long ll;

#define newline cout<<"\n"
#define deb(x) cout<<#x<<" "<<x<<endl;

template<typename... T>
void read(T&... args){
    ((cin>>args), ...);
}

template<typename... T>
void write(T... args){
    ((cout<<args<<" "), ...);
}

void printarr(vector<ll> &v){
    for(ll x: v){
        cout<<x<<" ";
    }
    newline;
}

const ll MOD = 1e9+7;
const ll nax = 1e7+7;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    
    ll n, k; cin>>n>>k;

    ll muls = n/k;

    ll hm = 0;
    if(k%2==0){
        for(ll i=k/2; i<=n; i+=k){
            hm++;
        }
    }

    ll ans = pow(muls,3)+pow(hm,3);

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

Measured memory_bytes: 3932
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


# --------------------------------------------

dp = None
D = None
D_dfs_d = None


def dfs_d(v, pre, dist):
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def main():
    global D
    global D_dfs_d

    N = int(input())
    D_dfs_d = [-1] * (N + 1)
    D = [[] for _ in range(N + 1)]

    for i in range(N - 1):
        a, b, c = li_input()
        D[a].append((b, c))
        D[b].append((a, c))

    Q, K = li_input()

    # Kから各頂点までの長さをWFSで求める
    dfs_d(K, -1, 0)

    for i in range(Q):
        x, y = li_input()
        print(D_dfs_d[x] + D_dfs_d[y])


main()


Measured memory_bytes: 133664
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
bool test = true;
#else 
bool test = false;
#endif
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

signed main(void) {
	int i, j, k, l;
	int K;
	string m[2][100];
	cin >> K;
	rep(i, K) cin >> m[0][i];
	rep(i, K) cin >> m[1][i];
	int pow[2] = {};
	bool win[2] = {};
	string kougekida = "kougekida";
	string mamoru = "mamoru";
	string tameru = "tameru";
	rep(i, K) {
		if (m[0][i] == kougekida) {
			if (m[1][i] == kougekida) {
				if (pow[0] == 0 && pow[1] == 0) continue;
			}
		}
		if (m[0][i] == kougekida) {
			if (m[!0][i] == kougekida) {
				rep(j, 2) {
					if (pow[j] > pow[!j]) {
						win[j] = true;
						goto end;
					}
				}
				pow[0] = pow[1] = 0;
				continue;
			}
		}
		rep(j, 2) {
			if (m[j][i] == kougekida) {
				if (pow[j] == 0) {
					win[!j] = true;
					goto end;
				}
			}

			if (m[j][i] == kougekida) {
				if (m[!j][i] == mamoru) {
					if (pow[j] == 5) {
						win[j] = true;
						goto end;
					}
					else {
						pow[j] = 0;
					}
				}
				if (m[!j][i] == tameru) {
					win[j] = true;
					goto end;
				}
			}
			if (m[j][i] == tameru) {
				if (pow[j] == 5) continue;
				else {
					pow[j]++;
				}
			}
		}

		if (test) {
			dump(pow[0]);
			dump(pow[1]);
		}
	}
end:
	if (win[0]) puts("Isono-kun");
	else if (win[1]) puts("Nakajima-kun");
	else puts("Hikiwake-kun");
	return 0;
}

Measured memory_bytes: 3232
#include <iostream>
#define mid (l+r)/2
#define ll long long

using namespace std;
const int N=2e5+55;
ll tree[N*4];
int h[N];
ll a[N];

void update(int l , int r , int node , int ind , ll val)
{
    if(l==r)
    {
        tree[node]=val;
        return ;
    }
    if(ind<=mid)
        update(l,mid,node*2,ind,val);
    else
        update(mid+1,r,node*2+1,ind,val);
    tree[node]=max(tree[node*2],tree[node*2+1]);
}

ll query(int l , int r , int node , int x , int y)
{
    if(l>y||r<x)
        return 0;
    if(x<=l&&r<=y)
        return tree[node];
    return max(query(l,mid,node*2,x,y),query(mid+1,r,node*2+1,x,y));
}

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>h[i];
    for(int i=0;i<n;i++)
        cin>>a[i];
    ll ans=0;
    ll x=0;
    for(int i=0;i<n;i++)
    {
        x=query(0,n-1,1,1,h[i])+a[i];
        ans=max(ans,x);
        update(0,n-1,1,h[i],x);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8448
#include<stdio.h>

int main(void){
	int a=0,b=0,c=0,d=0;
	int left=0;int right=0;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	
	left=a+b;
	right=c+d;
	if(left>right){printf("Left\n");}
	else if(left==right){printf("Balanced\n");}
	else{printf("Right\n");}
	
	return 0;
}

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

int main(){
	int n,a,b,c,x[100],best[100],d,sumkcal,summoney;
	int bestpizza;
	memset(best,0,sizeof(best));
	bestpizza=0;
	cin>>n;
	cin>>a>>b;
	cin>>c;
	for(int i=0;i<n;i++){
		cin>>x[i];
	}
	d=0;
	for(int i=0;i<=10000;i++){
		for(int j=0;j<n;j++){
			if(10000-i==x[j]){
				best[d]=x[j];
				d++;
			}
		}
	}
	sumkcal=c;
	summoney=a;
	bestpizza=c/a;
	for(int i=0;i<n;i++){
		summoney += b;
		sumkcal += best[i];
		bestpizza=max(bestpizza,sumkcal/summoney);
	}
	cout<<bestpizza<<endl;
	return 0;
}

Measured memory_bytes: 1164
#include<stdio.h>
int main(){
  int n,i,j,count=0;
  scanf("%d",&n);
  int d[n+1];
  for(i=0;i<n;i++)
    scanf("%d",&d[i]);
  for(i=0;i<n-1;i++)
    for(j=i+1;j<n;j++)
      count+=d[i]*d[j];
  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a;
	cin>>a;
	cout<<3*pow(a,2)<<endl;
	return 0;
}



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

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

const int MOD=1e9+7;
const int INF=1<<30;
const int MAX=1e5;

template<class T>
inline void xmin(T &a, T b){a=(a<b)?a:b;}
template<class T>
inline void xmax(T &a, T b){a=(a>b)?a:b;}

int a,b;
int cur;
void solve(){
    cur=1;
    cin>>a>>b;
    int cnt=0;
    while(cur<b){
        cur+=a-1;
        cnt++;
    }
    cout<<cnt<<endl;

    //いやこれBやないかーい！！！
}

signed main(){
    //while(1)
    solve();
}


Measured memory_bytes: 256
while True:
    m,f,r=map(int,input().split())
    a=0
    if m ==-1 and f==-1 and r==-1:
        break
    elif m==-1 or f==-1:
        a="F"
    elif m+f>=80:
        a="A"
    elif m+f>=65 and m+f<=79:
        a="B"
    elif m+f>=50 and m+f<=65:
        a="C"
    elif m+f>=30 and m+f<=49:
        if r>=50:
            a="C"
        else:
            a="D"
    elif m+f<=29:
        a="F"
    print(a)


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

int main() {
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e ;
  if(a == 0) cout << 1 ;
  else if(b == 0) cout << 2 ;
  else if(c == 0) cout << 3 ;
  else if(d == 0) cout << 4 ;
  else if(e == 0) cout << 5 ;
}


Measured memory_bytes: 3620
from itertools import combinations
n = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))

even = []   #偶数番目で表になる
odd = []    #奇数番目で表になる
for i,(a,b) in enumerate(zip(As,Bs)):
    if i%2 == 0:
        even.append(a)
        odd.append(b)
    else:
        even.append(b)
        odd.append(a)



def check(n, even, odd):
    prev = -10**10
    ps = []
    for i in range(n):
        if i%2 == 0:
            if prev > even[i//2][0]:
                return False,-1
            else:
                ps.append(even[i//2][1])
            prev = even[i//2][0]
        else:
            if prev > odd[i//2][0]:
                return  False, -1
            else:
                ps.append(odd[i//2][1])
            prev = odd[i//2][0]
    return True, ps
    


def inversion(a):
    n = len(a)
    cnt = 0
    for i in range(n):
        for j in range(i+1,n):
            if a[i] > a[j]:
                cnt +=1
    return cnt
 
#偶数としてpickupするやつ
INF = 10**10
ans = 10**10
for l in combinations(range(n), (n-1)//2+1):
    cnt = 0
    even_selected = [(even[i],i) for i in range(n) if i in l]
    odd_selected = [(odd[i],i) for i in range(n) if i not in l]
    # こいつらを昇順に並べられるか
    even_selected.sort()
    odd_selected.sort()
    is_possible, a = check(n, even_selected, odd_selected)
    # 並び順が正しければ
    if is_possible:
        cnt = inversion(a)
        ans = min(cnt, ans)
        
if ans == INF:
    print(-1)
else:
    print(ans)        

Measured memory_bytes: 3188
import java.sql.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int x = scan.nextInt();
		int[] list = new int[n];
		int sum = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < list.length; i++) {
			list[i] = scan.nextInt();
			sum += list[i];
			min = Math.min(min, list[i]);
		}
		
		int cnt = (x - sum) / min;
		System.out.println(cnt + n);
		
	}
}

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

int main() {
	int N, Y;
	cin >> N >> Y;
	int ansX = -1, ansY = -1, ansZ = -1;
	for (int x = 0; x <= N; x++) {
		for (int y = 0; y <= N - x; y++) {
			int z = N - y - x;
			if (z < 0)
				continue;
			if (Y == 10000 * x + 5000 * y + 1000 * z) {
				ansX = x;
				ansY = y;
				ansZ = z;
			}
		}
	}
	cout << ansX << " " << ansY << " " << ansZ << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,r,a,b;
    int c=0;
    cin>>n>>r;
    vector<int> h(n);
    vector<int> l(n);
    for(int i=0;i<n;i++){
        cin>>h.at(i);
        l.at(i)=1;
    }
    for(int i=0;i<r;i++){
      cin>>a>>b;
      a-=1,b-=1;
      if(h.at(a)<h.at(b)){
          l.at(b)*=1,l.at(a)*=0;
      }else if(h.at(a)>h.at(b)){
          l.at(a)*=1,l.at(b)=0;
      }else{
          l.at(a)*=0,l.at(b)*=0;
      }
    }for(int i=0;i<n;i++){
        if(l.at(i)==1){
            c++;
        }
    }cout<<c<<endl;
    
}


Measured memory_bytes: 4060
n,m,k=map(int,input().split())
f=False
for i in range(n+1):
    for j in range(m+1):
        if k==i*m+j*n-2*i*j:
            print('Yes')
            f=True
            break
    if f:
        break
if not f:
    print('No')


Measured memory_bytes: 9140
#include<iostream>
using namespace std;
int a[1000005];
int main(){
	int k,i;
	cin>>a[0]>>a[1]>>k;
	for(i=0;i<k;i++){
		a[!(i&1)]+=(a[i&1]>>=1);
	}
	cout<<a[0]<<" "<<a[1];
	return 0;
}

Measured memory_bytes: 256
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
    ll A, B, K;
    cin >> A >> B >> K;
    for(int i = 0; i < K; i++){
        if(i%2==0){
            if(A%2==1){
                A--;
            }
            ll fromA = A/2;
            B = B + fromA;
            A = A - fromA;

        }
        if(i%2==1){
            if(B%2==1){
                B--;
            }
            ll fromB = B/2;
            A = A + fromB;
            B = B - fromB;
        }
    }
    cout << A <<" " << B << endl;

    return 0;
}

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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

// bit op
int popcnt(uint x) { return __builtin_popcount(x); }
int popcnt(ull x) { return __builtin_popcountll(x); }
int bsr(uint x) { return 31 - __builtin_clz(x); }
int bsr(ull x) { return 63 - __builtin_clzll(x); }
int bsf(uint x) { return __builtin_ctz(x); }
int bsf(ull x) { return __builtin_ctzll(x); }

int solve(V<ll> _v) {
    multiset<ll> v(_v.begin(), _v.end());
    int ans = 0;
    while (v.size()) {
        ll q = *v.rbegin();
        v.erase(v.find(q));
        ll x = 2;
        while (x <= q) x <<= 1;
        ll r = x - q;
        if (v.find(r) != v.end()) {
            v.erase(v.find(r));
            ans++;
        }
    }
    return ans;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << fixed;
    int n;
    cin >> n;
    VV<ll> g(60);
    for (int i = 0; i < n; i++) {
        ll x;
        cin >> x;
        int p = bsf(ull(x));
        g[p].push_back(x >> p);
    }
    int ans = 0;
    for (auto v: g) ans += solve(v);
    cout << ans << endl;
    return 0;
}


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

int main(void){
  int D;
  int X, Y, W, H, N;

  cin >> D;
  for(int i = 0; i < D; i++){
    cin >> X >> Y >> W >> H;
    cin >> N;
    
    int cats = 0;
    for(int j = 0; j < N; j++){
      int x, y;
      cin >> x >> y;
      if(x >= X && x <= X + W && y >= Y && y <= Y + H) cats++;
    }
    cout << cats << endl;
  }
}


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

// Optimization
//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << ' ';
#define PrintVl(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << endl;
#define PrintA(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << ' ';
#define PrintAl(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define m1set(a) memset(a, 1, sizeof(a))
#define mn1set(a) memset(a, -1, sizeof(a))
#define mmset(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 3e5 + 5, mod = 1e9 + 7, mod1 = 998242353, mod2 = 1e9 + 9;
const ll inf = 1e18 + 7;

string s, t;
int ans;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> s >> t;
    For(i, 0, 3){
        if (s[i] == t[i]) ans++;
    }
    cout << ans;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int n,t;
  cin >> n >> t;
  int ans = 1005;
  for(int i=0; i<n; ++i)
  {
    int a,b;
    cin >> a >> b;
    if (b<=t) 
    {
      if (a<ans)
      	ans = a;
    }
  }
  if (ans==1005) cout << "TLE"; else cout << ans;
   
  return 0;
}

Measured memory_bytes: 256
MOD = 10**9 + 7

N = int(input())
As = list(map(int, input().split()))

ans = 0
for d in range(60):
    sumXOR = 0
    num0, num1 = 0, 0
    for A in As:
        if (A>>(59-d))&1:
            num1 += 1
        else:
            num0 += 1
#    print('d:', d, '/ num0:', num0, '/ num1:', num1)
    sumXOR += (num0 * num1) % MOD
    sumXOR %= MOD
    ans *= 2
    ans += sumXOR
    ans %= MOD

print(ans)


Measured memory_bytes: 122808
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mk(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) r.begin(),r.end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<=(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-9;
//int mod=1000000007;





int main(){
	int n;
	int a;
	while(cin>>n&&n>0){
		vi v(7,0);
		rep(i,n){
			cin>>a;
			int b=0;
			for(int i=0; i<7; i++){
				b+=10;
				if(a<b){
					v[i]++;
					break;
				}
				if(i==6)v[i]++;
			}
		}
		for(int i=0; i<7; i++){
			cout<<v[i]<<endl;
		}
	}
}

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

using namespace std;
using ll = long long;

int D;
int c[26];
int s[400][26];

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

    for (int i = 0; i < 26; i++) cin >> c[i];
    for (int i = 0; i < D; i++) {
        for (int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    vector<int> t(D, 1);
    random_device rnd;
    mt19937 mt(rnd());
    uniform_int_distribution<> rand(1, 26);
    for (int i = 0; i < D; i++) {
        cout << rand(mt) << '\n';
    }
    return 0;
}



Measured memory_bytes: 3672
require 'pp'
require 'set'
N = readline.chomp.to_i
A = readline.chomp.split.map(&:to_i)

a = Set.new(A)
min = a.min

while a.size != 1
  #pp a,min
  a0 = min
  a.map! do |x|
    mod = (x % a0)
    min = mod if mod > 0 and mod < min
    mod
  end
  a.delete_if {|x| x == 0 }
  a.add(a0)
end
puts a.to_a.first


Measured memory_bytes: 16964
def actual(A, B):
    if A == B:
        return 'Draw'

    if A == 1:
        return 'Alice'

    if B == 1:
        return 'Bob'

    if A > B:
        return 'Alice'
    else:
        return 'Bob'

A, B = map(int, input().split())
print(actual(A, B))

Measured memory_bytes: 9056
#include <iostream>
using namespace std;
int main() {
      ios_base::sync_with_stdio(false);
       cin.tie(NULL);
      long n,q,b,k,count[100001]={0};
      long sum=0;
      cin>>n;
      int a[n];
      for(long i=0;i<n;i++){
      cin>>a[i];
      sum=sum+a[i];
      count[a[i]-0]++;
      }
      cin>>k;
      for(long i=0;i<k;i++){
           cin>>b>>q;
           sum=sum+count[b]*(q-b);
           count[q]=count[q]+count[b];
           count[b]=0;
            cout<<sum<<"\n";
      }      
	return 0;
}


Measured memory_bytes: 4716
#from operator import mul
#from functools import reduce
#cnt = 1000000000000000000
ans =1
N = int(input())
nums = list(map(int, input().split()))

if 0 in nums:
        print(0)
        exit()
for num in nums:
    ans *= num
    if ans > 10**18 :
        print(-1)
        exit()
print(ans)

Measured memory_bytes: 21464
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <utility>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
const int inf = 1e9;

int n, k;
vector<P> vec[101];
int d[101];

void dijkstra(int s){
		pq<P, vector<P>, greater<P> > q;
		q.push(mk(0, s));
		d[s] = 0;
		while(!q.empty()){
				P p = q.top(); q.pop();
				int at = p.second;
				int dis = p.first;
				if(d[at] < dis)continue;
				for(auto itr = vec[at].begin(); itr != vec[at].end(); ++itr){
						int to = (*itr).second;
						int cost = (*itr).first;
						if(d[to] > dis + cost){
								d[to] = dis + cost;
								q.push(mk(d[to], to));
						}
				}
		}
}

int main(int argc, char const* argv[])
{
	do{
			cin >> n >> k;
			for(int i = 0; i < n; i++){
					vec[i].erase(vec[i].begin(), vec[i].end());
			}
			for(int i = 0; i < k; i++){
					int a;
					cin >> a;
					if(a == 0){
							int b, c;
							cin >> b >> c;
							b--; c--;
							fill(d, d+n, inf);
							dijkstra(b);
							if(d[c] == inf)cout << -1 << endl;
							else cout << d[c] << endl;
					}else{
							int b, c, dd;
							cin >> b >> c >> dd;
							b--; c--;
							vec[b].pb(mk(dd, c));
							vec[c].pb(mk(dd, b));
					}
			}
	}while(n != 0);
	return 0;
}



Measured memory_bytes: 3084
N=int(input())
S=input()
M=[0 if s=='R' else 1 if s=='G' else 2 for s in S]

C = [[0] * (N+1) for _ in range(3)]
for i in range(N-1,-1,-1):
    for j in range(3):
        C[j][i] = C[j][i+1]+1 if M[i]==j else C[j][i+1]

ans=0
for i in range(N):
    for j in range(i+1,N):
        if M[i]==M[j]: continue
        k=3-M[i]-M[j]
        ans+=C[k][j+1]
        if j+(j-i) < N and M[j+(j-i)]==k: ans-=1
print(ans)


Measured memory_bytes: 68504