akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define all(x) (x).begin() , (x).end()
#define f first
#define s second
#define pr(x) cout<<x<<endl;
#define pr2(x,y) cout<<x<<" "<<y<<endl;
#define pr3(x,y,z) cout<<x<<" "<<y<<endl;
#define prv(v) for(auto x:v) cout<<x<<" ";
using namespace std;
 
const ll N =(2e5+5);
const ll MOD = 1e9+7;
const ll INF = 1e16;
const ll LOG = 29;

long long binpow(long long a, long long b) {
    a%=MOD;    
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%MOD;
        a = (a * a) %MOD;

        
        b >>= 1;
    }
    res%=MOD;
    return res;
}
void solve(){
    ll n,l;
    cin>>n>>l;
    ll idx = -1;
    ll a[n+1];
    for(int i= 1;i<=n;i++){
        cin>>a[i];
    }
    for(int i =1;i<n;i++){
        if(a[i+1]+a[i]>=l){
            idx =i;
            break;
        }

    }
    if(idx == -1){
        cout<<"Impossible\n";
        return;
    }
    cout<<"Possible\n";
    for(int i =1;i<idx;i++)cout<<i<<"\n";
    for(int i = n-1;i>idx;i--)cout<<i<<"\n";
    cout<<idx<<endl;
}

/*
1 5
2 4
2 5
2 6
3 3
3 4
3 5
3 6
3 7
4 4
4 5
4 6
5 5
*/




int main()
{
    ios_base::sync_with_stdio(0);
     cin.tie(NULL);
     
    ll t=1;
    while(t--){
        solve();
    }
     
 
 
    return 0;     
    
        
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
char S[101010];
vector<char> ps[10];
ll Q,Sn;
ll i, j, k;
int main(){
    scanf("%s", S);
    Sn = strlen(S);
    j = 0;
    scanf("%lld", &Q);
    while(Q--){
        ll T;
        scanf("%lld", &T);
        if(T==1){
            j = !j;
        }else{
            ll F;
            char C[3];
            scanf("%lld%s", &F, C);
            F = (F-1) ^ j;
            ps[F].push_back(C[0]);
        }
    }
    
    for (i = 0; i < ps[j].size();++i){
        printf("%c", ps[j][ps[j].size()-1-i]);
    }
    fornum (i,0,Sn){
        if(j==0){
            printf("%c", S[i]);
        }else{
            printf("%c", S[Sn - i - 1]);
        }
    }
    fornum(i, 0, ps[!j].size()){
        printf("%c", ps[!j][i]);
    } 
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	float t;
	float t2;
	
	
	while (scanf("%f %f", &t, &t2) != EOF){
		
		if ((t < 35.50) && (t2 < 71.00)){
			printf("AAA\n");
		}
		else if ((t < 37.50) && (t2 < 77.00)){
			printf("AA\n");
		}
		else if ((t < 40.00) && (t2 < 83.00)){
			printf("A\n");
		}
		else if ((t < 43.00) && (t2 < 89.00)){
			printf("B\n");
		}
		else if ((t < 50.00) && (t2 < 105.00)){
			printf("C\n");
		}
		else if ((t < 55.00) && (t2 < 116.00)){
			printf("D\n");
		}
		else if ((t < 70.00) && (t2 < 148.00)){
			printf("E\n");
		}
		else{
			printf("NA\n");
		}
	}
	return (0);
}

Measured memory_bytes: 604
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int[][] dp=new int[m+1][1<<n];
		Arrays.fill(dp[0],100000001);
		dp[0][0]=0;
		for(int i=1; i<=m; i++){
			int a=sc.nextInt();
			int b=sc.nextInt();
			int state=0;
			for(int j=0; j<b; j++){
				state+=1<<(sc.nextInt()-1);
			}
			for(int k=1; k<1<<n; k++){
				dp[i][k]=dp[i-1][k];
			}
			for(int t=0; t<1<<n; t++){
				dp[i][t|state]=Math.min(dp[i][t|state],dp[i-1][t]+a);
			}
		}
		if(dp[m][(1<<n)-1]==100000001){
			dp[m][(1<<n)-1]=-1;
		}
		System.out.println(dp[m][(1<<n)-1]);
	}
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int resC = 0, resP = 0;
    int n, m;
    cin >> n >> m;
    vector<bool> prob(n, false);
    vector<int> cnt(n, 0);
    rep (i, m) {
        int p;
        string s;
        cin >> p >> s;
        p--;
        if (prob[p]) continue;
        if (s == "AC") {
            prob[p] = true;
            resC++;
            resP += cnt[p];
        } else {
            cnt[p]++;
        }
    }
    cout << resC << " " << resP << endl;
    
    return 0;
}



Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '1') {
            cout << '9';
        } else {
            cout << '1';
        }
    }
    cout << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#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 SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main()
{
    int n, k;
    cin >> n >> k;
    long long h[n], sum=0;
    REP(i, n) cin >> h[i];
    SORT(h, n);
    if(n < k){
        cout << 0 << endl;
        return 0;
    }else{
        REP(i, n-k) sum += h[i];
        cout << sum << endl;
    }
}


Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;
class card{
	char ch;
	int num;
public:
	card(){ this->ch = ' '; this->num = 0; }
	card(char a, int m){ this->ch = a, this->num = m; }
	void set(int m){ this->num = m; }
	void set(char a, int m){ this->ch = a, this->num = m; }
	void pirnt(){ cout << this->ch << ' ' << this->num << '\n'; }
	friend bool operator<=(card a, card b){
		return a.num <= b.num;
	}
	friend bool operator!=(card a, card b){
		return a.ch != b.ch || a.num != b.num;
	}
};
card A[100001];
card B[100001];
long n;
// MergeSort
void merge(long left, long mid, long right){
	long n1 = mid - left;
	long n2 = right - mid;
	card* L = new card[n1 + 1];
	card* R = new card[n2 + 1];
	for (long i = 0; i < n1; ++i) L[i] = B[left + i];
	for (long i = 0; i < n2; ++i) R[i] = B[mid + i];
	L[n1].set(20);
	R[n2].set(20);
	long i = 0, j = 0;
	for (long k = left; k < right; ++k){
		if (L[i] <= R[j]){
			B[k] = L[i]; ++i;
		}
		else{
			B[k] = R[j]; ++j;
		}
	}
	delete[] L;
	delete[] R;
}
void mergeSort(long left, long right){
	if (left + 1 < right){
		long mid = (left + right) / 2;
		mergeSort(left, mid);
		mergeSort(mid, right);
		merge(left, mid, right);
	}
}
// quickSort
long partition(long p, long r){
	long i = p - 1;
	for (long j = p; j < r; ++j) if (A[j] <= A[r]) swap(A[++i], A[j]);
	swap(A[i + 1], A[r]);
	return i + 1;
}
void quickSort(long p, long r){
	if (p < r){
		long q = partition(p, r);
		quickSort(p, q - 1);
		quickSort(q + 1, r);
	}
}
int main(){
	scanf("%ld",&n);
	for (long i = 0; i < n; ++i){
		char ch[2]; int tmp;
		scanf("%s %d",&ch,&tmp);
		A[i].set(ch[0], tmp);
		B[i].set(ch[0], tmp);
	}
	quickSort(0, n - 1);
	mergeSort(0, n);
	bool isStable = true;
	for (long i = 0; i < n; ++i){
		if (A[i] != B[i]){ isStable = false; break; }
	}
	if (isStable) cout << "Stable\n"; else cout << "Not stable\n";
	for (long i = 0; i < n; ++i) A[i].pirnt();
}

Measured memory_bytes: 3344
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    vl p(n);
    rep(i, n) {
        cin >> p[i];
    }

    ll ans = 0;
    ll u = p[0];
    rep(i, n) {
        if(p[i] <= u) {
            ans++;
            u = p[i];
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 1792
void main() {
	auto ip = readAs!(long[]), N = ip[0], X = ip[1], Y = ip[2];
	X--; Y--;
	auto darr = new long[][](N, N);
	foreach(ref v; darr) v[] = -1;
	foreach(i; 0..N) {
		foreach(j; i+1..N) {
			auto tmp = j - i;
			tmp = min(tmp, abs(i - X) + 1 + abs(j - Y));
			darr[i][j] = tmp;
		}
	}
	auto res = new int[](N);
	foreach(i; 0..N) foreach(j; i+1..N) {
		res[darr[i][j]]++;
	}
	res[1..$].each!writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 34300
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define pii 3.14
#define mod (ll)(1e9+7)
#define inf (ll)(1e18)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define pi pair<int,int>
#define N (ll)(2e5 + 5)

void solve()
{
    ll a;
    cin>>a;

    a = a + a*a + a*a*a;
    cout<<a<<"\n";
}

int main()
{
    fio;
    ll tc = 1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll t;
ll ret = LINF;

void input() {
  IN(N);
}

void solve() {
  for (ll i = 1; i * i <= N; i++) {
    ll r = N%i;
    ll p = N/i;
    if (r == 0) {
      ll mv = (i-1) + (p-1);
      CHMIN(ret, mv);
    }
  }
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
#include <stdio.h>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    scanf ("%d %d %d",&a,&b,&c);
    if((a<b) && (b<c)){
        printf("Yes\n");
        }else{
            printf("No\n");
    }
    
}



Measured memory_bytes: 2620
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define INF 1e9+7
#define roop(i,m,n) for(int i=m;i<n;i++)
#define mroop(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;

//おまじない



int main() {

	int a, c;
	char b;

	cin >> a >> b >> c;

	if (b == '+') {
		cout << a + c << endl;
	}
	else {
		cout << a - c << endl;
	}

	return 0;
}


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

#define rep(i, n) for(int i=0; i < (n); ++i)
#define ll long long

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; }}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; }}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

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

    int n; cin >> n;
    string s; cin >> s;
    char prev = ' ';
    int ans = 0;
    rep(i, n) {
        if (s[i] == prev) continue;
        ans++;
        prev = s[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    N,K=pin()
    t=K//N
    for i in range(t,0,-1):
        if K%i==0:
            print(i)
            return
        
#%%submit!
resolve()

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

int h, w;

bool is_paint(int h, int w, vector<vector<char>> grid){
  if (grid[h - 1][w] == '#' ||
      grid[h + 1][w] == '#' ||
      grid[h][w - 1] == '#' ||
      grid[h][w + 1] == '#')
        return true;
  else
    return false;
}

int main() {
  cin >> h >> w;
  vector<vector<char>> grid(h + 2, vector<char>(w + 2));

  for(int i = 1; i <= h; i++){
    for(int j = 1; j <= w; j++){
      cin >> grid[i][j];
    }
  }

  bool flag = true;
  for(int i = 1; i <= h; i++){
    for(int j = 1; j <= w; j++){
      if (grid[i][j] == '#'){
        if(!is_paint(i, j,grid)){
          flag = false;
          break;
        }
      }
    }
    if(!flag)
      break;
  }

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-8;

long long int N, M, K, L, R, H, W;
//int N, M, K, L, R, H, W;


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

	cin >> N;
	string s;
	cin >> s;
	long long int ans = 0;
	for (int i = 1; i < N - 1; i++) {
		map<char, int>mpa;
		map<char, int>mpb;
		for (int j = 0; j < i; j++) {
			if (s[i] != s[j]) {
				mpa[s[j]]++;
			}
		}
		for (int j = i + 1; j < N; j++) {
			if (s[i] != s[j]) {
				mpb[s[j]]++;
			}
		}
		for (auto j : mpa) {
			for (auto k : mpb) {
				if (j.first != k.first)ans += j.second*k.second;
			}
		}
		for (int j = 1; j < N; j++) {
			int l = i - j, r = i + j;
			if (l < 0 || r >= N)continue;
			if (s[l] != s[i] && s[i] != s[r] && s[l] != s[r])ans--;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ff first
#define ss second
#define N 100005
#define mod 1000000007
#define fo(n) for(int i=1;i<=n;i++)
typedef long long int ll;
typedef long int li;

string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    char a[27]; int n; string t;
    for(int i=0;i<26;i++) a[i] = s[i];
    cin>>n>>t;
    for(int i=0;i<t.size();i++) {
        t[i] = a[(t[i]-'A' + n)%26];
    }
    cout<<t;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdio.h>
using namespace std;
int main()
{
    char s[100], p[100], ss[200];
    scanf("%s %s", s, p);
    strcpy(ss, s);
    strcat(ss, s);
    if (strstr(ss, p) == NULL)
        printf("No\n");
    else
        printf("Yes\n");
}


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

void solve(std::istream &ist, std::ostream &ost)
{
    /* ------- 宣言と入力 ------- */

    int N, W;
    ist >> N >> W;

    vector<int> w;
    vector<int> v;

    for (int i = 0; i < N; i++)
    {
        int input_w, input_v;
        ist >> input_w >> input_v;
        w.emplace_back(input_w);
        v.emplace_back(input_v);
    }

    /* ------- 計算 ------- */

    int max_V = 110110;
    int max_N = 110;

    vector<vector<long long>> dp_table;

    for (int i = 0; i < max_N; ++i)
    {
        dp_table.emplace_back(0);
        for (int j = 0; j <= max_V; ++j)
        {
            dp_table.at(i).emplace_back(INT_MAX);
        }
    }

    dp_table.at(0).at(0) = 0;

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j <= max_V; j++)
        {
            // i番目の品物を追加できない場合の価値
            long long insert_value = dp_table.at(i).at(j);

            // i番目の品物を追加できる（する）場合の価値
            if (v.at(i) <= j)
            {
                insert_value = min(dp_table.at(i).at(j - v.at(i)) + w.at(i), insert_value);
            }

            dp_table.at(i + 1).at(j) = insert_value;
        }
    }

    // for (int i = 0; i < N; i++)
    // {
    //     for (int j = 0; j < max_V; j++)
    //     {
    //         cout << dp_table.at(i).at(j) << " " ;
    //     }
    //     cout << endl;
    // }

    // 最適値の出力
    long long res = 0;
    for (int j = 0; j < max_V; j++)
    {
        if (dp_table[N][j] <= W)
        {
            res = j;
        }
    }
    ost << res << endl;
}

#ifndef WOMAIN
int main()
{
    solve(std::cin, std::cout);
    return 0;
}
#endif


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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long



int32_t main() {

    int n; cin >> n;
    string a, b, c;
    cin >> a >> b >> c;

    int ret = 0;
    for(int i = 0; i < n; ++i) {
        if(a[i] == b[i] && a[i] == c[i]) ret += 0;
        else if(a[i] == b[i] || a[i] == c[i] || b[i] == c[i]) ret += 1;
        else ret += 2;
    }

    cout << ret << endl;;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;

signed main(){
	cin>>N;
	int ans=0;
	for(int i=1;i<=N;i++){
		int r=N/i;
		ans+=((2*i+(r-1)*i)*r)/2;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3592
#!/usr/bin/env python3
import sys

class UnionFind:
    def __init__(self, n):
        # par = Parent Number or NoV
        self.par = [-1] * (n+1)
        # rank = Tree Height
        self.rank = [0] * (n+1)
    
    # 自分が所属する集合の数を返す
    def size(self, x):
        return -1*self.par[self.find(x)]

    # 根なら番号を返す
    def find(self, x):
        
        if(self.par[x] < 1):
            return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    # 親が同じか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        # 根を探す
        x = self.find(x)
        y = self.find(y)

        # もう繋がれている
        if(x == y):
            return False

        # つなぎ替える
        if(self.size(x) < self.size(y)):
            x,y = y,x
        
        # xのサイズを更新
        self.par[x] += self.par[y]
        # yのサイズ(おやばんごう)をxに
        self.par[y] = x

        return True 

def solve(N: int, M: int, p: "List[int]", x: "List[int]", y: "List[int]"):
    uf = UnionFind(N)
    for i in range(M):
        uf.union(x[i], y[i])
    
    ans = 0
    for i in range(N):
        if(uf.same_check(p[i], i+1)):
            ans += 1

    # rootl = [i for i in range(1,N+1) if uf.par[i] < 0]

    # ans = 0
    # for i in rootl:
    #     # そえじちゅーしゅつ
    #     tl = {j for j in range(1,N+1) if uf.same_check(i,j)} 
    #     # なかみちぇっく
    #     il = {p[j-1] for j in tl}
    #     # たしあわせ
    #     ans += len(tl & il)

    print(ans)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    x = [int()] * (M)  # type: "List[int]" 
    y = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, M, p, x, y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 17052
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    S=input()
    T=input()
    cnt=0
    for i in range(len(S)):
        if S[i]!=T[i]:
            cnt+=1
            
    print(cnt)

main()


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

template<class t> void vin(vector<t>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int n;
    cin >> n;
    map<string, int> cnt;
    char ch = 'X';
    bool ok = true;
    rep(i, n) {
        string w;
        cin >> w;
        if (cnt[w] > 0) {
            ok = false;
        }
        else {
            cnt[w]++;
        }
        if (ch == 'X') {
            ch = w[w.size()-1];
        }
        else {
            if (ch != w[0]) {
                ok = false;
            }
            ch = w[w.size()-1];
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

#define N_MAX (1<<18)
#define INF 1000000000000LL

int nn_mn1;
int nn_mn2;
long long dat_mn1[(2 * N_MAX) - 1];
long long dat_mn2[(2 * N_MAX) - 1];

void init_mn1(int n1){
  nn_mn1 = 1;

  while(nn_mn1 < n1)nn_mn1 *= 2;

  for(int i = 0; i < 2 * nn_mn1 - 1; i++){
    dat_mn1[i] = INF;
  }
}

void init_mn2(int n1){
  nn_mn2 = 1;

  while(nn_mn2 < n1)nn_mn2 *= 2;

  for(int i = 0; i < 2 * nn_mn2 - 1; i++){
    dat_mn2[i] = INF;
  }
}

void update_mn1(int k, long long a){
  k += nn_mn1 - 1;
  dat_mn1[k] = a;
  while(k > 0){
    k = (k - 1) / 2;
    dat_mn1[k] = min(dat_mn1[k * 2 + 1], dat_mn1[k * 2 + 2]);
  }
}

void update_mn2(int k, long long a){
  k += nn_mn2 - 1;
  dat_mn2[k] = a;
  while(k > 0){
    k = (k - 1) / 2;
    dat_mn2[k] = min(dat_mn2[k * 2 + 1], dat_mn2[k * 2 + 2]);
  }
}

long long query_mn1(int a, int b, int k, int l, int r){
  if(r <= a || b <= l)return INF;

  if(a <= l && r <= b){
    return dat_mn1[k];
  }
  else{
    long long vl = query_mn1(a, b, k * 2 + 1, l, (l + r) / 2);
    long long vr = query_mn1(a, b, k * 2 + 2, (l + r) / 2, r);
    return min(vl, vr);
  }
}

long long query_mn2(int a, int b, int k, int l, int r){
  if(r <= a || b <= l)return INF;

  if(a <= l && r <= b){
    return dat_mn2[k];
  }
  else{
    long long vl = query_mn2(a, b, k * 2 + 1, l, (l + r) / 2);
    long long vr = query_mn2(a, b, k * 2 + 2, (l + r) / 2, r);
    return min(vl, vr);
  }
}

int main() {
  ll n,q,a,b;
  cin>>n>>q>>a>>b;
  a--;b--;
  vector<ll> v;
  rep(i,0,q){
    ll c;
    cin>>c;
    c--;
    v.pb(c);
  }
  ll total = 0;
  init_mn1(n);
  init_mn2(n);
  update_mn1(a,abs(v[0]-b)-a);
  update_mn1(b,abs(v[0]-a)-b);
  update_mn2(a,abs(v[0]-b)+a);
  update_mn2(b,abs(v[0]-a)+b);
  rep(i,1,q){
    ll a1 = query_mn1(0,v[i],0,0,nn_mn1) + v[i] - abs(v[i]-v[i-1]);
    ll b1 = query_mn2(v[i],n,0,0,nn_mn2) - v[i] - abs(v[i]-v[i-1]);
    update_mn1(v[i-1],min(a1,b1)-v[i-1]);
    update_mn2(v[i-1],min(a1,b1)+v[i-1]);
    total += abs(v[i]-v[i-1]);
  }
  ll mn = INF;
  rep(i,0,n){
    mn = min(mn,query_mn1(i,i+1,0,0,nn_mn1)+i);
    mn = min(mn,query_mn2(i,i+1,0,0,nn_mn2)-i);
  }
  cout << mn + total << endl;
  return 0;
}

Measured memory_bytes: 10096
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

const int mod = 1e9 + 7;
const int MX = 200010;
int bit[MX];
void add(int i, int x){
	for(i++; i < MX; i += i & -i) (bit[i] += x) %= mod;
}
int sum(int i){
	ll res = 0;
	for(i++; i; i -= i & -i) res += bit[i];
	return res % mod;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, m;
	cin >> n >> m;
	vector<pi> in;
	rep(i, n){
		int x; cin >> x; in.emplace_back(x, 1);
	}
	rep(i, m){
		int x; cin >> x; in.emplace_back(x, -1);
	}
	sort(all(in));
	
	map<int, vi> v;
	vi cur;
	int prev = -1;
	
	for(pi i : in){
		if(i.second < 0){
			if(prev > 0) for(int j : cur) v[j - prev].pb(i.first - j);
			prev = i.first;
			cur.clear();
		}
		else cur.pb(i.first);
	}
	
	vi vs(1);
	for(auto &i : v){
		sort(all(i.second)); i.second.erase(unique(all(i.second)), i.second.end());
		vs.insert(vs.end(), all(i.second));
	}
	sort(all(vs)); vs.erase(unique(all(vs)), vs.end());
	
	add(0, 1);
	
	for(auto &i : v){
		for(int j = i.second.size() - 1; j >= 0; j--){
			int y = lower_bound(all(vs), i.second[j]) - vs.begin();
			add(y, sum(y - 1));
		}
	}
	
	cout << sum(vs.size() - 1) << endl;
	
	return 0;
}

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

int main(void){
    int N;
    scanf("%d", &N);

    int *a;
    a = (int *)malloc(N * (sizeof(int)));

    for(int i=0; i<N; i++){
        scanf("%d", &(*(a+i)));
    }

    int S = 0;

    for(int i=0; i<N; i++) S ^= *(a+i);

    for(int i=0; i<N; i++) printf("%d ", *(a+i)^S);
    printf("\n");

    free(a);
    return 0;
}

Measured memory_bytes: 3188
import math
from functools import reduce
def gcd(*numbers): # 引数は複数の整数で、リストではない
    return reduce(math.gcd, numbers)
def gcd_list(numbers): # 引数はリスト
    return reduce(math.gcd, numbers)

k = int(input())
ans = 0

for p in range(1,k-1):
    for q in range(p+1,k):
        for r in range(q+1,k+1):
            ans += 6*gcd(p,q,r)
            
for p in range(1,k):
    for q in range(p+1,k+1):
        ans += 6*gcd(p,q)
        
ans += k*(k+1)//2
print(ans)

Measured memory_bytes: 9632
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ios>//左右揃え
#include<iomanip>//setwで幅指定

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

int main(void) {
    int x;
    cin >> x;
    int tmp = x % 500;
    cout << 1000 * (x / 500) + 5 * (tmp / 5) << endl;
}

Measured memory_bytes: 256
import copy
K = int(input())

runrun = list(map(str, range(1, 10)))
start = 0
while(True):

    runrun_tmp = copy.deepcopy(runrun[start:])
    start = len(runrun)
    for r in runrun_tmp:
        last_int = int(r[-1])
        tmp = []
        if last_int != 0:
            tmp.append(r+str(last_int-1))
        tmp.append(r+str(last_int))
        if last_int != 9:
            tmp.append(r+str(last_int+1))
        runrun += tmp
    if len(runrun) > K:
        break

print(runrun[K-1])

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

int lng(char x[],char y[]){
  
  int m,n,i,j,c[1001][1001];
  m=strlen(x);
  n=strlen(y);

  
  
 for(i=1;i<=m;i++)c[i][0]=0;
 for(i=0;i<=n;i++)c[0][i]=0;

 for(i=1;i<=m;i++){
   for(j=1;j<=n;j++){
     

     if(x[i-1]==y[j-1])c[i][j]=c[i-1][j-1]+1;
     else if(c[i-1][j]>=c[i][j-1])c[i][j]=c[i-1][j];
     else c[i][j]=c[i][j-1];
     // printf("aaaaaaaaaa %c %c, %d\n",x[i-1],y[j-1],c[i][j]);
   }
 }
 // printf("bbbbbbbb %d\n",c[m][n]);
 return c[m][n];
}

int main(){

  int i,n;
  char x[1000],y[1000];
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s%s",x,y);
    printf("%d\n",lng(x,y));
  }
  
  return 0;
}



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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.1415926535
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

int main()
{
    int n;
    cin>>n;
    double x=0;
    ffor(i,0,n)
    {
    	double a;
    	cin>>a;
    	x+=1/a;
    }
    cout<<SP(10)<<1/x;
    return 0;
}


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

bn = bin(k)[2:]
l = 0
ba = []
for i in range(n):
    ba.append(bin(a[i])[2:])
    l = max(len(ba[i]), l)
l = max(l, len(bn))
bn = bn.zfill(l)
ba = [ba[i].zfill(l) for i in range(n)]

c = [0]*l
for a in ba:
    for i in range(l):
        if a[i] == "1": # 1の個数
            c[i] += 1
ans = 0
x = 0
#print(ba)
#print(c)
for i in range(l):
    if k >= x + 2**(l-i-1):
        if c[i] >= n/2:
            ans += (2**(l-i-1)) * c[i]
        else:
            ans += (2**(l-i-1)) * (n-c[i])
            x += 2**(l-i-1)
    else:
        ans += (2**(l-i-1)) * c[i]
    #print(i, ans, x)
print(ans)

Measured memory_bytes: 25980
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

import itertools
n,m,q=n1()
s=n3(q)

s=sorted(s, key=lambda x: x[3],reverse=True)

Alist=list(itertools.combinations_with_replacement(range(1,m+1), n))
ans=0
for A in Alist:
    tmp=0
    for r in s:
        if A[r[1]-1]-A[r[0]-1]==r[2]:
            tmp+=r[3]
    ans=max(ans,tmp)
print(ans)

Measured memory_bytes: 21548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string btos(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  char x,y;cin>>x>>y;
  char ans;
  if(x==y)ans='=';
  else if(x<y)ans='<';
  else ans='>';
  cout << ans<<endl;
  return 0;
}

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

const int mod = 10000;
int N, K;
int B[102];

int main() {
  cin >> N >> K;
  fill(B,B+N,-1);
  for(int i = 0; i < K; ++i) {
    int A;
    cin >> A;
    cin >> B[A-1];
    --B[A-1];
  }

  int T[102][3][3];
  fill(T[0][0],T[102][0],0);
  if(B[0] == -1) 
    T[0][0][1] = T[0][1][1] = T[0][2][1] = 1;
  else
    T[0][B[0]][1] = 1;

  for(int i = 1; i < N; ++i) {
    for(int a = 0; a < 3; ++a) {
      for(int b = 0; b < 3; ++b) {
	for(int c = 0, d = 1; c < 3 && d; ++c) {
	  if(B[i] != -1) {
	    c = B[i];
	    d = 0;
	  }
	  int nb;
	  if(a == c) nb = b+1;
	  else nb = 1;
	  if(nb >= 3) continue;
	  T[i][c][nb] = (T[i][c][nb] + T[i-1][a][b]) % mod;
	}
      }
    }
  }
  int sum = 0;
  for(int i = 0; i < 3; ++i) {
    for(int j = 0; j < 3; ++j) {
      sum = (sum+T[N-1][i][j])%mod;
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int max = Math.max(A,Math.max(B,C));
//		if(A==max) {
//			System.out.println(B+C+A*Math.pow(2,(sc.nextInt()-1)));
//		}
//		if(B==max) {
//			System.out.println(A+C+B*Math.pow(2,(sc.nextInt()-1)));
//		}
//		if(C==max) {
//			System.out.println(B+A+C*Math.pow(2,(sc.nextInt()-1)));
//		}
		System.out.println((int)(A+B+C+max*(Math.pow(2,sc.nextInt())-1)));
		sc.close();
	}
}


Measured memory_bytes: 21844
import java.util.*;
public class Main{
	public static void main(String[] args){
      	Scanner sc = new Scanner(System.in);
    	char[] n = sc.next().toCharArray();
      	int count = 0;
      	for(int i = 0; i < n.length; i++){
        	if(n[i] == '2') count++;
        }
      	System.out.println(count);
    }
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a, b, x;
  cin >> a >> b >> x;
  if (a == 0) {
    cout << b / x + 1 << endl;
    return 0;
  }
  a--;
  cout << b / x - a / x << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;

#define ll long long

int main()
{

    string s;
    cin >> s;
    if (s[1] == 'B')
        printf("ARC");
    else
        printf("ABC");
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int dp[1010][1010];
int bingo[3][3];
bool flag[3][3];
int cnt[2][105];

int main() {
	int n;
	cin >> n;
	vector<int>a(n), b(n);
	rep(i, n) {
		cin >> a[i];
		while (a[i] % 2 == 0) {
			b[i]++;
			a[i] /= 2;
		}
	}
	sort(b.begin(), b.end());
	int ans = b[0];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
def solution():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))

    limit = sum(a) / (4 * m)
    a.sort(reverse=True)
    for aa in a[0:m]:
        if aa < limit:
            print("No")
            return
    print("Yes")

solution()

Measured memory_bytes: 38384
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#define ll long long
#define il inline
using namespace std;
int main()
{
    int a,b,x;
    cin >> a >> b >> x;
    if( a + b >= x && x >= a) cout << "YES\n";
    else cout << "NO\n";
    return 0;
}

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

int gcd(int a, int b)
{
	int r = a % b;
	if (r == 0) {
		return b;
	}
	return gcd(b, r);
}
int lcm(int a, int b)
{
	if(a == 0 || b == 0) {
		return 0;
	}
	//return (a * b) / gcd(a, b);
	return ((a / gcd(a, b)) * b);
}
int main()
{
	int n, m;
	vector<int> t;
	
	// 前処理をするとさらに早くすることが出来る
	while (cin >> n >> m) {// while(cin >>n, n)なら1行で住む
		if (n == 0 && m == 0) {
			break;
		}
		// 出力
		cout << gcd(n, m) << " " << lcm(n, m) << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int odd = 0;
		for (int i = 0; i < 3; i++) {
			odd += sc.nextInt() % 2;
		}
		System.out.println(odd >= 2 ? "Hom" : "Tem");
	}
}



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

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

    vector<int> a(n), x(n), y(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        x[i] = i + a[i];
        y[i] = i - a[i];
    }
    sort(y.begin(), y.end());

    long long int ans = 0;
    for(int i=0; i<n; i++){
        ans += upper_bound(y.begin(), y.end(), x[i]) - lower_bound(y.begin(), y.end(), x[i]);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  string s;
  cin >>s;
  int cnt=0;
  for(int i=0;i<3;++i){
    if(s[i]=='o')cnt++;
  }
  cout << 700+cnt*100 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}


//for(int i = ; i < ; i++){}

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i = 0; i < n; i++) cin>>a[i];
  int c;
  c = a[1];
  for(int i = 2; i < n; i++){
    c = c ^ a[i];
  }
  if(a[0]==c) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}
  



Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,cnt=1;
	cin>>a>>b>>c;
	if(a!=b) cnt++;
	if(a!=c && b!=c){
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}
	

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    string S;
    ll N;
    cin >>S;
    N=S.size();
    map<char,bool>m;
    rep(i,N){
        m[S[i]]=1;
    }

    for(char i='a';i<='z';i++){
        if(m[i]==0){
            cout<<i<<endl;
            return 0;
        }
    }
    
    cout << "None" << endl;


    return 0;
    

}

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

using namespace std;
std::vector<int> vec;
int check(int i )
{
  if( vec[i] == vec[i+1]){ 
    check(i+1);
  }
  else
  {
   return i;
  }
}

int main () 
{
  int n;
  
  cin >>n;
  for(int i =0;i<n;i++)
  {
    int temp;
    cin>> temp;
    vec.push_back(temp);
  }
  
  int sum =0;
  for(int i =0; i<n;)
  {
    int temp = check(i);
    if(i==temp){
     i++;
    }else{
    sum += (temp-i+1)/2;
    i = temp;
    }
  }  
  cout<<sum;
  
  return 0;
  
}

Measured memory_bytes: 256
H, W, A, B = map(int, input().split())
mod = 10 ** 9 + 7

# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, H + W + 1):
    factorial.append(factorial[-1] * i % mod)
    inverse.append(pow(factorial[-1], mod-2, mod))


# 組み合わせ計算
def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % mod


ans = 0
for w in range(B, W):
    ans += nCr(H - A - 1 + w, w) * nCr(A - 1 + W - w - 1, A - 1) % mod

print(ans % mod)


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

int pow_int(int x, int y)
{
  return (int)pow((double)x, y);
}

int main()
{
  int N, K;
  cin >> N >> K;

  int n = 1;
  while(true)
  {
    if(N < pow_int(K, n))
    {
      cout << n << endl;
      break;
    }
    n++;
  }
}

Measured memory_bytes: 4068
//(UNCOMMENT WHEN SUBMITTING)
//#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
// #pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)
// #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

// clang-format off
#define range(i) for (int _ = 0; _ < i; _++)
#define vprnt(v) for (auto vi : v) cout << vi << " "; cout << endl;
#define fastio() ios::sync_with_stdio(false); cin.tie(0)
#define ll long long
#define all(x) (x).begin(), (x).end()
using namespace ::std;
int nxt() {int x;cin >> x;return x;}
ll nxtll() {ll x;cin >> x;return x;}
// clang-format on

int main() {
    fastio();
    string s;
    cin >> s;

    int mod = 0;
    for (char ch : s) {
        mod = (mod + ch - '0') % 9;
    }

    cout << (mod ? "No" : "Yes") << endl;

    return 0;
}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
long long x[55];
bool cmp(long long p,long long q){
	return p>q;
}
double f(long long p,long long q){
	double s1=1;
	for(long long i=1;i<=q;i++){
		s1*=(p-i+1);
	}
	for(long long i=1;i<=q;i++){
		s1/=(i);
	}
	return s1;
}
int main(){
	long long n,a,b,g,h,s;
	double ss;
	scanf("%lld%lld%lld",&n,&a,&b);
	for(long long i=1;i<=n;i++){
		scanf("%lld",&x[i]);
	}
	sort(x+1,x+n+1,cmp);
	g=x[1];
	h=x[a];
	s=0;
	for(long long i=1;i<=a;i++){
		s+=x[i];
	}
	if(g==h){
		printf("%.6f\n",1.000000*s/a);
		s=0;
		for(long long i=1;i<=n;i++){
			if(x[i]==g)s++;
		}
		ss=0;
		if(s>=b){
			for(long long i=a;i<=b;i++){
				ss+=f(s,i);
			}
		}
		else{
			for(long long i=a;i<=s;i++){
				ss+=f(s,i);
			}
		}
		printf("%.0f\n",ss);
	}
	else{
		printf("%.6f\n",1.000000*s/a);
		s=0;g=0;
		for(long long i=1;i<=a;i++){
			if(x[i]==h)g++;
		}
		for(long long i=1;i<=n;i++){
			if(x[i]==h)s++;
		}
		ss=f(s,g);
		printf("%.0f\n",ss);
	}
	return 0;
}

Measured memory_bytes: 256