akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  string s; cin>>s; int n=s.length();
  vector<int> a;
  int cnt = 1;
  char prev = s[0];
  for(int i=1; i<n; i++) {
    if (s[i] == prev) cnt++; 
    else {
      a.push_back(cnt);
      prev = s[i];
      cnt = 1;
    }
  }
  a.push_back(cnt);
 for (int i=0; i<a.size(); i+=2) {
   rep(j, a[i]-1) {
     cout << 0 << ' ';
   }
   cout << ceil((double) a[i]/2) + a[i+1]/2 << ' ';
   cout << ceil((double) a[i+1]/2) + a[i]/2 << ' ';
   rep(j, a[i+1]-1) cout << 0 << ' ';
 } 
 puts("");
  return 0;
}

Measured memory_bytes: 1144
n=int(input())
h=list(map(int,input().split()))
h.append(float('inf'))
ans=0
cnt=0
for i in range(n):
  if h[i]>=h[i+1]:
      cnt+=1
  else:
    ans=max(ans,cnt)
    cnt=0
ans=max(ans,cnt)
print(ans)    

Measured memory_bytes: 14224
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

str a,b;
int sum;
int s;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>a>>b;
    int m = 1;
    for(int i=b.size()-1;i>=0;i--){
        int d = numerize(b[i]);
        sum+=d*m;
        m*=10;
    }
    for(int i=a.size()-1;i>=0;i--){
        int d = numerize(a[i]);
        sum+=d*m;
        m*=10;
    }
    s = sqrt(sum);
    if(s*s == sum)cout<<"Yes\n";
    else cout<<"No\n";
}


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

struct suffix_array{
    int n;
    vector <int> x;
    suffix_array(const char *s) : n(strlen(s)),x(n){
        vector<int> r(n),t(n);
        for (int i = 0; i < n; ++i) r[x[i] = i] = s[i];
        for (int h = 1; t[n-1] != n-1 ; h *= 2) {
            auto cmp = [&](int i,int j){
                if(r[i] != r[j]) return r[i] < r[j];
                return i + h < n && j + h < n ? r[i+h] < r[j+h] : i >j;
            };
            sort(x.begin(),x.end(),cmp);
            for (int i = 0; i + 1 < n ; ++i)  t[i + 1] = t[i] + cmp(x[i],x[i+1]);
            for (int i = 0; i < n; ++i)  r[x[i]] = t[i];
        }
    }
    int operator[] (int i) const {return x[i];}
};

bool contain(const string &S, int *sa, const string &T) {
    int lb = -1, ub = S.size() - 1;
    while(ub -lb > 1){
        int mid = (lb + ub )/ 2;
        if(S.compare(sa[mid], T.size(), T) >= 0) ub = mid;
        else lb = mid;
    }
    return S.compare(sa[ub], T.size(), T) == 0;
}

signed main(){
    ios::sync_with_stdio(false);
    string T; cin >> T;
    int Q; cin >> Q;
    suffix_array sary(T.c_str());
    while(Q--){
        string P; cin >> P;
        cout << (contain(T,sary.x.data(),P) ? 1 : 0) << endl;
    }
}

Measured memory_bytes: 15804
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

const int dx[] = { -1, 0, 0, 1 }, dy[] = { 0, -1, 1, 0 };
//const int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy[] = { 0, -1, 1, -1, 1, 0, -1, 1 };
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
int place(int x, int y, int w) { return w*x + y; }

struct Cube
{
	char top, bottom, north, south, east, west;
	Cube() :top('r'), bottom('c'), north('g'), south('m'), east('b'), west('y') {};
	void to_north()
	{
		char t = north;
		north = top;
		top = south;
		south = bottom;
		bottom = t;
	}
	void to_south()
	{
		char t = south;
		south = top;
		top = north;
		north = bottom;
		bottom = t;
	}	
	void to_east()
	{
		char t = east;
		east = top;
		top = west;
		west = bottom;
		bottom = t;
	}
	void to_west()
	{
		char t = west;
		west = top;
		top = east;
		east = bottom;
		bottom = t;
	}
};

bool operator<(const Cube& a, const Cube& b)
{
	if (a.top != b.top) return a.top < b.top;
	if (a.bottom != b.bottom) return a.bottom < b.bottom;
	if (a.north != b.north) return a.north < b.north;
	if (a.south != b.south) return a.south < b.south;
	if (a.east != b.east) return a.east < b.east;
	if (a.west != b.west) return a.west < b.west;
	return false;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int h, w;
	while (cin >> w >> h, h)
	{
		vs fld(h);
		REP(i, h) cin >> fld[i];
		string s; cin >> s;
		int sx, sy;
		REP(i, h)REP(j, w)
		{
			if (fld[i][j] == '#')
			{
				sx = i, sy = j;
				fld[i][j] = 'w';
			}
		}
		queue<tuple<int, int, int, Cube, int>> que;
		que.emplace(sx, sy, 0, Cube(), 0);
		set<tuple<int, int, int, Cube>> st;
		st.emplace(sx, sy, 0, Cube());
		bool ok = false;
		while (!que.empty())
		{
			int x, y, p, cnt; Cube tmp;
			tie(x, y, p, tmp, cnt) = que.front();
			que.pop();
			if (p == s.size())
			{
				ok = true;
				cout << cnt << endl;
				break;
			}
			REP(i, 4)
			{
				int nx = x + dx[i], ny = y + dy[i];
				int np = p;
				Cube nc = tmp;
				if (i == 0) nc.to_north();
				if (i == 1) nc.to_west();
				if (i == 2) nc.to_east();
				if (i == 3) nc.to_south();
				if (!valid(nx, ny, h, w) || fld[nx][ny] == 'k') continue;
				if (fld[nx][ny] != 'w')
				{
					if (fld[nx][ny] != s[p] || nc.top != fld[nx][ny]) continue;
					np++;
				}
				if (st.count(make_tuple(nx, ny, np, nc))) continue;
				st.emplace(nx, ny, np, nc);
				que.emplace(nx, ny, np, nc, cnt + 1);
			}
		}
		if (!ok) cout << "unreachable" << endl;
	}
	return 0;
}

Measured memory_bytes: 7220
#include<iostream>
#include<cstring>
#include<algorithm>
 
using namespace std;
 
int main(){
  string s;
  string ans = "";
  int p = 0;
  cin>>s;
  for(int i = 0;i<s.size();i++){
    if(s[i] != 'B'){
      ans += s[i];
      p++;
    }else{
      if(p != 0)
	--p;
      ans = ans.substr(0,p);
    }
  }
  cout<<ans<<endl;
  
  return 0;
}


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

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

vector<int> edges[200010];
vector<int> c(200010,0);

void dfs(int i,int p = -1) {
    for (int& j : edges[i]) if (j != p) {
        c[j] += c[i];
        dfs(j,i);
    }
}

int main() {
    int n,q;
    cin >> n >> q;
    for (int i = 0;i < n-1;++i) {
        int u,v;
        cin >> u >> v;
        u--;v--;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    for (int i = 0;i < q;++i) {
        int p,x;
        cin >> p >> x;
        c[p-1] += x;
    }
    dfs(0);
    for (int i = 0;i < n;++i) cout << c[i] << " \n"[i == n-1];
    return 0;
}


Measured memory_bytes: 23424
#include <stdio.h>

main(){
  int num[7], input, n, i, tmp;

  while(1){
    scanf("%d", &n);
    if(n==0) break;

    for(i=0;i<7;i++) num[i]=0;
    for(i=0;i<n;i++){
      scanf("%d", &input);
      tmp=input/10;
      if(tmp>=7) tmp=6;
      num[tmp]++;
    }

    for(i=0;i<7;i++){
      printf("%d\n", num[i]);
    }
  }
  return 0;
}

Measured memory_bytes: 404
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
	ll h, w;
	cin >> h >> w;
	ll ans = INF;
	for (int rep = 0; rep < 2; rep++) {
		for (int i = 1; i <= h; i++) {
			ll a = i * w;
			ll b = (h - i) / 2 * w;
			ll c = (h - i) * w - b;
			ll d = (h - i) * (w / 2);
			ll e = (h - i) * w - d;
			ll mn1 = min({a, b, c});
			ll mx1 = max({a, b, c});
			ll mn2 = min({a, d, e});
			ll mx2 = max({a, d, e});
			ans = min({ans, mx1 - mn1, mx2 - mn2});
		}
		swap(h, w);
	}
	cout << ans;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
As = list(map(int,input().split()))
nc=[0]*(200000+1)
for a in As:
    nc[a] += 1
setA = set(As)
kind = len(setA)
if kind - K <= 0:
    print(0)
else:
    nc.sort()
    c = 0
    for i in range(200000+1):
        if nc[i] == 0:
            continue
        c += nc[i]
        kind -= 1
        if kind == K:
            break
    print(c)


Measured memory_bytes: 119696
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979;

int main() {
  ll x,c=0,X=100;
  cin>>x;
  while(X<x){
    c++;
    long double d=X;
    d*=1.01;
    X=d;
  }
  cout<<c;
      
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll H, W, N;
    cin >> H >> W >> N;
    pll s;
    cin >> s.first >> s.second;
    s.first--;
    s.second--;
    string S, T;
    cin >> S >> T;

    //! 高橋が左右から脱出できるか見る
    bool e = false;
    ll wr = s.second;
    ll wl = s.second;
    REP(i, N)
    {
        //! 高橋の手番
        if (S[i] == 'L')
            wl--;
        else if (S[i] == 'R')
            wr++;

        if (wr >= W || wl < 0)
            e = true;

        //! 青木の手番
        if (T[i] == 'L')
            wr = std::max(0LL, wr - 1);
        else if (T[i] == 'R')
            wl = std::min(W - 1, wl + 1);
    }

    //! 高橋が上下から脱出できるか
    ll hu = s.first;
    ll hd = s.first;
    REP(i, N)
    {
        //! 高橋の手番
        if (S[i] == 'U')
            hu--;
        else if (S[i] == 'D')
            hd++;

        if (hu < 0 || hd >= H)
            e = true;
        //! 青木の手番
        if (T[i] == 'U')
            hd = std::max(0LL, hd - 1);
        else if (T[i] == 'D')
            hu = std::min(H - 1, hu + 1);
    }

    if (e)
        cout << "NO" << endl;
    else
        cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using pll = pair<ll,ll>;
using Graph = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i,l,r) for(ll i = (l); i <= (ll)(r); i++)
#define rep3(i,l,r) for(ll i = (l); i >= (ll)(r); i--)
#define dup(x,y) (((x)+(y)-1)/(y)) // x/yの除算の切り上げ
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int inf = 1001001001;
const ll INF = 1LL << 60;
const ll mod = 1000000007; //1000000007;
const ld pi = acos(-1);

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

    ll k;
    cin >> k;
    if(k%2==0){
        cout << -1 << endl;
        return 0;
    }
    ll x=0;
    rep(i,k+10){
        x=x*10+7;
        if(x<0) x+=k;
        x%=k;
        if(x<0) x+=k;
        if(x==0){
            cout << i+1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a.at(i);
  sort(all(a),greater<int>());
  int alice = 0, bob = 0;
  rep(i,n){
    if(i % 2 == 0) alice += a.at(i);
    else bob += a.at(i);
  }
  cout << alice - bob << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    vector<P> v;
    for(int i = 0; i < n; i++)
    {
        ll a, b; cin >> a >> b;
        v.push_back(P(a, b));
    }
    sort(v.begin(), v.end());
    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        if(m == 0) break;
        if(m - v[i].second < 0)
        {
            ans += v[i].first * m;
            m = 0;
        }
        else
        {
            ans += v[i].second * v[i].first;
            m -= v[i].second;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 2420
n = int(input())
a = [int(i) for i in input().split()]

ans = 0

for i in range(len(a)):
  while True:
    if a[i] % 2 != 0:
      break
    elif a[i] % 2 == 0:
      a[i] = a[i] // 2
      ans += 1
    
print(ans)

Measured memory_bytes: 4148
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;

typedef pair<int, int> P;

const P dir[] = {
    P(0, -1),
    P(-1, 0),
    P(0, 1),
    P(1, 0)};

int main() {
    int H, W;
    cin >> H >> W;

    vector<vector<char>> S(H, vector<char>(W));

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> S[i][j];
        }
    }

    int ans;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (S[i][j] == '#') {
                continue;
            }
            vector<vector<int>> dist(H, vector<int>(W, INF));
            queue<P> q;

            auto update = [&](int i, int j, int x) {
                if (S[i][j] == '#') {
                    return;
                }
                if (dist[i][j] != INF) {
                    return;
                }
                // cout << "i: " << i << ", j: " << j << ", x: " << x << endl;
                dist[i][j] = min(x, dist[i][j]);
                q.push(P(i, j));
            };

            update(i, j, 0);
            while (!q.empty()) {
                P p = q.front();
                q.pop();

                for (auto d : dir) {
                    int x = p.second + d.first;
                    int y = p.first + d.second;
                    if (x < 0 || W <= x) continue;
                    if (y < 0 || H <= y) continue;
                    update(y, x, dist[p.first][p.second] + 1);
                }
            }

            for (int y = 0; y < H; y++) {
                for (int x = 0; x < W; x++) {
                    if (dist[y][x] != INF) {
                        ans = max(ans, dist[y][x]);
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	map<ll,ll> m;
	vector<ll> c(26,0);
	vector<ll> d((ll)s.size()+1);
	REP(i,(ll)s.size()) {
		ll buf1=1;
		ll buf2=0;
		REP(j,26) {
			if(c[j]%2==1) {
				buf2+=buf1;
			}
			buf1*=2;
		}
		d[i]=buf2;
		m[buf2]=INF;
		c[s[i]-'a']++;
	}
	ll buf1=1;
	ll buf2=0;
	REP(i,26) {
		if(c[i]%2==1) {
			buf2+=buf1;
		}
		buf1*=2;
	}
	d[(ll)s.size()]=buf2;
	m[buf2]=INF;
	m[0]=0;
	REP(i,(ll)s.size()+1) {
		ll ret=INF;
		ret=min(ret,m[d[i]]+1);
		REP(j,26) {
			ll buf=d[i];
			if(d[i]%(1<<(j+1))!=d[i]%(1<<(j))) {
				buf-=(1<<(j));
			} else {
				buf+=(1<<(j));
			}
			if(m.count(buf)!=0) ret=min(ret,m[buf]+1);
		}
		m[d[i]]=min(m[d[i]],ret);
	}
	if(d[(ll)s.size()]==0) cout<<1<<endl;
	else cout<<m[d[(ll)s.size()]]<<endl;
}


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

int main() {
  int h, w;
  cin >> h >> w;
  vector<bool> row(h, false);
  vector<bool> col(w, false);
  vector<string> a(h);
  for (int i = 0; i < h; i++){
      cin >> a.at(i);
  }
  
  for (int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(a.at(i).at(j) == '#'){
        row.at(i) = true;
        col.at(j) = true;
      }
    }
  }
  for(int i = 0; i < h; i++){
    if(row.at(i)){
      for(int j = 0; j < w; j++){
        if(col.at(j)){
          cout << a.at(i).at(j);
        }
      }
    cout << endl;
    }
  }
}

/*#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
	int h;
	cin >> h;
	int w;
	cin >> w;
	vector<string> a(h);
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}

	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}*/


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

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

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n){
        cin>>a[i];
    }
    ll ans=0,pre=0;
    rep(i,n){
        if(a[i]<pre){
            ans+=pre-a[i];
        }else{
            pre=a[i];
        }
    }
    cout<<ans<<endl;
}

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

 int main() {
   // 入力
   int n;
   cin >> n;
   vector<tuple<string, int, int>> v(n);
   for (int i = 0; i < n; i++) {
     cin >> get<0>(v[i]) >> get<1>(v[i]);  //<0>cityname ,<1>point
     get<2>(v[i]) = i + 1; //仮のインデックスナンバー 後で入れ替え用
   }

   // ソート
   sort(v.begin(), v.end(), [](auto a, auto b) { //vector内の頭からケツまですべて先頭のstringでsort
     //[](auto a, auto b) sort(head,butt,cmpr-func)

    /*     // nameをキーに昇順でソート
    sort(fruits.begin(), fruits.end(),[](const fruit& x, const fruit& y)
                                      { return x.name < y.name;}); //フルーツの名前をアルファベット順に変える x<y

    // priceをキーに降順でソート
    sort(fruits.begin(), fruits.end(),
         [](const fruit& x, const fruit& y) { return x.price > y.price;});
    */

     if (get<0>(a) == get<0>(b)) //stringの文字一緒なら
       return get<1>(a) > get<1>(b);  //点数の大きいほう
     else
       return get<0>(a) < get<0>(b); //
   });

   // 出力
   for (auto x : v) cout << get<2>(x) << endl;
 }


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;
  vector<ll> a(n);
  vector<ll> b(n);
  vector<ll> c(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) cin >> c[i];

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  // あるbの段を選んだときにcの段がいくつ選べるか
  vector<ll> b_cnt(n);
  {
    rep(i, n) {
      auto c_it = upper_bound(c.begin(), c.end(), b[i]);
      b_cnt[i] = distance(c_it, c.end());
    }
  }
  // あるb以降の組み合わせの総和
  vector<ll> b_cnt_wa(n);
  {
    ll wa = 0;
    for(int i=n-1;i>=0;i--) {
      wa += b_cnt[i];
      b_cnt_wa[i] = wa;
    }
  }

  // あるaの段を選んだとき
  ll ans = 0;
  {
    rep(i, n) {
      auto b_it = upper_bound(b.begin(), b.end(), a[i]);
      int b_index = distance(b.begin(), b_it);
      ans += b_cnt_wa[b_index];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7224
def guumoji(s):
    if len(s)%2 != 0:
        return False
    else:
        s1 = s[:int(len(s)/2)]
        s2 = s[int(len(s)/2):]
        if s1 == s2:
            return True
        else:
            return False
s = input()
i = 2
while i < len(s):
    s0 = s[:-i]
    if guumoji(s0):
        break
    else:
        i += 2
print(len(s0))

Measured memory_bytes: 3060
use std::cmp::min;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');

    let cv: Vec<char> = s.chars().collect();
    let mut rc = 0;
    let mut bc = 0;
    for i in 0..cv.len() {
        match cv[i] {
            '0' => rc += 1,
            '1' => bc += 1,
            _ => unreachable!(),
        }
    }
    let ans = min(rc, bc) * 2;
    println!("{}", ans);
}


Measured memory_bytes: 4352
n, k = map(int, input().split())
ans = 0

for i in range(1, n+1):
    count = 0
    if i >= k:
        ans += 1 / n
    else:
        count = 1
        while i * 2**count < k:
            count += 1
        num = (1/n) * (0.5**count)
        ans += num

print('{:.12f}'.format(ans))

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

int main() {
  int n; cin >> n;
  map<int,int> m;
  rep(i,n) {
    int ai; cin >> ai;
    m[ai]++;
  }
  ll ans = 1, cnt = 0;
  for (auto it = m.rbegin(); it != m.rend(); it++) {
    ll k = (*it).first;
    int v = (*it).second;
    while (v >= 2 && cnt < 2) {
      ans *= k;
      v-=2;
      cnt++;
    }
    if (cnt > 2) break;
  }
  if (cnt < 2) ans = 0;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8216
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
template<typename T> T gcd(T a,T b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
int n;
vi v;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  v.pb(0);
  ll s = 0;
  cin >> n;
  FOR(i, 0, n){
    int a;
    cin >> a;
    v.pb(a);
    s += abs(a - v[i]);
  }
  v.pb(0);
  s += abs(0 - v[n]);
  FOR(i, 1, n+1) printf("%d\n", s - abs(v[i]-v[i-1]) - abs(v[i+1]-v[i]) + abs(v[i+1]-v[i-1]));
  return 0;
}


Measured memory_bytes: 1784
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string lis;
	cin>>lis;
	bool ans=true;
	ll i;
	for(i=0;i<3;i++)
	{
		if(lis[i]=='7')
		{
			ans=true;
			break;
		}
		else
		{
			ans=false;
		}	
	}
	if(ans==true)
	{
		cout<<"Yes"<<"\n";
	}
	else
	{
		cout<<"No"<<"\n";
	}
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略

int main(){
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  ll ans = 0;
  bool flag1 = false;
  bool flag2 = false;
  bool flag3 = false;
  while(true){
    for(ll j = 0; j < a; j++){
      if(j >= k){
        flag1 = true;
        break;
      }
      ans += 1;
    }
    if(flag1 == true){
        break;
      }
    for(ll j = 0; j < b; j++){
      if(j+a >= k){
        flag2 = true;
        break;
      } 
    }
    if(flag2 == true){
        break;
    }
    for(ll j = 0; j < c; j++){
      if(j+a+b >= k){
        flag3 = true;      
        break;
      }
      ans -= 1;
    }
    flag3 = true;
    if(flag3 == true){
        break;
    }
  }
  cout << ans;
}

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

using namespace std;

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

typedef long long LL;
typedef pair<int, int> Pii;

const int inf = 0x3f3f3f3f;
const LL infLL = 0x3f3f3f3f3f3f3f3fLL;

const int maxn = 500 + 5;

int n, k;
int a[maxn], b[maxn];

bool check(int g) {
  rep(i, n) b[i] = a[i] % g;
  sort(b, b + n);
  int x = 0, y = 0;
  rep(i, n) y += g - b[i];
  rep(i, n) {
    x += b[i];
    y -= g - b[i];
    if (x == y && x <= k && y <= k) return true;
  }
  return false;
}

int main() {
  scanf("%d%d", &n, &k);
  int sum = 0;
  rep(i, n) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  int ret = 0;
  for (int i = 1; i * i <= sum; ++i)
    if (sum % i == 0) {
      if (check(i)) ret = max(ret, i);
      if (check(sum / i)) ret = max(ret, sum / i);
    }
  printf("%d\n", ret);

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int num = 1;
    while(N--) {
        num = min(num * 2, num + K);
    }
    cout << num << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#define MOD 1e9+7
using namespace std;
int N;
int p[100002];
int main(){
  cin >> N;
  for(int i=1;i<=N;i++)cin >> p[i];
  int ans=0;
  int i=1;
  while(i<=N){
    if(p[i]==i){
      if(i<N){
	ans++;
	i+=2;
      }
      else{
	ans++;
	i++;
      }
    }
    else i++;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	pair<int,int> mx = {-1e9,-1};
	pair<int,int> mn = {1e9,-1};
	for(int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		if(x > mx.first) mx = {x,i};
		if(x < mn.first) mn = {x,i};
	}
	cout << 2*n - 1 << endl;
	if(abs(mx.first) > abs(mn.first)) {
		for(int i = 0; i < n; ++i) {
			cout << mx.second + 1 << ' ' << i + 1 << endl;
		}
		for(int i = 0; i + 1< n; ++i) {
			cout << i + 1 << ' ' << i + 2 << endl;
		}
	}
	else {
		for(int i = 0; i < n; ++i) {
			cout << mn.second + 1 << ' ' << i + 1 << endl;
		}
		for(int i = n-1; i >= 1; --i) {
			cout << i + 1 << ' ' << i << endl;
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  string s;
  cin >> s;
  int n = s.size();

  int ans = 0;
  rep(i,n-1) {
    if (s[i] != s[i+1]) ans++;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
import io.StdIn.readLine 

object Main {
  def main(args: Array[String]): Unit = {
    var s = readLine().sorted
    if(s(0) == s(1) && s(2) == s(3) && s(0) != s(2)){
      println("Yes")
    }else{
      println("No")
    }
  }
}

Measured memory_bytes: 54836
/*input
46 4 40 5
*/

#include <bits/stdc++.h>

using namespace std;

int A, B, C, D;

int main() {
	cin >> A >> B >> C >> D;
	cout << ((A + D - 1) / D >= (C + B - 1) / B ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3644
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int x,y;
int main()
{
	cin>>x>>y;
	if(abs(x)<abs(y))cout<<abs(y)-abs(x)+(x<0)+(y<0);
	else cout<<abs(x)-abs(y)+(x>0)+(y>0);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=2e5+10;
const int N=1e6+10;
typedef long long ll;
const ll mod=1e9+7;
#define per(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define inf 0x3f3f3f3f
#define qwq puts("QWQ");
#define qaq puts("QAQ");
#define mem(a,b) memset(a,b,sizeof(a))
#define mid ((l+r)>>1)
#define l(x) x<<1
#define r(x) x<<1|1
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
void read(int &x)
{
	int f=1;x=0;
	char s=getchar();
	while(s<'0'||s>'9')
    {
    	if(s=='-')f=-1;
    	s=getchar();
	}
	while(s>='0'&&s<='9')x=x*10+s-'0',s=getchar();
	x*=f;
}
int main()
{
	double w,h,x,y,sa,sb,sc,sd,ans,sum;
	int flag=0;
	scanf("%lf%lf%lf%lf",&w,&h,&x,&y);
	sum=w*h;
	if(x==w/2&&y==h/2)flag=1;
	printf("%.6lf %d\n",sum/2,flag);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;

int gi() {
	int x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,m,T,x[N],y[N],a[N],cnt[N];
char ans[N];
bitset<50010> b[50010];

void mdf(int x,int y) {
	--cnt[a[x]];a[x]=y;++cnt[a[x]];
}

int main() {
	cin>>n>>m>>T;
	for(int i=1;i<=m;i++) x[i]=gi(),y[i]=gi();
	if(T==1) {
		for(int i=1;i<=n;i++) b[i][i]=1;
		for(int i=m;i;i--) b[x[i]]=b[y[i]]=b[x[i]]|b[y[i]];
		bitset<50010> all;for(int i=1;i<=n;i++) all[i]=1;
		for(int i=1;i<=n;i++) all&=b[i];
		if(!all.count()) cout<<-1,exit(0);
		else {
			int p=0;for(int i=1;i<=n;i++) if(all[i]) { p=i;break; }
			a[p]=1;
			for(int i=m;i;i--) {
				if(a[x[i]]&&!a[y[i]]) ans[i]='^';
				else ans[i]='v'; a[x[i]]=a[y[i]]=(a[x[i]]|a[y[i]]);
			}
		}
	}
	else {
		if(n==2) cout<<-1,exit(0);
		for(int i=1;i<=n;i++) a[i]=i,++cnt[i];
		for(int i=m;i;i--) {
			if(cnt[a[x[i]]]>1) ans[i]='v',mdf(x[i],a[y[i]]);
			else ans[i]='^',mdf(y[i],a[x[i]]);
		}
	}
	for(int i=1;i<=m;i++) putchar(ans[i]);
	return 0;
}


Measured memory_bytes: 307584
n,m,c = list(map(int, input().strip().split()))
b= list(map(int, input().strip().split()))
s = []
for i in range(n):
    array = list(map(int, input().strip().split()))
    s.append(array)
ans=0
for i in range(n):
    x=c
    for j in range(m):
        x+=b[j]*s[i][j]
    if x>0:
        ans=ans+1
print(ans)

Measured memory_bytes: 9168
def choose_hand(last,next):
    for j in ['r','s','p']:
        if j!=last and j!=next:
            return j

n,k = map(int,input().split())
r,s,p = map(int,input().split())
points = {'r':r, 's':s, 'p':p}
hands = {'r':'p', 's':'r', 'p':'s'}
t = list(input())
rpsList = ['']*n
ans = 0

for i,hand in enumerate(t):
    rpsList[i] += hands[hand]
    if i>=k and rpsList[i]==rpsList[i-k]:
        lastHand = rpsList[i-k]
        nextHand = hands[t[i+k]] if i+k<n  else ''
        rpsList[i] = choose_hand(lastHand,nextHand)
    else:
        ans += points[hands[hand]]

print(ans)

Measured memory_bytes: 10612
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15
#define PI 3.141592653589793
#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
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;



int main() {
	go;
    cin >> N;
    if(N <= 6) {
    	cout << 1 << "\n";
    	quit;
    }
    if(N == 7) {
    	cout << 2 << "\n";
    }
   	else {
   		ll ans = N / 11;
   		ans *= 2;
   		// ans--;
   		if(N % 11 == 0) {
   		}
   		else if((N % 11 <= 6)) {
	   		// trace1(N % 11);
   			ans++;
   		}
   		else {
   			ans += 2;
   		}
   		cout << ans << "\n";
   	}
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 3608
/**
    And in the end, the love you take is equal to the love you make.

        I LOVE YOU LAURA.
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_DISABLE_PERFCRIT_LOCKS

#define findOrder find_by_order
#define orderKey order_of_key

#define isOn(mask, i) (mask & (1 << i))
#define turn(mask, i) (mask |= (1 << i))
#define switch(mask, i) (mask &= ~(1 << i))
#define change(mask, i) (mask ^= (1 << i))
#define lowbit(mask) (mask & (-mask))
#define turnAll(mask, n) (mask = (1 << n) - 1)
#define switchLastBit(mask) (mask & (mask - 1))
#define turnLastZero(mask) (mask | (mask + 1))
#define modulo(x, mod) ((x) & (mod - 1))
#define log2(x) (31 - __builtin_clz(x))

#define mkp make_pair
#define pb push_back
#define pf push_front
#define eb emplace_back
#define ef emplace_front
#define ins insert
#define rsz resize
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) ((int)x.size())
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define debug(x) (cerr << x << " ")

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

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

typedef pair<int, int> ii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdb;
typedef pair<int, ii> tri;
typedef complex<ld> cd;

typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ld> vdb;
typedef vector<cd> vcd;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vll> matrix;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_tree;

const ll mod = 1e9+7;
const int maxn = 405;
const int pi = 2 * acos(0.0);
const db eps = 1e-9;

ll dp[maxn][maxn], sum[maxn], arr[maxn];

ll solve_dp (int l, int r){
    if (l == r) return 0LL;

    ll &ans = dp[l][r];
    if (ans != -1) return ans;

    ans = (1LL << 60);
    for (int i = l; i < r; i++){
        ans = min(ans, solve_dp(l, i) + solve_dp(i + 1, r));
    }

    ans += (sum[r] - sum[l - 1]); // cost of combine element
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    memset(dp, -1, sizeof dp);

    int n; cin >> n;

    for (int i = 1; i <= n; i++){
        cin >> arr[i];
        sum[i] = sum[i - 1] + arr[i];
    }

    cout << solve_dp(1, n) << "\n";

    return 0;
}


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

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

int abs(int x){
  if(x<0){
    x=-x;
  }
  return x;
}

int main(){
  int x,a,b;
  cin>>x>>a>>b;
  if(abs(x-a)<abs(x-b)){
    cout<<"A"<<endl;
  }else{
    cout<<"B"<<endl;
  }
}


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

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll ma = b * d;
  ma = max({a * c, a * d, b * d, b * c});
  if ((a <= 0 && b >= 0) || (c <= 0 && d >= 0)) ma = max((ll)0, ma);
  cout << ma << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1005;
inline int read(){
	char c=getchar();int t=0,f=1;
	while((!isdigit(c))&&(c!=EOF)){if(c=='-')f=-1;c=getchar();}
	while((isdigit(c))&&(c!=EOF)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n,x[maxn],y[maxn],len[40];
char s[40];
signed main(){
	n=read();
	for(int i=1;i<=n;i++)x[i]=read(),y[i]=read();
	int tmp=(x[1]+y[1])&1;
	for(int i=2;i<=n;i++){
		int alfa=(x[i]+y[i])&1;
		if(alfa!=tmp){tmp=-1;break;}
	}
	if(tmp==-1){puts("-1");return 0;}
	printf("%d\n1 ",32-tmp);
	len[1]=1;int N=1;
	if(tmp){
		for(int i=1;i<=30;i++)printf("%d ",len[++N]=1<<i);
		puts("");
	}
	else{
		for(int i=0;i<=30;i++)printf("%d ",len[++N]=1<<i);
		puts("");
	}
	for(int i=1;i<=n;i++){
		ll nx=0,ny=0;
		for(int j=N;j;j--){
			ll dx=x[i]-nx,dy=y[i]-ny;
			if(abs(dx)>abs(dy)){
				if(dx>0)nx+=len[j],s[j]='R';
				else nx-=len[j],s[j]='L';
			}
			else{
				if(dy>0)ny+=len[j],s[j]='U';
				else ny-=len[j],s[j]='D';
			}
		}printf("%s\n",s+1);
	}
	return 0;
}


Measured memory_bytes: 256
Module Main
  Sub Main
    Dim s = Console.ReadLine()
    Dim ss = s.Split(" "c)
    Dim a = CInt(ss(0))
    Dim b = CInt(ss(1))
    If a > 8 OrElse b > 8 Then
      Console.WriteLine(":(")
    Else
      Console.WriteLine("Yay!")
    End If
  End Sub
End Module


Measured memory_bytes: 22352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
const int N = 2e5+5;
const ll mod = 1e9+7;
vector<int>v[N];
int n,k;
ll fac[N];
ll inv[N];
ll po(ll a, ll b){
    if(b==0)return 1;
    ll x = po(a,b/2);
    x = (x*x)%mod;
    if(b&1)x = (x*a)%mod;
    return x;
}
ll nck(ll a, ll b){
    if(b>a)return 0;
    ll ret = (fac[a]*inv[b])%mod;
    ret = (ret*inv[a-b])%mod;
    return ret;
}
ll dp[N];
bool vis[N];
int root = 0;
void dfs(int x){
    vis[x] = true;
    int cnt = k-2;
    if(x==root)cnt++;
    dp[x] = 1;
    int chld = 0;
    for(int y:v[x]){
        if(vis[y])continue;
        dfs(y);
        chld++;
        dp[x] = (dp[x]*dp[y])%mod;
    }
    dp[x] = (dp[x]*nck(cnt,chld))%mod;
    dp[x] = (dp[x]*fac[chld])%mod;
}
void solve(){
    cin>>n>>k;
    fac[0] = 1;
    for(int i=1;i<=k;i++){
        fac[i] = fac[i-1]*i;
        fac[i]%=mod;
    }
    inv[k] = po(fac[k],mod-2);
    for(int i=k-1;i>=0;i--){
        inv[i] = inv[i+1]*(i+1);
        inv[i]%=mod;
    }
    int x,y;
    for(int i=1;i<n;i++){
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    for(int i=1;i<=n;i++){
        if(v[i].size()==1){
            root = i;
            break;
        }
    }
    dfs(root);
    dp[root] = (dp[root]*k)%mod;
    cout<<dp[root]<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
  //  cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 20136
#include <stdio.h>
int main(void){
    // Your code here!
    int A,B;
    int tasu,hiku,seki;
    int max;
    scanf("%d %d",&A,&B);
    
    tasu=A+B;
    hiku=A-B;
    seki=A*B;
    max=tasu;
    if(hiku>max)max=hiku;
    if(seki>max)max=seki;
    
    printf("%d",max);
    return 0;
}

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

int main() {
	int cheese[3];
	while (cin >> cheese[0] >> cheese[1] >> cheese[2]) {
		if (cheese[0] == 0 && cheese[1] == 0 && cheese[2] == 0) {
			break;
		}
		sort(cheese,cheese + 3);
		int min_diagonal = cheese[0]*cheese[0] + cheese[1]*cheese[1];
		int n;
		cin >> n;
		while (n--) {
			int r;
			cin >> r;
			cout << (min_diagonal < 4*r*r ? "OK" : "NA") << endl;
		}
	}
}

Measured memory_bytes: 3132
#include<iostream>
#include<cstdio>

using namespace std;


int main(){
	
	int n;
	while(scanf("%d",&n)!=-1){
		
		int ans = 0;
		for(int i=0;i<=9;i++){
			for(int j=0;j<=9;j++){
				for(int k=0;k<=9;k++){
					for(int p=0;p<=9;p++){
						if(i+j+k+p == n)ans++;
					}
				}
			}
		}
		
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1208