akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

int main(){
    char a;
    cin >> a;
    if(isupper(a)){
        cout << 'A' << endl;
    }
    else{
        cout << 'a' << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3564
n, m = gets.chomp.split(" ").map(&:to_i)
a = [0]
1.upto(m) do |i|
  a[i] = gets.chomp.to_i
end

def combi2(n, k)
  $memo ||= {}
  key = "#{n},#{k}"
  return $memo[key] if $memo[key]
  num1 = 1
  num2 = 1
  1.upto(k) do |i|
    num1 *= (n - i + 1)
    num2 *= i
  end
  num = num1 / num2
  $memo[key] = num
  num
end

def n_pattern2(d)
  return 1 if d.zero?
  c = 0
  cc = nil
  0.upto(d / 2) do |i|
    n2 = i
    n1 = d - 2 * i
    nn = n1 + n2
    if n1.zero? || n2.zero?
      c += 1
    else
      if cc
        cl = nn
        cr = n2
        cc = cc * ((cl - cr + 1)..(cl - cr + 2)).inject(1, :*) / ((cl + 1) * cr)
        c += cc
      else
        cc = combi2(nn, n2)
        c += cc
      end
    end
  end
  c
end

c = 1
cur = 0
1.upto(m) do |i|
  if a[i] == cur
    puts 0
    exit
  end
  d = a[i] - cur - 1
  c *= n_pattern2(d)
  cur += d + 2
end
d = n - cur
c *= n_pattern2(d)
puts c % 1_000_000_007


Measured memory_bytes: 15356
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
vi primes, leastFac;
void compPrimes(int N) {
	F0R(i, N) {
		leastFac.pb(0);
	}
	leastFac[0] = 1; leastFac[1] = 1;
	FOR(i, 2, N) {
		if (leastFac[i] == 0) {
			primes.pb(i);
			leastFac[i] = i;
		}
		for (int j = 0; j < sz(primes) && i*primes[j] < N && primes[j] <= leastFac[i]; j++) {
			leastFac[i*primes[j]] = primes[j];
		}
	}
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    compPrimes(1000);
    int X; cin >> X;
    FOR(i, X, MX*10) {
        F0R(j, sz(primes)) {
            if (i % primes[j] == 0 && i != primes[j]) goto bad;
        }
        cout << i << endl; return 0;
        bad:;
    }
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,Q,top;
int64 sta[MAXN];
int64 cnt[MAXN],ans[MAXN];
void Solve() {
    read(N);read(Q);
    sta[++top] = N;
    int64 p;
    for(int i = 1 ; i <= Q ; ++i) {
	read(p);
	while(top && sta[top] >= p) --top;
	sta[++top] = p;
    }
    cnt[top] = 1;
    for(int i = top ; i >= 1 ; --i) {
	if(i != top) cnt[i] += cnt[i + 1] * (sta[i + 1] / sta[i]);
	if(i == 1) {ans[sta[1]] += cnt[1];continue;}
	int64 r = sta[i] % sta[i - 1];
	while(r > sta[1]) {
	    int t = upper_bound(sta + 1,sta + top + 1,r) - sta - 1;
	    cnt[t] += cnt[i] * (r / sta[t]);
	    r %= sta[t];
	}
	ans[r] += cnt[i];
    }
    for(int i = N ; i >= 1 ; --i) ans[i] += ans[i + 1];
    for(int i = 1 ; i <= N ; ++i) {
	out(ans[i]);enter;
    }
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 4096
// Believe in yourself
#include<bits/stdc++.h>

using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define Pair vector<pair<ll,ll>>
#define vec vector <ll> 
#define all(a) a.begin(),a.end()
#define mo 1000000007
#define decimal(i,n) fixed << setprecision(i) << n
#define show(a) for(auto xyz:a)cout<<xyz<<" ";cout<<endl;
#define show_nl(a) for(auto xyz:a)cout<<xyz<<endl;


void eea(ll a,ll b,ll &x,ll &y)
{
    if (a == 1)
    {
        x = 1; y = 0;
        return;
    }
    ll x1, y1;
    eea(b%a,a,x1,y1);
    x=y1-(b/a)*x1;
    y=x1;
}
ll mi(ll a,ll m)
{
    ll x,y;
    eea(a,m,x,y);
    x= (x%m+m)%m;
    return x;
}

/*
Enter the test case


Some helpful points
1.) Calm yourself
2.) check for semicolon or data type mismatch
*/

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);    
    ll t=1;
    // cin>>t;
    while(t--)
    {
       ll n,d;
      cin>>n>>d;
      ll c=0,p,q;
      for(ll i=0;i<n;i++)
      {
         cin>>p>>q;
        if(p*p+q*q<=d*d)
          c++;
      }
      cout<<c<<"\n";
    }
}



Measured memory_bytes: 3652
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7; 

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF_INT (1<<30)
#define INF_LL (1ll<<62)

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

int N,M;

int main(){    
    cin>>N>>M;
    if(N==M)out("Yes");
    else out("No");
}

Measured memory_bytes: 256
#include <stdio.h>
int A[1000000], n;
int binarySearch(int key) {
  int left = 0;
  int right = n;
  int mid;
  while(left < right) {
    mid = (left + right) / 2;
    if(key == A[mid]) return 1;
    if(key > A[mid]) left = mid + 1;
    else if(key < A[mid]) right = mid;
  }
  return 0;
}
int main(void) {
  int i, q, k, sum = 0;
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++) {
    scanf("%d",&k);
    if(binarySearch(k))
      sum++;
  }
  printf("%d\n",sum);
  return 0;
}


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

int mx(int a,int b){return max(a,b);}

int e(){return 0;}

int main(){
  int N,K;cin>>N>>K;
  segtree<int,mx,e> S(300001);
  for(int i=0;i<N;i++){
    int a;cin>>a;
    S.set(a,S.prod(max(a-K,0),min(a+K+1,300001))+1);//ふーん
  }
  
  cout<<S.prod(0,300001)<<endl;
}
  


Measured memory_bytes: 8580
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,C;
  cin>>n>>C;
  bool m[C][200001];
  memset(m,false,sizeof(m));
  int s,t,c;
  for(int i=0;i<n;i++){
    cin>>s>>t>>c;
    c--;
    for(int j=s*2-1;j<=t*2;j++) m[c][j]=true;
  }
  vector<int> a(200001,0);
  for(int i=0;i<C;i++){
    for(int j=0;j<200001;j++){
      if(m[i][j]) a[j]++;
    }
  }
  int cnt=0;
  for(int i=0;i<200001;i++)
    cnt=max(cnt,a[i]);
  cout<<cnt;
}


Measured memory_bytes: 6912
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <queue>
#include <sstream>
#include <unordered_map>
#include <cstring>
#include <iomanip>

using namespace std;

typedef long long ll;

const ll INF=1e9+7;

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

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

int main(){
    int N;
    vector<string> S(110);
    string O;
    map<string,int> A;
    cin>>N;
    rep(i,N)cin>>S[i];
    A[S[0]]++;
    O=S[0];
    for(int i=1;i<N;i++){
        string a=S[i];
        if(A[a]!=1&&a.front()==O.back()){
            A[a]++;
            O=a;
        }else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<string> poll(n);
    map<string,int> mp; 
    rep(i,n){
        cin >> poll[i];
        mp[poll[i]]++;
    }
    int maxi = 0;
    rep(i,n){
        maxi = max(maxi, mp[poll[i]]);
    }
    sort(all(poll));
    for(int i = 0; i < n;){
        if(mp[poll[i]] == maxi){
            dunk(poll[i]);
        }
        i += mp[poll[i]];
    }
    return 0;
}

Measured memory_bytes: 27136
while True:
    t, d, l = map(int, input().split())
    if t == 0:break
    a = [int(input()) for _ in range(t)]
    w = 0
    wd = 0
    for i in range(t):
        if a[i] >= l:
            if wd:
                w += 1
                wd = d
            else:
                wd = d
        else:
            if wd:
                w += 1
                wd -= 1
    print(w)
            


Measured memory_bytes: 14184
/**
  @date Time-stamp: <2019-04-27 21:24:30 tagashira>
  @file a.cpp
  @brief https://atcoder.jp/contests/abc123/tasks/abc124_b
**/

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  vector<int> C(0, N);
  vector<int> V(0, N);
  int tmpC, tmpV;
  int i;

  for (i = 0; i < N; i++) {
    cin >> tmpV;
    V.push_back(tmpV);
  }
  for (i = 0; i < N; i++) {
    cin >> tmpC;
    C.push_back(tmpC);
  }

  vector<int> sum(0, N);
  for (i = 0; i < N; i++) {
    sum.push_back(V[i] - C[i]);
  }

  sort(sum.begin(), sum.end());

  int result = 0;
  for (i = 0; i < N; i++) {
    if (sum[i] > 0) {
      result += sum[i];
    }
  }

  cout << result << "\n";

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string t;
  cin >> t;
  for(int i=0;i<t.size();i++){
    if(t.at(i)=='?'){
      t.at(i)='D';
    }
  }
  cout << t << endl;
}
  

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

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

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
	int n;
	double sum=0.0;
	cin>>n;
	
	rep(i,n){
	double a;
	cin>>a;
	sum+=1.0/a;
	}
	printf("%.15f\n",1.0/sum);
    return 0;
}













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

int main(){
ll A, B, C;
  cin >> A >> B >> C;
  int cnt = 0;

  while(true){
    if (A % 2 != 0 || B % 2 != 0 || C % 2 != 0)
    {
      cout << cnt << endl;
      return 0;
    }else if(A==B && B==C){
      cout << -1 << endl;
      return 0;
    }else{
    ll  t_A = A / 2;
    ll  t_B = B / 2;
    ll  t_C = C / 2;
      A=t_C + t_B;
      B=t_C + t_A;
      C=t_A + t_B;
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
s=input()
flag1=0
flag2=0
if 0<int(s[:2])<13:
  flag1=1
else:
  pass
if 0<int(s[2:])<13:
  flag2=1
else:
  pass

if flag1==0 and flag2==0:
  print("NA")
elif flag1==1 and flag2==0:
  print("MMYY")
elif flag1==0 and flag2==1:
  print("YYMM")
else:
  print("AMBIGUOUS")

Measured memory_bytes: 9176
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<stack>
#include<iomanip>
#include<functional>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int mod =1e9+7;

int main()
{
    int n;
    cin>>n;
    vector<int> b(n);
    vector<bool> ispushed(n,false);
    rep(i,n)
    {
        cin>>b[i];
    }
    int ans=0;
    int now=0;
    ispushed[0]=true;
    while(now!=1)
    {
        now=b[now];
        now--;
        ans++;
        if(ispushed[now])
        {
            ans=-1;
            break;
        }
        ispushed[now]=true;
    }
    cout<<ans;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep(a,n) for(int i=a;i<n;i++)
#define rep1(a,n) for(int i=a;i<=n;i++)
int main()
{
   int n,l,sum=0,mini,maxi;
   cin>>n>>l;
   mini=l;
   maxi=l+n-1;

   rep1(mini,maxi)
     sum+=i;

    if(maxi<0&&mini<0)
        cout<<sum-maxi<<"\n";
    else if(mini>0&&maxi>0)
        cout<<sum-mini<<"\n";
    else
      cout<<sum<<"\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

template <typename T>
struct SegmentTree {
  using F = function<T(T, T)>;

  int n;
  T init;
  F f;
  vector<T> data;

  SegmentTree() {}
  SegmentTree(int n_, vector<T> v = vector<T>(),
              F f = [](T a, T b) { return max(a, b); }, T init = -1)
      : f(f), init(init) {
    n = 1;
    while (n < n_) n *= 2;
    data.assign(n * 2 - 1, init);
    if (n_ == v.size()) build(v);
  }
  void build(vector<T> v) {
    for (int i = 0; i < v.size(); ++i) data[i + n - 1] = v[i];
    for (int i = n - 2; i >= 0; --i) {
      data[i] = f(data[i * 2 + 1], data[i * 2 + 2]);
    }
  }
  void update(int k, T x) {
    k += n - 1;
    data[k] = x;
    while (k > 0) {
      k = (k - 1) / 2;
      data[k] = f(data[k * 2 + 1], data[k * 2 + 2]);
    }
  }
  T query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if (b <= l || r <= a) return init;
    if (a <= l && r <= b) return data[k];
    T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return f(vl, vr);
  }
};

int main() {
  int n, m;
  cin >> n >> m;
  vector<P> p;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a > m) continue;
    p.push_back({b, a});
  }
  sort(rbegin(p), rend(p));
  vector<int> v(m);
  for (int i = 0; i < m; i++) v[i] = i;
  SegmentTree<int> seg(m, v);
  int ans = 0;
  for (int i = 0; i < p.size(); i++) {
    int a, b;
    tie(b, a) = p[i];
    int cur = seg.query(0, m - a + 1);
    if (cur < 0) continue;
    seg.update(cur, -1);
    ans += b;
  }
  cout << ans << endl;
}


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

#define PrintLn(X) cout << X << endl
#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)

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

	cout << ((a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
long long int m=1000000007;
long long int power(long long int p,long long int k)
{
long long int a=1;
while(k)
{
if(k&1)
a=(a*p)%m;
p=(p*p)%m;
k>>=1;
}
return a;
}
int main()
{
ll n,i;
double ans=0;
cin>>n;
ll a[n];
for(i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
ans=a[0];
for(i=1;i<(n);i++)
ans=(ans+a[i])/2;
cout<<ans;
return 0;
}
 

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

#define ll long long int
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

using namespace std;

ll inf=1e18;
ll mod=(ll)10e9+7;
double pi=3.1415926535897932384626433832795;
ll i, j;
ll N=1e5;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    string s;
    cin>>s;
    string s1;
    if(s.size()<4)
        cout<<"No"<<endl;
    else
    {
        s1=s[0];
        s1=s1+s[1];
        s1=s1+s[2];
        s1=s1+s[3];
        if(s1=="YAKI")
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5+3;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	ll n; ll s;
	cin>>n;
	s = 0;
	ll m = n;
	while(m>0){
		s += m%10;
		m /= 10;
	}
	cout<<(n%s==0?"Yes":"No")<<endl;

	return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np
import numba  # noqa
from numba import njit, b1, i4, i8, f8  # noqa

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main(T):
    if T >= 30:
        return "Yes"
    else:
        return "No"


T = int(readline())

print(main(T))


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
	int ab,bc,ca;cin>>ab>>bc>>ca;
    cout<<ab*bc/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int H, W;
  int h, w;
  while(1) {
    scanf("%d%d", &H, &W);
    if(H==0 && W==0) break;
    for (h = 0; h < H; h++) {
      for (w = 0; w < W; w++) {
        if(w == (W -1) || w == 0 || h == 0 || h == (H - 1)) {
          printf("#");
        } else {
          printf(".");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2148
#include <bits/stdc++.h>
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
 
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}
 
void solve(){
 
 
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();

    vi c;
    int n;cin>>n;
    c.resize(n,0);
    rep(i,n-1){
        int x;cin>>x;c[--x]++;
    }
    rep(i,n)cout<<c[i]<<'\n';

	return 0;
}
 



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

long long gcd(long long a, long long b){
    if(b){
        return gcd(b, a % b);
    }else{
        return a;
    }
}

int main(void){
    int n;
    cin >> n;
    
    long long ans = 1;
    long long t;
    int i;
    for(i = 1; i <= n; i++){
        cin >> t;
        ans = ans / gcd(t, ans) * t;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
// She is Pretty pretty!
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

const int N = 1e6 + 100;
const ll mod = 1e9 + 7;
int pre[N], suf[N];
int32_t main() {
    // ios_base::sync_with_stdio(0);
    // cin.tie(0);
    // cout.tie(0);
    int n, k;
    cin >> n >> k;
    if (n < k) return cout << 1 << endl, 0;
    // 2 3~2n-1
    // 3 6~3n-3

    for (int i = 1; i <= 1+n; i++) {
        pre[i] = pre[i - 1] + i;
        pre[i] %= mod;
        // printf("pre[%lld] == %lld\n", i , pre[i]);
    }
    cout << endl;
    for (int i = 1; i <= n+1; i++) {
        suf[i] = suf[i - 1] + (n + 2 - i);
        suf[i] %= mod;
        // printf("suf[%lld] == %lld\n", i , suf[i]);
    }

    int ans = 0;
    for (int i = k; i <= n+1; i++) {
        ans = (ans + mod  + suf[i] - pre[i] + 1) % mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6720
import sys
sys.setrecursionlimit(10**5)

def main():
    n=int(input())
    nodes=[[]for _ in range(n)]
    mod=10**9+7

    for _ in range(n-1):
        x,y=map(int,input().split())
        nodes[x-1].append(y-1)
        nodes[y-1].append(x-1)

    def pick(n,excep=-1):
        white=1
        black=1
        for node in nodes[n]:
            if excep==node:
                continue
            p=pick(node,n)
            white=(white*(p[0]+p[1]))%mod
            black=(black*p[0])%mod
        return [white,black]
    p=pick(0)
    print(sum(p)%mod)
main()

Measured memory_bytes: 117808
while True:
  n = int(input())
  if n == 0:
    break
  c = 10000
  for i in range(n//500+1):
    n1 = n - 500*i
    c1 = (850*3*0.88)*(i//3)+850*(i%3) 
    for j in range(n1//300+1):
      n2 = n1 - 300*j
      if n2 % 200 == 0:
        k = n2 // 200
        c2 = c1 + (550*4*0.85)*(j//4)+550*(j%4)+(380*5*0.8)*(k//5)+380*(k%5)
        if c2 <= c:
          c = c2
  print(int(c))

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1'000'000'007

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

ll dp[111111];
bool ng[111111];

void modAdd(ll &a, ll b){
	a += b;
	a %= MOD;
}

int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
	ll n, m;cin >> n >> m;
	REP(i, m){
		ll a;cin >> a;ng[a] = true;
	}
	dp[0] = 1;
	REP(i, n){
		if(!ng[i+1])modAdd(dp[i+1], dp[i]);
		if(!ng[i+2])modAdd(dp[i+2], dp[i]);
	}
	cout << dp[n] << endl;
	return 0;
}


Measured memory_bytes: 1152
X = input()

last2 = int(X[len(X)-2:])
try_num = int(X) //100

if try_num >= 20:
    print(1)
    exit(0)

for i in range(try_num):
    if last2 > 5:
        last2 -= 5
    else:
        print(1)
        exit(0)
print(0)

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;

long long int dp[101][10][1001];

int main(void) {

  dp[0][0][0] = 1;
  for(int i=1; i<=100; i++){
    for(int j=0; j<10; j++){
      for(int k=0; k<=1000; k++){
        dp[i][j][k] = dp[i-1][j][k];
        if( k - i < 0 || j == 0 ) continue;
        dp[i][j][k] += dp[i-1][j-1][k-i];
      }
    }
  }

  int n, s;
  while(cin >> n >> s){
    if( n == 0 && s == 0 ) break;
    cout << dp[100][n][s] + dp[100][n-1][s] << endl;
  }


  return 0;
}

// EOF

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

using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define mp make_pair
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int> > small_heap;
typedef priority_queue<int> big_heap;
int T;

int n, k;
ll ans = 1;
int l_neg = -1, l_pos = -1, r_neg = -1, r_pos = -1;
const ll M = 1e9 + 7;

inline bool cmp(ll a, ll b) {
    return abs(a) < abs(b);
}

int calc(vector<ll> a) {
    ll ret = 1;
    for (int i = n - k; i < n; i++)
        (ret *= a[i]) %= M;
    return ret;
}

inline int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}

int main() {
    n = read(), k = read();
    vector<ll> a(n, 0);
    for (register int i = 0; i < n; ++i) a[i] = read();
    sort(a.begin(), a.end(), cmp);
    for (register int i = n - k; i < n; ++i) {
        (ans *= a[i]) %= M;
        if (r_pos == -1 && a[i] > 0) r_pos = i;
        if (r_neg == -1 && a[i] < 0) r_neg = i;
    }
    for (register int i = n - k - 1; ~i; --i) {
        if (l_pos == -1 && a[i] > 0) l_pos = i;
        if (l_neg == -1 && a[i] < 0) l_neg = i;
    }
    if (ans < 0 && n > k) {
        if (r_pos == -1) {
            if (l_pos == -1) {
                ans = 1;
                for (int i = 0; i < k; ++i)
                    (ans *= a[i]) %= M;
            } else {
                swap(a[l_pos], a[r_neg]);
                ans = calc(a);
            }
        } else {
            if (l_neg == -1) {
                swap(a[l_pos], a[r_neg]);
                ans = calc(a);
            } else if (l_pos == -1) {
                swap(a[l_neg], a[r_pos]);
                ans = calc(a);
            } else {
                vector<ll> c1 = a;
                vector<ll> c2 = a;
                swap(c1[l_neg], c1[r_pos]);
                swap(c2[l_pos], c2[r_neg]);
                ans = (abs(a[l_neg] * a[r_neg]) > abs(a[l_pos] * a[r_pos])) ? calc(c1) : calc(c2);
            }
        }
    }
    cout << (ans % M + M) % M << endl;
    return 0;
}

Measured memory_bytes: 9484
n = int(input())
h = list(map(int, input().split()))

dp =[float('inf') for i in range(n)]
dp[0]=0

for i in range(n-1):
  dp[i+1] = min(dp[i+1], dp[i]+abs(h[i+1]-h[i]))
  if i < n-2:
    dp[i+2] = min(dp[i+2], dp[i]+abs(h[i+2]-h[i]))
print(dp[n-1])
                

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

#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < int(n); i++)

#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
const int MOD = 1000000007;

std::vector<int> graph[100001];
ll dp[100001][2];

ll fun(int node, int parent_color, int parent) {
    if(node != 1 && graph[node].size() == 1) {
        if(parent_color == 1) return dp[node][parent_color] = 1;
        else return dp[node][parent_color] = 2;
    }
    if(dp[node][parent_color] != -1) return dp[node][parent_color];
    ll ans = 1;
    for(int x : graph[node]) {
        if(x != parent) {
            ans *= fun(x, 0, node);
            ans %= MOD;
        }
    }
    if(parent_color == 1) return dp[node][parent_color] = ans;
    ll ans1 = 1;
    for(int x : graph[node]) {
        if(x != parent) {
            ans1 *= fun(x, 1, node);
            ans1 %= MOD;
        }
    }
    ans += ans1;
    ans %= MOD;
    return dp[node][parent_color] = ans;
}

int main() {
    IOS;
    memset(dp, -1, sizeof(dp));
    int n, u, v;
    cin >> n;
    if(n == 1) {
        cout << "2";
        return 0;
    }
    rep(i, n - 1) {
        cin >> u >> v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }
    cout << fun(1, -1, 0) ;
    return 0;
}

Measured memory_bytes: 15616
X = int(input())
if 400<=X<600:
    print(8)
elif 600<=X<800:
    print(7)
elif 800<=X<1000:
    print(6)
elif 1000<=X<1200:
    print(5)
elif 1200<=X<1400:
    print(4)
elif 1400<=X<1600:
    print(3)
elif 1600<=X<1800:
    print(2)
elif 1800<=X<2000:
    print(1)

Measured memory_bytes: 9188
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
EPS = 10 ** -10

class ModTools:
    """ 階乗・逆元用のテーブルを構築する """

    def __init__(self, MAX, MOD):
        
        MAX += 1
        self.MAX = MAX
        self.MOD = MOD
        factorial = [1] * MAX
        factorial[0] = factorial[1] = 1
        for i in range(2, MAX):
            factorial[i] = factorial[i-1] * i % MOD
        inverse = [1] * MAX
        inverse[MAX-1] = pow(factorial[MAX-1], MOD-2, MOD)
        for i in range(MAX-2, -1, -1):
            inverse[i] = inverse[i+1] * (i+1) % MOD
        self.fact = factorial
        self.inv = inverse
    
    def nCr(self, n, r):
        """ 組み合わせ """

        if n < r: return 0
        r = min(r, n-r)
        numerator = self.fact[n]
        denominator = self.inv[r] * self.inv[n-r] % self.MOD
        return numerator * denominator % self.MOD

    def nHr(self, n, r):
        """ 重複組み合わせ """

        return self.nCr(r+n-1, r)

    def nPr(self, n, r):
        """ 順列 """

        if n < r: return 0
        return self.fact[n] * self.inv[n-r] % self.MOD

    def div(self, x, y):
        """ MOD除算 """

        return x * pow(y, self.MOD-2, self.MOD) % self.MOD

N, K = MAP()

mt = ModTools(N+K+1, MOD)
ans = mt.nCr(N-1, K-1)
print(ans%MOD)



Measured memory_bytes: 5820
X = int(input())
forward = 0
for i in range(100000):
    if i * (i + 1) // 2 > X:
        forward = i - 1
        break
        
if (X - forward * (forward + 1) // 2)  == 0:
    print(forward)
else:
    print(forward + 1)

Measured memory_bytes: 2940
# Segment tree (+)
from operator import add
from sys import stdin


class SegmentTree:
    _f = None
    _data = None
    _offset = None
    _size = None

    def __init__(self, size, f):
        self._f = f
        self._size = size
        t = 1
        while t < size:
            t *= 2
        self._offset = t - 1
        self._data = [0] * (t * 2 - 1)

    def update(self, index, value):
        f = self._f
        data = self._data
        i = self._offset + index
        data[i] = value
        while i >= 1:
            i = (i - 1) // 2
            data[i] = f(data[i * 2 + 1], data[i * 2 + 2])

    def query(self, start, stop):
        def iter_segments(data, l, r):
            while l < r:
                if l & 1 == 0:
                    yield data[l]
                if r & 1 == 0:
                    yield data[r - 1]
                l = l // 2
                r = (r - 1) // 2
        f = self._f
        it = iter_segments(self._data, start + self._offset,
                           stop + self._offset)
        result = next(it)
        for e in it:
            result = f(result, e)
        return result


readline = stdin.readline

N, M = map(int, readline().split())
ab = [list(map(int, readline().split())) for _ in range(M)]

ab.sort(key=lambda x: x[1])
st = SegmentTree(N - 1, add)

result = 0
for a, b in ab:
    a, b = a - 1, b - 1
    if st.query(a, b) != 0:
        continue
    result += 1
    st.update(b - 1, 1)
print(result)


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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
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;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    int n;
    cin >> n;
    int ans = 1;
    for(int i=1;i<=6;i++){
        if(n>=pow(2,i)){
            ans = pow(2,i);
        }
    }
    cout << ans << endl;
}

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

int main()
{
    int N;
    cin >> N;
    int Ai;
    vector<int> A;
    vector<int> dp(N, 0);
    for(int i=0;i<N;i++){
        cin >> Ai;
        A.push_back(Ai);
    }
    for(int i=N-1;i>=0;i--){
        int tmp = 0;
        for(int j=2;(i+1)*j<=N;j++){
            if(dp[(i+1)*j-1]) tmp ^= 1;
        }
        dp[i] = (A[i] ^ tmp);
    }
    vector<int> res;
    for(int i=0;i<N;i++){
        if(dp[i]) res.push_back(i);
    }
    cout<<res.size()<<endl;
    for(auto v : res) cout<<(v+1)<<" ";
    if(res.size()>0) cout<<endl;

    return 0;
}

Measured memory_bytes: 3444
#include<stdio.h>
int main ()
{
    int a,b,i;
    long long int sum=0;
    scanf("%d",&a);
    for (i=1;i<=a;i++)
    {
        if (i%3!=0 && i%5!=0)
        {
           sum=sum+i;
        }
    }
    printf ("%lld\n",sum);
    return 0;
}


Measured memory_bytes: 1708
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int A, B, C; cin >> A >> B >> C;
  string result;
  if (A<=C && B>=C) result = "Yes";
  else result = "No"; 
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

template<class T, class Cond>
struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  bool operator()(T& a, const T& b) const {
    if(cond(a, b)) { a = b; return true; }
    return false;
  }
};
template<class T, class Cond>
chain<T, Cond> make_chain(Cond cond) { return chain<T, Cond>(cond); }

int main() {
  vector<i64> A{ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
  i64 K;
  cin >> K;
  cout << A[K - 1] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>

std::map<unsigned int, size_t> memo;

size_t solv(unsigned int n) {
  if (n < 6) {
    return n;
  }

  if (memo.count(n) == 1) {
    return memo.at(n);
  }

  size_t ans = solv(n-6);
  for (unsigned m=6*6; m<=n; m*=6) {
    size_t r = solv(n-m);
    if (r < ans) ans = r;
  }

  for (unsigned m=9; m<=n; m*=9) {
    size_t r = solv(n-m);
    if (r < ans) ans = r;
  }

  memo.insert(std::make_pair(n, ans+1));

  return ans+1;
}


int main() {
  unsigned int n;

  std::cin >> n;

  std::cout << solv(n) << std::endl;

  return 0;
}


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

int n, a_sum, b_sum, ans = 0x3f3f3f3f;

int main() {
    scanf("%d", &n);
    for (register int a = 1; a < n; ++a) {
        register int aa = a, bb = n - aa;
        a_sum = b_sum = 0;
        while (aa) {
            a_sum += aa % 10;
            aa /= 10;
        }
        while (bb) {
            b_sum += bb % 10;
            bb /= 10;
        }
        ans = min(ans, a_sum + b_sum);
    }
    printf("%d", ans);
    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 REPR(i, n) for(int i = n - 1; 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 pb(a) push_back(a)

ll mod = 1e9 + 7;

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

  int a, b, c;
  cin >> a >> b >> c;
  int ans = b / a;
  ans = min(ans, c);
  cout << ans << endl;
  return 0;
}


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

using namespace std;

using ll = long long;

int main() {
    #if __APPLE__
        freopen("in", "r", stdin);
        freopen("out", "w", stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie();
    int n;
    ll a, b;
    cin >> n >> a >> b;
    vector<ll> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    ll l = -1, r = 2e9, d = a - b;
    while (r - l > 1) {
        ll m = (l + r) / 2ll;
        ll cnt = 0;
        for (ll x : v) {
            ll left = x - b * m;
            if (left > 0ll) {
                cnt += left / d + (left % d != 0);
            }
        }
        if (cnt <= m) r = m;
        else l = m;
    }
    cout << r << '\n';
}


Measured memory_bytes: 1024
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int num = 0;
    int n0 = n;
    while(n){
        num += n % 10;
        n /= 10;
    }
    prints(n, num);
    cout << (n0 % num == 0 ? "Yes" : "No") << '\n';
}


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

long long dp[3001][3001];

int main(){
    int n;cin>>n;
    long a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }

    for(int i=n-1;i>=0;i--){
        for(int j=i;j<n;j++){
            if(i==j){
                dp[i][j]=a[i];
            }
            else{
                dp[i][j]=max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
            }
        }
    }
    cout<<dp[0][n-1];

}


Measured memory_bytes: 70016
x,y,z,k = map(int,input().split())

info = [list(map(int,input().split())) for i in range(3)]
info[0]=sorted(info[0],reverse=True)
info[1]=sorted(info[1],reverse=True)
info[2]=sorted(info[2],reverse=True)
li = []
ans = []
li_append = li.append 
ans_append = ans.append

for i in info[0]:
  for j in info[1]:
    li_append(i+j)
li = sorted(li,reverse=True)

for i in li[:3000]:
  for j in info[2]:
    ans_append(i+j)
ans = sorted(ans,reverse = True)

for i in range(k):
  print(ans[i])

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

int main()
{
    int n;
    cin >> n;
    string res = "";
    while(n != 0)
    {
        if(n % 2 == 0) res = "0" + res;
        else
        {
            res = "1" + res;
            n--;
        }
        n /= -2;
    }
    if(res == "") res = "0";
    cout << res << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,a,b,c,h[1000],i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d%d",&a,&b,&c);
		if(a*a==b*b+c*c || b*b==a*a+c*c || c*c==b*b+a*a)
			h[i]=0;
		else h[i]=1;
	}
	for(i=0;i<n;i++){
		if(h[i]==0)printf("YES\n");
		else printf("NO\n");
	}
		return 0;
}

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

int main() {
  int a,b; cin >> a >> b;
  if(a>=13) cout << b << endl;
  else if(a<=5) cout << 0 << endl;
  else cout << b/2 << endl;
}

Measured memory_bytes: 3576
import java.util.*;

class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
      for(;;){
        int s=sc.nextInt(); if(s==0)break; 
      for(int i=0;i<9;i++)s-=sc.nextInt();
    System.out.println(s);
    }
    }
    }

Measured memory_bytes: 17200
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	N := sc.NextInt()

	if N%2 == 1 {
		fmt.Println(0)
		return
	}

	k := N / 2
	cnt := 0
	for k > 0 {
		cnt += k / 5
		k /= 5
	}
	fmt.Println(cnt)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

template<typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &x : v) is >> x;
  return is;
}

const long long mod = 1e9 + 7;

int main() {
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; cin >> n;
	vector<long long> a(n); cin >> a;
	long long ans = 0, sum = 0;
	for (int i = 0; i < n; i++) {
		if (i) {
			ans = (ans + ((sum * a[i]) % mod)) % mod;
		}
		sum = (sum + a[i]) % mod;
	}
	cout << ans << '\n';
}


Measured memory_bytes: 4776