akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int _i=(first);_i<(last);++_i){cout<<#a<<"["<<_i<<"] = "<<(a)[_i]<<endl;}
#define PRINTP(p)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#p<<" = ("<<(p.first)<<", "<<(p.second)<<")"<<endl;
#define PRINTI(a,i)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<#i<<"] = "<<#a<<"["<<(i)<<"] = "<<(a)[i]<<endl;
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#define PRINTP(p)
#define PRINTI(a,i)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MOD 1000000007
//#define MOD 998244353

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

template <class T>
using vec2 = vector<vector<T>>;

template <class T>
using vec3 = vector<vector<vector<T>>>;

const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

    int N, K;
    cin >> N  >> K;
    vector<int> p(N);
    REP(i, N) cin >> p[i];
    sort(all(p));
    int s = 0;
    REP(i, K) s += p[i];
    cout << s << endl;
    return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
template<class T> inline void chmin(T &a, T b){if(a>=b)a=b;}
template<class T> inline void chmax(T &a, T b){if(a<=b)a=b;}
typedef long long ll;

int N,M;
vector<vector<int> > G;
// dp[bit][v] : 訪れた頂点がbitのときのvへの道筋の数
int dp[1<<8][8];

int rec(int bit = 1,int v = 0){
    // 全部調査ずみなら
    if(bit == (1<<N)-1) return 1;
    // 行く先が全部調査済みなら行ける場所がないので１を返す
    if(dp[bit][v]) return dp[bit][v];

    int ret = 0; // 全部の頂点に行けない場合は0が帰る。
    for(auto nv : G[v]){
        if(bit & (1<<nv)) continue; // nvは調査ずみ
        // その頂点を調査済みにして一つ下の深さへ
        ret += rec(bit | (1<<nv), nv);
    }
    return dp[bit][v] = ret;
}

int main()
{
    cin >> N >> M;
    G.assign(N,vector<int>());
    REP(i,M){
        int from,to;
        cin >> from >> to;
        from--;to--;
        G[from].push_back(to);
        G[to].push_back(from);
    }
    
    cout << rec() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <functional>
#include <typeinfo>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define mp(a, b) make_pair(a, b)
#define all(vec) (vec).begin(), (vec).end()
#define yn(formula) (formula) ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(formula) (formula) ? (cout << "YES" << endl) : (cout << "NO" << endl)
#define MIN(a, b) ((a) < (b)) ? (a) : (b)

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pii> vp;
typedef vector<pll> vpl;
typedef vector<vi> vvi;
typedef vector<vll> vvl;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vp> vvp;
typedef vector<vpl> vvpl;

constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 29;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };

struct edge { ll to; ll cost; };

/*<ここから>***********************************************************/


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

	ll ans = 5000 * 100000 * 2 + 1;
	for (ll ab = 0; ab <= max(X, Y) * 2; ab += 2) {

		ll x = X - ab / 2, y = Y - ab / 2;
		ll cost = ll(ab * C);
		if (x > 0) cost += ll(x * A);
		if (y > 0) cost += ll(y * B);
		if (cost < ans)	ans = cost;
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;

using namespace std;

int main()
{
   FAST/**/
    
   ll n;
   cin>>n;
   
   ll ans = (n)*(n-1);
   ans/=2;
   cout<<ans;
   
   return 0;
}

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

int main (void){  
    char a;
    cin >> a ;
    if (a <= 'Z') {
        cout << "A" << endl;
    } else {
        cout << "a" << endl;
    } 
    return 0;
}

Measured memory_bytes: 3552
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
// constexpr ll inf = 1ll<<61;
// constexpr ll mod = 1e9+7;

signed main(){
  int n, m; cin >> n >> m;
  vi x(m);
  rep(i,n){
    int k; cin >> k;
    rep(j,k){
      int a; cin >> a;
      x[a-1]++;
    }
  }
  int ans = 0;
  rep(i,m)
    if(x[i] == n) ans++;

  cout << ans << endl;
    
}

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

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;
vll W;

ll ltmp;
string stmp;
double dtmp;
ll llmin(ll a,ll b){
    if(a>=b) return b;
    return a;
}
ll llmax(ll a,ll b){
    if(a<=b) return b;
    return a;
}
int main(){

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

    cin >> N;
    ll Wsum=0;
    rep(ni,N){
        cin >> ltmp;
        W.push_back(ltmp);
        Wsum+=ltmp;
    }

    ll ans = base10_6;
    
    ll Wsum_left=0;
    rep(ni,N){
        Wsum_left+=W[ni];
        ans = llmin(ans, abs(Wsum - Wsum_left * 2)   );

    }
    cout << ans << endl;

    

}

Measured memory_bytes: 3632
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# lcm、逆元
MOD = 10 ** 9 + 7

N = ir()
A = np.array(lr())

U = 10 ** 6 + 10
is_prime = np.zeros(U, np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
    if p*p > U:
        break
    if is_prime[p]:
        is_prime[p*p::p+p] = 0

M = 10 ** 3
small_primes = np.where(is_prime[:M])[0].tolist()

B = A.copy()
lcm = 1
for p in small_primes:
    e = 0
    while np.any(A%p == 0):
        e += 1
        A[A%p == 0] //= p
    lcm *= p ** e
    lcm %= MOD

for p in set(A.tolist()):
    lcm *= p
    lcm %= MOD

B = sum(pow(x, MOD-2, MOD) for x in B.tolist()) % MOD
B *= lcm
answer = B % MOD
print(answer % MOD)
# np.int64とint型の違いに注意

Measured memory_bytes: 21648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 998244353;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  int x;
  cin >> x;
  int ans;

  ans = 360 / gcd(360,x);
  cout << ans << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <numeric>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define INF 999999999
using namespace std;

int main(){
    int n; cin >> n;
    int rem = 0;
    int temp;
    int a[100001] = {0};
    rep(i, 1, n+1){
        cin >> temp;
        if(temp > 100000) rem += 1;
        else a[temp] += 1;
    }
//    cout << "a[0], a[1] =" << a[0] << " " << a[1] << endl;
    rep(i, 1, 100001){
        if(a[i] == 0) ;
        else if(a[i] < i) rem += a[i];
        else if(a[i] > i) rem += abs(i - a[i]);
    }

    cout << rem << endl;

    return 0;
}


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

int main(){
  int N;
  cin >> N;
  
  int even = N / 2;
  int odd = N - even;
  
  double ans = ( double )odd / (double)N;
  
  printf("%.10f", ans);
  
  return 0;
}
  
      


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

using ll = long long;

const long long mod = 998244353;

ll mod_pow(ll x, ll n) {
  if (n == 0) return 1;
  ll res = mod_pow(x * x % mod, n / 2);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> D(N);
  for (int i = 0; i < N; ++i) cin >> D[i];
  ll ans = 1;
  if (D[0] != 0) ans = 0;
  for (int i = 1; i < N; ++i) if (D[i] == 0) ans = 0;
  vector<ll> nodes(N, 0);
  for (int i = 0; i < N; ++i) ++nodes[D[i]];
  for (int i = 0; i < N - 1; ++i) {
    ans = (ans * mod_pow(nodes[i], nodes[i + 1])) % mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N, M int

func main() {
	sc.Split(bufio.ScanWords)

	N = nextInt()
	T := make([]int, N)
	sum := 0
	for i := 0; i < N; i++ {
		T[i] = nextInt()
		sum += T[i]
	}

	M = nextInt()
	for m := 0; m < M; m++ {
		i := nextInt() - 1
		x := nextInt()
		fmt.Println(sum - T[i] + x)
	}
}


Measured memory_bytes: 640
"""
子孫に向かって有向辺が伸びる
⇨ ループなし
⇨ トポロジカルソート通りに並べると親がわかる
"""
from collections import deque
from collections import defaultdict
n, m = map(int, input().split())

edges = [[] for _ in range(n)]
ps = [[] for _ in range(n)]
for i in range(n+m-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    ps[b].append(a)

def topo(G):
    cut_in = defaultdict(int)
    for vs in G:
        for v in vs:
            cut_in[v] += 1
    res = []
    # 入次数が0のものを洗い出し
    zeros = [i for i in range(n) if cut_in[i] == 0]
    q = deque(zeros)
    # すべての入次数が0になるまでくりかえす
    while len(q) > 0:
        v = q.popleft()
        res.append(v)
        for u in G[v]:
            cut_in[u] -= 1
            if cut_in[u] == 0:
                q.append(u)
    return res

ss = topo(edges)
# print(ss,ps)
ss = {s:i for i,s in enumerate(ss)}

for i in range(n):
    mn = -1
    parent = 0
    if len(ps[i]) == 0:
        print(0)
        continue
    for p in ps[i]:
        if mn < ss[p]:
            mn = ss[p]   
            parent = p
    print(parent+1)


Measured memory_bytes: 127468
from itertools import permutations as perm
n = int(input())
XY = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
	for j in range(n):
		if i == j:continue
		ab = XY[i]
		cd = XY[j]
		ans += ((ab[0]-cd[0])**2+(ab[1]-cd[1])**2)**0.5

print(ans/n)

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

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int a, b; cin >> a >> b;

  cout << (a + b + 1) / 2 << endl;
  
  return (0);
}

Measured memory_bytes: 3660
import math
import decimal
a, b, h, m = map(int, input().split())

tanshin = ((h * 60 + m) * 360 / (12 * 60))
choshin =  (m * 360 / 60) 
bcos = tanshin - choshin

# c2 = a2+b2−2abcosC
c2 = (a ** 2) + (b ** 2) - (2 * a * b * math.cos(math.radians(bcos)))

print(math.sqrt(c2))



Measured memory_bytes: 10220
function Main(input) {
	input = input.split("\n");
	var mem = input[0].split(" ").map(Number);
	var arr = input[1].split(" ").map(Number);
	var sum = 0;
	var st = -1;
	var end = -1;
	for(var i=0;i<arr.length;i++){
	    if(end<arr[i]){
	        sum += end-st;
	        st = arr[i];
	        end = arr[i]+mem[1];
	    }else{
	        end = arr[i]+mem[1];
	    }
	}
	sum += end-st;
	console.log(sum)
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 34200
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] values = new int[w];
for(int i=0;i<w;i++){
    values[i]=i+1;
}
for(int i=0;i<n;i++){
    int sub;
    String str=sc.next();
    String[] ab=str.split(",");
    int a=Integer.parseInt(ab[0])-1;
     int b=Integer.parseInt(ab[1])-1;
     sub=values[a];
values[a]=values[b];
values[b]=sub;
}
for(int i=0;i<w;i++){
    System.out.println(values[i]);
}
        }
    }
}


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

using namespace std;

int main()
{

    int n,m;

    cin>>n>>m;//a=n//b=m

    if(n==m)
    {
        cout<<"a == b\n";
    }

    else if(n>m)
        cout<<"a > b\n";

    else

        cout<<"a < b\n";

    return 0;
}



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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define repa(i, a, b) for (auto i = (a); i <= (b); i++)
#define repd(i, a, b) for (auto i = (a); i >= (b); i--)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define zero(a)  memset((a), 0, sizeof (a))
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back

constexpr auto inf = numeric_limits<int>().max() - 1;
constexpr auto llinf = numeric_limits<ll>().max() - 1LL;

template<typename ForwardIterator>
void dump(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << *it << " ";
	}
	cout << endl;
}

template<typename ForwardIterator>
void dump_map(ForwardIterator st, ForwardIterator en) {
	for (auto it = st; it != en; it++) {
		cout << (*it).first << ":" << (*it).second << " ";
	}
	cout << endl;
}
template<typename T>
void debug(initializer_list<T> list) {
  for (auto el : list) {
    cout << el << " ";
  }
  cout << endl;
}

constexpr ll mod = ll(1e9 + 7);

ll mult(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }

ll power(ll a, ll b) {
	ll result = 1LL;
	while (b) {
		if (b % 2LL) result = mult(result, a);
		a = mult(a, a);
		b /= 2LL;
	}
	return result;
}

ll divide(ll a, ll b) { return mult(a, power(b, mod - 2)); }

ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }

ll subtract(ll a, ll b) { return ((a - b) % mod + mod) % mod; }

void solve() {
  string s;
  cin >> s;
  if (s ==  "ARC") cout << "ABC";
  else cout << "ARC";
	cout << "\n";
}

#define REPEAT 0
#define CASE 0

int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	#if REPEAT
		int t;
		cin >> t;
		repa(i, 1, t) {
			#if CASE
				cout << "Case #" << i << ": ";
			#endif
			solve();
		}
	#else
		solve();
	#endif
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
    int num;
    string bl;
    int ans[4] = {0};
    while(cin >> num >> bl){
        if(bl == ",A")
                ans[0]++;
        if(bl == ",B")
                ans[1]++;
        if(bl == ",AB")
                ans[2]++;
        if(bl == ",O")
                ans[3]++;
    }
    for(int i = 0; i < 4; i++)
        cout << ans[i] << endl;
    return 0;
}

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

using namespace std ;

const int MAX = 1e5 + 10 ;
const int inf = 1e9 ;
int dp[MAX] , tree[4 * MAX] ;
map<int , int>to , last ;
int n , m;
string s ;

void update(int node , int l , int r , int idx , int val)
{
	if(idx > r || idx < l)
		return ;
	if(l == r)
	{
		tree[node] = val ;
		return ;
	}
	int mid = (l + r) >> 1 ;
	update(node << 1 , l , mid , idx , val) ;
	update(node << 1 | 1 , mid + 1 , r , idx , val) ;
	tree[node] = min(tree[node << 1] , tree[node << 1 | 1]) ;
}

int query(int node , int l , int r , int from , int to)
{
	if(to < l || from > r)
		return inf;
	if(l >= from && r <= to)
		return tree[node] ;
	int mid = (l + r) >> 1 ;
	int a = query(node << 1 , l , mid , from , to) ;
	int b = query(node << 1 | 1 , mid + 1 , r , from , to) ;
	return min(a , b) ;
}

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>m ;
	cin>>s ;
	dp[n] = 1 ;
	last[dp[n]] = n ;
	update(1 , 0 , n , n , dp[n]) ;
	for(int i = n-1 ; i >= 0 ; --i)
	{
		if(s[i] == '1')
		{
			dp[i] = inf ;
			update(1 , 0 , n , i , dp[i]) ;
			last[dp[i]] = i ;
			continue ;
		}
		dp[i] = query(1 , 0 , n , i+1 , min(n , i+m)) + 1 ;
		update(1 , 0 , n , i , dp[i]) ;
		to[i] = last[dp[i] - 1] - i;
		last[dp[i]] = i ;
	}
	if(dp[0] >= inf)
		return cout<<-1<<"\n" , 0 ;
	int cur = 0 ;
	while(cur != n)
	{
		cout<<to[cur]<<" " ;
		cur += to[cur] ;
	}
	return 0 ;
}		

Measured memory_bytes: 11344
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) (x.begin(),x.end())
using namespace std;

int main(){
ll N;
cin>>N;
vector<string> s(N);
for(ll i=0;i<N;i++){
  cin>>s[i];
}
for(ll i=0;i<N;i++){
  sort(s[i].begin(),s[i].end());
}
sort(s.begin(),s.end());
ll ans =0;
ll tmp1,tmp2,tmp3;
tmp1=1;
for(ll i=1;i<N;i++){
if(s[i]==s[i-1]){
  tmp1++;
  continue;
}
else{
  if(tmp1>1){
    ans += tmp1*(tmp1-1)/2;
  }
  tmp1=1;
}
}


if(tmp1>1){
  ans += tmp1*(tmp1-1)/2;
}



cout<<ans<<endl;

return 0;

}


Measured memory_bytes: 7296
N = int(input()) 
A = []

for i in range(N):
    A.append(int(input()))

max_A = max(A)
max_c = A.count(max_A)

for i in range(N):
    if A[i] != max_A :
        print(max_A)
    else:
        if max_c == 1:
            A[i] = 0
            print(max(A))
        else:
            print(max_A)
            


Measured memory_bytes: 12520
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int x=0,y=0;
    int t=0;
    int a,b,c;
    for(int i=1;i<=n;i++)
    {
        cin>>c>>a>>b;
        if(abs(x-a)+abs(y-b)>c-t)
        {
            cout<<"No";
            return 0;
        }
        if((abs(x-a)+abs(y-b))%2==0 &&(c-t)%2==1)
        {
            cout<<"No";
            return 0;
        }
        if((abs(x-a)+abs(y-b))%2==1 &&(c-t)%2==0)
        {
            cout<<"No";
            return 0;
        }
        x=a;
        y=b;
        t=c;
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
H,W,K = map(int,input().split())
MOD = 10**9+7

dp = [0] * W
dp[0] = 1

for i in range(H):
    dp2 = [0] * W
    for b in range(2**(W-1)):
        if '11' in bin(b): continue
        b *= 2
        for j in range(W):
            if b&(1<<j):
                dp2[j] += dp[j-1]
            elif b&(1<<(j+1)):
                dp2[j] += dp[j+1]
            else:
                dp2[j] += dp[j]
            dp2[j] %= MOD
    dp = dp2
print(dp[K-1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rg register
#define oo 0x7fffffff
#define ll long long 
#define ull unsigned ll
using namespace std;
inline int read()
{
	int out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		{
			fh=-1;
			jp=getchar();
		}
	while (jp>='0'&&jp<='9')
		{
			out=out*10+jp-'0';
			jp=getchar();
		}
	return out*fh;
}
const int MAXN=2e5+10;
int n,X;
int x[MAXN];
ull pre[MAXN];
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),X=read();
	ull ans=0;
	for(rg int i=1;i<=n;++i)
		{
			x[i]=read();
			pre[i]=pre[i-1]+1ll*x[i];
		}
	ans=1ll*X*n+5*pre[n];
	for(rg int i=1;i<n;++i)
		{
			ull res=1ll*X*i;
			if(2*i>=n)
				res=res+pre[n]*5;
			else
				{
					ull coef=7;
					int lst=n-2*i;
					res+=(pre[n]-pre[lst])*5;
					while(lst>=i)
						{
							res+=(pre[lst]-pre[lst-i])*coef;
							lst-=i;
							coef+=2;
						}
					res+=pre[lst]*coef;
				}
			ans=min(ans,res);
		}
	cout<<ans+1ll*X*n;
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<int, int> P;
typedef pair<pair<int, int>, int> PP;
typedef bitset<61> Bitset;
const ll INFL = 1LL << 60;
const ll MOD = 1000000007;
const int INF = INT_MAX;
const int MAX = 300000;
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); }
//------------------------------------------------------------------------------------------------------------------------------

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N,K;cin>>N>>K;
    int ans = 0;
    for(int i = K; i <= N+1; i++){
        ll j = i;
        ans += (j*(N-j+1)+1)%MOD;
        ans %= MOD;
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long ll;
const int N = 1e6+1;
ll a[123],s;

int main()
{
	ll k;
	cin>>k;
	if(k<=2ll*1e16)
	{
		if(k%2ll==0ll)
		{
			ll a1=k/2ll+1ll,a2=k/2ll+1ll;
			cout<<2<<endl<<a1<<" "<<a2;
		}
		else
		{
			ll a1=k/2ll+1ll,a2=k/2ll+1ll;
			a1+=2ll;a2-=1ll;;
			cout<<2<<endl<<a1<<" "<<a2;
		}
	}
	else
	{
		cout<<50<<endl;
		for(int i=1;i<=50;++i)a[i]=k/50ll;
		ll ret=k%50;
		if(!ret)
		{
			for(int i=1;i<=50;++i)cout<<a[i]+49<<" ";
			return 0;
		}
		for(ll i=49;i>=1;--i)
		if(ret%i==0ll)
		{
			for(int t=1;t<=i;++t)a[t]+=51ll*ret/i;
			for(int t=1;t<=50;++t)a[t]-=i;
			for(int t=1;t<=50;++t)
			cout<<a[t]+49<<" ";
			return 0;
		}
	}
}
/*
500000000000000000
*/

Measured memory_bytes: 256
// Problem : D - Friend Suggestions
// Contest : AtCoder Beginner Contest 157
// URL : https://atcoder.jp/contests/abc157/tasks/abc157_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

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

#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);
#define endl "\n"
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;

const int MAX = 1e5+5;
int  p[MAX],siz[MAX];
int deg[MAX];

void makeset(int n)
{
	for (int i = 1; i <= n; ++i)
	{
		p[i] = i;
		siz[i] = 1;
	}
}
int findset(int v)
{
	while(v != p[v])
	{
		v = p[v] = p[p[v]];
	}
	return v;
}
void union_(int a,int b)
{
	a = findset(a);
	b = findset(b);
	if(a != b)
	{
		if(siz[a] < siz[b])
			swap(a,b);
		p[b] = a;
		siz[a] += siz[b];
	}
}

vector<int> v[MAX];

int32_t main()
{
	IOS;
	int n, m, k;
	cin >> n >> m >> k;
	makeset(n);
	for(int i = 0; i < m; i++) {
		int x, y; cin >> x >> y;
		deg[x]++; deg[y]++;
		union_(x, y);
	}
	
	for(int i = 0; i < k; i++) {
		int x, y; cin >> x >> y;
		v[x].push_back(y);
		v[y].push_back(x);		
	}
	
	for(int i = 1; i <= n; i++) {
		int ans = siz[findset(i)] - 1 - deg[i];
		for(auto it : v[i])	{
			if(findset(it) == findset(i))
				ans--;
		}
		cout << ans <<" ";
	}
	return 0;
}


Measured memory_bytes: 9088
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main() {
#ifdef RUN_LOCAL
  ifstream in("../input.txt");
  cin.rdbuf(in.rdbuf());
#endif

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


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

  sort(a.begin(), a.end(), greater<int>());
  int sum = 0;

  for (int i = 0; i < n; ++i) {
    sum+= a[i];
  }
  for (int i = 0; i < n; ++i) {
    if (sum > a[i] * 4 * m) {
      cout << "No" << endl;
      return 0;
    }
    if (i >= m - 1) {
      break;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,ab,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s[ohara];
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,n)cin>>s[i];
    rep(i,n){
        if(s[i][Size(s[i])-1]=='A'&&s[i][0]=='B')ab++;
        else if(s[i][Size(s[i])-1]=='A')a++;
        else if(s[i][0]=='B')b++;
        rep(j,Size(s[i])-1){
            if(s[i][j]=='A'&&s[i][j+1]=='B')ans++;
        }
    }
    ans+=max(ab-1,0LL);
    if(a>=1&&ab>=1){
        ans++;
        a--;
    }
    if(b>=1&&ab>=1){
        ans++;
        b--;
    }
    ans+=min(a,b);
    Cout(ans);
    return 0;
}


Measured memory_bytes: 8576
import collections

N = int(input())
L = [input() for _ in range(N)]
result = []
c = collections.Counter(L)
mostC =  c.most_common()[0][1]

for k,v in c.items():
    if v == mostC:
        result.append(k)

result.sort()

for name in result:
    print(name)




Measured memory_bytes: 45036
n=int(input())  #数値入力 「N」だけの入力のとき
a=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
bunbo = 0

for i in range(n):
    bunbo += 1/a[i]
print(1/bunbo)    

Measured memory_bytes: 2940
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
const ll INF = 1e17;
const int MOD = 1e9 + 7;

int a[3];

int main(void) {
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	ct(a[0] + a[1]);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N, M;
    cin >> N >> M;
    vector<i_i> ans;
    //奇数は単純
    if(N&1){
        for(int l = 1, r = N-1;l < r;l++,r--){
            ans.emplace_back(l, r);
        }
    }
    //偶数は途中で変えないといけない
    else{
        bool f = false;
        for(int l = 1,r = N-1; l < r; l++, r--){
            if(!f&&r-l<=N/2){
                f = true;
                r--;
            }
            ans.emplace_back(l, r);
        }
    }
    rep(i,M){
        cout << ans[i].first << " " << ans[i].second << endl;
    }
}

Measured memory_bytes: 4248
# encoding: utf-8

import sys
from collections import deque


class Solution:
    @staticmethod
    def message_queue():
        # write your code here
        # array_length = int(input())
        _input = sys.stdin.readlines()
        task_num = int(_input[0].split()[0])
        task_time = int(_input[0].split()[1])
        total_time = 0

        task_deque = deque([{'name': i.split()[0], 'time': int(i.split()[1])} for i in _input[1:]])

        while task_deque:
            item = task_deque.popleft()
            if item['time'] <= task_time:
                total_time += item['time']
                print(item['name'], total_time)
            else:
                item['time'] -= task_time
                total_time += task_time
                task_deque.append(item)


if __name__ == '__main__':
    solution = Solution()
    solution.message_queue()

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;
const ll mod = 1e9 + 7;

ll fac[maxn], ifac[maxn];

ll modpow(ll, ll);
ll inv(ll);
ll nck(ll, ll);
void build();
void testlib();



ll n, m;
ll dp[50][maxn]; // # way to choose i factors to make v[j]
bool used[3009][3009];

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  build();
  cin>>n>>m;

  vector<ll> v;
  for (ll i=1; i*i <= m; i++) {
    if (m%i) continue;
    v.push_back(i);
    v.push_back(m/i);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(),v.end()), v.end());


  for (int i=0; i<int(v.size()); i++) {
    for (int j=0; j<int(v.size()); j++) {
      if (j>i && v[j]%v[i]==0) {
	used[i][j]=true;
      }
    }
  }

  dp[0][0] = 1;

  for (int i=0; i<33; i++) {
    for (int j=0; j<int(v.size()); j++) {
      for (int k=0; k<int(v.size()); k++) {
	if (used[j][k]) {
	  dp[i+1][k] += dp[i][j];
	  dp[i+1][k] %= mod;
	}
      }
    }
  }

  // for (int i=0; i<5; i++) {
  //   for (int j=0; j<int(v.size()); j++) {
  //     cout<<dp[i][j]<<" ";
  //   }
  //   cout<<endl;
  // }


  ll ans = 0;
  for (int i=0; i<33; i++) {
    ll cur = nck(n,i) * dp[i][int(v.size())-1];
    cur %= mod;
    ans += cur;
    ans %= mod;
  }


  cout<<ans<<endl;
  

  return 0;
}

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


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

ll inv(ll x) {
  assert(x != 0);
  return modpow(x, mod-2);
}

void build() {
  fac[0] = ifac[0] = 1;
  for (int i=1; i<maxn; i++) {
    fac[i] = fac[i-1] * i;
    fac[i] %= mod;
    ifac[i] = inv(fac[i]);
    ifac[i] %= mod;
  }
}

ll nck(ll n, ll k) {
  assert(n>=0 && k>=0);
  if (k > n) return 0;
  return (((fac[n] * ifac[k]) % mod) * ifac[n-k]) % mod;
}

void testlib() {
  assert(modpow(1,1) == 1);
  assert(modpow(4,2) == 16);
  assert(modpow(2,5) == 32);
  assert(fac[3] == 6);
  assert(nck(4,2) == 6);
  assert(nck(10,2) == 45);
}


Measured memory_bytes: 89728
N=int(input())
ld=list(map(int,input().split()))
def modpow(a,n,p):#a^n mod p
    res=1
    while n>0:
        if n&1:#１とのビット論理積が１、つまり奇数
            res=res*a%p
        a=a*a%p
        n>>=1
        #ビットの右シフト_2進数表記のnを小数点を固定して右に１桁ずらす_１桁小さくなる
    return res
if ld[0]!=0:
    print(0)

else:
    dd={}
    for i in range(N):
        if ld[i] in dd:
            dd[ld[i]]+=1
        else:
            dd[ld[i]]=1

    if dd[0]!=1:
        print(0)
    else:
        DV=998244353
        ans=1
        for i in range(0,len(dd)-1):
            #mul=dd[i]**dd[i+1]%DV
            if i in dd and i+1 in dd:
                mul=modpow(dd[i],dd[i+1],DV)
                #ans*=dd[i]**dd[i+1]
                ans*=mul
                ans%=DV
            else:
                print(0)
                break
        else:
            print(ans)


Measured memory_bytes: 19552
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  char tmp;
  int kaisu = 0;
  for(int i = 0; s.size() > i; i++){
    if(i == 0 || s.at(i) != tmp){
      tmp = s.at(i);
      if(i != 0) kaisu++;
    }
  }
  cout << kaisu << endl;
  return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//main code
int main(int argc, char const* argv[])
{
	LL n,T;
	cin >> n >> T;
	VL t(n);
	for (int i = 0; i < n; i++) {
		cin >> t[i];
	}
	LL ans = T; // 最後の人のぶん
	for (int i = 0; i < n-1; i++) {
		ans += min(T, t[i+1] - t[i]);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#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 <cstring>
#include <climits>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;

main(){
	string red,green,down,out;
	
	while(cin>>red){
		if(red=="-")break;
		cin>>green>>down;
		
		out.clear();
		int ri=0,gi=1,di=0;
		char mid=green[0];
		int c=1;
		
		while(green.size()+red.size()>out.size()+down.size()){
			if(mid==down[di]){
				++di;
				mid=red[ri];
				++ri;
			}else{
				out.push_back(mid);
				mid=green[gi];
				++gi;
			}
		}
		cout<<out<<endl;
	}
}

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

#define int           long long 
#define S             second
#define F             first
#define pb            push_back
#define all(c)        (c).begin(),(c).end()
#define rall(c)       (c).rbegin(),(c).rend() 
#define lb            lower_bound
#define si(c)         (int)((c).size())
#define lcm(a, b)      (a * (b / __gcd(a,b)))  
#define inf           (int)(1e18)
#define endl          '\n'
#define mp            make_pair
#define time(s)       (double(clock()-s)/double(CLOCKS_PER_SEC))
#define debug(args...)    _F(#args, args)
#define vi            std::vector<int>
#define pii           pair<int, int> 
#define vpi           vector<pii>

clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

template<typename T> void _F(const char *name, T arg1){ cerr << name << " = " << arg1 << endl;}
template<typename T, typename... Args> void _F(const char *names, T arg1, Args... args)
{ const char *name = strchr(names, ',');cerr.write(names, name-names) << " = " << arg1 << endl;_F(name+2, args...);}

template< typename T1, typename T2 > istream& operator>>(istream& in, pair<T1, T2> &q){ in >> q.F >> q.S; return in;}
template< typename T1, typename T2 > ostream& operator<<(ostream& out, pair<T1, T2> &q){ out << q.F << " " << q.S; return out;}
template< typename T1, typename T2 > pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F+p2.F, p1.S+p2.S};}
template< typename T1, typename T2 > pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2){ return {p1.F-p2.F, p1.S-p2.S};}
template< typename T1, typename T2 > bool operator<(pair<T1, T2> p1, pair<T1, T2> p2){ return p1 < p2 ;}

template<typename T> void Unique(vector<T> &v){
    sort(all(v)), v.resize(distance(v.begin(), unique(all(v))));
}

const int N = 2e5+1;
int par[N], siz[N];

int root(int x) {
	if(x == par[x])return x;
	return par[x] = root(par[x]);
}

void merge(int x, int y) {
	x = root(x), y = root(y);
	if(x == y)return;

	par[y] = x;
	siz[x] += siz[y];
}

void solve(int &test) {
	int n, m;
	cin >> n >> m;

	for(int i = 1; i <= n; i++) {
		par[i] = i;
		siz[i] = 1;
	}

	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		merge(x, y);
	}

	int ans = 0;

	for(int i = 1; i <= n; i++) {
		ans = max(ans, siz[i]);
	}

	cout << ans << endl;
}

signed main(){

    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);   
    start = clock(); 
  
    int test = 1;
    // cin >> test;

    cout << fixed << setprecision(2);
     
    for(int i = 1; i <= test; ++i){
        solve(i); 
    }

    cerr << time(start);
    return 0;
}

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

using namespace std;

#define int long long
using int64 = long long;
const int mod = 1e9 + 7;

struct edge
{
  int to, cost;
};

typedef vector< vector< edge > > Graph;

template < typename T = int > vector< T > Dijkstra(Graph &g, int s)
{
  typedef pair< T, int > Pi;
  vector< T > min_cost(g.size(), numeric_limits< T >::max() / 4);
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  que.emplace(0, s);
  min_cost[s] = 0;
  while(!que.empty()) {
    auto p = que.top();
    que.pop();
    if(p.first > min_cost[p.second]) continue;
    for(auto &e : g[p.second]) {
      if(p.first + e.cost >= min_cost[e.to]) continue;
      min_cost[e.to] = p.first + e.cost;
      que.emplace(min_cost[e.to], e.to);
    }
  }
  return (min_cost);
}

int N, M, S, T, A[500000], B[500000], C[500000];
vector< edge > dag1[500000], dag2[500000];

bool v[500000];
vector< int > order;

void ord(int idx, bool f)
{
  if(v[idx]++) return;
  for(auto &to : f ? dag1[idx] : dag2[idx]) ord(to.to, f);
  order.emplace_back(idx);
}

signed main()
{
  scanf("%lld %lld", &N, &M);
  scanf("%lld %lld", &S, &T);
  --S, --T;

  Graph g(N);
  for(int i = 0; i < M; i++) {
    scanf("%lld %lld %lld", &A[i], &B[i], &C[i]);
    --A[i], --B[i];
    g[A[i]].emplace_back((edge) {B[i], C[i]});
    g[B[i]].emplace_back((edge) {A[i], C[i]});
  }
  auto latte = Dijkstra< int64 >(g, S);
  auto malta = Dijkstra< int64 >(g, T);
  for(int i = 0; i < M; i++) {
    if(latte[A[i]] + malta[B[i]] + C[i] == latte[T]) {
      dag1[A[i]].emplace_back((edge) {B[i], C[i]});
      dag2[B[i]].emplace_back((edge) {A[i], C[i]});
    }
    if(latte[B[i]] + malta[A[i]] + C[i] == latte[T]) {
      dag1[B[i]].emplace_back((edge) {A[i], C[i]});
      dag2[A[i]].emplace_back((edge) {B[i], C[i]});
    }
  }

  ord(S, true);
  reverse(begin(order), end(order));
  vector< int64 > beet1(N), beet2(N);
  beet1[S] = 1;
  for(int i : order) {
    for(auto &d : dag1[i]) {
      (beet1[d.to] += beet1[i]) %= mod;
    }
  }

  order.clear();
  memset(v, false, sizeof(v));
  ord(T, false);
  reverse(begin(order), end(order));
  beet2[T] = 1;
  for(int i : order) {
    for(auto &d : dag2[i]) {
      (beet2[d.to] += beet2[i]) %= mod;
    }
  }

  int64 ret = beet1[T] * beet2[S] % mod;


  int64 sub = 0;

  for(auto &i : order) {
    for(auto &e : dag1[i]) {
      if(latte[i] * 2 < latte[T]) {
        if(latte[e.to] * 2 > latte[T]) {
          int64 ei = beet1[i] * beet2[e.to] % mod;
          sub += ei * ei % mod;
          sub %= mod;
        }
      }
    }


    if(latte[T] % 2 == 0 && latte[i] == latte[T] / 2) {
      int64 ei = beet1[i] * beet2[i] % mod;
      sub += ei * ei % mod;
      sub %= mod;
    }

  }

  cout << (ret + mod - sub) % mod << endl;


}

Measured memory_bytes: 61984
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    string S;cin>>S;
    int cnt=0;
    REP(i,S.size())if(S[i]=='o')cnt++;
    cout<<(cnt>=8||((15-S.size())+cnt)>=8?"YES":"NO")<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>

using namespace std;
using ll = long long;

int main(){
    int h,w;cin>>h>>w;
    string s[h];
    for(int i=0;i<h;i++){
        cin>>s[i];
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int tmp=0;
            if(s[i][j]=='.'){
                for(int k=-1;k<=1;k++){
                    for(int l=-1;l<=1;l++){
                        if((i+k>=0&&i+k<h)&&(j+l>=0&&j+l<w)){
                            if(s[i+k][j+l]=='#'){
                                tmp++;
                            }
                        }
                    }
                }
                s[i][j]=tmp+'0';
            }
        }
    }
    
    for(int i=0;i<h;i++){
        cout<<s[i]<<endl;
    }
}

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

ll max(ll a, ll b){ 
	if(a >= b) return a;
	else if(a < b) return b;
}
ll min(ll a, ll b){ 
	if(a <= b) return a;
	else if(a > b) return b;
}
ll gcd(ll a, ll b){
	if(b == 0) return a;
	return gcd(b, a%b);
}
ll fact(ll n){
	ll res = 1;
	rep(i, n){
		res *= i + 1;
		res =  res%((ll)(1e9 + 7));
	}
	return res;
}
ll digit(const ll n){
	ll res = 0;
	ll i = 1;
	while(n % i != n){
		res += 1;
		i *= 10;
	}
	return res;
}

int main(){
	ll a, b;
	cin >> a >> b;
	ll ans = 0;
	while( (a-1)*ans + a < b){
		ans++;
		}
	ans += 1;
	if(b == 1) ans = 0;
	cout << ans << endl;
}


Measured memory_bytes: 256