akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <atcoder/dsu>
using namespace std;
using namespace atcoder;

int main() {
    int n;
    cin >> n;
    vector<int> x(n), y(n), z(n), r(n), ans(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        x[i]--; y[i]--;
        z[x[i]] = y[i];
        r[x[i]] = i;
    }
    dsu t(n);
    vector<int> q;
    int l = n, l_index = -1;
    for (int i = 0; i < n; i++) {
        if (z[i] < l) {
            l = z[i];
            l_index = i;
        } else {
            while (not q.empty() and z[q.back()] < z[i]) {
                t.merge(q.back(), i);
                q.pop_back();
            }
        }
        q.push_back(l_index);
    }
    for (int i = 0; i < n; i++) {
        ans[r[i]] = t.size(i);
    }
    for (int i = 0; i < n; i++) {
        cout << ans[i] << "\n";
    }
}


Measured memory_bytes: 8072
#lang racket

(define (add-list u v)
  (if (or (null? u) (null? v))
      null
      (cons (+ (car u) (car v))
            (add-list (cdr u) (cdr v)))))


(define (sum-choose bit items init)
  (let iter ([i 0] [v items] [total init])
    (if (null? v)
        total
        (iter (+ i 1)
              (cdr v)
              (if (zero? (bitwise-and bit (arithmetic-shift 1 i)))
                  total
                  (add-list total (car v)))))))


(define (solve N M X books ans)
  (define end (arithmetic-shift 1 N))
  (define initial (make-list (+ M 1) 0))
  (define (good x) (>= x X))
  (let iter ([bit 0])
    (if (= bit end)
        (if (= ans +inf.0) -1 (inexact->exact ans))
        (let ([total (sum-choose bit books initial)])
          (set! ans (if (andmap good (cdr total))
                        (min ans (car total))
                        ans))
          (iter (+ bit 1))))))

(define (readline n)
  (if (zero? n)
      null
      (cons (read) (readline (- n 1)))))

(define (readlines n m)
  (if (zero? n)
      null
      (cons (readline m) (readlines (- n 1) m))))

(let* ([N (read)]
       [M (read)]
       [X (read)]
       [books (readlines N (+ M 1))])
  (display (solve N M X books +inf.0)))

Measured memory_bytes: 103328
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(int argc, const char * argv[]) {
  std::cout << std::fixed << std::setprecision(15);

  ll N; cin >> N;
  string str; cin >> str;
  ll cnt = 0;
  rep(i, 10){
    rep(j,10){
      rep(k, 10){
        string s = to_string(i) + to_string(j) + to_string(k);
        int t = 0;
        rep(p, N){
          if(s[t]  == str[p]) t++;
        }
        if(t == 3) cnt++;
      }
    }
  }

  cout << cnt << endl;
}  


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

#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;


int main(int argc, const char* argv[]) {

  int r;
  std::cin >> r;
  double cir = 2*r*3.14159265358979323846;
  std::cout << cir << std::endl;

  return 0;
}


Measured memory_bytes: 3784
include(Math)

def fibl(n)
	f0 = 0
	f1 = 2
	f = 1
	for i in 1..(n - 1)
		f0 = f1
		f1 = f
		f = f0 + f1
	end
	return f
end

puts fibl(STDIN.gets.to_i)

Measured memory_bytes: 1916
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <list>
#define debug(x) cout << #x << ": " << (x) << endl
using namespace std;

const double PI  = 3.141592653589793238463;
const int INF = 1000000007;

using ull = unsigned long long;
using ll = long long;

using Int = int;
using Double = double;

using P = pair<Int, Int>;
using V = vector<Int>;
using M = vector<V>;

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

    string x;
    cin >> x;
    cin >> x;

    cout << "A" << x[0] << "C" << endl;

    return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    for(i = k;i < n;++i){
        if(a.at(i) > a.at(i-k)) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 4844
import java.util.*;
public class Main {
	//定義関数から参照できる変数定義はこの辺
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		int N =sc.nextInt();
		long sum = 0;
		for(int i=1;i<=N;i++){
			if ((i%3)!=0) {
				if ((i%5)!=0) {
					sum=sum+i;
				}
				
			}
		}




		System.out.println(sum);
		//System.out.print(ans);
    }
}

Measured memory_bytes: 27232
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	trees := make([]Tree, n)
	display := make([]int, n)

	for i := 0; i < n; i++ {
		trees[i].p = -1
		trees[i].l = -1
		trees[i].r = -1
	}
	for i := 0; i < n; i++ {
		id := getNextInt(scanner)
		trees[id].l = getNextInt(scanner)
		trees[id].r = getNextInt(scanner)
		if trees[id].l != -1 {
			trees[trees[id].l].p = id
		}
		if trees[id].r != -1 {
			trees[trees[id].r].p = id
		}
	}

	for i := 0; i < n; i++ {
		if trees[i].p == -1 {
			fmt.Fprintln(writer, "Preorder")
			preorder(trees, i, 0, display)
			fmt.Fprintln(writer, show(display))
			fmt.Fprintln(writer, "Inorder")
			inorder(trees, i, 0, display)
			fmt.Fprintln(writer, show(display))
			fmt.Fprintln(writer, "Postorder")
			postorder(trees, i, 0, display)
			fmt.Fprintln(writer, show(display))
			break
		}
	}

	writer.Flush()
}

type Tree struct {
	p int
	l int
	r int
}

func show(display []int) string {
	n := len(display)
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		ss[i] = fmt.Sprintf(" %d", display[i])
	}
	return strings.Join(ss, "")
}

func preorder(trees []Tree, i, count int, disp []int) int {
	if i == -1 {
		return count
	}
	disp[count] = i
	count++
	return preorder(trees, trees[i].r, preorder(trees, trees[i].l, count, disp), disp)
}

func inorder(trees []Tree, i, count int, disp []int) int {
	if i == -1 {
		return count
	}
	count = inorder(trees, trees[i].l, count, disp)
	disp[count] = i
	count++
	return inorder(trees, trees[i].r, count, disp)
}

func postorder(trees []Tree, i, count int, disp []int) int {
	if i == -1 {
		return count
	}
	count = postorder(trees, trees[i].r, postorder(trees, trees[i].l, count, disp), disp)
	disp[count] = i
	count++
	return count
}



Measured memory_bytes: 1160
use proconio::input;

const A: usize = 1000_000;

fn main() {
    input! { n: usize }
    let mut a = vec![0; n];
    let mut ac = vec![0; A + 1];
    for i in 0..n {
        input! { ai: usize }
        a[i] = ai;
        ac[ai] += 1;
    }

    let mut pc = true;
    for i in 2..=A {
        let mut c = 0;
        for j in (i..=A).step_by(i) {
            c += ac[j];
        }
        if c > 1 {
            pc = false;
            break;
        }
    }

    println!("{} coprime", if pc {
        "pairwise"
    } else {
        let mut v = a[0];
        for i in 1..n {
            v = num_integer::gcd(a[i], v);
        }
        if v == 1 {
            "setwise"
        } else {
            "not"
        }
    });
}


Measured memory_bytes: 20472
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;
string s, t;
int main() {
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

int main()
{
int N;string S;
scanf("%d\n",&N);
cin>>S;int x=0;int ans=0;
for(int i=0;i<S.size();i++)
{
  if(S[i]=='I')x++;
  else x--;
  ans=max(ans,x);
}
printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	char str[5];
	scanf("%s", str);
	int i;
	int Ans = 0;
	
	for(i = 0; i < 4; i++){
		if(str[i] == '+'){
			Ans ++;
		} else{
			Ans --;
		}
	}
	
	printf("%d", Ans);
	
	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while(true) {
            try{
            String[] line = br.readLine().split(" ");
            int length = String.valueOf(Integer.parseInt(line[0]) + Integer.parseInt(line[1])).length(); 
            System.out.println(length);
            }catch(NullPointerException e) {
                break;
            }
        }
    }
}

Measured memory_bytes: 17008
import collections,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M = LI()
ans = 1
def prime_factor(num):
    prime_factor = collections.defaultdict(int)
    for i in range(2,int(num**0.5)+1):
        while num%i==0:
            prime_factor[i] += 1
            num //= i
    if num>1:
        prime_factor[num]=1
    return prime_factor
def nCr(n,r,mod):
    comb_count = 1
    for i in range(r):
        comb_count *= n-i
        comb_count %= mod
    for j in range(1,r+1):
        comb_count *= pow(j,mod-2,mod)
        comb_count %= mod
    return comb_count
for v in prime_factor(M).values():
    ans *= nCr(v+N-1,v,10**9+7)
    ans %= 10**9+7
print(ans)


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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)
#define repR(i,s,n) for(ll i = (n-1); i >= (s); i--)
#define repR0(i,n) repR(i,0,n)
#define repR1(i,n) repR(i,1,n+1)

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;
#define fcout cout << fixed << setprecision(18)

int cells[8][8] = {}; // r * c
int Qini[8] = {}, Q[8], ans[8];

bool check (int r, int c) {
  if (cells[r][c] == -2) return false;
  Q[r] = c;
  if (r < 7) {
    bool temp = false;
    rep0(i, 8) if (check(r + 1, i)) temp = true;
    if (!temp) return false;

  } else {

    bool temp = true;
    vector<int> cnt0(8, 0);
    rep0(i, 8) {
      if (!temp) break;
      cnt0[Q[i]]++;
      if (cnt0[Q[i]] > 1) temp = false;
    }
    vector<int> cnt1(16, 0);
    rep0(i, 8) {
      if (!temp) break;
      cnt1[Q[i] + i]++;
      if (cnt1[Q[i] + i] > 1) temp = false;
    }
    vector<int> cnt2(16, 0);
    rep0(i, 8) {
      if (!temp) break;
      cnt2[Q[i] - i + 7]++;
      if (cnt2[Q[i] - i + 7] > 1) temp = false;
    }
    if (!temp) {
      Q[r] = -1;
      return false;
    }

    rep0(i, 8) {
      rep0(j, 8) {
        if (Q[i] == j) cout << "Q";
        else cout << ".";
      }
      cout << BR;
    }
  }
  return true;
}

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

  rep0(i, 8) Q[i] = -1;

  rep0(j, N) {
    int r, c;
    cin >> r >> c;
    rep0(i, 8) {
      cells[r][i] = -2;
      cells[i][c] = -2;
    }
    rep(i, -7, 8) {
      if (r + i >= 0 && r + i <= 7 && c + i >= 0 && c + i <= 7)
        cells[r + i][c + i] = -2;
      if (r + i >= 0 && r + i <= 7 && c - i >= 0 && c - i <= 7)
        cells[r + i][c - i] = -2;
    }
    cells[r][c] = -1;
  }

  rep0(i, 8) {
    if (check(0, i)) break;
  }

  // rep0(i, 8) {
  //   rep0(j, 8) {
  //     if (abs(cells[i][j]) == 1) cout << "Q";
  //     else if (abs(cells[i][j]) == 2) cout << "x";
  //     else cout << ".";
  //   }
  //   cout << BR;
  // }
  return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int MOD = (int)1e9 + 7;
const int INF = 1LL << 60;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B;
    char op;
    cin >> A >> op >> B;
    if (op == '+'){
        cout << A+B << endl;
    }else{
        cout << A-B << endl;
    }
}

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

int main() {
    int N, K, num = 0;
    cin >> N >> K;

    for (int i = 0; i < N; i++) {
        int x;
        cin >> x;
        if (K - x > x) {
            num += x * 2;
        }
        else {
            num += (K-x) * 2;
        }
    }
    cout << num << endl;
}


Measured memory_bytes: 256
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL 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; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

int a, b;

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

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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)
        {
            int[] f_data = Console.ReadLine().Split().Select(c => int.Parse(c)).ToArray();
            var ans = 0;
            if (f_data[0] % f_data[1] != 0) ans = (f_data[0] / f_data[1]+1 ) * f_data[2];
            else ans = (f_data[0] / f_data[1] ) * f_data[2];
            Console.WriteLine(ans);





        }

        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }
        
        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }

        public static long Gcd(long a, long b)
        {
            long x = Math.Max(a, b);
            long y = Math.Min(a, b);
            if (x % y == 0) return y;
            else return Gcd(y, x % y);
        }
    }
}


Measured memory_bytes: 28268
#include <iostream>
using namespace std;
 
int main(void){
 
    int a[]{1,3,5,7,8,10,12},b[]={4,6,9,11},c=2;
    int x,y;
    cin>>x>>y;
    
    bool xt=false,yt=false;
    for(int i=0;i<sizeof(a) / sizeof(int);i++){
        if(x==a[i]){
            xt=true;
        }
        if(y==a[i]){
            yt=true;
        }
        if(xt==true&&yt==true){
            break;
        }
    }
    if(xt==false||yt==false){
        xt=false,yt=false;
        for(int i=0;i<sizeof(b) / sizeof(int);i++){
            if(x==b[i]){
                xt=true;
            }
            if(y==b[i]){
                yt=true;
            }
            if(xt==true&&yt==true){
                break;
            }
        }
    }
    if(xt==false||yt==false){
        if(x==c&&y==c){
            xt=true,yt=true;
        }
    }
    
    if(xt==true&&yt==true){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
 
}


Measured memory_bytes: 256
fun main() {
    val n = readLine()!!.trim().toInt()
    val heights = readLine()!!.trim().split(' ').map(String::toInt).toIntArray()
    var result = 0L
    for (i in 1 until n) {
        if (heights[i] < heights[i - 1]) {
            result += heights[i - 1] - heights[i]
            heights[i] = heights[i - 1]
        }
    }
    println(result)
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n+1);
    rep(i,n+1) cin >> a[i];
    vector<int> b(n);
    rep(i,n) cin >> b[i];
    ll ans = 0;
    rep(i,n){
        int num = min(a[i],b[i]);
        ans += num;
        b[i] -= num;
        int num2 = min(a[i+1],b[i]);
        ans += num2;
        a[i+1] -= num2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int n,ans;
    cin>>n;
    int a[n];
    REP(i,n){
        cin>>a[i];
        if(a[i]==a[i-1]){
            a[i]=10000-i;
            ++ans;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lol long long
template<class A,class B>inline bool chmax(A &a,const B &b){return(b>a&&(a=b,true));}
template<class A,class B>inline bool chmin(A &a,const B &b){return(b<a&&(a=b,true));}
using namespace std;
lol mod=1e9+7;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ans=0;
  int sum=0;
  for(int i=0;i<5;i++){
    int a;cin >>a;
    ans+=10*(1+(a-1)/10);
    chmax(sum,10*(1+(a-1)/10)-a);
  }
  cout <<ans-sum<<'\n';
  return (0);
}

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

int main() {
  int n;
  cin >> n;
  vector<int> list(n);
  for(int i=0;i<n;i++) {
    cin >> list.at(i);
  }
  int ans=0;
  for(int i=0;i<n-1;i++) {
    for(int j=i+1;j<n;j++) {
      ans += list.at(i)*list.at(j);
    }
  }
  cout << ans << endl;
}


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

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define dis distance
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vector <int> > vvi;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);


typedef pair<int,bool> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int F;
    cin >> F;
    cout << (F - 30) / 2<< endl;
    return 0;
}



Measured memory_bytes: 3172
#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define dash 12
#endif

// Loops --------------------------------------------------------------------

#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)

// Extra --------------------------------------------------------------------

#define ull                 unsigned long long int
#define ll                  long long int
#define ld                  long double
#define endl                '\n'
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()

// Template -----------------------------------------------------------------

// multiple input
template <typename T> 
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U> 
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

const ll Mod = 2019;

void solve(ll &T)
{
    string s;
    std::cin>>s;

    ll n = s.size();
    ll ten = 1, suf = 0, ans = 0;
    vector<ll> a(Mod);
    a[suf]++;

    rloop(i,n-1,0)
    {
        suf = (suf + (s[i] - '0') * ten) % Mod;
        ten = (ten * 10) % Mod;
        ans += a[suf];
        a[suf]++;
    }
    std::cout<<ans<<"\n";
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

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

    int t = 1;
    loop(Case,1,t+1)
    {
        d(Case);
        solve(Case);
    }
    return 0;
}

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

int main() {

	string a, b, c; cin >> a >> b >> c;
	int x1 = stoi(a + b) + stoi(c);
	int x2 = stoi(b + a) + stoi(c);
	int x3 = stoi(b + c) + stoi(a);
	int x4 = stoi(c + b) + stoi(a);
	int x5 = stoi(c + a) + stoi(b);
	int x6 = stoi(a + c) + stoi(b);
	cout << max({ x1,x2,x3,x4,x5,x6 }) << endl;
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h,n;
    cin>>h>>n;
    int a[n],sum=0;

    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }

    for(int i=0;i<n;i++)
    {
        sum+=a[i];
    }

    if(sum>=h)
        cout<<"Yes\n";
    else
        cout<<"No\n";

    exit(0);

}


Measured memory_bytes: 3992
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    int c = 0;
    REP(i,n){
        int x = in();
        if (i != x - 1) c++;
    }
    cout << (c <= 2 ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        solve();
    }
    static Scanner cin;

    static string S;
    static long K;
    static void input()
    {
        cin = new Scanner();
        S = ReadLine();
        K = cin.nextLong();
    }
    static void solve()
    {
        input();
        for(int i = 0; i < Min(K, S.Length); i++)
        {
            if(S[i] != '1')
            {
                WriteLine(S[i]);
                return;
            }
        }
        WriteLine(1);
    }
    class Scanner
    {
        string[] s;
        int i;

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

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

        public int nextInt()
        {
            return int.Parse(next());
        }

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

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

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

        public double[] ArrayDounble(int N, int add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13140
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;

#define pb push_back
#define fi first
#define se second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int inf = 1e9;

template <class T>
istream& operator>>(istream& ss, vector<T>& v) {
    for (int i = 0; i < v.size(); i++) ss >> v[i];
    return ss;
}

template <class T> 
ostream& operator<<(ostream& ss, const vector<T>& v) {
    for (int i = 0; i < v.size(); i++) ss << v[i] << ' ';
    return ss;
}

ll binpow(ll a, ll n, ll m) {
    ll res = 1;
    while (n) {
        if (n & 1) {
            res *= a;
            res %= m;
        }
        a *= (a % m);
        a %= m;
        n >>= 1;
    }
    return res % m;
}

ll gcd(ll a, ll b) {
    return b ? gcd (b, a % b) : a;
}

ll lcm(ll a, ll b) {
    return a * b / gcd(a,b);
}

void solve() {
    int n;
    cin >> n;
    int d = (n % 10);
    if (d == 3) cout << "bon";
    else if (d == 2 || d == 4 || d == 5 || d == 7 || d == 9) cout << "hon";
    else cout << "pon";
}

int main() {
    speed;
    int t = 1;
    //cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; 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 ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

int main() {
    int n,m; cin >> n >> m;
    vector<int> a(n), b(n);
    REP(i,n) {
        cin >> a[i] >> b[i];
    }
    vector<vector<ll>> task(m+1);
    REP(i,n) {
        if(a[i]<=m) task[m-a[i]].emplace_back(b[i]);
    }
    priority_queue<ll> pq;
    ll ans = 0;
    REPR(i,m) {
        for(ll x : task[i]) pq.push(x);
        if(!pq.empty()) {
            ans += pq.top();
            pq.pop();
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	
	int n, m;
	cin >> n >> m;
	vector<int> x(m);
	vector<int> diff(m-1);
	rep(i, m){
		cin >> x[i];
	}
	if(m <= n){
		puts("0");
		return 0;
	}
	sort(x.begin(), x.end());
	ll ans = 0LL;
	rep(i, m-1){
		diff[i] = x[i+1] - x[i];
		ans += diff[i];
	}
	
	
	sort(diff.begin(), diff.end(), greater<int>());
	rep(i, n-1){
		ans -= diff[i];
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;

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

    
    ll r, d, x;
    cin >> r >> d >> x;
    ll ans = r * x - d;
    for (int i = 0; i < 10; i++)
    {
        cout << ans << endl;
        ans = r * ans - d;
    }
    return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll,ll> pll;


ll s;
ll m = 1000000000;
int main()
{
        cin >> s;
        if(s == m*m){
                cout << "0 0 0 1000000000 1000000000 0\n"; return 0;
        }
        if(s <= m){
                cout << "0 0 1 0 0 " << s << endl;
                return 0;
        }
        ll B = s / m;
        ll nb = (B+1)*m - s;
        cout << "0 0 " << B+1 << " " << 1 << " " << nb << " " << m << endl;
        return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int is_prime(int);
int main(void){
    int count = 0, i, n;
    int num[10000];

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

    return 0;
}
int is_prime(int num){
    int i;
    if(num == 0 || num == 1 || (num % 2 == 0 && num != 2)) return 0;
    for(i = 3; i * i <= num; i = i + 2){
        if(num % i == 0) return 0;
    }
    return 1;
}


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

template<typename T>
istream& operator >> (istream& istr, vector<T>& vec){
    for(T& x: vec) istr >> x;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& vec){
    if(!vec.empty()){
        ostr << vec.front();
        for(auto itr = ++vec.begin(); itr != vec.end(); itr++)
            ostr << "" << *itr;
    }
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    ostr << p.first << " " << p.second;
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& mat){
    if(!mat.empty()){
        ostr << mat.front();
        for(auto itr = ++mat.begin(); itr != mat.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
// vll x(n); x[i]=a;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll>> vpll;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()
// sort(all(x));

int main(){
    ll h, w, a, b;
    cin >> h >> w >> a >> b;
    if (a > w/2){
        cout << "No" << endl;
        return 0;
    }
    if (b > h/2){
        cout << "No" << endl;
        return 0;
    }

    vvll c(h,vll(w));
    REP(i,b){
        REP(j,a) c[i][j] = 1;
        REP(j,w-a) c[i][j+a] = 0;
    }
    REP(i,h-b){
        REP(j,a) c[i+b][j] = 0;
        REP(j,w-a) c[i+b][j+a] = 1;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
#define fir first
#define sec second
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc()) 
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

const int MOD = (int)(1e9 + 7);
inline void Add(int& x,int y) {
  x = x + y >= MOD ? x + y - MOD : x + y;
}
inline void Sub(int& x,int y) {
  x = x - y < 0 ? x - y + MOD : x - y;
}
int power(int a,int b) {
  int ret = 1;
  while (b) {
    if (b&1) ret = 1ll * ret * a % MOD;
    a = 1ll * a * a % MOD;
    b >>= 1;
  }
  return ret;
}

const int N = 200010;
int n, m, arr[N], acnt;
char str[N];
int dp[N];
void doit(int lim) {
  if (n%2) {
    puts("0");
    return;
  }
  lim = (lim + 1) / 2;
  rep (i, 1, n/2) {
    Add(dp[i], dp[i-1]);
    if (i-lim-1 >= 1)
      Sub(dp[i], dp[i-lim-1]);
    if (i <= lim) Add(dp[i], 2 * i);
    Add(dp[i], dp[i-1]);
  }
  int ans = dp[n/2];
  Sub(ans, dp[n/2-1]);
  printf("%d\n", ans);
}
int main() {
  read(n), read(m);
  scanf("%s", str+1);
  if (str[1] == 'R') {
    rep (i, 1, m) {
      if (str[i] == 'R') str[i] = 'B';
      else str[i] = 'R';
    }
  }
  int key = 1;
  rep (i, 2, m) if (str[i] == 'R') key = 0;
  if (key) {
    dp[0] = 1, dp[1] = 2;
    rep (i, 2, n) dp[i] = (dp[i-1] + dp[i-2]) % MOD;
    int ans = dp[n];
    if (n >= 3) Sub(ans, dp[max(0, n - 4)]);
    printf("%d\n", ans);
    return 0;
  }
  for (int i = 1, j = 0; i <= m; ++ i) {
    if (str[i] == 'B') {
      ++ j;
      if (str[i+1] == 'R' && i <= m)
	arr[++ acnt] = j;
    }
    else j = 0;
  }
  int lim = n;
  rep (i, 2, acnt) {
    if (arr[i] % 2 != 0)
      lim = min(lim, arr[i]); 
  }
  lim = min(lim, arr[1] + 1);
  doit(lim);
  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    string O, E;
    cin >> O >> E;

    rep(i,O.size()){
        cout << O[i];
        if(i+1<=E.size()) cout << E[i];
    }
    cout << endl;
}


Measured memory_bytes: 3576
#include<iostream>
using namespace std;
int main()
{
  while(true){
    int maxamnt = 0;
    char ans;
    for(int i = 0; i < 5; ++i){
      int bn,an;
      cin >> bn;
      cin >> an;
      if( an + bn == 0 ) return 0;
      if( maxamnt < an+bn ){
	maxamnt = an+bn;
	ans = 'A' + i;
      }
    }
    cout << ans << ' ' << maxamnt << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    string s;
    cin >> s;
    map<char, int> mp;
    FORE(e, s) mp[e]++;
    bool f = mp.size() == 2 && begin(mp)->second == 2 && next(begin(mp))->second == 2;
    cout << (f ? "Yes" : "No") << endl;
}


Measured memory_bytes: 764
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
///////////////////////___combination___////////////////////
vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll 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;
}

///////////////////////////////////////////////////////////
int n, x, ans;
signed main(){
  cin>>n>>x;
  rep(i,n){
    int y;cin>>y;
    ans = __gcd(ans, abs(y-x));
  }
  cout << ans << endl;
}




Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int x,n;
	int sum=0;
	scanf("%d",&n);
	x=n;
	while(n){
		
		sum+=n%10;
		
		n=n/10;
	}
	
	if ( x%sum==0)
	    printf("Yes");
	else printf("No");
	
	return 0;
}

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

int main() 
{
    bool mp[9][9];
    int n, m;
    cin >> n >> m;
    memset(mp,false,sizeof mp);
    for (int i=0; i<m; i++)
    {
        int a,b;
        cin >> a >> b;
        mp[a][b] = true;
        mp[b][a]=true;
    }
    vector<int> A;
    ll ans=0;
    for (int i=1;i<=n;i++) A.push_back(i);
    do
    {
        bool res=true;
        for (int i=0;i<n-1;i++)
        {
            if (!mp[A[i]][A[i+1]])
                res=false;
        }
        if (res) ans++;
    } while (next_permutation(A.begin()+1,A.end()));
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
int main(){
	ll n;
	cin>>n;
	stack<char> st;
	while(n!=0){
		n--;
		st.push('a'+n%26);
		n/=26;
	}
	while(!st.empty()){
		cout<<st.top();
		st.pop();
	}
	return 0;
}

Measured memory_bytes: 3624
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n, m, k = LI()
    a = LI()
    b = LI()
    a = list(itertools.accumulate(a))
    b = list(itertools.accumulate(b))
    ans = bisect_right(a, k)
    for i, bi in enumerate(b, start=1):
        if bi > k:
            break
        ans = max(ans, i + bisect_right(a, k - bi))
    print(ans)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 42348
import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
import numpy as np

def main():  
    N,M,X = map(int,input().split())
    book = np.array([input().split() for _ in range(N)],np.int32)
    ans = INF
    for bit in range(1<<N):
        ret = np.zeros(M + 1,np.int32)
        for i in range(N):
            if (bit>>i)&1:
                ret += book[i]
        if np.all(ret[1:] >= X):
            ans = min(ans,ret[0])
    print(ans if ans < INF else -1)
if __name__ == '__main__':
    main()

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

using namespace std;

int main() {

    int N;
    cin >> N;

    map<string, long long> members;

    for(int i = 0; i < N; i++) {
        string S;
        cin >> S;
        sort(S.begin(), S.end());
        members[S]++; 
    }

    long long ans = 0;

    for(auto p:members) {
        if(p.second > 1) {
            ans += p.second * (p. second - 1) / 2;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11136
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	string S; cin >> S;
	int N = S.size();

	vector<vector<int>> nex(N+1, vector<int>(26,N));
	for (int i = N-1; i >= 0; --i) {
		int k = S[i] - 'a';
		rep(j,26) nex[i][j] = nex[i+1][j];
		nex[i][k] = i;
	}

	vector<int> dp(N+1,1e9);
	dp[N] = 1;
	vector<int> cha(N+1);
	for (int i = N-1; i >= 0; --i) {
		rep(j,26) {
			if(nex[i][j]==N) {
				if (dp[i] > 1) {
					dp[i] = 1;
					cha[i] = j;
				}
			} else {
				if(chmin(dp[i],dp[nex[i][j]+1]+1)) {
					cha[i] = j;
				}
			}
		}
	}

	string ans = "";
	int cur = 0;
	while (cur < N) {
		int k = cha[cur];
		ans += char(k+'a');
		cur = nex[cur][k]+1;
	}
	cout << ans << ln;
}


Measured memory_bytes: 28564
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
 
#define CASES int t;cin>>t;while(t--)
#define REP(i, val, b) for (int i = val; i < b; ++i)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);

struct D {
    int a, b, c;
    int maxfun() {
        return max(a, max(b, c));
    }
};

int main() {
    fastio
    int n;
    cin >> n;
    vector<D> A(n);
    REP(i,0,n) cin >> A[i].a >> A[i].b >> A[i].c;
    int B[n][3];
    B[0][0] = A[0].a;
    B[0][1] = A[0].b;
    B[0][2] = A[0].c;
    REP(i,1,n) {
        B[i][0] = A[i].a + max(B[i-1][1], B[i-1][2]);
        B[i][1] = A[i].b + max(B[i-1][0], B[i-1][2]);
        B[i][2] = A[i].c + max(B[i-1][0], B[i-1][1]);
    }
    cout << max(B[n-1][0], max(B[n-1][1], B[n-1][2]));
    return 0;
}

Measured memory_bytes: 2560