akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main() {
    int a,b;
    cin >> a >> b;

    if(a > 8 || b > 8) {
        cout << ":(" << endl;
        return 0;
    }

    cout << "Yay!" << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
# 約数の合計が最低の約数のペアを求める
def make_div(n):
    divi = []
    for i in reversed(range(1,int(n**0.5)+1)):
        if n%i == 0:
            return [i, n//i] 

print(sum(make_div(n))-2)

Measured memory_bytes: 2940
#ARC086-C
from collections import Counter
n,k = map(int,input().split())
a = list(map(int,input().split()))

c = Counter(a)

c = c.most_common()
#print(c)

syurui = len(c)
cnt = 0
for i in range(len(c)):
    if syurui > k:
        cnt += c[-1][1]
        a = c.pop(-1)
        syurui -= 1
    else:
        break
    
print(cnt)

Measured memory_bytes: 39352
k = int(input())
R = [[0 for j in range(10)] for d in range(10)] #d:桁数-1, j:先頭の数
R_total = [[0 for j in range(10)] for d in range(10)] #辞書順
for j in range(10):
    R[0][j] = 1
    R_total[0][j] = j
for d in range(1, 10):
    R[d][0] = R[d - 1][0] + R[d - 1][1]
    R_total[d][0] = R_total[d - 1][9]
    for j in range(1, 9):
        R[d][j] = R[d - 1][j - 1] + R[d - 1][j] + R[d - 1][j + 1]
        R_total[d][j] = R_total[d][j - 1] + R[d][j]
    R[d][9] = R[d - 1][8] + R[d - 1][9]
    R_total[d][9] = R_total[d][8] + R[d][9]
k_digit = 0
k_top = 1
while k > R_total[k_digit][9]:
    k_digit += 1
while k > R_total[k_digit][k_top]:
    k_top += 1
k_d = k_digit
k_j = k_top
answer =  k_top * (10 ** (k_digit))
while k_d:
    k_d -= 1
    if k_j == 9:
        k = k - (R_total[k_d + 1][9] - R_total[k_d][9])
        if k <= R_total[k_d][8]:
            k_j = 8
    else:
        k = k - (R_total[k_d + 1][k_j] - R_total[k_d][k_j + 1])
        if k_j == 0:
            if k > R_total[k_d][0]:
                k_j = 1
        else:
            if k <= R_total[k_d][k_j - 1]:
                k_j -= 1
            elif k > R_total[k_d][k_j]:
                k_j += 1
    answer += k_j * (10 ** k_d)
print(answer)

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

int main() {
    int flag = 0;
    string N;
    cin >> N;

    for(size_t i = 0; i < sizeof(N); i++) {
        if(N[i] == '7') {
            flag = 1;
            break;
        } else {
            flag = 0;
        }
    }

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

    return 0;
}

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

using namespace std;

long long knapsack(vector<int> v, vector<int> wt, int n, int W){
    long long dp[n+1][W+1];
    int i,j;
    for(i=0;i<=n;i++){
        dp[i][0] = 0;
    }
    for(i=0;i<=W;i++){
        dp[0][i] = 0;
    }
    for(j=1; j<=W; j++){
            for(i=1;i<=n;i++){
                if(wt[i-1]<=j){
                    dp[i][j] = max(dp[i-1][j], v[i-1] + dp[i-1][j-wt[i-1]]);
                }
                else
                    dp[i][j] = dp[i-1][j];
            }
    }
    return dp[n][W];
}
int main(){
    vector<int> wt, v;
    int i,n,w,val,W;
    cin>>n>>W;
    for(i=0;i<n;i++){
        cin>>w>>val;
        wt.push_back(w);
        v.push_back(val);
    }
    cout<<knapsack(v, wt, n, W);
}


Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int n;cin >> n;
    priority_queue<LL> pa;
    priority_queue<LL,vector<LL>,greater<LL>> pb;
    LL la=0,ra=0;
    LL sum = 0;
    for(int i=0;i<n;i++){
        int x;cin >> x;
        if(x==1){
            LL l,r;cin >> l >> r;
            sum+=r;
            if(pa.size()==pb.size()){
                if(pa.empty()){
                    pa.push(l);
                    la+=l;
                }
                else if(pb.top()<=l){
                    LL t = pb.top();pb.pop();
                    ra+=l;
                    ra-=t;
                    la+=t;
                    pa.push(t);
                    pb.push(l);
                }
                else{
                    pa.push(l);
                    la+=l;
                }
            }
            else{
                if(pa.top()>=l){
                    LL t = pa.top();pa.pop();
                    la+=l;
                    la-=t;
                    ra+=t;
                    pa.push(l);
                    pb.push(t);
                }
                else{
                    ra+=l;
                    pb.push(l);
                }
            }
        }
        else if(x==2){
            LL s=pa.top();
            cout <<s<<" " <<sum+(LL)pa.size()*s-la+ra-(LL)pb.size()*s << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3828
#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
const int N=200005;
int n,m,c,s[N][30],f[N];
char S[N];
typedef long long LL;
LL l,r;

LL calc(LL x)
{
	if(x<=n) return s[x][c];
	LL s1=s[n][c],s0=s[m][c];
	LL l1=n,l0=m;
	while(l1<=x) swap(l1,l0),l1+=l0,swap(s1,s0),s1+=s0;
	return s0+calc(x-l0);
}

int main()
{
	scanf("%s",S+1),n=strlen(S+1)/2;
	rep(i,1,n)
		rep(j,0,25) s[i][j]=s[i-1][j]+(S[i]-'a'==j);
	rep(i,2,n)
	{
		int k=f[i-1];
		while(k && S[k+1]!=S[i]) k=f[k];
		if(S[k+1]==S[i]) ++k;
		f[i]=k;
	}
	m=n-f[n];
	scanf("%lld %lld",&l,&r);
	rep(i,0,25) c=i,printf("%lld ",calc(r)-calc(l-1));
	puts("");
	return 0;
}

Measured memory_bytes: 14080
N,M=map(int,input().split())
h=[list(map(int, input().split())) for i in range(M)]
s=[[10**6]*N for i in range(N)]
for i in h:
    s[i[0]-1][i[1]-1]=i[2]
    s[i[1]-1][i[0]-1]=i[2]
for i in range(N):
    for j in range(N):
        for k in range(N):
            s[j][k] = min(s[j][k],s[j][i] + s[i][k])
a=0
for i in h:
    if s[i[0]-1][i[1]-1]!=i[2]:
        a+=1
print(a)

Measured memory_bytes: 41964
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
q = lmiinps()

k = 1
l = 0
s = 0

a = sorted(q)
a.append(0)

b = [0]*(a[n-1])
d = [0]*(a[n-1])

for i in range(n):
    if a[i] == a[i+1]:
        k += 1
    else:
        l = ((k*(k-1))//2)
        s += l
        b[a[i]-1]=l
        d[a[i]-1]=k
        k = 1

for j in q:
    p = s-((b[j-1])-((b[j-1] *(d[j-1]-2)) // d[j-1]))
    print(p)

Measured memory_bytes: 26140
n, m, x, y = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

X2 = X.copy()
X2.append(x)
X2.sort()

Y2 = Y.copy()
Y2.append(y)
Y2.sort()

if X2[-1] < Y2[0]:
    print('No War')
else:
    print('War')


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

std::vector<std::vector<LL>>G;
LL K;
std::vector<std::pair<std::pair<LL, LL>, LL>>color;

void dfs(LL v, LL p, LL k)
{
	LL c = 1;
	for (LL u : G[v])
	{
		if (u != p)
		{
			color.push_back(std::make_pair(std::make_pair(std::min(v, u), std::max(v, u)), (k + c) % K));
			dfs(u, v, (k + c) % K);
			++c;
		}
	}
}

int main()
{
	LL N;
	in >> N;
	std::vector<LL>a(N - 1), b(N - 1);
	rep(i, N - 1) in >> a[i] >> b[i];

	G.resize(N + 1);
	rep(i, N - 1)
	{
		G[a[i]].push_back(b[i]);
		G[b[i]].push_back(a[i]);
	}

	for (LL i = 1; i <= N; ++i) K = std::max<LL>(K, G[i].size());
	dfs(1, -1, 0);

	std::vector<LL>c(N - 1);
	std::sort(color.begin(), color.end());
	rep(i, N - 1)
	{
		auto it = std::lower_bound(color.begin(), color.end(), std::make_pair(std::make_pair(std::min(a[i], b[i]), std::max(a[i], b[i])), -1LL));
		c[i] = (*it).second + 1;
	}

	out << K << std::endl;
	rep(i, N - 1) out << c[i] << std::endl;
}


Measured memory_bytes: 12660
#include <iostream>
#include <cmath>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#include <bitset>
#include <iomanip>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

void printFixedDouble(double d, int fix) {
    cout << std::fixed;
    cout << std::setprecision(fix) << d << endl;
}

int factorial(int n)
{
    int x = 1; // 0! = 1

    for (int i = 1; i <= n; ++i)
        x *= i;

    return x;
}

int main() {

    int N;
    cin >> N;

    long patternNum = factorial(N);

    vector<pii> towns;
    vint townNums(N);
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        towns.push_back(pii(x, y));
        townNums[i] = i;
    }

    double avg = 0;
    do {
        double distance = 0;
        rep(s, N - 1) {
            distance += std::sqrt(std::pow(towns[townNums[s]].first - towns[townNums[s+1]].first, 2) + std::pow(towns[townNums[s]].second - towns[townNums[s+1]].second, 2));
        }
        avg += distance / patternNum;
    } while (next_permutation(townNums.begin(), townNums.end()));

    printFixedDouble(avg, 8);
}

Measured memory_bytes: 256
S = list(input())

abc = [chr(ord('a') + i) for i in range(26)]

if len(S) < 26:
    rest_alp = list(set(abc) - set(S))
    rest_alp.sort()
    S.append(rest_alp[0])
    print("".join(S))
    exit()
else:
    for i in reversed(range(25)):
        for j in reversed(range(i+1, 26)):
            if S[i] < S[j]:
                ans = S[:i].append(S[j])
                print("".join(S[:i]) + "".join(S[j]))
                exit()
print(-1) 

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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int x;
    cin >> x;

    // 処理
    int ans = 1;
    for (int i = 2; i < sqrt(x); i++) {
        for (int j = 2; j <= 10; j++) {
            int tmp = pow(i, j);
            if (tmp <= x && tmp > ans) ans = tmp;
        }
    }

    // 出力
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>




using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const int INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;


ll solve(const string& r, int n, const string& s1, const string& s2) {
    int n1 = s1.size(), n2 = s2.size();
    vector<vector<ll> > d(n1 + 1, vector<ll>(n2 + 1, 0));
    
    d[0][0] = 1;
    for (int i = 0; i < n; ++i) {
        for (int i1 = 0; i1 <= min(i, n1); ++i1) {
            int i2 = i - i1;
            if (i2 > n2)
                continue;
            if ((i1 < n1) && (s1[i1] == r[i])) {
                d[i1 + 1][i2] += d[i1][i2];
            }
            if ((i2 < n2) && (s2[i2] == r[i])) {
                d[i1][i2 + 1] += d[i1][i2];
            }
        }
    }
    return d[n1][n2];
}

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    string r = s.substr(n, n);
    reverse(r.begin(), r.end());
    int all = 1 << n;
    ll res = 0;
    for (int i = 0; i < all; ++i) {
        //cerr << i << "\n";
        string s1 = "", s2 = "";
        for (int j = 0; j < n; ++j) {
            if ((i >> j) & 1) {
                s1.push_back(s[j]);
            }
            else {
                s2.push_back(s[j]);
            }
        }
        res += solve(r, n, s1, s2);
    }
    cout << res << endl;
}

//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    solve();


#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}

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

int main()
{
	int a,b ;
	const double tubo = 3.305785 ;
	double area ;

	cin >> a >> b ;
	area = (a*b) / tubo ;
	printf( "%lf\n" , area ) ;

	return 0 ;
}

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

int main(){
    int a[2],n;
    cin >> n >> a[0] >> a[1];
    sort(a,a+2);
    cout << a[0] << " ";
    if(n - (a[0]+a[1]) < 0)cout << (a[0]+a[1]) - n << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> //required
//#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define lb long double
#define pb push_back
#define loop(i,start,n) for(ll i=start;i<n;i++)
#define rloop(i,n,start)for(ll i=n;i>=start;i--)
#define mod 1000000007
#define endl "\n"
#define INF     1e15
#define NEG_INF -1e15
#define pll pair<ll,ll>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
//using namespace __gnu_pbds;
//template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
char a[10][10];
bool solve(ll x, ll y, ll h, ll w, ll k){
	char temp[h + 1][w + 1];
	loop(i, 0, h)
		loop(j, 0, w)
			temp[i][j] = a[i][j];


	ll cnt = 0;
	while( cnt < h){
		if((1 << cnt) & x){
			loop(i, 0, w)
				temp[cnt][i] = '+';
		}
		cnt++;
	}

	cnt = 0;
	while( cnt < w){
		if((1 << cnt) & y){
			loop(i, 0, h)
				temp[i][cnt] = '+';
		}
		cnt++;
	}
	ll ans = 0;
	loop(i, 0, h){
		loop(j, 0, w){
			if(temp[i][j] == '#')
				ans++;
		}
		cnt++;
	}


	return (ans == k);
}
int main(){
	IOS;
	ll h, w, k;
	cin >> h >> w >> k;
	loop(i, 0, h)
		loop(j, 0, w)
			cin >> a[i][j];

	ll ans = 0;
	loop(i, 0, (1 << h)){
		loop(j, 0, (1 << w)){
			if(solve(i, j, h, w, k))
				ans++;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <queue>
#include<map>
#include<algorithm>
#include<set>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<=n;i++)
#define ALL(a) a.begin(),a.end()
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
typedef long long int ll;
int main() {
    int n, m, k,a,b,c;
    cin >> a >> b >> c >> k;
    while (a >= b) {
        b *= 2; k--;
    }
    while (b >= c) {
        c *= 2; k--;
    }
    if (k >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3632
// practice with Dukkha
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 500;

int aa[N], rr[N];

int count(int n, int md) {
	int rsum = 0;
	for (int i = 0; i < n; i++)
		rsum += rr[i] = aa[i] % md;
	if (rsum == 0)
		return 0;
	sort(rr, rr + n);
	int p = 0, q = n * md - rsum;
	for (int i = 0; i < n && p != q; i++) {
		p += rr[i];
		q -= md - rr[i];
	}
	return p;
}

int main() {
	int n, k; cin >> n >> k;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		sum += aa[i] = a;
	}
	int ans = 0;
	for (int a = 1, b; a <= (b = sum / a); a++)
		if (sum % a == 0) {
			if (count(n, b) <= k) {
				ans = b;
				break;
			}
			if (count(n, a) <= k)
				ans = a;
		}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3520
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll n,m,count=0,ans=0;cin>>n>>m;
  vp d(n);
  rep(i,0,n){
    cin>>d[i].first>>d[i].second;
  }
  sort(d.begin(),d.end());
  rep(i,0,n){
    if(count>=m){break;}
    ans+=d[i].first*min(m-count,d[i].second);
    count+=d[i].second;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
int main(){
    LL a,b,bb;
    cin >> a >> b;
    bb = b*2;
    if(a <= bb) cout << "0" << endl;
    else cout << (a - bb) << endl;

    return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;

void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
ll a, b;
map <ll, ll> mp;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    cin >> a >> b;
    ll temp = __gcd(a, b);
    if(temp == 1)
    {
        cout << 1;
        return 0;
    }
    for(ll i = 2; i * i <= temp; i++)
    {
        if(temp % i == 0)
        {
            mp[i] = 1;
            while(temp % i == 0)
                temp /= i;
        }
    }
    if(temp != 1) mp[temp] = 1;
    cout << mp.size() + 1;
    return 0;
}


Measured memory_bytes: 256
n,m=map(int, input().split())
a_list=[int(i) for i in input().split()]

a_list.sort(reverse=True)
#print(a_list)

standard=sum(a_list)/(4*m)

#print(a_list[m-1])
#print(standard)
if a_list[m-1]<standard:
    print("No")
    
else:
    print("Yes")


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



struct Mint {
    int x;

    Mint() : x(0) {}

    Mint(int y) : x(y >= 0 ? y % M : (M - (-y) % M) % M) {}

    Mint &operator+=(const Mint &p) {
        if((x += p.x) >= M) x -= M;
        return *this;
    }

    Mint &operator-=(const Mint &p) {
        if((x += M - p.x) >= M) x -= M;
        return *this;
    }

    Mint &operator*=(const Mint &p) {
        x = (int) (1LL * x * p.x % M);
        return *this;
    }

    Mint &operator/=(const Mint &p) {
        *this *= p.inverse();
        return *this;
    }

    Mint operator-() const { return Mint(-x); }

    Mint operator+(const Mint &p) const { return Mint(*this) += p; }

    Mint operator-(const Mint &p) const { return Mint(*this) -= p; }

    Mint operator*(const Mint &p) const { return Mint(*this) *= p; }

    Mint operator/(const Mint &p) const { return Mint(*this) /= p; }

    bool operator==(const Mint &p) const { return x == p.x; }

    bool operator!=(const Mint &p) const { return x != p.x; }

    Mint inverse() const {
        int a = x, b = M, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return Mint(u);
    }

    Mint power(int n) const {
        Mint ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const Mint &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, Mint &a) {
        int t;
        is >> t;
        a = Mint(t);
        return (is);
    }


};
using mint = Mint;


template< typename T>
T power(T x,int k){
    T ret=1;
    while(k>0){
        if(k&1) (ret*=x);
        (x*=x); 
        k >>= 1;
    }
    return ret;
}

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

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

    Mint ans=power<Mint>(2,n);

    ans=ans-1;
    
    Mint as=1;
    rep(i,a){
        as*=n-i;
    }
    rep(i,a){
        as/=a-i;
    }

    Mint bs=1;
    rep(i,b){
        bs*=n-i;
    }
    rep(i,b){
        bs/=b-i;
    }
    
    //cout<<ans<<' '<<as<<' '<<bs<<endl;

    cout<<ans-(as+bs)<<endl;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
void Digvijay()
{
   int k;
   cin>>k;
   queue<int> q;
   for(int i=1;i<10;i++)
   {
       q.push(i);
   }
//    if(k<=9)
//    {
//        cout<<k<<"\n";
//        return;
//    }
   k--;
   while(k)
   {
       int f=q.front();
       q.pop();
       if(f%10==9)
       {
           q.push(f*10+f%10-1);
           q.push(f*10+f%10);
       }
       else if(f%10==0)
       {
           q.push(f*10+f%10);
           q.push(f*10+f%10+1);
       }
       else
       {
           q.push(f*10+f%10-1);
           q.push(f*10+f%10);
           q.push(f*10+f%10+1);
       }
       k--;
   }
   cout<<q.front()<<"\n";
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int _=1;
    //cin>>_;
    for(int __=0;__<_;__++)
    {
        Digvijay();
    }
}

Measured memory_bytes: 4772
L, R = map(int, input().split())

if L // 2019 != R // 2019:
    print(0)
else:
    ans = float("inf")
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min(ans, (i * j) % 2019)

    print(ans)


Measured memory_bytes: 2940
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#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 out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

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

    int n,t,a; cin >> n >> t >> a;
    int ans = 0 , cc = INF;
    FOR(i,1,n+1){
        int h; cin >> h;
        int d = (t*1000-h*6)-a*1000;
        if(d<0) d = -d;
        if(cc>d){cc = d; ans = i;}
    }
    out(ans);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
   int n1,n2;
   cin >> n1;
   cin >> n2;
   int sum = 0;
    if(n1==3)
        sum += 1;
    else if(n1==2)
        sum += 2;
    else if(n1==1)
        sum += 3;
        
    if(n2==3)
        sum += 1;
    else if(n2==2)
        sum += 2;
    else if(n2==1)
        sum += 3;
   if((n1==1)&&(n2==1))
        sum += 4;
        
    cout << sum*100000 << endl;
   return 0;
}

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

int main(){
    int a, b, c;
    int i=0;
    cin >> a >> b >> c;
    for(a; a<=b; a++){
        if(c % a == 0){
            i++;
        }
    }
    printf("%d\n", i);
}

Measured memory_bytes: 3192
main = do
 [n,p] <- map read . words <$> getLine :: IO [Integer]
 as <- map read . words <$> getLine :: IO [Integer]
 print (biscuits n p as)

biscuits n p as
 | p == 0 = (2^evens) * sum (map (comb odds) [0,2..odds])
 | otherwise = (2^n) - ((2^evens) * sum (map (comb odds) [0,2..odds]))
 where
  odds = fromIntegral $ length (filter odd as)
  evens = n - odds 

fact n = product [1..n]

comb n r = div (fact n) (fact r * fact (n-r))

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 1000000007
//#define mod 987654321
#define sz(a) ((ll)(a).size())

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-9
typedef pair<int, int> II;
typedef pair<ll, ll> LL;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI (2 * acos((ld)0))
#define linf (1ll << 60)
#define y1 y32432
#define y0 y435346

#define maxn 2000025

ll n, a, b;
ll N = inf;

int main() {

//	freopen("in.txt", "r", stdin);
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> a >> b;
	if(n < a + b - 1 || n > a * b){
		cout << -1 << endl;
		return 0;
	}

	int cur = n;
	for(int i = b; i >= 1; i--){
		if(cur - a >= i - 1){
			For(j, cur - a + 1, cur) cout << j << " ";
			cur -= a;
		} else{
			For(j, i, cur) cout << j << " ";
			cur = i - 1;
		}
	}

	return 0;
}


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


#define ll long long int
#define ld long double
#define mod 1000000007
#define big 1e18+10
#define small -big
#define pb push_back



template <typename T>

void prarr(T a)
{
     cerr << "[ ";
     
     for(auto i : a){
         cerr << i << " ";
     }
     
     cerr << "]" << endl;
}


#define trace(...) _er(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>

void _er(const char* name, Arg1&& arg1){
	cerr << "[" << name << " : " << arg1 << "]" << endl;
}

template <typename Arg1, typename... Args>

void _er(const char* names, Arg1&& arg1, Args&&... args){
    
	const char* comma = strchr(names + 1, ',');
	cerr << "[" ; cerr.write(names, comma - names) << " : " << arg1 << "] ";
	_er(comma+2, args...);
}


void solve() {
        
       ll x;
       cin >> x;
       cout << (x ^ 1) << endl;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
   

    int t=1;
    //cin >> t;

    for(int i = 1; i <= t; i++) {  
   
         solve();
    }


    return 0;
        
}


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

public static partial class Program
{
    public static void Main()
    {
        var s = CRL();

        long ans = 0;
        for (int bit = 0; bit < (1 << s.Length - 1); bit++)
        {
            var flag = new bool[s.Length - 1];
            for (int i = 0; i < s.Length - 1; i++)
            {
                flag[i] = ((bit >> i) & 1) == 1;
            }

            var sb = new StringBuilder(s);
            for (int i = s.Length - 2; i >= 0; i--)
            {
                if (flag[i])
                {
                    sb.Insert(i + 1, "+");
                }
            }

            ans += sb.ToString().Split('+').Sum(x => x.ToLong());
        }

        CWL(ans);
    }
}

public static partial class Program
{
    //テンプレここから
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);

    public static long LCM(long a, long b) => a * b / GCD(a, b);
    public static int ToInt(this double d) => (int) d;
    public static long ToLong(this double d) => (long) d;
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static int[] ArrayInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static string CRL() => Console.ReadLine();
    public static string RL() => ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static void WL(object obj) => WriteLine(obj);
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Diff(int a, int b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static long[] dx = new long[] {0, -1, 0, 1};
    public static long[] dy = new long[] {-1, 0, 1, 0};
    public static long mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array) => array.OrderBy(x => x).ToArray();
    public static int[] Sort(this int[] array) => array.OrderBy(x => x).ToArray();
    public static long[] DSort(this long[] array) => array.OrderByDescending(x => x).ToArray();
    public static int[] DSort(this int[] array) => array.OrderByDescending(x => x).ToArray();
    public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);

    public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);

    //テンプレここまで
}

Measured memory_bytes: 13396
import sys
n = int(input())
arr = sorted(list(map(lambda x: tuple(map(int, x.split())), sys.stdin.readlines())))
# print(arr)

candidate = set()
for i in range(n):
  for j in range(i+1, n):
    candidate.add((arr[j][0] - arr[i][0], arr[j][1] - arr[i][1]))
    
# print(candidate)

ans = n
for can in candidate:
  li = arr.copy()
  count = 0
  while (len(li) > 0) and (count < ans):
    count += 1
    p = li.pop(-1)
    p = (p[0] - can[0], p[1] - can[1])
    #print(li)
    pos = set(li)
    while p in pos:
      pos.remove(p)
      li.remove(p)
      p = (p[0] - can[0], p[1] - can[1])
      #print(li, "p", p)
  ans = count
print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
const int INF = 100000000;


string s;

int main(){

    cin >> s;

    // enum WEEK = {"SAT", "FRI"};

    if(s == "SUN"){
        cout << 7 << endl;
        return 0;
    }
    if(s == "MON"){
        cout << 6 << endl;
        return 0;
    }
    if(s == "TUE"){
        cout << 5 << endl;
        return 0;
    }
    if(s == "WED"){
        cout << 4 << endl;
        return 0;
    }
    if(s == "THU"){
        cout << 3 << endl;
        return 0;
    }
    if(s == "FRI"){
        cout << 2 << endl;
        return 0;
    }
    if(s == "SAT"){
        cout << 1 << endl;
        return 0;
    }

    // switch(s){
    //     case "SUN":
    //         cout << 7 << endl;
    //         break;
    //     case "MON":
    //         cout << 6 << endl;
    //         break;
    //     case "TUE":
    //         cout << 5 << endl;
    //         break;
    //     case "WED":
    //         cout << 4 << endl;
    //         break;
    //     case "THU":
    //         cout << 3 << endl;
    //         break;
    //     case "FRI":
    //         cout << 2 << endl;
    //         break;
    //     case "SAT":
    //         cout << 1 << endl;
    //         break;
    // }

    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	int ans = 1;
	while(ans*2<=n)
	{
		ans*=2;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3580
#include <algorithm>
#include <cassert>
#include <iostream>
#include <memory>
#include <numeric>

#include <array>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cstring>
#include <ostream>
#include <type_traits>
#include <utility>
#include <chrono>
#include <random>

#ifdef ONLINE_JUDGE
#pragma GCC optimize ("O2")
#pragma GCC target ("avx,avx2")
#endif

using namespace std;

using u64 = uint64_t;
using i64 = int64_t;
using u32 = uint32_t;
using vi = vector<int>;
using vi64 = vector<i64>;

#define seq(i,a,b) for (int i = (a); i < (b); ++i)
#define rev(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define dbg(x) {cerr << #x << ": " << x << endl;}

int main(int argc, char *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n; cin >> n;

    std::array<long, 1000000> count;
    seq(x,1,100) seq(y,1,100) seq(z,1,100) {
      ++count[x*x + y*y + z*z + x*y + y*z + x*z];
    }
    seq(_, 1, n+1) {
      cout << count[_] << "\n";
    }
}


Measured memory_bytes: 3620
#include<iostream>
#include<deque>
using namespace std;
int N,A[3];
int conv(string&s)
{
	int a=s[0]-'A';
	int b=s[1]-'A';
	return a*3+b;
}
int ans[1<<17];
deque<int>P[9];
main()
{
	cin>>N;
	for(int i=0;i<3;i++)cin>>A[i];
	for(int i=0;i<N;i++)
	{
		string s;cin>>s;
		int id=conv(s);
		P[id].push_back(i);
		int x=--A[id%3];
		int y=--A[id/3];
		if(x<0&&y<0)
		{
			if(P[id].size()>=2)
			{
				ans[P[id].front()]=id%3;
				P[id].pop_front();
				ans[P[id].front()]=id/3;
				P[id].pop_front();
			}
			else
			{
				int jd=-1,kd=-1;
				if(id%3==1)jd=5;
				else if(id%3==2)jd=3-id/3*3+2;
				if(id/3==0)kd=3-id;
				else if(id/3==1)kd=1;
				if(P[jd].size()>=1&&P[kd].size()>=1)
				{
					ans[P[jd].front()]=id%3;
					P[jd].pop_front();
					ans[P[kd].front()]=id/3;
					P[kd].pop_front();
				}
				else if(P[jd].size()>=1)
				{
					ans[P[jd].front()]=id%3;
					P[jd].pop_front();
					ans[P[id].front()]=id/3;
					P[id].pop_front();
				}
				else if(P[kd].size()>=1)
				{
					ans[P[id].front()]=id%3;
					P[id].pop_front();
					ans[P[kd].front()]=id/3;
					P[kd].pop_front();
				}
				else
				{
					cout<<"No"<<endl;
					return 0;
				}
			}
			A[id%3]+=2;
			A[id/3]+=2;
		}
		else if(x<0||y<0)
		{
			ans[P[id].front()]=x<0?id%3:id/3;
			if(x<0)A[id%3]+=2;
			else A[id/3]+=2;
			P[id].pop_front();
		}
	}
	for(int i=0;i<9;i++)
	{
		while(!P[i].empty())
		{
			ans[P[i].front()]=i/3;
			P[i].pop_front();
		}
	}
	cout<<"Yes"<<endl;
	for(int i=0;i<N;i++)cout<<(char)(ans[i]+'A')<<endl;
}


Measured memory_bytes: 4300
#include <iostream>
using namespace std;
int main(){
    int n; cin >> n;
    int a[n]; for(int i = 0; i < n; ++i) cin >> a[i];
    int nnum = a[0];
    long long ans = a[1] - a[0];
    for(int i = 1; i < n; ++i){
        ans = max(ans,(long long) a[i]-nnum);
        nnum = min(nnum,a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3856
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <vector>
#include <queue>
#include <functional>
#include <math.h>
#include <string.h>

using std::endl;
using std::string;

#define ll long long int
#define LEP(a, n) for(int a = 0; a < n; ++a)
#define INF 1145141919810
#define OUT std::cout
#define IN std::cin
#define itn int
#define fro for
#define sdt std

ll Add(ll num)
{
	ll hoge = 1;
	ll ans = 0;
	for (int a = 0; a < 10; ++a)
	{

		ans += (num % (hoge * 10) - num % hoge) / (hoge);

		hoge *= 10;
	}

	return ans;

}


int main()
{

	ll num, mod;

	IN >> num;
	if (num % Add(num) == 0) puts("Yes");
	else puts("No");


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<algorithm>
#include<string>
#include<cstring>

using namespace std;



int main() {
	string flag = "KIHBR";
	string S;
	cin >> S;
	bool good = true;
	int j = 0;
	int count = 0;
	int Count[] = { 2, 1, 1, 2, 2, 2 };
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'A') {
			count++;
			if (count == Count[j]) {
				good = false;
				break;
			}
			continue;
		}
		if (j == 5) {
			good = false;
			break;
		}
		if (S[i] == flag[j]) {
			j++;
			count = 0;
		}
		else {
			good = false;
			break;
		}
	}
	if (good && j == 5)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/arc090/tasks/arc090_b

#include "algorithm"
#include "cmath"
#include "functional"
#include "iostream"
#include "numeric"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void check(ll u, VL& positions, V<V<PL>>& edge_list, V<bool>& visited) {
  visited[u] = true;

  for (auto e : edge_list[u]) {
    ll v = e.fi;
    ll c = e.se;

    ll n_pos = positions[u] + c;
    if (positions[v] != INF && positions[v] != n_pos) drop("No");
    positions[v] = n_pos;

    if (!visited[v]) check(v, positions, edge_list, visited);
  }
}

void solve() {
  ll N, M;
  cin >> N >> M;

  V<V<PL>> edge_list(N, VPL(0));

  rep(i, M) {
    ll l, r, d;
    cin >> l >> r >> d;
    l--, r--;

    edge_list[l].emplace_back(r, d);
    edge_list[r].emplace_back(l, -d);
  }

  VL positions(N, INF);

  rep(i, N) {
    if (positions[i] != INF) continue;
    V<bool> visited(N);
    positions[i] = 0;
    check(i, positions, edge_list, visited);
  }

  cout << "Yes" << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 18432
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
    static void createSgmt(int[] a, int[] s, int l, int h, int p){
        if(l == h){
            s[p] = a[l];
            return;
        }
        int mid = (l + h)/2;
        createSgmt(a, s, l, mid, 2*p + 1);
        createSgmt(a, s, mid + 1, h, 2*p + 2);
        
        s[p] = s[2*p + 1]*s[2*p + 2];
    }
    static int query(int[] s, int l, int h, int ql, int qh, int p){
        if(ql <= l && qh >= h){
            return s[p];
        }
        if(ql > h || qh < l){
            return 1;
        }
        int mid = (l+h)/2;
        
        return query(s, l, mid, ql, qh, 2*p + 1) * query(s, l, h, ql, qh, 2*p + 2);
    }
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    }
  public static void main(String[] args)throws Exception{
    FastReader in = new FastReader();
    int x = in.nextInt(), y = in.nextInt(), z = in.nextInt();
    System.out.println(z + " " + x + " " + y);
  }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
int n,f[3][110],a[3][110];
int Read()
{
	int x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return f*x;
}
int main()
{
//	freopen("candy.in","r",stdin);
//	freopen("candy.out","w",stdout);
	n=Read();
	for(int i=1;i<=2;i++)
	for(int j=1;j<=n;j++) a[i][j]=Read();
	f[1][1]=a[1][1];
	for(int i=1;i<=2;i++)
	for(int j=1;j<=n;j++) 
	{
		if(i==1) f[i][j]=f[i][j-1]+a[i][j];
		else f[i][j]=max(f[i][j-1],f[i-1][j])+a[i][j];
	}
	cout<<f[2][n];
	return 0;
}

Measured memory_bytes: 3540
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  long x, y;
  scanf("%ld%ld", &x, &y);
  long ans = 0;
  while (x <= y) {
    ans++;
    x *= 2;
  }
  printf("%ld\n", ans);
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

class Range {
	
	private boolean getRange(int n1, int n2, int n3) {
		return (n1 < n2) ? (n2 < n3 ? true : false) : false; 
	}
	
	public String compare(int n1, int n2, int n3) {
		if (getRange(n1, n2, n3)) {
			return "Yes";
		}
		return "No";
	}
}

public class Main {

	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String result = new Range().compare(scan.nextInt(), scan.nextInt(), scan.nextInt());
		System.out.println(result);

	}

}


Measured memory_bytes: 26240
n,k=list(map(int,input().split()))
li=[]
for i in range(n):
    a,b=list(map(int,input().split()))
    li.append((a,b))
li.sort()
for i in li:
    k-=i[1]
    if k<=0:
        print(i[0])
        exit()

Measured memory_bytes: 17012