akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = list(map(int, input().split()))  # モンスターの数
B = list(map(int, input().split()))  # 勇者のキャパシティ

total_A = sum(A)
# 
# print(A)
# print(B)
# 最初の街に関しては先に処理
if A[0] >= B[0]:
    A[0] -= B[0]
    B[0] = 0  # 勇者のキャパシティを0にする
else:
    B[0] -= A[0]
    A[0] = 0

# print(A)
# print(B)

for i in range(1, N):
    if B[i-1] >= A[i]:
        B[i-1] -= A[i]
        A[i] = 0
        continue
    if B[i-1] > 0:
        A[i] -= B[i-1]
        B[i-1] = 0
    if A[i] > 0:
        if A[i] > B[i]:
            A[i] -= B[i]
            B[i] = 0
        elif B[i] >= A[i]:
            B[i] -= A[i]
            A[i] = 0
    # print("hogeeeeeeeeeee")
    # print(A)
    # print(B)

if (A[-1] > 0) & (B[-1] > 0):
    if A[-1] >= B[-1]:
        A[-1] -= B[-1]
        B[-1] = 0
    elif B[-1] > A[-1]:
        A[-1] = 0
        B[-1] -= A[-1]

# print(A)
# print(B)
after_A = sum(A)

print(total_A - after_A)


Measured memory_bytes: 18752
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

int main(){

  int N; cin >> N;

  vector < vector<pair<int, long long> > > graph(N);
  for (int i = 0; i < N - 1; i++){
    int u, v, w; cin >> u >> v >> w;
    u--; v--;
    graph[u].push_back(make_pair(v, w));
    graph[v].push_back(make_pair(u, w));
  }

  vector <int> ans(N);
  for (int i = 0; i < N; i++){
    ans[i] = -1;
  }
  
  queue <int> que;
  ans[0] = 1; que.push(0);
  
  while (!que.empty()){
    int edge = que.front(); que.pop();

    for (int i = 0; i < graph[edge].size(); i++){
      int next = graph[edge][i].first;
      long long dist = graph[edge][i].second;

      if (ans[next] == -1){
        que.push(next);
        if (dist % 2 == 0) ans[next] = ans[edge];
        else ans[next] = 1 - ans[edge];
      }
    }
  }
  
  for (int i = 0; i < N; i++){
    cout << ans[i] << endl;
  }
  
  return 0;
}


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

int main(){
  vector<int> vec(3);
  for(int i=0; i<3; i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  if(vec.at(0)+vec.at(1)==vec.at(2)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef pair<int, int> pii;

const int N = 200005;

int n, m, k;
int row, col;
string a[2];

int di[] = { -1, 0, 0, 1 };
int dj[] = { 0, -1, 1, 0 };

bool calc(int x, int y, char f, char b) {
//	cout << f << " " << x << endl;
	for (int i = 0; i < k; i++) {
		if (a[0][i] == f)
			x--, y++;
		if (x <= 0)
			return 1;
		if (a[1][i] == b && y > 1)
			x++, y--;
		if (x <= 0)
			return 1;
	}
	return 0;
}

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
	cin >> n >> m >> k >> row >> col >> a[0] >> a[1];
	int u = row;
	int d = n + 1 - row;
	int l = col;
	int r = m + 1 - col;
	if (calc(u, d, 'U', 'D'))
		puts("NO");
	else if (calc(d, u, 'D', 'U'))
		puts("NO");
	else if (calc(l, r, 'L', 'R'))
		puts("NO");
	else if (calc(r, l, 'R', 'L'))
		puts("NO");
	else
		puts("YES");
	return 0;
}


Measured memory_bytes: 920
local function meld(a,b)
    if not a then
        return b
    elseif not b then
        return a
    elseif a[1]<b[1] then
        b[4]=a[3]
        a[3]=b
        return a
    else
        a[4]=b[3]
        b[3]=a
        return b
    end
end

local function pair(a)
    local b=a and a[4]
    if not b then
        return a
    end
    local q={}
    while b do
        local c=b[4]
        a[4]=false
        b[4]=false
        table.insert(q,meld(a,b))
        a=c
        b=a and a[4]
    end
    for i=#q,1,-1 do
        a=meld(a,q[i])
    end
    return a
end


local PairingHeap={}

PairingHeap.empty=function(self)
    return not self[1]
end

PairingHeap.push=function(self,k,v)
	if not self[1] then
		self[1]={
            k,
            v,
            false,
            false,
		}
	else
		if self[1][1]<k then
			self[1][3]={
				k,
				v,
				false,
				self[1][3],
			}
		else
			self[1]={
				k,
				v,
				self[1],
				false,
			}
		end
	end
end

PairingHeap.top=function(self)
    return self[1][2]
end

PairingHeap.pop=function(self)
    self[1]=pair(self[1][3])
end

PairingHeap.join=function(self,other)
	if self[1][1]<other[1][1]then
		other[1][4]=self[1][3]
        self[1][3]=other[1]
	else
		self[1][4]=other[1][3]
        other[1][3]=self[1]
        self[1]=other[1]
    end
    return self
end

PairingHeap.new=function(self)
    local obj={}
    setmetatable(obj,{__index=PairingHeap})
    return obj
end

----------

local n,d,a=io.read("n","n","n")
local pq=PairingHeap:new()
for i=1,n do
    local x,h=io.read("n","n")
    pq:push(x,{x,h,0})
end

local atack=0
local total=0
while not pq:empty() do
    local x,h,c=table.unpack(pq:top())
    pq:pop()
    if c==0 then
        if atack*a<h then
            h=h-atack*a
            local count=(h-1)//a+1
            pq:push(x+2*d+0.5,{x+2*d,count,1})
            total=total+count
            atack=atack+count
        end
    else
        atack=atack-h
    end
end
print(total)

Measured memory_bytes: 114256
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

def solve():
    a,b,c=map(int,input().split())
    if c%gcd(a,b)==0:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    solve()

Measured memory_bytes: 2940
/**
*    author:  yuya1234
*    created: 17.07.2020 14:01:05
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
long double eps = 1.0E-14;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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; }
template<class T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T>T lcm(T a,T b){return gcd(a,b)*(a/gcd(a,b))*(b/gcd(a,b));}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  //std::cout << std::fixed << std::setprecision(15);

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

  int x[m],y[m];
  REP(i,m)
  {
    cin>>x[i]>>y[i];
    x[i]--;
    y[i]--;
  }

  vector<int> v(n,1);
  vector<int> ido(n,0);
  ido[0]=1;
  REP(i,m)
  {
    v[x[i]]--;
    v[y[i]]++;
    if(ido[x[i]]>0 && v[x[i]]==0)
    {
      ido[x[i]]=0;
      ido[y[i]]++;
    }
    else if(ido[x[i]]>0 && v[x[i]]>0)
    {
      if(ido[x[i]]>v[x[i]])ido[x[i]]=v[x[i]];
      ido[y[i]]++;
    }
  }

  int ans=0;
  REP(i,n)
  {
    if(ido[i]>0 && v[i]>0)ans++;
  }

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 4768
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
int main()
{
   int N;
   cin >> N;
   vector<int> L;
   int l_tmp;
   for(int i=0; i < N; i++){
      cin >> l_tmp;
      L.push_back(l_tmp);
   }
   int l_max = *max_element(L.begin(), L.end());
   int l_sum = accumulate(L.begin(), L.end(), 0);
   int l_sum_n_1  = l_sum - l_max;

   if(l_max < l_sum_n_1){
      cout << "Yes" <<endl;
   }
   else{
      cout << "No" <<endl;
   }


   return 0;
}

Measured memory_bytes: 256
n=int(input())
c=1
for i in range(1,n+1):
    c *=i
a=[]
b=[]
for i in range(n):
    x,y=map(int,input().split())
    a.append(x)
    b.append(y)
d=[]
for i in range(n):
    for j in range(i+1,n):
        k=((a[i]-a[j])**2+(b[i]-b[j])**2)**0.5
        d.append(k)

total=c/n*2*sum(d)
print(total/c)


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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')

typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int n;
bool check(vector<vector<int>> cnt, int s)
{
    for (int i = 0; i < n; i++)
    {
        if ((s >> i) & 1)
        {
            for (int j = 0; j < n; j++)
            {
                if (cnt[i][j] != -1 && cnt[i][j] != (s >> j & 1))
                    return false;
            }
        }
    }
    return true;
}
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    //int n;
    cin >> n;
    //vector<int> cnt(n + 1, 1);
    vector<vector<int>> cnt(n, vector<int>(n, -1));
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        //bool ok = 1;
        for (int j = 1; j <= a; j++)
        {
            int x, y;
            cin >> x >> y;
            x--;
            cnt[i][x] = y;
        }
    }
    int num = (1 << n) - 1;
    //cout << "num:" << num << "\n";
    for (int s = 0; s <= num; s++)
    {
        //bool ok = 1;
        if (check(cnt, s))
        {
            ans = max(ans, __builtin_popcount(s));
        }
    }
    cout << ans << "\n";
    return 0;
}

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

int main(void){
    string a, b, c;
    cin >> a >> b >> c;
    if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

int main() {
  ll n,d;
  cin >> n >> d;
  int cnt = 0;
  rep(i,n) {
    ll x,y;
    cin >> x >> y;
    if(sqrt(x * x + y * y) <= d) cnt++;
  }

  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <math.h>

int main(void){
	
	short i,j,a[4],b[4],hit,blow;

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF){
		hit=0;blow=0;
		scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
		for(i=0;i<4;i++){
			if(a[i]==b[i]){hit++;b[i]=99;}
			else{
				for(j=0;j<4;j++){
					if(a[i]==b[j]){blow++;b[j]=99;break;}
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}

	return 0;
}

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

int main() {
    string s;
    cin >> s;
    int n = sz(s);
    vector<int> ans(n,0);
    int count = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') {
            count++;
        }
        else if(s[i-1] != s[i]){
            ans[i-1]=count;
            count=0;
        }
    }
    //rep(i,n) cout << ans[i];
    //cout << endl;
    count = 0;
    for (int i = n-1; i >= 0; i--) {
        if (s[i] == 'L') {
            count++;
        }
        else if(s[i+1] != s[i]){
            ans[i+1]=count;
            count=0;
        }
    }
    //rep(i,n) cout << ans[i];
    //cout << endl;
    int l,r;
    rep(i,n-1){
        if (s[i] == 'R' && s[i+1] == 'L'){
            l = ans[i];
            r = ans[i+1];
            ans[i] = l/2+l%2+r/2;
            ans[i+1] = r/2+r%2+l/2;
        }
    }
    rep(i,n) cout << ans[i] << ' ';
    cout << endl;
    return 0;
}


Measured memory_bytes: 1024
/*
 * WelcomeToAtCoder.cpp
 *
 *  Created on: 2020/02/19
 *      Author: black
 */
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

long long S[100000];
long long T[50000];

int main(){
	int n, q;
	cin >> n;
	for(int i=0;i<n;++i){
		cin >> S[i];
	}

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

	int left = 0;
	int right = n-1;
	int center = (right+left)/2;
	int count = 0;

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

		while(center != left){
			center = (right+left)/2;
			//cout << "R=" << right << ",L=" << left << ",C=" << center << endl;
			if (S[center] == T[i]){
				++count;
				break;
			}
			else if(S[center] < T[i]){
				left = center+1;
			}
			else{
				right = center-1;
			}
			if (left == right){
				if (S[left] == T[i]){
					count++;
				}
				break;
			}
		}
	}

	cout << count << endl;

	return 0;
}



Measured memory_bytes: 4268
#include<iostream>

using namespace std;

int main() {
	int K, S, ans = 0;
	cin >> K >> S;

	for (int x = 0;x <= K;x++) {
		for (int y = 0;y <= K;y++) {
		
			int z = S - x - y;

			if (0 <= z and z <= K) {
				ans = ans + 1;
			}

		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7; // change if needed

struct Modint {
  ll val;
  
  Modint (ll _val = 0)
    : val(_val % MOD) {}

  Modint operator+ (Modint other) const {
    return Modint(val + other.val);
  }

  void operator+= (Modint other) {
    val += other.val;
    val %= MOD;
  }

  Modint operator- () const {
    return Modint(MOD - val);
  }

  Modint operator- (Modint other) const {
    return Modint(val + MOD - other.val);
  }

  void operator-= (Modint other) {
    val += MOD - other.val;
    val %= MOD;
  }

  Modint operator* (Modint other) const {
    return Modint(val * other.val);
  }

  void operator*= (Modint other) {
    val *= other.val;
    val %= MOD;
  }

  bool operator== (Modint other) const {
    return val == other.val;
  }

  bool operator!= (Modint other) const {
    return val != other.val;
  }
};

Modint exp (Modint a, int k) {
  if (k == 0) {
    return Modint(1);
  } else if (k % 2 == 0) {
    Modint half = exp(a, k / 2);
    return half * half;
  } else {
    return a * exp(a, k - 1);
  }
}

Modint inv (Modint a) {
  return exp(a, MOD - 2);
}

ostream& operator<< (ostream& out, Modint p) {
  out << p.val;
  return out;
}

const int MAX_N = 17;

Modint fact [1 << MAX_N];
Modint invfact [1 << MAX_N];

Modint choose (int n, int k) {
  if (n < k) return Modint(0);
  return fact[n] * invfact[n - k] * invfact[k];
}

int arr [MAX_N];
Modint dp [MAX_N][1 << MAX_N];
// dp[k][mask] -- # of ways that the mask groups all have minimums in the first k

Modint sign [2] = {Modint(1), -Modint(1)};

int main () {
  ios::sync_with_stdio(false);
  
  fact[0] = Modint(1);
  invfact[0] = Modint(1);
  for (int i = 1; i < 1 << MAX_N; i++) {
    fact[i] = Modint(i) * fact[i - 1];
    invfact[i] = inv(Modint(i)) * invfact[i - 1];
  }

  int n, m;
  cin >> n >> m;
  
  for (int i = 0; i < m; i++) {
    cin >> arr[i];
  }
  reverse(arr, arr + m);

  dp[0][0] = Modint(1);
  
  Modint ans = 0;
  for (int k = 1; k <= m; k++) {
    for (int mask = 0; mask < 1 << n; mask++) {
      dp[k][mask] = dp[k - 1][mask];
      for (int i = 0; i < n; i++) {
        if (mask & 1 << i) {
          int last = mask - (1 << i);
          int left = (1 << n) - arr[k - 1] - last;
          dp[k][mask] += choose(left, (1 << i) - 1) * dp[k - 1][last];
        }
      }

      if (k == m) {
        Modint cur = dp[k][mask];
        int left = (1 << n) - 1 - mask;
        for (int i = 0; i < n; i++) {
          if (!(mask & 1 << i)) {
            cur *= choose(left, 1 << i);
            left -= 1 << i;
          }
        }

        ans += sign[__builtin_popcount(mask) % 2] * cur;
      }
    }
  }

  if (m == 0) {
    ans = Modint(1);
    int left = (1 << n) - 1;
    for (int i = 0; i < n; i++) {
      ans *= choose(left, 1 << i);
      left -= 1 << i;
    }
  }
  
  for (int i = 0; i < n; i++) {
    ans *= Modint(2);
    ans *= fact[1 << i];
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 19712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    ll H, N;
    cin >> H >> N;
    vl A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];

    vl dp(H + 1, INF);
    dp[0] = 0;
    rep(h, H){
        rep(i, N){
            chmin(dp[min(h + A[i], H)], dp[h] + B[i]);
        }
    }

    cout << dp[H] << endl;
}

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

int main() {
  int tate;
  cin >> tate;
  int yoko;
  cin >> yoko;
  
  vector<vector<char>> moji(tate, vector<char>(yoko, ' '));
  
  for (int i = 0; i < tate; i = i + 1) {
    for (int j = 0; j < yoko; j = j + 1) {
      cin >> moji.at(i).at(j);
    }
  }
  
  vector<vector<bool>> line(tate, vector<bool>(yoko, true));
  
  for (int i = 0; i < tate; i = i + 1) {
    if (moji.at(i) == vector<char>(yoko, '.')) {
      line.at(i) = vector<bool>(yoko, false);
    }
  }
  
  for (int j = 0; j < yoko; j = j + 1) {
    
    int count = 0;
    
    for (int i = 0; i < tate; i = i + 1) {
      if (moji.at(i).at(j) == '.') {
        count = count + 1;
      }
    }
    if (count == tate) {
      for (int i = 0; i < tate; i = i + 1) {
        line.at(i).at(j) = false;
      }
    }
  }
  
  for (int i = 0; i < tate; i = i + 1) {
    
    bool kaigyou = false;
    
    for (int j = 0; j < yoko; j = j + 1) {
      if (line.at(i).at(j) == true) {
        cout << moji.at(i).at(j);
        kaigyou = true;
      }
    }
    if (kaigyou == true) {
      cout << endl;
    }
    
  }
}

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

map<int, int> mp;
int dp[1010101];

int main(void) {
	int cur = 0, i = 0;
	dp[0] = 0; mp[0] = 0;
	for (char c = getchar(); c >= 'a' && c <= 'z'; c = getchar()) {
		++i; cur ^= (1 << c - 'a');
		int cnt = __builtin_popcount(cur);
		dp[i] = 1 << 30;
		if (mp.count(cur))
			dp[i] = min(dp[i], dp[mp[cur]] + 1);
		for (int sigma = 0; sigma < 26; sigma++)
			if (mp.count(cur ^ (1 << sigma)))
				dp[i] = min(dp[i], dp[mp[cur ^ (1 << sigma)]] + 1);
		if (!mp.count(cur) || dp[mp[cur]] > dp[i])
			mp[cur] = i;
	}
	cout << dp[i] << endl;
	return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 200200;
const int mod = 1e9 + 7;
const ll INF = 1e18;

ll n,a[N],s[N],ans;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	
	cin>>n;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	sort(a+1,a+n+1);
	fo(i,n)
		s[i]=s[i-1]+a[i];
	ans=n;
	for(int i=n;i>1;--i)
		if(s[i-1]*2<a[i])
		{
			ans=n-i+1;
			break;
		}
	cout<<ans;
	return 0;	
}

Measured memory_bytes: 1792
import sys
readline = sys.stdin.readline
class UFP():
    def __init__(self, num):
        self.par = [-1]*num
        self.dist = [0]*num
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            res = 0
            xo = x
            while self.par[x] >= 0:
                res += self.dist[x]
                x = self.par[x]
            self.dist[xo] = res
            self.par[xo] = x
            return x
    
    def union(self, x, y, d):
        rx = self.find(x)
        ry = self.find(y)
        if rx != ry:
            if self.par[rx] > self.par[ry]:
                rx, ry = ry, rx
                x, y = y, x
                d = -d
            self.par[rx] += self.par[ry]
            self.par[ry] = rx
            self.dist[ry] = d + self.dist[x] - self.dist[y]
            return True
        else:
            if d + self.dist[x] - self.dist[y]:
                return False
            return True           
    
INF = 3*10**9
def check():
    H, W = map(int, readline().split())
    N = int(readline())
    Hm = [INF]*H
    Wm = [INF]*W
    HP = [[] for _ in range(H)]
    WP = [[] for _ in range(W)]
    for _ in range(N):
        h, w, a = map(int, readline().split())
        h -= 1
        w -= 1
        Hm[h] = min(Hm[h], a)
        Wm[w] = min(Wm[w], a)
        HP[h].append((w, a))
        WP[w].append((h, a))
        
    Th = UFP(H)
    Tw = UFP(W)
    for h in range(H):
        L = len(HP[h]) 
        if L > 1:
            HP[h].sort()
            for i in range(L-1):
                wp, ap = HP[h][i]
                wn, an = HP[h][i+1]
                if not Tw.union(wp, wn, an-ap):
                    return False
    for w in range(W):
        L = len(WP[w]) 
        if L > 1:
            WP[w].sort()
            for i in range(L-1):
                hp, ap = WP[w][i]
                hn, an = WP[w][i+1]
                if not Th.union(hp, hn, an-ap):
                    return False
    
    cmh = [INF]*H
    for h in range(H):
        rh = Th.find(h)
        cmh[rh] = min(cmh[rh], Th.dist[h])
    cmw = [INF]*W
    for w in range(W):
        rw = Tw.find(w)
        cmw[rw] = min(cmw[rw], Tw.dist[w])
    
    for h in range(H):
        if Hm[h] - Th.dist[h] + cmh[Th.find(h)] < 0:
            return False
    for w in range(W):
        if Wm[w] - Tw.dist[w] + cmw[Tw.find(w)] < 0:
            return False
    return True

print('Yes' if check() else 'No')

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int k, n;
    cin >> k >> n;
    vec a = ivec(n);
    int las = a[0] + k - a.back();
    int ma = 0;
    For(i, 0, n - 2) chmax(ma, a[i + 1] - a[i]);
    chmax(ma, las);
    print(k - ma);

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  lint N, M, L;
  cin >> N >> M >> L;
  vector<vector<lint>> dist(N, vector<lint>(N, 1e15));
  REP(i, M) {
    lint A, B, C;
    cin >> A >> B >> C;
    A--; B--;
    if(C <= L) {
      dist[A][B] = C;
      dist[B][A] = C;
    }
  }
  REP(k, N) REP(i, N) REP(j, N) if(dist[i][k]+dist[k][j] < dist[i][j]) dist[i][j] = dist[i][k]+dist[k][j];
  REP(i, N) REP(j, N) {
    if(dist[i][j] <= L) {
      dist[i][j] = 1;
    } else {
      dist[i][j] = 1e15;
    }
  }
  REP(k, N) REP(i, N) REP(j, N) if(dist[i][k]+dist[k][j] < dist[i][j]) dist[i][j] = dist[i][k]+dist[k][j];
  lint Q;
  cin >> Q;
  REP(q, Q) {
    int s, t;
    cin >> s >> t;
    s--; t--;
    if(dist[s][t] >= 1e9) {
      cout << -1 << "\n";
    } else {
      cout << dist[s][t]-1 << "\n";
    }
    
  }
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+10;
map<pair<int,int>,int>jl;
int n,m,k;
void cl(int x,int y){
	for(int i=x-2;i<=x;i++)
	for(int j=y-2;j<=y;j++){
		if(i<=0||j<=0)continue;
		jl[make_pair(i,j)]++;
	}
}
ll ans[10];
int main()
{
	//freopen("H:\\c++1\\in.txt","r",stdin);
	//freopen("H:\\c++1\\out.txt","w",stdout);
	scanf("%d%d",&n,&m);
	scanf("%d",&k);
	while(k--){
		int x,y;
		scanf("%d%d",&x,&y);
		cl(x,y);
	}
	for(auto it:jl){
		int x=it.first.first,y=it.first.second;
		if(x+2>n||y+2>m)continue;
		ans[it.second]++;
	}
	ll sum=0;
	for(int i=1;i<=9;i++)sum+=ans[i];
	ans[0]=1ll*(n-2)*(m-2)-sum;
	for(int i=0;i<=9;i++)printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 56448
import java.util.Scanner;
   
class Main
{
   
    public static void main(String[] args)
    {   Scanner stdIn=new Scanner(System.in);
        int a=stdIn.nextInt();
        int b=stdIn.nextInt();
        int c=stdIn.nextInt();
          
        if(a<b && b<c){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
          
    }
}

Measured memory_bytes: 26012
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
ans = 0
for i in range(1, n+1, 2):
    ct = 0
    for j in range(1, i+1):
        if i % j == 0:
            ct += 1
    if ct == 8:
        ans += 1
print(ans)

Measured memory_bytes: 38640
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
if a < 40:
    a=40
if b < 40:
    b=40
if c < 40:
    c=40
if d < 40:
    d=40
if e < 40:
    e=40

print((a+b+c+d+e)//5)


Measured memory_bytes: 5592
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PP pair<P,P>

int dp[5100][5100];

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n;
  string s;  
  cin>>n>>s;

  rep(i,n){
    FOR(j,i+1,n){
      if(s[i]==s[j]){
        if(i==0) dp[i][j]=1;
        else dp[i][j]=min(dp[i-1][j-1]+1,j-i);
      }
    }
  }

  int ans=0;
  rep(i,n){
    rep(j,n){
      ans=max(ans,dp[i][j]);
    }
  }

  cout<<ans<<endl;


}

Measured memory_bytes: 200960
/*input
6 2 4
33189 87907 277349742
71616 46764 575306520
8801 53151 327161251
58589 4337 796697686
66854 17565 289910583
50598 35195 478112689
13919 88414 103962455
7953 69657 699253752
44255 98144 468443709
2332 42580 752437097
39752 19060 845062869
60126 74101 382963164
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=1000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

vector<ll> v[maxn];

bool cmp(vector<ll> A,vector<ll> B){
	return A[0]-A[1]<B[0]-B[1];
}

ll pre[maxn];
priority_queue<ll,vector<ll>,greater<ll>> pq;

int main(){
	IOS;
	int x,y,z;
	cin>>x>>y>>z;
	REP(i,x+y+z){
		v[i].resize(3);
		REP(j,3) cin>>v[i][j];
	}
	ll ans=0;
	REP(i,x+y+z){
		ans+=v[i][2];
		v[i][0]-=v[i][2];
		v[i][1]-=v[i][2];
		v[i][2]=0;
	}
	// cout<<ans<<'\n';
	sort(v,v+x+y+z,cmp);
	ll sum=0;
	for(int i=0;i<x+y+z;i++){
		pq.push(v[i][1]);
		sum+=v[i][1];
		if(SZ(pq)>y){
			sum-=pq.top();
			pq.pop();
		} 
		if(SZ(pq)<y) pre[i]=-INF64;
		else pre[i]=sum;
	}
	ll ret=-INF64;
	while(SZ(pq)) pq.pop();
	sum=0;
	for(int i=x+y+z-1;i>0;i--){
		pq.push(v[i][0]);
		sum+=v[i][0];
		if(SZ(pq)>x){
			sum-=pq.top();
			pq.pop();
		}
		if(SZ(pq)==x){
			ret=max(ret,sum+pre[i-1]);
		}
	}
	cout<<ret+ans<<'\n';
	return 0;
}


Measured memory_bytes: 12664
(n, m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.append([int(j) for j in input().split()])

for i in range(m):
    b.append(int(input()))

for i in range(n):
    s = 0
    for j in range(m):
        s += A[i][j] * b[j]
    print(s)

Measured memory_bytes: 7012
#include<iostream>
#include<vector>
#define MAX int(7.5*1e6)
using namespace std;

int main(){
  int n, m;
  while(1) {
    scanf("%d %d\n", &m, &n);
    if(n == 0)break;
    vector<bool> isBoring(MAX, false);
    for (int i = 0; i < n; i++) {
      while(isBoring[m]) m++;
      for (int j = m; j < MAX; j+=m) {
        isBoring[j] = true;
      }
    }
    while(isBoring[++m]);
    std::cout << m << std::endl;
  }
  return 0;
}

Measured memory_bytes: 4036
#include <stdio.h>

int main()
{
    long long n, k, i; 
    long long min, max;
    long long num = 0;
    scanf("%lld%lld", &n, &k);

    for (i = k; i <= n + 1; i++) {
        min = (long long)(i * (i-1) / 2);
        max = (long long)((2*n-i+1) * i / 2);
        num += max - min + 1;
    }

    printf("%lld\n", num % 1000000007);

    return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    int n, m; cin >> n >> m;
    vector<int> A(n);
    int sum = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> A[i];
        sum += A[i];
    }
    double k = (double)sum / (4 * m);
    int cnt = 0;
    for(int i = 0; i < n; i++)
    {
        if(A[i] >= k) cnt++;
    }
    if(cnt >= m)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a[4];
  int b[4];
  
  while(scanf("%d",&a[0])!=EOF){
    int i;
    int hit=0;
    int blow=0;
    for(i=1;i<4;i++){
      scanf("%d",&a[i]);
    }
    for(i=0;i<4;i++){
      scanf("%d",&b[i]);
    }

    for(i=0;i<4;i++){
      int j;
      if(a[i]==b[i]){
	hit++;
      }

      for(j=0;j<4;j++){
	if(i!=j){
	  if(a[i]==b[j]){
	    blow++;
	  }
	}
      }
    }
    printf("%d %d\n",hit,blow);
  }

  return 0;
}

Measured memory_bytes: 596
var input: string = require('fs').readFileSync('/dev/stdin', 'utf8');
var inputLines: string[] = input.trim().split("\n");
var parts = inputLines[0].split(" ");

var f = parts[0].toUpperCase().charAt(0);
var s = parts[1].toUpperCase().charAt(0);
var t = parts[2].toUpperCase().charAt(0);
console.log(f + s + t);

Measured memory_bytes: 7372
#include <stdio.h>

int main(void)
{
	int a, b;
	
	scanf("%d %d", &a, &b);
	printf("%d\n", a - b);
	
	scanf("%d %d", &a, &b);
	printf("%d\n", a - b);
	
	scanf("%d %d", &a, &b);
	printf("%d\n", a - b);
	
	scanf("%d %d", &a, &b);
	printf("%d\n", a - b);
	
	scanf("%d %d", &a, &b);
	printf("%d\n", a - b);
	
	scanf("%d %d", &a, &b);
	printf("%d\n", a - b);
	
	scanf("%d %d", &a, &b);
	printf("%d\n", a - b);
	
	return (0);
}

Measured memory_bytes: 600
N = int(input())
CSF = [list(map(int, input().split())) for _ in range(N-1)]

for i in range(N-1):
    result = 0
    for j in range(i, N-1):
        if result <= CSF[j][1]:
            result = CSF[j][0] + CSF[j][1]
        else:
            result = CSF[j][0] + CSF[j][1] + ((-((-(result-CSF[j][1]))//CSF[j][2])) * CSF[j][2])

    print(result)

print(0)


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <cmath>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define step(i, f, n, a) for(int (i) = (f); (i) < (n); (i)+=a)
#define rstep(i, f, n, a) for(int (i) = (f); (i) >= (n); (i)-=a)
#define p(...) printf(__VA_ARGS__); cout << endl;
#define gets(x) x; cin >> x;
#define puts(x) x; cout << x << endl;
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](const a, const b){ return c ;}
#define key(t, x, compare) [](const t& a, const t& b){ return a x compare b x ;}

using namespace std;

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

int main(){
  ll x, y;
  cin >> x >> y;
  if (1 >= abs(x-y)) {
    puts("Brown")
  }else{
    puts("Alice")
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		int[] cnt = new int[26];
		for(int i = 0; i < s.length(); i++) {
			int idx = s.charAt(i) - 'a';
			cnt[idx]++;
		}
		int min = 100;
		for(int i = 0; i < 26; i++) {
			if(cnt[i] == 0) continue;
			char c = (char)(i + 'a');
			String t = s;

			int m = 0;
			for(int j = 0; j < 100; j++) {
				if(check(t, c)) break;
				String w = "";
				m++;
				for(int k = 0; k < t.length() - 1; k++) {
					if(t.charAt(k) == c || t.charAt(k + 1) == c) {
						w += c;
					}else {
						w += t.charAt(k);
					}
				}
				t = w;
			}
			min = Math.min(min, m);
		}
		System.out.println(min);
	}
	static boolean check(String s, char c) {
		for(int i = 0; i < s.length(); i++) {
			if(c != s.charAt(i)) return false;
		}
		return true;
	}
}

Measured memory_bytes: 36692
using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            switch (str)
            {
                case "A":
                    Console.WriteLine("T");
                    break;
                case "T":
                    Console.WriteLine("A");
                    break;
                case "G":
                    Console.WriteLine("C");
                    break;
                case "C":
                    Console.WriteLine("G");
                    break;
            }
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <iomanip> // << fixed << precision(10)
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

#define FOR(i,s,t) for(int i=s;i<t;i++)
#define REP(i,n) FOR(i,0,n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) for_each(begin(A), end(A), [&](T i){ cout << i << " "; });cout << "\n"
#define MOD 1000000007

typedef long lint;
typedef pair<lint, lint> P;
bool lessPair(const P& l, const P& r){return l.second < r.second;}

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

    vector<lint> city(4, 0);

    REP(i, 3) {
      lint a,b; cin >> a; cin >> b;
      city[a-1]++;
      city[b-1]++;
    }
    
    REP(i, 4) {
      if(city[i] == 2 || city[i] == 1) {
        continue;
      }

      PRINT("NO");
      return 0;
      
    }

    PRINT("YES");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	string s;
	cin>>s;
	for(int i=0;i<(int)s.size();i++){
		if(i%2==0){
			cout<<s[i];
		}
	}
	return 0;
}


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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  int N; cin >> N;
  vector<ll> A(N), B(N);
  for(int i = 0; i < N; i++){
    cin >> A[i] >> B[i];
  }


  vector<pair<ll,int>> C(N);
  for(int i = 0; i < N; i++){
    C[i] = make_pair(A[i] + B[i], i);
  }

  sort(C.rbegin(), C.rend());

  ll a_val = 0;
  ll b_val = 0;
  for(int i = 0; i < N; i++){
    int index = C[i].second;
    // cerr << C[i].first << " " << C[i].second << endl;
    if(i%2==0){
      a_val += A[index];
    } else { 
      b_val += B[index];
    }
  }

  cout << a_val - b_val << endl;

}


Measured memory_bytes: 6412
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int kuti = 1;
        int tap = 0;
        while (kuti < b) {
            kuti = kuti - 1 + a;
            tap++;
        }

        System.out.println(tap);
    }
}


Measured memory_bytes: 21844
#include<iostream>
#include<string>
using namespace std;
int main(void)
{
	long long Count = 0, ans = 0;
	string str;
	cin>>str;
	if (str.length() >= 3)
		for(int i = 0; i < str.length()-1; i++)
		{
			if (str[i] == 'A')
				Count++;
			else if (str[i] == 'B' && str[i+1] == 'C')
					ans+=Count, i++;
			else Count = 0;
		}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    int  main(){
        ll n,d,dem=1;
        cin>>n;
        d=7;
        if(n%2==0||n%5==0) cout<<-1;
        else{
        while(d%n){
            d=10*d+7;
            d=d%n;
            dem++;
        }
        cout<<dem;
        }
        return 0;
    }


Measured memory_bytes: 3640
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    g = {}
    for i in range(n):
        s = input()
        if s in g:
            g[s] += 1
        else:
            g[s] = 1
    
    m = f()[0]
    for i in range(m):
        s = input()
        if s in g:
            g[s] -= 1
        else:
            g[s] = -1

    mxv = 0
    for k,v in g.items():
        mxv = max(mxv, v)
    
    print(mxv)

solve()


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

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

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

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        k: usize,
        v: [usize1; n]
    }
    let mut ans = 0;
    if v[0] != 0 {
        ans = 1;
    }
    let mut t = vec![vec![]; n];
    for i in 1..n {
        t[v[i]].push(i);
    }
    ans += dfs(0, &t, k).1;
    println!("{}", ans);
}

fn dfs(r: usize, t: &Vec<Vec<usize>>, k: usize) -> (usize, usize) {
    let mut h = 0;
    let mut c = 0;
    for &v in &t[r] {
        let (hs, cs) = dfs(v, t, k);
        c += cs;
        if hs == k - 1 && r != 0 {
            c += 1;
        } else {
            h = max(h, hs + 1);
        }
    }
    (h, c)
}


Measured memory_bytes: 23420
#include<stdio.h>

int main(void){
    int a, b, c, d, e, i;
    scanf("%d %d %d", &a, &b, &c);

    for (i=0; i<10; i++){
        d = a * c -b;
        printf("%d\n", d);
        c = d;
    }
    return 0;
}

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

int main(){

  int x;
  cin>>x;

  // 整数どうしの割り算は少数点が切り捨てられます
  // X%60 で Xを60で割ったあまりを計算できます
  int h = x / 3600;
  int m = (x / 60) % 60;
  int s = x % 60;
  cout<<h<<":"<<m<<":"<<s<<endl;

  return 0;
}



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

template<class Ty>
using passive_queue = priority_queue<Ty, vector<Ty>, greater<Ty>>;

struct Problem {

	LL dp[200003][3];

	void Solve() {
		UL N; cin >> N;
		vector<LL> A(N); rep(i, N) cin >> A[i];
		rep(j, 3) dp[0][j] = dp[1][j] = 0;
		rep(i, N) {
			dp[i + 2][0] = dp[i][0] + A[i];
			dp[i + 2][1] = max(dp[i + 1][0], dp[i][1] + A[i]);
			dp[i + 2][2] = max(dp[i + 1][1], dp[i][2] + A[i]);
		}
		if (N % 2) cout << dp[N + 1][2] << endl;
		else cout << dp[N + 1][1] << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


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

int		main(void)
{
	long num, dist;

	scanf("%ld %ld", &num, &dist);
	long x[num],y[num];
	int i = 0, sum = 0;
	while (i < num)
	{
		scanf("%ld %ld",&x[i], &y[i]);
		if ((x[i]*x[i] + y[i]*y[i]) <= dist*dist)
			sum++;
		i++;
	}
	printf("%d", sum);
	return(0);
}

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

int main(void){
  int cp;
  int hako[3];
  for(int i = 0; i < 3; i++)
    cin >> hako[i];
  for(int i = 1; i < 3; i++){
    cp = hako[i];
    hako[i] = hako[0];
    hako[0] = cp;
  }
  for(int i = 0; i < 3; i++){
    cout << hako[i] << " ";
  }
  cout << "\n";
  return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using ll = long long;
using namespace std;        
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define ar array
#define mod 1000000007

void solve(){
		int n;
		cin>>n;
		vector<int> v(n);
		for(auto &i:v) cin>>i;
		ll b=0,sum=0;
		for(int i=1;i<n;i++){
			b=(b+v[i-1])%mod;
			sum=(sum+v[i]*b)%mod;
		}
		cout<<sum<<endl;


	

}

int main(){
	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
//	freopen("input.txt",r,"stdin");
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}





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

typedef vector<int> vi;
typedef pair<int, int> pi;

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

#define pb push_back
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

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

    int ans = ceil((double)(B-1)/(A-1));
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256