akhauriyash/Code-Regression huggingface dataset:
module WeightedDirectedGraph
  (* 頂点 *)
  (Vertex : Hashtbl.HashedType)
  (* 辺の重み *)
  (Weight : sig
    type t
    val zero : t
    val ( + ) : t -> t -> t
    val compare : t -> t -> int
  end) :
sig
  (* ハッシュテーブルを使うようにしたダイクストラ法の実装 *)
  val dijkstra :
    (* 頂点数（Hashtblを用いるので目安程度） *)
    int ->
    (* 隣接リスト *)
    (Vertex.t -> (Vertex.t * Weight.t) list) ->
    (* 始点 *)
    Vertex.t ->
    (* 始点から辿り着けなければNoneを返す関数 *)
    (Vertex.t -> Weight.t option)
end =
struct
  module WMap = Map.Make (Weight)
  module VHash = Hashtbl.Make (Vertex)

  let dijkstra n es s =
    let d = VHash.create n in
    VHash.add d s Weight.zero;
    let rec dijkstra_aux q =
      match WMap.min_binding_opt q with
      | None -> ()
      | Some (w, us) ->
          dijkstra_aux @@
          Fun.flip (Fun.flip List.fold_left (WMap.remove w q)) us @@ fun q u ->
            if 0 < Weight.compare w (VHash.find d u)
            then q
            else Fun.flip (Fun.flip List.fold_left q) (es u) @@ fun q (v, c) ->
              let open Weight in
              match VHash.find_opt d v with
              | Some d when Weight.compare d (w + c) <= 0 -> q
              | _ ->
                  VHash.replace d v (w + c);
                  WMap.add (w + c) (v :: try WMap.find (w + c) q with Not_found -> []) q in
    dijkstra_aux (WMap.singleton Weight.zero [s]);
    VHash.find_opt d
end

module G = WeightedDirectedGraph
(struct
  type t = int * int
  let equal = ( = )
  let hash (v, w) = 2501 * v + w
end)
(struct
  type t = int
  let zero = 0
  let ( + ) = ( + )
  let compare = compare
end)

let () = Scanf.scanf "%d %d %d\n" @@ fun n m s ->
  let es = Array.make n [] in
  for i = 0 to m - 1 do
    Scanf.scanf "%d %d %d %d\n" @@ fun u v a b ->
      es.(u - 1) <- (v - 1, a, b) :: es.(u - 1);
      es.(v - 1) <- (u - 1, a, b) :: es.(v - 1);
  done;
  let vs = Array.init n @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun c d -> (c, d) in
  let d = Fun.flip (G.dijkstra (n * 2501)) (0, min 2500 s) @@ fun (v, w) ->
    (let (c, d) = vs.(v) in ((v, min 2500 (w + c)), d)) ::
      Fun.flip List.filter_map es.(v) (fun (u, a, b) ->
        if w < a
        then None
        else Some ((u, w - a), b)) in
  for v = 1 to n - 1 do
    Printf.printf "%d\n" @@
    List.fold_left min max_int @@
    List.init 2501 @@ fun w -> Option.value ~default:max_int @@ d (v, w)
  done


Measured memory_bytes: 30760
adj = []
n = gets.to_i
n.times do
  u, k, *v = gets.split.map { |i| i.to_i }
  adj[u-1] = []
  (1..n).each do |j|
    adj[u-1] << ( v.include?(j) ? 1 : 0 )
  end
end

adj.each do |line|
  puts line * ' '
end

Measured memory_bytes: 8860
//
// Created on 2020/05/02.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    string ans = "NG";
    int k;
    int a,b;
    cin>>k;
    cin>>a>>b;
    for (int i = 0; i * k <= b + 10 ; ++i) {
        if( a <= i * k && i * k <= b){
            ans = "OK";
        }
    }

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


Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main()
{
	int i,N,a,b,c,p[1000];
	cin>>N;
	for(i=0;i<N;i++)
	{
		cin>>a>>b>>c;
		if(a*a+b*b==c*c||b*b+c*c==a*a||a*a+c*c==b*b)
			p[i]=1;
		else p[i]=0;
	}
	for(i=0;i<N;i++)
		if(p[i])
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		return 0;
}

Measured memory_bytes: 1156
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

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

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
	if (y == 0) 
		return 1; 
	ll p = power(x, y/2) % MOD; 
	p = (p * p) % MOD; 
  
	return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
	#ifndef ONLINE_JUDGE
	if (fopen("INPUT.txt", "r"))
	{
		freopen ("INPUT.txt" , "r" , stdin);
		//freopen ("OUTPUT.txt" , "w" , stdout);
	}
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	clock_t clk;
	clk = clock();
//-----------------------------------------------------------------------------------------------------------//

	cout<<fixed<<setprecision(9);
	ld L;
	cin>>L;
	L=L/3;
	cout<<L*L*L<<endl;

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


	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

	return 0;
}

Measured memory_bytes: 256
HOGE = 2 ** 52
loop do
  n = gets.to_i
  break if n==0
  b = gets.chomp
  e = 0
  a = HOGE + b.to_i(2)
  m = a
  while n>0 and a!=0 do
    ct = (HOGE * 2 - 1 - m) / a
    ct = n if ct>n
    m += ct * a
    n -= ct
    break if n==0
    e += 1
    m = (m + a) / 2
    a /= 2
    n -= 1
  end
  puts e.to_s(2).rjust(12, ?0) + m.to_s(2)[1..52]
end


Measured memory_bytes: 6928
# coding: utf-8

n, q = map(int,raw_input().split())
A = [2**31-1 for i in xrange(100000)]
B = [2**31-1 for i in xrange(101)]

def update(i,x):
    if A[i] == 2**31-1:
        A[i] = x
        B[i/1000] = min(x, B[i/1000])
    else:
        A[i] = x
        MIN = 2**31-1
        for j in xrange(i/1000 * 1000, (i/1000 + 1) * 1000):
            if A[j] < MIN:
                MIN = A[j]
        B[i/1000] = MIN

def find(s,t):
    MIN = 2**31-1
    if s/1000 == t/1000 or s/1000 + 1 == t/1000:
        for i in xrange(s, t+1):
            if A[i] < MIN:
                MIN = A[i]
    else:
        #left range
        for i in xrange(s, (s/1000 + 1) * 1000):
            if A[i] < MIN:
                MIN = A[i]
        #middle range
        for j in xrange(s/1000 + 1, t/1000):
            if B[j] < MIN:
                MIN = B[j]
        
        #right range
        for i in xrange(t/1000 * 1000, t+1):
            if A[i] < MIN:
                MIN = A[i]
    print MIN   
    
for i in xrange(q):
    com, s, t = map(int,raw_input().split())
    if com: #find
        find(s,t)
    else: #update
        update(s,t)
    

Measured memory_bytes: 6104
def main():
    import sys

    input = sys.stdin.readline

    def build_table(h, w, a):
        ret = [[0] * (w + 1) for _ in range(h + 1)]
        for r in range(h):
            for c in range(w):
                ret[r + 1][c + 1] = ret[r + 1][c] + ret[r][c + 1] - ret[r][c] + a[r][c]
        return ret

    def get(p, q, t):
        return t[q][q] - t[p - 1][q] - t[q][p - 1] + t[p - 1][p - 1]

    n, m, q = map(int, input().split())

    t = [[0] * (n + 1) for _ in range(n + 1)]  # 0-indexed
    for _ in range(m):
        l, r = (int(x) - 1 for x in input().split())  # 0-indexed
        t[l][r] += 1

    t = build_table(n, n, t)  # 1-indexed

    ret = []
    for _ in range(q):
        p, q = map(int, input().split())  # 1-indexed
        ret.append(get(p, q, t))

    print(*ret, sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 20148
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

typedef long long int ll;

int main(){

    int D,G;
    cin >> D >> G;
    //cout << D << G << endl;
    vector<int> p(D),c(D);

    REP(i,D){
        cin >> p[i] >> c[i];
    }

    int ans = INF;
    //cout << (1<<D) << endl;


    for(int mask = 0;mask < (1<<D) ; mask++){
        int sum = 0,num = 0,rest_max = -1;
        for(int i = 0;i < D;i++){

            if(mask >> i & 1){

                sum += (i+1)* 100 *p[i] + c[i];
                num += p[i];
            }else{
                rest_max = i;
            }
        }
        //cout << sum << " " << num << endl;

        if(sum < G){

            int sum1 = 100 * (rest_max+1);
            int need_problem = (G - sum + sum1 -1)/sum1;
            if(need_problem >= p[rest_max]){
                continue;
            }
            num += need_problem;
        }
        
        ans = min(ans,num);
        
    }

    cout << ans << endl;


    return 0;
}

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

int main(){ 
    int n;
    cin>>n;
    int b=0;
    vector<char> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        if(a[i]=='Y'){
            b++;
            break;
        }
    }
    if(b==0){
        cout<<"Three";
    }else{
        cout<<"Four";
    }
    return 0;
}


Measured memory_bytes: 256
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt int

func main() {
	reader.Split(bufio.ScanWords)
	_, _ = strconv.Atoi(read())
	M, _ := strconv.Atoi(read())
	ab := make(SortBy, M)

	for i := 0; i < M; i++ {
		ab[i] = make([]int, 2)

		ab[i][0], _ = strconv.Atoi(read())
		ab[i][1], _ = strconv.Atoi(read())
	}
	sort.Sort(ab)
	var broken int

	for i := 0; i < M; i++ {
		start, end := ab[i][0], ab[i][1]
		if broken <= start {
			broken = end
			ans++
		}
	}
	fmt.Println(ans)
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; 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
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy [][]int

func (a SortBy) Len() int      { return len(a) }
func (a SortBy) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool {
	return a[i][1] < a[j][1]
}

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <regex>
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pl4 = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpl4 = vector<pl4>;
using vvpl4 = vector<vpl4>;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back()
#define sz size()
#define be begin()
#define en end()
#define asn assign
#define emp empty()
#define ft front()
#define bk back()
#define clr clear()
#define ins insert
#define era erase

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rFOR(i,a,b) for(int i=(b);i>=(a);i--)
#define SORT(a) sort((a).be,(a).en)
#define rSORT(a) sort((a).rbegin(),(a).rend())
#define UNIQUE(a) (a).erase(unique((a).be,(a).en),(a).en)
#define PREVP(a) prev_permutation((a).be,(a).en)
#define NEXTP(a) next_permutation((a).be,(a).en)
#define BINS(a,b) binary_search((a).be,(a).en,(b))
#define LOWB(a,b) (lower_bound((a).be,(a).en,(b))-(a).be)
#define UPB(a,b) (upper_bound((a).be,(a).en,(b))-(a).be)
#define CNT(a,b) count((a).be,(a).en,b)
#define SUM(a) accumulate((a).be,(a).en,0)
#define REV(a) reverse((a).be,(a).en)
#define REGS(a,b) regex_search((a),regex(b))
#define REGM(a,b) regex_match((a),regex(b))
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define say(a) cout <<(a);
#define sal(a) cout <<(a)<<endl;
#define sak cout <<endl;
#define dbg(a) cout <<(#a)<<": "<<(a)<<endl;
#define a2l(a) ((ll)(a-97))
#define A2l(a) ((ll)(a-65))
#define l2a(a) ((char)(a+97))
#define l2A(a) ((char)(a+65))
#define DigN2(a) ((llabs(a)==0)?(1):((ll)(log2(double(llabs(a))))+1))
#define DigN10(a) ((llabs(a)==0)?(1):((ll)(log10(double(llabs(a))))+1))
#define Dig2(a,b) (((a)>>(b))&1)
#define Pow2(a) (1<<(a))

#define int ll

const ll MOD = 1e9+7;
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

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 min(ll a, ll b){if(a>=b) return b;if(a<b) return a;}
ll max(ll a, ll b){if(a>=b) return a;if(a<b) return b;}

ll SalV(vll v){
    say("{");
    FOR(i,0,v.sz-1){
        say(v[i]);
        if(i!=v.sz-1) say(",");
    }
    sal("}")
}

ll DigS10(ll n){
    ll m=0;
    FOR(i,0,DigN10(n)-1){
        m+=(ll)((llabs(n)%(ll)(pow(10.0,(double)(i+1))))/(ll)(pow(10.0,(double)i)));
    }
    return m;
}

ll isP(ll n){
    if(n<=1) return 0;
    FOR(i,2,(ll)sqrt(n)){
        if(n%i==0) return 0;
    }
    return 1;
}

signed main() {

    ll N,aa,chk=0;
    cin >>N;
    vll a(100010,0);
    FOR(i,0,N-1){
        cin >>aa;
            a[aa]++;
            a[aa+1]++;
            a[aa+2]++;
    }
    rSORT(a);
    sal(a[0]);

}

Measured memory_bytes: 1024
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    w = input().rstrip()
    c = Counter(w)
    for i in c.values():
        if i%2 == 1:
            print('No')
            break
    else:
        print('Yes')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
import fractions
def lcm(C,D):
    return C*D//fractions.gcd(C,D)
A,B,C,D = map(int, input().split())
b = (B - B//C - B//D + B//lcm(C,D))
a = ((A-1) - (A-1)//C- (A-1)//D + (A-1)//lcm(C,D))
print(b-a)

Measured memory_bytes: 5048
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
	int n, m;
	std::cin >> n >> m;
	while (n != 0 && m != 0) {
		int whole_price = 0;
		std::vector<int> vegi(n);
		for (auto &v : vegi) std::cin >> v;
		std::sort(vegi.begin(), vegi.end());
		for (auto i = 1; i <= n; ++i) {
			whole_price += (i % m == 0) ? 0 : vegi[n - i];
		}
		std::cout << whole_price << std::endl;
		std::cin >> n >> m;
	}
}


Measured memory_bytes: 2992
/*

        /////////  /////      ////      ///
        //        //   //    //  //  // //
        //////   //    //   //    //   //
            //  // /// //  //         //
      //////// //      // //         //
      
         

*/

#include<bits/stdc++.h>
#include<assert.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
#define Fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(0);
#define fo(i,s,n) for(int i=s;i<n;i++)
#define mod 1000000007
#define umap unordered_map
#define pb(x) push_back(x)
#define all(x) (x).begin(), (x).end()
#define lb() lower_bound()
#define ub() upper_bound()
#define PI 3.14159265
#define S second
#define F first 
//fill(all(vec), 1);to fill vector with a number
//if (S.count(key)) returns 1 if set or map contain key else return 0
ll nCr(ll n,ll r)
{
	r = min(r,n-r);
	if(r<0)
		 return 0;
	if(r == 0)
		return 1;
	ll ans = 1;
	for(ll i = 1;i<=r;i++)
	{
		ans = ans*(n-i+1)/i;
    }
	return ans;
 		
}


ll logn(int n, int r) 
{ 
     return (n > r - 1) ? 1 + logn(n / r, r) : 0; 
} 


ll power(ll a,ll b) {
	if(b == 1) return a;
	if(b == 0) return 1;
	ll m1 = power(a,b/2);
	if(b%2) return m1*m1*a;
	return m1*m1;
}


bool isprime(ll a)
{
    if(a<=1)
        return false;
    if(a==2||a==3)
        return true;
    if(a%2==0||a%3==0)
        return false;
    for(ll i=5;i*i<=a;i=i+6)
    {
        if(a%i==0||a%(i+2)==0)
            return false;
    }
    return true;

}
/*********************//*********************///*********************///*********************//
ll t;

void solve()
{
    ll n;
    cin>>n;
    ll a[n];
    map<ll,ll>mp;
    vector<ll>p;
    fo(i,0,n)
        cin>>a[i];
    fo(i,0,n)
    {
        if(mp.find(a[i])==mp.end())
        {
            p.push_back(a[i]);
        }
        mp[a[i]]++;
    }
    sort(all(p));
    ll ans=0;
    ll l=p.size();
    fo(i,0,n)
    {
        fo(j,i+1,n)
        {
            fo(k,j+1,n)
            {
                if(a[i]!=a[j]&&a[i]!=a[k]&&a[k]!=a[j])
                {
                    ll g[]={a[i],a[k],a[j]};
                    sort(g,g+3);
                    if(g[0]+g[1]>g[2])
                        ans++;
                }
            }
        }
    }
    cout<<ans<<endl;


}



int main()
{
    Fast
/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
*/
    //cin>>t;
    t=1;
    for(ll i=1;i<=t;i++)
    {
      solve();
    }

    
    return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i=0;i<(int)(n);++i)
template <typename T> ll gcd(T a, T b) {return b?gcd(b, a%b):a;}
template <typename T> ll lcm(T a, T b) {return a * b / gcd(a, b);};
template <typename T> inline void chmin(T &a, const T& b){if(a>b)a=b;}
template <typename T> inline void chmax(T &a, const T& b){if(a<b)a=b;}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int q; cin >> q;
  string before="", end="";
  bool first = true;
  for (int i = 0; i < q; ++i) {
    int t; cin >> t;
    if (t == 1) {
      first = !first;
    } else {
      int f; cin >> f;
      string c; cin >> c;
      if (f == 1) {
        if (first) {
//          s = c + s;
          before += c;
        } else {
          end += c;
//          s = s + c;
        }
      } else {
        if (first) {
          end += c;
//          s = s + c;
        } else {
          before += c;
//          s = c + s;
        }
      }
    }
  }
  reverse(before.begin(), before.end());
  s = before + s + end;
  if (!first) reverse(s.begin(), s.end());
  cout << s << '\n';
}


Measured memory_bytes: 1200
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main(){
    int a, b, c, x, cnt = 0;
    cin >> a >> b >> c >> x;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                if(500*i + 100*j + 50*k == x)cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
using namespace std;
int main()
{
	int N,ANS=0;
	vector<int> A;
	vector<int> B;
	vector<int> C;
	cin >> N;

	for (int i = 0; i < N; i++)
	{
		int t;
		cin >> t;
		A.push_back(t-1);
	}
	for (int i = 0; i < N; i++)
	{
		int t;
		cin >> t;
		B.push_back(t);
	}
	for (int i = 0; i < N-1; i++)
	{
		int t;
		cin >> t;
		C.push_back(t);
	}
	ANS = ANS + B[A[0]];

	for (int i = 1; i < N; i++)
	{
		if (A[i] == A[i-1]+1)
		{
			ANS = ANS + C[A[i-1]];
		}
		ANS = ANS + B[A[i]];
	}
	cout << ANS << endl;

}

Measured memory_bytes: 256
MOD=10**9+7
N=int(input())
A=list(map(int,input().split()))
cum=[0]*(N+1)
for i in range(N):
    cum[i+1]=(cum[i]+A[i])%MOD

ans=0
for i in range(N):
    res=(cum[N]-cum[i+1]+MOD)%MOD*A[i]%MOD
    ans=(ans+res)%MOD
print(ans)

Measured memory_bytes: 105244
use proconio::input;

fn main() {
  input! {
    n: usize,
    m: usize,
    mut ms: [isize;m]
  }
  
  if m <= n {
    println!("0");
    return
  }
    
  ms.sort();
  if n == 1 {
    println!("{}", (ms.last().unwrap() - ms.first().unwrap()).abs());
    return
  }
  
  let mut between: Vec<isize> = vec![0;m-1];
  for i in 0..m-1 {
    let v = ms[i];
    between[i] = (ms[i+1] - ms[i]).abs();
  }
  between.sort();
  
  for _ in 0..n-1 {
    between.pop();
  }
  
  println!("{}", between.iter().sum::<isize>());
}

Measured memory_bytes: 4368
#include<stdio.h>

int main(){
  int num,i,j;
  char room[]={'0','1','2','3','5','7','8','9'};

  while(scanf("%d",&num),num!=0){
    char ans[11]={};
    for(i=0;num;num/=8){
      ans[i]=room[num%8];
      i++;
    }
    for(j=i-1;j>=0;j--)
      printf("%c",ans[j]);
    putchar('\n');
  }

  return 0;
}

Measured memory_bytes: 576
#include <bits/stdc++.h>
#define int long long

int sumofdigits(int x) {
  int sum = 0;
  while (x > 0) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}

void PrintMap(std::map<int, int>& m) {
  for (auto iter: m) {
    std::cout << iter.first << " => " << iter.second << "\n";
  }
}

signed main() {
  int n, k;
  std::cin >> n >> k;
  std::map<int, int> count;
  int a;
  for (int i = 0; i < n; i++) {
    std::cin >> a;
    if (count.find(a) != count.end()) {
      count.at(a) += 1;
    } else {
      count[a] = 1;
    }
  }

  std::vector<int> vec(count.size());
  int i = 0;
  for (auto iter: count) {
    vec.at(i) = iter.second;
    i++;
  }
  std::sort(vec.begin(), vec.end());

  int total = 0;
  for (int j = 0; j < (int)vec.size() - k; j++) {
    total += vec.at(j);
  }
  
  std::cout << total << '\n';
  return 0;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD =  998244353;
//

     signed main(){
       int n,x,y;
       cin>>n>>x>>y;x--;y--;
       int ans[n]={},dp[n][n];
       for(int i=0;i<n;i++)for(int j=i+1;j<n;j++){
            ans[min(abs(i-j),min(abs(i-x)+abs(j-y),abs(i-y)+abs(j-x))+1)]++;
       }
       for(int i=1;i<n;i++)cout<<ans[i]<<endl;
     

   }
         


        


Measured memory_bytes: 256
#include <stdio.h>
#include <sstream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
#include <ctype.h>
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, char> pic;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; 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;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

ll bit[200010];
int max_n = 200000;
int pm = 0;
void add(int x) {

	while (max_n >= x)
	{
		bit[x]++;
		x += x & -x;
	}
}
void sub(int x) {
	while (max_n >= x)
	{
		bit[x]--;
		x += x & -x;
	}
}


void solv() {
	string s;
	getline(cin, s);

	stringstream ss(s);

	stack<int> st;

	while (ss >> s)
	{
		if (s == "+" || s == "-" || s == "*") {
			int l = st.top();
			st.pop();
			int r = st.top();
			st.pop();
			if (s == "+") r += l;
			if (s == "-") r -= l;
			if (s == "*") r *= l;
			st.push(r);
		}
		else {
			st.push(stoi(s));
		}
	}
	cout << st.top() << endl;
}
int main() {
	//	COMinit();
	solv();
	return 0;
}



Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main() {
	int a,b;
  	cin >> a >> b;
  	if(a >= 1 && a <= 9 && b >= 1 && b <= 9) {
    	cout << a * b << endl;
    } else cout << "-1" << endl;
  	return 0;
}

Measured memory_bytes: 256
d[4][1<<16];*s=*d,*t=d+1;w;c;f;p=2e4;i;main(a){s[p]=d[2][p]=1;do{if(a=getchar()-70){for(i=1e4;i<3e4;i++)t[i-c]|=s[i]&&f,t[i+c]|=s[i];w=2-w;s=d[w+f%2];memset(t=d[w?++f%2+w:-~f%2+w],0,2e5);c=-1;}c++;}while(a>=0);scanf("%d%d",&a,&c);puts(d[f%2][p+a]&&d[2+(f+!!w&1)][p+c]?"Yes":"No");}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  string s;
  cin >> s;
  for (int i = 0; i < 26; i++) {
    bool no = false;
    for (int j = 0; j < s.size(); j++) {
      if (s[j] == 'a' + i) no = true;
    }
    if (no) continue;
    cout << char('a' + i) << endl;
    return 0;
  }
  cout << "None" << endl;

  return 0;
}

Measured memory_bytes: 512
from math import ceil
import sys
n = int(input())

k = ceil((2 * n) ** 0.5)
if k * (k - 1) // 2 != n:
    print('No')
    sys.exit(0)

S = [[] for _ in range(k)]
a = 1
for i in range(k):
    for j in range(i + 1, k):
        S[i].append(a)
        S[j].append(a)
        a += 1

print('Yes')
print(k)
for i in range(k):
    print(len(S[i]), *S[i], sep = ' ')

Measured memory_bytes: 14372
#include<iostream>

using namespace std;

int main(){
	int busa, busb, traina, trainb;
	cin >>busa >> busb;
	cin >> traina >> trainb;
	int bus;
	if (busa < busb)
	{
		bus = busa;
	}
	else
	{
		bus = busb;
	}
	int train;
	if (traina < trainb)
	{
		train = traina;
	}
	else
	{
		train = trainb;
	}
	cout << bus + train << endl;
	
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int H,W;
	while(1){
	cin>>H>>W;
	if(H==0&&W==0){
			break;
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(i==0||i==H-1||j==0||j==W-1){
				cout<<"#";
			}
			else{
				cout<<".";
				
			}
		}
	    cout<<endl;
	}
	cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int h, w;
    ll mod = 1e9 + 7;
    cin >> h >> w;
    vector<string> arr;
    string s;
    for(int i = 0; i < h; i++) {
        cin >> s;
        arr.push_back(s);
    }
    vector<vector<ll>> dp(h, vector<ll>(w, 0));
    dp[0][0] = 1;
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            if (arr[i][j] == '.') {
                if (i - 1 >= 0)
                    dp[i][j] += dp[i-1][j];
                if (j - 1 >= 0)
                    dp[i][j] += dp[i][j-1];
                dp[i][j] %= mod;
            }
        }
    }
    cout << dp.back().back() << endl;
    return 0;
}



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

using namespace std ;

const int MAX = 1e5 + 10 ;

int arr[MAX] ;
int l , r , d ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>l>>r>>d ;
	return cout<<r/d - (l-1) / d<<"\n" , 0 ;
}		

Measured memory_bytes: 3572
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n = INT()
xy = [LIST() for _ in range(n)]
c = list(permutations(xy, n))
ans = 0
for i in range(len(c)):
    for j in range(1, n):
        ans += sqrt((c[i][j][0] - c[i][j - 1][0]) ** 2 + (c[i][j][1] - c[i][j - 1][1]) ** 2)
ans /= len(c)
print(ans)

Measured memory_bytes: 66284
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];
#define sq(n) (n)*(n)

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    string s;
    cin>>s;
    rep(i,s.length()){
        rep(j,s.length()){
            if(i+j>s.length())continue;
            string t=s.substr(0,i)+s.substr(i+j,s.length());
            if(t=="keyence"){
                cout<<"YES"<<endl;
                return;
            }
        }
    }
    cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline int rd_int(void){
  int x;
  rd(x);
  return x;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int K;
int main(){
  int i;
  int res = 0;
  rd(N);
  rd(K);
  for(i=(0);i<(N);i++){
    if(K <= rd_int()){
      res++;
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190929-1

// --- original code ---
// int N, K;
// {
//   int res = 0;
//   rd(N,K);
//   rep(i,N) if(K <= rd_int()) res++;
//   wt(res);
// }


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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    ll N;
    cin >> N;

    map<string, ll> mp;

    ll mx = -1;
    for(ll i = 0; i < N; i++){
        string s;
        cin >> s;
        mp[s]++;
        mx = max(mp[s], mx);
    }

    ll cn = 0;
    ll idx = 0;
    //ここになにか入力
    map<string, ll> mp2;
    auto begin = mp.begin(), end = mp.end();
    for (auto iter = begin; iter != end; iter++) {
           if(iter->second == mx){
                mp2[iter->first]++;
            }
        idx++;
    }  

    //cout << 0 << endl;
    auto begin2 = mp2.begin(), end2 = mp2.end();
    for (auto iter = begin2; iter != end2; iter++) {
        cout << iter->first << endl;
    } 





}


Measured memory_bytes: 37760
coins = reverse $ map (\i -> i*i) [1..17]

ans :: [Int] -> Int -> Int
ans _ 0 = 1
ans [1] n = 1
ans (c:cs) v =
  let a = v `div` c
      s = [0 .. a]
  in
    sum $ map (\n -> ans cs (v - c*n)) s

main = do
  c <- getContents
  let i = takeWhile (/= 0) $ map read $ lines c
      o = map (ans coins) i
  mapM_ print o
  



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

typedef long long ll;
typedef long double ld;

#define test(t) int t;cin>>t;while(t--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
const int MOD = 1e9+7,MAX = 1e5+5;
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
ll modInv(ll a)
{
	return powN(a,MOD-2);
}


int main()
{
	int a,b;
	cin>>a>>b;
	cout<<(a-2*b>0?a-2*b:0)<<endl;
}

Measured memory_bytes: 256
#author : dokueki

import sys
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)-1
sys.setrecursionlimit(10**7)
mod = 1000000007


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    k = int(sys.stdin.readline())
    a, b = map(int, sys.stdin.readline().split())
    for i in range(a, b + 1):
        if i % k == 0:
            print("OK")
            break
    else:
        print("NG")


if __name__ == "__main__":
    try:
        IOE()
    except:
        pass
    main()


Measured memory_bytes: 62056
from sys import exit
from itertools import accumulate,chain
n,*s=open(0).read().split()
t=[2*i.count("(")-len(i) for i in s]
if sum(t)!=0:
    print("No");exit()
st=[[min(accumulate(s_,lambda a,b: a+(1 if b=="(" else -1),initial=0)),t_] for s_,t_ in zip(s,t)]
now=0
for c in chain(sorted([x for x in st if x[1]>=0])[::-1],sorted([x for x in st if x[1]<0],key=lambda z:z[1]-z[0])[::-1]):
    if now+c[0]<0:
        print("No");exit()
    now+=c[1]
print("Yes")

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

int main()
{
	int i;
	cin >> i;
	
	if (i>88) {
		cout << "Yes" <<endl;
		return 0;
	}
	
	i = i % 10;
	
	if (i == 9) {
		cout << "Yes" <<endl;
	}else{
		cout << "No" <<endl;
	}
    return 0;
}

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

int main(){
    //input
    int n;
    cin >> n;
    vector<int> h(n);
    for(auto& i : h){
        cin >> i;
    }
    //calculate
    int max = 0;
    int tmp_max = 0;
    for(int i=0; i+1<n; i++){
        if(h.at(i) >= h.at(i+1)){
            tmp_max++;
          	max = ((max <= tmp_max) ? tmp_max : max);
        }
        else{
          	tmp_max = 0;
        }
    }
    //output
    cout << max << endl;
}


Measured memory_bytes: 640
//http://abc057.contest.atcoder.jp/tasks/abc057_b

#include <bits/stdc++.h>

using namespace std;

signed main(signed arg, char *args[])
{
    int n,m,a[50],b[50],c[50],d[50];
    int cp,dis,dmin;

    cin>>n>>m;

    for(int i=0;i<n;i++) cin>>a[i]>>b[i];
    for(int i=0;i<m;i++) cin>>c[i]>>d[i];
 
    for(int i=0;i<n;i++){
        dmin=0x7FFFFFFF;
        for(int j=0;j<m;j++){
            dis=fabs(c[j]-a[i])+fabs(d[j]-b[i]);
            if(dis<dmin){
                dmin=dis;
                cp=j+1;
            }
        }
        cout<<cp<<endl;
    }
}


Measured memory_bytes: 256
#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 k, x;
    cin >> k >> x;

    int left_edge = x - k + 1;
    int right_edge = x + k - 1;

    if ( left_edge < -1000000 ) {
        left_edge = -1000000;
    }
    if ( right_edge > 1000000 ) {
        right_edge = 1000000;
    }

    for ( int i = left_edge; i <= right_edge; i++ ) {
        cout << i << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <cmath>
#include <iterator>
#include <math.h>
#include <cstdio>
#include <map>

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;

int main(void){
    vector<int> a;
    int roop,stk,co = 0;
    cin >> roop;
    for(int i=0;i<roop;i++){
        cin >> stk;
        if(count(a.begin(),a.end(),stk) == 0){
            a.push_back(stk);
            co++;
        }
    }
    cout << co << endl;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#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 ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(n,x);
  Vi A(n);
  VIN(A)
  M amap;
  REP(i,n){
    amap[A[i]]++;
  }
  Vi elem;
  for(auto p: amap){
    elem.pb(p.second);
  }
  int sumv = VSUM(elem);
  RSORT(elem);
  REP(i,x){
    if(i >= elem.size()) break;
    sumv -= elem[i];
  }
  OUT(sumv);
}

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

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
           
#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
    int k, c[5000];
    while (scanf("%d", &k), k)
    {
	int n = k*(k-1)/2;
	rep (i, n)
	    scanf("%d", c + i);
	printf("%d\n", accumulate(c, c + n, 0) / (k - 1));
    }
}

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

int C2(int n)
{
    if (n < 2) {
        return 0;
    } else {
        return (n*(n-1)) / 2;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    cout << C2(n) + C2(m) << endl;

}



Measured memory_bytes: 256
K = int(input())
a = []
a.append(7%K)
for i in range(1, K+1):
    a.append((a[-1]*10 + 7) % K)
for i in range(K+1):
    if a[i] == 0:
        print(i+1)
        break
else:
    print(-1)

Measured memory_bytes: 48336
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/abc125/tasks/abc125_c
//ポイント：ある点を境に左右に分けるという発想

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL gcd(LL a,LL b) { return b?gcd(b,a%b):a;}
LL lcm(LL a,LL b) { return a/gcd(a,b)*b;}

LL N,M;
LL A[200000];

LL ans = 0;

void solve(){
	//A[0]~A[left]までの最大公約数をleft_gcd[left]とおく
	vector<LL> left_gcd(N,A[0]);
	for(int i=1;i<N;i++) left_gcd[i] = gcd(left_gcd[i-1],A[i]);
	//A[right]~A[N-1]までの最大公約数をright_gcd[right]とおく
	vector<LL> right_gcd(N,A[N-1]);
	for(int i=N-2;i>=0;i--) right_gcd[i] = gcd(right_gcd[i+1],A[i]);

	//仮にA[i]を書き換える対象だとする
	for(int i=0;i<N;i++){
		LL both_side_gcd;//A[i]を除いたA全体のgcdを見る
		if(i==0) both_side_gcd = right_gcd[1];
		else if(i==N-1) both_side_gcd = left_gcd[N-2];
		else both_side_gcd = gcd(left_gcd[i-1],right_gcd[i+1]);
		ans = max(ans,both_side_gcd);
	}
}
 
int main(){
    cin >> N;
    for(int i=0;i<N;i++) cin >> A[i];
 
    solve();
 
    cout << ans << endl;
    return 0;
}

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

int main() {
	int x,a,b;
	cin>>x>>a>>b;
	if(a>=b)
	cout<<"delicious"<<endl;
	else
	{
		if(b-a<=x)
		cout<<"safe"<<endl;
		else
		cout<<"dangerous"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
//abc111_a.cpp
//Sat Sep 29 20:23:33 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	string s;
	cin >> s;

	for (int i=0;i<3;i++){
		if (s[i] == '1'){
			s[i] = '9';
		}else if (s[i] == '9'){
			s[i] = '1';
		}
	}


	cout << s << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,sum=0;
  cin>>n;
  int d[n];
  for(int i=0;i<n;i++)
  {
    cin>>d[i];
  }
  for(int i=0;i<n;i++)
  {
    for(int j=i+1;j<n;j++)
    {
      sum+=d[i]*d[j];
    }
  }
  cout<<sum;
  return 0;
}

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

int main()
{
    int mod=1e9+7;
    int s;
    cin>>s;
    int dp[2001]={0};
    dp[3]=dp[4]=dp[5]=1;
    for(int i=6;i<=s;i++)
    {
        dp[i]=1;
        for(int j=3;j<=i-3;j++)
            dp[i]=(dp[i]+dp[j])%mod;
    }
    cout<<dp[s];
}

Measured memory_bytes: 3608