akhauriyash/Code-Regression huggingface dataset:
//Code by Anshuman Das Gupta

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define MOD 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define loop(I,N) for(int i=I;i<N;i++)
#define sortvec(V) sort(V.begin(),V.end())
#define vec vector<int>
#define endl "\n"
using namespace std;
#define PI 3.14159265359
int fast_power(int base, int power) {
    int result = 1;
    while (power > 0) {

        if (power & 1) {
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result % MOD;
}

bool isPrime(int x) {
    for (int i = 2; i <= sqrt(x); i++) {
        if (x % i == 0)
            return false;
    }
    if (x == 1)
        return false;
    return true;
}

int binsearch(int a[], int f, int r, int x) {
    while (f <= r) {
        int mid = (f + r) / 2;
        if (a[mid] == x)
            return mid;
        else if (a[mid] > x) {
            r = mid - 1;
        }
        else {
            f = mid + 1;
        }
    }
    return -1;
}
void sieve(int a[], int n) {
    a[0] = 0;
    a[1] = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] == 1) {
            for (int j = i + i; j <= n; j += i) {
                a[j] = 0;
            }
        }
    }
}
int32_t main() {
#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("out.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--) {
        int n, k;
        cin >> n >> k;
        if(k%2==1){
            cout << "No\n";
        }
        else if (n * 2 <= k && n * 4 >= k) {
            cout << "Yes\n";
        }
        else
            cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 3672
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

constexpr ll INF = 1e16;

#define rep(i, N) for(ll i=0; i<N; ++i)

ll max(ll a, ll b) {return a < b ? b : a; }
ll min(ll a, ll b) {return a > b ? b : a; }
double maxf(double a, double b) { return a < b ? b : a; }

int main() {
  int h, a, ans = 0;
  cin>>h>>a;

  while(h>0){
    h = h - a;
    ans++;
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  a,b,c,d:Integer;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(a);
    Read(b);
    Read(c);
    Readln(d);

    Writeln((a*b+c*d+abs(a*b-c*d))div 2);
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	int N; cin >> N;
	V<int> a(N),v(N),c(N);
	REP(i,N) cin >> v[i];
	REP(i,N) cin >> c[i];
	REP(i,N) a[i]=v[i]-c[i];
	
	
	int ans = 0; 
	REP(i,N) if(a[i]>0) ans += a[i];
	cout << ans << endl;


	

	return 0;
}


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

int main()
{
	string S;
	cin>>S;
	if(S[0]=='A')
	{
		bool flag=0;
		int p=(int)S.length();
		for(int a=2;a<=p-2;a++)
		{
			if(S[a]=='C')
			{
				if(!flag) flag=1;
				else if(flag)
				{
					flag=0;
					break;
				}
			}
		}
		int cnt=0;
		for(int a=0;a<S.length();a++)
		{
			if(isupper(S[a]))
			{
				cnt++;
			}
		}
		if(cnt > 2) flag=0;
		if(flag) cout<<"AC";
		else cout<<"WA";
	}
	else
	{
		cout<<"WA";
	}
	return 0;
}

Measured memory_bytes: 256
//
//  nomura_a.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <queue>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
ll mod = 998244353;
ll INF = 1000000007;
#define PI 3.14159265

pair<int, int> dijsktra(int x, char des, int n, vector<pair<int, char> > *adj) {
  priority_queue<pair<pair<int, char>, int> >  q; // (-d, x) current distance to node x is d, using -d to find minimum distance
  bool processed[n];
  pair<int, char> distance[n];
  for (int i=0; i<n; i++) {
    distance[i].first = INF;
    distance[i].second = '0';
    processed[i] = false;
  }
  // find from x
  distance[x] = make_pair(0, '0');
  q.push({distance[x], x});

  while (!q.empty()) {
    int a = q.top().second;
    q.pop();
    if (processed[a]) continue;;
    processed[a] = true;
    for (auto u: adj[a]) {
      int b = u.first; // node b
      char label = u.second;
      int w = 1; // distance from a to b is w
      if (distance[b].first > distance[a].first + w) {
        distance[b] = make_pair(distance[a].first + w, label);
        q.push({{-distance[b].first, label}, b});
      }
    }
  }

  int l = INF;
  int end = 0;
  // std::cout << "distance from " << x << std::endl;
  for (int i = 0; i < n; i++) {
    if (distance[i].first==INF) continue;
    if (distance[i].second == des && distance[i].first < l) {
      l = distance[i].first;
      end = i;
    }
    // std::cout << " distance to " << i << ": " << distance[i] << std::endl;
  }

  return make_pair(l, end);
}


int main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;

  std::cout << h2*60+m2 - (h1*60+m1) - k << std::endl;

  return 0;
}

Measured memory_bytes: 3600
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

const int N = 2005;
int dp[N];

void pre() {
  dp[0] = 1;
  for (int i = 3; i < N; i++) {
    for (int j = 3; j <= i; j++) {
      dp[i] = add(dp[i], dp[i - j]);
    }
  }
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  pre();
  int n;
  cin >> n;
  cout << dp[n] << endl;

  return 0;
}

Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <cmath>
using namespace std;
long long gcd(long long a, long long b) {
	if (a < b) gcd(b, a);
	long long  r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}
long long lcm(long long a, long long b) {
	return a / gcd(a, b) * b;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

long long modinv(long long a, long long mod) {
	long long b = mod, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t*b; swap(a, b);
		u -= t*v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}
inline long long mod(long long a, long long m) {
	return (a % m + m) % m;
}

// 拡張 Euclid の互除法
// ap + bq = gcd(a, b) となる (p, q) を求め、d = gcd(a, b) をリターンします
long long extGcd(long long a, long long b, long long &p, long long &q) {
	if (b == 0) { p = 1; q = 0; return a; }
	long long d = extGcd(b, a%b, q, p);
	q -= a / b * p;
	return d;
}

// 中国剰余定理
// リターン値を (r, m) とすると解は x ≡ r (mod. m)
// 解なしの場合は (0, -1) をリターン
//amari,mod,amari,mod
pair<long long, long long> ChineseRem(long long b1, long long m1, long long b2, long long m2) {
	long long p, q;
	long long d = extGcd(m1, m2, p, q); // p is inv of m1/d (mod. m2/d)
	if ((b2 - b1) % d != 0) return make_pair(0, -1);
	long long m = m1 * (m2 / d); // lcm of (m1, m2)
	long long tmp = (b2 - b1) / d * p % (m2 / d);
	long long r = mod(b1 + m1 * tmp, m);
	return make_pair(r, m);
}
typedef pair<int, int>p;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b,q;
	cin >> a >> b >> q;
	long long s[100004];
	long long t[100004];
	for (int i = 0; i < a; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < b; i++) {
		cin >> t[i];
	}
	long long x;
	while (q--) {
		cin >> x;
		int mj = lower_bound(s, s + a, x)-s;
		int mt = lower_bound(t, t + b, x)-t;
		long long migij, migit, hidarij, hidarit;
		if (x > s[a - 1]) {
			migij = LLONG_MAX / 3;
		}
		else {
			migij = s[mj];
		}
		if (x > t[b - 1]) {
			migit = LLONG_MAX / 3;
		}
		else {
			migit = t[mt];
		}
		if (mj == 0) {
			hidarij = LLONG_MIN/3;
		}
		else {
			hidarij = s[mj - 1];
		}
		if (mt == 0) {
			hidarit = LLONG_MIN/3;
		}
		else {
			hidarit = t[mt - 1];
		}
		long long ans = LLONG_MAX;
		ans = min(ans, max(migit-x, migij-x));
		ans = min(ans, max(x - hidarit, x - hidarij));
		ans = min(ans, min(migit - x, x - hidarij)*2+max(migit - x, x - hidarij));
		ans = min(ans, min(migij - x, x - hidarit)*2+max(migij - x, x - hidarit));
		cout << ans << "\n";
	}
}


Measured memory_bytes: 2944
#include <stdio.h>
#include <limits.h>
#define U 10000
#define NIL -1
#define WHITE 0
#define BLACK 1
#define MAX 100009
int d[U];
int parent[U];
int color[U];

int main()
{
    int cost = 0;
    int mincost;
    int i, j, k, u, v;
    int n, c;
    int A[105][105];
    scanf("%d", &n);

    for (i = 0; i < n; i++)
    {
        for (j = 0; j < n; j++)
        {
            A[i][j] = NIL;
        }
    }

    for (i = 0; i < n; i++)
    {
        scanf("%d%d", &u, &k);
        for (j = 0; j < k; j++)
        {
            scanf("%d%d", &c, &v);
            A[u][c] = v;
        }
    }

    for (u = 0; u < n; u++)
    {
        d[u] = MAX; //コスト おもさ
        parent[u] = NIL;
        color[u] = WHITE; //訪問した:BLACK   訪問まだ:WHITE
    }
    d[0] = 0; //最初の島のコストは０

    while (1)
    {
        mincost = MAX;

        for (i = 0; i < n; i++)
        {
            if (color[i] != BLACK && d[i] < mincost)
            {
                mincost = d[i];
                u = i;
            }
        }

        // printf("aiueo\n");

        if (mincost == MAX)
            break;

        color[u] = BLACK;

        for (v = 0; v < n; v++)
        {
            if (color[v] != BLACK && A[u][v] + d[u] < d[v] && A[u][v] != NIL)
            {
                parent[v] = u;
                d[v] = A[u][v] + d[u];
            }
        }
    }

    for (v = 0; v < n; v++)
        cost += d[v];

    //  printf("%d\n",cost);

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

    return 0;
}



Measured memory_bytes: 2052
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <map>
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i,n) for(int i = 1; i <= n; i++)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;

int main()
{
	ll N, K;
	cin >> N >> K;
	vector<ll> a(100010, 0);
	rep(i, N)
	{
		ll tmp1, tmp2;
		cin >> tmp1 >> tmp2;
		a[tmp1] += tmp2;
	}

	ll ind = 0;
	for(int i=1; i<=100000;i++)
	{
		K -= a[i];
		ind = i;
		if (K<=0)
		{
			co(i);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 1024
package main

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

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,100)}
  n,m := input.Next2Ints()
  x := input.NextIntArray()
  uf := NewUnionFind(n)
  for i:=0;i<n;i++ { uf.weight[i] = x[i] }
  es := make(Edges,m)
  g := make(Graph,n)
  for i:=0;i<m;i++ {
    a,b,y := input.Next3Ints()
    a,b = a-1,b-1
    c := int64(y)
    es[i] = Edge{a,b,c}
    g.Add(a,b,c)
    g.Add(b,a,c)
  }
  sort.Sort(es)
  ok := make([]bool,m)
  for i:=0;i<m;i++ {
    uf.Unite(es[i].fm,es[i].to)
    if uf.Weight(es[i].fm) >= es[i].c { ok[i] = true }
  }
  used := make([]bool,n)
  var dfs func(int,int64)
  dfs = func(u int,c int64) {
    used[u] = true
    for _,e := range g[u] {
      if e.c > c { continue }
      if used[e.to] { continue }
      dfs(e.to,c)
    }
  }
  ans := 0
  for i:=m-1;i>=0;i-- {
    if used[es[i].fm] { continue }
    if !ok[i] { ans++;continue }
    dfs(es[i].fm,es[i].c)
  }
  fmt.Println(ans)
}

type Edge struct { fm,to int;c int64 }
type Edges []Edge
type Graph [][]Edge
func(e Edges) Len() int { return len(e) }
func(e Edges) Swap(i,j int) { e[i],e[j] = e[j],e[i] }
func(e Edges) Less(i,j int) bool { return e[i].c < e[j].c }
func(g Graph) AddEdge(fm int,e Edge) { g[fm] = append(g[fm],e) }
func(g Graph) Add(fm,to int,c int64) { g.AddEdge(fm,Edge{fm,to,c}) }

type UnionFind struct { par,size []int;weight []int64 }
func NewUnionFind(n int) UnionFind {
  par := make([]int,n)
  size := make([]int,n)
  weight := make([]int64,n)
  for i:=0;i<n;i++ { par[i],size[i] = i,1 }
  return UnionFind{par,size,weight}
}
func(u UnionFind) Find(i int) int {
  if u.par[i] == i { return i }
  u.par[i] = u.Find(u.par[i])
  return u.par[i]
}
func(u UnionFind) Same(i,j int) bool { return u.Find(i) == u.Find(j) }
func(u UnionFind) Unite(i,j int) {
  i,j = u.Find(i),u.Find(j)
  if i == j { return }
  u.par[j] = i
  u.size[i] += u.size[j]
  u.weight[i] += u.weight[j]
}
func(u UnionFind) Size(i int) int { return u.size[u.Find(i)] }
func(u UnionFind) Weight(i int) int64 { return u.weight[u.Find(i)] }

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInt() int {
  n,_ := strconv.Atoi(i.NextLine())
  return n
}
func(i *Input) Next2Ints() (int,int) {
  s := strings.Fields(i.NextLine())
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}
func(i *Input) Next3Ints() (int,int,int) {
  s := strings.Fields(i.NextLine())
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  z,_ := strconv.Atoi(s[2])
  return x,y,z
}
func(i *Input) NextIntArray() []int64 {
  s := strings.Fields(i.NextLine())
  a := make([]int64,len(s))
  for i:=0;i<len(s);i++ { a[i],_ = strconv.ParseInt(s[i],10,64) }
  return a
}

Measured memory_bytes: 71168
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <iterator>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define ff first
#define ss second
#define END "\n"
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long ll;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef vector<ii> vii;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
/////////////////////////////////////////////////////////////////////
vector<vector<ll>> adj;
vector<ll> sum;
vector<bool> visited;
void dfs(ll v)
{
    visited[v] = true;
    for (auto u: adj[v])
    {
        if (visited[u])
        sum[v] = max(sum[u] + 1, sum[v]);
        else
        {
            dfs(u);
            sum[v] = max(sum[u] + 1, sum[v]);
        }
    }
}


int main()
{
    fast
    ll n, m, i, j, x, y, ans = -1;
    cin >> n >> m;
    sum = vector<ll>(n + 1, 0);
    adj = vector<vector<ll>>(n + 1);
    visited = vector<bool>(n + 1, false);
    for (i = 0; i < m; i++)
    {
        cin >> x >> y;
        adj[x].pb(y);
    }
    for (i = 1; i <= n; i++)
    {
        if (!visited[i])
        dfs(i);
    }
    for (i = 1; i <= n; i++)
    ans = max(ans, sum[i]);
    cout << endl;
    cout << ans << endl;
    return 0;
}

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

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

    static class DRestoringRoadNetwork {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 残っている道の中で最小の道が正しい道としてやる
            // だから道を一応並べ替える必要がある？
            // 安い順に道を見て行って矛盾があれば・・みたいな
            //　どういう順番に更新していけばいいんだろう…
            // O(N^2)で更新ができそう
            // 矛盾ってどう見つけるんだろう
            // たとえば i->j , cost:cについて
            // i->k, k->jで道が存在してcost < c => 矛盾
            // i->k, k->jでの道すべてに対してcost > c => 矛盾しない、直接結ぶ道が必要
            // i->k, k->jで道が存在してcost = c => 矛盾しないが、道は必要ない
            // それでよさそう
            int n = in.nextInt();
            int[][] remTable = new int[n][n];
            long ans = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    remTable[i][j] = in.nextInt();
                }
            }

            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    // 各道(i->j)について考える
                    boolean need = true;
                    for (int k = 0; k < n; k++) {
                        if (i == k || k == j) continue;
                        // i = 0
                        // j = 2
                        if (remTable[i][j] > remTable[i][k] + remTable[k][j]) {
                            // 矛盾
                            ans = -1;
                            break;
                        } else if (remTable[i][j] == remTable[i][k] + remTable[k][j]) {
                            need = false;
                        }
                    }
                    if (ans == -1) continue;
                    if (need) {
                        ans += remTable[i][j];
                    }
                }
            }
            out.println(ans);


        }

    }
}



Measured memory_bytes: 50656
import java.io.PrintWriter

fun main(args:Array<String>) {
    val printWriter = PrintWriter(System.out)
    val (d, t, s) = readLine()!!.split(" ").map { it.toInt() }
    printWriter.println(when {
        t * s >= d -> "Yes"
        else -> "No"
    })
    printWriter.flush()
}

Measured memory_bytes: 36584
#include <stdio.h>
#define N 10000

int n, m, data[N], tmp[N];

void MergeSort(int data[], int left, int right){
  int mid, i, j, k;
  if(left >= right) return;
  mid = (left + right) / 2;
  MergeSort(data, left, mid);
  MergeSort(data, mid+1, right);
  for(i=left;i<=mid;i++) tmp[i] = data[i];
  for(i=mid+1, j=right;i<=right;i++, j--) tmp[i] = data[j];
  i = left;
  j = right;
  for(k=left;k<=right;k++){
    if(tmp[i] <= tmp[j]) data[k] = tmp[i++];
    else data[k] = tmp[j--];
  }
}

char find(int x){
  int l = 0, r = n;
  while(r - l >= 1){
    int i = (l + r) / 2;
    if(data[i] == x) return 1;
    else if(data[i] < x) l = i + 1;
    else r = i;
  }
  return 0;
}

main(){
  int i, in, ans = 0;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d", &data[i]);
  }
  MergeSort(data, 0, n-1);
  scanf("%d", &m);
  for(i=0;i<m;i++){
    scanf("%d", &in);
    if(find(in)) ans++;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int mod = 1000000007;
const double pi = acos(-1); // cos(pi) = -1 <=> pi = arccos(-1)

/* global variables */

/* function */

/* main */
int main() {

    int n;
    cin >> n;
    while (n) {
        double mean = 0;
        double variance = 0;
        for (int i = 0; i < n; i++) {
            int v;
            cin >> v;
            mean += v;
            variance += v * v;
        }
        mean /= n;
        variance /= n;
        cout << fixed << setprecision(6) << sqrt(variance - mean * mean) << '\n';
        cin >> n;
    }
 }



Measured memory_bytes: 3288
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class A
{
    public static void Main()
    {

        int n = GetInt();
        while(n >= 0)
        {
            if (n % 7 == 0)
            {
                Console.WriteLine("Yes");
                return;
            }
            n -= 4;
        }
        Console.WriteLine("No");
        return;
    }
}


public static class MyIO
{
    private static string[] args = null;
    private static int num = -1;
    private static int used = -1;

    private static string getArg()
    {
        if (used == num)
        {
            args = Console.ReadLine().Split(' ');
            num = args.Length;
            used = 0;
        }
        return args[used++];
    }

    public static int GetInt() { return int.Parse(getArg()); }
    public static long GetLong() { return long.Parse(getArg()); }
    public static double GetDouble() { return double.Parse(getArg()); }
    public static string GetString() { return getArg(); }
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <string>
#include <utility>
#include <map> 
#include <queue>
#include <stack>
#include <iomanip>
#include <sstream>
#define MP make_pair
#define PB push_back
#define S size()
#define B begin()
#define E end()
#define ll long long
#define REP(i,a,n) for(ll i=a; i<n; ++i)
#define RED(i,n,a) for(ll i=n; i>=a; --i)
#define m9 1000000007
#define endl "\n"
#define F first
#define SE second
#define ld long double



using namespace std;

ll gcd(ll a, ll b){
    if(a%b==0){
        return b;
    }
    else{
        return gcd(b, a%b);
    }
}
ld area(ld x1, ld y1, ld x2, ld y2, ld x3, ld y3){
    return abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
}

vector <ll> v;

void generate(string s){
    stringstream obj(s);
    ll x=0;
    obj>>x;
    if(x<=1e6){
        v.PB(x);
        generate(s+"1"), generate(s+"0");
    }
}

int main(){
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    ll n, w;
    cin>>n>>w;
    ll dp[w+1];
    REP(i,0,w+1){
        dp[i]=0;
    }
    for(ll i=1; i<=n; ++i){
        ll weight, value;
        cin>>weight>>value;
        for(ll j=w-weight; j>=0; --j){
            dp[j+weight]=max(dp[j+weight], dp[j]+value);
        }
    }
    ll ans=0;
    REP(i,0,w+1){
        ans=max(ans,dp[i]);
    }
    cout<<ans;
    
    
    
}


Measured memory_bytes: 1024
# D
H, W = map(int, input().split())
C = []
for _ in range(10):
    C.append(list(map(int, input().split())))

count_ = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for _ in range(H):
    for w in map(int, input().split()):
        if w >= 0:
            count_[w] += 1

# minimum cost
DP = [1000]*10
DP[1] = 0

end = 0
while end == 0:
    end = 1
    for i in range(10):
        a = min([C[i][j] + DP[j] for j in range(10)])
        if a < DP[i]:
            end = 0
            DP[i] = a
            
print(sum([DP[j]*count_[j] for j in range(10)]))

Measured memory_bytes: 3064
/*
 _ _ _   _    _   _    _   _ _ _   _    _   _ __ _   __       __
|  _ _| | |  | | | |  | | |  _  | | |  | | |  __  | |   \   /   |
| |_ _  | |__| | | |  | | | |_| | | |__| | | |__| | | |\ \_/ /| |
|_ _  | |  __  | | |  | | |  _ <  |  __  | |  __  | | | \   / | |
 _ _| | | |  | | | |__| | | |_| | | |  | | | |  | | | |  \_/  | |  _   _   _
|_ _ _| |_|  |_| |_ __ _| |_ _ _| |_|  |_| |_|  |_| |_|       |_| |_| |_| |_|

*/

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

#define ll long long int
#define fi first
#define se second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << " ";
#define endl "\n"
const int  MOD=1000000007;

void solve() {
    string s;
    cin>>s;
    int ans=0;
    for(int i=0,j=s.size()-1;i<j;i++,j--){
        if(s[i]!=s[j])
            ans++;
    }
    cout<<ans<<endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int t = 1;
    // cin>>t;
    for (long int tt = 1; tt <= t; tt++) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int x,t;
	cin>>x>>t;
	if(x<=t){
		cout<<0<<endl;
	}else{
		cout<<x-t<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
a, b, k = map(int, input().split())
L =[]
for i in range(k):
    L.append(a + i)
    if a + i == b:
        break
for j in range(k):
    L.append(b - j)
    if b - j == a:
        break
L = list(set(L))
for k in sorted(L):
    print(k)


Measured memory_bytes: 3060
N=int(input())
S=[[int(s) for s in input()] for i in range(N)]
c=[[] for i in range(N)]
for i in range(N):
    for j in range(N):
        if S[i][j]:
            c[i].append(j)
def bfs(p,g,d):
    r=0
    q=[]
    for e in p:
        if x[e]==g^1:
            return -1
        elif x[e]==-1:
            x[e]=g
            for f in c[e]:
                q.append(f)
    if len(q)==0:
        return d
    return bfs(q,g^1,d+1)
r=0
for i in range(N):
    x=[-1]*N
    d=bfs([i],0,0)
    if d==-1:
        break
    r=max(r,d)
print(r if d!=-1 else d)

Measured memory_bytes: 4212
#include <stdio.h>

int main(void){
	int i=1,j,cul=0,stack[200]={0};
	char temp[3];
	while(scanf("%s",temp)!=EOF){
		if(temp[0]=='+'){
			cul=stack[i-2]+stack[i-1];
			i-=2;
			stack[i]=cul;
			i++;
		}
		else if(temp[0]=='-'){
			cul=stack[i-2]-stack[i-1];
			i-=2;
			stack[i]=cul;
			i++;
		}
		else if(temp[0]=='*'){
			cul=stack[i-1]*stack[i-2];
			i-=2;
			stack[i]=cul;
			i++;
		}
		else{
			stack[i]=atoi(temp);
			i++;
		}
	}
	printf("%d\n",stack[i-1]);
	return 0;
}

Measured memory_bytes: 548
#include<stdio.h>

#define N 2000001

int Max(int*,int);
void CountingSort(int*,int*,int,int);

int main(void){
  int n,A[N],B[N];
  int i;

  scanf(" %d",&n);
  for(i = 0; i < n; i++){
    scanf(" %d",&A[i]);
  }

  CountingSort(A,B,Max(A,n),n);

  for(i = 1; i < n+1; i++){
    if(i > 1)printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
  
  return 0;
}

int Max(int *A, int n){
  int max=A[0];
  int i;

  for(i = 1; i < n; i++){
    if(A[i] > max) max = A[i];
  }
  return max;
}

void CountingSort(int *A, int *B, int k, int n){
  int C[k+1];
  int i,j;

  for(i = 0; i < k+1; i++){
    C[i] = 0;
  }

  for(j = 0; j < n; j++){
    C[A[j]]++;
  }
  
  for(i = 1; i < k+1; i++){
    C[i] = C[i] + C[i-1];
  }

  for(j = n-1; j >= 0; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}




Measured memory_bytes: 17392
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
struct node{ll lv,rv,lc,rc;};
#define MAX_N 101
ll gcd(ll x,ll y){return __gcd(x,y);}
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}

int n;
node g[MAX_N];
int t[MAX_N];

ll rec(int pos){
  if(pos==0)return 1;
  node m=g[pos];
  ll a=rec(m.lc);
  ll b=rec(m.rc);
  ll c=gcd(a*m.lv,b*m.rv);
  return a*(b*m.rv/c)+b*(a*m.lv/c);
}

void solve(){
  int root;
  for(root=1;t[root]>0;root++);
  cout<<rec(root)<<endl;
}

void init(){
  for(int i=0;i<MAX_N;i++)t[i]=0;
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    init(); 
    for(int i=1;i<=n;i++){
      ll p,q,r,b,x;
      cin>>p>>q>>r>>b;
      x=gcd(p,q);
      p/=x,q/=x;
      g[i]=(node){p,q,r,b};
      t[r]=t[b]=i;
    }
    solve();
  }
  return 0;
}

Measured memory_bytes: 1168
mod = int(1e9 + 7)
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            result %= mod

    return result


n, a, b = map(int, input().split())

base = 1
waru = 1000
syou = n // waru
amari = n % waru
kakeru = 2**waru % mod
for _ in range(syou):
    base = base * kakeru
    base %= mod
base = base * 2**amari
base %= mod

nca = cmb(n, a%mod)
ncb = cmb(n, b%mod)
answer = (base - 1 - nca - ncb) % mod
print(answer)


Measured memory_bytes: 27700
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

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

Measured memory_bytes: 0
# verify-helper: PROBLEM https://judge.yosupo.jp/problem/unionfind
import sys

input = sys.stdin.buffer.readline


class UnionFindTree:
    """Disjoint-Set Data Structure

    Union-Find Tree

    complexity:
        - init: O(n)
        - find, unite, same: O(alpha(n))
    """

    def __init__(self, n: int) -> None:
        self.par = list(range(n))  # parent
        self.rank = [0] * n  # depth of tree

    def find(self, x: int) -> int:
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x: int, y: int) -> None:
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def is_same(self, x: int, y: int) -> bool:
        return self.find(x) == self.find(y)


def main() -> None:
    N, Q = map(int, input().split())
    uft = UnionFindTree(N)
    for _ in range(Q):
        t, u, v = map(int, input().split())
        if t == 0:
            uft.unite(u, v)
        else:
            print(int(uft.is_same(u, v)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 18484
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<string>
using namespace std;
#define rep2(x,from,to) for(long long x=from;x<to;x++)
#define rep(x,to) rep2(x,0,to)
long long n;
long long r,g,b;
string s;
long long ans;
int main()
{
    cin>>n;
    cin>>s;
    rep(i,n)
    {
        if(s[i]=='R')r++;
        if(s[i]=='G')g++;
        if(s[i]=='B')b++;
    }
    ans=r*g*b;
    rep(i,n)
    {
        rep2(j,1,n+3)
        {
            r=0;
            g=0;
            b=0;
            if(i-j<0||i+j>n-1)
            {
                break;
            }
            rep2(k,-1,2)
            { 
        if(s[i+j*k]=='R')r++;
        if(s[i+j*k]=='G')g++;
        if(s[i+j*k]=='B')b++;
            }
            if(r==g&&g==b&&b==r)ans--;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int cnt = 0;
	int n; cin>>n;
	for(int i = 0; i < n; i++)
	{
		int x; cin>>x;
		if(x&1) cnt++;
	}
	if(cnt&1) cout<<"NO\n";
	else cout<<"YES\n";
}


Measured memory_bytes: 384
// Package main provides
//
// File:  c.go
// Author: ymiyamoto
//
// Created on Wed Dec 26 21:29:27 2018
//
package main

import (
	"fmt"
	"sort"
)

type strs []string

func (s strs) Len() int {
	return len(s)
}

func (s strs) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s strs) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s strs) find(str string) bool {
	for i := range s {
		if s[i] == str {
			return true
		}
	}
	return false
}
func kthSubstring(s string, K int) string {
	alpha := "abcdefghijklmnopqrstuvwxyz"

	arr := make(strs, 0)
	for i := range alpha {
		for j := range s {
			if s[j] == alpha[i] {
				for k := j + 1; k <= len(s) && k <= j+5; k++ {
					if !arr.find(s[j:k]) {
						arr = append(arr, s[j:k])
					}
				}
			}
		}
	}

	sort.Sort(arr)
	return arr[K-1]
}

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

	fmt.Println(kthSubstring(s, K))
}


Measured memory_bytes: 1664
import java.util.Scanner;

public class Main {
	public static void main(String [] args){
		Scanner scan = new Scanner(System.in);
		
		int i,j;
		
		while(true){
			
			int h = scan.nextInt();
			int w = scan.nextInt();
			
			if(h == 0 && w == 0){
				break;
			}
			
			for(i=0; i<h; i++){
				for(j=0; j<w; j++){
					if(i==0 || i == (h-1)){
						System.out.print('#');
					}else if(j==0 || j==(w-1)){
						System.out.print('#');
					}else{
						System.out.print('.');
					}
					
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int a[m], b[m];
  for (int i = 0; i < m; i++) cin >> a[i] >> b[i];
  vector<int> ad1, adn;
  for (int i = 0; i < m; i++) {
    if (a[i] == 1) ad1.push_back(b[i]);
    if (b[i] == n) adn.push_back(a[i]);
  }
  sort(ad1.begin(), ad1.end());
  sort(adn.begin(), adn.end());
  for (auto l : ad1) {
    if (binary_search(adn.begin(), adn.end(), l)) {
      cout << "POSSIBLE" << "\n";
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << "\n";
  return 0;
}

Measured memory_bytes: 2812
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main(){
    int x, h;
    while(cin >>x >>h){
        if(x == 0 && h == 0) break;
        double ans = x * x, tmp = x * (sqrt(((x / 2.0) * (x / 2.0)) + (h * h))) / 2;
        ans += (tmp * 4);
        printf("%f\n", ans);
    }
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define ll long long int
#define vec vector<ll>
#define mat vector<vec>

using namespace std;

const ll mod=1000000007;
const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

int main(){

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

  mat dp(21,vec(n+1));

  for(ll i=0;i<n;i++){
    for(ll j=0;j<20;j++){
      dp[j][i+1]=dp[j][i];
      if((1<<j) & a[i])dp[j][i+1]++;
    }
  }

  ll ans=0;
  for(ll i=0;i<n;i++){
    ll r=i+1,l=n+1;
    ll h;
    while(abs(r-l)>1){
      h=(r+l)/2;
      bool ok=1;
      for(ll j=0;j<20;j++){
        if(dp[j][h]-dp[j][i]>1){
          ok=0;
          break;
        }
      }
      if(ok){
        r=h;
      }
      else{
        l=h;
      }
    }
    ans+=(r-i);
    //cout << r << endl;
  }

  cout << ans << endl;
}

Measured memory_bytes: 39160
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

int main (){
    ll x;
    cin >> x;
    ll p=x/11;
    ll q=x%11;
    p*=2;
    if(1<=q&&q<=6) p++;
    else if(7<=q&&q<=10) p+=2;
    cout << p << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s;
    cin>>s;
    if(s[0]!='A') s='A'+s;
    if(s[s.size()-1]!='A') s+='A';
    rep(i,s.size()){
        if(s[i]=='H'&&s[i+1]!='A') s.insert(i+1,1,'A');
        else if(s[i]=='B'&&s[i+1]!='A') s.insert(i+1,1,'A');
    }
    if(s=="AKIHABARA") cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

int k,a,b;
scanf("%d %d %d",&k,&a,&b);
  for(int i=a; i<=b; i++){
  if(i%k==0){
  printf("OK");
  return 0;
  } 
}
  printf("NG");
  return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define INF 0x3f3f3f3f 
#define MEM(x,y) memset(x,y,sizeof(x))
#define int long long
#define rep(i , a , b) for(int i = a ; i <= b ; i ++)
#define P pair<int,int>
#define  sc(a) scanf("%lld",&a)
#define pf(a) printf("%lld ",a)
using namespace std;
signed main()
{
	long double a, b, c;
	cin >> a >> b >> c;
	c -= a + b + 2 * sqrt(a * b);
	if(c>0)
		cout << "Yes";
	else
		cout << "No";
}











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

#define IOS ios::sync_with_stdio(false); cin.tie(0);

int gcd (int x, int y){

    if (x % y == 0) return y;
    return gcd(y,x % y);

}


int main(void)
{
    IOS
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0 ; i < n; i++) cin >> a[i];

    vector<int> lgcd(n); lgcd[0] = a[0];
    vector<int> rgcd(n); rgcd[n-1] = a[n-1];
    vector<int> lrgcd(n);
    
    for(int i = 1; i < n; i++){
        lgcd[i] = gcd(lgcd[i-1] , a[i]);
        rgcd[n-i-1] = gcd(rgcd[n-i] , a[n-i-1]);
        //cerr << "i:" << i << " " << lgcd[i] << " " << rgcd[n-i-1] << endl;
    }
    //cerr << "gcd1" << endl;
    for(int i = 0; i < n; i++){
        if (i == 0) {
            lrgcd[i] = rgcd[i+1];
        } else if (i == n-1) {
            lrgcd[i] = lgcd[i-1];
        } else {
            lrgcd[i] = gcd(lgcd[i-1], rgcd[i+1]); 
        }
    }
    auto itr = max_element(lrgcd.begin(),lrgcd.end());
    cout << *itr << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int a[101];
int main()
{
	int n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			for(int k=j+1;k<=n;k++)
			{
				if(a[i]==a[j]||a[j]==a[k]||a[i]==a[k])
					continue;
				if(((a[i]+a[j])>a[k])&&((a[i]+a[k])>a[j])&&((a[j]+a[k])>a[i]))
					ans++;
			}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define pb push_back
#define mp make_pair

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, i, j, k, l, m;
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e >> k;
    int ck = e - a;
    if(ck <= k){
        cout<<"Yay!"; return 0;
    }
    else{
        cout<<":("; return 0;
    }
}

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

int main() {
    int n,q;
    cin >> n >> q;
    vector<vector<int>> x(n);
    for(int i = 0; i < n-1; i++) {
        int a,b;
        cin >> a >> b;
        x[a-1].push_back(b);
        x[b-1].push_back(a);
    }

    vector<int> order;
    vector<bool> h(n,false);
    queue<int> y;
    h[0]=true;
    order.push_back(1);
    y.push(1);
    vector<int> parent(n);

    while(!y.empty()){
        int v=y.front();
        y.pop();

        for(int nv : x[v-1]){
            if(h[nv-1] == true) continue;

            h[nv-1]=true;
            parent[nv-1]=v;
            y.push(nv);
            order.push_back(nv);
        }
    }

    vector<int> p(n);
    for(int i = 0; i < q; i++) {
        int s,t;
        cin >> s >> t;
        p[s-1] += t;
    }

    vector<int> ans(n);
    for(int i = 0; i < n; i++) {
        int l=order[i];
        if(l==1){
            ans[0]=p[0];
        }
        else{
            ans[l-1] = p[l-1]+ans[parent[l-1]-1];
        }
    }

    for(int i = 0; i < n-1; i++) {
        cout << ans[i] << ' ';
    }
    cout << ans[n-1] << endl;

    return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;

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

    ll t = 0, res = 0;
    for(int i = 1; t < X; i++){
        t += i;
        res++;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.*;

class Main{
	public static void main(String []args)throws IOException{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int K, N, i, j, minDist = Integer.MAX_VALUE;
      String str = br.readLine();
      
      K = Integer.parseInt(str.substring(0, str.indexOf(" ")));
      N = Integer.parseInt(str.substring(str.indexOf(" ") + 1));
      
      int A[] = new int[N];
      str = br.readLine();
      String s[] = str.split(" ");
      
      for(i = 0; i < s.length; i++)
      {
        A[i] = Integer.parseInt(s[i]);
      }
      int dist[] = new int[N];
      int max = 0;
      for(i = 0; i < N - 1; i++)
      {
        	dist[i] = Math.abs(A[(i + 1) % N] - A[i % N]);
        if(dist[i] > dist[max])
          max = i;
      }
      dist[i] = K - A[N - 1] + A[0];
      if(dist[i] > dist[max])
        max = i;
      minDist = 0;
      for(i = 0; i < N; i++)
      {
          minDist = minDist + dist[i];
      }
      System.out.println(minDist - dist[max]);
    }
}

Measured memory_bytes: 49884
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cctype>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;

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<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;

int main() {
	int x;
	cin >> x;
	if (x >= 30) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3632