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

using namespace std;

using vi = vector<int>; using vvi = vector<vi>;
using ii = pair<int,int>; using vii = vector<ii>;
using l = long long; using vl = vector<l>; using vvl = vector<vl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using lu = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
const int INF = numeric_limits<int>::max();
const double EPS = 1e-10; static constexpr auto PI = acos(-1);
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
#define ALL(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(b); a > l(c); a--)

// #define ONLINE_JUDGE
#if defined ONLINE_JUDGE
const bool enable_log = false;
#else
const bool enable_log = true;
#endif
struct VoidStream { void operator&(std::ostream&) { } };
#define LOG !(enable_log) ? (void) 0 : VoidStream() & cerr

const l MOD = e9 + 7;
int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  l n, m;
  while (cin >> n >> m) {
    l sx = 0;
    F(i, 0, n) {
      l a; cin >> a;
      sx = (sx + a * (2 * i - n + 1)) % MOD;
    }
    l sy = 0;
    F(i, 0, m) {
      l a; cin >> a;
      sy = (sy + a * (2 * i - m + 1) + MOD) % MOD;
    }
    cout << (sx * sy) % MOD << '\n';
  }
}


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

using namespace std;

int N, K, C;
string S;

int A[200005], B[200005], P[200005], sum[200005];

int main(void) {

	cin >> N >> K >> C;
	cin >> S;

	S = "$" + S + "$";

	for (int i = 1; i <= N; i++) {
		if (S[i] == 'o') {
			if (i - C - 1 >= 1) {
				A[i] = A[i - C - 1] + 1;
			}
			else { A[i] = 1; }
		}
		else { A[i] = A[i - 1]; }
	}

	

	for (int i = N; i >= 1; i--) {
		if (S[i] == 'o') {
			if (i + C + 1 <= N) { B[i] = B[i + C + 1] + 1; }
			else { B[i] = 1; }
		}
		else {
			B[i] = B[i + 1];
		}
	}


	if (C > 0) {
		for (int i = 1; i + C + 1 <= N; i++) {
			if (A[i] + B[i + C + 1] >= K) {
				for (int j = i + 1; j <= i + C; j++) { P[j] = 1; }
			}
		}

		for (int i = 1; i <= C; i++) {
			if (B[i + 1] >= K) { P[i] = 1; }
		}

		for (int i = N - C + 1; i <= N; i++) {
			if (A[i - 1] >= K) { P[i] = 1; }
		}



		/*for (int i = 1; i + C + 1 <= N; i++) {
			if (A[i] + B[i + C + 1] >= K) { sum[i + 1]++; sum[i + C + 1]--; }
		}


		for (int i = 1; i <= N; i++) {
			sum[i] += sum[i - 1];
		}

		for (int i = 1; i <= N; i++) {
			P[i] += sum[i];
		}*/

	}
	else {
		for (int i = 1; i <= N; i++) {
			if (A[i - 1] + B[i+1] >= K) { P[i] = 1; }
		}
	}

/*	for (int i = 1; i <= N; i++) {
	cout << "A[" << i << "]= " << A[i] <<" B["<<i<<"]= "<<B[i]<< " P["<<i<<"]= "<< P[i] <<" sum["<<i<<"]= "<<sum[i]<< endl;
	}*/


	for (int i = 1; i <= N; i++) {
		if (S[i] == 'o' && P[i] <= 0) { cout << i << endl; }
	}
	
	return 0;
}

Measured memory_bytes: 3392
// finish date: 2019/11/09

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    int N;
    cin >> N;
    cout << (N-1)/2<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void solveSimultaneousEquation( double a, double b, double c, double d, double e, double f )
{
	double x,y,Y,sum;
	
	Y=d*b-a*e;
	sum=d*c-a*f;
	y=sum/Y;
	x=(c-b*y)/a;
	
	printf( "%.3lf %.3lf\n", x, y);

	return;
}

int main( void ) 
{
	double a,b,c,d,e,f;
	
	while( EOF != scanf( "%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f ) ) {
		solveSimultaneousEquation( a, b, c, d, e, f );
	}

	return 0;
}

Measured memory_bytes: 648
S = input()
a = int(S[:2])
b = int(S[2:])
if 1 <= a and a <= 12 and 1 <= b and b <= 12:
    print("AMBIGUOUS")
elif 1 <= a and a <= 12:
    print("MMYY")
elif 1 <= b and b <= 12:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var a=arr[0];
var b=arr[1];
var len=b.length-1;
var reg = new RegExp(b,"g");
var ans=[];
while (reg.test(a)) {
   reg.lastIndex -= len;
   ans.push(reg.lastIndex-1);
}
if(ans.length!=0)console.log(ans.join("\n"));

Measured memory_bytes: 15780
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        sc.useDelimiter("");
		// 整数の入力
		int a = sc.nextInt();
        int b = sc.nextInt(); 
        int c = sc.nextInt();
      
		// 出力
		System.out.println(a + b + c);
	}
}

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

int main(void){
    ll x, h1, h2;
    cin >> x;
    h1 = x / 500;
    x %= 500;
    h2 = x / 5;
    cout << h1 * 1000 + h2 * 5 << endl;
    return 0;
}


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

int main(){
  int n, a;
  vector<int> x;
  vector<vector<unsigned long long int>> table(50);
  for(int i=0; i<50; ++i) table[i].resize(2500);
  
  cin >> n >> a;
  x.resize(n);
  for(int i=0; i<n; ++i){
    cin >> x[i];
  }

  for(int i=0; i<n; ++i){
    for(int j=i-1; j>=0; --j){
      for(int k=0; k<2500; ++k){
	if(table[j][k]){
	  table[j+1][k+x[i]] += table[j][k];
	}
      }
    }
    table[0][x[i]-1]++;
  }

  unsigned long long int count=0;

  for(int i=0; i<n; ++i){
    count += table[i][(i+1)*a-1];
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
const int MASK = (1 << 12) + 5;
const int INF = 1e9;
int dp[MASK];
int state[MASK];
int cost[1005];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	int mask = (1 << n) - 1;
	for (int i = 1; i <= mask; i++) {
		dp[i] = INF;
	}
	for (int i = 1; i <= m; i++) {
		int b;
		cin >> cost[i] >> b;
		for (int j = 0; j < b; j++) {
			int x;
			cin >> x;
			state[i] = state[i] | (1 << (x - 1));
		}
		dp[state[i]] = min(dp[state[i]], cost[i]);
	}
	for (int i = 1; i <= m; i++) {
		for (int j = 0; j <= mask; j++) {
			dp[j | state[i]] = min(dp[j | state[i]], dp[j] + cost[i]);
		}
	}
	if (dp[mask] != INF)
		cout << dp[mask];
	else
		cout << -1;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<lli,lli> ii;
typedef vector<lli> vi;
#define deb(x) cout << #x": " << (x) << endl;

int main(){ _
  lli a, b, c, d;
  cin >> a >> b >> c >> d;
  lli x = a * c, y = a * d, z = b * c, w = b * d;
  vi h;
  h.pb(x);
  h.pb(y);
  h.pb(z);
  h.pb(w);
  sort(rbegin(h), rend(h));
  cout << h[0] << ENDL;
  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(int I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl



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

	ll N,K;
	cin >> N >> K;
	vector<ll> a(N);
	FOR(i,0,N)cin>>a[i];

	vector<bool> dp(K+1,false);
	FOR(i,0,K+1){
		FOR(j,0,N){
			if(i-a[j] >= 0)if(dp[i-a[j]] == false){
				dp[i] = true;
			}
		}
	}
	if(dp[K]){
		cout << "First" << endl;
	}else{
		cout << "Second" << endl;
	}
}


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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //A[0]-A[N-1]が持っていい素因数は高々10^5種類
    //10^5回の割り算ができるなら絶対pairwise coprimeじゃない
    int N; cin >> N;
    vector<int> cnt(1000001, 0);
    vector<int> A(N);
    vector<int> B(N);
    vector<int> prime(1000, 1);
    vector<int> pr_lst;
    bool pairwise = true;
    prime[0] = prime[1] = 0;
    for(int i = 2; i < 1000; i++){
        for(int j = (i << 1); j < 1000; j+=i) prime[j] = false;
    }
    rep(i, 1000) if(prime[i]) pr_lst.push_back(i);
    rep(i, N) {cin >> A[i]; B[i] = A[i];}
    //rep(i, N){A[i] = 1000000; B[i] = A[i];}
    rep(i, N){
        for(auto pr: pr_lst){
            if(A[i]%pr == 0){
                cnt[pr]++;
                if(cnt[pr] >= 2) pairwise = false;
                while(A[i]%pr == 0){A[i]/=pr;}
            }
        }
    }
    
    sort(A.begin(), A.end());
    rep(i, A.size()-1) if(A[i] == A[i+1] && A[i] != 1) pairwise = false;
    if(pairwise) cout << "pairwise coprime" << endl;
    else{
        int acc_gcd = 0;
        rep(i, N) acc_gcd = __gcd(acc_gcd, B[i]);
        if(acc_gcd == 1) cout << "setwise coprime" << endl;
        else cout << "not coprime" << endl;
    }
    return 0;
}

Measured memory_bytes: 15060
#include<stdio.h>
#include<string.h>
#define SIZE 1002
int main(){

  int i,j;
  int na,nb,nc,n;
  int a[SIZE],b[SIZE],c[SIZE],d[SIZE];
  int data[SIZE];

  while(1){
  scanf("%d %d %d",&na,&nb,&nc);
  if(na==0 && nb==0 && nc==0)break;
  scanf("%d",&n);

  for(i=1;i<=na+nb+nc;i++)data[i]=2;
  for(i=0;i<n;i++){
    scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]);
    if(d[i]==1){
      data[a[i]]=data[b[i]]=data[c[i]]=1;
    }
  }

  for(i=0;i<n;i++){
    if(d[i]==0){
      if(data[a[i]]==1 && data[b[i]]==1)data[c[i]]=0;
      else if(data[a[i]]==1 && data[c[i]]==1)data[b[i]]=0;
      else if(data[b[i]]==1 && data[c[i]]==1)data[a[i]]=0;
    }
  }
  
  for(i=1;i<=na+nb+nc;i++){
    printf("%d\n",data[i]);
  }
  }

  return 0;
}

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

signed main()
{
    string s;
    int day, ans;
    
    cin >> s;
    day = 0;
    ans = 0;
    for(int i=0 ;i<3 ;i++ ){
        if(s[i] =='R') {
            day++;
        } else {
            day = 0;
        }
        
        ans = max(ans, day);
    }
    
    cout << ans << endl;
    
    return (0);
}

Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-9)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;
const long long inf = 1e12;

int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
	int n, d;
	cin >> n >> d;
	cout << (n + d * 2) / (d * 2 + 1);
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

ans = 0
for b in range(K + 1, N + 1):
    ans += (b - K) * (N // b)
    if N % b != 0:
        if K != 0:
            ans += max(0, N - N // b * b - K + 1)
        else:
            ans += max(0, N - N // b * b - K)

print(ans)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <sstream>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;

int w[]={2,3,5,10,12,15};
int v[]={380,550,850,1520,1870,2244};

int dp[50+1];
void solve(){
	for(int i=0;i<51;i++){
		dp[i]=INT_MAX/3;
	}
	dp[0]=0;
	for(int i=0;i<6;i++){
		for(int j=w[i];j<=50;j++){
			dp[j]=min(dp[j],dp[j-w[i]]+v[i]);
		}
	}
}

main(){
	solve();
	int n;
	while(cin>>n){
		if(n==0)break;
		n/=100;
		cout<<dp[n]<<endl;
	}
}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
  int width,high,i,j;

  while(1){
    scanf("%d %d",&high,&width);
    if(width == 0 && high == 0) break;
    for(i=0;i<high;i++){
      for(j=0;j<width;j++){
        if(i == 0) printf("#");
        else if(j == 0) printf("#");
        else if(j == width-1) printf("#");
        else if(i == high-1) printf("#");
        else printf(".");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2088
#include <bits/stdc++.h>
#define REP(i, a, n) for (ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

int main(void) {
  ll H, W;
  cin >> H >> W;
  vector<string> S(H);
  REP(i, 0, H) cin >> S[i];

  vector<vector<ll>> s1(H + W - 1, vector<ll>(W + 1));
  REP(i, 0, H + W - 1) {
    for (ll y = H - i - 1, x = 0; x < W; y++, x++) {
      if (0 <= y && y < H && S[y][x] == '#') {
        s1[i][x + 1]++;
      }
    }
    REP(j, 0, W) s1[i][j + 1] += s1[i][j];
  }
  vector<vector<ll>> s2(H + W - 1, vector<ll>(W + 1));
  REP(i, 0, H + W - 1) {
    for (ll y = i, x = 0; x < W; y--, x++) {
      if (0 <= y && y < H && S[y][x] == '#') {
        s2[i][x + 1]++;
      }
    }
    REP(j, 0, W) s2[i][j + 1] += s2[i][j];
  }

  ll ans = 0, ans2 = 0;
  REP(i, 0, H) REP(j, 0, W) if (S[i][j] == '#') {
    for (ll y = i + 1, x = j + 1; y < H && x < W; y++, x++) if (S[y][x] == '#') {
      ll t = y - i;
      {
        ll u = H - (i - j + t * 2) - 1, l = max(j - t, 0LL), r = min(j + 1, W);
        if (0 <= u && u < H + W - 1 && l < r) {
          ans += s1[u][r] - s1[u][l];
          if (j - t >= 0 && s1[u][j - t + 1] - s1[u][j - t] > 0) ans2++;
          if (j < W && s1[u][j + 1] - s1[u][j] > 0) ans2++;
        }
      }
      {
        ll u = H - (i - j - t * 2) - 1, l = max(j + t, 0LL), r = min(j + t * 2 + 1, W);
        if (0 <= u && u < H + W - 1 && l < r) {
          ans += s1[u][r] - s1[u][l];
          if (j + t >= 0 && s1[u][j + t + 1] - s1[u][j + t] > 0) ans2++;
          if (j + t * 2 < W && s1[u][j + t * 2 + 1] - s1[u][j + t * 2] > 0) ans2++;
        }
      }
    }
    for (ll y = i + 1, x = j - 1; y < H && x >= 0; y++, x--) if (S[y][x] == '#') {
      ll t = y - i;
      {
        ll u = i + j - t * 2, l = max(j - t * 2, 0LL), r = min(j - t + 1, W);
        if (0 <= u && u < H + W - 1 && l < r) {
          ans += s2[u][r] - s2[u][l];
          if (j - t * 2 >= 0 && s2[u][j - t * 2 + 1] - s2[u][j - t * 2]) ans2++;
          if (j - t < W && s2[u][j - t + 1] - s2[u][j - t] > 0) ans2++;
        }
      }
      {
        ll u = i + j + t * 2, l = max(j, 0LL), r = min(j + t + 1, W);
        if (0 <= u && u < H + W - 1 && l < r) {
          ans += s2[u][r] - s2[u][l];
          if (j >= 0 && s2[u][j + 1] - s2[u][j] > 0) ans2++;
          if (j + t < W && s2[u][j + t + 1] - s2[u][j + t] > 0) ans2++;
        }
      }
    }
  }
  cout << ans - ans2 / 2 << endl;
}

Measured memory_bytes: 3328
#include<stdio.h>
#define NOT_FOUND 0
int binarySearch(int n,int *a,int key){
  int left = 0;
  int right = n;
  int mid;
  while(left < right){
    mid = (left + right) / 2;
    if(a[mid] == key)  return 1;
    else if(key < a[mid])  right = mid;
    else left = mid + 1;
  }
  return NOT_FOUND;
}
int main(){
  int n,a[100000],q,b[50000],i,cnt = 0;
  scanf("%d",&n);
  for(i = 0;i < n; i++){
     scanf("%d",&a[i]);
   }
   scanf("%d",&q);
   for(i = 0;i < q; i++){
     scanf("%d",&b[i]);
   }
   for(i = 0;i < q; i++){
     if(binarySearch(n,a,b[i]) != NOT_FOUND) cnt++;
   }
   printf("%d\n",cnt);
   return 0;
 }



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

void Shuffle(int n, int r){
	int c,p;
	int Deck[50];
	int tmp[50];
	//?±±?????????
	for(int i = 0;i < n;i++){
		Deck[i] = n - i;
	}
	//?????£?????????
	for(int i = 0; i < r; i++){
		cin >> p >> c;
		p--; //??????????????????????????????

		//p??????c???????????????????????£??????
		for(int j = 0; j < c; j++){
			tmp[j] = Deck[j + p];
		}
		//???????????????
		for(int j = p-1; j >= 0; j--){
			Deck[j+c] = Deck[j];
		}
		//?????£?????????????????????????????????
		for(int j = 0; j < c; j++){
			Deck[j] = tmp[j];
		}
	}
	cout << Deck[0] << endl;
}

int main(void){
	int n; //?±±???????????°
	int r; //???????????????????????°
	while(1){
		cin >> n >> r;
		if(n == 0 && r == 0){
			return 0;
		}
		Shuffle(n,r);
	}
	return 0;
}

Measured memory_bytes: 1160
def tashizan(a, b):
    c = a + b
    return c


def hikizan(a, b):
    c = a - b
    return c


def kakezan(a, b):
    c = a * b
    return c


def warizan(a, b):
    c = a // b
    return c


def hantei(op):
    if op == "+":
        ans = tashizan(a, b)
    elif op == '-':
        ans = hikizan(a, b)
    elif op == '*':
        ans = kakezan(a, b)
    elif op == '/':
        ans = warizan(a, b)
    return ans


while True:
    a, op, b = input().split()   # 3変数ともに文字列として読み込む
    a = int(a)                   # a を整数に変換
    b = int(b)                   # b を整数に変換
    
    if op == "?":
        break
    else:
        print(hantei(op))



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

int main() {
    int N, K, Q, a;
    scanf("%d%d%d", &N, &K, &Q);
    vector<int> score(N, K-Q);
    while (Q--) {
        scanf("%d", &a);
        score[a-1]++;
    }
    for (int x : score)
        puts((x > 0) ? "Yes" : "No");
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, m, ans = 0;
  cin >> n >> m;

  cout << (n == m ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <bitset>
typedef long long lint;
const int N=705;
int n,cnt[2],col[N];
bool mp[N][N];
std::bitset <N> bans;

namespace utils{
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
	template <class T> inline void apn(T &x,const T y){x=x<y?x:y;}
	template <class T> inline void apx(T &x,const T y){x=x>y?x:y;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

bool dfs_col(const int x,const bool f){
	col[x]=f,++cnt[f];
	for(int i=1; i<=n; ++i){
		if(i!=x&&!mp[x][i]){
			if(col[i]==-1&&!dfs_col(i,col[x]^1)) return 0;
			else if(col[i]==col[x]) return 0;
		}
	}
	return 1;
}

int main(){
	n=nxi();
	memset(col+1,-1,n*sizeof(int));
	for(int i=nxi(); i; --i){
		int a=nxi(),b=nxi();
		mp[a][b]=mp[b][a]=1;
	}
	bans[0]=1;
	for(int i=1; i<=n; ++i){
		if(~col[i]) continue;
		cnt[0]=cnt[1]=0;
		if(!dfs_col(i,0)){
			return puts("-1"),0;
		}
		bans=bans<<cnt[0]|bans<<cnt[1];
	}
	int ans=1e9;
	for(int i=0; i<=n; ++i){
		if(bans[i]) apn(ans,(i*(i-1)+(n-i)*(n-i-1))>>1);
	}
	printf("%d\n",ans);
	return 0;
}


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

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

int ans;

int main(void) {
    string s, t;
    cin >> s >> t;

    int n = sz(s);
    rep(i, 0, n) if (s[i]!=t[i]) ans++;


  
    cout << ans << "\n";
    return 0;
}



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

int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k,i,j;
    cin>>n>>k;
    string s;
    cin>>s;
    n=s.length();
    vector<int>x,y;
    for(i=0;i<n;i++)
    {
    	if(s[i]=='0')
    	{
    		x.push_back(i);
    		for(j=i;j<n;j++)
    		{
    			if(s[j]!=s[i])
    			break;
			}
			y.push_back(j-1);
			i=j-1;
		}
	}
	int max=0,sum;
	if(x.size()<=k)
	cout<<n;
	else
	{
		
		
		for(i=0;i<=x.size()-k;i++)
		{
			if(i==0)
			{
				sum=x[i+k];
			}
			else
			{
				if(i+k==x.size())
				sum=n-y[i-1]-1;
				else
				sum=x[i+k]-y[i-1]-1;
			}
			if(max<sum)
			max=sum;
		}
		cout<<max;
	}
     
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
typedef long long ll; 
map<ll, int> enumpr(ll n) {
    map<ll, int> V;
    for (ll i = 2; i*i <= n; i++) while (n%i == 0) V[i]++, n /= i;
    if (n>1) V[n]++;
    return V;
}
ll aCb(ll a, ll b)
{
    if (a < b) return 0;

    map<ll, int> up;
    rep(i, 0, b) {
        auto e = enumpr(a - i);
        fore(p, e) up[p.first] += p.second;
    }

    rep(i, 0, b) {
        auto e = enumpr(b - i);
        fore(p, e) up[p.first] -= p.second;
    }

    ll res = 1;
    fore(p, up) {
        rep(i, 0, p.second) res *= p.first;
    }

    return res;
}
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int N, P, A[101];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> P;
    rep(i, 0, N) cin >> A[i];

    int odd = 0, even = 0;
    rep(i, 0, N) {
        if (A[i] % 2 == 1) odd++;
        else even++;
    }


    ll ans = -1;
    if (P == 0) {
        ans = 0;
        int c = 0;
        while (c <= odd) ans += aCb(odd, c), c += 2;
        rep(i, 0, even) ans *= 2;
    } else {
        ans = 0;
        int c = 1;
        while (c <= odd) {
            ans += aCb(odd, c);
            c += 2;
        }
        rep(i, 0, even) ans *= 2;
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 256
a = input()                                                             
b = input()                                                             
c = input()                                                             
d = input()                                                             
e = input()                                                             
                                                                        
orders = [a, b, c, d, e]                                                
orders = sorted(orders, key=lambda x:int(x[-1]))                        
                                                                        
a = []                                                                  
b = []                                                                  
for order in orders:                                                    
    if order[-1] == "0":                                                
        a.append(int(order))                                            
    else:                                                               
        b.append(order)                                                 
                                                                        
if len(a) == 5:                                                         
    o = sum(a)                                                          
else:                                                                   
    o = sum(a) + int(b[0]) + sum([10 - int(_b[-1])+int(_b) for _b in b[1:]])
print(o)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _abs(x) ((x)>0?(x):-(x))
#define M 2000
typedef long long ll;
using namespace std;

bool ab[100000],ac[100000],bc[100000];

bool match(char a, char b)
{
    return (a=='?' || b=='?' || a==b);
}


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

    int A = a.length();
    int B = b.length();
    int C = c.length();

    for (int i=0; i<A; i++)
        for (int j=0; j<B; j++)
            if (!match(a[i],b[j])) ab[i-j+50000] = true;

    for (int i=0; i<A; i++)
        for (int j=0; j<C; j++)
            if (!match(a[i],c[j])) ac[i-j+50000] = true;

    for (int i=0; i<B; i++)
        for (int j=0; j<C; j++)
            if (!match(b[i],c[j])) bc[i-j+50000] = true;


    int ans = 3*M;
            for (int i= -2 * M; i<=2 * M; i++)
                for (int j=-2*M; j<=2*M; j++)
        if (!ab[50000+i] && !ac[50000+j] && !bc[j-i+50000])
            {
                int L = min(0,min(i,j));
                int R = max(A, max(B+i, C+j));
                ans = min(ans,R-L);
            }
    cout << ans;

}





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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



i64 n, m, a[101010];
i64 lcm(i64 x, i64 y){
	return x / __gcd(x,y) * y;
}
void solve(){
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
		i64 cnt = a[0]/2;
	for(int i = 0; i < n; i++){
		i64 c = lcm(cnt, a[i]/2);
		if((c-cnt) % (cnt*2) != 0){
			cout << 0 << endl;
			return;
		}
		cnt = c;
		if(cnt > m){
			cout << 0 << endl;
			return;
		}
	}
	
	cout << 1 + (m-cnt)/(cnt*2) << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  rep(i, N)
  {
    cin >> A[i] >> B[i];
  }
  SORT(A);
  RSORT(B);
  long long ans = 0;
  if (N % 2 == 1)
  {
    int index = (N - 1) / 2;
    ans = B[index] - A[index] + 1;
  }
  else
  {
    int index = (N - 2) / 2;
    long long left = A[index] + A[index + 1];
    long long right = B[index] + B[index + 1];
    ans = right - left + 1;
  }
  cout << ans << endl;
  return 0;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n, m;
    string s;
    cin >> n >> m >> s;

    vector<int> ans;
    int p = n;
    while (p > 0) {
        if (p <= m) {
            ans.push_back(p);
            break;
        }
        bool ok = false;
        for (int i = m; i > 0; i--) {
            if (s[p - i] == '0') {
                ans.push_back(i);
                p -= i;
                ok = true;
                break;
            }
        }
        if (!ok) {
            cout << -1 << EOL;
            return;
        }
    }
    reverse(ALL(ans));
    REP(i, sz(ans)) cout << ans[i] << (i == sz(ans) - 1 ? EOL : ' ');
}


Measured memory_bytes: 1096
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;

struct UnionFind {
    vector<ll> par, siz;

    UnionFind(ll N){
        for(ll i=0;i<N;++i){
            par.push_back(i);
            siz.push_back(1);
        }
    }

    ll root(ll x){
        while(x!=par[x]) x = par[x];
        return x;
    }

    bool same(ll x, ll y){
        return root(x) == root(y);
    }

    ll unite(ll x, ll y){
        ll xx = root(x);
        ll yy = root(y);
        ll ans;
        if(xx==yy) {
            ans = 0;
            return ans;
        }
        else {
            if(siz[xx] < siz[yy]) swap(xx, yy);
            ans = siz[xx] * siz[yy];
            par[yy] = xx;
            siz[xx] += siz[yy];
            return ans;
        }
    }
};

int main() {
    ll N, M;
    cin>>N>>M;
    UnionFind tree(N);
    ll ans = N*(N-1)/2;
    vector<ll> ansarr;
    ansarr.push_back(ans);
    ll A[M], B[M];
    for(ll i=0;i<M;++i){
        cin>>A[i]>>B[i];
        A[i]--;
        B[i]--;
    }
    ll tmpans;
    for(ll i=M-1;i>=0;--i){
        tmpans = tree.unite(A[i], B[i]);
        ans -= tmpans;
        ansarr.push_back(ans);
    }
    for(ll i=M-1;i>=0;--i){
        cout<<ansarr[i]<<endl;
    }
}



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

int main(){
  int n;
  cin >> n;
  vector<long int> a(n+1), b(n);
  for(int i = 0;i<n+1;i++){
    cin >>a.at(i);
  }
  for(int i=0;i<n;i++){
    cin >> b.at(i);
  }
  long int count=0;
  for(int i=0;i< n;i++){
    if(a.at(i)>= b.at(i)) count += b.at(i);
    if(a.at(i)<b.at(i)){
      count += a.at(i);
      if(a.at(i+1) >= b.at(i)-a.at(i)){
        count += b.at(i)-a.at(i);
        a.at(i+1) = a.at(i+1) - (b.at(i) -a.at(i));
      }else{
        count +=a.at(i+1);
        a.at(i+1) = 0;
      }
    }
  }
  cout << count;
}

Measured memory_bytes: 1792
#include <string>
#include<set>
#include <iostream>
using namespace std;
main()
{
    int i,n,h;
    scanf("%d",&n);
    set<string>s;
    string x;
    for(i=1;i<=n;i++)
    {
      cin>>x;
        s.insert(x);
     }
    cout<<s.size()<<endl;
    
}

Measured memory_bytes: 19192
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define int ll
#define pb push_back
#define sz(i) (int)(i.size())
#define fi first
#define se second
#define ld long double
#define pii pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = 1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << std::endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 100 + 10;
const int M = 1e5;
// make sure N size is correctttt!!!!!!!!!

#undef int
int n, w[N], val[N], WT;
#define int ll
int dp[N][M+10];

int solve(int idx, int values){
   if(values < 0){
      return inf;
   }
   if(idx >= n){
      if(values != 0)return inf;
      return 0;
   }
   int &ans = dp[idx][values];
   if(ans != -1)
      return ans;
   ans = inf;
   ans = min({ans, w[idx] + solve(idx+1, values-val[idx]), solve(idx+1, values)});
   return ans;
}

int32_t main(){_

   cin>>n>>WT;

   for (int i = 0; i < n; ++i)
   {
      cin>>w[i]>>val[i];
   }

   memset(dp, -1, sizeof dp);
   
   int ans = 0;
   for (int i = 1; i <= M; ++i)
   {
      int tt = solve(0, i);//exactly i values
      if(tt <= WT){
         ans = i;
      }
   }

   cout<<ans;
   //make sure N size is correct!!!!!!!!!
   return 0;
}

Measured memory_bytes: 86272
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    const long Hou = 1000000007;

    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3 3");
            WillReturn.Add("1 3 4");
            WillReturn.Add("1 3 6");
            //60
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("6 5");
            WillReturn.Add("-790013317 -192321079 95834122 418379342 586260100 802780784");
            WillReturn.Add("-253230108 193944314 363756450 712662868 735867677");
            //835067060
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] XArr = InputList[1].Split(' ').Select(A => int.Parse(A)).ToArray();
        int[] YArr = InputList[2].Split(' ').Select(A => int.Parse(A)).ToArray();

        long SenbunSumX = DeriveSenbunSum(XArr);
        long SenbunSumY = DeriveSenbunSum(YArr);

        long Answer = SenbunSumX * SenbunSumY;
        Answer %= Hou;
        Console.WriteLine(Answer);
    }

    //座標の配列を引数として、作成可能な線分の長さの総和を返す
    static long DeriveSenbunSum(int[] pArr)
    {
        int UB = pArr.GetUpperBound(0);
        long SenbunSum = 0;
        for (int I = 0; I <= UB; I++) {
            long CurrPos = pArr[I] % Hou;
            int KeisuuMinus = I;
            int KeisuuPlus = UB - I;
            SenbunSum += -CurrPos * KeisuuMinus;
            SenbunSum %= Hou;
            SenbunSum += CurrPos * KeisuuPlus;
            SenbunSum %= Hou;
        }
        return SenbunSum;
    }
}


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 3e2 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-8;

ll n;
str s[MAXN];

void shift(){
	for(int i = 0; i < n; i++){
		for(int j = 1; j < n; j++) swap(s[i][j], s[i][j - 1]);
	}
	return ;
}

bool valid(){
	for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(s[i][j] != s[j][i]) return false;
	return true;
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for(int i = 0; i < n; i++) cin >> s[i];
	ll ans = 0;
	for(int i = 0; i < n; i++){
		shift();
		if(valid()) ans ++;
	}
	cout << ans * n << '\n';
	return 0;
}


/*
                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define adj_list vector<vi>
#define endl "\n"
#define INF_INT 2e9
#define INF_LL 2e18
#define matmax 25
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define pi pair<int, int>
#define pii pair<int, pair<int, int> >
#define pl pair<ll, ll>
#define pll pair<ll, pair<ll, ll> >
#define vi vector<int>
#define vl vector<ll>
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long int ll;

ll pow1(ll a, ll b, ll m = mod)
{
	if (b == 0)
		return 1ll;
	else if (b == 1)
		return a;
	else
	{
		ll x = pow1(a, b/2, m);
		x *= x;
		x %= m;
		if (b%2)
		{
			x *= a;
			x %= m;
		}
		return x;
	}
}

template <class avgType>
avgType avg(avgType a, avgType b) {
	return (a + b)/2;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());

int randInt() {
	return rng() % INT_MAX;
}

ll randLL() {
	return rng64() % LLONG_MAX;
}

vector< int > hashmods = {1000000007, 1000000009, 1000000021, 1000000033, 1000000087, 1000000093};

ll n, a[310000], val[310000];

int main() {
	fastio;

	cin>>n;
	for (int i = 1; i <= n; i++) {
		cin>>a[i];
		val[a[i]]++;
	}

	ll ans = 0;

	for (int i = 1; i <= n; i++) {
		ans += (val[i] * (val[i]-1))/2;
	}

	for (int i = 1; i <= n; i++) {
		ll curr = ans;
		curr -= (val[a[i]]-1);
		cout<<curr<<endl;
	}

	return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef vector<int> vi;
const int MX = 2e5 + 5;
#define f(i, x, n) for (int i = x; i < n; i++)
#define int long long
#define w(t)  \
    int t;    \
    cin >> t; \
    while (t--)
#define pb push_back
#define endl "\n"
#define yes cout << "YES" << endl
#define no cout << "NO" << endl

int32_t main()
{
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#else
    // online submission
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t, a, b, d, e, f;
    cin >> t;
    for (int i = 1; i > 0; i++)
    {
        a = i * 1000;
        if (a >= t)
            break;
    }
    cout << a - t << endl;

    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define mn(a, b) (a < b ? a : b)
#define mx(a, b) (a > b ? a : b)
#define f first
#define s second
#define all(v) (v).begin(), (v).end()
#define base 331

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main(){

    //freopen(".in","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll a, b, n;
    cin>>n>>a>>b;
    if(a > b) swap(a, b);
    ll aux = b - a - 1;
    if(aux % 2 == 0){
        ll aux2 = n - b;
        ll na = a + aux2;
        ll x1 = aux2 + 1;
        na++;
        if(na != n) x1 += ((n - na - 2) / 2 + 1);
        ll x2 = a - 1;
        ll nb = aux + 1;
        if(nb != 1)
            x2 += (nb - 3) / 2 + 1;
        cout<<mn(x1, x2 + 1);
    }
    else cout<<(aux - 1) / 2 + 1;
    return 0;
}


Measured memory_bytes: 256
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long N, K;
    scan(N, K);
    writeln(((K - 1) ^^ (N - 1)) * K);
}


Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ

int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;;i++){
		int can=1+(a-1)*i;
		if(b<=can){
			printf("%d\n",i);return 0;
		}
	}
}

Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {

	public static void main(String[] args) {
		Task task = new Task();
		task.solve();
	}

	public static class Task {
		static final long MOD = (long) 1e9 + 7;

		public void solve() {
			Scan sc = new Scan();
			int n = (int) sc.scanLong();
			int begin = 0;
			int end = 0;
			int middle = 0;
			int same = 0;
			while (n-- > 0) {
				String curr = sc.scanString();
				char ct = curr.charAt(0);
				char ed = curr.charAt(curr.length() - 1);
				if (ct == 'B' && ed == 'A')
					++same;
				else if (ct == 'B')
					++begin;
				else if (ed == 'A')
					++end;
				middle += curr.split("AB", -1).length - 1;
			}
			if (begin == 0 && end == 0) {
				System.out.println(middle + (same > 0 ? same - 1 : 0));
			} else if (begin == 0 || end == 0) {
				System.out.println(middle + same);
			} else {
				--begin;
				--end;
				middle += (same + 1);
				System.out.println(middle + Math.min(begin, end));
			}
		}
	}

	public static class Scan {
		private byte[] buf = new byte[1024];
		private int index;
		private InputStream in;
		private int total;

		public Scan() {
			in = System.in;
		}

		public int scan() {
			if (total < 0)
				throw new InputMismatchException();
			if (index >= total) {
				index = 0;
				try {
					total = in.read(buf);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				if (total <= 0)
					return -1;
			}
			return buf[index++];
		}

		public long scanLong() {
			long integer = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n)) {
				if (n >= '0' && n <= '9') {
					integer *= 10;
					integer += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			return neg * integer;
		}

		public double scanDouble() throws IOException {
			double doub = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n) && n != '.') {
				if (n >= '0' && n <= '9') {
					doub *= 10;
					doub += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			if (n == '.') {
				n = scan();
				double temp = 1;
				while (!isWhiteSpace(n)) {
					if (n >= '0' && n <= '9') {
						temp /= 10;
						doub += (n - '0') * temp;
						n = scan();
					} else
						throw new InputMismatchException();
				}
			}
			return doub * neg;
		}

		public String scanString() {
			StringBuilder sb = new StringBuilder();
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			while (!isWhiteSpace(n)) {
				sb.append((char) n);
				n = scan();
			}
			return sb.toString();
		}

		public char scanChar() {
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			return (char) n;
		}

		private boolean isWhiteSpace(int n) {
			if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
				return true;
			return false;
		}
	}
}


Measured memory_bytes: 45260