akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N;i++)
        cin >> A.at(i);
    sort(A.begin(),A.end());
    bool can = true;
    for (int i = 0; i < N-1; i++)
    {
        if(A.at(i)==A.at(i+1))
            can = false;
    }
    puts(can?"YES":"NO");
}

Measured memory_bytes: 1024
#include <vector>
#include <cstdio>
using namespace std;
typedef long long ll;

template <typename T>
struct fenwick_tree {
    vector<T> x;
    fenwick_tree(int n) : x(n, 0) { }
    T max(int j) {
        T S = 0;
        for (; j >= 0; j = (j & (j + 1)) - 1) S = std::max(x[j],S);
        return S;
    }
    void chmax(int k, T a) {
        for (; k < x.size(); k |= k+1) x[k] = std::max(x[k],a);
    }
};

int main(){
    ll n;scanf("%lld",&n);
    fenwick_tree<ll> dp(n+1);
    for(int i=0;i<n;i++){
        int x;scanf("%d",&x);
        dp.chmax(x,dp.max(x-1)+x);
        // for(int i=1;i<=n;i++){
        //     printf("%lld ",dp.max(i)-dp.max(i-1));
        // }
        // puts("");
    }
    printf("%lld\n",(ll)n*(n+1)/2 - dp.max(n));
}

Measured memory_bytes: 1788
package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}


Measured memory_bytes: 1136
using System;
class Program
{
    static void Main()
    {
        Calq cal = new Calq();
        const int TEST = 3;
        int[] test = new int[TEST];
        string line;
        string[] temp;
        string note;

        while ((line = Console.ReadLine()) != ("-1 -1 -1"))
        {
            temp = line.Split(' ');
            for (int i = 0; i < TEST; ++i)
            {
                test[i] = int.Parse(temp[i]);
            }
            int mid = test[0];
            int fin = test[1];
            int comp = test[2];

            note = cal.Qualif(mid, fin, comp);
            Console.Out.WriteLine(note);
        }
    }
}
class Calq
{
    internal string Qualif(int cent, int last, int doubleCheck)
    {
        int result = cent + last;
        if (cent == -1||last == -1)
            return "F";
        else if (result >= 80)
            return "A";
        else if (result >= 65)
            return "B";
        else if (result >= 50)
            return "C";
        else if (result >= 30)
            return CompExam(doubleCheck);
        else
            return "F";
    }
    internal string CompExam(int comple)
    {
        if (comple >= 50)
            return "C";
        else
            return "D";
    }
}


Measured memory_bytes: 15884
// -*- compile-command: "g++ -g -Wno-return-type -Wall -Wextra -DLOCAL -std=c++11 -D_GLIBCXX_DEBUG d.cpp -od && ./d " -*-
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
#define int LL
#define vc vector
#define pb push_back
#define pr pair
#define fi first
#define se second
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define f(i,n) for(int i=0;i<(n);i++)
#define fr(i,n) for(int i=(n);i--;)
#define fv(i,v) f(i,sz(v))

const int M=1e9+7;

int f[(int)1e5+10];

int pow(int a,int b){
	int r=1;
	for(;b;b>>=1,a=a*a%M)
		if(b&1) r=r*a%M;
	return r;
}
int inv(int a){
	return pow(a,M-2);
}

int ncr(int n,int k){
	if(n<0||k<0||k>n) return 0;
	return f[n]*inv(f[k]*f[n-k]%M)%M;
}


main(){
	ios::sync_with_stdio(0),cin.tie(0);
	int n;
	cin>>n;
	f[0]=1;
	for(int i=1;i<(int)1e5+10;i++) f[i]=f[i-1]*i%M;
	vc<int> a(n+1);
	f(i,n+1) cin>>a[i];
	unordered_map<int,int> x;
	int first=-1,second=-1;
	f(i,n+1){
		if(!x.count(a[i])){
			x[a[i]]=i;
			continue;
		}
		first=x[a[i]];
		second=i;
		break;
	}
	int mid=second-first-1;
	f(k,n+2){
		if(!k) continue;
		int r=ncr(n+1,k);
		r=(r+M-ncr(n+1-(mid+2),k-1))%M;
		cout<<r<<'\n';
	}
}


Measured memory_bytes: 6948
// Copyright lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef std::pair<int, int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef std::pair<long long, long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i, j, k)  for (register int i = (int)(j); i <= (int)(k); i++)
#define rrep(i, j, k) for (register int i = (int)(j); i >= (int)(k); i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

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

const int mod = 1e9 + 7;
string k;
int d;
int f[10010][110][2];

void work() {
  cin >> k >> d;
  f[0][0][0] = 1;
  rep(i, 0, k.size() - 1) {
    rep(j, 0, d - 1) {
      rep(a, 0, 1) {
        if (!f[i][j][a]) continue;
        // cout<<i<<' '<<j<<' '<<a<<' '<<f[i][j][a]<<endl;
        int mx = 9;
        if (!a) mx = k[i] - '0';
        rep(x, 0, mx) {
          (f[i+1][(j+x) % d][a | (x < mx)] += f[i][j][a]) %= mod;
        }
      }
    }
  }
  cout<<(f[k.size()][0][0] + f[k.size()][0][1] - 1 + mod) % mod<<endl;
}

int main() {
  #ifdef LZT
    freopen("in", "r", stdin);
  #endif

  work();

  #ifdef LZT
    Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
  #endif
}


Measured memory_bytes: 8832
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1
#define INF 1000000000 //1e9

#define PI 3.14159265359

int main(){
    int N,M;
    cin >> N >> M;
    int sum = 0;
    for(int i = 0; i < M;i++){
        int a;
        cin >> a ;
        sum += a;
    }
    if(sum > N ) cout << -1 << endl;
    else cout << N - sum << endl;
    return 0;
}

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

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 200005;
ll n, a[MX], b[MX], x[MX], y[MX], res;

ll find (ll k) {
	return lower_bound(y, y + n, k) - y;
}

ll solve (int j) {
	ll res = 0;
	sort(y, y + n);

	forn (i, n) {
		res += find((1ll << j + 1) - x[i]);
		res -= find((1ll << j) - x[i]);

		res += find((1ll << j + 2) - x[i]);
		res -= find((1ll << j + 1) + (1ll << j) - x[i]);
	}

	return res % 2;
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n;
	forn (i, n) cin >> a[i];
	forn (i, n) cin >> b[i];

	forn (j, 29) {
		forn (i, n) x[i] = a[i] & ((1 << j + 1) - 1);
		forn (i, n) y[i] = b[i] & ((1 << j + 1) - 1);
		
		res |= solve(j) << j;
	}

	cout << res << endl;

	return 0;
}

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {
    int n, x, mi;
    cin >> n >> x;
    vector<int> m(n);
    rep(i, n) {
        cin >> m[i];
        x -= m[i];
    }
    sort(m.begin(), m.end());
    mi = m[0];
    cout << m.size() + x / mi << endl;
    return 0;
}

Measured memory_bytes: 3608
#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>;
const int MAX = 1000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
//setprecision(15)


int main() {
	int N, R; cin >> N >> R;
	if (N >= 10) {
		cout << R << endl;
	} else {
		cout << R + (10-N) * 100 << endl;
	}
}

Measured memory_bytes: 3584
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n, c, k, ans, itr, lim;
    ans = 0;
    itr = 0;
    cin >> n >> c >> k;
    vector<int> t(n);
    for(int i=0; i<n; ++i){
        cin >> t[i];
    }
    // sort
    sort(t.begin(), t.end());
    // greedy
    while(itr < n){
        ans++;
        lim = t[itr] + k;
        for(int i=0; i<c; ++i){
            if(itr + i < n && t[itr + i] <= lim){
                if(i == c-1){
                    itr = itr + i + 1;
                }
                continue;
            }
            else {
                itr = itr + i;
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
import collections as cole


n = int(input())
v = list(map(int, input().split()))

v1 = v[::2]   #odd
v2 = v[1::2]  #even

d1 = cole.Counter(v1)
d2 = cole.Counter(v2)

values1, counts1 = zip(*d1.most_common())
values2, counts2 = zip(*d2.most_common())

max1 = values1[0]
max2 = values2[0]

if max1 == max2:
    if len(counts1) != 1 and counts1[0] == counts1[1]:
        max1 = values1[1]
    elif len(counts2) != 1 and counts2[0] == counts2[1]:
        max2 = values2[1]
    elif len(counts1) != 1 and len(counts2) != 1:
        if counts1[1] > counts2[1]:
            max1 = values1[1]
        else:
            max2 = values2[1]
    elif len(counts1) != 1:
        max1 = values1[1]
    elif len(counts2) != 1:
        max2 = values2[1]


count = 0
if max1 != max2:
    count += len([x for x in v1 if x != max1])
    count += len([y for y in v2 if y != max2])

else:
    count += len(v1)


print(count)


Measured memory_bytes: 22668
use std::cmp;

fn main(){
  let hw: Vec<usize> = read_vec();
  let h = hw[0];
  let w = hw[1];

  let mut va: Vec<Vec<usize>> = Vec::new();

  for _ in 0 .. h {
    va.push(read_vec());
  }

  let mut ml: usize = 2000000000;

  for x in 0 .. w {
    for y in 0 .. h {
      let mut tl: usize = 0;
      
      for i in 0 .. w {
        for j in 0 .. h {
          tl += cmp::min(if x > i {x-i} else {i-x}, if y > j {y-j} else {j-y}) * va[j][i];
        }
      }

      ml = cmp::min(ml, tl);
    }
  }
  println!("{:?}", ml);
}

fn read_vec<T>() -> Vec<T>
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.split_whitespace().map(|e| e.parse().unwrap()).collect()
}



Measured memory_bytes: 5028
#include<bits/stdc++.h>
using namespace std;
bool mmp(int a,int b)
{
return a>b;
}
int main()
{
   int n,k,ass=0;
   int a[51];
   cin>>n>>k;
   for(int i=1;i<=n;i++)
    {
    cin>>a[i];
    }
    sort(a+1,a+n+1,mmp);
    for(int i=1;i<=k;i++)   
    {
        ass+=a[i];
    }
    cout<<ass<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;
ll lcm(ll a,ll b){
    return a*b/__gcd(a,b);
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("a.in","r",stdin);
#endif
    ll n,m;
    cin>>n>>m;
    vector <ll> a(n);
    bool ok=false;
    ll ans=1;
    vector <int> cnt(n);
    rep(i,n) {
        cin >> a[i];
        a[i]/=2;
        while (a[i]%2==0)
            a[i]/=2,cnt[i]++;
    }
    for (int i=1;i<n;i++)
    {
        if (cnt[i]!=cnt[0])
        {
            cout<<0;
            return 0;
        }
    }
    rep(i,n)
    {
        ans=lcm(a[i],ans);
        if (ans>m)
        {
            cout<<0;
            return 0;
        }
    }
    m/=pow((ll)(2),cnt[0]);
    if (ok)
        cout<<0;
    else
        cout<<(m/ans+1)/2;






}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int N, D, X;
  cin >> N >> D >> X;
  int ans = X;
  rep(i, N)
  {
    int A;
    cin >> A;
    int date = 1;
    for (int j = 1; date <= D; j++)
    {
      ans++;
      date = j * A + 1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

#define lint long long
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

const lint MOD = 1e9 + 7;

lint power(lint x, lint n){
    lint t = 1;
    while(n > 0){
        if(n & 1){
            t *= x;
            t %= MOD;
        }
        x *= x;
        x %= MOD;
        n >>= 1;
    }
    return t;
}

int main(){
    string s;
    cin >> s;
    vector<lint> a(s.size() + 1, 0), c(s.size() + 1, 0), q(s.size() + 1, 0);
    rep(i, s.size()){
        a[i+1] = (s[i] == 'A') + a[i];
        c[i+1] = (s[i] == 'C') + c[i];
        q[i+1] = (s[i] == '?') + q[i];
    }
    lint ans = 0, x3 = power(3, q[s.size()]-3) % MOD, x2 = power(3, q[s.size()]-2) % MOD, x1 = power(3, q[s.size()]-1) % MOD, x = power(3, q[s.size()]) % MOD;
    rep(i, s.size()){
        if(s[i] == 'B'){
            ans += ((a[i] * (c[s.size()] - c[i+1])) % MOD) * x;
            ans %= MOD;
            ans += ((a[i] * (q[s.size()] - q[i+1])) % MOD) * x1;
            ans %= MOD;
            ans += ((q[i] * (c[s.size()] - c[i+1])) % MOD) * x1;
            ans %= MOD;
            ans += ((q[i] * (q[s.size()] - q[i+1])) % MOD) * x2;
            ans %= MOD;
        }else if(s[i] == '?'){
            ans += ((a[i] * (c[s.size()] - c[i+1])) % MOD) * x1;
            ans %= MOD;
            ans += ((a[i] * (q[s.size()] - q[i+1])) % MOD) * x2;
            ans %= MOD;
            ans += ((q[i] * (c[s.size()] - c[i+1])) % MOD) * x2;
            ans %= MOD;
            ans += ((q[i] * (q[s.size()] - q[i+1])) % MOD) * x3;
            ans %= MOD;
        }
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll r,d,x; cin>>r>>d>>x;
	for (int i=0; i<10; i++) {
		x=r*x-d;
		cout<<x<<"\n";
	}
	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;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, K, S; cin >> N >> K >> S;
    int x = 1000000000;
    if(x == S) x--;

    vec A(N, x);
    REP(i, K) A[i] = S;

    REP(i, N) cout << A[i] << ' ';
    cout << endl;

    return 0;
}


Measured memory_bytes: 2176
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    k = int(input().strip())

    def lunlun(step=9, path=0):
        if step < 0:
            if path > 0:
                yield path
            return
        prev = (path // 10 ** (step + 1)) % 10
        for i in range(max(prev - 1, 0), min(prev + 1 if path else 9, 9) + 1):
            for x in lunlun(step - 1, path + i * 10 ** step):
                yield x
    
    for _, x in zip(range(k), lunlun()):
        pass
    print(x)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 42588
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	n, _ := strconv.Atoi(nextLine())
	s := nextLine()

	mustLeft := 0
	left := 0
	right := 0
	for i := 0; i < n; i++ {
		if s[i] == '(' {
			left++
		} else {
			right++
		}
		mustLeft = int(math.Max(float64(mustLeft), float64(right-left)))

	}
	left += mustLeft
	mustRight := left - right

	for i := 0; i < mustLeft; i++ {
		s = "(" + s
	}
	for i := 0; i < mustRight; i++ {
		s = s + ")"
	}

	fmt.Println(s)

}


Measured memory_bytes: 640
N, X = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
L = 0
count = 0
flag = 0
for i in a:
    L += i
    count += 1
    if L > X:
        print(count)
        flag = 1
        break
if flag == 0:
    print(count+1)

Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	double x, y, z;
	int a, b;
	while(~scanf("%lf %lf %lf", &x, &y, &z))
	{
		b = y + z;
		a = x - z;
		printf("%d\n", a/b);
	}
}

Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class C
{
	public static void Main()	
	{
		long x = GetLong();
		long q = x/11;
		long rest = x - 11 * q;
		Console.WriteLine(2 * q + (rest + 5)/6);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 13140
#include<stdio.h>
int main(){
  int n,i;
  long long d[30]={1,2,4};
  while(scanf("%d",&n),n){
    for(i=3;i<n;i++)d[i]=d[i-1]+d[i-2]+d[i-3];
    printf("%lld\n",(d[n-1]-1)/3650+1);
  }
  return 0;
}
  

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

string S;

int main(void) {
	cin >> S;

	int ln = S.length();
	int ans = ln;
	for (int i = 0; i < ln - 1; ++i) {
		if (S[i] != S[i + 1]) {
			int x = i + 1;
			int y = ln - i - 1;
			int d = max(x, y);
			ans = min(d, ans);
		}
	}

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 512
MOD = 998244353
N, S = map(int, input().split())
A = list(map(int, input().split()))

dp = [[0 for j in range(S+1)] for i in range(N+1)] #dp[i][j] = i番目まで見て重さjのものを取る方法
dp[0][0] = 1

# for i in range(N):
#     for j in range(S+1):
#         dp[i+1][j] += 2*dp[i][j]
#         dp[i+1][j] %= MOD
#         if j + A[i] <= S:
#             dp[i+1][j+A[i]] += dp[i][j]
#             dp[i+1][j+A[i]] %= MOD

for i in range(1, N+1):
    for j in range(S+1):
        get = 0
        non_get = 2*dp[i-1][j] % MOD
    
        if j - A[i-1] >= 0:
            get = dp[i-1][j - A[i-1]]
        dp[i][j] = (non_get + get) % MOD
        
        

print(dp[N][S])            

# print(dp)
        

Measured memory_bytes: 147072
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repm(i, m, n) for (int i = (m); i < (int)(n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define all(vec) vec.begin(), vec.end()
using namespace std;

int main(){
  int a;
  //string a;
  cin >> a;
  vector<int> seq(a - 1);
  rep(i, a - 1) cin >> seq[i];
  
  int ans = 0;
  //string ans = "Yes";
  //string ans = "No";
  //string ans = "YES";
  //string ans = "NO";
  int cnt = 0;
  vector<int> w(a);
  w[0] = seq[0];
  repm(i, 1, a - 1) w[i] = min(seq[i], seq[i - 1]);
  w[a - 1] = seq[a - 2];
  rep(i, a) ans += w[i];

  cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod = 1000000007;
struct mint{
	ll x;
	mint(ll x = 0):x((x%mod+mod)%mod){}
	mint operator-() const{return mint(-x);}
	mint& operator+=(const mint a){
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a){
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a){
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
	bool operator==(const mint a){
		return x == a.x;
	}
};

mint f(int n){
	if(n == 0) return 1;
	mint x = f(n/2);
	x *= x;
	if(n%2 == 1) x *= 2;
	return x;
}

mint choose(int n, int a){
	mint x = 1, y = 1;
	rep(i,a){
		x *= n-i;
		y *= i+1;
	}
	return x / y;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, a, b;
	cin >> n >> a >> b;
	mint ans = f(n) - choose(n, a) - choose(n, b);
	ans -= 1;
	cout << ans.x << endl;
	return 0;
}

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

int main(){
	long A, B;
	cin >> A >> B;
	long a, b;
	a = A;
	b = B;
	long gcd;
	while(true){
		if(a == 0 || b == 0){
			gcd = a+b;
			break;
		}else{
			a = a%b;
			if(a != 0){
				b = b%a;
			}
		}
	}
	long ans = A*B/gcd;
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            string ans = "";
            for(int i = 0; i < 3; i++)
            {
                switch (n[i])
                {
                    case '1':
                        ans += "9";
                        break;
                    case '9':
                        ans += "1";
                        break;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 25832
#include<bits/stdc++.h>
using namespace std;int N,A[400000],i;long long ans=0;map<int,int> mp;main(){cin>>N;for(i=0;i<N;cin>>A[i],mp[A[i]+i]++,++i);for(i=0;i<N;ans+=mp[i-A[i]],++i);cout<<ans;}

Measured memory_bytes: 21440
#include <iostream>
using namespace std;
//include
//------------------------------------------
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>

using namespace std;

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int n;
int a[100000];
int main() {
	cin >> n;
	REP(i,n)cin>>a[i];
	int ans=0;
	REP(i,n){
		int swt = 0;
		bool now = a[i];
		int last=i;
		FOR(j,i+1,n+1){
			if(j==n || now==a[j]){
				if(j!=n && swt < 2){
					now=!now;
					if(!swt)last=j-1;
					swt++;
				}else{
					ans = max(ans,j-i);
					break;
				}
			}
			now=!now;
		}
		i=last;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3460
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    long MAX = (long)1e15;

    void run() {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt(), w = sc.nextInt();
        long[] dp = new long[w + 1];
        int[] wn = new int[n];
        long[] vn = new long[n];

        Arrays.fill(dp, -1);
        dp[0] = 0;

        for (int i = 0; i < n; i++) {
            wn[i] = sc.nextInt();
            vn[i] = sc.nextLong();
        }


        for(int j = 0; j < n; j++) for (int i = w; i >= 0; i--) if (dp[i] >= 0 && i + wn[j] <= w) {
            dp[i + wn[j]] = Math.max(dp[i + wn[j]], dp[i] + vn[j]);
        }

        long ans = 0;
        for (int i = 0; i <= w; i++) {
            ans = Math.max(ans, dp[i]);
        }
        System.out.println(ans);
    }


    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 26196
/*
 * Problem Description: Linear Search
 * Category:
 * Author: Khan
 * Date: 13th October, 2017
 */

#include <stdio.h>

int binary_search(int A[], int n, int key)
{
    int left = 0;
    int right = n;
    int mid;
    while(left < right)
    {
        mid = (left + right) / 2;
        if(A[mid] == key)
            return 1;
        if(key > A[mid])
            left = mid + 1;
        else if(key < A[mid])
            right = mid;
    }
    return 0;
}

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    int i, n, A[1000000], q, key, sum = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
    {
        scanf("%d", &A[i]);
    }
    scanf("%d", &q);
    for (int i = 0; i < q; ++i)
    {
        scanf("%d", &key);
        if(binary_search(A, n, key))
            sum++;
    }
    printf("%d\n", sum);
    return 0;
}

Measured memory_bytes: 2108
#include <stdio.h>

unsigned long a[100100];

int main()
{
	int k;
	unsigned long max, min;
	
	scanf("%d", &k);

	for (int i = 0; i < k; i++)
	{
		scanf("%ld", &a[i]);
	}

	max = 3, min = 2;

	if (a[k - 1] != 2)
	{
		printf("-1");
		return 0;
	}

	for (int i = k - 2; i >= 0; i--)
	{
		if (a[i] > max)
		{
			printf("-1");
			return 0;
		}
		else
		{
			max = ((max / a[i]) + 1)*a[i] - 1;

			if (min%a[i] != 0)
			{
				min = ((min / a[i]) + 1)*a[i];
			}
		}

		if (max <= min)
		{
			printf("-1");
			return 0;
		}
	}

	printf("%ld %ld", min, max);

	return 0;
}

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

int main() {
int64_t X;
  cin >> X;
  bool t= false;
  for(int i = -120; i < 120; i++){
    for(int j = -120; j <120; j++){
      if(i*i*i*i*i - j*j*j*j*j == X){
        cout << i <<' ' << j << endl;
        t= true;
      
      break;
    }
    }
      if(t){
        break;
      }
    }

}



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

typedef long long ll;

#define pb push_back
#define MS(x,y) memset((x),(y),sizeof((x)))
#define mn 1000000

using namespace std;

bool res = false;
bool vis[101];

void solve(int n) {
    if (n < 0) return;
    if (n == 0) {
        res = true;
        vis[n] = true;
        return;
    }

    if (vis[n]) return;

    solve(n-4);
    solve(n-7);

    vis[n] = true;
}

int main()
{
    #if LOCAL_DEBUG
        fstream cin("in.txt");
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;

    cin>>n;

    MS(vis, 0);

    solve(n);

    if (!res) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

    return 0;
}


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

int main()
{
    std::ios::sync_with_stdio(false);
    lld t = 1;
    // cin >> t;
    while(t--) {
        lld n;
        cin >> n;
        lld prod = 1;
        long double sum = 0;
        vector<lld> v(n);
        for(lld i = 0; i < n; i++) {
            cin >> v[i];
            sum += (1 * 1.0 / v[i]);
        }
        long double ans = 1 * 1.0 / sum;
        cout << fixed << setprecision(10) << ans << "\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;
const static ll MOD = 1e9+7;


int main(){
    int N; cin >> N;
    vector<int> A(N); for(int i = 0; i < N; i++) cin >> A[i];
    int N4=0, N2=0;
    for(int i = 0; i < N; i++){
        if(A[i] % 2 == 0){
            if(A[i] % 4 == 0) N4++;
            else N2++;
        }
    }
    if(N4*2 + max(N2-1, 0) >= N-1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1000000007;

using ll = long long;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);


    ll n, x;
    cin >> n >> x;

    ppp(3*(n-gcd(n, x)));

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int main(){

	string s="";

	cin>>s;

	string ans="";

	int i;
	for(i=0;i<s.length();i++){
		if(s[i]=='0'){ans+='0';}
		else if(s[i]=='1'){ans+='1';}
		else{
			if(ans.length()>0){
				ans.erase(ans.begin() + ans.length()-1); 
			}
		}
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'

int a[3][3];

bool check(){
  int ok = 0;
  int s = 0;
  forn(j,3){
    forn(i,3) s += a[i][j];
    ok |= s == -3;
    s = 0;
  }
  forn(i,3){
    forn(j,3) s += a[i][j];
    ok |= s == -3;
    s = 0;
  }
  forn(i,3) s += a[i][i];
  ok |= s == -3;
  s = 0;
  forn(i,3) s += a[3-i-1][i];
  ok |= s == -3;
  s = 0;
  
  return ok;
}

void solve(){
  forn(i,3) forn(j,3) cin >> a[i][j];
  int n;
  cin >> n;
  bool ok = 0;
  forn(i,n){
    int b;
    cin >> b;
    forn(i,3) forn(j,3) {
      if (a[i][j] == b) a[i][j] = -1;
    }
    ok = ok or check();
  }
  if (ok) cout << "Yes";
  else cout << "No";

}

int main() {
  ios::sync_with_stdio(false);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

1
322123


n - 1
0 ... (n-1) [res ... res] S - (n-1) ... S


 */

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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    ll x;
    cin >> x;
    ll n = x / 11;
    if(x%11==0) cout << n*2 << endl;
    else if(x%11<=6) cout << n*2+1 << endl;
    else cout << n*2+2 << endl;
    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int V = 100010;
char get(void) {
	static char buf[V], *p1 = buf, *p2 = buf;
	if (p1 == p2) {
		p2 = (p1 = buf) + fread(buf, 1, V, stdin);
		if (p1 == p2) return EOF;
	}
	return *p1++;
}
void Read(LL &x) {
	x = 0; static char c;
	while (c > '9' || c < '0') c = get();
	while (c >= '0' && c <= '9') {
		x = x * 10 + c - '0';
		c = get();
	}
}
LL ep[V], ep1[V], a[V], d[V], N, L, T, S;
int main(void) {
	//freopen("in.txt", "r", stdin);
	Read(N); Read(L); Read(T);
	int i, j;
	for (i = 1; i <= N; i++) {
		Read(a[i]); Read(d[i]);
		ep[i] = a[i] + (d[i] & 1 ? T : -T);
		ep1[i] = (ep[i] % L + L) % L;
		S = ((S + (ep[i] - ep1[i]) / L) % N + N) % N;
	}
	sort(ep1 + 1, ep1 + 1 + N);
	for (i = S + 1, j = 1; j <= N; j++, i = i % N + 1) printf("%d ", ep1[i]);
	return 0;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}
vl fact,finv;
ll modpw(ll x,ll k){
	ll res=1;
	while(k!=0){
		if(k&1)res=res*x%MOD;
		x=x*x%MOD;
		k=k>>1;
	}
	return res;
}

ll comb(ll n,ll k) {
	if(n==0&&k==0)return 1;
	if(n<k||n<0)return 0;
	return fact[n]*finv[n-k]%MOD*finv[k]%MOD;
}

struct ferm{
	ferm(ll n){
		fact.resize(n);
		finv.resize(n);
		fact[0]=1;
		finv[0]=1;
		rep(i,n-1){
			fact[i+1]=(fact[i]*(i+1))%MOD;
			finv[i+1]=modpw(fact[i+1],MOD-2);
		}
	}
};
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	ferm(n+1);
	vl v(n);
	rep(i,n)cin>>v[i];
	sort(all(v));
	ll ans=0;
	rep(i,n){
		ll ad=0;
		ll sub=0;
		ad=comb(i,k-1);
		sub=comb(n-i-1,k-1);
		//puta(ad,sub);
		ans+=v[i]*(ad%MOD-sub%MOD+MOD);
		ans%=MOD;
	}
	puta(ans);
}


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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    //good luck kittu!
    int n, k; cin>>n>>k;
    int count = 0;
    while(n){
        count++;
        n /= k;
    }
    cout<<count<<"\n";
    return 0;
}

Measured memory_bytes: 256
//∴ (Therefore)

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) int n;cin>>n;vector<int>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<int,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    int n;cin>>n;
    if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)cout<<"hon"<<nnn;
    if(n%10==0||n%10==1||n%10==6||n%10==8)cout<<"pon"<<nnn;
    if(n%10==3)cout<<"bon"<<nnn;
    return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll h;
  cin>>h;

  ll cnt=0;
  while(h>0){
    h/=2;
    cnt++;
  }

  ll dp[150];
  REP(i,150)dp[i]=1;
  for(ll i = 2; i<150; i++)
    dp[i] = dp[i-1]*2+1;

  cout << dp[cnt] << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> n(3);
  cin >> n.at(0) >> n.at(1) >> n.at(2);
  sort(n.begin(), n.end());
  if (n.at(0) == 5 && n.at(1) == 5 && n.at(2) == 7) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>

int main(){
  long long int N, tmp;
  std::vector<long long int> d;
  
  scanf("%lld", &N);
  long long int sumd = 0;
  long long int sumd2 = 0;
  for(long long int i = 0; i < N; i++){
    scanf("%lld", &tmp);
    sumd += tmp;
    sumd2 += tmp*tmp;
  }
  
  std::cout << (sumd*sumd - sumd2)/2;
  
  return 0;
}


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

int main()
{
	ll s;
	cin >> s;
	ll a = s/1000000000;
	ll b = s%1000000000;
	//if(b==0)b=1000000000;
	if(s==1000000000000000000)cout<<0<<' '<<0<<' '<<1000000000<<' '<<0<<' '<<0<<' '<<1000000000<<endl;
	else cout<<0<<' '<<0<<' '<<1000000000<<' '<<1<<' '<<(1000000000-b)<<' '<<a+1<<endl;
	return 0;
}


Measured memory_bytes: 256