akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int w,h,n;
    cin >> w >> h >> n;
    int x1,y1,x2,y2;
    x1 = y1 = 0;
    x2 = w;
    y2 = h;

    for (int i=0; i<n; i++) {
        int x,y,a;
        cin >> x >> y >> a;
        switch(a){
            case 1:
                x1 = max(x1, x);
                break;
            case 2:
                x2 = min(x2, x);
                break;
            case 3:
                y1 = max(y1, y);
                break;
            case 4:
                y2 = min(y2, y);
                break;
        }
    }

    cout << max(0,x2-x1)*max(0,y2-y1) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/

int main() {
	ll X, Y, Z; cin >> X >> Y >> Z;
	for (int i = 0;;i++) {
		if (Y * i + Z*i+Z > X) {
			cout << i-1 << endl;
			break;
		}
	}
}

Measured memory_bytes: 256
package main
 
import (
  "fmt"
)
 
func main() {
 
  var n int
  fmt.Scanln(&n)
  p := scanNums(n)
  
  var targets [] int
  for i:=0; i<n; i++ {
    if p[i] != i+1 {
      targets = append(targets, i)
    }
  }

  if len(targets) == 0 {
    fmt.Print("YES")
  } else if len(targets) == 2 && p[targets[0]] == targets[1]+1 && p[targets[1]] == targets[0]+1 {
    fmt.Print("YES")
  } else {
    fmt.Print("NO")
  }
  
}
 
func scanNums(len int) (nums []int) {
    var num int
    for i := 0; i < len; i++ {
        fmt.Scan(&num)
        nums = append(nums, num)
    }
    return
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    ll ans=-(1<<30);
    cin >> n;
    ll p[n][11];
    bool f[n][10];
    for(int i = 0;i < 10*n;i ++){
        cin >> f[i/10][i%10];
    }
    for(int i = 0;i < 11*n;i ++){
        cin >> p[i/11][i%11];
    }
    for(int b = 1;b < (1<<10);b ++){
        ll a = 0;
        for(int i = 0;i < n;i ++){
            int cnt = 0;
            for(int j = 0;j < 10;j ++){
                if((b>>j&1)&&f[i][j]) cnt++;
            }
            a += p[i][cnt];
        }
        if(a>ans) ans = a;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoder.Tool;
namespace AtCoder
{
    class AC
    {
        const int MOD = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;
        const double EPS = 1e-8;
        static readonly int[] dx = { 0, 1, 0, -1 };
        static readonly int[] dy = { 1, 0, -1, 0 };

        
        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            int N = int.Parse(Console.ReadLine());
            var A = cin.SplitReadL();

            long ans = 0;
            var d = new long[N + 1];
            d[0] = 0;
            for (var i = 0; i < N; i++) d[i + 1] = d[i] + A[i];

            long cur = 0;
            int l = 0;
            for(var r = 0; r < N; r++)
            {
                cur ^= A[r];
                if (cur == d[r + 1] - d[l])
                {
                    ans += r - l + 1;
                }
                else
                {
                    while (cur != d[r + 1] - d[l])
                    {
                        cur ^= A[l];
                        l++;
                    }
                    ans += r - l + 1;
                }
            }


            Console.WriteLine(ans);
            
            //Console.Out.Flush();
        }

    }

   

    

    

    public class Scanner
    {
        public int[] SplitRead()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReadL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for (var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
    }
}


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

int main(void)
{
	int r, g, b;
	cin >> r;
	cin >> g;
	cin >> b;


	int num = r*100 + g*10 + b;
	if (num%4 == 0)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define PB push_back
#define SP << " " <<

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VLL;

__attribute__((constructor))
void initial(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed <<setprecision(15);
}


int main(void){
	
    int H, A;
    cin >> H >> A;

    int ans = H/A;
    if(H%A>0){
        ans ++;
    }
       
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,j,minj,n,A[100],t,cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  for(i=0;i<n;i++){
    minj=i;
    for(j=i;j<n;j++)
      if(A[j]<A[minj])
	minj=j;
    if(minj!=i)cnt++;
    t=A[i];
    A[i]=A[minj];
    A[minj]=t;
  }
  for(i=0;i<n-1;i++)printf("%d ",A[i]);
  printf("%d\n%d\n",A[i],cnt);
  return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int n, l;
    string s[100];

    cin >> n >> l;
    for(int i=0; i<n; i++) cin >> s[i];

    sort(s, s+n);

    for(int i=0; i<n; i++) cout << s[i];
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <climits>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n)-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);

//const ll INFL = LLONG_MAX;//10^18 = 2^60
const ll INFL = 1LL<<60;
//const int INF = INT_MAX;
const ll INF = 1 << 30;//10^9
ll MOD = 1000000007;
//ll MOD = 998244353;

vector<ll> dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, 0, -1, 0, 1, -1, 1, -1, 0};

void pres(double A, ll x = 10){cout << fixed << setprecision(x) << A << endl;}
void BinarySay(ll x, ll y = 60){rep(i, y) cout << (x>>(y-1-i) & 1); cout << endl;}
ll cnt_bit(ll x){return __builtin_popcountll(x);}

ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x; k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}

ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y){
  ll res = x / gcd(x, y);
  res *= y;
  return res;
};

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
ll comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

const int MAXkai = 200010;
ll kai_memo[MAXkai];
ll kai(ll N){
  if(kai_memo[N] != 0) return kai_memo[N];
  if(N <= 1) return 1;
  return kai_memo[N] = N * kai(N-1) % MOD;
}

ll dp[62][3];
void solve(){
  ll N;
  cin >> N;
  dp[0][0] = 1;
  rep(i, 61)rep(j, 3)rep(k, 3){
    if(j == 2){
      dp[i+1][j] += dp[i][j];
      dp[i+1][j] %= MOD;
      continue;
    }
    ll n = (N>>(60-i)) & 1;
    ll nj = j * 2 + n - k;
    if(nj >= 2) nj = 2;
    if(nj < 0) continue;
    dp[i+1][nj] += dp[i][j];
    dp[i+1][nj] %= MOD;
  }
  cout << (dp[61][0] + dp[61][1] + dp[61][2]) % MOD << endl;
}


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


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
    char s[1000];
    int n, i;
    
    scanf("%s",s);
    n=strlen(s);
    
    int a=0;
    int b=0;
    for(i=0;i<n;i++){
        if(((i+1)%2)!=0){
            if((s[i]!='R')&&(s[i]!='U')&&(s[i]!='D')){
                a=1;
                break;
            }
        }
        else{
            if((s[i]!='L')&&(s[i]!='U')&&(s[i]!='D')){
                b=1;
                break;
            }
        }
    }
    if((a==0)&&(b==0)) printf("Yes\n");
    else printf("No\n");
    return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    int2(a, b);

    cout << (max(a, b) + (max(max(a, b)-1, min(a, b)))) << endl;

    return 0;
}


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

using namespace std;

int n;
long long mx = 3234566667;
set<long long> seen;

void get_nums(long long num) {
	if (seen.find(num) != seen.end() || num > mx)
		return;
	seen.insert(num);
	if (num == 0)
		for (int i=1; i<10; ++i)
			get_nums(i);
	else {
		int lst = num%10;
		if (lst>0)
			get_nums(num*10+lst-1);
		get_nums(num*10+lst);
		if (lst < 9)
			get_nums(num*10+lst+1);
	}
}
	

int main() {
	cin >> n;
	get_nums(0);
	while (n--)
		seen.erase(seen.begin());
	cout << *seen.begin() << '\n';	
	return 0;
}


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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;

vector<ll> check(ll a) {
    vector<ll> ans(60);
    for (int i = 0; i < 60; i++) {
        ll cycle = 1ll << (i + 1);
        ll cycle_count = (a + 1) / cycle;
        ll under = cycle_count * cycle;

        ll cycle_one_count = cycle_count * (cycle / 2);
        ll over = (a + 1) - under;
        ll last_one_count = max(over - (cycle / 2), 0ll);
        ll now = cycle_one_count + last_one_count;
        ans[i] = now;
    }
    return ans;
}

int main() {

    ll a, b;
    cin >> a >> b;

    vector<ll> ac = check(max(a - 1, 0ll));
    vector<ll> bc = check(b);

    vector<ll> bits(60);
    rep(i, 60) bits[i] = bc[i] - ac[i];

    ll ans = 0;
    rep(i, 60) {
        ll now = bits[i] % 2;
        ll d = now << i;
        ans += d;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
 
using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
  
void solve() {
	int n;
	cin >> n;
	
	vi l(n), r(n), k(n);
	for(int i = 0; i < n; i++) {
		cin >> k[i] >> l[i] >> r[i];
		k[i]--;
	}
	
	vector<vi> g(n), g1(n);
	for(int i = 0; i < n; i++) {
		g[k[i]].pub(i);
		if(k[i] + 1 < n) g1[k[i] + 1].pub(i);
	}
	
	priority_queue<ii> q;
	vi vis(n, 0);
	for(int i = n - 1; i >= 0; i--) {
		for(int j : g[i]) q.push({l[j] - r[j], j});
		if(!q.empty()) {
			ii p = q.top();
			if(p.ff > 0) {
				vis[p.ss] = 1;
				q.pop();
			}
		}
	}
	
	while(!q.empty()) q.pop();	
	for(int i = 0; i < n; i++) {
		for(int j : g1[i]) q.push({r[j] - l[j], j});
		if(!q.empty()) {
			ii p = q.top();
			if(p.ff > 0) {
				vis[p.ss] = 1;
				q.pop();
			}
		}
	}
	
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		if(vis[i]) ans += max(l[i], r[i]);
		else ans += min(l[i], r[i]);
	}
	
	cout << ans << endl;
}
 
int main(){
#define MULTITEST 1
#if MULTITEST   
 
    CASET {
        solve();
    }
    
#else
 
    solve();
    
#endif
 
    return 0;
}

Measured memory_bytes: 23992
// C - Sum of product of pairs
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

int main(){
	int MOD = 1e9 + 7;
	int N; cin>>N;
	vector<int> A(N);
	ll s = 0;
	for(int i=0; i<N; ++i){
		cin>>A[i];
		s += A[i];
		s %= MOD;
	}
	s *= s;
	for(int a:A){
		s -= (ll)a * a % MOD;
		s %= MOD;
		s += MOD;
	}
	s *= (MOD + 1) / 2;
	cout<< s % MOD <<endl;
}


Measured memory_bytes: 4048
#include<iostream>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>//min,max,swap,rand,reverse,sort,lower_bound
#include<functional>
#include<vector>
#include<list>
#include<map>
#include<tuple>
#include<cmath>//abs, sin, cos
#include<bitset>
using namespace std;

int main()
{
	double W, H, x, y,ans;
	double S_x1, S_x2, S_y1, S_y2, S_x, S_y;
	cin >> W >> H >> x >> y;
	cout << double(W)*double(H) / 2 << endl;
	if (x + x == W && y + y == H)
		cout << '1';
	else
		cout << '0';
	return 0;
}

Measured memory_bytes: 3232
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  string s;
  cin >> s;
  ll res = 0;
  for(int i = 0;i < (int)s.size();i++)if(s[i] == '+')res++;
  res = res + -1 * (s.size() - res);
  cout << res << endl;
}

Measured memory_bytes: 3600
l, r = map(int, input().split())
step = r - l
mod = 2019
if step >= mod:
    print(0)
else:
    min_value = 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            value = i * j % mod
            if value < min_value:
                min_value = value
    print(min_value)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdint>
#include<algorithm>

int64_t dist(int64_t x, int64_t y) { return std::max(x-y, y-x); }
int64_t calc(int64_t a1, int64_t a2, int64_t b1, int64_t b2, int lv, int64_t L) {
  if(lv == 0) return 0;
  int64_t Lb = L/3;
  int64_t bi_a1 = a1/Lb;
  int64_t bi_a2 = a2/Lb;
  int64_t bi_b1 = b1/Lb;
  int64_t bi_b2 = b2/Lb;
  if(bi_a1 == bi_b1 && bi_a2 == bi_b2) {
    return calc(a1%Lb, a2%Lb, b1%Lb, b2%Lb, lv-1, Lb); // same block
  }
  if(bi_a2 == bi_b2) { std::swap(a1, a2); std::swap(b1, b2); }
  // bi_a2 != bi_b2
  int64_t res = dist(a2, b2);
  while(Lb > 0) {
    bi_a1 = a1/Lb;
    bi_b1 = b1/Lb;
    if(bi_a1 != bi_b1) return res + dist(a1,b1);
    if(bi_a1 == 1) {
      bi_a2 = a2/Lb;
      bi_b2 = b2/Lb;
      if(dist(bi_a2, bi_b2) > 1) { // 
        int64_t r1 = dist(a1, Lb-1)+dist(Lb-1, b1);
        int64_t r2 = dist(a1, Lb*2)+dist(Lb*2, b1);
        return res + std::min(r1, r2); 
      }
    }
    a1 %= Lb;
    b1 %= Lb;
    Lb /= 3;
  }
  return res;
}

int main() {
  int64_t L = 1;
  for(int i = 0; i < 30; ++i) L *= 3;
  int Q; std::cin >> Q;
  for(int i = 0; i < Q; ++i) {
    int64_t a, b, c, d; std::cin >> a >> b >> c >> d;
    std::cout << calc(a-1, b-1, c-1, d-1, 30, L) << std::endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(){
	int H,N;
	int A;
	int total;

	scanf("%d %d",&H,&N);
	
	for (int i = 0; i < N; i++) {
		scanf("%d", &A);
		total = total + A;
	}
	
	if(H - total <=0){
		printf("Yes");
	}
	else printf("No");

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
  int N;
  int x,y,b,p;
  cin >> N;
  for(int i=0;i<N;i++){
    int ans;
    cin >> x >> y >> b >> p;
    ans = x*b+y*p;
    if(b>=5&&p>=2) ans *= 0.8;
    else{
      if(b<5) b = 5;
      if(p<2) p = 2;
      if(ans>(x*b+y*p)*0.8) ans = (x*b+y*p)*0.8;
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main(){
    vector<vector<int> > c(4, vector<int>(4));
    for(int i = 1; i < 4; i++){
        for(int j = 1; j < 4; j++){
            cin >> c[i][j];
        }
    }
    if(c[1][2] - c[1][1] == c[2][2] - c[2][1] && c[2][2] - c[2][1] == c[3][2] - c[3][1]){
        if(c[1][3] - c[1][2] == c[2][3] - c[2][2] && c[2][3] - c[2][2] == c[3][3] - c[3][2]){
            if(c[2][1] - c[1][1] == c[2][2] - c[1][2] && c[2][2] - c[1][2] == c[2][3] - c[1][3]){
                if(c[3][1] - c[2][1] == c[3][2] - c[2][2] && c[3][2] - c[2][2] == c[3][3] - c[2][3]){
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
 
using namespace std;
 
int main( void )
{
  /* ボール数入力 */
  int n;
  cin >> n;
  
  /* ボールの番号と番号の数を入力 */
  vector<int> a(n), c(n);
  long ans = 0;
  for ( auto &i : a ) {
    cin >> i;
    ans += c[i]++;
  }

  for ( const auto &i : a ) {
    cout << (ans - (c[i] - 1)) << endl;  
  }
  
  return 0;
}

Measured memory_bytes: 4096
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        System.out.println(str);
    }

    public static void main(String[] args) {

        long A;
        long B;

        try (Scanner sc = new Scanner(System.in)) {
            A = sc.nextLong();
            B = sc.nextLong();
        }
        for(int i = 0;i < 1010;i++){
            if(Math.floor((double)i * (double)0.08 )== A && Math.floor((double)i * (double)0.1 )==B){
                System.out.println(i);
                return;
            }
        }
        System.out.println(-1);
        return;
    }
}


Measured memory_bytes: 23892
def F(a, d):
	s = set([0])
	for i in a:
		t = set([])
		for j in s:
			t.add(j - i)
			t.add(j + i)
		s = t
	return d in s
s = raw_input()
a = map(len, s.split('T'))
x, y = map(int, raw_input().split())
print ['No', 'Yes'][F(a[2::2], x - a[0]) and F(a[1::2], y)]

Measured memory_bytes: 3256
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,T=MI()
    t=LI()
    t.append(t[-1]+T+5)
    ans=0
    for i in range(N):
        if t[i+1]-t[i]<=T:
            ans+=t[i+1]-t[i]
        else:
            ans+=T
    print(ans)

main()


Measured memory_bytes: 77520
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

h,w = li()
n = ni()
a = list(li())

grid = [[0]*w for _ in range(h)]
cnt = 0
for i, ai in enumerate(a):
    for _ in range(ai):
        grid[cnt//w][cnt%w] = i+1
        cnt += 1

for i, row in enumerate(grid):
    if i%2:
        print(*row[::-1])
    else:
        print(*row)

Measured memory_bytes: 3912
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)(b); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    cout << (n + 1) / 2 << endl;
    return 0;
}


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

int main() {
    vector<int> a(3); REP(i, 3) cin >> a[i];
    sort(a.begin(), a.end());

    if (a[1] % 2 == a[0] % 2)
        cout << (a[1] - a[0]) / 2 - a[1] + a[2] << endl;
    else
        cout << (a[1] - a[0] + 1) / 2 - a[1] + a[2] + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
const int N = 11, M = 1005, INF = 1e9 + 1000;
bool a[N][M];
int H, W, k, ans = INF;
int main(){
	cin >> H >> W >> k;
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			char c;
			cin >> c;
			a[i][j] = c - '0';
		}
	}
	for(int h = 0; h < (1 << H - 1); h++){
		vector < int > sum(H, 0);
		int cur_ans = 0;
		for(int w = 0; w < W; w++){
			vector < int > arr(H, 0);
			int cur = 0; 
			for(int j = 0; j < H; j++){
				arr[cur] += a[j][w];
				cur += h >> j & 1;
			}
			bool ok = false;
			for(int i = 0; i <= cur; i++){
				if(arr[i] + sum[i] > k){
					if(arr[i] > k)cur_ans = INF;
					cur_ans++;
					for(int j = 0; j <= cur; j++)sum[j] = arr[j];
					ok = true;
					break;
				}
			}
			if(ok == false){
				for(int i = 0; i <= cur; i++)sum[i] += arr[i];
			}
			if(cur_ans >= INF)break;
		}
		ans = min(ans, cur_ans + __builtin_popcount(h));
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	string n="",m="";
	for(int i=0;i<b;i++) n+=(char)(a+'0');
	for(int i=0;i<a;i++) m+=(char)(b+'0');
	if(m>n) cout<<n;
	else cout<<m;
	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d %d', $n, $x);
$l = array_map('intval', explode(' ', trim(fgets(STDIN))));

$d = 0;
$cnt = 1;
for ($i = 0; $i < $n; $i++) {
  $d += $l[$i];
  if ($d > $x) break;
  $cnt++;
}
echo $cnt.PHP_EOL;

Measured memory_bytes: 4604
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for (int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
    }

    int min = arr[0];
    int max = Integer.MIN_VALUE;
    for (int i = 1; i < n; i++) {
      max = Math.max(max, arr[i] - min);
      min = Math.min(min, arr[i]);
    }
    System.out.println(max);
  }
}



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

int main(){
  int n, a, tmp, cnt, mincnt;
  int i, j;
  
  cin >> n;
  
  for(i = 0; i < n; i++){
    cin >> a;
    tmp = a;
    cnt = 0;
    
    for(j = 0; tmp > 1; j++){
      if((tmp % 2) == 0){
        cnt++;
      }else{
        break;
      }
      tmp /= 2;
    }
    
    if(i == 0) mincnt = cnt;
    if(cnt < mincnt) mincnt = cnt;
  }
  
  cout << mincnt << endl;
}

Measured memory_bytes: 3572
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n, m;
  bool is_opened = false;
  string u, t;
  set<string> ids;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> u;
    ids.insert(u);
  }
  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> t;
    if (ids.count(t) > 0) {
      if (is_opened) {
        cout << "Closed by " << t << endl;
      } else {
        cout << "Opened by " << t << endl;
      }
      is_opened = not is_opened;
    } else {
      cout << "Unknown " << t << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1232
n = gets.to_i
pi = gets.split(" ").map(&:to_i)

cnt = 0

(n-2).times do |i|
  cnt += 1 if (((pi[i] < pi[i+1]) and (pi[i+1] < pi[i+2])) or ((pi[i] > pi[i+1]) and (pi[i+1] > pi[i+2])))
end

p cnt

Measured memory_bytes: 1788
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline

class Solver(object):
    def __init__(self):
        pass

    def solve(self,s:str,t:str) -> int:
        ## DP loop
        dp = [[0]*(len(t)+1) for _ in range(len(s)+1)]
        for i in range(len(s)):
            for j in range(len(t)):
                if s[i] == t[j]:
                    dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]+1)
                dp[i+1][j+1] = max(dp[i+1][j+1],dp[i+1][j],dp[i][j+1])
        
        ans = ""

        ## Recover the LCS from DP table
        ## checking the update point
        l,m = len(s),len(t)
        while l > 0 and m >0:
            if dp[l][m] == dp[l-1][m]:
                l -= 1
            elif dp[l][m] == dp[l][m-1]:
                m -= 1
            else:
                ans = t[m-1] + ans
                l -= 1
                m -= 1

        return ans

def main():
    s = input().rstrip()
    t = input().rstrip()
    solver = Solver()
    print(solver.solve(s,t))

if __name__ == "__main__":
    main()

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

int main(){

	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif

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

	int n; cin >> n;

	for(int i=1;i<=n;i++){
		int ans = 0;
		int r = (int) sqrt(i);
		for(int x=1;x<r;x++){
			for(int y=x+1;y<r;y++){
				for(int z=y+1;z<r;z++){
					if(x*x+y*y+z*z+x*y+x*z+z*y == i){
						ans += 6;
					}
				}
			}
		}
		for(int x=1;x<r;x++){
			for(int y=x+1;y<r;y++){
					if(x*x+y*y+x*x+x*y+x*x+x*y == i){
						ans += 3;
				}
			}
		}
				for(int x=1;x<r;x++){
			for(int y=x+1;y<r;y++){
					if(x*x+y*y+y*y+x*y+y*y+x*y == i){
						ans += 3;
				}
			}
		}
		for(int x=1;x<r;x++){
				if(6*x*x == i){
						ans += 1;
				}
			
		}
		cout << ans << endl;
	}


	return 0;
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll m=n;
	ll cnt=0;
	while(m/10!=0){
		cnt++;
		m=m/10;
	}
	ll N=m;
	for(int i=0;i<cnt;i++){
		N*=10;
		N+=9;
	}
	ll ans=0;
	if(N!=n){
		ans--;
	}
	while(N!=0){
		ans+=N%10;
		N/=10;
	}
	cout <<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string N;
  cin >> N;
  int ans = 700;
  for(int i = 0; i<N.size(); i++){
    if(N.at(i) =='o'){
      ans += 100;
    }
  }
  cout << ans<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int a,b,c=0;
  cin>>a;
  b=a;
  while(true){
    if(b==0) break;
    c=c+b%10;
    b/=10;
  }
  if(a%c==0) cout<<"Yes";
  else cout<<"No";
  cout<<"\n";
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	int N; cin>>N;
	int midIx = N/2;//中央値: ((N-1) + 1)/2 番目
	vector<pair<int,int>> X(N+1);//<value,index>
	rp(i,1,N+1){
		int x; cin>>x;
		X[i] = make_pair(x,i);
	}
	sort(all(X));

	// for(auto x:X){printf("%d %d\n",x.first, x.second);}//

	vi ans(N+1);
	rp(i,1,N+1){
		int xi,j; tie(xi,j)=X[i];
		// printf("%d %d %d %d\n",i,j,X[midIx].first,X[midIx+1].first);//
		if(i<=midIx){
			ans[j] = X[midIx+1].first;
		}
		else{
			ans[j] = X[midIx].first;
		}
	}

	rp(i,1,N+1){
		ote(ans[i]);
	}

}


Measured memory_bytes: 4480
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define EPS 1e-10
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}
ll dx[]={0, 0, -1, 1};
ll dy[]={1, -1, 0, 0};// up,down,left right

map<ll, bool> A;

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


    ll N ;
    cin >> N;

    
    rep(i, N){
        ll inp; cin >> inp;
        if(A[inp]){
            cout << "NO" << endl;
            return 0;
        }
        A[inp] = true;
        
    }
    cout << "YES" << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)          \
  sort(x.begin(), x.end()); \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << "(" << #x << ", " << #y << ") = " \
                          << "(" << x << ", " << y << ")" << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

// ----------------------------------------------

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

  string S;
  cin >> S;

  ll N = S.size();

  vector<long long> v(2019, 0);
  long long t = 1;
  long long c = 0;
  v[c]++;
  rep(i,N){
    c = (c + (S[N - i - 1] - '0') * t) % 2019;
    t = (t * 10) % 2019;
    v[c]++;
  }
  long long res = 0;
  rep(i, 2019) {
    res += v[i] * (v[i] - 1) / 2;
  }

  cout << res << endl;
}

Measured memory_bytes: 3728
N = list(input())
N = list(map(int, N))

if N[-1]==2\
or N[-1]==4\
or N[-1]==5\
or N[-1]==7\
or N[-1]==9:
    print('hon')
elif N[-1]==0\
or   N[-1]==1\
or   N[-1]==6\
or   N[-1]==8:
    print('pon')
elif N[-1]==3:
    print('bon')
else:
    print('???')


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A[3];
	rep(i, 0, 3)
	{
		cin >> A[i];
	}
	sort(A, A + 3);

	if (A[0] == A[1])cout << A[2] << endl;
	else cout << A[0] << endl;

	return 0;
}

Measured memory_bytes: 256
mod=10**9+7
s=input()
n=len(s)
Sum_A=[0]*(n+1)
Sum_B=[0]*(n+1)
Sum_C=[0]*(n+1)
Sum_q=[0]*(n+1)
for i in range(1, n+1):
    Sum_A[i]=Sum_A[i-1]
    Sum_C[i]=Sum_C[i-1]
    Sum_q[i]=Sum_q[i-1]
    if s[i-1]=='A':
        Sum_A[i]+=1
    elif s[i-1]=='C':
        Sum_C[i]+=1
    elif s[i-1]=='?':
        Sum_q[i]+=1
ans=0
def count(x, q):
    return int(x*pow(3, q, mod)+q*pow(3, (q-1), mod)) if q>0 else int(x*pow(3, q, mod))
for i in range(n):
    if s[i]=='B' or s[i]=='?':
        ans+=count(Sum_A[i], Sum_q[i])*count(Sum_C[n]-Sum_C[i+1], Sum_q[n]-Sum_q[i+1])
        ans%=mod
print(ans)


Measured memory_bytes: 9460
#include<bits/stdc++.h>
using namespace std;
int main()
{ int a1,a2,a3;
 cin>>a1>>a2>>a3;
 int s=a1+a2+a3;
 if(s>=22)
 {
   cout<<"bust"<<endl;
 }
 else
 {
   cout<<"win"<<endl;
 }
  return 0;
}

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

using namespace std;

int main() {
  int N; cin >> N;
  int max_p = 0;
  long long sum_p = 0;
  for(int i = 0; i < N; i++) {
    int pi; cin >> pi;
    if(pi > max_p) {
      sum_p += max_p;
      max_p = pi;
    } else {
      sum_p += pi;
    }
  }
  sum_p += max_p / 2;
  cout << sum_p << endl;
}


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

using namespace std;
typedef long long ll;

const int mod = 1e9+7; 

int main(){
	ios::sync_with_stdio(false);
	int m,n,ans= 0,curh,k,pos;
	cin >> n;
	vector<vector<int> > points(n, vector<int>(3));
	for(int i = 0; i < n; ++i){
		cin >> points[i][0];
		cin >> points[i][1];
		cin >> points[i][2];
		if(points[i][2] != 0)pos = i;
	}
	
	for(int i = 0; i <= 100; ++i){
		for(int j = 0; j <= 100; ++j){
			curh = abs(points[pos][0]-i) + abs(points[pos][1]-j) + points[pos][2];
			 
			for(k = 0; k < n; ++k){
				if(points[k][2] == 0){
					if(curh-points[k][2] > abs(points[k][0]-i) + abs(points[k][1]-j))break;
				}else if(curh-points[k][2] != abs(points[k][0]-i) + abs(points[k][1]-j))break;
			}
			if(k == n){
				cout << i << " " << j << " " << curh;
				return 0;
			}
		}
	}
	return 0;
} 

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

int main() {
    int n;
    cin>>n;
    vector<int> a(n+1);
    rep(i,n) cin>>a[i+1];
    vector<int> b(n+1);
    for(int i=n; i>0;i--){
        int sum = 0;
        for(int j=i+i; j<=n;j+=i){
            sum ^= b[j];
        }
        b[i] = sum^a[i];
    }
    vector<int> ans;
    for (int i = 1; i <= n; i++) {
      if (b[i]) ans.push_back(i);
    }
    cout<<ans.size()<<endl;
    rep(i,ans.size()){
        cout<<ans[i]<<" "<< endl;
    }
    
  return 0;
}


Measured memory_bytes: 3192
N = int(input())
SP = [list(map(str,input().split())) + [i+1] for i in range(N)]

SP.sort(key = lambda x:x[0])
idx = 0
init = SP[idx][0]
while idx < N:
    D = []
    while idx  < N and SP[idx][0] == init:
        D += [SP[idx]]
        idx += 1
    D.sort(reverse = True,key = lambda x:int(x[1]))
    for i in range(len(D)):
        print(D[i][2])
    init = SP[min(idx,N-1)][0]
        

    
    

Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int64 n;
  cin >> n;
  int64 ret = (n + 10) / 11 * 2;
  if (n < 6) {
    ret = 1;
  } else {
    n -= 6;
    ret = min(ret, (n + 10) / 11 * 2 + 1);
  }
  cout << ret << endl;
  return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int T=1;
    //cin >> T;
    while(T--){
        ll n,w,wt,val;
        cin>>n>>w;
        ll dp[n+1][w+1];
        rep(i,n+1){
            rep(j,w+1) dp[i][j]=0;
        }
        rep_a(i,1,n+1){
            cin>>wt>>val;
            rep_a(j,1,w+1){
                if(wt>j) dp[i][j]=dp[i-1][j];
                else dp[i][j]=max(dp[i-1][j], val+dp[i-1][j-wt]);
            }
        }
        cout<<dp[n][w]<<el;
    }

    return 0;
}

Measured memory_bytes: 79232
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

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

    string S;
    cin >> S;
    int sum = 0;

    vector<int> a(N);

    for (int i = 0; i < N; i++)
    {
        if (S[i] == 'R')
            a[i] = 0;
        if (S[i] == 'G')
            a[i] = 1;
        if (S[i] == 'B')
            a[i] = 2;
    }

    vector<int> cnt(3);
    for (int i = 0; i < N; i++)
    {
        cnt[a[i]]++;
    }

    long long ans = 1;
    for (int i = 0; i < 3; i++)
    {
        ans *= cnt[i];
        // cout << cnt[i] << endl;
    }

    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            int k = j + (j - i);
            if (k < N)
            {
                if (a[i] == a[j])
                    continue;
                if (a[i] == a[k])
                    continue;
                if (a[k] == a[j])
                    continue;
                ans--;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
    using namespace std;
    array<long, 5> v{};
    for(auto &i : v)cin >> i;
    long a((*min_element(v.begin(), v.end(), [](auto a, auto b){return (a - 1) % 10 < (b - 1) % 10;}) - 1) % 10 - 9);
    for(auto &i : v)i = (i + 9) / 10 * 10;
    cout << a + accumulate(v.begin(), v.end(), 0L) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	static int map[][];
	static int n;
	static int i;
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int j,k,x,y;
		while(true){
			n=sc.nextInt();
			if(n==0) return;
			map=new int[n][n];
			for(j=0;j<n;j++){
				for(k=0;k<n;k++){
					map[j][k]=-1;
				}
			}
			x=y=n/2;
			y++;
			map[y][x]=1;
			magic(x+1,y+1,2);
			for(j=0;j<n;j++){
				for(k=0;k<n;k++){
					System.out.printf("%4d",map[j][k]);
				}
				System.out.println();
			}
		}
	}
	public static void magic(int x,int y,int i){
		if(i>n*n) return;
		
		if(n<=x){
			magic(0,y,i);
		}
		else if(x<0){
			magic(n-1,y,i);
		}
		else if(n<=y){
			magic(x,0,i);
		}
		else if(map[y][x]!=-1){
			magic(x-1,y+1,i);
		}
		else{
			map[y][x]=i;
			magic(x+1,y+1,i+1);
		}
	}
}

Measured memory_bytes: 12000
#include<stdio.h>

#define N 100000
#define Q 50000

int binarysearch(int,int[],int);/*search*/

int main()
{
  int n,s[N],q,t,i,cnt=0,m;
  
  scanf("%d",&n);
  for(i=0 ; i<n ; i++)
    scanf("%d",&s[i]);
  scanf("%d",&q);
  for(i=0 ; i<q ; i++){
    scanf("%d",&t);
    if(binarysearch(t,s,n))cnt++;
  }
  
  printf("%d\n",cnt);

  return 0;
}

int binarysearch(int x,int y[],int n)
{
  int left=0,right=n,mid;

  while(left<right)
    {
       mid=(left+right)/2;
       if(x == y[mid])
	 return 1;
       else if(y[mid]>x)
	 right=mid;
       else if(y[mid]<x)
	 left=mid+1;
  }
  return 0;
}



Measured memory_bytes: 2120
using System;
using System.Collections.Generic;
using System.Linq;
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = Long() + add;
        }
        return Array;
    }
}
class Program {
    static Scanner cin = new Scanner();
    static void Main() {
        int N = cin.Int();
        var a = cin.ArrayLong(N);
        Console.WriteLine(a.Sum() - N);
        Console.ReadLine();
    }
}

Measured memory_bytes: 11476
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main{
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			String S = scan.next();
			char[]s = new char[S.length()];
			s = S.toCharArray();
			
			Deque<Character> que = new ArrayDeque<Character>();
			//Deque<String> que = new ArrayDeque<String>();
			
			for(int i = 0;i<s.length;i++)que.addLast(s[i]);
			
			//System.out.println(que.getLast());
			
			
			while(true) {
			StringBuilder sb = new StringBuilder();
			
			for(int i = 0;i<5;i++)sb.append(que.removeLast());
			
			
			if(sb.toString().equals("maerd")||sb.toString().equals("esare")) {
				//sb.delete(0, 5);
			}else {
				sb.append(que.removeLast());
				if(sb.toString().equals("resare")) {
					//sb.delete(0, 6);
				}else{
					sb.append(que.removeLast());
					if(sb.toString().equals("remaerd")) {
						//sb.delete(0, 7);
					}else {
						System.out.println("NO");
						System.exit(0);
					}
				}
			}
			
			if(que.isEmpty())break;
			}
			
			System.out.println("YES");
			
			
			
			
			
			
			
			
		}
		
		
	}
		

}


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

int main(){
  string str;

  while(getline(cin,str), str!="."){
    stack<char> s;

    bool f = true;
    for(int i=0;f && (i<(int)str.size());i++){
      if(str[i] == '(' || str[i] == '[')s.push(str[i]);
      else if(str[i] == ')'){
	if(s.empty() || s.top() != '(')f = false;
	else s.pop();
      }else if(str[i] == ']'){
	if(s.empty() || s.top() != '[')f = false;
	else s.pop();
      }
    }
    
    if(f && s.empty())cout << "yes" << endl;
    else cout << "no" << endl;
  }
}

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

#define F first 
#define S second

using namespace std;

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

const int N = 100010, M = 2 * N;

int n;
int h[N], e[M], w[M], ne[M], idx;
int color[N];

void add(int a, int b, int c)
{
	e[idx] = b, w[idx] = c, ne[idx] = h[a], h[a] = idx ++ ;
}

void dfs(int u, int fa, int c)
{
	color[u] = c;
	for (int i = h[u]; ~i; i = ne[i])
	{
		int j = e[i];
		if (j == fa) continue;
		if (w[i] & 1) dfs(j, u, 1 - c);
		else dfs(j, u, c);
	}
}

int main()
{
	memset(h, -1, sizeof h);
	scanf("%d", &n);
	for (int i = 0; i < n - 1; i ++ )
	{
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		add(a, b, c), add(b, a, c);
	}
	
	dfs(1, -1, 0);
	for (int i = 1; i <= n; i ++ ) cout << color[i] << endl;
    return 0;
}


Measured memory_bytes: 5760