akhauriyash/Code-Regression huggingface dataset:
//////// Don't_be_late 
// https://atcoder.jp/contests/abc177/tasks/abc177_a
// date: 2020-08-29T21:00:28.777315
// memo: 

//<editor-fold desc="my macro">

#include<bits/stdc++.h>
#ifdef LOCAL
    #include<my/dump.h>
#else
    #define dump(...) 42 
    #define dumpi(x) 42 
#endif

typedef long long ll;
using namespace std;

#define repe(x, a) for(auto& (x) : (a))
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rep3(i, a, b) for(ll i=a, i##_len=(b);i<i##_len;i++)
#define _rep2(i, n) _rep3(i,0,n)
#define repd(...) _overload3(__VA_ARGS__,_repd3,_repd2,)(__VA_ARGS__)
#define _repd3(i, a, b) for(ll i=b-1, i##_len=(a);i>=i##_len;i--)
#define _repd2(i, n) _repd3(i,0,n)
#define loop(...) _overload3(__VA_ARGS__,,_loop2,_loop1)(__VA_ARGS__)
#define _loop2(i, a) for(ll i=a;; i++)
#define _loop1(i) _loop2(i,0)

#define all(x) x.begin(),x.end()
#define SIZE(x) ((ll)(x).size())

#define F first
#define S second
#define vec vector
#define umap unordered_map
#define uset unordered_set

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

#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define inrange(x,start,stop) ((start) <= (x) && (x) < (stop))
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; }

template <typename Cont, typename Func>
Cont fmap(const Cont &container, Func functor) {
    Cont result(container.size());
    std::transform(container.begin(), container.end(), result.begin(), functor);// [](int x){return x * 2;}
    return result;
}
template <typename Cont, typename Pred>
Cont filter(const Cont &container, Pred predicate) {
    Cont result;
    std::copy_if(container.begin(), container.end(), std::back_inserter(result), predicate);// [](int x){return x == 2;}
    return result;
}   

template<typename T, typename ...Args>
void ci(T& first, Args&... args) {
    ((cin >> first), ..., (cin >> args)); //C++17
}

template<char Sep, typename T, typename ...Args>
void print_seq(const T& first, const Args&... args) {
    ((cout << first), ..., (cout << Sep << args)); //C++17
}

void co(){ cout << endl; }
template<typename... Words>
void co(Words... words) {
    print_seq<' '>(words...);
    cout << endl;
}
#define coi(x) cout<<(x)<<" "

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define sankou(n,a,b) cout << ((n) ? (a) : (b) ) << endl

#define asrt(expr...) assert((expr))
//</editor-fold>

#define INF 1e19
#define MOD 1e9+7
#define MAXR 1e5

int solve() {
    ll D,T,S;
    ci(D,T,S);
//    co(D <= T * S );
    Yes(D <= T * S );
    return 0;

}

int main(){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    
    solve();
    return 0;
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int X, Y; cin >> X >> Y;

  if(X == Y) {
    cout << 0 << endl;
    exit(0);
  }

  if(X == 0) {
    if(Y < 0) {
      cout << -Y + 1 << endl;
    }
    else {
      cout << Y << endl;
    }
  }
  else if(Y == 0) {
    if(X > 0) {
      cout << X + 1 << endl;
    }
    else {
      cout << -X << endl;
    }
  }



  else if(X < 0 && Y < 0) {
    if(X < Y) {
      // direct
      // OK
      cout << Y - X << endl;
    }
    else {
      if(-X < -Y) {
        // OK ???
        cout << -Y + X + 2 << endl;
      }
      else {
        // OK
        cout << X << ", " << Y << endl;
        assert(0);
      }
    }
  }
  else if(X > 0 && Y < 0) {
    if(-X < Y) {
      // kuso
      cout << Y - -X + 1 << endl;
    }
    else { // -X > Y
      // tsurai
      cout << -Y - X + 1 << endl;
    }
  }
  else if(X < 0 && Y > 0) {
    if(-X < Y) {
      // OK ?
      cout << min(Y - -X + 1, Y - X) << endl;
    }
    else {
      // OK ?
      cout << min(Y - X, -X - Y + 1) << endl;
    }
  }
  else {
    if(X < Y) {
      // OK
      cout << Y - X << endl;
    }
    else {
      // OK
      cout << X - Y + 2 << endl;
    }
  }
  
  return 0;
}

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

int a[200010];
int main()
{
    int n; cin>>n;
    int s=0;
    for(int i=0; i<n; ++i) {
        cin>>a[i];
        s^=a[i];
    }
    for(int i=0; i<n; ++i) cout<<(s^a[i])<<' ';
    cout<<endl;
}



Measured memory_bytes: 4368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	string t;
	rep(i,s.size()){
		if(s[i]!='B'){
			t+=s[i];
		}else{
			if(!t.empty()){
				t.erase(t.end()-1);
			}
		}
	}
	cout<<t<<endl;
}

Measured memory_bytes: 256
#! ruby -Ku

d = []
n,z,w = gets.chomp.split(" ").map(&:to_i)

d = gets.chomp.split(" ").map(&:to_i)

if n == 1 then
	puts (d[0]-w).abs
else
	puts [(d[n-1]-w).abs,(d[n-1]-d[n-2]).abs].max
end

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

class Program
{
    static void Main(string[] args)
    {
        solve();
    }
    static Scanner cin;

    static int N;
    static void input()
    {
        cin = new Scanner();
        N = cin.nextInt();
    }
    static void solve()
    {
        input();
        int[] bukket = new int[N];
       
        for(int n = 2; n <= N; n++)
        {
            int value = n;
            for(int i = 2; i <= value;)
            {
                if (value % i == 0)
                {
                    bukket[i - 1]++;
                    value /= i;
                }
                else
                    i++;
            }
        }
        long ans = 1;
        for(int i = 0; i < N; i++)
        {
            if(bukket[i] != 0)
                ans = (ans * (bukket[i] + 1)) % 1000000007;
        }
        WriteLine(ans);
    }

    
    class Scanner
    {
        string[] s;
        int i;

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

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }
        
        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

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

        public long nextLong()
        {
            return long.Parse(next());
        }

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

        public double nextDouble()
        {
            return double.Parse(next());
        }

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

Measured memory_bytes: 13140
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (int)(n); (i)++)
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; (i)--)
#define For(i, a, b)    for(int i = (a); (i) < (int)(b) ; (i)++)
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };



/*--------additional--------*/

bool judge(vector<vector<int>> &_G,vector<ll> &_h, int p){

    for(auto x : _G[p]){
        if(_h[p] <= _h[x]) return false;
    }

    return true;
}

/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n; cin >> n;
    set<string> p;

    rep(i, n){
        string s; cin >> s;
        p.insert(s);
    }

    cout << p.size() << endl;

return 0;
}

Measured memory_bytes: 19144
#include <bits/stdc++.h>
using namespace std;
int main(){
	string a,b;
	cin >> a >> b;
	if(a.length()< b.length()){
		cout <<"LESS";
		return 0;
	}
	else if(a.length() > b.length()){
		cout << "GREATER";
		return 0;
	}
	for(int i=0;i<a.length();++i){
		if(a[i]-'0' > b[i] - '0'){
			cout << "GREATER";
			return 0;
		}
		else if(a[i]-'0' < b[i] - '0'){
			cout << "LESS";
			return 0;

		}
	}
	cout << "EQUAL";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
bool check(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
    if (x1!=x2) {
        double m = (y2-y1)/(x2-x1);
        if (y3-y1>m*(x3-x1)&&y4-y1<m*(x4-x1)) return true;
        else if (y3-y1<m*(x3-x1)&&y4-y1>m*(x4-x1)) return true;
        else return false;
    } else {
        if (x3>x1&&x4<x1) return true;
        else if (x3<x1&&x4>x1) return true;
        else return false;
    }
}
int main() {
    double xa,ya,xb,yb,xc,yc,xd,yd;
    while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf", &xa, &ya, &xb, &yb, &xc, &yc, &xd, &yd) != EOF) {
        if (check(xa,ya,xc,yc,xb,yb,xd,yd)&&check(xb,yb,xd,yd,xa,ya,xc,yc)) puts("YES");
        else puts("NO");
    }
}

Measured memory_bytes: 0
#include <stdio.h>
#define INF 1000000001
#define N 500000
int comp=0;
int L[N],R[N];
void merge(int *A, int left, int mid, int right);
void mergeSort(int *A,int left,int right);

int main(void){
int A[N],i,n,left, mid, right;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&A[i]);
left=0;
right=n;
mergeSort(A, left, right);
for(i=0;i<n;i++){printf("%d",A[i]);
	if(i<n-1)printf(" ");
	else printf("\n");
	}
printf("%d\n",comp);
return 0;
}

void merge(int *A, int left, int mid, int right){
int  n1,n2,i,j,k;
  n1 = mid - left;
  n2 = right - mid;
  for(i = 0;i<n1;i++)L[i] = A[left + i];
  for(i = 0;i<n2;i++)R[i] = A[mid + i];
  L[n1] = INF;
  R[n2] = INF;
  i = 0;
  j = 0;
//  for(k = left;k<right-1;k++) {
  for(k = left;k<=right-1;k++) {
    comp++;
    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
    }
    else {
      A[k] = R[j];
      j = j + 1;
    }
    }
}
void mergeSort(int *A,int left,int right){
int mid;
  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
    }
}



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

int main() {
  int A, B, M;
  cin >> A >> B >> M;
  
  vector<int> a(A), b(B);
  
  for (int i = 0; i < A; i++) cin >> a.at(i);

//  int minA = *min_element(a.begin(), a.end());
  int minA = a.at(0);
  for (int i = 0; i < A; i++) {
    if (a.at(i) < minA) {
      minA = a.at(i);
    }
  }
    
  for (int j = 0; j <B; j++) cin >> b.at(j);

  int minB = *min_element(b.begin(), b.end());  
//  int minB = b.at(0);
//  for (int j = 0; j < B; j++) {
//    if (j < minB) {
//      minB = b.at(j);
//    }
//  }
  
  int minAB = minA + minB; 
  
  vector<int> x(M), y(M), c(M);
  
  for (int k = 0; k < M; k++) {  
  cin >> x.at(k) >> y.at(k) >> c.at(k);
  }
  
  int minm = a.at(x.at(0) - 1) + b.at(y.at(0) - 1) - c.at(0);

  for (int k = 0; k < M; k++) {
    if (a.at(x.at(k) - 1) + b.at(y.at(k) - 1) - c.at(k) < minm) {
      minm = a.at(x.at(k) - 1) + b.at(y.at(k) - 1) - c.at(k);
    }  
  }

  cout << min(minAB, minm) << endl;
}


Measured memory_bytes: 2304
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int c[4] = {};
    for (int i = 0; i < n; i++) { int a; cin >> a; c[a]++; }
    double dp[302][302][302] = {};
    for (int k = 0; k <= c[3]; k++)
        for (int j = 0; j <= c[2]+c[3]; j++)
            for (int i = 0; i <= c[1]+c[2]+c[3]; i++) {
                if (i+j+k == 0) continue;
                if (i > 0) dp[i][j][k] += dp[i-1][j][k] * i / n;
                if (j > 0) dp[i][j][k] += dp[i+1][j-1][k] * j / n;
                if (k > 0) dp[i][j][k] += dp[i][j+1][k-1] * k / n;
                dp[i][j][k] += 1;
                dp[i][j][k] *= (double)n / (i+j+k);
            }
    cout << setprecision(12) << dp[c[1]][c[2]][c[3]] << endl;
}


Measured memory_bytes: 215424
#include<iostream>
#include<iomanip>
#include<cstdio>

#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
const int INF = 1e9+1;

int N,A[100000];

int gcd(int a, int b) {
    if (a == 0) return b;
    return gcd(b % a, a);
}

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    //left[i] iまでの累積gcd
    //O(n^2)からO(n)に落とすためのコツの一つ、累積計算結果を配列に保存しておき再利用する
    vector<int> left(N), right(N);
    left[0] = A[0];
    for (int i = 1; i < N; i++) {
        left[i] = gcd(left[i-1],A[i]);
    }
    right[N-1] = A[N-1];
    for (int i = N - 2; i >= 0; i--) {
        right[i] = gcd(right[i+1],A[i]);
    }

    int res = -1;
    chmax(res, right[1]);
    chmax(res, left[N-2]);
    for (int i = 1; i < N - 1; i++) {
        chmax(res, gcd(left[i-1],right[i+1]));
    }

    cout << res << endl;

}


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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i,n) cin >> s[i];
  
  set<string> a;
  rep(i,n) a.insert(s[i]);
  int ans = a.size();
  cout << ans << endl;
}


Measured memory_bytes: 24944
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<int> dp(45);
    int N;
    cin >> N;
    dp[0] = 1;
    dp[1] = 1;
    for(int i=2; i<=N; i++) dp[i] = dp[i-1] + dp[i-2];

    cout << dp[N] << endl;

    return 0;
}



Measured memory_bytes: 3208
N,C,*D=`dd`.split.map &:to_i
a=[],[],[]
(N*N).times{|i|a[(i/N+i%N)%3]<<D.pop}
s,t,u=a.map{|e|(0...C).map{|t|s=0;e.map{|f|s+=D[~-f*C+t]};s}}
p [*0...C].permutation(3).map{|x,y,z|s[x]+t[y]+u[z]}.min

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

int main() {
	//入力
	int r, g, b;
	cin >> r >> g >> b;
	
	//処理
	int ans = (r * 100) + (g * 10) + b;
	if (ans % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

}

Measured memory_bytes: 256
import sys
from itertools import permutations

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

cnt = 0

def dfs(N, Adj, p, pos, mask):
    global cnt

    if pos == N:
        for i in range(N - 1):
            if not Adj[p[i]][p[i + 1]]:
                break
        else:
            cnt += 1

        return None

    for i in range(N):
        if mask & (1 << i):
            p[pos] = i
            dfs(N, Adj, p, pos + 1, (mask ^ (1 << i)))

    return None

def solve():
    global cnt
    cnt = 0

    N, M = map(int, input().split())
    Adj = [[0]*N for i in range(N)]

    for i in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        Adj[a][b] = 1
        Adj[b][a] = 1

    p = list(range(N))
    dfs(N, Adj, p, 1, (2 << N) - 1 - 1)

    print(cnt)

if __name__ == '__main__':
    solve()

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

using namespace std;


int main(void){
    int N;
    cin >> N;
    vector<int> d(N);
    for(auto& it : d) cin >> it;
    sort(d.begin(), d.end());
    int ans = 0;
    int prev = 0;
    for(auto x : d){
        if(prev < x) ans++;
        prev = x;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N,X; cin>>N>>X;
    vint m(N);
    REP(i,N) cin>>m[i];

    int ans=N+(X-accumulate(ALL(m),0))/(*min_element(ALL(m)));
    cout<<ans<<endl;
}


Measured memory_bytes: 256
fn main() {
    let num: i64 = 10i64.pow(18);
    let mut sc = Scanner::new();
    let a: i64 = sc.read();
    let b: i64 = sc.read();
    let _c: i64 = sc.read();
    let k: i64 = sc.read();

    if (a - b).abs() > num {
        println!("Unfair");
    } else if k % 2 == 0 {
        println!("{}", a - b);
    } else {
        println!("{}", b - a);
    }

}


struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner { ptr: 0, length: 0, buf: vec![0; 1024 * 10], small_cache: vec![0; 1024] }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }
    fn is_space(b: u8) -> bool { b == b'\n' || b == b'\r' || b == b'\t' || b == b' ' }

    fn read<T>(&mut self) -> T where T: std::str::FromStr, T::Err: std::fmt::Debug, {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)]).parse().unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;

long long MOD = 1000000007;

long long Calc(long long A, long long B) {
	if (B == 0) return 1;
	if (B % 2 == 0) {
		long long C = Calc(A, B / 2);
		return (C * C) % MOD;
	}
	return (A * Calc(A, B - 1)) % MOD;
}

int main() {
	long long N, COUNT = 0, X, Y;
	cin >> N;
	if (N == 1) {
		long long C;
		cin >> C;
		cout << (C * 2) % MOD << endl;
		return 0;
	}
	X = Calc(2, N - 1), Y = Calc(2, N - 2);
	vector<long long> C(N);
	for (int i = 0; i < N; i++) cin >> C[i];
	sort(C.begin(), C.end(), greater<long long>());
	for (long long i = 0; i < N; i++) {
		long long P = (i * Y + X) % MOD;
		COUNT += (P * C[i]) % MOD;
		COUNT %= MOD;
	}
	COUNT *= Calc(2, N);
	COUNT %= MOD;
	cout << COUNT << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#define LEN 100005

typedef struct pp{
  char name[11];
  int time;
}P;
P Q[LEN];
int head,tail,n;

void enqueue(P);
P dequeue();
int min(int,int);

int main(){
  int el = 0,c;
  int i,q;
  P data;
  scanf("%d %d",&n,&q);
  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].time);
  }
  head=1;
  tail=n+1;
  while(head!=tail){
    data=dequeue();
    c=min(q,data.time);
    data.time -= c;
    el += c;
    if(data.time>0)enqueue(data);
    else printf("%s %d\n",data.name,el);
  }
  return 0;
}

void enqueue(P data){
  Q[tail] = data;
  tail = (tail + 1)%LEN;
}

P dequeue(){
  P data = Q[head];
  head = (head + 1)%LEN;
  return data;
}

int min(int x,int y){
  if(x<y) return x;
  else return y;
}



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

#define int long long
#define counter(m)     for(int i=0;i<m;i++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    string s;
    cin>>s;
    int sum=0;
    for(auto c:s) sum+=c-'0';
    if(sum%9==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
int N,K,ans;
int cnt[200200];
int main()
{
	cin>>N>>K;
	for(int i=0;i<N;i++)
	{
		int x;
		cin>>x;
		cnt[x-1]++;
	}
	sort(cnt,cnt+N,greater<int>());
	for(int i=K;i<N;i++)
		ans+=cnt[i];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */
namespace utils{

    class Repeater{
        int st;
        int ed;
        int d;
    public:
        class rep_iterator{
            int i; int d;
        public:
            rep_iterator(int x, int pd) :i(x), d(pd) {}

            int& operator*(){ return i; }
            bool operator==(const rep_iterator& k) const { return i == k.i; }
            bool operator!=(const rep_iterator& k) const { return i != k.i; }
            rep_iterator& operator++(){ i+=d; return *this; }
        };

        explicit Repeater(int N) :st(0), ed(N), d(1) {}
        Repeater(int b, int e) :st(b), ed(e), d(1) {if(st > ed){ st--; ed--; d = -1; } }

        rep_iterator begin() const{ return rep_iterator(st, d); }
        rep_iterator end() const{ return rep_iterator(ed, d); }

    };

    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;


void sub_main(istream &is) {
    ll N , M;
    is >> N >> M;
    if(!is) return;
    ll maxL = 0;
    ll minR = N + 1;
    for (auto &&i : Repeater(0, M)) {
        ll l, r;
        is >> l >> r;
        max_update(maxL, l);
        min_update(minR, r);
    } // end i

    cout << max(ll{0}, minR - maxL + 1) << endl;




}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_C.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
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; }

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a[i];
    sort(ALL(a));
    ll ans = 1;
    rep(i,n){
        if(a[i] != 0 && a[i]<=(ll)1e18/ans){
            ans *= a[i];
        }else if(a[i] == 0){
            cout << 0 << endl;
            return 0;
        }else{
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3964
import numpy as np
from collections import Counter

h,w,n = map(int,input().split())
d = {}
for i in range(n):
    a,b = map(int,input().split())
    a,b = a-1,b-1

    am1_f = a-1 > 0
    ap1_f = a+1 < h-1
    bm1_f = b-1 > 0
    bp1_f = b+1 < w-1
    a_f = a > 0 and a < h-1
    b_f = b > 0 and b < w-1

    am1 = a-1
    ap1 = a+1
    bm1 = b-1
    bp1 = b+1

    if am1_f:
        baseid = am1 * w
        if b_f:
            pid = baseid + b

            if pid not in d:
                d[pid] = 1
            else:
                d[pid] += 1

        if bm1_f:
            pid = baseid + bm1
            if pid not in d:
                d[pid] = 1
            else:
                d[pid] += 1

        if bp1_f:
            pid = baseid + bp1
            if pid not in d:
                d[pid] = 1
            else:
                d[pid] += 1

    if ap1_f:
        baseid = ap1*w
        if b_f:
            pid = baseid + b

            if pid not in d:
                d[pid] = 1
            else:
                d[pid] += 1

        if bm1_f:
            pid = baseid + bm1
            if pid not in d:
                d[pid] = 1
            else:
                d[pid] += 1

        if bp1_f:
            pid = baseid + bp1
            if pid not in d:
                d[pid] = 1
            else:
                d[pid] += 1
    if a_f:

        baseid = a * w
        if b_f:
            pid = baseid + b
            if pid not in d:
                d[pid] = 1
            else:
                d[pid] += 1

        if bm1_f:
            pid = baseid + bm1
            if pid not in d:
                d[pid] = 1
            else:
                d[pid] += 1

        if bp1_f:
            pid = baseid + bp1
            if pid not in d:
                d[pid] = 1
            else:
                d[pid] += 1
    # print(d)

ans = [0 for i in range(10)]

for val in d.values():
    ans[val] += 1

ans[0] = (h-2)*(w-2)-sum(ans)

for a in ans:
    print(a)

Measured memory_bytes: 121548
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
#include<cmath>
#include <numeric>
#include<iomanip>
#include <cstdint>
#include<deque>
typedef long long ll;

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<ll>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] < 0) {
			count++;
			a[i] *= (-1);
		}
	}
	ll ans = 0;
	sort(a.begin(), a.end());
	if (count % 2 != 0) {
		a[0] *= (-1);
	}
	for (int i = 0; i < n; i++) {
		ans += a[i];
	}
	cout << ans << endl;
}

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

int main(){
  int x, y;
  while(1) {
    cin >> x >> y;
    if ((x == 0) && (y == 0)) {
      break;
    }
    for (int i = 0; i < x; i++) {
      for (int j = 0; j < y; j++) {
        if ((i - j) % 2 == 0) {
          cout << '#';
        } else {
          cout << '.';
        }
      }
      cout << endl;
    }
    cout <<endl;
  }
}

Measured memory_bytes: 3096
#include <stdio.h>

int main(void){
  char str[128];
  fgets(str,128,stdin);
  int a,b,c,d;
  sscanf(str,"%d %d %d",&a,&b,&c);
  if(b<c){
    d=b;
    b=c;
    c=d;
  }
  if(a<b){
    d=a;
    a=b;
    b=d;
  }
  if(b<c){
    d=b;
    b=c;
    c=d;
  }
  printf("%d\n",b+c);
  return 0;
}

Measured memory_bytes: 128
const M=1000000007;
function power(a,b:int64):int64;
var t:int64;
begin
if b=0 then power:=1 else begin
t:=power(a*a mod M,b div 2);
if b mod 2=1 then t:=t*a mod M;
power:=t;
end;
end;
var
N,K,i,j:Longint;
now,ans:int64;
memo:Array[1..100000]of Longint;
begin
read(N,K);
for i:=K downto 1 do begin
now:=power(K div i,N);
j:=i+i;
while j<=K do begin
dec(now,memo[j]);
inc(j,i);
end;
memo[i]:=(now mod M+M)mod M;
inc(ans,now*i mod M);
end;
writeln(ans mod M);
end.

Measured memory_bytes: 1380
#include<stdio.h>
int main(){
  int n,m,i,d[100010],c=0,s=0;
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++){
    scanf("%d",&d[i]);
    s+=d[i];
  }
  for(i=0;i<n;i++){
    if(d[i]*4*m>=s)c++;
  }
  printf("%s\n",c<m?"No":"Yes");
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
#define R(i,n) for(int i=0;i<n;i++)
int n,a=1e9,c[2][20],p[1<<18][51];main(){cin>>n;R(i,n*2)cin>>c[i/n][i%n];fill(p[1],p[1<<n],1e9);R(B,1<<n){int o=0,d[n];R(i,n)if(~B&1<<i)d[i]=o++;R(i,n){int k=c[abs(i-n+o)%2][i];R(j,k+1)p[B|1<<i][k]=min(p[B|1<<i][k],p[B][j]+d[i]);}}R(i,51)a=min(a,p[(1<<n)-1][i]);cout<<(a>1e8?-1:a);}

Measured memory_bytes: 52480
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_map>
#include<stack>
#include<random>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define int long long
#define inf 1145141919
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
typedef pair<int, P> PP;
struct edge { P to; int cost; };
const long long mod = 1000000007;
int k[80];
int rd[1000007], rm[1000007], rc[1000007];
int rmc[1000007];
signed main() {
	int n; cin >> n;
	string s; cin >> s;
	int q; cin >> q;
	rep(i, q)cin >> k[i];

	rep(i, n) {
		if (s[i] == 'D')rd[i + 1]++;
		if (s[i] == 'M')rm[i + 1]++;
		if (s[i] == 'C') {
			rc[i + 1]++;
		}
	}
	
	rep(i, n) {
		rd[i + 1] += rd[i];
		rm[i + 1] += rm[i];
		rc[i + 1] += rc[i];
	}

	rep(i, n) {
		if (s[i] == 'C') {
			rmc[i + 1] = rmc[i] + rm[i];
		}
		else rmc[i + 1] = rmc[i];
	}
	rep(i, q) {
		int ans = 0;
		rep(j, n) {
			if (s[j] == 'D'){
			//[j+1,j+k)
				ans += rmc[min(n, j + k[i])] - rmc[j+1] - rm[j + 1] * (rc[min(j + k[i],n)] - rc[j+1]);
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 32644
import java.lang.reflect.Array;
import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*;

class Main {
    static class Pair{
        long x;
        long cnt;
        public Pair(long x,long cnt){
            this.x=x;
            this.cnt=cnt;
        }
    }
    //public static PrintWriter pw;
    public static PrintWriter pw = new PrintWriter(System.out);

    public static void solve() throws IOException {
        //	pw=new PrintWriter(new FileWriter("C:\\Users\\shree\\Downloads\\small_output_in"));
        FastReader sc = new FastReader();
        long n=sc.L(); long m=sc.L(); long k=sc.L();
        if(solve(n,m,k)) pw.println("Yes"); else pw.println("No");
        pw.close();
    }

    static boolean solve(long n,long m,long k){
        for(long p1=0;p1<=n;p1++)
        for(long q=0;q<=m;q++) {

            if (p1 * m + q * n - 2 * p1 * q == k) return true;
        }
        return false;
    }



    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                try {

                    solve();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }, "1", 1 << 26).start();

    }

    static BufferedReader br;
    static long M = (long) 1e9 + 7;

    static class FastReader {

        StringTokenizer st;

        public FastReader() throws FileNotFoundException {
            //br=new BufferedReader(new FileReader("C:\\Users\\shree\\Downloads\\B-small-practice.in"));
            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 I() {
            return Integer.parseInt(next());
        }

        long L() {
            return Long.parseLong(next());
        }

        double D() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public boolean hasNext() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                String s = br.readLine();
                if (s == null) {
                    return false;
                }
                st = new StringTokenizer(s);
            }
            return true;
        }

    }
}

Measured memory_bytes: 25684
'use strict'

function main(input) {
  input = input.split('\n');
  const NK = input[0].split(' ').map(n => parseInt(n));
  const N = NK[0],
        K = NK[1];
  const A = input[1].split(' ').map(n => parseInt(n));
  const countBucket = [...Array(N+1)].fill(0);

  for (const num of A) {
    countBucket[num] += 1;
  }
  console.log(countBucket.sort((a, b) => b - a).slice(K).reduce((a, b) => a + b));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 42252
#include<stdio.h>
int main()
{
    int H,W,i,j;
    while(1){
        scanf("%d %d",&H,&W);
        if(H==0&&W==0)
        break;
        for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2000
n = int(input())
v = list(map(int,input().split()))
v2 = [v[i] for i in range(n) if i%2 == 0]
v1 = [v[i] for i in range(n) if i%2 == 1]
d1 = {}
d2 = {}
for i in v1:
    if i not in d1:
        d1[i] = 1
    else:
        d1[i] += 1
for i in v2:
    if i not in d2:
        d2[i] = 1
    else:
        d2[i] += 1
d1 = sorted(d1.items(),key = lambda x:x[1],reverse = True)
d2 = sorted(d2.items(),key = lambda x:x[1],reverse = True)
d1.append([0,0])
d2.append([0,0])
if d1[0][0] != d2[0][0]:
    print(n- d1[0][1] - d2[0][1])
else:
    print(min(n - d1[0][1] -d2[1][1],n - d1[1][1] -d2[0][1]))

Measured memory_bytes: 18676
#include <iostream>

using namespace std;

int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    int counter = 0;
    for (int i = min(a, b); i >= 1; i--)
    {
        if (a % i == 0 && b % i == 0)
        {
            counter++;
        }
        if (counter == k)
        {
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
import sys
import fractions
sys.setrecursionlimit(10**9)

n,m=map(int,input().split())
alist=list(map(int,input().split()))
alist=list(set(alist))

n=len(alist)


def sks(n):
	global alist
	if n == 1:
		return alist[0]
	else:
		tmp=sks(n-1)
		return tmp*alist[n-1]//fractions.gcd(tmp,alist[n-1])

sk = sks(n)
gomi=sk//2

for a in alist:
	if (gomi-a//2)%a != 0:
		print(0)
		sys.exit()

print(int((m+gomi)//sk))



Measured memory_bytes: 16316
#include <stdio.h>
#include <stdlib.h>
int main(){
	struct dataset{
		char* name;
		int number[128];
		int ololon[128];
	};
	struct dataset rectangle;
	int i = 0;
	while(1){
		scanf("%d%d", &rectangle.number[i], &rectangle.number[i+1]);
		if(rectangle.number[i] == 0 && rectangle.number[i+1] == 0) return 0;
		while(rectangle.number[i]--){
			rectangle.ololon[i] = rectangle.number[i+1];
			while(rectangle.ololon[i]--){
				putchar('#');
			}
			putchar('\n');
		}
		putchar('\n');
		i += 2;
	}
	return 0;
}


Measured memory_bytes: 2600
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

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-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")

template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 998244353; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;


bool comp(const P & p1, const P & p2) {
	if (p1.second == p2.second)return p1.first < p2.first;
	else return p1.second < p2.second;
}
void solve() {
	int N; cin >> N;
	vector<P>v(N);
	vector<int>A(N), B(N);
	REP(i, N) {
		cin >> A[i];
	}
	REP(i, N) {
		cin >> B[i];
		v[i] = { A[i],B[i] };
	}
	sort(all(v), comp);
	//print("here");
	VSORT(A);
	VSORT(B);
	REP(i, N) {
		if (A[i] > B[i]) {
			print("No"); return;
		}
	}
	REP(i, N - 1)if (A[i + 1] <= B[i]) { print("Yes"); return; }
	//print("here");
	set<P>st;
	vector<int>vec(N);
	REP(i, N) {
		st.insert({ v[i].first,i });
		vec[i] = v[i].first;
	}
	REP(i, N - 1) {
		auto itr = st.begin();
		P now = *itr;
		//pe(now.first);
		//print(now.second);
		if (now.second <= i) {
			print("Yes"); return;
		}
		int id = now.second;
		st.erase(itr);
		int val = vec[i];
		auto itr2 = st.find({ val,i });
		vec[id] = val;
		st.erase(itr2);
		st.insert({ val,id });
	}
	print("No");
}


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

	solve();
}




Measured memory_bytes: 10368
#include <iostream>
#include <vector>
#define ll long long int
using namespace std;
int ketawa(int a){
  int wa=0;
  while(a!=0){
    wa += a%10;
    a /= 10;
  }
  return wa;
}
int main(){
  int n; cin>>n;
  int ans = ketawa(n);
  if(ans==1)ans=10;
  cout<<ans<<endl;
}



Measured memory_bytes: 256
# C - H and V
import sys

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


def main():
    H, W, K = map(int, readline().split())
    C = [line.decode() for line in readlines()]
    res = 0
    for bit in range(1 << (H + W)):
        cnt_black = sum(
            not (bit >> i) & 1 and not (bit >> (j + H)) & 1 and C[i][j] == "#"
            for i in range(H)
            for j in range(W)
        )
        if cnt_black == K:
            res += 1
    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9260
# ABC029-D
# N以下1の現れる回数

N = input()
L = len(N)
K = int(input())

dp = [[[0, 0] for _ in range(5)] for _ in range(L+1)]
# dp[l][k][isless] = 上からl桁目まで読んだ時、0以外がk個あって、
# isless = 0　なら上からl桁の数が全て一致している
# isless = 1　なら一致せず、どこかの桁が小さい

dp[0][0][0] = 1
# 一番上の桁の上に0があるとみなす

for l in range(L):
    a = int(N[l])
    for isless in [0, 1]:
        for k in range(4):
            for num in range(10):
                # 次の桁が実際のものより小さいならisless = 1で確定
                if num < a:
                    if num != 0:
                        dp[l+1][k+1][1] += dp[l][k][isless]
                    else:
                        dp[l+1][k][1] += dp[l][k][isless] 
                # 次の桁が一致したならそれまでの状態を引き継ぐ
                # 超えてたらislessになっているもののみ通す
                elif num == a or isless:
                    if num != 0:
                        dp[l+1][k+1][isless] += dp[l][k][isless]
                    else:
                        dp[l+1][k][isless] += dp[l][k][isless]
#print(dp)
#ans = 0
#for k in range(L+1):
#    ans += k*(dp[L][k][1] + dp[L][k][0])
print(dp[L][K][1]+dp[L][K][0])

Measured memory_bytes: 41072
#include <bits/stdc++.h>
#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()

using namespace std;
signed main (){
  int N,A,B;
  cin>>N>>A>>B;
  int C;
  C=N/(A+B)*A;
  int D;
  D=N%(A+B);
  if(D<=A){
    cout<<C+D<<endl;
  }
  else{
    cout<<C+A<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define per(i,s,n) for(int i=n-1;i>=s;i--)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  int n,m,c;
  cin>>n>>m>>c;
  int a[m];
  int b[m];
  rep(i,m) cin>>b[i];
  int ans=0;
  rep(i,n){
    int d=0;
    rep(j,m){
      cin>>a[j];
      d+=a[j]*b[j];
    }
    d+=c;
    if(d>0) ans++;
  }
  
  cout<<ans<<endl;
}



Measured memory_bytes: 256
n,m=map(int, input().split())
a=[int(x) for x in input().split()]
a=[-1*x for x in a]

import heapq

heapq.heapify(a)

for i in range(m):
    max_value = heapq.heappop(a) #最大値の取得
    heapq.heappush(a, (max_value/2)) #半額にして-1倍してからキューに戻す

a=[-1*x for x in a]
a=[int(x) for x in a]
print(sum(a))

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

int main()
{
    int N, M;
    cin>>N>>M;
    vector<vector<int>> E(N);
    for (int i=0; i<M; i++)
    {
        int a, b;
        cin>>a>>b;
        E[a-1].push_back(b-1);
        E[b-1].push_back(a-1);
    }
    int Q;
    cin>>Q;
    vector<int> v(Q), d(Q), c(Q);
    for (int i=0; i<Q; i++)
    {
        cin>>v[i]>>d[i]>>c[i];
        v[i]--;
    }

    vector<int> A(N, -1);

    for (int i=0; i<=10; i++)
    {
        vector<int> VD(N, -1), VI(N, -1);
        for (int j=0; j<Q; j++)
            if (d[j]==i)
                VD[v[j]] = 0,
                VI[v[j]] = j;
        for (int j=0; j<i; j++)
        {
            vector<int> PVD = VD;
            vector<int> PVI = VI;

            for (int v=0; v<N; v++)
                if (PVD[v]==j && j<d[PVI[v]])
                    for (int e: E[v])
                        if (VI[e]<PVI[v])
                        {
                            VD[e] = j+1;
                            VI[e] = PVI[v];
                        }
        }
        for (int j=0; j<N; j++)
            A[j] = max(A[j], VI[j]);
    }

    for (int a: A)
        cout<<(a==-1 ? 0 : c[a])<<endl;   
}


Measured memory_bytes: 9304
#include <bits/stdc++.h>
#define vi vector<int>
#define rep(i, xtz, n) for(int i=xtz; i<n; i++)
#define repx(i, xtz, n) for(int i=xtz; i>n; i--)
#define lli long long int
#define MOD 1000000007

using namespace std;

int main(){
    //freopen("i.in", "r", stdin);
    int n, m;
    cin>>n>>m;
    vector<vector<bool>> graph(n, vector<bool>(m));
    vector<vector<lli>> dp(n, vector<lli>(m, -1));
    rep(i, 0, n){
        rep(j, 0, m){
            char ch;
            cin>>ch;
            if(ch=='.') graph[i][j] = true;
            else graph[i][j] = false;
        }
    }
    rep(i, 0, n){
        rep(j, 0, m){
            if(graph[i][j]){
                if(i==0 && j==0) dp[i][j] = 1;
                else if(i==0){if(dp[i][j-1]!=-1) dp[i][j] = dp[i][j-1];}
                else if(j==0){if(dp[i-1][j]!=-1) dp[i][j] = dp[i-1][j];}
                else{
                    if(dp[i][j-1]!=-1 || dp[i-1][j]!=-1) dp[i][j] = 0;
                    if(dp[i][j-1]!=-1) dp[i][j] = (dp[i][j] + dp[i][j-1]) % MOD;
                    if(dp[i-1][j]!=-1) dp[i][j] = (dp[i][j] + dp[i-1][j]) % MOD;
                }
            }
        }
    }
    if(dp[n-1][m-1]==-1) cout<<0;
    else cout<<dp[n-1][m-1];
}

Measured memory_bytes: 8320
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define el '\n'
#define MOD 1000000007
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b;
    cin >> a >> b;
    if(a>=13){
        cout << b << el;
    } else if(a <= 5){
        cout << 0 << el;
    } else {
        cout << b/2 << el;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fr(i,j,n) for(int i=j;i<n;i++)
#define pb        push_back
#define rf(i,j,n) for(i=n;i>=j;i--)
#define vi        vector<int>
#define hmm        "\n"
#define sp        " "
using namespace std;
int main()
{
    long long n,c=0 ; cin >> n;
    long long  p = 100 ;
    while (p < n )
    {
        p = floor(1.01*p);
        c++;
    }
    cout<<c<<hmm ;
}


Measured memory_bytes: 3744