akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define DEBUG_MODE
#define endl '\n'
#ifdef DEBUG_MODE
#define DEBUG(X) debug_func(X, #X)
#define DEBUG_ENDL endl
#define DEBUG_SEPARATOR_LINE cout<<"=================\n"
#else
#define DEBUG(X) 0
#define DEBUG_ENDL 0
#define DEBUG_SEPARATOR_LINE 0
#endif
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
#define DEBUG_ENDL_S(S) ((S).size() ? "\n" : "")
template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
void debug_func_preffix(const string &s) { if(s.size()) cout << s << " = "; }
template <typename T>
void debug_func(const T &t, const string &s = "") {
    debug_func_preffix(s);
    cout << t << DEBUG_ENDL_S(s);
}
template <typename T, typename U>
void debug_func(const P<T, U> &p, const string &s = "") {
    debug_func_preffix(s);
    cout << "(";
    debug_func(p.first);
    cout << ", ";
    debug_func(p.second);
    cout << ")" << DEBUG_ENDL_S(s);
}
template <typename T>
void debug_func(const V<T> &v, const string &s = "") {
    for(ll i = 0; i < v.size(); i++) {
        string t = s + "[" + to_string(i) + "]";
        debug_func(v[i], t);
    }
}

int main() {
    ll A, B, K;
    cin >> A >> B >> K;
    V<ll> po;
    for(ll i = 1; i <= 100; i++) {
        if(A % i || B % i) continue;
        po.push_back(i);
    }
    reverse(ALL(po));
    cout << po[K - 1] << endl;
    return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N;
	cin >> N;
	int64 res = 0;
	int64 now = 1;
	map<PLL, int64> cnt;
	FOR(i, 1, N+1) {
	  string s = to_string(i);
	  cnt[PLL(s[0], s.back())]++;
	}
	FOR(i, 1, N+1) {
	  string s= to_string(i);
	  res += cnt[PLL(s.back(), s[0])];
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int x, y;
    int a[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
    
    scanf("%d%d", &x, &y);
    printf("%s\n", a[x] == a[y] ? "Yes":"No");
    return 0;
}


Measured memory_bytes: 128
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;

const int maxn=1000010;
int f[maxn],prime[maxn];
 
int GenP() {
	int i,tot,p,tmp;
	tot=0;
	for (i=2;i<maxn;++i) f[i]=i;
	for (p=2;p<maxn;++p)
	{
		if (f[p]==p) prime[tot++]=p;
		for (i=0;i<tot && prime[i]<=f[p];++i)
		{
			tmp=prime[i]*p;
			if (tmp<maxn) 
				f[tmp]=prime[i];
			else
				break;
		}
	}
}
int a[1000010];
void mainmain(){
	GenP();
	int t=0;
	reep(i,1,1000010){
		a[i]=a[i-1];
		if(prime[t]==i){
			t++;
			a[i]++;
		}
	}
	int n;
	while(cin>>n,n){
		int ans=0;
		rep(i,n){
			int p,m;
			cin>>p>>m;
			int x=p-m,y=p+m;
			if(x<1) x=1;
			if(y>1000000) y=1000000;
			ans+=a[y]-a[x-1]-1;
		}
		cout<<ans<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 12876
//---Vaidik Patel"---//-------------------Proud to be Indian--------------------------------//
#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set,multi multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define pii pair<int,int>
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order()
#define deb1(x) cout<<#x<<" : "<<x<<"\n";
#define deb2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<"\n";
#define deb3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<"\n";
#define deb4(x,y,z,w) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<"\t"<<#w<<" : "<<w<<endl;
#define deb5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define deb6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rFOR(i,a,b) for(int i=a;i>=b;i--)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vector<int>>
#define M 1000000007
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int powermodm(int x,int n,int m)
{int ans=1;   while(n){if(n&1){ans=(ans*x)%m;}x=(x*x)%m;n>>1;}return ans;}

void solve()
{
    int n;
    cin>>n;
    vi a(n);
    FOR(i,0,n)
    {
        cin>>a[i];
    }
    sort(all(a));
    int ans=1;
    FOR(i,0,n)
    {
        if(a[i]>0 && ans<=(1e18/(long double)a[i]))
        {
            ans=ans*a[i];
        }
        else if(a[i]==0)
        {
            
            cout<<0;
            return;
        }
        else
        {
            cout<<-1<<"\n";
            return;
        }
    }
    cout<<ans<<"\n";
}
signed main()
{
    
    FIO
    int t;
    t=1;
    //cin>>t;
    FOR(i,0,t)
    {
        //cout<<"Case #"<<i+1<<": ";
        solve();
    }
}


Measured memory_bytes: 3992
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e17;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N=1000005;

void solve()
{
    
    int n,k;
    cin>>n>>k;
    if(n>=10)
    {
        cout<<k<<endl;
    }
    else
    {
        cout<<(k+(100*(10-n)))<<endl;
    }
    
    
}

int32_t main()
{
    IOS;
    
    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
def main():
    UNRESTORABLE = 'UNRESTORABLE'
    INIT = 'z' * 51

    S = input()
    N = len(S)

    T = input()
    M = len(T)

    ans = INIT
    for i in range(N):
        if (N - i) < M: break
        *B, = S
        for j in range(M):
            if (B[i + j] != '?') and (B[i + j] != T[j]): break
            B[i + j] = T[j]
        else:
            ans = min(ans, (''.join(B)).replace('?', 'a'))

    if ans == INIT:
        print(UNRESTORABLE)
    else:
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
N = int(input())
A = input().split()
A = [int(a) for a in A]
B = input().split()
B = [int(b) for b in B]
C = input().split()
C = [int(c) for c in C]

sat = sum(B)
for i in range(N-1):#料理=A[i]
    if(A[i]+1==A[i+1]):
        sat += C[A[i]-1]
        #print(i,C[A[i]])
print(sat)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <functional>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,j,n) for(int i=j;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int h,n;
	cin >> h >>n;
    int sum=0;
  int a;
    fr(i,n){
      cin >> a;
      sum+=a;
    }
  string ans;
    if(sum<h)ans="No";
    else ans = "Yes";
      cout << ans << endl;
}

Measured memory_bytes: 256
"use strict";

const main = (input) => {
    const spi = input.split('\n');
    const s = spi[0];
    const t = spi[1];
    const n = s.length;

    for (let i = 0; i < n; i++) {
        if (s[i] !== t[i]) {
            console.log("No");
            return;
        }
    }

    console.log("Yes");
};

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


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

using namespace std;

const int N = 2e5 + 5;
const int INF = 1e9 + 5;
const double PI = acos(-1);

typedef long long ll;

const int X[] = {1, -1, 0, 0};
const int Y[] = {0, 0, 1, -1};

const int mod = 1e9 + 7;

int n, a[N], l[N], r[N];
ll ans;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    stack<int> s;
    for (int i = 1; i <= n; i++) {
        while (!s.empty() && a[s.top()] >= a[i]) {
            s.pop();
        }
        if (!s.empty()) {
            l[i] = s.top();
        } else {
            l[i] = 0;
        }
        s.push(i);
    }
    while (!s.empty()) {
        s.pop();
    }
    for (int i = n; i >= 1; i--) {
        while (!s.empty() && a[s.top()] >= a[i]) {
            s.pop();
        }
        if (!s.empty()) {
            r[i] = s.top();
        } else {
            r[i] = n + 1;
        }
        s.push(i);
    }
    for (int i = 1; i <= n; i++) {
        ans += (r[i] - i) * 1LL * (i - l[i]) * 1LL * a[i];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;


int main(){
    
    int x[5];
    rep(i,5) cin>>x[i];

    rep(i, 5){
        if(x[i]==0){
            cout<<i+1<<endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3524
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

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

typedef long long ll;

int main()
{
    string a,b;
    cin>>a>>b;
    
    int x=a.length();
    int y=b.length();
    
    ll c=0;
    
    for(int i=0;i<a.length();i++)
    {
        if(a[i]!=b[i])
        c++;
    }
    
    cout<<c+y-x;
    

    return 0;
}


Measured memory_bytes: 3904
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;

ll digit_sum(ll num){
  ll sum=0,dig;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<ll> res;
  ll base = 1;

  for (int i = 0; i < 15; ++i) {
    for (int j = 1; j < 150; ++j) {
      res.push_back(base * (j+1) - 1);
    }
    base *= 10;
  }
  sort(res.begin(), res.end());
  res.erase(unique(res.begin(), res.end()), res.end());

  for (ll i = 0; i < res.size(); ++i) {
    for (ll j = i+1; j < res.size(); ++j) {
      if((double)res[i]/digit_sum(res[i]) > (double)res[j]/digit_sum(res[j])){
        res.erase(res.begin() + i--);
        break;
      }
    }
  }

  long long K;
  cin >> K;
  for (long long i = 0; i < K; ++i) {
    cout << res[i] << endl;
  }
}


Measured memory_bytes: 384
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque

inf = 10 ** 15
mod = 10 ** 9 + 7

s = input()
n = len(s)
ss = []
for c in s:
    if c != 'x':
        ss.append(c)
leng = len(ss)
flag = True
for i in range(leng//2):
    if ss[i] != ss[leng-1-i]:
        flag = False
        break
if flag:
    count=0
    l = 0
    r = n-1
    while l < r:
        if s[r] != s[l]:
            if s[l] == 'x':
                count+=1
                l+=1
            else:
                count+=1
                r-=1
        else:
            r -= 1
            l += 1
    print(count)


else:
    print(-1)


Measured memory_bytes: 48496
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*                                                    
      I ♥ CLARICE STARLING...                                                               
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
const ll INF = (ll)2e18 + 77;
void solve()
{
    ll S;cin>>S;
    vector<ll>dp(S+1,0ll);
    ll i;dp[0]=1ll;
    foe(i,3,S)
    {
        int j;
        for(j=3;j<=i;j++)
        {
            dp[i]=(dp[i]+dp[i-j])%MOD7;
            if(dp[i]<0)dp[i]+=MOD7;
        }
    }
    cout<<dp[S]<<"\n";
}
int main()
{
   fastio
   //Test_cases
   solve();
  return 0;
}
//**always check if you are not killing input in between
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
// Syntax to create a min heap for priority queue priority_queue <int, vector<int>, greater<int>>; 
//for modinverse use modularexponention(x,M-2,M);
//for "each" subtraction from ans(ans-k) if(ans<0) do ans+=MOD,ans%=MOD
//vector<vector<int>>dp(201,vector<int>(n+1)); A way to initialize vector of vector
//string2=string1.substr(pos,length);if len no specified then till end
//void fill (ForwardIterator first, ForwardIterator last, const T& val);
//The range filled is [first,last), which contains all the elements between first and last, including the element pointed by first but not the element pointed by last.


//If wrong on pretest 2 means logically wrong
/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 3636
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
dp=[[0,0,0]for _ in range(n+1)]
for i in range(n):
    a,b,c=l[i]
    dp[i+1][0]=max(dp[i][1],dp[i][2])+a
    dp[i+1][1]=max(dp[i][0],dp[i][2])+b
    dp[i+1][2]=max(dp[i][0],dp[i][1])+c
print(max(dp[-1]))

Measured memory_bytes: 50064
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 3010
#define MO 1000000007
int f[MAXN][MAXN][2],n,m,ans;
int main()
{
	scanf("%d%d",&n,&m);
	f[0][0][1]=1;
	for(int i=1;i<=n;i++)
		f[0][i][0]=1;
	for(int i=0;i<m;i++)
		for(int j=0;j<=n;j++)
			for(int k=0;k<2;k++)
			{
				if(j) (f[i+1][j-1][k|(j-1==0)]+=f[i][j][k])%=MO;
				if(j) (f[i+1][j][k|(j==1)]+=f[i][j][k])%=MO;
				if(j<n) (f[i+1][j][k]+=f[i][j][k])%=MO,(f[i+1][j+1][k]+=f[i][j][k])%=MO;;
			}
	for(int i=0;i<=n;i++)
		(ans+=f[m][i][1])%=MO;
	printf("%d\n",ans);
}

Measured memory_bytes: 70784
#include<stdio.h>
int main(void)
{
	int a,b,c,n=-1,x=-1,q=-1;
	while(n+x!=0){
		while(n+x>0){
			for(a=1;a<=n-2;a++){
				for(b=a+1;b<=n-1;b++){
					for(c=b+1;c<=n;c++){
						if(a+b+c==x){
							q++;
						}
					}
				}
			}
			n=0;
			x=0;
		}
		if(q>-1){
			printf("%d\n",q);
		}
		q=0;
		scanf("%d%d",&n,&x);
	}
	return 0;
}

Measured memory_bytes: 600
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int k; string s;
	cin >> k >> s;
	int n=s.length();
	for(int i=0; i<min(k,n); i++){
		cout << s[i];
	}
	if(n>k)cout << "..." ;
	cout << endl;
}	


Measured memory_bytes: 3580
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const [a, p] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const ans = _ => {
  const keppen = p + a * 3

  return Math.floor(keppen / 2)
}

console.log(ans())


Measured memory_bytes: 7500
#include <cstdio>
#include <algorithm>
using namespace std;

int a, b, c;
char s[100001];
int main(void)
{
	scanf("%s", s);
	char * cp = s;
	while (*cp != '\0')
	{
		switch (*cp)
		{
		case 'a':
			++a;
			break;
		case 'b':
			++b;
			break;
		case 'c':
			++c;
			break;
		}
		++cp;
	}
	int m = min(min(a, b), c);
	a -= m;
	b -= m;
	c -= m;
	if (a + b + c == 0)
		printf("YES");
	else if (a * b > 0 && max(a, b) <= 1)
		printf("YES");
	else if (b * c > 0 && max(b, c) <= 1)
		printf("YES");
	else if (a * c > 0 && max(a, c) <= 1)
		printf("YES");
	else if (max(max(a, b), c) <= 1)
		printf("YES");
	else
		printf("NO");
	return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,true):false;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,true):false;}

int nextInt() { int x; scanf("%d", &x); return x;}

ll dp[55][2505];
int x[55];

int main2() {
  memset(dp, 0, sizeof(dp));
  int N = nextInt();
  int A = nextInt();
  REP(i, N) x[i] = nextInt();

  dp[0][0] = 1;
  for (int i = 0; i < N; i++) {
    for (int m = 50; m >= 1; m--) {
      for (int v = 2500; v - x[i] >= 0; v--) {
        dp[m][v] += dp[m-1][v - x[i]];
      }
    }
  }
  ll ans = 0;
  for (int i = 1; i <= N; i++) if (i * A <= 2500) ans += dp[i][i * A];
  cout << ans << endl;

  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}

mat matrix_mult(mat A, mat B, int N, int mod){
    mat C(N, vec(N, 0));
    REP(i, N) REP(j, N) REP(k, N){
        C[i][j] += A[i][k] * B[k][j];
        C[i][j] %= mod;
    }
    return C;
}

mat matrix_pow(mat A, int r, int N, int mod){
    mat B(N, vec(N, 0));
    REP(i, N) B[i][i] = 1;
    IREP(i, 64){
        B = matrix_mult(B, B, N, mod);
        if((r >> i) & 1) B = matrix_mult(A, B, N, mod); 
    }
    return B;
}

signed main(){

    int N, K; cin >> N >> K;
    int mod = 1000000007;
    mat a(N, vec(N)); REP(i, N) readv(a[i]);
    a = matrix_pow(a, K, N, mod);
    int ans = 0;
    REP(i, N) REP(j, N){
        ans += a[i][j];
        ans %= mod;
    }
    cout << ans;
    
    return 0;
}

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

using namespace std;

int main() {
    int N;
    cin >> N;

    vector<vector<int>> counts(10, vector<int>(10, 0));

    for (int i = 1; i <= N; ++i) {
        stringstream ss;
        ss << i;
        string s;
        ss >> s;
        counts[s.front() - '0'][s.back() - '0']++;
    }

    int64_t answer = 0;
    for (int a = 0; a < 10; ++a) {
        for (int b = 0; b < 10; ++b) {
            answer += (int64_t)counts[a][b] * counts[b][a];
        }
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <vector>
#include <stack>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in(gcu());}
_sc(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
//_sc(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
template <typename H,typename... T> _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
template <typename T>
_vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
//_vo(string &s){for (char c: s) pcu(c);}
template <typename H,typename... T> _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename T> _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
_vl(){out('\n');}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	vector<stack<int>> v(in());
	for (int q = in(); q; q--) {
		int o = in();
		auto &t = v[in()];
		switch(o) {
		case 0:
			t.push(in());
			break;
		case 1:
			if (!t.empty())
				outl(t.top());
			break;
		default:
			if (!t.empty())
				t.pop();
		}
	}
}


Measured memory_bytes: 3788
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, ll> cnt;
    REP(i, n){
        cin >> a[i];
        cnt[a[i]]++;
    }

    ll base = 0;
    for(auto p: cnt){
        base += p.second * (p.second-1) / 2;
    }

    REP(i, n){
        ll ans = base;
        ll num = cnt[a[i]];
        ans = (ans - num*(num-1)/2);
        ans += (num-1)*(num-2)/2;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 10240
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,w,n,x,y,hl=0,hr=0,vd=0,vu=0,i;
	string s,t;
	cin>>h>>w>>n>>x>>y>>s>>t;
	for(i=0;i<n;i++)
	{
		if(s[i]=='R')
			hr++;
		if(s[i]=='L')
			hl--;
		if(s[i]=='U')
			vu--;
		if(s[i]=='D')
			vd++;
		if((y+hl)<1)
		{
			cout<<"NO"<<endl;
			exit(0);
		}
		if((y+hr)>w)
		{
			cout<<"NO"<<endl;
			exit(0);
		}
		if((x+vu)<1)
		{
			cout<<"NO"<<endl;
			exit(0);
		}
		if((x+vd)>h)
		{
			cout<<"NO"<<endl;
			exit(0);
		}
		if(t[i]=='R')
			hl=min(hl+1,w-y);
		if(t[i]=='L')
			hr=max(hr-1,1-y);
		if(t[i]=='U')
			vd=max(vd-1,1-x);
		if(t[i]=='D')
			vu=min(vu+1,h-x);
		//cout<<i<<" "<<hr<<" "<<hl<<" "<<vd<<" "<<vu<<endl;
	}
	cout<<"YES"<<endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    string x;
    cin>>x;
    int len=x.length();
    for(int i=0;i<len-1;i++){
        if (x[i]==x[i+1]){
            printf("%d %d\n",i+1,i+2);
            return 0;
        }
    }
    for(int i=0;i<len-2;i++){
        if (x[i]==x[i+2]){
            printf("%d %d\n",i+1,i+3);
            return 0;
        }
    }
    printf("-1 -1\n");
    
}

Measured memory_bytes: 3844
package main

import "fmt"

func checkDup(s string) bool {
	m := make(map[rune]bool)
	for _, v := range s {
		if _, ok := m[v]; !ok {
			m[v] = true
		} else {
			return false
		}
	}
	return true
}

func main() {
	var s string
	fmt.Scan(&s)

	if checkDup(s) {
		fmt.Println("yes")
	} else {
		fmt.Println("no")
	}
}


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

typedef long long ll;

using namespace std;

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


int main(){
    ll N,K;
    cin >> N >> K;
    cout << min(abs(N%K-K),N%K) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MO = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define rt return
#define ENDL cout<<endl
#define MAXE(a,b) a=max(a,b)
#define MINE(a,b) a=min(a,b)
#define s second
#define f first

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int main(){
    vector<pair<int,int>> vec;
    vector<int> cnt(4,0);
    for(int a = 0;a < 3;a++){
        int b,c;cin >> b >> c;
        vec.push_back({b,c});
        cnt.at(b-1)++;
        cnt.at(c-1)++;
    }
    sort(ALL(cnt));
    YES(cnt.at(0) == 1 && cnt.at(1) == 1 && cnt.at(2) == 2 && cnt.at(3) == 2);
    return 0;
}


Measured memory_bytes: 256
def MaxHeap(A, i):
    # print(A)
    l = i * 2
    r = i * 2 + 1

    largest = i

    if l < len(A):
        if A[i] < A[l]:
            largest = l
            # print("l", A[l])

    
    if r < len(A):
        if A[largest] < A[r]:
            largest = r
            # print("l", A[r])
    
    if largest != i: #子の方が親より大きい
        tmp = A[i]
        # print(A[largest])
        A[i] = A[largest]
        A[largest] = tmp

        MaxHeap(A, largest)

def BuildHeap(A):
    length = len(A)//2

    for k in range(length, 0, -1):
        #print(k)
        MaxHeap(A, k)
   

    return A

n = input()

A = [""]
A += [int(i) for i in input().split()]

A = BuildHeap(A)

for i in A[1:]:
    print(" ", end = "")
    print(i, end = "")

print("")

"""
10
4 1 3 2 16 9 10 14 8 7 
"""


Measured memory_bytes: 63932
#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(){
  ll n;
  cin >> n;
  string res = "";
  while(n){
    --n;
    res += (char)('a' + ( n % 26));
    n /= 26;
  }
  reverse(res.begin(), res.end());
  cout << res << endl;
  return 0;
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int n;
    cin >> n;

    cout << (n - 2) * 180 << endl; 

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
//    return *(int*)a - *(int*)b;
    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

int main()
{
  int a ,b, c, d, e, X, Y;
//  long long  b, c, d, e, X, Y;
  //  double  c;
  long long  A[200003]={};
  int  B[100003]={};
  int  C[100003][11]={};

  int  flag[1003]={};

//  long long  a, b, c, d, X, Y;
  char s[101][101]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
//  int flag=0;
//  int tmp=0;
  char tmp[101]={};
//  int min=1000000;
  long long min=100000001;
  int len=0;
  int l=0;
  int r=1000001;
  int cnt=0;
  int num=0;
  int ans=0;
  int max=0;
  int addr=0;
  int ptn=0;
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
//  scanf("%lld %lld", &a, &b);
//  scanf("%d%d", &a,&c);
//  cnt = strlen(t);
// printf("%d\n",a);
  scanf("%d", &a);
  printf("%d\n", 180*(a-2));

    
    
    
    
    
//    printf("%s %d %d\n", s[i],C[i][0],C[i][1]);
   // printf("%d\n", C[i][1]);
/*  for(i=0;i<addr;i++){
//  scanf("%lld%lld", &B[0][i],&B[1][i]);
//    ans=ans+A[i];
    printf("%lld ", A[i]);
  }
*/
//    printf("%d ", cnt);
   
//  ans=a*3;
//  ans=(ans+b)/2;
//  printf("%d\n", ans);

  
//  printf("%lf\n",ans);
  //  //  if(flag==0)   printf("TLE\n");
//    if(max < cnt - max)  printf("Yes\n");
//    else  printf("No\n");
  
return 0;
}


Measured memory_bytes: 128
/*
 * Pawan Harendra Mishra
 */

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

#define X first
#define Y second
typedef long long ll;
typedef pair<ll,ll> pll;

#define N 100005
ll n, h[N];

int main(int argc, char const *argv[])
{
    //ios::sync_with_stdio(false);
    //cin.tie(NULL);

    cin >> n;
    for (ll i=0; i<n; i++) cin >> h[i];

    ll ans = 0;
    ll prev = h[0];
    ll count = 0;
    for (ll i=1; i<n; i++) {
        if (count > ans) ans = count;
        
        if (h[i] <= prev) count++;
        else count = 0;

        prev = h[i];
    }

    if (count > ans) ans = count;

    cout << ans << endl;
    return 0;
}

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

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		while(solve());
	}
	@SuppressWarnings("unchecked")
	static boolean solve() {
		int n = sc.nextInt();
		int m = sc.nextInt();
		int z = sc.nextInt();
		if (n == 0) {
			return false;
		}
		ArrayList<Edge>[] g = new ArrayList[n];
		for(int i=0;i<n;i++) {
			g[i] = new ArrayList<Edge>();
		}
		int m2 = m * 2 + 1;
		Edge[] e = new Edge[m2];
		for(int i=0;i<m;i++) {
			int s = sc.nextInt() - 1;
			int d = sc.nextInt() - 1;
			e[i*2] = new Edge(s,d,i*2);
			g[s].add(e[i*2]);
			e[i*2+1] = new Edge(d,s,i*2+1);
			g[d].add(e[i*2+1]);
		}
		e[m*2] = new Edge(-1, 0, m*2);
		int[][] a = new int[m2][m2];
		for(int i=0;i<m2;i++) {
			for(Edge ee:g[e[i].to]) {
				if (ee.to == e[i].from) {
					continue;
				}
				a[i][ee.id] = 1;
			}
		}
//		System.out.println(Arrays.deepToString(a));
		int[][] x = new int[m2][m2];
		for(int i=0;i<m2;i++) {
			x[i][i] = 1;
		}
		while(z > 0) {
			if (z % 2 == 1) {
				x = mul(x,a);
			}
			a = mul(a,a);
			z /= 2;
		}
		boolean ans = false;
		for(int i=0;i<m*2;i++) {
			if (x[m*2][i] == 1 && e[i].to == n-1) {
				ans = true;
			}
		}
//		System.out.println(Arrays.deepToString(x));
		System.out.println(ans ? "yes" : "no");
		return true;
	}
	static int[][] mul(int[][] a,int[][] b) {
		int n = a.length;
		int[][] c = new int[n][n];
		for(int i=0;i<n;i++) {
			for(int j=0;j<n;j++) {
				for(int k=0;k<n;k++) {
					c[i][j] |= a[i][k] & b[k][j];
				}
			}
		}
		return c;
	}
}
class Edge {
	int from,to,id;
	public Edge(int from,int to,int id) {
		this.from = from;
		this.to = to;
		this.id = id;
	}
}

Measured memory_bytes: 43712
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5;
int t[maxn+5],x[maxn+5],y[maxn+5];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>t[i]>>x[i]>>y[i];
	}
	int flag =1;
	int x0=0,y0=0;
	for(int i=1;i<=n;i++){
		int res=abs(x0-x[i])+abs(y0-y[i]);
		if(res>t[i]||(t[i]-t[i-1])%2!=res%2){
			flag=0;
			break;
		}
		x0=x[i];y0=y[i];
	}
	if(flag){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#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; i++)
#define all(v) v.begin(), v.end()
using pint = pair<int, int>;
using tint = tuple<int, int, int>;
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; }
typedef int64_t lint;
constexpr double PI=3.14159265358979323846;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;

int main() {
	int N;
	cin >> N;
	vector<int> v(N);
	rep(i, N) {
		cin >> v.at(i);
	}

	int a=0, b=0, c=0, x, y, z;
	rep(i, N) {
		if (i%2 == 1) continue;
		if (v.at(i)%2 == 1) a++;
	}
	std::cout << a << '\n';
}


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

int main(void){
  string S;
  cin>>S;
  if(S=="SUN") cout<<7<<endl;
  else if(S=="SAT") cout<<1<<endl;
  else if(S=="MON") cout<<6<<endl;
  else if(S=="TUE") cout<<5<<endl;
  else if(S=="WED") cout<<4<<endl;
  else if(S=="THU") cout<<3<<endl;
  else if(S=="FRI") cout<<2<<endl;
  return 0;
}


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

int main() {
  int A,B,C; cin >> A >> B >> C;
  bool check = false;
  rep(i,0,B+1) if (A * i % B == C) check = true;
  if (check) cout << "YES" << endl;
  else cout << "NO" << endl;
}  

Measured memory_bytes: 3596
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
using namespace std;
int a=0 , b=0, c=0 , d=0 , e[100][100], f[100000], g[100000], h[100000], counto=1, x , y , z ;
long long ab[100000], abc = 0;
pair<int, int>manji[100000];
char rikka, toka[100000];
string saya, homu, kyok, mami[100], mado[100];
bool gg;

int main() {
	unsigned long long aho = 0, baka = 0;
	cin >> aho;
	
	baka += aho / 11*2;
	if (0 < aho % 11 ) {
		if (6 < aho % 11) {
			baka += 2;
		}
		else { baka += 1; }
	}
	
	cout << baka << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#include <queue> 
#include <map>
#include <set>
#define MOD 1000000007
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
using namespace std;

int main(){

  int n;
  cin >> n;
  
  int c[510],s[510],f[510],t[510] = {};
  
  REP(i,n-1){
   cin >> c[i] >> s[i] >> f[i];
  }
  
  REP(i,n-1){
    t[i] += (s[i]+c[i]);
    FOR(j,i+1,n-1){
      if(t[i] < s[j]) t[i] = s[j];
      int wait = t[i] % f[j];
      if(wait != 0)t[i] += (f[j]- wait);
      t[i] += c[j];
    }
  }
  
  REP(i,n-1) cout << t[i] << endl;
  
  cout << 0 << endl;
  
 return 0;
}

Measured memory_bytes: 256
/*AMETHYSTS*/
#pragma comment(linker, "/STACK:1000000000")
#include <cstdio>
#include <iostream>
#include <ctime>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <set>
#include <map>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#include <deque>
#include <stack>
#include <climits>
#include <string>
#include <queue>
#include <memory.h>
#include <unordered_map>
#include <random>

#define ll long long
#define ld double
#define pii pair <int, int>
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define mp make_pair
#define ui unsigned ll
#define pll pair <ll, ll>

using namespace std;

const int maxn = (int)2e5 + 10;

pii v[maxn];

const ld d = 5 * acos(-1.0);

vector <pii> g;

int t[4 * maxn];

int go(int it, int l, int r, int lm, int rm) {
	if (l == lm && r == rm) {
		return t[it];
	}

	int m = (l + r) >> 1;

	if (rm <= m) {
		return go(2 * it, l, m, lm, rm);
	}

	if (lm > m) {
		return go(2 * it + 1, m + 1, r, lm, rm);
	}

	return max(go(2 * it, l, m, lm, m), go(2 * it + 1, m + 1, r, m + 1, rm));
}

void change(int it, int l, int r, int pos, int x) {
	if (l == r) {
		t[it] = x;
	} else {
		int m = (l + r) >> 1;

		if (pos <= m) {
			change(2 * it, l, m, pos, x);
		} else {
			change(2 * it + 1, m + 1, r, pos, x);
		}

		t[it] = max(t[it], x);
	}
}

int go() {
	vector <int> c;

	for (int i = 0; i < (int)g.size(); i++) {
		c.push_back(g[i].second);
	}

	sort(c.begin(), c.end());
	
	for (int i = 0; i < (int)g.size(); i++) {
		g[i].second = lower_bound(c.begin(), c.end(), g[i].second) - c.begin();
	}

	int ans = 0;

	for (int i = (int)g.size() - 1; i >= 0; i--) {
		int res = 1 + go(1, 0, maxn - 1, g[i].second, maxn - 1);
		change(1, 0, maxn - 1, g[i].second, res);
		ans = max(ans, res);
	}

	return ans;
}

int main() {
	int x1, y1, x2, y2;

	int n;

	cin >> x1 >> y1 >> x2 >> y2 >> n;

	for (int i = 0; i < n; i++) {
		scanf("%d %d", &v[i].first, &v[i].second);
	}

	if (x1 != x2) {
		for (int i = 0; i < n; i++) {
			swap(v[i].first, v[i].second);
		}

		swap(x1, y1);
		swap(x2, y2);
	}

	if (x1 == x2) {
		if (y1 > y2) {
			swap(y1, y2);
		}

		for (int i = 0; i < n; i++) {
			if (v[i].first == x1 && y1 <= v[i].second && v[i].second <= y2) {
				printf("%.10lf\n", (ll)100 * (y2 - y1) - 20 + 2 * d);
				return 0;
			}
		}

		cout << (ll)100 * (y2 - y1) << endl;
		return 0;
	}

	if (x1 > x2) {
		swap(x1, x2);
		swap(y1, y2);
	}

	if (y1 > y2) {
		y1 = -y1;
		y2 = -y2;

		for (int i = 0; i < n; i++) {
			v[i].second = -v[i].second;
		}
	}

	sort(v, v + n);

	for (int i = 0; i < n; i++) {
		if (x1 <= v[i].first && v[i].first <= x2 && y1 <= v[i].second && v[i].second <= y2) {
			g.push_back(v[i]);
		}
	}

	int cnt = go();

	ld ans = (ll)100 * (y2 - y1 + x2 - x1) - 20 * cnt + d * cnt;

	if (cnt == x2 - x1 + 1 || cnt == y2 - y1 + 1) {
		ans += d;
	}

	printf("%.10lf\n", ans);

	return 0;
}


Measured memory_bytes: 8304
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod=1e9+7;
const int INF=1001001001;

int main() {
  int A,B;
  cin>>A>>B;
  if(A>=13){cout<<B<<endl;}
  else if(A>=6){cout<<B/2<<endl;}
  else{cout<<0<<endl;}
  return 0;  
}

Measured memory_bytes: 3548
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors


def main():
    a,b,k = map(int,input().split())
    divisor1 = set(make_divisors(a))
    divisor2 = set(make_divisors(b))
    divisor3 = divisor1 & divisor2
    divisor3 = sorted(list(divisor3))

    print(divisor3[-k])


if __name__ == '__main__':
    main()


Measured memory_bytes: 38512
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            long k = Long.parseLong(in.next());

            for (int i = 0; i < Math.min(S.length(), k); i++) {
                if (S.charAt(i) >= '2') {
                    out.println(S.charAt(i));
                    return;
                }
            }
            out.println(1);

        }

    }
}



Measured memory_bytes: 21844
N,K=map(int,input().split())

ans=0
for b in range(K+1,N+1):
    quo=N//b
    ans+=quo*(b-K)
    rem=N-(b*quo+K-1)#途中までの
    if rem>0:
        ans+=rem

if K==0:
    ans-=N-K#a=0(商０かつ余り0)をカウントしているので
        
print(ans)



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

int m[2000][2000];
long long l[2000][2000], r[2000][2000], u[2000][2000], d[2000][2000];



int main(){
  int h, w;
  cin >> h >> w;
  
  for(int i=0; i<h; i++){
    string s;
    cin >> s;
    for(int j=0; j<w; j++){
      if(s[j] == '.')
        m[i][j] = 0;
      else
        m[i][j] = 1;
    }
  }
  
  
  for(int i=0; i<h; i++){
    int k=1;
    for(int j=0; j<w; j++){
      if(m[i][j] == 0){
        l[i][j] = k;
        ++k;
      }else{
        l[i][j] = 0;
        k = 1;
      }
    }
    
    k=1;
    for(int j=w-1; j>=0; j--){
      if(m[i][j] == 0){
        r[i][j] = k;
        ++k;
      }else{
        r[i][j] = 0;
        k = 1;
      }
    }
  }
  
  for(int j=0; j<w; j++){
    int k=1;
    for(int i=0; i<h; i++){
      if(m[i][j] == 0){
        u[i][j] = k;
        ++k;
      }else{
        u[i][j] = 0;
        k = 1;
      }
    }
    
    k=1;
    for(int i=h-1; i>=0; i--){
      if(m[i][j] == 0){
        d[i][j] = k;
        ++k;
      }else{
        d[i][j] = 0;
        k = 1;
      }
    }
  }
  
  long long ans = 0;
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      ans = max(ans, u[i][j] + d[i][j] + l[i][j] + r[i][j] -3);
    }
  }
  
  cout << ans << endl;
}



Measured memory_bytes: 140928
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pa;
typedef unsigned int uint;
typedef unsigned long long ull;
ll n,a[300000],ans=0;
int main() {
	cin >> n;
	cin >> a[0];
	for (int i = 1; i < n; i++) { 
		cin >> a[i];
		if (a[i - 1] > a[i]) {
			ans += a[i - 1] - a[i];
			a[i] = a[i - 1];
		}
		
	}
	cout << ans << endl;
}

Measured memory_bytes: 5168