akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#define FOR(i, m, n) for(int i = m;i < n;i++)
using namespace std;

int main(){  
  int A, B;
  cin >> A >> B;
  
  if(A<=8 && B<=8) cout << "Yay!" << endl;
  else cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
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;}

int N;
vector<int> pw2;
vector<int> A;

int ff(int a,int b){
  if(a==1&&b==2) return 1;
  if(a==2&&b==1) return 1;
  return a^b;
}

bool isok(int x, int key){
  // code here
  if(pw2[x] < key) return true;
  else return false;
}
int binsch(int key){
  // set value
  int ng = sz(pw2); int ok = 0;
  while(abs(ok-ng)>1){
    int mid = (ok+ng)/2;
    if(isok(mid, key)) ok = mid;
    else ng = mid;
  }
  return pw2[ok];
}

int f(int d, int n){
  //cout << d<< " " << n << endl;
  if(d==1) return A[n-1];
  int dd = binsch(d);
  int a = f(d-dd,n);
  int b = f(d-dd,n+dd);
  return ff(a,b);
}

int main(){
  cin >> N;
  string S; cin >> S;
  A.resize(N);
  rep(i,N){
    A[i] = (int)(S[i]-'0');
  }
  int now = 1;
  while(1){
    pw2.pb(now);
    if(now>=200000) break;
    now *= 2;
  }
  int ans;
  if(N%2==0){
    ans = f(N,1);
  }
  else{
    int a = f(N-1,1);
    int b = f(N-1,2);
    ans = ff(a,b);
  }
  cout << ans << endl;

  return 0;
}


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

#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define inf (long long int) 1e18
#define eps 0.000001
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define mod 1000000007
#define MAXN 100001
ll spf[MAXN]; 
ll gcd(ll a,ll b);
ll palindrome(string s);
ll modexp(ll a,ll b,ll m);
void sieve();
vl getFactorization(ll x);
void getZarr(string str, ll Z[]);


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/

    ll n;
    cin>>n;
    vl v;
    v.pb(111);
    v.pb(222);
    v.pb(333);
    v.pb(444);
    v.pb(555);
    v.pb(666);
    v.pb(777);
    v.pb(888);
    v.pb(999);
    auto it=lower_bound(v.begin(),v.end(),n);
    cout<<*it<<endl;

}

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

ll palindrome(string s){
    ll l = 0;
    ll h = s.length() - 1;
    while (h > l){
        if (s[l++] != s[h--]){
            return 0;
        }
    }
    return 1;
}

ll modexp(ll a, ll b, ll m){
    if (b==0)
        return 1;
    ll temp = modexp(a,b/2,m);
    temp = (temp*temp)%m;
    if (b&1)
        return (temp*(a%m))%m; // if b is odd a^b = a^(b/2)*a^(b/2)*a
    return temp;
}

void sieve() { 
    spf[1] = 1; 
    for (ll i=2; i<MAXN; i++) 
        spf[i] = i; 
    for (ll i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (ll i=3; i*i<MAXN; i++) { 
        if (spf[i] == i) { 
            for (ll j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 

vl getFactorization(ll x) 
{ 
    vl ret; 
    while (x != 1) 
    { 
        ret.push_back(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
} 

void getZarr(string str, ll Z[]){
    ll n = str.length();
    ll L, R, k;
    L = R = 0;
    for (ll i = 1; i < n; ++i){
        if (i > R){
            L = R = i;
            while (R<n && str[R-L] == str[R])
                R++;
            Z[i] = R-L;
            R--;
        } else {
            k = i-L;
            if (Z[k] < R-i+1)
                Z[i] = Z[k];
            else {
                L = i;
                while (R<n && str[R-L] == str[R])
                    R++;
                Z[i] = R-L;
                R--;
            }
        }
    }
}


Measured memory_bytes: 256
import sys

SA = input()
SB = input()
SC = input()

idx = 0

for i in range(100**3):
    if idx==0:
        if len(SA)==0:
            print("A")
            sys.exit()
        if SA[0]=="a":
            idx = 0
        elif SA[0]=="b":
            idx = 1
        elif SA[0]=="c":
            idx = 2
        SA = SA[1:]
    if idx==1:
        if len(SB)==0:
            print("B")
            sys.exit()
        if SB[0]=="a":
            idx = 0
        elif SB[0]=="b":
            idx = 1
        elif SB[0]=="c":
            idx = 2
        SB = SB[1:]
    if idx==2:
        if len(SC)==0:
            print("C")
            sys.exit()
        if SC[0]=="a":
            idx = 0
        elif SC[0]=="b":
            idx = 1
        elif SC[0]=="c":
            idx = 2
        SC = SC[1:]


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

int main(){

  int value, n, cnt, sum_v, sum_n;
  double ave;

  cnt = 0;
  sum_v = 0;
  sum_n = 0;
  while(scanf("%d, %d", &value, &n) != EOF){
    sum_v += value * n;
    sum_n += n;
    cnt++;
  }

  ave = round((double)sum_n / cnt);

  cout << sum_v << endl << ave << endl;

  return 0;

}

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

long long gcd(long long aaa,long long bbb) {
    if(bbb==0) {
        return aaa;
    }
    return gcd(bbb,aaa%bbb);
}

int main (){

    ll n,tmp=0,tmpp=0,cmp=0,ans=0;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
        tmp = max(tmp,a[i]);
    }

    for(ll i = 0; i < n; i++) {
        if(i == 0) {
            tmpp = abs(tmp/2-a[i]);
            ans = a[i];
        }else {
            cmp = abs(tmp/2-a[i]);
            if(tmpp == 1 && (a[i] == tmp/2 || a[i] == (tmp+1)/2)) {
                ans = a[i];
            }else if(tmpp != 1){
                tmpp = min(tmpp, cmp);
                if(tmpp == cmp) {
                    ans = a[i];
                }
            }
        }
    }
    cout << max(tmp,ans) << ' ' << min(tmp,ans) << endl;
    return 0;
}


Measured memory_bytes: 1152
import Data.Bool (bool)

main :: IO ()
main = do
  let
    xs = [3, 2, 1, 1, 2, 1, 1, 0]
  s <- map (== 'S') <$> getLine :: IO [Bool]
  print . (xs !!) . foldl (\i j -> 2 * i + j) 0 . map (bool 0 1) $ s


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

// <editor-fold>

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
// vector出力
template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  cout << "{";
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  cout << "}";
  return os;
}
// vector入力
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x;
  return is;
}
struct Pos {
  int x, y;
};
// 任意の個数の変数をスペース区切りで出力します
void dump() {
  cout << endl;
}
template <class Head, class... Tail>
void dump(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(Tail) != 0)
    cout << " ";
  dump(std::move(tail)...);
}
// </editor-fold>

int n, moku[3], ans = INF;
vector<int> take(8);

void dfs(string s) {
  if (s.size() == n) {
    vector<int> v(4);  // 0-A,1-B,2-C,3-D(使わない)

    for (int i = 0; i < s.size(); i++) {
      v[s[i] - 'A'] += take[i];
    }
    if ((v[0] && v[1] && v[2]) == false) return;

    int res = 0;

    for (int i = 0; i < s.size(); i++)
      if (s[i] != 'D') res += 10;
    res -= 30;

    for (int i = 0; i < 3; i++) {
      res += abs(moku[i] - v[i]);
    }

    ans = min(ans, res);
    return;
  }
  dfs(s + ('A'));
  dfs(s + ('B'));
  dfs(s + ('C'));
  dfs(s + ('D'));
  return;
}

int main() {
  cin >> n >> moku[0] >> moku[1] >> moku[2];
  for (int i = 0; i < n; i++) {
    cin >> take[i];
  }
  dfs("");
  cout << ans << endl;
}


Measured memory_bytes: 256
N, M = map(int,input().split())
dp = [float('inf')] * (2**N)
dp[0] = 0
for _ in range(M):
    a, b = map(int,input().split())
    c = sum(1 << (i-1) for i in map(int,input().split()))
    for x in range(2**N):
        if dp[c|x] > dp[x] + a:
            dp[c|x] = dp[x] + a
if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])


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

int main() {
    int n, a, b, m, sum, ans=0;
    cin >> n >> a >> b;

    for(int i=1; i<=n; i++) {
        m=i;
        sum=0;
        while(true) {
            sum += m%10;
            m /= 10;
            if(m==0) break;
        }
        if(a<=sum && sum<=b) ans += i;
    }
    cout << ans << endl;
} 

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

int main() {
  string S;
  cin >> S;
  if(S[2]==S[3]&&S[4]==S[5]){
  	cout << "Yes" << endl; 
  }
  else{
  	cout << "No" << endl; 
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll a[100005];
int main( void )
{
  ios::sync_with_stdio(false);
  int N, L;
  cin >> N >> L;
  for( int i=0; i<N; i++ ){
    cin >> a[i];
  }
  int l=0, r=N-1;
  while( l < r && a[l] + a[l+1] < L ){
    l++;
  }
  if( l == r ){
    cout << "Impossible" << endl;
    return 0;
  }
  cout << "Possible" << endl;
  for( int i=0; i<l; i++ ){
    cout << i+1 << endl;
  }
  for( int i=N-2; i>=l; i-- ){
    cout << i+1 << endl;
  }
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define F(i,j,k) for(int i=(j);i<=(k);++i)
using namespace std;
#define ll long long
const int N =1e5+5;
int n;
ll w[N],sum,num;
int main(){
	//freopen("txt.in","r",stdin);freopen("txt.out","w",stdout);
	scanf("%d\n",&n);
	F(i,1,n)scanf("%lld",&w[i]),sum+=w[i];
	if(sum%((ll)n*(n+1)/2))printf("NO\n");
	else{
		num=sum/((ll)n*(n+1)/2);
		w[0]=w[n];
		F(i,1,n)if((w[i]-w[i-1]-num)%n||(w[i]-w[i-1]-num)>0){printf("NO\n");return 0;}
		printf("YES\n");return 0;
	}
	return 0;
}
//w(i)-w(i-1)=x*1+y(1-n)=x+y-yn=sum-yn,yn=w[i-1]-w[i]+sum 
//x+y=sum

Measured memory_bytes: 1024
using System;
class Program
 {
        static void Main(string[] args)
        {
		  int n = int.Parse(Console.ReadLine());
          string[] strh = Console.ReadLine().Split(' ');
          int[] h = new int[n];
          
          for(int c = 0; c<n; c++){
          h[c] = int.Parse(strh[c]);
          }
          
          int[] min = new int[n-1];
          
          min[0] = Math.Abs(h[0]-h[1]);
          
          if(n == 2){
            
          Console.WriteLine(min[0]);
            
          }else if(n == 3){
            
          	min[1] = Math.Abs(h[0]-h[2]);
          	Console.WriteLine(min[1]);
            
          }else{
            
         	 	min[1] = Math.Abs(h[0]-h[2]);

              for(int d = 2; d<n-1; d++){

                min[d] = Math.Min(min[d-2]+Math.Abs(h[d-1]-h[d+1]) , min[d-1]+Math.Abs(h[d]-h[d+1]));

              }
            
          Console.WriteLine(min[n-2]);

          }
        }
 }

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

using namespace std;

int a[32] = {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};

int main(){
  int k;
  cin >> k;
  cin.ignore();

  --k;

  cout << a[k] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    char vowels[] = {'a', 'e', 'i', 'o', 'u'};
    char c;
    cin >> c;
    for(int i = 0; i < 5; i++) {
        if(c == vowels[i]){
            cout << "vowel";
            return 0;
        }
    }
    cout << "consonant";
    return 0;
}

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


auto solve(long long N){
    int i = 0;
    while(1 < N){
        i++;
        N >>= 1;
    }

    return 1 << i;
}

int main(){
    long long N;
    scanf("%lld",&N);
    auto result = solve(N);
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
while True:
    data = input().split()
    n = int(data[0])
    x = int(data[1])
    if n == 0 and x ==0:
        break
    count = 0
    for i in range(1,n-1):
        for j in range(i+1,n):
            for k in range(j+1,n+1):
                if i != j and j != k and i != k:
                    c = i + j + k
                    if c == x:
                        count += 1
    print(count)

Measured memory_bytes: 7672
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <limits>
using namespace std;
using ll = long long;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 8;
constexpr int MAXN = 4000;
int N;
ll sum[MAXN];
ll getsum(const int inf, const int sup)  // [inf, sup)
{
    assert(0 <= inf);
    assert(sup <= N);
    assert(inf < sup);
    return sum[sup - 1] - (inf == 0 ? 0LL : sum[inf - 1]);
}
int dp[MAXN + 1][MAXN + 1];  //最後の区間が[i,j)である増加列の項数の最大値 (i < j)
int pre[MAXN + 1][MAXN + 1];
int main()
{
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> sum[i];
    }
    for (int i = 1; i < N; i++) {
        sum[i] += sum[i - 1];
    }
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= N; j++) {
            pre[i][j] = -1;
        }
    }
    for (int j = 1; j <= N; j++) {
        dp[0][j] = 1;
    }
    using P = pair<ll, int>;
    using PP = pair<P, int>;
    for (int mid = 1; mid < N; mid++) {
        vector<PP> v;
        for (int inf = 0; inf < mid; inf++) {
            v.push_back({{getsum(inf, mid), -inf}, dp[inf][mid]});
        }
        for (int sup = mid + 1; sup <= N; sup++) {
            v.push_back({{getsum(mid, sup), -sup}, -1});
        }
        sort(v.begin(), v.end());
        int maxi = -INF<int>;
        int maxind = -1;
        for (const auto& pp : v) {
            const int ind = -pp.first.second;
            const int value = pp.second;
            if (ind > mid) {
                dp[mid][ind] = maxi + 1;
                pre[mid][ind] = maxind;
            } else {
                if (maxi <= value) {
                    maxi = value;
                    maxind = ind;
                }
            }
        }
    }

    int num = -1;
    int left = 0;
    for (int i = 0; i < N; i++) {
        if (num <= dp[i][N]) {
            left = i;
            num = dp[i][N];
        }
    }
    cout << num << endl;
    vector<int> sep;
    int right = N;
    while (left > 0) {
        sep.push_back(left);
        const int L = left;
        left = pre[left][right];
        right = L;
    }
    reverse(sep.begin(), sep.end());
    for (const int l : sep) {
        cout << l << " ";
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 111036
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
int main() {
    string a,b,c;
    cin>>a>>b>>c;
    string ans;
    ans+=a.at(0)+'A'-'a';
    ans+=b.at(0)+'A'-'a';
    ans+=c.at(0)+'A'-'a';
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
   int n;cin>>n;
   vector<ll> v;
   int ans=200000;
   for(int i=0;i<n;i++){
       ll a;cin>>a;
       auto j=upper_bound(v.begin(),v.end(),a,greater<int>());
       if(j==v.end())v.push_back(a);
       else *j=a;
   }
   cout<<v.size();
}

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

int main(void){
    string n;
    cin>>n;
    ll ans=0;
    for(ll i=0;i<n.length();++i){
        ans+=n[i]-'0';
    }
    cout<<(ans%9==0?"Yes":"No");
    return 0;
}


Measured memory_bytes: 3728
using System;

namespace AtCoderAGC034A
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 0;

            string[] s = Console.ReadLine().Split(' ');

            int N = int.Parse(s[0]);
            int A = int.Parse(s[1])-1;
            int B = int.Parse(s[2])-1;
            int C = int.Parse(s[3])-1;
            int D = int.Parse(s[4])-1;

            char[] c = Console.ReadLine().ToCharArray();

            int Max;

            if (C < D)
                Max = D;
            else
                Max = C;

            for(int i=A+2;i<Max -1;i++)
            {
                if(c[i-1] == '#' && c[i] == '#')
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            if(C < D)
            {
                Console.WriteLine("Yes");
                return;
            }

            for(int i=B;i<=D;i++)
            {
                if(c[i-1] == '.' && c[i] == '.' && c[i+1] == '.')
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");
        }

    }

}


Measured memory_bytes: 12000
n,m,k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)

a.unshift(0)
b.unshift(0)
(1..n).each {|i| a[i]+=a[i-1]}
(1..m).each {|j| b[j]+=b[j-1]}

n+=1
m+=1

b_j = m-1
ans = 0
n.times do |i|
    t = 0
    b_j.downto(0) do |j|
        if a[i]+b[j] <= k
            t = i+j
            b_j = j
            break
        end
    end
    ans = [ans, t].max
end

p ans

Measured memory_bytes: 49044
#include<stdio.h>
#define zyougen 150
#define Big 1000000
int i, j, num, A[zyougen][zyougen]={0};
int back[zyougen], min[zyougen], used[zyougen];

int prim(){
 int dir, next, Sum = 0;
 
 min[1] = 1;
 
 while(1){
   dir  = Big;
   next = -1;
   for(i=1; i<=num; i++){
     if ( (dir > min[i]) && (used[i] != -1) ) {
       next = i;
       dir  = min[i];
     }
   }
   if (next == -1) {
     break;
   }
   used[next] = -1;
   for(j=1; j<=num; j++){
     if( (used[j] != -1) && (A[next][j] != Big) ) {
       if (min[j] > A[next][j]) {
         min[j]  = A[next][j];
         back[j] = next;
         used[j] = 1; 
       }
     }
   }
 }

 for(i=1; i<=num; i++){
   if (back[i] != -1) {
     Sum += A[i][back[i]];
   }
 }
 
 return Sum;
}

int main(){
 int omomi;

 scanf("%d", &num);

 for(i=1; i<=num; i++){
   for(j=1; j<=num; j++){
     scanf("%d", &omomi);
     if(omomi != -1){
       A[i][j] = omomi;
     } else {
       A[i][j] = Big;
     }
   }
   min[i]  = Big;
   back[i] = -1;
   used[i] = 0;
 }

 printf("%d\n", prim());

 return 0;
}

Measured memory_bytes: 1836
import heapq
n,m = map(int,input().split())
price_list =list(map(lambda x : -int(x),input().split()))
heapq.heapify(price_list)

for i in range(m):
    dis = heapq.heappop(price_list)
    heapq.heappush(price_list, -(-dis//2)) 
print(-1*sum(price_list))

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

int main() {
  
  int N=0, A=0, B=0;
  
  cin >> N >> A >> B;
  
  int keisan = N*A;
  
  if(keisan < B) {
    
    cout << keisan << endl;
    
  } else {
    
    cout << B << endl;
    
  }
  
  return 0;
  
}

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

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 

#define int long long
#define mod 1000000007
#define pb push_back
#define S second
#define F first
#define INF 1e18
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define deb(x) cerr << "\n" \
                    << #x << "=" << x << "\n";
#define deb2(x, y) cerr << "\n" \
                        << #x << "=" << x << "\n" \
                        << #y << "=" << y << "\n";
#define w(x) \
  int x;     \
  cin >> x;  \
  while (x--)

#define MAXN 1000002 
  
// stores smallest prime factor for every number 
int spf[MAXN]; 
  
// Calculating SPF (Smallest Prime Factor) for every 
// number till MAXN. 
// Time Complexity : O(nloglogn) 
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) 
  
        // marking smallest prime factor for every 
        // number to be itself. 
        spf[i] = i; 
  
    // separately marking spf for every even 
    // number as 2 
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            // marking SPF for all numbers divisible by i 
            for (int j=i*i; j<MAXN; j+=i) 
  
                // marking spf[j] if it is not  
                // previously marked 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
  
int getFactorization(int x) 
{ 
    vector<int> ret;
    int prev = -1;
    int cnt = 0,ans = 1ll;
    while (x != 1) 
    { 
      if(spf[x] == prev)
        cnt++;
      else {
        ans *= (cnt + 1);
        prev = spf[x];
        cnt = 1;
      }
      x = x / spf[x]; 
    } 
    if(cnt > 0)
      ans *= (cnt + 1);
    return ans;
} 
  
int32_t main() {

  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int ans = 0;
  sieve();
  for(int i = 1; i <= n - 1; ++i) {
    int sum = n - i;
    ans += getFactorization(sum);
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 11460
#include <string.h>

#include <algorithm>
#include <iostream>

using namespace std;

int main(void) {

	int N;
	cin >> N;

	int A[200000];//身長
	int B = 0; //踏み台の高さ

	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	long long sum = 0;

	//A[1]からA[N-1]まで
	for (int i = 1; i < N; i++) {

		int sa = (A[i-1] + B) - A[i];

		//前の人より既に高いとき
		if (sa <= 0) {
			B = 0;
		}

		//前の人のほうが高いとき⇒踏み台が必要
		if (sa > 0) {
			B = sa;
			sum += sa;
		}
		
	}

	cout << sum << endl;
}

Measured memory_bytes: 4432
// Problem : C - gacha
// Contest : AtCoder - AtCoder Beginner Contest 164
// URL : https://atcoder.jp/contests/abc164/tasks/abc164_c?lang=en
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define ll long long
#define mod 1000000007
int lcm(int x,int y){
	return x/__gcd(x,y)*y;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    set<string>s;
    int n;
    cin>>n;
    string a;
    REP(i,n)cin>>a,s.insert(a);
    cout<<s.size()<<endl;
    return 0;
}


Measured memory_bytes: 19184
use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
                assert!(_it.next().is_none());
        }
    };
}

fn digit_sum(n: i64) -> i64 {
    let mut sum = 0;
    let mut tmp_n = n;

    loop {
        sum += tmp_n % 10;
        tmp_n = tmp_n / 10;

        if tmp_n == 0 {
            break;
        }
    }
    sum
}

fn main() {
    from_line!(n: i64, a: i64, b: i64);
    let mut sum = 0;
    for i in 1..n+1 {
        if a <= digit_sum(i) && digit_sum(i) <= b {
            sum += i;
        }
    }
    println!("{}", sum);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>

int gcd(int a, int b) {
    while (b > 0) {
        int tmp = b;
        b = a % b;
        a = tmp;
    }
    return a;
}

int main() {
    int x, y;
    std::cin >> x;
    std::cin >> y;
    if (x > y) {
        std::cout << gcd(x, y) << std::endl;
    } else
    {
        std::cout << gcd(y, x) << std::endl;
    }
    
}


Measured memory_bytes: 3120
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

type pair struct {
	fi int
	se int
}

func convination(n int, k int) int {
	if k < 0 || n < k {
		return 0
	}
	var ret = 1
	for i := 1; i <= k; i++ {
		ret *= n
		ret /= i
		n--
	}
	return ret
}
func modconvination(n int, k int) int {
	if k < 0 || n < k {
		return 0
	}
	var ret = 1
	for i := 1; i <= k; i++ {
		ret *= n
		ret %= mod
		ret = inverseDiv(ret, i)
		n--
	}
	return ret
}
func inverseDiv(a int, b int) int {
	return a * modinv(b, mod) % mod
}

func modinv(a int, m int) int {
	b := m
	u := 1
	v := 0
	for {
		if b == 0 {
			break
		}
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= m
	if u < 0 {
		u += m
	}
	return u
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	//予備
	n := iScan()
	s := Scan()
	co := 0
	var add string
	for i := 0; i < n; i++ {
		if s[i] == '(' {
			co++
		} else {
			co--
		}
		if co < 0 {
			add = "(" + add
			co = 0
		}
	}
	for i := 0; i < co; i++ {
		s = s + ")"
	}
	s = add + s
	fmt.Println(s)
}

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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef unsigned long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

////////////////////////////////////////////////////////////////////

const int N = 1e5 + 2;

int A[N];

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n; cin >> n;
	for (int i = 0; i < n + n; i++) cin >> A[i];
	sort(A, A + n + n);
	int ans = 0;
	for (int i = 0; i < n; i++) ans += A[i + i];
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

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

	int N,H,ans=0;
	cin>>N>>H;
	VI A(N);
	VI B(N);
	REP(i,N)cin>>A[i]>>B[i];
	rSORT(A);
	rSORT(B);
	int i=0;
	while(H>0 && B[i]>A[0]){
		H-=B[i];
		i++;
		ans++;
		if(H<=0){
			cout<<ans<<endl;
			return 0;
		}
	}
	if(H%A[0]!=0)ans++;
	ans+=H/A[0];
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
int n, q, a;
bool dp[30][2010];
signed main() {
	cin >> n;
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		for (int j = 0; j <= 2000; j++)dp[i][j] = dp[i - 1][j];
		for (int j = 0; j <= 2000 - a; j++) {
			if (dp[i - 1][j])dp[i][j + a] = 1;
		}
	}
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> a;
		cout << (dp[n][a] ? "yes\n" : "no\n");
	}
}


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

int main(void) {
  int A, B;
  string S;
  int cnt = 0;
  bool flg = false;
  cin >> A >> B;
  cin >> S;
  
  flg = S[A] == '-';
  for (int i = 0; i < A + B + 1; i++) {
    if (S[i] == '-') {
      cnt++;
    }
  }
  
  if (flg && cnt == 1) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define MAX 200009
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

void __print(int 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 dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tt, T)
	{
		//cout << "Case #" << tp << ": ";
		int n, m, k;
		cin >> n >> m >> k;
		int a[n+1];
		a[0] = 0;
		FOR1(i, n) cin >> a[i];
		int b[m+1];
		b[0] = 0;
		FOR1(i, m) cin >> b[i];
		

		int pre_a[n+1]; pre_a[0] = 0;
		int pre_b[m+1]; pre_b[0] = 0;
		FOR1(i, n){
			pre_a[i] = pre_a[i-1] + a[i];
		}
		FOR1(i, m){
			pre_b[i] = pre_b[i-1] + b[i]; 
		}
		int ans = 0;
		for(int i = 0; i <= n; i++){

			int j = upper_bound(pre_b+1, pre_b+m+1, k-pre_a[i]) - 1 - pre_b;
			dbg(tt, i, j, i+j);
			if(pre_a[i]+pre_b[j] <= k) ans = max(ans, i+j);
		}
		cout << ans;
		cout<<'\n';
	}
	return 0;
}


Measured memory_bytes: 9908
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


ll f(ll x){
	ll y=x-x%4;
	ll ans=0;
	rep(i,y,x+1){
		ans=ans^i;
	}
	return ans;
}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll a,b;
	cin >> a >> b;
	ll p=f(a-1);
	ll q=f(b);
	ll r=p^q;
	trace2(p,q);
	cout << r;
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

K = input()[:-1]
D = int(input())
L = len(K)
dp = [[[0]*D for _ in range(2)] for _ in range(L+1)]
dp[0][0][0] = 1
MOD = 10**9+7

for i in range(L):
    Ki = int(K[i])
    
    for j in range(2):
        for k in range(D):
            for d in range(10 if j else Ki+1):
                dp[i+1][j|(d<Ki)][(k+d)%D] += dp[i][j][k]
                dp[i+1][j|(d<Ki)][(k+d)%D] %= MOD

print((dp[L][0][0]+dp[L][1][0]-1)%MOD)

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

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

    int N; cin >> N;
    int mi = inf;
    REP(i, 1, N) {
      int x = 0, y = 0;
      int num = i;
      while (num) {
        x += num % 10;
        num /= 10;
      }
      num = N - i;
      while (num) {
        y += num % 10;
        num /= 10;
      }
      mi = min(mi, x + y);
    }
    cout << mi << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int a,b,c;
  
  a = n/100;
  b = n/10-a*10;
  c = n-b*10-a*100;
  
  string ans;
  if(c==3)
    ans = "bon";
  else if(c==0 || c == 1 || c == 6 || c == 8)
    ans = "pon";
  else
   ans = "hon";
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
//***Little by little one travels far***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll fuel[302][302];
ll dis[302][302];
ll inf =1e17;
int main()
{
  ll n,m,l,q;
  cin>>n>>m>>l;

  for1(i,n)
    for1(j,n){
      if(i!=j){
      fuel[i][j]=inf;
      dis[i][j]=inf;
      }
    }

  forn(i,m){
    ll a,b,c;
    cin>>a>>b>>c;
    fuel[a][b]=c;
    fuel[b][a]=c;
  }

  for(ll k=1;k<=n;k++)
  for(ll i=1;i<=n;i++)
  for(ll j=1;j<=n;j++)
    fuel[i][j]=min(fuel[i][j],fuel[i][k]+fuel[k][j]);
    
  for(ll i=1;i<=n;i++)
  for(ll j=1;j<=n;j++){
    if(fuel[i][j]<=l)
      dis[i][j]=1;  
  }

  for(ll k=1;k<=n;k++)
  for(ll i=1;i<=n;i++)
  for(ll j=1;j<=n;j++)
    dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);

  cin>>q;
  for(ll i=0;i<q;i++){
    ll s,t;
    cin>>s>>t;
    if(dis[s][t]==inf) cout<<"-1"<<endl;
    else cout<<(dis[s][t]-(ll)1)<<endl;
  }
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
int main(){
    ll a;cin >> a;
    ll ans=a/11*2;
    ll c=a%11;
    if(0<c&&c<=6)ans+=1;
    if(c>=7) ans+=2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int A,B,C;
    scanf("%d",&A);
    scanf("%d",&B);
    scanf("%d",&C);
    if(A<C&&C<B){
        printf("Yes");
        
    }
    if(B<C&&C<A){
        printf("Yes");
        
    }if(C<A&&C<B){
        printf("No");
        
    }if(C>A&&C>B){
    printf("No");}
    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"

#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0);}

#define SHOW(x) std::cout << #x << " = " << x << std::endl;


int main()
{
//    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios_base::sync_with_stdio(false);


    string s;
    cin >> s;
    cout << "ABC" + s << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
struct node{   
  int key;
  struct node *parent;
  struct node *right;
  struct node *left;
};
typedef struct node *Node;
Node T;
#define NIL NULL;
void Insert(int);
void Preorder(Node);
void Inorder(Node);
int main()
{
  int n,i,key;
  char S[7];  

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",S);
    if(S[0]=='i'){
      scanf("%d",&key);
      Insert(key);
    }
    else{
      Inorder(T);
      printf("\n");
      Preorder(T);
      printf("\n");
      
    }
  }
  return 0;
}

void Insert(int key)
{
  Node y,x,z;
  y=NIL;
  x=T;
  z=malloc(sizeof(struct node));
  z->key=key;
  z->left=NIL;
  z->right=NIL;
  while(x!=NULL){
    y=x;
    if( z->key < x->key )x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NULL){
    T=z;
  }
  else if(z->key<y->key){
      y->left=z;
  }
  else{
    y->right=z;
  }
}

void Preorder(Node T)
{
  printf(" %d",T->key);
  if(T->left!=NULL){
    Preorder(T->left);
  }
  if(T->right!=NULL){
    Preorder(T->right);
  }
   
}
void Inorder(Node T)
{
  if(T->left!=NULL && T->right!=NULL){
    Inorder(T->left);
    printf(" %d",T->key);
    Inorder(T->right);
  
  }
  if(T->left!=NULL && T->right==NULL){
   Inorder(T->left);
     printf(" %d",T->key);  
  }
  
  if(T->right!=NULL && T->left==NULL){
  printf(" %d",T->key);
 Inorder(T->right); 
  
  }
  if(T->left==NULL && T->right==NULL)printf(" %d",T->key);
 
}



Measured memory_bytes: 25236
code = r"""
# distutils: language=c++
# distutils: include_dirs=[/home/contestant/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False
cdef extern from "/opt/atcoder-stl/atcoder/fenwicktree.hpp" namespace "atcoder":
    cdef cppclass fenwick_tree[T]:
        fenwick_tree(int n)
        void add(int p, T x)
        T sum(int l, int r)

from libc.stdio cimport scanf, printf
cdef int n, q, i, a, t, u, v
scanf('%d%d', &n, &q)
cdef fenwick_tree[long] *bit = new fenwick_tree[long](n)
for i in range(n):
    scanf('%d', &a)
    bit.add(i, a)
for i in range(q):
    scanf('%d%d%d', &t, &u, &v)
    if t:
        printf('%ld\n', bit.sum(u, v))
    else:
        bit.add(u, v)
"""
import os
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    open('solve.pyx', 'w').write(code)
    os.system('cythonize -i -3 -b solve.pyx')
import solve

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

using namespace std;

int main()
{
	int n, t, e, j;
	int f[6];
	int cube[6][4];
	map<int, int> m;
	
	for(int i = 0; i < 6; i++)
	{
		scanf("%d", &f[i]);
		m[f[i]] = i;
	}
	
	cube[0][0] = f[3];
	cube[0][1] = f[1];
	cube[0][2] = f[2];
	cube[0][3] = f[4];
	
	cube[1][0] = f[3];
	cube[1][1] = f[5];
	cube[1][2] = f[2];
	cube[1][3] = f[0];
	
	cube[2][0] = f[5];
	cube[2][1] = f[4];
	cube[2][2] = f[0];
	cube[2][3] = f[1];
	
	cube[3][0] = f[4];
	cube[3][1] = f[5];
	cube[3][2] = f[1];
	cube[3][3] = f[0];
	
	cube[4][0] = f[2];
	cube[4][1] = f[5];
	cube[4][2] = f[3];
	cube[4][3] = f[0];
	
	cube[5][0] = f[3];
	cube[5][1] = f[4];
	cube[5][2] = f[2];
	cube[5][3] = f[1];
	
	scanf("%d", &n);
	
	for(int i = 0; i < n; i++)
	{
		scanf("%d %d", &t, &e);
		
		for(j = 0; j < 4; j++)
		{
			if(cube[m[t]][j] == e)
				break;
		}
		if(j == 3)
			printf("%d\n", cube[m[t]][0]);
		else
			printf("%d\n", cube[m[t]][j+1]);
	}
	
	return 0;
}


Measured memory_bytes: 3152
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		solver();
	}

	static void solver() {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int n = sc.nextInt();
			int d = sc.nextInt();
			if (n == 0 && d == 0) {
				sc.close();
				return;
			}
			ArrayList<Country> cs = new ArrayList<>();
			for (int i = 0; i < n; i++) {
				int m = sc.nextInt();
				int[] c = new int[m];
				for (int j = 0; j < m; j++) {
					c[m - j - 1] = sc.nextInt();
				}
				cs.add(new Country(c, m));
			}
			cs.sort(null);
			int max = cs.get(cs.size() - 1).sum;
			int min = cs.get(0).sum;
			int max2 = min;
			if (cs.size() >= 2) {
				max2 = cs.get(cs.size() - 2).sum;
			}
			while (max - min <= d) {
				boolean breaked=false;
				for (int i = 0; i < cs.size(); i++) {
					if (cs.get(i).c.size() == 0){
						cs.remove(i);
						breaked=true;
						break;
					}
					int ns = cs.get(i).sum - cs.get(i).c.get(0);
					if (((i != cs.size() - 1 && Math.abs(ns - max) <= d)
							|| (i == cs.size() - 1 && Math.abs(ns - max2) <= d)) && Math.abs(ns - min) <= d) {
						breaked=true;
						cs.get(i).sum = ns;
						cs.get(i).c.remove(0);
						if (cs.get(i).c.size() == 0) {
							cs.remove(i);
							if (cs.size() == 0)
								break;
						}
						cs.sort(null);
						max = cs.get(cs.size() - 1).sum;
						max2 = min;
						if (cs.size() >= 2) {
							max2 = cs.get(cs.size() - 2).sum;
						}
						min = Math.min(cs.get(0).sum, min);
						break;
					}
				}
				if (!breaked||cs.size() == 0)
					break;
			}
			if (cs.size() == 0) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}

	static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class Country implements Comparable<Country> {
		int sum = 0;
		ArrayList<Integer> c = new ArrayList<>();

		Country(int[] c, int m) {
			for (int i = 0; i < m; i++) {
				this.c.add(c[i]);
				this.sum += c[i];
			}
		}

		@Override
		public int compareTo(Country o) {
			return Integer.compare(this.sum, o.sum);
		}
	}
}

Measured memory_bytes: 85436
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=705;
int G[maxn][maxn];
vi g[maxn];
int col[maxn];
bool ok=1;
int n,m;
pi dfs(int u,int c)
{
    col[u]=c;
    pi ret={0,0};
    if(c) ret.second++;
    else ret.first++;
    for(auto i:g[u])
    {
        if(col[i]!=-1&&col[i]==c)
        {
            ok=0;
            return ret;
        }
        else if(col[i]==-1)
        {
            auto cur=dfs(i,c^1);
            ret.first+=cur.first;
            ret.second+=cur.second;
        }
    }
    return ret;
}
int main()
{
    cin>>n>>m;
    for(int i=0,u,v;i<m;i++)
    {
        cin>>u>>v;
        G[u][v]=G[v][u]=1;
    }
    int cc=0;
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++) 
        {
            if(!G[i][j])
            {
                g[i].push_back(j);
                g[j].push_back(i);
                cc++;
            }
        }
    int ans;
    memset(col,-1,sizeof(col));
    vc<vi> dp(2,vi(n+1));
    int t=0;
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        if(col[i]==-1)
        {
            pi cur=dfs(i,0);
            if(!ok) break;
            dp[t^1]=vi(n+1,0);
            for(int j=n;j>=0;j--)
            {
                if(j>=cur.second)
                    dp[t^1][j]|=dp[t][j-cur.second];
                if(j>=cur.first)
                    dp[t^1][j]|=dp[t][j-cur.first];
            }
            t^=1;
        }
    }
    if(!ok) ans=-1;
    else
    {
        int tmp=0;
        for(int i=1;i<=n;i++)
        {
            if(dp[t][i]) tmp=max(tmp,i*(n-i));
        }
        ans=m-(tmp-cc);
    }
    print(ans);
}

Measured memory_bytes: 3072