akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
 int N;
 cin>>N;
 vector<int>x(N),y(N),h(N);
 for(int i=0;i<N;i++){
   cin>>x[i]>>y[i]>>h[i];
 }
 for(int i=0;i<=100;i++){
   for(int j=0;j<=100;j++){  
    int64_t H=-1;
    for(int t=0;t<N;t++){
     if(h[t]>0){H=h[t]+abs(i-x[t])+abs(j-y[t]);break;}
    }
    bool ok=true;
    for(int k=0;k<N;k++){
      if(h[k]!=max((int64_t)0,H-abs(i-x[k])-abs(j-y[k]))){
      ok=false;break;}
    }
    if(ok){cout<<i<<" "<<j<<" "<<H<<endl;return 0;}
  } 
 }
 return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
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;}
using namespace std;

int main(){
  double R;
  cin>>R;
  cout<<2*R*PI<<endl;
}

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

int main() {
    uint64_t N, T;
    std::cin >> N >> T;

    uint64_t prev = 0, total = 0, t;
    for (size_t i = 0; i < N; ++i) {
        std::cin >> t;
        if (i == 0 || (prev + T) <= t) {
            total += T;
            prev = t;
        } else {
            total += (T - (prev + T - t));
            prev = t;
        }
    }

    std::cout << total << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e5 + 10;
int s[N], nxt[N][30];
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, L, q;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> s[i];
    }
    cin >> L >> q;
    for(int i = 1; i <= n; i++) {
        int l = i + 1, r = n, res = n+1;
        while(l <= r) {
            int mid = l + r >> 1;
            if(s[mid] <= s[i] + L) {
                res = mid;
                l = mid + 1;
            } else {
                r = mid - 1;
            }
        }
        nxt[i][0] = res;
        // cout << i << "->" << res << '\n';
    }
    for(int i = 1; i < 30; i++) {
        for(int j = 1; j <= n; j++) {
            nxt[j][i] = nxt[nxt[j][i - 1]][i - 1];
            if(nxt[j][i - 1] >= n) {
                nxt[j][i] = n + 1;
            }
            // printf("nxt[%d][%d]:%d\n", j, i, nxt[j][i]);
        }
    }
    while(q--) {
        int a, b;
        cin >> a >> b;
        int l = 1, r = n, res = 0;
        if(a > b) swap(a, b);
        while(l <= r) {
            int mid = l + r >> 1;
            int val = mid, aa = a;
            // val = 2;
            for(int i = 0; i < 30; i++) {
                if((val >> i) & 1) {
                    aa = nxt[aa][i];
                    if(aa >= n) aa = n;
                }
            }
            // cout << ">" << a << endl;
            if(aa >= b) {
                res = mid;
                r = mid - 1;
            } else {
                l = mid + 1;
            }
        }
        cout << res << '\n';
    }
    return 0;
}

Measured memory_bytes: 12928
N, M = map(int, input().split())
A = [-2 for i in range(N)]
for i in range(M):
  c, n = map(int, input().split())
  if A[c-1] != -2 and A[c-1] != n:
    A[c-1] = -1
  elif A[c-1] != -1 or A[c-1] == n:
    A[c-1] = n
if -1 in A:
  print(-1)
else:
  if N == 1 and A[0] == -2:
    print(0)
  elif N == 1 and A[0] >= 0:
    print(A[0])
  elif N != 1:
    if A[0] == -2:
      A[0] = 1
    for i in range(1, N):
      if A[i] == -2:
        A[i] = 0
    if A[0] != 0:
      for i in range(N):
        print(A[i], end = '')
      print()
    else:
      print(-1)

Measured memory_bytes: 3064
//vec[i]の範囲外エラー表示
#define _GLIBCXX_DEBUG
//includeとusing
#include <bits/stdc++.h>
using namespace std;
//型名省略
using ll = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using pll = pair<ll, ll>;
//定数
const ll INF = 1e9;
const ll MOD = 1e9+7;
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define xrep(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define all(A) A.begin(), A.end()
//入力
ll llin() {ll x; cin >> x; return x;}
string stin() {string s; cin >> s; return s;}
vl vlin(ll n) {vl a(n); rep(i,n){cin >> a[i];} return a;}
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}


//main関数
int main() {
    ll n = llin();
    vl a(n);
    rep(i,n){
        cin >> a[i];
    }

    vl sum(n,a[0]);
    rep(i,n - 1){
        sum[i + 1] = (sum[i] + a[i + 1]) % MOD;
    }
    ll ans = 0;
    rep(i,n - 1){
        ans += (sum[i] * (a[i + 1])) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}



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

using namespace std;
typedef long long ll;
int main() {
  ll N;
  cin >> N;
  ll ans = 0;
  vector<ll> x;
  for (ll i = 1; i <= sqrt(N); i++) {
    if (N % i == 0) {
      if (N / i == i) {
	x.push_back(i);
      }
      else {
	x.push_back(i);
	x.push_back(N / i);
      }
    }
  }

  for (int i = 0; i < (int)x.size(); ++i) {
    if (x[i] <= 2) continue;
    if (N % (x[i] - 1) == 0) continue;
    if (N / (x[i] - 1) == N % (x[i] - 1)) ans += x[i] - 1;
  }
  
  cout << ans << endl;
  return 0;
}



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

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

    int n,m,a,b,ans=0;

    cin >> n >> m;

    vector <int> h(n),freq(n);

    for (int i=0;i<n;i++){
        cin >> h[i];
        freq[i] = 1;
    }

    for (int i=0;i<m;i++){
        cin >> a >> b;
        if (h[a-1]<=h[b-1]){
                freq[a-1] = 0;
        }
        if(h[b-1]<=h[a-1]){
                freq[b-1] = 0;
        }
    }


    cout << count(freq.begin(),freq.end(),1) << endl;


    return 0;
}

Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
int n,l,a[3010];
double x,y;
int main(){
	scanf("%d %d",&n,&l);
	for(int i=1;i<=n;++i)scanf("%d",a+i);
	for(int i=1;i<=n;++i)for(int j=i+1;j<=n;++j){
		double arg=M_PI*(1.0*a[i]+a[j]+l)/l,p=1.0*(j-i-1)/(n-2);
		x+=p*cos(arg);y+=p*sin(arg);
		arg=M_PI*(a[i]+a[j])/l,p=1.0-p;
		x+=p*cos(arg);y+=p*sin(arg);
	}x/=n*(n-1);y/=n*(n-1);
	printf("%.15lf %.15lf",x*6,y*6);
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)

vector<int> sieve_of_eratosthenes() {
	int n = 1000000;
	vector<int> primes(n);
	for (int i = 2; i < n; i++)primes[i] = i;
	for (int i = 2; i*i < n; i++) {
		if (primes[i]) {
			for (int j = i * i; j < n; j += i) primes[j] = 0;
		}
	}
	return primes;
}

int main() {
	ll n, i = 0, mod = 1; cin >> n;
	auto p = sieve_of_eratosthenes();

	while (n) {
		if (p[i] && i % 10 == mod) {
			cout << i << endl;
			n--;
		}
		i++;
	}

	return 0;
}

Measured memory_bytes: 4096
#include<iostream>
using namespace std;
int main(){
  string s;cin>>s;int n=s.size();
  bool f1=false,f2=false;
  for(int i=0;i<n;i++){
    if(s[i]=='C')f1=true;
    if(f1&&s[i]=='F')f2=true;
  }
  if(f2)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h> 
#include <string> 
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;

int main() {

	int res ;
	int a, b, c; cin >> a >> b >> c;

	res = max(a, max(b, c)) - min(a, min(b, c));

	cout << res << endl;
}

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

#define     MX        200005
#define     mod       1000000007
#define     ll        long long
#define     ld        double
#define     mem(a,b)  memset(a,b,sizeof(a))
#define     fast()    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     F         first
#define     S         second
#define     mp        make_pair
#define     inf       1000000010
#define     PI        acos(-1.0)

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

int n;
ll a[MX],b[MX];
map<pair<ll,ll>,ll>same,dif;
ll zero=0;
ll two[MX];

int main(){
	fast();
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	two[0]=1;
	for(int i=1;i<MX;i++) two[i]=(2LL*two[i-1])%mod;

	cin>>n;
  	for(int i=1;i<=n;i++) {
      	cin>>a[i]>>b[i];
        if(a[i] && b[i]){
            ll gcd= __gcd(abs(a[i]),abs(b[i]));
            a[i]/=gcd,b[i]/=gcd;
        }
        if(a[i] && b[i]){
            if( (a[i]>0 && b[i]>0) || (a[i]<0 && b[i]<0) ) same[mp(abs(a[i]),abs(b[i]))]++;
            else dif[mp(abs(b[i]),abs(a[i]))]++;
        }
        else if(a[i] && b[i]==0) {
            a[i]=1;
            same[mp(a[i],b[i])]++;
        }
        else if(a[i]==0 && b[i]){
            b[i]=1;
            dif[mp(b[i],a[i])]++;
        }
        else zero++;
  	}
  	ll ans=1;
  	for(auto it=same.begin();it!=same.end();it++){
        //cout<<(it->F.F)<<" "<<(it->F.S)<<endl;

        ll val1= it->S,val2=0,res=0;
        pair<ll,ll> pr = it->F;
        if(dif.count(pr)) {
            val2= dif[pr];
            dif.erase(pr);
        }
        res=(two[val1]+two[val2]-1+mod)%mod;
        ans = (1LL*ans*res)%mod;
  	}
  	//cout<<ans<<endl;
  	for(auto it= dif.begin();it!=dif.end();it++){
        //cout<<(it->F.F)<<" "<<(it->F.S)<<endl;
        ll val1= it->S;
        ans= (1LL*ans*two[val1])%mod;
  	}
  	//cout<<ans<<endl;
  	ans=(ans+zero-1+mod)%mod;
  	cout<<ans<<endl;
}


Measured memory_bytes: 20644
#include<stdio.h>
int main(){
  char s[6];
  for(int i=0;i<6;i++){
  scanf("%s",&s[i]);
  }
  if(s[2]==s[3]&& s[4]==s[5]){
    printf("Yes");
  }
  else printf("No");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>

using namespace std;

void countingsort(vector<int> &A,int k){

	vector<int> C(k+1,0);

	for (int j = 0; j < A.size(); j++){
		C[A[j]]++;
	}

	for (int i = 0; i < C.size(); i++){
		for (int j = 0; j < C[i]; j++){
			if ( i == C.size()-1 and j == C[i]-1){
				cout << i ;
			}else{
				cout << i << " ";
			}
		}
	}
	cout << endl;
}

int main(){

	int n; cin >> n;
	vector<int> A(n,0);
	int max = 0;
	for (int i = 0; i < n; i++){
		cin >> A[i];
		if (max < A[i]){
			max = A[i];
		}
	}
	countingsort(A,max);

return 0;
}

Measured memory_bytes: 10696
'use strict'

const main = (input) => {
    const K = parseInt(input.split(' ')[0])
    const S = parseInt(input.split(' ')[1])

    let sum = 0
    for(let x = 0; x <= K; x++){
        for(let y = 0; y <= K; y++){
            let z = S - x - y
            if(z >= 0 && z <= K){
                sum++
            }
        }
    }
    console.log(sum)
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

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

int main(void){
	int X;
	cin >> X;
	if (X>=30) cout << "Yes" << endl;
	else cout << "No" << endl;	
return 0;
}


Measured memory_bytes: 3588
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int H, W, K, ans;
char C[7][7];
bool now[7][7];

int Solve(int h, int w){

  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      if (C[i][j] == '#') now[i][j] = true;
    }
  }

  for (int i = 0; i < H; i++){
    if (h % 2 != 0){
      for (int j = 0; j < W; j++){
        now[i][j] = false;
      }
    }
    h /= 2;
  }
  for (int j = 0; j < W; j++){
    if (w % 2 != 0){
      for (int i = 0; i < H; i++){
        now[i][j] = false;
      }
    }
    w /= 2;
  }


  int cnt = 0;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      if (now[i][j]) cnt++;
    }
  }
  if (cnt == K) ans++;

  return 0;
}

int main(){
  cin >> H >> W >> K;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cin >> C[i][j];
    }
  }
  for (int i = 0; i < pow(2, H); i++){
    for (int j = 0; j < pow(2, W); j++){
      Solve(i, j);
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4040
def divisors(n)
  r = []
  1.upto(n) do |i|
    break unless i <= n / i
    next unless (n % i).zero?
    r << i
    r << n / i if i != n / i
  end
  r
end

p 1.step(gets.to_i, 2).map.count{|i| divisors(i).size == 8}


Measured memory_bytes: 1788
/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 1e5+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

ll a[maxn], b[maxn], c[maxn];
ll dp[maxn][3];

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

    int n;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%lld%lld%lld", &a[i], &b[i], &c[i]);

    memset(dp, 0, sizeof(dp));

    for(int i = 1; i <= n; i++)
    {
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];
    }
    ll answer = max(dp[n][0], max(dp[n][1], dp[n][2]));
    printf("%lld\n", answer);

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}



Measured memory_bytes: 4992
#include<iostream>
#include<cmath>
using namespace std;
int num[105]={0};
int main()
{
    int a[3][3],n,t;
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
        cin>>a[i][j];
    cin>>n;
    int flag=0;
    for(int i=0;i<n;i++)
    {
        cin>>t;
        num[t]++;
    }
    for(int i=0;i<3;i++)
    {
        if(num[a[i][0]]&&num[a[i][1]]&&num[a[i][2]]){
            cout<<"Yes"<<endl;
            flag=1;
            break;
        }
        else if(num[a[0][i]]&&num[a[1][i]]&&num[a[2][i]]){
            cout<<"Yes"<<endl;
            flag=1;
            break;
        }
    }
    if(flag==0)
    {
        if(num[a[0][0]]&&num[a[1][1]]&&num[a[2][2]])
        cout<<"Yes"<<endl;
        else if(num[a[0][2]]&&num[a[1][1]]&&num[a[2][0]])
        cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}

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

int main() {
  int x;
  cin >> x;
  
  int a[x];
  for (int i = 0; i < x; i++) {
    cin >> a[i];
  }
  
  int b[x];
  for (int i = 0; i < x; i++) {
    cin >> b[i];
  }
  
  int c[x-1];
  for (int i = 0; i < x-1; i++) {
    cin >> c[i];
  }
  
  int manzoku = b[a[0]-1];
  for (int i = 1; i < x; i++) {
    manzoku += b[a[i]-1];
    if ((a[i] - 1) == a[i-1]) {
      manzoku += c[a[i-1]-1];
    }
  }
  cout << manzoku;
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n, = map(int,readline().split())
*x, = map(int,readline().split())
l,q,*ab = map(int,read().split())


from bisect import bisect_left, bisect_right

M = 19
"""
L = [[bisect_left(x,i-l) for i in x]]
for i in range(M):
    LL = [L[-1][L[-1][i]] for i in range(n)]
    L.append(LL)

"""
R = [[bisect_right(x,i+l)-1 for i in x]]
for i in range(M):
    RR = [R[-1][R[-1][i]] for i in range(n)]
    R.append(RR)

#for i in R: print(i)

mp = iter(ab)
for a,b in zip(mp,mp):
    a -= 1
    b -= 1
    if a > b: a,b = b,a
    
    ans = 0
    for i in range(M,-1,-1):
        if R[i][a] < b:
            ans += 1<<i
            a = R[i][a]
    print(ans+1)
    
    
    
    




Measured memory_bytes: 203820
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;

int main(){
    cin >> n;
    int ans = 0;
    for(int i = 1;i <= n;i++){
        if(d_cnt(i)%2)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define ll long long
#define debug(x) cout << "debug: " << x << endl
#define MOD 1e9 + 7
#define INF 1e9

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

int main(){
    int n; cin >> n;
    vector<vector<int>> v(n, vector<int>(3));
    rep(i, n) {rep(j, 3) cin >> v[i][j];}
    vector<vector<int>> dp(n, vector<int>(3, -INF));
    dp[0][0] = v[0][0], dp[0][1] = v[0][1], dp[0][2] = v[0][2];
    repk(i,1,n){
        chmax(dp[i][0], dp[i - 1][1] + v[i][0]);
        chmax(dp[i][0], dp[i - 1][2] + v[i][0]);
        chmax(dp[i][1], dp[i - 1][0] + v[i][1]);
        chmax(dp[i][1], dp[i - 1][2] + v[i][1]);
        chmax(dp[i][2], dp[i - 1][0] + v[i][2]);
        chmax(dp[i][2], dp[i - 1][1] + v[i][2]);
    }
    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;
}

Measured memory_bytes: 11136
package main

import "fmt"

func main() {
	var n, m, a, b, c int
	fmt.Scan(&n, &m, &c)
	sum, count := 0, 0
	gm := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&b)
		gm[i] = b
	}
	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			fmt.Scan(&a)
			sum = sum + a*gm[j]
		}
		if sum+c > 0 {
			count++
			sum = 0
		}
		sum = 0
	}
	fmt.Print(count)
}


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

int main() {
    int K, X;
    cin >> K >> X;
    if (K * 500 >= X) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3556
N = int(input())
s = [input() for _ in range(N)]

ans = 0
a = 0
for b in range(N):
    if all(s[(i - a) % N][(j - b) % N] == s[(j - a) % N][(i - b) % N] for i in range(N) for j in range(i + 1, N)):
        ans += N
print(ans)


Measured memory_bytes: 43100
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using static System.Console;

namespace Code_test
{
    class Program
    {
        static void Main(string[] args) {
            ReadLine();
            string ABC = "abcdefghijklmnopqrstuvwxyz";
            var list = new List<char>(ReadLine().ToCharArray()).ToList();
            Dictionary<char, int> Dict = new Dictionary<char, int>();
            foreach (char e in ABC) Dict.Add(e, 0);
            foreach (char e in list) Dict[e]++;
            Decimal Result = 1;
            foreach (var e in Dict) {
                Result *= e.Value + 1;
                Result %= (Decimal)Math.Pow(10, 9) + 7;
            }
            WriteLine((Result - 1));

            ReadLine();
        }
    }
}

Measured memory_bytes: 12640
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int H, W;
std::map<LL, bool>h, w;

int main()
{
	in >> H >> W;
	std::vector<std::vector<char>>a(H, std::vector<char>(W));
	rep(i, H) rep(j, W) in >> a[i][j];
	rep(i, H)
	{
		bool flag = false;
		rep(j, W)
		{
			if (a[i][j] == '#')
			{
				flag = true;
				break;
			}
		}
		h[i] = flag;
	}
	rep(j, W)
	{
		bool flag = false;
		rep(i, H)
		{
			if (a[i][j] == '#')
			{
				flag = true;
				break;
			}
		}
		w[j] = flag;
	}
	rep(i, H)
	{
		bool flag = false;
		rep(j, W)
		{
			if (h[i] && w[j])
			{
				flag = true;
				out << a[i][j];
			}
		}
		if (flag) out << std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL);

int main() {
  FAST;
  int N;
  string S;
  cin >> N >> S;
  int count = 0;
  for (int i = 0; i < N - 2; i++) {
    if (S.at(i) == 'A' && S.at(i + 1) == 'B' && S.at(i + 2) == 'C') {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define MAXN 101
#define endl "\n"
#define readln(x) getline(cin, x);
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
ll fpow(ll x, ll n, ll mod){if (n==0) return 1%mod; ll u = fpow(x, n/2, mod); u = (u*u)%mod; if (n%2==1)u = (u*x)%mod;return u;}
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll N, W, w[MAXN], v[MAXN], dp[MAXN][100005];
int main(){
    //freopen("data.txt","r",stdin);
    cin >> N >> W;
    for (int i = 1; i<= N; i++){
        cin >> w[i] >> v[i];
    }
    //memset(dp, 1000000007, sizeof dp);
    for (int i = 1; i<= N; i++){
        for (int j = 0; j<=100000; j++){
            dp[i][j] = 1000000007;
        }
    }
    for (int i = 1; i<=N; i++){
        dp[i][v[i]] = w[i];
    }
    for (int i = 2; i<=N; i++){
        for (int j = 0; j<=100000; j++){
            dp[i][j] = min(dp[i][j], dp[i-1][j]);
            if (j>=v[i]){
                dp[i][j] = min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
            }
        }
    }
    ll ans = -1;
    for (int j = 100000; j>=0; j--){
        if (dp[N][j]<=W){
            ans = j;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << "Line " << __LINE__ << ": " <<  #x << " = " << (x) << "\n";
#define spa << " " <<
#define fi first
#define se second
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()

using ld = long double;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;

template<typename T> using V = vector<T>;
template<typename T> using P = pair<T, T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){os << "(" << v.first << ", " << v.second << ")"; return os;}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<vector<T>> &v){ for(auto &e : v){os << e << "\n";} return os;}
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

template <class T> void UNIQUE(vector<T> &x) {sort(ALL(x));x.erase(unique(ALL(x)), x.end());}
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 (a>b) { a=b; return 1; } return 0; }
void fail() { cout << -1 << '\n'; exit(0); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<"\n";}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<"\n";};

const ll INF = (1ll<<62);
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
const ll mod = (int)1e9 + 7;
//const ll mod = 998244353;

int main(){

    ll N, Q;
    cin >> N >> Q;
    ll res = (N-2)*(N-2);

    V<ll> t(Q), X(Q);
    REP(q, Q) cin >> t[q] >> X[q];

    set<ll> R, C;
    REP(q, Q){
        if(t[q] == 1){
            R.insert(X[q]);
        }else{
            C.insert(X[q]);
        }
    }
    
    ll rmin = N, cmin = N;
    REP(q, Q){
        //dump(q)
        if(t[q]==1){
            if(X[q]<=rmin){
                auto itr = R.lower_bound(X[q]);
                while(itr != R.end()){
                    res -= (cmin - 2);
                    itr = R.erase(itr);
                }
                rmin = X[q];
            }
        }else{
            if(X[q]<=cmin){
                auto itr = C.lower_bound(X[q]);
                while(itr != C.end()){
                    res -= (rmin - 2);
                    itr = C.erase(itr);
                }
                cmin = X[q];
            }
        }
    }


    cout << res << endl;

    return 0;
}

Measured memory_bytes: 15532
n, m, q = gets.split.map(&:to_i)
abcds = q.times.map { gets.split.map(&:to_i) }

ans = 0
[*1..m].repeated_combination(n).each do |arr|
  sum = abcds.inject(0) do |r, (a, b, c, d)|
    r + (arr[b - 1] - arr[a - 1] == c ? d : 0)
  end

  ans = sum if sum >= ans
end

puts ans


Measured memory_bytes: 14260
K, N = map(int, input().split())
num_list = list(map(int, input().split()))
num_list.sort()

dis_list = [num_list[i+1] - num_list[i] for i in range(N-1)]


last_dis = (K-num_list[-1])+num_list[0] if num_list[-1] > (K//2) else num_list[-1] - num_list[0]
dis_list.append(last_dis)

max_dis = max(dis_list)

ans = K-max_dis
print(ans)


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

int N,A,B,C;
int l[10];
int INF =1234567890;
int dfs(int i,int a,int b,int c){
  if(i==N){
    // 竹をそれぞれ一本も使用していない場合
    if(a==0||b==0||c==0) return INF;
    // 合体してできたabcをそろえる分だけMP消費
    return abs(a-A)+abs(b-B)+abs(c-C);
  }
  // 今ある竹を採用しない場合
  int res = dfs(i+1,a,b,c);

  if(a==0) res=min(res,dfs(i+1,a+l[i],b,c));
  else  res=min(res,dfs(i+1,a+l[i],b,c)+10);
  if(b==0) res=min(res,dfs(i+1,a,b+l[i],c));
  else  res=min(res,dfs(i+1,a,b+l[i],c)+10);
  if(c==0) res=min(res,dfs(i+1,a,b,c+l[i]));
  else  res=min(res,dfs(i+1,a,b,c+l[i])+10);

  return res;
}

int main() {
  cin>>N>>A>>B>>C;
  for(int i=0;i<N;i++) cin>>l[i];

  int ans =dfs(0,0,0,0);
  cout<<ans<<endl;
}


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

using ll = long long;

int main() {
    vector<bool> is_prime(100000, true);
    map<int, vector<int>> m;
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i < 100000; ++i) {
        if(is_prime[i]) {
            m[i % 5].push_back(i);
            for(int j = i + i; j < 100000; j += i) {
                is_prime[j] = false;
            }
        }
    }

    int n; cin >> n;
    for(int i = 1; i <= n; ++i) {
        cout << m[1][i] << " \n"[i == n];
    }
}


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

int main() {
    int N, L;
    cin >> N >> L;
    vector<string> Ss(N);
    for (auto & S: Ss) cin >> S;
    sort(Ss.begin(), Ss.end());
    for (auto & S: Ss) cout << S;
    cout << endl;
    return 0;
}

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

int main(){

int H,W;
while(1){
    cin>>H>>W;
    if(H==0 && W==0){
        break;
    }

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(i==0 || j==0 || i==H-1 || j==W-1){
                cout<<"#";
            }else{
                cout<<".";
            }
        }
        cout<<endl;
    }
    cout<<endl;
}

    return 0;
}


Measured memory_bytes: 3080
import java.util.Scanner;

class Main{
  static class Card{
    char ch;
    int num;
  }

  static void trace(Card[] cards){
    int i;
    for(i = 0; i < cards.length - 1; i++){
      System.out.print(cards[i].ch);
      System.out.print(cards[i].num + " ");
    }
    System.out.print(cards[i].ch);
    System.out.println(cards[i].num);
  }

  static void bubbleSort(Card[] c){
    for(int i = 0; i < c.length; i++){
      for(int j = c.length - 1; j > i; j--){
        if(c[j].num < c[j-1].num){
          Card tmp = c[j];
          c[j] = c[j-1];
          c[j-1] = tmp;
        }
      }
    }
  }

  static void selectionSort(Card[] c){
    for(int i = 0; i < c.length; i++){
      int m = i;
      for(int j = i + 1; j < c.length; j++){
        if(c[m].num > c[j].num)
          m = j;
      }
      Card tmp = c[i];
      c[i] = c[m];
      c[m] = tmp;
    }
  }

  static boolean isEqual(Card[] c1, Card[] c2){
    if(c1.length != c2.length)return false;
    for(int i = 0; i < c1.length; i++)
      if(!(c1[i].num == c2[i].num && c1[i].ch == c2[i].ch))
        return false;
    return true;
  }

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

    int n = stdIn.nextInt();
    Card[] cards1 = new Card[n];
    Card[] cards2 = new Card[n];
    for(int i = 0; i < n; i++){
      String input = stdIn.next();
      char ch = input.charAt(0);
      int num = Integer.parseInt(input.substring(1));
      cards1[i] = new Card();
      cards1[i].ch = ch;
      cards1[i].num = num;

      cards2[i] = new Card();
      cards2[i].ch = ch;
      cards2[i].num = num;
    }

    bubbleSort(cards1);
    trace(cards1);
    if(isEqual(cards1, cards1))
      System.out.println("Stable");
    else
      System.out.println("Not stable");
    selectionSort(cards2);
    trace(cards2);
    if(isEqual(cards1, cards2))
      System.out.println("Stable");
    else
      System.out.println("Not stable");

  }
}

Measured memory_bytes: 26224
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main{

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		while(true){

			String input = br.readLine();
			int sum = 0;

			if(input.equals("0")){
				break;
			}

			for(int i = 0; i < input.length(); i++){
				sum += Character.digit(input.charAt(i), 10);
			}

			sb.append(sum + "\n");

		}

		System.out.print(sb);

	}
}

Measured memory_bytes: 24104
/*
Look at the star
Look at the shine for U
*/ 

#include<bits/stdc++.h>
#define sl(x) scanf("%d",&x)
using namespace std;
const int INF = 0x3f3f3f;
const int N = 1e6+5;
const int mod = 1e9+7;

int main()
{
	int n,m,i,j,flag = 0;
	sl(n);
	for(i = 0;i*4 <= n;i++)
	{
		for(j = 0;j*7 <= n;j++)
		{
			if(i*4+j*7 > n) continue;
			if(i*4+j*7 == n){
				flag = 1;
				break;
			}
		}
	}
	if(flag) puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
struct fast_ios {
    fast_ios() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    };
} fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define POW2(n) (1LL << (n))
#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)
template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &v : vec)
        is >> v;
    return is;
}

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    cin >> P;
    vector<int> Pinv(N + 1);

    REP(i, N) Pinv[P[i]] = i;
    multiset<int> shown;
    shown.insert(-1);
    shown.insert(-1);
    shown.insert(N);
    shown.insert(N);
    ll ret = 0;
    IFOR(i, 1, N + 1) {
        ll now = Pinv[i];
        auto pos = shown.lower_bound(now);
        ll r = *pos;
        ll rr = *next(pos);
        ll l = *prev(pos);
        ll ll = *prev(pos, 2);
        ret += ((rr - r) * (now - l) + (l - ll) * (r - now)) * i;
        // dbg((vector<ll>{ll, l, r, rr}));
        shown.insert(now);
    }
    cout << ret << endl;
}


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

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

  if(A >= 13)
    cout << B << endl;
  else if(A >= 6)
    cout << B / 2 << endl;
  else
  {
    cout << 0 << endl;
  }
}


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

int main(){
  string ans="";
  rep(i,0,3) {
    string s; cin >>s;
    ans.push_back(s[0]);
  }
  transform(ans.begin(),ans.end(),ans.begin(),::toupper);
  cout <<ans <<endl;
  return 0;
}


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

void print(ll x[], ll n)
{
	for(int i = 0; i < n; i++)
		cout << x[i] << " ";
	cout << endl;
}
int x[100009], n;
int dp[100009];
ll cost(int i)
{
	if(i==n-1)
		return 0;
	if(i >= n)
		return 100000000000;
	if(dp[i] != -1)
		return dp[i];
	dp[i] = min(abs(x[i+1]-x[i]) + cost(i+1), abs(x[i+2]-x[i])+cost(i+2)); 
	return dp[i];
}

int main()
{
	ios::sync_with_stdio(false);

	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> x[i];
	memset(dp, -1, sizeof dp);
	cout << cost(0) << endl;

	return 0;
}

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	vector<int> ans(4, 0);

	rep(i, n){
		string s;
		cin >> s;

		if(s == "AC") ans[0]++;
		else if(s == "WA") ans[1]++;
		else if(s == "TLE") ans[2]++;
		else ans[3]++;
	}

	cout << "AC x " << ans[0] << endl;
	cout << "WA x " << ans[1] << endl;
	cout << "TLE x " << ans[2] << endl;
	cout << "RE x " << ans[3] << endl;

	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define ll long long
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
int n,h,w;
signed main(){
	cin>>n>>h>>w;
	cout<<(n-h+1)*(n-w+1)<<endl;
    return 0;
}

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

int main() {
 int A,B,C,D,X,Y;
 cin >> A >> B >> C >> D;
 X=(A+D-1)/D;
 Y=(C+B-1)/B;
 if (X>=Y)
 cout << "Yes" << endl;
 else 
 cout << "No" << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(void){
   int a,b;
   cin >> a >> b;
   vector<int> v(a);
   for(int i=0;i<a;i++){
       cin >> v[i];
   }
   sort(v.begin(),v.end());
    long sum = 0;
    for(int i=0;i<b;i++)sum+=v[i];
    cout << sum << endl;
}


Measured memory_bytes: 3600
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static long mod = 998244353;
	static int[] ans;
	static void Main(string[] args) {

		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);
		
		string str = Console.ReadLine();
		string res = "Good";
		if ( str[0] == str[1] ) { res = "Bad"; }
		if ( str[1] == str[2] ) { res = "Bad"; }
		if ( str[2] == str[3] ) { res = "Bad"; }


		Console.WriteLine(res);
				return;

	}




	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}


}

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#define rep(i, a, n) for(int i = int(a);i < int(n);++i)
#define repe(i, a, n) for(int i = int(a);i <= int(n);++i)
#define repr(i, a, n) for(int i = int(a);i > int(n);--i)
#define reper(i, a, n) for(int i = int(a);i >= int(n);--i)
#define size(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define pb push_back
#define EPS (1e-20)
#define INF 2147483647
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using namespace std;


int A, B, C, X, Y;


int solve(){
	int ans = 0;
	C *= 2;
	if(A+B < C){
		if(X < Y){
			ans = A*X+B*X;
			if(B < C) ans += B*(Y-X);
			else ans += C*(Y-X);
		}
		else {
			ans = A*Y+B*Y;
			if (A < C) ans += A*(X-Y);
			else ans += C*(X-Y);
		}
	}
	else {
		if (X < Y){
			ans = C*X;
			if (B < C) ans += B*(Y-X);
			else ans += C*(Y-X);
		}
		else{
			ans = C*Y;
			if (A < C) ans += A*(X-Y);
			else ans += C*(X-Y);
		}
	}
	return ans;
}


int main(){
	cin >> A >> B >> C >> X >> Y;

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 256
from functools import reduce

# 入力
N = int(input())
A = [int(input()) for _ in range(N)]

# 貪欲法に基づき、小さい整数から順にペアを作成
ans = reduce(
    lambda acc, a: (acc[0] + (a + acc[1]) // 2, max(0, a - acc[1]) % 2),
    A,
    (0, 0)
)[0]

# 出力
print(ans)


Measured memory_bytes: 7564
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner();
			int n = cin.Int();
			long k = cin.Long();
			long[] a = cin.ArrayLong(n);
			long[] f = cin.ArrayLong(n);

			Array.Sort(a);
			Array.Sort(f);
			Array.Reverse(f);

			long max = 0;
			for (int i = 0; i < n; i++) {
				max = Math.Max(max, a[i] * f[i]);
			}

			long left = -1;
			long right = max;

			Func<long, bool> check = mid => {
				long kk = k;
				for (int i = 0; i < n; i++) {
					long diff = a[i] * f[i] - mid;
					if (diff <= 0) {
						continue;
					}

					long num = diff / f[i];
					if (diff % f[i] != 0) {
						num++;
					}

					kk -= num;
					if (kk < 0) {
						return false;
					}
				}

				return true;
			};

			while (right - left > 1) {
				long mid = (right + left) / 2;
				if (check(mid)) {
					right = mid;
				} else {
					left = mid;
				}
			}

			long ans = right;

			Console.WriteLine(ans);
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 45788
N = int(input())
dp = [[0]*3 for _ in range(N+1)]
for i in range(N):
    a, b, c = list(map(int, input().split()))
    dp[i+1][0] = max(dp[i][1], dp[i][2]) + a
    dp[i+1][1] = max(dp[i][2], dp[i][0]) + b
    dp[i+1][2] = max(dp[i][0], dp[i][1]) + c
print(max(dp[N]))

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

int main(void){
  int arr[3];
  int i;
  for (i = 0; i < 3; i++){
    cin >> arr[i];
  }
  
  sort(arr, arr+3);
  
  cout<<arr[0] + arr[1] <<endl;
  
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;

int main(){
    vll a(7);
    rep(i, 0, 7){
        cin >> a[i];
    }
    ll ans = 0;
    ll r = 0;
    bool t = true;
    if(a[0]%2 == 0){r++;}
    if(a[3]%2 == 0){r++;}
    if(a[4]%2 == 0){r++;}
    if(a[0] == 0){t = false;}
    if(a[3] == 0){t = false;}
    if(a[4] == 0){t = false;}
    if(r>1||!t){
        ans += (a[0] - a[0]%2);
        ans += (a[3] - a[3]%2);
        ans += (a[4] - a[4]%2);
    }else{
        if(a[0]%2 != 0){
            ans += (a[0] - 1);
        }else{
            ans += (a[0] - 2);
        }
        if(a[3]%2 != 0){
            ans += (a[3] - 1);
        }else{
            ans += (a[3] - 2);
        }
        if(a[4]%2 != 0){
            ans += (a[4] - 1);
        }else{
            ans += (a[4] - 2);
        }
        ans += 3;
    }
    ans += a[1];
    prtl(ans);
}

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

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define For(i, a) for (int i=0; i<a; i++)
#define FORR(i,a,b) for (int i = a; i >= b; i--)
#define Forr(i,a) for (int i = a; i >= 0; i--)

#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__)
void DBG() { cerr << "]\n";}
template<typename T, typename ...Args> void DBG(T first, Args... args)
{cerr << first; if(sizeof...(args))cerr<<", "; DBG(args...); }

const int N = 1e6;
int prime[N], square_of_a_prime[N], spf[N];

void seive(){
  FOR(i,2,N)prime[i]=1;
  FOR(i,2,N){
    if(prime[i]){
      if(i*i<N)square_of_a_prime[i*i]=1;
      FOR(j,2,N){
        if(i*j<N) prime[i*j]=0;
        else break;
      }
    }
  }
}
void smallest_prime_factor(){
  memset(spf,-1,sizeof(spf));
  spf[1]=1;
  for(int i=2; i<N; i++){
    if(spf[i]==-1){
      spf[i] = i;
      for(int j = 2; j*i<N; j++){
        if(spf[i*j]==-1){
          spf[i*j] = i;
        }
      }
    }
  }
}

int count_no_of_factors(int x){
  // complexity is O(n^1/3)...
  int ans = 1;
  For(i,N){
    if(prime[i]){
      if(i*i*i > x)break;
      int count = 1;
      while(x%i==0){
        count++;
        x/=i;
      }
      ans *= count;
    }
  }
  if(prime[x])ans*=2;
  else if(square_of_a_prime[x])ans*=3;
  else if(x!=1)ans*=4;
  return ans;
}

void prime_factorize(int x){
  // complexity is O(n^1/2)
  vector<int> ff(N,0);
  while(x%2==0){
    ff[2]++;
    x/=2;
  }
  for(int i=3;i*i<=x;i+=2){
    while(x%i==0){
      ff[i]++;
      x/=i;
    }
  }
  if(x>2)ff[x]++;
}

void prime_factorize_using_seive(int x){
  vector<int> ff(N,0);
  while(x!=1){
    ff[spf[x]]++;
    x/=spf[x];
  }
}

void solve(){
  seive();
  int n; cin >> n;
  int cnt=0;
  for(int i=1;i<=n-1;i++){
    int num=n-i;
    cnt += count_no_of_factors(num);
  }
  cout << cnt << "\n";
}


int32_t main(){
  ios_base:: sync_with_stdio(false);
  cin.tie(0);
  int t=1;
  for(int tt=1;tt<=t;tt++){
    solve();
  }
}

Measured memory_bytes: 12088