akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define int long long int

void fileioe(){
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout); 
	freopen("error.txt","w",stderr);
}
#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
#define fioe() fileioe()
#else
#define fioe() 1
#endif
//!

const int maxr = 4e3+5;
int dp[maxr][3];

int32_t main()
{
	GO
	//fioe();
	memset(dp,0,sizeof(dp));
	int n;
	string s;
	cin>>n>>s;
	// r g b 0 1 2
	for(int i=1;i<=n;i++){
		if(s[i-1] == 'R'){
			dp[i][0]++;
		}
		else if(s[i-1] == 'G'){
			dp[i][1]++;
		}
		else{
			dp[i][2]++;
		}
		for(int j=0;j<3;j++){
			dp[i][j] += dp[i-1][j];
		}
	}
	string ref = "RGB";
	int ans = 0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			int len = (j-i+1);
			bool visited[3] = {0};
			for(int k = 0;k<3;k++){
				if(s[i-1] == ref[k])
					visited[k] = true;
			}
			for(int k = 0;k<3;k++){
				if(s[j-1] == ref[k])
					visited[k] = true;
			}
			int sum = visited[0]+visited[1]+visited[2];
			if(sum == 1)
				continue;
			int ind;
			char ch ;
			for(int i=0;i<3;i++){
				if(!visited[i]){
					ind = i;
					ch = ref[i];
				}
			}
			ans += dp[j][ind] - dp[i-1][ind];
			if(len%2==1){
				int idx = i + len/2;
				if(s[idx-1] == ch)
					ans--;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
    int ar[10005],i,j,n,sum=0;

    cin>>n;

    for(i=0;i<n;i++)
    {
        cin>>ar[i];
    }

    sort(ar,ar+n);

    ar[n-1]=ar[n-1]/2;

    for(i=0;i<n;i++)
    {
        sum=sum+ar[i];
    }

    cout<<sum<<endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;

typedef long long ll;

ll a[maxn];

int main()
{
    int n;
    scanf("%d",&n);
    int flag = 0;
    for(int i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
    }

    for(int i=1; i<n; i++)
        if(a[i] != a[i-1])
            flag = 1;
    if(flag == 0)
    {
        printf("%lld %lld\n",a[n-1],a[n-2]);
        return 0;
    }
    sort(a,a+n);
    double cnt = a[n-1]*1.0/2;
    int pos = upper_bound(a,a+n,(int)cnt) - a;
    int pos1 = pos;
    while(a[pos1] > cnt)
        pos1 --;
    if(pos == n-1)
        pos--;
    if(abs(a[pos1] - cnt) <= abs(a[pos] - cnt) )
        printf("%lld %lld\n",a[n-1],a[pos1]);
    else
        printf("%lld %lld\n",a[n-1],a[pos]);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> prices (N+1,0);
  for ( int j = 0; j < N ; j++ ) {
    cin >> prices[j];
  }
  int best = 0;
  for ( int i = 0; i<N ; i++ ) {
   if ( prices[best] <= prices[i] ) {
     best = i;
   }
  }
  int total = 0;
  total += prices[best]/2;
  prices[best] = 0;
  for ( int k = 0; k<N ; k++ ) {
    total += prices[k];
  }
  cout << total << endl;
}

Measured memory_bytes: 256
n, m = map(int,input().split())

edge = [[] for i in range(n)]

for i in range(m):
    a, b = map(lambda x:int(x)-1,input().split())
    edge[a].append(b)

possible = False
for to in edge[0]:
    if n-1 in edge[to]:
        possible = True
        break

print("POSSIBLE" if possible else "IMPOSSIBLE")

Measured memory_bytes: 96880
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n; cin>>n;
  string s; cin>>s;
  string l,r;
  for(int i=0; i<(n/2); ++i) l+=s[i];
  for(int i=(n/2); i<n; ++i) r+=s[i];
  if(l==r) cout<<"Yes"; else cout<<"No";
  return 0;
}

Measured memory_bytes: 3576
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 100001;
static const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline T int_ceil(T a, T b) { T res = a / b; if(a % b != 0) res++; return res; }
template<typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T> >;
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	ll n; cin >> n;
	vector<ll> v(n);
	rep(i, n){
		cin >> v[i];
	}

	ll ans = 0;
	rep2(i, 0, n){
		rep2(j, i+1, n){
			rep2(k, j+1, n){
				ll a = v[i], b = v[j], c = v[k];
				bool ok = true;
				if(a == b || b == c || a == c) continue;
				if(!(a < b + c)) ok = false;
				if(!(c < b + a)) ok = false;
				if(!(b < a + c)) ok = false;
				if(ok) {
					// print(a, b, c);
					ans++;
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}


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

#define int long long
#define ALL(x) x.begin(),x.end()
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb(x) push_back(x)
#define eb emplace_back
#define SORT(ls) sort(ls.begin(), ls.end())
#define DESC(ls) sort(ls.rbegin(), ls.rend()) 
#define mp(x, y) make_pair(x, y)
#define INF 1000000000
#define MOD 1000000007
#define F(i, a, n) for(i=a;i<n;i++)
#define B(i, a, n) for(i=n-1;i>=0;i--)
#define SI(x) cin>>x
#define DI(x, y) cin>>x>>y
#define TI(x, y, z) cin>>x>>y>>z
#define FI(w, x, y, z) cin>>w>>x>>y>>z
#define SO(x) cout<<x<<"\n"
#define DO(x, y) cout<<x<<" "<<y<<"\n"
#define TO(x, y, z) cout<<x<<" "<<y<<" "<<z<< "\n"
#define FO(w, x, y, z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<"\n"
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

bool inline inBounds(int i, int j)
{
    if(i < 0 || j < 0)
        return false;
    return true;
}

int32_t main(void)
{
    FASTER;
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int i, j;
    string s, t;
    DI(s, t);
    int n = s.length();
    int m = t.length();
    int dp[n][m];
    ii prev[n][m];
    
    F(i, 0, n)
        F(j, 0, m)
            prev[i][j] = {-1, -1};
    
    F(i, 0, n)
    {
        F(j, 0, m)
        {
            if(s[i] == t[j])
            {
                dp[i][j] = 1;
                if(inBounds(i - 1, j - 1))
                {
                    prev[i][j] = mp(i - 1, j - 1);
                    dp[i][j] += dp[i - 1][j - 1];
                }
            }
            else
            {
                dp[i][j] = 0;
                if(inBounds(i - 1, j) && dp[i][j] <= dp[i - 1][j])
                {
                    dp[i][j] = dp[i - 1][j];
                    prev[i][j] = {i - 1, j};
                }
                if(inBounds(i, j - 1) && dp[i][j] <= dp[i][j - 1])
                {
                    dp[i][j] = dp[i][j - 1];
                    prev[i][j] = {i, j - 1};
                }
            }
        }
    }
    prev[0][0] = {-1, -1};
    string ans = "";
    ii curr = {n - 1, m - 1};
    while(curr.first != -1 || curr.second != -1)
    {
        if(s[curr.first] == t[curr.second])
            ans += s[curr.first];
        curr = prev[curr.first][curr.second];
    }
    reverse(ans.begin(), ans.end());
    SO(ans);
    return 0;
}


Measured memory_bytes: 211200
n = int(input())
cards = [input().split() for _ in range(n)]
p_t = 0
p_h = 0
for card in cards:
    if card[0] == card[1]:
        p_t += 1
        p_h += 1
    elif card[0] > card[1]:
        p_t += 3
    else:
        p_h += 3
print(p_t, p_h)


Measured memory_bytes: 5720
lis = input().split(" ")

a = int(lis[0]) + int(lis[1])
b = int(lis[0]) - int(lis[1])
c = int(lis[0]) * int(lis[1])

if a > b:
    m = a
    if m > c:
        pass
    else:
        m = c
else:
    m = b
    if b > c:
        pass
    else:
        m = c
        
print(m)

Measured memory_bytes: 3060
#include <stdio.h>
int main()
{
  int n;
  scanf("%d",&n);
  int i,a;
  for (i=0;i<n;i++){
    scanf("%d",&a);
      if(a%2==0){
        if(a%3!=0&&a%5!=0){
          puts("DENIED");
          return 0;
        }
      }
  }
  puts("APPROVED");
  return 0;
}

Measured memory_bytes: 1608
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    ll a,n,m;
    cin >> a >> n >> m;
    ll ans = 0;
    for(ll y = 1;y<=72;y++){
        ll t = pow(y+a,n);
        string s = to_string(t);
        ll sum = 0;
        for(char c : s)sum+=c - '0';
        if(t <= m && sum == y)ans ++;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
	int n, k; cin >> n >> k;
	vector<int>D(k); for (auto&& x : D)cin >> x;
	sort(D.begin(), D.end());

	vector<int>like;
	for (int i = 0; i <=9; i++) {
		bool include = false;
		for (int j = 0; j < D.size(); j++) {
			if (D[j] == i) {
				include = true;
				break;
			}
		}
		if (!include)like.push_back(i);
	}
	sort(like.begin(), like.end());

	int ans = n;
	while (1) {
		string ans_ = to_string(ans);
		bool good = false;
		for (int i = 0; i < ans_.size(); i++) {
			for (int j = 0; j < like.size(); j++) {
				if (ans_[i] - '0' == like[j]) {
					good = true;
					break;
				}
				else good = false;
			}
			if (!good)break;
		}
		if (good) {
			cout << ans << endl;
			return 0;
		}
		ans++;
	}

	return 0;
}

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

#define REP(i,n) for(int i=0; i<n; ++i)
#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 ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const ll INF = 1e9;

void out(VI &ans){
    REP(i,ans.size()){
        if (ans[i] == 0) break;
        printf("%d ", ans[i]);
    }
    cout << endl;
}

int main() {
    int n, k;
    cin >> n >> k;

    if (n % 2 == 0){
        printf("%d ", n/2);
        REP(i,k-1) printf("%d ", n);
        cout << endl;
        return 0;
    }

    if (n == 1){
        VI ans((k+1)/2, 1);
        out(ans);
        return 0;
    }

    VI ans(k, (n+1)/2);
    int d = k/2;
    REP(i,d){
        int j = k - 1;
        while (ans[j] == 0) j--;
        ans[j]--;
        if (ans[j] > 0){
            j++;
            while (j < k) ans[j++] = n;
        }
        // out(ans);
    }

    out(ans);

    return 0;
}


Measured memory_bytes: 3456
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        int ans = Integer.MAX_VALUE;
        int banboo[] = new int[8];
        int A, B, C;

        void allocate(int a, int b, int c, Queue<Integer> unused, int mp) {
            if (unused.size() > 0){
                Queue<Integer> removed = new ArrayDeque<>(unused);
                int item = removed.poll();
                allocate(a + banboo[item], b, c, removed, mp + 10);
                allocate(a, b + banboo[item], c, removed, mp + 10);
                allocate(a, b, c + banboo[item], removed, mp + 10);
                allocate(a, b, c, removed, mp);
            } else if (a > 0 && b > 0 && c > 0) {
                ans = Math.min(ans, mp + Math.abs(a - A) + Math.abs(b - B) + Math.abs(c - C));
            }
        }

        void solve(InputReader in, PrintWriter out) {
            int N = in.nextInt();
            A = in.nextInt();
            B = in.nextInt();
            C = in.nextInt();

            Queue<Integer> unused = new ArrayDeque<>();
            for (int i = 0; i < N; ++i) {
                banboo[i] = in.nextInt();
                unused.offer(i);
            }
            allocate(0,0,0,unused,-30);

            out.println(ans);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; ++i) arr[i] = this.nextInt();
            return arr;
        }
    }
}


Measured memory_bytes: 27092
#include <bits/stdc++.h>
#include <variant>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;

struct Data {
  int time, num;
  Data() : time(-1), num(0) {;}
  Data(int t, int n) : time(t), num(n) {;}
};

inline Data Merge(Data left, Data right) {
  if (left.time < right.time) {
    return right;
  } else {
    return left;
  }
}

struct SegmentTree {
  int n; vector<Data> data;
  SegmentTree(int N) : n(1 << N), data(n * 2) {}
  Data get (int pos) {
    Data value = data[pos];
    while (pos < 2*n-1) {
      pos = pos / 2 + n;
      value = Merge(value, data[pos]);
    }
    return value;
  }
  void sub(int fr, int to, int node, int la, int ra, Data value) {
    if (ra<=fr || to<=la) return;
    if (fr<=la && ra<=to) {
      data[node] = value;
      return;
    }
    sub(fr, to, (node-n)*2+0, la, (la+ra)/2, value);
    sub(fr, to, (node-n)*2+1, (la+ra)/2, ra, value);
  }
  void update(int fr, int to, Data value) { return sub(fr, to, 2*n-2, 0, n, value); }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int h,w;
  cin>>h>>w;
  using T = tuple<int,int>;
  auto comp = [] (auto&& lhs, auto&& rhs) {
    auto&& [lt, ls] = lhs;
    auto&& [rt, rs] = rhs;
    return lt - ls > rt - rs;
  };
  priority_queue<T, vector<T>, decltype(comp)> q(comp);
  REP(i,w) {
    q.emplace(i, i);
  }
  SegmentTree st(18);
  REP(i,w) {
    st.update(i, i+1, Data(-1, i));
  }
  constexpr int INF = 1e8;
  REP(i,h) {
    int a,b;
    cin>>a>>b;
    --a;
    if (a == 0) {
      st.update(a, b, Data(i, -INF));
    } else {
      int old = st.get(a-1).num;
      st.update(a, b, Data(i, old));
    }
    if (b < w) {
      auto bs = st.get(b).num;
      if (bs >= 0) {
        q.emplace(b, bs);
      }
    }
    bool ok = false;
    while (!q.empty()) {
      auto&& [t, s] = q.top();
      if (st.get(t).num == s) {
        ok = true;
        cout<<t-s + i + 1<<"\n";
        break;
      }
      q.pop();
    }
    if (!ok) {
      cout<<-1<<"\n";
    }
  }
  
  return 0;
}


Measured memory_bytes: 11700
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;

int main(){
  int w,a,b;
  cin >> w >> a >> b;
  if(a+w<b){
    cout << b-(a+w) << endl;
    return 0;
  }
  if(b+w<a){
    cout << a-(b+w) << endl;
    return 0;
  }
  cout << 0 << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int N = 2e5+10;
const int X = 60;

//head

int n;
ld a[N];
int cnt[60][60];
ll ans;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) {
		ll now = a[i]*1e9+0.1;
		int b = 0;
		while(now%5 == 0) {
			now /= 5;
			b++;
		}
		cnt[__builtin_ctzll(now)][b]++;
	}
	rep(i, X) rep(j, X) rep(ii, X) rep(jj, X) if(P(i, j) <= P(ii, jj) and i+ii >= 18 and j+jj >= 18) {
		if(P(i, j) == P(ii, jj)) {
			ans += (ll)cnt[i][j]*(cnt[i][j]-1)>>1;
		} else {
			ans += (ll)cnt[i][j]*cnt[ii][jj];
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 6832
#include <iostream>

using namespace std;

typedef long long s64;

s64 a[55], b[55], c[55], d[55];
s64 fabs(s64 x) { return x < 0 ? -x : x; }
s64 dist(int p, int q)
{
	return fabs(a[p] - c[q]) + fabs(b[p] - d[q]);
}
int main()
{
	int n, m;

	cin >> n >> m;
	for (int i = 0; i < n; ++i)
		cin >> a[i] >> b[i];
	for (int i = 0; i < m; ++i)
		cin >> c[i] >> d[i];

	for (int i = 0; i < n; ++i) {
		int best = 0;
		s64 bestV = dist(i, 0);
		for (int j = 1; j < m; ++j) {
			s64 v = dist(i, j);
			if (v < bestV) {
				bestV = v;
				best = j;
			}
		}
		cout << best+1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;
typedef vector<string> Vs;

ll x,res;

int main(){
	cin>>x;
	res=x/11*2;
	x%=11;
	if (x) res++;
	if (x>6) res++;
	cout<<res<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;
int c;

int main(){
	IOS
	cin >> c;
	ll serebu=1000*(c/500);
	//cout << serebu << endl;
	c%=500;
	ll lima=5*(c/5);
	cout << serebu+lima << '\n'; 
}

Measured memory_bytes: 3648
var input = [];
process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on('data', function(chunk){
   input = chunk.toString("utf8").trim().split("\n");
});
process.stdin.on('end', function(){
    for (var i = 0; i < input.length; i++) {
    var data = input[i].split(" ").map(Number);
    var a = data[0],
        b = data[1];
        
    var GCD,
        LCM;
    while(b != 1){
        if(a === b) break;
        sortedData = [a,b].sort(function(a,b){
            if (a < b) {
                return 1
            }else if(a > b){
                return -1
            }
            return 0
        });
        b = sortedData[0] - sortedData[1];
        a = sortedData[1]
    }
    GCD = b;
    LCM = data[0] * data[1] / GCD;
    console.log(GCD + " " + LCM)
    }
    
});

Measured memory_bytes: 18192
#include <vector>
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> num(n,-1);
  bool flag = true;
  for (int i = 0; i < m; i++)
  {
    int s,c;
    cin >> s >> c;
    if (num[s - 1] == -1 || num[s - 1] == c) num[s - 1] = c;
    else flag = false;
  }

  for (int i = 0; i < n; i++)
  {
    if (num[i] == -1 && i == 0)
    {
      if (n == 1)num[i] = 0;
      else num[i] = 1;
    }if (num[i] == -1 && i != 0)
      num[i] = 0;
  }
  int ans = 0;
  if (flag == true)
  {
    if (n == 2 && num[0] == 0) flag = false;
    if (n == 3) 
      if(num[0] == 0 && num[1] == 0) flag = false;
  }
  
 
  if (flag == false) cout << -1 << endl;
  else
  {
    for (int i = 0; i < n; i++)  ans += num[i] * pow(10, n - i - 1);
    cout << ans << endl;
  }
}


Measured memory_bytes: 384
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	} 
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	a := scanInts(n)

	b1 := make([]int, n)
	b2 := make([]int, n)
	for i := 0; i < n; i++ {
		b1[i] = a[i]-i
		b2[i] = -a[i]-i
	}
	cnt := map[int]int{}
	for i := 0; i < n; i++ {
		cnt[b1[i]]++
	}
	ans := 0
	for i := 0; i < n; i++ {
		ans += cnt[b2[i]]
	}
	fmt.Fprintln(wr, ans)
}


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

int main(){
    //ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("../input.txt","r",stdin);
    string S;
    cin >> S;
    for (int i = 0; i < S.size(); ++i) {
        cout << "x";
    }
}


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

using namespace std;
typedef long long int ll;

int main(){
    int k;
    int a, b;
    cin>>k;
    cin>>a>>b;
    if(a> b)swap(a, b);
    int k_a = a/k;
    int k_b = b/k;
    if(k_a == k_b){
        if(k*k_a == a ){
            cout<<"OK"<<endl;
        }
        else{
            cout<<"NG"<<endl;
        }
    }
    else{
        cout<<"OK"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3600
let () = Scanf.scanf "%d %d\n" @@ fun n m ->
  let ps = Array.make n [] in
  for i = 0 to m - 1 do
    Scanf.scanf "%d %d\n" @@ fun p y ->
      ps.(p - 1) <- (y, i) :: ps.(p - 1)
  done;
  for i = 0 to n - 1 do
    ps.(i) <- List.sort compare ps.(i)
  done;
  List.iter print_endline @@
  List.map snd @@
  List.sort compare @@
  List.concat @@ Array.to_list @@ Array.mapi (fun p ->
    List.mapi (fun x (_, i) ->
      i, Printf.sprintf "%06d%06d" (p + 1) (x + 1))) ps
    


Measured memory_bytes: 31104
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<deque>
#include<functional>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<string>
#include<vector>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
typedef long long ll;

using namespace std;

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

	int a, b, c;
	int k;
	int ans = 0;
	cin >> a >> b >> c >> k;
	int max = a;
	if (max < b)max = b;
	if (max < c)max = c;
	REP(i, k) {
		if (max == a) {
			a *= 2;
			max = a;
		}
		else if (max == b) {
			b *= 2;
			max = b;
		}
		else if (max == c) {
			c *= 2;
			max = c;
		}
	}
	cout << a + b + c << endl;
}

Measured memory_bytes: 3544
// defines
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define casti static_cast<int>
#define cast static_cast
#define ll long long int
#define vi vector<int>
#define vpi vector<pair<int,int >>

// includes
#include <bits/stdc++.h>

using namespace std;

ll modF=1e9+7;

// topcoder



//codechef and codeforces and atcoder

int main(){
    char inp;
    cin>>inp;
    if(inp>=65 && inp<=90){
        cout<<"A\n";
    }
    else{
        cout<<"a\n";
    }
}


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

using namespace std;

int main()
{
  double n, h = 0.0, l = 999999.0;

  while (cin >> n){
    h = max(h, n);
    l = min(l, n);
  }

  printf("%.1lf\n", h - l);
}

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

int main() {
  int n, x; cin >> n >> x;
  int position = 0, ans = 1;
  for (int i = 0; i < n; i++) {
    int l; cin >> l;
    position += l;
    if (position <= x) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m;
int val[2001][3];
long double per[2001][2001];
long double winper[2001][3][4];
long double loseper[2001][3];
long double tmp[4];

int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d%d%d",&val[i][0],&val[i][1],&val[i][2]);
	}
	per[0][0]=1.0;
	for(int i=0;i<m;i++){
		for(int j=0;j<=i;j++){
			per[i+1][j]+=per[i][j]*2.0/3.0;
			per[i+1][j+1]+=per[i][j]/3.0;
		}
	}
	for(int j=m-1;j>=0;j--){
		per[m][j]+=per[m][j+1];
	}
	for(int ty=0;ty<3;ty++){
		for(int i=0;i<=m;i++){
			loseper[i][ty]=1.0;
			winper[i][ty][0]=1.0;
			int pts=val[0][ty]*i;
			for(int j=1;j<n;j++){
				int ned=pts/val[j][ty];
				if(ned*val[j][ty]<pts){
					ned++;
				}
				long double pe=0.0;
				if(ned<=m)pe=per[m][ned];
				loseper[i][ty]*=pe;
				for(int k=0;k<4;k++){
					tmp[k]=0.0;
				}
				for(int k=0;k<3;k++){
					tmp[k+1]+=winper[i][ty][k]*pe;
					tmp[k]+=winper[i][ty][k]*(1.0-pe);
				}
				for(int k=0;k<3;k++){
					winper[i][ty][k]=tmp[k];
				}
			}
		}
	}
	long double best=-3.0;
	for(int i=0;i<=m;i++){
		for(int j=0;j<=m-i;j++){
			int k=m-i-j;
			long double result=0.0;
			for(int l=0;l<3;l++){
				result+=winper[i][0][l]*5.0;
				result+=winper[j][1][l]*3.0;
				result+=winper[k][2][l]*2.0;
			}
			result-=loseper[i][0];
			result-=loseper[j][1];
			result-=loseper[k][2];
			best=max(best,result);
		}
	}
	printf("%.10f\n",(double)best);
	return 0;
}

Measured memory_bytes: 42444
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

# 遅い
def rec_binary_search(x, ss):
    len_s = len(ss)
    half = len_s // 2
    if len_s <= 10:
        return int(x in ss)
    if x < ss[half]:
        ss = ss[:half]
    else:
        ss = ss[half:]
    return rec_binary_search(x, ss)

def binary_search(x, ss):
    L = 0
    R = len(ss)
    half = (L+R) // 2
    while L<=R:
        if R-L < 2:
            return int(x in ss[L:R+1])
        if x < ss[half]:
            R = half-1
        elif x > ss[half]:
            L = half + 1
        else:
            return 1
        half = (L+R) // 2

n = int(input())
ss = list(map(int, input().split()))
m = int(input())
ts = list(map(int, input().split()))

ans = 0
for x in ts:
    ans += binary_search(x, ss)

print(ans)


Measured memory_bytes: 16176
#include <iostream>

using namespace std;

int n, l;
int a[25], d[25];

void solve() {
	int t = 0, la = -1;
	
	while (1) {
		t++;
		
		bool end = true;
		bool last = false;
		for (int i = 0; i < n; i++) {
			if (a[i] <= 0 || a[i] >= l) continue;
			a[i] += d[i];
			
			if (!last && a[i] <= 0) {
				la = i + 1;
				last = true;
			}
			if (!last && a[i] >= l) {
				la = i + 1;
			}
			
			if (0 < a[i] && a[i] < l) end = false;
		}
		
		for (int i = 0; i < n; i++) {
			if (a[i] <= 0 || a[i] >= l) continue;
			for (int j = i + 1; j < n; j++) {
				if (a[j] <= 0 || a[j] >= l) continue;
				if (a[i] == a[j]) {
					swap(d[i], d[j]);
					break;
				}
			}
		}
		
		if (end) break;
	}
	
	cout << t << " " << la << endl;
}

int main() {
	while (1) {
		cin >> n >> l; if (n == 0 && l == 0) break;
		for (int i = 0; i < n; i++) {
			char c; cin >> c;
			if (c == 'R') d[i] = 1;
			else d[i] = -1;
			cin >> a[i];
		}
		
		solve();
	}
	
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  char c;
  int a[26] = {0};
  while (cin >> c) {
    if (c < 97) {
      c += 32;
    }
    a[c - 97]++;
  }

  for (int i = 0; i < 26; i++) {
    cout << char(i+97) << " : " << a[i] << '\n';
  }
}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x,w,a[101]={},cntl=0,cntr=0;
  cin>>n>>m>>x;
  for(int i=0;i<m;i++){
    cin>>w;
    a[w]=1;
  }
  for(int i=0;i<n;i++)
    if(i<x && a[i]==1)cntl++;
    else if(i>x && a[i]==1)cntr++;
  if(cntl>cntr)swap(cntl,cntr);
  cout<<cntl<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String line = sc.nextLine();
        String[] arrData = line.split(" ");
        int W = Integer.valueOf(arrData[0]);
        int H = Integer.valueOf(arrData[1]);
        int x = Integer.valueOf(arrData[2]);
        int y = Integer.valueOf(arrData[3]);
        int r = Integer.valueOf(arrData[4]);

        if(x + r > W) {
            System.out.println("No");
            return;
        }

        if (y + r > H) {
            System.out.println("No");
            return;
        }

        if(x - r < 0) {
            System.out.println("No");
            return;
        }

        if (y - r < 0) {
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
}
}


Measured memory_bytes: 26284
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(10);

}

signed main() {
	ll n, q, l, r;
	string s;

	cin >> n >> q >> s;

	vector<ll> v(n + 2, 0);

	REP(i, n - 1) {
		if (s[i] == 'A' && s[i + 1] == 'C') {
			v[i + 2] = 1;
		}
	}

	REP(i, n + 1) {
		v[i + 1] += v[i];
	}

	REP(i, q) {
		cin >> l >> r;
		cout << v[r] - v[l] << endl;
	}
}

Measured memory_bytes: 1792
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let (a, b, c) = get!(usize, usize, usize);
    if a + b + 1 <= c {
        let nc = a + b + 1;
        println!("{}", nc + b);
    } else {
        println!("{}", b + c);
    }
}


Measured memory_bytes: 4352
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

bonus = 0
for i in range(n-1):
    if a[i]+1 == a[i+1]:
        bonus += c[a[i]-1]
        
print(sum(b)+bonus)

Measured memory_bytes: 3064
#include<stdio.h>
#include<limits.h>
int main(void)
{
  int n,x,m,min=INT_MAX,i,counter=0;
  scanf("%d %d",&n,&x);
  for(i=0;i<n;i++)
    {
      scanf("%d",&m);
      if(m<min)
	{
	  min = m;
	}
      x -= m;
      counter++;
    }
  counter += (x/min);
  printf("%d\n",counter);
  return 0;
 
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  string s,t;
  cin >> s >> t;
  s+=')';
  t+='(';
  //sがi文字 tがj文字までの最長の部分列の文字数
  ll ns=s.size();
  ll nt=t.size();
  ll dp[ns+5][nt+5];
  rep(i,ns+5) rep(j,nt+5) dp[i][j]=0;
  rep(i,ns) rep(j,nt){
    dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
    dp[i][j+1] = max(dp[i][j+1],dp[i][j]);
    if(s[i]==t[j]) dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]+1);
  }

  string ans;
  int i=ns-1, j=nt-1;
  //  cout << dp[i][j] << endl;
  while(i+j>0){
    ll x=dp[i][j];
    if(i > 0 && dp[i-1][j]==x) i--;
    else if(j>0 && dp[i][j-1]==x) j--;
    else {
      i--;j--;
      ans +=s[i];
    }
  }
  reverse(ans.begin(),ans.end());
  cout << ans << endl;
  
  
  
  return 0;
    

}


Measured memory_bytes: 70912
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    int N,K,X,Y;
    cin >> N >> K >> X >> Y;
    int ans = N*Y + min(N,K)*(X-Y);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int N = 210000;

int n, q;

ll m;

int p[N];
int sz[N];

int get(int x) {
	if (x == p[x]) {
		return x;
	}
	return p[x] = get(p[x]);
}

void un(int a, int b) {
	a = get(a), b = get(b);
	if (a == b) {
		return;
	}
	if (sz[a] > sz[b]) {
		swap(a, b);
	}
	sz[b] += sz[a];
	p[a] = b;
}

void no() {
	cout << "No\n";
	exit(0);
}

void yes() {
	cout << "Yes\n";
	exit(0);
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(20);
	cin >> n >> m >> q;
	for (int i = 0; i < n; ++i) {
		p[i] = i, sz[i] = 1;
	}
	vector<pair<int, int>> vv;
	for (int i = 0; i < q; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		if (c == 0) {
			un(a, b);
		} else {
			vv.emplace_back(a, b);
		}
	}
	if (m == n - 1) {
		if (!vv.empty()) {
			no();
		} else {
			yes();
		}
	}

	for (auto p: vv) {
		if (get(p.first) == get(p.second)) {
			no();
		}
	}

	ll k = 0;
	for (int i = 0; i < n; ++i) {
		if (p[i] == i) {
			++k;
		}
	}

	ll l = n;
	ll r = n - k + k * (k - 1) / 2;
	if (m >= l && m <= r) {
		yes();
	} else {
		no();
	}

	return 0;
}




Measured memory_bytes: 2168
// Best practice
 
#include<bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii 		pair<int,int>
#define psi 		pair<string,int>
#define vi 			vector<int>
#define vpii  		vector<pii>
#define vvi 		vector<vi>
#define sz(x)	    (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define prec(n) 	fixed<<setprecision(n)
#define ini(a, i) 	memset(a, i, sizeof(a))
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
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 {
	#ifndef 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__) << "] "
 
 
// const int dx[4] = { -1, 1, 0, 0};
// const int dy[4] = {0, 0, -1, 1};
// int dX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
// int dY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
 
 
// Code from Here -------------------------------------------------------------------------------

bool check(int n){
	while(n){
		if(n%10 != 7)return false;
		n/=10;
	}
	return true;
}

int count(int n){
	int ans = 0;
	while(n){
		ans++;
		n/=10;
	}
	return ans;
}

signed main() {
	tezz
 
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif

	int n;
	cin >> n;
	int c = -1;
	for(int i=0; i<10; i++){
		if(((n)*(i+1))%10 == 7){
			c = i+1;
			break;
		}
	}
	if(c==-1){
		cout << -1 << endl;
		return 0;
	}
	int e = 0;
	c=0;
	do{
		e = e*10 + 7;
		e%=n;		
		c++;
	}while(e != 0);
	cout << c << endl;
 
	return 0;
}  

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

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

const lli MOD = 1000000007LL;

lli modpow(lli a, lli n){
    lli res = 1;

    for(lli ai = a; n; n>>=1){
        if(1&n) res = (res*ai)%MOD;
        ai=(ai*ai)%MOD;
    }
    return res;
}

lli inv(lli n){
    return modpow(n, MOD-2);
}

lli modperm(lli n, lli k){
    lli res = 1;
    rep(i, k){
        res = (res*(n-i))%MOD;
    }
    return res;
}

lli modcomb(lli n, lli k){
    return (modperm(n, k)*inv(modperm(k, k)))%MOD;
}

lli posmod(lli n){
    lli res = n;
    res %= MOD;
    if(res < 0) res += MOD;
    return res;
}
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main(void){
    lli res = 0;
    lli n;
    cin >> n;
    auto ptable = prime_factor(n);
    for(auto i : ptable){
        int b = i.second;
        int t = 1;
        while(b > 0){
            if(t > b){
                b = 0;
                break;
            }
            b-=t;
            t++;
            res++;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3632
#%%
from collections import Counter
n = input()
d = list(map(int, input().split()))



#%%
d_cnt =Counter(d)
d_cnt = dict(d_cnt)

d_cnt_keys = list(d_cnt.keys())
d_cnt_keys.sort()

if d[0] != 0 or d_cnt[0] != 1 or len(d_cnt_keys)!= d_cnt_keys[-1]+1:
    print(0)
    exit()

#%%

ans = 1
p = 998244353
for key in d_cnt_keys:
    if key == 0:
        continue
    ans =ans*pow(d_cnt[key-1], d_cnt[key],p)%p
print(ans)

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

int main() {
  long long N, A, B;
  cin >> N >> A >> B;
  if ((B - A) % 2 == 0)
    cout << (B - A) / 2 << endl;
  else
    cout << min(A - 1, N - B) + 1 + (B - A - 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>

using namespace std;

const int INF = (1<<30) - 1;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    while(cin>>N>>M, N|M){
        vector<int> hs(N);
        vector<int> ws(M);
        
        for(auto &v: hs)
            cin >> v;
        for(auto &v: ws)
            cin >> v;
        
        for(int i=1; i<N; i++)
            hs[i] += hs[i-1];
        for(int i=1; i<M; i++)
            ws[i] += ws[i-1];
        
        map<int, int> hmap;
        map<int, int> wmap;
        
        for(int i=0; i<N; i++)
            for(int j=0; j<=i; j++)
                hmap[hs[i]- (i==j?0:hs[j])]++;
        for(int i=0; i<M; i++)
            for(int j=0; j<=i; j++)
                wmap[ws[i]- (i==j?0:ws[j])]++;
        
        int ans = 0;
        for(auto &it: hmap){
            ans += it.second * wmap[it.first];
        }
        
        cout << ans << endl;
                
    }
    return 0;
}

Measured memory_bytes: 32472
def is_palindrome(s):
    return s == s[::-1]


def main():
    s = "-" + input()
    n = len(s) - 1
    if (
        is_palindrome(s[1:])
        and is_palindrome(s[1 : (n - 1) // 2 + 1])
        and is_palindrome(s[(n + 3) // 2 : n + 1])
    ):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 9044
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1'000'000'007;
struct mint {
    ll x; // typedef long long ll;
    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 { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime MOD
    mint inv() const { return pow(MOD-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination MOD prime
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
    mint p(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[n-k];
    }
}; //comb(10000007);
// comb(5, 2) → 10, comb.p(5, 2) → 20
// comb.fact[4] → 24, 2のN乗 → mint(2).pow(N)

mint ans;
vector<int> graph[200005]; // 0-indexed
int N;

int dfs(int x, int pa = -1) {
    // 部分木のサイズを返す、自分含む
    mint add = mint(2).pow(N-1) - 1;
    int res = 0;
    for (int a : graph[x]) {
        if (a == pa) continue;
        int y = dfs(a, x);
        res += y;
        add -= mint(2).pow(y) - 1;
    }
    res++;
    if (pa != -1) {
        add -= mint(2).pow(N-res) - 1;
    }
    ans += add;
    return res;
}

int main() {
    // warp and weft 一つの頂点に注目して何回選ばれるか、最後に2^Nで割る
    cin >> N;
    rep(i, N-1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    dfs(0);
    ans /= mint(2).pow(N);
    cout << ans << '\n';
    return 0;
    // ll, 0, -, 1i, for s&g, debug
}


Measured memory_bytes: 27740
#include <stdio.h>

int main()
{
	int A,B,C,D;
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&C);
	scanf("%d",&D);
	
	printf("%d\n",((A<B)? A:B) + ((C<D)? C:D));
	return 0;
}



Measured memory_bytes: 128
/*
  GOOD is not Enough
  You've got to be GREAT.
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios: :sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second
#define all(a) a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;


void solve()
{ 
  int n;
  cin >> n;
  int sum=0;
  fp(i,1,n)
  {
      if(i%3 ==0 || i%5==0)
      {

      }
      else
        sum+=i;
  }
 cout << sum << '\n';
 return;
}

signed main()
{
  int T=1;
//   cin >> T;
  while(T--)
  {
    solve();
	}
  return 0;
}

Measured memory_bytes: 3632