akhauriyash/Code-Regression huggingface dataset:
/*
Author : N_o_o_B
Created : December 04 2019 01:12:00 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    int n,k,x,y;
    cin >> n >> k >> x >> y;
    cout << min(k,n)*x + max(n-k,0)*y << endl;




    time_taken();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void) {
  int a, b, x;
  scanf("%d %d %d", &a, &b, &x);
  if (x < a * a * b / 2.0) {
    printf("%lf\n", atan(a * b * b / 2.0 / x) / acos(-1) * 180);
  } else {
    printf("%lf\n", atan(2.0 * b / a - 2.0 * x / a / a / a) / acos(-1) * 180);
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define MOD 1000000007
#define pp pop_back
#define MAXN   100001
#define mp make_pair
#define endl '\n'
int main()
{
	ll a,b,c,d,n;
	cin>>a>>b>>c>>d>>n;
	a=a*4;
	b=b*2;
	//cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
	ll x=min(a*2,min(b*2,min(c*2,d)));
	//cout<<x<<endl;
	ll ans=0;
	if(x==d)
	{
		if(n%2==0)
		{
			n=n/2;
			ans+=n*x;
		}
		else
		{
			n=n/2;
			ans+=n*x;
			//cout<<"hello"<<ans<<endl;
			x=min(a,min(b,c));
			ans+=x;
		}
	}
	else
	{
		ans+=(x/2)*n;
	}
	cout<<ans<<endl;
}


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

int main(){
  string N;
  cin >> N;
  int n = N.size();
  int sum = 0;
  for(int i=0; i<n; i++){
    sum += N.at(i)-'0';
    if(sum>=9){
      sum %= 9;
    }
  }
  //cout << 0+N.at(0);
  if(sum == 0){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define whole(x) (x).begin(), (x).end()
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
  
const int N = int(2e5) + 2;
const int LG = 20;
const ll mod = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const ll linf = 1e18; 
const ld pi = acos(-1);
const int base = 10;
const ld EPS = 1e-9;

int n;
int main (){
    scanf ("%d", &n);
    printf ("%d\n", (n * n * n));
}

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


int main(){
  
  ll N, X, Y, q, i, j, min;
  vector<ll> ans(2000);
  vector<vector<ll>> len(2000, vector<ll>(2000, 3000));

  cin >> N >> X >> Y;
  
  rep(i, N){
    for(j = i + 1; j < N; j++){
      len[i][j] = j - i;
      if(i + 1 <= X && j + 1 > X){
        min = fabs(Y - (j + 1));
        min++;
        min = X - (i + 1) + min;
        if(min < len[i][j]){
          len[i][j] = min;
        }
      } else if(i + 1 > X){
        min = (i + 1) - X;
        min++;
        min += fabs(Y - (j + 1));
        if(min < len[i][j]){
          len[i][j] = min;
        }
      }
    }
  }
  rep(i, N){
    rep(j, N){
      ans[len[i][j] - 1]++;
    }
  }
  
  rep(i, N - 1){
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 31616
#include <bits/stdc++.h>
#define int             long long
#define ld              long double
#define rep0(i,n)       for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rep(i,x,y)      for(int i=x;i<=y;i++)
#define reprev1(i,n)    for(int i=n;i>0;i--)
#define reprev0(i,n)    for(int i=n-1;i>=0;i--)
#define reprev(i,x,y)   for(int i=x;i>=y;i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x,y)         fixed<<setprecision(y)<<x
#define setbits(x)      __builtin_popcount(x)
#define zerobits(x)     __builtin_ctz(x)
#define in(a,n)         vi a(n);rep0(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define endl            '\n'
#define mod             1000000007
#define Max             (int)1e6+6
#define inf             1e18
using namespace std;

int n,m,k,x,y,z,a1,b,c,d,i,j;





void sol()
{   
    cin>>n>>k;
    int a[n+1];
    rep1(i,n)cin>>a[i];
    int dp[n+1]={};
    
    for(int i=2;i<=n;i++)
    { int mn=inf;
        for(int j=1;j<=k;j++)
        {  if(i-j>=1)
            mn=min(mn,dp[i-j]+abs(a[i]-a[i-j]));
        }
        dp[i]=mn;
    }
    
    
    
    
    cout<< dp[n] <<endl;
}





int32_t main(){

    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    // w(t)
    sol();
    return 0;
}



Measured memory_bytes: 1792
n=int(input())
a=list(map(int,input().split()))

tsum = 0
res1 = 0
for i in range(n):
    tsum += a[i]
    if i % 2 == 0:
        if tsum < 1:
            res1 += 1-tsum
            tsum = 1
    else:
        if tsum > -1:
            res1 += tsum+1
            tsum = -1

tsum = 0
res2 = 0
for i in range(n):
    tsum += a[i]
    if i % 2 == 1:
        if tsum < 1:
            res2 += 1-tsum
            tsum = 1
    else:
        if tsum > -1:
            res2 += tsum+1
            tsum = -1

print(min(res1,res2))

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

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

    vector<int> X(M);
    for(int i = 0; i < M; i++){
        cin >> X[i];
    }

    sort(X.begin(), X.end());

    vector<int> dif(M);
    int sum = 0;
    for(int i = 1; i < M; i++){
        dif[i] = X[i] - X[i-1];
    }

    sort(dif.begin(), dif.end());
    for(int i = 1; i < M; i++){
        if(i < M - (N - 1)){
            sum += dif[i];
        }
    }

    
    cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1024
%:pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
// by piano
template<typename tp> inline void read(tp &x) {
    x = 0;char c = getchar();bool f = 0;
    for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
    for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
    if(f) x = -x;
}
const int N = 1e6 + 10;
struct E {
	int from, to, nxt;
}e[N << 2];
int head[N], cnt = 0;

inline void add(int u, int v) {
	e[++ cnt] = (E) {u, v, head[u]};
	head[u] = cnt;
}
int n, b[N], a[N];
vector<int> v;
inline bool dfs(int u, int fa) {
	int statu = 1;
	if(fa == 0 || a[fa] > a[u]) statu = 0; 
	for(int i = head[u]; i; i = e[i].nxt) if(e[i].to != fa) {
		statu |= !dfs(e[i].to, u);
	}
	return statu;
}

inline void solve(int u) {
	if(dfs(u, 0)) v.push_back(u);
}

main() {
//	freopen("C.in", "r", stdin);
//	freopen("C.out", "w", stdout);
	read(n);
	for(int i = 1; i <= n; i ++) read(a[i]);
	for(int i = 1; i <= n - 1; i ++) {
		int u, v;
		read(u), read(v);
		add(u, v), add(v, u);
	}
	for(int i = 1; i <= n; i ++) solve(i);
	for(auto u : v) cout << u << ' ';
}

Measured memory_bytes: 4480
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



int n, q;
string s;
char t[200000];
char d[200000];


int fall(int pos) {
	if (pos == -1 || pos == n)return pos;
	rep(i,q){
		if (s[pos] == t[i]) {
			if (d[i] =='L') {
				pos--;
			}
			else {
				pos++;
			}
		}
		if (pos == -1 || pos == n)return pos;
	}

	return pos;
}


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


	cin >> n >> q;
	cin >> s;
	rep(i,q) {
		cin >> t[i] >> d[i];
	}

	//rep(i, n)cout << ' ' << fall(i);
	//cout << endl;

	int border = -1;
	{
		int lb = -1, ub = n;
		while (ub - lb > 1) {
			int mid = (lb + ub) / 2;
			if (fall(mid) <= mid)lb = mid;
			else ub = mid;
		}
		border = lb;
	}
	
	int ans = n;
	//left
	{
		int lb = -1, ub = border + 1;
		while (ub - lb > 1) {
			int mid = (lb + ub) / 2;
			if (fall(mid) == -1)lb = mid;
			else ub = mid;
		}
		ans -= lb + 1;
	}
	//right
	{
		int lb = border - 1, ub = n;
		while (ub - lb > 1) {
			int mid = (lb + ub) / 2;
			if (fall(mid) == n)ub = mid;
			else lb = mid;
		}
		ans -= n - ub;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 976
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int N, T; cin >> N >> T;
	
	int ans = 1 << 30;
	REP(i,N){
		int c, t; cin >> c >> t;
		if(t<=T) ans = min(ans, c);
	}

	if(ans == (1 << 30)) cout << "TLE" << endl;
	else cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    int n, k;
    cin >> n >> k;
    int h[n];
    rep(i,n) cin >> h[i];
    sort(h, h+n);
    int ans = INF;
    rep(i,n) {
        if (i+k-1 > n-1) break;
        ans = min(ans, h[i+k-1] - h[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double A, B, C, D;
  cin >> A >> B >> C >> D;
  double E;
  E=A*B;
  E/=2;
 cout << E << " ";
  if(C*2==A && D*2==B){cout << 1 <<endl;}else{cout << 0 << endl;}
}

Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef int64_t lint;
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using lb = long double;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SI(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define debug(x) cerr << #x << ": " << x << "\n"//手動デバッグ
#define debugV(x) for(int i=0;i<((ll)(x).size());i++)cerr << #x <<"at:"<<i<< ": " << x[i] << "\n"//手動デバッグ 
#define YES(c) cout<<((c)?"YES\n":"NO\n"),0
#define Yes(c) cout<<((c)?"Yes\n":"No\n"),0
#define O(p) cout<<p<<"\n",0
#define OS(p) cout<<p<<" ",0
#define ON(p) cout<<p,0
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define endl "\n"//endlを置き換える
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定

const int dy[4]={1,0,-1,0};
const int dx[4]={0,1,0,-1};//^>v<

template<class T=int> T in(){
    T x;
    cin>>x;
    return (x);
}
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 gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}
//------------------------------------------------------------





//------------------------------------------------------------
int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
//------------------------------------------------------------
    int n;cin>>n;
    map<string,int> m;
    rep(i,n){
        string s;cin>>s;
        m[s]++;
    }
    int ma=0;
    for (auto i : m) {
        ma=max(ma,i.second);
    }
    for (auto i : m) {
        if(i.second==ma)O(i.first);
    }
    
    
    
    
//------------------------------------------------------------
	return 0;
}


Measured memory_bytes: 19248
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const double pi=3.14159265358979323846;
int ctoi(const char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}
vector<int> input(int n) {
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    return vec;
}
void output(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    return;
}
vector<vector<int>> input(int n, int m) {
    vector<vector<int>> table(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> table. at(i).at(j);
        }
    }
    return table;
}
void output(vector<vector<int>> table) {
    for (int i = 0; i < table.size(); i++) {
        for (int j = 0; j < table.at(0).size(); j++) {
            cout << table.at(i).at(j) << " ";
        }
        cout << endl;
    }
}
long long perm(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long perm = 1;
    for (int i = n; i > n - r; i--) {
        perm *= i;
    }
    return perm;
}
long long comb(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long comb = perm(n,r);
    for (int i = r; i > 0; i--) {
        comb /= i;
    }
    return comb;
}
long long homo(int n, int r) {
    return comb(n + r - 1, n - 1);
}
long long fact(int n) {
    long long fact = 1;
    for (int i = n; i > 0; i--) {
        fact *= i;
    }
    return fact;
}
int gcd(int a, int b){
    if (a % b == 0){
        return(b);
    }else{
        return(gcd(b, a % b));
    }
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
bool isprime(int n){
    if (n < 2) return false;
    else if (n == 2) return true;
    else if (n % 2 == 0) return false;

    for (int i = 3; i <= sqrt(n); i += 2){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}
void Yes(bool f) {
    if (f) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
void YES(bool f) {
    if (f) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

int main() {
  string s;
  cin >> s;
  Yes(s=="hi"||s=="hihi"||s=="hihihi"||s=="hihihihi"||s=="hihihihihi");
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

void dfs(int n, vi res){
  //  printf("rec %d %d\n", n, (int)res.size());
  if(n == 0){
    rep(i, res.size()) printf(i?" %d":"%d", res[i]); puts("");
    return;
  }
  res.PB(0);
  for(int i = n; i > 0; i--){
    if(res.size() <= 1){
      //      printf("a %d\n", i);
      res[res.size()-1] = i;
      dfs(n-i, res);
    }else{
      //      printf("%d\n", i);
      if(res[res.size()-2] < i) continue;
      res[res.size()-1] = i;
      dfs(n-i, res);
    }
  }
  return;
}

int main(){
  int n;
  while(scanf("%d", &n) && n){
    vi a;
    dfs(n, a);
  }
  return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
unsigned long long n,sum;
int main()
{
    cin>>n;
    for(long long i=1;i<=n;i++)
    {
       if(i%3!=0 && i%5!=0 && i%15!=0) sum+=i;
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

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

        String x = sc.next();
        String y = sc.next();

        int a = Integer.parseInt(x, 16);
        int b = Integer.parseInt(y, 16);

        if (a==b){
            System.out.println("=");
        }else if (a<b){
            System.out.println("<");
        }else {
            System.out.println(">");
        }

    }
}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()
typedef pair<ll, ll>    P;

int main() {
    string s, mihon = "CODEFESTIVAL2016";
    cin >> s;
    int ans = 0;
    REP(i, 16) {
        if(s[i] != mihon[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import math as m
a, b, c = map(float, input().split())
c = m.radians(c)
S = a * b * m.sin(c) * (1/2)
l = m.sqrt(a**2 + b**2 - 2 * a * b * m.cos(c))
L = a + b + l
h = b * m.sin(c)
print("%.5f\n%.5f\n%.5f" % (S, L, h))

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

int main() {
  int64_t n,k,s;
  cin >> n >> k >> s;
  rep(i,k) cout << s << " ";
  if(s==1000000000) rep(i,n-k) cout << 3 << " ";
  else rep(i,n-k) cout << s+1 << " ";
  cout << endl;

}

Measured memory_bytes: 1280
#include <stdio.h>
int main(void)
{
	int a,b,c,A,B,C,i;
	scanf("%d%d",&a,&b);
	c=a;
	for(i=1; i<=2; i++){
		switch(c){
			case 2:
				C=1;
				break;
			case 3:
				C=2;
				break;
			case 4:
				C=3;
				break;
			case 5:
				C=4;
				break;
			case 6:
				C=5;
				break;
			case 7:
				C=6;
				break;
			case 8:
				C=7;
				break;
			case 9:
				C=8;
				break;
			case 10:
				C=9;
			break;
				case 11:
				C=10;
				break;
			case 12:
				C=11;
				break;
			case 13:
				C=12;
				break;
			case 1:	
				C=13;
				break;
		}
		if(i==1){
			c=b;
			A=C;
		}
		if(i==2){
			B=C;
		}
	}
	if(A>B){
		printf("Alice\n");
	}
	if(A<B){
		printf("Bob\n");
	}
	if(A==B){
		printf("Draw\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

int main(){
 	string s;
  cin >> s;
  for(int i=0;i<s.size();i++){
   if(s.at(i) =='1'){
    s.at(i) ='9'; 
   }
   else if(s.at(i) =='9') {
    s.at(i) = '1' ;
   }
  }
  cout << s << endl;
}

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

int main(void)
{
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    vector<ll> F(N);
    ll a_count = 0;
    for(int i=0;i<N;i++){
        cin >> A.at(i);
        a_count += A.at(i);
    }
    for(int i=0;i<N;i++){
        cin >> F.at(i);
    }

    sort(A.begin(), A.end());
    sort(F.begin(), F.end(), greater<ll>());

    if(a_count <= K){
        cout << 0;
        return 0;
    }
    ll max_ans=0, ans;
    ll min_ans = 1;
    for(int i=0;i<N;i++){
        max_ans = max(max_ans, A.at(i)*F.at(i));
    }
    ll count_k, diff;
    while (true){
        ans = (min_ans + max_ans) / 2;
        bool ok = true;
        count_k = K;
        for(int i=0;i<N;i++){
            diff = A.at(i) * F.at(i) - ans;
            if(diff > 0){
                if(diff%F.at(i)==0){
                    count_k -= diff / F.at(i);
                }else{
                    count_k -= diff / F.at(i) + 1;
                }
            }
            if(count_k<0){
                ok = false;
                break;
            }
        }
        if(ok){
            max_ans = ans;
        }else{
            min_ans = ans;
        }
        if(max_ans==min_ans+1){
            cout << max_ans;
            return 0;
        }
        
    }
    return 0;
}

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

int main() {
  int n,k; cin >> n >> k;
  int e = (n-1)*(n-2)/2;
  if (k>e) {
    cout << -1 << endl;
    return 0;
  }
  cout << e-k+n-1 << endl;
  int count = 0;
  for (int i=2; i<=n;i++) {
    printf("%d %d\n", 1, i);
  } 
  [&] {
    for (int i=2; i<n; i++) {
      for (int j=i+1; j<=n; j++) {
        if (count == e - k)
          return;
        printf("%d %d\n", i, j);
        count++;
      }
    }
  }();
  return 0;
}

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

using namespace std;

int main(){
    int A, B, C;
    cin >> A >> B >> C;

    bool b = false;

    if(A == 7 && B == 5 && C == 5)
        b = true;
    if(A == 5 && B == 7 && C == 5)
        b = true;
    if(A == 5 && B == 5 && C == 7)
        b = true;

    if(b)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class315
    {
        static void Main()
        {
            string S = Console.ReadLine();
            bool frag = false;
            string T = Console.ReadLine();
            if (T.Length == S.Length + 1)
            {
                if (T.Substring(0, S.Length) == S)
                    frag = true;
            }
            Console.WriteLine(frag?"Yes":"No");
        }
    }
}


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

int main() {
  string S;
  string T;
  cin >> S;
  cin >> T;
  int N = S.size();
 for(int i = 0; i < N ; i++){
  if(S.at(i) == T.at(i) && i == N - 1){
    cout << "Yes" << endl;
    break;
  }
   else if(S.at(i) != T.at(i)){
    cout << "No" << endl;
     break;
   }
  
 }
  
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int n,k;
    int a[n];
    cin>>n>>k;
    set<int> st;
    map<int,int> mp;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        st.insert(a);
        if(mp.find(a)==mp.end())mp[a]=1;
        else mp[a]++;
    }
    if(st.size()<=k){
        cout<<0<<endl;
        return 0;
    }
    vector<int> sa;
    for(auto itr=st.begin();itr!=st.end();itr++){
        sa.push_back(mp[*itr]);
    }
    sort(sa.begin(),sa.end());
    int ans=0;
    for(int i=0;i<st.size()-k;i++){
        ans+=sa[i];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 20092
int main(void){
  int R, G, B, N;
  scanf("%d %d %d %d", &R, &G, &B, &N);

  int count = 0;
  int temp;

  for(int r=0;r<=N;r++){
  	for(int g=0;g<=N;g++){
      temp = N - r*R - g*G;
      if( temp >= 0 && temp%B == 0){
        count += 1;
      }
    }
  }
  printf("%d", count);
}


Measured memory_bytes: 128
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

long long N;
vector<vector<vector<double>>> dp;
int cnt[4];

double dfs(int i, int j, int k)
{
  if (dp[i][j][k] != -1)
    return dp[i][j][k];
  if (i == 0 && j == 0 && k == 0)
    return 0.0;
  double ret = 0.0;
  if (i - 1 >= 0)
    ret += dfs(i - 1, j, k) * i;
  if (j - 1 >= 0)
    ret += dfs(i + 1, j - 1, k) * j;
  if (k - 1 >= 0)
    ret += dfs(i, j + 1, k - 1) * k;
  ret += N;
  ret /= (i + j + k);
  return dp[i][j][k] = ret;
}

int main()
{
  scanf("%lld", &N);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &a[i]);
    cnt[a[i]]++;
  }
  dp.assign(301, vector<vector<double>>(301, vector<double>(301, -1)));
  dp[0][0][0] = 0.0;
  printf("%.10lf\n", dfs(cnt[1], cnt[2], cnt[3]));

  return 0;
}


Measured memory_bytes: 217088
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  vector<int> d(a);
  rep(i,a)
    cin>>d.at(i);
  int e=0;
  rep(i,a-1){
    if(abs(d.at(i)-d.at(i+1))*b>c)
      e+=c;
      else
        e+=(d.at(i+1)-d.at(i))*b;
    }
  cout<<e;
}

Measured memory_bytes: 1024
package main

import "fmt"

func main() {
	var (
		n int
		s string
	)
	
	_, _ = fmt.Scan(&n, &s)
	
	answer := 1
	
	for i := 1; i < len(s); i++ {
		if s[i] != s[i-1] {
			answer++
		}
	}
	
	fmt.Println(answer)
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;

signed main(){
	ll m,d; cin>>m>>d;
	ll ans=0;
	rep(i,1,m+1){
		for(int j=2;j*j<=i;j++){
			if(i%j==0 && i/j>1 && j/10==0 && (i/j)/10==0){
				if(j==(i/j)){
					if(j*10+(i/j)<=d)ans++;
				}
				else{
					if(j*10+(i/j)<=d)ans++;
					if((i/j)*10+j<=d)ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3632
#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<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    string s;
    cin >> s;
    int n = s.length();
    REP(i,n-1){
        if (s[i] == s[i+1]){
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
        if (i < n-2 && s[i] == s[i+2]){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    cout << "-1 -1" << endl;
    return 0;
}

Measured memory_bytes: 512
#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());

int main(){
  int n;
  cin >> n;
  map<int,int> mp;
  for(int i=2;i<=33;i++){
    for(int j=2;pow(i,j)<=1000;j++){
      mp[pow(i,j)]++;
    }
  }
  mp[1]++;
  int ans = 0;
  for(auto p : mp){
    if(n >= p.first) ans = p.first;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#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;
}
*/

string s;
ll k;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(20);
    cin >> s;
    cin >> k;
    int fl = 0;
    for (int i = 1; i < s.size(); ++i) {
        if (s[i] != s[0]) {
            fl = 1;
        }
    }

    if (!fl) {
        cout << (s.size() * k) / 2 << "\n";
        return 0;
    }

    char c = 0;

    ll g1 = 0;
    ll g2 = 0;

    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == c) {
            c = 0;
            ++g1;
        } else {
            c = s[i];
        }
    }

    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == c) {
            c = 0;
            ++g2;
        } else {
            c = s[i];
        }
    }

    cout << g1 + (k - 1) * g2 << "\n";

	return 0;
}




Measured memory_bytes: 764
import java.util.Scanner;
import static java.lang.System.out;

class Watch {
    public void run() {
        int input = new Scanner( System.in ).nextInt();
        int h = input / 3600;
        int m = input % 3600 / 60;
        int s = input % 60 % 60;

        out.printf( "%d:%d:%d\n", h, m, s);
    }
}

public class Main {
    public static void main( String... args) {
        Watch test = new Watch();
        test.run();
    }
}

Measured memory_bytes: 26360
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

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

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REPR(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define FOR(i, n, m) for (ll i = (n); i < (m); ++i)
#define FORR(i, n, m) for (ll i = (m) - 1; i >= (n); --i) 
#define FORE(x, xs) for (auto &x: (xs))
#define ALL(v) v.begin(), v.end()
#define ZERO(a) memset(a,0,sizeof(a))

const int INF = 1000000009;
const int MOD = 1000000007;
const double EPS = 1e-14;
const double PI = acos(-1);

const int MAX = 2e5;

ll N, K;
ll a[100001]; /// 元のデータ
ll b[100001]; /// 累積和
ll c[100001]; /// 正の値だけの累積和

int main() {
  cin >> N >> K;
  FOR (i, 1, N+1) cin >> a[i];
  b[0] = c[0] = 0ll;
  FOR (i, 1, N+1) {
    b[i] = a[i]+b[i-1];
    c[i] = c[i-1] + ((a[i] > 0ll) ? a[i] : 0ll);
  }

  ll ans = -INF;
  REP (i, N-K+1) {
    ll sum = max(0ll, b[i+K]-b[i]);
    sum += c[i] + (c[N]-c[i+K]);
    ans = max(ans, sum);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double A, B, H, M;
  cin >> A >> B >> H >> M;
  
  double pi=M_PI;
  
  double Mr=M*2*pi/60;
  double Hr=(H+M/60)*2*pi/12;
  double f = Mr - Hr;
  
  double X = A * A + B * B;
  double Y = 2 * A * B * cos(f);
  double e = sqrt(X - Y);
  cout << fixed << setprecision(15) << e << endl;
}
  

Measured memory_bytes: 4136
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

def calcScore(t, s, c):
    scores = [0]*26
    lasts = [0]*26
    for i in range(1, len(t)):
        scores[t[i]] += s[i][t[i]]
        dif = i - lasts[t[i]]
        scores[t[i]] -= c[t[i]] * dif * (dif-1) // 2
        lasts[t[i]] = i
    for i in range(26):
        dif = len(t) - lasts[i]
        scores[i] -= c[i] * dif * (dif-1) // 2
    return scores

def update(socre, day, t, q):
    p = t[day]
    t[day] = q
    scores[p] = 0
    scores[q] = 0
    lasts = [0]*26
    for i in range(1, len(t)):
        if t[i] == p or t[i] == q:
            scores[t[i]] += s[i][t[i]]
            dif = i - lasts[t[i]]
            scores[t[i]] -= c[t[i]] * dif * (dif-1) // 2
            lasts[t[i]] = i
    for i in [p, q]:
        dif = len(t) - lasts[i]
        scores[i] -= c[i] * dif * (dif-1) // 2
    return scores

def greedy(c, s):
    day_lim = len(s)
    socres = [0]*26
    t = [0]*day_lim
    lasts = [0]*26
    for i in range(1, day_lim):
        pls = [v for v in socres]
        mns = [v for v in socres]
        for j in range(26):
            pls[j] += s[i][j]
            mns[j] -= c[j] * (i - lasts[j])
        sum_mns = sum(mns)
        pt = sum_mns - mns[0] + pls[0]
        idx = 0
        for j in range(1, 26):
            tmp = sum_mns - mns[j] + pls[j]
            if pt < tmp:
                pt = tmp
                idx = j
        t[i] = idx
        lasts[idx] = i
        for j in range(26):
            if j == idx:
                socres[j] = pls[j]
            else:
                socres[j] = mns[j]
    return socres, t

D = int(input())
c = list(map(int, input().split()))
s = [[0]*26 for _ in range(D+1)]
for i in range(1, D+1):
    s[i] = list(map(int, input().split()))

scores, t = greedy(c, s)

for v in t[1:]:
    print(v+1)

Measured memory_bytes: 68720
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n;cin>>n;
	int a[205];
	for(int i=0;i<n;cin>>a[i++]);
	int m=9e9;
	for(int i=0;i<n;i++)
	{
		int cnt=0;
		for(;a[i]%2==0;a[i]/=2,cnt++);
		m=min(m,cnt);
	}
	cout<<m<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.nextLine();
		BigDecimal[] array = new BigDecimal[n];
		for (int i = 0; i < n; i++) {
			array[i] = new BigDecimal(sc.nextLine());
		}
		sc.close();
		Arrays.sort(array);
		BigDecimal b = array[n - 1];
		BigDecimal comparer = new BigDecimal(0);
		BigDecimal[] divideArray = new BigDecimal[2];
		BigDecimal nT = new BigDecimal(0);
		for (int i = n - 2; i >= 0; i--) {
			divideArray = b.divideAndRemainder(array[i]);
			nT = array[i];
			while (divideArray[1].compareTo(comparer) != 0) {
				BigDecimal mT = nT;
				nT = divideArray[1];
				divideArray = mT.divideAndRemainder(nT);
			}
			if (nT.compareTo(comparer) != 0) {
				b = b.multiply(array[i]).divide(nT);
			}
		}
		System.out.println(b.toString());
	}
}

Measured memory_bytes: 25660
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);  cin.tie(0) ; cout.tie(0);
#define debug(x) cout << #x << " : " << x << endl;
#define pi 3.14159265359
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using ll = long long int;
using db = double;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<bool> vb;
const int MOD = 1e9+9;

void solve()
{
    ll n ,sum = 0;
    cin >> n;
    vl a(n);
    for( auto &i : a) cin >> i;
    sort(a.rbegin() , a.rend());
    sum += a[0];
    int counter = 1;
    for(int i = 2 ; i < n ; i++)
    {
        // cout << a[i] << "  " << a[counter] << endl;
        sum += a[counter];
        if(i%2 == 1) counter++;
    }
    cout<< sum << endl;
}

int main()
{
    fastio;

    ll t = 1;
    // cin >> t;
    while(t--)
       solve();
    return 0;
}

Measured memory_bytes: 4724
#include<stdio.h>

int main(void){
	int x,a,b;
		
	scanf("%d",&x);
	scanf("%d",&a);
	scanf("%d",&b);
	
	if(b-a>0 && x>=b-a){
		printf("safe\n");
	}else if(b <= a){
		printf("delicious\n");
	}else if(x+1<=b-a){
		printf("dangerous\n");
	}
}	

Measured memory_bytes: 128
#-*- coding: utf-8 -*-

A,B=input().split() 
cnt_print=0;
for i in range(int(A),int(B)+1):
  if (str(i)[0:2] == str(i)[4:5]+str(i)[3:4]):
    cnt_print=cnt_print+1
    
print (cnt_print)  


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 x;
  cin >> x;

  i64 ans = (x/11)*2;
  x %= 11;
  if(0<x) ans++;
  if(6<x) ans++;
  
  cout << ans << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

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

using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    a--;b--;
    cout<<"100 100\n";
    for(int i=0;i<50;i++){
        for(int j=0;j<100;j++){
            if(a!=0&&i%2==1&&j%2==1){
                cout<<'.';
                a--;
            }
            else{

             cout<<'#';
            }
        }
        cout<<'\n';
    }
    for(int i=0;i<50;i++){
        for(int j=0;j<100;j++){
            if(b!=0&&i%2==1&&j%2==1){
                cout<<'#';
                b--;
            }
            else {cout<<'.';
            }
        }
        cout<<'\n';
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std ;
int main () {
	int n,i; 
	cin >> n ;
	int sum=0,maxL=0;

	for(i=0;i<n;i++) {
		int L;
		cin >> L;
		sum += L;
		maxL = max(maxL,L);
	}

	if (maxL < sum-maxL){
		cout << "Yes" << endl ;
	}
	else {
		cout << "No" << endl ;
	}
	return 0;
}

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

public class Main{
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int N = scan.nextInt();
			int X = scan.nextInt();
			int[]x = new int [N+1];
			for(int i = 0;i<N;i++)x[i] = scan.nextInt();
			x[N] = X;
			Arrays.sort(x);
			
			int g = x[1]-x[0];
			for(int i = 2;i<N+1;i++) {
				g = gcd(x[i]-x[i-1],g);
			}
			
			System.out.println(g);
			
			/*
			int xmin = x[0];
			int xmax = x[N-1];
			
			if(X<xmin) {
				int g = x[0]-X;
				for(int i = 1;i<N;i++) {
					g = gcd(x[i]-x[i-1],g);
				}
			}else if(X>xmax) {
				int g = X-x[N-1];
				for(int i = N-1;i>0;i--) {
					g = gcd(x[i]-x[i-1],g);
				}
			}else {
				
			}
			*/
			
		}
		
		
	}
	
	private static int gcd(int A,int B){//最大公約数
		return B==0?A:gcd (B,A%B);
	}
		

}


Measured memory_bytes: 48488
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    int n;
    cin>>n;
    map<ll, int>  back;
    ll ans = 0;
    for(int i = 0; i < n; i++){
        ll num;
        cin>>num;
        ans += back[i+1-num];
        back[i+1+num]++;
    }
    cout<<ans;
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

Measured memory_bytes: 26308
n = int(input())
x, y = [list(map(int, input().split())) for _ in range(2)]
 
print(sum([abs(x[i] - y[i]) for i in range(n)]))
print(pow(sum([(x[i] - y[i]) ** 2 for i in range(n)]), 1/2))
print(pow(sum([abs(x[i] - y[i]) ** 3 for i in range(n)]), 1/3))
print(max([abs(x[i] - y[i]) for i in range(n)]))


Measured memory_bytes: 5648
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n,m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

for i in range(1000):
    flag = True
    for s in sc:
        num = str(i)
        if len(num) >= s[0] and str(s[1]) == num[s[0] - 1]:
            continue
        else:
            flag = False
            break
    if flag and len(str(i)) == n:
        print(i)
        exit()

print(-1)


Measured memory_bytes: 9192
;; D - Lunlun Number

(defparameter *max-n-digits* 10) ; 最大桁数 (入力例4を参照)

(defun next-lunlun (lun &optional (i 0))
  "i桁目以降を次のルンルン数に更新. lunは最下位桁から順に格納."
  (cond ((null (aref lun i))
          (setf (aref lun i) 1))
        ((or (>= (aref lun i) 9) ; i桁目が9
             (and (aref lun (1+ i)) ; i桁目がi+1桁目より大きい
                  (> (aref lun i) (aref lun (1+ i)))))
          (next-lunlun lun (1+ i))
          (setf (aref lun i) (max 0 (1- (aref lun (1+ i))))))
        (t ; 桁上がりなし
          (incf (aref lun i)))))

(defun lunlun-to-int (lun)
  "配列lun (先頭が最下位桁) を整数に変換"
  (loop for x across lun
        for i from 0
        for acc = x then (if x (+ acc (* (expt 10 i) x)) acc)
        finally (return acc)))

(defun lunlun (k)
  "k番目のルンルン数"
  (let ((lun (make-array (1+ *max-n-digits*) :initial-element nil)))
    ; lunは最下位桁から順に格納.
    (setf (aref lun 0) 0) ; 最下位桁を0に初期化
    (loop repeat k do (next-lunlun lun)
          finally (return (lunlun-to-int lun)))))

(let ((k (read)))
  (princ (lunlun k)))


Measured memory_bytes: 7648
#include <bits/stdc++.h>
using namespace std;
int main() {
    // 入力受け取り, 入次数も管理する
int n;
    cin >> n;

set<string> data;
for(int i=0;i<n;i++){
string te;
cin >> te;
data.insert(te);
}
if(data.size()==3)
cout << "Three";
else
cout << "Four";


}




Measured memory_bytes: 256
n = int(input())
a = [int(_) for _ in input().split()]
numCnt = [0] * 100001
for i in a:
    numCnt[i] += 1
ans = 0
for i in range(1, 100000):
    ans = max(ans, numCnt[i-1] + numCnt[i] + numCnt[i+1])

print(ans)

Measured memory_bytes: 13964
N = int(input())
D = [[-1]*N for i in range(N)]
for i in range(N):
    A = int(input())
    for j in range(A):
        x,y = map(int,input().split())
        D[i][x-1] = y
ans = 0
for i in range(2**N):
    T = []
    n = i
    for j in range(N):
        T.append(n%2)
        n//=2
    res = 1
    for j in range(N):
        if T[j]==1:
            for k in range(N):
                if D[j][k]!=-1 and D[j][k]!=T[k]:res=0
    if res:ans = max(ans,T.count(1))
print(ans)

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

int main(){
  int n,k,a[200010]={},b[200010]={};
  cin>>n>>k;
  for(int i=0;i<n;++i)cin>>a[i];

  sort(a,a+n);

  int j=0;
  for(int i=0;i<n;++i){
    if(a[i]==a[i+1])b[j]++;
    else{
      b[j]++;
      j++;
    }
  }

  sort(b,b+j);
  reverse(b,b+j);

  int ans=0;
  while(j>k){
    ans+=b[--j];
  }
  cout << ans << endl;

  return 0;
}
//xueleiさん

Measured memory_bytes: 5104
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int N=100005;
#define ll long long
ll a[N],f[N],d[N];int top=0;
inline void work(ll x,ll y){
	if (!x) return;
	int t=upper_bound(a+1,a+top+1,x)-a-1;
    if(!t) d[1]+=y,d[x+1]-=y;
    else f[t]+=x/a[t]*y,work(x%a[t],y);
}
int main (){
	int n,m;scanf ("%d%d",&n,&m);
	a[++top]=n;
	for (int i=1;i<=m;i++){
		ll x;scanf ("%lld",&x);
		while (x<=a[top]) --top;
		a[++top]=x;
	}
	f[top]=1;
	for (int i=top;i>=2;i--) f[i-1]+=a[i]/a[i-1]*f[i],work(a[i]%a[i-1],f[i]);
	d[1]+=f[1],d[a[1]+1]-=f[1];
	for (int i=1;i<=n;i++) d[i]+=d[i-1],printf ("%lld\n",d[i]);
	return 0;
}


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

int main(){
    int n, i, h, hm = 0, c = 0;
    cin >> n;
    for(i=0; i<n; i++){
        cin >> h;
        if(h >= hm){
            c++;
            hm = h;
        }
    }
    cout << c;
    return 0;
}

Measured memory_bytes: 256